Skip to contentSkip to conversation

mx27: mxt_td60: Add USB Support

PATCH New Alan Carvalho de Assis 2 participants 4 messages Dec 4, 2009 – Dec 9, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mx27: mxt_td60: Add USB Support

This patch add USB support on i-MXT TD60 to Host1 and Host2 ports.

---
 arch/arm/mach-mx2/Kconfig                   |    1 +
 arch/arm/mach-mx2/mxt_td60.c                |  106 +++++++++++++++++++++++++++
 arch/arm/plat-mxc/include/mach/iomux-mx27.h |   14 ++++
 3 files changed, 121 insertions(+), 0 deletions(-)
arch/arm/mach-mx2/Kconfig +1 -0
index b96c6a3..f67f295 100644
@@ -107,6 +107,7 @@ config MACH_PCA100
 config MACH_MXT_TD60
 	bool "Maxtrack i-MXT TD60"
 	depends on MACH_MX27
+	select MXC_ULPI
 	help
 	  Include support for i-MXT (aka td60) platform. This
 	  includes specific configurations for the module and its peripherals.
arch/arm/mach-mx2/mxt_td60.c +106 -0

136 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/iomux-mx27.h +14 -0
index 5ac158b..82766af 100644
@@ -33,7 +33,14 @@
 #define PA3_PF_USBH2_NXT        (GPIO_PORTA | GPIO_PF | 3)
 #define PA4_PF_USBH2_STP        (GPIO_PORTA | GPIO_PF | 4)
 #define PB22_PF_USBH1_SUSP      (GPIO_PORTB | GPIO_PF | 22)
+#define PB23_PF_USB_PWR         (GPIO_PORTB | GPIO_PF | 23)
 #define PB25_PF_USBH1_RCV       (GPIO_PORTB | GPIO_PF | 25)
+#define PB26_PF_USBH1_FS        (GPIO_PORTB | GPIO_PF | 26)
+#define PB27_PF_USBH1_OE_B      (GPIO_PORTB | GPIO_PF | 27)
+#define PB28_PF_USBH1_TXDM      (GPIO_PORTB | GPIO_PF | 28)
+#define PB29_PF_USBH1_TXDP      (GPIO_PORTB | GPIO_PF | 29)
+#define PB30_PF_USBH1_RXDM      (GPIO_PORTB | GPIO_PF | 30)
+#define PB31_PF_USBH1_RXDP      (GPIO_PORTB | GPIO_PF | 31)
 #define PC5_PF_I2C2_SDA         (GPIO_PORTC | GPIO_PF | GPIO_IN | 5)
 #define PC6_PF_I2C2_SCL         (GPIO_PORTC | GPIO_PF | GPIO_IN | 6)
 #define PC7_PF_USBOTG_DATA5     (GPIO_PORTC | GPIO_PF | GPIO_OUT | 7)
@@ -123,6 +130,13 @@
 #define PD14_AF_ETMTRACE_PKT7   (GPIO_PORTD | GPIO_AF | 14)
 #define PD15_AF_ETMTRACE_PKT6   (GPIO_PORTD | GPIO_AF | 15)
 #define PD16_AF_ETMTRACE_PKT5   (GPIO_PORTD | GPIO_AF | 16)
+#define PD19_AF_USBH2_DATA4     (GPIO_PORTD | GPIO_AF | 19)
+#define PD20_AF_USBH2_DATA3     (GPIO_PORTD | GPIO_AF | 20)
+#define PD21_AF_USBH2_DATA6     (GPIO_PORTD | GPIO_AF | 21)
+#define PD22_AF_USBH2_DATA0     (GPIO_PORTD | GPIO_AF | 22)
+#define PD23_AF_USBH2_DATA2     (GPIO_PORTD | GPIO_AF | 23)
+#define PD24_AF_USBH2_DATA1     (GPIO_PORTD | GPIO_AF | 24)
+#define PD26_AF_USBH2_DATA5     (GPIO_PORTD | GPIO_AF | 26)
 #define PF1_AF_ETMTRACE_PKT0    (GPIO_PORTF | GPIO_AF | 1)
 #define PF3_AF_ETMTRACE_PKT2    (GPIO_PORTF | GPIO_AF | 3)
 #define PF5_AF_ETMPIPESTAT11    (GPIO_PORTF | GPIO_AF | 5)
Signature · 1 line
1.6.0.4
#1 lore raw

PATCH 1/1 mx27: mxt_td60: Add USB Support

Quoted 7 lines · Alan Carvalho de Assis

This patch add USB support on i-MXT TD60 to Host1 and Host2 ports.

---
 arch/arm/mach-mx2/Kconfig                   |    1 +
 arch/arm/mach-mx2/mxt_td60.c                |  106 +++++++++++++++++++++++++++
 arch/arm/plat-mxc/include/mach/iomux-mx27.h |   14 ++++

Changes to iomux-mx27.h should go in an extra patch, I think.

[...]

