Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch Move the parameters for obs600 to obs600_autoconf.c...



details:   https://anonhg.NetBSD.org/src/rev/346a14a7e488
branches:  trunk
changeset: 791498:346a14a7e488
user:      kiyohara <kiyohara%NetBSD.org@localhost>
date:      Thu Nov 21 13:52:27 2013 +0000

description:
Move the parameters for obs600 to obs600_autoconf.c.  This parameters was set from u-boot.

diffstat:

 sys/arch/evbppc/obs405/obs600_autoconf.c |  54 ++++++++++++++++++++++++++++++-
 sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c |  41 +++++------------------
 2 files changed, 62 insertions(+), 33 deletions(-)

diffs (153 lines):

diff -r 31bcf01fd255 -r 346a14a7e488 sys/arch/evbppc/obs405/obs600_autoconf.c
--- a/sys/arch/evbppc/obs405/obs600_autoconf.c  Thu Nov 21 13:41:10 2013 +0000
+++ b/sys/arch/evbppc/obs405/obs600_autoconf.c  Thu Nov 21 13:52:27 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: obs600_autoconf.c,v 1.6 2012/01/10 12:17:20 kiyohara Exp $     */
+/*     $NetBSD: obs600_autoconf.c,v 1.7 2013/11/21 13:52:27 kiyohara Exp $     */
 
 /*
  * Copyright 2004 Shigeyuki Fukushima.
@@ -33,7 +33,9 @@
  * DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: obs600_autoconf.c,v 1.6 2012/01/10 12:17:20 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: obs600_autoconf.c,v 1.7 2013/11/21 13:52:27 kiyohara Exp $");
+
+#include "dwctwo.h"
 
 #include <sys/systm.h>
 #include <sys/device.h>
@@ -47,6 +49,44 @@
 
 #include <dev/ic/comreg.h>
 
+#if NDWCTWO > 0
+#include <dev/usb/usb.h>
+#include <dev/usb/usbdi.h>
+#include <dev/usb/usbdivar.h>
+
+#include <dwc2/dwc2.h>
+#include "dwc2_core.h"
+
+/* This parameters was set from u-boot. */
+static struct dwc2_core_params dwctwo_obs600_params = {
+       .otg_cap                        = 0,    /* HNP/SRP capable */
+       .otg_ver                        = 0,    /* 1.3 */
+       .dma_enable                     = 1,
+       .dma_desc_enable                = 0,
+       .speed                          = 0,    /* High Speed */
+       .enable_dynamic_fifo            = 1,
+       .en_multiple_tx_fifo            = 0,
+       .host_rx_fifo_size              = 531,  /* 531 DWORDs */
+       .host_nperio_tx_fifo_size       = 256,  /* 256 DWORDs */
+       .host_perio_tx_fifo_size        = 256,  /* 256 DWORDs */
+       .max_transfer_size              = 524287,
+       .max_packet_count               = 1023,
+       .host_channels                  = 4,
+       .phy_type                       = 2,    /* ULPI */
+       .phy_utmi_width                 = 8,    /* 8 bits */
+       .phy_ulpi_ddr                   = 0,    /* Single */
+       .phy_ulpi_ext_vbus              = 0,
+       .i2c_enable                     = 0,
+       .ulpi_fs_ls                     = 0,
+       .host_support_fs_ls_low_power   = 0,
+       .host_ls_low_power_phy_clk      = 0,    /* 48 MHz */
+       .ts_dline                       = 0,
+       .reload_ctl                     = 0,
+       .ahbcfg                         = 0x10,
+       .uframe_sched                   = 1,
+};
+#endif
+
 
 /*
  * Determine device configuration for a machine.
@@ -80,5 +120,15 @@
 device_register(device_t dev, void *aux)
 {
 
+#if NDWCTWO > 0
+       if (device_is_a(dev, "dwctwo")) {
+               prop_dictionary_t dict = device_properties(dev);
+
+               prop_dictionary_set_uint32(dict, "params",
+                   (uint32_t)&dwctwo_obs600_params);
+               return;
+       }
+#endif
+
        obs405_device_register(dev, aux, OBS600_COM_FREQ);
 }
diff -r 31bcf01fd255 -r 346a14a7e488 sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c
--- a/sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c  Thu Nov 21 13:41:10 2013 +0000
+++ b/sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c  Thu Nov 21 13:52:27 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dwctwo_plb.c,v 1.1 2013/11/21 13:33:15 kiyohara Exp $ */
+/* $NetBSD: dwctwo_plb.c,v 1.2 2013/11/21 13:52:27 kiyohara Exp $ */
 /*
  * Copyright (c) 2013 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwctwo_plb.c,v 1.1 2013/11/21 13:33:15 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwctwo_plb.c,v 1.2 2013/11/21 13:52:27 kiyohara Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -67,34 +67,6 @@
 static char ex_storage[EXTENT_FIXED_STORAGE_SIZE(8)]
     __attribute__((aligned(8)));
 
-static struct dwc2_core_params dwctwo_405ex_params = {
-       .otg_cap                        = 0,    /* HNP/SRP capable */
-       .otg_ver                        = 0,    /* 1.3 */
-       .dma_enable                     = 1,
-       .dma_desc_enable                = 0,
-       .speed                          = 0,    /* High Speed */
-       .enable_dynamic_fifo            = 1,
-       .en_multiple_tx_fifo            = 0,
-       .host_rx_fifo_size              = 531,  /* 531 DWORDs */
-       .host_nperio_tx_fifo_size       = 256,  /* 256 DWORDs */
-       .host_perio_tx_fifo_size        = 256,  /* 256 DWORDs */
-       .max_transfer_size              = 524287,
-       .max_packet_count               = 1023,
-       .host_channels                  = 4,
-       .phy_type                       = 2,    /* ULPI */
-       .phy_utmi_width                 = 8,    /* 8 bits */
-       .phy_ulpi_ddr                   = 0,    /* Single */
-       .phy_ulpi_ext_vbus              = 0,
-       .i2c_enable                     = 0,
-       .ulpi_fs_ls                     = 0,
-       .host_support_fs_ls_low_power   = 0,
-       .host_ls_low_power_phy_clk      = 0,    /* 48 MHz */
-       .ts_dline                       = 0,
-       .reload_ctl                     = 0,
-       .ahbcfg                         = 0x10,
-       .uframe_sched                   = 1,
-};
-
 
 static int
 dwctwo_plb_match(device_t parent, cfdata_t match, void *aux)
@@ -119,10 +91,17 @@
 {
        struct dwc2_softc *sc = device_private(self);
        struct plb_attach_args *paa = aux;
+       prop_dictionary_t dict = device_properties(self);
        uint32_t srst0;
 
        sc->sc_dev = self;
-       sc->sc_params = &dwctwo_405ex_params;
+
+       /* get core parameters */
+       if (!prop_dictionary_get_uint32(dict, "params",
+           (uint32_t *)&sc->sc_params)) {
+               aprint_error("struct dwc2_core_params not found\n");
+               return;
+       }
 
        dwctwo_tag.pbs_base = paa->plb_addr;
        dwctwo_tag.pbs_limit += paa->plb_addr;



Home | Main Index | Thread Index | Old Index