usb: add support for generic EHCI devices
Subsystems (2)
PATCH v2 1/1 usb: add support for generic EHCI devices
This driver is meant to be used with any EHCI-compatible host controller in case if there's no need for platform-specific glue such as setup of controller or PHY's power mode via GPIOs etc.
---
Changes compared to v1:
* Updated commit message with removal of Synopsys board mention
* Cleaned-up ehci_usb_remove()
drivers/usb/host/Kconfig | 7 ++++++ drivers/usb/host/Makefile | 1 + drivers/usb/host/ehci-generic.c | 51 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 drivers/usb/host/ehci-generic.c
drivers/usb/host/Kconfig +7 -0
@@ -73,4 +73,11 @@ config USB_EHCI_UNIPHIER ---help--- Enables support for the on-chip EHCI controller on UniPhier SoCs. +config USB_EHCI_GENERIC + bool "Support for generic EHCI USB controller" + depends on OF_CONTROL + default y + ---help--- + Enables support for generic EHCI controller. + endif
drivers/usb/host/Makefile +1 -0
@@ -32,6 +32,7 @@ else obj-$(CONFIG_USB_EHCI_FSL) += ehci-fsl.o endif obj-$(CONFIG_USB_EHCI_FARADAY) += ehci-faraday.o +obj-$(CONFIG_USB_EHCI_GENERIC) += ehci-generic.o obj-$(CONFIG_USB_EHCI_EXYNOS) += ehci-exynos.o obj-$(CONFIG_USB_EHCI_MXC) += ehci-mxc.o obj-$(CONFIG_USB_EHCI_MXS) += ehci-mxs.o
drivers/usb/host/ehci-generic.c new file +51 -0
51 lines not on this page · raw message
Signature · 1 line
2.5.0
PATCH v2 1/1 usb: add support for generic EHCI devices
Hi Simon, Marek,
Quoted 96 lines · Alexey Brodkin
This driver is meant to be used with any EHCI-compatible host controller in case if there's no need for platform-specific glue such as setup of controller or PHY's power mode via GPIOs etc.
Signed-off-by Alexey Brodkin <[email protected]>Reviewed-by Simon Glass <[email protected]>Reviewed-by Marek Vasut <[email protected]>Cc Stephen Warren <[email protected]>---
Changes compared to v1:
* Updated commit message with removal of Synopsys board mention
* Cleaned-upehci_usb_remove()drivers/usb/host/Kconfig | 7 ++++++ drivers/usb/host/Makefile | 1 + drivers/usb/host/ehci-generic.c | 51 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 drivers/usb/host/ehci-generic.cdrivers/usb/host/Kconfig +7
-0@@ -73,4 +73,11 @@ config USB_EHCI_UNIPHIER ---help--- Enables support for the on-chip EHCI controller on UniPhier SoCs. +config USB_EHCI_GENERIC + bool "Support for generic EHCI USB controller" + depends on OF_CONTROL + default y + ---help--- + Enables support for generic EHCI controller. + endifdrivers/usb/host/Makefile +1
-0@@ -32,6 +32,7 @@ else obj-$(CONFIG_USB_EHCI_FSL) += ehci-fsl.o endif obj-$(CONFIG_USB_EHCI_FARADAY) += ehci-faraday.o +obj-$(CONFIG_USB_EHCI_GENERIC) += ehci-generic.o obj-$(CONFIG_USB_EHCI_EXYNOS) += ehci-exynos.o obj-$(CONFIG_USB_EHCI_MXC) += ehci-mxc.o obj-$(CONFIG_USB_EHCI_MXS) += ehci-mxs.odrivers/usb/host/ehci-generic.c new file +41
-0@@ -0,0 +1,51 @@ +/* +* Copyright (C) 2015 Alexey Brodkin <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <dm.h> +#include "ehci.h" + +/* +* Even though here we don't explicitly use "struct ehci_ctrl" +* ehci_register() expects it to be the first thing that resides in +* device's private data. +*/ +struct generic_ehci { +struct ehci_ctrl ctrl; +}; + +static int ehci_usb_probe (struct udevice *dev) +{ +struct ehci_hccr *hccr = (struct ehci_hccr *)dev_get_addr (dev); +struct ehci_hcor *hcor; + + hcor = (struct ehci_hcor *)((uint32_t )hccr + +HC_LENGTH (ehci_readl (&hccr->cr_capbase))); + +return ehci_register (dev, hccr, hcor,NULL ,0 ,USB_INIT_HOST ); +} + +static int ehci_usb_remove (struct udevice *dev) +{ +return ehci_deregister (dev); +} + +static const struct udevice_id ehci_usb_ids[] = { + { .compatible ="generic-ehci" }, + { } +}; + +U_BOOT_DRIVER (usb_ehci) = {
drivers/usb/host/ehci-generic.c line 51
Quoted 10 lines
drivers/usb/host/ehci-generic.c new file +10
-0+ .name = "ehci_generic", + .id = UCLASS_USB, + .of_match = ehci_usb_ids, + .probe = ehci_usb_probe, + .remove = ehci_usb_remove, + .ops = &ehci_usb_ops, + .priv_auto_alloc_size = sizeof(struct generic_ehci), + .flags = DM_FLAG_ALLOC_PRIV_DMA, +}; +
Any comments on that one or there's a chance it could be applied?
-Alexey
PATCH v2 1/1 usb: add support for generic EHCI devices
In reply to Alexey BrodkinQuoted 16 lines · Alexey Brodkin
This driver is meant to be used with any EHCI-compatible host controller in case if there's no need for platform-specific glue such as setup of controller or PHY's power mode via GPIOs etc.
Signed-off-by Alexey Brodkin <[email protected]>Reviewed-by Simon Glass <[email protected]>Reviewed-by Marek Vasut <[email protected]>Cc Stephen Warren <[email protected]>---
Changes compared to v1:
* Updated commit message with removal of Synopsys board mention
* Cleaned-upehci_usb_remove()
Quoted 5 lines
drivers/usb/host/Kconfig | 7 ++++++ drivers/usb/host/Makefile | 1 + drivers/usb/host/ehci-generic.c | 51 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 drivers/usb/host/ehci-generic.c
Marek do you want to pick this up?
- Simon
PATCH v2 1/1 usb: add support for generic EHCI devices
Quoted 25 lines · Simon Glass
On 18 November 2015 at 08:26, Alexey Brodkin
Quoted 15 lines · <[email protected]> wrote:
This driver is meant to be used with any EHCI-compatible host controller in case if there's no need for platform-specific glue such as setup of controller or PHY's power mode via GPIOs etc.
Signed-off-by Alexey Brodkin <[email protected]>Reviewed-by Simon Glass <[email protected]>Reviewed-by Marek Vasut <[email protected]>Cc Stephen Warren <[email protected]>---
Changes compared to v1:
* Updated commit message with removal of Synopsys board mention
* Cleaned-upehci_usb_remove()Quoted 6 lines
drivers/usb/host/Kconfig | 7 ++++++ drivers/usb/host/Makefile | 1 + drivers/usb/host/ehci-generic.c | 51 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 drivers/usb/host/ehci-generic.c
Quoted 3 lines
Reviewed-by Simon Glass <[email protected]>Marek do you want to pick this up?
I have some comments.
Best regards,
Marek Vasut
PATCH v2 1/1 usb: add support for generic EHCI devices
In reply to Alexey BrodkinQuoted 14 lines · Alexey Brodkin
This driver is meant to be used with any EHCI-compatible host controller in case if there's no need for platform-specific glue such as setup of controller or PHY's power mode via GPIOs etc.
Signed-off-by Alexey Brodkin <[email protected]>Reviewed-by Simon Glass <[email protected]>Reviewed-by Marek Vasut <[email protected]>Cc Stephen Warren <[email protected]>---
Changes compared to v1:
* Updated commit message with removal of Synopsys board mention
* Cleaned-upehci_usb_remove()
[...]
drivers/usb/host/ehci-generic.c line 25
Quoted 6 lines
drivers/usb/host/ehci-generic.c new file +6
-0+static int ehci_usb_probe (struct udevice *dev) +{ +struct ehci_hccr *hccr = (struct ehci_hccr *)dev_get_addr (dev); +struct ehci_hcor *hcor; + + hcor = (struct ehci_hcor *)((uint32_t)hccr +
This should be uintptr_t for the sake of 64bit systems, no ?
drivers/usb/host/ehci-generic.c line 29
Quoted 4 lines
drivers/usb/host/ehci-generic.c new file +4
-0+ HC_LENGTH(ehci_readl(&hccr->cr_capbase))); + +return ehci_register (dev, hccr, hcor,NULL ,0 ,USB_INIT_HOST ); +}
I can fix that nit when applying, so let me know what you think please.
Best regards,
Marek Vasut
PATCH v2 1/1 usb: add support for generic EHCI devices
Hi Marek,
Quoted 18 lines · Marek Vasut
Quoted 14 lines · Alexey Brodkin
This driver is meant to be used with any EHCI-compatible host controller in case if there's no need for platform-specific glue such as setup of controller or PHY's power mode via GPIOs etc.
Signed-off-by Alexey Brodkin <[email protected]>Reviewed-by Simon Glass <[email protected]>Reviewed-by Marek Vasut <[email protected]>Cc Stephen Warren <[email protected]>---
Changes compared to v1:
* Updated commit message with removal of Synopsys board mention
* Cleaned-upehci_usb_remove()[...]
Quoted 8 lines
drivers/usb/host/ehci-generic.c line 25
Quoted 6 lines
drivers/usb/host/ehci-generic.c new file +6
-0+static int ehci_usb_probe (struct udevice *dev) +{ +struct ehci_hccr *hccr = (struct ehci_hccr *)dev_get_addr (dev); +struct ehci_hcor *hcor; + + hcor = (struct ehci_hcor *)((uint32_t)hccr +This should be
uintptr_tfor the sake of 64bit systems, no ?
Hm, that's a good point!
Indeed I was only thinking about 32-bit systems that I work with. So please do that change.
What's interesting most of other USB drivers do use "uint32_t" so there's a room for improvement it seems :)
-Alexey
PATCH v2 1/1 usb: add support for generic EHCI devices
Quoted 1 line · Alexey Brodkin
Hi Marek,
Hi!
Quoted 28 lines · Marek Vasut
Quoted 18 lines · Alexey Brodkin
Quoted 14 lines
This driver is meant to be used with any EHCI-compatible host controller in case if there's no need for platform-specific glue such as setup of controller or PHY's power mode via GPIOs etc.
Signed-off-by Alexey Brodkin <[email protected]>Reviewed-by Simon Glass <[email protected]>Reviewed-by Marek Vasut <[email protected]>Cc Stephen Warren <[email protected]>---
Changes compared to v1:
* Updated commit message with removal of Synopsys board mention
* Cleaned-upehci_usb_remove()[...]
Quoted 8 lines
drivers/usb/host/ehci-generic.c line 25
Quoted 6 lines
drivers/usb/host/ehci-generic.c new file +6
-0+static int ehci_usb_probe (struct udevice *dev) +{ +struct ehci_hccr *hccr = (struct ehci_hccr *)dev_get_addr (dev); +struct ehci_hcor *hcor; + + hcor = (struct ehci_hcor *)((uint32_t)hccr +This should be
uintptr_tfor the sake of 64bit systems, no ?
Quoted 2 lines
Hm, that's a good point!
Indeed I was only thinking about 32-bit systems that I work with.
You work for hardware design company, no ? I'd expect you guys thing about 256byte long cachelines and other such stuff :-)
Quoted 4 lines
So please do that change.
What's interesting most of other USB drivers do use "
uint32_t" so there's a room for improvement it seems :)
Patches are welcome ;-) Besides, please use u32 instead of uint32_t.
Quoted 1 line
-Alexey
Best regards,
Marek Vasut
PATCH v2 1/1 usb: add support for generic EHCI devices
In reply to Marek VasutHi Marek,
Quoted 27 lines · Marek Vasut
Quoted 14 lines · Alexey Brodkin
This driver is meant to be used with any EHCI-compatible host controller in case if there's no need for platform-specific glue such as setup of controller or PHY's power mode via GPIOs etc.
Signed-off-by Alexey Brodkin <[email protected]>Reviewed-by Simon Glass <[email protected]>Reviewed-by Marek Vasut <[email protected]>Cc Stephen Warren <[email protected]>---
Changes compared to v1:
* Updated commit message with removal of Synopsys board mention
* Cleaned-upehci_usb_remove()[...]
drivers/usb/host/ehci-generic.c line 25
Quoted 6 lines
drivers/usb/host/ehci-generic.c new file +6
-0+static int ehci_usb_probe (struct udevice *dev) +{ +struct ehci_hccr *hccr = (struct ehci_hccr *)dev_get_addr (dev); +struct ehci_hcor *hcor; + + hcor = (struct ehci_hcor *)((uint32_t)hccr +This should be
uintptr_tfor the sake of 64bit systems, no ?
Quoted 6 lines
drivers/usb/host/ehci-generic.c line 29
Quoted 4 lines
drivers/usb/host/ehci-generic.c new file +4
-0+ HC_LENGTH(ehci_readl(&hccr->cr_capbase))); + +return ehci_register (dev, hccr, hcor,NULL ,0 ,USB_INIT_HOST ); +}I can fix that nit when applying, so let me know what you think please.
Could you please do that fix and apply the patch?
-Alexey
PATCH v2 1/1 usb: add support for generic EHCI devices
Quoted 30 lines · Alexey Brodkin
Hi Marek,
Quoted 27 lines · Marek Vasut
Quoted 14 lines · Alexey Brodkin
This driver is meant to be used with any EHCI-compatible host controller in case if there's no need for platform-specific glue such as setup of controller or PHY's power mode via GPIOs etc.
Signed-off-by Alexey Brodkin <[email protected]>Reviewed-by Simon Glass <[email protected]>Reviewed-by Marek Vasut <[email protected]>Cc Stephen Warren <[email protected]>---
Changes compared to v1:
* Updated commit message with removal of Synopsys board mention
* Cleaned-upehci_usb_remove()[...]
drivers/usb/host/ehci-generic.c line 25
Quoted 6 lines
drivers/usb/host/ehci-generic.c new file +6
-0+static int ehci_usb_probe (struct udevice *dev) +{ +struct ehci_hccr *hccr = (struct ehci_hccr *)dev_get_addr (dev); +struct ehci_hcor *hcor; + + hcor = (struct ehci_hcor *)((uint32_t)hccr +This should be
uintptr_tfor the sake of 64bit systems, no ?
Quoted 8 lines
Quoted 6 lines
drivers/usb/host/ehci-generic.c line 29
Quoted 4 lines
drivers/usb/host/ehci-generic.c new file +4
-0+ HC_LENGTH(ehci_readl(&hccr->cr_capbase))); + +return ehci_register (dev, hccr, hcor,NULL ,0 ,USB_INIT_HOST ); +}I can fix that nit when applying, so let me know what you think please.
Could you please do that fix and apply the patch?
Done and applied, thanks!
Best regards,
Marek Vasut