Skip to contentSkip to conversation

atmel: add ehci support

PATCH Applied Jean-Christophe PLAGNIOL-VILLARD 2 participants 15 messages Jan 21, 2013 – Jan 23, 2013

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

cover atmel: add ehci support

HI,

the following patch series add the ehci support to atmel

it also allow to discover the caps resources via cr_capbase so no need to hardcode it anymore

The following changes since commit 3de3b677ee3adc4e10235b623a8e0aa45be48893:

Makefile: move cmd_check_file_size to Makefile.lib (2013-01-20 12:51:28 +0100)

are available in the git repository at:

git://git.jcrosoft.org/barebox.git delivery/atmel_usb_ehci

for you to fetch changes up to 44aea6f57969984648a0686ce698b14e55e55752:

at91sam9x5ek: add usb support (2013-01-17 22:45:45 +0800)

----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (9):
usb: add parameters info on usb device
usb: fix for USB_ST_STALLED status reporting in ehci_submit_async()
ehci: if caps ressource is not provided discover it via cr_capbase
ehci: add atmel support
at91: usb: allow to specicfy inverted vbus
at91sam9g45: add ehci support
at91sam9m10g45ek: add usb support
at91sam9x5: add ehci support
at91sam9x5ek: add usb support

 arch/arm/boards/at91sam9m10g45ek/init.c     |   20 ++++++++++++++++++++
 arch/arm/boards/at91sam9x5ek/init.c         |   20 +++++++++++++++-----
 arch/arm/configs/at91sam9m10g45ek_defconfig |    6 ++++++
 arch/arm/configs/at91sam9x5ek_defconfig     |    6 ++++++
 arch/arm/mach-at91/at91rm9200_devices.c     |    9 +++++++++
 arch/arm/mach-at91/at91sam9260_devices.c    |    9 +++++++++
 arch/arm/mach-at91/at91sam9261_devices.c    |    9 +++++++++
 arch/arm/mach-at91/at91sam9263_devices.c    |    3 ++-
 arch/arm/mach-at91/at91sam9g45.c            |    1 +
 arch/arm/mach-at91/at91sam9g45_devices.c    |   25 ++++++++++++++++++++++++-
 arch/arm/mach-at91/at91sam9n12_devices.c    |    3 ++-
 arch/arm/mach-at91/at91sam9x5.c             |    1 +
 arch/arm/mach-at91/at91sam9x5_devices.c     |   25 ++++++++++++++++++++++++-
 arch/arm/mach-at91/include/mach/board.h     |    2 ++
 drivers/usb/core/usb.c                      |   14 ++++++++++++++
 drivers/usb/host/Kconfig                    |    5 +++++
 drivers/usb/host/Makefile                   |    1 +
 drivers/usb/host/ehci-atmel.c               |   96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/usb/host/ehci-hcd.c                 |   18 ++++++++++++++----
 19 files changed, 260 insertions(+), 13 deletions(-)
 create mode 100644 drivers/usb/host/ehci-atmel.c

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#1 lore raw

PATCH 1/9 usb: add parameters info on usb device

iManufacturer = 0
iProduct = 1
iSerialNumber = 0

    Manufacturer =
         Product = OHCI Root Hub
    SerialNumber =
        idVendor = 0000
       idProduct = 0000
---
 drivers/usb/core/usb.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/usb/core/usb.c +14 -0
index 9dc931b..a813be5 100644
@@ -300,6 +300,7 @@ static int usb_new_device(struct usb_device *dev)
 	int port = -1;
 	struct usb_device *parent = dev->parent;
 	unsigned short portstatus;
+	char str[16];
 
 	buf = dma_alloc(USB_BUFSIZ);
 
@@ -438,6 +439,19 @@ static int usb_new_device(struct usb_device *dev)
 	print_usb_device(dev);
 
 	register_device(&dev->dev);
