Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Jul 2012 16:06:38 +0000
From:      aleek@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r239673 - in soc2012/aleek/beaglexm-armv6/sys: arm/ti arm/ti/usb boot/fdt/dts
Message-ID:  <20120722160638.76CBF106566C@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: aleek
Date: Sun Jul 22 16:06:38 2012
New Revision: 239673
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239673

Log:
  configured GPIO pins for USB EHCI

Modified:
  soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_gpio.c
  soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_sdma.c
  soc2012/aleek/beaglexm-armv6/sys/arm/ti/usb/omap_ehci.c
  soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts

Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_gpio.c
==============================================================================
--- soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_gpio.c	Sun Jul 22 15:40:31 2012	(r239672)
+++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_gpio.c	Sun Jul 22 16:06:38 2012	(r239673)
@@ -69,7 +69,9 @@
  /* Register definitions */
 #define TI_GPIO_REVISION		0x0000
 #define TI_GPIO_SYSCONFIG		0x0010
+
 #if defined(SOC_OMAP3) || defined(SOC_TI_AM37X)
+
 #define TI_GPIO_REVISION		0x0000
 #define TI_GPIO_SYSCONFIG		0x0010
 #define TI_GPIO_SYSSTATUS		0x0014
@@ -96,7 +98,9 @@
 #define TI_GPIO_SETWKUENA		0x0084
 #define TI_GPIO_CLEARDATAOUT		0x0090
 #define TI_GPIO_SETDATAOUT		0x0094
+
 #elif defined(SOC_OMAP4) || defined(SOC_TI_AM335X)
+
 #define TI_GPIO_IRQSTATUS_RAW_0		0x0024
 #define TI_GPIO_IRQSTATUS_RAW_1		0x0028
 #define TI_GPIO_IRQSTATUS_0		0x002C

Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_sdma.c
==============================================================================
--- soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_sdma.c	Sun Jul 22 15:40:31 2012	(r239672)
+++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_sdma.c	Sun Jul 22 16:06:38 2012	(r239673)
@@ -341,6 +341,8 @@
 	if (ch == NULL)
 		return (EINVAL);
 
+	device_printf( sc->sc_dev, "Activating channel %d\n", *ch );
+
 	TI_SDMA_LOCK(sc);
 
 	/* Check to see if all channels are in use */

Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/usb/omap_ehci.c
==============================================================================
--- soc2012/aleek/beaglexm-armv6/sys/arm/ti/usb/omap_ehci.c	Sun Jul 22 15:40:31 2012	(r239672)
+++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/usb/omap_ehci.c	Sun Jul 22 16:06:38 2012	(r239673)
@@ -294,6 +294,7 @@
 omap_ehci_soft_phy_reset(struct omap_ehci_softc *isc, unsigned int port)
 {
 	unsigned long timeout = (hz < 10) ? 1 : ((100 * hz) / 1000);
+	timeout = timeout<<2;
 	uint32_t reg;
 
 	reg = ULPI_FUNC_CTRL_RESET
@@ -348,28 +349,36 @@
 	int i;
 	
 	device_printf(isc->sc_dev, "Starting TI EHCI USB Controller\n");
+	device_printf( isc->sc_dev, "%s:%d\n", __FUNCTION__, __LINE__ );
 	
 	
 	/* Enable Clocks for high speed USBHOST */
 	ti_prcm_clk_enable(USBHSHOST_CLK);
+	device_printf( isc->sc_dev, "%s:%d\n", __FUNCTION__, __LINE__ );
 	
 	/* Hold the PHY in reset while configuring */
 	for (int i = 0; i < 3; i++) {
 		if (isc->phy_reset[i]) {
+			device_printf( isc->sc_dev, "%s:%d\n", __FUNCTION__, __LINE__ );
 			/* Configure the GPIO to drive low (hold in reset) */
 			if ((isc->reset_gpio_pin[i] != -1) && (isc->sc_gpio_dev != NULL)) {
+			device_printf( isc->sc_dev, "%s:%d\n", __FUNCTION__, __LINE__ );
 				GPIO_PIN_SETFLAGS(isc->sc_gpio_dev, isc->reset_gpio_pin[i],
 				    GPIO_PIN_OUTPUT);
+			device_printf( isc->sc_dev, "%s:%d\n", __FUNCTION__, __LINE__ );
 				GPIO_PIN_SET(isc->sc_gpio_dev, isc->reset_gpio_pin[i],
 				    GPIO_PIN_LOW);
+			device_printf( isc->sc_dev, "%s:%d\n", __FUNCTION__, __LINE__ );
 				reset_performed = 1;
 			}
 		}
 	}
+	device_printf( isc->sc_dev, "%s:%d\n", __FUNCTION__, __LINE__ );
 
 	/* Hold the PHY in RESET for enough time till DIR is high */
 	if (reset_performed)
 		DELAY(10);
+	device_printf( isc->sc_dev, "%s:%d\n", __FUNCTION__, __LINE__ );
 
 	/* Read the UHH revision */
 	isc->ehci_rev = omap_uhh_read_4(isc, OMAP_USBHOST_UHH_REVISION);
@@ -804,6 +813,7 @@
 	 * The interrupt resource is just the single interupt for the controller.
 	 */
 
+	device_printf( dev, "%s:%d\n", __FUNCTION__, __LINE__ );
 	/* Allocate resource for the EHCI register set */
 	rid = 0;
 	sc->sc_io_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE);
