Module Name:    src
Committed By:   kiyohara
Date:           Thu Nov 21 13:52:27 UTC 2013

Modified Files:
        src/sys/arch/evbppc/obs405: obs600_autoconf.c
        src/sys/arch/powerpc/ibm4xx/dev: dwctwo_plb.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbppc/obs405/obs600_autoconf.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbppc/obs405/obs600_autoconf.c
diff -u src/sys/arch/evbppc/obs405/obs600_autoconf.c:1.6 src/sys/arch/evbppc/obs405/obs600_autoconf.c:1.7
--- src/sys/arch/evbppc/obs405/obs600_autoconf.c:1.6	Tue Jan 10 12:17:20 2012
+++ src/sys/arch/evbppc/obs405/obs600_autoconf.c	Thu Nov 21 13:52:27 2013
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: obs600_autoc
 
 #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 @@ void
 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);
 }

Index: src/sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c
diff -u src/sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c:1.1 src/sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c:1.2
--- src/sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c:1.1	Thu Nov 21 13:33:15 2013
+++ src/sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c	Thu Nov 21 13:52:27 2013
@@ -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 struct powerpc_bus_space dwctwo_t
 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 @@ dwctwo_plb_attach(device_t parent, devic
 {
 	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;

Reply via email to