[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20131125212415.GS18046@saruman.home>
Date: Mon, 25 Nov 2013 15:24:15 -0600
From: Felipe Balbi <balbi@...com>
To: Mark Jackson <mpfj-list@...flow.co.uk>
CC: <linux-usb@...r.kernel.org>, lkml <linux-kernel@...r.kernel.org>,
Felipe Balbi <balbi@...com>, <bigeasy@...utronix.de>,
Greg KH <gregkh@...uxfoundation.org>, <jkosina@...e.cz>,
<anatol.pomozov@...il.com>,
"linux-omap@...r.kernel.org" <linux-omap@...r.kernel.org>
Subject: Re: [PATCH] Allow MUSB DSPS to use "force host" mode
Hi,
On Fri, Nov 22, 2013 at 03:55:59PM +0000, Mark Jackson wrote:
> The IDDIG input pin is normally used to determine the USB mode
> (i.e. HOST or DEVICE).
>
> On some systems (e.g. AM335x) leaving this pin floating allows
> the USB mode to be set via software.
>
> This patch adds support for this via the device tree.
>
> Signed-off-by: Mark Jackson <mpfj@...flow.co.uk>
> ---
> .../devicetree/bindings/usb/am33xx-usb.txt | 2 ++
> drivers/usb/musb/musb_dsps.c | 14 ++++++++++++++
> include/linux/usb/musb.h | 1 +
> 3 files changed, 17 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/usb/am33xx-usb.txt b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
> index 20c2ff2..560b7ff 100644
> --- a/Documentation/devicetree/bindings/usb/am33xx-usb.txt
> +++ b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
> @@ -47,6 +47,8 @@ USB
> - dmas: specifies the dma channels
> - dma-names: specifies the names of the channels. Use "rxN" for receive
> and "txN" for transmit endpoints. N specifies the endpoint number.
> +- ti,force-host: specifies that the IDDIG input be ignored and the device be
> + put into host mode regardless.
>
> The controller should have an "usb" alias numbered properly in the alias
> node.
> diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
> index 1901f6f..6439809 100644
> --- a/drivers/usb/musb/musb_dsps.c
> +++ b/drivers/usb/musb/musb_dsps.c
> @@ -105,6 +105,7 @@ struct dsps_musb_wrapper {
> unsigned otg_disable:5;
>
> /* bit positions for mode */
> + unsigned iddig_mux:5;
> unsigned iddig:5;
> /* miscellaneous stuff */
> u8 poll_seconds;
> @@ -387,6 +388,15 @@ static int dsps_musb_init(struct musb *musb)
>
> musb->isr = dsps_interrupt;
>
> + /* Force host mode, rather than relying on IDDIG input */
> + if (musb->config->force_host) {
> + val = dsps_readl(reg_base, wrp->mode);
> + /* clear IDDIG bit, set IDDIG_MUX bit */
> + val &= ~(1 << wrp->iddig);
> + val |= (1 << wrp->iddig_mux);
> + dsps_writel(musb->ctrl_base, wrp->mode, val);
> + }
> +
> /* reset the otgdisable bit, needed for host mode to work */
> val = dsps_readl(reg_base, wrp->phy_utmi);
> val &= ~(1 << wrp->otg_disable);
> @@ -512,6 +522,9 @@ static int dsps_create_musb_pdev(struct dsps_glue *glue,
> pdata.power = get_int_prop(dn, "mentor,power") / 2;
> config->multipoint = of_property_read_bool(dn, "mentor,multipoint");
>
> + if (of_property_read_bool(dn, "ti,force-host"))
> + config->force_host = true;
> +
> ret = platform_device_add_data(musb, &pdata, sizeof(pdata));
> if (ret) {
> dev_err(dev, "failed to add platform_data\n");
> @@ -607,6 +620,7 @@ static const struct dsps_musb_wrapper am33xx_driver_data = {
> .mode = 0xe8,
> .reset = 0,
> .otg_disable = 21,
> + .iddig_mux = 7,
I recently sent a patch to make this work, I'm attaching it here in case
it didn't reach mailing list.
--
balbi
View attachment "0001-usb-musb-dsps-implement-set_mode.diff" of type "text/x-diff" (2760 bytes)
View attachment "0002-usb-musb-core-call-musb_platform_set_mode-during-prob.diff" of type "text/x-diff" (1461 bytes)
Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)
Powered by blists - more mailing lists