Skip to contentSkip to conversation

musb: fix power field to hold all possible values

PATCH Applied Ajay Kumar Gupta 5 participants 11 messages Feb 23, 2010 – Mar 24, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 musb: fix power field to hold all possible values

MUSB can supply upto 500mA such as, AM3517 and OMAP3EVM Rev >=E and thus the 'power' field has to hold values above 255.

---
 arch/arm/plat-omap/include/plat/usb.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/plat-omap/include/plat/usb.h +1 -1
index 288e29e..b181297 100644
@@ -46,7 +46,7 @@ struct ehci_hcd_omap_platform_data {
 struct omap_musb_board_data {
 	u8	interface_type;
 	u8	mode;
-	u8	power;
+	u16	power;
 };
 
 enum musb_interface    {MUSB_INTERFACE_ULPI, MUSB_INTERFACE_UTMI};
Signature · 1 line
1.6.2.4
#1 lore raw

Hi,

Quoted 2 lines · Ajay Kumar Gupta

MUSB can supply upto 500mA such as, AM3517 and OMAP3EVM Rev >=E and thus the 'power' field has to hold values above 255.

power on the arch code is same as bMaxPower it will be multiplied by two on musb_core.c. See line 150 of that file.

Meaning 500mA is set to 250 on the board-file.

Signature · 1 line
balbi
#2 lore raw
Quoted 11 lines · Felipe Balbi

Hi,

Quoted 2 lines · Ajay Kumar Gupta

MUSB can supply upto 500mA such as, AM3517 and OMAP3EVM Rev >=E and thus the 'power' field has to hold values above 255.

power on the arch code is same as bMaxPower it will be multiplied by two on musb_core.c. See line 150 of that file.

Meaning 500mA is set to 250 on the board-file.

Any reason we have the "multiply by 2" there?

- Anand

#3 lore raw

Hi,

Quoted 7 lines · Anand
Quoted 5 lines

power on the arch code is same as bMaxPower it will be multiplied by two on musb_core.c. See line 150 of that file.

Meaning 500mA is set to 250 on the board-file.

Any reason we have the "multiply by 2" there?

no big reason. It's just legacy code. Maybe it's to keep consistency with the gadget framework, donno.

Signature · 1 line
balbi
#4 lore raw
In reply to Felipe Balbi
Quoted 7 lines

-----Original Message-----
From: Felipe Balbi [mailto:[email protected]]
Sent: Tuesday, February 23, 2010 3:22 PM
To: Gupta, Ajay Kumar
Cc: [email protected]
Subject: Re: [PATCH] musb: fix power field to hold all possible values

Quoted 8 lines

Hi,

Quoted 2 lines · Ajay Kumar Gupta

MUSB can supply upto 500mA such as, AM3517 and OMAP3EVM Rev >=E and thus the 'power' field has to hold values above 255.

power on the arch code is same as bMaxPower it will be multiplied by two on musb_core.c. See line 150 of that file.

Agreed but see comment below.

Quoted 2 lines

Meaning 500mA is set to 250 on the board-file.

Board files are providing the actual mA and it is getting divided in Arch/arm/mach-omap2/usb-musb.c. See the code snippet below,

        musb_plat.clock = "ick";
        musb_plat.board_data = board_data;
-->     musb_plat.power = board_data->power >> 1;
        musb_plat.mode = board_data->mode;

So we need to either take this patch or fix this logic of dividing the mA supplied from all omap board files.

-Ajay

Quoted 3 lines

--
balbi

#5 lore raw

Hi,

Quoted 10 lines · Ajay Kumar

Board files are providing the actual mA and it is getting divided in Arch/arm/mach-omap2/usb-musb.c. See the code snippet below,

        musb_plat.clock = "ick";
        musb_plat.board_data = board_data;
-->     musb_plat.power = board_data->power >> 1;
        musb_plat.mode = board_data->mode;

So we need to either take this patch or fix this logic of dividing the mA supplied from all omap board files.

that's true, had missed that. Sorry.

Signature · 1 line
balbi
#6 lore raw
Quoted 11 lines · Felipe Balbi

Hi,

Quoted 8 lines · Ajay Kumar

Board files are providing the actual mA and it is getting divided in Arch/arm/mach-omap2/usb-musb.c. See the code snippet below,

        musb_plat.clock = "ick";
        musb_plat.board_data = board_data;
-->     musb_plat.power = board_data->power >> 1;
        musb_plat.mode = board_data->mode;
Quoted 4 lines
Quoted 2 lines

So we need to either take this patch or fix this logic of dividing the mA supplied from all omap board files.

that's true, had missed that. Sorry.

Hmm, I believe this value is also divided somewhere else but I forgot where. In any case, when making changes like this please run the standard USB tests for gadgets and OTG.

Otherwise things are guaranteed to break for USB certs :)

Tony

#7 lore raw

Hi,

Quoted 23 lines

-----Original Message-----
From: Tony Lindgren [mailto:[email protected]]
Sent: Friday, February 26, 2010 3:50 AM
To: Felipe Balbi
Cc: Gupta, Ajay Kumar; [email protected]
Subject: Re: [PATCH] musb: fix power field to hold all possible values

Quoted 12 lines · Felipe Balbi

Hi,

Quoted 9 lines · Ajay Kumar

Board files are providing the actual mA and it is getting divided in Arch/arm/mach-omap2/usb-musb.c. See the code snippet below,

        musb_plat.clock = "ick";
        musb_plat.board_data = board_data;
-->     musb_plat.power = board_data->power >> 1;
        musb_plat.mode = board_data->mode;

So we need to either take this patch or fix this logic of dividing the

mA

Quoted 2 lines
Quoted 1 line

supplied from all omap board files.

Quoted 7 lines
Quoted 1 line

that's true, had missed that. Sorry.

Hmm, I believe this value is also divided somewhere else but I forgot where. In any case, when making changes like this please run the standard USB tests for gadgets and OTG.

Otherwise things are guaranteed to break for USB certs :)

Tony,

Currently the flow is,

1. Actual mA provided in all omap board files.
2. mA gets divided in usb-musb.c
3. mA multiplied by two in driver/usb/musb/musb_core.c to pass it to hcd->power_budget.

So the current patch fixes the logic in step [1] above to fill mA value Above 255.

-Ajay

Quoted 2 lines

Tony

#8 lore raw

Hi,

Quoted 45 lines

-----Original Message-----
From: [email protected] [mailto:linux-omap- [email protected]] On Behalf Of Gupta, Ajay Kumar
Sent: Friday, February 26, 2010 10:03 AM
To: Tony Lindgren; Felipe Balbi
Cc: [email protected]
Subject: RE: [PATCH] musb: fix power field to hold all possible values

Hi,

Quoted 7 lines

-----Original Message-----
From: Tony Lindgren [mailto:[email protected]]
Sent: Friday, February 26, 2010 3:50 AM
To: Felipe Balbi
Cc: Gupta, Ajay Kumar; [email protected]
Subject: Re: [PATCH] musb: fix power field to hold all possible values

Quoted 13 lines
Quoted 12 lines · Felipe Balbi

Hi,

Quoted 9 lines · Ajay Kumar

Board files are providing the actual mA and it is getting divided in Arch/arm/mach-omap2/usb-musb.c. See the code snippet below,

        musb_plat.clock = "ick";
        musb_plat.board_data = board_data;
-->     musb_plat.power = board_data->power >> 1;
        musb_plat.mode = board_data->mode;

So we need to either take this patch or fix this logic of dividing

the

Quoted 10 lines

mA

Quoted 3 lines
Quoted 1 line

supplied from all omap board files.

that's true, had missed that. Sorry.

Hmm, I believe this value is also divided somewhere else but I forgot where. In any case, when making changes like this please run the standard USB tests for gadgets and OTG.

Otherwise things are guaranteed to break for USB certs :)

Tony,

Currently the flow is,

Quoted 7 lines

1. Actual mA provided in all omap board files.
2. mA gets divided in usb-musb.c
3. mA multiplied by two in driver/usb/musb/musb_core.c to pass it to hcd->power_budget.

So the current patch fixes the logic in step [1] above to fill mA value Above 255.

Felipe/Tony,

Any update on this patch ?

Regards,
Ajay

Quoted 8 lines

-Ajay

Quoted 2 lines

Tony

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#9 lore raw
Quoted 3 lines · Ajay Kumar

Felipe/Tony,

Any update on this patch ?

It's fine by me but I was expecting Tony to pick it up since it's on the arch code.

Tony, do you want me to queue it for Greg or you take it forward ?

Signature · 1 line
balbi