From 43c8352e3e6b5142c9295d4934e2fd657ff6be39 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 13 May 2017 15:57:34 +0200 Subject: ARM: rmobile: Update link address to match latest BL2 Update the CONFIG_SYS_TEXT_BASE to match BL2 Rev.1.0.9 and newer, which loads the U-Boot to 0x50000000 . Signed-off-by: Marek Vasut Cc: Hiroyuki Yokoyama Cc: Nobuhiro Iwamatsu --- include/configs/rcar-gen3-common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/configs') diff --git a/include/configs/rcar-gen3-common.h b/include/configs/rcar-gen3-common.h index 056aea3fdb0..c87d31950fd 100644 --- a/include/configs/rcar-gen3-common.h +++ b/include/configs/rcar-gen3-common.h @@ -52,7 +52,7 @@ #define CONFIG_SYS_BAUDRATE_TABLE { 115200, 38400 } /* MEMORY */ -#define CONFIG_SYS_TEXT_BASE 0x49000000 +#define CONFIG_SYS_TEXT_BASE 0x50000000 #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE + 0x7fff0) #define CONFIG_SYS_SDRAM_BASE (0x48000000) -- cgit v1.3.1 From 2dea3b3e7b281f6b3b9fde318749212e02b3e0a2 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 13 May 2017 15:57:39 +0200 Subject: ARM: rmobile: Add R8A7796 support Add Kconfig entry for the R8A7796 RCar M3 SoC. Signed-off-by: Marek Vasut Cc: Hiroyuki Yokoyama Cc: Nobuhiro Iwamatsu --- arch/arm/mach-rmobile/Kconfig.64 | 3 +++ arch/arm/mach-rmobile/Makefile | 1 + arch/arm/mach-rmobile/include/mach/r8a7796.h | 39 ++++++++++++++++++++++++++++ arch/arm/mach-rmobile/include/mach/rmobile.h | 2 ++ arch/arm/mach-rmobile/memmap-r8a7796.c | 30 +++++++++++++++++++++ include/configs/rcar-gen3-common.h | 31 ++++++++++++++++++---- 6 files changed, 101 insertions(+), 5 deletions(-) create mode 100644 arch/arm/mach-rmobile/include/mach/r8a7796.h create mode 100644 arch/arm/mach-rmobile/memmap-r8a7796.c (limited to 'include/configs') diff --git a/arch/arm/mach-rmobile/Kconfig.64 b/arch/arm/mach-rmobile/Kconfig.64 index e0c27ed9c66..4ffc40edc6e 100644 --- a/arch/arm/mach-rmobile/Kconfig.64 +++ b/arch/arm/mach-rmobile/Kconfig.64 @@ -6,6 +6,9 @@ choice config R8A7795 bool "Renesas SoC R8A7795" +config R8A7796 + bool "Renesas SoC R8A7796" + endchoice choice diff --git a/arch/arm/mach-rmobile/Makefile b/arch/arm/mach-rmobile/Makefile index 3b56fcf96f8..2aea527bae2 100644 --- a/arch/arm/mach-rmobile/Makefile +++ b/arch/arm/mach-rmobile/Makefile @@ -17,5 +17,6 @@ obj-$(CONFIG_R8A7792) += lowlevel_init_ca15.o cpu_info-rcar.o pfc-r8a7792.o obj-$(CONFIG_R8A7793) += lowlevel_init_ca15.o cpu_info-rcar.o pfc-r8a7793.o obj-$(CONFIG_R8A7794) += lowlevel_init_ca15.o cpu_info-rcar.o pfc-r8a7794.o obj-$(CONFIG_R8A7795) += lowlevel_init_gen3.o cpu_info-rcar.o pfc-r8a7795.o memmap-r8a7795.o +obj-$(CONFIG_R8A7796) += lowlevel_init_gen3.o cpu_info-rcar.o pfc-r8a7796.o memmap-r8a7796.o obj-$(CONFIG_SH73A0) += lowlevel_init.o cpu_info-sh73a0.o pfc-sh73a0.o obj-$(CONFIG_TMU_TIMER) += ../../sh/lib/time.o diff --git a/arch/arm/mach-rmobile/include/mach/r8a7796.h b/arch/arm/mach-rmobile/include/mach/r8a7796.h new file mode 100644 index 00000000000..a7d1ba23bbb --- /dev/null +++ b/arch/arm/mach-rmobile/include/mach/r8a7796.h @@ -0,0 +1,39 @@ +/* + * arch/arm/include/asm/arch-rcar_gen3/r8a7796.h + * This file defines registers and value for r8a7796. + * + * Copyright (C) 2016 Renesas Electronics Corporation + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef __ASM_ARCH_R8A7796_H +#define __ASM_ARCH_R8A7796_H + +#include "rcar-gen3-base.h" + +/* Module stop control/status register bits */ +#define MSTP0_BITS 0x00200000 +#define MSTP1_BITS 0xFFFFFFFF +#define MSTP2_BITS 0x340E2FDC +#define MSTP3_BITS 0xFFFFFFDF +#define MSTP4_BITS 0x80000184 +#define MSTP5_BITS 0xC3FFFFFF +#define MSTP6_BITS 0xFFFFFFFF +#define MSTP7_BITS 0xFFFFFFFF +#define MSTP8_BITS 0x01F1FFF7 +#define MSTP9_BITS 0xFFFFFFFE +#define MSTP10_BITS 0xFFFEFFE0 +#define MSTP11_BITS 0x000000B7 + +/* SDHI */ +#define CONFIG_SYS_SH_SDHI0_BASE 0xEE100000 +#define CONFIG_SYS_SH_SDHI1_BASE 0xEE120000 +#define CONFIG_SYS_SH_SDHI2_BASE 0xEE140000 /* either MMC0 */ +#define CONFIG_SYS_SH_SDHI3_BASE 0xEE160000 /* either MMC1 */ +#define CONFIG_SYS_SH_SDHI_NR_CHANNEL 4 + +/* SH-I2C */ +#define CONFIG_SYS_I2C_SH_BASE0 0xE60B0000 + +#endif /* __ASM_ARCH_R8A7796_H */ diff --git a/arch/arm/mach-rmobile/include/mach/rmobile.h b/arch/arm/mach-rmobile/include/mach/rmobile.h index 22d97b19ab9..654349b0b3d 100644 --- a/arch/arm/mach-rmobile/include/mach/rmobile.h +++ b/arch/arm/mach-rmobile/include/mach/rmobile.h @@ -18,6 +18,8 @@ #include #elif defined(CONFIG_R8A7795) #include +#elif defined(CONFIG_R8A7796) +#include #else #error "SOC Name not defined" #endif diff --git a/arch/arm/mach-rmobile/memmap-r8a7796.c b/arch/arm/mach-rmobile/memmap-r8a7796.c new file mode 100644 index 00000000000..648743d51e0 --- /dev/null +++ b/arch/arm/mach-rmobile/memmap-r8a7796.c @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2017 Marek Vasut + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include + +static struct mm_region r8a7796_mem_map[] = { + { + .virt = 0x0UL, + .phys = 0x0UL, + .size = 0xe0000000UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | + PTE_BLOCK_INNER_SHARE + }, { + .virt = 0xe0000000UL, + .phys = 0xe0000000UL, + .size = 0xe0000000UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* List terminator */ + 0, + } +}; + +struct mm_region *mem_map = r8a7796_mem_map; diff --git a/include/configs/rcar-gen3-common.h b/include/configs/rcar-gen3-common.h index c87d31950fd..304478af073 100644 --- a/include/configs/rcar-gen3-common.h +++ b/include/configs/rcar-gen3-common.h @@ -2,7 +2,7 @@ * include/configs/rcar-gen3-common.h * This file is R-Car Gen3 common configuration file. * - * Copyright (C) 2015 Renesas Electronics Corporation + * Copyright (C) 2015-2017 Renesas Electronics Corporation * * SPDX-License-Identifier: GPL-2.0+ */ @@ -55,10 +55,31 @@ #define CONFIG_SYS_TEXT_BASE 0x50000000 #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE + 0x7fff0) -#define CONFIG_SYS_SDRAM_BASE (0x48000000) -#define CONFIG_SYS_SDRAM_SIZE (1024u * 1024 * 1024 - 0x08000000) -#define CONFIG_SYS_LOAD_ADDR (0x48080000) -#define CONFIG_NR_DRAM_BANKS 1 +#define DRAM_RSV_SIZE 0x08000000 +#if defined(CONFIG_R8A7795) +#define CONFIG_NR_DRAM_BANKS 4 +#define PHYS_SDRAM_1 (0x40000000 + DRAM_RSV_SIZE) +#define PHYS_SDRAM_1_SIZE (0x40000000u - DRAM_RSV_SIZE) +#define PHYS_SDRAM_2 0x500000000 +#define PHYS_SDRAM_2_SIZE 0x40000000u +#define PHYS_SDRAM_3 0x600000000 +#define PHYS_SDRAM_3_SIZE 0x40000000u +#define PHYS_SDRAM_4 0x700000000 +#define PHYS_SDRAM_4_SIZE 0x40000000u +#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 +#define CONFIG_SYS_SDRAM_SIZE PHYS_SDRAM_1_SIZE +#elif defined(CONFIG_R8A7796) +#define CONFIG_NR_DRAM_BANKS 2 +#define PHYS_SDRAM_1 (0x40000000 + DRAM_RSV_SIZE) +#define PHYS_SDRAM_1_SIZE (0x80000000u - DRAM_RSV_SIZE) +#define PHYS_SDRAM_2 0x0600000000 +#define PHYS_SDRAM_2_SIZE 0x80000000u +#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 +#define CONFIG_SYS_SDRAM_SIZE PHYS_SDRAM_1_SIZE +#endif +#define CONFIG_SYS_LOAD_ADDR 0x48080000 +#define CONFIG_VERY_BIG_RAM +#define CONFIG_MAX_MEM_MAPPED CONFIG_SYS_SDRAM_SIZE #define CONFIG_SYS_MONITOR_BASE 0x00000000 #define CONFIG_SYS_MONITOR_LEN (256 * 1024) -- cgit v1.3.1 From c94cb71d95d1a152d27685bc95897999ea17278d Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 13 May 2017 15:57:42 +0200 Subject: ARM: rmobile: salvator-x: Move OF_LIBFDT and CMD_FDT to board config Move these two Kconfig symbols to the salvator-x_defconfig. Signed-off-by: Marek Vasut Cc: Hiroyuki Yokoyama Cc: Nobuhiro Iwamatsu --- configs/salvator-x_defconfig | 2 ++ include/configs/rcar-gen3-common.h | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'include/configs') diff --git a/configs/salvator-x_defconfig b/configs/salvator-x_defconfig index 8f9b5b53280..9fb0b898f1b 100644 --- a/configs/salvator-x_defconfig +++ b/configs/salvator-x_defconfig @@ -5,9 +5,11 @@ CONFIG_RCAR_GEN3=y CONFIG_TARGET_SALVATOR_X=y CONFIG_VERSION_VARIABLE=y CONFIG_CMD_BOOTZ=y +CONFIG_CMD_FDT=y CONFIG_R8A7795=y # CONFIG_CMD_IMI is not set # CONFIG_CMD_IMLS is not set # CONFIG_CMD_XIMG is not set CONFIG_DOS_PARTITION=y # CONFIG_MMC is not set +CONFIG_OF_LIBFDT=y diff --git a/include/configs/rcar-gen3-common.h b/include/configs/rcar-gen3-common.h index 304478af073..6bc8ab18b6c 100644 --- a/include/configs/rcar-gen3-common.h +++ b/include/configs/rcar-gen3-common.h @@ -17,7 +17,6 @@ #define CONFIG_CMD_EXT2 #define CONFIG_CMD_EXT4 #define CONFIG_CMD_EXT4_WRITE -#define CONFIG_CMD_FDT #define CONFIG_REMAKE_ELF @@ -34,7 +33,6 @@ #define CONFIG_SETUP_MEMORY_TAGS #define CONFIG_INITRD_TAG #define CONFIG_CMDLINE_EDITING -#define CONFIG_OF_LIBFDT #undef CONFIG_SHOW_BOOT_PROGRESS -- cgit v1.3.1 From f7fda5d1c05e6c86cf60cbd16b7258be56477dfc Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 13 May 2017 15:57:43 +0200 Subject: ARM: rmobile: salvator-x: Set default device tree Set default device tree file in the salvator-x_defconfig and use it in the environment. Signed-off-by: Marek Vasut Cc: Hiroyuki Yokoyama Cc: Nobuhiro Iwamatsu --- configs/salvator-x_defconfig | 1 + include/configs/rcar-gen3-common.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'include/configs') diff --git a/configs/salvator-x_defconfig b/configs/salvator-x_defconfig index 9fb0b898f1b..8cef6075e94 100644 --- a/configs/salvator-x_defconfig +++ b/configs/salvator-x_defconfig @@ -3,6 +3,7 @@ CONFIG_ARCH_RMOBILE=y CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_RCAR_GEN3=y CONFIG_TARGET_SALVATOR_X=y +CONFIG_DEFAULT_FDT_FILE=r8a7795-salvator-x.dtb CONFIG_VERSION_VARIABLE=y CONFIG_CMD_BOOTZ=y CONFIG_CMD_FDT=y diff --git a/include/configs/rcar-gen3-common.h b/include/configs/rcar-gen3-common.h index 6bc8ab18b6c..e73bc618563 100644 --- a/include/configs/rcar-gen3-common.h +++ b/include/configs/rcar-gen3-common.h @@ -100,7 +100,7 @@ #define CONFIG_BOOTCOMMAND \ "tftp 0x48080000 Image; " \ - "tftp 0x48000000 Image-r8a7795-salvator-x.dtb; " \ + "tftp 0x48000000 Image-"CONFIG_DEFAULT_FDT_FILE"; " \ "booti 0x48080000 - 0x48000000" #endif /* __RCAR_GEN3_COMMON_H */ -- cgit v1.3.1 From 8474681c3eb37f65c08eb9080cef817c38ee60c4 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 13 May 2017 15:57:45 +0200 Subject: ARM: rmobile: salvator-x: Adjust UART clock The UART uses internal SCIF clock except on R8A7795 H3 WS1.0 . Use the internal clock and ignore the early version of the chip. Signed-off-by: Marek Vasut Cc: Hiroyuki Yokoyama Cc: Nobuhiro Iwamatsu --- board/renesas/salvator-x/salvator-x.c | 4 ++-- include/configs/salvator-x.h | 5 +++-- scripts/config_whitelist.txt | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'include/configs') diff --git a/board/renesas/salvator-x/salvator-x.c b/board/renesas/salvator-x/salvator-x.c index 038d6de6109..3f2bebf74f7 100644 --- a/board/renesas/salvator-x/salvator-x.c +++ b/board/renesas/salvator-x/salvator-x.c @@ -109,8 +109,8 @@ void reset_cpu(ulong addr) static const struct sh_serial_platdata serial_platdata = { .base = SCIF2_BASE, .type = PORT_SCIF, - .clk = 14745600, /* 0xE10000 */ - .clk_mode = EXT_CLK, + .clk = CONFIG_SH_SCIF_CLK_FREQ, + .clk_mode = INT_CLK, }; U_BOOT_DEVICE(salvator_x_scif2) = { diff --git a/include/configs/salvator-x.h b/include/configs/salvator-x.h index 81a7226d62d..94f62a7358c 100644 --- a/include/configs/salvator-x.h +++ b/include/configs/salvator-x.h @@ -20,7 +20,7 @@ #define CONFIG_SCIF_CONSOLE #define CONFIG_CONS_SCIF2 #define CONFIG_CONS_INDEX 2 -#define CONFIG_SH_SCIF_CLK_FREQ CONFIG_SYS_CLK_FREQ +#define CONFIG_SH_SCIF_CLK_FREQ CONFIG_S3D4_CLK_FREQ /* [A] Hyper Flash */ /* use to RPC(SPI Multi I/O Bus Controller) */ @@ -31,10 +31,11 @@ #define RCAR_XTAL_CLK 33333333u #define CONFIG_SYS_CLK_FREQ RCAR_XTAL_CLK /* ch0to2 CPclk, ch3to11 S3D2_PEREclk, ch12to14 S3D2_RTclk */ -/* CPclk 16.66MHz, S3D2 133.33MHz */ +/* CPclk 16.66MHz, S3D2 133.33MHz , S3D4 66.66MHz */ #define CONFIG_CP_CLK_FREQ (CONFIG_SYS_CLK_FREQ / 2) #define CONFIG_PLL1_CLK_FREQ (CONFIG_SYS_CLK_FREQ * 192 / 2) #define CONFIG_S3D2_CLK_FREQ (266666666u/2) +#define CONFIG_S3D4_CLK_FREQ (266666666u/4) /* Generic Timer Definitions (use in assembler source) */ #define COUNTER_FREQUENCY 0xFE502A /* 16.66MHz from CPclk */ diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index fa9c3fc8cbd..d1de3f7f147 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -2371,6 +2371,7 @@ CONFIG_S3C24XX_TACLS CONFIG_S3C24XX_TWRPH0 CONFIG_S3C24XX_TWRPH1 CONFIG_S3D2_CLK_FREQ +CONFIG_S3D4_CLK_FREQ CONFIG_S5P CONFIG_S5PC100 CONFIG_S5PC110 -- cgit v1.3.1 From 50fb0c451f8219d26612451933c7905457459bc4 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 13 May 2017 15:57:46 +0200 Subject: ARM: rmobile: salvator-x: Add SD support Add support for the SD card slots on the Salvator-X board. Signed-off-by: Marek Vasut Cc: Hiroyuki Yokoyama Cc: Nobuhiro Iwamatsu --- board/renesas/salvator-x/salvator-x.c | 89 ++++++++++++++++++++++++++++++++++- configs/salvator-x_defconfig | 8 ++-- include/configs/salvator-x.h | 10 +++- 3 files changed, 102 insertions(+), 5 deletions(-) (limited to 'include/configs') diff --git a/board/renesas/salvator-x/salvator-x.c b/board/renesas/salvator-x/salvator-x.c index 3f2bebf74f7..1ee5cf10514 100644 --- a/board/renesas/salvator-x/salvator-x.c +++ b/board/renesas/salvator-x/salvator-x.c @@ -2,7 +2,7 @@ * board/renesas/salvator-x/salvator-x.c * This file is Salvator-X board support. * - * Copyright (C) 2015 Renesas Electronics Corporation + * Copyright (C) 2015-2017 Renesas Electronics Corporation * Copyright (C) 2015 Nobuhiro Iwamatsu * * SPDX-License-Identifier: GPL-2.0+ @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -48,6 +49,15 @@ void s_init(void) #define TMU0_MSTP125 BIT(25) /* secure */ #define TMU1_MSTP124 BIT(24) /* non-secure */ #define SCIF2_MSTP310 BIT(10) /* SCIF2 */ +#define SD0_MSTP314 BIT(14) +#define SD1_MSTP313 BIT(13) +#define SD2_MSTP312 BIT(12) /* either MMC0 */ +#define SD3_MSTP311 BIT(11) /* either MMC1 */ + +#define SD0CKCR 0xE6150074 +#define SD1CKCR 0xE6150078 +#define SD2CKCR 0xE6150268 +#define SD3CKCR 0xE615026C int board_early_init_f(void) { @@ -55,6 +65,15 @@ int board_early_init_f(void) mstp_clrbits_le32(MSTPSR1, SMSTPCR1, TMU0_MSTP125 | TMU1_MSTP124); /* SCIF2 */ mstp_clrbits_le32(MSTPSR3, SMSTPCR3, SCIF2_MSTP310); + /* eMMC */ + mstp_clrbits_le32(MSTPSR3, SMSTPCR3, SD1_MSTP313 | SD2_MSTP312); + /* SDHI0, 3 */ + mstp_clrbits_le32(MSTPSR3, SMSTPCR3, SD0_MSTP314 | SD3_MSTP311); + + writel(0, SD0CKCR); + writel(0, SD1CKCR); + writel(0, SD2CKCR); + writel(0, SD3CKCR); return 0; } @@ -83,6 +102,74 @@ int board_init(void) return 0; } +#ifdef CONFIG_SH_SDHI +int board_mmc_init(bd_t *bis) +{ + int ret = -ENODEV; + + /* SDHI0 */ + gpio_request(GPIO_GFN_SD0_DAT0, NULL); + gpio_request(GPIO_GFN_SD0_DAT1, NULL); + gpio_request(GPIO_GFN_SD0_DAT2, NULL); + gpio_request(GPIO_GFN_SD0_DAT3, NULL); + gpio_request(GPIO_GFN_SD0_CLK, NULL); + gpio_request(GPIO_GFN_SD0_CMD, NULL); + gpio_request(GPIO_GFN_SD0_CD, NULL); + gpio_request(GPIO_GFN_SD0_WP, NULL); + + gpio_request(GPIO_GP_5_2, NULL); + gpio_request(GPIO_GP_5_1, NULL); + gpio_direction_output(GPIO_GP_5_2, 1); /* power on */ + gpio_direction_output(GPIO_GP_5_1, 1); /* 1: 3.3V, 0: 1.8V */ + + ret = sh_sdhi_init(CONFIG_SYS_SH_SDHI0_BASE, 0, + SH_SDHI_QUIRK_64BIT_BUF); + if (ret) + return ret; + + /* SDHI1/SDHI2 eMMC */ + gpio_request(GPIO_GFN_SD1_DAT0, NULL); + gpio_request(GPIO_GFN_SD1_DAT1, NULL); + gpio_request(GPIO_GFN_SD1_DAT2, NULL); + gpio_request(GPIO_GFN_SD1_DAT3, NULL); + gpio_request(GPIO_GFN_SD2_DAT0, NULL); + gpio_request(GPIO_GFN_SD2_DAT1, NULL); + gpio_request(GPIO_GFN_SD2_DAT2, NULL); + gpio_request(GPIO_GFN_SD2_DAT3, NULL); + gpio_request(GPIO_GFN_SD2_CLK, NULL); + gpio_request(GPIO_GFN_SD2_CMD, NULL); + gpio_request(GPIO_GP_5_3, NULL); + gpio_request(GPIO_GP_5_9, NULL); + gpio_direction_output(GPIO_GP_5_3, 0); /* 1: 3.3V, 0: 1.8V */ + gpio_direction_output(GPIO_GP_5_9, 0); /* 1: 3.3V, 0: 1.8V */ + + ret = sh_sdhi_init(CONFIG_SYS_SH_SDHI2_BASE, 1, + SH_SDHI_QUIRK_64BIT_BUF); + if (ret) + return ret; + + /* SDHI3 */ + gpio_request(GPIO_GFN_SD3_DAT0, NULL); /* GP_4_9 */ + gpio_request(GPIO_GFN_SD3_DAT1, NULL); /* GP_4_10 */ + gpio_request(GPIO_GFN_SD3_DAT2, NULL); /* GP_4_11 */ + gpio_request(GPIO_GFN_SD3_DAT3, NULL); /* GP_4_12 */ + gpio_request(GPIO_GFN_SD3_CLK, NULL); /* GP_4_7 */ + gpio_request(GPIO_GFN_SD3_CMD, NULL); /* GP_4_8 */ + /* IPSR10 */ + gpio_request(GPIO_FN_SD3_CD, NULL); + gpio_request(GPIO_FN_SD3_WP, NULL); + + gpio_request(GPIO_GP_3_15, NULL); + gpio_request(GPIO_GP_3_14, NULL); + gpio_direction_output(GPIO_GP_3_15, 1); /* power on */ + gpio_direction_output(GPIO_GP_3_14, 1); /* 1: 3.3V, 0: 1.8V */ + + ret = sh_sdhi_init(CONFIG_SYS_SH_SDHI3_BASE, 2, + SH_SDHI_QUIRK_64BIT_BUF); + return ret; +} +#endif + int dram_init(void) { gd->ram_size = CONFIG_SYS_SDRAM_SIZE; diff --git a/configs/salvator-x_defconfig b/configs/salvator-x_defconfig index 8cef6075e94..1478b6ae3bf 100644 --- a/configs/salvator-x_defconfig +++ b/configs/salvator-x_defconfig @@ -8,9 +8,11 @@ CONFIG_VERSION_VARIABLE=y CONFIG_CMD_BOOTZ=y CONFIG_CMD_FDT=y CONFIG_R8A7795=y -# CONFIG_CMD_IMI is not set +CONFIG_SH_SDHI=y # CONFIG_CMD_IMLS is not set -# CONFIG_CMD_XIMG is not set +CONFIG_CMD_EDITENV=y +CONFIG_CMD_SAVEENV=y CONFIG_DOS_PARTITION=y -# CONFIG_MMC is not set +CONFIG_MMC=y +CONFIG_GENERIC_MMC=y CONFIG_OF_LIBFDT=y diff --git a/include/configs/salvator-x.h b/include/configs/salvator-x.h index 94f62a7358c..91307eb3536 100644 --- a/include/configs/salvator-x.h +++ b/include/configs/salvator-x.h @@ -24,7 +24,6 @@ /* [A] Hyper Flash */ /* use to RPC(SPI Multi I/O Bus Controller) */ -#define CONFIG_ENV_IS_NOWHERE /* Board Clock */ /* XTAL_CLK : 33.33MHz */ @@ -45,6 +44,15 @@ #define GICD_BASE 0xF1010000 #define GICC_BASE 0xF1020000 +/* SDHI */ +#define CONFIG_SH_SDHI_FREQ 200000000 + +/* Environment in eMMC, at the end of 2nd "boot sector" */ +#define CONFIG_ENV_IS_IN_MMC +#define CONFIG_ENV_OFFSET (-CONFIG_ENV_SIZE) +#define CONFIG_SYS_MMC_ENV_DEV 1 +#define CONFIG_SYS_MMC_ENV_PART 2 + /* Module stop status bits */ /* MFIS, SCIF1 */ #define CONFIG_SMSTP2_ENA 0x00002040 -- cgit v1.3.1 From 90e53f8b455e762c04cb154a381c8f1513af847f Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 13 May 2017 15:57:47 +0200 Subject: ARM: rmobile: salvator-x: Add RAVB ethernet support Add support for the AVB ethernet on the Salvator-X board. Signed-off-by: Marek Vasut Cc: Hiroyuki Yokoyama Cc: Nobuhiro Iwamatsu --- board/renesas/salvator-x/salvator-x.c | 46 +++++++++++++++++++++++++++++++++++ configs/salvator-x_defconfig | 7 ++++++ include/configs/salvator-x.h | 6 +++++ 3 files changed, 59 insertions(+) (limited to 'include/configs') diff --git a/board/renesas/salvator-x/salvator-x.c b/board/renesas/salvator-x/salvator-x.c index 1ee5cf10514..38ff99a17c7 100644 --- a/board/renesas/salvator-x/salvator-x.c +++ b/board/renesas/salvator-x/salvator-x.c @@ -49,6 +49,7 @@ void s_init(void) #define TMU0_MSTP125 BIT(25) /* secure */ #define TMU1_MSTP124 BIT(24) /* non-secure */ #define SCIF2_MSTP310 BIT(10) /* SCIF2 */ +#define ETHERAVB_MSTP812 BIT(12) #define SD0_MSTP314 BIT(14) #define SD1_MSTP313 BIT(13) #define SD2_MSTP312 BIT(12) /* either MMC0 */ @@ -65,6 +66,8 @@ int board_early_init_f(void) mstp_clrbits_le32(MSTPSR1, SMSTPCR1, TMU0_MSTP125 | TMU1_MSTP124); /* SCIF2 */ mstp_clrbits_le32(MSTPSR3, SMSTPCR3, SCIF2_MSTP310); + /* EHTERAVB */ + mstp_clrbits_le32(MSTPSR8, SMSTPCR8, ETHERAVB_MSTP812); /* eMMC */ mstp_clrbits_le32(MSTPSR3, SMSTPCR3, SD1_MSTP313 | SD2_MSTP312); /* SDHI0, 3 */ @@ -99,9 +102,52 @@ int board_init(void) mstp_clrbits_le32(MSTPSR1, SMSTPCR1, GSX_MSTP112); +#ifdef CONFIG_RAVB + /* EtherAVB Enable */ + /* GPSR2 */ + gpio_request(GPIO_GFN_AVB_AVTP_CAPTURE_A, NULL); + gpio_request(GPIO_GFN_AVB_AVTP_MATCH_A, NULL); + gpio_request(GPIO_GFN_AVB_LINK, NULL); + gpio_request(GPIO_GFN_AVB_PHY_INT, NULL); + gpio_request(GPIO_GFN_AVB_MAGIC, NULL); + gpio_request(GPIO_GFN_AVB_MDC, NULL); + + /* IPSR0 */ + gpio_request(GPIO_IFN_AVB_MDC, NULL); + gpio_request(GPIO_IFN_AVB_MAGIC, NULL); + gpio_request(GPIO_IFN_AVB_PHY_INT, NULL); + gpio_request(GPIO_IFN_AVB_LINK, NULL); + gpio_request(GPIO_IFN_AVB_AVTP_MATCH_A, NULL); + gpio_request(GPIO_IFN_AVB_AVTP_CAPTURE_A, NULL); + /* IPSR1 */ + gpio_request(GPIO_FN_AVB_AVTP_PPS, NULL); + /* IPSR2 */ + gpio_request(GPIO_FN_AVB_AVTP_MATCH_B, NULL); + /* IPSR3 */ + gpio_request(GPIO_FN_AVB_AVTP_CAPTURE_B, NULL); + + /* AVB_PHY_RST */ + gpio_request(GPIO_GP_2_10, NULL); + gpio_direction_output(GPIO_GP_2_10, 0); + mdelay(20); + gpio_set_value(GPIO_GP_2_10, 1); + udelay(1); +#endif + return 0; } +static struct eth_pdata salvator_x_ravb_platdata = { + .iobase = 0xE6800000, + .phy_interface = 0, + .max_speed = 1000, +}; + +U_BOOT_DEVICE(salvator_x_ravb) = { + .name = "ravb", + .platdata = &salvator_x_ravb_platdata, +}; + #ifdef CONFIG_SH_SDHI int board_mmc_init(bd_t *bis) { diff --git a/configs/salvator-x_defconfig b/configs/salvator-x_defconfig index 1478b6ae3bf..3738fe45365 100644 --- a/configs/salvator-x_defconfig +++ b/configs/salvator-x_defconfig @@ -12,7 +12,14 @@ CONFIG_SH_SDHI=y # CONFIG_CMD_IMLS is not set CONFIG_CMD_EDITENV=y CONFIG_CMD_SAVEENV=y +CONFIG_CMD_NET=y +CONFIG_CMD_NFS=y +CONFIG_CMD_MII=y +CONFIG_CMD_PING=y +CONFIG_CMD_DHCP=y CONFIG_DOS_PARTITION=y CONFIG_MMC=y CONFIG_GENERIC_MMC=y CONFIG_OF_LIBFDT=y +CONFIG_DM_ETH=y +CONFIG_RENESAS_RAVB=y diff --git a/include/configs/salvator-x.h b/include/configs/salvator-x.h index 91307eb3536..b5a98d6db2b 100644 --- a/include/configs/salvator-x.h +++ b/include/configs/salvator-x.h @@ -25,6 +25,12 @@ /* [A] Hyper Flash */ /* use to RPC(SPI Multi I/O Bus Controller) */ +/* Ethernet RAVB */ +#define CONFIG_NET_MULTI +#define CONFIG_PHY_MICREL +#define CONFIG_BITBANGMII +#define CONFIG_BITBANGMII_MULTI + /* Board Clock */ /* XTAL_CLK : 33.33MHz */ #define RCAR_XTAL_CLK 33333333u -- cgit v1.3.1 From fe2e8ff955ad18a7f7f26d3d56ebaa96167139b6 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 13 May 2017 15:57:48 +0200 Subject: ARM: rmobile: salvator-x: Add DVFS and PMIC support Add support for rebooting the board using the ROHM BD9571MWV I2C PMIC, but keep the CPU reboot option as a fallback. Signed-off-by: Marek Vasut Cc: Hiroyuki Yokoyama Cc: Nobuhiro Iwamatsu --- board/renesas/salvator-x/salvator-x.c | 9 +++++++++ include/configs/salvator-x.h | 12 ++++++++++++ 2 files changed, 21 insertions(+) (limited to 'include/configs') diff --git a/board/renesas/salvator-x/salvator-x.c b/board/renesas/salvator-x/salvator-x.c index 38ff99a17c7..acc541df0cf 100644 --- a/board/renesas/salvator-x/salvator-x.c +++ b/board/renesas/salvator-x/salvator-x.c @@ -50,6 +50,7 @@ void s_init(void) #define TMU1_MSTP124 BIT(24) /* non-secure */ #define SCIF2_MSTP310 BIT(10) /* SCIF2 */ #define ETHERAVB_MSTP812 BIT(12) +#define DVFS_MSTP926 BIT(26) #define SD0_MSTP314 BIT(14) #define SD1_MSTP313 BIT(13) #define SD2_MSTP312 BIT(12) /* either MMC0 */ @@ -78,6 +79,10 @@ int board_early_init_f(void) writel(0, SD2CKCR); writel(0, SD3CKCR); +#if defined(CONFIG_SYS_I2C) && defined(CONFIG_SYS_I2C_SH) + /* DVFS for reset */ + mstp_clrbits_le32(MSTPSR9, SMSTPCR9, DVFS_MSTP926); +#endif return 0; } @@ -235,8 +240,12 @@ const struct rmobile_sysinfo sysinfo = { void reset_cpu(ulong addr) { +#if defined(CONFIG_SYS_I2C) && defined(CONFIG_SYS_I2C_SH) + i2c_reg_write(CONFIG_SYS_I2C_POWERIC_ADDR, 0x20, 0x80); +#else /* only CA57 ? */ writel(RST_CODE, RST_CA57RESCNT); +#endif } static const struct sh_serial_platdata serial_platdata = { diff --git a/include/configs/salvator-x.h b/include/configs/salvator-x.h index b5a98d6db2b..0e5c130b13a 100644 --- a/include/configs/salvator-x.h +++ b/include/configs/salvator-x.h @@ -50,6 +50,18 @@ #define GICD_BASE 0xF1010000 #define GICC_BASE 0xF1020000 +/* i2c */ +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_SH +#define CONFIG_SYS_I2C_SLAVE 0x60 +#define CONFIG_SYS_I2C_SH_NUM_CONTROLLERS 1 +#define CONFIG_SYS_I2C_SH_SPEED0 400000 +#define CONFIG_SH_I2C_DATA_HIGH 4 +#define CONFIG_SH_I2C_DATA_LOW 5 +#define CONFIG_SH_I2C_CLOCK 10000000 + +#define CONFIG_SYS_I2C_POWERIC_ADDR 0x30 + /* SDHI */ #define CONFIG_SH_SDHI_FREQ 200000000 -- cgit v1.3.1 From d1018f5f9f6433a0ba5da64a431c4e6fa6299962 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 13 May 2017 15:57:49 +0200 Subject: ARM: rmobile: salvator-x: Add USB support Add support for the EHCI USB. Signed-off-by: Marek Vasut Cc: Hiroyuki Yokoyama Cc: Nobuhiro Iwamatsu --- board/renesas/salvator-x/salvator-x.c | 12 ++++++++++++ configs/salvator-x_defconfig | 6 ++++++ include/configs/salvator-x.h | 7 +++++++ 3 files changed, 25 insertions(+) (limited to 'include/configs') diff --git a/board/renesas/salvator-x/salvator-x.c b/board/renesas/salvator-x/salvator-x.c index acc541df0cf..44e4006f5c0 100644 --- a/board/renesas/salvator-x/salvator-x.c +++ b/board/renesas/salvator-x/salvator-x.c @@ -107,6 +107,9 @@ int board_init(void) mstp_clrbits_le32(MSTPSR1, SMSTPCR1, GSX_MSTP112); + /* USB1 pull-up */ + setbits_le32(PFC_PUEN6, PUEN_USB1_OVC | PUEN_USB1_PWEN); + #ifdef CONFIG_RAVB /* EtherAVB Enable */ /* GPSR2 */ @@ -131,6 +134,15 @@ int board_init(void) /* IPSR3 */ gpio_request(GPIO_FN_AVB_AVTP_CAPTURE_B, NULL); + /* USB2_OVC */ + gpio_request(GPIO_GP_6_15, NULL); + gpio_direction_input(GPIO_GP_6_15); + + /* USB2_PWEN */ + gpio_request(GPIO_GP_6_14, NULL); + gpio_direction_output(GPIO_GP_6_14, 1); + gpio_set_value(GPIO_GP_6_14, 1); + /* AVB_PHY_RST */ gpio_request(GPIO_GP_2_10, NULL); gpio_direction_output(GPIO_GP_2_10, 0); diff --git a/configs/salvator-x_defconfig b/configs/salvator-x_defconfig index 3738fe45365..60e0b720bba 100644 --- a/configs/salvator-x_defconfig +++ b/configs/salvator-x_defconfig @@ -17,6 +17,12 @@ CONFIG_CMD_NFS=y CONFIG_CMD_MII=y CONFIG_CMD_PING=y CONFIG_CMD_DHCP=y +CONFIG_CMD_USB=y +CONFIG_USB=y +CONFIG_USB_HOST=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_STORAGE=y +CONFIG_USB_EHCI_RCAR_GEN3=y CONFIG_DOS_PARTITION=y CONFIG_MMC=y CONFIG_GENERIC_MMC=y diff --git a/include/configs/salvator-x.h b/include/configs/salvator-x.h index 0e5c130b13a..4ac9328e1b9 100644 --- a/include/configs/salvator-x.h +++ b/include/configs/salvator-x.h @@ -62,6 +62,13 @@ #define CONFIG_SYS_I2C_POWERIC_ADDR 0x30 +/* USB */ +#ifdef CONFIG_R8A7795 +#define CONFIG_USB_MAX_CONTROLLER_COUNT 3 +#else +#define CONFIG_USB_MAX_CONTROLLER_COUNT 2 +#endif + /* SDHI */ #define CONFIG_SH_SDHI_FREQ 200000000 -- cgit v1.3.1 From 4c443bdbf60d221786b6827d92df33a47b9cd5fb Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 13 May 2017 15:57:51 +0200 Subject: ARM: rmobile: salvator-x: Enable SCIF2 clock There are two UARTs on the board, so enable the clock for the second one as well. Signed-off-by: Marek Vasut Cc: Hiroyuki Yokoyama Cc: Nobuhiro Iwamatsu --- include/configs/salvator-x.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/configs') diff --git a/include/configs/salvator-x.h b/include/configs/salvator-x.h index 4ac9328e1b9..0ac39003266 100644 --- a/include/configs/salvator-x.h +++ b/include/configs/salvator-x.h @@ -81,6 +81,8 @@ /* Module stop status bits */ /* MFIS, SCIF1 */ #define CONFIG_SMSTP2_ENA 0x00002040 +/* SCIF2 */ +#define CONFIG_SMSTP3_ENA 0x00000400 /* INTC-AP, IRQC */ #define CONFIG_SMSTP4_ENA 0x00000180 -- cgit v1.3.1