diff --git a/arch/arm/dts/r8a7791-porter.dts b/arch/arm/dts/r8a7791-porter.dts index bc93bb24e4..3d47daa08b 100644 --- a/arch/arm/dts/r8a7791-porter.dts +++ b/arch/arm/dts/r8a7791-porter.dts @@ -214,6 +214,7 @@ &scif0 { pinctrl-0 = <&scif0_pins>; pinctrl-names = "default"; + u-boot,dm-pre-reloc; status = "okay"; }; diff --git a/arch/arm/dts/r8a779x-u-boot.dtsi b/arch/arm/dts/r8a779x-u-boot.dtsi index 0baac1d2c5..f34cb942ed 100644 --- a/arch/arm/dts/r8a779x-u-boot.dtsi +++ b/arch/arm/dts/r8a779x-u-boot.dtsi @@ -20,6 +20,14 @@ u-boot,dm-pre-reloc; }; +&pfc { + u-boot,dm-pre-reloc; +}; + &prr { u-boot,dm-pre-reloc; }; + +&rst { + u-boot,dm-pre-reloc; +}; diff --git a/arch/arm/mach-rmobile/Kconfig.32 b/arch/arm/mach-rmobile/Kconfig.32 index ab05966d15..a96938c01e 100644 --- a/arch/arm/mach-rmobile/Kconfig.32 +++ b/arch/arm/mach-rmobile/Kconfig.32 @@ -70,6 +70,8 @@ config TARGET_PORTER bool "Porter board" select DM select DM_SERIAL + select SUPPORT_SPL + select SPL_DM if SPL config TARGET_STOUT bool "Stout board" diff --git a/board/renesas/porter/porter.c b/board/renesas/porter/porter.c index 86dea8bfa7..bd0080d210 100644 --- a/board/renesas/porter/porter.c +++ b/board/renesas/porter/porter.c @@ -115,3 +115,25 @@ void reset_cpu(ulong addr) val |= 0x02; i2c_write(CONFIG_SYS_I2C_POWERIC_ADDR, 0x13, 1, &val, 1); } + +#ifdef CONFIG_SPL_BUILD +#include +void board_init_f(ulong dummy) +{ + board_early_init_f(); +} + +void spl_board_init(void) +{ + /* UART clocks enabled and gd valid - init serial console */ + preloader_console_init(); +} + +void board_boot_order(u32 *spl_boot_list) +{ + /* Boot from SPI NOR with YMODEM UART fallback. */ + spl_boot_list[0] = BOOT_DEVICE_SPI; + spl_boot_list[1] = BOOT_DEVICE_UART; + spl_boot_list[2] = BOOT_DEVICE_NONE; +} +#endif diff --git a/configs/porter_defconfig b/configs/porter_defconfig index 38501d0bf1..0fa308b584 100644 --- a/configs/porter_defconfig +++ b/configs/porter_defconfig @@ -1,12 +1,22 @@ CONFIG_ARM=y CONFIG_ARCH_RMOBILE=y -CONFIG_SYS_TEXT_BASE=0xE6304000 +CONFIG_SYS_TEXT_BASE=0x50000000 +CONFIG_SPL_GPIO_SUPPORT=y +CONFIG_SPL_LIBCOMMON_SUPPORT=y +CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_SYS_MALLOC_F_LEN=0x8000 CONFIG_R8A7791=y CONFIG_TARGET_PORTER=y +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_BOOTDELAY=3 CONFIG_VERSION_VARIABLE=y +CONFIG_SPL=y +CONFIG_SPL_BOARD_INIT=y +CONFIG_SPL_I2C_SUPPORT=y +CONFIG_SPL_YMODEM_SUPPORT=y CONFIG_CMD_BOOTZ=y # CONFIG_CMD_IMI is not set # CONFIG_CMD_XIMG is not set @@ -26,8 +36,14 @@ CONFIG_CMD_EXT4=y CONFIG_CMD_EXT4_WRITE=y CONFIG_CMD_FAT=y CONFIG_OF_CONTROL=y +CONFIG_SPL_OF_CONTROL=y +CONFIG_OF_EMBED=y +CONFIG_OF_SPL_REMOVE_PROPS="interrupts interrupt-parent dma-names dmas power-domains" CONFIG_ENV_IS_IN_SPI_FLASH=y +CONFIG_SPL_DM_SEQ_ALIAS=y +CONFIG_SPL_OF_TRANSLATE=y CONFIG_CLK=y +CONFIG_SPL_CLK=y CONFIG_CLK_RENESAS=y CONFIG_DM_GPIO=y CONFIG_RCAR_GPIO=y @@ -44,6 +60,7 @@ CONFIG_DM_PCI=y CONFIG_PCI_RCAR_GEN2=y CONFIG_PINCTRL=y CONFIG_PINCONF=y +CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_PFC=y CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y @@ -55,3 +72,4 @@ CONFIG_DM_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_PCI=y CONFIG_USB_STORAGE=y +CONFIG_SPL_FRAMEWORK=y diff --git a/configs/r8a7795_salvator-x_defconfig b/configs/r8a7795_salvator-x_defconfig index f59736dcf7..8df8a899b8 100644 --- a/configs/r8a7795_salvator-x_defconfig +++ b/configs/r8a7795_salvator-x_defconfig @@ -54,4 +54,5 @@ CONFIG_USB_XHCI_HCD=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_GENERIC=y CONFIG_USB_STORAGE=y +CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SMBIOS_MANUFACTURER="" diff --git a/configs/r8a7795_ulcb_defconfig b/configs/r8a7795_ulcb_defconfig index 9317f01461..273caf3219 100644 --- a/configs/r8a7795_ulcb_defconfig +++ b/configs/r8a7795_ulcb_defconfig @@ -55,4 +55,5 @@ CONFIG_USB_XHCI_HCD=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_GENERIC=y CONFIG_USB_STORAGE=y +CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SMBIOS_MANUFACTURER="" diff --git a/configs/r8a7796_salvator-x_defconfig b/configs/r8a7796_salvator-x_defconfig index 77c856867e..ddcca68396 100644 --- a/configs/r8a7796_salvator-x_defconfig +++ b/configs/r8a7796_salvator-x_defconfig @@ -55,4 +55,5 @@ CONFIG_USB_XHCI_HCD=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_GENERIC=y CONFIG_USB_STORAGE=y +CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SMBIOS_MANUFACTURER="" diff --git a/configs/r8a7796_ulcb_defconfig b/configs/r8a7796_ulcb_defconfig index cee34b339e..1ac460bcd3 100644 --- a/configs/r8a7796_ulcb_defconfig +++ b/configs/r8a7796_ulcb_defconfig @@ -56,4 +56,5 @@ CONFIG_USB_XHCI_HCD=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_GENERIC=y CONFIG_USB_STORAGE=y +CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SMBIOS_MANUFACTURER="" diff --git a/configs/r8a77970_eagle_defconfig b/configs/r8a77970_eagle_defconfig index 5d8bc6645c..22b7bbd09b 100644 --- a/configs/r8a77970_eagle_defconfig +++ b/configs/r8a77970_eagle_defconfig @@ -54,4 +54,5 @@ CONFIG_USB_XHCI_HCD=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_GENERIC=y CONFIG_USB_STORAGE=y +CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SMBIOS_MANUFACTURER="" diff --git a/configs/r8a77995_draak_defconfig b/configs/r8a77995_draak_defconfig index a5bf21c0e7..d4359217e3 100644 --- a/configs/r8a77995_draak_defconfig +++ b/configs/r8a77995_draak_defconfig @@ -58,4 +58,5 @@ CONFIG_USB_XHCI_HCD=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_GENERIC=y CONFIG_USB_STORAGE=y +CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SMBIOS_MANUFACTURER="" diff --git a/drivers/clk/renesas/clk-rcar-gen3.c b/drivers/clk/renesas/clk-rcar-gen3.c index 0c394a8a71..1be3fe7136 100644 --- a/drivers/clk/renesas/clk-rcar-gen3.c +++ b/drivers/clk/renesas/clk-rcar-gen3.c @@ -288,6 +288,8 @@ static ulong gen3_clk_get_rate(struct clk *clk) static ulong gen3_clk_set_rate(struct clk *clk, ulong rate) { + /* Force correct SD-IF divider configuration if applicable */ + gen3_clk_setup_sdif_div(clk); return gen3_clk_get_rate(clk); } diff --git a/drivers/net/ravb.c b/drivers/net/ravb.c index 093288b639..bd30cba940 100644 --- a/drivers/net/ravb.c +++ b/drivers/net/ravb.c @@ -399,7 +399,7 @@ static int ravb_dmac_init(struct udevice *dev) static int ravb_config(struct udevice *dev) { struct ravb_priv *eth = dev_get_priv(dev); - struct phy_device *phy; + struct phy_device *phy = eth->phydev; u32 mask = ECMR_CHG_DM | ECMR_RE | ECMR_TE; int ret; @@ -410,13 +410,6 @@ static int ravb_config(struct udevice *dev) ravb_mac_init(eth); ravb_write_hwaddr(dev); - /* Configure phy */ - ret = ravb_phy_config(dev); - if (ret) - return ret; - - phy = eth->phydev; - ret = phy_startup(phy); if (ret) return ret; @@ -443,10 +436,6 @@ static int ravb_start(struct udevice *dev) struct ravb_priv *eth = dev_get_priv(dev); int ret; - ret = clk_enable(ð->clk); - if (ret) - return ret; - ret = ravb_reset(dev); if (ret) goto err; @@ -473,8 +462,8 @@ static void ravb_stop(struct udevice *dev) { struct ravb_priv *eth = dev_get_priv(dev); + phy_shutdown(eth->phydev); ravb_reset(dev); - clk_disable(ð->clk); } static int ravb_probe(struct udevice *dev) @@ -512,8 +501,23 @@ static int ravb_probe(struct udevice *dev) eth->bus = miiphy_get_dev_by_name(dev->name); + /* Bring up PHY */ + ret = clk_enable(ð->clk); + if (ret) + goto err_mdio_register; + + ret = ravb_reset(dev); + if (ret) + goto err_mdio_reset; + + ret = ravb_phy_config(dev); + if (ret) + goto err_mdio_reset; + return 0; +err_mdio_reset: + clk_disable(ð->clk); err_mdio_register: mdio_free(mdiodev); err_mdio_alloc: @@ -525,6 +529,8 @@ static int ravb_remove(struct udevice *dev) { struct ravb_priv *eth = dev_get_priv(dev); + clk_disable(ð->clk); + free(eth->phydev); mdio_unregister(eth->bus); mdio_free(eth->bus); diff --git a/drivers/serial/serial_sh.c b/drivers/serial/serial_sh.c index c07ddc70dc..a17698f90e 100644 --- a/drivers/serial/serial_sh.c +++ b/drivers/serial/serial_sh.c @@ -149,7 +149,7 @@ static int sh_serial_getc_generic(struct uart_port *port) return ch; } -#ifdef CONFIG_DM_SERIAL +#if CONFIG_IS_ENABLED(DM_SERIAL) static int sh_serial_pending(struct udevice *dev, bool input) { @@ -204,7 +204,7 @@ static const struct dm_serial_ops sh_serial_ops = { .setbrg = sh_serial_setbrg, }; -#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) static const struct udevice_id sh_serial_id[] ={ {.compatible = "renesas,sci", .data = PORT_SCI}, {.compatible = "renesas,scif", .data = PORT_SCIF}, diff --git a/include/configs/porter.h b/include/configs/porter.h index b4a317f724..758ed21c15 100644 --- a/include/configs/porter.h +++ b/include/configs/porter.h @@ -16,12 +16,8 @@ #include "rcar-gen2-common.h" -#if defined(CONFIG_ARCH_RMOBILE_EXTRAM_BOOT) -#define CONFIG_SYS_INIT_SP_ADDR 0x7023FFFC -#else -#define CONFIG_SYS_INIT_SP_ADDR 0xE633fffC -#endif -#define STACK_AREA_SIZE 0xC000 +#define CONFIG_SYS_INIT_SP_ADDR 0x4f000000 +#define STACK_AREA_SIZE 0x00100000 #define LOW_LEVEL_MERAM_STACK \ (CONFIG_SYS_INIT_SP_ADDR + STACK_AREA_SIZE - 4) @@ -67,4 +63,11 @@ #define CONFIG_SYS_I2C_POWERIC_ADDR 0x58 /* da9063 */ +/* SPL support */ +#define CONFIG_SPL_TEXT_BASE 0xe6304000 +#define CONFIG_SPL_STACK 0xe6340000 +#define CONFIG_SPL_MAX_SIZE 0x40000 +#define CONFIG_SPL_SPI_LOAD +#define CONFIG_SYS_SPI_U_BOOT_OFFS 0x140000 + #endif /* __PORTER_H */ diff --git a/include/configs/rcar-gen2-common.h b/include/configs/rcar-gen2-common.h index ad436fd8b1..e47b02fcc9 100644 --- a/include/configs/rcar-gen2-common.h +++ b/include/configs/rcar-gen2-common.h @@ -26,7 +26,7 @@ #endif /* console */ - +#define CONFIG_AUTO_COMPLETE #define CONFIG_SYS_LONGHELP #define CONFIG_SYS_PBSIZE 256 #define CONFIG_SYS_BAUDRATE_TABLE { 38400, 115200 } diff --git a/include/configs/rcar-gen3-common.h b/include/configs/rcar-gen3-common.h index a16d26be99..226069d67c 100644 --- a/include/configs/rcar-gen3-common.h +++ b/include/configs/rcar-gen3-common.h @@ -16,6 +16,7 @@ /* boot option */ #define CONFIG_SUPPORT_RAW_INITRD +#define CONFIG_AUTO_COMPLETE #define CONFIG_CMDLINE_TAG #define CONFIG_SETUP_MEMORY_TAGS