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

Commit 979ecef5 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
clock management changes for i.MX

Another simple series related to clock management, this time only for
imx.

* tag 'clk' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc:
  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

Fix up trivial conflicts in drivers/net/ethernet/freescale/fec.c due to
commit 0ebafefc ("net: fec: add clk_prepare/clk_unprepare") clashing
trivially with commit e163cc97 ("net/fec: fix the .remove code").
parents e8cbce97 8c3b2296
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -447,6 +447,7 @@ config ARCH_MXS
	select ARCH_REQUIRE_GPIOLIB
	select CLKDEV_LOOKUP
	select CLKSRC_MMIO
	select HAVE_CLK_PREPARE
	help
	  Support for Freescale MXS-based family of processors

+5 −5
Original line number Diff line number Diff line
@@ -545,11 +545,11 @@ int __init mx23_clocks_init(void)
	 */
	clk_set_parent(&ssp_clk, &ref_io_clk);

	clk_enable(&cpu_clk);
	clk_enable(&hbus_clk);
	clk_enable(&xbus_clk);
	clk_enable(&emi_clk);
	clk_enable(&uart_clk);
	clk_prepare_enable(&cpu_clk);
	clk_prepare_enable(&hbus_clk);
	clk_prepare_enable(&xbus_clk);
	clk_prepare_enable(&emi_clk);
	clk_prepare_enable(&uart_clk);

	clkdev_add_table(lookups, ARRAY_SIZE(lookups));

+5 −5
Original line number Diff line number Diff line
@@ -804,11 +804,11 @@ int __init mx28_clocks_init(void)
	clk_set_parent(&ssp0_clk, &ref_io0_clk);
	clk_set_parent(&ssp1_clk, &ref_io0_clk);

	clk_enable(&cpu_clk);
	clk_enable(&hbus_clk);
	clk_enable(&xbus_clk);
	clk_enable(&emi_clk);
	clk_enable(&uart_clk);
	clk_prepare_enable(&cpu_clk);
	clk_prepare_enable(&hbus_clk);
	clk_prepare_enable(&xbus_clk);
	clk_prepare_enable(&emi_clk);
	clk_prepare_enable(&uart_clk);

	clk_set_parent(&lcdif_clk, &ref_pix_clk);
	clk_set_parent(&saif0_clk, &pll0_clk);
+23 −10
Original line number Diff line number Diff line
@@ -74,10 +74,15 @@ static int __clk_enable(struct clk *clk)
	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;

@@ -90,13 +95,9 @@ int clk_enable(struct clk *clk)

	return ret;
}
EXPORT_SYMBOL(clk_enable);
EXPORT_SYMBOL(clk_prepare);

/* This function decrements the reference count on the clock and disables
 * the clock when reference count is 0. The parent clock tree is
 * recursively disabled
 */
void clk_disable(struct clk *clk)
void clk_unprepare(struct clk *clk)
{
	if (clk == NULL || IS_ERR(clk))
		return;
@@ -105,6 +106,18 @@ void clk_disable(struct clk *clk)
	__clk_disable(clk);
	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);

/* 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;

	if (clk->usecount)
		clk_enable(parent);
		clk_prepare_enable(parent);

	mutex_lock(&clocks_mutex);
	ret = clk->set_parent(clk, parent);
+1 −1
Original line number Diff line number Diff line
@@ -229,7 +229,7 @@ static void __init mx28evk_fec_reset(void)
	/* Enable fec phy clock */
	clk = clk_get_sys("pll2", NULL);
	if (!IS_ERR(clk))
		clk_enable(clk);
		clk_prepare_enable(clk);

	/* Power up fec phy */
	ret = gpio_request(MX28EVK_FEC_PHY_POWER, "fec-phy-power");
Loading