From: Felipe Balbi <balbi@ti.com>
To: Roman Alyautdin <ralyautdin@dev.rtsoft.ru>,
Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Cc: <linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] usb: musb: dsps: implement vbus_status method
Date: Fri, 9 Oct 2015 16:19:03 -0500 [thread overview]
Message-ID: <87lhbbu4e0.fsf@saruman.tx.rr.com> (raw)
In-Reply-To: <56167D41.3010902@dev.rtsoft.ru>
[-- Attachment #1: Type: text/plain, Size: 1984 bytes --]
Hi,
Roman Alyautdin <ralyautdin@dev.rtsoft.ru> 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 <ralyautdin@dev.rtsoft.ru>
>>>> ---
>>>> drivers/usb/musb/musb_dsps.c | 13 +++++++++++++
>>>> 1 file changed, 13 insertions(+)
>>>>
>>>> diff --git a/drivers/usb/musb/musb_dsps.c
>>>> 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
>>>> *hw_ep,
>>>> u16 len, u8 *dst)
>>>> }
>>>> }
>>>>
>>>> +static int dsps_musb_vbus_status(struct musb *musb)
>>>> +{
>>>> + void __iomem *mregs = musb->mregs;
>>>> + u8 devctl;
>>>> +
>>>> + devctl = dsps_readb(mregs, MUSB_DEVCTL);
>>>> + if ((devctl & MUSB_DEVCTL_VBUS) == (3 << MUSB_DEVCTL_VBUS_SHIFT))
>>>
>>> I don't see why this has to be is implemented in the DSPS glue
>>> layer. The
>>> DevCtl register is a standard MUSB one.
>>
>> Looking at the musb_platform_get_vbus_status(), it's unclear why it
>> returns 0 if the vbus_status() method id undefined. I think we should
>> 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
> in case of method is undefined and keep current logic of interface
> implementation in platform-specific driver.
>
> Hence print "Vbus unknown" in musb_vbus_show() in case of -EINVAL from
> 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 anyway.
--
balbi
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
prev parent reply other threads:[~2015-10-09 21:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-07 14:40 [PATCH] usb: musb: dsps: implement vbus_status method Roman Alyautdin
2015-10-08 13:50 ` Sergei Shtylyov
2015-10-08 14:07 ` Sergei Shtylyov
2015-10-08 14:27 ` Roman Alyautdin
2015-10-09 21:19 ` Felipe Balbi [this message]
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=87lhbbu4e0.fsf@saruman.tx.rr.com \
--to=balbi@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=ralyautdin@dev.rtsoft.ru \
--cc=sergei.shtylyov@cogentembedded.com \
/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.