[U-Boot] [PATCH 01/14] mips: Add in_le32(), out_le32() etc IO accessor functions

in_le32() and out_le32() are needed for the bootcounter support. So lets implement these accessor functions for MIPS as well.
Signed-off-by: Stefan Roese sr@denx.de Cc: Daniel Schwierzeck daniel.schwierzeck@gmail.com --- arch/mips/include/asm/io.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h index 957442effd..a750f6c0e4 100644 --- a/arch/mips/include/asm/io.h +++ b/arch/mips/include/asm/io.h @@ -391,6 +391,27 @@ __BUILDIO(q, u64) #define readq readq #define writeq writeq
+/* in_le32(), out_le32() and friends */ +#define out_arch(type,endian,a,v) __raw_write##type(cpu_to_##endian(v),a) +#define in_arch(type,endian,a) endian##_to_cpu(__raw_read##type(a)) + +#define out_le64(a,v) out_arch(q,le64,a,v) +#define out_le32(a,v) out_arch(l,le32,a,v) +#define out_le16(a,v) out_arch(w,le16,a,v) + +#define in_le64(a) in_arch(q,le64,a) +#define in_le32(a) in_arch(l,le32,a) +#define in_le16(a) in_arch(w,le16,a) + +#define out_be32(a,v) out_arch(l,be32,a,v) +#define out_be16(a,v) out_arch(w,be16,a,v) + +#define in_be32(a) in_arch(l,be32,a) +#define in_be16(a) in_arch(w,be16,a) + +#define out_8(a,v) __raw_writeb(v,a) +#define in_8(a) __raw_readb(a) + #define __BUILD_MEMORY_STRING(bwlq, type) \ \ static inline void writes##bwlq(volatile void __iomem *mem, \

This fixes an issue which has been noticed on the Gardena board, with the watchdog enabled, where the watdchdog reset (after a system hang) did result in reporting of 2.9 GiB and a hang after this. With this patch applied the memory controller is correctly reset and initialized again even after a watchdog reset.
Signed-off-by: Stefan Roese sr@denx.de Cc: Daniel Schwierzeck daniel.schwierzeck@gmail.com --- arch/mips/mach-mt7620/lowlevel_init.S | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/arch/mips/mach-mt7620/lowlevel_init.S b/arch/mips/mach-mt7620/lowlevel_init.S index 1a50f160fe..aa707e0de6 100644 --- a/arch/mips/mach-mt7620/lowlevel_init.S +++ b/arch/mips/mach-mt7620/lowlevel_init.S @@ -108,6 +108,12 @@ CPLL_READY: sw t3, 0(t0)
CPLL_DONE: + /* Reset MC */ + lw t2, 0x34(s0) + ori t2, BIT(10) + sw t2, 0x34(s0) + nop + /* * SDR and DDR initialization: delay 200us */

Am 09.10.18 um 08:59 schrieb Stefan Roese:
This fixes an issue which has been noticed on the Gardena board, with the watchdog enabled, where the watdchdog reset (after a system hang) did result in reporting of 2.9 GiB and a hang after this. With this patch applied the memory controller is correctly reset and initialized again even after a watchdog reset.
Signed-off-by: Stefan Roese sr@denx.de Cc: Daniel Schwierzeck daniel.schwierzeck@gmail.com
arch/mips/mach-mt7620/lowlevel_init.S | 6 ++++++ 1 file changed, 6 insertions(+)
applied to u-boot-mips/next, thanks.

Using CONFIG_SYS_MIPS_CACHE_INIT_RAM_LOAD should ensure that the cache is initialized correctly (parity etc). Even though some issues are still seen on the linkit and gardena MT7688 platforms, which could be a result of a non-optimal cache configuration / setup.
Signed-off-by: Stefan Roese sr@denx.de Cc: Daniel Schwierzeck daniel.schwierzeck@gmail.com --- arch/mips/mach-mt7620/Kconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/mips/mach-mt7620/Kconfig b/arch/mips/mach-mt7620/Kconfig index 13a7bd2cc0..e42d918ba0 100644 --- a/arch/mips/mach-mt7620/Kconfig +++ b/arch/mips/mach-mt7620/Kconfig @@ -13,6 +13,7 @@ choice config SOC_MT7620 bool "MT7620/8" select MIPS_L1_CACHE_SHIFT_5 + select SYS_MIPS_CACHE_INIT_RAM_LOAD help This supports MediaTek MIPS MT7620 family.

