From aaa717ebdec1859c263ba0a25afab255e8ab6038 Mon Sep 17 00:00:00 2001 From: Nobuhiro Iwamatsu Date: Tue, 2 Dec 2014 16:52:18 +0900 Subject: arm: rmobile: rcar: Move module control register to header file of SoC Module control registers of R-Car ARM SoC (r8a7790, r8a7791, r8a7793 and r8a7794) are same address. This moves these to header file of SoC. Signed-off-by: Nobuhiro Iwamatsu Signed-off-by: Nobuhiro Iwamatsu --- board/renesas/alt/alt.c | 11 ----------- board/renesas/gose/gose.c | 8 -------- board/renesas/koelsch/koelsch.c | 8 -------- board/renesas/lager/lager.c | 8 -------- 4 files changed, 35 deletions(-) (limited to 'board') diff --git a/board/renesas/alt/alt.c b/board/renesas/alt/alt.c index 523c5f1..bf90f2e 100644 --- a/board/renesas/alt/alt.c +++ b/board/renesas/alt/alt.c @@ -37,20 +37,9 @@ void s_init(void) qos_init(); } -#define MSTPSR1 0xE6150038 -#define SMSTPCR1 0xE6150134 #define TMU0_MSTP125 (1 << 25) - -#define MSTPSR7 0xE61501C4 -#define SMSTPCR7 0xE615014C #define SCIF2_MSTP719 (1 << 19) - -#define MSTPSR8 0xE61509A0 -#define SMSTPCR8 0xE6150990 #define ETHER_MSTP813 (1 << 13) - -#define MSTPSR3 0xE6150048 -#define SMSTPCR3 0xE615013C #define IIC1_MSTP323 (1 << 23) #define mstp_setbits(type, addr, saddr, set) \ diff --git a/board/renesas/gose/gose.c b/board/renesas/gose/gose.c index 715fba0..bb6849e 100644 --- a/board/renesas/gose/gose.c +++ b/board/renesas/gose/gose.c @@ -41,16 +41,8 @@ void s_init(void) qos_init(); } -#define MSTPSR1 0xE6150038 -#define SMSTPCR1 0xE6150134 #define TMU0_MSTP125 (1 << 25) - -#define MSTPSR7 0xE61501C4 -#define SMSTPCR7 0xE615014C #define SCIF0_MSTP721 (1 << 21) - -#define MSTPSR8 0xE61509A0 -#define SMSTPCR8 0xE6150990 #define ETHER_MSTP813 (1 << 13) #define mstp_setbits(type, addr, saddr, set) \ diff --git a/board/renesas/koelsch/koelsch.c b/board/renesas/koelsch/koelsch.c index 244bc58..14d1770 100644 --- a/board/renesas/koelsch/koelsch.c +++ b/board/renesas/koelsch/koelsch.c @@ -43,16 +43,8 @@ void s_init(void) qos_init(); } -#define MSTPSR1 0xE6150038 -#define SMSTPCR1 0xE6150134 #define TMU0_MSTP125 (1 << 25) - -#define MSTPSR7 0xE61501C4 -#define SMSTPCR7 0xE615014C #define SCIF0_MSTP721 (1 << 21) - -#define MSTPSR8 0xE61509A0 -#define SMSTPCR8 0xE6150990 #define ETHER_MSTP813 (1 << 13) #define mstp_setbits(type, addr, saddr, set) \ diff --git a/board/renesas/lager/lager.c b/board/renesas/lager/lager.c index 93273b2..23ef194 100644 --- a/board/renesas/lager/lager.c +++ b/board/renesas/lager/lager.c @@ -50,16 +50,8 @@ void s_init(void) qos_init(); } -#define MSTPSR1 0xE6150038 -#define SMSTPCR1 0xE6150134 #define TMU0_MSTP125 (1 << 25) - -#define MSTPSR7 0xE61501C4 -#define SMSTPCR7 0xE615014C #define SCIF0_MSTP721 (1 << 21) - -#define MSTPSR8 0xE61509A0 -#define SMSTPCR8 0xE6150990 #define ETHER_MSTP813 (1 << 13) #define mstp_setbits(type, addr, saddr, set) \ -- cgit v1.1 From 44e1eebf86efc917010b8fd482951b10c3b06453 Mon Sep 17 00:00:00 2001 From: Nobuhiro Iwamatsu Date: Tue, 2 Dec 2014 16:52:19 +0900 Subject: arm: rmobile: rcar: Move control macro of mstp to arch-rmobile/rcar-mstp.h Control macro of mstp is common in R-Car ARM SoC (r8a7790, r8a7791, r8a7793 and r8a7794). This moves these to arch-rmobile/rcar-mstp.h Signed-off-by: Nobuhiro Iwamatsu Signed-off-by: Nobuhiro Iwamatsu --- board/renesas/alt/alt.c | 10 +--------- board/renesas/gose/gose.c | 10 +--------- board/renesas/koelsch/koelsch.c | 10 +--------- board/renesas/lager/lager.c | 10 +--------- 4 files changed, 4 insertions(+), 36 deletions(-) (limited to 'board') diff --git a/board/renesas/alt/alt.c b/board/renesas/alt/alt.c index bf90f2e..e3cfe54 100644 --- a/board/renesas/alt/alt.c +++ b/board/renesas/alt/alt.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -42,15 +43,6 @@ void s_init(void) #define ETHER_MSTP813 (1 << 13) #define IIC1_MSTP323 (1 << 23) -#define mstp_setbits(type, addr, saddr, set) \ - out_##type((saddr), in_##type(addr) | (set)) -#define mstp_clrbits(type, addr, saddr, clear) \ - out_##type((saddr), in_##type(addr) & ~(clear)) -#define mstp_setbits_le32(addr, saddr, set) \ - mstp_setbits(le32, addr, saddr, set) -#define mstp_clrbits_le32(addr, saddr, clear) \ - mstp_clrbits(le32, addr, saddr, clear) - int board_early_init_f(void) { /* TMU */ diff --git a/board/renesas/gose/gose.c b/board/renesas/gose/gose.c index bb6849e..0b2d904 100644 --- a/board/renesas/gose/gose.c +++ b/board/renesas/gose/gose.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -45,15 +46,6 @@ void s_init(void) #define SCIF0_MSTP721 (1 << 21) #define ETHER_MSTP813 (1 << 13) -#define mstp_setbits(type, addr, saddr, set) \ - out_##type((saddr), in_##type(addr) | (set)) -#define mstp_clrbits(type, addr, saddr, clear) \ - out_##type((saddr), in_##type(addr) & ~(clear)) -#define mstp_setbits_le32(addr, saddr, set) \ - mstp_setbits(le32, addr, saddr, set) -#define mstp_clrbits_le32(addr, saddr, clear) \ - mstp_clrbits(le32, addr, saddr, clear) - int board_early_init_f(void) { /* TMU0 */ diff --git a/board/renesas/koelsch/koelsch.c b/board/renesas/koelsch/koelsch.c index 14d1770..5ebbfcf 100644 --- a/board/renesas/koelsch/koelsch.c +++ b/board/renesas/koelsch/koelsch.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -47,15 +48,6 @@ void s_init(void) #define SCIF0_MSTP721 (1 << 21) #define ETHER_MSTP813 (1 << 13) -#define mstp_setbits(type, addr, saddr, set) \ - out_##type((saddr), in_##type(addr) | (set)) -#define mstp_clrbits(type, addr, saddr, clear) \ - out_##type((saddr), in_##type(addr) & ~(clear)) -#define mstp_setbits_le32(addr, saddr, set) \ - mstp_setbits(le32, addr, saddr, set) -#define mstp_clrbits_le32(addr, saddr, clear) \ - mstp_clrbits(le32, addr, saddr, clear) - int board_early_init_f(void) { mstp_clrbits_le32(MSTPSR1, SMSTPCR1, TMU0_MSTP125); diff --git a/board/renesas/lager/lager.c b/board/renesas/lager/lager.c index 23ef194..47cf51b 100644 --- a/board/renesas/lager/lager.c +++ b/board/renesas/lager/lager.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include "qos.h" @@ -54,15 +55,6 @@ void s_init(void) #define SCIF0_MSTP721 (1 << 21) #define ETHER_MSTP813 (1 << 13) -#define mstp_setbits(type, addr, saddr, set) \ - out_##type((saddr), in_##type(addr) | (set)) -#define mstp_clrbits(type, addr, saddr, clear) \ - out_##type((saddr), in_##type(addr) & ~(clear)) -#define mstp_setbits_le32(addr, saddr, set) \ - mstp_setbits(le32, addr, saddr, set) -#define mstp_clrbits_le32(addr, saddr, clear) \ - mstp_clrbits(le32, addr, saddr, clear) - int board_early_init_f(void) { /* TMU0 */ -- cgit v1.1 From 72fd3838c6cc861e5061d99316c35eed62a3fb85 Mon Sep 17 00:00:00 2001 From: Nobuhiro Iwamatsu Date: Tue, 2 Dec 2014 16:52:20 +0900 Subject: arm: rmobile: rcar: Move arch_preboot_os function to rcar-gen2-common/common.c The arch_preboot_os function used in boards using R-Car ARM SoC (r8a7790, r8a7791, r8a7793 and r8a7794) is common. This makes rcar-gen2-common/common.c file providing common function for R-Car ARM SoC, and moves this function to this file. Signed-off-by: Nobuhiro Iwamatsu Signed-off-by: Nobuhiro Iwamatsu --- board/renesas/alt/Makefile | 2 +- board/renesas/alt/alt.c | 6 ------ board/renesas/gose/Makefile | 2 +- board/renesas/gose/gose.c | 10 ---------- board/renesas/koelsch/Makefile | 2 +- board/renesas/koelsch/koelsch.c | 6 ------ board/renesas/lager/Makefile | 2 +- board/renesas/lager/lager.c | 6 ------ board/renesas/rcar-gen2-common/common.c | 27 +++++++++++++++++++++++++++ 9 files changed, 31 insertions(+), 32 deletions(-) create mode 100644 board/renesas/rcar-gen2-common/common.c (limited to 'board') diff --git a/board/renesas/alt/Makefile b/board/renesas/alt/Makefile index 9ed12bd..6904e39 100644 --- a/board/renesas/alt/Makefile +++ b/board/renesas/alt/Makefile @@ -6,4 +6,4 @@ # SPDX-License-Identifier: GPL-2.0 # -obj-y := alt.o qos.o +obj-y := alt.o qos.o ../rcar-gen2-common/common.o diff --git a/board/renesas/alt/alt.c b/board/renesas/alt/alt.c index e3cfe54..c794d43 100644 --- a/board/renesas/alt/alt.c +++ b/board/renesas/alt/alt.c @@ -60,12 +60,6 @@ int board_early_init_f(void) return 0; } -void arch_preboot_os(void) -{ - /* Disable TMU0 */ - mstp_setbits_le32(MSTPSR1, SMSTPCR1, TMU0_MSTP125); -} - int board_init(void) { /* adress of boot parameters */ diff --git a/board/renesas/gose/Makefile b/board/renesas/gose/Makefile index a4fb6cc..2dac748 100644 --- a/board/renesas/gose/Makefile +++ b/board/renesas/gose/Makefile @@ -6,4 +6,4 @@ # SPDX-License-Identifier: GPL-2.0 # -obj-y := gose.o qos.o +obj-y := gose.o qos.o ../rcar-gen2-common/common.o diff --git a/board/renesas/gose/gose.c b/board/renesas/gose/gose.c index 0b2d904..677b976 100644 --- a/board/renesas/gose/gose.c +++ b/board/renesas/gose/gose.c @@ -60,16 +60,6 @@ int board_early_init_f(void) return 0; } -#define TSTR0 0x04 -#define TSTR0_STR0 0x01 -void arch_preboot_os(void) -{ - /* stop TMU0 */ - mstp_clrbits_le32(TMU_BASE + TSTR0, TMU_BASE + TSTR0, TSTR0_STR0); - /* Disable TMU0 */ - mstp_setbits_le32(MSTPSR1, SMSTPCR1, TMU0_MSTP125); -} - #define PUPR5 0xE6060114 #define PUPR5_ETH 0x3FFC0000 #define PUPR5_ETH_MAGIC (1 << 27) diff --git a/board/renesas/koelsch/Makefile b/board/renesas/koelsch/Makefile index b4d0183..c10bba5 100644 --- a/board/renesas/koelsch/Makefile +++ b/board/renesas/koelsch/Makefile @@ -6,4 +6,4 @@ # SPDX-License-Identifier: GPL-2.0 # -obj-y := koelsch.o qos.o +obj-y := koelsch.o qos.o ../rcar-gen2-common/common.o diff --git a/board/renesas/koelsch/koelsch.c b/board/renesas/koelsch/koelsch.c index 5ebbfcf..10fa571 100644 --- a/board/renesas/koelsch/koelsch.c +++ b/board/renesas/koelsch/koelsch.c @@ -61,12 +61,6 @@ int board_early_init_f(void) return 0; } -void arch_preboot_os(void) -{ - /* Disable TMU0 */ - mstp_setbits_le32(MSTPSR1, SMSTPCR1, TMU0_MSTP125); -} - /* LSI pin pull-up control */ #define PUPR5 0xe6060114 #define PUPR5_ETH 0x3FFC0000 diff --git a/board/renesas/lager/Makefile b/board/renesas/lager/Makefile index 034c6f8..8d03461 100644 --- a/board/renesas/lager/Makefile +++ b/board/renesas/lager/Makefile @@ -6,4 +6,4 @@ # SPDX-License-Identifier: GPL-2.0 # -obj-y := lager.o qos.o +obj-y := lager.o qos.o ../rcar-gen2-common/common.o diff --git a/board/renesas/lager/lager.c b/board/renesas/lager/lager.c index 47cf51b..4afb1ac 100644 --- a/board/renesas/lager/lager.c +++ b/board/renesas/lager/lager.c @@ -67,12 +67,6 @@ int board_early_init_f(void) return 0; } -void arch_preboot_os(void) -{ - /* Disable TMU0 */ - mstp_setbits_le32(MSTPSR1, SMSTPCR1, TMU0_MSTP125); -} - DECLARE_GLOBAL_DATA_PTR; int board_init(void) { diff --git a/board/renesas/rcar-gen2-common/common.c b/board/renesas/rcar-gen2-common/common.c new file mode 100644 index 0000000..23010ee --- /dev/null +++ b/board/renesas/rcar-gen2-common/common.c @@ -0,0 +1,27 @@ +/* + * board/renesas/rcar-gen2-common/common.c + * + * Copyright (C) 2013 Renesas Electronics Corporation + * Copyright (C) 2013 Nobuhiro Iwamatsu + * + * SPDX-License-Identifier: GPL-2.0 + */ + +#include +#include +#include +#include +#include + +#define TSTR0 0x04 +#define TSTR0_STR0 0x01 + +#define TMU0_MSTP125 (1 << 25) +void arch_preboot_os(void) +{ + /* stop TMU0 */ + mstp_clrbits_le32(TMU_BASE + TSTR0, TMU_BASE + TSTR0, TSTR0_STR0); + + /* Disable TMU0 */ + mstp_setbits_le32(MSTPSR1, SMSTPCR1, TMU0_MSTP125); +} -- cgit v1.1 From 8e2e58863a5bf10fee36709646692c072eafe555 Mon Sep 17 00:00:00 2001 From: Nobuhiro Iwamatsu Date: Tue, 2 Dec 2014 16:52:24 +0900 Subject: arm: rmobile: rcar: Stop clock prior to booting kernel This stops clock except INTC-RT, MSIF, INTC-SYS, IRQC and SCIF before kernel boots. Signed-off-by: Hisashi Nakamura Signed-off-by: Nobuhiro Iwamatsu Signed-off-by: Nobuhiro Iwamatsu --- board/renesas/rcar-gen2-common/common.c | 38 ++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) (limited to 'board') diff --git a/board/renesas/rcar-gen2-common/common.c b/board/renesas/rcar-gen2-common/common.c index 23010ee..0103f42 100644 --- a/board/renesas/rcar-gen2-common/common.c +++ b/board/renesas/rcar-gen2-common/common.c @@ -16,12 +16,44 @@ #define TSTR0 0x04 #define TSTR0_STR0 0x01 -#define TMU0_MSTP125 (1 << 25) +static struct mstp_ctl mstptbl[] = { + { SMSTPCR0, MSTP0_BITS, CONFIG_SMSTP0_ENA, + RMSTPCR0, MSTP0_BITS, CONFIG_RMSTP0_ENA }, + { SMSTPCR1, MSTP1_BITS, CONFIG_SMSTP1_ENA, + RMSTPCR1, MSTP1_BITS, CONFIG_RMSTP1_ENA }, + { SMSTPCR2, MSTP2_BITS, CONFIG_SMSTP2_ENA, + RMSTPCR2, MSTP2_BITS, CONFIG_RMSTP2_ENA }, + { SMSTPCR3, MSTP3_BITS, CONFIG_SMSTP3_ENA, + RMSTPCR3, MSTP3_BITS, CONFIG_RMSTP3_ENA }, + { SMSTPCR4, MSTP4_BITS, CONFIG_SMSTP4_ENA, + RMSTPCR4, MSTP4_BITS, CONFIG_RMSTP4_ENA }, + { SMSTPCR5, MSTP5_BITS, CONFIG_SMSTP5_ENA, + RMSTPCR5, MSTP5_BITS, CONFIG_RMSTP5_ENA }, + /* No MSTP6 */ + { SMSTPCR7, MSTP7_BITS, CONFIG_SMSTP7_ENA, + RMSTPCR7, MSTP7_BITS, CONFIG_RMSTP7_ENA }, + { SMSTPCR8, MSTP8_BITS, CONFIG_SMSTP8_ENA, + RMSTPCR8, MSTP8_BITS, CONFIG_RMSTP8_ENA }, + { SMSTPCR9, MSTP9_BITS, CONFIG_SMSTP9_ENA, + RMSTPCR9, MSTP9_BITS, CONFIG_RMSTP9_ENA }, + { SMSTPCR10, MSTP10_BITS, CONFIG_SMSTP10_ENA, + RMSTPCR10, MSTP10_BITS, CONFIG_RMSTP10_ENA }, + { SMSTPCR11, MSTP11_BITS, CONFIG_SMSTP1_ENA, + RMSTPCR11, MSTP11_BITS, CONFIG_RMSTP11_ENA }, +}; + void arch_preboot_os(void) { + int i; + /* stop TMU0 */ mstp_clrbits_le32(TMU_BASE + TSTR0, TMU_BASE + TSTR0, TSTR0_STR0); - /* Disable TMU0 */ - mstp_setbits_le32(MSTPSR1, SMSTPCR1, TMU0_MSTP125); + /* Stop module clock */ + for (i = 0; i < ARRAY_SIZE(mstptbl); i++) { + mstp_setclrbits_le32(mstptbl[i].s_addr, mstptbl[i].s_dis, + mstptbl[i].s_ena); + mstp_setclrbits_le32(mstptbl[i].r_addr, mstptbl[i].r_dis, + mstptbl[i].r_ena); + } } -- cgit v1.1 From d7916b1d38c20a55ca7248742dd0bdf049deb7e4 Mon Sep 17 00:00:00 2001 From: Nobuhiro Iwamatsu Date: Wed, 3 Dec 2014 15:30:30 +0900 Subject: arm: rmobile: lager: Add support MMC and MMC command Lager board has been connected to eMMC of 8GB to MMC1 port. This enables MMC1 port and MMC command. Signed-off-by: Nobuhiro Iwamatsu Signed-off-by: Nobuhiro Iwamatsu --- board/renesas/lager/lager.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'board') diff --git a/board/renesas/lager/lager.c b/board/renesas/lager/lager.c index 4afb1ac..d1e29d2 100644 --- a/board/renesas/lager/lager.c +++ b/board/renesas/lager/lager.c @@ -19,8 +19,10 @@ #include #include #include +#include #include #include +#include #include "qos.h" DECLARE_GLOBAL_DATA_PTR; @@ -54,6 +56,7 @@ void s_init(void) #define TMU0_MSTP125 (1 << 25) #define SCIF0_MSTP721 (1 << 21) #define ETHER_MSTP813 (1 << 13) +#define MMC1_MSTP305 (1 << 5) int board_early_init_f(void) { @@ -63,6 +66,8 @@ int board_early_init_f(void) mstp_clrbits_le32(MSTPSR7, SMSTPCR7, SCIF0_MSTP721); /* ETHER */ mstp_clrbits_le32(MSTPSR8, SMSTPCR8, ETHER_MSTP813); + /* eMMC */ + mstp_clrbits_le32(MSTPSR3, SMSTPCR3, MMC1_MSTP305); return 0; } @@ -141,6 +146,28 @@ int board_phy_config(struct phy_device *phydev) return 0; } +int board_mmc_init(bd_t *bis) +{ + int ret = 0; + +#ifdef CONFIG_SH_MMCIF + gpio_request(GPIO_FN_MMC1_D0, NULL); + gpio_request(GPIO_FN_MMC1_D1, NULL); + gpio_request(GPIO_FN_MMC1_D2, NULL); + gpio_request(GPIO_FN_MMC1_D3, NULL); + gpio_request(GPIO_FN_MMC1_D4, NULL); + gpio_request(GPIO_FN_MMC1_D5, NULL); + gpio_request(GPIO_FN_MMC1_D6, NULL); + gpio_request(GPIO_FN_MMC1_D7, NULL); + gpio_request(GPIO_FN_MMC1_CLK, NULL); + gpio_request(GPIO_FN_MMC1_CMD, NULL); + + ret = mmcif_mmc_init(); +#endif + return ret; +} + + int dram_init(void) { gd->ram_size = CONFIG_SYS_SDRAM_SIZE; -- cgit v1.1 From 2b8c0814f88fa2d6fd8a1ac994e4396b39a0eac8 Mon Sep 17 00:00:00 2001 From: Nobuhiro Iwamatsu Date: Wed, 3 Dec 2014 15:30:30 +0900 Subject: arm: rmobile: alt: Add support MMC and MMC command Alt board has been connected to eMMC of 8GB to MMC port. This enables MMC port and MMC command. Signed-off-by: Nobuhiro Iwamatsu Signed-off-by: Nobuhiro Iwamatsu --- board/renesas/alt/alt.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'board') diff --git a/board/renesas/alt/alt.c b/board/renesas/alt/alt.c index c794d43..8cc17e9 100644 --- a/board/renesas/alt/alt.c +++ b/board/renesas/alt/alt.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -42,6 +43,7 @@ void s_init(void) #define SCIF2_MSTP719 (1 << 19) #define ETHER_MSTP813 (1 << 13) #define IIC1_MSTP323 (1 << 23) +#define MMC0_MSTP315 (1 << 15) int board_early_init_f(void) { @@ -57,6 +59,10 @@ int board_early_init_f(void) /* IIC1 / sh-i2c ch1 */ mstp_clrbits_le32(MSTPSR3, SMSTPCR3, IIC1_MSTP323); +#ifdef CONFIG_SH_MMCIF + /* MMC */ + mstp_clrbits_le32(MSTPSR3, SMSTPCR3, MMC0_MSTP315); +#endif return 0; } @@ -120,6 +126,19 @@ int board_eth_init(bd_t *bis) #endif } +int board_mmc_init(bd_t *bis) +{ + int ret = 0; + +#ifdef CONFIG_SH_MMCIF + gpio_request(GPIO_GP_4_31, NULL); + gpio_set_value(GPIO_GP_4_31, 1); + + ret = mmcif_mmc_init(); +#endif + return ret; +} + int dram_init(void) { gd->ram_size = CONFIG_SYS_SDRAM_SIZE; -- cgit v1.1