mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] usb: ohci: Clear control register at driver startup
@ 2016-05-25 18:13 Alexander Shiyan
  2016-05-25 18:13 ` [PATCH 2/3] usb: Add OHCI platform driver Alexander Shiyan
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Alexander Shiyan @ 2016-05-25 18:13 UTC (permalink / raw)
  To: barebox

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/usb/host/ohci-at91.c | 7 -------
 drivers/usb/host/ohci-hcd.c  | 7 ++++---
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 0f5c8f1..0a6e5ca 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -44,8 +44,6 @@ static void at91_stop_clock(void)
 
 static int at91_ohci_probe(struct device_d *dev)
 {
-	struct ohci_regs __iomem *regs = (struct ohci_regs __iomem *)dev->resource[0].start;
-
 	iclk = clk_get(NULL, "ohci_clk");
 	fclk = clk_get(NULL, "uhpck");
 
@@ -54,11 +52,6 @@ static int at91_ohci_probe(struct device_d *dev)
 	 */
 	at91_start_clock();
 
-	/*
-	 * The USB host controller must remain in reset.
-	 */
-	writel(0, &regs->control);
-
 	add_generic_device("ohci", DEVICE_ID_DYNAMIC, NULL, dev->resource[0].start,
 			   resource_size(&dev->resource[0]), IORESOURCE_MEM, NULL);
 
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 612c3a1..a4795bb 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1817,14 +1817,15 @@ static int ohci_probe(struct device_d *dev)
 		return -ENOMEM;
 	memset(ohci->ohci_dev, 0, sizeof(*ohci->ohci_dev));
 
-	usb_register_host(host);
-
 	iores = dev_request_mem_resource(dev, 0);
 	if (IS_ERR(iores))
 		return PTR_ERR(iores);
 	ohci->regs = IOMEM(iores->start);
 
-	return 0;
+	/* Put the USB host controller into reset */
+	writel(0, &ohci->regs->control);
+
+	return usb_register_host(host);
 }
 
 static struct driver_d ohci_driver = {
-- 
2.4.9


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/3] usb: Add OHCI platform driver
  2016-05-25 18:13 [PATCH 1/3] usb: ohci: Clear control register at driver startup Alexander Shiyan
@ 2016-05-25 18:13 ` Alexander Shiyan
  2016-05-26  6:28   ` Sascha Hauer
  2016-05-25 18:13 ` [PATCH 3/3] usb: Replace AT91 OHCI driver with platform OHCI driver Alexander Shiyan
  2016-05-26  6:21 ` [PATCH 1/3] usb: ohci: Clear control register at driver startup Sascha Hauer
  2 siblings, 1 reply; 7+ messages in thread
From: Alexander Shiyan @ 2016-05-25 18:13 UTC (permalink / raw)
  To: barebox

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/usb/host/Kconfig         |  3 +++
 drivers/usb/host/Makefile        |  1 +
 drivers/usb/host/ohci-platform.c | 57 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 61 insertions(+)
 create mode 100644 drivers/usb/host/ohci-platform.c

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 54eaf46..6ff4afc 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -22,6 +22,9 @@ config USB_OHCI_AT91
 	depends on ARCH_AT91
 	bool "AT91 OHCI driver"
 
+config USB_OHCI_PLATFORM
+	bool "Platform OHCI driver"
+
 endif
 
 config USB_XHCI
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 0478d34..1b5319d 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -3,5 +3,6 @@ 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
+obj-$(CONFIG_USB_OHCI_PLATFORM)	+= ohci-platform.o
 obj-$(CONFIG_USB_XHCI)		+= xhci-hcd.o xhci-hub.o
 obj-$(CONFIG_USB_XHCI_PCI)	+= xhci-pci.o
diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
new file mode 100644
index 0000000..4c97330
--- /dev/null
+++ b/drivers/usb/host/ohci-platform.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ */
+
+#include <common.h>
+#include <driver.h>
+#include <errno.h>
+#include <init.h>
+#include <io.h>
+#include <linux/clk.h>
+
+struct ohci_platform_data {
+	int (*probe)(struct device_d *, struct resource *);
+};
+
+static struct platform_device_id ohci_platform_ids[] = {
+	{ }
+};
+
+static int ohci_platform_probe(struct device_d *dev)
+{
+	struct ohci_platform_data *data;
+	struct resource *res;
+	int ret;
+
+	ret = dev_get_drvdata(dev, (const void **)&data);
+	if (ret)
+		return ret;
+
+	res = dev_get_resource(dev, IORESOURCE_MEM, 0);
+	if (IS_ERR(res))
+		return PTR_ERR(res);
+
+	dev->priv = data;
+
+	if (data->probe) {
+		ret = data->probe(dev, res);
+		if (ret)
+			return ret;
+	}
+
+	add_generic_device_res("ohci", DEVICE_ID_SINGLE, res, 1, NULL);
+
+	return 0;
+}
+
+static struct driver_d ohci_platform_driver = {
+	.name		= "ohci-platform",
+	.id_table	= ohci_platform_ids,
+	.probe		= ohci_platform_probe,
+};
+device_platform_driver(ohci_platform_driver);
-- 
2.4.9


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 3/3] usb: Replace AT91 OHCI driver with platform OHCI driver
  2016-05-25 18:13 [PATCH 1/3] usb: ohci: Clear control register at driver startup Alexander Shiyan
  2016-05-25 18:13 ` [PATCH 2/3] usb: Add OHCI platform driver Alexander Shiyan
