linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bin Liu <b-liu-l0cyMroinI0@public.gmane.org>
To: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
Cc: Felipe Balbi <balbi-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>,
	Ivaylo Dimitrov
	<ivo.g.dimitrov.75-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Sergei Shtylyov
	<sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 10/15] usb: musb: Don't set d+ high before enable for 2430 glue layer
Date: Sat, 14 May 2016 23:42:12 -0500	[thread overview]
Message-ID: <20160515044212.GB20689@uda0271908> (raw)
In-Reply-To: <20160513222517.GG5995-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>

Hi,

On Fri, May 13, 2016 at 03:25:17PM -0700, Tony Lindgren wrote:
> * Bin Liu <b-liu-l0cyMroinI0@public.gmane.org> [160513 15:04]:
> > 
> > But what would be in musb_default_set_mode()? Currently only am35x,
> > da8xx, dsps, and omap2430 glues implement _set_mode(), but they don't
> > have any in common. Only omap2430 sets session bit in _set_mode(), no
> > one else does so.
> 
> Well how about the following if no glue specific configuration of the
> ID pin is possible?

ID pin configuration is required, either in sw or hw, for the controller
otg state transition.

In my understanding, if ID pin is grounded, setting session bit make the
controller transition to host mode; or if ID pin is float, setting
session bit triggers srp request.

I think I don't understand what you are trying to solve by adding
default set_mode() in core.

Regards,
-Bin.

