From 8a41f6887056ef4aff1c5481f00d6e29fafd68bf Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 17 Feb 2018 00:31:19 +0100 Subject: [PATCH 1/8] ARM: dts: rmobile: Move the u-boot,dm-pre-reloc into u-boot DTS on porter Fix ommission where the u-boot,dm-pre-reloc DT bit was pulled into the common DT, not the U-Boot specific DT part. Move it to U-Boot DT part. Signed-off-by: Marek Vasut Cc: Nobuhiro Iwamatsu --- arch/arm/dts/r8a7791-porter-u-boot.dts | 4 ++++ arch/arm/dts/r8a7791-porter.dts | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm/dts/r8a7791-porter-u-boot.dts b/arch/arm/dts/r8a7791-porter-u-boot.dts index 987d0e4..9220248 100644 --- a/arch/arm/dts/r8a7791-porter-u-boot.dts +++ b/arch/arm/dts/r8a7791-porter-u-boot.dts @@ -8,3 +8,7 @@ #include "r8a7791-porter.dts" #include "r8a7791-u-boot.dtsi" + +&scif0 { + u-boot,dm-pre-reloc; +}; diff --git a/arch/arm/dts/r8a7791-porter.dts b/arch/arm/dts/r8a7791-porter.dts index 3d47daa..bc93bb2 100644 --- a/arch/arm/dts/r8a7791-porter.dts +++ b/arch/arm/dts/r8a7791-porter.dts @@ -214,7 +214,6 @@ &scif0 { pinctrl-0 = <&scif0_pins>; pinctrl-names = "default"; - u-boot,dm-pre-reloc; status = "okay"; }; From cd07358c044247c01d14f08307026879e80efb8e Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 17 Feb 2018 00:35:23 +0100 Subject: [PATCH 2/8] ARM: rmobile: Reset ethernet PHY Toggle the PHY reset GPIO to bring the ethernet PHY out of reset properly. Signed-off-by: Marek Vasut Cc: Nobuhiro Iwamatsu --- NOTE: This should be moved to the SH ethernet driver, but it's quite late in the cycle, so this is something to be done in 2018.05. --- board/renesas/porter/porter.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/board/renesas/porter/porter.c b/board/renesas/porter/porter.c index bd0080d..dfefd7f 100644 --- a/board/renesas/porter/porter.c +++ b/board/renesas/porter/porter.c @@ -65,11 +65,19 @@ int board_early_init_f(void) return 0; } +#define ETHERNET_PHY_RESET 176 /* GPIO 5 22 */ + int board_init(void) { /* adress of boot parameters */ gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; + /* Force ethernet PHY out of reset */ + gpio_request(ETHERNET_PHY_RESET, "phy_reset"); + gpio_direction_output(ETHERNET_PHY_RESET, 0); + mdelay(10); + gpio_direction_output(ETHERNET_PHY_RESET, 1); + return 0; } From a05dab4e7612b83e4d4b768f53bb9926cf545358 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 17 Feb 2018 01:19:20 +0100 Subject: [PATCH 3/8] ARM: rmobile: Enable convenient commands on Porter Enable cache and time commands, which are convenience tools for doing benchmarks and various boot tests. Also enable FIT support for booting fitImage. Signed-off-by: Marek Vasut Cc: Nobuhiro Iwamatsu --- configs/porter_defconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configs/porter_defconfig b/configs/porter_defconfig index 0fa308b..53d197c 100644 --- a/configs/porter_defconfig +++ b/configs/porter_defconfig @@ -11,6 +11,7 @@ CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_SPL_SPI_FLASH_SUPPORT=y CONFIG_SPL_SPI_SUPPORT=y CONFIG_DEFAULT_DEVICE_TREE="r8a7791-porter-u-boot" +CONFIG_FIT=y CONFIG_BOOTDELAY=3 CONFIG_VERSION_VARIABLE=y CONFIG_SPL=y @@ -31,6 +32,8 @@ CONFIG_CMD_USB=y CONFIG_CMD_DHCP=y CONFIG_CMD_MII=y CONFIG_CMD_PING=y +CONFIG_CMD_CACHE=y +CONFIG_CMD_TIME=y CONFIG_CMD_EXT2=y CONFIG_CMD_EXT4=y CONFIG_CMD_EXT4_WRITE=y @@ -72,4 +75,3 @@ CONFIG_DM_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_PCI=y CONFIG_USB_STORAGE=y -CONFIG_SPL_FRAMEWORK=y From 7b8eeb40604240c32ab8e1df4a85900b3378f895 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 17 Feb 2018 01:21:15 +0100 Subject: [PATCH 4/8] ARM: rmobile: Set FDT/initramfs limits on Porter Set those limits to inform U-Boot about FDT and initramfs placement. Signed-off-by: Marek Vasut Cc: Nobuhiro Iwamatsu --- include/configs/porter.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/configs/porter.h b/include/configs/porter.h index 758ed21..1816f2f 100644 --- a/include/configs/porter.h +++ b/include/configs/porter.h @@ -63,6 +63,10 @@ #define CONFIG_SYS_I2C_POWERIC_ADDR 0x58 /* da9063 */ +#define CONFIG_EXTRA_ENV_SETTINGS \ + "fdt_high=0xffffffff\0" \ + "initrd_high=0xffffffff\0" + /* SPL support */ #define CONFIG_SPL_TEXT_BASE 0xe6304000 #define CONFIG_SPL_STACK 0xe6340000 From f51155eced8386b4e63654eef94b1e4a6a42655a Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 17 Feb 2018 02:17:40 +0100 Subject: [PATCH 5/8] i2c: rcar_iic: Allow IIC on RCar Gen2 The IIC on Gen2 is compatible with this driver as well, allow it. Signed-off-by: Marek Vasut Cc: Nobuhiro Iwamatsu --- drivers/i2c/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig index 7dbec77..9d43690 100644 --- a/drivers/i2c/Kconfig +++ b/drivers/i2c/Kconfig @@ -178,7 +178,7 @@ endif config SYS_I2C_RCAR_IIC bool "Renesas RCar Gen3 IIC driver" - depends on RCAR_GEN3 && DM_I2C + depends on (RCAR_GEN3 || RCAR_GEN2) && DM_I2C help Support for Renesas RCar Gen3 IIC controller. From 88306dbb5a88b9ae1433d198376c64560d6d7c1b Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 17 Feb 2018 02:14:09 +0100 Subject: [PATCH 6/8] ARM: dts: rmobile: Enable I2C6 on Porter Enable I2C6 bus on Porter to access the PMIC , ie. to reset the board. Signed-off-by: Marek Vasut Cc: Nobuhiro Iwamatsu --- arch/arm/dts/r8a7791-porter.dts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm/dts/r8a7791-porter.dts b/arch/arm/dts/r8a7791-porter.dts index bc93bb2..0592aa7 100644 --- a/arch/arm/dts/r8a7791-porter.dts +++ b/arch/arm/dts/r8a7791-porter.dts @@ -351,6 +351,11 @@ }; }; +&i2c6 { + status = "okay"; + clock-frequency = <400000>; +}; + &sata0 { status = "okay"; }; From a6e50da0d5a42f84f39edad57cb24a85e8524e6d Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 17 Feb 2018 02:15:08 +0100 Subject: [PATCH 7/8] ARM: rmobile: Replace SH I2C with IIC on Porter Get rid of the SH I2C driver on Porter and enable the IIC driver instead . The old SH I2C is completely broken on Porter anyway and the DM/DT capable IIC driver allows access to the PMIC too. Use the DM/DT capable driver instead. Signed-off-by: Marek Vasut Cc: Nobuhiro Iwamatsu --- configs/porter_defconfig | 2 ++ include/configs/porter.h | 14 -------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/configs/porter_defconfig b/configs/porter_defconfig index 53d197c..736576c 100644 --- a/configs/porter_defconfig +++ b/configs/porter_defconfig @@ -50,6 +50,8 @@ CONFIG_SPL_CLK=y CONFIG_CLK_RENESAS=y CONFIG_DM_GPIO=y CONFIG_RCAR_GPIO=y +CONFIG_DM_I2C=y +CONFIG_SYS_I2C_RCAR_IIC=y CONFIG_DM_MMC=y CONFIG_MMC_UNIPHIER=y CONFIG_SPI_FLASH=y diff --git a/include/configs/porter.h b/include/configs/porter.h index 1816f2f..eb28d1a 100644 --- a/include/configs/porter.h +++ b/include/configs/porter.h @@ -49,20 +49,6 @@ #define CONFIG_SYS_TMU_CLK_DIV 4 -/* i2c */ -#define CONFIG_SYS_I2C -#define CONFIG_SYS_I2C_SH -#define CONFIG_SYS_I2C_SLAVE 0x7F -#define CONFIG_SYS_I2C_SH_NUM_CONTROLLERS 3 -#define CONFIG_SYS_I2C_SH_SPEED0 400000 -#define CONFIG_SYS_I2C_SH_SPEED1 400000 -#define CONFIG_SYS_I2C_SH_SPEED2 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 0x58 /* da9063 */ - #define CONFIG_EXTRA_ENV_SETTINGS \ "fdt_high=0xffffffff\0" \ "initrd_high=0xffffffff\0" From 25f6dc8955bdf97bfb16ef19de7ce4abe76aaee4 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 17 Feb 2018 02:16:48 +0100 Subject: [PATCH 8/8] ARM: rmobile: Fix broken reset code on Porter The 'reset' command did not work on Porter because the reset code was accessing the wrong PMIC address over broken I2C bus driver. Replace the code with DM-aware code and fix up the PMIC address. This makes the 'reset' command work again. Signed-off-by: Marek Vasut Cc: Nobuhiro Iwamatsu --- board/renesas/porter/porter.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/board/renesas/porter/porter.c b/board/renesas/porter/porter.c index dfefd7f..320841f 100644 --- a/board/renesas/porter/porter.c +++ b/board/renesas/porter/porter.c @@ -116,12 +116,25 @@ const struct rmobile_sysinfo sysinfo = { void reset_cpu(ulong addr) { - u8 val; + struct udevice *dev; + const u8 pmic_bus = 6; + const u8 pmic_addr = 0x5a; + u8 data; + int ret; - i2c_set_bus_num(2); /* PowerIC connected to ch2 */ - i2c_read(CONFIG_SYS_I2C_POWERIC_ADDR, 0x13, 1, &val, 1); - val |= 0x02; - i2c_write(CONFIG_SYS_I2C_POWERIC_ADDR, 0x13, 1, &val, 1); + ret = i2c_get_chip_for_busnum(pmic_bus, pmic_addr, 1, &dev); + if (ret) + hang(); + + ret = dm_i2c_read(dev, 0x13, &data, 1); + if (ret) + hang(); + + data |= BIT(1); + + ret = dm_i2c_write(dev, 0x13, &data, 1); + if (ret) + hang(); } #ifdef CONFIG_SPL_BUILD