@ 2016-05-25 18:13 ` Alexander Shiyan
  2016-05-26  6:21 ` [PATCH 1/3] usb: ohci: Clear control register at driver startup Sascha Hauer
  2 siblings, 0 replies; 7+ messages in thread
From: Alexander Shiyan @ 2016-05-25 18:13 UTC (permalink / raw)
  To: barebox

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 arch/arm/boards/pm9g45/init.c        |  2 +-
 arch/arm/configs/animeo_ip_defconfig |  2 +-
 arch/arm/configs/dss11_defconfig     |  2 +-
 arch/arm/configs/pm9g45_defconfig    |  2 +-
 drivers/usb/host/Kconfig             |  9 +---
 drivers/usb/host/Makefile            |  1 -
 drivers/usb/host/ohci-at91.c         | 81 ------------------------------------
 drivers/usb/host/ohci-platform.c     | 27 ++++++++++++
 8 files changed, 32 insertions(+), 94 deletions(-)
 delete mode 100644 drivers/usb/host/ohci-at91.c

diff --git a/arch/arm/boards/pm9g45/init.c b/arch/arm/boards/pm9g45/init.c
index 524fe53..58d84dc 100644
--- a/arch/arm/boards/pm9g45/init.c
+++ b/arch/arm/boards/pm9g45/init.c
@@ -100,7 +100,7 @@ static void pm9g45_add_device_mci(void) {}
 /*
  * USB OHCI Host port
  */