+	sprintf(str, "%d", dev->descriptor->iManufacturer);
+	dev_add_param_fixed(&dev->dev, "iManufacturer", str);
+	sprintf(str, "%d", dev->descriptor->iProduct);
+	dev_add_param_fixed(&dev->dev, "iProduct", str);
+	sprintf(str, "%d", dev->descriptor->iSerialNumber);
+	dev_add_param_fixed(&dev->dev, "iSerialNumber", str);
+	dev_add_param_fixed(&dev->dev, "Manufacturer", dev->mf);
+	dev_add_param_fixed(&dev->dev, "Product", dev->prod);
+	dev_add_param_fixed(&dev->dev, "SerialNumber", dev->serial);
+	sprintf(str, "%04x", le16_to_cpu(dev->descriptor->idVendor));
+	dev_add_param_fixed(&dev->dev, "idVendor", str);
+	sprintf(str, "%04x", le16_to_cpu(dev->descriptor->idProduct));
+	dev_add_param_fixed(&dev->dev, "idProduct", str);
 	list_add_tail(&dev->list, &usb_device_list);
 
 	err = 0;
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH 2/9 usb: fix for USB_ST_STALLED status reporting in ehci_submit_async()

Checking the status field of the qTD token in the current code do not take into acount cases where endpoint stall (halted) bit is set together with XactErr status bit. As a result clearing stall on an endpoint won't be done if this status bit was also set. Check for halted bit and report USB_ST_STALLED status if the host controller also indicates endpoit stall condition.

From u-boot by Anatolij Gustschin <[email protected]>

---
 drivers/usb/host/ehci-hcd.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/usb/host/ehci-hcd.c +2 -0
index ad8cf2f..35b4f71 100644
@@ -393,6 +393,8 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer,
 			break;
 		default:
 			dev->status = USB_ST_CRC_ERR;
+			if ((token & 0x40) == 0x40)
+				dev->status |= USB_ST_STALLED;
 			break;
 		}
 		dev->act_len = length - ((token >> 16) & 0x7fff);
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

PATCH 3/9 ehci: if caps ressource is not provided discover it via cr_capbase

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 drivers/usb/host/ehci-hcd.c |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/usb/host/ehci-hcd.c +12 -4
index 35b4f71..9315fe3 100644
@@ -843,9 +843,14 @@ int ehci_register(struct device_d *dev, struct ehci_data *data)
 	dev->priv = ehci;
 	ehci->flags = data->flags;
 	ehci->hccr = data->hccr;
-	ehci->hcor = data->hcor;
 	ehci->dev = dev;
 
+	if (data->hcor)
+		ehci->hcor = data->hcor;
+	else
+		ehci->hcor = (void __iomem *)ehci->hccr +
+			HC_LENGTH(ehci_readl(&ehci->hccr->cr_capbase));
+
 	ehci->qh_list = dma_alloc_coherent(sizeof(struct QH) * NUM_TD);
 	ehci->td = dma_alloc_coherent(sizeof(struct qTD) * NUM_TD);
 
@@ -879,13 +884,16 @@ static int ehci_probe(struct device_d *dev)
 	else
 		data.flags = EHCI_HAS_TT;
 
-	if (dev->num_resources < 2) {
-		printf("echi: need 2 resources base and data");
+	if (dev->num_resources < 1) {
+		printf("echi: need 1 resources base and data");
 		return -ENODEV;
 	}
 
 	data.hccr = dev_request_mem_region(dev, 0);
-	data.hcor = dev_request_mem_region(dev, 1);
+	if (dev->num_resources > 1)
+		data.hcor = dev_request_mem_region(dev, 1);
+	else
+		data.hcor = NULL;
 
 	return ehci_register(dev, &data);
 }
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

PATCH 4/9 ehci: add atmel support

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 drivers/usb/host/Kconfig      |    5 +++
 drivers/usb/host/Makefile     |    1 +
 drivers/usb/host/ehci-atmel.c |   96 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 102 insertions(+)
 create mode 100644 drivers/usb/host/ehci-atmel.c
drivers/usb/host/Kconfig +5 -0
index 439d8eb..3927d3a 100644
@@ -6,6 +6,11 @@ config USB_EHCI_OMAP
 	depends on USB_TWL4030
 	bool "OMAP EHCI driver"
 
+config USB_EHCI_ATMEL
+	depends on ARCH_AT91
+	depends on USB_EHCI
+	bool "Atmel EHCI driver"
+
 config USB_OHCI
 	bool "OHCI driver"
 
drivers/usb/host/Makefile +1 -0
index 00f5e24..156fc7f 100644
@@ -1,4 +1,5 @@
 obj-$(CONFIG_USB_EHCI)		+= ehci-hcd.o
 obj-$(CONFIG_USB_EHCI_OMAP)	+= ehci-omap.o