@@ -811,6 +821,7 @@
 		device_printf(dev, "Error: Could not map EHCI memory\n");
 		goto error;
 	}
+	device_printf( dev, "%s:%d\n", __FUNCTION__, __LINE__ );
 	/* Request an interrupt resource */
 	rid = 0;
 	sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE);
@@ -818,6 +829,7 @@
 		device_printf(dev, "Error: could not allocate irq\n");
 		goto error;
 	}
+	device_printf( dev, "%s:%d\n", __FUNCTION__, __LINE__ );
 
 	/* Allocate resource for the UHH register set */
 	rid = 1;
@@ -826,6 +838,7 @@
 		device_printf(dev, "Error: Could not map UHH memory\n");
 		goto error;
 	}
+	device_printf( dev, "%s:%d\n", __FUNCTION__, __LINE__ );
 	/* Allocate resource for the TLL register set */
 	rid = 2;
 	isc->tll_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE);
@@ -833,6 +846,7 @@
 		device_printf(dev, "Error: Could not map TLL memory\n");
 		goto error;
 	}
+	device_printf( dev, "%s:%d\n", __FUNCTION__, __LINE__ );
 	
 	/* Add this device as a child of the USBus device */
 	sc->sc_bus.bdev = device_add_child(dev, "usbus", -1);
@@ -840,6 +854,7 @@
 		device_printf(dev, "Error: could not add USB device\n");
 		goto error;
 	}
+	device_printf( dev, "%s:%d\n", __FUNCTION__, __LINE__ );
 
 	device_set_ivars(sc->sc_bus.bdev, &sc->sc_bus);
 	device_set_desc(sc->sc_bus.bdev, OMAP_EHCI_HC_DEVSTR);
@@ -863,6 +878,7 @@
 		isc->reset_gpio_pin[i] = -1;
 	}
 
+	device_printf( dev, "%s:%d\n", __FUNCTION__, __LINE__ );
 	tuple_size = sizeof(pcell_t) * 3;
 	node = ofw_bus_get_node(dev);
 	len = OF_getprop(node, "phy-config", phyconf, sizeof(phyconf));
@@ -882,6 +898,7 @@
 		}
 	}
 	
+	device_printf( dev, "%s:%d\n", __FUNCTION__, __LINE__ );
 	/* Initialise the ECHI registers */
 	err = omap_ehci_init(isc);
 	if (err) {
@@ -890,12 +907,14 @@
 	}
 		
 
+	device_printf( dev, "%s:%d\n", __FUNCTION__, __LINE__ );
 	/* Set the tag and size of the register set in the EHCI context */
 	sc->sc_io_hdl = rman_get_bushandle(sc->sc_io_res);
 	sc->sc_io_tag = rman_get_bustag(sc->sc_io_res);
 	sc->sc_io_size = rman_get_size(sc->sc_io_res);
 
 
