aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2016-05-09 09:41:24 -0400
committerArnd Bergmann <arnd@arndb.de>2016-05-09 09:41:24 -0400
commitb65b98d9ac27a97a715b076ead50e408026bfbf4 (patch)
treed16cc2722ed29beb3a429c078dc779412928fcda
parent2377f9fdac3086c6bb167c83f05ad91fb66d8e9d (diff)
parent71d42e9c71d7fca2eca98eac315cb485b5d2314d (diff)
Merge tag 'lpc32xx-soc-4.7' of git://github.com/vzapolskiy/linux-lpc32xx into next/soc
Merge "NXP LPC32xx mach updates for v4.7" from Vladimir Zapolskiy: This includes a few nonfunctional clean-ups for NXP LPC32xx: * removed leftover from restart code migration to a watchdog driver * removed dead code leftovers from migration to CCF driver * fix double const qualifier * tag 'lpc32xx-soc-4.7' of git://github.com/vzapolskiy/linux-lpc32xx: ARM: lpc32xx: remove duplicate const on lpc32xx_auxdata_lookup ARM: lpc32xx: remove leftovers of legacy clock source and provider drivers ARM: lpc32xx: remove reboot header file
-rw-r--r--arch/arm/mach-lpc32xx/common.c95
-rw-r--r--arch/arm/mach-lpc32xx/common.h24
-rw-r--r--arch/arm/mach-lpc32xx/phy3250.c2
3 files changed, 2 insertions, 119 deletions
diff --git a/arch/arm/mach-lpc32xx/common.c b/arch/arm/mach-lpc32xx/common.c
index 5b7a1e78c3a5..2f6067bce7c3 100644
--- a/arch/arm/mach-lpc32xx/common.c
+++ b/arch/arm/mach-lpc32xx/common.c
@@ -17,13 +17,6 @@
17 */ 17 */
18 18
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/platform_device.h>
21#include <linux/interrupt.h>
22#include <linux/irq.h>
23#include <linux/err.h>
24#include <linux/i2c.h>
25#include <linux/i2c-pnx.h>
26#include <linux/io.h>
27 20
28#include <asm/mach/map.h> 21#include <asm/mach/map.h>
29#include <asm/system_info.h> 22#include <asm/system_info.h>
@@ -44,19 +37,6 @@ void lpc32xx_get_uid(u32 devid[4])
44} 37}
45 38
46/* 39/*
47 * Returns SYSCLK source
48 * 0 = PLL397, 1 = main oscillator
49 */
50int clk_is_sysclk_mainosc(void)
51{
52 if ((__raw_readl(LPC32XX_CLKPWR_SYSCLK_CTRL) &
53 LPC32XX_CLKPWR_SYSCTRL_SYSCLKMUX) == 0)
54 return 1;
55
56 return 0;
57}
58
59/*
60 * Detects and returns IRAM size for the device variation 40 * Detects and returns IRAM size for the device variation
61 */ 41 */
62#define LPC32XX_IRAM_BANK_SIZE SZ_128K 42#define LPC32XX_IRAM_BANK_SIZE SZ_128K
@@ -87,81 +67,6 @@ u32 lpc32xx_return_iram_size(void)
87} 67}
88EXPORT_SYMBOL_GPL(lpc32xx_return_iram_size); 68EXPORT_SYMBOL_GPL(lpc32xx_return_iram_size);
89 69
90/*
91 * Computes PLL rate from PLL register and input clock
92 */
93u32 clk_check_pll_setup(u32 ifreq, struct clk_pll_setup *pllsetup)
94{
95 u32 ilfreq, p, m, n, fcco, fref, cfreq;
96 int mode;
97
98 /*
99 * PLL requirements
100 * ifreq must be >= 1MHz and <= 20MHz
101 * FCCO must be >= 156MHz and <= 320MHz
102 * FREF must be >= 1MHz and <= 27MHz
103 * Assume the passed input data is not valid
104 */
105
106 ilfreq = ifreq;
107 m = pllsetup->pll_m;
108 n = pllsetup->pll_n;
109 p = pllsetup->pll_p;
110
111 mode = (pllsetup->cco_bypass_b15 << 2) |
112 (pllsetup->direct_output_b14 << 1) |
113 pllsetup->fdbk_div_ctrl_b13;
114
115 switch (mode) {
116 case 0x0: /* Non-integer mode */
117 cfreq = (m * ilfreq) / (2 * p * n);
118 fcco = (m * ilfreq) / n;
119 fref = ilfreq / n;
120 break;
121
122 case 0x1: /* integer mode */
123 cfreq = (m * ilfreq) / n;
124 fcco = (m * ilfreq) / (n * 2 * p);
125 fref = ilfreq / n;
126 break;
127
128 case 0x2:
129 case 0x3: /* Direct mode */
130 cfreq = (m * ilfreq) / n;
131 fcco = cfreq;
132 fref = ilfreq / n;
133 break;
134
135 case 0x4:
136 case 0x5: /* Bypass mode */
137 cfreq = ilfreq / (2 * p);
138 fcco = 156000000;
139 fref = 1000000;
140 break;
141
142 case 0x6:
143 case 0x7: /* Direct bypass mode */
144 default:
145 cfreq = ilfreq;
146 fcco = 156000000;
147 fref = 1000000;
148 break;
149 }
150
151 if (fcco < 156000000 || fcco > 320000000)
152 cfreq = 0;
153
154 if (fref < 1000000 || fref > 27000000)
155 cfreq = 0;
156
157 return (u32) cfreq;
158}
159
160u32 clk_get_pclk_div(void)
161{
162 return 1 + ((__raw_readl(LPC32XX_CLKPWR_HCLK_DIV) >> 2) & 0x1F);
163}
164
165static struct map_desc lpc32xx_io_desc[] __initdata = { 70static struct map_desc lpc32xx_io_desc[] __initdata = {
166 { 71 {
167 .virtual = (unsigned long)IO_ADDRESS(LPC32XX_AHB0_START), 72 .virtual = (unsigned long)IO_ADDRESS(LPC32XX_AHB0_START),
diff --git a/arch/arm/mach-lpc32xx/common.h b/arch/arm/mach-lpc32xx/common.h
index 2d90801ed1e1..30c9e64fc65b 100644
--- a/arch/arm/mach-lpc32xx/common.h
+++ b/arch/arm/mach-lpc32xx/common.h
@@ -19,37 +19,15 @@
19#ifndef __LPC32XX_COMMON_H 19#ifndef __LPC32XX_COMMON_H
20#define __LPC32XX_COMMON_H 20#define __LPC32XX_COMMON_H
21 21
22#include <mach/board.h> 22#include <linux/init.h>
23#include <linux/platform_device.h>
24#include <linux/reboot.h>
25 23
26/* 24/*
27 * Other arch specific structures and functions 25 * Other arch specific structures and functions
28 */ 26 */
29extern void lpc32xx_timer_init(void);
30extern void __init lpc32xx_init_irq(void); 27extern void __init lpc32xx_init_irq(void);
31extern void __init lpc32xx_map_io(void); 28extern void __init lpc32xx_map_io(void);
32extern void __init lpc32xx_serial_init(void); 29extern void __init lpc32xx_serial_init(void);
33 30
34
35/*
36 * Structure used for setting up and querying the PLLS
37 */
38struct clk_pll_setup {
39 int analog_on;
40 int cco_bypass_b15;
41 int direct_output_b14;
42 int fdbk_div_ctrl_b13;
43 int pll_p;
44 int pll_n;
45 u32 pll_m;
46};
47
48extern int clk_is_sysclk_mainosc(void);
49extern u32 clk_check_pll_setup(u32 ifreq, struct clk_pll_setup *pllsetup);
50extern u32 clk_get_pllrate_from_reg(u32 inputclk, u32 regval);
51extern u32 clk_get_pclk_div(void);
52
53/* 31/*
54 * Returns the LPC32xx unique 128-bit chip ID 32 * Returns the LPC32xx unique 128-bit chip ID
55 */ 33 */
diff --git a/arch/arm/mach-lpc32xx/phy3250.c b/arch/arm/mach-lpc32xx/phy3250.c
index b2f9e226febe..1ae723072521 100644
--- a/arch/arm/mach-lpc32xx/phy3250.c
+++ b/arch/arm/mach-lpc32xx/phy3250.c
@@ -159,7 +159,7 @@ static struct lpc32xx_mlc_platform_data lpc32xx_mlc_data = {
159 .dma_filter = pl08x_filter_id, 159 .dma_filter = pl08x_filter_id,
160}; 160};
161 161
162static const struct of_dev_auxdata const lpc32xx_auxdata_lookup[] __initconst = { 162static const struct of_dev_auxdata lpc32xx_auxdata_lookup[] __initconst = {
163 OF_DEV_AUXDATA("arm,pl022", 0x20084000, "dev:ssp0", NULL), 163 OF_DEV_AUXDATA("arm,pl022", 0x20084000, "dev:ssp0", NULL),
164 OF_DEV_AUXDATA("arm,pl022", 0x2008C000, "dev:ssp1", NULL), 164 OF_DEV_AUXDATA("arm,pl022", 0x2008C000, "dev:ssp1", NULL),
165 OF_DEV_AUXDATA("arm,pl110", 0x31040000, "dev:clcd", &lpc32xx_clcd_data), 165 OF_DEV_AUXDATA("arm,pl110", 0x31040000, "dev:clcd", &lpc32xx_clcd_data),