From 5a86d67e31998a3d47c684dcd55705f65c8cff4f Mon Sep 17 00:00:00 2001 From: Tony Dinh Date: Mon, 8 Aug 2022 20:01:34 -0700 Subject: arm: kirkwood: pogo_v4: Add Distro boot capability - Add distro boot to board include file and deconfig file - Miscellaneous changes: - Add CONFIG_SUPPORT_PASSING_ATAGS and friends to support legacy kernel method of booting (e.g. OpenWrt) with appended DTB. - Add CONFIG_LTO and CONFIG_UBIFS_SILENCE_MSG, and disable some unused configs to reduce binary size. Note that this patch is depended on the following patch: https://patchwork.ozlabs.org/project/uboot/patch/20220807192709.21717-1-pali@kernel.org/ Signed-off-by: Tony Dinh --- include/configs/pogo_v4.h | 54 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 46 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/configs/pogo_v4.h b/include/configs/pogo_v4.h index 7fff78b7b5d..b5ce2dd13d0 100644 --- a/include/configs/pogo_v4.h +++ b/include/configs/pogo_v4.h @@ -21,15 +21,53 @@ */ #include "mv-common.h" -/* - * Default environment variables - */ +/* Include the common distro boot environment */ +#ifndef CONFIG_SPL_BUILD + +#ifdef CONFIG_MMC +#define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) +#else +#define BOOT_TARGET_DEVICES_MMC(func) +#endif + +#ifdef CONFIG_SATA +#define BOOT_TARGET_DEVICES_SATA(func) func(SATA, sata, 0) +#else +#define BOOT_TARGET_DEVICES_SATA(func) +#endif + +#ifdef CONFIG_USB_STORAGE +#define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0) +#else +#define BOOT_TARGET_DEVICES_USB(func) +#endif + +#define BOOT_TARGET_DEVICES(func) \ + BOOT_TARGET_DEVICES_MMC(func) \ + BOOT_TARGET_DEVICES_USB(func) \ + BOOT_TARGET_DEVICES_SATA(func) \ + func(DHCP, dhcp, na) + +#define KERNEL_ADDR_R __stringify(0x800000) +#define FDT_ADDR_R __stringify(0x2c00000) +#define RAMDISK_ADDR_R __stringify(0x01100000) +#define SCRIPT_ADDR_R __stringify(0x200000) + +#define LOAD_ADDRESS_ENV_SETTINGS \ + "kernel_addr_r=" KERNEL_ADDR_R "\0" \ + "fdt_addr_r=" FDT_ADDR_R "\0" \ + "ramdisk_addr_r=" RAMDISK_ADDR_R "\0" \ + "scriptaddr=" SCRIPT_ADDR_R "\0" + +#include + #define CONFIG_EXTRA_ENV_SETTINGS \ - "dtb_file=/boot/dts/" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \ - "bootargs_console=console=ttyS0,115200\0" \ - "bootcmd_usb=usb start; load usb 0:1 0x00800000 /boot/uImage; " \ - "load usb 0:1 0x01100000 /boot/uInitrd; " \ - "load usb 0:1 0x2c00000 $dtb_file\0" + LOAD_ADDRESS_ENV_SETTINGS \ + "fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \ + "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \ + "console=ttyS0,115200\0" \ + BOOTENV +#endif /* CONFIG_SPL_BUILD */ /* * Ethernet Driver configuration -- cgit v1.2.3 From 5692e5b2445b5e45d463e9e21c7a296ee4d3d96c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Wed, 10 Aug 2022 14:46:09 +0200 Subject: arm: mvebu: mbus: Fix mbus driver to work also after U-Boot relocation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mbus driver is initialized from arch_cpu_init() callback which is called before relocation. This driver stores lot of functions and structure pointers into global variables, so it is data position dependent. Therefore after relocations all pointers are invalid and driver does not work anymore as all pointers referes to the old memory, which overlaps with CONFIG_SYS_LOAD_ADDR and ${loadaddr}. For example U-Boot fuse command crashes if loadaddr memory is cleared or rewritten by some image loaded by U-Boot load command. mw.w ${loadaddr} 0x0 10000 fuse read 0 1 2 Fix this issue by removing of all mbus global variables in which are stored pointers to structures or functions which changes during relocation. And replace it by direct function calls (not via pointers). With this change fuse command finally works. Signed-off-by: Pali Rohár Reviewed-by: Chris Packham Reviewed-by: Stefan Roese --- include/linux/mbus.h | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'include') diff --git a/include/linux/mbus.h b/include/linux/mbus.h index 717cbeab37f..04112eabe1c 100644 --- a/include/linux/mbus.h +++ b/include/linux/mbus.h @@ -33,16 +33,6 @@ struct mbus_dram_target_info { } cs[4]; }; -struct mvebu_mbus_state { - void __iomem *mbuswins_base; - void __iomem *sdramwins_base; - struct dentry *debugfs_root; - struct dentry *debugfs_sdram; - struct dentry *debugfs_devs; - const struct mvebu_mbus_soc_data *soc; - int hw_io_coherency; -}; - /* Flags for PCI/PCIe address decoding regions */ #define MVEBU_MBUS_PCI_IO 0x1 #define MVEBU_MBUS_PCI_MEM 0x2 @@ -67,7 +57,6 @@ int mvebu_mbus_add_window_remap_by_id(unsigned int target, int mvebu_mbus_add_window_by_id(unsigned int target, unsigned int attribute, phys_addr_t base, size_t size); int mvebu_mbus_del_window(phys_addr_t base, size_t size); -int mbus_dt_setup_win(struct mvebu_mbus_state *mbus, - u32 base, u32 size, u8 target, u8 attr); +int mbus_dt_setup_win(u32 base, u32 size, u8 target, u8 attr); #endif /* __LINUX_MBUS_H */ -- cgit v1.2.3 From 7875f8019c15ee557d4d7807cd1164876b47e8f3 Mon Sep 17 00:00:00 2001 From: Tony Dinh Date: Thu, 11 Aug 2022 16:40:25 -0700 Subject: arm: kirkwood: nsa310s: Add Distro boot capability - Add distro boot to board include file and deconfig file - Miscellaneous changes: - Remove Gerald from maintainer list (email bounced) - Add CONFIG_SUPPORT_PASSING_ATAGS and friends to support legacy kernel method of booting (e.g. OpenWrt) with appended DTB. - Add CONFIG_UBIFS_SILENCE_MSG to reduce binary size. Note that this patch is depended on the following patch: https://patchwork.ozlabs.org/project/uboot/patch/20220807192709.21717-1-pali@kernel.org/ Signed-off-by: Tony Dinh --- include/configs/nsa310s.h | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/configs/nsa310s.h b/include/configs/nsa310s.h index 027a47b5a32..62f07011809 100644 --- a/include/configs/nsa310s.h +++ b/include/configs/nsa310s.h @@ -9,15 +9,42 @@ #ifndef _CONFIG_NSA310S_H #define _CONFIG_NSA310S_H +/* + * mv-common.h should be defined after CMD configs since it used them + * to enable certain macros + */ #include "mv-common.h" -/* default environment variables */ +/* Include the common distro boot environment */ +#ifndef CONFIG_SPL_BUILD + +#define BOOT_TARGET_DEVICES(func) \ + func(USB, usb, 0) \ + func(SATA, sata, 0) \ + func(DHCP, dhcp, na) + +#define KERNEL_ADDR_R __stringify(0x800000) +#define FDT_ADDR_R __stringify(0x2c00000) +#define RAMDISK_ADDR_R __stringify(0x01100000) +#define SCRIPT_ADDR_R __stringify(0x200000) + +#define LOAD_ADDRESS_ENV_SETTINGS \ + "kernel_addr_r=" KERNEL_ADDR_R "\0" \ + "fdt_addr_r=" FDT_ADDR_R "\0" \ + "ramdisk_addr_r=" RAMDISK_ADDR_R "\0" \ + "scriptaddr=" SCRIPT_ADDR_R "\0" + +#include #define CONFIG_EXTRA_ENV_SETTINGS \ "console=console=ttyS0,115200\0" \ "kernel=/boot/zImage\0" \ "fdt=/boot/nsa310s.dtb\0" \ - "bootargs_root=ubi.mtd=3 root=ubi0:rootfs rootfstype=ubifs rw\0" + "bootargs_root=ubi.mtd=3 root=ubi0:rootfs rootfstype=ubifs rw\0" \ + LOAD_ADDRESS_ENV_SETTINGS \ + BOOTENV + +#endif /* CONFIG_SPL_BUILD */ /* Ethernet driver configuration */ #define CONFIG_MVGBE_PORTS {1, 0} /* enable port 0 only */ -- cgit v1.2.3 From 857065403a481a768e0c509bb2d3766e4feb2f86 Mon Sep 17 00:00:00 2001 From: Michael Walle Date: Wed, 17 Aug 2022 21:37:55 +0200 Subject: board: lsxl: remove eraseenv script This is not needed. The user can do a "env default -f -a". Signed-off-by: Michael Walle Reviewed-by: Stefan Roese --- include/configs/lsxl.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'include') diff --git a/include/configs/lsxl.h b/include/configs/lsxl.h index e1108619f21..db5f7a93f92 100644 --- a/include/configs/lsxl.h +++ b/include/configs/lsxl.h @@ -62,9 +62,6 @@ "&& bootz ${kernel_addr} " \ "${ramdisk_addr}:${ramdisk_len} ${fdt_addr}\0" \ "bootcmd_rescue=run config_nc_dhcp; run nc\0" \ - "eraseenv=sf probe 0 " \ - "&& sf erase " __stringify(CONFIG_ENV_OFFSET) \ - " +" __stringify(CONFIG_ENV_SIZE) "\0" \ "config_nc_dhcp=setenv autoload_old ${autoload}; " \ "setenv autoload no " \ "&& bootp " \ -- cgit v1.2.3 From 111e1e110b3740802b56cb901f941cc3b6199d85 Mon Sep 17 00:00:00 2001 From: Michael Walle Date: Wed, 17 Aug 2022 21:37:59 +0200 Subject: board: lsxl: use CONFIG_DEFAULT_FDT_FILE Drop our own CONFIG_FDTFILE handling in favor of the generic CONFIG_DEFAULT_FDT_FILE one. Signed-off-by: Michael Walle Reviewed-by: Stefan Roese --- include/configs/lsxl.h | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/include/configs/lsxl.h b/include/configs/lsxl.h index db5f7a93f92..fb9a8c5032f 100644 --- a/include/configs/lsxl.h +++ b/include/configs/lsxl.h @@ -22,21 +22,13 @@ /* * Default environment variables */ - -#if defined(CONFIG_LSXHL) -#define CONFIG_FDTFILE "kirkwood-lsxhl.dtb" -#elif defined(CONFIG_LSCHLV2) -#define CONFIG_FDTFILE "kirkwood-lschlv2.dtb" -#else -#error "Unsupported board" -#endif - #define CONFIG_EXTRA_ENV_SETTINGS \ "bootsource=legacy\0" \ "hdpart=0:1\0" \ "kernel_addr=0x00800000\0" \ "ramdisk_addr=0x01000000\0" \ "fdt_addr=0x00ff0000\0" \ + "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \ "bootcmd_legacy=sata init " \ "&& load sata ${hdpart} ${kernel_addr} /uImage.buffalo "\ "&& load sata ${hdpart} ${ramdisk_addr} /initrd.buffalo "\ @@ -44,7 +36,7 @@ "bootcmd_net=bootp ${kernel_addr} vmlinuz " \ "&& tftpboot ${ramdisk_addr} initrd.img " \ "&& setenv ramdisk_len ${filesize} " \ - "&& tftpboot ${fdt_addr} " CONFIG_FDTFILE " " \ + "&& tftpboot ${fdt_addr} ${fdtfile} " \ "&& bootz ${kernel_addr} " \ "${ramdisk_addr}:${ramdisk_len} ${fdt_addr}\0" \ "bootcmd_hdd=sata init " \ @@ -58,7 +50,7 @@ "&& load usb 0:1 ${kernel_addr} /vmlinuz " \ "&& load usb 0:1 ${ramdisk_addr} /initrd.img " \ "&& setenv ramdisk_len ${filesize} " \ - "&& load usb 0:1 ${fdt_addr} " CONFIG_FDTFILE " " \ + "&& load usb 0:1 ${fdt_addr} ${fdtfile} " \ "&& bootz ${kernel_addr} " \ "${ramdisk_addr}:${ramdisk_len} ${fdt_addr}\0" \ "bootcmd_rescue=run config_nc_dhcp; run nc\0" \ -- cgit v1.2.3 From 148b3aef9a6348a9363ec177bf718d32be3840ee Mon Sep 17 00:00:00 2001 From: Michael Walle Date: Wed, 17 Aug 2022 21:38:00 +0200 Subject: board: lsxl: reorder image loading and remove ramdisk_len We can load the ramdisk as the last step. This way we don't have to set the intermediate variable 'ramdisk_len' and can remove it. Signed-off-by: Michael Walle Reviewed-by: Stefan Roese --- include/configs/lsxl.h | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/configs/lsxl.h b/include/configs/lsxl.h index fb9a8c5032f..7c2c0e22ad8 100644 --- a/include/configs/lsxl.h +++ b/include/configs/lsxl.h @@ -34,25 +34,22 @@ "&& load sata ${hdpart} ${ramdisk_addr} /initrd.buffalo "\ "&& bootm ${kernel_addr} ${ramdisk_addr}\0" \ "bootcmd_net=bootp ${kernel_addr} vmlinuz " \ - "&& tftpboot ${ramdisk_addr} initrd.img " \ - "&& setenv ramdisk_len ${filesize} " \ "&& tftpboot ${fdt_addr} ${fdtfile} " \ + "&& tftpboot ${ramdisk_addr} initrd.img " \ "&& bootz ${kernel_addr} " \ - "${ramdisk_addr}:${ramdisk_len} ${fdt_addr}\0" \ + "${ramdisk_addr}:${filesize} ${fdt_addr}\0" \ "bootcmd_hdd=sata init " \ "&& load sata ${hdpart} ${kernel_addr} /vmlinuz " \ - "&& load sata ${hdpart} ${ramdisk_addr} /initrd.img " \ - "&& setenv ramdisk_len ${filesize} " \ "&& load sata ${hdpart} ${fdt_addr} /dtb " \ + "&& load sata ${hdpart} ${ramdisk_addr} /initrd.img " \ "&& bootz ${kernel_addr} " \ - "${ramdisk_addr}:${ramdisk_len} ${fdt_addr}\0" \ + "${ramdisk_addr}:${filesize} ${fdt_addr}\0" \ "bootcmd_usb=usb start " \ "&& load usb 0:1 ${kernel_addr} /vmlinuz " \ - "&& load usb 0:1 ${ramdisk_addr} /initrd.img " \ - "&& setenv ramdisk_len ${filesize} " \ "&& load usb 0:1 ${fdt_addr} ${fdtfile} " \ + "&& load usb 0:1 ${ramdisk_addr} /initrd.img " \ "&& bootz ${kernel_addr} " \ - "${ramdisk_addr}:${ramdisk_len} ${fdt_addr}\0" \ + "${ramdisk_addr}:${filesize} ${fdt_addr}\0" \ "bootcmd_rescue=run config_nc_dhcp; run nc\0" \ "config_nc_dhcp=setenv autoload_old ${autoload}; " \ "setenv autoload no " \ -- cgit v1.2.3 From f5631b2c84dcbb225ae33532fa039763732363b8 Mon Sep 17 00:00:00 2001 From: Michael Walle Date: Wed, 17 Aug 2022 21:38:01 +0200 Subject: board: lsxl: use proper *_r variables Use the common kernel_addr_r, ramdisk_addr_r and fdt_addr_r variable names. Signed-off-by: Michael Walle Reviewed-by: Stefan Roese --- include/configs/lsxl.h | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'include') diff --git a/include/configs/lsxl.h b/include/configs/lsxl.h index 7c2c0e22ad8..162f07790ff 100644 --- a/include/configs/lsxl.h +++ b/include/configs/lsxl.h @@ -25,31 +25,31 @@ #define CONFIG_EXTRA_ENV_SETTINGS \ "bootsource=legacy\0" \ "hdpart=0:1\0" \ - "kernel_addr=0x00800000\0" \ - "ramdisk_addr=0x01000000\0" \ - "fdt_addr=0x00ff0000\0" \ + "kernel_addr_r=0x00800000\0" \ + "ramdisk_addr_r=0x01000000\0" \ + "fdt_addr_r=0x00ff0000\0" \ "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \ "bootcmd_legacy=sata init " \ - "&& load sata ${hdpart} ${kernel_addr} /uImage.buffalo "\ - "&& load sata ${hdpart} ${ramdisk_addr} /initrd.buffalo "\ - "&& bootm ${kernel_addr} ${ramdisk_addr}\0" \ - "bootcmd_net=bootp ${kernel_addr} vmlinuz " \ - "&& tftpboot ${fdt_addr} ${fdtfile} " \ - "&& tftpboot ${ramdisk_addr} initrd.img " \ - "&& bootz ${kernel_addr} " \ - "${ramdisk_addr}:${filesize} ${fdt_addr}\0" \ + "&& load sata ${hdpart} ${kernel_addr_r} /uImage.buffalo "\ + "&& load sata ${hdpart} ${ramdisk_addr_r} /initrd.buffalo "\ + "&& bootm ${kernel_addr_r} ${ramdisk_addr_r}\0" \ + "bootcmd_net=bootp ${kernel_addr_r} vmlinuz " \ + "&& tftpboot ${fdt_addr_r} ${fdtfile} " \ + "&& tftpboot ${ramdisk_addr_r} initrd.img " \ + "&& bootz ${kernel_addr_r} " \ + "${ramdisk_addr_r}:${filesize} ${fdt_addr_r}\0" \ "bootcmd_hdd=sata init " \ - "&& load sata ${hdpart} ${kernel_addr} /vmlinuz " \ - "&& load sata ${hdpart} ${fdt_addr} /dtb " \ - "&& load sata ${hdpart} ${ramdisk_addr} /initrd.img " \ - "&& bootz ${kernel_addr} " \ - "${ramdisk_addr}:${filesize} ${fdt_addr}\0" \ + "&& load sata ${hdpart} ${kernel_addr_r} /vmlinuz " \ + "&& load sata ${hdpart} ${fdt_addr_r} /dtb " \ + "&& load sata ${hdpart} ${ramdisk_addr_r} /initrd.img " \ + "&& bootz ${kernel_addr_r} " \ + "${ramdisk_addr_r}:${filesize} ${fdt_addr_r}\0" \ "bootcmd_usb=usb start " \ - "&& load usb 0:1 ${kernel_addr} /vmlinuz " \ - "&& load usb 0:1 ${fdt_addr} ${fdtfile} " \ - "&& load usb 0:1 ${ramdisk_addr} /initrd.img " \ - "&& bootz ${kernel_addr} " \ - "${ramdisk_addr}:${filesize} ${fdt_addr}\0" \ + "&& load usb 0:1 ${kernel_addr_r} /vmlinuz " \ + "&& load usb 0:1 ${fdt_addr_r} ${fdtfile} " \ + "&& load usb 0:1 ${ramdisk_addr_r} /initrd.img " \ + "&& bootz ${kernel_addr_r} " \ + "${ramdisk_addr_r}:${filesize} ${fdt_addr_r}\0" \ "bootcmd_rescue=run config_nc_dhcp; run nc\0" \ "config_nc_dhcp=setenv autoload_old ${autoload}; " \ "setenv autoload no " \ -- cgit v1.2.3 From aa088beac3aca0dd9b40f60b0b1e5ab1c6bae471 Mon Sep 17 00:00:00 2001 From: Michael Walle Date: Wed, 17 Aug 2022 21:38:03 +0200 Subject: board: lsxl: make last resort recovery more reliable If something is wrong with the environment, we cannot rely on a proper u-boot operation anymore. In fact, it is possible, that we never reach misc_init_r() with a broken environment. Also don't enable the netconsole by environment settings. This way the user don't have to reconfigure the environment. Instead the network console is only enabled when the push button is pressed during boot. Signed-off-by: Michael Walle Reviewed-by: Stefan Roese --- include/configs/lsxl.h | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'include') diff --git a/include/configs/lsxl.h b/include/configs/lsxl.h index 162f07790ff..4d5908d2360 100644 --- a/include/configs/lsxl.h +++ b/include/configs/lsxl.h @@ -57,17 +57,7 @@ "&& setenv ncip " \ "&& setenv autoload ${autoload_old}; " \ "setenv autoload_old\0" \ - "standard_env=setenv ipaddr; setenv netmask; setenv serverip; " \ - "setenv ncip; setenv gatewayip; setenv ethact; " \ - "setenv bootfile; setenv dnsip; " \ - "setenv bootsource legacy; run ser\0" \ - "restore_env=run standard_env; saveenv; reset\0" \ - "ser=setenv stdin serial; setenv stdout serial; " \ - "setenv stderr serial\0" \ "nc=setenv stdin nc; setenv stdout nc; setenv stderr nc\0" \ - "stdin=serial\0" \ - "stdout=serial\0" \ - "stderr=serial\0" /* * Ethernet Driver configuration -- cgit v1.2.3 From cb75d02ab13d71dda92e8925e8ec07d3890815bc Mon Sep 17 00:00:00 2001 From: Michael Walle Date: Wed, 17 Aug 2022 21:38:05 +0200 Subject: board: lsxl: convert to DM_ETH Just enabling the Kconfig option for DM_ETH and DM_MDIO is enough. Additionally, we can remove the old hardcoded config. Signed-off-by: Michael Walle Reviewed-by: Stefan Roese --- include/configs/lsxl.h | 8 -------- 1 file changed, 8 deletions(-) (limited to 'include') diff --git a/include/configs/lsxl.h b/include/configs/lsxl.h index 4d5908d2360..c82eb8b04bf 100644 --- a/include/configs/lsxl.h +++ b/include/configs/lsxl.h @@ -59,12 +59,4 @@ "setenv autoload_old\0" \ "nc=setenv stdin nc; setenv stdout nc; setenv stderr nc\0" \ -/* - * Ethernet Driver configuration - */ -#ifdef CONFIG_CMD_NET -#define CONFIG_MVGBE_PORTS {0, 1} /* enable port 1 only */ -#define CONFIG_PHY_BASE_ADR 7 -#endif /* CONFIG_CMD_NET */ - #endif /* _CONFIG_LSXL_H */ -- cgit v1.2.3