From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933431AbbJHO1p (ORCPT ); Thu, 8 Oct 2015 10:27:45 -0400 Received: from mail.dev.rtsoft.ru ([213.79.90.226]:54384 "EHLO dev.rtsoft.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932931AbbJHO1k (ORCPT ); Thu, 8 Oct 2015 10:27:40 -0400 Message-ID: <56167D41.3010902@dev.rtsoft.ru> Date: Thu, 08 Oct 2015 17:27:13 +0300 From: Roman Alyautdin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: Sergei Shtylyov CC: balbi@ti.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] usb: musb: dsps: implement vbus_status method References: <1444228816-4497-1-git-send-email-ralyautdin@dev.rtsoft.ru> <561674B9.1040101@cogentembedded.com> <56167892.10206@cogentembedded.com> In-Reply-To: <56167892.10206@cogentembedded.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >>> 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 Regards, Roman > > MBR, Sergei >