aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimir Zapolskiy <vz@mleia.com>2016-03-02 23:52:58 -0500
committerFelipe Balbi <balbi@kernel.org>2016-03-04 08:14:49 -0500
commitc9083dd34a9f0b39ee343d6f3d115b42e2034bfe (patch)
tree79693fd7984ea7d998e24d87f3d2045f780c5255
parent68726e772d3d2a65a4ea593a6cbde21a9700985a (diff)
usb: udc: lpc32xx: remove direct access to clock controller registers
Direct access to clock control registers can be safely removed, the task of clock management is done by platform clock driver based on common clock framework. Signed-off-by: Vladimir Zapolskiy <vz@mleia.com> Signed-off-by: Felipe Balbi <balbi@kernel.org>
-rw-r--r--drivers/usb/gadget/udc/lpc32xx_udc.c29
1 files changed, 0 insertions, 29 deletions
diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c b/drivers/usb/gadget/udc/lpc32xx_udc.c
index bb8737ad2c87..2b8f21f5b5b5 100644
--- a/drivers/usb/gadget/udc/lpc32xx_udc.c
+++ b/drivers/usb/gadget/udc/lpc32xx_udc.c
@@ -49,7 +49,6 @@
49#endif 49#endif
50 50
51#include <mach/hardware.h> 51#include <mach/hardware.h>
52#include <mach/platform.h>
53 52
54/* 53/*
55 * USB device configuration structure 54 * USB device configuration structure
@@ -210,16 +209,6 @@ static inline struct lpc32xx_udc *to_udc(struct usb_gadget *g)
210 209
211#define UDCA_BUFF_SIZE (128) 210#define UDCA_BUFF_SIZE (128)
212 211
213/* TODO: When the clock framework is introduced in LPC32xx, IO_ADDRESS will
214 * be replaced with an inremap()ed pointer
215 * */
216#define USB_CTRL IO_ADDRESS(LPC32XX_CLK_PM_BASE + 0x64)
217
218/* USB_CTRL bit defines */
219#define USB_SLAVE_HCLK_EN (1 << 24)
220#define USB_HOST_NEED_CLK_EN (1 << 21)
221#define USB_DEV_NEED_CLK_EN (1 << 22)
222
223/********************************************************************** 212/**********************************************************************
224 * USB device controller register offsets 213 * USB device controller register offsets
225 **********************************************************************/ 214 **********************************************************************/
@@ -639,9 +628,6 @@ static void isp1301_udc_configure(struct lpc32xx_udc *udc)
639 i2c_smbus_write_byte_data(udc->isp1301_i2c_client, 628 i2c_smbus_write_byte_data(udc->isp1301_i2c_client,
640 ISP1301_I2C_INTERRUPT_RISING, INT_VBUS_VLD); 629 ISP1301_I2C_INTERRUPT_RISING, INT_VBUS_VLD);
641 630
642 /* Enable usb_need_clk clock after transceiver is initialized */
643 writel((readl(USB_CTRL) | USB_DEV_NEED_CLK_EN), USB_CTRL);
644
645 dev_info(udc->dev, "ISP1301 Vendor ID : 0x%04x\n", 631 dev_info(udc->dev, "ISP1301 Vendor ID : 0x%04x\n",
646 i2c_smbus_read_word_data(udc->isp1301_i2c_client, 0x00)); 632 i2c_smbus_read_word_data(udc->isp1301_i2c_client, 0x00));
647 dev_info(udc->dev, "ISP1301 Product ID : 0x%04x\n", 633 dev_info(udc->dev, "ISP1301 Product ID : 0x%04x\n",
@@ -983,11 +969,6 @@ static void udc_clk_set(struct lpc32xx_udc *udc, int enable)
983 969
984 /* 48MHz PLL up */ 970 /* 48MHz PLL up */
985 clk_prepare_enable(udc->usb_pll_clk); 971 clk_prepare_enable(udc->usb_pll_clk);
986
987 /* Enable the USB device clock */
988 writel(readl(USB_CTRL) | USB_DEV_NEED_CLK_EN,
989 USB_CTRL);
990
991 clk_prepare_enable(udc->usb_otg_clk); 972 clk_prepare_enable(udc->usb_otg_clk);
992 } else { 973 } else {
993 if (!udc->clocked) 974 if (!udc->clocked)
@@ -999,11 +980,6 @@ static void udc_clk_set(struct lpc32xx_udc *udc, int enable)
999 980
1000 /* 48MHz PLL dpwn */ 981 /* 48MHz PLL dpwn */
1001 clk_disable_unprepare(udc->usb_pll_clk); 982 clk_disable_unprepare(udc->usb_pll_clk);
1002
1003 /* Disable the USB device clock */
1004 writel(readl(USB_CTRL) & ~USB_DEV_NEED_CLK_EN,
1005 USB_CTRL);
1006
1007 clk_disable_unprepare(udc->usb_otg_clk); 983 clk_disable_unprepare(udc->usb_otg_clk);
1008 } 984 }
1009} 985}
@@ -3125,9 +3101,6 @@ static int lpc32xx_udc_probe(struct platform_device *pdev)
3125 goto io_map_fail; 3101 goto io_map_fail;
3126 } 3102 }
3127 3103
3128 /* Enable AHB slave USB clock, needed for further USB clock control */
3129 writel(USB_SLAVE_HCLK_EN | (1 << 19), USB_CTRL);
3130
3131 /* Get required clocks */ 3104 /* Get required clocks */
3132 udc->usb_pll_clk = clk_get(&pdev->dev, "ck_pll5"); 3105 udc->usb_pll_clk = clk_get(&pdev->dev, "ck_pll5");
3133 if (IS_ERR(udc->usb_pll_clk)) { 3106 if (IS_ERR(udc->usb_pll_clk)) {
@@ -3161,8 +3134,6 @@ static int lpc32xx_udc_probe(struct platform_device *pdev)
3161 goto pll_set_fail; 3134 goto pll_set_fail;
3162 } 3135 }
3163 3136
3164 writel(readl(USB_CTRL) | USB_DEV_NEED_CLK_EN, USB_CTRL);
3165
3166 /* Enable USB device clock */ 3137 /* Enable USB device clock */
3167 retval = clk_prepare_enable(udc->usb_slv_clk); 3138 retval = clk_prepare_enable(udc->usb_slv_clk);
3168 if (retval < 0) { 3139 if (retval < 0) {