Re: [PATCH] usb: musb: call pm_runtime_{get,put}_sync before reading vbus registers
On Mon, Feb 26, 2018 at 06:19:30PM +0100, Merlijn Wajer wrote: > Hi, > > On 26/02/18 16:57, Bin Liu wrote: > > Hi, > > > > On Mon, Feb 26, 2018 at 11:56:08AM +0100, Merlijn Wajer wrote: > >> Without pm_runtime_{get,put}_sync calls in place, reading > >> vbus status via /sys causes the following error: > >> > >> Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa0ab060 > >> pgd = b333e822 > >> [fa0ab060] *pgd=48011452(bad) > >> > >> [] (musb_default_readb) from [] > >> (musb_vbus_show+0x58/0xe4) > >> [] (musb_vbus_show) from [] (dev_attr_show+0x20/0x44) > >> [] (dev_attr_show) from [] > >> (sysfs_kf_seq_show+0x80/0xdc) > >> [] (sysfs_kf_seq_show) from [] (seq_read+0x250/0x448) > >> [] (seq_read) from [] (__vfs_read+0x1c/0x118) > >> [] (__vfs_read) from [] (vfs_read+0x90/0x144) > >> [] (vfs_read) from [] (SyS_read+0x3c/0x74) > >> [] (SyS_read) from [] (ret_fast_syscall+0x0/0x54) > >> > >> Solution was suggested by Tony Lindgren. > >> > >> Signed-off-by: Merlijn Wajer > >> --- > >> drivers/usb/musb/musb_core.c | 4 > >> 1 file changed, 4 insertions(+) > >> > >> diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c > >> index eef4ad578b31..ceaa40ef0e73 100644 > >> --- a/drivers/usb/musb/musb_core.c > >> +++ b/drivers/usb/musb/musb_core.c > >> @@ -1760,6 +1760,8 @@ vbus_show(struct device *dev, struct > >> device_attribute *attr, char *buf) > >>val = musb->a_wait_bcon; > >>vbus = musb_platform_get_vbus_status(musb); > >>if (vbus < 0) { > >> + pm_runtime_get_sync(dev); > >> + > >>/* Use default MUSB method by means of DEVCTL register */ > >>devctl = musb_readb(musb->mregs, MUSB_DEVCTL); > >>if ((devctl & MUSB_DEVCTL_VBUS) > >> @@ -1767,6 +1769,8 @@ vbus_show(struct device *dev, struct > >> device_attribute *attr, char *buf) > >>vbus = 1; > >>else > >>vbus = 0; > >> + > >> + pm_runtime_put_sync(dev); > >>} > >>spin_unlock_irqrestore(>lock, flags); > > > > Thanks for the patch, but I got spinlock deadlock when testing it. I > > think the function pair should be at the outside scope of the > > spin_lock/unlock, doesn't it? > > I see - sorry. Weird, it worked for me on my Nokia N900. What did you > test this on? > > I will try to submit an improved version tonight (you seem to have a > good idea on what is wrong, so I will follow that), but it would help me > if I can reproduce the issue. I tested on both Beaglebone Black and AM335x GP EVM, on the USB1 host port. I didn't test the USB0 port (yet). Thanks, -Bin.
Re: [PATCH] usb: musb: call pm_runtime_{get,put}_sync before reading vbus registers
On Mon, Feb 26, 2018 at 06:19:30PM +0100, Merlijn Wajer wrote: > Hi, > > On 26/02/18 16:57, Bin Liu wrote: > > Hi, > > > > On Mon, Feb 26, 2018 at 11:56:08AM +0100, Merlijn Wajer wrote: > >> Without pm_runtime_{get,put}_sync calls in place, reading > >> vbus status via /sys causes the following error: > >> > >> Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa0ab060 > >> pgd = b333e822 > >> [fa0ab060] *pgd=48011452(bad) > >> > >> [] (musb_default_readb) from [] > >> (musb_vbus_show+0x58/0xe4) > >> [] (musb_vbus_show) from [] (dev_attr_show+0x20/0x44) > >> [] (dev_attr_show) from [] > >> (sysfs_kf_seq_show+0x80/0xdc) > >> [] (sysfs_kf_seq_show) from [] (seq_read+0x250/0x448) > >> [] (seq_read) from [] (__vfs_read+0x1c/0x118) > >> [] (__vfs_read) from [] (vfs_read+0x90/0x144) > >> [] (vfs_read) from [] (SyS_read+0x3c/0x74) > >> [] (SyS_read) from [] (ret_fast_syscall+0x0/0x54) > >> > >> Solution was suggested by Tony Lindgren . > >> > >> Signed-off-by: Merlijn Wajer > >> --- > >> drivers/usb/musb/musb_core.c | 4 > >> 1 file changed, 4 insertions(+) > >> > >> diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c > >> index eef4ad578b31..ceaa40ef0e73 100644 > >> --- a/drivers/usb/musb/musb_core.c > >> +++ b/drivers/usb/musb/musb_core.c > >> @@ -1760,6 +1760,8 @@ vbus_show(struct device *dev, struct > >> device_attribute *attr, char *buf) > >>val = musb->a_wait_bcon; > >>vbus = musb_platform_get_vbus_status(musb); > >>if (vbus < 0) { > >> + pm_runtime_get_sync(dev); > >> + > >>/* Use default MUSB method by means of DEVCTL register */ > >>devctl = musb_readb(musb->mregs, MUSB_DEVCTL); > >>if ((devctl & MUSB_DEVCTL_VBUS) > >> @@ -1767,6 +1769,8 @@ vbus_show(struct device *dev, struct > >> device_attribute *attr, char *buf) > >>vbus = 1; > >>else > >>vbus = 0; > >> + > >> + pm_runtime_put_sync(dev); > >>} > >>spin_unlock_irqrestore(>lock, flags); > > > > Thanks for the patch, but I got spinlock deadlock when testing it. I > > think the function pair should be at the outside scope of the > > spin_lock/unlock, doesn't it? > > I see - sorry. Weird, it worked for me on my Nokia N900. What did you > test this on? > > I will try to submit an improved version tonight (you seem to have a > good idea on what is wrong, so I will follow that), but it would help me > if I can reproduce the issue. I tested on both Beaglebone Black and AM335x GP EVM, on the USB1 host port. I didn't test the USB0 port (yet). Thanks, -Bin.
Re: [PATCH] usb: musb: call pm_runtime_{get,put}_sync before reading vbus registers
Hi, On 26/02/18 16:57, Bin Liu wrote: > Hi, > > On Mon, Feb 26, 2018 at 11:56:08AM +0100, Merlijn Wajer wrote: >> Without pm_runtime_{get,put}_sync calls in place, reading >> vbus status via /sys causes the following error: >> >> Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa0ab060 >> pgd = b333e822 >> [fa0ab060] *pgd=48011452(bad) >> >> [] (musb_default_readb) from [] >> (musb_vbus_show+0x58/0xe4) >> [] (musb_vbus_show) from [] (dev_attr_show+0x20/0x44) >> [] (dev_attr_show) from [] (sysfs_kf_seq_show+0x80/0xdc) >> [] (sysfs_kf_seq_show) from [] (seq_read+0x250/0x448) >> [] (seq_read) from [] (__vfs_read+0x1c/0x118) >> [] (__vfs_read) from [] (vfs_read+0x90/0x144) >> [] (vfs_read) from [] (SyS_read+0x3c/0x74) >> [] (SyS_read) from [] (ret_fast_syscall+0x0/0x54) >> >> Solution was suggested by Tony Lindgren. >> >> Signed-off-by: Merlijn Wajer >> --- >> drivers/usb/musb/musb_core.c | 4 >> 1 file changed, 4 insertions(+) >> >> diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c >> index eef4ad578b31..ceaa40ef0e73 100644 >> --- a/drivers/usb/musb/musb_core.c >> +++ b/drivers/usb/musb/musb_core.c >> @@ -1760,6 +1760,8 @@ vbus_show(struct device *dev, struct device_attribute >> *attr, char *buf) >> val = musb->a_wait_bcon; >> vbus = musb_platform_get_vbus_status(musb); >> if (vbus < 0) { >> +pm_runtime_get_sync(dev); >> + >> /* Use default MUSB method by means of DEVCTL register */ >> devctl = musb_readb(musb->mregs, MUSB_DEVCTL); >> if ((devctl & MUSB_DEVCTL_VBUS) >> @@ -1767,6 +1769,8 @@ vbus_show(struct device *dev, struct device_attribute >> *attr, char *buf) >> vbus = 1; >> else >> vbus = 0; >> + >> +pm_runtime_put_sync(dev); >> } >> spin_unlock_irqrestore(>lock, flags); > > Thanks for the patch, but I got spinlock deadlock when testing it. I > think the function pair should be at the outside scope of the > spin_lock/unlock, doesn't it? I see - sorry. Weird, it worked for me on my Nokia N900. What did you test this on? I will try to submit an improved version tonight (you seem to have a good idea on what is wrong, so I will follow that), but it would help me if I can reproduce the issue. Cheers, Merlijn signature.asc Description: OpenPGP digital signature
Re: [PATCH] usb: musb: call pm_runtime_{get,put}_sync before reading vbus registers
Hi, On 26/02/18 16:57, Bin Liu wrote: > Hi, > > On Mon, Feb 26, 2018 at 11:56:08AM +0100, Merlijn Wajer wrote: >> Without pm_runtime_{get,put}_sync calls in place, reading >> vbus status via /sys causes the following error: >> >> Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa0ab060 >> pgd = b333e822 >> [fa0ab060] *pgd=48011452(bad) >> >> [] (musb_default_readb) from [] >> (musb_vbus_show+0x58/0xe4) >> [] (musb_vbus_show) from [] (dev_attr_show+0x20/0x44) >> [] (dev_attr_show) from [] (sysfs_kf_seq_show+0x80/0xdc) >> [] (sysfs_kf_seq_show) from [] (seq_read+0x250/0x448) >> [] (seq_read) from [] (__vfs_read+0x1c/0x118) >> [] (__vfs_read) from [] (vfs_read+0x90/0x144) >> [] (vfs_read) from [] (SyS_read+0x3c/0x74) >> [] (SyS_read) from [] (ret_fast_syscall+0x0/0x54) >> >> Solution was suggested by Tony Lindgren . >> >> Signed-off-by: Merlijn Wajer >> --- >> drivers/usb/musb/musb_core.c | 4 >> 1 file changed, 4 insertions(+) >> >> diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c >> index eef4ad578b31..ceaa40ef0e73 100644 >> --- a/drivers/usb/musb/musb_core.c >> +++ b/drivers/usb/musb/musb_core.c >> @@ -1760,6 +1760,8 @@ vbus_show(struct device *dev, struct device_attribute >> *attr, char *buf) >> val = musb->a_wait_bcon; >> vbus = musb_platform_get_vbus_status(musb); >> if (vbus < 0) { >> +pm_runtime_get_sync(dev); >> + >> /* Use default MUSB method by means of DEVCTL register */ >> devctl = musb_readb(musb->mregs, MUSB_DEVCTL); >> if ((devctl & MUSB_DEVCTL_VBUS) >> @@ -1767,6 +1769,8 @@ vbus_show(struct device *dev, struct device_attribute >> *attr, char *buf) >> vbus = 1; >> else >> vbus = 0; >> + >> +pm_runtime_put_sync(dev); >> } >> spin_unlock_irqrestore(>lock, flags); > > Thanks for the patch, but I got spinlock deadlock when testing it. I > think the function pair should be at the outside scope of the > spin_lock/unlock, doesn't it? I see - sorry. Weird, it worked for me on my Nokia N900. What did you test this on? I will try to submit an improved version tonight (you seem to have a good idea on what is wrong, so I will follow that), but it would help me if I can reproduce the issue. Cheers, Merlijn signature.asc Description: OpenPGP digital signature
Re: [PATCH] usb: musb: call pm_runtime_{get,put}_sync before reading vbus registers
Hi, On Mon, Feb 26, 2018 at 11:56:08AM +0100, Merlijn Wajer wrote: > Without pm_runtime_{get,put}_sync calls in place, reading > vbus status via /sys causes the following error: > > Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa0ab060 > pgd = b333e822 > [fa0ab060] *pgd=48011452(bad) > > [] (musb_default_readb) from [] (musb_vbus_show+0x58/0xe4) > [] (musb_vbus_show) from [] (dev_attr_show+0x20/0x44) > [] (dev_attr_show) from [] (sysfs_kf_seq_show+0x80/0xdc) > [] (sysfs_kf_seq_show) from [] (seq_read+0x250/0x448) > [] (seq_read) from [] (__vfs_read+0x1c/0x118) > [] (__vfs_read) from [] (vfs_read+0x90/0x144) > [] (vfs_read) from [] (SyS_read+0x3c/0x74) > [] (SyS_read) from [] (ret_fast_syscall+0x0/0x54) > > Solution was suggested by Tony Lindgren. > > Signed-off-by: Merlijn Wajer > --- > drivers/usb/musb/musb_core.c | 4 > 1 file changed, 4 insertions(+) > > diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c > index eef4ad578b31..ceaa40ef0e73 100644 > --- a/drivers/usb/musb/musb_core.c > +++ b/drivers/usb/musb/musb_core.c > @@ -1760,6 +1760,8 @@ vbus_show(struct device *dev, struct device_attribute > *attr, char *buf) > val = musb->a_wait_bcon; > vbus = musb_platform_get_vbus_status(musb); > if (vbus < 0) { > + pm_runtime_get_sync(dev); > + > /* Use default MUSB method by means of DEVCTL register */ > devctl = musb_readb(musb->mregs, MUSB_DEVCTL); > if ((devctl & MUSB_DEVCTL_VBUS) > @@ -1767,6 +1769,8 @@ vbus_show(struct device *dev, struct device_attribute > *attr, char *buf) > vbus = 1; > else > vbus = 0; > + > + pm_runtime_put_sync(dev); > } > spin_unlock_irqrestore(>lock, flags); Thanks for the patch, but I got spinlock deadlock when testing it. I think the function pair should be at the outside scope of the spin_lock/unlock, doesn't it? Regards, -Bin.
Re: [PATCH] usb: musb: call pm_runtime_{get,put}_sync before reading vbus registers
Hi, On Mon, Feb 26, 2018 at 11:56:08AM +0100, Merlijn Wajer wrote: > Without pm_runtime_{get,put}_sync calls in place, reading > vbus status via /sys causes the following error: > > Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa0ab060 > pgd = b333e822 > [fa0ab060] *pgd=48011452(bad) > > [] (musb_default_readb) from [] (musb_vbus_show+0x58/0xe4) > [] (musb_vbus_show) from [] (dev_attr_show+0x20/0x44) > [] (dev_attr_show) from [] (sysfs_kf_seq_show+0x80/0xdc) > [] (sysfs_kf_seq_show) from [] (seq_read+0x250/0x448) > [] (seq_read) from [] (__vfs_read+0x1c/0x118) > [] (__vfs_read) from [] (vfs_read+0x90/0x144) > [] (vfs_read) from [] (SyS_read+0x3c/0x74) > [] (SyS_read) from [] (ret_fast_syscall+0x0/0x54) > > Solution was suggested by Tony Lindgren . > > Signed-off-by: Merlijn Wajer > --- > drivers/usb/musb/musb_core.c | 4 > 1 file changed, 4 insertions(+) > > diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c > index eef4ad578b31..ceaa40ef0e73 100644 > --- a/drivers/usb/musb/musb_core.c > +++ b/drivers/usb/musb/musb_core.c > @@ -1760,6 +1760,8 @@ vbus_show(struct device *dev, struct device_attribute > *attr, char *buf) > val = musb->a_wait_bcon; > vbus = musb_platform_get_vbus_status(musb); > if (vbus < 0) { > + pm_runtime_get_sync(dev); > + > /* Use default MUSB method by means of DEVCTL register */ > devctl = musb_readb(musb->mregs, MUSB_DEVCTL); > if ((devctl & MUSB_DEVCTL_VBUS) > @@ -1767,6 +1769,8 @@ vbus_show(struct device *dev, struct device_attribute > *attr, char *buf) > vbus = 1; > else > vbus = 0; > + > + pm_runtime_put_sync(dev); > } > spin_unlock_irqrestore(>lock, flags); Thanks for the patch, but I got spinlock deadlock when testing it. I think the function pair should be at the outside scope of the spin_lock/unlock, doesn't it? Regards, -Bin.
[PATCH] usb: musb: call pm_runtime_{get,put}_sync before reading vbus registers
Without pm_runtime_{get,put}_sync calls in place, reading vbus status via /sys causes the following error: Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa0ab060 pgd = b333e822 [fa0ab060] *pgd=48011452(bad) [] (musb_default_readb) from [] (musb_vbus_show+0x58/0xe4) [] (musb_vbus_show) from [] (dev_attr_show+0x20/0x44) [] (dev_attr_show) from [] (sysfs_kf_seq_show+0x80/0xdc) [] (sysfs_kf_seq_show) from [] (seq_read+0x250/0x448) [] (seq_read) from [] (__vfs_read+0x1c/0x118) [] (__vfs_read) from [] (vfs_read+0x90/0x144) [] (vfs_read) from [] (SyS_read+0x3c/0x74) [] (SyS_read) from [] (ret_fast_syscall+0x0/0x54) Solution was suggested by Tony Lindgren. Signed-off-by: Merlijn Wajer --- drivers/usb/musb/musb_core.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index eef4ad578b31..ceaa40ef0e73 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -1760,6 +1760,8 @@ vbus_show(struct device *dev, struct device_attribute *attr, char *buf) val = musb->a_wait_bcon; vbus = musb_platform_get_vbus_status(musb); if (vbus < 0) { + pm_runtime_get_sync(dev); + /* Use default MUSB method by means of DEVCTL register */ devctl = musb_readb(musb->mregs, MUSB_DEVCTL); if ((devctl & MUSB_DEVCTL_VBUS) @@ -1767,6 +1769,8 @@ vbus_show(struct device *dev, struct device_attribute *attr, char *buf) vbus = 1; else vbus = 0; + + pm_runtime_put_sync(dev); } spin_unlock_irqrestore(>lock, flags); -- 2.16.2
[PATCH] usb: musb: call pm_runtime_{get,put}_sync before reading vbus registers
Without pm_runtime_{get,put}_sync calls in place, reading vbus status via /sys causes the following error: Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa0ab060 pgd = b333e822 [fa0ab060] *pgd=48011452(bad) [] (musb_default_readb) from [] (musb_vbus_show+0x58/0xe4) [] (musb_vbus_show) from [] (dev_attr_show+0x20/0x44) [] (dev_attr_show) from [] (sysfs_kf_seq_show+0x80/0xdc) [] (sysfs_kf_seq_show) from [] (seq_read+0x250/0x448) [] (seq_read) from [] (__vfs_read+0x1c/0x118) [] (__vfs_read) from [] (vfs_read+0x90/0x144) [] (vfs_read) from [] (SyS_read+0x3c/0x74) [] (SyS_read) from [] (ret_fast_syscall+0x0/0x54) Solution was suggested by Tony Lindgren . Signed-off-by: Merlijn Wajer --- drivers/usb/musb/musb_core.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index eef4ad578b31..ceaa40ef0e73 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -1760,6 +1760,8 @@ vbus_show(struct device *dev, struct device_attribute *attr, char *buf) val = musb->a_wait_bcon; vbus = musb_platform_get_vbus_status(musb); if (vbus < 0) { + pm_runtime_get_sync(dev); + /* Use default MUSB method by means of DEVCTL register */ devctl = musb_readb(musb->mregs, MUSB_DEVCTL); if ((devctl & MUSB_DEVCTL_VBUS) @@ -1767,6 +1769,8 @@ vbus_show(struct device *dev, struct device_attribute *attr, char *buf) vbus = 1; else vbus = 0; + + pm_runtime_put_sync(dev); } spin_unlock_irqrestore(>lock, flags); -- 2.16.2
Re: [RFC PATCH] usb: musb: call pm_runtime_{get,put}_sync before reading vbus registers
Hello! On 2/24/2018 11:51 PM, Merlijn Wajer wrote: Without pm_runtime_{get,put}_sync calls in place, reading vbus status via /sys causes the following error: Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa0ab060 pgd = b333e822 [fa0ab060] *pgd=48011452(bad) [] (musb_default_readb) from [] (musb_vbus_show+0x58/0xe4) [] (musb_vbus_show) from [] (dev_attr_show+0x20/0x44) [] (dev_attr_show) from [] (sysfs_kf_seq_show+0x80/0xdc) [] (sysfs_kf_seq_show) from [] (seq_read+0x250/0x448) [] (seq_read) from [] (__vfs_read+0x1c/0x118) [] (__vfs_read) from [] (vfs_read+0x90/0x144) [] (vfs_read) from [] (SyS_read+0x3c/0x74) [] (SyS_read) from [] (ret_fast_syscall+0x0/0x54) Solution was suggested by Tony Lindgren. Signed-off-by: Merlijn Wajer --- drivers/usb/musb/musb_core.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index ea5013aa69e2..182611f76af3 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c [...] @@ -1767,6 +1769,9 @@ musb_vbus_show(struct device *dev, struct device_attribute *attr, char *buf) vbus = 1; else vbus = 0; + + pm_runtime_put_sync(dev); + Empty line not needed here. } spin_unlock_irqrestore(>lock, flags); MBR, Sergei
Re: [RFC PATCH] usb: musb: call pm_runtime_{get,put}_sync before reading vbus registers
Hello! On 2/24/2018 11:51 PM, Merlijn Wajer wrote: Without pm_runtime_{get,put}_sync calls in place, reading vbus status via /sys causes the following error: Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa0ab060 pgd = b333e822 [fa0ab060] *pgd=48011452(bad) [] (musb_default_readb) from [] (musb_vbus_show+0x58/0xe4) [] (musb_vbus_show) from [] (dev_attr_show+0x20/0x44) [] (dev_attr_show) from [] (sysfs_kf_seq_show+0x80/0xdc) [] (sysfs_kf_seq_show) from [] (seq_read+0x250/0x448) [] (seq_read) from [] (__vfs_read+0x1c/0x118) [] (__vfs_read) from [] (vfs_read+0x90/0x144) [] (vfs_read) from [] (SyS_read+0x3c/0x74) [] (SyS_read) from [] (ret_fast_syscall+0x0/0x54) Solution was suggested by Tony Lindgren . Signed-off-by: Merlijn Wajer --- drivers/usb/musb/musb_core.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index ea5013aa69e2..182611f76af3 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c [...] @@ -1767,6 +1769,9 @@ musb_vbus_show(struct device *dev, struct device_attribute *attr, char *buf) vbus = 1; else vbus = 0; + + pm_runtime_put_sync(dev); + Empty line not needed here. } spin_unlock_irqrestore(>lock, flags); MBR, Sergei
[RFC PATCH] usb: musb: call pm_runtime_{get,put}_sync before reading vbus registers
Without pm_runtime_{get,put}_sync calls in place, reading vbus status via /sys causes the following error: Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa0ab060 pgd = b333e822 [fa0ab060] *pgd=48011452(bad) [] (musb_default_readb) from [] (musb_vbus_show+0x58/0xe4) [] (musb_vbus_show) from [] (dev_attr_show+0x20/0x44) [] (dev_attr_show) from [] (sysfs_kf_seq_show+0x80/0xdc) [] (sysfs_kf_seq_show) from [] (seq_read+0x250/0x448) [] (seq_read) from [] (__vfs_read+0x1c/0x118) [] (__vfs_read) from [] (vfs_read+0x90/0x144) [] (vfs_read) from [] (SyS_read+0x3c/0x74) [] (SyS_read) from [] (ret_fast_syscall+0x0/0x54) Solution was suggested by Tony Lindgren. Signed-off-by: Merlijn Wajer --- drivers/usb/musb/musb_core.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index ea5013aa69e2..182611f76af3 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -1760,6 +1760,8 @@ musb_vbus_show(struct device *dev, struct device_attribute *attr, char *buf) val = musb->a_wait_bcon; vbus = musb_platform_get_vbus_status(musb); if (vbus < 0) { + pm_runtime_get_sync(dev); + /* Use default MUSB method by means of DEVCTL register */ devctl = musb_readb(musb->mregs, MUSB_DEVCTL); if ((devctl & MUSB_DEVCTL_VBUS) @@ -1767,6 +1769,9 @@ musb_vbus_show(struct device *dev, struct device_attribute *attr, char *buf) vbus = 1; else vbus = 0; + + pm_runtime_put_sync(dev); + } spin_unlock_irqrestore(>lock, flags); -- 2.16.2
[RFC PATCH] usb: musb: call pm_runtime_{get,put}_sync before reading vbus registers
Without pm_runtime_{get,put}_sync calls in place, reading vbus status via /sys causes the following error: Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa0ab060 pgd = b333e822 [fa0ab060] *pgd=48011452(bad) [] (musb_default_readb) from [] (musb_vbus_show+0x58/0xe4) [] (musb_vbus_show) from [] (dev_attr_show+0x20/0x44) [] (dev_attr_show) from [] (sysfs_kf_seq_show+0x80/0xdc) [] (sysfs_kf_seq_show) from [] (seq_read+0x250/0x448) [] (seq_read) from [] (__vfs_read+0x1c/0x118) [] (__vfs_read) from [] (vfs_read+0x90/0x144) [] (vfs_read) from [] (SyS_read+0x3c/0x74) [] (SyS_read) from [] (ret_fast_syscall+0x0/0x54) Solution was suggested by Tony Lindgren . Signed-off-by: Merlijn Wajer --- drivers/usb/musb/musb_core.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index ea5013aa69e2..182611f76af3 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -1760,6 +1760,8 @@ musb_vbus_show(struct device *dev, struct device_attribute *attr, char *buf) val = musb->a_wait_bcon; vbus = musb_platform_get_vbus_status(musb); if (vbus < 0) { + pm_runtime_get_sync(dev); + /* Use default MUSB method by means of DEVCTL register */ devctl = musb_readb(musb->mregs, MUSB_DEVCTL); if ((devctl & MUSB_DEVCTL_VBUS) @@ -1767,6 +1769,9 @@ musb_vbus_show(struct device *dev, struct device_attribute *attr, char *buf) vbus = 1; else vbus = 0; + + pm_runtime_put_sync(dev); + } spin_unlock_irqrestore(>lock, flags); -- 2.16.2