Merge branch 'imx/clk' into next/clk
* imx/clk: ARM: mxs: select HAVE_CLK_PREPARE for clock clk: add config option HAVE_CLK_PREPARE into Kconfig ASoC: mxs-saif: convert to clk_prepare/clk_unprepare video: mxsfb: convert to clk_prepare/clk_unprepare serial: mxs-auart: convert to clk_prepare/clk_unprepare net: flexcan: convert to clk_prepare/clk_unprepare mtd: gpmi-lib: convert to clk_prepare/clk_unprepare mmc: mxs-mmc: convert to clk_prepare/clk_unprepare dma: mxs-dma: convert to clk_prepare/clk_unprepare net: fec: add clk_prepare/clk_unprepare ARM: mxs: convert platform code to clk_prepare/clk_unprepare clk: add helper functions clk_prepare_enable and clk_disable_unprepare
This commit is contained in:
Коммит
8c3b2296f1
|
@ -442,6 +442,7 @@ config ARCH_MXS
|
||||||
select ARCH_REQUIRE_GPIOLIB
|
select ARCH_REQUIRE_GPIOLIB
|
||||||
select CLKDEV_LOOKUP
|
select CLKDEV_LOOKUP
|
||||||
select CLKSRC_MMIO
|
select CLKSRC_MMIO
|
||||||
|
select HAVE_CLK_PREPARE
|
||||||
help
|
help
|
||||||
Support for Freescale MXS-based family of processors
|
Support for Freescale MXS-based family of processors
|
||||||
|
|
||||||
|
|
|
@ -545,11 +545,11 @@ int __init mx23_clocks_init(void)
|
||||||
*/
|
*/
|
||||||
clk_set_parent(&ssp_clk, &ref_io_clk);
|
clk_set_parent(&ssp_clk, &ref_io_clk);
|
||||||
|
|
||||||
clk_enable(&cpu_clk);
|
clk_prepare_enable(&cpu_clk);
|
||||||
clk_enable(&hbus_clk);
|
clk_prepare_enable(&hbus_clk);
|
||||||
clk_enable(&xbus_clk);
|
clk_prepare_enable(&xbus_clk);
|
||||||
clk_enable(&emi_clk);
|
clk_prepare_enable(&emi_clk);
|
||||||
clk_enable(&uart_clk);
|
clk_prepare_enable(&uart_clk);
|
||||||
|
|
||||||
clkdev_add_table(lookups, ARRAY_SIZE(lookups));
|
clkdev_add_table(lookups, ARRAY_SIZE(lookups));
|
||||||
|
|
||||||
|
|
|
@ -775,11 +775,11 @@ int __init mx28_clocks_init(void)
|
||||||
clk_set_parent(&ssp0_clk, &ref_io0_clk);
|
clk_set_parent(&ssp0_clk, &ref_io0_clk);
|
||||||
clk_set_parent(&ssp1_clk, &ref_io0_clk);
|
clk_set_parent(&ssp1_clk, &ref_io0_clk);
|
||||||
|
|
||||||
clk_enable(&cpu_clk);
|
clk_prepare_enable(&cpu_clk);
|
||||||
clk_enable(&hbus_clk);
|
clk_prepare_enable(&hbus_clk);
|
||||||
clk_enable(&xbus_clk);
|
clk_prepare_enable(&xbus_clk);
|
||||||
clk_enable(&emi_clk);
|
clk_prepare_enable(&emi_clk);
|
||||||
clk_enable(&uart_clk);
|
clk_prepare_enable(&uart_clk);
|
||||||
|
|
||||||
clk_set_parent(&lcdif_clk, &ref_pix_clk);
|
clk_set_parent(&lcdif_clk, &ref_pix_clk);
|
||||||
clk_set_parent(&saif0_clk, &pll0_clk);
|
clk_set_parent(&saif0_clk, &pll0_clk);
|
||||||
|
|
|
@ -74,10 +74,15 @@ static int __clk_enable(struct clk *clk)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function increments the reference count on the clock and enables the
|
/*
|
||||||
* clock if not already enabled. The parent clock tree is recursively enabled
|
* The clk_enable/clk_disable could be called by drivers in atomic context,
|
||||||
|
* so they should not really hold mutex. Instead, clk_prepare/clk_unprepare
|
||||||
|
* can hold a mutex, as the pair will only be called in non-atomic context.
|
||||||
|
* Before migrating to common clk framework, we can have __clk_enable and
|
||||||
|
* __clk_disable called in clk_prepare/clk_unprepare with mutex held and
|
||||||
|
* leave clk_enable/clk_disable as the dummy functions.
|
||||||
*/
|
*/
|
||||||
int clk_enable(struct clk *clk)
|
int clk_prepare(struct clk *clk)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
@ -90,13 +95,9 @@ int clk_enable(struct clk *clk)
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(clk_enable);
|
EXPORT_SYMBOL(clk_prepare);
|
||||||
|
|
||||||
/* This function decrements the reference count on the clock and disables
|
void clk_unprepare(struct clk *clk)
|
||||||
* the clock when reference count is 0. The parent clock tree is
|
|
||||||
* recursively disabled
|
|
||||||
*/
|
|
||||||
void clk_disable(struct clk *clk)
|
|
||||||
{
|
{
|
||||||
if (clk == NULL || IS_ERR(clk))
|
if (clk == NULL || IS_ERR(clk))
|
||||||
return;
|
return;
|
||||||
|
@ -105,6 +106,18 @@ void clk_disable(struct clk *clk)
|
||||||
__clk_disable(clk);
|
__clk_disable(clk);
|
||||||
mutex_unlock(&clocks_mutex);
|
mutex_unlock(&clocks_mutex);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(clk_unprepare);
|
||||||
|
|
||||||
|
int clk_enable(struct clk *clk)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(clk_enable);
|
||||||
|
|
||||||
|
void clk_disable(struct clk *clk)
|
||||||
|
{
|
||||||
|
/* nothing to do */
|
||||||
|
}
|
||||||
EXPORT_SYMBOL(clk_disable);
|
EXPORT_SYMBOL(clk_disable);
|
||||||
|
|
||||||
/* Retrieve the *current* clock rate. If the clock itself
|
/* Retrieve the *current* clock rate. If the clock itself
|
||||||
|
@ -166,7 +179,7 @@ int clk_set_parent(struct clk *clk, struct clk *parent)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (clk->usecount)
|
if (clk->usecount)
|
||||||
clk_enable(parent);
|
clk_prepare_enable(parent);
|
||||||
|
|
||||||
mutex_lock(&clocks_mutex);
|
mutex_lock(&clocks_mutex);
|
||||||
ret = clk->set_parent(clk, parent);
|
ret = clk->set_parent(clk, parent);
|
||||||
|
|
|
@ -228,7 +228,7 @@ static void __init mx28evk_fec_reset(void)
|
||||||
/* Enable fec phy clock */
|
/* Enable fec phy clock */
|
||||||
clk = clk_get_sys("pll2", NULL);
|
clk = clk_get_sys("pll2", NULL);
|
||||||
if (!IS_ERR(clk))
|
if (!IS_ERR(clk))
|
||||||
clk_enable(clk);
|
clk_prepare_enable(clk);
|
||||||
|
|
||||||
/* Power up fec phy */
|
/* Power up fec phy */
|
||||||
ret = gpio_request(MX28EVK_FEC_PHY_POWER, "fec-phy-power");
|
ret = gpio_request(MX28EVK_FEC_PHY_POWER, "fec-phy-power");
|
||||||
|
|
|
@ -66,7 +66,7 @@ static int __init mxs_arch_reset_init(void)
|
||||||
|
|
||||||
clk = clk_get_sys("rtc", NULL);
|
clk = clk_get_sys("rtc", NULL);
|
||||||
if (!IS_ERR(clk))
|
if (!IS_ERR(clk))
|
||||||
clk_enable(clk);
|
clk_prepare_enable(clk);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,7 +245,7 @@ static int __init mxs_clocksource_init(struct clk *timer_clk)
|
||||||
|
|
||||||
void __init mxs_timer_init(struct clk *timer_clk, int irq)
|
void __init mxs_timer_init(struct clk *timer_clk, int irq)
|
||||||
{
|
{
|
||||||
clk_enable(timer_clk);
|
clk_prepare_enable(timer_clk);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize timers to a known state
|
* Initialize timers to a known state
|
||||||
|
|
|
@ -3,5 +3,8 @@ config CLKDEV_LOOKUP
|
||||||
bool
|
bool
|
||||||
select HAVE_CLK
|
select HAVE_CLK
|
||||||
|
|
||||||
|
config HAVE_CLK_PREPARE
|
||||||
|
bool
|
||||||
|
|
||||||
config HAVE_MACH_CLKDEV
|
config HAVE_MACH_CLKDEV
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -334,7 +334,7 @@ static int mxs_dma_alloc_chan_resources(struct dma_chan *chan)
|
||||||
goto err_irq;
|
goto err_irq;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = clk_enable(mxs_dma->clk);
|
ret = clk_prepare_enable(mxs_dma->clk);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_clk;
|
goto err_clk;
|
||||||
|
|
||||||
|
@ -372,7 +372,7 @@ static void mxs_dma_free_chan_resources(struct dma_chan *chan)
|
||||||
dma_free_coherent(mxs_dma->dma_device.dev, PAGE_SIZE,
|
dma_free_coherent(mxs_dma->dma_device.dev, PAGE_SIZE,
|
||||||
mxs_chan->ccw, mxs_chan->ccw_phys);
|
mxs_chan->ccw, mxs_chan->ccw_phys);
|
||||||
|
|
||||||
clk_disable(mxs_dma->clk);
|
clk_disable_unprepare(mxs_dma->clk);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct dma_async_tx_descriptor *mxs_dma_prep_slave_sg(
|
static struct dma_async_tx_descriptor *mxs_dma_prep_slave_sg(
|
||||||
|
@ -578,7 +578,7 @@ static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = clk_enable(mxs_dma->clk);
|
ret = clk_prepare_enable(mxs_dma->clk);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_out;
|
goto err_out;
|
||||||
|
|
||||||
|
@ -604,7 +604,7 @@ static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma)
|
||||||
writel(MXS_DMA_CHANNELS_MASK << MXS_DMA_CHANNELS,
|
writel(MXS_DMA_CHANNELS_MASK << MXS_DMA_CHANNELS,
|
||||||
mxs_dma->base + HW_APBHX_CTRL1 + MXS_SET_ADDR);
|
mxs_dma->base + HW_APBHX_CTRL1 + MXS_SET_ADDR);
|
||||||
|
|
||||||
clk_disable(mxs_dma->clk);
|
clk_disable_unprepare(mxs_dma->clk);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
|
@ -713,7 +713,7 @@ static int mxs_mmc_probe(struct platform_device *pdev)
|
||||||
ret = PTR_ERR(host->clk);
|
ret = PTR_ERR(host->clk);
|
||||||
goto out_iounmap;
|
goto out_iounmap;
|
||||||
}
|
}
|
||||||
clk_enable(host->clk);
|
clk_prepare_enable(host->clk);
|
||||||
|
|
||||||
mxs_mmc_reset(host);
|
mxs_mmc_reset(host);
|
||||||
|
|
||||||
|
@ -772,7 +772,7 @@ out_free_dma:
|
||||||
if (host->dmach)
|
if (host->dmach)
|
||||||
dma_release_channel(host->dmach);
|
dma_release_channel(host->dmach);
|
||||||
out_clk_put:
|
out_clk_put:
|
||||||
clk_disable(host->clk);
|
clk_disable_unprepare(host->clk);
|
||||||
clk_put(host->clk);
|
clk_put(host->clk);
|
||||||
out_iounmap:
|
out_iounmap:
|
||||||
iounmap(host->base);
|
iounmap(host->base);
|
||||||
|
@ -798,7 +798,7 @@ static int mxs_mmc_remove(struct platform_device *pdev)
|
||||||
if (host->dmach)
|
if (host->dmach)
|
||||||
dma_release_channel(host->dmach);
|
dma_release_channel(host->dmach);
|
||||||
|
|
||||||
clk_disable(host->clk);
|
clk_disable_unprepare(host->clk);
|
||||||
clk_put(host->clk);
|
clk_put(host->clk);
|
||||||
|
|
||||||
iounmap(host->base);
|
iounmap(host->base);
|
||||||
|
@ -819,7 +819,7 @@ static int mxs_mmc_suspend(struct device *dev)
|
||||||
|
|
||||||
ret = mmc_suspend_host(mmc);
|
ret = mmc_suspend_host(mmc);
|
||||||
|
|
||||||
clk_disable(host->clk);
|
clk_disable_unprepare(host->clk);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -830,7 +830,7 @@ static int mxs_mmc_resume(struct device *dev)
|
||||||
struct mxs_mmc_host *host = mmc_priv(mmc);
|
struct mxs_mmc_host *host = mmc_priv(mmc);
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
clk_enable(host->clk);
|
clk_prepare_enable(host->clk);
|
||||||
|
|
||||||
ret = mmc_resume_host(mmc);
|
ret = mmc_resume_host(mmc);
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ int gpmi_init(struct gpmi_nand_data *this)
|
||||||
struct resources *r = &this->resources;
|
struct resources *r = &this->resources;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = clk_enable(r->clock);
|
ret = clk_prepare_enable(r->clock);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_out;
|
goto err_out;
|
||||||
ret = gpmi_reset_block(r->gpmi_regs, false);
|
ret = gpmi_reset_block(r->gpmi_regs, false);
|
||||||
|
@ -146,7 +146,7 @@ int gpmi_init(struct gpmi_nand_data *this)
|
||||||
/* Select BCH ECC. */
|
/* Select BCH ECC. */
|
||||||
writel(BM_GPMI_CTRL1_BCH_MODE, r->gpmi_regs + HW_GPMI_CTRL1_SET);
|
writel(BM_GPMI_CTRL1_BCH_MODE, r->gpmi_regs + HW_GPMI_CTRL1_SET);
|
||||||
|
|
||||||
clk_disable(r->clock);
|
clk_disable_unprepare(r->clock);
|
||||||
return 0;
|
return 0;
|
||||||
err_out:
|
err_out:
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -202,7 +202,7 @@ int bch_set_geometry(struct gpmi_nand_data *this)
|
||||||
ecc_strength = bch_geo->ecc_strength >> 1;
|
ecc_strength = bch_geo->ecc_strength >> 1;
|
||||||
page_size = bch_geo->page_size;
|
page_size = bch_geo->page_size;
|
||||||
|
|
||||||
ret = clk_enable(r->clock);
|
ret = clk_prepare_enable(r->clock);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_out;
|
goto err_out;
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ int bch_set_geometry(struct gpmi_nand_data *this)
|
||||||
writel(BM_BCH_CTRL_COMPLETE_IRQ_EN,
|
writel(BM_BCH_CTRL_COMPLETE_IRQ_EN,
|
||||||
r->bch_regs + HW_BCH_CTRL_SET);
|
r->bch_regs + HW_BCH_CTRL_SET);
|
||||||
|
|
||||||
clk_disable(r->clock);
|
clk_disable_unprepare(r->clock);
|
||||||
return 0;
|
return 0;
|
||||||
err_out:
|
err_out:
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -704,7 +704,7 @@ void gpmi_begin(struct gpmi_nand_data *this)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Enable the clock. */
|
/* Enable the clock. */
|
||||||
ret = clk_enable(r->clock);
|
ret = clk_prepare_enable(r->clock);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
pr_err("We failed in enable the clk\n");
|
pr_err("We failed in enable the clk\n");
|
||||||
goto err_out;
|
goto err_out;
|
||||||
|
@ -773,7 +773,7 @@ err_out:
|
||||||
void gpmi_end(struct gpmi_nand_data *this)
|
void gpmi_end(struct gpmi_nand_data *this)
|
||||||
{
|
{
|
||||||
struct resources *r = &this->resources;
|
struct resources *r = &this->resources;
|
||||||
clk_disable(r->clock);
|
clk_disable_unprepare(r->clock);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clears a BCH interrupt. */
|
/* Clears a BCH interrupt. */
|
||||||
|
|
|
@ -802,7 +802,7 @@ static int flexcan_open(struct net_device *dev)
|
||||||
struct flexcan_priv *priv = netdev_priv(dev);
|
struct flexcan_priv *priv = netdev_priv(dev);
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
clk_enable(priv->clk);
|
clk_prepare_enable(priv->clk);
|
||||||
|
|
||||||
err = open_candev(dev);
|
err = open_candev(dev);
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -824,7 +824,7 @@ static int flexcan_open(struct net_device *dev)
|
||||||
out_close:
|
out_close:
|
||||||
close_candev(dev);
|
close_candev(dev);
|
||||||
out:
|
out:
|
||||||
clk_disable(priv->clk);
|
clk_disable_unprepare(priv->clk);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -838,7 +838,7 @@ static int flexcan_close(struct net_device *dev)
|
||||||
flexcan_chip_stop(dev);
|
flexcan_chip_stop(dev);
|
||||||
|
|
||||||
free_irq(dev->irq, dev);
|
free_irq(dev->irq, dev);
|
||||||
clk_disable(priv->clk);
|
clk_disable_unprepare(priv->clk);
|
||||||
|
|
||||||
close_candev(dev);
|
close_candev(dev);
|
||||||
|
|
||||||
|
@ -877,7 +877,7 @@ static int __devinit register_flexcandev(struct net_device *dev)
|
||||||
struct flexcan_regs __iomem *regs = priv->base;
|
struct flexcan_regs __iomem *regs = priv->base;
|
||||||
u32 reg, err;
|
u32 reg, err;
|
||||||
|
|
||||||
clk_enable(priv->clk);
|
clk_prepare_enable(priv->clk);
|
||||||
|
|
||||||
/* select "bus clock", chip must be disabled */
|
/* select "bus clock", chip must be disabled */
|
||||||
flexcan_chip_disable(priv);
|
flexcan_chip_disable(priv);
|
||||||
|
@ -911,7 +911,7 @@ static int __devinit register_flexcandev(struct net_device *dev)
|
||||||
out:
|
out:
|
||||||
/* disable core and turn off clocks */
|
/* disable core and turn off clocks */
|
||||||
flexcan_chip_disable(priv);
|
flexcan_chip_disable(priv);
|
||||||
clk_disable(priv->clk);
|
clk_disable_unprepare(priv->clk);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1591,7 +1591,7 @@ fec_probe(struct platform_device *pdev)
|
||||||
ret = PTR_ERR(fep->clk);
|
ret = PTR_ERR(fep->clk);
|
||||||
goto failed_clk;
|
goto failed_clk;
|
||||||
}
|
}
|
||||||
clk_enable(fep->clk);
|
clk_prepare_enable(fep->clk);
|
||||||
|
|
||||||
ret = fec_enet_init(ndev);
|
ret = fec_enet_init(ndev);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -1614,7 +1614,7 @@ failed_register:
|
||||||
fec_enet_mii_remove(fep);
|
fec_enet_mii_remove(fep);
|
||||||
failed_mii_init:
|
failed_mii_init:
|
||||||
failed_init:
|
failed_init:
|
||||||
clk_disable(fep->clk);
|
clk_disable_unprepare(fep->clk);
|
||||||
clk_put(fep->clk);
|
clk_put(fep->clk);
|
||||||
failed_clk:
|
failed_clk:
|
||||||
for (i = 0; i < FEC_IRQ_NUM; i++) {
|
for (i = 0; i < FEC_IRQ_NUM; i++) {
|
||||||
|
@ -1641,7 +1641,7 @@ fec_drv_remove(struct platform_device *pdev)
|
||||||
|
|
||||||
fec_stop(ndev);
|
fec_stop(ndev);
|
||||||
fec_enet_mii_remove(fep);
|
fec_enet_mii_remove(fep);
|
||||||
clk_disable(fep->clk);
|
clk_disable_unprepare(fep->clk);
|
||||||
clk_put(fep->clk);
|
clk_put(fep->clk);
|
||||||
iounmap(fep->hwp);
|
iounmap(fep->hwp);
|
||||||
unregister_netdev(ndev);
|
unregister_netdev(ndev);
|
||||||
|
@ -1667,7 +1667,7 @@ fec_suspend(struct device *dev)
|
||||||
fec_stop(ndev);
|
fec_stop(ndev);
|
||||||
netif_device_detach(ndev);
|
netif_device_detach(ndev);
|
||||||
}
|
}
|
||||||
clk_disable(fep->clk);
|
clk_disable_unprepare(fep->clk);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1678,7 +1678,7 @@ fec_resume(struct device *dev)
|
||||||
struct net_device *ndev = dev_get_drvdata(dev);
|
struct net_device *ndev = dev_get_drvdata(dev);
|
||||||
struct fec_enet_private *fep = netdev_priv(ndev);
|
struct fec_enet_private *fep = netdev_priv(ndev);
|
||||||
|
|
||||||
clk_enable(fep->clk);
|
clk_prepare_enable(fep->clk);
|
||||||
if (netif_running(ndev)) {
|
if (netif_running(ndev)) {
|
||||||
fec_restart(ndev, fep->full_duplex);
|
fec_restart(ndev, fep->full_duplex);
|
||||||
netif_device_attach(ndev);
|
netif_device_attach(ndev);
|
||||||
|
|
|
@ -424,7 +424,7 @@ static int mxs_auart_startup(struct uart_port *u)
|
||||||
{
|
{
|
||||||
struct mxs_auart_port *s = to_auart_port(u);
|
struct mxs_auart_port *s = to_auart_port(u);
|
||||||
|
|
||||||
clk_enable(s->clk);
|
clk_prepare_enable(s->clk);
|
||||||
|
|
||||||
writel(AUART_CTRL0_CLKGATE, u->membase + AUART_CTRL0_CLR);
|
writel(AUART_CTRL0_CLKGATE, u->membase + AUART_CTRL0_CLR);
|
||||||
|
|
||||||
|
@ -453,7 +453,7 @@ static void mxs_auart_shutdown(struct uart_port *u)
|
||||||
writel(AUART_INTR_RXIEN | AUART_INTR_RTIEN | AUART_INTR_CTSMIEN,
|
writel(AUART_INTR_RXIEN | AUART_INTR_RTIEN | AUART_INTR_CTSMIEN,
|
||||||
u->membase + AUART_INTR_CLR);
|
u->membase + AUART_INTR_CLR);
|
||||||
|
|
||||||
clk_disable(s->clk);
|
clk_disable_unprepare(s->clk);
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int mxs_auart_tx_empty(struct uart_port *u)
|
static unsigned int mxs_auart_tx_empty(struct uart_port *u)
|
||||||
|
@ -634,7 +634,7 @@ auart_console_setup(struct console *co, char *options)
|
||||||
if (!s)
|
if (!s)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
clk_enable(s->clk);
|
clk_prepare_enable(s->clk);
|
||||||
|
|
||||||
if (options)
|
if (options)
|
||||||
uart_parse_options(options, &baud, &parity, &bits, &flow);
|
uart_parse_options(options, &baud, &parity, &bits, &flow);
|
||||||
|
@ -643,7 +643,7 @@ auart_console_setup(struct console *co, char *options)
|
||||||
|
|
||||||
ret = uart_set_options(&s->port, co, baud, parity, bits, flow);
|
ret = uart_set_options(&s->port, co, baud, parity, bits, flow);
|
||||||
|
|
||||||
clk_disable(s->clk);
|
clk_disable_unprepare(s->clk);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -328,7 +328,7 @@ static void mxsfb_enable_controller(struct fb_info *fb_info)
|
||||||
|
|
||||||
dev_dbg(&host->pdev->dev, "%s\n", __func__);
|
dev_dbg(&host->pdev->dev, "%s\n", __func__);
|
||||||
|
|
||||||
clk_enable(host->clk);
|
clk_prepare_enable(host->clk);
|
||||||
clk_set_rate(host->clk, PICOS2KHZ(fb_info->var.pixclock) * 1000U);
|
clk_set_rate(host->clk, PICOS2KHZ(fb_info->var.pixclock) * 1000U);
|
||||||
|
|
||||||
/* if it was disabled, re-enable the mode again */
|
/* if it was disabled, re-enable the mode again */
|
||||||
|
@ -368,7 +368,7 @@ static void mxsfb_disable_controller(struct fb_info *fb_info)
|
||||||
|
|
||||||
writel(VDCTRL4_SYNC_SIGNALS_ON, host->base + LCDC_VDCTRL4 + REG_CLR);
|
writel(VDCTRL4_SYNC_SIGNALS_ON, host->base + LCDC_VDCTRL4 + REG_CLR);
|
||||||
|
|
||||||
clk_disable(host->clk);
|
clk_disable_unprepare(host->clk);
|
||||||
|
|
||||||
host->enabled = 0;
|
host->enabled = 0;
|
||||||
}
|
}
|
||||||
|
@ -668,7 +668,7 @@ static int __devinit mxsfb_restore_mode(struct mxsfb_info *host)
|
||||||
line_count = fb_info->fix.smem_len / fb_info->fix.line_length;
|
line_count = fb_info->fix.smem_len / fb_info->fix.line_length;
|
||||||
fb_info->fix.ypanstep = 1;
|
fb_info->fix.ypanstep = 1;
|
||||||
|
|
||||||
clk_enable(host->clk);
|
clk_prepare_enable(host->clk);
|
||||||
host->enabled = 1;
|
host->enabled = 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -841,7 +841,7 @@ static int __devinit mxsfb_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
error_register:
|
error_register:
|
||||||
if (host->enabled)
|
if (host->enabled)
|
||||||
clk_disable(host->clk);
|
clk_disable_unprepare(host->clk);
|
||||||
fb_destroy_modelist(&fb_info->modelist);
|
fb_destroy_modelist(&fb_info->modelist);
|
||||||
error_init_fb:
|
error_init_fb:
|
||||||
kfree(fb_info->pseudo_palette);
|
kfree(fb_info->pseudo_palette);
|
||||||
|
|
|
@ -107,6 +107,28 @@ static inline void clk_unprepare(struct clk *clk)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* clk_prepare_enable helps cases using clk_enable in non-atomic context. */
|
||||||
|
static inline int clk_prepare_enable(struct clk *clk)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = clk_prepare(clk);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
ret = clk_enable(clk);
|
||||||
|
if (ret)
|
||||||
|
clk_unprepare(clk);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* clk_disable_unprepare helps cases using clk_disable in non-atomic context. */
|
||||||
|
static inline void clk_disable_unprepare(struct clk *clk)
|
||||||
|
{
|
||||||
|
clk_disable(clk);
|
||||||
|
clk_unprepare(clk);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clk_get_rate - obtain the current clock rate (in Hz) for a clock source.
|
* clk_get_rate - obtain the current clock rate (in Hz) for a clock source.
|
||||||
* This is only valid once the clock source has been enabled.
|
* This is only valid once the clock source has been enabled.
|
||||||
|
|
|
@ -210,7 +210,7 @@ int mxs_saif_put_mclk(unsigned int saif_id)
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
clk_disable(saif->clk);
|
clk_disable_unprepare(saif->clk);
|
||||||
|
|
||||||
/* disable MCLK output */
|
/* disable MCLK output */
|
||||||
__raw_writel(BM_SAIF_CTRL_CLKGATE,
|
__raw_writel(BM_SAIF_CTRL_CLKGATE,
|
||||||
|
@ -264,7 +264,7 @@ int mxs_saif_get_mclk(unsigned int saif_id, unsigned int mclk,
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ret = clk_enable(saif->clk);
|
ret = clk_prepare_enable(saif->clk);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче