From patchwork Tue Feb 10 07:35:31 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 6346 X-Patchwork-Delegate: me@felipebalbi.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n1A7ngPf022407 for ; Tue, 10 Feb 2009 07:49:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750823AbZBJHtl (ORCPT ); Tue, 10 Feb 2009 02:49:41 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751202AbZBJHtl (ORCPT ); Tue, 10 Feb 2009 02:49:41 -0500 Received: from smtp.nokia.com ([192.100.105.134]:27671 "EHLO mgw-mx09.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751075AbZBJHtk (ORCPT ); Tue, 10 Feb 2009 02:49:40 -0500 Received: from esebh106.NOE.Nokia.com (esebh106.ntc.nokia.com [172.21.138.213]) by mgw-mx09.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id n1A7mchq002415; Tue, 10 Feb 2009 01:49:35 -0600 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by esebh106.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 10 Feb 2009 09:49:28 +0200 Received: from vaebe101.NOE.Nokia.com ([10.160.244.11]) by vaebh104.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 10 Feb 2009 09:49:27 +0200 Received: from scadufax.research.nokia.com ([172.21.43.40]) by vaebe101.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 10 Feb 2009 09:49:27 +0200 Date: Tue, 10 Feb 2009 09:35:31 +0200 From: Felipe Balbi To: "ext Gupta, Ajay Kumar" Cc: Steve Sakoman , linux-omap Subject: Re: musb OTG broken in 2.6.29-rc3? Message-ID: <20090210073525.GE3166@scadufax.research.nokia.com> Reply-To: felipe.balbi@nokia.com References: <5e088bd90902090940s3c6de0eqac55e21acd4490bc@mail.gmail.com> <19F8576C6E063C45BE387C64729E739403FA81B5E5@dbde02.ent.ti.com> <5e088bd90902092043u913d35axe658e784d4befb59@mail.gmail.com> <19F8576C6E063C45BE387C64729E739403FA81B610@dbde02.ent.ti.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <19F8576C6E063C45BE387C64729E739403FA81B610@dbde02.ent.ti.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-OriginalArrivalTime: 10 Feb 2009 07:49:27.0562 (UTC) FILETIME=[195A1EA0:01C98B54] X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org On Tue, Feb 10, 2009 at 05:47:16AM +0100, Ajay Kumar Gupta wrote: > > -----Original Message----- > > From: Steve Sakoman [mailto:sakoman@gmail.com] > > Sent: Tuesday, February 10, 2009 10:13 AM > > To: Gupta, Ajay Kumar > > Cc: linux-omap > > Subject: Re: musb OTG broken in 2.6.29-rc3? > > > > On Mon, Feb 9, 2009 at 8:05 PM, Gupta, Ajay Kumar wrote: > > > > >> Before I spend too much time debugging, has anyone else been > > >> successful with musb OTG in 2.6.29-rc3? A quick search of this list > > >> didn't turn up any discussion of issues. > > > > > > It works fine on OMAP35x EVM too. I had to add a proc entry for session start > > > (Switching on the vBus). > > > > Could you give me a little more detail on what you had to do for > > session start? Perhaps I have a similar issue on Overo. > It is same $ echo "F" >/proc/driver/musb_hdrc, which was earlier > In musb_procfs.c and now been removed. > > + case 'F': > + reg = musb_readb(mbase, MUSB_DEVCTL); > + reg |= MUSB_DEVCTL_SESSION; > + musb_writeb(mbase, MUSB_DEVCTL, reg); a temp sysfs for that will help: Steve, could you try the following ==== cut here ==== diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 2cc34fa..0ffd611 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -1713,6 +1713,32 @@ musb_vbus_show(struct device *dev, struct device_attribute *attr, char *buf) } static DEVICE_ATTR(vbus, 0644, musb_vbus_show, musb_vbus_store); +static ssize_t +musb_session_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t n) +{ + struct musb *musb = dev_to_musb(dev); + unsigned short session; + u8 devctl; + + if (sscanf(buf, "%hu", &session) != 1 + || (session != 1) || (session != 0)) { + dev_err(dev, "value must be 1 on 0\n"); + return -EINVAL; + } + + devctl = musb_readb(musb->mregs, MUSB_DEVCTL); + if (session) + devctl |= MUSB_DEVCTL_SESSION; + else + devctl &= ~MUSB_DEVCTL_SESSION; + + musb_writeb(musb->mregs, MUSB_DEVCTL, devctl); + + return n; +} +static DEVICE_ATTR(session, 0644, NULL, musb_session_store); + #ifdef CONFIG_USB_GADGET_MUSB_HDRC /* Gadget drivers can't know that a host is connected so they might want @@ -1813,6 +1839,7 @@ static void musb_free(struct musb *musb) */ #ifdef CONFIG_SYSFS + device_remove_file(musb->controller, &dev_attr_session); device_remove_file(musb->controller, &dev_attr_mode); device_remove_file(musb->controller, &dev_attr_vbus); #ifdef CONFIG_USB_MUSB_OTG @@ -2047,6 +2074,7 @@ bad_config: } #ifdef CONFIG_SYSFS + status = device_create_file(dev, &dev_attr_session); status = device_create_file(dev, &dev_attr_mode); status = device_create_file(dev, &dev_attr_vbus); #ifdef CONFIG_USB_GADGET_MUSB_HDRC @@ -2061,6 +2089,7 @@ bad_config: fail2: #ifdef CONFIG_SYSFS + device_remove_file(musb->controller, &dev_attr_session); device_remove_file(musb->controller, &dev_attr_mode); device_remove_file(musb->controller, &dev_attr_vbus); #ifdef CONFIG_USB_MUSB_OTG