> 
> Tony
> 
> 8< -----------------------
> --- a/drivers/usb/musb/musb_core.c
> +++ b/drivers/usb/musb/musb_core.c
> @@ -416,6 +416,26 @@ void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *src)
>  	return hw_ep->musb->io.write_fifo(hw_ep, len, src);
>  }
>  
> +static int musb_try_set_mode(struct musb *musb, u8 mode)
> +{
> +	if (musb->ops->set_mode)
> +		return musb->ops->set_mode(musb, mode);
> +
> +	if (mode == MUSB_HOST) {
> +		u8 devctl;
> +
> +		devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
> +		devctl |= MUSB_DEVCTL_SESSION;
> +		musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
> +	} else {
> +		dev_warn(musb->controller,
> +			 "platform specific set_mode not implemnted: %i\n",
> +			 mode);
> +	}
> +
> +	return 0;
> +}
> +
>  /*-------------------------------------------------------------------------*/
>  
>  /* for high speed test mode; see USB 2.0 spec 7.1.20 */
> @@ -1723,11 +1743,11 @@ musb_mode_store(struct device *dev, struct device_attribute *attr,
>  
>  	spin_lock_irqsave(&musb->lock, flags);
>  	if (sysfs_streq(buf, "host"))
> -		status = musb_platform_set_mode(musb, MUSB_HOST);
> +		status = musb_try_set_mode(musb, MUSB_HOST);
>  	else if (sysfs_streq(buf, "peripheral"))
> -		status = musb_platform_set_mode(musb, MUSB_PERIPHERAL);
> +		status = musb_try_set_mode(musb, MUSB_PERIPHERAL);
>  	else if (sysfs_streq(buf, "otg"))
> -		status = musb_platform_set_mode(musb, MUSB_OTG);
> +		status = musb_try_set_mode(musb, MUSB_OTG);
>  	else
>  		status = -EINVAL;
>  	spin_unlock_irqrestore(&musb->lock, flags);
> @@ -2185,13 +2205,13 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
>  		status = musb_host_setup(musb, plat->power);
>  		if (status < 0)
>  			goto fail3;
> -		status = musb_platform_set_mode(musb, MUSB_HOST);
> +		status = musb_try_set_mode(musb, MUSB_HOST);
>  		break;
>  	case MUSB_PORT_MODE_GADGET:
>  		status = musb_gadget_setup(musb);
>  		if (status < 0)
>  			goto fail3;
> -		status = musb_platform_set_mode(musb, MUSB_PERIPHERAL);
> +		status = musb_try_set_mode(musb, MUSB_PERIPHERAL);
>  		break;
>  	case MUSB_PORT_MODE_DUAL_ROLE:
>  		status = musb_host_setup(musb, plat->power);
> @@ -2202,7 +2222,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
>  			musb_host_cleanup(musb);
>  			goto fail3;
>  		}
> -		status = musb_platform_set_mode(musb, MUSB_OTG);
> +		status = musb_try_set_mode(musb, MUSB_OTG);
>  		break;
>  	default:
>  		dev_err(dev, "unsupported port mode %d\n", musb->port_mode);
> --- a/drivers/usb/musb/musb_core.h
> +++ b/drivers/usb/musb/musb_core.h
> @@ -556,14 +556,6 @@ static inline void musb_platform_disable(struct musb *musb)
>  		musb->ops->disable(musb);
>  }
>  
> -static inline int musb_platform_set_mode(struct musb *musb, u8 mode)
> -{
> -	if (!musb->ops->set_mode)
> -		return 0;
> -
> -	return musb->ops->set_mode(musb, mode);
> -}
> -
>  static inline void musb_platform_try_idle(struct musb *musb,
>  		unsigned long timeout)
>  {
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2016-05-15  4:42 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-12  0:53 [PATCHv2 00/15] Get MUSB PM runtime working again Tony Lindgren
     [not found] ` <1463014396-4095-1-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-05-12  0:53   ` [PATCH 01/15] usb: musb: Fix idling after host mode by increasing autosuspend delay Tony Lindgren
2016-05-12  0:53   ` [PATCH 02/15] usb: musb: Remove unnecessary shutdown function Tony Lindgren
2016-05-12  0:53   ` [PATCH 03/15] usb: musb: Update to use PM runtime autosuspend Tony Lindgren
2016-05-12  0:53   ` [PATCH 04/15] usb: musb: Split PM runtime between wrapper IP and musb core Tony Lindgren
2016-05-12  0:53   ` [PATCH 05/15] usb: musb: Remove conditional PM runtime calls for musb_gadget Tony Lindgren
2016-05-12  0:53   ` [PATCH 06/15] usb: musb: Use delayed for musb_gadget_pullup Tony Lindgren
2016-05-12  0:53   ` [PATCH 07/15] usb: musb: Handle cable status better for 2430 glue layer Tony Lindgren
     [not found]     ` <1463014396-4095-8-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-05-12  1:33       ` Tony Lindgren
     [not found]         ` <20160512013303.GO5995-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-05-13 19:57           ` Bin Liu
2016-05-13 20:09             ` Tony Lindgren
     [not found]               ` <20160513200902.GB5995-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-05-13 20:21                 ` Bin Liu
2016-05-13 20:24                   ` Bin Liu
2016-05-13 20:33                     ` Tony Lindgren
     [not found]                       ` <20160513203330.GC5995-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-05-13 20:41                         ` Bin Liu
2016-05-13 20:58                           ` Tony Lindgren
2016-05-12  0:53   ` [PATCH 08/15] usb: musb: Improve PM runtime and phy handling " Tony Lindgren
     [not found]     ` <1463014396-4095-9-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-09-09 17:08       ` [08/15] " Laurent Pinchart
2016-09-09 17:24         ` Tony Lindgren
     [not found]           ` <20160909172447.kw3jb3odlpwt6egv-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-09-09 18:33             ` Laurent Pinchart
2016-09-09 19:24               ` Laurent Pinchart
2016-09-09 20:05                 ` Tony Lindgren
2016-09-09 20:08               ` Tony Lindgren
2016-05-12  0:53   ` [PATCH 09/15] usb: musb: Remove try_idle " Tony Lindgren
2016-05-12  0:53   ` [PATCH 10/15] usb: musb: Don't set d+ high before enable " Tony Lindgren
     [not found]     ` <1463014396-4095-11-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-05-13 21:03       ` Bin Liu
2016-05-13 21:17         ` Tony Lindgren
     [not found]           ` <20160513211739.GE5995-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-05-13 21:22             ` Bin Liu
2016-05-13 21:39               ` Tony Lindgren
     [not found]                 ` <20160513213900.GF5995-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-05-13 22:02                   ` Bin Liu
2016-05-13 22:25                     ` Tony Lindgren
     [not found]                       ` <20160513222517.GG5995-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-05-15  4:42                         ` Bin Liu [this message]
2016-05-16 15:19                           ` Tony Lindgren
2016-05-13 22:35             ` Tony Lindgren
     [not found]               ` <20160513223540.GH5995-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-05-15  4:47                 ` Bin Liu
2016-05-14 13:30         ` Sergei Shtylyov
     [not found]           ` <99ff5bff-e2f4-3137-2854-81d7b4b14bce-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2016-05-16 14:15             ` Bin Liu
2016-05-16 14:57               ` Tony Lindgren
     [not found]                 ` <20160516145757.GI5995-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-05-16 15:22                   ` Bin Liu
2016-05-16 15:45                     ` Tony Lindgren
2016-05-12  0:53   ` [PATCH 11/15] usb: musb: Return error value from musb_mailbox Tony Lindgren
2016-05-12  0:53   ` [PATCH 12/15] usb: musb: Remove extra PM runtime calls from 2430 glue layer Tony Lindgren
2016-05-12  0:53   ` [PATCH 13/15] usb: musb: Remove pm_runtime_set_irq_safe Tony Lindgren
2016-05-12  0:53   ` [PATCH 14/15] usb: musb: Use normal module_init for 2430 glue Tony Lindgren
2016-05-12  0:53   ` [PATCH 15/15] usb: phy: Check initial state for twl6030 Tony Lindgren
2016-05-17 21:16   ` [PATCHv2 00/15] Get MUSB PM runtime working again Bin Liu
2016-05-17 21:54     ` Tony Lindgren
     [not found]       ` <20160517215403.GP5995-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-05-17 22:05         ` Bin Liu
2016-05-18 17:35           ` Bin Liu
2016-05-18 18:14             ` Tony Lindgren
     [not found]               ` <20160518181403.GR5995-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-05-18 18:45                 ` Alan Stern
     [not found]                   ` <Pine.LNX.4.44L0.1605181442440.1981-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2016-05-18 19:12                     ` Tony Lindgren
     [not found]                       ` <20160518191239.GS5995-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-05-18 19:24                         ` Bin Liu
2016-05-18 18:07           ` Tony Lindgren
     [not found]             ` <20160518180737.GQ5995-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-05-18 18:10               ` Bin Liu
2016-05-19 15:26                 ` Tony Lindgren
     [not found]                   ` <20160519152601.GV5995-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-05-19 17:50                     ` Tony Lindgren

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=20160515044212.GB20689@uda0271908 \
    --to=b-liu-l0cymroini0@public.gmane.org \
    --cc=balbi-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=ivo.g.dimitrov.75-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=kishon-l0cyMroinI0@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org \
    --cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org \
    /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;
as well as URLs for NNTP newsgroup(s).