aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2014-04-15 09:20:50 -0400
committerArnd Bergmann <arnd@arndb.de>2015-12-01 15:44:22 -0500
commit990f2f223cb479a15afda9eb8552582aa82e2404 (patch)
tree09e20e274ef06c17c6bd4dfd859bdcdc3d6738cf
parent31ade3b83e1821da5fbb2f11b5b3d4ab2ec39db8 (diff)
clk: mmp: stop using platform headers
The mmp clock drivers currently hardcode the physical addresses for the clock registers. This is generally a bad idea, and it also gets in the way of multiplatform builds, which make the platform header files inaccessible to device drivers. To work around the header file problem, this patch changes the calling convention so the three mmp clock drivers get initialized with the base addresses as arguments from the platform code. It would still be useful to have a larger rework of the clock drivers, with DT integration to let the clocks actually be probed automatically, and the base addresses passed as DT properties. I am unsure if anyone is still interested in the mmp platform, so it is possible that this won't happen. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Mike Turquette <mturquette@linaro.org> Cc: Chao Xie <chao.xie@marvell.com> Cc: Eric Miao <eric.y.miao@gmail.com> Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
-rw-r--r--arch/arm/mach-mmp/clock-mmp2.c4
-rw-r--r--arch/arm/mach-mmp/clock-pxa168.c4
-rw-r--r--arch/arm/mach-mmp/clock-pxa910.c4
-rw-r--r--arch/arm/mach-mmp/common.h3
-rw-r--r--arch/arm/mach-mmp/mmp2.c5
-rw-r--r--arch/arm/mach-mmp/pxa168.c5
-rw-r--r--arch/arm/mach-mmp/pxa910.c6
-rw-r--r--drivers/clk/mmp/clk-mmp2.c12
-rw-r--r--drivers/clk/mmp/clk-pxa168.c12
-rw-r--r--drivers/clk/mmp/clk-pxa910.c14
-rw-r--r--include/linux/clk/mmp.h17
11 files changed, 58 insertions, 28 deletions
diff --git a/arch/arm/mach-mmp/clock-mmp2.c b/arch/arm/mach-mmp/clock-mmp2.c
index 53d77cbd6000..6847c49bbb39 100644
--- a/arch/arm/mach-mmp/clock-mmp2.c
+++ b/arch/arm/mach-mmp/clock-mmp2.c
@@ -4,6 +4,7 @@
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/io.h> 5#include <linux/io.h>
6#include <linux/clk.h> 6#include <linux/clk.h>
7#include <linux/clk/mmp.h>
7 8
8#include <mach/addr-map.h> 9#include <mach/addr-map.h>
9 10
@@ -105,7 +106,8 @@ static struct clk_lookup mmp2_clkregs[] = {
105 INIT_CLKREG(&clk_sdh3, "sdhci-pxav3.3", "PXA-SDHCLK"), 106 INIT_CLKREG(&clk_sdh3, "sdhci-pxav3.3", "PXA-SDHCLK"),
106}; 107};
107 108
108void __init mmp2_clk_init(void) 109void __init mmp2_clk_init(phys_addr_t mpmu_phys, phys_addr_t apmu_phys,
110 phys_addr_t apbc_phys)
109{ 111{
110 clkdev_add_table(ARRAY_AND_SIZE(mmp2_clkregs)); 112 clkdev_add_table(ARRAY_AND_SIZE(mmp2_clkregs));
111} 113}
diff --git a/arch/arm/mach-mmp/clock-pxa168.c b/arch/arm/mach-mmp/clock-pxa168.c
index c572f219ae26..bfa54bb16449 100644
--- a/arch/arm/mach-mmp/clock-pxa168.c
+++ b/arch/arm/mach-mmp/clock-pxa168.c
@@ -4,6 +4,7 @@
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/io.h> 5#include <linux/io.h>
6#include <linux/clk.h> 6#include <linux/clk.h>
7#include <linux/clk/mmp.h>
7 8
8#include <mach/addr-map.h> 9#include <mach/addr-map.h>
9 10
@@ -85,7 +86,8 @@ static struct clk_lookup pxa168_clkregs[] = {
85 INIT_CLKREG(&clk_rtc, "sa1100-rtc", NULL), 86 INIT_CLKREG(&clk_rtc, "sa1100-rtc", NULL),
86}; 87};
87 88
88void __init pxa168_clk_init(void) 89void __init pxa168_clk_init(phys_addr_t mpmu_phys, phys_addr_t apmu_phys,
90 phys_addr_t apbc_phys)
89{ 91{
90 clkdev_add_table(ARRAY_AND_SIZE(pxa168_clkregs)); 92 clkdev_add_table(ARRAY_AND_SIZE(pxa168_clkregs));
91} 93}
diff --git a/arch/arm/mach-mmp/clock-pxa910.c b/arch/arm/mach-mmp/clock-pxa910.c
index 379e1df61c70..ef7d3dbc8731 100644
--- a/arch/arm/mach-mmp/clock-pxa910.c
+++ b/arch/arm/mach-mmp/clock-pxa910.c
@@ -4,6 +4,7 @@
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/io.h> 5#include <linux/io.h>
6#include <linux/clk.h> 6#include <linux/clk.h>
7#include <linux/clk/mmp.h>
7 8
8#include <mach/addr-map.h> 9#include <mach/addr-map.h>
9 10
@@ -61,7 +62,8 @@ static struct clk_lookup pxa910_clkregs[] = {
61 INIT_CLKREG(&clk_rtc, "sa1100-rtc", NULL), 62 INIT_CLKREG(&clk_rtc, "sa1100-rtc", NULL),
62}; 63};
63 64
64void __init pxa910_clk_init(void) 65void __init pxa910_clk_init(phys_addr_t mpmu_phys, phys_addr_t apmu_phys,
66 phys_addr_t apbc_phys, phys_addr_t apbcp_phys)
65{ 67{
66 clkdev_add_table(ARRAY_AND_SIZE(pxa910_clkregs)); 68 clkdev_add_table(ARRAY_AND_SIZE(pxa910_clkregs));
67} 69}
diff --git a/arch/arm/mach-mmp/common.h b/arch/arm/mach-mmp/common.h
index cf445bae6d77..7453a90c34bd 100644
--- a/arch/arm/mach-mmp/common.h
+++ b/arch/arm/mach-mmp/common.h
@@ -5,6 +5,3 @@ extern void timer_init(int irq);
5 5
6extern void __init mmp_map_io(void); 6extern void __init mmp_map_io(void);
7extern void mmp_restart(enum reboot_mode, const char *); 7extern void mmp_restart(enum reboot_mode, const char *);
8extern void __init pxa168_clk_init(void);
9extern void __init pxa910_clk_init(void);
10extern void __init mmp2_clk_init(void);
diff --git a/arch/arm/mach-mmp/mmp2.c b/arch/arm/mach-mmp/mmp2.c
index a70b5530bd42..c8914ef21f7f 100644
--- a/arch/arm/mach-mmp/mmp2.c
+++ b/arch/arm/mach-mmp/mmp2.c
@@ -9,6 +9,7 @@
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12#include <linux/clk/mmp.h>
12#include <linux/module.h> 13#include <linux/module.h>
13#include <linux/kernel.h> 14#include <linux/kernel.h>
14#include <linux/init.h> 15#include <linux/init.h>
@@ -111,7 +112,9 @@ static int __init mmp2_init(void)
111 mfp_init_base(MFPR_VIRT_BASE); 112 mfp_init_base(MFPR_VIRT_BASE);
112 mfp_init_addr(mmp2_addr_map); 113 mfp_init_addr(mmp2_addr_map);
113 pxa_init_dma(IRQ_MMP2_DMA_RIQ, 16); 114 pxa_init_dma(IRQ_MMP2_DMA_RIQ, 16);
114 mmp2_clk_init(); 115 mmp2_clk_init(APB_PHYS_BASE + 0x50000,
116 AXI_PHYS_BASE + 0x82800,
117 APB_PHYS_BASE + 0x15000);
115 } 118 }
116 119
117 return 0; 120 return 0;
diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
index 144e997624c0..53f21554ae63 100644
--- a/arch/arm/mach-mmp/pxa168.c
+++ b/arch/arm/mach-mmp/pxa168.c
@@ -13,6 +13,7 @@
13#include <linux/list.h> 13#include <linux/list.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/clk.h> 15#include <linux/clk.h>
16#include <linux/clk/mmp.h>
16#include <linux/platform_device.h> 17#include <linux/platform_device.h>
17#include <linux/platform_data/mv_usb.h> 18#include <linux/platform_data/mv_usb.h>
18 19
@@ -56,7 +57,9 @@ static int __init pxa168_init(void)
56 mfp_init_base(MFPR_VIRT_BASE); 57 mfp_init_base(MFPR_VIRT_BASE);
57 mfp_init_addr(pxa168_mfp_addr_map); 58 mfp_init_addr(pxa168_mfp_addr_map);
58 pxa_init_dma(IRQ_PXA168_DMA_INT0, 32); 59 pxa_init_dma(IRQ_PXA168_DMA_INT0, 32);
59 pxa168_clk_init(); 60 pxa168_clk_init(APB_PHYS_BASE + 0x50000,
61 AXI_PHYS_BASE + 0x82800,
62 APB_PHYS_BASE + 0x15000);
60 } 63 }
61 64
62 return 0; 65 return 0;
diff --git a/arch/arm/mach-mmp/pxa910.c b/arch/arm/mach-mmp/pxa910.c
index eb57ee196842..545404261327 100644
--- a/arch/arm/mach-mmp/pxa910.c
+++ b/arch/arm/mach-mmp/pxa910.c
@@ -7,6 +7,7 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10#include <linux/clk/mmp.h>
10#include <linux/module.h> 11#include <linux/module.h>
11#include <linux/kernel.h> 12#include <linux/kernel.h>
12#include <linux/init.h> 13#include <linux/init.h>
@@ -97,7 +98,10 @@ static int __init pxa910_init(void)
97 mfp_init_base(MFPR_VIRT_BASE); 98 mfp_init_base(MFPR_VIRT_BASE);
98 mfp_init_addr(pxa910_mfp_addr_map); 99 mfp_init_addr(pxa910_mfp_addr_map);
99 pxa_init_dma(IRQ_PXA910_DMA_INT0, 32); 100 pxa_init_dma(IRQ_PXA910_DMA_INT0, 32);
100 pxa910_clk_init(); 101 pxa910_clk_init(APB_PHYS_BASE + 0x50000,
102 AXI_PHYS_BASE + 0x82800,
103 APB_PHYS_BASE + 0x15000,
104 APB_PHYS_BASE + 0x3b000);
101 } 105 }
102 106
103 return 0; 107 return 0;
diff --git a/drivers/clk/mmp/clk-mmp2.c b/drivers/clk/mmp/clk-mmp2.c
index 09d2832fbd78..38931dbd1eff 100644
--- a/drivers/clk/mmp/clk-mmp2.c
+++ b/drivers/clk/mmp/clk-mmp2.c
@@ -9,6 +9,7 @@
9 * warranty of any kind, whether express or implied. 9 * warranty of any kind, whether express or implied.
10 */ 10 */
11 11
12#include <linux/clk.h>
12#include <linux/module.h> 13#include <linux/module.h>
13#include <linux/kernel.h> 14#include <linux/kernel.h>
14#include <linux/spinlock.h> 15#include <linux/spinlock.h>
@@ -16,8 +17,6 @@
16#include <linux/delay.h> 17#include <linux/delay.h>
17#include <linux/err.h> 18#include <linux/err.h>
18 19
19#include <mach/addr-map.h>
20
21#include "clk.h" 20#include "clk.h"
22 21
23#define APBC_RTC 0x0 22#define APBC_RTC 0x0
@@ -73,7 +72,8 @@ static const char *sdh_parent[] = {"pll1_4", "pll2", "usb_pll", "pll1"};
73static const char *disp_parent[] = {"pll1", "pll1_16", "pll2", "vctcxo"}; 72static const char *disp_parent[] = {"pll1", "pll1_16", "pll2", "vctcxo"};
74static const char *ccic_parent[] = {"pll1_2", "pll1_16", "vctcxo"}; 73static const char *ccic_parent[] = {"pll1_2", "pll1_16", "vctcxo"};
75 74
76void __init mmp2_clk_init(void) 75void __init mmp2_clk_init(phys_addr_t mpmu_phys, phys_addr_t apmu_phys,
76 phys_addr_t apbc_phys)
77{ 77{
78 struct clk *clk; 78 struct clk *clk;
79 struct clk *vctcxo; 79 struct clk *vctcxo;
@@ -81,19 +81,19 @@ void __init mmp2_clk_init(void)
81 void __iomem *apmu_base; 81 void __iomem *apmu_base;
82 void __iomem *apbc_base; 82 void __iomem *apbc_base;
83 83
84 mpmu_base = ioremap(APB_PHYS_BASE + 0x50000, SZ_4K); 84 mpmu_base = ioremap(mpmu_phys, SZ_4K);
85 if (mpmu_base == NULL) { 85 if (mpmu_base == NULL) {
86 pr_err("error to ioremap MPMU base\n"); 86 pr_err("error to ioremap MPMU base\n");
87 return; 87 return;
88 } 88 }
89 89
90 apmu_base = ioremap(AXI_PHYS_BASE + 0x82800, SZ_4K); 90 apmu_base = ioremap(apmu_phys, SZ_4K);
91 if (apmu_base == NULL) { 91 if (apmu_base == NULL) {
92 pr_err("error to ioremap APMU base\n"); 92 pr_err("error to ioremap APMU base\n");
93 return; 93 return;
94 } 94 }
95 95
96 apbc_base = ioremap(APB_PHYS_BASE + 0x15000, SZ_4K); 96 apbc_base = ioremap(apbc_phys, SZ_4K);
97 if (apbc_base == NULL) { 97 if (apbc_base == NULL) {
98 pr_err("error to ioremap APBC base\n"); 98 pr_err("error to ioremap APBC base\n");
99 return; 99 return;
diff --git a/drivers/clk/mmp/clk-pxa168.c b/drivers/clk/mmp/clk-pxa168.c
index 93e967c0f972..0dd83fb950c9 100644
--- a/drivers/clk/mmp/clk-pxa168.c
+++ b/drivers/clk/mmp/clk-pxa168.c
@@ -9,6 +9,7 @@
9 * warranty of any kind, whether express or implied. 9 * warranty of any kind, whether express or implied.
10 */ 10 */
11 11
12#include <linux/clk.h>
12#include <linux/module.h> 13#include <linux/module.h>
13#include <linux/kernel.h> 14#include <linux/kernel.h>
14#include <linux/spinlock.h> 15#include <linux/spinlock.h>
@@ -16,8 +17,6 @@
16#include <linux/delay.h> 17#include <linux/delay.h>
17#include <linux/err.h> 18#include <linux/err.h>
18 19
19#include <mach/addr-map.h>
20
21#include "clk.h" 20#include "clk.h"
22 21
23#define APBC_RTC 0x28 22#define APBC_RTC 0x28
@@ -66,7 +65,8 @@ static const char *disp_parent[] = {"pll1_2", "pll1_12"};
66static const char *ccic_parent[] = {"pll1_2", "pll1_12"}; 65static const char *ccic_parent[] = {"pll1_2", "pll1_12"};
67static const char *ccic_phy_parent[] = {"pll1_6", "pll1_12"}; 66static const char *ccic_phy_parent[] = {"pll1_6", "pll1_12"};
68 67
69void __init pxa168_clk_init(void) 68void __init pxa168_clk_init(phys_addr_t mpmu_phys, phys_addr_t apmu_phys,
69 phys_addr_t apbc_phys)
70{ 70{
71 struct clk *clk; 71 struct clk *clk;
72 struct clk *uart_pll; 72 struct clk *uart_pll;
@@ -74,19 +74,19 @@ void __init pxa168_clk_init(void)
74 void __iomem *apmu_base; 74 void __iomem *apmu_base;
75 void __iomem *apbc_base; 75 void __iomem *apbc_base;
76 76
77 mpmu_base = ioremap(APB_PHYS_BASE + 0x50000, SZ_4K); 77 mpmu_base = ioremap(mpmu_phys, SZ_4K);
78 if (mpmu_base == NULL) { 78 if (mpmu_base == NULL) {
79 pr_err("error to ioremap MPMU base\n"); 79 pr_err("error to ioremap MPMU base\n");
80 return; 80 return;
81 } 81 }
82 82
83 apmu_base = ioremap(AXI_PHYS_BASE + 0x82800, SZ_4K); 83 apmu_base = ioremap(apmu_phys, SZ_4K);
84 if (apmu_base == NULL) { 84 if (apmu_base == NULL) {
85 pr_err("error to ioremap APMU base\n"); 85 pr_err("error to ioremap APMU base\n");
86 return; 86 return;
87 } 87 }
88 88
89 apbc_base = ioremap(APB_PHYS_BASE + 0x15000, SZ_4K); 89 apbc_base = ioremap(apbc_phys, SZ_4K);
90 if (apbc_base == NULL) { 90 if (apbc_base == NULL) {
91 pr_err("error to ioremap APBC base\n"); 91 pr_err("error to ioremap APBC base\n");
92 return; 92 return;
diff --git a/drivers/clk/mmp/clk-pxa910.c b/drivers/clk/mmp/clk-pxa910.c
index 993abcdb32cc..e1d2ce22cdf1 100644
--- a/drivers/clk/mmp/clk-pxa910.c
+++ b/drivers/clk/mmp/clk-pxa910.c
@@ -9,6 +9,7 @@
9 * warranty of any kind, whether express or implied. 9 * warranty of any kind, whether express or implied.
10 */ 10 */
11 11
12#include <linux/clk.h>
12#include <linux/module.h> 13#include <linux/module.h>
13#include <linux/kernel.h> 14#include <linux/kernel.h>
14#include <linux/spinlock.h> 15#include <linux/spinlock.h>
@@ -16,8 +17,6 @@
16#include <linux/delay.h> 17#include <linux/delay.h>
17#include <linux/err.h> 18#include <linux/err.h>
18 19
19#include <mach/addr-map.h>
20
21#include "clk.h" 20#include "clk.h"
22 21
23#define APBC_RTC 0x28 22#define APBC_RTC 0x28
@@ -64,7 +63,8 @@ static const char *disp_parent[] = {"pll1_2", "pll1_12"};
64static const char *ccic_parent[] = {"pll1_2", "pll1_12"}; 63static const char *ccic_parent[] = {"pll1_2", "pll1_12"};
65static const char *ccic_phy_parent[] = {"pll1_6", "pll1_12"}; 64static const char *ccic_phy_parent[] = {"pll1_6", "pll1_12"};
66 65
67void __init pxa910_clk_init(void) 66void __init pxa910_clk_init(phys_addr_t mpmu_phys, phys_addr_t apmu_phys,
67 phys_addr_t apbc_phys, phys_addr_t apbcp_phys)
68{ 68{
69 struct clk *clk; 69 struct clk *clk;
70 struct clk *uart_pll; 70 struct clk *uart_pll;
@@ -73,25 +73,25 @@ void __init pxa910_clk_init(void)
73 void __iomem *apbcp_base; 73 void __iomem *apbcp_base;
74 void __iomem *apbc_base; 74 void __iomem *apbc_base;
75 75
76 mpmu_base = ioremap(APB_PHYS_BASE + 0x50000, SZ_4K); 76 mpmu_base = ioremap(mpmu_phys, SZ_4K);
77 if (mpmu_base == NULL) { 77 if (mpmu_base == NULL) {
78 pr_err("error to ioremap MPMU base\n"); 78 pr_err("error to ioremap MPMU base\n");
79 return; 79 return;
80 } 80 }
81 81
82 apmu_base = ioremap(AXI_PHYS_BASE + 0x82800, SZ_4K); 82 apmu_base = ioremap(apmu_phys, SZ_4K);
83 if (apmu_base == NULL) { 83 if (apmu_base == NULL) {
84 pr_err("error to ioremap APMU base\n"); 84 pr_err("error to ioremap APMU base\n");
85 return; 85 return;
86 } 86 }
87 87
88 apbcp_base = ioremap(APB_PHYS_BASE + 0x3b000, SZ_4K); 88 apbcp_base = ioremap(apbcp_phys, SZ_4K);
89 if (apbcp_base == NULL) { 89 if (apbcp_base == NULL) {
90 pr_err("error to ioremap APBC extension base\n"); 90 pr_err("error to ioremap APBC extension base\n");
91 return; 91 return;
92 } 92 }
93 93
94 apbc_base = ioremap(APB_PHYS_BASE + 0x15000, SZ_4K); 94 apbc_base = ioremap(apbc_phys, SZ_4K);
95 if (apbc_base == NULL) { 95 if (apbc_base == NULL) {
96 pr_err("error to ioremap APBC base\n"); 96 pr_err("error to ioremap APBC base\n");
97 return; 97 return;
diff --git a/include/linux/clk/mmp.h b/include/linux/clk/mmp.h
new file mode 100644
index 000000000000..607321fa2c2b
--- /dev/null
+++ b/include/linux/clk/mmp.h
@@ -0,0 +1,17 @@
1#ifndef __CLK_MMP_H
2#define __CLK_MMP_H
3
4#include <linux/types.h>
5
6extern void pxa168_clk_init(phys_addr_t mpmu_phys,
7 phys_addr_t apmu_phys,
8 phys_addr_t apbc_phys);
9extern void pxa910_clk_init(phys_addr_t mpmu_phys,
10 phys_addr_t apmu_phys,
11 phys_addr_t apbc_phys,
12 phys_addr_t apbcp_phys);
13extern void mmp2_clk_init(phys_addr_t mpmu_phys,
14 phys_addr_t apmu_phys,
15 phys_addr_t apbc_phys);
16
17#endif