arch/arm/mach-mx2/mxt_td60.c static struct imxuart_platform_data uart_pdata[] = { · line 289

Quoted 8 lines
arch/arm/mach-mx2/mxt_td60.c +8 -0
+static int isp1105_init(struct otg_transceiver *otg)
+{
+	mxc_gpio_mode(GPIO_PORTB | 23 | GPIO_GPIO | GPIO_OUT);
+	gpio_set_value(GPIO_PORTB + 23, 1);
+	mxc_gpio_mode(GPIO_PORTC | 31 | GPIO_GPIO | GPIO_OUT);
+	gpio_set_value(GPIO_PORTC + 31, 1);
+	return 0;
+}

gpio_request() is needed here.

Quoted 21 lines
arch/arm/mach-mx2/mxt_td60.c +21 -0
+static int isp1105_set_vbus(struct otg_transceiver *otg, bool on)
+{
+	if (on)
+		gpio_set_value(GPIO_PORTB + 27, 0);
+	else
+		gpio_set_value(GPIO_PORTB + 27, 1);
+
+	return 0;
+}
+
+static struct mxc_usbh_platform_data usbh1_pdata = {
+	.portsc	= MXC_EHCI_MODE_UTMI | MXC_EHCI_SERIAL,
+	.flags	= MXC_EHCI_POWER_PINS_ENABLED | MXC_EHCI_INTERFACE_SINGLE_UNI,
+};
+
+static int __init usbh1_init(void)
+{
+	struct otg_transceiver *otg;
+
+	otg = kzalloc(sizeof(*otg), GFP_KERNEL);
+	if (!otg)

arch/arm/mach-mx2/mxt_td60.c static struct imxuart_platform_data uart_pdata[] = { · line 322

Quoted 10 lines
arch/arm/mach-mx2/mxt_td60.c +10 -0
+		return -ENOMEM;
+
+	otg->label	= "ISP1105";
+	otg->init	= isp1105_init;
+	otg->set_vbus	= isp1105_set_vbus;
+
+	usbh1_pdata.otg = otg;
+
+	return mxc_register_device(&mxc_usbh1, &usbh1_pdata);
+}

Ideally, you would make that a more generic driver of its own, which lives in drivers/usb/otg/ and is named something like 'transceiver-gpio'. You would instanciate it by passing a platform data struct to set the gpios you want it to use. This might sound overdone, but it would make your code reusable.

The calls to mxc_gpio_mode() would remain in your platform code, of course.

Daniel

#2 lore raw

PATCH 1/1 mx27: mxt_td60: Add USB Support

Hi Daniel,

Quoted 12 lines · Daniel Mack
Quoted 8 lines · Alan Carvalho de Assis

This patch add USB support on i-MXT TD60 to Host1 and Host2 ports.

---
 arch/arm/mach-mx2/Kconfig                   |    1 +
 arch/arm/mach-mx2/mxt_td60.c                |  106
+++++++++++++++++++++++++++
 arch/arm/plat-mxc/include/mach/iomux-mx27.h |   14 ++++

Changes to iomux-mx27.h should go in an extra patch, I think.

Yes, I agree.

Quoted 13 lines

[...]

arch/arm/mach-mx2/mxt_td60.c static struct imxuart_platform_data uart_pdata[] = { · line 289

Quoted 8 lines
arch/arm/mach-mx2/mxt_td60.c +8 -0
+static int isp1105_init(struct otg_transceiver *otg)
+{
+	mxc_gpio_mode(GPIO_PORTB | 23 | GPIO_GPIO | GPIO_OUT);
+	gpio_set_value(GPIO_PORTB + 23, 1);
+	mxc_gpio_mode(GPIO_PORTC | 31 | GPIO_GPIO | GPIO_OUT);
+	gpio_set_value(GPIO_PORTC + 31, 1);
+	return 0;
+}

gpio_request() is needed here.

Sure, I missed it.

Quoted 9 lines

Ideally, you would make that a more generic driver of its own, which lives in
drivers/usb/otg/ and is named something like 'transceiver-gpio'. You would instanciate it by passing a platform data struct to set the gpios you want it
to use. This might sound overdone, but it would make your code reusable.

The calls to mxc_gpio_mode() would remain in your platform code, of course.

Ok, I need your support here. I'm using mxc-master and I looked for something related to "transceiver gpio", but no success. I found some gpio related to usb gadget, but this is not the case. Could you point me to right function?

Thank you very much,

Alan

Quoted 3 lines

Daniel

#3 lore raw

PATCH 1/1 mx27: mxt_td60: Add USB Support

Quoted 9 lines · Alan Carvalho de Assis
Quoted 9 lines · Alan Carvalho de Assis

Ideally, you would make that a more generic driver of its own, which lives in
drivers/usb/otg/ and is named something like 'transceiver-gpio'. You would instanciate it by passing a platform data struct to set the gpios you want it
to use. This might sound overdone, but it would make your code reusable.

Quoted 7 lines
Quoted 2 lines

The calls to mxc_gpio_mode() would remain in your platform code, of course.

Ok, I need your support here. I'm using mxc-master and I looked for something related to "transceiver gpio", but no success. I found some gpio related to usb gadget, but this is not the case. Could you point me to right function?

What I was thinking of is a very small kind of driver that is initialized similar to the ulpi transceiver but instead of taking ULPI lowevel operations, it is fed with a struct to specify the GPIOs to use.

Daniel