+obj-$(CONFIG_USB_EHCI_ATMEL)	+= ehci-atmel.o
 obj-$(CONFIG_USB_OHCI)		+= ohci-hcd.o
 obj-$(CONFIG_USB_OHCI_AT91)	+= ohci-at91.o
drivers/usb/host/ehci-atmel.c new file +96 -0

96 lines not on this page · raw message

Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#5 lore raw

PATCH 5/9 at91: usb: allow to specicfy inverted vbus

In reply to Jean-Christophe PLAGNIOL-VILLARD

add missing vbus to all SoC

---
 arch/arm/mach-at91/at91rm9200_devices.c  |    9 +++++++++
 arch/arm/mach-at91/at91sam9260_devices.c |    9 +++++++++
 arch/arm/mach-at91/at91sam9261_devices.c |    9 +++++++++
 arch/arm/mach-at91/at91sam9263_devices.c |    3 ++-
 arch/arm/mach-at91/at91sam9g45_devices.c |    3 ++-
 arch/arm/mach-at91/at91sam9n12_devices.c |    3 ++-
 arch/arm/mach-at91/at91sam9x5_devices.c  |    3 ++-
 arch/arm/mach-at91/include/mach/board.h  |    1 +
 8 files changed, 36 insertions(+), 4 deletions(-)
arch/arm/mach-at91/at91rm9200_devices.c +9 -0
index 4109172..84d4c15 100644
@@ -37,9 +37,18 @@ void at91_add_device_sdram(u32 size)
 #if defined(CONFIG_USB_OHCI)
 void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data)
 {
+	int i;
+
 	if (!data)
 		return;
 
+	/* Enable VBus control for UHP ports */
+	for (i = 0; i < data->ports; i++) {
+		if (gpio_is_valid(data->vbus_pin[i]))
+			at91_set_gpio_output(data->vbus_pin[i],
+					     data->vbus_pin_active_low[i]);
+	}
+
 	add_generic_device("at91_ohci", DEVICE_ID_DYNAMIC, NULL, AT91RM9200_UHP_BASE,
 			1024 * 1024, IORESOURCE_MEM, data);
 }
arch/arm/mach-at91/at91sam9260_devices.c +9 -0
index a893a95..5ee0b11 100644
@@ -42,9 +42,18 @@ void at91_add_device_sdram(u32 size)
 #if defined(CONFIG_USB_OHCI)
 void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data)
 {
+	int i;
+
 	if (!data)
 		return;
 
+	/* Enable VBus control for UHP ports */
+	for (i = 0; i < data->ports; i++) {
+		if (gpio_is_valid(data->vbus_pin[i]))
+			at91_set_gpio_output(data->vbus_pin[i],
+					     data->vbus_pin_active_low[i]);
+	}
+
 	add_generic_device("at91_ohci", DEVICE_ID_DYNAMIC, NULL, AT91SAM9260_UHP_BASE,
 			1024 * 1024, IORESOURCE_MEM, data);
 }
arch/arm/mach-at91/at91sam9261_devices.c +9 -0
index becd25f..5241894 100644
@@ -45,9 +45,18 @@ void at91_add_device_sdram(u32 size)
 #if defined(CONFIG_USB_OHCI)
 void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data)
 {
+	int i;
+
 	if (!data)
 		return;
 
+	/* Enable VBus control for UHP ports */
+	for (i = 0; i < data->ports; i++) {
+		if (gpio_is_valid(data->vbus_pin[i]))
+			at91_set_gpio_output(data->vbus_pin[i],
+					     data->vbus_pin_active_low[i]);
+	}
+
 	add_generic_device("at91_ohci", DEVICE_ID_DYNAMIC, NULL, AT91SAM9261_UHP_BASE,
 			1024 * 1024, IORESOURCE_MEM, data);
 }
