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 <damm@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
This commit is contained in:
Magnus Damm 2013-07-12 01:22:19 +09:00 committed by Simon Horman
parent 9a1456242c
commit 512e53bc7f
3 changed files with 19 additions and 9 deletions

View File

@ -24,6 +24,7 @@
#include <linux/clkdev.h> #include <linux/clkdev.h>
#include <mach/clock.h> #include <mach/clock.h>
#include <mach/common.h> #include <mach/common.h>
#include <mach/r8a7790.h>
/* /*
* MD EXTAL PLL0 PLL1 PLL3 * MD EXTAL PLL0 PLL1 PLL3
@ -42,8 +43,6 @@
* see "p1 / 2" on R8A7790_CLOCK_ROOT() below * see "p1 / 2" on R8A7790_CLOCK_ROOT() below
*/ */
#define MD(nr) (1 << nr)
#define CPG_BASE 0xe6150000 #define CPG_BASE 0xe6150000
#define CPG_LEN 0x1000 #define CPG_LEN 0x1000
@ -53,7 +52,6 @@
#define SMSTPCR5 0xe6150144 #define SMSTPCR5 0xe6150144
#define SMSTPCR7 0xe615014c #define SMSTPCR7 0xe615014c
#define MODEMR 0xE6160060
#define SDCKCR 0xE6150074 #define SDCKCR 0xE6150074
#define SD2CKCR 0xE6150078 #define SD2CKCR 0xE6150078
#define SD3CKCR 0xE615007C #define SD3CKCR 0xE615007C
@ -288,14 +286,9 @@ static struct clk_lookup lookups[] = {
void __init r8a7790_clock_init(void) void __init r8a7790_clock_init(void)
{ {
void __iomem *modemr = ioremap_nocache(MODEMR, PAGE_SIZE); u32 mode = r8a7790_read_mode_pins();
u32 mode;
int k, ret = 0; int k, ret = 0;
BUG_ON(!modemr);
mode = ioread32(modemr);
iounmap(modemr);
switch (mode & (MD(14) | MD(13))) { switch (mode & (MD(14) | MD(13))) {
case 0: case 0:
R8A7790_CLOCK_ROOT(15, &extal_clk, 172, 208, 106, 88); R8A7790_CLOCK_ROOT(15, &extal_clk, 172, 208, 106, 88);

View File

@ -7,4 +7,7 @@ void r8a7790_pinmux_init(void);
void r8a7790_init_delay(void); void r8a7790_init_delay(void);
void r8a7790_timer_init(void); void r8a7790_timer_init(void);
#define MD(nr) BIT(nr)
u32 r8a7790_read_mode_pins(void);
#endif /* __ASM_R8A7790_H__ */ #endif /* __ASM_R8A7790_H__ */

View File

@ -196,6 +196,20 @@ void __init r8a7790_add_standard_devices(void)
r8a7790_register_cmt(00); r8a7790_register_cmt(00);
} }
#define MODEMR 0xe6160060
u32 __init r8a7790_read_mode_pins(void)
{
void __iomem *modemr = ioremap_nocache(MODEMR, 4);
u32 mode;
BUG_ON(!modemr);
mode = ioread32(modemr);
iounmap(modemr);
return mode;
}
void __init r8a7790_timer_init(void) void __init r8a7790_timer_init(void)
{ {
void __iomem *cntcr; void __iomem *cntcr;