Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c9083dd3 authored by Vladimir Zapolskiy's avatar Vladimir Zapolskiy Committed by Felipe Balbi
Browse files

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: default avatarVladimir Zapolskiy <vz@mleia.com>
Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
parent 68726e77
Loading
Loading
Loading
Loading
+0 −29
Original line number Original line Diff line number Diff line
@@ -49,7 +49,6 @@
#endif
#endif


#include <mach/hardware.h>
#include <mach/hardware.h>
#include <mach/platform.h>


/*
/*
 * USB device configuration structure
 * USB device configuration structure
@@ -210,16 +209,6 @@ static inline struct lpc32xx_udc *to_udc(struct usb_gadget *g)


#define UDCA_BUFF_SIZE (128)
#define UDCA_BUFF_SIZE (128)


/* TODO: When the clock framework is introduced in LPC32xx, IO_ADDRESS will
 * be replaced with an inremap()ed pointer
 * */
#define USB_CTRL		IO_ADDRESS(LPC32XX_CLK_PM_BASE + 0x64)

/* USB_CTRL bit defines */
#define USB_SLAVE_HCLK_EN	(1 << 24)
#define USB_HOST_NEED_CLK_EN	(1 << 21)
#define USB_DEV_NEED_CLK_EN	(1 << 22)

/**********************************************************************
/**********************************************************************
 * USB device controller register offsets
 * USB device controller register offsets
 **********************************************************************/
 **********************************************************************/
@@ -639,9 +628,6 @@ static void isp1301_udc_configure(struct lpc32xx_udc *udc)
	i2c_smbus_write_byte_data(udc->isp1301_i2c_client,
	i2c_smbus_write_byte_data(udc->isp1301_i2c_client,
		ISP1301_I2C_INTERRUPT_RISING, INT_VBUS_VLD);
		ISP1301_I2C_INTERRUPT_RISING, INT_VBUS_VLD);


	/* Enable usb_need_clk clock after transceiver is initialized */
	writel((readl(USB_CTRL) | USB_DEV_NEED_CLK_EN), USB_CTRL);

	dev_info(udc->dev, "ISP1301 Vendor ID  : 0x%04x\n",
	dev_info(udc->dev, "ISP1301 Vendor ID  : 0x%04x\n",
		 i2c_smbus_read_word_data(udc->isp1301_i2c_client, 0x00));
		 i2c_smbus_read_word_data(udc->isp1301_i2c_client, 0x00));
	dev_info(udc->dev, "ISP1301 Product ID : 0x%04x\n",
	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)


		/* 48MHz PLL up */
		/* 48MHz PLL up */
		clk_prepare_enable(udc->usb_pll_clk);
		clk_prepare_enable(udc->usb_pll_clk);

		/* Enable the USB device clock */
		writel(readl(USB_CTRL) | USB_DEV_NEED_CLK_EN,
			     USB_CTRL);

		clk_prepare_enable(udc->usb_otg_clk);
		clk_prepare_enable(udc->usb_otg_clk);
	} else {
	} else {
		if (!udc->clocked)
		if (!udc->clocked)
@@ -999,11 +980,6 @@ static void udc_clk_set(struct lpc32xx_udc *udc, int enable)


		/* 48MHz PLL dpwn */
		/* 48MHz PLL dpwn */
		clk_disable_unprepare(udc->usb_pll_clk);
		clk_disable_unprepare(udc->usb_pll_clk);

		/* Disable the USB device clock */
		writel(readl(USB_CTRL) & ~USB_DEV_NEED_CLK_EN,
			     USB_CTRL);

		clk_disable_unprepare(udc->usb_otg_clk);
		clk_disable_unprepare(udc->usb_otg_clk);
	}
	}
}
}
@@ -3125,9 +3101,6 @@ static int lpc32xx_udc_probe(struct platform_device *pdev)
		goto io_map_fail;
		goto io_map_fail;
	}
	}


	/* Enable AHB slave USB clock, needed for further USB clock control */
	writel(USB_SLAVE_HCLK_EN | (1 << 19), USB_CTRL);

	/* Get required clocks */
	/* Get required clocks */
	udc->usb_pll_clk = clk_get(&pdev->dev, "ck_pll5");
	udc->usb_pll_clk = clk_get(&pdev->dev, "ck_pll5");
	if (IS_ERR(udc->usb_pll_clk)) {
	if (IS_ERR(udc->usb_pll_clk)) {
@@ -3161,8 +3134,6 @@ static int lpc32xx_udc_probe(struct platform_device *pdev)
		goto pll_set_fail;
		goto pll_set_fail;
	}
	}


	writel(readl(USB_CTRL) | USB_DEV_NEED_CLK_EN, USB_CTRL);

	/* Enable USB device clock */
	/* Enable USB device clock */
	retval = clk_prepare_enable(udc->usb_slv_clk);
	retval = clk_prepare_enable(udc->usb_slv_clk);
	if (retval < 0) {
	if (retval < 0) {