-#ifdef CONFIG_USB_OHCI_AT91
+#ifdef CONFIG_USB_OHCI_PLATFORM
 static struct at91_usbh_data  __initdata usbh_data = {
 	.ports		= 2,
 	.vbus_pin	= { AT91_PIN_PD0,  -EINVAL },
diff --git a/arch/arm/configs/animeo_ip_defconfig b/arch/arm/configs/animeo_ip_defconfig
index 825c5e4..4f5e959 100644
--- a/arch/arm/configs/animeo_ip_defconfig
+++ b/arch/arm/configs/animeo_ip_defconfig
@@ -68,7 +68,7 @@ CONFIG_NAND_ATMEL=y
 CONFIG_UBI=y
 CONFIG_USB_HOST=y
 CONFIG_USB_OHCI=y
-CONFIG_USB_OHCI_AT91=y
+CONFIG_USB_OHCI_PLATFORM=y
 CONFIG_MCI=y
 CONFIG_MCI_STARTUP=y
 CONFIG_MCI_ATMEL=y
diff --git a/arch/arm/configs/dss11_defconfig b/arch/arm/configs/dss11_defconfig
index f15fb6b..ddf7acf 100644
--- a/arch/arm/configs/dss11_defconfig
+++ b/arch/arm/configs/dss11_defconfig
@@ -33,7 +33,7 @@ CONFIG_UBI=y
 CONFIG_DISK_WRITE=y
 CONFIG_USB_HOST=y
 CONFIG_USB_OHCI=y
-CONFIG_USB_OHCI_AT91=y
+CONFIG_USB_OHCI_PLATFORM=y
 CONFIG_USB_STORAGE=y
 CONFIG_MCI=y
 CONFIG_MCI_STARTUP=y
diff --git a/arch/arm/configs/pm9g45_defconfig b/arch/arm/configs/pm9g45_defconfig
index d3a5624..7661644 100644
--- a/arch/arm/configs/pm9g45_defconfig
+++ b/arch/arm/configs/pm9g45_defconfig
@@ -52,7 +52,7 @@ CONFIG_UBI=y
 CONFIG_DISK_ATA=y
 CONFIG_USB_HOST=y
 CONFIG_USB_OHCI=y
-CONFIG_USB_OHCI_AT91=y
+CONFIG_USB_OHCI_PLATFORM=y
 CONFIG_USB_STORAGE=y
 CONFIG_MCI=y
 CONFIG_MCI_ATMEL=y
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 6ff4afc..117cb2e 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -16,16 +16,9 @@ config USB_OHCI
 	bool "OHCI driver"
 	depends on !MMU
 
-if USB_OHCI
-
-config USB_OHCI_AT91
-	depends on ARCH_AT91
-	bool "AT91 OHCI driver"
-
 config USB_OHCI_PLATFORM
 	bool "Platform OHCI driver"
-
-endif
+	depends on USB_OHCI
 
 config USB_XHCI
 	bool "xHCI driver"
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 1b5319d..cf30655 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -2,7 +2,6 @@ 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
 obj-$(CONFIG_USB_OHCI_PLATFORM)	+= ohci-platform.o
 obj-$(CONFIG_USB_XHCI)		+= xhci-hcd.o xhci-hub.o
 obj-$(CONFIG_USB_XHCI_PCI)	+= xhci-pci.o
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
deleted file mode 100644
index 0a6e5ca..0000000
--- a/drivers/usb/host/ohci-at91.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * (C) Copyright 2010 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; version 2 of
- * the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <common.h>
-#include <linux/clk.h>
-#include <driver.h>
-#include <init.h>
-#include <usb/usb.h>
-#include <usb/usb_defs.h>
-#include <errno.h>
-#include <io.h>
-
-#include "ohci.h"
-
-/* interface and function clocks; sometimes also an AHB clock */
-static struct clk *iclk, *fclk;
-
-static void at91_start_clock(void)
-{
-	clk_enable(iclk);
-	clk_enable(fclk);
-}
-
-static void at91_stop_clock(void)
-{
-	clk_disable(fclk);
-	clk_disable(iclk);
-}
-
-static int at91_ohci_probe(struct device_d *dev)
-{
-	iclk = clk_get(NULL, "ohci_clk");
-	fclk = clk_get(NULL, "uhpck");
-
-	/*
-	 * Start the USB clocks.
-	 */
-	at91_start_clock();
-
-	add_generic_device("ohci", DEVICE_ID_DYNAMIC, NULL, dev->resource[0].start,
-			   resource_size(&dev->resource[0]), IORESOURCE_MEM, NULL);
-
-	return 0;
-}
-
-static void at91_ohci_remove(struct device_d *dev)
-{
-	struct ohci_regs __iomem *regs = (struct ohci_regs __iomem *)dev->resource[0].start;
-
-	/*
-	 * Put the USB host controller into reset.
-	 */
-	writel(0, &regs->control);
-
-	/*
-	 * Stop the USB clocks.
-	 */
-	at91_stop_clock();
-}
-
-static struct driver_d at91_ohci_driver = {
-	.name = "at91_ohci",
-	.probe = at91_ohci_probe,
-	.remove = at91_ohci_remove,
-};
-device_platform_driver(at91_ohci_driver);
diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
index 4c97330..5765373 100644
--- a/drivers/usb/host/ohci-platform.c
+++ b/drivers/usb/host/ohci-platform.c
@@ -18,7 +18,34 @@ struct ohci_platform_data {
 	int (*probe)(struct device_d *, struct resource *);
 };
 
+static int at91_ohci_probe(struct device_d *dev, struct resource *res)
+{
+	struct clk *iclk, *fclk;
+
+	iclk = clk_get(NULL, "ohci_clk");
+	if (IS_ERR(iclk))
+		return PTR_ERR(iclk);
+
+	fclk = clk_get(NULL, "uhpck");
+	if (IS_ERR(fclk))
+		return PTR_ERR(fclk);
+
+	/* Start the USB clocks */
+	clk_enable(iclk);
+	clk_enable(fclk);
+
+	return 0;
+}
+
+static struct ohci_platform_data at91_ohci_data = {
+	.probe	= at91_ohci_probe,
+};
+
 static struct platform_device_id ohci_platform_ids[] = {
+	{
+		.name		= "at91_ohci",
+		.driver_data	= (unsigned long)&at91_ohci_data,
+	},
 	{ }
 };
 
-- 
2.4.9


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] usb: ohci: Clear control register at driver startup
  2016-05-25 18:13 [PATCH 1/3] usb: ohci: Clear control register at driver startup Alexander Shiyan
  2016-05-25 18:13 ` [PATCH 2/3] usb: Add OHCI platform driver Alexander Shiyan
  2016-05-25 18:13 ` [PATCH 3/3] usb: Replace AT91 OHCI driver with platform OHCI driver Alexander Shiyan
