Skip to content

Commit d871c62

Browse files
georgecherianFelipe Balbi
authored andcommitted
usb: musb: core: Convert the musb_platform_reset to have a return value.
Currently musb_platform_reset() is only used by dsps. In case of BABBLE interrupt for other platforms the musb_platform_reset() is a NOP. In such situations no need to re-initialize the endpoints. Also in the latest silicon revision of AM335x, we do have a babble recovery mechanism without resetting the IP block. In preperation to add that support its better to have a rest_done return for musb_platform_reset(). Signed-off-by: George Cherian <[email protected]> Tested-by: Bin Liu <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
1 parent 675ae76 commit d871c62

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

drivers/usb/musb/musb_core.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1753,9 +1753,11 @@ static void musb_irq_work(struct work_struct *data)
17531753
static void musb_recover_work(struct work_struct *data)
17541754
{
17551755
struct musb *musb = container_of(data, struct musb, recover_work.work);
1756-
int status;
1756+
int status, ret;
17571757

1758-
musb_platform_reset(musb);
1758+
ret = musb_platform_reset(musb);
1759+
if (ret)
1760+
return;
17591761

17601762
usb_phy_vbus_off(musb->xceiv);
17611763
usleep_range(100, 200);
@@ -1764,8 +1766,8 @@ static void musb_recover_work(struct work_struct *data)
17641766
usleep_range(100, 200);
17651767

17661768
/*
1767-
* When a babble condition occurs, the musb controller removes the
1768-
* session bit and the endpoint config is lost.
1769+
* When a babble condition occurs, the musb controller
1770+
* removes the session bit and the endpoint config is lost.
17691771
*/
17701772
if (musb->dyn_fifo)
17711773
status = ep_config_from_table(musb);

drivers/usb/musb/musb_core.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ struct musb_platform_ops {
192192

193193
int (*set_mode)(struct musb *musb, u8 mode);
194194
void (*try_idle)(struct musb *musb, unsigned long timeout);
195-
void (*reset)(struct musb *musb);
195+
int (*reset)(struct musb *musb);
196196

197197
int (*vbus_status)(struct musb *musb);
198198
void (*set_vbus)(struct musb *musb, int on);
@@ -555,10 +555,12 @@ static inline void musb_platform_try_idle(struct musb *musb,
555555
musb->ops->try_idle(musb, timeout);
556556
}
557557

558-
static inline void musb_platform_reset(struct musb *musb)
558+
static inline int musb_platform_reset(struct musb *musb)
559559
{
560-
if (musb->ops->reset)
561-
musb->ops->reset(musb);
560+
if (!musb->ops->reset)
561+
return -EINVAL;
562+
563+
return musb->ops->reset(musb);
562564
}
563565

564566
static inline int musb_platform_get_vbus_status(struct musb *musb)

drivers/usb/musb/musb_dsps.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ static int dsps_musb_set_mode(struct musb *musb, u8 mode)
544544
return 0;
545545
}
546546

547-
static void dsps_musb_reset(struct musb *musb)
547+
static int dsps_musb_reset(struct musb *musb)
548548
{
549549
struct device *dev = musb->controller;
550550
struct dsps_glue *glue = dev_get_drvdata(dev->parent);
@@ -556,6 +556,7 @@ static void dsps_musb_reset(struct musb *musb)
556556
usleep_range(100, 200);
557557
usb_phy_init(musb->xceiv);
558558

559+
return 0;
559560
}
560561

561562
static struct musb_platform_ops dsps_ops = {

0 commit comments

Comments
 (0)