]> git.sur5r.net Git - u-boot/commitdiff
drivers: usb: musb: adopt musb backend driver to driver model
authorMugunthan V N <mugunthanvnm@ti.com>
Thu, 17 Nov 2016 09:08:10 +0000 (14:38 +0530)
committerSimon Glass <sjg@chromium.org>
Sat, 3 Dec 2016 04:04:48 +0000 (21:04 -0700)
Currently all backend driver ops uses hard coded physical
address, so to adopt the driver to DM, add device pointer to ops
call backs so that drivers can get physical addresses from the
usb driver priv/plat data.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
arch/arm/include/asm/arch-omap3/musb.h
arch/arm/include/asm/omap_musb.h
arch/arm/mach-omap2/am33xx/board.c
arch/arm/mach-omap2/omap3/am35x_musb.c
drivers/usb/musb-new/am35x.c
drivers/usb/musb-new/musb_dsps.c

index cee4ed311e2f811400c8636fa44b7d959eb40191..d06a758f1b07b5b67eda90f2f81f10f8938863f0 100644 (file)
@@ -7,7 +7,7 @@
 
 #ifndef __ASM_ARCH_OMAP3_MUSB_H
 #define __ASM_ARCH_OMAP3_MUSB_H
-extern void am35x_musb_reset(void);
-extern void am35x_musb_phy_power(u8 on);
-extern void am35x_musb_clear_irq(void);
+void am35x_musb_reset(struct udevice *dev);
+void am35x_musb_phy_power(struct udevice *dev, u8 on);
+void am35x_musb_clear_irq(struct udevice *dev);
 #endif
index 8b9cb0eb8f6134ef087a4929f711e52d542bc8a7..7c5fb4077443a8f84e4e610ea89c27247f4a03cb 100644 (file)
@@ -15,9 +15,10 @@ extern const struct musb_platform_ops omap2430_ops;
 
 struct omap_musb_board_data {
        u8 interface_type;
-       void (*set_phy_power)(u8 on);
-       void (*clear_irq)(void);
-       void (*reset)(void);
+       struct udevice *dev;
+       void (*set_phy_power)(struct udevice *dev, u8 on);
+       void (*clear_irq)(struct udevice *dev);
+       void (*reset)(struct udevice *dev);
 };
 
 enum musb_interface    {MUSB_INTERFACE_ULPI, MUSB_INTERFACE_UTMI};
index 2ce7790be6c7daa3a8ce07e74ddec2f31e498083..581c0ab518b2f88bf86a914e0c3202d63c376db5 100644 (file)
@@ -148,7 +148,7 @@ static struct musb_hdrc_config musb_config = {
 };
 
 #ifdef CONFIG_AM335X_USB0
-static void am33xx_otg0_set_phy_power(u8 on)
+static void am33xx_otg0_set_phy_power(struct udevice *dev, u8 on)
 {
        am33xx_usb_set_phy_power(on, &cdev->usb_ctrl0);
 }
@@ -167,7 +167,7 @@ static struct musb_hdrc_platform_data otg0_plat = {
 #endif
 
 #ifdef CONFIG_AM335X_USB1
-static void am33xx_otg1_set_phy_power(u8 on)
+static void am33xx_otg1_set_phy_power(struct udevice *dev, u8 on)
 {
        am33xx_usb_set_phy_power(on, &cdev->usb_ctrl1);
 }
index 74dd105eb6f59cc320cb010b231ec832e4de938e..d542699ab001540862f08b471e61970d8d6f24c2 100644 (file)
@@ -13,7 +13,7 @@
 #include <asm/io.h>
 #include <asm/arch/am35x_def.h>
 
-void am35x_musb_reset(void)
+void am35x_musb_reset(struct udevice *dev)
 {
        /* Reset the musb interface */
        clrsetbits_le32(&am35x_scm_general_regs->ip_sw_reset,
@@ -22,7 +22,7 @@ void am35x_musb_reset(void)
                        USBOTGSS_SW_RST, 0);
 }
 
-void am35x_musb_phy_power(u8 on)
+void am35x_musb_phy_power(struct udevice *dev, u8 on)
 {
        unsigned long start = get_timer(0);
 
@@ -53,7 +53,7 @@ void am35x_musb_phy_power(u8 on)
        }
 }
 