Am 09.10.18 um 08:59 schrieb Stefan Roese:
Using CONFIG_SYS_MIPS_CACHE_INIT_RAM_LOAD should ensure that the cache is initialized correctly (parity etc). Even though some issues are still seen on the linkit and gardena MT7688 platforms, which could be a result of a non-optimal cache configuration / setup.
I thought this doesn't really help? Also if you can't move CONFIG_MIPS_CACHE_INDEX_BASE to some SRAM space, you need to run your memory init code before the cache initialisation to have working DRAM available. But this slows down the boot time.
Signed-off-by: Stefan Roese sr@denx.de Cc: Daniel Schwierzeck daniel.schwierzeck@gmail.com
arch/mips/mach-mt7620/Kconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/mips/mach-mt7620/Kconfig b/arch/mips/mach-mt7620/Kconfig index 13a7bd2cc0..e42d918ba0 100644 --- a/arch/mips/mach-mt7620/Kconfig +++ b/arch/mips/mach-mt7620/Kconfig @@ -13,6 +13,7 @@ choice config SOC_MT7620 bool "MT7620/8" select MIPS_L1_CACHE_SHIFT_5
- select SYS_MIPS_CACHE_INIT_RAM_LOAD help This supports MediaTek MIPS MT7620 family.

Add the ethernet DT node to the DTS file.
Signed-off-by: Stefan Roese sr@denx.de Cc: Daniel Schwierzeck daniel.schwierzeck@gmail.com --- arch/mips/dts/mt7628a.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/arch/mips/dts/mt7628a.dtsi b/arch/mips/dts/mt7628a.dtsi index c14259b170..effb36681f 100644 --- a/arch/mips/dts/mt7628a.dtsi +++ b/arch/mips/dts/mt7628a.dtsi @@ -120,6 +120,14 @@ }; };
+ eth@10110000 { + compatible = "mediatek,mt7622-eth"; + reg = <0x10100000 0x10000 + 0x10110000 0x8000>; + + syscon = <&sysc>; + }; + usb_phy: usb-phy@10120000 { compatible = "mediatek,mt7628-usbphy"; reg = <0x10120000 0x1000>;

Am 09.10.18 um 08:59 schrieb Stefan Roese:
Add the ethernet DT node to the DTS file.
Signed-off-by: Stefan Roese sr@denx.de Cc: Daniel Schwierzeck daniel.schwierzeck@gmail.com
arch/mips/dts/mt7628a.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+)
series from 4/14 to 14/14 applied to u-boot-mips/next, thanks.

Add the GPIO DT nodes to the DTS file.
Signed-off-by: Stefan Roese sr@denx.de Cc: Daniel Schwierzeck daniel.schwierzeck@gmail.com --- arch/mips/dts/mt7628a.dtsi | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
diff --git a/arch/mips/dts/mt7628a.dtsi b/arch/mips/dts/mt7628a.dtsi index effb36681f..8da2ca3e4d 100644 --- a/arch/mips/dts/mt7628a.dtsi +++ b/arch/mips/dts/mt7628a.dtsi @@ -71,6 +71,38 @@ reg = <0x300 0x100>; };
+ gpio@600 { + #address-cells = <1>; + #size-cells = <0>; + + compatible = "mtk,mt7628-gpio", "mtk,mt7621-gpio"; + reg = <0x600 0x100>; + + interrupt-parent = <&intc>; + interrupts = <6>; + + gpio0: bank@0 { + reg = <0>; + compatible = "mtk,mt7621-gpio-bank"; + gpio-controller; + #gpio-cells = <2>; + }; + + gpio1: bank@1 { + reg = <1>; + compatible = "mtk,mt7621-gpio-bank"; + gpio-controller; + #gpio-cells = <2>; + }; + + gpio2: bank@2 { + reg = <2>; + compatible = "mtk,mt7621-gpio-bank"; + gpio-controller; + #gpio-cells = <2>; + }; + }; + spi0: spi@b00 { compatible = "ralink,mt7621-spi"; reg = <0xb00 0x40>;

Add the watchdog DT node to the DTS file.
Signed-off-by: Stefan Roese sr@denx.de Cc: Daniel Schwierzeck daniel.schwierzeck@gmail.com --- arch/mips/dts/mt7628a.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/arch/mips/dts/mt7628a.dtsi b/arch/mips/dts/mt7628a.dtsi index 8da2ca3e4d..70e34cfdbc 100644 --- a/arch/mips/dts/mt7628a.dtsi +++ b/arch/mips/dts/mt7628a.dtsi @@ -48,6 +48,17 @@ mask = <0x1>; };
+ watchdog: watchdog@100 { + compatible = "ralink,mt7628a-wdt", "mediatek,mt7621-wdt"; + reg = <0x100 0x30>; + + resets = <&resetc 8>; + reset-names = "wdt"; + + interrupt-parent = <&intc>; + interrupts = <24>; + }; + intc: interrupt-controller@200 { compatible = "ralink,rt2880-intc"; reg = <0x200 0x100>;

Imply DM_ETH and DM_GPIO for ARCH_MT7620, as this platform now supports ethernet and GPIO as well.
Signed-off-by: Stefan Roese sr@denx.de Cc: Daniel Schwierzeck daniel.schwierzeck@gmail.com --- arch/mips/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 071dea04ec..0aa23981d4 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -74,6 +74,8 @@ config ARCH_MT7620 imply CMD_DM select DISPLAY_CPUINFO select DM + imply DM_ETH + imply DM_GPIO select DM_SERIAL imply DM_SPI imply DM_SPI_FLASH

This patch enables and starts the watchdog on the MT7620 platform. Currently the WD timeout is configured to 60 seconds.
Signed-off-by: Stefan Roese sr@denx.de Cc: Daniel Schwierzeck daniel.schwierzeck@gmail.com --- arch/mips/Kconfig | 1 + arch/mips/mach-mt7620/cpu.c | 40 +++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 0aa23981d4..54a483075f 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -79,6 +79,7 @@ config ARCH_MT7620 select DM_SERIAL imply DM_SPI imply DM_SPI_FLASH + select ARCH_MISC_INIT if WATCHDOG select MIPS_TUNE_24KC select OF_CONTROL select ROM_EXCEPTION_VECTORS diff --git a/arch/mips/mach-mt7620/cpu.c b/arch/mips/mach-mt7620/cpu.c index 457f09f32c..87cc973b75 100644 --- a/arch/mips/mach-mt7620/cpu.c +++ b/arch/mips/mach-mt7620/cpu.c @@ -6,6 +6,7 @@ #include <common.h> #include <dm.h> #include <ram.h> +#include <wdt.h> #include <asm/io.h> #include <linux/io.h> #include <linux/sizes.h> @@ -67,3 +68,42 @@ int print_cpuinfo(void)
return 0; } + +#ifdef CONFIG_WATCHDOG +static struct udevice *watchdog_dev; + +/* Called by macro WATCHDOG_RESET */ +void watchdog_reset(void) +{ + static ulong next_reset; + ulong now; + + if (!watchdog_dev) + return; + + now = get_timer(0); + + /* Do not reset the watchdog too often */ + if (now > next_reset) { + next_reset = now + 1000; /* reset every 1000ms */ + wdt_reset(watchdog_dev); + } +} + +int arch_misc_init(void) +{ + /* Init watchdog */ + if (uclass_get_device_by_seq(UCLASS_WDT, 0, &watchdog_dev)) { + debug("Watchdog: Not found by seq!\n"); + if (uclass_get_device(UCLASS_WDT, 0, &watchdog_dev)) { + puts("Watchdog: Not found!\n"); + return 0; + } + } + + wdt_start(watchdog_dev, 60000, 0); /* 60 seconds */ + printf("Watchdog: Started\n"); + + return 0; +} +#endif

Configure digital vs analog GPIOs as needed on this board.
Signed-off-by: Stefan Roese sr@denx.de Cc: Daniel Schwierzeck daniel.schwierzeck@gmail.com --- board/gardena/smart-gateway-mt7688/board.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/board/gardena/smart-gateway-mt7688/board.c b/board/gardena/smart-gateway-mt7688/board.c index 5ff546f505..838dfc205b 100644 --- a/board/gardena/smart-gateway-mt7688/board.c +++ b/board/gardena/smart-gateway-mt7688/board.c @@ -4,14 +4,17 @@ */
#include <common.h> -#include <asm/io.h> +#include <linux/io.h> + +#define MT76XX_AGPIO_CFG 0x1000003c
int board_early_init_f(void) { - /* - * Nothing to be done here for this board (no UART setup etc) - * right now. We might need some pin muxing, so lets keep this - * function for now. - */ + void __iomem *gpio_mode; + + /* Configure digital vs analog GPIOs */ + gpio_mode = ioremap_nocache(MT76XX_AGPIO_CFG, 0x100); + iowrite32(0x00fe01ff, gpio_mode); + return 0; }

Add the available LEDs to the DTS file so that they can be used.
Signed-off-by: Stefan Roese sr@denx.de Cc: Daniel Schwierzeck daniel.schwierzeck@gmail.com --- .../mips/dts/gardena-smart-gateway-mt7688.dts | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+)
diff --git a/arch/mips/dts/gardena-smart-gateway-mt7688.dts b/arch/mips/dts/gardena-smart-gateway-mt7688.dts index ee99c3d17c..ef8a9612fd 100644 --- a/arch/mips/dts/gardena-smart-gateway-mt7688.dts +++ b/arch/mips/dts/gardena-smart-gateway-mt7688.dts @@ -6,6 +6,7 @@ /dts-v1/;
#include "mt7628a.dtsi" +#include <dt-bindings/gpio/gpio.h>
/ { compatible = "gardena,smart-gateway-mt7688", "ralink,mt7628a-soc"; @@ -21,6 +22,64 @@ reg = <0x0 0x08000000>; };
+ leds { + compatible = "gpio-leds"; + + power_blue { + label = "smartgw:power:blue"; + gpios = <&gpio0 18 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + power_green { + label = "smartgw:power:green"; + gpios = <&gpio0 19 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + power_red { + label = "smartgw:power:red"; + gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + radio_blue { + label = "smartgw:radio:blue"; + gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + radio_green { + label = "smartgw:radio:green"; + gpios = <&gpio0 24 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + radio_red { + label = "smartgw:radio:red"; + gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + internet_blue { + label = "smartgw:internet:blue"; + gpios = <&gpio0 26 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + internet_green { + label = "smartgw:internet:green"; + gpios = <&gpio0 27 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + internet_red { + label = "smartgw:internet:red"; + gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + }; + chosen { bootargs = "console=ttyS0,57600"; stdout-path = &uart0;

This is needed to set the LEDs automatically to a default state, as configured in the dts.
Signed-off-by: Stefan Roese sr@denx.de Cc: Daniel Schwierzeck daniel.schwierzeck@gmail.com --- arch/mips/mach-mt7620/Kconfig | 1 + board/gardena/smart-gateway-mt7688/board.c | 9 +++++++++ 2 files changed, 10 insertions(+)
diff --git a/arch/mips/mach-mt7620/Kconfig b/arch/mips/mach-mt7620/Kconfig index e42d918ba0..6f6952afd0 100644 --- a/arch/mips/mach-mt7620/Kconfig +++ b/arch/mips/mach-mt7620/Kconfig @@ -25,6 +25,7 @@ choice config BOARD_GARDENA_SMART_GATEWAY_MT7688 bool "Gardena Smart Gateway" depends on SOC_MT7620 + select BOARD_LATE_INIT select SUPPORTS_BOOT_RAM help Gardena Smart Gateway boards have a MT7688 SoC with 128 MiB of RAM diff --git a/board/gardena/smart-gateway-mt7688/board.c b/board/gardena/smart-gateway-mt7688/board.c index 838dfc205b..3a1838e44a 100644 --- a/board/gardena/smart-gateway-mt7688/board.c +++ b/board/gardena/smart-gateway-mt7688/board.c @@ -4,6 +4,7 @@ */
#include <common.h> +#include <led.h> #include <linux/io.h>
#define MT76XX_AGPIO_CFG 0x1000003c @@ -18,3 +19,11 @@ int board_early_init_f(void)
return 0; } + +int board_late_init(void) +{ + if (IS_ENABLED(CONFIG_LED)) + led_default_state(); + + return 0; +}

These misc updates include the following changes: - Change baudrate from 57600 to 115200 - Enable MIPS_BOOT_CMDLINE_LEGACY - Enable FIT support - Enable ethernet support - Enable SPI NOR and NAND support - Change MTD_UBI_BEB_LIMIT to 22 - Enable MTD Support - Enable GPIO support - Enable watchdog support - Enable bootcounter support - Enable version variable - Change max image size from 0x80000 to 0xa0000 - Change SYS_MALLOC_LEN to 16MiB (because of UBI/UBIFS)
Signed-off-by: Stefan Roese sr@denx.de Cc: Daniel Schwierzeck daniel.schwierzeck@gmail.com --- .../mips/dts/gardena-smart-gateway-mt7688.dts | 1 - ...gardena-smart-gateway-mt7688-ram_defconfig | 36 ++++++++++++++----- .../gardena-smart-gateway-mt7688_defconfig | 36 ++++++++++++++----- .../configs/gardena-smart-gateway-mt7688.h | 4 +-- 4 files changed, 58 insertions(+), 19 deletions(-)
diff --git a/arch/mips/dts/gardena-smart-gateway-mt7688.dts b/arch/mips/dts/gardena-smart-gateway-mt7688.dts index ef8a9612fd..d8d88686bb 100644 --- a/arch/mips/dts/gardena-smart-gateway-mt7688.dts +++ b/arch/mips/dts/gardena-smart-gateway-mt7688.dts @@ -81,7 +81,6 @@ };
chosen { - bootargs = "console=ttyS0,57600"; stdout-path = &uart0; }; }; diff --git a/configs/gardena-smart-gateway-mt7688-ram_defconfig b/configs/gardena-smart-gateway-mt7688-ram_defconfig index 0e2f158518..5d1a84fb3f 100644 --- a/configs/gardena-smart-gateway-mt7688-ram_defconfig +++ b/configs/gardena-smart-gateway-mt7688-ram_defconfig @@ -1,55 +1,75 @@ CONFIG_MIPS=y CONFIG_SYS_TEXT_BASE=0x80010000 CONFIG_ARCH_MT7620=y -# CONFIG_MIPS_BOOT_CMDLINE_LEGACY is not set # CONFIG_MIPS_BOOT_ENV_LEGACY is not set CONFIG_MIPS_BOOT_FDT=y +CONFIG_ENV_VARS_UBOOT_CONFIG=y CONFIG_NR_DRAM_BANKS=1 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +CONFIG_FIT=y +CONFIG_FIT_SIGNATURE=y +CONFIG_IMAGE_FORMAT_LEGACY=y CONFIG_OF_STDOUT_VIA_ALIAS=y CONFIG_SYS_CONSOLE_INFO_QUIET=y +CONFIG_VERSION_VARIABLE=y CONFIG_BOARD_EARLY_INIT_F=y CONFIG_HUSH_PARSER=y -CONFIG_CMD_CPU=y CONFIG_CMD_LICENSE=y -# CONFIG_CMD_BOOTD is not set # CONFIG_CMD_ELF is not set # CONFIG_CMD_XIMG is not set CONFIG_CMD_MEMINFO=y # CONFIG_CMD_FLASH is not set +CONFIG_CMD_GPIO=y # CONFIG_CMD_LOADS is not set +CONFIG_CMD_MTD=y CONFIG_CMD_SF=y CONFIG_CMD_SPI=y -# CONFIG_CMD_NET is not set +CONFIG_CMD_DHCP=y +CONFIG_CMD_MII=y +CONFIG_CMD_PING=y +CONFIG_CMD_BOOTCOUNT=y CONFIG_CMD_TIME=y +CONFIG_CMD_UUID=y CONFIG_MTDIDS_DEFAULT="spi-nand0=spi-nand0" -CONFIG_MTDPARTS_DEFAULT="mtdparts=spi-nand0:-(ubi)" +CONFIG_MTDPARTS_DEFAULT="mtdparts=spi-nand0:-(nand)" CONFIG_CMD_UBI=y CONFIG_OF_EMBED=y CONFIG_DEFAULT_DEVICE_TREE="gardena-smart-gateway-mt7688" CONFIG_ENV_IS_IN_SPI_FLASH=y +CONFIG_NET_RANDOM_ETHADDR=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_HAVE_BLOCK_DEVICE=y +CONFIG_BOOTCOUNT_LIMIT=y +CONFIG_SYS_BOOTCOUNT_SINGLEWORD=y +CONFIG_SYS_BOOTCOUNT_ADDR=0xb000006c CONFIG_CLK=y -CONFIG_CPU=y -CONFIG_DM_GPIO=y CONFIG_LED=y CONFIG_LED_BLINK=y CONFIG_LED_GPIO=y CONFIG_MTD=y +CONFIG_MTD_SPI_NAND=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_GIGADEVICE=y CONFIG_SPI_FLASH_MACRONIX=y CONFIG_SPI_FLASH_SPANSION=y CONFIG_SPI_FLASH_STMICRO=y CONFIG_SPI_FLASH_WINBOND=y +CONFIG_SPI_FLASH_XMC=y CONFIG_SPI_FLASH_MTD=y +CONFIG_MTD_UBI_BEB_LIMIT=22 +CONFIG_PHYLIB=y +CONFIG_PHY_FIXED=y +CONFIG_MT76XX_ETH=y CONFIG_PHY=y CONFIG_POWER_DOMAIN=y CONFIG_RAM=y CONFIG_DM_RESET=y -CONFIG_BAUDRATE=57600 # CONFIG_SPL_SERIAL_PRESENT is not set CONFIG_SYS_NS16550=y CONFIG_SPI=y +CONFIG_MT7621_SPI=y CONFIG_SYSRESET_SYSCON=y +CONFIG_WATCHDOG=y +CONFIG_WDT=y +CONFIG_WDT_MT7621=y +CONFIG_LZMA=y diff --git a/configs/gardena-smart-gateway-mt7688_defconfig b/configs/gardena-smart-gateway-mt7688_defconfig index 1213227758..7c930f0cd9 100644 --- a/configs/gardena-smart-gateway-mt7688_defconfig +++ b/configs/gardena-smart-gateway-mt7688_defconfig @@ -4,55 +4,75 @@ CONFIG_ARCH_MT7620=y CONFIG_BOOT_ROM=y CONFIG_ONBOARD_DDR2_SIZE_1024MBIT=y CONFIG_ONBOARD_DDR2_CHIP_WIDTH_16BIT=y -# CONFIG_MIPS_BOOT_CMDLINE_LEGACY is not set # CONFIG_MIPS_BOOT_ENV_LEGACY is not set CONFIG_MIPS_BOOT_FDT=y +CONFIG_ENV_VARS_UBOOT_CONFIG=y CONFIG_NR_DRAM_BANKS=1 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +CONFIG_FIT=y +CONFIG_FIT_SIGNATURE=y +CONFIG_IMAGE_FORMAT_LEGACY=y CONFIG_OF_STDOUT_VIA_ALIAS=y CONFIG_SYS_CONSOLE_INFO_QUIET=y +CONFIG_VERSION_VARIABLE=y CONFIG_BOARD_EARLY_INIT_F=y CONFIG_HUSH_PARSER=y -CONFIG_CMD_CPU=y CONFIG_CMD_LICENSE=y -# CONFIG_CMD_BOOTD is not set # CONFIG_CMD_ELF is not set # CONFIG_CMD_XIMG is not set CONFIG_CMD_MEMINFO=y # CONFIG_CMD_FLASH is not set +CONFIG_CMD_GPIO=y # CONFIG_CMD_LOADS is not set +CONFIG_CMD_MTD=y CONFIG_CMD_SF=y CONFIG_CMD_SPI=y -# CONFIG_CMD_NET is not set +CONFIG_CMD_DHCP=y +CONFIG_CMD_MII=y +CONFIG_CMD_PING=y +CONFIG_CMD_BOOTCOUNT=y CONFIG_CMD_TIME=y +CONFIG_CMD_UUID=y CONFIG_MTDIDS_DEFAULT="spi-nand0=spi-nand0" -CONFIG_MTDPARTS_DEFAULT="mtdparts=spi-nand0:-(ubi)" +CONFIG_MTDPARTS_DEFAULT="mtdparts=spi-nand0:-(nand)" CONFIG_CMD_UBI=y CONFIG_OF_EMBED=y CONFIG_DEFAULT_DEVICE_TREE="gardena-smart-gateway-mt7688" CONFIG_ENV_IS_IN_SPI_FLASH=y +CONFIG_NET_RANDOM_ETHADDR=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_HAVE_BLOCK_DEVICE=y +CONFIG_BOOTCOUNT_LIMIT=y +CONFIG_SYS_BOOTCOUNT_SINGLEWORD=y +CONFIG_SYS_BOOTCOUNT_ADDR=0xb000006c CONFIG_CLK=y -CONFIG_CPU=y -CONFIG_DM_GPIO=y CONFIG_LED=y CONFIG_LED_BLINK=y CONFIG_LED_GPIO=y CONFIG_MTD=y +CONFIG_MTD_SPI_NAND=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_GIGADEVICE=y CONFIG_SPI_FLASH_MACRONIX=y CONFIG_SPI_FLASH_SPANSION=y CONFIG_SPI_FLASH_STMICRO=y CONFIG_SPI_FLASH_WINBOND=y +CONFIG_SPI_FLASH_XMC=y CONFIG_SPI_FLASH_MTD=y +CONFIG_MTD_UBI_BEB_LIMIT=22 +CONFIG_PHYLIB=y +CONFIG_PHY_FIXED=y +CONFIG_MT76XX_ETH=y CONFIG_PHY=y CONFIG_POWER_DOMAIN=y CONFIG_RAM=y CONFIG_DM_RESET=y -CONFIG_BAUDRATE=57600 # CONFIG_SPL_SERIAL_PRESENT is not set CONFIG_SYS_NS16550=y CONFIG_SPI=y +CONFIG_MT7621_SPI=y CONFIG_SYSRESET_SYSCON=y +CONFIG_WATCHDOG=y +CONFIG_WDT=y +CONFIG_WDT_MT7621=y +CONFIG_LZMA=y diff --git a/include/configs/gardena-smart-gateway-mt7688.h b/include/configs/gardena-smart-gateway-mt7688.h index 0184147068..b10857a757 100644 --- a/include/configs/gardena-smart-gateway-mt7688.h +++ b/include/configs/gardena-smart-gateway-mt7688.h @@ -30,7 +30,7 @@
/* Memory usage */ #define CONFIG_SYS_MAXARGS 64 -#define CONFIG_SYS_MALLOC_LEN (1024 * 1024) +#define CONFIG_SYS_MALLOC_LEN (16 * 1024 * 1024) #define CONFIG_SYS_BOOTPARAMS_LEN (128 * 1024) #define CONFIG_SYS_CBSIZE 512
@@ -38,7 +38,7 @@ #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE
/* Environment settings */ -#define CONFIG_ENV_OFFSET 0x80000 +#define CONFIG_ENV_OFFSET 0xa0000 #define CONFIG_ENV_SIZE (64 << 10) #define CONFIG_ENV_SECT_SIZE (64 << 10) #define CONFIG_SYS_REDUNDAND_ENVIRONMENT

Use the correct function to get the uncached address to access the SoC registers.
Signed-off-by: Stefan Roese sr@denx.de Cc: Daniel Schwierzeck daniel.schwierzeck@gmail.com --- board/seeed/linkit-smart-7688/board.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/board/seeed/linkit-smart-7688/board.c b/board/seeed/linkit-smart-7688/board.c index a28abc00b8..d3d3d50c2c 100644 --- a/board/seeed/linkit-smart-7688/board.c +++ b/board/seeed/linkit-smart-7688/board.c @@ -6,12 +6,15 @@ #include <common.h> #include <asm/io.h>
-#define MT76XX_GPIO1_MODE 0xb0000060 +#define MT76XX_GPIO1_MODE 0x10000060
void board_debug_uart_init(void) { + void __iomem *gpio_mode; + /* Select UART2 mode instead of GPIO mode (default) */ - clrbits_le32((void __iomem *)MT76XX_GPIO1_MODE, GENMASK(27, 26)); + gpio_mode = ioremap_nocache(MT76XX_GPIO1_MODE, 0x100); + clrbits_le32(gpio_mode, GENMASK(27, 26)); }
int board_early_init_f(void)

These misc updates include the following changes: - Change baudrate from 57600 to 115200 - Enable MIPS_BOOT_CMDLINE_LEGACY - Enable FIT support - Enable ethernet support - Enable SPI support - Enable GPIO support - Change max image size from 0x40000 to 0x80000
A note about the baudrate change:
The original Mediatek U-Boot version used 57600 baud. Lets move to a more common and faster speed of 115200 baud. And remove the "console=" property from the DT as its not needed.
Signed-off-by: Stefan Roese sr@denx.de Cc: Daniel Schwierzeck daniel.schwierzeck@gmail.com --- arch/mips/dts/linkit-smart-7688.dts | 1 - configs/linkit-smart-7688-ram_defconfig | 22 +++++++++++++++------- configs/linkit-smart-7688_defconfig | 22 +++++++++++++++------- include/configs/linkit-smart-7688.h | 2 +- 4 files changed, 31 insertions(+), 16 deletions(-)
diff --git a/arch/mips/dts/linkit-smart-7688.dts b/arch/mips/dts/linkit-smart-7688.dts index df4bf907c6..c9db136f30 100644 --- a/arch/mips/dts/linkit-smart-7688.dts +++ b/arch/mips/dts/linkit-smart-7688.dts @@ -22,7 +22,6 @@ };
chosen { - bootargs = "console=ttyS0,57600"; stdout-path = &uart2; }; }; diff --git a/configs/linkit-smart-7688-ram_defconfig b/configs/linkit-smart-7688-ram_defconfig index 77cd1c1575..bca7449971 100644 --- a/configs/linkit-smart-7688-ram_defconfig +++ b/configs/linkit-smart-7688-ram_defconfig @@ -1,35 +1,38 @@ CONFIG_MIPS=y CONFIG_SYS_TEXT_BASE=0x80010000 CONFIG_ARCH_MT7620=y -# CONFIG_MIPS_BOOT_CMDLINE_LEGACY is not set +CONFIG_BOARD_LINKIT_SMART_7688=y # CONFIG_MIPS_BOOT_ENV_LEGACY is not set CONFIG_MIPS_BOOT_FDT=y CONFIG_NR_DRAM_BANKS=1 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +CONFIG_FIT=y +CONFIG_FIT_SIGNATURE=y +CONFIG_IMAGE_FORMAT_LEGACY=y CONFIG_OF_STDOUT_VIA_ALIAS=y CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_BOARD_EARLY_INIT_F=y CONFIG_HUSH_PARSER=y -CONFIG_CMD_CPU=y CONFIG_CMD_LICENSE=y -# CONFIG_CMD_BOOTD is not set # CONFIG_CMD_ELF is not set # CONFIG_CMD_XIMG is not set CONFIG_CMD_MEMINFO=y # CONFIG_CMD_FLASH is not set +CONFIG_CMD_GPIO=y # CONFIG_CMD_LOADS is not set CONFIG_CMD_SF=y CONFIG_CMD_SPI=y -# CONFIG_CMD_NET is not set +CONFIG_CMD_DHCP=y +CONFIG_CMD_MII=y +CONFIG_CMD_PING=y CONFIG_CMD_TIME=y CONFIG_OF_EMBED=y CONFIG_DEFAULT_DEVICE_TREE="linkit-smart-7688" CONFIG_ENV_IS_IN_SPI_FLASH=y +CONFIG_NET_RANDOM_ETHADDR=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_HAVE_BLOCK_DEVICE=y CONFIG_CLK=y -CONFIG_CPU=y -CONFIG_DM_GPIO=y CONFIG_LED=y CONFIG_LED_BLINK=y CONFIG_LED_GPIO=y @@ -40,12 +43,17 @@ CONFIG_SPI_FLASH_SPANSION=y CONFIG_SPI_FLASH_STMICRO=y CONFIG_SPI_FLASH_WINBOND=y CONFIG_SPI_FLASH_MTD=y +CONFIG_PHYLIB=y +CONFIG_PHY_FIXED=y +CONFIG_MT76XX_ETH=y CONFIG_PHY=y CONFIG_POWER_DOMAIN=y CONFIG_RAM=y CONFIG_DM_RESET=y -CONFIG_BAUDRATE=57600 # CONFIG_SPL_SERIAL_PRESENT is not set CONFIG_SYS_NS16550=y CONFIG_SPI=y +CONFIG_MT7621_SPI=y CONFIG_SYSRESET_SYSCON=y +CONFIG_LZMA=y +CONFIG_LZO=y diff --git a/configs/linkit-smart-7688_defconfig b/configs/linkit-smart-7688_defconfig index 62cdda1e0a..4435b06fba 100644 --- a/configs/linkit-smart-7688_defconfig +++ b/configs/linkit-smart-7688_defconfig @@ -1,39 +1,42 @@ CONFIG_MIPS=y CONFIG_SYS_TEXT_BASE=0x9c000000 CONFIG_ARCH_MT7620=y +CONFIG_BOARD_LINKIT_SMART_7688=y CONFIG_BOOT_ROM=y CONFIG_ONBOARD_DDR2_SIZE_1024MBIT=y CONFIG_ONBOARD_DDR2_CHIP_WIDTH_16BIT=y -# CONFIG_MIPS_BOOT_CMDLINE_LEGACY is not set # CONFIG_MIPS_BOOT_ENV_LEGACY is not set CONFIG_MIPS_BOOT_FDT=y CONFIG_NR_DRAM_BANKS=1 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +CONFIG_FIT=y +CONFIG_FIT_SIGNATURE=y +CONFIG_IMAGE_FORMAT_LEGACY=y CONFIG_OF_STDOUT_VIA_ALIAS=y CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_BOARD_EARLY_INIT_F=y CONFIG_HUSH_PARSER=y -CONFIG_CMD_CPU=y CONFIG_CMD_LICENSE=y -# CONFIG_CMD_BOOTD is not set # CONFIG_CMD_ELF is not set # CONFIG_CMD_XIMG is not set # CONFIG_CMD_CRC32 is not set CONFIG_CMD_MEMINFO=y # CONFIG_CMD_FLASH is not set +CONFIG_CMD_GPIO=y # CONFIG_CMD_LOADS is not set CONFIG_CMD_SF=y CONFIG_CMD_SPI=y -# CONFIG_CMD_NET is not set +CONFIG_CMD_DHCP=y +CONFIG_CMD_MII=y +CONFIG_CMD_PING=y CONFIG_CMD_TIME=y CONFIG_OF_EMBED=y CONFIG_DEFAULT_DEVICE_TREE="linkit-smart-7688" CONFIG_ENV_IS_IN_SPI_FLASH=y +CONFIG_NET_RANDOM_ETHADDR=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_HAVE_BLOCK_DEVICE=y CONFIG_CLK=y -CONFIG_CPU=y -CONFIG_DM_GPIO=y CONFIG_LED=y CONFIG_LED_BLINK=y CONFIG_LED_GPIO=y @@ -44,12 +47,17 @@ CONFIG_SPI_FLASH_SPANSION=y CONFIG_SPI_FLASH_STMICRO=y CONFIG_SPI_FLASH_WINBOND=y CONFIG_SPI_FLASH_MTD=y +CONFIG_PHYLIB=y +CONFIG_PHY_FIXED=y +CONFIG_MT76XX_ETH=y CONFIG_PHY=y CONFIG_POWER_DOMAIN=y CONFIG_RAM=y CONFIG_DM_RESET=y -CONFIG_BAUDRATE=57600 # CONFIG_SPL_SERIAL_PRESENT is not set CONFIG_SYS_NS16550=y CONFIG_SPI=y +CONFIG_MT7621_SPI=y CONFIG_SYSRESET_SYSCON=y +CONFIG_LZMA=y +CONFIG_LZO=y diff --git a/include/configs/linkit-smart-7688.h b/include/configs/linkit-smart-7688.h index 78efa23279..3bae92d0ee 100644 --- a/include/configs/linkit-smart-7688.h +++ b/include/configs/linkit-smart-7688.h @@ -38,7 +38,7 @@ #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE
/* Environment settings */ -#define CONFIG_ENV_OFFSET 0x40000 +#define CONFIG_ENV_OFFSET 0x80000 #define CONFIG_ENV_SIZE (16 << 10) #define CONFIG_ENV_SECT_SIZE (64 << 10)

Hi Stefan,
On Tue, 9 Oct 2018 08:59:03 +0200 Stefan Roese sr@denx.de wrote:
in_le32() and out_le32() are needed for the bootcounter support. So lets implement these accessor functions for MIPS as well.
Signed-off-by: Stefan Roese sr@denx.de Cc: Daniel Schwierzeck daniel.schwierzeck@gmail.com
arch/mips/include/asm/io.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
There is a similar patch pending:
http://patchwork.ozlabs.org/patch/978674/
Thanks, Anatolij

Hi Anatolij,
On 09.10.2018 19:38, Anatolij Gustschin wrote:
Hi Stefan,
On Tue, 9 Oct 2018 08:59:03 +0200 Stefan Roese sr@denx.de wrote:
in_le32() and out_le32() are needed for the bootcounter support. So lets implement these accessor functions for MIPS as well.
Signed-off-by: Stefan Roese sr@denx.de Cc: Daniel Schwierzeck daniel.schwierzeck@gmail.com
arch/mips/include/asm/io.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
There is a similar patch pending:
Yes, thanks. Looks pretty identical. Please go ahead with this one from Mario and my patch can be dropped from this series then.
Thanks, Stefan
participants (3)
-
Anatolij Gustschin
-
Daniel Schwierzeck
-
Stefan Roese