arch/arm/mach-at91/at91sam9263_devices.c +2 -1
index b72cc5a..c5efe9f 100644
@@ -50,7 +50,8 @@ void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data)
 	/* Enable VBus control for UHP ports */
 	for (i = 0; i < data->ports; i++) {
 		if (gpio_is_valid(data->vbus_pin[i]))
-			at91_set_gpio_output(data->vbus_pin[i], 0);
+			at91_set_gpio_output(data->vbus_pin[i],
+					     data->vbus_pin_active_low[i]);
 	}
 
 	add_generic_device("at91_ohci", DEVICE_ID_DYNAMIC, NULL, AT91SAM9263_UHP_BASE,
arch/arm/mach-at91/at91sam9g45_devices.c +2 -1
index d2746da..7d44ee0 100644
@@ -44,7 +44,8 @@ void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data)
 	/* Enable VBus control for UHP ports */
 	for (i = 0; i < data->ports; i++) {
 		if (gpio_is_valid(data->vbus_pin[i]))
-			at91_set_gpio_output(data->vbus_pin[i], 0);
+			at91_set_gpio_output(data->vbus_pin[i],
+					     data->vbus_pin_active_low[i]);
 	}
 
 	add_generic_device("at91_ohci", DEVICE_ID_DYNAMIC, NULL, AT91SAM9G45_OHCI_BASE,
arch/arm/mach-at91/at91sam9n12_devices.c +2 -1
index 3f41f3e..9d6e80f 100644
@@ -46,7 +46,8 @@ void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data)
 	/* Enable VBus control for UHP ports */
 	for (i = 0; i < data->ports; i++) {
 		if (gpio_is_valid(data->vbus_pin[i]))
-			at91_set_gpio_output(data->vbus_pin[i], 0);
+			at91_set_gpio_output(data->vbus_pin[i],
+					     data->vbus_pin_active_low[i]);
 	}
 
 	add_generic_device("at91_ohci", DEVICE_ID_DYNAMIC, NULL, AT91SAM9N12_OHCI_BASE,
arch/arm/mach-at91/at91sam9x5_devices.c +2 -1
index e92fa0d..71057a5 100644
@@ -45,7 +45,8 @@ void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data)
 	/* Enable VBus control for UHP ports */
 	for (i = 0; i < data->ports; i++) {
 		if (gpio_is_valid(data->vbus_pin[i]))
-			at91_set_gpio_output(data->vbus_pin[i], 0);
+			at91_set_gpio_output(data->vbus_pin[i],
+					     data->vbus_pin_active_low[i]);
 	}
 
 	add_generic_device("at91_ohci", DEVICE_ID_DYNAMIC, NULL, AT91SAM9X5_OHCI_BASE,
arch/arm/mach-at91/include/mach/board.h +1 -0
index b18f1c0..0994770 100644
@@ -29,6 +29,7 @@
 struct at91_usbh_data {
 	u8		ports;		/* number of ports on root hub */
 	int		vbus_pin[2];	/* port power-control pin */
+	u8	vbus_pin_active_low[2];	/* vbus polarity */
 };
 extern void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data);
 
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#6 lore raw

PATCH 6/9 at91sam9g45: add ehci support

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 arch/arm/mach-at91/at91sam9g45.c         |    1 +
 arch/arm/mach-at91/at91sam9g45_devices.c |   22 ++++++++++++++++++++++
 arch/arm/mach-at91/include/mach/board.h  |    1 +
 3 files changed, 24 insertions(+)
arch/arm/mach-at91/at91sam9g45.c +1 -0
index 7118efe..6e88bf1 100644
@@ -187,6 +187,7 @@ static struct clk *periph_clocks[] __initdata = {
 static struct clk_lookup periph_clocks_lookups[] = {
 	/* One additional fake clock for ohci */
 	CLKDEV_CON_ID("ohci_clk", &uhphs_clk),
+	CLKDEV_CON_DEV_ID("ehci_clk", "atmel-ehci", &uhphs_clk),
 	CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci0", &mmc0_clk),
 	CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci1", &mmc1_clk),
 	CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi0", &spi0_clk),
arch/arm/mach-at91/at91sam9g45_devices.c +22 -0
index 7d44ee0..c4ca7c6 100644
@@ -55,6 +55,28 @@ void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data)
 void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data) {}
 #endif
 
+#if defined(CONFIG_USB_EHCI)
+void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data)
+{
+	int i;
+
+	if (!data)
+		return;
+
+	/* Enable VBus control for UHP ports */
+	for (i = 0; i < data->ports; i++) {
+		if (gpio_is_valid(data->vbus_pin[i]))
+			at91_set_gpio_output(data->vbus_pin[i],
+					     data->vbus_pin_active_low[i]);
+	}
+
+	add_generic_device("atmel-ehci", DEVICE_ID_SINGLE, NULL, AT91SAM9G45_EHCI_BASE,
+			1024 * 1024, IORESOURCE_MEM, data);
+}
+#else
+void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data) {}
+#endif
+
 #if defined(CONFIG_DRIVER_NET_MACB)
 void at91_add_device_eth(int id, struct at91_ether_platform_data *data)
 {
arch/arm/mach-at91/include/mach/board.h +1 -0
index 0994770..b0afcf9 100644
@@ -32,6 +32,7 @@ struct at91_usbh_data {
 	u8	vbus_pin_active_low[2];	/* vbus polarity */
 };
 extern void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data);
