aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorIan Molton <spyro@f2s.com>2008-07-08 05:32:50 -0400
committerIan Molton <spyro@f2s.com>2008-07-10 05:28:49 -0400
commit13f7558237ed841b19f11e0920c01c4d6d50fcc5 (patch)
tree095c566671b214920479f2447bec1b9b99a2c894 /arch
parented847782f6459a5c94aa0c9f93679f6a4176a47a (diff)
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: Ian Molton <spyro@f2s.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/common/sa1111.c2
-rw-r--r--arch/arm/mach-pxa/clock.c30
-rw-r--r--arch/arm/mach-pxa/pxa25x.c31
-rw-r--r--arch/arm/mach-sa1100/clock.c2
4 files changed, 31 insertions, 34 deletions
diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c
index eb06d0b2cb74..79fa71d990b5 100644
--- a/arch/arm/common/sa1111.c
+++ b/arch/arm/common/sa1111.c
@@ -627,7 +627,7 @@ __sa1111_probe(struct device *me, struct resource *mem, int irq)
627 if (!sachip) 627 if (!sachip)
628 return -ENOMEM; 628 return -ENOMEM;
629 629
630 sachip->clk = clk_get(me, "GPIO27_CLK"); 630 sachip->clk = clk_get(me, "SA1111_CLK");
631 if (!sachip->clk) { 631 if (!sachip->clk) {
632 ret = PTR_ERR(sachip->clk); 632 ret = PTR_ERR(sachip->clk);
633 goto err_free; 633 goto err_free;
diff --git a/arch/arm/mach-pxa/clock.c b/arch/arm/mach-pxa/clock.c
index b4d04955dcb0..630063ffa6fc 100644
--- a/arch/arm/mach-pxa/clock.c
+++ b/arch/arm/mach-pxa/clock.c
@@ -101,21 +101,6 @@ unsigned long clk_get_rate(struct clk *clk)
101EXPORT_SYMBOL(clk_get_rate); 101EXPORT_SYMBOL(clk_get_rate);
102 102
103 103
104static void clk_gpio27_enable(struct clk *clk)
105{
106 pxa_gpio_mode(GPIO11_3_6MHz_MD);
107}
108
109static void clk_gpio27_disable(struct clk *clk)
110{
111}
112
113static const struct clkops clk_gpio27_ops = {
114 .enable = clk_gpio27_enable,
115 .disable = clk_gpio27_disable,
116};
117
118
119void clk_cken_enable(struct clk *clk) 104void clk_cken_enable(struct clk *clk)
120{ 105{
121 CKEN |= 1 << clk->cken; 106 CKEN |= 1 << clk->cken;
@@ -131,14 +116,6 @@ const struct clkops clk_cken_ops = {
131 .disable = clk_cken_disable, 116 .disable = clk_cken_disable,
132}; 117};
133 118
134static struct clk common_clks[] = {
135 {
136 .name = "GPIO27_CLK",
137 .ops = &clk_gpio27_ops,
138 .rate = 3686400,
139 },
140};
141
142void clks_register(struct clk *clks, size_t num) 119void clks_register(struct clk *clks, size_t num)
143{ 120{
144 int i; 121 int i;
@@ -148,10 +125,3 @@ void clks_register(struct clk *clks, size_t num)
148 list_add(&clks[i].node, &clocks); 125 list_add(&clks[i].node, &clocks);
149 mutex_unlock(&clocks_mutex); 126 mutex_unlock(&clocks_mutex);
150} 127}
151
152static int __init clk_init(void)
153{
154 clks_register(common_clks, ARRAY_SIZE(common_clks));
155 return 0;
156}
157arch_initcall(clk_init);
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index 034d3a6c31d8..c5b845b935bb 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -132,6 +132,29 @@ static const struct clkops clk_pxa25x_gpio12_ops = {
132 .disable = clk_gpio12_disable, 132 .disable = clk_gpio12_disable,
133}; 133};
134 134
135static unsigned long gpio11_config_3m6[] = {
136 GPIO11_3_6MHz,
137};
138
139static unsigned long gpio11_config_gpio[] = {
140 GPIO11_GPIO,
141};
142
143static void clk_gpio11_enable(struct clk *clk)
144{
145 pxa2xx_mfp_config(gpio11_config_3m6, 1);
146}
147
148static void clk_gpio11_disable(struct clk *clk)
149{
150 pxa2xx_mfp_config(gpio11_config_gpio, 1);
151}
152
153static const struct clkops clk_pxa25x_gpio11_ops = {
154 .enable = clk_gpio11_enable,
155 .disable = clk_gpio11_disable,
156};
157
135/* 158/*
136 * 3.6864MHz -> OST, GPIO, SSP, PWM, PLLs (95.842MHz, 147.456MHz) 159 * 3.6864MHz -> OST, GPIO, SSP, PWM, PLLs (95.842MHz, 147.456MHz)
137 * 95.842MHz -> MMC 19.169MHz, I2C 31.949MHz, FICP 47.923MHz, USB 47.923MHz 160 * 95.842MHz -> MMC 19.169MHz, I2C 31.949MHz, FICP 47.923MHz, USB 47.923MHz
@@ -151,6 +174,7 @@ static struct clk pxa25x_clks[] = {
151 INIT_CKEN("UARTCLK", BTUART, 14745600, 1, &pxa_device_btuart.dev), 174 INIT_CKEN("UARTCLK", BTUART, 14745600, 1, &pxa_device_btuart.dev),
152 INIT_CKEN("UARTCLK", STUART, 14745600, 1, NULL), 175 INIT_CKEN("UARTCLK", STUART, 14745600, 1, NULL),
153 INIT_CKEN("UDCCLK", USB, 47923000, 5, &pxa25x_device_udc.dev), 176 INIT_CKEN("UDCCLK", USB, 47923000, 5, &pxa25x_device_udc.dev),
177 INIT_CLK("GPIO11_CLK", &clk_pxa25x_gpio11_ops, 3686400, 0, NULL),
154 INIT_CLK("GPIO12_CLK", &clk_pxa25x_gpio12_ops, 32768, 0, NULL), 178 INIT_CLK("GPIO12_CLK", &clk_pxa25x_gpio12_ops, 32768, 0, NULL),
155 INIT_CKEN("MMCCLK", MMC, 19169000, 0, &pxa_device_mci.dev), 179 INIT_CKEN("MMCCLK", MMC, 19169000, 0, &pxa_device_mci.dev),
156 INIT_CKEN("I2CCLK", I2C, 31949000, 0, &pxa_device_i2c.dev), 180 INIT_CKEN("I2CCLK", I2C, 31949000, 0, &pxa_device_i2c.dev),
@@ -169,7 +193,10 @@ static struct clk pxa25x_clks[] = {
169 INIT_CKEN("FICPCLK", FICP, 47923000, 0, NULL), 193 INIT_CKEN("FICPCLK", FICP, 47923000, 0, NULL),
170}; 194};
171 195
172static struct clk gpio7_clk = INIT_CKOTHER("GPIO7_CK", &pxa25x_clks[4], NULL); 196static struct clk pxa2xx_clk_aliases[] = {
197 INIT_CKOTHER("GPIO7_CLK", &pxa25x_clks[4], NULL),
198 INIT_CKOTHER("SA1111_CLK", &pxa25x_clks[5], NULL),
199};
173 200
174#ifdef CONFIG_PM 201#ifdef CONFIG_PM
175 202
@@ -344,7 +371,7 @@ static int __init pxa25x_init(void)
344 if (cpu_is_pxa255()) 371 if (cpu_is_pxa255())
345 ret = platform_device_register(&pxa_device_hwuart); 372 ret = platform_device_register(&pxa_device_hwuart);
346 373
347 clks_register(&gpio7_clk, 1); 374 clks_register(pxa2xx_clk_aliases, ARRAY_SIZE(pxa2xx_clk_aliases));
348 375
349 return ret; 376 return ret;
350} 377}
diff --git a/arch/arm/mach-sa1100/clock.c b/arch/arm/mach-sa1100/clock.c
index fc97fe57ee6f..b5809c51d13f 100644
--- a/arch/arm/mach-sa1100/clock.c
+++ b/arch/arm/mach-sa1100/clock.c
@@ -103,7 +103,7 @@ static void clk_gpio27_disable(void)
103} 103}
104 104
105static struct clk clk_gpio27 = { 105static struct clk clk_gpio27 = {
106 .name = "GPIO27_CLK", 106 .name = "SA1111_CLK",
107 .rate = 3686400, 107 .rate = 3686400,
108 .enable = clk_gpio27_enable, 108 .enable = clk_gpio27_enable,
109 .disable = clk_gpio27_disable, 109 .disable = clk_gpio27_disable,