Re: [PATCH 1/3] usb: host: f_usb20ho: add support for Fujitsu ehci/ohci USB 2.0 host controller

From: Arnd Bergmann
Date: Tue Dec 16 2014 - 04:06:48 EST


On Tuesday 16 December 2014 10:10:26 Sneeker Yeh wrote:
> This patch adds support for EHCI compliant Host controller found
> on Fujitsu Socs.
>
> Signed-off-by: Sneeker Yeh <Sneeker.Yeh@xxxxxxxxxxxxxx>
> ---
> .../devicetree/bindings/usb/fujitsu-ehci.txt | 22 ++
> drivers/usb/host/Kconfig | 11 +
> drivers/usb/host/Makefile | 1 +
> drivers/usb/host/f_usb20ho_hcd.c | 306 ++++++++++++++++++++
> drivers/usb/host/f_usb20ho_hcd.h | 35 +++
> 5 files changed, 375 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/usb/fujitsu-ehci.txt
> create mode 100644 drivers/usb/host/f_usb20ho_hcd.c
> create mode 100644 drivers/usb/host/f_usb20ho_hcd.h
>
> diff --git a/Documentation/devicetree/bindings/usb/fujitsu-ehci.txt b/Documentation/devicetree/bindings/usb/fujitsu-ehci.txt
> new file mode 100644
> index 0000000..e180860
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/usb/fujitsu-ehci.txt
> @@ -0,0 +1,22 @@
> +FUJITSU GLUE COMPONENTS
> +
> +MB86S7x EHCI GLUE
> + - compatible : Should be "fujitsu,f_usb20ho_hcd"

Please try to use the binding from

Documentation/devicetree/bindings/usb/usb-ehci.txt and the respective
ohci binding first, and use two separate devic enodes.

> + - reg : Address and length of the register set for the device.
> + - interrupts : The irq number of this device that is used to interrupt the
> + CPU
> + - clocks: from common clock binding, handle to usb clock.
> + - clock-names: from common clock binding.

You should always document the specific strings for a named property.

> + - #stream-id-cells : handle to use "arm,mmu-400" ARM IOMMU driver

Don't use that binding, we are trying to kill that off. Instead, use
an 'iommus' property.


> + hci_res[0].start = ohci ? resource->start + F_OHCI_OFFSET :
> + resource->start + F_EHCI_OFFSET;
> + hci_res[0].end = ohci ?
> + resource->start + F_OHCI_OFFSET + F_OHCI_SIZE - 1 :
> + resource->start + F_EHCI_OFFSET + F_EHCI_SIZE - 1;
> + hci_res[0].flags = IORESOURCE_MEM;
> +
> + hci_res[1].start = irq;
> + hci_res[1].flags = IORESOURCE_IRQ;
> +
> + hci_dev = platform_device_alloc(ohci ? "ohci-platform" :
> + "ehci-platform", 0);
> + if (!hci_dev) {
> + dev_err(&pdev->dev, "platform_device_alloc() failed\n");
> + ret = -ENODEV;
> + goto err_res;
> + }

No need for playing games with child devices, just see how the other
drivers do it.

> + ret = platform_device_add(hci_dev);
> + if (ret) {
> + dev_err(&pdev->dev, "platform_device_add() failed\n");
> + goto err_alloc;
> + }
> +
> + return hci_dev;
> +
> +err_alloc:
> + platform_device_put(hci_dev);
> +err_res:
> + return ERR_PTR(ret);
> +}
> +
> +static u64 f_usb20ho_dma_mask = DMA_BIT_MASK(32);

The dma mask should come from the dma-ranges property of the parent bus,
as of_platform_populate now does.

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/