+extern void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data);
 
 void atmel_nand_load_image(void *dest, int size, int pagesize, int blocksize);
 
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#7 lore raw

PATCH 7/9 at91sam9m10g45ek: add usb support

In reply to Jean-Christophe PLAGNIOL-VILLARD

warning: the ohci work only without MMU

enable:
- ehci
- usb strorage
- usb net asix

---
 arch/arm/boards/at91sam9m10g45ek/init.c     |   20 ++++++++++++++++++++
 arch/arm/configs/at91sam9m10g45ek_defconfig |    6 ++++++
 2 files changed, 26 insertions(+)
arch/arm/boards/at91sam9m10g45ek/init.c +20 -0
index d77b2bf..214de96 100644
@@ -209,6 +209,25 @@ static void ek_device_add_keyboard(void)
 static void ek_device_add_keyboard(void) {}
 #endif
 
+#if defined(CONFIG_USB_OHCI) || defined(CONFIG_USB_EHCI)
+/*
+ * USB HS Host port (common to OHCI & EHCI)
+ */
+static struct at91_usbh_data ek_usbh_hs_data = {
+	.ports			= 2,
+	.vbus_pin		= {AT91_PIN_PD1, AT91_PIN_PD3},
+	.vbus_pin_active_low	= {1, 1},
+};
+
+static void ek_add_device_usb(void)
+{
+	at91_add_device_usbh_ohci(&ek_usbh_hs_data);
+	at91_add_device_usbh_ehci(&ek_usbh_hs_data);
+}
+#else
+static void ek_add_device_usb(void) {}
+#endif
+
 static int at91sam9m10g45ek_mem_init(void)
 {
 	at91_add_device_sdram(128 * 1024 * 1024);
@@ -222,6 +241,7 @@ static int at91sam9m10g45ek_devices_init(void)
 	ek_add_device_nand();
 	at91_add_device_eth(0, &macb_pdata);
 	ek_add_device_mci();
+	ek_add_device_usb();
 	ek_device_add_leds();
 	ek_device_add_keyboard();
 
arch/arm/configs/at91sam9m10g45ek_defconfig +6 -0
index 0929f8e..1e35787 100644
@@ -58,6 +58,8 @@ CONFIG_FS_TFTP=y
 CONFIG_NET_NETCONSOLE=y
 CONFIG_NET_RESOLV=y
 CONFIG_DRIVER_NET_MACB=y
+CONFIG_NET_USB=y
+CONFIG_NET_USB_ASIX=y
 # CONFIG_SPI is not set
 CONFIG_MTD=y
 CONFIG_NAND=y
@@ -66,6 +68,10 @@ CONFIG_NAND=y
 # CONFIG_NAND_ECC_HW_NONE is not set
 CONFIG_NAND_ATMEL=y
 CONFIG_UBI=y
+CONFIG_USB=y
+CONFIG_USB_EHCI=y
+CONFIG_USB_EHCI_ATMEL=y
+CONFIG_USB_STORAGE=y
 CONFIG_MCI=y
 CONFIG_MCI_STARTUP=y
 CONFIG_MCI_ATMEL=y
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#8 lore raw

Re: [PATCH 7/9] at91sam9m10g45ek: add usb support

Quoted 1 line · Jean-Christophe PLAGNIOL-VILLARD

warning: the ohci work only without MMU

This should give a compilation warning at minimum given that MMU is enabled in the defconfig

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#9 lore raw

Re: [PATCH 7/9] at91sam9m10g45ek: add usb support

Quoted 5 lines · Sascha Hauer
Quoted 1 line · Jean-Christophe PLAGNIOL-VILLARD

warning: the ohci work only without MMU

This should give a compilation warning at minimum given that MMU is enabled in the defconfig

I was thinking to put a depend ont he driver

Best Regards,
J.

Quoted 8 lines

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#10 lore raw

Re: [PATCH 7/9] at91sam9m10g45ek: add usb support

Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 5 lines · Sascha Hauer
Quoted 1 line · Jean-Christophe PLAGNIOL-VILLARD

warning: the ohci work only without MMU

This should give a compilation warning at minimum given that MMU is enabled in the defconfig

I was thinking to put a depend ont he driver

Fine with me.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#11 lore raw

Re: [PATCH 7/9] at91sam9m10g45ek: add usb support

Quoted 10 lines · Sascha Hauer
Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 5 lines · Sascha Hauer
Quoted 1 line · Jean-Christophe PLAGNIOL-VILLARD

warning: the ohci work only without MMU

This should give a compilation warning at minimum given that MMU is enabled in the defconfig

I was thinking to put a depend ont he driver

Fine with me.

send in other pull request for master

Best Regards,
J.

Quoted 9 lines

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#12 lore raw

PATCH 8/9 at91sam9x5: add ehci support

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 arch/arm/mach-at91/at91sam9x5.c         |    1 +
 arch/arm/mach-at91/at91sam9x5_devices.c |   22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+)
