Skip to contentSkip to conversation

musb: Add structure 'musb_hdrc_board_data'

PATCH In review Ajay Kumar Gupta 4 participants 24 messages Nov 17, 2009 – Nov 19, 2009 11 messages not in the archive

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

cover musb: Add structure 'musb_hdrc_board_data'

Hi,

This patch set adds a new structure 'musb_hdrc_board_data' to get all board specific data from board files.

It is actually done to accomodate ULPI_VBUSCONTROL programming required for OMAP3EVM Rev >=E which uses external Vbus supply to support 500mA.

Necessarly changes have been done in all the OMAP, Davinci and Blackfin platform based boards.

[patches created against linus's tree and tested on OMAP3EVM]

Regards,
Ajay

Ajay Kumar Gupta (8):
musb: Add structure to get board specific data
musb: Get power (mA) from board data
musb: Update musb_init() call for all OMAP3 boards
musb: Update setup_usb() call for all Davinci boards
musb: Add 'extvbus' in musb_hdrc_board_data
musb: set 'extvbus = 0' for OMAP3 boards
musb: set 'extvbus = 0' for Davinci boards
musb: set 'extvbus = 0' for Blackfin boards

 arch/arm/mach-davinci/board-dm355-evm.c     |   10 +++++++++-
 arch/arm/mach-davinci/board-dm355-leopard.c |   10 +++++++++-
 arch/arm/mach-davinci/board-dm644x-evm.c    |    9 ++++++++-
 arch/arm/mach-davinci/board-sffsdr.c        |   10 +++++++++-
 arch/arm/mach-davinci/include/mach/common.h |    7 +++++--
 arch/arm/mach-davinci/usb.c                 |    8 ++++----
 arch/arm/mach-omap2/board-2430sdp.c         |    8 +++++++-
 arch/arm/mach-omap2/board-3430sdp.c         |    9 ++++++++-
 arch/arm/mach-omap2/board-ldp.c             |    8 +++++++-
 arch/arm/mach-omap2/board-omap3beagle.c     |    9 ++++++++-
 arch/arm/mach-omap2/board-omap3evm.c        |    9 ++++++++-
 arch/arm/mach-omap2/board-omap3pandora.c    |    9 ++++++++-
 arch/arm/mach-omap2/board-overo.c           |    9 ++++++++-
 arch/arm/mach-omap2/board-rx51.c            |    8 +++++++-
 arch/arm/mach-omap2/board-zoom2.c           |    8 +++++++-
 arch/arm/mach-omap2/usb-musb.c              |   13 +++++--------
 arch/arm/plat-omap/include/mach/usb.h       |    3 ++-
 arch/blackfin/mach-bf527/boards/cm_bf527.c  |    6 ++++++
 arch/blackfin/mach-bf527/boards/ezbrd.c     |    6 ++++++
 arch/blackfin/mach-bf527/boards/ezkit.c     |    6 ++++++
 arch/blackfin/mach-bf548/boards/cm_bf548.c  |    6 ++++++
 arch/blackfin/mach-bf548/boards/ezkit.c     |    6 ++++++
 drivers/usb/musb/musb_core.c                |   14 +++++++++++++-
 drivers/usb/musb/musb_regs.h                |    5 +++++
 include/linux/usb/musb.h                    |   19 +++++++++++++------
 25 files changed, 180 insertions(+), 35 deletions(-)

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

#1 lore raw

PATCH 1/8 musb: Add structure to get board specific data

Adding 'musb_hdrc_board_data' which will have all the board specific parameters such as; mA power, potpgt, extvbus, gpios etc.

Currently only 'power' and 'potpgt' is being moved from existing 'musb_hdrc_platform_data' to 'musb_hdrc_board_data' but any further board specific functions or parameter can be added to this structure later.

---
 include/linux/usb/musb.h |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)
include/linux/usb/musb.h +12 -6
index d437556..6e1426c 100644
@@ -27,6 +27,15 @@ struct musb_hdrc_eps_bits {
 	u8		bits;
 };
 
+/* MUSB board-specific details */
+struct musb_hdrc_board_data {
+	/* power (mA/2) sourcing capability */
+	u8	power;
+	/* (HOST or OTG) msec/2 after VBUS on till power good */
+	u8		potpgt;
+
+};
+
 struct musb_hdrc_config {
 	/* MUSB configuration-specific details */
 	unsigned	multipoint:1;	/* multipoint device */
@@ -67,15 +76,9 @@ struct musb_hdrc_platform_data {
 	/* (HOST or OTG) switch VBUS on/off */
 	int		(*set_vbus)(struct device *dev, int is_on);
 
-	/* (HOST or OTG) mA/2 power supplied on (default = 8mA) */
-	u8		power;
-
 	/* (PERIPHERAL) mA/2 max power consumed (default = 100mA) */
 	u8		min_power;
 
-	/* (HOST or OTG) msec/2 after VBUS on till power good */
-	u8		potpgt;
-
 	/* Power the device on or off */
 	int		(*set_power)(int state);
 
@@ -84,6 +87,9 @@ struct musb_hdrc_platform_data {
 
 	/* MUSB configuration-specific details */
 	struct musb_hdrc_config	*config;
+
+	/* MUSB board-specific details */
+	struct musb_hdrc_board_data *board_data;
 };
 
 
Signature · 1 line
1.6.2.4
#2 lore raw

PATCH 2/8 musb: Get power (mA) from board data

Different board may have different power sourcing capability and now with 'struct musb_hdrc_board_data' in place; pass this data from board files and also modify musb_core.c to get 'power' data from 'plat->board_data'.

---
 drivers/usb/musb/musb_core.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/usb/musb/musb_core.c +3 -1
index 3a61ddb..818ccda 100644
@@ -2033,7 +2033,9 @@ bad_config:
 		if (is_otg_enabled(musb))
 			hcd->self.otg_port = 1;
 		musb->xceiv->host = &hcd->self;
-		hcd->power_budget = 2 * (plat->power ? : 250);
+		if (plat->board_data)
+			hcd->power_budget =
+				2 * (plat->board_data->power ? : 250);
 	}
 
 	/* For the host-only role, we can activate right away.
Signature · 1 line
1.6.2.4
#3 lore raw

PATCH 3/8 musb: Update musb_init() call for all OMAP3 boards

musb_init() has been modified to pass board specific data so updating this function call from all OMAP3 boards.

---
 arch/arm/mach-omap2/board-2430sdp.c      |    7 ++++++-
 arch/arm/mach-omap2/board-3430sdp.c      |    8 +++++++-
 arch/arm/mach-omap2/board-ldp.c          |    7 ++++++-
 arch/arm/mach-omap2/board-omap3beagle.c  |    8 +++++++-
 arch/arm/mach-omap2/board-omap3evm.c     |    8 +++++++-
 arch/arm/mach-omap2/board-omap3pandora.c |    8 +++++++-
 arch/arm/mach-omap2/board-overo.c        |    8 +++++++-
 arch/arm/mach-omap2/board-rx51.c         |    7 ++++++-
 arch/arm/mach-omap2/board-zoom2.c        |    8 +++++++-
 arch/arm/mach-omap2/usb-musb.c           |   13 +++++--------
 arch/arm/plat-omap/include/mach/usb.h    |    3 ++-
 11 files changed, 67 insertions(+), 18 deletions(-)
arch/arm/mach-omap2/board-2430sdp.c +6 -1
index 42217b3..970dcab 100644
@@ -23,6 +23,7 @@
 #include <linux/err.h>
 #include <linux/clk.h>
 #include <linux/io.h>
+#include <linux/usb/musb.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -194,6 +195,10 @@ static struct twl4030_hsmmc_info mmc[] __initdata = {
 	{}	/* Terminator */
 };
 
+static struct musb_hdrc_board_data musb_bdata __initdata = {
+	.power = 50,
+};
+
 static void __init omap_2430sdp_init(void)
 {
 	int ret;
@@ -203,7 +208,7 @@ static void __init omap_2430sdp_init(void)
 	platform_add_devices(sdp2430_devices, ARRAY_SIZE(sdp2430_devices));
 	omap_serial_init();
 	twl4030_mmc_init(mmc);
-	usb_musb_init();
+	usb_musb_init(&musb_bdata);
 	board_smc91x_init();
 
 	/* Turn off secondary LCD backlight */
arch/arm/mach-omap2/board-3430sdp.c +7 -1
index 0acb556..85cd24f 100644
@@ -24,6 +24,7 @@
 #include <linux/regulator/machine.h>
 #include <linux/io.h>
 #include <linux/gpio.h>
+#include <linux/usb/musb.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -484,6 +485,11 @@ static void enable_board_wakeup_source(void)
 	omap_cfg_reg(AF26_34XX_SYS_NIRQ); /* T2 interrupt line (keypad) */
 }
 
+/* musb board specific details */
+static struct musb_hdrc_board_data musb_bdata __initdata = {
+	.power = 50,
+};
+
 static void __init omap_3430sdp_init(void)
 {
 	omap3430_i2c_init();
@@ -497,7 +503,7 @@ static void __init omap_3430sdp_init(void)
 				ARRAY_SIZE(sdp3430_spi_board_info));
 	ads7846_dev_init();
 	omap_serial_init();
-	usb_musb_init();
+	usb_musb_init(&musb_bdata);
 	board_smc91x_init();
 	enable_board_wakeup_source();
 }
arch/arm/mach-omap2/board-ldp.c +6 -1
index d57ec2f..a8338a4 100644
@@ -27,6 +27,7 @@
 #include <linux/i2c/twl4030.h>
 #include <linux/io.h>
 #include <linux/smsc911x.h>
+#include <linux/usb/musb.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -374,6 +375,10 @@ static struct platform_device *ldp_devices[] __initdata = {
 	&ldp_gpio_keys_device,
 };
 
+static struct musb_hdrc_board_data musb_bdata __initdata = {
+	.power = 50,
+};
+
 static void __init omap_ldp_init(void)
 {
 	omap_i2c_init();
@@ -384,7 +389,7 @@ static void __init omap_ldp_init(void)
 				ARRAY_SIZE(ldp_spi_board_info));
 	ads7846_dev_init();
 	omap_serial_init();
-	usb_musb_init();
+	usb_musb_init(&musb_bdata);
 
 	twl4030_mmc_init(mmc);
 	/* link regulators to MMC adapters */
arch/arm/mach-omap2/board-omap3beagle.c +7 -1
index 08b0816..113bcfe 100644
@@ -30,6 +30,7 @@
 
 #include <linux/regulator/machine.h>
 #include <linux/i2c/twl4030.h>
+#include <linux/usb/musb.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -400,6 +401,11 @@ static void __init omap3beagle_flash_init(void)
 	}
 }
 
+/* musb board specific details */
+static struct musb_hdrc_board_data musb_bdata __initdata = {
+	.power = 50,
+};
+
 static void __init omap3_beagle_init(void)
 {
 	omap3_beagle_i2c_init();
@@ -412,7 +418,7 @@ static void __init omap3_beagle_init(void)
 	/* REVISIT leave DVI powered down until it's needed ... */
 	gpio_direction_output(170, true);
 
-	usb_musb_init();
+	usb_musb_init(&musb_bdata);
 	omap3beagle_flash_init();
 
 	/* Ensure SDRC pins are mux'd for self-refresh */
arch/arm/mach-omap2/board-omap3evm.c +7 -1
index 4c4d7f8..9e2656a 100644
@@ -27,6 +27,7 @@
 #include <linux/spi/ads7846.h>
 #include <linux/i2c/twl4030.h>
 #include <linux/usb/otg.h>
+#include <linux/usb/musb.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -297,6 +298,11 @@ static struct platform_device *omap3_evm_devices[] __initdata = {
 	&omap3evm_smc911x_device,
 };
 
+/* musb board specific details */
+static struct musb_hdrc_board_data musb_bdata __initdata = {
+	.power = 50,
+};
+
 static void __init omap3_evm_init(void)
 {
 	omap3_evm_i2c_init();
@@ -311,7 +317,7 @@ static void __init omap3_evm_init(void)
 	/* OMAP3EVM uses ISP1504 phy and so register nop transceiver */
 	usb_nop_xceiv_register();
 #endif
-	usb_musb_init();
+	usb_musb_init(&musb_bdata);
 	ads7846_dev_init();
 }
 
arch/arm/mach-omap2/board-omap3pandora.c +7 -1
index 7519edb..9bcd324 100644
@@ -29,6 +29,7 @@
 #include <linux/input.h>
 #include <linux/input/matrix_keypad.h>
 #include <linux/gpio_keys.h>
+#include <linux/usb/musb.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -387,6 +388,11 @@ static struct platform_device *omap3pandora_devices[] __initdata = {
 	&pandora_keys_gpio,
 };
 
+/* musb board specific details */
+static struct musb_hdrc_board_data musb_bdata __initdata = {
+	.power = 50,
+};
+
 static void __init omap3pandora_init(void)
 {
 	omap3pandora_i2c_init();
@@ -397,7 +403,7 @@ static void __init omap3pandora_init(void)
 			ARRAY_SIZE(omap3pandora_spi_board_info));
 	omap3pandora_ads7846_init();
 	pandora_keys_gpio_init();
-	usb_musb_init();
+	usb_musb_init(&musb_bdata);
 
 	/* Ensure SDRC pins are mux'd for self-refresh */
 	omap_cfg_reg(H16_34XX_SDRC_CKE0);
arch/arm/mach-omap2/board-overo.c +7 -1
index 9917d2f..e2acb91 100644
@@ -32,6 +32,7 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
 #include <linux/mtd/partitions.h>
+#include <linux/usb/musb.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -384,13 +385,18 @@ static struct platform_device *overo_devices[] __initdata = {
 	&overo_lcd_device,
 };
 
+/* musb board specific details */
+static struct musb_hdrc_board_data musb_bdata __initdata = {
+	.power = 50,
+};
+
 static void __init overo_init(void)
 {
 	overo_i2c_init();
 	platform_add_devices(overo_devices, ARRAY_SIZE(overo_devices));
 	omap_serial_init();
 	overo_flash_init();
-	usb_musb_init();
+	usb_musb_init(&musb_bdata);
 	overo_ads7846_init();
 	overo_init_smsc911x();
 
arch/arm/mach-omap2/board-rx51.c +6 -1
index 78869a9..839d7a8 100644
@@ -16,6 +16,7 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/gpio.h>
+#include <linux/usb/musb.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -53,6 +54,10 @@ static struct omap_board_config_kernel rx51_config[] = {
 	{ OMAP_TAG_LCD,		&rx51_lcd_config },
 };
 
+static struct musb_hdrc_board_data musb_bdata __initdata = {
+	.power = 50,
+};
+
 static void __init rx51_init_irq(void)
 {
 	omap_board_config = rx51_config;
@@ -67,7 +72,7 @@ extern void __init rx51_peripherals_init(void);
 static void __init rx51_init(void)
 {
 	omap_serial_init();
-	usb_musb_init();
+	usb_musb_init(&musb_bdata);
 	rx51_peripherals_init();
 
 	/* Ensure SDRC pins are mux'd for self-refresh */
arch/arm/mach-omap2/board-zoom2.c +7 -1
index ea00486..abe3059 100644
@@ -17,6 +17,7 @@
 #include <linux/gpio.h>
 #include <linux/i2c/twl4030.h>
 #include <linux/regulator/machine.h>
+#include <linux/usb/musb.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -265,6 +266,11 @@ static int __init omap_i2c_init(void)
 	return 0;
 }
 
+/* musb board specific details */
+static struct musb_hdrc_board_data musb_bdata __initdata = {
+	.power = 50,
+};
+
 extern int __init omap_zoom2_debugboard_init(void);
 
 static void __init omap_zoom2_init(void)
@@ -272,7 +278,7 @@ static void __init omap_zoom2_init(void)
 	omap_i2c_init();
 	omap_serial_init();
 	omap_zoom2_debugboard_init();
-	usb_musb_init();
+	usb_musb_init(&musb_bdata);
 }
 
 static void __init omap_zoom2_map_io(void)
arch/arm/mach-omap2/usb-musb.c +5 -8
index 1145a25..0e9380c 100644
@@ -124,12 +124,6 @@ static struct musb_hdrc_platform_data musb_plat = {
 	/* .clock is set dynamically */
 	.set_clock	= musb_set_clock,
 	.config		= &musb_config,
-
-	/* REVISIT charge pump on TWL4030 can supply up to
-	 * 100 mA ... but this value is board-specific, like
-	 * "mode", and should be passed to usb_musb_init().
-	 */
-	.power		= 50,			/* up to 100 mA */
 };
 
 static u64 musb_dmamask = DMA_BIT_MASK(32);
@@ -146,8 +140,11 @@ static struct platform_device musb_device = {
 	.resource	= musb_resources,
 };
 
-void __init usb_musb_init(void)
+void __init usb_musb_init(struct musb_hdrc_board_data *board_data)
 {
+	/* get board-specific data */
+	musb_plat.board_data = board_data;
+
 	if (cpu_is_omap243x())
 		musb_resources[0].start = OMAP243X_HS_BASE;
 	else
@@ -167,7 +164,7 @@ void __init usb_musb_init(void)
 }
 
 #else
-void __init usb_musb_init(void)
+void __init usb_musb_init(struct musb_hdrc_board_data *board_data)
 {
 }
 #endif /* CONFIG_USB_MUSB_SOC */
arch/arm/plat-omap/include/mach/usb.h +2 -1
index f337e17..c64bd8c 100644
@@ -3,6 +3,7 @@
 #ifndef	__ASM_ARCH_OMAP_USB_H
 #define	__ASM_ARCH_OMAP_USB_H
 
+#include <linux/usb/musb.h>
 #include <mach/board.h>
 
 /*-------------------------------------------------------------------------*/
@@ -27,7 +28,7 @@
 #define UDC_BASE			OMAP2_UDC_BASE
 #define OMAP_OHCI_BASE			OMAP2_OHCI_BASE
 
-extern void usb_musb_init(void);
+extern void usb_musb_init(struct musb_hdrc_board_data *board_data);
 
 #endif
 
Signature · 1 line
1.6.2.4
#4 lore raw

PATCH 4/8 musb: Update setup_usb() call for all Davinci boards

setup_usb() has been modified to pass board specific data so updating this function call from all Davinci based boards.

Added "struct device;" to fix below compilation warning for Davinci boards. "musb.h: struct device, defined within parameter list"

---
 arch/arm/mach-davinci/board-dm355-evm.c     |    9 ++++++++-
 arch/arm/mach-davinci/board-dm355-leopard.c |    9 ++++++++-
 arch/arm/mach-davinci/board-dm644x-evm.c    |    8 +++++++-
 arch/arm/mach-davinci/board-sffsdr.c        |    9 ++++++++-
 arch/arm/mach-davinci/include/mach/common.h |    7 +++++--
 arch/arm/mach-davinci/usb.c                 |    8 ++++----
 6 files changed, 40 insertions(+), 10 deletions(-)
arch/arm/mach-davinci/board-dm355-evm.c +8 -1
index 77e8067..31c5741 100644
@@ -24,6 +24,7 @@
 #include <media/tvp514x.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/eeprom.h>
+#include <linux/usb/musb.h>
 
 #include <asm/setup.h>
 #include <asm/mach-types.h>
@@ -317,6 +318,12 @@ static struct spi_board_info dm355_evm_spi_info[] __initconst = {
 	},
 };
 
+/* musb board specific data */
+static struct musb_hdrc_board_data musb_bdata __initdata = {
+	.power = 250,	/* (power in mA)/2 */
+	.potpgt = 4,	/* (potpgt in msec)/2 */
+};
+
 static __init void dm355_evm_init(void)
 {
 	struct clk *aemif;
@@ -344,7 +351,7 @@ static __init void dm355_evm_init(void)
 	gpio_request(2, "usb_id_toggle");
 	gpio_direction_output(2, USB_ID_VALUE);
 	/* irlml6401 switches over 1A in under 8 msec */
-	setup_usb(500, 8);
+	setup_usb(&musb_bdata);
 
 	davinci_setup_mmc(0, &dm355evm_mmc_config);
 	davinci_setup_mmc(1, &dm355evm_mmc_config);
arch/arm/mach-davinci/board-dm355-leopard.c +8 -1
index 84ad5d1..2c534f1 100644
@@ -21,6 +21,7 @@
 #include <linux/clk.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/eeprom.h>
+#include <linux/usb/musb.h>
 
 #include <asm/setup.h>
 #include <asm/mach-types.h>
@@ -243,6 +244,12 @@ static struct spi_board_info dm355_leopard_spi_info[] __initconst = {
 	},
 };
 
+/* musb board specific data */
+static struct musb_hdrc_board_data musb_bdata __initdata = {
+	.power = 250,	/* (power in mA)/2 */
+	.potpgt = 4,	/* (potpgt in msec)/2 */
+};
+
 static __init void dm355_leopard_init(void)
 {
 	struct clk *aemif;
@@ -270,7 +277,7 @@ static __init void dm355_leopard_init(void)
 	gpio_request(2, "usb_id_toggle");
 	gpio_direction_output(2, USB_ID_VALUE);
 	/* irlml6401 switches over 1A in under 8 msec */
-	setup_usb(500, 8);
+	setup_usb(&musb_bdata);
 
 	davinci_setup_mmc(0, &dm355leopard_mmc_config);
 	davinci_setup_mmc(1, &dm355leopard_mmc_config);
arch/arm/mach-davinci/board-dm644x-evm.c +7 -1
index 1213a00..307520e 100644
@@ -29,6 +29,7 @@
 #include <linux/phy.h>
 #include <linux/clk.h>
 #include <linux/videodev2.h>
+#include <linux/usb/musb.h>
 
 #include <media/tvp514x.h>
 
@@ -438,6 +439,11 @@ static struct pcf857x_platform_data pcf_data_u18 = {
 	.teardown	= evm_u18_teardown,
 };
 
+/* musb board specific data */
+static struct musb_hdrc_board_data musb_bdata __initdata = {
+	.power = 250,	/* (power in mA)/2 */
+	.potpgt = 4,	/* (potpgt in msec)/2 */
+};
 
 /* U35 - various I/O signals used to manage USB, CF, ATA, etc */
 
@@ -477,7 +483,7 @@ evm_u35_setup(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
 	/* irlml6401 switches over 1A, in under 8 msec;
 	 * now it can be managed by nDRV_VBUS ...
 	 */
-	setup_usb(500, 8);
+	setup_usb(&musb_bdata);
 
 	return 0;
 }
arch/arm/mach-davinci/board-sffsdr.c +8 -1
index 7acdfd8..e61d7d7 100644
@@ -38,6 +38,7 @@
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/physmap.h>
 #include <linux/io.h>
+#include <linux/usb/musb.h>
 
 #include <asm/setup.h>
 #include <asm/mach-types.h>
@@ -149,6 +150,12 @@ static struct davinci_uart_config uart_config __initdata = {
 	.enabled_uarts = (1 << 0),
 };
 
+/* musb board specific data */
+static struct musb_hdrc_board_data musb_bdata __initdata = {
+	.power = 0,	/* (power in mA)/2 */
+	.potpgt = 0,	/* (potpgt in msec)/2 */
+};
+
 static void __init davinci_sffsdr_map_io(void)
 {
 	dm644x_init();
@@ -164,7 +171,7 @@ static __init void davinci_sffsdr_init(void)
 	davinci_serial_init(&uart_config);
 	soc_info->emac_pdata->phy_mask = SFFSDR_PHY_MASK;
 	soc_info->emac_pdata->mdio_max_freq = SFFSDR_MDIO_FREQUENCY;
-	setup_usb(0, 0); /* We support only peripheral mode. */
+	setup_usb(&musb_bdata); /* We support only peripheral mode. */
 
 	/* mux VLYNQ pins */
 	davinci_cfg_reg(DM644X_VLYNQEN);
arch/arm/mach-davinci/include/mach/common.h +5 -2
index 1fd3917..dab784c 100644
@@ -20,11 +20,14 @@ extern void davinci_irq_init(void);
 extern void __iomem *davinci_intc_base;
 extern int davinci_intc_type;
 
+struct device;
+#include <linux/usb/musb.h>
+
 /* parameters describe VBUS sourcing for host mode */
-extern void setup_usb(unsigned mA, unsigned potpgt_msec);
+extern void setup_usb(struct musb_hdrc_board_data *board_data);
 
 /* parameters describe VBUS sourcing for host mode */
-extern void setup_usb(unsigned mA, unsigned potpgt_msec);
+extern void setup_usb(struct musb_hdrc_board_data *board_data);
 
 struct davinci_timer_instance {
 	void __iomem	*base;
arch/arm/mach-davinci/usb.c +4 -4
index 06f5593..1b164dc 100644
@@ -85,10 +85,10 @@ static struct platform_device usb_dev = {
 	.num_resources  = ARRAY_SIZE(usb_resources),
 };
 
-void __init setup_usb(unsigned mA, unsigned potpgt_msec)
+void __init setup_usb(struct musb_hdrc_board_data *board_data)
 {
-	usb_data.power = mA / 2;
-	usb_data.potpgt = potpgt_msec / 2;
+	/* get board-specific data */
+	usb_data.board_data = board_data;
 
 	if (cpu_is_davinci_dm646x()) {
 		/* Override the defaults as DM6467 uses different IRQs. */
@@ -102,7 +102,7 @@ void __init setup_usb(unsigned mA, unsigned potpgt_msec)
 
 #else
 
-void __init setup_usb(unsigned mA, unsigned potpgt_msec)
+void __init setup_usb(struct musb_hdrc_board_data *board_data)
 {
 }
 
Signature · 1 line
1.6.2.4
#5 lore raw

PATCH 5/8 musb: Add 'extvbus' in musb_hdrc_board_data

Some of the board might use external Vbus power supply on musb interface which would require to program ULPI_BUSCONTROL register.

Adding 'extvbus' flag which can be set from such boards which will be checked at musb driver files before programming ULPI_BUSCONTROL.

---
 drivers/usb/musb/musb_core.c |   12 +++++++++++-
 drivers/usb/musb/musb_regs.h |    5 +++++
 include/linux/usb/musb.h     |    3 ++-
 3 files changed, 18 insertions(+), 2 deletions(-)
drivers/usb/musb/musb_core.c +11 -1
index 818ccda..c0a6760 100644
@@ -2027,15 +2027,25 @@ bad_config:
 	/* host side needs more setup */
 	if (is_host_enabled(musb)) {
 		struct usb_hcd	*hcd = musb_to_hcd(musb);
+		u8 busctl;
 
 		otg_set_host(musb->xceiv, &hcd->self);
 
 		if (is_otg_enabled(musb))
 			hcd->self.otg_port = 1;
 		musb->xceiv->host = &hcd->self;
-		if (plat->board_data)
+		if (plat->board_data) {
 			hcd->power_budget =
 				2 * (plat->board_data->power ? : 250);
+			/* program PHY to use external vBus if required */
+			if (plat->board_data->extvbus) {
+				busctl = musb_readb(musb->mregs,
+						MUSB_ULPI_BUSCONTROL);
+				busctl |= ULPI_USE_EXTVBUS;
+				musb_writeb(musb->mregs,
+						MUSB_ULPI_BUSCONTROL, busctl);
+			}
+		}
 	}
 
 	/* For the host-only role, we can activate right away.
drivers/usb/musb/musb_regs.h +5 -0
index cc1d71b..a0314df 100644
@@ -72,6 +72,10 @@
 #define MUSB_DEVCTL_HR		0x02
 #define MUSB_DEVCTL_SESSION	0x01
 
+/* ULPI VBUSCONTROL */
+#define ULPI_USE_EXTVBUS	0x01
+#define ULPI_USE_EXTVBUSIND	0x02
+
 /* TESTMODE */
 #define MUSB_TEST_FORCE_HOST	0x80
 #define MUSB_TEST_FIFO_ACCESS	0x40
@@ -246,6 +250,7 @@
 
 /* REVISIT: vctrl/vstatus: optional vendor utmi+phy register at 0x68 */
 #define MUSB_HWVERS		0x6C	/* 8 bit */
+#define MUSB_ULPI_BUSCONTROL	0x70	/* 8 bit */
 
 #define MUSB_EPINFO		0x78	/* 8 bit */
 #define MUSB_RAMINFO		0x79	/* 8 bit */
include/linux/usb/musb.h +2 -1
index 6e1426c..45fd7d1 100644
@@ -33,7 +33,8 @@ struct musb_hdrc_board_data {
 	u8	power;
 	/* (HOST or OTG) msec/2 after VBUS on till power good */
 	u8		potpgt;
-
+	/* flag to program PHY to use external Vbus */
+	unsigned	extvbus:1;
 };
 
 struct musb_hdrc_config {
Signature · 1 line
1.6.2.4
#6 lore raw

PATCH 6/8 musb: set 'extvbus = 0' for OMAP3 boards

Default value of 'extvbus' is being set as '0' to maintain the current programming state of all OMAP3 musb boards.

This flag should be set to '1' for boards using external vbus supply such as, OMAP3EVM Rev >=E.

---
 arch/arm/mach-omap2/board-2430sdp.c      |    1 +
 arch/arm/mach-omap2/board-3430sdp.c      |    1 +
 arch/arm/mach-omap2/board-ldp.c          |    1 +
 arch/arm/mach-omap2/board-omap3beagle.c  |    1 +
 arch/arm/mach-omap2/board-omap3evm.c     |    1 +
 arch/arm/mach-omap2/board-omap3pandora.c |    1 +
 arch/arm/mach-omap2/board-overo.c        |    1 +
 arch/arm/mach-omap2/board-rx51.c         |    1 +
 8 files changed, 8 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-2430sdp.c +1 -0
index 970dcab..0a2abf1 100644
@@ -197,6 +197,7 @@ static struct twl4030_hsmmc_info mmc[] __initdata = {
 
 static struct musb_hdrc_board_data musb_bdata __initdata = {
 	.power = 50,
+	.extvbus = 0,
 };
 
 static void __init omap_2430sdp_init(void)
arch/arm/mach-omap2/board-3430sdp.c +1 -0
index 85cd24f..8dbb03a 100644
@@ -488,6 +488,7 @@ static void enable_board_wakeup_source(void)
 /* musb board specific details */
 static struct musb_hdrc_board_data musb_bdata __initdata = {
 	.power = 50,
+	.extvbus = 0,
 };
 
 static void __init omap_3430sdp_init(void)
arch/arm/mach-omap2/board-ldp.c +1 -0
index a8338a4..dfee4c5 100644
@@ -377,6 +377,7 @@ static struct platform_device *ldp_devices[] __initdata = {
 
 static struct musb_hdrc_board_data musb_bdata __initdata = {
 	.power = 50,
+	.extvbus = 0,
 };
 
 static void __init omap_ldp_init(void)
arch/arm/mach-omap2/board-omap3beagle.c +1 -0
index 113bcfe..34ec334 100644
@@ -404,6 +404,7 @@ static void __init omap3beagle_flash_init(void)
 /* musb board specific details */
 static struct musb_hdrc_board_data musb_bdata __initdata = {
 	.power = 50,
+	.extvbus = 0,
 };
 
 static void __init omap3_beagle_init(void)
arch/arm/mach-omap2/board-omap3evm.c +1 -0
index 9e2656a..0066bee 100644
@@ -301,6 +301,7 @@ static struct platform_device *omap3_evm_devices[] __initdata = {
 /* musb board specific details */
 static struct musb_hdrc_board_data musb_bdata __initdata = {
 	.power = 50,
+	.extvbus = 0,
 };
 
 static void __init omap3_evm_init(void)
arch/arm/mach-omap2/board-omap3pandora.c +1 -0
index 9bcd324..bf387b8 100644
@@ -391,6 +391,7 @@ static struct platform_device *omap3pandora_devices[] __initdata = {
 /* musb board specific details */
 static struct musb_hdrc_board_data musb_bdata __initdata = {
 	.power = 50,
+	.extvbus = 0,
 };
 
 static void __init omap3pandora_init(void)
arch/arm/mach-omap2/board-overo.c +1 -0
index e2acb91..d53c61d 100644
@@ -388,6 +388,7 @@ static struct platform_device *overo_devices[] __initdata = {
 /* musb board specific details */
 static struct musb_hdrc_board_data musb_bdata __initdata = {
 	.power = 50,
+	.extvbus = 0,
 };
 
 static void __init overo_init(void)
arch/arm/mach-omap2/board-rx51.c +1 -0
index 839d7a8..1b2ece0 100644
@@ -56,6 +56,7 @@ static struct omap_board_config_kernel rx51_config[] = {
 
 static struct musb_hdrc_board_data musb_bdata __initdata = {
 	.power = 50,
+	.extvbus = 0,
 };
 
 static void __init rx51_init_irq(void)
Signature · 1 line
1.6.2.4
#7 lore raw

PATCH 7/8 musb: set 'extvbus = 0' for Davinci boards

Default value of 'extvbus' is being set as '0' to maintain the current programming state of all Davinci musb boards.

---
 arch/arm/mach-davinci/board-dm355-evm.c     |    1 +
 arch/arm/mach-davinci/board-dm355-leopard.c |    1 +
 arch/arm/mach-davinci/board-dm644x-evm.c    |    1 +
 arch/arm/mach-davinci/board-sffsdr.c        |    1 +
 4 files changed, 4 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/board-dm355-evm.c +1 -0
index 31c5741..ed011ae 100644
@@ -322,6 +322,7 @@ static struct spi_board_info dm355_evm_spi_info[] __initconst = {
 static struct musb_hdrc_board_data musb_bdata __initdata = {
 	.power = 250,	/* (power in mA)/2 */
 	.potpgt = 4,	/* (potpgt in msec)/2 */
+	.extvbus = 0,
 };
 
 static __init void dm355_evm_init(void)
arch/arm/mach-davinci/board-dm355-leopard.c +1 -0
index 2c534f1..4ab8ab5 100644
@@ -248,6 +248,7 @@ static struct spi_board_info dm355_leopard_spi_info[] __initconst = {
 static struct musb_hdrc_board_data musb_bdata __initdata = {
 	.power = 250,	/* (power in mA)/2 */
 	.potpgt = 4,	/* (potpgt in msec)/2 */
+	.extvbus = 0,
 };
 
 static __init void dm355_leopard_init(void)
arch/arm/mach-davinci/board-dm644x-evm.c +1 -0
index 307520e..9e99882 100644
@@ -443,6 +443,7 @@ static struct pcf857x_platform_data pcf_data_u18 = {
 static struct musb_hdrc_board_data musb_bdata __initdata = {
 	.power = 250,	/* (power in mA)/2 */
 	.potpgt = 4,	/* (potpgt in msec)/2 */
+	.extvbus = 0,
 };
 
 /* U35 - various I/O signals used to manage USB, CF, ATA, etc */
arch/arm/mach-davinci/board-sffsdr.c +1 -0
index e61d7d7..c6c9b20 100644
@@ -154,6 +154,7 @@ static struct davinci_uart_config uart_config __initdata = {
 static struct musb_hdrc_board_data musb_bdata __initdata = {
 	.power = 0,	/* (power in mA)/2 */
 	.potpgt = 0,	/* (potpgt in msec)/2 */
+	.extvbus = 0,
 };
 
 static void __init davinci_sffsdr_map_io(void)
Signature · 1 line
1.6.2.4

A message that is not in the archive (sent off-list or not yet received): 1258470596-24321-8-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org

#9 lore raw

PATCH 8/8 musb: set 'extvbus = 0' for Blackfin boards

Default value of 'extvbus' is being set as '0' to maintain the current programming state of all Blackfin musb boards.

---
 arch/blackfin/mach-bf527/boards/cm_bf527.c |    6 ++++++
 arch/blackfin/mach-bf527/boards/ezbrd.c    |    6 ++++++
 arch/blackfin/mach-bf527/boards/ezkit.c    |    6 ++++++
 arch/blackfin/mach-bf548/boards/cm_bf548.c |    6 ++++++
 arch/blackfin/mach-bf548/boards/ezkit.c    |    6 ++++++
 5 files changed, 30 insertions(+), 0 deletions(-)
arch/blackfin/mach-bf527/boards/cm_bf527.c +6 -0
index f1996b1..48e1591 100644
@@ -104,6 +104,11 @@ static struct musb_hdrc_config musb_config = {
 	.gpio_vrsel	= GPIO_PF11,
 };
 
+/* musb board specific details */
+static struct musb_hdrc_board_data musb_bdata = {
+	.extvbus = 0,
+};
+
 static struct musb_hdrc_platform_data musb_plat = {
 #if defined(CONFIG_USB_MUSB_OTG)
 	.mode		= MUSB_OTG,
@@ -113,6 +118,7 @@ static struct musb_hdrc_platform_data musb_plat = {
 	.mode		= MUSB_PERIPHERAL,
 #endif
 	.config		= &musb_config,
+	.board_data	= &musb_bdata,
 };
 
 static u64 musb_dmamask = ~(u32)0;
arch/blackfin/mach-bf527/boards/ezbrd.c +6 -0
index cad23b1..bc56ea9 100644
@@ -64,6 +64,11 @@ static struct musb_hdrc_config musb_config = {
 	.gpio_vrsel	= GPIO_PG13,
 };
 
+/* musb board specific details */
+static struct musb_hdrc_board_data musb_bdata = {
+	.extvbus = 0,
+};
+
 static struct musb_hdrc_platform_data musb_plat = {
 #if defined(CONFIG_USB_MUSB_OTG)
 	.mode		= MUSB_OTG,
@@ -73,6 +78,7 @@ static struct musb_hdrc_platform_data musb_plat = {
 	.mode		= MUSB_PERIPHERAL,
 #endif
 	.config		= &musb_config,
+	.board_data	= &musb_bdata,
 };
 
 static u64 musb_dmamask = ~(u32)0;
arch/blackfin/mach-bf527/boards/ezkit.c +6 -0
index f09665f..c99e8f2 100644
@@ -102,6 +102,11 @@ static struct musb_hdrc_config musb_config = {
 	.gpio_vrsel	= GPIO_PG13,
 };
 
+/* musb board specific details */
+static struct musb_hdrc_board_data musb_bdata = {
+	.extvbus = 0,
+};
+
 static struct musb_hdrc_platform_data musb_plat = {
 #if defined(CONFIG_USB_MUSB_OTG)
 	.mode		= MUSB_OTG,
@@ -111,6 +116,7 @@ static struct musb_hdrc_platform_data musb_plat = {
 	.mode		= MUSB_PERIPHERAL,
 #endif
 	.config		= &musb_config,
+	.board_data	= &musb_bdata,
 };
 
 static u64 musb_dmamask = ~(u32)0;
arch/blackfin/mach-bf548/boards/cm_bf548.c +6 -0
index ccdcd6d..f745ab3 100644
@@ -333,6 +333,11 @@ static struct musb_hdrc_config musb_config = {
 	.gpio_vrsel	= GPIO_PH6,
 };
 
+/* musb board specific details */
+static struct musb_hdrc_board_data musb_bdata = {
+	.extvbus = 0,
+};
+
 static struct musb_hdrc_platform_data musb_plat = {
 #if defined(CONFIG_USB_MUSB_OTG)
 	.mode		= MUSB_OTG,
@@ -342,6 +347,7 @@ static struct musb_hdrc_platform_data musb_plat = {
 	.mode		= MUSB_PERIPHERAL,
 #endif
 	.config		= &musb_config,
+	.board_data	= &musb_bdata,
 };
 
 static u64 musb_dmamask = ~(u32)0;
arch/blackfin/mach-bf548/boards/ezkit.c +6 -0
index 1a5286b..00995e8 100644
@@ -435,6 +435,11 @@ static struct musb_hdrc_config musb_config = {
 	.gpio_vrsel	= GPIO_PE7,
 };
 
+/* musb board specific details */
+static struct musb_hdrc_board_data musb_bdata = {
+	.extvbus = 0,
+};
+
 static struct musb_hdrc_platform_data musb_plat = {
 #if defined(CONFIG_USB_MUSB_OTG)
 	.mode		= MUSB_OTG,
@@ -444,6 +449,7 @@ static struct musb_hdrc_platform_data musb_plat = {
 	.mode		= MUSB_PERIPHERAL,
 #endif
 	.config		= &musb_config,
+	.board_data	= &musb_bdata,
 };
 
 static u64 musb_dmamask = ~(u32)0;
Signature · 1 line
1.6.2.4

A message that is not in the archive (sent off-list or not yet received): 1258470596-24321-9-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org

#11 lore raw

Re: [PATCH 8/8] musb: set 'extvbus = 0' for Blackfin boards

Quoted 2 lines · Ajay Kumar Gupta

Default value of 'extvbus' is being set as '0' to maintain the current programming state of all Blackfin musb boards.

Again, you could keep the structures unitialized so that they default to
all zeros (which they do anyway for the 'power' and 'potpgt' fields with your patch).

Quoted 1 line

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

#13 lore raw

Re: [PATCH 6/8] musb: set 'extvbus = 0' for OMAP3 boards

In reply to Ajay Kumar Gupta
Quoted 5 lines · Ajay Kumar Gupta

Default value of 'extvbus' is being set as '0' to maintain the current programming state of all OMAP3 musb boards.

This flag should be set to '1' for boards using external vbus supply such as, OMAP3EVM Rev >=E.

This patch is rather pointless as the struct fieds not explictily
initialized will be default to 0 anyway. You should only need to explicitly init to 1.

Quoted 1 line

WBR, Sergei

#14 lore raw

Re: [PATCH 4/8] musb: Update setup_usb() call for all Davinci boards

In reply to Ajay Kumar Gupta
Quoted 5 lines · Ajay Kumar Gupta

setup_usb() has been modified to pass board specific data so updating this function call from all Davinci based boards.

Added "struct device;" to fix below compilation warning for Davinci boards. "musb.h: struct device, defined within parameter list"

You should fix the missing #include in the musb.h, not band-aid it here...

Quoted 28 lines
arch/arm/mach-davinci/board-dm355-evm.c +7 -0
index 77e8067..31c5741 100644
@@ -24,6 +24,7 @@
 #include <media/tvp514x.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/eeprom.h>
+#include <linux/usb/musb.h>
 
 #include <asm/setup.h>
 #include <asm/mach-types.h>
@@ -317,6 +318,12 @@ static struct spi_board_info dm355_evm_spi_info[] __initconst = {
 	},
 };
 
+/* musb board specific data */
+static struct musb_hdrc_board_data musb_bdata __initdata = {
+	.power = 250,	/* (power in mA)/2 */
+	.potpgt = 4,	/* (potpgt in msec)/2 */
+};
+
 static __init void dm355_evm_init(void)
 {
 	struct clk *aemif;

arch/arm/mach-davinci/board-dm355-evm.c static __init void dm355_evm_init(void) · line 354

Quoted 5 lines
arch/arm/mach-davinci/board-dm355-evm.c +1 -1
@@ -344,7 +351,7 @@ static __init void dm355_evm_init(void)
 	gpio_request(2, "usb_id_toggle");
 	gpio_direction_output(2, USB_ID_VALUE);
 	/* irlml6401 switches over 1A in under 8 msec */
-	setup_usb(500, 8);
+	setup_usb(&musb_bdata);

Unfortunately, this will conflict with a patch queued for 2.6.33 in
linux-davinci. Though in fact, it will render the part of this patch useless... :-/

arch/arm/mach-davinci/include/mach/common.h extern void davinci_irq_init(void); · line 23

Quoted 9 lines
arch/arm/mach-davinci/include/mach/common.h +1 -0
index 1fd3917..dab784c 100644
@@ -20,11 +20,14 @@ extern void davinci_irq_init(void);
 extern void __iomem *davinci_intc_base;
 extern int davinci_intc_type;
 
+struct device;

NAK. <linux/usb/musb.h> should be fixed instead.

arch/arm/mach-davinci/include/mach/common.h extern void davinci_irq_init(void); · line 30

Quoted 9 lines
arch/arm/mach-davinci/include/mach/common.h +4 -2
+#include <linux/usb/musb.h>
+
 /* parameters describe VBUS sourcing for host mode */
-extern void setup_usb(unsigned mA, unsigned potpgt_msec);
+extern void setup_usb(struct musb_hdrc_board_data *board_data);
 
 /* parameters describe VBUS sourcing for host mode */
-extern void setup_usb(unsigned mA, unsigned potpgt_msec);
+extern void setup_usb(struct musb_hdrc_board_data *board_data);

Don't you see -- these are duplicate? You could kill the second one. :-)

BTW, the mentioned linux-davinci patch moved the declaration to
<mach/usb.h> (and renamed the function too).

WBR, Sergei

A message that is not in the archive (sent off-list or not yet received): [email protected]

#16 lore raw

RE: [PATCH 4/8] musb: Update setup_usb() call for all Davinci boards

Hi,

Quoted 15 lines

-----Original Message-----
From: Sergei Shtylyov [mailto:[email protected]]
Sent: Tuesday, November 17, 2009 9:24 PM
To: Gupta, Ajay Kumar
Cc: [email protected]; davinci-linux-open-
source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org; [email protected]; [email protected]; [email protected]; Gadiyar, Anand
Subject: Re: [PATCH 4/8] musb: Update setup_usb() call for all Davinci
boards

Quoted 2 lines · Ajay Kumar Gupta

setup_usb() has been modified to pass board specific data so updating this function call from all Davinci based boards.

Quoted 6 lines
Quoted 1 line

Added "struct device;" to fix below compilation warning for Davinci

boards.

Quoted 1 line

"musb.h: struct device, defined within parameter list"

You should fix the missing #include in the musb.h, not band-aid it
here...

Ok fine, As the error was only with Davinci and not with OMAP/Blackfin So added here.

Quoted 60 lines

arch/arm/mach-

Quoted 4 lines
arch/arm/mach- renamed from arch/arm/mach-davinci/board-dm355-evm.c +0 -0

davinci/board-dm355-evm.c

arch/arm/mach-davinci/board-dm355-evm.c static struct spi_board_info dm355_evm_spi_info[]

Quoted 12 lines

index 77e8067..31c5741 100644

arch/arm/mach-davinci/board-dm355-evm.c +1 -0
@@ -24,6 +24,7 @@
 #include <media/tvp514x.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/eeprom.h>
+#include <linux/usb/musb.h>
 
 #include <asm/setup.h>
 #include <asm/mach-types.h>
@@ -317,6 +318,12 @@ static struct spi_board_info dm355_evm_spi_info[]

__initconst = {

Quoted 13 lines
arch/arm/mach-davinci/board-dm355-evm.c +6 -0
 	},
 };
 
+/* musb board specific data */
+static struct musb_hdrc_board_data musb_bdata __initdata = {
+	.power = 250,	/* (power in mA)/2 */
+	.potpgt = 4,	/* (potpgt in msec)/2 */
+};
+
 static __init void dm355_evm_init(void)
 {
 	struct clk *aemif;

arch/arm/mach-davinci/board-dm355-evm.c static __init void dm355_evm_init(void) · line 354

Quoted 5 lines
arch/arm/mach-davinci/board-dm355-evm.c +1 -1
@@ -344,7 +351,7 @@ static __init void dm355_evm_init(void)
 	gpio_request(2, "usb_id_toggle");
 	gpio_direction_output(2, USB_ID_VALUE);
 	/* irlml6401 switches over 1A in under 8 msec */
-	setup_usb(500, 8);
+	setup_usb(&musb_bdata);

Unfortunately, this will conflict with a patch queued for 2.6.33 in
linux-davinci. Though in fact, it will render the part of this patch useless... :-/

Review

Quoted 1 line
(quoted diff) +0 -0

b/arch/arm/mach-davinci/include/mach/common.h

arch/arm/mach-davinci/include/mach/common.h extern void davinci_irq_init(void); · line 23

Quoted 8 lines

index 1fd3917..dab784c 100644

arch/arm/mach-davinci/include/mach/common.h +1 -0
@@ -20,11 +20,14 @@ extern void davinci_irq_init(void);
 extern void __iomem *davinci_intc_base;
 extern int davinci_intc_type;
 
+struct device;

NAK. <linux/usb/musb.h> should be fixed instead.

Quoted 6 lines
arch/arm/mach-davinci/include/mach/common.h +3 -1
+#include <linux/usb/musb.h>
+
 /* parameters describe VBUS sourcing for host mode */
-extern void setup_usb(unsigned mA, unsigned potpgt_msec);
+extern void setup_usb(struct musb_hdrc_board_data *board_data);
 
Quoted 6 lines

arch/arm/mach-davinci/include/mach/common.h extern void davinci_irq_init(void); · line 27

Quoted 3 lines
arch/arm/mach-davinci/include/mach/common.h +1 -1
 /* parameters describe VBUS sourcing for host mode */
-extern void setup_usb(unsigned mA, unsigned potpgt_msec);
+extern void setup_usb(struct musb_hdrc_board_data *board_data);

Don't you see -- these are duplicate? You could kill the second one.
:-)

I saw, but though it could be some Davinci hack. I will remove it in next version.

-Ajay

Quoted 5 lines

BTW, the mentioned linux-davinci patch moved the declaration to
<mach/usb.h> (and renamed the function too).

WBR, Sergei

A message that is not in the archive (sent off-list or not yet received): 1258470596-24321-5-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org

#18 lore raw

Re: [PATCH 4/8] musb: Update setup_usb() call for all Davinci boards

Quoted 7 lines · Ajay Kumar Gupta

setup_usb() has been modified to pass board specific data so updating this function call from all Davinci based boards.

Added "struct device;" to fix below compilation warning for Davinci boards. "musb.h: struct device, defined within parameter list"

[...]

Quoted 13 lines
arch/arm/mach-davinci/board-sffsdr.c +1 -0
index 7acdfd8..e61d7d7 100644
@@ -38,6 +38,7 @@
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/physmap.h>
 #include <linux/io.h>
+#include <linux/usb/musb.h>
 
 #include <asm/setup.h>
 #include <asm/mach-types.h>

arch/arm/mach-davinci/board-sffsdr.c static struct davinci_uart_config uart_config __initdata = { · line 156

Quoted 7 lines
arch/arm/mach-davinci/board-sffsdr.c +4 -0
@@ -149,6 +150,12 @@ static struct davinci_uart_config uart_config __initdata = {
 	.enabled_uarts = (1 << 0),
 };
 
+/* musb board specific data */
+static struct musb_hdrc_board_data musb_bdata __initdata = {
+	.power = 0,	/* (power in mA)/2 */
+	.potpgt = 0,	/* (potpgt in msec)/2 */

You can leave the structure unixitialized here, it will default to all
zeros anyway.

arch/arm/mach-davinci/board-sffsdr.c static struct davinci_uart_config uart_config __initdata = { · line 161

Quoted 5 lines
arch/arm/mach-davinci/board-sffsdr.c +2 -0
+};
+
 static void __init davinci_sffsdr_map_io(void)
 {
 	dm644x_init();

WBR, Sergei

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

#19 lore raw

Re: [PATCH 4/8] musb: Update setup_usb() call for all Davinci boards

In reply to Ajay Kumar Gupta
Quoted 7 lines · Ajay Kumar Gupta

setup_usb() has been modified to pass board specific data so updating this function call from all Davinci based boards.

Added "struct device;" to fix below compilation warning for Davinci boards. "musb.h: struct device, defined within parameter list"

[...]

arch/arm/mach-davinci/usb.c static struct platform_device usb_dev = { · line 91

Quoted 13 lines
arch/arm/mach-davinci/usb.c +1 -3
index 06f5593..1b164dc 100644
@@ -85,10 +85,10 @@ static struct platform_device usb_dev = {
 	.num_resources  = ARRAY_SIZE(usb_resources),
 };
 
-void __init setup_usb(unsigned mA, unsigned potpgt_msec)
+void __init setup_usb(struct musb_hdrc_board_data *board_data)
 {
-	usb_data.power = mA / 2;
-	usb_data.potpgt = potpgt_msec / 2;

Hm, again, you can't separate this patch from patch 1/8 to keep the code
compiling between the patches. It looks like you have no choice but lump most of your patches together (and get rid of some others :-). Either that or better separate your change to the struct musb_hdrc_platfrpom_data and your change to setup_usb() prototype.

WBR, Sergei

A message that is not in the archive (sent off-list or not yet received): 1258470596-24321-4-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org

#21 lore raw

Re: [PATCH 3/8] musb: Update musb_init() call for all OMAP3 boards

Quoted 4 lines · Ajay Kumar Gupta

musb_init() has been modified to pass board specific data so updating this function call from all OMAP3 boards.

[...]

Quoted 5 lines
arch/arm/mach-omap2/usb-musb.c +0 -0
index 1145a25..0e9380c 100644

arch/arm/mach-omap2/usb-musb.c static struct musb_hdrc_platform_data musb_plat = { · line 132

Quoted 9 lines
arch/arm/mach-omap2/usb-musb.c +0 -6
@@ -124,12 +124,6 @@ static struct musb_hdrc_platform_data musb_plat = {
 	/* .clock is set dynamically */
 	.set_clock	= musb_set_clock,
 	.config		= &musb_config,
-
-	/* REVISIT charge pump on TWL4030 can supply up to
-	 * 100 mA ... but this value is board-specific, like
-	 * "mode", and should be passed to usb_musb_init().
-	 */
-	.power		= 50,			/* up to 100 mA */

That should obviously be a part of patch 1/8...

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

A message that is not in the archive (sent off-list or not yet received): [email protected]

#23 lore raw

RE: [PATCH 3/8] musb: Update musb_init() call for all OMAP3 boards

Hi,

Quoted 22 lines

-----Original Message-----
From: [email protected] [mailto:linux-omap-
[email protected]] On Behalf Of Sergei Shtylyov
Sent: Tuesday, November 17, 2009 10:01 PM
To: Gupta, Ajay Kumar
Cc: [email protected]; davinci-linux-open-
source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org; [email protected]; [email protected]; [email protected]; Gadiyar, Anand
Subject: Re: [PATCH 3/8] musb: Update musb_init() call for all OMAP3
boards

Quoted 4 lines · Ajay Kumar Gupta

musb_init() has been modified to pass board specific data so updating this function call from all OMAP3 boards.

[...]

arch/arm/mach-omap2/usb-

Quoted 1 line
arch/arm/mach-omap2/usb- renamed from arch/arm/mach-omap2/usb-musb.c +0 -0

musb.c

Quoted 15 lines

arch/arm/mach-omap2/usb-musb.c static struct musb_hdrc_platform_data musb_plat = { · line 132

Quoted 13 lines

index 1145a25..0e9380c 100644

arch/arm/mach-omap2/usb-musb.c +0 -6
@@ -124,12 +124,6 @@ static struct musb_hdrc_platform_data musb_plat = {
 	/* .clock is set dynamically */
 	.set_clock	= musb_set_clock,
 	.config		= &musb_config,
-
-	/* REVISIT charge pump on TWL4030 can supply up to
-	 * 100 mA ... but this value is board-specific, like
-	 * "mode", and should be passed to usb_musb_init().
-	 */
-	.power		= 50,			/* up to 100 mA */

That should obviously be a part of patch 1/8...

It was actually a part of 1/8 earlier but as this is OMAP specific and [1/8] is generic so moved it to OMAP specific patch here.

-Ajay

Quoted 6 lines

WBR, Sergei
--
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

A message that is not in the archive (sent off-list or not yet received): 1258470596-24321-3-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org

#25 lore raw

Re: [PATCH 2/8] musb: Get power (mA) from board data

Hello.

Quoted 4 lines · Ajay Kumar Gupta

Different board may have different power sourcing capability and now with 'struct musb_hdrc_board_data' in place; pass this data from board files and also modify musb_core.c to get 'power' data from 'plat->board_data'.

This should be part of the patch 1/8 to keep the code compiling.

Quoted 7 lines
drivers/usb/musb/musb_core.c +0 -0
index 3a61ddb..818ccda 100644

drivers/usb/musb/musb_core.c bad_config: · line 2038

Quoted 7 lines
drivers/usb/musb/musb_core.c +3 -1
@@ -2033,7 +2033,9 @@ bad_config:
 		if (is_otg_enabled(musb))
 			hcd->self.otg_port = 1;
 		musb->xceiv->host = &hcd->self;
-		hcd->power_budget = 2 * (plat->power ? : 250);
+		if (plat->board_data)
+			hcd->power_budget =
+				2 * (plat->board_data->power ? : 250);

Shouldn't it be:

+
+ hcd->power_budget = 2 * (plat->board_data &&
+ plat->board_data->power ?
+ plat->board_data->power : 250);

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

A message that is not in the archive (sent off-list or not yet received): [email protected]

#27 lore raw

RE: [PATCH 2/8] musb: Get power (mA) from board data

Hi,

Quoted 37 lines

-----Original Message-----
From: Sergei Shtylyov [mailto:[email protected]]
Sent: Tuesday, November 17, 2009 9:12 PM
To: Gupta, Ajay Kumar
Cc: [email protected]; davinci-linux-open-
source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org; [email protected]; [email protected]; [email protected]; Gadiyar, Anand
Subject: Re: [PATCH 2/8] musb: Get power (mA) from board data

Hello.

Quoted 4 lines · Ajay Kumar Gupta

Different board may have different power sourcing capability and now with 'struct musb_hdrc_board_data' in place; pass this data from board files and also modify musb_core.c to get 'power' data from 'plat->board_data'.

This should be part of the patch 1/8 to keep the code compiling.

Quoted 7 lines
drivers/usb/musb/musb_core.c +0 -0
index 3a61ddb..818ccda 100644

drivers/usb/musb/musb_core.c bad_config: · line 2038

Quoted 7 lines
drivers/usb/musb/musb_core.c +3 -1
@@ -2033,7 +2033,9 @@ bad_config:
 		if (is_otg_enabled(musb))
 			hcd->self.otg_port = 1;
 		musb->xceiv->host = &hcd->self;
-		hcd->power_budget = 2 * (plat->power ? : 250);
+		if (plat->board_data)
+			hcd->power_budget =
+				2 * (plat->board_data->power ? : 250);

Shouldn't it be:

Review

Quoted 4 lines
(quoted diff) +4 -0
+
+		hcd->power_budget = 2 * (plat->board_data &&
+				         plat->board_data->power ?
+					 plat->board_data->power : 250);

But the next patch on 'extvbus' would again need a check for ' plat->board_data ' so added both in same 'if' check.

-Ajay

Quoted 2 lines

WBR, Sergei

A message that is not in the archive (sent off-list or not yet received): 1258470596-24321-2-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org

#29 lore raw

Re: [PATCH 1/8] musb: Add structure to get board specific data

Hello.

Quoted 18 lines · Ajay Kumar Gupta

Adding 'musb_hdrc_board_data' which will have all the board specific parameters such as; mA power, potpgt, extvbus, gpios etc.

Currently only 'power' and 'potpgt' is being moved from existing 'musb_hdrc_platform_data' to 'musb_hdrc_board_data' but any further board specific functions or parameter can be added to this structure later.

---
 include/linux/usb/musb.h |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)
include/linux/usb/musb.h +0 -0
index d437556..6e1426c 100644

include/linux/usb/musb.h struct musb_hdrc_eps_bits { · line 35

Quoted 9 lines
include/linux/usb/musb.h +6 -0
@@ -27,6 +27,15 @@ struct musb_hdrc_eps_bits {
 	u8		bits;
 };
 
+/* MUSB board-specific details */
+struct musb_hdrc_board_data {
+	/* power (mA/2) sourcing capability */
+	u8	power;
+	/* (HOST or OTG) msec/2 after VBUS on till power good */
+	u8		potpgt;

Uneven indentation, either too many or too little tabs here.

WBR, Sergei

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

#30 lore raw

Re: [PATCH 1/8] musb: Add structure to get board specific data

In reply to Ajay Kumar Gupta
Quoted 9 lines · Ajay Kumar Gupta

Adding 'musb_hdrc_board_data' which will have all the board specific parameters such as; mA power, potpgt, extvbus, gpios etc.

Currently only 'power' and 'potpgt' is being moved from existing 'musb_hdrc_platform_data' to 'musb_hdrc_board_data' but any further board specific functions or parameter can be added to this structure later.

[...]

Quoted 4 lines
include/linux/usb/musb.h +0 -0
index d437556..6e1426c 100644

[...]

include/linux/usb/musb.h struct musb_hdrc_platform_data { · line 72

Quoted 7 lines
include/linux/usb/musb.h +0 -3
@@ -67,15 +76,9 @@ struct musb_hdrc_platform_data {
 	/* (HOST or OTG) switch VBUS on/off */
 	int		(*set_vbus)(struct device *dev, int is_on);
 
-	/* (HOST or OTG) mA/2 power supplied on (default = 8mA) */
-	u8		power;
-

Oh, this will break compilation of the existing code! This patch
shouldn't be separated from patch 2/8.

WBR, Sergei

A message that is not in the archive (sent off-list or not yet received): 1258470596-24321-1-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org

#32 lore raw

Hello.

Quoted 5 lines · Ajay Kumar Gupta

This patch set adds a new structure 'musb_hdrc_board_data' to get all board specific data from board files.

It is actually done to accomodate ULPI_VBUSCONTROL programming required for OMAP3EVM Rev >=E which uses external Vbus supply to support 500mA.

It's not clear why it was necessary to create yet another structure. You
could your new field to 'struct musb_hdrc_platfrom_data'...

Quoted 2 lines

Regards,
Ajay

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

A message that is not in the archive (sent off-list or not yet received): [email protected]

#34 lore raw

Hi,

Quoted 18 lines

-----Original Message-----
From: Sergei Shtylyov [mailto:[email protected]]
Sent: Wednesday, November 18, 2009 7:50 PM
To: Gupta, Ajay Kumar
Cc: [email protected]; davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org; [email protected]; [email protected]; [email protected]; Gadiyar, Anand
Subject: Re: [PATCH 0/8] musb: Add structure 'musb_hdrc_board_data'

Hello.

Quoted 1 line · Ajay Kumar Gupta

This patch set adds a new structure 'musb_hdrc_board_data'

to get all

Quoted 1 line

board specific data from board files.

Quoted 7 lines
Quoted 2 lines

It is actually done to accomodate ULPI_VBUSCONTROL programming required for OMAP3EVM Rev >=E which uses external Vbus

supply to support 500mA.

It's not clear why it was necessary to create yet another
structure. You could your new field to 'struct musb_hdrc_platfrom_data'...

This a actually a simpler approach and would avoid changing Davinci/BLackFin Specific files.

Felipe/Anand,
Is it ok to add 'extvbus' in 'musb_hdrc_platform_data' and pass this data from all OMAP board files.

Anyways we do have 'musb_config' which has all platform sepecific information.

-Ajay

Quoted 7 lines
Quoted 3 lines

Regards,
Ajay

WBR, Sergei