-void am35x_musb_clear_irq(void)
+void am35x_musb_clear_irq(struct udevice *dev)
 {
        clrsetbits_le32(&am35x_scm_general_regs->lvl_intr_clr,
                        0, USBOTGSS_INT_CLR);
index b8791ddd5c1dc28a6dfd384ec787ddfdc51c4269..0167ea77970c043905fc6cb4e16cf9d63415d30f 100644 (file)
@@ -336,7 +336,7 @@ eoi:
        if (ret == IRQ_HANDLED || epintr || usbintr) {
                /* clear level interrupt */
                if (data->clear_irq)
-                       data->clear_irq();
+                       data->clear_irq(data->dev);
                /* write EOI */
                musb_writel(reg_base, USB_END_OF_INTR_REG, 0);
        }
@@ -401,14 +401,14 @@ static int am35x_musb_init(struct musb *musb)
 
        /* Reset the musb */
        if (data->reset)
-               data->reset();
+               data->reset(data->dev);
 
        /* Reset the controller */
        musb_writel(reg_base, USB_CTRL_REG, AM35X_SOFT_RESET_MASK);
 
        /* Start the on-chip PHY and its PLL. */
        if (data->set_phy_power)
-               data->set_phy_power(1);
+               data->set_phy_power(data->dev, 1);
 
        msleep(5);
 
@@ -416,7 +416,7 @@ static int am35x_musb_init(struct musb *musb)
 
        /* clear level interrupt */
        if (data->clear_irq)
-               data->clear_irq();
+               data->clear_irq(data->dev);
 
        return 0;
 }
@@ -439,7 +439,7 @@ static int am35x_musb_exit(struct musb *musb)
 
        /* Shutdown the on-chip PHY and its PLL. */
        if (data->set_phy_power)
-               data->set_phy_power(0);
+               data->set_phy_power(data->dev, 0);
 
 #ifndef __UBOOT__
        usb_put_phy(musb->xceiv);
@@ -630,7 +630,7 @@ static int am35x_suspend(struct device *dev)
 
        /* Shutdown the on-chip PHY and its PLL. */
        if (data->set_phy_power)
-               data->set_phy_power(0);
+               data->set_phy_power(data->dev, 0);
 
        clk_disable(glue->phy_clk);
        clk_disable(glue->clk);
@@ -647,7 +647,7 @@ static int am35x_resume(struct device *dev)
 
        /* Start the on-chip PHY and its PLL. */
        if (data->set_phy_power)
-               data->set_phy_power(1);
+               data->set_phy_power(data->dev, 1);
 
        ret = clk_enable(glue->phy_clk);
        if (ret) {
index a71db76d7c7c4b44c073dda60ddfaa13c82951ad..399b85bbce814c1ea865d8afa4eab9c4e33d0c4b 100644 (file)
@@ -452,7 +452,7 @@ static int dsps_musb_init(struct musb *musb)
 
        /* Start the on-chip PHY and its PLL. */
        if (data->set_phy_power)
-               data->set_phy_power(1);
+               data->set_phy_power(data->dev, 1);
 
        musb->isr = dsps_interrupt;
 
@@ -493,7 +493,7 @@ static int dsps_musb_exit(struct musb *musb)
 
        /* Shutdown the on-chip PHY and its PLL. */
        if (data->set_phy_power)
-               data->set_phy_power(0);
+               data->set_phy_power(data->dev, 0);
 
 #ifndef __UBOOT__
        /* NOP driver needs change if supporting dual instance */
@@ -693,7 +693,7 @@ static int dsps_suspend(struct device *dev)
 
        /* Shutdown the on-chip PHY and its PLL. */
        if (data->set_phy_power)
-               data->set_phy_power(0);
+               data->set_phy_power(data->dev, 0);
 
        return 0;
 }
@@ -705,7 +705,7 @@ static int dsps_resume(struct device *dev)
 
        /* Start the on-chip PHY and its PLL. */
        if (data->set_phy_power)
-               data->set_phy_power(1);
+               data->set_phy_power(data->dev, 1);
 
        return 0;
 }