arch/arm/mach-at91/at91sam9x5.c +1 -0
index 5d43423..e6e3a2f 100644
@@ -206,6 +206,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("macb_clk", "macb0", &macb0_clk),
 	CLKDEV_CON_DEV_ID("macb_clk", "macb1", &macb1_clk),
 	CLKDEV_CON_ID("ohci_clk", &uhphs_clk),
+	CLKDEV_CON_DEV_ID("ehci_clk", "atmel-ehci", &uhphs_clk),
 	CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi0", &spi0_clk),
 	CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi1", &spi1_clk),
 	CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci0", &mmc0_clk),
arch/arm/mach-at91/at91sam9x5_devices.c +22 -0
index 71057a5..8e59fe0 100644
@@ -56,6 +56,28 @@ void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data)
 void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data) {}
 #endif
 
+#if defined(CONFIG_USB_EHCI)
+void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data)
+{
+	int i;
+
+	if (!data)
+		return;
+
+	/* Enable VBus control for UHP ports */
+	for (i = 0; i < data->ports; i++) {
+		if (gpio_is_valid(data->vbus_pin[i]))
+			at91_set_gpio_output(data->vbus_pin[i],
+					     data->vbus_pin_active_low[i]);
+	}
+
+	add_generic_device("atmel-ehci", DEVICE_ID_SINGLE, NULL, AT91SAM9X5_EHCI_BASE,
+			1024 * 1024, IORESOURCE_MEM, data);
+}
+#else
+void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data) {}
+#endif
+
 #if defined(CONFIG_DRIVER_NET_MACB)
 void at91_add_device_eth(int id, struct at91_ether_platform_data *data)
 {
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#13 lore raw

PATCH 9/9 at91sam9x5ek: add usb support

In reply to Jean-Christophe PLAGNIOL-VILLARD

warning: the ohci work only without MMU

enable:
- ehci
- usb strorage
- usb net asix

---
 arch/arm/boards/at91sam9x5ek/init.c     |   20 +++++++++++++++-----
 arch/arm/configs/at91sam9x5ek_defconfig |    6 ++++++
 2 files changed, 21 insertions(+), 5 deletions(-)
arch/arm/boards/at91sam9x5ek/init.c +15 -5
index f230205..5e11241 100644
@@ -192,14 +192,24 @@ static void ek_add_device_spi(void)
 	at91_add_device_spi(0, &spi_pdata);
 }
 
+#if defined(CONFIG_USB_OHCI) || defined(CONFIG_USB_EHCI)
 /*
- * USB Host port
+ * USB HS Host port (common to OHCI & EHCI)
  */