@ 2016-05-26  6:21 ` Sascha Hauer
  2 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2016-05-26  6:21 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: barebox

On Wed, May 25, 2016 at 09:13:24PM +0300, Alexander Shiyan wrote:
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---

A comment why this is done would be nice.

Sascha


>  drivers/usb/host/ohci-at91.c | 7 -------
>  drivers/usb/host/ohci-hcd.c  | 7 ++++---
>  2 files changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
> index 0f5c8f1..0a6e5ca 100644
> --- a/drivers/usb/host/ohci-at91.c
> +++ b/drivers/usb/host/ohci-at91.c
> @@ -44,8 +44,6 @@ static void at91_stop_clock(void)
>  
>  static int at91_ohci_probe(struct device_d *dev)
>  {
> -	struct ohci_regs __iomem *regs = (struct ohci_regs __iomem *)dev->resource[0].start;
> -
>  	iclk = clk_get(NULL, "ohci_clk");
>  	fclk = clk_get(NULL, "uhpck");
>  
> @@ -54,11 +52,6 @@ static int at91_ohci_probe(struct device_d *dev)
>  	 */
>  	at91_start_clock();
>  
> -	/*
> -	 * The USB host controller must remain in reset.
> -	 */
> -	writel(0, &regs->control);
> -
>  	add_generic_device("ohci", DEVICE_ID_DYNAMIC, NULL, dev->resource[0].start,
>  			   resource_size(&dev->resource[0]), IORESOURCE_MEM, NULL);
>  
> diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
> index 612c3a1..a4795bb 100644
> --- a/drivers/usb/host/ohci-hcd.c
> +++ b/drivers/usb/host/ohci-hcd.c
> @@ -1817,14 +1817,15 @@ static int ohci_probe(struct device_d *dev)
>  		return -ENOMEM;
>  	memset(ohci->ohci_dev, 0, sizeof(*ohci->ohci_dev));
>  
> -	usb_register_host(host);
> -
>  	iores = dev_request_mem_resource(dev, 0);
>  	if (IS_ERR(iores))
>  		return PTR_ERR(iores);
>  	ohci->regs = IOMEM(iores->start);
>  
> -	return 0;
> +	/* Put the USB host controller into reset */
> +	writel(0, &ohci->regs->control);
> +
> +	return usb_register_host(host);
>  }
>  
>  static struct driver_d ohci_driver = {
> -- 
> 2.4.9
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] usb: Add OHCI platform driver
  2016-05-25 18:13 ` [PATCH 2/3] usb: Add OHCI platform driver Alexander Shiyan
@ 2016-05-26  6:28   ` Sascha Hauer
  0 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2016-05-26  6:28 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: barebox

On Wed, May 25, 2016 at 09:13:25PM +0300, Alexander Shiyan wrote:
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
>  drivers/usb/host/Kconfig         |  3 +++
>  drivers/usb/host/Makefile        |  1 +
>  drivers/usb/host/ohci-platform.c | 57 ++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 61 insertions(+)
>  create mode 100644 drivers/usb/host/ohci-platform.c
> 
> diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
> index 54eaf46..6ff4afc 100644
> --- a/drivers/usb/host/Kconfig
> +++ b/drivers/usb/host/Kconfig
> @@ -22,6 +22,9 @@ config USB_OHCI_AT91
>  	depends on ARCH_AT91
>  	bool "AT91 OHCI driver"
>  
> +config USB_OHCI_PLATFORM
> +	bool "Platform OHCI driver"
> +
>  endif
>  
>  config USB_XHCI
> diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
> index 0478d34..1b5319d 100644
> --- a/drivers/usb/host/Makefile
> +++ b/drivers/usb/host/Makefile
> @@ -3,5 +3,6 @@ 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
> +obj-$(CONFIG_USB_OHCI_PLATFORM)	+= ohci-platform.o
>  obj-$(CONFIG_USB_XHCI)		+= xhci-hcd.o xhci-hub.o
>  obj-$(CONFIG_USB_XHCI_PCI)	+= xhci-pci.o
> diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
> new file mode 100644
> index 0000000..4c97330
> --- /dev/null
> +++ b/drivers/usb/host/ohci-platform.c
> @@ -0,0 +1,57 @@
> +/*
> + * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.
> + */
> +
> +#include <common.h>
> +#include <driver.h>
> +#include <errno.h>
> +#include <init.h>
> +#include <io.h>
> +#include <linux/clk.h>
> +
> +struct ohci_platform_data {
> +	int (*probe)(struct device_d *, struct resource *);
> +};
> +
> +static struct platform_device_id ohci_platform_ids[] = {
> +	{ }
> +};
> +
> +static int ohci_platform_probe(struct device_d *dev)
> +{
> +	struct ohci_platform_data *data;
> +	struct resource *res;
> +	int ret;
> +
> +	ret = dev_get_drvdata(dev, (const void **)&data);
> +	if (ret)
> +		return ret;
> +
> +	res = dev_get_resource(dev, IORESOURCE_MEM, 0);
> +	if (IS_ERR(res))
> +		return PTR_ERR(res);
> +
> +	dev->priv = data;
> +
> +	if (data->probe) {
> +		ret = data->probe(dev, res);
> +		if (ret)
> +			return ret;
> +	}
> +
> +	add_generic_device_res("ohci", DEVICE_ID_SINGLE, res, 1, NULL);

We should get rid of this additional device along the way and instead
create a dedicated ohci_register() function which is directly called by
the different SoC specific drivers. See the ehci driver for a template
what I mean.

Sascha

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] usb: ohci: Clear control register at driver startup
  2014-12-14 11:55 Alexander Shiyan
@ 2014-12-18  8:42 ` Alexander Shiyan
  0 siblings, 0 replies; 7+ messages in thread
