mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Michael Graichen <michael.graichen@hotmail.com>
Cc: "barebox@lists.infradead.org" <barebox@lists.infradead.org>,
	"m.tretter@pengutronix.de" <m.tretter@pengutronix.de>,
	"a.fatoum@pengutronix.de" <a.fatoum@pengutronix.de>,
	"johannes@gnu-linux.rocks" <johannes@gnu-linux.rocks>
Subject: Re: [PATCH] added zynq 7000 usb support
Date: Thu, 22 May 2025 22:23:05 +0200	[thread overview]
Message-ID: <aC-HqY6SKkLLtGeE@pengutronix.de> (raw)
In-Reply-To: <VI1PR02MB44291219773B2D4E4D4D2777AB9CA@VI1PR02MB4429.eurprd02.prod.outlook.com>

On Mon, May 19, 2025 at 07:09:06AM +0000, Michael Graichen wrote:
> This adds support to use the USB interface on Zynq-7000 SoC.
> 
> Signed-off-by: Michael Graichen <michael.graichen@hotmail.com>
> ---
>  drivers/usb/host/Kconfig     |  8 ++++++++
>  drivers/usb/host/Makefile    |  1 +
>  drivers/usb/host/ehci-zynq.c | 36 ++++++++++++++++++++++++++++++++++++
>  3 files changed, 45 insertions(+)
>  create mode 100644 drivers/usb/host/ehci-zynq.c
> 
> diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
> index d38b4dcac4..812270f869 100644
> --- a/drivers/usb/host/Kconfig
> +++ b/drivers/usb/host/Kconfig
> @@ -14,6 +14,14 @@ config USB_EHCI_ATMEL
>  	select USB_OHCI_AT91
>  	bool "Atmel EHCI driver"
>  
> +config USB_EHCI_ZYNQ
> +	bool "Support for Xilinx Zynq on-chip EHCI USB controller"
> +	depends on ARCH_ZYNQ
> +	select USB_EHCI

Please use "depends on USB_EHCI" rather than selecting it.

> +	select USB_ULPI
> +	help
> +	  Enable support for Zynq on-chip EHCI USB controller
> +
>  config USB_OHCI
>  	bool "OHCI driver"
>  	depends on !MMU && HAS_DMA
> diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
> index e55dff4580..cbddfbe923 100644
> --- a/drivers/usb/host/Makefile
> +++ b/drivers/usb/host/Makefile
> @@ -2,6 +2,7 @@
>  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_EHCI_ZYNQ)	+= ehci-zynq.o
>  obj-$(CONFIG_USB_OHCI)		+= ohci-hcd.o
>  obj-$(CONFIG_USB_OHCI_AT91)	+= ohci-at91.o
>  obj-$(CONFIG_USB_XHCI)		+= xhci.o xhci-mem.o xhci-ring.o
> diff --git a/drivers/usb/host/ehci-zynq.c b/drivers/usb/host/ehci-zynq.c
> new file mode 100644
> index 0000000000..f08e9a3c5c
> --- /dev/null
> +++ b/drivers/usb/host/ehci-zynq.c
> @@ -0,0 +1,36 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * USB Low level initialization(Specific to Zynq 7000)
> + */
> +
> +#include <common.h>
> +#include <linux/usb/ulpi.h>
> +
> +static int zynq_ehci_probe(struct device_d *dev)
> +{
> +	struct resource *res;
> +	void __iomem *base;
> +
> +	res = dev_get_resource(dev, IORESOURCE_MEM, 0);
> +	if (!res)
> +		return -EINVAL;

dev_get_resource() returns an ERR_PTR. Test the result with

	if (IS_ERR(ret))
		return PTR_ERR(res);

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



      reply	other threads:[~2025-05-22 20:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-19  7:09 Michael Graichen
2025-05-22 20:23 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aC-HqY6SKkLLtGeE@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=johannes@gnu-linux.rocks \
    --cc=m.tretter@pengutronix.de \
    --cc=michael.graichen@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox