OMAP USB Host cleanup
Subsystems (8)
v9 cover OMAP USB Host cleanup
Hi Samuel,
I think this series is in a pretty good shape to pull now :). I've added Reviewed-by and Acked-by tags. You can please pull from below.
NOTE: the first patch is a stable fix so Greg KH might want to pick it up for 3.8-rc.
The following changes since commit 7d1f9aeff1ee4a20b1aeb377dd0f579fe9647619:
Linux 3.8-rc4 (2013-01-17 19:25:45 -0800)
are available in the git repository at:
git://github.com/rogerq/linux.git linux-usbhost14-part
This patchset addresses the following
- Consolidate USB Host platform data.
- Avoid addressing clocks one by one by name and use a for loop + bunch of cleanups.
- Get number of channels/ports dynamically either from revision register or from platform data. Avoids getting clocks that are not present.
- Add OMAP5 and HSIC mode (Not tested).
v9:
- Addressed clock framework related comments from Russell King.
- Removed 2 clock data patches from the series as they will be taken care of by Paul Walmsey.
v8:
- Re-arranged patch "USB-ehci-omap-Don-t-free-gpios-that-we-didn-t-reques.patch" to be the first since it is a candidate for stable.
- Fixed issues raised by Felipe, i.e. indentation and use of switch ()
v7:
- Updated patch 4 to not hold a spinlock when using clk_get().
- Updated patches 3 and 11 to return -EADDRNOTAVAIL on failure of demv_request_and_ioremap().
v6:
- Added USB Host platform data consolidation patch as the first patch. based on request from Tony.
- Rebased on v3.8-rc3.
v5:
- Rebased on top of todays arm-soc/for-next.
- Removed the clock merging patch from the list.
- Updated patches 14, 19 and 20 to accomodate the above change.
- Added patch 22 to fix a build warning.
v4:
- Added appropriate maintainers in to/cc.
- minor print message fix in patch 23 to maintain consistency.
v3:
- Rebased on arm-soc/for-next commit f979306c4d38d213c6977aaf3b1115e8ded71e3a.
- Rearranged patch that get rids of cpu_is_omap..() macros.
- Coding style fixes.
v2:
- Clocks are allocated dynamically based on number of ports available on the platform.
- Reduced console spam if non critical clocks are not found on the platform.
- Get rid of cpu_is_.. macros from USB host driver.
cheers,
-roger
---
Roger Quadros (20):
USB: ehci-omap: Don't free gpios that we didn't request
mfd: omap-usb-host: Consolidate OMAP USB-HS platform data
mfd: omap-usb-tll: Fix channel count detection
mfd: omap-usb-tll: Use devm_kzalloc/ioremap and clean up error path
mfd: omap-usb-tll: Clean up clock handling
mfd: omap-usb-tll: introduce and use mode_needs_tll()
mfd: omap-usb-tll: Check for missing platform data in probe
mfd: omap-usb-tll: Fix error message
mfd: omap-usb-tll: serialize access to TLL device
mfd: omap-usb-tll: Add OMAP5 revision and HSIC support
mfd: omap_usb_host: Avoid missing platform data checks in suspend/resume
mfd: omap-usb-host: Use devm_kzalloc() and devm_request_and_ioremap()
mfd: omap-usb-host: know about number of ports from revision register
mfd: omap-usb-host: override number of ports from platform data
mfd: omap-usb-host: cleanup clock management code
mfd: omap-usb-host: Manage HSIC clocks for HSIC mode
mfd: omap-usb-host: Get rid of unnecessary spinlock
mfd: omap-usb-host: clean up omap_usbhs_init()
mfd: omap-usb-host: Don't spam console on clk_set_parent failure
mdf: omap-usb-host: get rid of build warning
arch/arm/mach-omap2/board-3430sdp.c | 2 +- arch/arm/mach-omap2/board-3630sdp.c | 2 +- arch/arm/mach-omap2/board-am3517crane.c | 2 +- arch/arm/mach-omap2/board-am3517evm.c | 2 +- arch/arm/mach-omap2/board-cm-t35.c | 2 +- arch/arm/mach-omap2/board-cm-t3517.c | 2 +- arch/arm/mach-omap2/board-devkit8000.c | 2 +- arch/arm/mach-omap2/board-igep0020.c | 4 +- arch/arm/mach-omap2/board-omap3beagle.c | 2 +- arch/arm/mach-omap2/board-omap3evm.c | 2 +- arch/arm/mach-omap2/board-omap3pandora.c | 2 +- arch/arm/mach-omap2/board-omap3stalker.c | 2 +- arch/arm/mach-omap2/board-omap3touchbook.c | 2 +- arch/arm/mach-omap2/board-omap4panda.c | 2 +- arch/arm/mach-omap2/board-overo.c | 2 +- arch/arm/mach-omap2/board-zoom.c | 2 +- arch/arm/mach-omap2/usb-host.c | 29 +-- arch/arm/mach-omap2/usb.h | 20 +- drivers/mfd/omap-usb-host.c | 558 +++++++++++++++++----------- drivers/mfd/omap-usb-tll.c | 243 +++++++------ drivers/usb/host/ehci-omap.c | 14 +- include/linux/platform_data/usb-omap.h | 24 +- 22 files changed, 497 insertions(+), 425 deletions(-)
Signature · 1 line
1.7.4.1
PATCH v9 1/20 USB: ehci-omap: Don't free gpios that we didn't request
This driver does not request any gpios so don't free them. Fixes L3 bus error on multiple modprobe/rmmod of ehci_hcd with ehci-omap in use.
Without this patch, EHCI will break on repeated insmod/rmmod of ehci_hcd for all OMAP2+ platforms that use EHCI and set 'phy_reset = true' in usbhs_omap_board_data. i.e.
board-3430sdp.c: .phy_reset = true,board-3630sdp.c: .phy_reset = true,board-am3517crane.c: .phy_reset = true,board-am3517evm.c: .phy_reset = true,board-cm-t3517.c: .phy_reset = true,board-cm-t35.c: .phy_reset = true,board-devkit8000.c: .phy_reset = true,board-igep0020.c: .phy_reset = true,board-igep0020.c: .phy_reset = true,board-omap3beagle.c: .phy_reset = true,board-omap3evm.c: .phy_reset = true,board-omap3pandora.c: .phy_reset = true,board-omap3stalker.c: .phy_reset = true,board-omap3touchbook.c: .phy_reset = true,board-omap4panda.c: .phy_reset = false,board-overo.c: .phy_reset = true,board-zoom.c: .phy_reset = true,
--- drivers/usb/host/ehci-omap.c | 8 -------- 1 files changed, 0 insertions(+), 8 deletions(-)
drivers/usb/host/ehci-omap.c +0 -8
@@ -288,7 +288,6 @@ static int ehci_hcd_omap_remove(struct platform_device *pdev) {struct device *dev = &pdev->dev;struct usb_hcd *hcd =dev_get_drvdata (dev); -struct ehci_hcd_omap_platform_data *pdata = dev->platform_data;usb_remove_hcd (hcd);disable_put_regulator (dev->platform_data);
@@ -298,13 +297,6 @@ static int ehci_hcd_omap_remove(struct platform_device *pdev)pm_runtime_put_sync (dev);pm_runtime_disable (dev); -if (pdata->phy_reset) { -if (gpio_is_valid (pdata->reset_gpio_port[0 ])) -gpio_free (pdata->reset_gpio_port[0 ]); - -if (gpio_is_valid (pdata->reset_gpio_port[1 ])) -gpio_free (pdata->reset_gpio_port[1 ]); - }return 0 ; }
Signature · 1 line
1.7.4.1
PATCH v9 2/20 mfd: omap-usb-host: Consolidate OMAP USB-HS platform data
In reply to Roger QuadrosLet's have a single platform data structure for the OMAP's High-Speed USB host subsystem instead of having 3 separate ones i.e. one for board data, one for USB Host (UHH) module and one for USB-TLL module.
This makes the code much simpler and avoids creating multiple copies of platform data.
For the ehci-omap.c part:
--- arch/arm/mach-omap2/board-3430sdp.c | 2 +- arch/arm/mach-omap2/board-3630sdp.c | 2 +- arch/arm/mach-omap2/board-am3517crane.c | 2 +- arch/arm/mach-omap2/board-am3517evm.c | 2 +- arch/arm/mach-omap2/board-cm-t35.c | 2 +- arch/arm/mach-omap2/board-cm-t3517.c | 2 +- arch/arm/mach-omap2/board-devkit8000.c | 2 +- arch/arm/mach-omap2/board-igep0020.c | 4 +- arch/arm/mach-omap2/board-omap3beagle.c | 2 +- arch/arm/mach-omap2/board-omap3evm.c | 2 +- arch/arm/mach-omap2/board-omap3pandora.c | 2 +- arch/arm/mach-omap2/board-omap3stalker.c | 2 +- arch/arm/mach-omap2/board-omap3touchbook.c | 2 +- arch/arm/mach-omap2/board-omap4panda.c | 2 +- arch/arm/mach-omap2/board-overo.c | 2 +- arch/arm/mach-omap2/board-zoom.c | 2 +- arch/arm/mach-omap2/usb-host.c | 29 ++----------- arch/arm/mach-omap2/usb.h | 20 +-------- drivers/mfd/omap-usb-host.c | 63 +++++++++++---------------- drivers/mfd/omap-usb-tll.c | 11 ++--- drivers/usb/host/ehci-omap.c | 6 +- include/linux/platform_data/usb-omap.h | 23 ++-------- 22 files changed, 61 insertions(+), 125 deletions(-)
arch/arm/mach-omap2/board-3430sdp.c +1 -1
@@ -424,7 +424,7 @@ static void enable_board_wakeup_source(void) OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP); } -static const struct usbhs_omap_board_data usbhs_bdata__initconst = { +static struct usbhs_omap_platform_data usbhs_bdata__initdata = { .port_mode[0 ] =OMAP_EHCI_PORT_MODE_PHY , .port_mode[1 ] =OMAP_EHCI_PORT_MODE_PHY ,
arch/arm/mach-omap2/board-3630sdp.c +1 -1
@@ -53,7 +53,7 @@ static void enable_board_wakeup_source(void) OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP); } -static const struct usbhs_omap_board_data usbhs_bdata__initconst = { +static struct usbhs_omap_platform_data usbhs_bdata__initdata = { .port_mode[0 ] =OMAP_EHCI_PORT_MODE_PHY , .port_mode[1 ] =OMAP_EHCI_PORT_MODE_PHY ,
arch/arm/mach-omap2/board-am3517crane.c +1 -1
@@ -40,7 +40,7 @@ static struct omap_board_mux board_mux[] __initdata = { };#endif -static struct usbhs_omap_board_data usbhs_bdata__initdata = { +static struct usbhs_omap_platform_data usbhs_bdata__initdata = { .port_mode[0 ] =OMAP_EHCI_PORT_MODE_PHY , .port_mode[1 ] =OMAP_USBHS_PORT_MODE_UNUSED , .port_mode[2 ] =OMAP_USBHS_PORT_MODE_UNUSED ,
arch/arm/mach-omap2/board-am3517evm.c +1 -1
@@ -274,7 +274,7 @@ static __init void am3517_evm_mcbsp1_init(void)omap_ctrl_writel (devconf0,OMAP2_CONTROL_DEVCONF0 ); } -static const struct usbhs_omap_board_data usbhs_bdata__initconst = { +static struct usbhs_omap_platform_data usbhs_bdata__initdata = { .port_mode[0 ] =OMAP_EHCI_PORT_MODE_PHY , #if defined(CONFIG_PANEL_SHARP_LQ043T1DG01) || \ defined(CONFIG_PANEL_SHARP_LQ043T1DG01_MODULE)
arch/arm/mach-omap2/board-cm-t35.c +1 -1
@@ -418,7 +418,7 @@ static struct omap2_hsmmc_info mmc[] = { {}/* Terminator */ }; -static struct usbhs_omap_board_data usbhs_bdata__initdata = { +static struct usbhs_omap_platform_data usbhs_bdata__initdata = { .port_mode[0 ] =OMAP_EHCI_PORT_MODE_PHY , .port_mode[1 ] =OMAP_EHCI_PORT_MODE_PHY , .port_mode[2 ] =OMAP_USBHS_PORT_MODE_UNUSED ,
arch/arm/mach-omap2/board-cm-t3517.c +1 -1
@@ -166,7 +166,7 @@ static inline void cm_t3517_init_rtc(void) {}#define HSUSB2_RESET_GPIO (147)#define USB_HUB_RESET_GPIO (152) -static struct usbhs_omap_board_data cm_t3517_ehci_pdata__initdata = { +static struct usbhs_omap_platform_data cm_t3517_ehci_pdata__initdata = { .port_mode[0 ] =OMAP_EHCI_PORT_MODE_PHY , .port_mode[1 ] =OMAP_EHCI_PORT_MODE_PHY , .port_mode[2 ] =OMAP_USBHS_PORT_MODE_UNUSED ,
arch/arm/mach-omap2/board-devkit8000.c +1 -1
@@ -435,7 +435,7 @@ static struct platform_device *devkit8000_devices[] __initdata = { &omap_dm9000_dev, }; -static const struct usbhs_omap_board_data usbhs_bdata__initconst = { +static struct usbhs_omap_platform_data usbhs_bdata__initdata = { .port_mode[0 ] =OMAP_EHCI_PORT_MODE_PHY , .port_mode[1 ] =OMAP_USBHS_PORT_MODE_UNUSED ,
arch/arm/mach-omap2/board-igep0020.c +2 -2
@@ -526,7 +526,7 @@ static void __init igep_i2c_init(void)omap3_pmic_init ("twl4030" , &igep_twldata); } -static const struct usbhs_omap_board_data igep2_usbhs_bdata__initconst = { +static struct usbhs_omap_platform_data igep2_usbhs_bdata__initdata = { .port_mode[0 ] =OMAP_EHCI_PORT_MODE_PHY , .port_mode[1 ] =OMAP_USBHS_PORT_MODE_UNUSED , .port_mode[2 ] =OMAP_USBHS_PORT_MODE_UNUSED ,
@@ -537,7 +537,7 @@ static const struct usbhs_omap_board_data igep2_usbhs_bdata __initconst = { .reset_gpio_port[2] = -EINVAL, }; -static const struct usbhs_omap_board_data igep3_usbhs_bdata__initconst = { +static struct usbhs_omap_platform_data igep3_usbhs_bdata__initdata = { .port_mode[0 ] =OMAP_USBHS_PORT_MODE_UNUSED , .port_mode[1 ] =OMAP_EHCI_PORT_MODE_PHY , .port_mode[2 ] =OMAP_USBHS_PORT_MODE_UNUSED ,
arch/arm/mach-omap2/board-omap3beagle.c +1 -1
@@ -430,7 +430,7 @@ static struct platform_device *omap3_beagle_devices[] __initdata = { &madc_hwmon, }; -static const struct usbhs_omap_board_data usbhs_bdata__initconst = { +static struct usbhs_omap_platform_data usbhs_bdata__initdata = { .port_mode[0 ] =OMAP_USBHS_PORT_MODE_UNUSED , .port_mode[1 ] =OMAP_EHCI_PORT_MODE_PHY ,
arch/arm/mach-omap2/board-omap3evm.c +1 -1
@@ -538,7 +538,7 @@ static int __init omap3_evm_i2c_init(void)return 0 ; } -static struct usbhs_omap_board_data usbhs_bdata__initdata = { +static struct usbhs_omap_platform_data usbhs_bdata__initdata = { .port_mode[0 ] =OMAP_USBHS_PORT_MODE_UNUSED , .port_mode[1 ] =OMAP_EHCI_PORT_MODE_PHY ,
arch/arm/mach-omap2/board-omap3pandora.c +1 -1
@@ -567,7 +567,7 @@ static struct platform_device *omap3pandora_devices[] __initdata = { &pandora_backlight, }; -static const struct usbhs_omap_board_data usbhs_bdata__initconst = { +static struct usbhs_omap_platform_data usbhs_bdata__initdata = { .port_mode[0 ] =OMAP_USBHS_PORT_MODE_UNUSED , .port_mode[1 ] =OMAP_EHCI_PORT_MODE_PHY ,
arch/arm/mach-omap2/board-omap3stalker.c +1 -1
@@ -361,7 +361,7 @@ static struct platform_device *omap3_stalker_devices[] __initdata = { &keys_gpio, }; -static struct usbhs_omap_board_data usbhs_bdata__initconst = { +static struct usbhs_omap_platform_data usbhs_bdata__initdata = { .port_mode[0 ] =OMAP_USBHS_PORT_MODE_UNUSED , .port_mode[1 ] =OMAP_EHCI_PORT_MODE_PHY , .port_mode[2 ] =OMAP_USBHS_PORT_MODE_UNUSED ,
arch/arm/mach-omap2/board-omap3touchbook.c +1 -1
@@ -309,7 +309,7 @@ static struct platform_device *omap3_touchbook_devices[] __initdata = { &keys_gpio, }; -static const struct usbhs_omap_board_data usbhs_bdata__initconst = { +static struct usbhs_omap_platform_data usbhs_bdata__initdata = { .port_mode[0 ] =OMAP_EHCI_PORT_MODE_PHY , .port_mode[1 ] =OMAP_EHCI_PORT_MODE_PHY ,
arch/arm/mach-omap2/board-omap4panda.c +1 -1
@@ -139,7 +139,7 @@ static struct platform_device *panda_devices[] __initdata = { &btwilink_device, }; -static const struct usbhs_omap_board_data usbhs_bdata__initconst = { +static struct usbhs_omap_platform_data usbhs_bdata__initdata = { .port_mode[0 ] =OMAP_EHCI_PORT_MODE_PHY , .port_mode[1 ] =OMAP_USBHS_PORT_MODE_UNUSED , .port_mode[2 ] =OMAP_USBHS_PORT_MODE_UNUSED ,
arch/arm/mach-omap2/board-overo.c +1 -1
@@ -457,7 +457,7 @@ static int __init overo_spi_init(void)return 0 ; } -static const struct usbhs_omap_board_data usbhs_bdata__initconst = { +static struct usbhs_omap_platform_data usbhs_bdata__initdata = { .port_mode[0 ] =OMAP_USBHS_PORT_MODE_UNUSED , .port_mode[1 ] =OMAP_EHCI_PORT_MODE_PHY , .port_mode[2 ] =OMAP_USBHS_PORT_MODE_UNUSED ,
arch/arm/mach-omap2/board-zoom.c +1 -1
@@ -92,7 +92,7 @@ static struct mtd_partition zoom_nand_partitions[] = { }, }; -static const struct usbhs_omap_board_data usbhs_bdata__initconst = { +static struct usbhs_omap_platform_data usbhs_bdata__initdata = { .port_mode[0 ] =OMAP_USBHS_PORT_MODE_UNUSED , .port_mode[1 ] =OMAP_EHCI_PORT_MODE_PHY , .port_mode[2 ] =OMAP_USBHS_PORT_MODE_UNUSED ,
arch/arm/mach-omap2/usb-host.c +5 -24
@@ -37,11 +37,6 @@#define USBHS_UHH_HWMODNAME "usb_host_hs"#define USBHS_TLL_HWMODNAME "usb_tll_hs" -static struct usbhs_omap_platform_data usbhs_data; -static struct usbtll_omap_platform_data usbtll_data; -static struct ehci_hcd_omap_platform_data ehci_data; -static struct ohci_hcd_omap_platform_data ohci_data; -static struct omap_device_pm_latency omap_uhhtll_latency[] = { { .deactivate_func = omap_device_idle_hwmods,
@@ -485,32 +480,18 @@ void __init setup_4430ohci_io_mux(const enum usbhs_omap_port_mode *port_mode) } } -void __init usbhs_init (const struct usbhs_omap_board_data *pdata) +void __init usbhs_init (struct usbhs_omap_platform_data *pdata) {struct omap_hwmod *uhh_hwm, *tll_hwm;struct platform_device *pdev;int bus_id =-1 ; -int i; - -for (i =0 ; i <OMAP3_HS_USB_PORTS ; i++) { - usbhs_data.port_mode[i] = pdata->port_mode[i]; - usbtll_data.port_mode[i] = pdata->port_mode[i]; - ohci_data.port_mode[i] = pdata->port_mode[i]; - ehci_data.port_mode[i] = pdata->port_mode[i]; - ehci_data.reset_gpio_port[i] = pdata->reset_gpio_port[i]; - ehci_data.regulator[i] = pdata->regulator[i]; - } - ehci_data.phy_reset = pdata->phy_reset; - ohci_data.es2_compatibility = pdata->es2_compatibility; - usbhs_data.ehci_data = &ehci_data; - usbhs_data.ohci_data = &ohci_data;if (cpu_is_omap34xx ()) {setup_ehci_io_mux (pdata->port_mode);setup_ohci_io_mux (pdata->port_mode);if (omap_rev () <=OMAP3430_REV_ES2_1 ) - usbhs_data.single_ulpi_bypass = true; + pdata->single_ulpi_bypass = true; }else if (cpu_is_omap44xx ()) {setup_4430ehci_io_mux (pdata->port_mode);
@@ -530,7 +511,7 @@ void __init usbhs_init(const struct usbhs_omap_board_data *pdata) } pdev =omap_device_build (OMAP_USBTLL_DEVICE , bus_id, tll_hwm, - &usbtll_data,sizeof (usbtll_data), + pdata,sizeof (*pdata), omap_uhhtll_latency,ARRAY_SIZE (omap_uhhtll_latency), false);if (IS_ERR (pdev)) {
@@ -540,7 +521,7 @@ void __init usbhs_init(const struct usbhs_omap_board_data *pdata) } pdev =omap_device_build (OMAP_USBHS_DEVICE , bus_id, uhh_hwm, - &usbhs_data,sizeof (usbhs_data), + pdata,sizeof (*pdata), omap_uhhtll_latency,ARRAY_SIZE (omap_uhhtll_latency), false);if (IS_ERR (pdev)) {
@@ -552,7 +533,7 @@ void __init usbhs_init(const struct usbhs_omap_board_data *pdata)#else -void __init usbhs_init (const struct usbhs_omap_board_data *pdata) +void __init usbhs_init (struct usbhs_omap_platform_data *pdata) { }
arch/arm/mach-omap2/usb.h +1 -19
@@ -53,26 +53,8 @@#define USBPHY_OTGSESSEND_EN (1 << 20)#define USBPHY_DATA_POLARITY (1 << 23) -struct usbhs_omap_board_data { -enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS ]; - -/* have to be valid if phy_reset is true and portx is in phy mode */ -int reset_gpio_port[OMAP3_HS_USB_PORTS ]; - -/* Set this to true for ES2.x silicon */ -unsigned es2_compatibility:1 ; - -unsigned phy_reset:1 ; - -/* -* Regulators for USB PHYs. -* Each PHY can have a separate regulator. -*/ -struct regulator *regulator[OMAP3_HS_USB_PORTS ]; -}; -extern void usb_musb_init (struct omap_musb_board_data *board_data); -extern void usbhs_init (const struct usbhs_omap_board_data *pdata); +extern void usbhs_init (struct usbhs_omap_platform_data *pdata);extern void am35x_musb_reset (void );extern void am35x_musb_phy_power (u8 on);
drivers/mfd/omap-usb-host.c +26 -37
149 lines not on this page · raw message
drivers/mfd/omap-usb-tll.c +5 -6
@@ -98,7 +98,7 @@struct usbtll_omap {struct clk *usbtll_p1_fck;struct clk *usbtll_p2_fck; -struct usbtll_omap_platform_data platdata; +struct usbhs_omap_platform_data *pdata;/* secure the register updates */ spinlock_t lock; };
@@ -203,7 +203,7 @@ static unsigned ohci_omap3_fslsmode(enum usbhs_omap_port_mode mode)static int usbtll_omap_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; -struct usbtll_omap_platform_data *pdata = dev->platform_data; +struct usbhs_omap_platform_data *pdata = dev->platform_data;void __iomem *base;struct resource *res;struct usbtll_omap *tll;
@@ -223,8 +223,7 @@ static int usbtll_omap_probe(struct platform_device *pdev)spin_lock_init (&tll->lock); -for (i =0 ; i <OMAP3_HS_USB_PORTS ; i++) - tll->platdata.port_mode[i] = pdata->port_mode[i]; + tll->pdata = pdata; tll->usbtll_p1_fck =clk_get (dev,"usb_tll_hs_usb_ch0_clk" );if (IS_ERR (tll->usbtll_p1_fck)) {
@@ -362,7 +361,7 @@ static int usbtll_omap_remove(struct platform_device *pdev)static int usbtll_runtime_resume (struct device *dev) {struct usbtll_omap *tll =dev_get_drvdata (dev); -struct usbtll_omap_platform_data *pdata = &tll->platdata; +struct usbhs_omap_platform_data *pdata = tll->pdata;unsigned long flags;dev_dbg (dev,"usbtll_runtime_resume\n" );
@@ -388,7 +387,7 @@ static int usbtll_runtime_resume(struct device *dev)static int usbtll_runtime_suspend (struct device *dev) {struct usbtll_omap *tll =dev_get_drvdata (dev); -struct usbtll_omap_platform_data *pdata = &tll->platdata; +struct usbhs_omap_platform_data *pdata = tll->pdata;unsigned long flags;dev_dbg (dev,"usbtll_runtime_suspend\n" );
drivers/usb/host/ehci-omap.c +3 -3
@@ -107,7 +107,7 @@ static int omap_ehci_init(struct usb_hcd *hcd) {struct ehci_hcd *ehci =hcd_to_ehci (hcd);int rc; -struct ehci_hcd_omap_platform_data *pdata; +struct usbhs_omap_platform_data *pdata; pdata = hcd->self.controller->platform_data;
@@ -151,7 +151,7 @@ static int omap_ehci_init(struct usb_hcd *hcd) }static void disable_put_regulator ( -struct ehci_hcd_omap_platform_data *pdata) +struct usbhs_omap_platform_data *pdata) {int i;
@@ -176,7 +176,7 @@ static void disable_put_regulator(static int ehci_hcd_omap_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; -struct ehci_hcd_omap_platform_data *pdata = dev->platform_data; +struct usbhs_omap_platform_data *pdata = dev->platform_data;struct resource *res;struct usb_hcd *hcd;void __iomem *regs;
include/linux/platform_data/usb-omap.h +4 -19
@@ -38,30 +38,15 @@ enum usbhs_omap_port_mode { OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM }; -struct usbtll_omap_platform_data { -enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS ]; -}; - -struct ehci_hcd_omap_platform_data { +struct usbhs_omap_platform_data {enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS ];int reset_gpio_port[OMAP3_HS_USB_PORTS ];struct regulator *regulator[OMAP3_HS_USB_PORTS ]; -unsigned phy_reset:1 ; -}; - -struct ohci_hcd_omap_platform_data { -enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS ]; -unsigned es2_compatibility:1 ; -}; - -struct usbhs_omap_platform_data { -enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS ]; - -struct ehci_hcd_omap_platform_data *ehci_data; -struct ohci_hcd_omap_platform_data *ohci_data;/* OMAP3 <= ES2.1 have a single ulpi bypass control bit */ -unsigned single_ulpi_bypass:1 ; +unsigned single_ulpi_bypass:1 ; +unsigned es2_compatibility:1 ; +unsigned phy_reset:1 ; };/*-------------------------------------------------------------------------*/
Signature · 1 line
1.7.4.1
Re: [PATCH v9 02/20] mfd: omap-usb-host: Consolidate OMAP USB-HS platform data
Hi Greg,
Quoted 7 lines · Roger Quadros
Let's have a single platform data structure for the OMAP's High-Speed USB host subsystem instead of having 3 separate ones i.e. one for board data, one for USB Host (UHH) module and one for USB-TLL module.
This makes the code much simpler and avoids creating multiple copies of platform data.
Quoted 6 lines
CC Alan Stern <[email protected]>Signed-off-by Roger Quadros <[email protected]>Reviewed-by Felipe Balbi <[email protected]>For the
ehci-omap.cpart:Acked-by Alan Stern <[email protected]>
Could you please ACK the drivers/usb/host/ehci-omap.c part so that this can go through the MFD tree. Thanks.
The reason it needs to go through MFD is that it depends on a platform header change which Samuel and Tony have agreed to share.
cheers,
-roger
Quoted 25 lines
--- arch/arm/mach-omap2/board-3430sdp.c | 2 +- arch/arm/mach-omap2/board-3630sdp.c | 2 +- arch/arm/mach-omap2/board-am3517crane.c | 2 +- arch/arm/mach-omap2/board-am3517evm.c | 2 +- arch/arm/mach-omap2/board-cm-t35.c | 2 +- arch/arm/mach-omap2/board-cm-t3517.c | 2 +- arch/arm/mach-omap2/board-devkit8000.c | 2 +- arch/arm/mach-omap2/board-igep0020.c | 4 +- arch/arm/mach-omap2/board-omap3beagle.c | 2 +- arch/arm/mach-omap2/board-omap3evm.c | 2 +- arch/arm/mach-omap2/board-omap3pandora.c | 2 +- arch/arm/mach-omap2/board-omap3stalker.c | 2 +- arch/arm/mach-omap2/board-omap3touchbook.c | 2 +- arch/arm/mach-omap2/board-omap4panda.c | 2 +- arch/arm/mach-omap2/board-overo.c | 2 +- arch/arm/mach-omap2/board-zoom.c | 2 +- arch/arm/mach-omap2/usb-host.c | 29 ++----------- arch/arm/mach-omap2/usb.h | 20 +-------- drivers/mfd/omap-usb-host.c | 63 +++++++++++---------------- drivers/mfd/omap-usb-tll.c | 11 ++--- drivers/usb/host/ehci-omap.c | 6 +- include/linux/platform_data/usb-omap.h | 23 ++-------- 22 files changed, 61 insertions(+), 125 deletions(-)
<snip>
Quoted 71 lines
drivers/usb/host/ehci-omap.c +3
-3@@ -107,7 +107,7 @@ static int omap_ehci_init(struct usb_hcd *hcd) {struct ehci_hcd *ehci =hcd_to_ehci (hcd);int rc; -struct ehci_hcd_omap_platform_data *pdata; +struct usbhs_omap_platform_data *pdata; pdata = hcd->self.controller->platform_data;@@ -151,7 +151,7 @@ static int omap_ehci_init(struct usb_hcd *hcd) }static void disable_put_regulator ( -struct ehci_hcd_omap_platform_data *pdata) +struct usbhs_omap_platform_data *pdata) {int i;@@ -176,7 +176,7 @@ static void disable_put_regulator(static int ehci_hcd_omap_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; -struct ehci_hcd_omap_platform_data *pdata = dev->platform_data; +struct usbhs_omap_platform_data *pdata = dev->platform_data;struct resource *res;struct usb_hcd *hcd;void __iomem *regs;include/linux/platform_data/usb-omap.h +4
-19@@ -38,30 +38,15 @@ enum usbhs_omap_port_mode { OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM }; -struct usbtll_omap_platform_data { -enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS ]; -}; - -struct ehci_hcd_omap_platform_data { +struct usbhs_omap_platform_data {enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS ];int reset_gpio_port[OMAP3_HS_USB_PORTS ];struct regulator *regulator[OMAP3_HS_USB_PORTS ]; -unsigned phy_reset:1 ; -}; - -struct ohci_hcd_omap_platform_data { -enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS ]; -unsigned es2_compatibility:1 ; -}; - -struct usbhs_omap_platform_data { -enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS ]; - -struct ehci_hcd_omap_platform_data *ehci_data; -struct ohci_hcd_omap_platform_data *ohci_data;/* OMAP3 <= ES2.1 have a single ulpi bypass control bit */ -unsigned single_ulpi_bypass:1 ; +unsigned single_ulpi_bypass:1 ; +unsigned es2_compatibility:1 ; +unsigned phy_reset:1 ; };/*-------------------------------------------------------------------------*/
Re: [PATCH v9 02/20] mfd: omap-usb-host: Consolidate OMAP USB-HS platform data
Quoted 12 lines · Roger Quadros
Hi Greg,
Quoted 9 lines · Roger Quadros
Let's have a single platform data structure for the OMAP's High-Speed USB host subsystem instead of having 3 separate ones i.e. one for board data, one for USB Host (UHH) module and one for USB-TLL module.
This makes the code much simpler and avoids creating multiple copies of platform data.
CC Alan Stern <[email protected]>
Quoted 7 lines
Quoted 4 lines
Signed-off-by Roger Quadros <[email protected]>Reviewed-by Felipe Balbi <[email protected]>For the
ehci-omap.cpart:Acked-by Alan Stern <[email protected]>Could you please ACK the
drivers/usb/host/ehci-omap.cpart so that this can go through the MFD tree. Thanks.
PATCH v9 3/20 mfd: omap-usb-tll: Fix channel count detection
In reply to Roger QuadrosFix channel count detecion for REV2. Also, don't give up if we don't recognize the IP Revision. We assume the default number of channels (i.e. 3) for unrecognized IPs.
--- drivers/mfd/omap-usb-tll.c | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-)
drivers/mfd/omap-usb-tll.c +11 -9
@@ -98,6 +98,7 @@struct usbtll_omap {struct clk *usbtll_p1_fck;struct clk *usbtll_p2_fck; +int nch;/* num. of channels */ struct usbhs_omap_platform_data *pdata;/* secure the register updates */ spinlock_t lock;
@@ -210,7 +211,7 @@ static int usbtll_omap_probe(struct platform_device *pdev)unsigned reg;unsigned long flags;int ret =0 ; -int i, ver, count; +int i, ver;dev_dbg (dev,"starting TI HSUSB TLL Controller\n" );
@@ -262,16 +263,18 @@ static int usbtll_omap_probe(struct platform_device *pdev) ver =usbtll_read (base,OMAP_USBTLL_REVISION );switch (ver) {case OMAP_USBTLL_REV1 : -case OMAP_USBTLL_REV2 : - count =OMAP_TLL_CHANNEL_COUNT ; + tll->nch =OMAP_TLL_CHANNEL_COUNT ;break ; +case OMAP_USBTLL_REV2 :case OMAP_USBTLL_REV3 : - count =OMAP_REV2_TLL_CHANNEL_COUNT ; + tll->nch =OMAP_REV2_TLL_CHANNEL_COUNT ;break ;default : -dev_err (dev,"TLL version failed\n" ); - ret = -ENODEV ; - goto err_ioremap; + tll->nch =OMAP_TLL_CHANNEL_COUNT ; +dev_dbg (dev, +"USB TLL Rev : 0x%x not recognized, assuming %d channels\n" , + ver, tll->nch); +break ; } if (is_ehci_tll_mode(pdata->port_mode[0]) ||
@@ -291,7 +294,7 @@ static int usbtll_omap_probe(struct platform_device *pdev)usbtll_write (base,OMAP_TLL_SHARED_CONF , reg);/* Enable channels now */ -for (i =0 ; i < count; i++) { +for (i =0 ; i < tll->nch; i++) { reg =usbtll_read (base,OMAP_TLL_CHANNEL_CONF (i));if (is_ohci_port (pdata->port_mode[i])) {
@@ -319,7 +322,6 @@ static int usbtll_omap_probe(struct platform_device *pdev) } } -err_ioremap:spin_unlock_irqrestore (&tll->lock, flags);iounmap (base);pm_runtime_put_sync (dev);
Signature · 1 line
1.7.4.1
PATCH v9 4/20 mfd: omap-usb-tll: Use devm_kzalloc/ioremap and clean up error path
In reply to Roger QuadrosUse devm_ variants of kzalloc() and ioremap(). Simplify the error path.
--- drivers/mfd/omap-usb-tll.c | 38 ++++++++++++-------------------------- 1 files changed, 12 insertions(+), 26 deletions(-)
drivers/mfd/omap-usb-tll.c +12 -26
@@ -215,11 +215,10 @@ static int usbtll_omap_probe(struct platform_device *pdev)dev_dbg (dev,"starting TI HSUSB TLL Controller\n" ); - tll =kzalloc (sizeof (struct usbtll_omap ),GFP_KERNEL ); + tll =devm_kzalloc (dev,sizeof (struct usbtll_omap ),GFP_KERNEL );if (!tll) {dev_err (dev,"Memory allocation failed\n" ); - ret = -ENOMEM ; - goto end; +return -ENOMEM ; }spin_lock_init (&tll->lock);
@@ -230,28 +229,22 @@ static int usbtll_omap_probe(struct platform_device *pdev)if (IS_ERR (tll->usbtll_p1_fck)) { ret =PTR_ERR (tll->usbtll_p1_fck);dev_err (dev,"usbtll_p1_fck failed error:%d\n" , ret); - goto err_tll; +return ret; } tll->usbtll_p2_fck =clk_get (dev,"usb_tll_hs_usb_ch1_clk" );if (IS_ERR (tll->usbtll_p2_fck)) { ret =PTR_ERR (tll->usbtll_p2_fck);dev_err (dev,"usbtll_p2_fck failed error:%d\n" , ret); - goto err_usbtll_p1_fck; + goto err_p2_fck; } res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (!res) { -dev_err (dev,"usb tll get resource failed\n" ); - ret = -ENODEV ; - goto err_usbtll_p2_fck; - } - - base =ioremap (res->start,resource_size (res)); + base =devm_request_and_ioremap (dev, res);if (!base) { -dev_err (dev,"TLL ioremap failed\n" ); - ret = -ENOMEM ; - goto err_usbtll_p2_fck; + ret = -EADDRNOTAVAIL ; +dev_err (dev,"Resource request/ioremap failed:%d\n" , ret); + goto err_res; }platform_set_drvdata (pdev, tll);
@@ -323,23 +316,17 @@ static int usbtll_omap_probe(struct platform_device *pdev) }spin_unlock_irqrestore (&tll->lock, flags); -iounmap (base);pm_runtime_put_sync (dev); tll_pdev = pdev; -if (!ret) - goto end; -pm_runtime_disable (dev); -err_usbtll_p2_fck: +return 0 ; + +err_res:clk_put (tll->usbtll_p2_fck); -err_usbtll_p1_fck: +err_p2_fck:clk_put (tll->usbtll_p1_fck); -err_tll: -kfree (tll); - -end:return ret; }
@@ -356,7 +343,6 @@ static int usbtll_omap_remove(struct platform_device *pdev)clk_put (tll->usbtll_p2_fck);clk_put (tll->usbtll_p1_fck);pm_runtime_disable (&pdev->dev); -kfree (tll);return 0 ; }
Signature · 1 line
1.7.4.1
PATCH v9 5/20 mfd: omap-usb-tll: Clean up clock handling
In reply to Roger QuadrosEvery channel has a functional clock that is similarly named. It makes sense to use a for loop to manage these clocks as OMAPs can come with up to 3 channels.
Dynamically allocate and get channel clocks depending on the number of clocks avaiable on the platform.
--- drivers/mfd/omap-usb-tll.c | 87 +++++++++++++++++++++++++++----------------- 1 files changed, 54 insertions(+), 33 deletions(-)
drivers/mfd/omap-usb-tll.c +54 -33
@@ -96,10 +96,9 @@#define is_ehci_tll_mode (x) (x == OMAP_EHCI_PORT_MODE_TLL)struct usbtll_omap { -struct clk *usbtll_p1_fck; -struct clk *usbtll_p2_fck;int nch;/* num. of channels */ struct usbhs_omap_platform_data *pdata; +struct clk **ch_clk;/* secure the register updates */ spinlock_t lock; };
@@ -225,26 +224,12 @@ static int usbtll_omap_probe(struct platform_device *pdev) tll->pdata = pdata; - tll->usbtll_p1_fck =clk_get (dev,"usb_tll_hs_usb_ch0_clk" ); -if (IS_ERR (tll->usbtll_p1_fck)) { - ret =PTR_ERR (tll->usbtll_p1_fck); -dev_err (dev,"usbtll_p1_fck failed error:%d\n" , ret); -return ret; - } - - tll->usbtll_p2_fck =clk_get (dev,"usb_tll_hs_usb_ch1_clk" ); -if (IS_ERR (tll->usbtll_p2_fck)) { - ret =PTR_ERR (tll->usbtll_p2_fck); -dev_err (dev,"usbtll_p2_fck failed error:%d\n" , ret); - goto err_p2_fck; - } - res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); base =devm_request_and_ioremap (dev, res);if (!base) { ret = -EADDRNOTAVAIL ;dev_err (dev,"Resource request/ioremap failed:%d\n" , ret); - goto err_res; +return ret; }platform_set_drvdata (pdev, tll);
@@ -270,6 +255,29 @@ static int usbtll_omap_probe(struct platform_device *pdev)break ; } +spin_unlock_irqrestore (&tll->lock, flags); + + tll->ch_clk =devm_kzalloc (dev,sizeof (struct clk * [tll->nch]), +GFP_KERNEL ); +if (!tll->ch_clk) { + ret = -ENOMEM ; +dev_err (dev,"Couldn't allocate memory for channel clocks\n" ); + goto err_clk_alloc; + } + +for (i =0 ; i < tll->nch; i++) { +char clkname[] ="usb_tll_hs_usb_chx_clk" ; + +snprintf (clkname,sizeof (clkname), +"usb_tll_hs_usb_ch%d_clk" , i); + tll->ch_clk[i] =clk_get (dev, clkname); + +if (IS_ERR (tll->ch_clk[i])) +dev_dbg (dev,"can't get clock : %s\n" , clkname); + } + +spin_lock_irqsave (&tll->lock, flags); + if (is_ehci_tll_mode(pdata->port_mode[0]) || is_ehci_tll_mode(pdata->port_mode[1]) || is_ehci_tll_mode(pdata->port_mode[2]) ||
@@ -321,11 +329,9 @@ static int usbtll_omap_probe(struct platform_device *pdev)return 0 ; -err_res: -clk_put (tll->usbtll_p2_fck); - -err_p2_fck: -clk_put (tll->usbtll_p1_fck); +err_clk_alloc: +pm_runtime_put_sync (dev); +pm_runtime_disable (dev);return ret; }
@@ -339,9 +345,12 @@ err_p2_fck:static int usbtll_omap_remove (struct platform_device *pdev) {struct usbtll_omap *tll =platform_get_drvdata (pdev); +int i; + +for (i =0 ; i < tll->nch; i++) +if (!IS_ERR (tll->ch_clk[i])) +clk_put (tll->ch_clk[i]); -clk_put (tll->usbtll_p2_fck); -clk_put (tll->usbtll_p1_fck);pm_runtime_disable (&pdev->dev);return 0 ; }
@@ -351,6 +360,7 @@ static int usbtll_runtime_resume(struct device *dev)struct usbtll_omap *tll =dev_get_drvdata (dev);struct usbhs_omap_platform_data *pdata = tll->pdata;unsigned long flags; +int i;dev_dbg (dev,"usbtll_runtime_resume\n" );
@@ -361,11 +371,20 @@ static int usbtll_runtime_resume(struct device *dev)spin_lock_irqsave (&tll->lock, flags); -if (is_ehci_tll_mode (pdata->port_mode[0 ])) -clk_enable (tll->usbtll_p1_fck); +for (i =0 ; i < tll->nch; i++) { +if (is_ehci_tll_mode (pdata->port_mode[i])) { +int r; -if (is_ehci_tll_mode (pdata->port_mode[1 ])) -clk_enable (tll->usbtll_p2_fck); +if (IS_ERR (tll->ch_clk[i])) +continue ; + + r =clk_enable (tll->ch_clk[i]); +if (r) { +dev_err (dev, +"Error enabling ch %d clock: %d\n" , i, r); + } + } + }spin_unlock_irqrestore (&tll->lock, flags);
@@ -377,6 +396,7 @@ static int usbtll_runtime_suspend(struct device *dev)struct usbtll_omap *tll =dev_get_drvdata (dev);struct usbhs_omap_platform_data *pdata = tll->pdata;unsigned long flags; +int i;dev_dbg (dev,"usbtll_runtime_suspend\n" );
@@ -387,11 +407,12 @@ static int usbtll_runtime_suspend(struct device *dev)spin_lock_irqsave (&tll->lock, flags); -if (is_ehci_tll_mode (pdata->port_mode[0 ])) -clk_disable (tll->usbtll_p1_fck); - -if (is_ehci_tll_mode (pdata->port_mode[1 ])) -clk_disable (tll->usbtll_p2_fck); +for (i =0 ; i < tll->nch; i++) { +if (is_ehci_tll_mode (pdata->port_mode[i])) { +if (!IS_ERR (tll->ch_clk[i])) +clk_disable (tll->ch_clk[i]); + } + }spin_unlock_irqrestore (&tll->lock, flags);
Signature · 1 line
1.7.4.1
PATCH v9 6/20 mfd: omap-usb-tll: introduce and use mode_needs_tll()
In reply to Roger QuadrosThis is a handy macro to check if the port requires the USB TLL module or not. Use it to Enable the TLL module and manage the clocks.
--- drivers/mfd/omap-usb-tll.c | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-)
drivers/mfd/omap-usb-tll.c +12 -8
@@ -95,6 +95,10 @@#define is_ehci_tll_mode (x) (x == OMAP_EHCI_PORT_MODE_TLL) +/* only PHY and UNUSED modes don't need TLL */ +#define omap_usb_mode_needs_tll (x) ((x) != OMAP_USBHS_PORT_MODE_UNUSED &&\ + (x) != OMAP_EHCI_PORT_MODE_PHY) +struct usbtll_omap {int nch;/* num. of channels */ struct usbhs_omap_platform_data *pdata;
@@ -211,6 +215,7 @@ static int usbtll_omap_probe(struct platform_device *pdev)unsigned long flags;int ret =0 ;int i, ver; +bool needs_tll;dev_dbg (dev,"starting TI HSUSB TLL Controller\n" );
@@ -278,12 +283,11 @@ static int usbtll_omap_probe(struct platform_device *pdev)spin_lock_irqsave (&tll->lock, flags); -if (is_ehci_tll_mode (pdata->port_mode[0 ]) || -is_ehci_tll_mode (pdata->port_mode[1 ]) || -is_ehci_tll_mode (pdata->port_mode[2 ]) || -is_ohci_port (pdata->port_mode[0 ]) || -is_ohci_port (pdata->port_mode[1 ]) || -is_ohci_port (pdata->port_mode[2 ])) { + needs_tll = false; +for (i =0 ; i < tll->nch; i++) + needs_tll |=omap_usb_mode_needs_tll (pdata->port_mode[i]); + +if (needs_tll) {/* Program Common TLL register */ reg =usbtll_read (base,OMAP_TLL_SHARED_CONF );
@@ -372,7 +376,7 @@ static int usbtll_runtime_resume(struct device *dev)spin_lock_irqsave (&tll->lock, flags);for (i =0 ; i < tll->nch; i++) { -if (is_ehci_tll_mode (pdata->port_mode[i])) { +if (omap_usb_mode_needs_tll (pdata->port_mode[i])) {int r;if (IS_ERR (tll->ch_clk[i]))
@@ -408,7 +412,7 @@ static int usbtll_runtime_suspend(struct device *dev)spin_lock_irqsave (&tll->lock, flags);for (i =0 ; i < tll->nch; i++) { -if (is_ehci_tll_mode (pdata->port_mode[i])) { +if (omap_usb_mode_needs_tll (pdata->port_mode[i])) {if (!IS_ERR (tll->ch_clk[i]))clk_disable (tll->ch_clk[i]); }
Signature · 1 line
1.7.4.1
PATCH v9 7/20 mfd: omap-usb-tll: Check for missing platform data in probe
In reply to Roger QuadrosNo need to check for missing platform data in runtime_suspend/resume as it makes more sense to do it in the probe function.
--- drivers/mfd/omap-usb-tll.c | 15 +++++---------- 1 files changed, 5 insertions(+), 10 deletions(-)
drivers/mfd/omap-usb-tll.c +5 -10
@@ -225,6 +225,11 @@ static int usbtll_omap_probe(struct platform_device *pdev)return -ENOMEM ; } +if (!pdata) { +dev_err (dev,"Platform data missing\n" ); +return -ENODEV ; + } +spin_lock_init (&tll->lock); tll->pdata = pdata;
@@ -368,11 +373,6 @@ static int usbtll_runtime_resume(struct device *dev)dev_dbg (dev,"usbtll_runtime_resume\n" ); -if (!pdata) { -dev_dbg (dev,"missing platform_data\n" ); -return -ENODEV ; - } -spin_lock_irqsave (&tll->lock, flags);for (i =0 ; i < tll->nch; i++) {
@@ -404,11 +404,6 @@ static int usbtll_runtime_suspend(struct device *dev)dev_dbg (dev,"usbtll_runtime_suspend\n" ); -if (!pdata) { -dev_dbg (dev,"missing platform_data\n" ); -return -ENODEV ; - } -spin_lock_irqsave (&tll->lock, flags);for (i =0 ; i < tll->nch; i++) {
Signature · 1 line
1.7.4.1
PATCH v9 8/20 mfd: omap-usb-tll: Fix error message
In reply to Roger Quadrosomap_enable/disable_tll() can fail if TLL device is not initialized. It could be due to multiple reasons and not only due to missing platform data.
Also make local variables static and use 'struct device *' instead of 'struct platform_device *' for global reference.
--- drivers/mfd/omap-usb-tll.c | 21 ++++++++++++--------- 1 files changed, 12 insertions(+), 9 deletions(-)
drivers/mfd/omap-usb-tll.c +12 -9
@@ -109,8 +109,8 @@ struct usbtll_omap {/*-------------------------------------------------------------------------*/ -const char usbtll_driver_name[] =USBTLL_DRIVER_NAME ; -struct platform_device *tll_pdev; +static const char usbtll_driver_name[] =USBTLL_DRIVER_NAME ; +static struct device *tll_dev;/*-------------------------------------------------------------------------*/
@@ -334,7 +334,8 @@ static int usbtll_omap_probe(struct platform_device *pdev)spin_unlock_irqrestore (&tll->lock, flags);pm_runtime_put_sync (dev); - tll_pdev = pdev; +/* only after this can omap_tll_enable/disable work */ + tll_dev = dev;return 0 ;
@@ -356,6 +357,8 @@ static int usbtll_omap_remove(struct platform_device *pdev)struct usbtll_omap *tll =platform_get_drvdata (pdev);int i; + tll_dev =NULL ; +for (i =0 ; i < tll->nch; i++)if (!IS_ERR (tll->ch_clk[i]))clk_put (tll->ch_clk[i]);
@@ -436,21 +439,21 @@ static struct platform_driver usbtll_omap_driver = {int omap_tll_enable (void ) { -if (!tll_pdev) { -pr_err ("missing omap usbhs tll platform_data\n" ); +if (!tll_dev) { +pr_err ("%s: OMAP USB TLL not initialized\n" , __func__);return -ENODEV ; } -return pm_runtime_get_sync (&tll_pdev->dev); +return pm_runtime_get_sync (tll_dev); }EXPORT_SYMBOL_GPL (omap_tll_enable);int omap_tll_disable (void ) { -if (!tll_pdev) { -pr_err ("missing omap usbhs tll platform_data\n" ); +if (!tll_dev) { +pr_err ("%s: OMAP USB TLL not initialized\n" , __func__);return -ENODEV ; } -return pm_runtime_put_sync (&tll_pdev->dev); +return pm_runtime_put_sync (tll_dev); }EXPORT_SYMBOL_GPL (omap_tll_disable);
Signature · 1 line
1.7.4.1
PATCH v9 9/20 mfd: omap-usb-tll: serialize access to TLL device
In reply to Roger QuadrosGet rid of the unnecessary spin_lock_irqsave/restore() as there is no interrupt handler for this driver. Instead we serialize access to tll_dev using a global spinlock.
--- drivers/mfd/omap-usb-tll.c | 53 ++++++++++++++++++++++--------------------- 1 files changed, 27 insertions(+), 26 deletions(-)
drivers/mfd/omap-usb-tll.c +27 -26
@@ -103,14 +103,13 @@ struct usbtll_omap {int nch;/* num. of channels */ struct usbhs_omap_platform_data *pdata;struct clk **ch_clk; -/* secure the register updates */ -spinlock_t lock; };/*-------------------------------------------------------------------------*/ static const char usbtll_driver_name[] =USBTLL_DRIVER_NAME ;static struct device *tll_dev; +static DEFINE_SPINLOCK (tll_lock);/* serialize access to tll_dev */ /*-------------------------------------------------------------------------*/
@@ -212,7 +211,6 @@ static int usbtll_omap_probe(struct platform_device *pdev)struct resource *res;struct usbtll_omap *tll;unsigned reg; -unsigned long flags;int ret =0 ;int i, ver;bool needs_tll;
@@ -230,8 +228,6 @@ static int usbtll_omap_probe(struct platform_device *pdev)return -ENODEV ; } -spin_lock_init (&tll->lock); - tll->pdata = pdata; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );
@@ -246,8 +242,6 @@ static int usbtll_omap_probe(struct platform_device *pdev)pm_runtime_enable (dev);pm_runtime_get_sync (dev); -spin_lock_irqsave (&tll->lock, flags); - ver =usbtll_read (base,OMAP_USBTLL_REVISION );switch (ver) {case OMAP_USBTLL_REV1 :
@@ -265,8 +259,6 @@ static int usbtll_omap_probe(struct platform_device *pdev)break ; } -spin_unlock_irqrestore (&tll->lock, flags); - tll->ch_clk =devm_kzalloc (dev,sizeof (struct clk * [tll->nch]),GFP_KERNEL );if (!tll->ch_clk) {
@@ -286,8 +278,6 @@ static int usbtll_omap_probe(struct platform_device *pdev)dev_dbg (dev,"can't get clock : %s\n" , clkname); } -spin_lock_irqsave (&tll->lock, flags); - needs_tll = false;for (i =0 ; i < tll->nch; i++) needs_tll |=omap_usb_mode_needs_tll (pdata->port_mode[i]);
@@ -332,10 +322,11 @@ static int usbtll_omap_probe(struct platform_device *pdev) } } -spin_unlock_irqrestore (&tll->lock, flags);pm_runtime_put_sync (dev);/* only after this can omap_tll_enable/disable work */ +spin_lock (&tll_lock); tll_dev = dev; +spin_unlock (&tll_lock);return 0 ;
@@ -357,7 +348,9 @@ static int usbtll_omap_remove(struct platform_device *pdev)struct usbtll_omap *tll =platform_get_drvdata (pdev);int i; +spin_lock (&tll_lock); tll_dev =NULL ; +spin_unlock (&tll_lock);for (i =0 ; i < tll->nch; i++)if (!IS_ERR (tll->ch_clk[i]))
@@ -371,13 +364,10 @@ static int usbtll_runtime_resume(struct device *dev) {struct usbtll_omap *tll =dev_get_drvdata (dev);struct usbhs_omap_platform_data *pdata = tll->pdata; -unsigned long flags;int i;dev_dbg (dev,"usbtll_runtime_resume\n" ); -spin_lock_irqsave (&tll->lock, flags); -for (i =0 ; i < tll->nch; i++) {if (omap_usb_mode_needs_tll (pdata->port_mode[i])) {int r;
@@ -393,8 +383,6 @@ static int usbtll_runtime_resume(struct device *dev) } } -spin_unlock_irqrestore (&tll->lock, flags); -return 0 ; }
@@ -402,13 +390,10 @@ static int usbtll_runtime_suspend(struct device *dev) {struct usbtll_omap *tll =dev_get_drvdata (dev);struct usbhs_omap_platform_data *pdata = tll->pdata; -unsigned long flags;int i;dev_dbg (dev,"usbtll_runtime_suspend\n" ); -spin_lock_irqsave (&tll->lock, flags); -for (i =0 ; i < tll->nch; i++) {if (omap_usb_mode_needs_tll (pdata->port_mode[i])) {if (!IS_ERR (tll->ch_clk[i]))
@@ -416,8 +401,6 @@ static int usbtll_runtime_suspend(struct device *dev) } } -spin_unlock_irqrestore (&tll->lock, flags); -return 0 ; }
@@ -439,21 +422,39 @@ static struct platform_driver usbtll_omap_driver = {int omap_tll_enable (void ) { +int ret; + +spin_lock (&tll_lock); +if (!tll_dev) {pr_err ("%s: OMAP USB TLL not initialized\n" , __func__); -return -ENODEV ; + ret = -ENODEV ; + }else { + ret =pm_runtime_get_sync (tll_dev); } -return pm_runtime_get_sync (tll_dev); + +spin_unlock (&tll_lock); + +return ret; }EXPORT_SYMBOL_GPL (omap_tll_enable);int omap_tll_disable (void ) { +int ret; + +spin_lock (&tll_lock); +if (!tll_dev) {pr_err ("%s: OMAP USB TLL not initialized\n" , __func__); -return -ENODEV ; + ret = -ENODEV ; + }else { + ret =pm_runtime_put_sync (tll_dev); } -return pm_runtime_put_sync (tll_dev); + +spin_unlock (&tll_lock); + +return ret; }EXPORT_SYMBOL_GPL (omap_tll_disable);
Signature · 1 line
1.7.4.1
PATCH v9 10/20 mfd: omap-usb-tll: Add OMAP5 revision and HSIC support
In reply to Roger QuadrosThe TLL module on OMAP5 has 3 channels.
HSIC mode requires the TLL channel to be in Transparent UTMI mode.
--- drivers/mfd/omap-usb-tll.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-)
drivers/mfd/omap-usb-tll.c +14 -0
@@ -54,10 +54,13 @@#define OMAP_TLL_CHANNEL_CONF (num) (0x040 + 0x004 * num)#define OMAP_TLL_CHANNEL_CONF_FSLSMODE_SHIFT 24 +#define OMAP_TLL_CHANNEL_CONF_DRVVBUS (1 << 16) +#define OMAP_TLL_CHANNEL_CONF_CHRGVBUS (1 << 15)#define OMAP_TLL_CHANNEL_CONF_ULPINOBITSTUFF (1 << 11)#define OMAP_TLL_CHANNEL_CONF_ULPI_ULPIAUTOIDLE (1 << 10)#define OMAP_TLL_CHANNEL_CONF_UTMIAUTOIDLE (1 << 9)#define OMAP_TLL_CHANNEL_CONF_ULPIDDRMODE (1 << 8) +#define OMAP_TLL_CHANNEL_CONF_MODE_TRANSPARENT_UTMI (2 << 1)#define OMAP_TLL_CHANNEL_CONF_CHANMODE_FSLS (1 << 1)#define OMAP_TLL_CHANNEL_CONF_CHANEN (1 << 0)
@@ -92,6 +95,7 @@#define OMAP_USBTLL_REV1 0x00000015/* OMAP3 */ #define OMAP_USBTLL_REV2 0x00000018/* OMAP 3630 */ #define OMAP_USBTLL_REV3 0x00000004/* OMAP4 */ +#define OMAP_USBTLL_REV4 0x00000006/* OMAP5 */ #define is_ehci_tll_mode (x) (x == OMAP_EHCI_PORT_MODE_TLL)
@@ -245,6 +249,7 @@ static int usbtll_omap_probe(struct platform_device *pdev) ver =usbtll_read (base,OMAP_USBTLL_REVISION );switch (ver) {case OMAP_USBTLL_REV1 : +case OMAP_USBTLL_REV4 : tll->nch =OMAP_TLL_CHANNEL_COUNT ;break ;case OMAP_USBTLL_REV2 :
@@ -310,6 +315,15 @@ static int usbtll_omap_probe(struct platform_device *pdev) reg &= ~(OMAP_TLL_CHANNEL_CONF_UTMIAUTOIDLE |OMAP_TLL_CHANNEL_CONF_ULPINOBITSTUFF |OMAP_TLL_CHANNEL_CONF_ULPIDDRMODE ); + }else if (pdata->port_mode[i] == +OMAP_EHCI_PORT_MODE_HSIC ) { +/* +* HSIC Mode requires UTMI port configurations +*/ + reg |=OMAP_TLL_CHANNEL_CONF_DRVVBUS + |OMAP_TLL_CHANNEL_CONF_CHRGVBUS + |OMAP_TLL_CHANNEL_CONF_MODE_TRANSPARENT_UTMI + |OMAP_TLL_CHANNEL_CONF_ULPINOBITSTUFF ; }else {continue ; }
Signature · 1 line
1.7.4.1
PATCH v9 11/20 mfd: omap_usb_host: Avoid missing platform data checks in suspend/resume
In reply to Roger QuadrosGet rid of the unnecessary missing platform data checks in runtime_suspend/resume. We are already checking for missing platform data in probe.
--- drivers/mfd/omap-usb-host.c | 10 ---------- 1 files changed, 0 insertions(+), 10 deletions(-)
drivers/mfd/omap-usb-host.c +0 -10
@@ -277,11 +277,6 @@ static int usbhs_runtime_resume(struct device *dev)dev_dbg (dev,"usbhs_runtime_resume\n" ); -if (!pdata) { -dev_dbg (dev,"missing platform_data\n" ); -return -ENODEV ; - } -omap_tll_enable ();spin_lock_irqsave (&omap->lock, flags);
@@ -309,11 +304,6 @@ static int usbhs_runtime_suspend(struct device *dev)dev_dbg (dev,"usbhs_runtime_suspend\n" ); -if (!pdata) { -dev_dbg (dev,"missing platform_data\n" ); -return -ENODEV ; - } -spin_lock_irqsave (&omap->lock, flags);if (is_ehci_tll_mode (pdata->port_mode[0 ]))
Signature · 1 line
1.7.4.1
PATCH v9 12/20 mfd: omap-usb-host: Use devm_kzalloc() and devm_request_and_ioremap()
In reply to Roger QuadrosUse devm_ variants of kzalloc and ioremap. Also clean up error path.
--- drivers/mfd/omap-usb-host.c | 38 +++++++++++--------------------------- 1 files changed, 11 insertions(+), 27 deletions(-)
drivers/mfd/omap-usb-host.c +11 -27
@@ -461,15 +461,20 @@ static int usbhs_omap_probe(struct platform_device *pdev)if (!pdata) {dev_err (dev,"Missing platform data\n" ); - ret = -ENOMEM ; - goto end_probe; +return -ENODEV ; } - omap =kzalloc (sizeof (*omap),GFP_KERNEL ); + omap =devm_kzalloc (dev,sizeof (*omap),GFP_KERNEL );if (!omap) {dev_err (dev,"Memory allocation failed\n" ); - ret = -ENOMEM ; - goto end_probe; +return -ENOMEM ; + } + + res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"uhh" ); + omap->uhh_base =devm_request_and_ioremap (dev, res); +if (!omap->uhh_base) { +dev_err (dev,"Resource request/ioremap failed\n" ); +return -EADDRNOTAVAIL ; }spin_lock_init (&omap->lock);
@@ -568,20 +573,6 @@ static int usbhs_omap_probe(struct platform_device *pdev) "failed error:%d\n", ret); } - res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"uhh" ); -if (!res) { -dev_err (dev,"UHH EHCI get resource failed\n" ); - ret = -ENODEV ; - goto err_init_60m_fclk; - } - - omap->uhh_base =ioremap (res->start,resource_size (res)); -if (!omap->uhh_base) { -dev_err (dev,"UHH ioremap failed\n" ); - ret = -ENOMEM ; - goto err_init_60m_fclk; - } -platform_set_drvdata (pdev, omap);omap_usbhs_init (dev);
@@ -591,13 +582,10 @@ static int usbhs_omap_probe(struct platform_device *pdev) goto err_alloc; } - goto end_probe; +return 0 ; err_alloc:omap_usbhs_deinit (&pdev->dev); -iounmap (omap->uhh_base); - -err_init_60m_fclk:clk_put (omap->init_60m_fclk); err_usbhost_p2_fck:
@@ -621,9 +609,7 @@ err_utmi_p1_fck: err_end:clk_put (omap->ehci_logic_fck);pm_runtime_disable (dev); -kfree (omap); -end_probe:return ret; }
@@ -638,7 +624,6 @@ static int usbhs_omap_remove(struct platform_device *pdev)struct usbhs_hcd_omap *omap =platform_get_drvdata (pdev);omap_usbhs_deinit (&pdev->dev); -iounmap (omap->uhh_base);clk_put (omap->init_60m_fclk);clk_put (omap->usbhost_p2_fck);clk_put (omap->usbhost_p1_fck);
@@ -648,7 +633,6 @@ static int usbhs_omap_remove(struct platform_device *pdev)clk_put (omap->utmi_p1_fck);clk_put (omap->ehci_logic_fck);pm_runtime_disable (&pdev->dev); -kfree (omap);return 0 ; }
Signature · 1 line
1.7.4.1
PATCH v9 13/20 mfd: omap-usb-host: know about number of ports from revision register
In reply to Roger QuadrosThe revision register should tell us how many ports are present.
--- drivers/mfd/omap-usb-host.c | 33 ++++++++++++++++++++++++++++----- 1 files changed, 28 insertions(+), 5 deletions(-)
drivers/mfd/omap-usb-host.c +28 -5
@@ -91,6 +91,8 @@struct usbhs_hcd_omap { +int nports; +struct clk *xclk60mhsp1_ck;struct clk *xclk60mhsp2_ck;struct clk *utmi_p1_fck;
@@ -347,8 +349,6 @@ static void omap_usbhs_init(struct device *dev)pm_runtime_get_sync (dev);spin_lock_irqsave (&omap->lock, flags); - omap->usbhs_rev =usbhs_read (omap->uhh_base,OMAP_UHH_REVISION ); -dev_dbg (dev,"OMAP UHH_REVISION 0x%x\n" , omap->usbhs_rev); reg =usbhs_read (omap->uhh_base,OMAP_UHH_HOSTCONFIG );/* setup ULPI bypass and burst configurations */
@@ -483,7 +483,32 @@ static int usbhs_omap_probe(struct platform_device *pdev)pm_runtime_enable (dev); -for (i =0 ; i <OMAP3_HS_USB_PORTS ; i++) +platform_set_drvdata (pdev, omap); +pm_runtime_get_sync (dev); + + omap->usbhs_rev =usbhs_read (omap->uhh_base,OMAP_UHH_REVISION ); + +/* we need to call runtime suspend before we update omap->nports +* to prevent unbalanced clk_disable() +*/ +pm_runtime_put_sync (dev); + +switch (omap->usbhs_rev) { +case OMAP_USBHS_REV1 : + omap->nports =3 ; +break ; +case OMAP_USBHS_REV2 : + omap->nports =2 ; +break ; +default : + omap->nports =OMAP3_HS_USB_PORTS ; +dev_dbg (dev, +"USB HOST Rev : 0x%d not recognized, assuming %d ports\n" , + omap->usbhs_rev, omap->nports); +break ; + } + +for (i =0 ; i < omap->nports; i++)if (is_ehci_phy_mode (i) ||is_ehci_tll_mode (i) ||is_ehci_hsic_mode (i)) { omap->ehci_logic_fck =clk_get (dev,"ehci_logic_fck" );
@@ -573,8 +598,6 @@ static int usbhs_omap_probe(struct platform_device *pdev) "failed error:%d\n", ret); } -platform_set_drvdata (pdev, omap); -omap_usbhs_init (dev); ret =omap_usbhs_alloc_children (pdev);if (ret) {
Signature · 1 line
1.7.4.1
PATCH v9 14/20 mfd: omap-usb-host: override number of ports from platform data
In reply to Roger QuadrosBoth OMAP4 and 5 exhibit the same revision ID in the REVISION register but they have different number of ports i.e. 2 and 3 respectively. So we can't rely on REVISION register for number of ports on OMAP5 and depend on platform data (or device tree) instead.
--- drivers/mfd/omap-usb-host.c | 34 +++++++++++++++++++------------ include/linux/platform_data/usb-omap.h | 1 + 2 files changed, 22 insertions(+), 13 deletions(-)
drivers/mfd/omap-usb-host.c +21 -13
@@ -493,19 +493,27 @@ static int usbhs_omap_probe(struct platform_device *pdev)*/ pm_runtime_put_sync (dev); -switch (omap->usbhs_rev) { -case OMAP_USBHS_REV1 : - omap->nports =3 ; -break ; -case OMAP_USBHS_REV2 : - omap->nports =2 ; -break ; -default : - omap->nports =OMAP3_HS_USB_PORTS ; -dev_dbg (dev, -"USB HOST Rev : 0x%d not recognized, assuming %d ports\n" , - omap->usbhs_rev, omap->nports); -break ; +/* +* If platform data contains nports then use that +* else make out number of ports from USBHS revision +*/ +if (pdata->nports) { + omap->nports = pdata->nports; + }else { +switch (omap->usbhs_rev) { +case OMAP_USBHS_REV1 : + omap->nports =3 ; +break ; +case OMAP_USBHS_REV2 : + omap->nports =2 ; +break ; +default : + omap->nports =OMAP3_HS_USB_PORTS ; +dev_dbg (dev, +"USB HOST Rev:0x%d not recognized, assuming %d ports\n" , + omap->usbhs_rev, omap->nports); +break ; + } }for (i =0 ; i < omap->nports; i++)
include/linux/platform_data/usb-omap.h +1 -0
@@ -39,6 +39,7 @@ enum usbhs_omap_port_mode { };struct usbhs_omap_platform_data { +int nports;enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS ];int reset_gpio_port[OMAP3_HS_USB_PORTS ];struct regulator *regulator[OMAP3_HS_USB_PORTS ];
Signature · 1 line
1.7.4.1
PATCH v9 15/20 mfd: omap-usb-host: cleanup clock management code
In reply to Roger QuadrosAll ports have similarly named port clocks so we can bunch them into a port data structure and use for loop to enable/disable the clocks.
Dynamically allocate and get clocks based on number of ports available on the platform
--- drivers/mfd/omap-usb-host.c | 186 ++++++++++++++++++++++++------------------ 1 files changed, 106 insertions(+), 80 deletions(-)
drivers/mfd/omap-usb-host.c +106 -80
@@ -92,13 +92,12 @@struct usbhs_hcd_omap {int nports; +struct clk **utmi_clk;struct clk *xclk60mhsp1_ck;struct clk *xclk60mhsp2_ck; -struct clk *utmi_p1_fck; -struct clk *usbhost_p1_fck; -struct clk *utmi_p2_fck; -struct clk *usbhost_p2_fck; +struct clk *utmi_p1_gfclk; +struct clk *utmi_p2_gfclk;struct clk *init_60m_fclk;struct clk *ehci_logic_fck;
@@ -276,22 +275,25 @@ static int usbhs_runtime_resume(struct device *dev)struct usbhs_hcd_omap *omap =dev_get_drvdata (dev);struct usbhs_omap_platform_data *pdata = omap->pdata;unsigned long flags; +int i, r;dev_dbg (dev,"usbhs_runtime_resume\n" );omap_tll_enable ();spin_lock_irqsave (&omap->lock, flags); -if (omap->ehci_logic_fck && !IS_ERR (omap->ehci_logic_fck)) +if (!IS_ERR (omap->ehci_logic_fck))clk_enable (omap->ehci_logic_fck); -if (is_ehci_tll_mode (pdata->port_mode[0 ])) -clk_enable (omap->usbhost_p1_fck); -if (is_ehci_tll_mode (pdata->port_mode[1 ])) -clk_enable (omap->usbhost_p2_fck); +for (i =0 ; i < omap->nports; i++) { +if (!is_ehci_tll_mode (pdata->port_mode[i]) || +IS_ERR (omap->utmi_clk[i])) +continue ; -clk_enable (omap->utmi_p1_fck); -clk_enable (omap->utmi_p2_fck); + r =clk_enable (omap->utmi_clk[i]); +if (r) +dev_err (dev,"Can't enable port %d clk : %d\n" , i, r); + }spin_unlock_irqrestore (&omap->lock, flags);
@@ -303,20 +305,19 @@ static int usbhs_runtime_suspend(struct device *dev)struct usbhs_hcd_omap *omap =dev_get_drvdata (dev);struct usbhs_omap_platform_data *pdata = omap->pdata;unsigned long flags; +int i;dev_dbg (dev,"usbhs_runtime_suspend\n" );spin_lock_irqsave (&omap->lock, flags); -if (is_ehci_tll_mode (pdata->port_mode[0 ])) -clk_disable (omap->usbhost_p1_fck); -if (is_ehci_tll_mode (pdata->port_mode[1 ])) -clk_disable (omap->usbhost_p2_fck); - -clk_disable (omap->utmi_p2_fck); -clk_disable (omap->utmi_p1_fck); +for (i =0 ; i < omap->nports; i++) { +if (is_ehci_tll_mode (pdata->port_mode[i]) && + !IS_ERR (omap->utmi_clk[i])) +clk_disable (omap->utmi_clk[i]); + } -if (omap->ehci_logic_fck && !IS_ERR (omap->ehci_logic_fck)) +if (!IS_ERR (omap->ehci_logic_fck))clk_disable (omap->ehci_logic_fck);spin_unlock_irqrestore (&omap->lock, flags);
@@ -458,6 +459,7 @@ static int usbhs_omap_probe(struct platform_device *pdev)struct resource *res;int ret =0 ;int i; +bool need_logic_fck;if (!pdata) {dev_err (dev,"Missing platform data\n" );
@@ -516,76 +518,91 @@ static int usbhs_omap_probe(struct platform_device *pdev) } } -for (i =0 ; i < omap->nports; i++) + i =sizeof (struct clk *) * omap->nports; + omap->utmi_clk =devm_kzalloc (dev, i,GFP_KERNEL ); +if (!omap->utmi_clk) { +dev_err (dev,"Memory allocation failed\n" ); + ret = -ENOMEM ; + goto err_mem; + } + + need_logic_fck = false; +for (i =0 ; i < omap->nports; i++) {if (is_ehci_phy_mode (i) ||is_ehci_tll_mode (i) || -is_ehci_hsic_mode (i)) { - omap->ehci_logic_fck =clk_get (dev,"ehci_logic_fck" ); -if (IS_ERR (omap->ehci_logic_fck)) { - ret =PTR_ERR (omap->ehci_logic_fck); -dev_warn (dev,"ehci_logic_fck failed:%d\n" , - ret); - } -break ; +is_ehci_hsic_mode (i)) + need_logic_fck |= true; + } + + omap->ehci_logic_fck =ERR_PTR (-EINVAL ); +if (need_logic_fck) { + omap->ehci_logic_fck =clk_get (dev,"ehci_logic_fck" ); +if (IS_ERR (omap->ehci_logic_fck)) { + ret =PTR_ERR (omap->ehci_logic_fck); +dev_dbg (dev,"ehci_logic_fck failed:%d\n" , ret); } + } - omap->utmi_p1_fck =clk_get (dev,"utmi_p1_gfclk" ); -if (IS_ERR (omap->utmi_p1_fck)) { - ret =PTR_ERR (omap->utmi_p1_fck); -dev_err (dev,"utmi_p1_gfclk failed error:%d\n" , ret); - goto err_end; + omap->utmi_p1_gfclk =clk_get (dev,"utmi_p1_gfclk" ); +if (IS_ERR (omap->utmi_p1_gfclk)) { + ret =PTR_ERR (omap->utmi_p1_gfclk); +dev_err (dev,"utmi_p1_gfclk failed error:%d\n" , ret); + goto err_p1_gfclk; + } + + omap->utmi_p2_gfclk =clk_get (dev,"utmi_p2_gfclk" ); +if (IS_ERR (omap->utmi_p2_gfclk)) { + ret =PTR_ERR (omap->utmi_p2_gfclk); +dev_err (dev,"utmi_p2_gfclk failed error:%d\n" , ret); + goto err_p2_gfclk; } omap->xclk60mhsp1_ck =clk_get (dev,"xclk60mhsp1_ck" );if (IS_ERR (omap->xclk60mhsp1_ck)) { ret =PTR_ERR (omap->xclk60mhsp1_ck);dev_err (dev,"xclk60mhsp1_ck failed error:%d\n" , ret); - goto err_utmi_p1_fck; - } - - omap->utmi_p2_fck =clk_get (dev,"utmi_p2_gfclk" ); -if (IS_ERR (omap->utmi_p2_fck)) { - ret =PTR_ERR (omap->utmi_p2_fck); -dev_err (dev,"utmi_p2_gfclk failed error:%d\n" , ret); - goto err_xclk60mhsp1_ck; + goto err_xclk60mhsp1; } omap->xclk60mhsp2_ck =clk_get (dev,"xclk60mhsp2_ck" );if (IS_ERR (omap->xclk60mhsp2_ck)) { ret =PTR_ERR (omap->xclk60mhsp2_ck);dev_err (dev,"xclk60mhsp2_ck failed error:%d\n" , ret); - goto err_utmi_p2_fck; - } - - omap->usbhost_p1_fck =clk_get (dev,"usb_host_hs_utmi_p1_clk" ); -if (IS_ERR (omap->usbhost_p1_fck)) { - ret =PTR_ERR (omap->usbhost_p1_fck); -dev_err (dev,"usbhost_p1_fck failed error:%d\n" , ret); - goto err_xclk60mhsp2_ck; - } - - omap->usbhost_p2_fck =clk_get (dev,"usb_host_hs_utmi_p2_clk" ); -if (IS_ERR (omap->usbhost_p2_fck)) { - ret =PTR_ERR (omap->usbhost_p2_fck); -dev_err (dev,"usbhost_p2_fck failed error:%d\n" , ret); - goto err_usbhost_p1_fck; + goto err_xclk60mhsp2; } omap->init_60m_fclk =clk_get (dev,"init_60m_fclk" );if (IS_ERR (omap->init_60m_fclk)) { ret =PTR_ERR (omap->init_60m_fclk);dev_err (dev,"init_60m_fclk failed error:%d\n" , ret); - goto err_usbhost_p2_fck; + goto err_init60m; + } + +for (i =0 ; i < omap->nports; i++) { +char clkname[] ="usb_host_hs_utmi_px_clk" ; + +/* clock names are indexed from 1*/ +snprintf (clkname,sizeof (clkname), +"usb_host_hs_utmi_p%d_clk" , i +1 ); + +/* If a clock is not found we won't bail out as not all +* platforms have all clocks and we can function without +* them +*/ + omap->utmi_clk[i] =clk_get (dev, clkname); +if (IS_ERR (omap->utmi_clk[i])) +dev_dbg (dev,"Failed to get clock : %s : %ld\n" , + clkname,PTR_ERR (omap->utmi_clk[i])); }if (is_ehci_phy_mode (pdata->port_mode[0 ])) {/* for OMAP3 , the clk set paretn fails */ - ret =clk_set_parent (omap->utmi_p1_fck, + ret =clk_set_parent (omap->utmi_p1_gfclk, omap->xclk60mhsp1_ck);if (ret !=0 )dev_err (dev,"xclk60mhsp1_ck set parent" "failed error:%d\n" , ret); }else if (is_ehci_tll_mode (pdata->port_mode[0 ])) { - ret =clk_set_parent (omap->utmi_p1_fck, + ret =clk_set_parent (omap->utmi_p1_gfclk, omap->init_60m_fclk);if (ret !=0 ) dev_err(dev, "init_60m_fclk set parent"
@@ -593,13 +610,13 @@ static int usbhs_omap_probe(struct platform_device *pdev) }if (is_ehci_phy_mode (pdata->port_mode[1 ])) { - ret =clk_set_parent (omap->utmi_p2_fck, + ret =clk_set_parent (omap->utmi_p2_gfclk, omap->xclk60mhsp2_ck);if (ret !=0 )dev_err (dev,"xclk60mhsp2_ck set parent" "failed error:%d\n" , ret); }else if (is_ehci_tll_mode (pdata->port_mode[1 ])) { - ret =clk_set_parent (omap->utmi_p2_fck, + ret =clk_set_parent (omap->utmi_p2_gfclk, omap->init_60m_fclk);if (ret !=0 ) dev_err(dev, "init_60m_fclk set parent"
@@ -617,28 +634,30 @@ static int usbhs_omap_probe(struct platform_device *pdev) err_alloc:omap_usbhs_deinit (&pdev->dev); -clk_put (omap->init_60m_fclk); -err_usbhost_p2_fck: -clk_put (omap->usbhost_p2_fck); +for (i =0 ; i < omap->nports; i++) +if (!IS_ERR (omap->utmi_clk[i])) +clk_put (omap->utmi_clk[i]); -err_usbhost_p1_fck: -clk_put (omap->usbhost_p1_fck); +clk_put (omap->init_60m_fclk); -err_xclk60mhsp2_ck: +err_init60m:clk_put (omap->xclk60mhsp2_ck); -err_utmi_p2_fck: -clk_put (omap->utmi_p2_fck); - -err_xclk60mhsp1_ck: +err_xclk60mhsp2:clk_put (omap->xclk60mhsp1_ck); -err_utmi_p1_fck: -clk_put (omap->utmi_p1_fck); +err_xclk60mhsp1: +clk_put (omap->utmi_p2_gfclk); -err_end: -clk_put (omap->ehci_logic_fck); +err_p2_gfclk: +clk_put (omap->utmi_p1_gfclk); + +err_p1_gfclk: +if (!IS_ERR (omap->ehci_logic_fck)) +clk_put (omap->ehci_logic_fck); + +err_mem:pm_runtime_disable (dev);return ret;
@@ -653,16 +672,23 @@ err_end:static int usbhs_omap_remove (struct platform_device *pdev) {struct usbhs_hcd_omap *omap =platform_get_drvdata (pdev); +int i;omap_usbhs_deinit (&pdev->dev); + +for (i =0 ; i < omap->nports; i++) +if (!IS_ERR (omap->utmi_clk[i])) +clk_put (omap->utmi_clk[i]); +clk_put (omap->init_60m_fclk); -clk_put (omap->usbhost_p2_fck); -clk_put (omap->usbhost_p1_fck); +clk_put (omap->utmi_p1_gfclk); +clk_put (omap->utmi_p2_gfclk);clk_put (omap->xclk60mhsp2_ck); -clk_put (omap->utmi_p2_fck);clk_put (omap->xclk60mhsp1_ck); -clk_put (omap->utmi_p1_fck); -clk_put (omap->ehci_logic_fck); + +if (!IS_ERR (omap->ehci_logic_fck)) +clk_put (omap->ehci_logic_fck); +pm_runtime_disable (&pdev->dev);return 0 ;
Signature · 1 line
1.7.4.1
PATCH v9 16/20 mfd: omap-usb-host: Manage HSIC clocks for HSIC mode
In reply to Roger QuadrosEnable the optional HSIC clocks (60MHz and 480MHz) for the ports that are configured in HSIC mode.
--- drivers/mfd/omap-usb-host.c | 97 ++++++++++++++++++++++++++++++++++++------ 1 files changed, 83 insertions(+), 14 deletions(-)
drivers/mfd/omap-usb-host.c +83 -14
@@ -93,6 +93,8 @@struct usbhs_hcd_omap {int nports;struct clk **utmi_clk; +struct clk **hsic60m_clk; +struct clk **hsic480m_clk;struct clk *xclk60mhsp1_ck;struct clk *xclk60mhsp2_ck;
@@ -286,13 +288,40 @@ static int usbhs_runtime_resume(struct device *dev)clk_enable (omap->ehci_logic_fck);for (i =0 ; i < omap->nports; i++) { -if (!is_ehci_tll_mode (pdata->port_mode[i]) || -IS_ERR (omap->utmi_clk[i])) -continue ; - - r =clk_enable (omap->utmi_clk[i]); -if (r) -dev_err (dev,"Can't enable port %d clk : %d\n" , i, r); +switch (pdata->port_mode[i]) { +case OMAP_EHCI_PORT_MODE_HSIC : +if (!IS_ERR (omap->hsic60m_clk[i])) { + r =clk_enable (omap->hsic60m_clk[i]); +if (r) { +dev_err (dev, +"Can't enable port %d hsic60m clk:%d\n" , + i, r); + } + } + +if (!IS_ERR (omap->hsic480m_clk[i])) { + r =clk_enable (omap->hsic480m_clk[i]); +if (r) { +dev_err (dev, +"Can't enable port %d hsic480m clk:%d\n" , + i, r); + } + } +/* Fall through as HSIC mode needs utmi_clk */ + +case OMAP_EHCI_PORT_MODE_TLL : +if (!IS_ERR (omap->utmi_clk[i])) { + r =clk_enable (omap->utmi_clk[i]); +if (r) { +dev_err (dev, +"Can't enable port %d clk : %d\n" , + i, r); + } + } +break ; +default : +break ; + } }spin_unlock_irqrestore (&omap->lock, flags);
@@ -312,9 +341,22 @@ static int usbhs_runtime_suspend(struct device *dev)spin_lock_irqsave (&omap->lock, flags);for (i =0 ; i < omap->nports; i++) { -if (is_ehci_tll_mode (pdata->port_mode[i]) && - !IS_ERR (omap->utmi_clk[i])) -clk_disable (omap->utmi_clk[i]); +switch (pdata->port_mode[i]) { +case OMAP_EHCI_PORT_MODE_HSIC : +if (!IS_ERR (omap->hsic60m_clk[i])) +clk_disable (omap->hsic60m_clk[i]); + +if (!IS_ERR (omap->hsic480m_clk[i])) +clk_disable (omap->hsic480m_clk[i]); +/* Fall through as utmi_clks were used in HSIC mode */ + +case OMAP_EHCI_PORT_MODE_TLL : +if (!IS_ERR (omap->utmi_clk[i])) +clk_disable (omap->utmi_clk[i]); +break ; +default : +break ; + } }if (!IS_ERR (omap->ehci_logic_fck))
@@ -520,7 +562,10 @@ static int usbhs_omap_probe(struct platform_device *pdev) i =sizeof (struct clk *) * omap->nports; omap->utmi_clk =devm_kzalloc (dev, i,GFP_KERNEL ); -if (!omap->utmi_clk) { + omap->hsic480m_clk =devm_kzalloc (dev, i,GFP_KERNEL ); + omap->hsic60m_clk =devm_kzalloc (dev, i,GFP_KERNEL ); + +if (!omap->utmi_clk || !omap->hsic480m_clk || !omap->hsic60m_clk) {dev_err (dev,"Memory allocation failed\n" ); ret = -ENOMEM ; goto err_mem;
@@ -578,7 +623,7 @@ static int usbhs_omap_probe(struct platform_device *pdev) }for (i =0 ; i < omap->nports; i++) { -char clkname[] ="usb_host_hs_utmi_px_clk" ; +char clkname[30 ];/* clock names are indexed from 1*/ snprintf(clkname, sizeof(clkname),
@@ -592,6 +637,20 @@ static int usbhs_omap_probe(struct platform_device *pdev)if (IS_ERR (omap->utmi_clk[i]))dev_dbg (dev,"Failed to get clock : %s : %ld\n" , clkname,PTR_ERR (omap->utmi_clk[i])); + +snprintf (clkname,sizeof (clkname), +"usb_host_hs_hsic480m_p%d_clk" , i +1 ); + omap->hsic480m_clk[i] =clk_get (dev, clkname); +if (IS_ERR (omap->hsic480m_clk[i])) +dev_dbg (dev,"Failed to get clock : %s : %ld\n" , + clkname,PTR_ERR (omap->hsic480m_clk[i])); + +snprintf (clkname,sizeof (clkname), +"usb_host_hs_hsic60m_p%d_clk" , i +1 ); + omap->hsic60m_clk[i] =clk_get (dev, clkname); +if (IS_ERR (omap->hsic60m_clk[i])) +dev_dbg (dev,"Failed to get clock : %s : %ld\n" , + clkname,PTR_ERR (omap->hsic60m_clk[i])); }if (is_ehci_phy_mode (pdata->port_mode[0 ])) {
@@ -635,9 +694,14 @@ static int usbhs_omap_probe(struct platform_device *pdev) err_alloc:omap_usbhs_deinit (&pdev->dev); -for (i =0 ; i < omap->nports; i++) +for (i =0 ; i < omap->nports; i++) {if (!IS_ERR (omap->utmi_clk[i]))clk_put (omap->utmi_clk[i]); +if (!IS_ERR (omap->hsic60m_clk[i])) +clk_put (omap->hsic60m_clk[i]); +if (!IS_ERR (omap->hsic480m_clk[i])) +clk_put (omap->hsic480m_clk[i]); + }clk_put (omap->init_60m_fclk);
@@ -676,9 +740,14 @@ static int usbhs_omap_remove(struct platform_device *pdev)omap_usbhs_deinit (&pdev->dev); -for (i =0 ; i < omap->nports; i++) +for (i =0 ; i < omap->nports; i++) {if (!IS_ERR (omap->utmi_clk[i]))clk_put (omap->utmi_clk[i]); +if (!IS_ERR (omap->hsic60m_clk[i])) +clk_put (omap->hsic60m_clk[i]); +if (!IS_ERR (omap->hsic480m_clk[i])) +clk_put (omap->hsic480m_clk[i]); + }clk_put (omap->init_60m_fclk);clk_put (omap->utmi_p1_gfclk);
Signature · 1 line
1.7.4.1
PATCH v9 17/20 mfd: omap-usb-host: Get rid of unnecessary spinlock
In reply to Roger QuadrosThe driver does not have an interrupt handler and we don't really need a spinlock, so get rid of it.
--- drivers/mfd/omap-usb-host.c | 16 ---------------- 1 files changed, 0 insertions(+), 16 deletions(-)
drivers/mfd/omap-usb-host.c +0 -16
@@ -23,7 +23,6 @@#include <linux/delay.h> #include <linux/clk.h> #include <linux/dma-mapping.h> -#include <linux/spinlock.h> #include <linux/gpio.h> #include <linux/platform_device.h> #include <linux/platform_data/usb-omap.h>
@@ -108,7 +107,6 @@ struct usbhs_hcd_omap {struct usbhs_omap_platform_data *pdata;u32 usbhs_rev; -spinlock_t lock; };/*-------------------------------------------------------------------------*/
@@ -276,13 +274,11 @@ static int usbhs_runtime_resume(struct device *dev) {struct usbhs_hcd_omap *omap =dev_get_drvdata (dev);struct usbhs_omap_platform_data *pdata = omap->pdata; -unsigned long flags;int i, r;dev_dbg (dev,"usbhs_runtime_resume\n" );omap_tll_enable (); -spin_lock_irqsave (&omap->lock, flags);if (!IS_ERR (omap->ehci_logic_fck))clk_enable (omap->ehci_logic_fck);
@@ -324,8 +320,6 @@ static int usbhs_runtime_resume(struct device *dev) } } -spin_unlock_irqrestore (&omap->lock, flags); -return 0 ; }
@@ -333,13 +327,10 @@ static int usbhs_runtime_suspend(struct device *dev) {struct usbhs_hcd_omap *omap =dev_get_drvdata (dev);struct usbhs_omap_platform_data *pdata = omap->pdata; -unsigned long flags;int i;dev_dbg (dev,"usbhs_runtime_suspend\n" ); -spin_lock_irqsave (&omap->lock, flags); -for (i =0 ; i < omap->nports; i++) {switch (pdata->port_mode[i]) {case OMAP_EHCI_PORT_MODE_HSIC :
@@ -362,7 +353,6 @@ static int usbhs_runtime_suspend(struct device *dev)if (!IS_ERR (omap->ehci_logic_fck))clk_disable (omap->ehci_logic_fck); -spin_unlock_irqrestore (&omap->lock, flags);omap_tll_disable ();return 0 ;
@@ -372,7 +362,6 @@ static void omap_usbhs_init(struct device *dev) {struct usbhs_hcd_omap *omap =dev_get_drvdata (dev);struct usbhs_omap_platform_data *pdata = omap->pdata; -unsigned long flags;unsigned reg;dev_dbg (dev,"starting TI HSUSB Controller\n" );
@@ -391,7 +380,6 @@ static void omap_usbhs_init(struct device *dev) }pm_runtime_get_sync (dev); -spin_lock_irqsave (&omap->lock, flags); reg =usbhs_read (omap->uhh_base,OMAP_UHH_HOSTCONFIG );/* setup ULPI bypass and burst configurations */
@@ -454,8 +442,6 @@ static void omap_usbhs_init(struct device *dev)usbhs_write (omap->uhh_base,OMAP_UHH_HOSTCONFIG , reg);dev_dbg (dev,"UHH setup done, uhh_hostconfig=%x\n" , reg); -spin_unlock_irqrestore (&omap->lock, flags); -pm_runtime_put_sync (dev);if (pdata->phy_reset) {/* Hold the PHY in RESET for enough time till
@@ -521,8 +507,6 @@ static int usbhs_omap_probe(struct platform_device *pdev)return -EADDRNOTAVAIL ; } -spin_lock_init (&omap->lock); - omap->pdata = pdata;pm_runtime_enable (dev);
Signature · 1 line
1.7.4.1
PATCH v9 18/20 mfd: omap-usb-host: clean up omap_usbhs_init()
In reply to Roger QuadrosWe split initializing revision 1 and revision 2 into different functions. Initialization is now done dynamically so that only the number of ports available on the system are initialized.
--- drivers/mfd/omap-usb-host.c | 129 +++++++++++++++++++++++++++---------------- 1 files changed, 81 insertions(+), 48 deletions(-)
drivers/mfd/omap-usb-host.c +81 -48
@@ -358,6 +358,75 @@ static int usbhs_runtime_suspend(struct device *dev)return 0 ; } +static unsigned omap_usbhs_rev1_hostconfig (struct usbhs_hcd_omap *omap, +unsigned reg) +{ +struct usbhs_omap_platform_data *pdata = omap->pdata; +int i; + +for (i =0 ; i < omap->nports; i++) { +switch (pdata->port_mode[i]) { +case OMAP_USBHS_PORT_MODE_UNUSED : + reg &= ~(OMAP_UHH_HOSTCONFIG_P1_CONNECT_STATUS << i); +break ; +case OMAP_EHCI_PORT_MODE_PHY : +if (pdata->single_ulpi_bypass) +break ; + +if (i ==0 ) + reg &= ~OMAP_UHH_HOSTCONFIG_ULPI_P1_BYPASS ; +else + reg &= ~(OMAP_UHH_HOSTCONFIG_ULPI_P2_BYPASS + << (i-1 )); +break ; +default : +if (pdata->single_ulpi_bypass) +break ; + +if (i ==0 ) + reg |=OMAP_UHH_HOSTCONFIG_ULPI_P1_BYPASS ; +else + reg |=OMAP_UHH_HOSTCONFIG_ULPI_P2_BYPASS + << (i-1 ); +break ; + } + } + +if (pdata->single_ulpi_bypass) { +/* bypass ULPI only if none of the ports use PHY mode */ + reg |=OMAP_UHH_HOSTCONFIG_ULPI_BYPASS ; + +for (i =0 ; i < omap->nports; i++) { +if (is_ehci_phy_mode (pdata->port_mode[i])) { + reg &=OMAP_UHH_HOSTCONFIG_ULPI_BYPASS ; +break ; + } + } + } + +return reg; +} + +static unsigned omap_usbhs_rev2_hostconfig (struct usbhs_hcd_omap *omap, +unsigned reg) +{ +struct usbhs_omap_platform_data *pdata = omap->pdata; +int i; + +for (i =0 ; i < omap->nports; i++) { +/* Clear port mode fields for PHY mode */ + reg &= ~(OMAP4_P1_MODE_CLEAR <<2 * i); + +if (is_ehci_tll_mode (pdata->port_mode[i]) || + (is_ohci_port (pdata->port_mode[i]))) + reg |=OMAP4_P1_MODE_TLL <<2 * i; +else if (is_ehci_hsic_mode (pdata->port_mode[i])) + reg |=OMAP4_P1_MODE_HSIC <<2 * i; + } + +return reg; +} +static void omap_usbhs_init (struct device *dev) {struct usbhs_hcd_omap *omap =dev_get_drvdata (dev);
@@ -389,54 +458,18 @@ static void omap_usbhs_init(struct device *dev) reg |=OMAP4_UHH_HOSTCONFIG_APP_START_CLK ; reg &= ~OMAP_UHH_HOSTCONFIG_INCRX_ALIGN_EN ; -if (is_omap_usbhs_rev1 (omap)) { -if (pdata->port_mode[0 ] ==OMAP_USBHS_PORT_MODE_UNUSED ) - reg &= ~OMAP_UHH_HOSTCONFIG_P1_CONNECT_STATUS ; -if (pdata->port_mode[1 ] ==OMAP_USBHS_PORT_MODE_UNUSED ) - reg &= ~OMAP_UHH_HOSTCONFIG_P2_CONNECT_STATUS ; -if (pdata->port_mode[2 ] ==OMAP_USBHS_PORT_MODE_UNUSED ) - reg &= ~OMAP_UHH_HOSTCONFIG_P3_CONNECT_STATUS ; - -/* Bypass the TLL module for PHY mode operation */ -if (pdata->single_ulpi_bypass) { -dev_dbg (dev,"OMAP3 ES version <= ES2.1\n" ); -if (is_ehci_phy_mode (pdata->port_mode[0 ]) || -is_ehci_phy_mode (pdata->port_mode[1 ]) || -is_ehci_phy_mode (pdata->port_mode[2 ])) - reg &= ~OMAP_UHH_HOSTCONFIG_ULPI_BYPASS ; -else - reg |=OMAP_UHH_HOSTCONFIG_ULPI_BYPASS ; - }else { -dev_dbg (dev,"OMAP3 ES version > ES2.1\n" ); -if (is_ehci_phy_mode (pdata->port_mode[0 ])) - reg &= ~OMAP_UHH_HOSTCONFIG_ULPI_P1_BYPASS ; -else - reg |=OMAP_UHH_HOSTCONFIG_ULPI_P1_BYPASS ; -if (is_ehci_phy_mode (pdata->port_mode[1 ])) - reg &= ~OMAP_UHH_HOSTCONFIG_ULPI_P2_BYPASS ; -else - reg |=OMAP_UHH_HOSTCONFIG_ULPI_P2_BYPASS ; -if (is_ehci_phy_mode (pdata->port_mode[2 ])) - reg &= ~OMAP_UHH_HOSTCONFIG_ULPI_P3_BYPASS ; -else - reg |=OMAP_UHH_HOSTCONFIG_ULPI_P3_BYPASS ; - } - }else if (is_omap_usbhs_rev2 (omap)) { -/* Clear port mode fields for PHY mode*/ - reg &= ~OMAP4_P1_MODE_CLEAR ; - reg &= ~OMAP4_P2_MODE_CLEAR ; - -if (is_ehci_tll_mode (pdata->port_mode[0 ]) || - (is_ohci_port (pdata->port_mode[0 ]))) - reg |=OMAP4_P1_MODE_TLL ; -else if (is_ehci_hsic_mode (pdata->port_mode[0 ])) - reg |=OMAP4_P1_MODE_HSIC ; - -if (is_ehci_tll_mode (pdata->port_mode[1 ]) || - (is_ohci_port (pdata->port_mode[1 ]))) - reg |=OMAP4_P2_MODE_TLL ; -else if (is_ehci_hsic_mode (pdata->port_mode[1 ])) - reg |=OMAP4_P2_MODE_HSIC ; +switch (omap->usbhs_rev) { +case OMAP_USBHS_REV1 : +omap_usbhs_rev1_hostconfig (omap, reg); +break ; + +case OMAP_USBHS_REV2 : +omap_usbhs_rev2_hostconfig (omap, reg); +break ; + +default :/* newer revisions */ +omap_usbhs_rev2_hostconfig (omap, reg); +break ; }usbhs_write (omap->uhh_base,OMAP_UHH_HOSTCONFIG , reg);
Signature · 1 line
1.7.4.1
PATCH v9 19/20 mfd: omap-usb-host: Don't spam console on clk_set_parent failure
In reply to Roger Quadrosclk_set_parent is expected to fail on OMAP3 platforms. We don't consider that as fatal so don't spam console.
--- drivers/mfd/omap-usb-host.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-)
drivers/mfd/omap-usb-host.c +9 -9
@@ -671,32 +671,32 @@ static int usbhs_omap_probe(struct platform_device *pdev) }if (is_ehci_phy_mode (pdata->port_mode[0 ])) { -/* for OMAP3 , the clk set paretn fails */ +/* for OMAP3, clk_set_parent fails */ ret =clk_set_parent (omap->utmi_p1_gfclk, omap->xclk60mhsp1_ck);if (ret !=0 ) -dev_err (dev,"xclk60mhsp1_ck set parent" -"failed error:%d\n" , ret); +dev_dbg (dev,"xclk60mhsp1_ck set parent failed: %d\n" , + ret); }else if (is_ehci_tll_mode (pdata->port_mode[0 ])) { ret =clk_set_parent (omap->utmi_p1_gfclk, omap->init_60m_fclk);if (ret !=0 ) -dev_err (dev,"init_60m_fclk set parent" -"failed error:%d\n" , ret); +dev_dbg (dev,"P0 init_60m_fclk set parent failed: %d\n" , + ret); }if (is_ehci_phy_mode (pdata->port_mode[1 ])) { ret =clk_set_parent (omap->utmi_p2_gfclk, omap->xclk60mhsp2_ck);if (ret !=0 ) -dev_err (dev,"xclk60mhsp2_ck set parent" -"failed error:%d\n" , ret); +dev_dbg (dev,"xclk60mhsp2_ck set parent failed: %d\n" , + ret); }else if (is_ehci_tll_mode (pdata->port_mode[1 ])) { ret =clk_set_parent (omap->utmi_p2_gfclk, omap->init_60m_fclk);if (ret !=0 ) -dev_err (dev,"init_60m_fclk set parent" -"failed error:%d\n" , ret); +dev_dbg (dev,"P1 init_60m_fclk set parent failed: %d\n" , + ret); }omap_usbhs_init (dev);
Signature · 1 line
1.7.4.1
PATCH v9 20/20 mdf: omap-usb-host: get rid of build warning
In reply to Roger QuadrosFixes the below build warning when driver is built-in.
drivers/mfd/omap-usb-host.c:750:12: warning:
?usbhs_omap_remove? defined but not used [-Wunused-function]
--- drivers/mfd/omap-usb-host.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mfd/omap-usb-host.c +1 -1
@@ -791,7 +791,7 @@ static struct platform_driver usbhs_omap_driver = { .owner = THIS_MODULE, .pm = &usbhsomap_dev_pm_ops, }, - .remove = __exit_p(usbhs_omap_remove), + .remove = usbhs_omap_remove, };MODULE_AUTHOR ("Keshava Munegowda <[email protected]>" );
Signature · 1 line
1.7.4.1
Re: [PATCH v9 20/20] mdf: omap-usb-host: get rid of build warning
Quoting Roger Quadros (2013-01-23 02:38:12)
Quoted 7 lines
Fixes the below build warning when driver is built-in.
drivers/mfd/omap-usb-host.c:750:12: warning:
?usbhs_omap_remove? defined but not used [-Wunused-function]Signed-off-by Roger Quadros <[email protected]>Reviewed-by Felipe Balbi <[email protected]>
Hi Roger,
I just noticed that $SUBJECT says "mdf" instead of "mfd" ;)
Regards,
Mike
Quoted 25 lines
--- drivers/mfd/omap-usb-host.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/mfd/omap-usb-host.c +1
-1@@ -791,7 +791,7 @@ static struct platform_driver usbhs_omap_driver = { .owner = THIS_MODULE, .pm = &usbhsomap_dev_pm_ops, }, - .remove = __exit_p(usbhs_omap_remove), + .remove = usbhs_omap_remove, };MODULE_AUTHOR ("Keshava Munegowda <[email protected]>" );Signature · 7 lines
1.7.4.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH v9 20/20] mdf: omap-usb-host: get rid of build warning
Quoted 6 lines · Mike Turquette
Quoting Roger Quadros (2013-01-23 02:38:12)
Quoted 5 lines
Fixes the below build warning when driver is built-in.
drivers/mfd/omap-usb-host.c:750:12: warning:
?usbhs_omap_remove? defined but not used [-Wunused-function]
Quoted 7 lines
Quoted 2 lines
Signed-off-by Roger Quadros <[email protected]>Reviewed-by Felipe Balbi <[email protected]>Hi Roger,
I just noticed that $SUBJECT says "mdf" instead of "mfd" ;)
Thanks Mike. I've fixed it in the pull request and i'll mail a patch as well.
cheers,
-roger.
Quoted 26 lines
Quoted 26 lines
--- drivers/mfd/omap-usb-host.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/mfd/omap-usb-host.c +1
-1@@ -791,7 +791,7 @@ static struct platform_driver usbhs_omap_driver = { .owner = THIS_MODULE, .pm = &usbhsomap_dev_pm_ops, }, - .remove = __exit_p(usbhs_omap_remove), + .remove = usbhs_omap_remove, };MODULE_AUTHOR ("Keshava Munegowda <[email protected]>" );Signature · 7 lines
1.7.4.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v10 20/20 mfd: omap-usb-host: get rid of build warning
In reply to Mike TurquetteFixes the below build warning when driver is built-in.
drivers/mfd/omap-usb-host.c:750:12: warning:
?usbhs_omap_remove? defined but not used [-Wunused-function]
--- drivers/mfd/omap-usb-host.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mfd/omap-usb-host.c +1 -1
@@ -791,7 +791,7 @@ static struct platform_driver usbhs_omap_driver = { .owner = THIS_MODULE, .pm = &usbhsomap_dev_pm_ops, }, - .remove = __exit_p(usbhs_omap_remove), + .remove = usbhs_omap_remove, };MODULE_AUTHOR ("Keshava Munegowda <[email protected]>" );
Signature · 1 line
1.7.4.1
Hi Samuel,
Could you please pull this if it looks OK? Thanks :).
cheers,
-roger
Quoted 114 lines · Roger Quadros
Hi Samuel,
I think this series is in a pretty good shape to pull now :). I've added Reviewed-by and Acked-by tags. You can please pull from below.
NOTE: the first patch is a stable fix so Greg KH might want to pick it up for 3.8-rc.
The following changes since commit
7d1f9aeff1ee4a20b1aeb377dd0f579fe9647619:Linux 3.8-rc4 (2013-01-17 19:25:45 -0800)
are available in the git repository at:
git://github.com/rogerq/linux.gitlinux-usbhost14-partThis patchset addresses the following
- Consolidate USB Host platform data.
- Avoid addressing clocks one by one by name and use a for loop + bunch of cleanups.
- Get number of channels/ports dynamically either from revision register or from platform data. Avoids getting clocks that are not present.
- Add OMAP5 and HSIC mode (Not tested).v9:
- Addressed clock framework related comments from Russell King.
- Removed 2 clock data patches from the series as they will be taken care of by Paul Walmsey.v8:
- Re-arranged patch "USB-ehci-omap-Don-t-free-gpios-that-we-didn-t-reques.patch" to be the first since it is a candidate for stable.
- Fixed issues raised by Felipe, i.e. indentation and use of switch ()v7:
- Updated patch 4 to not hold a spinlock when usingclk_get().
- Updated patches 3 and 11 to return-EADDRNOTAVAILon failure ofdemv_request_and_ioremap().v6:
- Added USB Host platform data consolidation patch as the first patch. based on request from Tony.
- Rebased on v3.8-rc3.v5:
- Rebased on top of todays arm-soc/for-next.
- Removed the clock merging patch from the list.
- Updated patches 14, 19 and 20 to accomodate the above change.
- Added patch 22 to fix a build warning.v4:
- Added appropriate maintainers in to/cc.
- minor print message fix in patch 23 to maintain consistency.v3:
- Rebased on arm-soc/for-next commitf979306c4d38d213c6977aaf3b1115e8ded71e3a.
- Rearranged patch that get rids of cpu_is_omap..() macros.
- Coding style fixes.v2:
- Clocks are allocated dynamically based on number of ports available on the platform.
- Reduced console spam if non critical clocks are not found on the platform.
- Get rid ofcpu_is_.. macros from USB host driver.cheers,
-roger---
Roger Quadros (20):
USB: ehci-omap: Don't free gpios that we didn't request
mfd: omap-usb-host: Consolidate OMAP USB-HS platform data
mfd: omap-usb-tll: Fix channel count detection
mfd: omap-usb-tll: Use devm_kzalloc/ioremap and clean up error path
mfd: omap-usb-tll: Clean up clock handling
mfd: omap-usb-tll: introduce and usemode_needs_tll()
mfd: omap-usb-tll: Check for missing platform data in probe
mfd: omap-usb-tll: Fix error message
mfd: omap-usb-tll: serialize access to TLL device
mfd: omap-usb-tll: Add OMAP5 revision and HSIC support
mfd:omap_usb_host: Avoid missing platform data checks in suspend/resume
mfd: omap-usb-host: Usedevm_kzalloc()anddevm_request_and_ioremap()
mfd: omap-usb-host: know about number of ports from revision register
mfd: omap-usb-host: override number of ports from platform data
mfd: omap-usb-host: cleanup clock management code
mfd: omap-usb-host: Manage HSIC clocks for HSIC mode
mfd: omap-usb-host: Get rid of unnecessary spinlock
mfd: omap-usb-host: clean upomap_usbhs_init()
mfd: omap-usb-host: Don't spam console onclk_set_parentfailure
mdf: omap-usb-host: get rid of build warningarch/arm/mach-omap2/board-3430sdp.c | 2 +- arch/arm/mach-omap2/board-3630sdp.c | 2 +- arch/arm/mach-omap2/board-am3517crane.c | 2 +- arch/arm/mach-omap2/board-am3517evm.c | 2 +- arch/arm/mach-omap2/board-cm-t35.c | 2 +- arch/arm/mach-omap2/board-cm-t3517.c | 2 +- arch/arm/mach-omap2/board-devkit8000.c | 2 +- arch/arm/mach-omap2/board-igep0020.c | 4 +- arch/arm/mach-omap2/board-omap3beagle.c | 2 +- arch/arm/mach-omap2/board-omap3evm.c | 2 +- arch/arm/mach-omap2/board-omap3pandora.c | 2 +- arch/arm/mach-omap2/board-omap3stalker.c | 2 +- arch/arm/mach-omap2/board-omap3touchbook.c | 2 +- arch/arm/mach-omap2/board-omap4panda.c | 2 +- arch/arm/mach-omap2/board-overo.c | 2 +- arch/arm/mach-omap2/board-zoom.c | 2 +- arch/arm/mach-omap2/usb-host.c | 29 +-- arch/arm/mach-omap2/usb.h | 20 +- drivers/mfd/omap-usb-host.c | 558 +++++++++++++++++----------- drivers/mfd/omap-usb-tll.c | 243 +++++++------ drivers/usb/host/ehci-omap.c | 14 +- include/linux/platform_data/usb-omap.h | 24 +- 22 files changed, 497 insertions(+), 425 deletions(-)
Samuel Ortiz
AppliedHi Roger,
Quoted 23 lines · Roger Quadros
Hi Samuel,
I think this series is in a pretty good shape to pull now :). I've added Reviewed-by and Acked-by tags. You can please pull from below.
NOTE: the first patch is a stable fix so Greg KH might want to pick it up for 3.8-rc.
The following changes since commit
7d1f9aeff1ee4a20b1aeb377dd0f579fe9647619:Linux 3.8-rc4 (2013-01-17 19:25:45 -0800)
are available in the git repository at:
git://github.com/rogerq/linux.gitlinux-usbhost14-partThis patchset addresses the following
- Consolidate USB Host platform data.
- Avoid addressing clocks one by one by name and use a for loop + bunch of cleanups.
- Get number of channels/ports dynamically either from revision register or from platform data. Avoids getting clocks that are not present.
- Add OMAP5 and HSIC mode (Not tested).
Quoted 4 lines
v9:
- Addressed clock framework related comments from Russell King.
- Removed 2 clock data patches from the series as they will be taken care of by Paul Walmsey.
Applied all 20 patches, thanks.
Cheers,
Samuel.
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/