usb: s3c-otg: Encapsulate PHY control
authorMarek Vasut <marex@denx.de>
Tue, 4 Nov 2014 03:08:18 +0000 (04:08 +0100)
committerChanho Park <chanho61.park@samsung.com>
Fri, 24 Jul 2015 07:30:02 +0000 (16:30 +0900)
Encapsulate the Samsung PHY control and its register accesses
into the otg_phy_init() and otg_phy_off() functions.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Chin Liang See <clsee@altera.com>
Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
Cc: Vince Bridgers <vbridger@altera.com>
Cc: Stefan Roese <sr@denx.de>
Acked-by: Pavel Machek <pavel@denx.de>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Tested-by: Lukasz Majewski <l.majewski@samsung.com>
drivers/usb/gadget/s3c_udc_otg.c

index 94bfcec45077c4d4066807e2ef90360d23beb73d..93585dc20cc072bb22ebd2762b39fb91ba068700 100644 (file)
@@ -159,8 +159,6 @@ static struct usb_ep_ops s3c_ep_ops = {
 
 void __iomem           *regs_otg;
 struct s3c_usbotg_reg *reg;
-struct s3c_usbotg_phy *phy;
-static unsigned int usb_phy_ctrl;
 
 bool dfu_usb_get_reset(void)
 {
@@ -169,6 +167,10 @@ bool dfu_usb_get_reset(void)
 
 void otg_phy_init(struct s3c_udc *dev)
 {
+       unsigned int usb_phy_ctrl = dev->pdata->usb_phy_ctrl;
+       struct s3c_usbotg_phy *phy =
+               (struct s3c_usbotg_phy *)dev->pdata->regs_phy;
+
        dev->pdata->phy_control(1);
 
        /*USB PHY0 Enable */
@@ -203,6 +205,10 @@ void otg_phy_init(struct s3c_udc *dev)
 
 void otg_phy_off(struct s3c_udc *dev)
 {
+       unsigned int usb_phy_ctrl = dev->pdata->usb_phy_ctrl;
+       struct s3c_usbotg_phy *phy =
+               (struct s3c_usbotg_phy *)dev->pdata->regs_phy;
+
        /* reset controller just in case */
        writel(PHY_SW_RST0, &phy->rstcon);
        udelay(20);
@@ -867,9 +873,7 @@ int s3c_udc_probe(struct s3c_plat_otg_data *pdata)
 
        dev->pdata = pdata;
 
-       phy = (struct s3c_usbotg_phy *)pdata->regs_phy;
        reg = (struct s3c_usbotg_reg *)pdata->regs_otg;
-       usb_phy_ctrl = pdata->usb_phy_ctrl;
 
        /* regs_otg = (void *)pdata->regs_otg; */