From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756180AbbJIVUU (ORCPT ); Fri, 9 Oct 2015 17:20:20 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:36278 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755207AbbJIVUQ (ORCPT ); Fri, 9 Oct 2015 17:20:16 -0400 From: Felipe Balbi To: Roman Alyautdin , Sergei Shtylyov CC: , Subject: Re: [PATCH] usb: musb: dsps: implement vbus_status method In-Reply-To: <56167D41.3010902@dev.rtsoft.ru> References: <1444228816-4497-1-git-send-email-ralyautdin@dev.rtsoft.ru> <561674B9.1040101@cogentembedded.com> <56167892.10206@cogentembedded.com> <56167D41.3010902@dev.rtsoft.ru> User-Agent: Notmuch/0.20.2 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Fri, 9 Oct 2015 16:19:03 -0500 Message-ID: <87lhbbu4e0.fsf@saruman.tx.rr.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, Roman Alyautdin writes: > On 08/10/15 17:07, Sergei Shtylyov wrote: >> On 10/8/2015 4:50 PM, Sergei Shtylyov wrote: >> >>>> Implement vbus_status method of musb_platform_ops that allows >>>> musb_core to properly represent the VBUS status of musb_dsps devices in >>>> corresponding sysfs entry >>>> >>>> Signed-off-by: Roman Alyautdin >>>> --- >>>> drivers/usb/musb/musb_dsps.c | 13 +++++++++++++ >>>> 1 file changed, 13 insertions(+) >>>> >>>> diff --git a/drivers/usb/musb/musb_dsps.c=20 >>>> b/drivers/usb/musb/musb_dsps.c >>>> index 84512d1..9c00edf 100644 >>>> --- a/drivers/usb/musb/musb_dsps.c >>>> +++ b/drivers/usb/musb/musb_dsps.c >>>> @@ -632,6 +632,18 @@ static void dsps_read_fifo32(struct musb_hw_ep=20 >>>> *hw_ep, >>>> u16 len, u8 *dst) >>>> } >>>> } >>>> >>>> +static int dsps_musb_vbus_status(struct musb *musb) >>>> +{ >>>> + void __iomem *mregs =3D musb->mregs; >>>> + u8 devctl; >>>> + >>>> + devctl =3D dsps_readb(mregs, MUSB_DEVCTL); >>>> + if ((devctl & MUSB_DEVCTL_VBUS) =3D=3D (3 << MUSB_DEVCTL_VBUS_SHI= FT)) >>> >>> I don't see why this has to be is implemented in the DSPS glue=20 >>> layer. The >>> DevCtl register is a standard MUSB one. >> >> Looking at the musb_platform_get_vbus_status(), it's unclear why it=20 >> returns 0 if the vbus_status() method id undefined. I think we should=20 >> read the DevCtl registre here, removing the FIXME at the call site. > > Maybe it is worth to return -EINVAL from musb_platform_get_vbus_status=20 > in case of method is undefined and keep current logic of interface=20 > implementation in platform-specific driver. > > Hence print "Vbus unknown" in musb_vbus_show() in case of -EINVAL from=20 > musb_platform_get_vbus_status I actually like the idea of reading DevCtl. That's a nice, safe default afaict. That's one of the information DevCtl is supposed to tell MUSB anywa= y. =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWGC9IAAoJEIaOsuA1yqREBX4P/R3qXcP7/qt1dPWWeGWdQ8D6 Zc88x1GyFVOnsJyZZILU2YRjsNUxeOFLW5UzLAo5SpkbEAjORrMQ0UGuWg0rphRd VLJ+q8jHFmOEUS1Tp3JQ9UNGfPdD1YjLxsFuC5m6g75eRglJxsCr83bY2fLo7tMT o0fy5OTQe64yOzgjdW62ysVBt6YVd0bogrdYmILxF0oUrICT+ToyZXB3RS5tX+LF sMnyYqPDUd/RG+2UtmkV5tysW29Ki1xuK4TfA7Ove09f6BK6/ZdYIJ7a0nT6/D4e tGMDACF9vnvSJqKBW4dJN1GE2oMxWmLjDtW3YtWoi46PFLfGPhc2zhdgVm7VKP30 Wt8G15FilFOSHxHnDMopEdyI1PmjwZN13RMB8S+DhuakHPUtditLrlRU8itekqDu /wUbGAqMHmo1Ag8gWp2PG1qs/1V2Y+moUNC1p2ARpbI5GEFn3ToyuiSt0/uWdIPw qn5xGANPSGy6+Y7lJrR9Yk4BeWg7aJ+NMurHrOwTscvmta5p7VJKbibBATCF7y5G EV6OYyVv7+UWhMqN0SH6vFeyhnCh45sAaOXFgHMccuI+zPUxJGE+STAspjhwCioB 1RhIdoThMzoVFN30187BwfRohmPDrReHlKuMcdeG57UzM9+aSjKswdPJhrOAkefF vB7XGrBAb7eXnOIuJiry =4Gvu -----END PGP SIGNATURE----- --=-=-=--