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

Commit 13f75582 authored by Ian Molton's avatar Ian Molton
Browse files

Clocklib: Fix SA1111 clock name mess.



This patch uses the ability of PXA's clocklib to alias clock to resolve the
problem caused by sharing the SA1111 IO controller between PXA and SA1100
architectures, which have differing GPIO numbering.

Signed-off-by: default avatarIan Molton <spyro@f2s.com>
parent ed847782
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -627,7 +627,7 @@ __sa1111_probe(struct device *me, struct resource *mem, int irq)
	if (!sachip)
		return -ENOMEM;

	sachip->clk = clk_get(me, "GPIO27_CLK");
	sachip->clk = clk_get(me, "SA1111_CLK");
	if (!sachip->clk) {
		ret = PTR_ERR(sachip->clk);
		goto err_free;
+0 −30
Original line number Diff line number Diff line
@@ -101,21 +101,6 @@ unsigned long clk_get_rate(struct clk *clk)
EXPORT_SYMBOL(clk_get_rate);


static void clk_gpio27_enable(struct clk *clk)
{
	pxa_gpio_mode(GPIO11_3_6MHz_MD);
}

static void clk_gpio27_disable(struct clk *clk)
{
}

static const struct clkops clk_gpio27_ops = {
	.enable		= clk_gpio27_enable,
	.disable	= clk_gpio27_disable,
};


void clk_cken_enable(struct clk *clk)
{
	CKEN |= 1 << clk->cken;
@@ -131,14 +116,6 @@ const struct clkops clk_cken_ops = {
	.disable	= clk_cken_disable,
};

static struct clk common_clks[] = {
	{
		.name		= "GPIO27_CLK",
		.ops		= &clk_gpio27_ops,
		.rate		= 3686400,
	},
};

void clks_register(struct clk *clks, size_t num)
{
	int i;
@@ -148,10 +125,3 @@ void clks_register(struct clk *clks, size_t num)
		list_add(&clks[i].node, &clocks);
	mutex_unlock(&clocks_mutex);
}

static int __init clk_init(void)
{
	clks_register(common_clks, ARRAY_SIZE(common_clks));
	return 0;
}
arch_initcall(clk_init);
+29 −2
Original line number Diff line number Diff line
@@ -132,6 +132,29 @@ static const struct clkops clk_pxa25x_gpio12_ops = {
	.disable        = clk_gpio12_disable,
};

static unsigned long gpio11_config_3m6[] = {
	GPIO11_3_6MHz,
};

static unsigned long gpio11_config_gpio[] = {
	GPIO11_GPIO,
};

static void clk_gpio11_enable(struct clk *clk)
{
	pxa2xx_mfp_config(gpio11_config_3m6, 1);
}

static void clk_gpio11_disable(struct clk *clk)
{
	pxa2xx_mfp_config(gpio11_config_gpio, 1);
}

static const struct clkops clk_pxa25x_gpio11_ops = {
	.enable         = clk_gpio11_enable,
	.disable        = clk_gpio11_disable,
};

/*
 * 3.6864MHz -> OST, GPIO, SSP, PWM, PLLs (95.842MHz, 147.456MHz)
 * 95.842MHz -> MMC 19.169MHz, I2C 31.949MHz, FICP 47.923MHz, USB 47.923MHz
@@ -151,6 +174,7 @@ static struct clk pxa25x_clks[] = {
	INIT_CKEN("UARTCLK", BTUART, 14745600, 1, &pxa_device_btuart.dev),
	INIT_CKEN("UARTCLK", STUART, 14745600, 1, NULL),
	INIT_CKEN("UDCCLK", USB, 47923000, 5, &pxa25x_device_udc.dev),
	INIT_CLK("GPIO11_CLK", &clk_pxa25x_gpio11_ops, 3686400, 0, NULL),
	INIT_CLK("GPIO12_CLK", &clk_pxa25x_gpio12_ops, 32768, 0, NULL),
	INIT_CKEN("MMCCLK", MMC, 19169000, 0, &pxa_device_mci.dev),
	INIT_CKEN("I2CCLK", I2C, 31949000, 0, &pxa_device_i2c.dev),
@@ -169,7 +193,10 @@ static struct clk pxa25x_clks[] = {
	INIT_CKEN("FICPCLK", FICP, 47923000, 0, NULL),
};

static struct clk gpio7_clk = INIT_CKOTHER("GPIO7_CK", &pxa25x_clks[4], NULL);
static struct clk pxa2xx_clk_aliases[] = {
	INIT_CKOTHER("GPIO7_CLK", &pxa25x_clks[4], NULL),
	INIT_CKOTHER("SA1111_CLK", &pxa25x_clks[5], NULL),
};

#ifdef CONFIG_PM

@@ -344,7 +371,7 @@ static int __init pxa25x_init(void)
	if (cpu_is_pxa255())
		ret = platform_device_register(&pxa_device_hwuart);

	clks_register(&gpio7_clk, 1);
	clks_register(pxa2xx_clk_aliases, ARRAY_SIZE(pxa2xx_clk_aliases));

	return ret;
}
+1 −1
Original line number Diff line number Diff line
@@ -103,7 +103,7 @@ static void clk_gpio27_disable(void)
}

static struct clk clk_gpio27 = {
	.name		= "GPIO27_CLK",
	.name		= "SA1111_CLK",
	.rate		= 3686400,
	.enable		= clk_gpio27_enable,
	.disable	= clk_gpio27_disable,