Skip to content

Commit 512e53b

Browse files
Magnus Dammhorms
authored andcommitted
ARM: shmobile: Introduce r8a7790_read_mode_pins()
Break out the r8a7790 boot mode code into a separate function so it can be shared by multiple users. Signed-off-by: Magnus Damm <[email protected]> Signed-off-by: Simon Horman <[email protected]>
1 parent 9a14562 commit 512e53b

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

arch/arm/mach-shmobile/clock-r8a7790.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <linux/clkdev.h>
2525
#include <mach/clock.h>
2626
#include <mach/common.h>
27+
#include <mach/r8a7790.h>
2728

2829
/*
2930
* MD EXTAL PLL0 PLL1 PLL3
@@ -42,8 +43,6 @@
4243
* see "p1 / 2" on R8A7790_CLOCK_ROOT() below
4344
*/
4445

45-
#define MD(nr) (1 << nr)
46-
4746
#define CPG_BASE 0xe6150000
4847
#define CPG_LEN 0x1000
4948

@@ -53,7 +52,6 @@
5352
#define SMSTPCR5 0xe6150144
5453
#define SMSTPCR7 0xe615014c
5554

56-
#define MODEMR 0xE6160060
5755
#define SDCKCR 0xE6150074
5856
#define SD2CKCR 0xE6150078
5957
#define SD3CKCR 0xE615007C
@@ -288,14 +286,9 @@ static struct clk_lookup lookups[] = {
288286

289287
void __init r8a7790_clock_init(void)
290288
{
291-
void __iomem *modemr = ioremap_nocache(MODEMR, PAGE_SIZE);
292-
u32 mode;
289+
u32 mode = r8a7790_read_mode_pins();
293290
int k, ret = 0;
294291

295-
BUG_ON(!modemr);
296-
mode = ioread32(modemr);
297-
iounmap(modemr);
298-
299292
switch (mode & (MD(14) | MD(13))) {
300293
case 0:
301294
R8A7790_CLOCK_ROOT(15, &extal_clk, 172, 208, 106, 88);

arch/arm/mach-shmobile/include/mach/r8a7790.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@ void r8a7790_pinmux_init(void);
77
void r8a7790_init_delay(void);
88
void r8a7790_timer_init(void);
99

10+
#define MD(nr) BIT(nr)
11+
u32 r8a7790_read_mode_pins(void);
12+
1013
#endif /* __ASM_R8A7790_H__ */

arch/arm/mach-shmobile/setup-r8a7790.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,20 @@ void __init r8a7790_add_standard_devices(void)
196196
r8a7790_register_cmt(00);
197197
}
198198

199+
#define MODEMR 0xe6160060
200+
201+
u32 __init r8a7790_read_mode_pins(void)
202+
{
203+
void __iomem *modemr = ioremap_nocache(MODEMR, 4);
204+
u32 mode;
205+
206+
BUG_ON(!modemr);
207+
mode = ioread32(modemr);
208+
iounmap(modemr);
209+
210+
return mode;
211+
}
212+
199213
void __init r8a7790_timer_init(void)
200214
{
201215
void __iomem *cntcr;

0 commit comments

Comments
 (0)