usb: musb: dsps: implement vbus_status method
Subsystems (2)
PATCH 1/1 usb: musb: dsps: implement vbus_status method
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
--- drivers/usb/musb/musb_dsps.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/usb/musb/musb_dsps.c +13 -0
@@ -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 )) +return 1 ; +else +return 0 ; +} +static struct musb_platform_ops dsps_ops = { .quirks =MUSB_DMA_CPPI41 |MUSB_INDEXED_EP , .init = dsps_musb_init,
@@ -647,6 +659,7 @@ static struct musb_platform_ops dsps_ops = { .try_idle = dsps_musb_try_idle, .set_mode = dsps_musb_set_mode, .recover = dsps_musb_recover, + .vbus_status = dsps_musb_vbus_status, };static u64 musb_dmamask =DMA_BIT_MASK (32 );
Signature · 1 line
1.7.9.5
Hello.
Quoted 14 lines · Roman Alyautdin
Implement
vbus_statusmethod ofmusb_platform_opsthat allowsmusb_coreto properly represent the VBUS status ofmusb_dspsdevices in corresponding sysfs entrySigned-off-by Roman Alyautdin <[email protected]>--- drivers/usb/musb/musb_dsps.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)drivers/usb/musb/musb_dsps.c +0
-0
drivers/usb/musb/musb_dsps.c static void dsps_read_fifo32(struct musb_hw_ep *hw_ep, u16 len, u8 *dst) · line 641
Quoted 10 lines
drivers/usb/musb/musb_dsps.c +7
-0@@ -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.
[...]
MBR, Sergei
Quoted 18 lines · Sergei Shtylyov
Quoted 18 lines
Implement
vbus_statusmethod ofmusb_platform_opsthat allowsmusb_coreto properly represent the VBUS status ofmusb_dspsdevices in corresponding sysfs entrySigned-off-by Roman Alyautdin <[email protected]>--- drivers/usb/musb/musb_dsps.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)drivers/usb/musb/musb_dsps.c +0
-0@@ -632,6 +632,18 @@ static void dsps_read_fifo32(struct musb_hw_ep *hw_ep, u16 len, u8 *dst) } }
Quoted 10 lines
drivers/usb/musb/musb_dsps.c static void dsps_read_fifo32(struct musb_hw_ep *hw_ep, u16 len, u8 *dst) · line 641
Quoted 7 lines
drivers/usb/musb/musb_dsps.c +7
-0+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.
MBR, Sergei
Quoted 33 lines · Sergei Shtylyov
Quoted 19 lines · Sergei Shtylyov
Quoted 19 lines
Implement
vbus_statusmethod ofmusb_platform_opsthat allowsmusb_coreto properly represent the VBUS status ofmusb_dspsdevices in corresponding sysfs entrySigned-off-by Roman Alyautdin <[email protected]>--- drivers/usb/musb/musb_dsps.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)drivers/usb/musb/musb_dsps.c +0
-0@@ -632,6 +632,18 @@ static void dsps_read_fifo32(struct musb_hw_ep *hw_ep, u16 len, u8 *dst) } }Quoted 11 lines
drivers/usb/musb/musb_dsps.c static void dsps_read_fifo32(struct musb_hw_ep *hw_ep, u16 len, u8 *dst) · line 641
Quoted 7 lines
drivers/usb/musb/musb_dsps.c +7
-0+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.
Quoted 2 lines
Looking at the
musb_platform_get_vbus_status(), it's unclear why it
returns 0 if thevbus_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
Quoted 3 lines
MBR, Sergei
Hi,
Quoted 39 lines · Roman Alyautdin
Quoted 34 lines · Sergei Shtylyov
Quoted 20 lines · Sergei Shtylyov
Quoted 20 lines
Implement
vbus_statusmethod ofmusb_platform_opsthat allowsmusb_coreto properly represent the VBUS status ofmusb_dspsdevices in corresponding sysfs entrySigned-off-by Roman Alyautdin <[email protected]>--- drivers/usb/musb/musb_dsps.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)drivers/usb/musb/musb_dsps.c +0
-0@@ -632,6 +632,18 @@ static void dsps_read_fifo32(struct musb_hw_ep *hw_ep, u16 len, u8 *dst) } }Quoted 11 lines
drivers/usb/musb/musb_dsps.c static void dsps_read_fifo32(struct musb_hw_ep *hw_ep, u16 len, u8 *dst) · line 641
Quoted 7 lines
drivers/usb/musb/musb_dsps.c +7
-0+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.Quoted 3 lines
Looking at the
musb_platform_get_vbus_status(), it's unclear why it
returns 0 if thevbus_status()method id undefined. I think we should read the DevCtl registre here, removing the FIXME at the call site.
Quoted 6 lines
Maybe it is worth to return
-EINVALfrommusb_platform_get_vbus_statusin 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-EINVALfrommusb_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.
Signature · 1 line
balbi