-static struct at91_usbh_data __initdata ek_usbh_data = {
-	.ports		= 2,
-	.vbus_pin	= {AT91_PIN_PD20, AT91_PIN_PD19},
+static struct at91_usbh_data ek_usbh_hs_data = {
+	.ports			= 2,
+	.vbus_pin		= {AT91_PIN_PD19, AT91_PIN_PD20},
 };
 
+static void ek_add_device_usb(void)
+{
+	at91_add_device_usbh_ohci(&ek_usbh_hs_data);
+	at91_add_device_usbh_ehci(&ek_usbh_hs_data);
+}
+#else
+static void ek_add_device_usb(void) {}
+#endif
+
 struct gpio_led leds[] = {
 	{
 		.gpio	= AT91_PIN_PB18,
@@ -250,7 +260,7 @@ static int at91sam9x5ek_devices_init(void)
 	ek_add_device_eth();
 	ek_add_device_spi();
 	ek_add_device_mci();
-	at91_add_device_usbh_ohci(&ek_usbh_data);
+	ek_add_device_usb();
 	ek_add_led();
 	ek_add_device_i2c();
 
arch/arm/configs/at91sam9x5ek_defconfig +6 -0
index 0df8631..400a35b 100644
@@ -52,6 +52,8 @@ CONFIG_NET_NFS=y
 CONFIG_NET_PING=y
 CONFIG_NET_NETCONSOLE=y
 CONFIG_DRIVER_NET_MACB=y
+CONFIG_NET_USB=y
+CONFIG_NET_USB_ASIX=y
 CONFIG_DRIVER_SPI_ATMEL=y
 CONFIG_MTD_M25P80=y
 CONFIG_I2C=y
@@ -66,6 +68,10 @@ CONFIG_NAND=y
 CONFIG_NAND_ATMEL=y
 CONFIG_NAND_ATMEL_PMECC=y
 CONFIG_UBI=y
+CONFIG_USB=y
+CONFIG_USB_EHCI=y
+CONFIG_USB_EHCI_ATMEL=y
+CONFIG_USB_STORAGE=y
 CONFIG_MCI=y
 CONFIG_MCI_STARTUP=y
 CONFIG_MCI_ATMEL=y
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#14 lore raw
In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD

HI,

the following patch series add the ehci support to atmel

it also allow to discover the caps resources via cr_capbase so no need to hardcode it anymore

Quoted 8 lines

The following changes since commit 3de3b677ee3adc4e10235b623a8e0aa45be48893:

Makefile: move cmd_check_file_size to Makefile.lib (2013-01-20 12:51:28 +0100)

are available in the git repository at:

git://git.jcrosoft.org/barebox.git delivery/atmel_usb_ehci

Applied, thanks

Sascha

Quoted 46 lines

for you to fetch changes up to 44aea6f57969984648a0686ce698b14e55e55752:

at91sam9x5ek: add usb support (2013-01-17 22:45:45 +0800)

----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (9):
usb: add parameters info on usb device
usb: fix for USB_ST_STALLED status reporting in ehci_submit_async()
ehci: if caps ressource is not provided discover it via cr_capbase
ehci: add atmel support
at91: usb: allow to specicfy inverted vbus
at91sam9g45: add ehci support
at91sam9m10g45ek: add usb support
at91sam9x5: add ehci support
at91sam9x5ek: add usb support

 arch/arm/boards/at91sam9m10g45ek/init.c     |   20 ++++++++++++++++++++
 arch/arm/boards/at91sam9x5ek/init.c         |   20 +++++++++++++++-----
 arch/arm/configs/at91sam9m10g45ek_defconfig |    6 ++++++
 arch/arm/configs/at91sam9x5ek_defconfig     |    6 ++++++
 arch/arm/mach-at91/at91rm9200_devices.c     |    9 +++++++++
 arch/arm/mach-at91/at91sam9260_devices.c    |    9 +++++++++
 arch/arm/mach-at91/at91sam9261_devices.c    |    9 +++++++++
 arch/arm/mach-at91/at91sam9263_devices.c    |    3 ++-
 arch/arm/mach-at91/at91sam9g45.c            |    1 +
 arch/arm/mach-at91/at91sam9g45_devices.c    |   25 ++++++++++++++++++++++++-
 arch/arm/mach-at91/at91sam9n12_devices.c    |    3 ++-
 arch/arm/mach-at91/at91sam9x5.c             |    1 +
 arch/arm/mach-at91/at91sam9x5_devices.c     |   25 ++++++++++++++++++++++++-
 arch/arm/mach-at91/include/mach/board.h     |    2 ++
 drivers/usb/core/usb.c                      |   14 ++++++++++++++
 drivers/usb/host/Kconfig                    |    5 +++++
 drivers/usb/host/Makefile                   |    1 +
 drivers/usb/host/ehci-atmel.c               |   96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/usb/host/ehci-hcd.c                 |   18 ++++++++++++++----
 19 files changed, 260 insertions(+), 13 deletions(-)
 create mode 100644 drivers/usb/host/ehci-atmel.c

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox