All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v1 09/16] ehci: Add support for Qualcomm EHCI
Date: Wed, 6 Jan 2016 22:04:07 +0100	[thread overview]
Message-ID: <201601062204.07374.marex@denx.de> (raw)
In-Reply-To: <1452104488-5502-10-git-send-email-mateusz.kulikowski@gmail.com>

On Wednesday, January 06, 2016 at 07:21:21 PM, Mateusz Kulikowski wrote:
> This driver is able to reconfigure OTG controller into HOST mode.
> Board can add board-specific initialization as board_prepare_usb().
> It requires USB_ULPI_VIEWPORT enabled in board configuration.
> 
> Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>

[...]

> +static int msm_init_after_reset(struct ehci_ctrl *dev)
> +{
> +	struct msm_ehci_priv *p = container_of(dev, struct msm_ehci_priv, ctrl);
> +	struct usb_ehci *ehci = p->ehci;
> +
> +	/* select ULPI phy */
> +	writel(0x80000000, &ehci->portsc);

Don't we have macro for this bit ?

> +	setup_usb_phy(p);
> +
> +	/* Enable sess_vld */
> +	setbits_le32(&ehci->genconfig2, GEN2_SESS_VLD_CTRL_EN);
> +
> +	/* Enable external vbus configuration in the LINK */
> +	setbits_le32(&ehci->usbcmd, SESS_VLD_CTRL);
> +
> +	/* USB_OTG_HS_AHB_BURST */
> +	writel(0x0, &ehci->sbuscfg);
> +
> +	/* USB_OTG_HS_AHB_MODE: HPROT_MODE */
> +	/* Bus access related config. */
> +	writel(0x08, &ehci->sbusmode);
> +
> +	/* set mode to host controller */
> +	writel(CM_HOST, &ehci->usbmode);
> +
> +	return 0;
> +}

[...]

> +static int ehci_usb_remove(struct udevice *dev)
> +{
> +	struct msm_ehci_priv *p = dev_get_priv(dev);
> +	struct usb_ehci *ehci = p->ehci;
> +	int ret;
> +
> +	ret = ehci_deregister(dev);
> +	if (ret)
> +		return ret;
> +
> +	/* Stop controller. */
> +	clrbits_le32(&ehci->usbcmd, CMD_RUN);
> +
> +	reset_usb_phy(p);
> +
> +	ret = board_prepare_usb(USB_INIT_DEVICE); /* Board specific hook */
> +	if (ret < 0)
> +		return ret;
> +
> +	/* Reset controller */
> +	setbits_le32(&ehci->usbcmd, CMD_RESET);
> +
> +	/* Wait for reset */
> +	if (wait_for_bit(__func__, &ehci->usbcmd, CMD_RESET, false, 30,

Ad. this wait_for_bit() , you can define a macro "wait_for_bit()" in some header 
file which would call the final __wait_for_bit(). The trick is, such macro will 
expand in place and you wouldn't have to call it with __func__ argument. The 
macro would be able to pass that __func__ argument into the final 
__wait_for_bit() . But that's just an idea, it doesn't prevent this driver from 
mainlining of course.

> +			 false)) {
> +		printf("Stuck on USB reset.\n");
> +		return -ETIMEDOUT;
> +	}
> +
> +	return 0;
> +}

Other than that portsc bit, add my

Acked-by: Marek Vasut <marex@denx.de>

  reply	other threads:[~2016-01-06 21:04 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-06 18:21 [U-Boot] [PATCH v1 00/16] Add support for 96boards Dragonboard410C board Mateusz Kulikowski
2016-01-06 18:21 ` [U-Boot] [PATCH v1 01/16] serial: Add support for Qualcomm serial port Mateusz Kulikowski
2016-01-11 16:57   ` Simon Glass
2016-01-06 18:21 ` [U-Boot] [PATCH v1 02/16] gpio: Add support for Qualcomm gpio controller Mateusz Kulikowski
2016-01-11 16:57   ` Simon Glass
2016-01-11 21:27     ` Mateusz Kulikowski
2016-01-06 18:21 ` [U-Boot] [PATCH v1 03/16] mmc: Add support for Qualcomm SDHCI controller Mateusz Kulikowski
2016-01-11 16:57   ` Simon Glass
2016-01-06 18:21 ` [U-Boot] [PATCH v1 04/16] ehci-hcd: Add init_after_reset Mateusz Kulikowski
2016-01-11 16:57   ` Simon Glass
2016-01-06 18:21 ` [U-Boot] [PATCH v1 05/16] usb: ulpi: Add Kconfig options for ULPI Mateusz Kulikowski
2016-01-06 20:49   ` Marek Vasut
2016-01-07 22:12     ` Mateusz Kulikowski
2016-01-07 22:50       ` Marek Vasut
2016-01-07 23:18       ` Simon Glass
2016-01-11 21:30         ` Mateusz Kulikowski
2016-01-06 18:21 ` [U-Boot] [PATCH v1 06/16] usb: Rename ehci-fsl.h to ehci-ci.h Mateusz Kulikowski
2016-01-06 20:51   ` Marek Vasut
2016-01-06 18:21 ` [U-Boot] [PATCH v1 07/16] usb: ehci-ci: Add missing registers Mateusz Kulikowski
2016-01-06 20:53   ` Marek Vasut
2016-01-06 18:21 ` [U-Boot] [PATCH v1 08/16] ehci-ci.h: drop generic USBCMD fields Mateusz Kulikowski
2016-01-06 20:54   ` Marek Vasut
2016-01-06 18:21 ` [U-Boot] [PATCH v1 09/16] ehci: Add support for Qualcomm EHCI Mateusz Kulikowski
2016-01-06 21:04   ` Marek Vasut [this message]
2016-01-11 21:39     ` Mateusz Kulikowski
2016-01-11 22:02       ` Marek Vasut
2016-01-06 18:21 ` [U-Boot] [PATCH v1 10/16] drivers: Add SPMI bus uclass Mateusz Kulikowski
2016-01-11 16:57   ` Simon Glass
2016-01-11 21:41     ` Mateusz Kulikowski
2016-01-06 18:21 ` [U-Boot] [PATCH v1 11/16] spmi: Add sandbox test driver Mateusz Kulikowski
2016-01-11 16:57   ` Simon Glass
2016-01-06 18:21 ` [U-Boot] [PATCH v1 12/16] drivers: spmi: Add support for Qualcomm SPMI bus driver Mateusz Kulikowski
2016-01-11 16:57   ` Simon Glass
2016-01-06 18:21 ` [U-Boot] [PATCH v1 13/16] pmic: Add support for Qualcomm PM8916 PMIC Mateusz Kulikowski
2016-01-11 16:58   ` Simon Glass
2016-01-06 18:21 ` [U-Boot] [PATCH v1 14/16] gpio: Add support for Qualcomm PM8916 gpios Mateusz Kulikowski
2016-01-11 16:58   ` Simon Glass
2016-01-06 18:21 ` [U-Boot] [PATCH v1 15/16] arm: Add support for Qualcomm Snapdragon family Mateusz Kulikowski
2016-01-11 16:58   ` Simon Glass
2016-01-06 18:21 ` [U-Boot] [PATCH v1 16/16] board: Add Qualcomm Dragonboard 410C support Mateusz Kulikowski
2016-01-07 10:23   ` Sjoerd Simons
2016-01-11 21:49     ` Mateusz Kulikowski
2016-01-11 16:58   ` Simon Glass
2016-01-11 22:01     ` Mateusz Kulikowski
2016-01-13 20:32       ` Simon Glass
2016-01-20 21:46         ` Mateusz Kulikowski
2016-01-20  4:35   ` Simon Glass
2016-01-20 22:00     ` Mateusz Kulikowski
2016-01-20 23:49       ` Andreas Färber

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=201601062204.07374.marex@denx.de \
    --to=marex@denx.de \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.