+	device_printf( dev, "%s:%d\n", __FUNCTION__, __LINE__ );
 	/* Setup the interrupt */
 	err = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE,
 						 NULL, (driver_intr_t *)ehci_interrupt, sc, &sc->sc_intr_hdl);
@@ -905,9 +924,11 @@
 		goto error;
 	}
 	
+	device_printf( dev, "%s:%d\n", __FUNCTION__, __LINE__ );
 	
 	/* Finally we are ready to kick off the ECHI host controller */
 	err = ehci_init(sc);
+	device_printf( dev, "%s:%d\n", __FUNCTION__, __LINE__ );
 	if (err == 0) {
 		err = device_probe_and_attach(sc->sc_bus.bdev);
 	}

Modified: soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts
==============================================================================
--- soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts	Sun Jul 22 15:40:31 2012	(r239672)
+++ soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts	Sun Jul 22 16:06:38 2012	(r239673)
@@ -64,9 +64,39 @@
 			reg =	< 0x48002000 0x2000 >;
 			/* Set of triplets < padname, muxname, padstate> */
 			scm-pad-config =
-				/* I2C0 */
-				"I2C0_SDA", "I2C0_SDA","input_pullup_inact_slow",
-				"I2C0_SCL", "I2C0_SCL","input_pullup_inact_slow";
+				/* USB */
+				/*
+				"af10",		"hsusb1_stp",	"output",
+				"ae10",		"hsusb1_clk",	"output",
+				"af9",		"hsusb1_dir",	"input_pulldown",
+				"ag9",		"hsusb1_nxt",	"input_pulldown",
+				"af11",		"hsusb1_data0",	"input_pulldown",
+				"ag12",		"hsusb1_data1",	"input_pulldown",
+				"ah12",		"hsusb1_data2",	"input_pulldown",
+				"ah14",		"hsusb1_data3",	"input_pulldown",
+				"ae11",		"hsusb1_data4",	"input_pulldown",
+				"ah9",		"hsusb1_data5",	"input_pulldown",
+				"af13",		"hsusb1_data6",	"input_pulldown",
+				"ae13",		"hsusb1_data7",	"input_pulldown",*/
+
+				"af7", "hsusb2_stp", "output",
+				"ag7", "hsusb2_dir", "input_pulldown",
+				"ah7", "hsusb2_nxt", "input_pulldown",
+
+				"ag8", "hsusb2_data0", "input_pulldown",
+				"ah8", "hsusb2_data1", "input_pulldown",
+				"ab2", "hsusb2_data2", "input_pulldown",
+				"v3", "hsusb2_data3", "input_pulldown",
+				"y2", "hsusb2_data4", "input_pulldown",
+				"y3", "hsusb2_data5", "input_pulldown",
+				"y4", "hsusb2_data6", "input_pulldown",
+				"aa3", "hsusb2_data7", "input_pulldown",
+
+				"ad25", "gpio_147", "output",
+				"ae7", "hsusb2_clk", "output",
+				"r8", "gpio_56", "output";
+
+
 		};
 
 		prcm@48004000 {
@@ -169,6 +199,20 @@
 
 		ehci@48064800 {
 			compatible = "ti,ehci";
+			/* 
+			 * USB port PHY configuration is a tuple: <mode, reset, gpio_pin>
+			 * mode is one of the following values:
+			 *   0 - unknown
+			 *   1 - PHY
+			 *   2 - TLL
+			 *   3 - HSIC
+			 *
+			 * reset indicates (if non-zero) if port reset is required 
+			 * gpio_pin - GPIO pin that is used to perform reset
+			 */
+			phy-config = <  1 0 0
+					1 1 56
+					0 0 0>;
 			reg = < 0x48064800 0x400 /* EHCI */
 					0x48064000 0x400 /* UHH */
 					0x48062000 0x1000 /* TLL */ >;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120722160638.76CBF106566C>