From: Alexander Shiyan @ 2014-12-18  8:42 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: barebox

Sun, 14 Dec 2014 14:55:28 +0300 от Alexander Shiyan <shc_work@mail.ru>:
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
>  drivers/usb/host/ohci-at91.c | 7 -------
>  drivers/usb/host/ohci-hcd.c  | 7 ++++---
>  2 files changed, 4 insertions(+), 10 deletions(-)

Ping.

---

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] usb: ohci: Clear control register at driver startup
@ 2014-12-14 11:55 Alexander Shiyan
  2014-12-18  8:42 ` Alexander Shiyan
  0 siblings, 1 reply; 7+ messages in thread
From: Alexander Shiyan @ 2014-12-14 11:55 UTC (permalink / raw)
  To: barebox

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/usb/host/ohci-at91.c | 7 -------
 drivers/usb/host/ohci-hcd.c  | 7 ++++---
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 0f5c8f1..0a6e5ca 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -44,8 +44,6 @@ static void at91_stop_clock(void)
 
 static int at91_ohci_probe(struct device_d *dev)
 {
-	struct ohci_regs __iomem *regs = (struct ohci_regs __iomem *)dev->resource[0].start;
-
 	iclk = clk_get(NULL, "ohci_clk");
 	fclk = clk_get(NULL, "uhpck");
 
@@ -54,11 +52,6 @@ static int at91_ohci_probe(struct device_d *dev)
 	 */
 	at91_start_clock();
 
-	/*
-	 * The USB host controller must remain in reset.
-	 */
-	writel(0, &regs->control);
-
 	add_generic_device("ohci", DEVICE_ID_DYNAMIC, NULL, dev->resource[0].start,
 			   resource_size(&dev->resource[0]), IORESOURCE_MEM, NULL);
 
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 622f5c3..e806c64 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1810,13 +1810,14 @@ static int ohci_probe(struct device_d *dev)
 		return -ENOMEM;
 	memset(ohci->ohci_dev, 0, sizeof(*ohci->ohci_dev));
 
-	usb_register_host(host);
-
 	ohci->regs = dev_request_mem_region(dev, 0);
 	if (IS_ERR(ohci->regs))
 		return PTR_ERR(ohci->regs);
 
-	return 0;
+	/* Put the USB host controller into reset */
+	writel(0, &ohci->regs->control);
+
+	return usb_register_host(host);
 }
 
 static struct driver_d ohci_driver = {
-- 
2.0.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-05-26  6:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-25 18:13 [PATCH 1/3] usb: ohci: Clear control register at driver startup Alexander Shiyan
2016-05-25 18:13 ` [PATCH 2/3] usb: Add OHCI platform driver Alexander Shiyan
2016-05-26  6:28   ` Sascha Hauer
2016-05-25 18:13 ` [PATCH 3/3] usb: Replace AT91 OHCI driver with platform OHCI driver Alexander Shiyan
2016-05-26  6:21 ` [PATCH 1/3] usb: ohci: Clear control register at driver startup Sascha Hauer
  -- strict thread matches above, loose matches on Subject: below --
2014-12-14 11:55 Alexander Shiyan
2014-12-18  8:42 ` Alexander Shiyan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox