[PATCH] zfs: fix missing include for disk_partition definition
Commit 0528979fa7ab ("part: Drop disk_partition_t typedef") changed to a struct. As a result it uncovered an apparent missing include in zfs_common.h for part.h which actually contains the definition. The ZFS handles the struct exclusively as pointers so it was only a warning. warning: ‘struct disk_partition’ declared inside parameter list will not be visible outside of this definition or declaration void zfs_set_blk_dev(struct blk_desc *rbdd, struct disk_partition *info); Signed-off-by: Joel Johnson Series-CC: Simon Glass --- include/zfs_common.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/zfs_common.h b/include/zfs_common.h index 027ba91b28..cb83e59e83 100644 --- a/include/zfs_common.h +++ b/include/zfs_common.h @@ -22,6 +22,8 @@ #ifndef __ZFS_COMMON__ #define __ZFS_COMMON__ +#include + #define SECTOR_SIZE0x200 #define SECTOR_BITS9 -- 2.26.2
Re: [PATCH v3] cmd: mvebu: bubt: fix quoted string split across lines
Ping for review feedback on this patch, it'd be good to have the fix included in the same release as the merge was included. Joel On 2020-04-25 20:54, Joel Johnson wrote: Update quoted string alignment to address checkpatch.pl warning originally introduced in commit f60a66ef5d7d ("cmd: mvebu: bubt: show image boot device"). Signed-off-by: Joel Johnson --- I am sort of inferring that this is the desired fix, preferring line length infractions over split quoted strings. As such, I've combined the static part of the string for grepping and left the dynamic parts on the next line. v2 change: - syntax fix v3 change: - actually add syntax fix... --- cmd/mvebu/bubt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index dc0ce01c35..ef53153c46 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -730,8 +730,8 @@ static int bubt_check_boot_mode(const struct bubt_dev *dst) for (int i = 0; i < ARRAY_SIZE(a38x_boot_modes); i++) { if (a38x_boot_modes[i].id == hdr->blockid) { - printf("Error: A38x image meant to be " - "booted from \"%s\", not \"%s\"!\n", + printf("Error: A38x image meant to be booted from " + "\"%s\", not \"%s\"!\n", a38x_boot_modes[i].name, dst->name); return -ENOEXEC; }
[PATCH v3] cmd: mvebu: bubt: fix quoted string split across lines
Update quoted string alignment to address checkpatch.pl warning originally introduced in commit f60a66ef5d7d ("cmd: mvebu: bubt: show image boot device"). Signed-off-by: Joel Johnson --- I am sort of inferring that this is the desired fix, preferring line length infractions over split quoted strings. As such, I've combined the static part of the string for grepping and left the dynamic parts on the next line. v2 change: - syntax fix v3 change: - actually add syntax fix... --- cmd/mvebu/bubt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index dc0ce01c35..ef53153c46 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -730,8 +730,8 @@ static int bubt_check_boot_mode(const struct bubt_dev *dst) for (int i = 0; i < ARRAY_SIZE(a38x_boot_modes); i++) { if (a38x_boot_modes[i].id == hdr->blockid) { - printf("Error: A38x image meant to be " - "booted from \"%s\", not \"%s\"!\n", + printf("Error: A38x image meant to be booted from " + "\"%s\", not \"%s\"!\n", a38x_boot_modes[i].name, dst->name); return -ENOEXEC; } -- 2.26.2
[PATCH v2] cmd: mvebu: bubt: fix quoted string split across lines
Update quoted string alignment to address checkpatch.pl warning originally introduced in commit f60a66ef5d7d ("cmd: mvebu: bubt: show image boot device"). Signed-off-by: Joel Johnson --- I am sort of inferring that this is the desired fix, preferring line length infractions over split quoted strings. As such, I've combined the static part of the string for grepping and left the dynamic parts on the next line. v2 change: - syntax fix --- cmd/mvebu/bubt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index dc0ce01c35..204e1afd07 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -730,8 +730,8 @@ static int bubt_check_boot_mode(const struct bubt_dev *dst) for (int i = 0; i < ARRAY_SIZE(a38x_boot_modes); i++) { if (a38x_boot_modes[i].id == hdr->blockid) { - printf("Error: A38x image meant to be " - "booted from \"%s\", not \"%s\"!\n", + printf("Error: A38x image meant to be booted from ", + "\"%s\", not \"%s\"!\n", a38x_boot_modes[i].name, dst->name); return -ENOEXEC; } -- 2.26.2
[PATCH] cmd: mvebu: bubt: fix quoted string split across lines
Update quoted string alignment to address checkpatch.pl warning originally introduced in commit f60a66ef5d7d ("cmd: mvebu: bubt: show image boot device"). Signed-off-by: Joel Johnson --- I am sort of inferring that this is the desired fix, preferring line length infractions over split quoted strings. As such, I've combined the static part of the string for grepping and left the dynamic parts on the next line. --- cmd/mvebu/bubt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index dc0ce01c35..204e1afd07 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -730,8 +730,8 @@ static int bubt_check_boot_mode(const struct bubt_dev *dst) for (int i = 0; i < ARRAY_SIZE(a38x_boot_modes); i++) { if (a38x_boot_modes[i].id == hdr->blockid) { - printf("Error: A38x image meant to be " - "booted from \"%s\", not \"%s\"!\n", + printf("Error: A38x image meant to be booted from ", + "\"%s\", not \"%s\"!\n", a38x_boot_modes[i].name, dst->name); return -ENOEXEC; } -- 2.26.2
Re: Please pull u-boot-marvell/master
On 2020-04-22 23:04, Stefan Roese wrote: On 22.04.20 20:34, Tom Rini wrote: On Wed, Apr 22, 2020 at 04:48:33PM +0200, Stefan Roese wrote: Hi Tom, please pull the 2nd batch of MVEBU related patches in this merge window. The major changes are: Applied to u-boot/master, thanks! But the following checkpatch should be fixed in a follow up sometime: WARNING: quoted string split across lines #28: FILE: cmd/mvebu/bubt.c:734: + printf("Error: A38x image meant to be " + "booted from \"%s\", not \"%s\"!\n", (There's another but I think the split is fine for how humans would grep for it). Joel, will you please take care of this. Thanks, Stefan Yep, I'll get it updated today. Joel
Re: [PATCH v1 1/2] arm: mvebu: correct SPL boot configs for SPI/MMC
On 2020-04-18 08:23, Dennis Gilmore wrote: On Sat, Apr 18, 2020 at 9:18 AM Dennis Gilmore wrote: On Fri, Apr 17, 2020 at 2:19 AM Joel Johnson wrote: > > Update mvebu SPL boot selection mechanism for the move to driver model > usage by ensuring that the required driver support for SPI and MMC > booting is available in SPL when the respective boot method is > selected. > > Previously, all mvebu boards selected a boot method (implicitly > MVEBU_SPL_BOOT_DEVICE_SPI for many) even if SPL booting wasn't used. > This changes mvebu boot method selection to depend on SPL usage which > resolves the issue with aarch64 boards which don't use SPL getting an > implicit boot device selection resulting in unmet dependencies. The > 32-bit arm boards do use SPL, but I'm led to conclude that most aren't > intentionally using the MVEBU_SPL_BOOT_DEVICE selection since none have > SPL_DM_SPI enabled in their defconfig even though they still implicitly > select the SPI boot method. > > This also results in the new addition of SPL_GPIO_SUPPORT to helios4. > The mainline dts for helios4 includes the cd-gpios entry for sdhci with > identical addresses as the clearfog dts. I don't have a helios4 board > to confirm, but based on the current source conclude that the board > itself is either wired to pull the signal low for eMMC, or the default > MMC boot isn't fully functional in mainline. In either case, as far as > I can tell, including the GPIO support will at least cause no > regression. Currently, SPL does not find u-boot.bin on the helios4, I am working on syncing all of the changes done to clearfog to the helios4, generally speaking, any change made to clearfog needs to also, be made for the helios4 as they have the same SOM. the differences being in changes for the carrier board. Dennis Great, thanks for the update and confirmation! Stefan - in this case, I'd encourage that only the first commit of this series be merged and drop the second patch entirely. Joel
[PATCH] spl: Kconfig: de-dup SPL_DM_GPIO definition
Two nearly concurrent commits (d4d65e112 and bcee8d676) added a SPL_DM_GPIO symbol. Resolve the duplication in favor of the version in drivers/gpio/Kconfig. Signed-off-by: Joel Johnson --- common/spl/Kconfig | 6 -- 1 file changed, 6 deletions(-) diff --git a/common/spl/Kconfig b/common/spl/Kconfig index 9d52b75cb4..ef5bf66696 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -508,12 +508,6 @@ config SPL_DMA the CPU moving the data. Enable this option to build the drivers in drivers/dma as part of an SPL build. -config SPL_DM_GPIO - bool "Support Driver Model GPIO drivers" - depends on SPL_GPIO_SUPPORT && DM_GPIO - help - Enable support for Driver Model based GPIO drivers in SPL. - config SPL_DRIVERS_MISC_SUPPORT bool "Support misc drivers" help -- 2.26.1
[PATCH v6 3/5] cmd: mvebu: bubt: verify A38x target device type
Ensure that the device to which an image is being written includes header information indicating boot support for the destination device. This is derived from the support in the SolidRun master-a38x vendor fork. Signed-off-by: Joel Johnson --- v2 changes: - none v3 changes: - use ARRAY_SIZE instead of #define size v4 changes: - none v5 changes: - use if(IS_ENABLED()) for inline check instead of ifdef v6 changes: - reduce #ifdef usages at the tradeoff of otherwise unneccessarily exposing A38x internal structs to more than A38x builds. - since state is exposed anyway, rename a38x_check_boot_mode to bubt_check_boot_mode with provision for per-target customization This fixes building across all mvebu targets. Exposing the needed a38x_* structs isn't something I'm hugely excited about, but it does get the build working and avoids inline #ifdefs as requested. In cases where the target being built (all but A38x) doesn't support checking the boot mode, rely on the compiler to [mostly] optimize the function usage away. Local tests show an increase of only 4 bytes of rodata in such cases. --- cmd/mvebu/bubt.c | 52 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index b80b81c82a..be6c5869a9 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -85,7 +85,7 @@ struct mvebu_image_info { u32 encrypt_start_offset; u32 encrypt_size; }; -#elif defined(CONFIG_ARMADA_38X) /* A38X */ +#endif /* Structure of the main header, version 1 (Armada 370/38x/XP) */ struct a38x_main_hdr_v1 { @@ -107,7 +107,23 @@ struct a38x_main_hdr_v1 { u8 ext; /* 0x1E */ u8 checksum; /* 0x1F */ }; -#endif + +struct a38x_boot_mode { + unsigned int id; + const char *name; +}; + +/* The blockid header field values used to indicate boot device of image */ +struct a38x_boot_mode a38x_boot_modes[] = { + { 0x4D, "i2c" }, + { 0x5A, "spi" }, + { 0x69, "uart" }, + { 0x78, "sata" }, + { 0x8B, "nand" }, + { 0x9C, "pex" }, + { 0xAE, "mmc" }, + {}, +}; struct bubt_dev { char name[8]; @@ -697,7 +713,29 @@ static int check_image_header(void) } #endif -static int bubt_verify(size_t image_size) +static int bubt_check_boot_mode(const struct bubt_dev *dst) +{ + if (IS_ENABLED(CONFIG_ARMADA_38X)) { + int mode; + const struct a38x_main_hdr_v1 *hdr = + (struct a38x_main_hdr_v1 *)get_load_addr(); + + for (mode = 0; mode < ARRAY_SIZE(a38x_boot_modes); mode++) { + if (strcmp(a38x_boot_modes[mode].name, dst->name) == 0) + break; + } + + if (a38x_boot_modes[mode].id == hdr->blockid) + return 0; + + puts("Error: A38x image not built for destination device!\n"); + return -ENOEXEC; + } else { + return 0; + } +} + +static int bubt_verify(const struct bubt_dev *dst) { int err; @@ -708,6 +746,12 @@ static int bubt_verify(size_t image_size) return err; } + err = bubt_check_boot_mode(dst); + if (err) { + printf("Error: Image boot mode verification failed\n"); + return err; + } + return 0; } @@ -829,7 +873,7 @@ int do_bubt_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (!image_size) return -EIO; - err = bubt_verify(image_size); + err = bubt_verify(dst); if (err) return err; -- 2.26.1
[PATCH v6 5/5] cmd: mvebu: bubt: show image boot device
When a mismatch is found trying to write an image for one boot method to a different boot device, print an error message including the image header marked target boot device type. Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v2 changes: - newly added in v2 series v3 changes: - none v4 changes: - adjust to ARRAY_SIZE usage v5 changes: - remove double space (one each line) in error message v6 changes: - rebased on different location/naming from patch 3 of the bubt_check_boot_mode function --- cmd/mvebu/bubt.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index be6c5869a9..dc0ce01c35 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -728,7 +728,17 @@ static int bubt_check_boot_mode(const struct bubt_dev *dst) if (a38x_boot_modes[mode].id == hdr->blockid) return 0; - puts("Error: A38x image not built for destination device!\n"); + for (int i = 0; i < ARRAY_SIZE(a38x_boot_modes); i++) { + if (a38x_boot_modes[i].id == hdr->blockid) { + printf("Error: A38x image meant to be " + "booted from \"%s\", not \"%s\"!\n", + a38x_boot_modes[i].name, dst->name); + return -ENOEXEC; + } + } + + printf("Error: unknown boot device in A38x image header: " + "0x%x\n", hdr->blockid); return -ENOEXEC; } else { return 0; -- 2.26.1
[PATCH v6 4/5] arm: mvebu: clearfog: enable bubt command
With support added for Armada 38x, include the bubt command in ClearFog defconfig. Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v2 changes: - none v3 changes: - none v4 changes: - none v5 changes: - none v6 changes: - none --- configs/clearfog_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/clearfog_defconfig b/configs/clearfog_defconfig index 6db8b8acf6..0f2ae1ccec 100644 --- a/configs/clearfog_defconfig +++ b/configs/clearfog_defconfig @@ -33,6 +33,7 @@ CONFIG_SPL_CMD_TLV_EEPROM=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y +CONFIG_CMD_MVEBU_BUBT=y CONFIG_CMD_PCI=y CONFIG_CMD_SPI=y CONFIG_CMD_USB=y -- 2.26.1
[PATCH v6 2/5] cmd: mvebu: bubt: correct U-Boot spelling
Replace "U-BOOT" text with correct spelling Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v2 changes: - none v3 changes: - none v4 changes: - none v5 changes: - none v6 changes: - none --- cmd/mvebu/bubt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index d399fb6da4..b80b81c82a 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -346,7 +346,7 @@ static int nand_burn_image(size_t image_size) /* Align U-Boot size to currently used blocksize */ image_size = ((image_size + (block_size - 1)) & (~(block_size - 1))); - /* Erase the U-BOOT image space */ + /* Erase the U-Boot image space */ printf("Erasing 0x%x - 0x%x:...", 0, (int)image_size); ret = nand_erase(mtd, 0, image_size); if (ret) { @@ -734,7 +734,7 @@ static int bubt_read_file(struct bubt_dev *src) static int bubt_is_dev_active(struct bubt_dev *dev) { if (!dev->active) { - printf("Device \"%s\" not supported by U-BOOT image\n", + printf("Device \"%s\" not supported by U-Boot image\n", dev->name); return 0; } @@ -822,7 +822,7 @@ int do_bubt_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (!bubt_is_dev_active(src)) return -ENODEV; - printf("Burning U-BOOT image \"%s\" from \"%s\" to \"%s\"\n", + printf("Burning U-Boot image \"%s\" from \"%s\" to \"%s\"\n", net_boot_file_name, src->name, dst->name); image_size = bubt_read_file(src); -- 2.26.1
[PATCH v6 1/5] cmd: mvebu: bubt: add A38x support
Add support for Armada 38x devices in bubt flashing utility. This is based on (and streamlined from) the support in the SolidRun master-a38x vendor fork. Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v2 changes - none v3 changes - none v4 changes - none v5 changes - none v6 changes - none --- cmd/mvebu/bubt.c | 69 +++- 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index 2041a7a29a..d399fb6da4 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -85,7 +85,29 @@ struct mvebu_image_info { u32 encrypt_start_offset; u32 encrypt_size; }; -#endif /* CONFIG_ARMADA_XXX */ +#elif defined(CONFIG_ARMADA_38X) /* A38X */ + +/* Structure of the main header, version 1 (Armada 370/38x/XP) */ +struct a38x_main_hdr_v1 { + u8 blockid; /* 0x0 */ + u8 flags; /* 0x1 */ + u16 reserved2; /* 0x2-0x3 */ + u32 blocksize; /* 0x4-0x7 */ + u8 version; /* 0x8 */ + u8 headersz_msb; /* 0x9 */ + u16 headersz_lsb; /* 0xA-0xB */ + u32 srcaddr; /* 0xC-0xF */ + u32 destaddr; /* 0x10-0x13 */ + u32 execaddr; /* 0x14-0x17 */ + u8 options; /* 0x18 */ + u8 nandblocksize; /* 0x19 */ + u8 nandbadblklocation;/* 0x1A */ + u8 reserved4; /* 0x1B */ + u16 reserved5; /* 0x1C-0x1D */ + u8 ext; /* 0x1E */ + u8 checksum; /* 0x1F */ +}; +#endif struct bubt_dev { char name[8]; @@ -621,7 +643,52 @@ static int check_image_header(void) return 0; } +#elif defined(CONFIG_ARMADA_38X) +static size_t a38x_header_size(const struct a38x_main_hdr_v1 *h) +{ + if (h->version == 1) + return (h->headersz_msb << 16) | le16_to_cpu(h->headersz_lsb); + + printf("Error: Invalid A38x image (header version 0x%x unknown)!\n", + h->version); + return 0; +} + +static uint8_t image_checksum8(const void *start, size_t len) +{ + u8 csum = 0; + const u8 *p = start; + + while (len) { + csum += *p; + ++p; + --len; + } + + return csum; +} +static int check_image_header(void) +{ + u8 checksum; + const struct a38x_main_hdr_v1 *hdr = + (struct a38x_main_hdr_v1 *)get_load_addr(); + const size_t image_size = a38x_header_size(hdr); + + if (!image_size) + return -ENOEXEC; + + checksum = image_checksum8(hdr, image_size); + checksum -= hdr->checksum; + if (checksum != hdr->checksum) { + printf("Error: Bad A38x image checksum. 0x%x != 0x%x\n", + checksum, hdr->checksum); + return -ENOEXEC; + } + + printf("Image checksum...OK!\n"); + return 0; +} #else /* Not ARMADA? */ static int check_image_header(void) { -- 2.26.1
Re: [PATCH v1 2/2] [WIP] arm: mvebu: Enable helios4 opt-out of SPL GPIO
On 2020-04-17 02:12, Stefan Roese wrote: On 17.04.20 09:19, Joel Johnson wrote: Change the SPL boot selection of MMC from a hard selection of GPIO to a softer imply and opt-out of GPIO support for helios4. This preserves the previous GPIO-less configuration. Signed-off-by: Joel Johnson Doesn't patch 1/2 generate a compile error (at least warning) on helios4? If yes, then please squash both patches together to preserve git bisect-ablility. Thanks, Stefan No, all mvebu targets build cleanly with just the first commit. My goal is to drop the second patch entirely and only have the first patch merged unless someone strongly objects. The difference with helios4 is that it actually specifies MVEBU_SPL_BOOT_DEVICE_MMC explicitly and so takes that config path with the newly selected options. It is the only board besides ClearFog to do so, but I can only personally test with ClearFog hardware. The only meaningful difference for helios4 is that the GPIO support is added where it wasn't included before, resulting in an increase of 2678 bytes in the SPL image. I don't see any way including GPIO support would or could cause harm, especially since the device tree includes the same gpio line for sdhci detection as ClearFog. I am however, open to and inviting clarification if helios4 has a problem with that. As far as I could tell, Aditya Prayoga is the most recent and most active helios4 contributor. Concretely, the following is the buildman -sK -sS report for the series on helios4, showing config and resulting binary size differences. 01: Merge tag 'arc-fixes-for-2020.07-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-arc arm: w+ helios4 02: arm: mvebu: correct SPL boot configs for SPI/MMC arm: (for 1/1 boards) spl/u-boot-spl:all +2678.0 spl/u-boot-spl:data +144.0 spl/u-boot-spl:rodata +214.0 spl/u-boot-spl:text +2320.0 helios4: spl/u-boot-spl:all +2678 spl/u-boot-spl:data +144 spl/u-boot-spl:rodata +214 spl/u-boot-spl:text +2320 spl-u-boot-spl: add: 26/0, grow: 2/0 bytes: 2464/0 (2464) function old new delta fdtdec_parse_phandle_with_args - 332 +332 static.gpio_request_tail - 200 +200 dm_gpio_request - 148 +148 dm_gpio_set_dir_flags- 136 +136 gpio_renumber- 132 +132 check_reserved - 116 +116 gpio_request_by_name - 112 +112 fdt_get_phandle - 112 +112 uclass_find_device_by_ofnode - 108 +108 ofnode_parse_phandle_with_args - 108 +108 fdt_node_offset_by_phandle - 96 +96 mvebu_gpio_probe - 76 +76 _u_boot_list_2_uclass_2_gpio - 76 +76 mvebu_gpio_direction_output - 72 +72 dm_gpio_get_value- 72 +72 gpio_xlate_offs_flags- 68 +68 _u_boot_list_2_driver_2_gpio_mvebu - 68 +68 mvebu_gpio_set_value - 56 +56 gpio_post_probe - 56 +56 fdtdec_get_int - 52 +52 uclass_get_device_by_ofnode - 48 +48 mvebu_gpio_get_function - 44 +44 mvebu_gpio_direction_input - 40 +40 sdhci_probe336 372 +36 mvebu_gpio_get_value - 36 +36 sdhci_get_cd96 128 +32 gpio_pre_remove - 24 +24 gpio_post_bind - 8 +8 arm: + u-boot.cfg: CONFIG_SPL_DM_GPIO=1 CONFIG_SPL_GPIO_SUPPORT=1 + u-boot-spl.cfg: CONFIG_SPL_DM_GPIO=1 CONFIG_SPL_GPIO_SUPPORT=1 + all: CONFIG_SPL_DM_GPIO=1 CONFIG_SPL_GPIO_SUPPORT=1 helios4 : + u-boot.cfg: CONFIG_SPL_DM_GPIO=1 CONFIG_SPL_GPIO_SUPPORT=1 + u-boot-spl.cfg: CONFIG_SPL_DM_GPIO=1 CONFIG_SPL_GPIO_SUPPORT=1 + all: CONFIG_SPL_DM_GPIO=1 CONFIG_SPL_GPIO_SUPPORT=1 03: [WIP] arm: mvebu: Enable helios4 opt-out of SPL GPIO arm: (for 1/1 boards) spl/u-boot-spl:all -2678.0 spl/u-boot-spl:data -144.0 spl/u
[PATCH v1 2/2] [WIP] arm: mvebu: Enable helios4 opt-out of SPL GPIO
Change the SPL boot selection of MMC from a hard selection of GPIO to a softer imply and opt-out of GPIO support for helios4. This preserves the previous GPIO-less configuration. Signed-off-by: Joel Johnson --- Aditya Prayoga - if you object to the addition of GPIO to the helios4 SPL, I'd be interested in your thoughts on this option This is an exploratory commit of a viable approach to retain the identical current helios4 current configuration. I think it's not worth it and shouldn't be applied since helios4 uses default MMC boot and there is sufficient space for the SPL image, but is a viable option depending on the opinion of helios4 interested maintainers. --- arch/arm/mach-mvebu/Kconfig | 6 +++--- configs/helios4_defconfig | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index 645990b3ef..af30d71cc6 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig @@ -245,12 +245,12 @@ config MVEBU_SPL_BOOT_DEVICE_SPI config MVEBU_SPL_BOOT_DEVICE_MMC bool "SDIO/MMC card" imply ENV_IS_IN_MMC - # GPIO needed for eMMC/SD card presence detection - select SPL_DM_GPIO select SPL_DM_MMC - select SPL_GPIO_SUPPORT select SPL_LIBDISK_SUPPORT select SPL_MMC_SUPPORT + # GPIO often needed for eMMC/SD card presence detection + imply SPL_DM_GPIO + imply SPL_GPIO_SUPPORT config MVEBU_SPL_BOOT_DEVICE_SATA bool "SATA" diff --git a/configs/helios4_defconfig b/configs/helios4_defconfig index 0fe8559507..3630a004bd 100644 --- a/configs/helios4_defconfig +++ b/configs/helios4_defconfig @@ -2,6 +2,7 @@ CONFIG_ARM=y CONFIG_ARCH_CPU_INIT=y CONFIG_ARCH_MVEBU=y CONFIG_SYS_TEXT_BASE=0x0080 +# CONFIG_SPL_GPIO_SUPPORT is not set CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_SYS_MALLOC_F_LEN=0x2000 -- 2.26.1
[PATCH v1 1/2] arm: mvebu: correct SPL boot configs for SPI/MMC
Update mvebu SPL boot selection mechanism for the move to driver model usage by ensuring that the required driver support for SPI and MMC booting is available in SPL when the respective boot method is selected. Previously, all mvebu boards selected a boot method (implicitly MVEBU_SPL_BOOT_DEVICE_SPI for many) even if SPL booting wasn't used. This changes mvebu boot method selection to depend on SPL usage which resolves the issue with aarch64 boards which don't use SPL getting an implicit boot device selection resulting in unmet dependencies. The 32-bit arm boards do use SPL, but I'm led to conclude that most aren't intentionally using the MVEBU_SPL_BOOT_DEVICE selection since none have SPL_DM_SPI enabled in their defconfig even though they still implicitly select the SPI boot method. This also results in the new addition of SPL_GPIO_SUPPORT to helios4. The mainline dts for helios4 includes the cd-gpios entry for sdhci with identical addresses as the clearfog dts. I don't have a helios4 board to confirm, but based on the current source conclude that the board itself is either wired to pull the signal low for eMMC, or the default MMC boot isn't fully functional in mainline. In either case, as far as I can tell, including the GPIO support will at least cause no regression. Tested on SolidRun ClearFog devices. Signed-off-by: Joel Johnson --- This patch unifies two patches from a prior ClearFog specific series which caused issues when building for most other mvebu boards. Now build and config diff tested for all arm and aarch64 mvebu boards! The only substantive changes end up being the SPL dependency for boot selection, along with defconfig cleanups with Kconfig consolidated boot dependent values. The superfluous addition of SPL_MTD_SUPPORT present in the prior patch for SPI booting was also removed. --- arch/arm/mach-mvebu/Kconfig | 12 configs/clearfog_defconfig | 3 --- configs/controlcenterdc_defconfig | 4 configs/db-88f6720_defconfig| 4 configs/db-88f6820-amc_defconfig| 4 configs/db-88f6820-gp_defconfig | 4 configs/db-mv784mp-gp_defconfig | 3 --- configs/ds414_defconfig | 3 --- configs/helios4_defconfig | 1 - configs/maxbcm_defconfig| 3 --- configs/theadorable_debug_defconfig | 3 --- configs/turris_omnia_defconfig | 4 configs/x530_defconfig | 4 include/configs/helios4.h | 5 - 14 files changed, 12 insertions(+), 45 deletions(-) diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index 161dee937f..645990b3ef 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig @@ -232,13 +232,25 @@ config SYS_SOC choice prompt "Boot method" + depends on SPL config MVEBU_SPL_BOOT_DEVICE_SPI bool "SPI NOR flash" + imply ENV_IS_IN_SPI_FLASH + select SPL_DM_SPI + select SPL_SPI_FLASH_SUPPORT + select SPL_SPI_LOAD + select SPL_SPI_SUPPORT config MVEBU_SPL_BOOT_DEVICE_MMC bool "SDIO/MMC card" + imply ENV_IS_IN_MMC + # GPIO needed for eMMC/SD card presence detection + select SPL_DM_GPIO + select SPL_DM_MMC + select SPL_GPIO_SUPPORT select SPL_LIBDISK_SUPPORT + select SPL_MMC_SUPPORT config MVEBU_SPL_BOOT_DEVICE_SATA bool "SATA" diff --git a/configs/clearfog_defconfig b/configs/clearfog_defconfig index 6db8b8acf6..ada35cb53b 100644 --- a/configs/clearfog_defconfig +++ b/configs/clearfog_defconfig @@ -3,14 +3,12 @@ CONFIG_ARCH_CPU_INIT=y CONFIG_SYS_THUMB_BUILD=y CONFIG_ARCH_MVEBU=y CONFIG_SYS_TEXT_BASE=0x0080 -CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_TARGET_CLEARFOG=y CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC=y CONFIG_DM_GPIO=y -CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_NR_DRAM_BANKS=2 CONFIG_SPL=y @@ -42,7 +40,6 @@ CONFIG_CMD_CACHE=y CONFIG_CMD_TIME=y # CONFIG_SPL_PARTITION_UUIDS is not set CONFIG_DEFAULT_DEVICE_TREE="armada-388-clearfog" -CONFIG_ENV_IS_IN_MMC=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SPL_OF_TRANSLATE=y CONFIG_AHCI_MVEBU=y diff --git a/configs/controlcenterdc_defconfig b/configs/controlcenterdc_defconfig index 51126cbdc3..524dbc2b39 100644 --- a/configs/controlcenterdc_defconfig +++ b/configs/controlcenterdc_defconfig @@ -14,8 +14,6 @@ CONFIG_NR_DRAM_BANKS=2 CONFIG_SPL=y CONFIG_DEBUG_UART_BASE=0xd0012000 CONFIG_DEBUG_UART_CLOCK=25000 -CONFIG_SPL_SPI_FLASH_SUPPORT=y -CONFIG_SPL_SPI_SUPPORT=y CONFIG_DEBUG_UART=y CONFIG_AHCI=y CONFIG_SPL_TEXT_BASE=0x4030 @@ -28,7 +26,6 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_LAST_STAGE_INIT=y CONFIG_SPL_BOARD_INIT=y CONFIG_SPL_SYS_MALLOC_SIMPLE=y -CONFIG_SPL_SPI_LOAD=y CONFIG_SYS_SPI_U_BOOT_OFFS=0x3 CONFIG_HUSH_PARSER=y # CONFIG_CMD_ELF is not set @@ -50,
Re: [PATCH 1/2] arm: mvebu: clearfog: add SCSI to distro bootcmd
On 2020-04-16 00:13, Stefan Roese wrote: On 16.04.20 06:09, Joel Johnson wrote: On 2020-03-23 04:20, Stefan Roese wrote: Added Josua to Cc. On 29.01.20 04:59, Joel Johnson wrote: Include attempting to boot from SCSI (SATA) devices within generated board distro bootcmd environment. The reasoning for boot ordering is that MMC and USB are external and removable, while when a case is in use, replacing M.2 or mSATA drives requires disassembly. Therefore, to boot SCSI, [bootable] external media must be removed. If SCSI were placed before MMC or USB, then removing a bootable SCSI drive to enable MMC or USB booting would be more difficult. Signed-off-by: Joel Johnson Josua posted a similar patch (different order though): http://patchwork.ozlabs.org/patch/1239539/ I tend to pull your patch though in the next merge window, if nobody objects. So: Reviewed-by: Stefan Roese Thanks, Stefan I just wanted to send a bump on this series. With the first pull request of the merge window you merged Josua's patch. I'd still advocate for my original reasoning on the boot order priority, but in either case the second patch in this series is unique and non-conflicting since it adds support for the additional SCSI buses depending on configuration. Josua - any objection to moving USB boot before SCSI in the priority order? I'll rebase the series on current master since it will conflict, but wanted to try to get consensus on the approach before doing so. Okay from me for this. Thanks, Stefan Looking again it looks like *both* were merged and resulted in some duplication, I just sent a related simple patch to correct. Joel
[PATCH] arm: mvebu: clearfog: adjust SCSI boot duplication
Fix duplication resulting from merging of multiple related series. Commits cecf38a75, bd02fd29f, and 201a500de added or adjusted SCSI boot support for ClearFog, but in slightly different locations which didn't result in a merge conflict. Signed-off-by: Joel Johnson --- include/configs/clearfog.h | 7 --- 1 file changed, 7 deletions(-) diff --git a/include/configs/clearfog.h b/include/configs/clearfog.h index 8314956db6..53ff830e81 100644 --- a/include/configs/clearfog.h +++ b/include/configs/clearfog.h @@ -104,12 +104,6 @@ #define BOOT_TARGET_DEVICES_MMC(func) #endif -#ifdef CONFIG_SCSI -#define BOOT_TARGET_DEVICES_SCSI(func) func(SCSI, scsi, 0) -#else -#define BOOT_TARGET_DEVICES_SCSI(func) -#endif - #ifdef CONFIG_USB_STORAGE #define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0) #else @@ -152,7 +146,6 @@ */ #define BOOT_TARGET_DEVICES(func) \ BOOT_TARGET_DEVICES_MMC(func) \ - BOOT_TARGET_DEVICES_SCSI(func) \ BOOT_TARGET_DEVICES_USB(func) \ BOOT_TARGET_DEVICES_SCSI_BUS0(func) \ BOOT_TARGET_DEVICES_SCSI_BUS1(func) \ -- 2.26.1
Re: [PATCH 0/4] Updates for ClearFog EEPROM
On 2020-04-16 06:38, Stefan Roese wrote: Hi Baruch, On 16.04.20 14:22, Baruch Siach wrote: Hi Stefan, On Wed, Apr 15 2020, Stefan Roese wrote: On 19.01.20 08:10, Joel Johnson wrote: This set of patches applies on top of https://patchwork.ozlabs.org/cover/1200324/, based on testing using the static configuration fallback updates in a related patch series. Joel Johnson (4): cmd: sys_eeprom: add missing implicit header cmd: sys_eeprom reflect I2C dependency in Kconfig arm: mvebu: clearfog: don't set SPL misc arm: mvebu: clearfog: fix compile w/o EEPROM board/solidrun/clearfog/clearfog.c | 26 +++--- cmd/Kconfig| 1 + cmd/sys_eeprom.c | 1 + configs/clearfog_defconfig | 1 - 4 files changed, 17 insertions(+), 12 deletions(-) Is it correct to assume, that this patchset is superseded by the Baruch's work? Can it be dropped? Which work are you referring to? The text quoted above specifically mentions dependency on my patch series adding auto detection based on EEPROM data. So as I understand these patches are still useful. Joel, correct me if I am wrong. If these are still useful, then please rebase and resubmit. I've dropped the patches in the meantime from patchwork as they didn't apply clean any more. Thanks, Stefan Dropping these are fine, it was indeed superseded. Baruch, you'd included a reworked version of these into a later version of your patchset. As I recall, there were issues at the time with disabling EEPROM support which this, and the eventual merged version of your series, resolved. Joel
Re: [PATCH v6 09/12] arm: mvebu: enable working default boot support
On 2020-04-14 03:33, Stefan Roese wrote: Hi Joel, On 23.03.20 21:21, Joel Johnson wrote: With the move to driver model usage, ensure that the required driver support for SPI and MMC booting is available in SPL. Tested on SolidRun ClearFog devices. Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- This patch generates multiple warnings on other MVEBU platforms. I've dropped it for now in my upcoming pull request. Please rework the problematic patches (missing in the pull request) and re-send. Thanks, Stefan Sure, I'm looking into the changes and will have a new series with the reworked patches in the next couple of days. The warnings really highlighted additional cleanup on mvebu booting and defaults in general which I'm taking a look at. I'm not too familiar with the multi-target building, but have read up on and am currently using the buildman tool with arm and aarch64 toolsets, and building the entire mvebu target set (21 boards currently). Is this the best way to do the testing and building across multiple boards or is there a different way you'd like the testing to be done in the end? Somewhat offtopic, what's the best location to which wiki issues should be reported? The page on Patches [1] still describes the old MAKEALL script. I hadn't found the script originally so skipped that step since it wasn't possible. This time, in digging further in source history I found the commit that removed it and referenced buildman. It would be useful for new contributors to update the wiki with a pointer to buildman if that's the desired replacement tool. Joel [1] https://www.denx.de/wiki/U-Boot/Patches
Re: [PATCH 1/2] arm: mvebu: clearfog: add SCSI to distro bootcmd
On 2020-03-23 04:20, Stefan Roese wrote: Added Josua to Cc. On 29.01.20 04:59, Joel Johnson wrote: Include attempting to boot from SCSI (SATA) devices within generated board distro bootcmd environment. The reasoning for boot ordering is that MMC and USB are external and removable, while when a case is in use, replacing M.2 or mSATA drives requires disassembly. Therefore, to boot SCSI, [bootable] external media must be removed. If SCSI were placed before MMC or USB, then removing a bootable SCSI drive to enable MMC or USB booting would be more difficult. Signed-off-by: Joel Johnson Josua posted a similar patch (different order though): http://patchwork.ozlabs.org/patch/1239539/ I tend to pull your patch though in the next merge window, if nobody objects. So: Reviewed-by: Stefan Roese Thanks, Stefan I just wanted to send a bump on this series. With the first pull request of the merge window you merged Josua's patch. I'd still advocate for my original reasoning on the boot order priority, but in either case the second patch in this series is unique and non-conflicting since it adds support for the additional SCSI buses depending on configuration. Josua - any objection to moving USB boot before SCSI in the priority order? I'll rebase the series on current master since it will conflict, but wanted to try to get consensus on the approach before doing so. Thanks! Joel
[PATCH v5 5/5] cmd: mvebu: bubt: show image boot device
When a mismatch is found trying to write an image for one boot method to a different boot device, print an error message including the image header marked target boot device type. Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v2 changes: - newly added in v2 series v3 changes: - none v4 changes: - adjust to ARRAY_SIZE usage v5 changes: - remove double space (one each line) in error message --- cmd/mvebu/bubt.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index b03924ca06..728633e60a 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -676,6 +676,17 @@ static int a38x_check_boot_mode(const struct bubt_dev *dst) if (a38x_boot_modes[mode].id == hdr->blockid) return 0; + for (int i = 0; i < ARRAY_SIZE(a38x_boot_modes); i++) { + if (a38x_boot_modes[i].id == hdr->blockid) { + printf("Error: image meant to be booted from" + " \"%s\", not \"%s\"!\n", + a38x_boot_modes[i].name, dst->name); + return -ENOEXEC; + } + } + + printf("Error: unknown boot device in image header: 0x%x\n", + hdr->blockid); return -ENOEXEC; } @@ -746,7 +757,6 @@ static int bubt_verify(const struct bubt_dev *dst) if (IS_ENABLED(CONFIG_ARMADA_38X)) { err = a38x_check_boot_mode(dst); if (err) { - puts("Error: image not built for destination device!\n"); return err; } } -- 2.25.0
[PATCH v5 1/5] cmd: mvebu: bubt: add A38x support
Add support for Armada 38x devices in bubt flashing utility. This is based on (and streamlined from) the support in the SolidRun master-a38x vendor fork. Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v2 changes - none v3 changes - none v4 changes - none v5 changes - none --- cmd/mvebu/bubt.c | 69 +++- 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index 2041a7a29a..d399fb6da4 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -85,7 +85,29 @@ struct mvebu_image_info { u32 encrypt_start_offset; u32 encrypt_size; }; -#endif /* CONFIG_ARMADA_XXX */ +#elif defined(CONFIG_ARMADA_38X) /* A38X */ + +/* Structure of the main header, version 1 (Armada 370/38x/XP) */ +struct a38x_main_hdr_v1 { + u8 blockid; /* 0x0 */ + u8 flags; /* 0x1 */ + u16 reserved2; /* 0x2-0x3 */ + u32 blocksize; /* 0x4-0x7 */ + u8 version; /* 0x8 */ + u8 headersz_msb; /* 0x9 */ + u16 headersz_lsb; /* 0xA-0xB */ + u32 srcaddr; /* 0xC-0xF */ + u32 destaddr; /* 0x10-0x13 */ + u32 execaddr; /* 0x14-0x17 */ + u8 options; /* 0x18 */ + u8 nandblocksize; /* 0x19 */ + u8 nandbadblklocation;/* 0x1A */ + u8 reserved4; /* 0x1B */ + u16 reserved5; /* 0x1C-0x1D */ + u8 ext; /* 0x1E */ + u8 checksum; /* 0x1F */ +}; +#endif struct bubt_dev { char name[8]; @@ -621,7 +643,52 @@ static int check_image_header(void) return 0; } +#elif defined(CONFIG_ARMADA_38X) +static size_t a38x_header_size(const struct a38x_main_hdr_v1 *h) +{ + if (h->version == 1) + return (h->headersz_msb << 16) | le16_to_cpu(h->headersz_lsb); + + printf("Error: Invalid A38x image (header version 0x%x unknown)!\n", + h->version); + return 0; +} + +static uint8_t image_checksum8(const void *start, size_t len) +{ + u8 csum = 0; + const u8 *p = start; + + while (len) { + csum += *p; + ++p; + --len; + } + + return csum; +} +static int check_image_header(void) +{ + u8 checksum; + const struct a38x_main_hdr_v1 *hdr = + (struct a38x_main_hdr_v1 *)get_load_addr(); + const size_t image_size = a38x_header_size(hdr); + + if (!image_size) + return -ENOEXEC; + + checksum = image_checksum8(hdr, image_size); + checksum -= hdr->checksum; + if (checksum != hdr->checksum) { + printf("Error: Bad A38x image checksum. 0x%x != 0x%x\n", + checksum, hdr->checksum); + return -ENOEXEC; + } + + printf("Image checksum...OK!\n"); + return 0; +} #else /* Not ARMADA? */ static int check_image_header(void) { -- 2.25.0
[PATCH v5 3/5] cmd: mvebu: bubt: verify A38x target device type
Ensure that the device to which an image is being written includes header information indicating boot support for the destination device. This is derived from the support in the SolidRun master-a38x vendor fork. Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v2 changes: - none v3 changes: - use ARRAY_SIZE instead of #define size v4 changes: - none v5 changes: - use if(IS_ENABLED()) for inline check instead of ifdef --- cmd/mvebu/bubt.c | 47 +-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index b80b81c82a..b03924ca06 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -107,6 +107,24 @@ struct a38x_main_hdr_v1 { u8 ext; /* 0x1E */ u8 checksum; /* 0x1F */ }; + +struct a38x_boot_mode { + unsigned int id; + const char *name; +}; + +/* The blockid header field values used to indicate boot device of image */ +struct a38x_boot_mode a38x_boot_modes[] = { + { 0x4D, "i2c" }, + { 0x5A, "spi" }, + { 0x69, "uart" }, + { 0x78, "sata" }, + { 0x8B, "nand" }, + { 0x9C, "pex" }, + { 0xAE, "mmc" }, + {}, +}; + #endif struct bubt_dev { @@ -644,6 +662,23 @@ static int check_image_header(void) return 0; } #elif defined(CONFIG_ARMADA_38X) +static int a38x_check_boot_mode(const struct bubt_dev *dst) +{ + int mode; + const struct a38x_main_hdr_v1 *hdr = + (struct a38x_main_hdr_v1 *)get_load_addr(); + + for (mode = 0; mode < ARRAY_SIZE(a38x_boot_modes); mode++) { + if (strcmp(a38x_boot_modes[mode].name, dst->name) == 0) + break; + } + + if (a38x_boot_modes[mode].id == hdr->blockid) + return 0; + + return -ENOEXEC; +} + static size_t a38x_header_size(const struct a38x_main_hdr_v1 *h) { if (h->version == 1) @@ -697,7 +732,7 @@ static int check_image_header(void) } #endif -static int bubt_verify(size_t image_size) +static int bubt_verify(const struct bubt_dev *dst) { int err; @@ -708,6 +743,14 @@ static int bubt_verify(size_t image_size) return err; } + if (IS_ENABLED(CONFIG_ARMADA_38X)) { + err = a38x_check_boot_mode(dst); + if (err) { + puts("Error: image not built for destination device!\n"); + return err; + } + } + return 0; } @@ -829,7 +872,7 @@ int do_bubt_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (!image_size) return -EIO; - err = bubt_verify(image_size); + err = bubt_verify(dst); if (err) return err; -- 2.25.0
[PATCH v5 4/5] arm: mvebu: clearfog: enable bubt command
With support added for Armada 38x, include the bubt command in ClearFog defconfig. Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v2 changes: - none v3 changes: - none v4 changes: - none v5 changes: - none --- configs/clearfog_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/clearfog_defconfig b/configs/clearfog_defconfig index c938448c30..0d7e19e731 100644 --- a/configs/clearfog_defconfig +++ b/configs/clearfog_defconfig @@ -35,6 +35,7 @@ CONFIG_SPL_CMD_TLV_EEPROM=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y +CONFIG_CMD_MVEBU_BUBT=y CONFIG_CMD_PCI=y CONFIG_CMD_SPI=y CONFIG_CMD_USB=y -- 2.25.0
[PATCH v5 2/5] cmd: mvebu: bubt: correct U-Boot spelling
Replace "U-BOOT" text with correct spelling Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v2 changes: - none v3 changes: - none v4 changes: - none v5 changes: - none --- cmd/mvebu/bubt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index d399fb6da4..b80b81c82a 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -346,7 +346,7 @@ static int nand_burn_image(size_t image_size) /* Align U-Boot size to currently used blocksize */ image_size = ((image_size + (block_size - 1)) & (~(block_size - 1))); - /* Erase the U-BOOT image space */ + /* Erase the U-Boot image space */ printf("Erasing 0x%x - 0x%x:...", 0, (int)image_size); ret = nand_erase(mtd, 0, image_size); if (ret) { @@ -734,7 +734,7 @@ static int bubt_read_file(struct bubt_dev *src) static int bubt_is_dev_active(struct bubt_dev *dev) { if (!dev->active) { - printf("Device \"%s\" not supported by U-BOOT image\n", + printf("Device \"%s\" not supported by U-Boot image\n", dev->name); return 0; } @@ -822,7 +822,7 @@ int do_bubt_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (!bubt_is_dev_active(src)) return -ENODEV; - printf("Burning U-BOOT image \"%s\" from \"%s\" to \"%s\"\n", + printf("Burning U-Boot image \"%s\" from \"%s\" to \"%s\"\n", net_boot_file_name, src->name, dst->name); image_size = bubt_read_file(src); -- 2.25.0
Re: [PATCH v3 5/5] cmd: mvebu: bubt: show image boot device
On 2020-03-24 01:28, Stefan Roese wrote: On 23.03.20 18:43, Joel Johnson wrote: When a mismatch is found trying to write an image for one boot method to a different boot device, print an error message including the image header marked target boot device type. Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v2 changes: - newly added in v2 series v3 changes: - none --- cmd/mvebu/bubt.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index fbcad37c40..f992507041 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -676,6 +676,17 @@ static int a38x_check_boot_mode(const struct bubt_dev *dst) if (a38x_boot_modes[mode].id == hdr->blockid) return 0; + for (int i = 0; i < A38X_BOOT_MODE_MAX; i++) { This will fail, as A38X_BOOT_MODE_MAX is not defined any more. Please use ARRAY_SIZE() here as well. Thanks, Stefan Yeah, I caught that but missed committing it for this series - I'd sent out a v4 with this fixed. A v5 with your other ifdef change will include it. Joel
[PATCH v6 12/12] arm: mvebu: clearfog: Use Pro DT by default
Switch to explicitly using the Pro variant DT, which has been available since Linux 4.11. Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v4 changes: - new v5 changes: - none v6 changes: - none I separated out this change to the end of the series since it drew questioning on prior review. I'd still advocate for making the change, since especially with the additions of static variants and runtime detection, it becomes easier from within a booted kernel to identify the type and version of U-Boot image installed. Without making this change, it becomes less direct to determine an actual Pro vs. Base, vs old U-Boot image maybe supporting some hybrid variant configuration. Even in the Linux kernel adding of the Pro DTS, it is indicated that it was meant for backwards compatibility. Except for cases where checking is done directly against the product name from userspace, I don't see downsides even from a compatibility perspective for not making this change. In cases where checking *is* done from userspace, the broadening of the Clearfog product line would seem to mean that userspace checking should be flagged as needing to be udpated as well (or glob/regex matched as needed). --- board/solidrun/clearfog/clearfog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c index 249ea46eb7..443751ba8f 100644 --- a/board/solidrun/clearfog/clearfog.c +++ b/board/solidrun/clearfog/clearfog.c @@ -246,7 +246,7 @@ int board_late_init(void) else if (IS_ENABLED(CONFIG_TARGET_CLEARFOG_BASE)) env_set("fdtfile", "armada-388-clearfog-base.dtb"); else - env_set("fdtfile", "armada-388-clearfog.dtb"); + env_set("fdtfile", "armada-388-clearfog-pro.dtb"); return 0; } -- 2.25.0
[PATCH v6 11/12] arm: mvebu: clearfog: don't always use SPL MMC
Move MMC booting assuptions from defconfig to Kconfig which includes as needed based on dependent options. Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v2 changes: - rebased on master to use Baruch's dynamic MMC/SD offset logic - update description, will revisit removal of CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC in separate future path if a more viable option is identified v3 changes: - none v4 changes: - none v5 changes: - none v6 changes: - none --- arch/arm/mach-mvebu/Kconfig | 1 + configs/clearfog_defconfig | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index 32191e7157..4b381a2936 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig @@ -249,6 +249,7 @@ config MVEBU_SPL_BOOT_DEVICE_MMC select SPL_DM_GPIO select SPL_DM_MMC select SPL_LIBDISK_SUPPORT + select SPL_MMC_SUPPORT config MVEBU_SPL_BOOT_DEVICE_SATA bool "SATA" diff --git a/configs/clearfog_defconfig b/configs/clearfog_defconfig index 6db8b8acf6..601b1997ed 100644 --- a/configs/clearfog_defconfig +++ b/configs/clearfog_defconfig @@ -10,7 +10,6 @@ CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_TARGET_CLEARFOG=y CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC=y CONFIG_DM_GPIO=y -CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_NR_DRAM_BANKS=2 CONFIG_SPL=y @@ -42,7 +41,6 @@ CONFIG_CMD_CACHE=y CONFIG_CMD_TIME=y # CONFIG_SPL_PARTITION_UUIDS is not set CONFIG_DEFAULT_DEVICE_TREE="armada-388-clearfog" -CONFIG_ENV_IS_IN_MMC=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SPL_OF_TRANSLATE=y CONFIG_AHCI_MVEBU=y -- 2.25.0
[PATCH v6 10/12] arm: mvebu: clearfog: move ENV params to Kconfig
Migrate the values for ENV_SIZE and ENV_OFFSET into board specific Kconfig defaults so they're more accessible for configuration. Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v2 changes: - none v3 changes: - none v4 changes: - none v5 changes: - none v6 changes: - none --- board/solidrun/clearfog/Kconfig | 8 configs/clearfog_defconfig | 2 -- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/board/solidrun/clearfog/Kconfig b/board/solidrun/clearfog/Kconfig index ea9c419472..e8c3f53d84 100644 --- a/board/solidrun/clearfog/Kconfig +++ b/board/solidrun/clearfog/Kconfig @@ -39,6 +39,14 @@ config CLEARFOG_SFP_25GB SGMII connection (requires a supporting SFP). By default, transfer speed of 1.25 Gbps is used, suitable for a more common 1 Gbps SFP module. +config ENV_SIZE + hex "Environment Size" + default 0x1 + +config ENV_OFFSET + hex "Environment offset" + default 0xF + config ENV_SECT_SIZE hex "Environment Sector-Size" # Use SPI flash erase block size of 4 KiB diff --git a/configs/clearfog_defconfig b/configs/clearfog_defconfig index c938448c30..6db8b8acf6 100644 --- a/configs/clearfog_defconfig +++ b/configs/clearfog_defconfig @@ -9,8 +9,6 @@ CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_TARGET_CLEARFOG=y CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC=y -CONFIG_ENV_SIZE=0x1 -CONFIG_ENV_OFFSET=0xF CONFIG_DM_GPIO=y CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y -- 2.25.0
[PATCH v6 03/12] arm: mvebu: clearfog: use Pro name by default
Make the board version printed indicate the Pro variant default. Also adjust static name casing to match what is expected for EEPROM product name to share string constants. Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v4 changes: - newly added v5 changes: - none v6 changes: - none --- board/solidrun/clearfog/clearfog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c index e268ef55a2..9b31902c70 100644 --- a/board/solidrun/clearfog/clearfog.c +++ b/board/solidrun/clearfog/clearfog.c @@ -170,7 +170,7 @@ int board_init(void) int checkboard(void) { - char *board = "ClearFog"; + char *board = "Clearfog Pro"; cf_read_tlv_data(); if (strlen(cf_tlv_data.tlv_product_name[0]) > 0) -- 2.25.0
[PATCH v6 07/12] arm: mvebu: clearfog: Unify DT selection paths
Unify the location of DT selection into board_late_init instead of split between detection and static configuration paths. Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v2 changes - newly added in V2 series based on run-time rebasing v3 changes - none v4 changes - separate change to explicit pro DT into separate commit v5 changes - none v6 changes - none --- board/solidrun/clearfog/clearfog.c | 2 ++ include/configs/clearfog.h | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c index fd9bd95a15..249ea46eb7 100644 --- a/board/solidrun/clearfog/clearfog.c +++ b/board/solidrun/clearfog/clearfog.c @@ -245,6 +245,8 @@ int board_late_init(void) env_set("fdtfile", "armada-385-clearfog-gtr-l8.dtb"); else if (IS_ENABLED(CONFIG_TARGET_CLEARFOG_BASE)) env_set("fdtfile", "armada-388-clearfog-base.dtb"); + else + env_set("fdtfile", "armada-388-clearfog.dtb"); return 0; } diff --git a/include/configs/clearfog.h b/include/configs/clearfog.h index 633187d86f..6ca0474461 100644 --- a/include/configs/clearfog.h +++ b/include/configs/clearfog.h @@ -134,7 +134,6 @@ #define CONFIG_EXTRA_ENV_SETTINGS \ RELOCATION_LIMITS_ENV_SETTINGS \ LOAD_ADDRESS_ENV_SETTINGS \ - "fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \ "console=ttyS0,115200\0" \ BOOTENV -- 2.25.0
[PATCH v6 08/12] arm: mvebu: clearfog: add SPI offsets
Add reasonable default SPI offsets and ENV size when configured to boot from SPI flash. Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v2 changes: - none v3 changes: - none v4 changes: - none v5 changes: - none v6 changes: - none There was some reasonable concern raised about duplicating config entries within a board specific config file rather than making board specific configurations within defconfig. This seems to offer a more board localized mechanism to provide platform defaults for core values. As mentioned in the review, this usage seems to match the Kconfig documented intended usage. As noted at https://www.kernel.org/doc/html/latest/kbuild/kconfig-language.html: "Default values are not limited to the menu entry where they are defined. This means the default can be defined somewhere else or be overridden by an earlier definition." Given that there is some dependency variability with these values I prefer keeping them as Kconfig values, but defer to maintainers. Notably, for the ENV values in this and a later commit, I'm using a pattern already in used several other board configs. --- board/solidrun/clearfog/Kconfig | 12 1 file changed, 12 insertions(+) diff --git a/board/solidrun/clearfog/Kconfig b/board/solidrun/clearfog/Kconfig index 44224d903d..ea9c419472 100644 --- a/board/solidrun/clearfog/Kconfig +++ b/board/solidrun/clearfog/Kconfig @@ -39,4 +39,16 @@ config CLEARFOG_SFP_25GB SGMII connection (requires a supporting SFP). By default, transfer speed of 1.25 Gbps is used, suitable for a more common 1 Gbps SFP module. +config ENV_SECT_SIZE + hex "Environment Sector-Size" + # Use SPI flash erase block size of 4 KiB + default 0x1000 if MVEBU_SPL_BOOT_DEVICE_SPI + # Use optimistic 64 KiB erase block, will vary between actual media + default 0x1 if MVEBU_SPL_BOOT_DEVICE_MMC + +config SYS_SPI_U_BOOT_OFFS + hex "address of u-boot payload in SPI flash" + default 0x2 + depends on MVEBU_SPL_BOOT_DEVICE_SPI + endmenu -- 2.25.0
[PATCH v6 06/12] arm: mvebu: clearfog: Add SATA mode flags
The mPCIe slots on ClearFog Pro and ClearFog Base may be alternately configured for SATA usage. Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v2 changes: - fixed help indentation v3 changes: - none v4 changes: - adjust static SerDes configuration at runtime instead of #ifdef - add setting of swap_rx for SATA (as yet untested on hardware) v5 changes: - make independent of runtime detection v6 change: - remove code side double check of config consistency --- board/solidrun/clearfog/Kconfig| 17 + board/solidrun/clearfog/clearfog.c | 14 ++ 2 files changed, 31 insertions(+) diff --git a/board/solidrun/clearfog/Kconfig b/board/solidrun/clearfog/Kconfig index c910e17093..44224d903d 100644 --- a/board/solidrun/clearfog/Kconfig +++ b/board/solidrun/clearfog/Kconfig @@ -15,6 +15,23 @@ config TARGET_CLEARFOG_BASE detection via additional EEPROM hardware. This option enables selecting the Base variant for older hardware revisions. +config CLEARFOG_CON3_SATA + bool "Use CON3 slot in SATA mode" + help + Use the CON3 port with SATA protocol instead of the default PCIe. + The ClearFog port allows usage of either mSATA or miniPCIe + modules, but the desired protocol must be configured at build + time since it affects the SerDes topology layout. + +config CLEARFOG_CON2_SATA + bool "Use CON2 slot in SATA mode" + depends on !TARGET_CLEARFOG_BASE + help + Use the CON2 port with SATA protocol instead of the default PCIe. + The ClearFog port allows usage of either mSATA or miniPCIe + modules, but the desired protocol must be configured at build + time since it affects the SerDes topology layout. + config CLEARFOG_SFP_25GB bool "Enable 2.5 Gbps mode for SFP" help diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c index 8f3e5dc6a3..fd9bd95a15 100644 --- a/board/solidrun/clearfog/clearfog.c +++ b/board/solidrun/clearfog/clearfog.c @@ -67,6 +67,20 @@ int hws_board_topology_load(struct serdes_map **serdes_map_array, u8 *count) if (IS_ENABLED(CONFIG_CLEARFOG_SFP_25GB)) board_serdes_map[5].serdes_speed = SERDES_SPEED_3_125_GBPS; + if (IS_ENABLED(CONFIG_CLEARFOG_CON2_SATA)) { + board_serdes_map[4].serdes_type = SATA2; + board_serdes_map[4].serdes_speed = SERDES_SPEED_3_GBPS; + board_serdes_map[4].serdes_mode = SERDES_DEFAULT_MODE; + board_serdes_map[4].swap_rx = 1; + } + + if (IS_ENABLED(CONFIG_CLEARFOG_CON3_SATA)) { + board_serdes_map[2].serdes_type = SATA1; + board_serdes_map[2].serdes_speed = SERDES_SPEED_3_GBPS; + board_serdes_map[2].serdes_mode = SERDES_DEFAULT_MODE; + board_serdes_map[2].swap_rx = 1; + } + /* Apply runtime detection changes */ if (sr_product_is(_tlv_data, "Clearfog GTR")) { board_serdes_map[0].serdes_type = PEX0; -- 2.25.0
[PATCH v6 09/12] arm: mvebu: enable working default boot support
With the move to driver model usage, ensure that the required driver support for SPI and MMC booting is available in SPL. Tested on SolidRun ClearFog devices. Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v2 changes: - change "select" for ENV_IS_IN_X to "imply" to allow disabling the default env location and configuring a different one if desired - remove SPL_DM_GPIO from defconfig, only include if needed for MMC booting v3 changes: - none v4 changes: - none v5 changes: - none v6 changes: - none --- arch/arm/mach-mvebu/Kconfig | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index 161dee937f..32191e7157 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig @@ -235,9 +235,19 @@ choice config MVEBU_SPL_BOOT_DEVICE_SPI bool "SPI NOR flash" + imply ENV_IS_IN_SPI_FLASH + select SPL_DM_SPI + select SPL_MTD_SUPPORT + select SPL_SPI_FLASH_SUPPORT + select SPL_SPI_LOAD + select SPL_SPI_SUPPORT config MVEBU_SPL_BOOT_DEVICE_MMC bool "SDIO/MMC card" + imply ENV_IS_IN_MMC + # GPIO required for SD card presence detection line + select SPL_DM_GPIO + select SPL_DM_MMC select SPL_LIBDISK_SUPPORT config MVEBU_SPL_BOOT_DEVICE_SATA -- 2.25.0
[PATCH v6 02/12] arm: mvebu: solidrun: remove hardcoded DTS MAC address
Using a consistent hardcoded MAC address from the DTS file causes issues when using multiple devices on the same network segment. Instead rely on environment configuration or random generation. Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v2 changes: - none v3 changes: - none v4 changes: - none v5 changes: - none v6 changes: - none --- arch/arm/dts/armada-38x-solidrun-microsom.dtsi | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm/dts/armada-38x-solidrun-microsom.dtsi b/arch/arm/dts/armada-38x-solidrun-microsom.dtsi index a322a28c21..9bbeafc53b 100644 --- a/arch/arm/dts/armada-38x-solidrun-microsom.dtsi +++ b/arch/arm/dts/armada-38x-solidrun-microsom.dtsi @@ -39,7 +39,6 @@ { /* ethernet@7 */ - mac-address = [00 50 43 02 02 01]; pinctrl-0 = <_rgmii_pins>; pinctrl-names = "default"; phy = <_dedicated>; -- 2.25.0
[PATCH v6 05/12] arm: mvebu: clearfog: Add option for 2.5 Gbps SFP
While newer Linux kernels provide autoconfiguration of SFP, provide an option for setting in U-Boot Kconfig for use prior to booting. Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v2 changes: - fixed help indentation v3 changes: - none v4 changes: - adjust static SerDes configuration at runtime instead of #ifdef v5 changes: - make independent of runtime detection v6 changes: - none --- board/solidrun/clearfog/Kconfig| 7 +++ board/solidrun/clearfog/clearfog.c | 5 + 2 files changed, 12 insertions(+) diff --git a/board/solidrun/clearfog/Kconfig b/board/solidrun/clearfog/Kconfig index 936d5918f8..c910e17093 100644 --- a/board/solidrun/clearfog/Kconfig +++ b/board/solidrun/clearfog/Kconfig @@ -15,4 +15,11 @@ config TARGET_CLEARFOG_BASE detection via additional EEPROM hardware. This option enables selecting the Base variant for older hardware revisions. +config CLEARFOG_SFP_25GB + bool "Enable 2.5 Gbps mode for SFP" + help + Set the SFP module connection to support 2.5 Gbps transfer speed for the + SGMII connection (requires a supporting SFP). By default, transfer speed + of 1.25 Gbps is used, suitable for a more common 1 Gbps SFP module. + endmenu diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c index 11d3a7f877..8f3e5dc6a3 100644 --- a/board/solidrun/clearfog/clearfog.c +++ b/board/solidrun/clearfog/clearfog.c @@ -63,6 +63,11 @@ int hws_board_topology_load(struct serdes_map **serdes_map_array, u8 *count) { cf_read_tlv_data(); + /* Apply build configuration options before runtime configuration */ + if (IS_ENABLED(CONFIG_CLEARFOG_SFP_25GB)) + board_serdes_map[5].serdes_speed = SERDES_SPEED_3_125_GBPS; + + /* Apply runtime detection changes */ if (sr_product_is(_tlv_data, "Clearfog GTR")) { board_serdes_map[0].serdes_type = PEX0; board_serdes_map[0].serdes_speed = SERDES_SPEED_5_GBPS; -- 2.25.0
[PATCH v6 04/12] arm: mvebu: clearfog: initial ClearFog Base variant
Add a unique entry for ClearFog Base variant, reflected in the board name and adjusted SerDes topology. Signed-off-by: Joel Johnson --- v2 changes: - reworked based on Baruch's run-time TLV EEPROM detection series v3 changes: - rebased on mvebu merged run-time TLV EEPROM detection series - minor update to help test regarding runtime detection failures v4 changes: - use runtime static config adjust instead of #ifdef in cases where hardware EEPROM detection fails or is disabled in build SPL size change for defconfig increases 36 bytes (122893 to 122929) SPL size change for defconfig+Base increases 60 bytes (122893 to 122953) - add placeholder support for EEPROM based Clearfog Pro, based on initial name confirmation from Baruch. I wanted to include the check at least in the patch for review to indicate expected usage to ensure that a Clearfog Pro EEPROM device boots correctly even if the image is built with Base static configuration. If there are other prerelease concerns and this should be added separately later, I'd be fine with that too. - Note that this approach *does not* currently provide any mechanism for EEPROM detected boards to have their SFP speed changed or switch between PCIE/SATA signalling. I'm assuming that will be done based on hardware detection, but confirmation/acceptance in review would be appreciated so it can be revisited if needed. v5 changes: - only make Base variant adjustment based on runtime configuration v6 changes: - print console message when falling back to static default; this would be nice to issue separate messages for the cause (no EEPROM detected, not compiled in, no matching product name) but that is better done as a separate changeset --- arch/arm/mach-mvebu/Kconfig| 2 ++ board/solidrun/clearfog/Kconfig| 18 ++ board/solidrun/clearfog/clearfog.c | 38 +- 3 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 board/solidrun/clearfog/Kconfig diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index bc5eaa5a76..161dee937f 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig @@ -280,4 +280,6 @@ config SECURED_MODE_CSK_INDEX default 0 depends on SECURED_MODE_IMAGE +source "board/solidrun/clearfog/Kconfig" + endif diff --git a/board/solidrun/clearfog/Kconfig b/board/solidrun/clearfog/Kconfig new file mode 100644 index 00..936d5918f8 --- /dev/null +++ b/board/solidrun/clearfog/Kconfig @@ -0,0 +1,18 @@ +menu "ClearFog configuration" + depends on TARGET_CLEARFOG + +config TARGET_CLEARFOG_BASE + bool "Use ClearFog Base static configuration" + help + Use the ClearFog Base as the static configuration instead of the + default which uses the ClearFog Pro. + + Runtime board detection is always attempted and used if available. The + static configuration is used as a fallback in cases where runtime + detection is disabled, is not available in hardware, or otherwise fails. + + Only newer revisions of the ClearFog product line support runtime + detection via additional EEPROM hardware. This option enables selecting + the Base variant for older hardware revisions. + +endmenu diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c index 9b31902c70..11d3a7f877 100644 --- a/board/solidrun/clearfog/clearfog.c +++ b/board/solidrun/clearfog/clearfog.c @@ -42,6 +42,7 @@ static void cf_read_tlv_data(void) read_tlv_data(_tlv_data); } +/* The starting board_serdes_map reflects original Clearfog Pro usage */ static struct serdes_map board_serdes_map[] = { {SATA0, SERDES_SPEED_3_GBPS, SERDES_DEFAULT_MODE, 0, 0}, {SGMII1, SERDES_SPEED_1_25_GBPS, SERDES_DEFAULT_MODE, 0, 0}, @@ -51,6 +52,13 @@ static struct serdes_map board_serdes_map[] = { {SGMII2, SERDES_SPEED_1_25_GBPS, SERDES_DEFAULT_MODE, 0, 0}, }; +void config_cfbase_serdes_map(void) +{ + board_serdes_map[4].serdes_type = USB3_HOST0; + board_serdes_map[4].serdes_speed = SERDES_SPEED_5_GBPS; + board_serdes_map[4].serdes_mode = SERDES_DEFAULT_MODE; +} + int hws_board_topology_load(struct serdes_map **serdes_map_array, u8 *count) { cf_read_tlv_data(); @@ -59,12 +67,26 @@ int hws_board_topology_load(struct serdes_map **serdes_map_array, u8 *count) board_serdes_map[0].serdes_type = PEX0; board_serdes_map[0].serdes_speed = SERDES_SPEED_5_GBPS; board_serdes_map[0].serdes_mode = PEX_ROOT_COMPLEX_X1; - } - - if (sr_product_is(_tlv_data, "Clearfog Base")) { - board_serdes_map[4].serdes_type = USB3_HOST0; - board_serdes_map[4].serdes_speed = SERDES_SPEED_5_GBPS; - board_serdes_map[4].serdes_mode = SERDES_DEFAULT_MODE; +
[PATCH v6 00/12] ClearFog Base static variant support
This patch series adds support for ClearFog Base static configuration, as well as updating and fixing the ClearFog support for MMC and SPI booting. v2 changes: - updated against, and dependent on, https://patchwork.ozlabs.org/cover/1200324 v3 changes: - rebased against ClearFog runtime TLV EEPROM changes merged into mvebu/master v4 - adjust static SerDes configuration at runtime instead of #ifdef v5 - distinguish build-only config changes (SFP and PCIe/SATA) from runtime detectable config changes - retested SATA mode in PCIe slot with swap rx changes, confirmed working as presently patched. Only tested with ClearFog Base which only provides single channel, but Pro mechanism is parallel. v6 - address minor review feedback Joel Johnson (12): arm: mvebu: fix SerDes table alignment arm: mvebu: solidrun: remove hardcoded DTS MAC address arm: mvebu: clearfog: use Pro name by default arm: mvebu: clearfog: initial ClearFog Base variant arm: mvebu: clearfog: Add option for 2.5 Gbps SFP arm: mvebu: clearfog: Add SATA mode flags arm: mvebu: clearfog: Unify DT selection paths arm: mvebu: clearfog: add SPI offsets arm: mvebu: enable working default boot support arm: mvebu: clearfog: move ENV params to Kconfig arm: mvebu: clearfog: don't always use SPL MMC arm: mvebu: clearfog: Use Pro DT by default .../arm/dts/armada-38x-solidrun-microsom.dtsi | 1 - arch/arm/mach-mvebu/Kconfig | 13 .../serdes/a38x/high_speed_env_spec.c | 6 +- board/solidrun/clearfog/Kconfig | 62 +++ board/solidrun/clearfog/clearfog.c| 61 +++--- configs/clearfog_defconfig| 4 -- include/configs/clearfog.h| 1 - 7 files changed, 132 insertions(+), 16 deletions(-) create mode 100644 board/solidrun/clearfog/Kconfig -- 2.25.0
[PATCH v6 01/12] arm: mvebu: fix SerDes table alignment
Tested on Solidrun ClearFog Base. Table alignment was: | Lane # | Speed | Type | | 0| 3 | SATA0 | | 1| 0 | SGMII1 | | 2| 3 | SATA1 | | 3| 5 | USB3 HOST1 | | 4| 5 | USB3 HOST0 | | 5| 4 | SGMII2 | After the change, it's correctly aligned as: | Lane # | Speed | Type | | 0| 3 | SATA0 | | 1| 0 | SGMII1 | | 2| 5 | PCIe1 | | 3| 5 | USB3 HOST1 | | 4| 5 | PCIe2 | | 5| 0 | SGMII2 | Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v2 changes - none v3 changes - none v4 changes - none v5 changes - none v6 changes - none --- arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c b/arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c index 33e70569bc..66409a50c0 100644 --- a/arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c +++ b/arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c @@ -1366,16 +1366,16 @@ static void print_topology_details(const struct serdes_map *serdes_map, DEBUG_INIT_S("board SerDes lanes topology details:\n"); - DEBUG_INIT_S(" | Lane # | Speed | Type |\n"); + DEBUG_INIT_S(" | Lane # | Speed | Type |\n"); DEBUG_INIT_S(" \n"); for (lane_num = 0; lane_num < count; lane_num++) { if (serdes_map[lane_num].serdes_type == DEFAULT_SERDES) continue; DEBUG_INIT_S(" | "); DEBUG_INIT_D(hws_get_physical_serdes_num(lane_num), 1); - DEBUG_INIT_S("| "); + DEBUG_INIT_S("| "); DEBUG_INIT_D(serdes_map[lane_num].serdes_speed, 2); - DEBUG_INIT_S(" | "); + DEBUG_INIT_S(" | "); DEBUG_INIT_S((char *) serdes_type_to_string[serdes_map[lane_num]. serdes_type]); -- 2.25.0
Re: [PATCH v3 5/5] cmd: mvebu: bubt: show image boot device
On 2020-03-23 11:43, Joel Johnson wrote: When a mismatch is found trying to write an image for one boot method to a different boot device, print an error message including the image header marked target boot device type. Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v2 changes: - newly added in v2 series v3 changes: - none --- cmd/mvebu/bubt.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index fbcad37c40..f992507041 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -676,6 +676,17 @@ static int a38x_check_boot_mode(const struct bubt_dev *dst) if (a38x_boot_modes[mode].id == hdr->blockid) return 0; + for (int i = 0; i < A38X_BOOT_MODE_MAX; i++) { + if (a38x_boot_modes[i].id == hdr->blockid) { + printf("Error: image meant to be booted from " + " \"%s\", not \"%s\"!\n", + a38x_boot_modes[i].name, dst->name); + return -ENOEXEC; + } + } + + printf("Error: unknown boot device in image header: 0x%x\n", + hdr->blockid); return -ENOEXEC; } @@ -745,10 +756,8 @@ static int bubt_verify(const struct bubt_dev *dst) #if defined(CONFIG_ARMADA_38X) err = a38x_check_boot_mode(dst); - if (err) { - puts("Error: image not built for destination device!\n"); + if (err) return err; - } #endif return 0; I sent this one prematurely before complete build testing, I'll followup with further testing with a change to use ARRAY_SIZE here as well. Joel
[PATCH v3 5/5] cmd: mvebu: bubt: show image boot device
When a mismatch is found trying to write an image for one boot method to a different boot device, print an error message including the image header marked target boot device type. Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v2 changes: - newly added in v2 series v3 changes: - none --- cmd/mvebu/bubt.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index fbcad37c40..f992507041 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -676,6 +676,17 @@ static int a38x_check_boot_mode(const struct bubt_dev *dst) if (a38x_boot_modes[mode].id == hdr->blockid) return 0; + for (int i = 0; i < A38X_BOOT_MODE_MAX; i++) { + if (a38x_boot_modes[i].id == hdr->blockid) { + printf("Error: image meant to be booted from " + " \"%s\", not \"%s\"!\n", + a38x_boot_modes[i].name, dst->name); + return -ENOEXEC; + } + } + + printf("Error: unknown boot device in image header: 0x%x\n", + hdr->blockid); return -ENOEXEC; } @@ -745,10 +756,8 @@ static int bubt_verify(const struct bubt_dev *dst) #if defined(CONFIG_ARMADA_38X) err = a38x_check_boot_mode(dst); - if (err) { - puts("Error: image not built for destination device!\n"); + if (err) return err; - } #endif return 0; -- 2.25.0
[PATCH v3 1/5] cmd: mvebu: bubt: add A38x support
Add support for Armada 38x devices in bubt flashing utility. This is based on (and streamlined from) the support in the SolidRun master-a38x vendor fork branch. Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v2 changes - none v3 changes - none --- cmd/mvebu/bubt.c | 69 +++- 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index 2041a7a29a..d399fb6da4 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -85,7 +85,29 @@ struct mvebu_image_info { u32 encrypt_start_offset; u32 encrypt_size; }; -#endif /* CONFIG_ARMADA_XXX */ +#elif defined(CONFIG_ARMADA_38X) /* A38X */ + +/* Structure of the main header, version 1 (Armada 370/38x/XP) */ +struct a38x_main_hdr_v1 { + u8 blockid; /* 0x0 */ + u8 flags; /* 0x1 */ + u16 reserved2; /* 0x2-0x3 */ + u32 blocksize; /* 0x4-0x7 */ + u8 version; /* 0x8 */ + u8 headersz_msb; /* 0x9 */ + u16 headersz_lsb; /* 0xA-0xB */ + u32 srcaddr; /* 0xC-0xF */ + u32 destaddr; /* 0x10-0x13 */ + u32 execaddr; /* 0x14-0x17 */ + u8 options; /* 0x18 */ + u8 nandblocksize; /* 0x19 */ + u8 nandbadblklocation;/* 0x1A */ + u8 reserved4; /* 0x1B */ + u16 reserved5; /* 0x1C-0x1D */ + u8 ext; /* 0x1E */ + u8 checksum; /* 0x1F */ +}; +#endif struct bubt_dev { char name[8]; @@ -621,7 +643,52 @@ static int check_image_header(void) return 0; } +#elif defined(CONFIG_ARMADA_38X) +static size_t a38x_header_size(const struct a38x_main_hdr_v1 *h) +{ + if (h->version == 1) + return (h->headersz_msb << 16) | le16_to_cpu(h->headersz_lsb); + + printf("Error: Invalid A38x image (header version 0x%x unknown)!\n", + h->version); + return 0; +} + +static uint8_t image_checksum8(const void *start, size_t len) +{ + u8 csum = 0; + const u8 *p = start; + + while (len) { + csum += *p; + ++p; + --len; + } + + return csum; +} +static int check_image_header(void) +{ + u8 checksum; + const struct a38x_main_hdr_v1 *hdr = + (struct a38x_main_hdr_v1 *)get_load_addr(); + const size_t image_size = a38x_header_size(hdr); + + if (!image_size) + return -ENOEXEC; + + checksum = image_checksum8(hdr, image_size); + checksum -= hdr->checksum; + if (checksum != hdr->checksum) { + printf("Error: Bad A38x image checksum. 0x%x != 0x%x\n", + checksum, hdr->checksum); + return -ENOEXEC; + } + + printf("Image checksum...OK!\n"); + return 0; +} #else /* Not ARMADA? */ static int check_image_header(void) { -- 2.25.0
[PATCH v3 4/5] arm: mvebu: clearfog: enable bubt command
With support added for Armada 38x, include the bubt command in ClearFog defconfig. Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v2 changes: - none v3 changes: - none --- configs/clearfog_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/clearfog_defconfig b/configs/clearfog_defconfig index c938448c30..0d7e19e731 100644 --- a/configs/clearfog_defconfig +++ b/configs/clearfog_defconfig @@ -35,6 +35,7 @@ CONFIG_SPL_CMD_TLV_EEPROM=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y +CONFIG_CMD_MVEBU_BUBT=y CONFIG_CMD_PCI=y CONFIG_CMD_SPI=y CONFIG_CMD_USB=y -- 2.25.0
[PATCH v3 3/5] cmd: mvebu: bubt: verify A38x target device type
Ensure that the device to which an image is being written includes header information indicating boot support for the destination device. This is derived from the support in the SolidRun master-a38x vendor fork. Signed-off-by: Joel Johnson --- v2 changes: - none v3 changes: - use ARRAY_SIZE instead of #define size --- cmd/mvebu/bubt.c | 47 +-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index b80b81c82a..fbcad37c40 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -107,6 +107,24 @@ struct a38x_main_hdr_v1 { u8 ext; /* 0x1E */ u8 checksum; /* 0x1F */ }; + +struct a38x_boot_mode { + unsigned int id; + const char *name; +}; + +/* The blockid header field values used to indicate boot device of image */ +struct a38x_boot_mode a38x_boot_modes[] = { + { 0x4D, "i2c" }, + { 0x5A, "spi" }, + { 0x69, "uart" }, + { 0x78, "sata" }, + { 0x8B, "nand" }, + { 0x9C, "pex" }, + { 0xAE, "mmc" }, + {}, +}; + #endif struct bubt_dev { @@ -644,6 +662,23 @@ static int check_image_header(void) return 0; } #elif defined(CONFIG_ARMADA_38X) +static int a38x_check_boot_mode(const struct bubt_dev *dst) +{ + int mode; + const struct a38x_main_hdr_v1 *hdr = + (struct a38x_main_hdr_v1 *)get_load_addr(); + + for (mode = 0; mode < ARRAY_SIZE(a38x_boot_modes); mode++) { + if (strcmp(a38x_boot_modes[mode].name, dst->name) == 0) + break; + } + + if (a38x_boot_modes[mode].id == hdr->blockid) + return 0; + + return -ENOEXEC; +} + static size_t a38x_header_size(const struct a38x_main_hdr_v1 *h) { if (h->version == 1) @@ -697,7 +732,7 @@ static int check_image_header(void) } #endif -static int bubt_verify(size_t image_size) +static int bubt_verify(const struct bubt_dev *dst) { int err; @@ -708,6 +743,14 @@ static int bubt_verify(size_t image_size) return err; } +#if defined(CONFIG_ARMADA_38X) + err = a38x_check_boot_mode(dst); + if (err) { + puts("Error: image not built for destination device!\n"); + return err; + } +#endif + return 0; } @@ -829,7 +872,7 @@ int do_bubt_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (!image_size) return -EIO; - err = bubt_verify(image_size); + err = bubt_verify(dst); if (err) return err; -- 2.25.0
[PATCH v3 2/5] cmd: mvebu: bubt: correct U-Boot spelling
Replace "U-BOOT" text with correct spelling Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v2 changes: - none v3 changes: - none --- cmd/mvebu/bubt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index d399fb6da4..b80b81c82a 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -346,7 +346,7 @@ static int nand_burn_image(size_t image_size) /* Align U-Boot size to currently used blocksize */ image_size = ((image_size + (block_size - 1)) & (~(block_size - 1))); - /* Erase the U-BOOT image space */ + /* Erase the U-Boot image space */ printf("Erasing 0x%x - 0x%x:...", 0, (int)image_size); ret = nand_erase(mtd, 0, image_size); if (ret) { @@ -734,7 +734,7 @@ static int bubt_read_file(struct bubt_dev *src) static int bubt_is_dev_active(struct bubt_dev *dev) { if (!dev->active) { - printf("Device \"%s\" not supported by U-BOOT image\n", + printf("Device \"%s\" not supported by U-Boot image\n", dev->name); return 0; } @@ -822,7 +822,7 @@ int do_bubt_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (!bubt_is_dev_active(src)) return -ENODEV; - printf("Burning U-BOOT image \"%s\" from \"%s\" to \"%s\"\n", + printf("Burning U-Boot image \"%s\" from \"%s\" to \"%s\"\n", net_boot_file_name, src->name, dst->name); image_size = bubt_read_file(src); -- 2.25.0
[PATCH v2 2/2] arm: mvebu: clearfog: support multiple SATA boot
Enable distro bootcmd support for additional SATA ports if enabled. Signed-off-by: Joel Johnson --- This patch builds on and requires the separate patch in the "ClearFog Base static variant support" series adding configurable SATA support ("arm: mvebu: clearfog: Add SATA mode flags"). v2 changes: - name macros SCSI_BUSN to better distinguish between bus and connection - move not SCSI case first, otherwise it tends to get lost --- include/configs/clearfog.h | 38 ++ 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/include/configs/clearfog.h b/include/configs/clearfog.h index a452f4b009..0c314c4c53 100644 --- a/include/configs/clearfog.h +++ b/include/configs/clearfog.h @@ -110,16 +110,46 @@ #define BOOT_TARGET_DEVICES_USB(func) #endif -#ifdef CONFIG_SCSI -#define BOOT_TARGET_DEVICES_SCSI(func) func(SCSI, scsi, 0) +#ifndef CONFIG_SCSI +#define BOOT_TARGET_DEVICES_SCSI_BUS0(func) +#define BOOT_TARGET_DEVICES_SCSI_BUS1(func) +#define BOOT_TARGET_DEVICES_SCSI_BUS2(func) +#else +/* + * With SCSI enabled, M.2 SATA is always located on bus 0 + */ +#define BOOT_TARGET_DEVICES_SCSI_BUS0(func) func(SCSI, scsi, 0) + +/* + * Either one or both mPCIe slots may be configured as mSATA interfaces. The + * SCSI bus ids are assigned based on sequence of hardware present, not always + * tied to hardware slot ids. As such, use second SCSI bus if either slot is + * set for SATA, and only use third SCSI bus if both slots are SATA enabled. + */ +#if defined (CONFIG_CLEARFOG_CON2_SATA) || defined (CONFIG_CLEARFOG_CON3_SATA) +#define BOOT_TARGET_DEVICES_SCSI_BUS1(func) func(SCSI, scsi, 1) #else -#define BOOT_TARGET_DEVICES_SCSI(func) +#define BOOT_TARGET_DEVICES_SCSI_BUS1(func) #endif +#if defined (CONFIG_CLEARFOG_CON2_SATA) && defined (CONFIG_CLEARFOG_CON3_SATA) +#define BOOT_TARGET_DEVICES_SCSI_BUS2(func) func(SCSI, scsi, 2) +#else +#define BOOT_TARGET_DEVICES_SCSI_BUS2(func) +#endif + +#endif /* CONFIG_SCSI */ + +/* + * The SCSI buses are attempted in increasing bus order, there is no current + * mechanism to alter the default bus priority order for booting. + */ #define BOOT_TARGET_DEVICES(func) \ BOOT_TARGET_DEVICES_MMC(func) \ BOOT_TARGET_DEVICES_USB(func) \ - BOOT_TARGET_DEVICES_SCSI(func) \ + BOOT_TARGET_DEVICES_SCSI_BUS0(func) \ + BOOT_TARGET_DEVICES_SCSI_BUS1(func) \ + BOOT_TARGET_DEVICES_SCSI_BUS2(func) \ func(PXE, pxe, na) \ func(DHCP, dhcp, na) -- 2.25.0
[PATCH v2 1/2] arm: mvebu: clearfog: add SCSI to distro bootcmd
Include attempting to boot from SCSI (SATA) devices within generated board distro bootcmd environment. The reasoning for boot ordering is that MMC and USB are external and removable, while when a case is in use, replacing M.2 or mSATA drives requires disassembly. Therefore, to boot SCSI, [bootable] external media must be removed. If SCSI were placed before MMC or USB, then removing a bootable SCSI drive to enable MMC or USB booting would be more difficult. Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v2 changes - none --- include/configs/clearfog.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/include/configs/clearfog.h b/include/configs/clearfog.h index 633187d86f..a452f4b009 100644 --- a/include/configs/clearfog.h +++ b/include/configs/clearfog.h @@ -110,9 +110,16 @@ #define BOOT_TARGET_DEVICES_USB(func) #endif +#ifdef CONFIG_SCSI +#define BOOT_TARGET_DEVICES_SCSI(func) func(SCSI, scsi, 0) +#else +#define BOOT_TARGET_DEVICES_SCSI(func) +#endif + #define BOOT_TARGET_DEVICES(func) \ BOOT_TARGET_DEVICES_MMC(func) \ BOOT_TARGET_DEVICES_USB(func) \ + BOOT_TARGET_DEVICES_SCSI(func) \ func(PXE, pxe, na) \ func(DHCP, dhcp, na) -- 2.25.0
Re: [PATCH 1/2] arm: mvebu: clearfog: add SCSI to distro bootcmd
On 2020-03-23 04:27, Stefan Roese wrote: Hi Joel, On 22.03.20 19:53, Joel Johnson wrote: As with other related ClearFog patches, I haven't received any review responses on this series (http://patchwork.ozlabs.org/project/uboot/list/?series=155760) and would like to ping out for additional review. I'd especially like feedback on the approach for support of multiple SCSI devices, if there a preferred or standardized mechanism I'd be happy to adjust, but I couldn't find any other examples of including multiple SCSI devices in distro_boot. In reviewing again myself there was an initial mental mismatch between CON2/CON3 usage as connection ports and the naming of SCSI_CLEARFOG2/SCSI_CLEARFOG3 as index counters, but otherwise still seems good. If it's in an acceptable state for inclusion in the next merge window, that's certainly fine too, I'm just looking for a crosscheck. Let's see, if Baruch and/or Josua have some comments here. Thanks, Stefan I have an update I'll post shortly which keeps the same logic, but renames the defined macros to be SCSI bus centric (i.e. X_BUS0, X_BUS1, X_BUS2) instead of potential confusion with hardware labelled port locations. Joel
Re: [PATCH v2 3/5] cmd: mvebu: bubt: verify A38x target device type
On 2020-03-23 04:06, Stefan Roese wrote: On 29.01.20 15:50, Joel Johnson wrote: Ensure that the device to which an image is being written includes header information indicating boot support for the destination device. This is derived from the support in the SolidRun master-a38x vendor fork branch. Signed-off-by: Joel Johnson --- v2 changes: - none --- cmd/mvebu/bubt.c | 49 ++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index b80b81c82a..78061a6a2d 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -107,6 +107,26 @@ struct a38x_main_hdr_v1 { u8 ext; /* 0x1E */ u8 checksum; /* 0x1F */ }; + +#define A38X_BOOT_MODE_MAX 8 Can't you drop this define here... +struct a38x_boot_mode { + unsigned int id; + const char *name; +}; + +/* The blockid header field values used to indicate boot device of image */ +struct a38x_boot_mode a38x_boot_modes[A38X_BOOT_MODE_MAX] = { ... and use [] here... + { 0x4D, "i2c" }, + { 0x5A, "spi" }, + { 0x69, "uart" }, + { 0x78, "sata" }, + { 0x8B, "nand" }, + { 0x9C, "pex" }, + { 0xAE, "mmc" }, + {}, +}; + #endif struct bubt_dev { @@ -644,6 +664,23 @@ static int check_image_header(void) return 0; } #elif defined(CONFIG_ARMADA_38X) +static int a38x_check_boot_mode(const struct bubt_dev *dst) +{ + int mode; + const struct a38x_main_hdr_v1 *hdr = + (struct a38x_main_hdr_v1 *)get_load_addr(); + + for (mode = 0; mode < A38X_BOOT_MODE_MAX; mode++) { ... and use ARRAY_SIZE() here instead? Thanks, Stefan Yes, that'd be better for maintenance for sure, I'll incorporate the change. Joel
Re: [PATCH v5 04/12] arm: mvebu: clearfog: initial ClearFog Base variant
On 2020-03-23 03:11, Stefan Roese wrote: On 27.01.20 21:01, Joel Johnson wrote: Add a unique entry for ClearFog Base variant, reflected in the board name and adjusted SerDes topology. Signed-off-by: Joel Johnson --- v2 changes: - reworked based on Baruch's run-time TLV EEPROM detection series v3 changes: - rebased on mvebu merged run-time TLV EEPROM detection series - minor update to help test regarding runtime detection failures v4 changes: - use runtime static config adjust instead of #ifdef in cases where hardware EEPROM detection fails or is disabled in build SPL size change for defconfig increases 36 bytes (122893 to 122929) SPL size change for defconfig+Base increases 60 bytes (122893 to 122953) - add placeholder support for EEPROM based Clearfog Pro, based on initial name confirmation from Baruch. I wanted to include the check at least in the patch for review to indicate expected usage to ensure that a Clearfog Pro EEPROM device boots correctly even if the image is built with Base static configuration. If there are other prerelease concerns and this should be added separately later, I'd be fine with that too. - Note that this approach *does not* currently provide any mechanism for EEPROM detected boards to have their SFP speed changed or switch between PCIE/SATA signalling. I'm assuming that will be done based on hardware detection, but confirmation/acceptance in review would be appreciated so it can be revisited if needed. v5 changes: - only make Base variant adjustment based on runtime configuration --- arch/arm/mach-mvebu/Kconfig| 2 ++ board/solidrun/clearfog/Kconfig| 18 ++ board/solidrun/clearfog/clearfog.c | 29 +++-- 3 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 board/solidrun/clearfog/Kconfig diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index bc5eaa5a76..161dee937f 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig @@ -280,4 +280,6 @@ config SECURED_MODE_CSK_INDEX default 0 depends on SECURED_MODE_IMAGE +source "board/solidrun/clearfog/Kconfig" + endif diff --git a/board/solidrun/clearfog/Kconfig b/board/solidrun/clearfog/Kconfig new file mode 100644 index 00..936d5918f8 --- /dev/null +++ b/board/solidrun/clearfog/Kconfig @@ -0,0 +1,18 @@ +menu "ClearFog configuration" + depends on TARGET_CLEARFOG + +config TARGET_CLEARFOG_BASE + bool "Use ClearFog Base static configuration" + help + Use the ClearFog Base as the static configuration instead of the + default which uses the ClearFog Pro. + + Runtime board detection is always attempted and used if available. The + static configuration is used as a fallback in cases where runtime + detection is disabled, is not available in hardware, or otherwise fails. + + Only newer revisions of the ClearFog product line support runtime + detection via additional EEPROM hardware. This option enables selecting + the Base variant for older hardware revisions. + +endmenu diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c index 9b31902c70..c873d00905 100644 --- a/board/solidrun/clearfog/clearfog.c +++ b/board/solidrun/clearfog/clearfog.c @@ -42,6 +42,7 @@ static void cf_read_tlv_data(void) read_tlv_data(_tlv_data); } +/* The starting board_serdes_map reflects original Clearfog Pro usage */ static struct serdes_map board_serdes_map[] = { {SATA0, SERDES_SPEED_3_GBPS, SERDES_DEFAULT_MODE, 0, 0}, {SGMII1, SERDES_SPEED_1_25_GBPS, SERDES_DEFAULT_MODE, 0, 0}, @@ -51,6 +52,13 @@ static struct serdes_map board_serdes_map[] = { {SGMII2, SERDES_SPEED_1_25_GBPS, SERDES_DEFAULT_MODE, 0, 0}, }; +void config_cfbase_serdes_map(void) +{ + board_serdes_map[4].serdes_type = USB3_HOST0; + board_serdes_map[4].serdes_speed = SERDES_SPEED_5_GBPS; + board_serdes_map[4].serdes_mode = SERDES_DEFAULT_MODE; +} + int hws_board_topology_load(struct serdes_map **serdes_map_array, u8 *count) { cf_read_tlv_data(); @@ -59,12 +67,17 @@ int hws_board_topology_load(struct serdes_map **serdes_map_array, u8 *count) board_serdes_map[0].serdes_type = PEX0; board_serdes_map[0].serdes_speed = SERDES_SPEED_5_GBPS; board_serdes_map[0].serdes_mode = PEX_ROOT_COMPLEX_X1; - } - - if (sr_product_is(_tlv_data, "Clearfog Base")) { - board_serdes_map[4].serdes_type = USB3_HOST0; - board_serdes_map[4].serdes_speed = SERDES_SPEED_5_GBPS; - board_serdes_map[4].serdes_mode = SERDES_DEFAULT_MODE; + } else if (sr_product_is(_tlv_data, "Clearfog Pro")) { + /* handle recognized product as noop, no adjus
Re: [PATCH 1/2] arm: mvebu: clearfog: add SCSI to distro bootcmd
As with other related ClearFog patches, I haven't received any review responses on this series (http://patchwork.ozlabs.org/project/uboot/list/?series=155760) and would like to ping out for additional review. I'd especially like feedback on the approach for support of multiple SCSI devices, if there a preferred or standardized mechanism I'd be happy to adjust, but I couldn't find any other examples of including multiple SCSI devices in distro_boot. In reviewing again myself there was an initial mental mismatch between CON2/CON3 usage as connection ports and the naming of SCSI_CLEARFOG2/SCSI_CLEARFOG3 as index counters, but otherwise still seems good. If it's in an acceptable state for inclusion in the next merge window, that's certainly fine too, I'm just looking for a crosscheck. Thanks! Joel On 2020-01-28 20:59, Joel Johnson wrote: Include attempting to boot from SCSI (SATA) devices within generated board distro bootcmd environment. The reasoning for boot ordering is that MMC and USB are external and removable, while when a case is in use, replacing M.2 or mSATA drives requires disassembly. Therefore, to boot SCSI, [bootable] external media must be removed. If SCSI were placed before MMC or USB, then removing a bootable SCSI drive to enable MMC or USB booting would be more difficult. Signed-off-by: Joel Johnson --- include/configs/clearfog.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/include/configs/clearfog.h b/include/configs/clearfog.h index 633187d86f..a452f4b009 100644 --- a/include/configs/clearfog.h +++ b/include/configs/clearfog.h @@ -110,9 +110,16 @@ #define BOOT_TARGET_DEVICES_USB(func) #endif +#ifdef CONFIG_SCSI +#define BOOT_TARGET_DEVICES_SCSI(func) func(SCSI, scsi, 0) +#else +#define BOOT_TARGET_DEVICES_SCSI(func) +#endif + #define BOOT_TARGET_DEVICES(func) \ BOOT_TARGET_DEVICES_MMC(func) \ BOOT_TARGET_DEVICES_USB(func) \ + BOOT_TARGET_DEVICES_SCSI(func) \ func(PXE, pxe, na) \ func(DHCP, dhcp, na)
Re: [PATCH v2 1/5] cmd: mvebu: bubt: add A38x support
I just wanted to ping on this review (http://patchwork.ozlabs.org/project/uboot/list/?series=155850). I haven't seen any review feedback, so would like to check if it's agreeably in a state ready for merging in the next merge window or if there are issues. Thanks! Joel On 2020-01-29 07:50, Joel Johnson wrote: Add support for Armada 38x devices in bubt flashing utility. This is based on (and streamlined from) the support in the SolidRun master-a38x vendor fork branch. Signed-off-by: Joel Johnson --- v2 changes - none --- cmd/mvebu/bubt.c | 69 +++- 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index 2041a7a29a..d399fb6da4 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -85,7 +85,29 @@ struct mvebu_image_info { u32 encrypt_start_offset; u32 encrypt_size; }; -#endif /* CONFIG_ARMADA_XXX */ +#elif defined(CONFIG_ARMADA_38X) /* A38X */ + +/* Structure of the main header, version 1 (Armada 370/38x/XP) */ +struct a38x_main_hdr_v1 { + u8 blockid; /* 0x0 */ + u8 flags; /* 0x1 */ + u16 reserved2; /* 0x2-0x3 */ + u32 blocksize; /* 0x4-0x7 */ + u8 version; /* 0x8 */ + u8 headersz_msb; /* 0x9 */ + u16 headersz_lsb; /* 0xA-0xB */ + u32 srcaddr; /* 0xC-0xF */ + u32 destaddr; /* 0x10-0x13 */ + u32 execaddr; /* 0x14-0x17 */ + u8 options; /* 0x18 */ + u8 nandblocksize; /* 0x19 */ + u8 nandbadblklocation;/* 0x1A */ + u8 reserved4; /* 0x1B */ + u16 reserved5; /* 0x1C-0x1D */ + u8 ext; /* 0x1E */ + u8 checksum; /* 0x1F */ +}; +#endif struct bubt_dev { char name[8]; @@ -621,7 +643,52 @@ static int check_image_header(void) return 0; } +#elif defined(CONFIG_ARMADA_38X) +static size_t a38x_header_size(const struct a38x_main_hdr_v1 *h) +{ + if (h->version == 1) + return (h->headersz_msb << 16) | le16_to_cpu(h->headersz_lsb); + + printf("Error: Invalid A38x image (header version 0x%x unknown)!\n", + h->version); + return 0; +} + +static uint8_t image_checksum8(const void *start, size_t len) +{ + u8 csum = 0; + const u8 *p = start; + + while (len) { + csum += *p; + ++p; + --len; + } + + return csum; +} +static int check_image_header(void) +{ + u8 checksum; + const struct a38x_main_hdr_v1 *hdr = + (struct a38x_main_hdr_v1 *)get_load_addr(); + const size_t image_size = a38x_header_size(hdr); + + if (!image_size) + return -ENOEXEC; + + checksum = image_checksum8(hdr, image_size); + checksum -= hdr->checksum; + if (checksum != hdr->checksum) { + printf("Error: Bad A38x image checksum. 0x%x != 0x%x\n", + checksum, hdr->checksum); + return -ENOEXEC; + } + + printf("Image checksum...OK!\n"); + return 0; +} #else /* Not ARMADA? */ static int check_image_header(void) {
Re: [PATCH v5 00/12] ClearFog Base static variant support
I just wanted to ping on this review (http://patchwork.ozlabs.org/project/uboot/list/?series=155533) to see if it had reached an agreeable state or if there were still lingering issues. I've been using it without issue against RC releases. If the plan is to not include it in v2020.04 that's completely reasonable, but I would request review and feedback on blocking issues, otherwise does it have general agreement for merging in the next merge window? Thanks, Joel On 2020-01-27 13:01, Joel Johnson wrote: This patch series adds support for ClearFog Base static configuration, as well as updating and fixing the ClearFog support for MMC and SPI booting. v2 changes: - updated against, and dependent on, https://patchwork.ozlabs.org/cover/1200324 v3 changes: - rebased against ClearFog runtime TLV EEPROM changes merged into mvebu/master v4 - adjust static SerDes configuration at runtime instead of #ifdef v5 - distinguish build-only config changes (SFP and PCIe/SATA) from runtime detectable config changes - retested SATA mode in PCIe slot with swap rx changes, confirmed working as presently patched. Only tested with ClearFog Base which only provides single channel, but Pro mechanism is parallel. Joel Johnson (12): arm: mvebu: fix SerDes table alignment arm: mvebu: solidrun: remove hardcoded DTS MAC address arm: mvebu: clearfog: use Pro name by default arm: mvebu: clearfog: initial ClearFog Base variant arm: mvebu: clearfog: Add option for 2.5 Gbps SFP arm: mvebu: clearfog: Add SATA mode flags arm: mvebu: clearfog: Unify DT selection paths arm: mvebu: clearfog: add SPI offsets arm: mvebu: enable working default boot support arm: mvebu: clearfog: move ENV params to Kconfig arm: mvebu: clearfog: don't always use SPL MMC arm: mvebu: clearfog: Use Pro DT by default .../arm/dts/armada-38x-solidrun-microsom.dtsi | 1 - arch/arm/mach-mvebu/Kconfig | 13 .../serdes/a38x/high_speed_env_spec.c | 6 +- board/solidrun/clearfog/Kconfig | 62 +++ board/solidrun/clearfog/clearfog.c| 53 +--- configs/clearfog_defconfig| 4 -- include/configs/clearfog.h| 1 - 7 files changed, 124 insertions(+), 16 deletions(-) create mode 100644 board/solidrun/clearfog/Kconfig
[PATCH] cmd: mdc/mwc: normalize disjoint MX_CYCLIC usage
Both CMD_MX_CYCLIC and MX_CYCLIC are in use and defined in Kconfig, but only the non-CMD version currently does anything. This changes all usages to prefer the CMD_MX_CYCLIC option (since it's only affecting addition of the commands), and switches defconfigs using the non-CMD version to use the CMD version. Signed-off-by: Joel Johnson --- README| 2 +- cmd/Kconfig | 8 +--- cmd/mem.c | 8 configs/M5249EVB_defconfig| 2 +- configs/amcore_defconfig | 2 +- configs/bcm11130_defconfig| 2 +- configs/bcm11130_nand_defconfig | 2 +- configs/bcm23550_w1d_defconfig| 2 +- configs/bcm28155_ap_defconfig | 2 +- configs/bcm28155_w1d_defconfig| 2 +- configs/bcm911360_entphn-ns_defconfig | 2 +- configs/bcm911360_entphn_defconfig| 2 +- configs/bcm911360k_defconfig | 2 +- configs/bcm958300k-ns_defconfig | 2 +- configs/bcm958300k_defconfig | 2 +- configs/bcm958305k_defconfig | 2 +- configs/bcm958622hr_defconfig | 2 +- configs/da850evm_defconfig| 2 +- configs/da850evm_direct_nor_defconfig | 2 +- configs/da850evm_nand_defconfig | 2 +- configs/k2e_evm_defconfig | 2 +- configs/k2e_hs_evm_defconfig | 2 +- configs/k2g_evm_defconfig | 2 +- configs/k2g_hs_evm_defconfig | 2 +- configs/k2hk_evm_defconfig| 2 +- configs/k2hk_hs_evm_defconfig | 2 +- configs/k2l_evm_defconfig | 2 +- configs/k2l_hs_evm_defconfig | 2 +- configs/legoev3_defconfig | 2 +- configs/omapl138_lcdk_defconfig | 2 +- configs/x600_defconfig| 2 +- configs/xtfpga_defconfig | 2 +- 32 files changed, 35 insertions(+), 41 deletions(-) diff --git a/README b/README index c1324c1296..8cfa92fac9 100644 --- a/README +++ b/README @@ -3025,7 +3025,7 @@ Low Level (hardware related) configuration options: Add the "loopw" memory command. This only takes effect if the memory commands are activated globally (CONFIG_CMD_MEMORY). -- CONFIG_MX_CYCLIC +- CONFIG_CMD_MX_CYCLIC Add the "mdc" and "mwc" memory commands. These are cyclic "md/mw" commands. Examples: diff --git a/cmd/Kconfig b/cmd/Kconfig index 6e1efaaf85..cbdbd9538b 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -692,7 +692,7 @@ config CMD_MEMORY base - print or set address offset loop - initialize loop on address range -config MX_CYCLIC +config CMD_MX_CYCLIC bool "Enable cyclic md/mw commands" depends on CMD_MEMORY help @@ -727,12 +727,6 @@ config SYS_ALT_MEMTEST endif -config CMD_MX_CYCLIC - bool "mdc, mwc" - help - mdc - memory display cyclic - mwc - memory write cyclic - config CMD_SHA1SUM bool "sha1sum" select SHA1 diff --git a/cmd/mem.c b/cmd/mem.c index f32985ca7d..6d54f19527 100644 --- a/cmd/mem.c +++ b/cmd/mem.c @@ -165,7 +165,7 @@ static int do_mem_mw(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return 0; } -#ifdef CONFIG_MX_CYCLIC +#ifdef CONFIG_CMD_MX_CYCLIC static int do_mem_mdc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int i; @@ -219,7 +219,7 @@ static int do_mem_mwc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return 0; } -#endif /* CONFIG_MX_CYCLIC */ +#endif /* CONFIG_CMD_MX_CYCLIC */ static int do_mem_cmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { @@ -1270,7 +1270,7 @@ U_BOOT_CMD( ); #endif /* CONFIG_CMD_MEMTEST */ -#ifdef CONFIG_MX_CYCLIC +#ifdef CONFIG_CMD_MX_CYCLIC U_BOOT_CMD( mdc,4, 1, do_mem_mdc, "memory display cyclic", @@ -1290,7 +1290,7 @@ U_BOOT_CMD( "[.b, .w, .l] address value delay(ms)" #endif ); -#endif /* CONFIG_MX_CYCLIC */ +#endif /* CONFIG_CMD_MX_CYCLIC */ #ifdef CONFIG_CMD_MEMINFO U_BOOT_CMD( diff --git a/configs/M5249EVB_defconfig b/configs/M5249EVB_defconfig index 39c4976e0d..12db389b69 100644 --- a/configs/M5249EVB_defconfig +++ b/configs/M5249EVB_defconfig @@ -9,7 +9,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_AUTOBOOT is not set CONFIG_CMD_IMLS=y CONFIG_LOOPW=y -CONFIG_MX_CYCLIC=y +CONFIG_CMD_MX_CYCLIC=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_CACHE=y CONFIG_DEFAULT_DEVICE_TREE="M5249EVB" diff --git a/configs/amcore_defconfig b/configs/amcore_defconfig index 78e2d1da05..dd357bf3da 100644 --- a/configs/amcore_defconfig +++ b/configs/amcore_defconfig @@ -14,7 +14,7 @@ CONFIG_SYS_PROMPT="amcore $ " CONFIG_CMD_IMLS=y # CONFIG_CMD_XIMG is not set CONFIG_LOOPW=y -CONFIG_MX_CYCLIC=y +CONFIG_CMD_MX_CYCLIC=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_CAC
[PATCH v2 4/5] arm: mvebu: clearfog: enable bubt command
With support added for Armada 38x, include the bubt command in ClearFog defconfig. Signed-off-by: Joel Johnson --- v2 changes: - none --- configs/clearfog_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/clearfog_defconfig b/configs/clearfog_defconfig index c938448c30..0d7e19e731 100644 --- a/configs/clearfog_defconfig +++ b/configs/clearfog_defconfig @@ -35,6 +35,7 @@ CONFIG_SPL_CMD_TLV_EEPROM=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y +CONFIG_CMD_MVEBU_BUBT=y CONFIG_CMD_PCI=y CONFIG_CMD_SPI=y CONFIG_CMD_USB=y -- 2.20.1
[PATCH v2 5/5] cmd: mvebu: bubt: show image boot device
When a mismatch is found trying to write an image for one boot method to a different boot device, print an error message including the image header marked target boot device type. Signed-off-by: Joel Johnson --- v2 changes: - newly added in v2 series --- cmd/mvebu/bubt.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index 78061a6a2d..5e2877788a 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -678,6 +678,17 @@ static int a38x_check_boot_mode(const struct bubt_dev *dst) if (a38x_boot_modes[mode].id == hdr->blockid) return 0; + for (int i = 0; i < A38X_BOOT_MODE_MAX; i++) { + if (a38x_boot_modes[i].id == hdr->blockid) { + printf("Error: image meant to be booted from " + " \"%s\", not \"%s\"!\n", + a38x_boot_modes[i].name, dst->name); + return -ENOEXEC; + } + } + + printf("Error: unknown boot device in image header: 0x%x\n", + hdr->blockid); return -ENOEXEC; } @@ -747,10 +758,8 @@ static int bubt_verify(const struct bubt_dev *dst) #if defined(CONFIG_ARMADA_38X) err = a38x_check_boot_mode(dst); - if (err) { - puts("Error: image not built for destination device!\n"); + if (err) return err; - } #endif return 0; -- 2.20.1
[PATCH v2 3/5] cmd: mvebu: bubt: verify A38x target device type
Ensure that the device to which an image is being written includes header information indicating boot support for the destination device. This is derived from the support in the SolidRun master-a38x vendor fork branch. Signed-off-by: Joel Johnson --- v2 changes: - none --- cmd/mvebu/bubt.c | 49 ++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index b80b81c82a..78061a6a2d 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -107,6 +107,26 @@ struct a38x_main_hdr_v1 { u8 ext; /* 0x1E */ u8 checksum; /* 0x1F */ }; + +#define A38X_BOOT_MODE_MAX 8 + +struct a38x_boot_mode { + unsigned int id; + const char *name; +}; + +/* The blockid header field values used to indicate boot device of image */ +struct a38x_boot_mode a38x_boot_modes[A38X_BOOT_MODE_MAX] = { + { 0x4D, "i2c" }, + { 0x5A, "spi" }, + { 0x69, "uart" }, + { 0x78, "sata" }, + { 0x8B, "nand" }, + { 0x9C, "pex" }, + { 0xAE, "mmc" }, + {}, +}; + #endif struct bubt_dev { @@ -644,6 +664,23 @@ static int check_image_header(void) return 0; } #elif defined(CONFIG_ARMADA_38X) +static int a38x_check_boot_mode(const struct bubt_dev *dst) +{ + int mode; + const struct a38x_main_hdr_v1 *hdr = + (struct a38x_main_hdr_v1 *)get_load_addr(); + + for (mode = 0; mode < A38X_BOOT_MODE_MAX; mode++) { + if (strcmp(a38x_boot_modes[mode].name, dst->name) == 0) + break; + } + + if (a38x_boot_modes[mode].id == hdr->blockid) + return 0; + + return -ENOEXEC; +} + static size_t a38x_header_size(const struct a38x_main_hdr_v1 *h) { if (h->version == 1) @@ -697,7 +734,7 @@ static int check_image_header(void) } #endif -static int bubt_verify(size_t image_size) +static int bubt_verify(const struct bubt_dev *dst) { int err; @@ -708,6 +745,14 @@ static int bubt_verify(size_t image_size) return err; } +#if defined(CONFIG_ARMADA_38X) + err = a38x_check_boot_mode(dst); + if (err) { + puts("Error: image not built for destination device!\n"); + return err; + } +#endif + return 0; } @@ -829,7 +874,7 @@ int do_bubt_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (!image_size) return -EIO; - err = bubt_verify(image_size); + err = bubt_verify(dst); if (err) return err; -- 2.20.1
[PATCH v2 1/5] cmd: mvebu: bubt: add A38x support
Add support for Armada 38x devices in bubt flashing utility. This is based on (and streamlined from) the support in the SolidRun master-a38x vendor fork branch. Signed-off-by: Joel Johnson --- v2 changes - none --- cmd/mvebu/bubt.c | 69 +++- 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index 2041a7a29a..d399fb6da4 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -85,7 +85,29 @@ struct mvebu_image_info { u32 encrypt_start_offset; u32 encrypt_size; }; -#endif /* CONFIG_ARMADA_XXX */ +#elif defined(CONFIG_ARMADA_38X) /* A38X */ + +/* Structure of the main header, version 1 (Armada 370/38x/XP) */ +struct a38x_main_hdr_v1 { + u8 blockid; /* 0x0 */ + u8 flags; /* 0x1 */ + u16 reserved2; /* 0x2-0x3 */ + u32 blocksize; /* 0x4-0x7 */ + u8 version; /* 0x8 */ + u8 headersz_msb; /* 0x9 */ + u16 headersz_lsb; /* 0xA-0xB */ + u32 srcaddr; /* 0xC-0xF */ + u32 destaddr; /* 0x10-0x13 */ + u32 execaddr; /* 0x14-0x17 */ + u8 options; /* 0x18 */ + u8 nandblocksize; /* 0x19 */ + u8 nandbadblklocation;/* 0x1A */ + u8 reserved4; /* 0x1B */ + u16 reserved5; /* 0x1C-0x1D */ + u8 ext; /* 0x1E */ + u8 checksum; /* 0x1F */ +}; +#endif struct bubt_dev { char name[8]; @@ -621,7 +643,52 @@ static int check_image_header(void) return 0; } +#elif defined(CONFIG_ARMADA_38X) +static size_t a38x_header_size(const struct a38x_main_hdr_v1 *h) +{ + if (h->version == 1) + return (h->headersz_msb << 16) | le16_to_cpu(h->headersz_lsb); + + printf("Error: Invalid A38x image (header version 0x%x unknown)!\n", + h->version); + return 0; +} + +static uint8_t image_checksum8(const void *start, size_t len) +{ + u8 csum = 0; + const u8 *p = start; + + while (len) { + csum += *p; + ++p; + --len; + } + + return csum; +} +static int check_image_header(void) +{ + u8 checksum; + const struct a38x_main_hdr_v1 *hdr = + (struct a38x_main_hdr_v1 *)get_load_addr(); + const size_t image_size = a38x_header_size(hdr); + + if (!image_size) + return -ENOEXEC; + + checksum = image_checksum8(hdr, image_size); + checksum -= hdr->checksum; + if (checksum != hdr->checksum) { + printf("Error: Bad A38x image checksum. 0x%x != 0x%x\n", + checksum, hdr->checksum); + return -ENOEXEC; + } + + printf("Image checksum...OK!\n"); + return 0; +} #else /* Not ARMADA? */ static int check_image_header(void) { -- 2.20.1
[PATCH v2 2/5] cmd: mvebu: bubt: correct U-Boot spelling
Replace "U-BOOT" text with correct spelling Signed-off-by: Joel Johnson --- v2 changes: - none --- cmd/mvebu/bubt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index d399fb6da4..b80b81c82a 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -346,7 +346,7 @@ static int nand_burn_image(size_t image_size) /* Align U-Boot size to currently used blocksize */ image_size = ((image_size + (block_size - 1)) & (~(block_size - 1))); - /* Erase the U-BOOT image space */ + /* Erase the U-Boot image space */ printf("Erasing 0x%x - 0x%x:...", 0, (int)image_size); ret = nand_erase(mtd, 0, image_size); if (ret) { @@ -734,7 +734,7 @@ static int bubt_read_file(struct bubt_dev *src) static int bubt_is_dev_active(struct bubt_dev *dev) { if (!dev->active) { - printf("Device \"%s\" not supported by U-BOOT image\n", + printf("Device \"%s\" not supported by U-Boot image\n", dev->name); return 0; } @@ -822,7 +822,7 @@ int do_bubt_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (!bubt_is_dev_active(src)) return -ENODEV; - printf("Burning U-BOOT image \"%s\" from \"%s\" to \"%s\"\n", + printf("Burning U-Boot image \"%s\" from \"%s\" to \"%s\"\n", net_boot_file_name, src->name, dst->name); image_size = bubt_read_file(src); -- 2.20.1
[PATCH 2/2] arm: mvebu: clearfog: support multiple SATA boot
Enabled distro bootcmd support for additional SATA ports if enabled. Signed-off-by: Joel Johnson --- This patch builds on and requires the separate patch series adding configurable SATA support ("arm: mvebu: clearfog: Add SATA mode flags"). --- include/configs/clearfog.h | 31 --- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/include/configs/clearfog.h b/include/configs/clearfog.h index a452f4b009..0bf7e9d950 100644 --- a/include/configs/clearfog.h +++ b/include/configs/clearfog.h @@ -111,15 +111,40 @@ #endif #ifdef CONFIG_SCSI -#define BOOT_TARGET_DEVICES_SCSI(func) func(SCSI, scsi, 0) +#define BOOT_TARGET_DEVICES_SCSI_M2SATA(func) func(SCSI, scsi, 0) + +/* + * Either one or both mPCIe slots may be configured as mSATA interfaces. The + * SCSI bus ids are assigned based on sequence of hardware present, not always + * tied to hardware slot ids. As such, use second SCSI bus if either slot is + * set for SATA, and only use third SCSI bus if both slots are SATA enabled. + */ +#if defined (CONFIG_CLEARFOG_CON2_SATA) || defined (CONFIG_CLEARFOG_CON3_SATA) +#define BOOT_TARGET_DEVICES_SCSI_CLEARFOG2(func) func(SCSI, scsi, 1) +#else +#define BOOT_TARGET_DEVICES_SCSI_CLEARFOG2(func) +#endif + +#if defined (CONFIG_CLEARFOG_CON2_SATA) && defined (CONFIG_CLEARFOG_CON3_SATA) +#define BOOT_TARGET_DEVICES_SCSI_CLEARFOG3(func) func(SCSI, scsi, 2) #else -#define BOOT_TARGET_DEVICES_SCSI(func) +#define BOOT_TARGET_DEVICES_SCSI_CLEARFOG3(func) #endif +#else +#define BOOT_TARGET_DEVICES_SCSI_M2SATA(func) +#endif /* CONFIG_SCSI */ + +/* + * The SCSI buses are attempted in increasing bus order, there is no current + * mechanism to alter the default bus priority order for booting. + */ #define BOOT_TARGET_DEVICES(func) \ BOOT_TARGET_DEVICES_MMC(func) \ BOOT_TARGET_DEVICES_USB(func) \ - BOOT_TARGET_DEVICES_SCSI(func) \ + BOOT_TARGET_DEVICES_SCSI_M2SATA(func) \ + BOOT_TARGET_DEVICES_SCSI_CLEARFOG2(func) \ + BOOT_TARGET_DEVICES_SCSI_CLEARFOG3(func) \ func(PXE, pxe, na) \ func(DHCP, dhcp, na) -- 2.20.1
[PATCH 1/2] arm: mvebu: clearfog: add SCSI to distro bootcmd
Include attempting to boot from SCSI (SATA) devices within generated board distro bootcmd environment. The reasoning for boot ordering is that MMC and USB are external and removable, while when a case is in use, replacing M.2 or mSATA drives requires disassembly. Therefore, to boot SCSI, [bootable] external media must be removed. If SCSI were placed before MMC or USB, then removing a bootable SCSI drive to enable MMC or USB booting would be more difficult. Signed-off-by: Joel Johnson --- include/configs/clearfog.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/include/configs/clearfog.h b/include/configs/clearfog.h index 633187d86f..a452f4b009 100644 --- a/include/configs/clearfog.h +++ b/include/configs/clearfog.h @@ -110,9 +110,16 @@ #define BOOT_TARGET_DEVICES_USB(func) #endif +#ifdef CONFIG_SCSI +#define BOOT_TARGET_DEVICES_SCSI(func) func(SCSI, scsi, 0) +#else +#define BOOT_TARGET_DEVICES_SCSI(func) +#endif + #define BOOT_TARGET_DEVICES(func) \ BOOT_TARGET_DEVICES_MMC(func) \ BOOT_TARGET_DEVICES_USB(func) \ + BOOT_TARGET_DEVICES_SCSI(func) \ func(PXE, pxe, na) \ func(DHCP, dhcp, na) -- 2.20.1
Re: [PATCH v5 12/12] arm: mvebu: clearfog: Use Pro DT by default
On 2020-01-27 23:17, Baruch Siach wrote: Hi Joel, On Mon, Jan 27, 2020 at 01:01:56PM -0700, Joel Johnson wrote: Switch to explicitly using the Pro variant DT, which has been available since Linux 4.11. --- v4 changes: - new v5 changes: - none I separated out this change to the end of the series since it drew questioning on prior review. I'd still advocate for making the change, since especially with the additions of static variants and runtime detection, it becomes easier from within a booted kernel to identify the type and version of U-Boot image installed. Without making this change, it becomes less direct to determine an actual Pro vs. Base, vs old U-Boot image maybe supporting some hybrid variant configuration. Even in the Linux kernel adding of the Pro DTS, it is indicated that it was meant for backwards compatibility. Except for cases where checking is done directly against the product name from userspace, I don't see downsides even from a compatibility perspective for not making this change. In cases where checking *is* done from userspace, the broadening of the Clearfog product line would seem to mean that userspace checking should be flagged as needing to be udpated as well (or glob/regex matched as needed). One downside I see is that boot of kernels older than 4.11 will fail. But maybe since we already assume a newer kernel for armada-388-clearfog-base.dtb we can do that for -pro as well. Older kernels is one case, and to be fair there may also be the case of custom images with a newer kernel that for whatever reason (old file glob patterns) don't ship the -pro.dtb file. My testing focused primarily on OpenWRT and Debian, and while certainly not pervasive, I've also tested with current Armbian and Arch Linux ARM builds. By the way, does env_set() override the stored environment? I'm not entirely sure of the behavior with duplicate entries, however patch 7 in the series removes the fdtfile entry from being added via CONFIG_EXTRA_ENV_SETTINGS, so it is now only set in one consistent location within board_late_init(). Joel
Re: [PATCH v5 06/12] arm: mvebu: clearfog: Add SATA mode flags
On 2020-01-27 23:06, Baruch Siach wrote: Hi Joel, On Mon, Jan 27, 2020 at 01:01:50PM -0700, Joel Johnson wrote: --- a/board/solidrun/clearfog/Kconfig +++ b/board/solidrun/clearfog/Kconfig + +config CLEARFOG_CON2_SATA + bool "Use CON2 slot in SATA mode" + depends on !TARGET_CLEARFOG_BASE + help + Use the CON2 port with SATA protocol instead of the default PCIe. + The ClearFog port allows usage of either mSATA or miniPCIe + modules, but the desired protocol must be configured at build + time since it affects the SerDes topology layout. + --- a/board/solidrun/clearfog/clearfog.c +++ b/board/solidrun/clearfog/clearfog.c + if (IS_ENABLED(CONFIG_CLEARFOG_CON2_SATA) && + !IS_ENABLED(CONFIG_TARGET_CLEARFOG_BASE)) { This second condition looks redundant. CONFIG_CLEARFOG_CON2_SATA already depends on !CONFIG_TARGET_CLEARFOG_BASE at the Kconfig level above. It is redundant between the config and code sides - I viewed the check in code and the final check and the config entry a convenience to indicate to a configuring user that an option isn't available. If there's a prevailing standard in U-Boot to treat the configuration as pristine or otherwise not want the redundancy, I wouldn't have an issue removing the double-check in code. Looks good to me otherwise. Have you had a chance to test mSATA? Yes, I added a brief overview to the cover letter - I tested on a ClearFog Base and verified that the CON3 setting does in fact enable SATA, detect the drive, and both U-Boot and Linux have access to the block device. Strictly speaking I only tested CON3 and not CON2, but both run identical parallel paths. Joel
[PATCH v5 09/12] arm: mvebu: enable working default boot support
With the move to driver model usage, ensure that the required driver support for SPI and MMC booting is available in SPL. Tested on SolidRun ClearFog devices. Signed-off-by: Joel Johnson --- v2 changes: - change "select" for ENV_IS_IN_X to "imply" to allow disabling the default env location and configuring a different one if desired - remove SPL_DM_GPIO from defconfig, only include if needed for MMC booting v3 changes: - none v4 changes: - none v5 changes: - none --- arch/arm/mach-mvebu/Kconfig | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index 161dee937f..32191e7157 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig @@ -235,9 +235,19 @@ choice config MVEBU_SPL_BOOT_DEVICE_SPI bool "SPI NOR flash" + imply ENV_IS_IN_SPI_FLASH + select SPL_DM_SPI + select SPL_MTD_SUPPORT + select SPL_SPI_FLASH_SUPPORT + select SPL_SPI_LOAD + select SPL_SPI_SUPPORT config MVEBU_SPL_BOOT_DEVICE_MMC bool "SDIO/MMC card" + imply ENV_IS_IN_MMC + # GPIO required for SD card presence detection line + select SPL_DM_GPIO + select SPL_DM_MMC select SPL_LIBDISK_SUPPORT config MVEBU_SPL_BOOT_DEVICE_SATA -- 2.20.1
[PATCH v5 11/12] arm: mvebu: clearfog: don't always use SPL MMC
Move MMC booting assuptions from defconfig to Kconfig which includes as needed based on dependent options. Signed-off-by: Joel Johnson --- v2 changes: - rebased on master to use Baruch's dynamic MMC/SD offset logic - update description, will revisit removal of CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC in separate future path if a more viable option is identified v3 changes: - none v4 changes: - none v5 changes: - none --- arch/arm/mach-mvebu/Kconfig | 1 + configs/clearfog_defconfig | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index 32191e7157..4b381a2936 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig @@ -249,6 +249,7 @@ config MVEBU_SPL_BOOT_DEVICE_MMC select SPL_DM_GPIO select SPL_DM_MMC select SPL_LIBDISK_SUPPORT + select SPL_MMC_SUPPORT config MVEBU_SPL_BOOT_DEVICE_SATA bool "SATA" diff --git a/configs/clearfog_defconfig b/configs/clearfog_defconfig index 6db8b8acf6..601b1997ed 100644 --- a/configs/clearfog_defconfig +++ b/configs/clearfog_defconfig @@ -10,7 +10,6 @@ CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_TARGET_CLEARFOG=y CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC=y CONFIG_DM_GPIO=y -CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_NR_DRAM_BANKS=2 CONFIG_SPL=y @@ -42,7 +41,6 @@ CONFIG_CMD_CACHE=y CONFIG_CMD_TIME=y # CONFIG_SPL_PARTITION_UUIDS is not set CONFIG_DEFAULT_DEVICE_TREE="armada-388-clearfog" -CONFIG_ENV_IS_IN_MMC=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SPL_OF_TRANSLATE=y CONFIG_AHCI_MVEBU=y -- 2.20.1
[PATCH v5 12/12] arm: mvebu: clearfog: Use Pro DT by default
Switch to explicitly using the Pro variant DT, which has been available since Linux 4.11. --- v4 changes: - new v5 changes: - none I separated out this change to the end of the series since it drew questioning on prior review. I'd still advocate for making the change, since especially with the additions of static variants and runtime detection, it becomes easier from within a booted kernel to identify the type and version of U-Boot image installed. Without making this change, it becomes less direct to determine an actual Pro vs. Base, vs old U-Boot image maybe supporting some hybrid variant configuration. Even in the Linux kernel adding of the Pro DTS, it is indicated that it was meant for backwards compatibility. Except for cases where checking is done directly against the product name from userspace, I don't see downsides even from a compatibility perspective for not making this change. In cases where checking *is* done from userspace, the broadening of the Clearfog product line would seem to mean that userspace checking should be flagged as needing to be udpated as well (or glob/regex matched as needed). Signed-off-by: Joel Johnson --- board/solidrun/clearfog/clearfog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c index 4170fd4775..c31cfcb242 100644 --- a/board/solidrun/clearfog/clearfog.c +++ b/board/solidrun/clearfog/clearfog.c @@ -238,7 +238,7 @@ int board_late_init(void) else if (IS_ENABLED(CONFIG_TARGET_CLEARFOG_BASE)) env_set("fdtfile", "armada-388-clearfog-base.dtb"); else - env_set("fdtfile", "armada-388-clearfog.dtb"); + env_set("fdtfile", "armada-388-clearfog-pro.dtb"); return 0; } -- 2.20.1
[PATCH v5 10/12] arm: mvebu: clearfog: move ENV params to Kconfig
Migrate the values for ENV_SIZE and ENV_OFFSET into board specific Kconfig defaults so they're more accessible for configuration. --- v2 changes: - none v3 changes: - none v4 changes: - none v5 changes: - none Signed-off-by: Joel Johnson --- board/solidrun/clearfog/Kconfig | 8 configs/clearfog_defconfig | 2 -- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/board/solidrun/clearfog/Kconfig b/board/solidrun/clearfog/Kconfig index ea9c419472..e8c3f53d84 100644 --- a/board/solidrun/clearfog/Kconfig +++ b/board/solidrun/clearfog/Kconfig @@ -39,6 +39,14 @@ config CLEARFOG_SFP_25GB SGMII connection (requires a supporting SFP). By default, transfer speed of 1.25 Gbps is used, suitable for a more common 1 Gbps SFP module. +config ENV_SIZE + hex "Environment Size" + default 0x1 + +config ENV_OFFSET + hex "Environment offset" + default 0xF + config ENV_SECT_SIZE hex "Environment Sector-Size" # Use SPI flash erase block size of 4 KiB diff --git a/configs/clearfog_defconfig b/configs/clearfog_defconfig index c938448c30..6db8b8acf6 100644 --- a/configs/clearfog_defconfig +++ b/configs/clearfog_defconfig @@ -9,8 +9,6 @@ CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_TARGET_CLEARFOG=y CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC=y -CONFIG_ENV_SIZE=0x1 -CONFIG_ENV_OFFSET=0xF CONFIG_DM_GPIO=y CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y -- 2.20.1
[PATCH v5 08/12] arm: mvebu: clearfog: add SPI offsets
Add reasonable default SPI offsets and ENV size when configured to boot from SPI flash. Signed-off-by: Joel Johnson --- v2 changes: - none v3 changes: - none v4 changes: - none v5 changes: - none There was some reasonable concern raised about duplicating config entries within a board specific config file rather than making board specific configurations within defconfig. This seems to offer a more board localized mechanism to provide platform defaults for core values. As mentioned in the review, this usage seems to match the Kconfig documented intended usage. As noted at https://www.kernel.org/doc/html/latest/kbuild/kconfig-language.html: "Default values are not limited to the menu entry where they are defined. This means the default can be defined somewhere else or be overridden by an earlier definition." Given that there is some dependency variability with these values I prefer keeping them as Kconfig values, but defer to maintainers. Notably, for the ENV values in this and a later commit, I'm using a pattern already in used several other board configs. --- board/solidrun/clearfog/Kconfig | 12 1 file changed, 12 insertions(+) diff --git a/board/solidrun/clearfog/Kconfig b/board/solidrun/clearfog/Kconfig index 44224d903d..ea9c419472 100644 --- a/board/solidrun/clearfog/Kconfig +++ b/board/solidrun/clearfog/Kconfig @@ -39,4 +39,16 @@ config CLEARFOG_SFP_25GB SGMII connection (requires a supporting SFP). By default, transfer speed of 1.25 Gbps is used, suitable for a more common 1 Gbps SFP module. +config ENV_SECT_SIZE + hex "Environment Sector-Size" + # Use SPI flash erase block size of 4 KiB + default 0x1000 if MVEBU_SPL_BOOT_DEVICE_SPI + # Use optimistic 64 KiB erase block, will vary between actual media + default 0x1 if MVEBU_SPL_BOOT_DEVICE_MMC + +config SYS_SPI_U_BOOT_OFFS + hex "address of u-boot payload in SPI flash" + default 0x2 + depends on MVEBU_SPL_BOOT_DEVICE_SPI + endmenu -- 2.20.1
[PATCH v5 07/12] arm: mvebu: clearfog: Unify DT selection paths
Unify the location of DT selection into board_late_init instead of split between detection and static configuration paths. --- v2 changes - newly added in V2 series based on run-time rebasing v3 changes - none v4 changes - separate change to explicit pro DT into separate commit v5 changes - none Signed-off-by: Joel Johnson --- board/solidrun/clearfog/clearfog.c | 2 ++ include/configs/clearfog.h | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c index f650e2b40e..4170fd4775 100644 --- a/board/solidrun/clearfog/clearfog.c +++ b/board/solidrun/clearfog/clearfog.c @@ -237,6 +237,8 @@ int board_late_init(void) env_set("fdtfile", "armada-385-clearfog-gtr-l8.dtb"); else if (IS_ENABLED(CONFIG_TARGET_CLEARFOG_BASE)) env_set("fdtfile", "armada-388-clearfog-base.dtb"); + else + env_set("fdtfile", "armada-388-clearfog.dtb"); return 0; } diff --git a/include/configs/clearfog.h b/include/configs/clearfog.h index 633187d86f..6ca0474461 100644 --- a/include/configs/clearfog.h +++ b/include/configs/clearfog.h @@ -134,7 +134,6 @@ #define CONFIG_EXTRA_ENV_SETTINGS \ RELOCATION_LIMITS_ENV_SETTINGS \ LOAD_ADDRESS_ENV_SETTINGS \ - "fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \ "console=ttyS0,115200\0" \ BOOTENV -- 2.20.1
[PATCH v5 05/12] arm: mvebu: clearfog: Add option for 2.5 Gbps SFP
While newer Linux kernels provide autoconfiguration of SFP, provide an option for setting in U-Boot Kconfig for use prior to booting. Signed-off-by: Joel Johnson --- v2 changes: - fixed help indentation v3 changes: - none v4 changes: - adjust static SerDes configuration at runtime instead of #ifdef v5 changes: - make independent of runtime detection --- board/solidrun/clearfog/Kconfig| 7 +++ board/solidrun/clearfog/clearfog.c | 5 + 2 files changed, 12 insertions(+) diff --git a/board/solidrun/clearfog/Kconfig b/board/solidrun/clearfog/Kconfig index 936d5918f8..c910e17093 100644 --- a/board/solidrun/clearfog/Kconfig +++ b/board/solidrun/clearfog/Kconfig @@ -15,4 +15,11 @@ config TARGET_CLEARFOG_BASE detection via additional EEPROM hardware. This option enables selecting the Base variant for older hardware revisions. +config CLEARFOG_SFP_25GB + bool "Enable 2.5 Gbps mode for SFP" + help + Set the SFP module connection to support 2.5 Gbps transfer speed for the + SGMII connection (requires a supporting SFP). By default, transfer speed + of 1.25 Gbps is used, suitable for a more common 1 Gbps SFP module. + endmenu diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c index c873d00905..064ce4e520 100644 --- a/board/solidrun/clearfog/clearfog.c +++ b/board/solidrun/clearfog/clearfog.c @@ -63,6 +63,11 @@ int hws_board_topology_load(struct serdes_map **serdes_map_array, u8 *count) { cf_read_tlv_data(); + /* Apply build configuration options before runtime configuration */ + if (IS_ENABLED(CONFIG_CLEARFOG_SFP_25GB)) + board_serdes_map[5].serdes_speed = SERDES_SPEED_3_125_GBPS; + + /* Apply runtime detection changes */ if (sr_product_is(_tlv_data, "Clearfog GTR")) { board_serdes_map[0].serdes_type = PEX0; board_serdes_map[0].serdes_speed = SERDES_SPEED_5_GBPS; -- 2.20.1
[PATCH v5 01/12] arm: mvebu: fix SerDes table alignment
Tested on Solidrun ClearFog Base. Table alignment was: | Lane # | Speed | Type | | 0| 3 | SATA0 | | 1| 0 | SGMII1 | | 2| 3 | SATA1 | | 3| 5 | USB3 HOST1 | | 4| 5 | USB3 HOST0 | | 5| 4 | SGMII2 | After the change, it's correctly aligned as: | Lane # | Speed | Type | | 0| 3 | SATA0 | | 1| 0 | SGMII1 | | 2| 5 | PCIe1 | | 3| 5 | USB3 HOST1 | | 4| 5 | PCIe2 | | 5| 0 | SGMII2 | Signed-off-by: Joel Johnson --- v2 changes - none v3 changes - none v4 changes - none v5 changes - none --- arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c b/arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c index 33e70569bc..66409a50c0 100644 --- a/arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c +++ b/arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c @@ -1366,16 +1366,16 @@ static void print_topology_details(const struct serdes_map *serdes_map, DEBUG_INIT_S("board SerDes lanes topology details:\n"); - DEBUG_INIT_S(" | Lane # | Speed | Type |\n"); + DEBUG_INIT_S(" | Lane # | Speed | Type |\n"); DEBUG_INIT_S(" \n"); for (lane_num = 0; lane_num < count; lane_num++) { if (serdes_map[lane_num].serdes_type == DEFAULT_SERDES) continue; DEBUG_INIT_S(" | "); DEBUG_INIT_D(hws_get_physical_serdes_num(lane_num), 1); - DEBUG_INIT_S("| "); + DEBUG_INIT_S("| "); DEBUG_INIT_D(serdes_map[lane_num].serdes_speed, 2); - DEBUG_INIT_S(" | "); + DEBUG_INIT_S(" | "); DEBUG_INIT_S((char *) serdes_type_to_string[serdes_map[lane_num]. serdes_type]); -- 2.20.1
[PATCH v5 06/12] arm: mvebu: clearfog: Add SATA mode flags
The mPCIe slots on ClearFog Pro and ClearFog Base may be alternately configured for SATA usage. Signed-off-by: Joel Johnson --- v2 changes: - fixed help indentation v3 changes: - none v4 changes: - adjust static SerDes configuration at runtime instead of #ifdef - add setting of swap_rx for SATA (as yet untested on hardware) v5 changes: - make independent of runtime detection --- board/solidrun/clearfog/Kconfig| 17 + board/solidrun/clearfog/clearfog.c | 15 +++ 2 files changed, 32 insertions(+) diff --git a/board/solidrun/clearfog/Kconfig b/board/solidrun/clearfog/Kconfig index c910e17093..44224d903d 100644 --- a/board/solidrun/clearfog/Kconfig +++ b/board/solidrun/clearfog/Kconfig @@ -15,6 +15,23 @@ config TARGET_CLEARFOG_BASE detection via additional EEPROM hardware. This option enables selecting the Base variant for older hardware revisions. +config CLEARFOG_CON3_SATA + bool "Use CON3 slot in SATA mode" + help + Use the CON3 port with SATA protocol instead of the default PCIe. + The ClearFog port allows usage of either mSATA or miniPCIe + modules, but the desired protocol must be configured at build + time since it affects the SerDes topology layout. + +config CLEARFOG_CON2_SATA + bool "Use CON2 slot in SATA mode" + depends on !TARGET_CLEARFOG_BASE + help + Use the CON2 port with SATA protocol instead of the default PCIe. + The ClearFog port allows usage of either mSATA or miniPCIe + modules, but the desired protocol must be configured at build + time since it affects the SerDes topology layout. + config CLEARFOG_SFP_25GB bool "Enable 2.5 Gbps mode for SFP" help diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c index 064ce4e520..f650e2b40e 100644 --- a/board/solidrun/clearfog/clearfog.c +++ b/board/solidrun/clearfog/clearfog.c @@ -67,6 +67,21 @@ int hws_board_topology_load(struct serdes_map **serdes_map_array, u8 *count) if (IS_ENABLED(CONFIG_CLEARFOG_SFP_25GB)) board_serdes_map[5].serdes_speed = SERDES_SPEED_3_125_GBPS; + if (IS_ENABLED(CONFIG_CLEARFOG_CON2_SATA) && + !IS_ENABLED(CONFIG_TARGET_CLEARFOG_BASE)) { + board_serdes_map[4].serdes_type = SATA2; + board_serdes_map[4].serdes_speed = SERDES_SPEED_3_GBPS; + board_serdes_map[4].serdes_mode = SERDES_DEFAULT_MODE; + board_serdes_map[4].swap_rx = 1; + } + + if (IS_ENABLED(CONFIG_CLEARFOG_CON3_SATA)) { + board_serdes_map[2].serdes_type = SATA1; + board_serdes_map[2].serdes_speed = SERDES_SPEED_3_GBPS; + board_serdes_map[2].serdes_mode = SERDES_DEFAULT_MODE; + board_serdes_map[2].swap_rx = 1; + } + /* Apply runtime detection changes */ if (sr_product_is(_tlv_data, "Clearfog GTR")) { board_serdes_map[0].serdes_type = PEX0; -- 2.20.1
[PATCH v5 02/12] arm: mvebu: solidrun: remove hardcoded DTS MAC address
Using a consistent hardcoded MAC address from the DTS file causes issues when using multiple devices on the same network segment. Instead rely on environment configuration or random generation. Signed-off-by: Joel Johnson --- v2 changes: - none v3 changes: - none v4 changes: - none v5 changes: - none --- arch/arm/dts/armada-38x-solidrun-microsom.dtsi | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm/dts/armada-38x-solidrun-microsom.dtsi b/arch/arm/dts/armada-38x-solidrun-microsom.dtsi index a322a28c21..9bbeafc53b 100644 --- a/arch/arm/dts/armada-38x-solidrun-microsom.dtsi +++ b/arch/arm/dts/armada-38x-solidrun-microsom.dtsi @@ -39,7 +39,6 @@ { /* ethernet@7 */ - mac-address = [00 50 43 02 02 01]; pinctrl-0 = <_rgmii_pins>; pinctrl-names = "default"; phy = <_dedicated>; -- 2.20.1
[PATCH v5 00/12] ClearFog Base static variant support
This patch series adds support for ClearFog Base static configuration, as well as updating and fixing the ClearFog support for MMC and SPI booting. v2 changes: - updated against, and dependent on, https://patchwork.ozlabs.org/cover/1200324 v3 changes: - rebased against ClearFog runtime TLV EEPROM changes merged into mvebu/master v4 - adjust static SerDes configuration at runtime instead of #ifdef v5 - distinguish build-only config changes (SFP and PCIe/SATA) from runtime detectable config changes - retested SATA mode in PCIe slot with swap rx changes, confirmed working as presently patched. Only tested with ClearFog Base which only provides single channel, but Pro mechanism is parallel. Joel Johnson (12): arm: mvebu: fix SerDes table alignment arm: mvebu: solidrun: remove hardcoded DTS MAC address arm: mvebu: clearfog: use Pro name by default arm: mvebu: clearfog: initial ClearFog Base variant arm: mvebu: clearfog: Add option for 2.5 Gbps SFP arm: mvebu: clearfog: Add SATA mode flags arm: mvebu: clearfog: Unify DT selection paths arm: mvebu: clearfog: add SPI offsets arm: mvebu: enable working default boot support arm: mvebu: clearfog: move ENV params to Kconfig arm: mvebu: clearfog: don't always use SPL MMC arm: mvebu: clearfog: Use Pro DT by default .../arm/dts/armada-38x-solidrun-microsom.dtsi | 1 - arch/arm/mach-mvebu/Kconfig | 13 .../serdes/a38x/high_speed_env_spec.c | 6 +- board/solidrun/clearfog/Kconfig | 62 +++ board/solidrun/clearfog/clearfog.c| 53 +--- configs/clearfog_defconfig| 4 -- include/configs/clearfog.h| 1 - 7 files changed, 124 insertions(+), 16 deletions(-) create mode 100644 board/solidrun/clearfog/Kconfig -- 2.20.1
[PATCH v5 04/12] arm: mvebu: clearfog: initial ClearFog Base variant
Add a unique entry for ClearFog Base variant, reflected in the board name and adjusted SerDes topology. Signed-off-by: Joel Johnson --- v2 changes: - reworked based on Baruch's run-time TLV EEPROM detection series v3 changes: - rebased on mvebu merged run-time TLV EEPROM detection series - minor update to help test regarding runtime detection failures v4 changes: - use runtime static config adjust instead of #ifdef in cases where hardware EEPROM detection fails or is disabled in build SPL size change for defconfig increases 36 bytes (122893 to 122929) SPL size change for defconfig+Base increases 60 bytes (122893 to 122953) - add placeholder support for EEPROM based Clearfog Pro, based on initial name confirmation from Baruch. I wanted to include the check at least in the patch for review to indicate expected usage to ensure that a Clearfog Pro EEPROM device boots correctly even if the image is built with Base static configuration. If there are other prerelease concerns and this should be added separately later, I'd be fine with that too. - Note that this approach *does not* currently provide any mechanism for EEPROM detected boards to have their SFP speed changed or switch between PCIE/SATA signalling. I'm assuming that will be done based on hardware detection, but confirmation/acceptance in review would be appreciated so it can be revisited if needed. v5 changes: - only make Base variant adjustment based on runtime configuration --- arch/arm/mach-mvebu/Kconfig| 2 ++ board/solidrun/clearfog/Kconfig| 18 ++ board/solidrun/clearfog/clearfog.c | 29 +++-- 3 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 board/solidrun/clearfog/Kconfig diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index bc5eaa5a76..161dee937f 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig @@ -280,4 +280,6 @@ config SECURED_MODE_CSK_INDEX default 0 depends on SECURED_MODE_IMAGE +source "board/solidrun/clearfog/Kconfig" + endif diff --git a/board/solidrun/clearfog/Kconfig b/board/solidrun/clearfog/Kconfig new file mode 100644 index 00..936d5918f8 --- /dev/null +++ b/board/solidrun/clearfog/Kconfig @@ -0,0 +1,18 @@ +menu "ClearFog configuration" + depends on TARGET_CLEARFOG + +config TARGET_CLEARFOG_BASE + bool "Use ClearFog Base static configuration" + help + Use the ClearFog Base as the static configuration instead of the + default which uses the ClearFog Pro. + + Runtime board detection is always attempted and used if available. The + static configuration is used as a fallback in cases where runtime + detection is disabled, is not available in hardware, or otherwise fails. + + Only newer revisions of the ClearFog product line support runtime + detection via additional EEPROM hardware. This option enables selecting + the Base variant for older hardware revisions. + +endmenu diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c index 9b31902c70..c873d00905 100644 --- a/board/solidrun/clearfog/clearfog.c +++ b/board/solidrun/clearfog/clearfog.c @@ -42,6 +42,7 @@ static void cf_read_tlv_data(void) read_tlv_data(_tlv_data); } +/* The starting board_serdes_map reflects original Clearfog Pro usage */ static struct serdes_map board_serdes_map[] = { {SATA0, SERDES_SPEED_3_GBPS, SERDES_DEFAULT_MODE, 0, 0}, {SGMII1, SERDES_SPEED_1_25_GBPS, SERDES_DEFAULT_MODE, 0, 0}, @@ -51,6 +52,13 @@ static struct serdes_map board_serdes_map[] = { {SGMII2, SERDES_SPEED_1_25_GBPS, SERDES_DEFAULT_MODE, 0, 0}, }; +void config_cfbase_serdes_map(void) +{ + board_serdes_map[4].serdes_type = USB3_HOST0; + board_serdes_map[4].serdes_speed = SERDES_SPEED_5_GBPS; + board_serdes_map[4].serdes_mode = SERDES_DEFAULT_MODE; +} + int hws_board_topology_load(struct serdes_map **serdes_map_array, u8 *count) { cf_read_tlv_data(); @@ -59,12 +67,17 @@ int hws_board_topology_load(struct serdes_map **serdes_map_array, u8 *count) board_serdes_map[0].serdes_type = PEX0; board_serdes_map[0].serdes_speed = SERDES_SPEED_5_GBPS; board_serdes_map[0].serdes_mode = PEX_ROOT_COMPLEX_X1; - } - - if (sr_product_is(_tlv_data, "Clearfog Base")) { - board_serdes_map[4].serdes_type = USB3_HOST0; - board_serdes_map[4].serdes_speed = SERDES_SPEED_5_GBPS; - board_serdes_map[4].serdes_mode = SERDES_DEFAULT_MODE; + } else if (sr_product_is(_tlv_data, "Clearfog Pro")) { + /* handle recognized product as noop, no adjustment required */ + } else if (sr_product_is(_tlv_data, "Clearfog Base")) { +
[PATCH v5 03/12] arm: mvebu: clearfog: use Pro name by default
Make the board version printed indicate the Pro variant default. Also adjust static name casing to match what is expected for EEPROM product name to share string constants. --- v4 changes: - newly added v5 changes: - none Signed-off-by: Joel Johnson --- board/solidrun/clearfog/clearfog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c index e268ef55a2..9b31902c70 100644 --- a/board/solidrun/clearfog/clearfog.c +++ b/board/solidrun/clearfog/clearfog.c @@ -170,7 +170,7 @@ int board_init(void) int checkboard(void) { - char *board = "ClearFog"; + char *board = "Clearfog Pro"; cf_read_tlv_data(); if (strlen(cf_tlv_data.tlv_product_name[0]) > 0) -- 2.20.1
Re: [PATCH v4 06/12] arm: mvebu: clearfog: Add option for 2.5 Gbps SFP
On 2020-01-27 09:27, Joel Johnson wrote: On 2020-01-27 00:20, Baruch Siach wrote: Hi Joel, On Mon, Jan 27 2020, Joel Johnson wrote: On 2020-01-26 22:29, Baruch Siach wrote: On Mon, Jan 27 2020, Joel Johnson wrote: While newer Linux kernels provide autoconfiguration of SFP, provide an option for setting in U-Boot Kconfig for use prior to booting. Signed-off-by: Joel Johnson --- v2 changes: - fixed help indentation v3 changes: - none v4 changes: - adjust static SerDes configuration at runtime instead of #ifdef --- board/solidrun/clearfog/Kconfig| 7 +++ board/solidrun/clearfog/clearfog.c | 3 +++ 2 files changed, 10 insertions(+) diff --git a/board/solidrun/clearfog/Kconfig b/board/solidrun/clearfog/Kconfig index 936d5918f8..c910e17093 100644 --- a/board/solidrun/clearfog/Kconfig +++ b/board/solidrun/clearfog/Kconfig @@ -15,4 +15,11 @@ config TARGET_CLEARFOG_BASE detection via additional EEPROM hardware. This option enables selecting the Base variant for older hardware revisions. +config CLEARFOG_SFP_25GB + bool "Enable 2.5 Gbps mode for SFP" + help + Set the SFP module connection to support 2.5 Gbps transfer speed for the + SGMII connection (requires a supporting SFP). By default, transfer speed + of 1.25 Gbps is used, suitable for a more common 1 Gbps SFP module. + endmenu diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c index 4019e37016..6c5b9a784f 100644 --- a/board/solidrun/clearfog/clearfog.c +++ b/board/solidrun/clearfog/clearfog.c @@ -59,6 +59,9 @@ void config_static_serdes_map(void) board_serdes_map[4].serdes_speed = SERDES_SPEED_5_GBPS; board_serdes_map[4].serdes_mode = SERDES_DEFAULT_MODE; } + + if (IS_ENABLED(CONFIG_CLEARFOG_SFP_25GB)) + board_serdes_map[5].serdes_speed = SERDES_SPEED_3_125_GBPS; config_static_serdes_map() is not called only when TLV EEPROM is present. So CONFIG_CLEARFOG_SFP_25GB has no effect in that case. This code should move to hws_board_topology_load() to avoid that. Yeah, that's what I was trying to ask with the question below embedded in patch 4. "Note that this approach *does not* currently provide any mechanism for EEPROM detected boards to have their SFP speed changed or switch between PCIE/SATA signalling. I'm assuming that will be done based on hardware detection, but confirmation/acceptance in review would be appreciated so it can be revisited if needed. After sending the series and thinking about it more, I didn't see any other mechanism by which the configuration would be changed. The question was really to confirm what I had inferred from code, namely that Pro/Base boards even with EEPROM would still have to have a U-Boot built with custom options in order to change the PCIe/SATA or SFP options. I would like to confirm with you that is desired and expected even in the cases of EEPROM supporting units. If that's the case, I'll rework the location of setting, along with updating the help text for those options. Pending your confirmation, I plan to get rid of the separate config_static_serdes_map function and fold it back in, with the SATA and SFP options coming before the board runtime detection configuration. My thinking is that EEPROM TLV is only meant to describe the hardware as manufactured, and never change. SATA (read mSATA) and SFP are user setup that TLV can't cover. So I think that SATA and SFP build time selection should apply regardless of TLV. In theory it could have been even better to store SATA/SFP selection in environment variables. But that is not currently possible, since serdes configuration takes place at SPL phase where the environment is not accessible. baruch Yeah, that makes sense and as I thought further on it is the only logical option based at least on what's currently exposed for runtime detction. I'll send out the updated series with this change and a few code style cleanups after completing the SATA testing, hopefully later today. Any other items pending for this series? I think it's in good shape, pending any further thoughts or discussion on the Pro DT by default change. Joel While SATA testing is pending, I'm including the updated resulting board/solidrun/clearfog/clearfog.c snippet (without patch separations) for review on the updated approach. I recognize that the final "Clearfog Base" and static IS_ENABLED check take the same path and could be combined, but I prefer to keep them separate to highlight and distinguish between the runtime detection and fallback cases. Joel void config_cfbase_serdes_map(void) { board_serdes_map[4].serdes_type = USB3_HOST0; board_serdes_map[4].serdes_speed = SERDES_SPEED_5_GBPS; board_serdes_map[4].serdes_mode = SERDES_DEFAULT_MODE; } int hws_board_topology_load(struct serdes_map **serdes_map_array, u8 *count) {
Re: [PATCH v4 06/12] arm: mvebu: clearfog: Add option for 2.5 Gbps SFP
On 2020-01-27 00:20, Baruch Siach wrote: Hi Joel, On Mon, Jan 27 2020, Joel Johnson wrote: On 2020-01-26 22:29, Baruch Siach wrote: On Mon, Jan 27 2020, Joel Johnson wrote: While newer Linux kernels provide autoconfiguration of SFP, provide an option for setting in U-Boot Kconfig for use prior to booting. Signed-off-by: Joel Johnson --- v2 changes: - fixed help indentation v3 changes: - none v4 changes: - adjust static SerDes configuration at runtime instead of #ifdef --- board/solidrun/clearfog/Kconfig| 7 +++ board/solidrun/clearfog/clearfog.c | 3 +++ 2 files changed, 10 insertions(+) diff --git a/board/solidrun/clearfog/Kconfig b/board/solidrun/clearfog/Kconfig index 936d5918f8..c910e17093 100644 --- a/board/solidrun/clearfog/Kconfig +++ b/board/solidrun/clearfog/Kconfig @@ -15,4 +15,11 @@ config TARGET_CLEARFOG_BASE detection via additional EEPROM hardware. This option enables selecting the Base variant for older hardware revisions. +config CLEARFOG_SFP_25GB + bool "Enable 2.5 Gbps mode for SFP" + help + Set the SFP module connection to support 2.5 Gbps transfer speed for the + SGMII connection (requires a supporting SFP). By default, transfer speed + of 1.25 Gbps is used, suitable for a more common 1 Gbps SFP module. + endmenu diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c index 4019e37016..6c5b9a784f 100644 --- a/board/solidrun/clearfog/clearfog.c +++ b/board/solidrun/clearfog/clearfog.c @@ -59,6 +59,9 @@ void config_static_serdes_map(void) board_serdes_map[4].serdes_speed = SERDES_SPEED_5_GBPS; board_serdes_map[4].serdes_mode = SERDES_DEFAULT_MODE; } + + if (IS_ENABLED(CONFIG_CLEARFOG_SFP_25GB)) + board_serdes_map[5].serdes_speed = SERDES_SPEED_3_125_GBPS; config_static_serdes_map() is not called only when TLV EEPROM is present. So CONFIG_CLEARFOG_SFP_25GB has no effect in that case. This code should move to hws_board_topology_load() to avoid that. Yeah, that's what I was trying to ask with the question below embedded in patch 4. "Note that this approach *does not* currently provide any mechanism for EEPROM detected boards to have their SFP speed changed or switch between PCIE/SATA signalling. I'm assuming that will be done based on hardware detection, but confirmation/acceptance in review would be appreciated so it can be revisited if needed. After sending the series and thinking about it more, I didn't see any other mechanism by which the configuration would be changed. The question was really to confirm what I had inferred from code, namely that Pro/Base boards even with EEPROM would still have to have a U-Boot built with custom options in order to change the PCIe/SATA or SFP options. I would like to confirm with you that is desired and expected even in the cases of EEPROM supporting units. If that's the case, I'll rework the location of setting, along with updating the help text for those options. Pending your confirmation, I plan to get rid of the separate config_static_serdes_map function and fold it back in, with the SATA and SFP options coming before the board runtime detection configuration. My thinking is that EEPROM TLV is only meant to describe the hardware as manufactured, and never change. SATA (read mSATA) and SFP are user setup that TLV can't cover. So I think that SATA and SFP build time selection should apply regardless of TLV. In theory it could have been even better to store SATA/SFP selection in environment variables. But that is not currently possible, since serdes configuration takes place at SPL phase where the environment is not accessible. baruch Yeah, that makes sense and as I thought further on it is the only logical option based at least on what's currently exposed for runtime detction. I'll send out the updated series with this change and a few code style cleanups after completing the SATA testing, hopefully later today. Any other items pending for this series? I think it's in good shape, pending any further thoughts or discussion on the Pro DT by default change. Joel
[PATCH 1/4] cmd: mvebu: bubt: add A38x support
Add support for Armada 38x devices in bubt flashing utility. This is based on (and streamlined from) the support in the SolidRun master-a38x vendor fork branch. Signed-off-by: Joel Johnson --- cmd/mvebu/bubt.c | 69 +++- 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index 2041a7a29a..d399fb6da4 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -85,7 +85,29 @@ struct mvebu_image_info { u32 encrypt_start_offset; u32 encrypt_size; }; -#endif /* CONFIG_ARMADA_XXX */ +#elif defined(CONFIG_ARMADA_38X) /* A38X */ + +/* Structure of the main header, version 1 (Armada 370/38x/XP) */ +struct a38x_main_hdr_v1 { + u8 blockid; /* 0x0 */ + u8 flags; /* 0x1 */ + u16 reserved2; /* 0x2-0x3 */ + u32 blocksize; /* 0x4-0x7 */ + u8 version; /* 0x8 */ + u8 headersz_msb; /* 0x9 */ + u16 headersz_lsb; /* 0xA-0xB */ + u32 srcaddr; /* 0xC-0xF */ + u32 destaddr; /* 0x10-0x13 */ + u32 execaddr; /* 0x14-0x17 */ + u8 options; /* 0x18 */ + u8 nandblocksize; /* 0x19 */ + u8 nandbadblklocation;/* 0x1A */ + u8 reserved4; /* 0x1B */ + u16 reserved5; /* 0x1C-0x1D */ + u8 ext; /* 0x1E */ + u8 checksum; /* 0x1F */ +}; +#endif struct bubt_dev { char name[8]; @@ -621,7 +643,52 @@ static int check_image_header(void) return 0; } +#elif defined(CONFIG_ARMADA_38X) +static size_t a38x_header_size(const struct a38x_main_hdr_v1 *h) +{ + if (h->version == 1) + return (h->headersz_msb << 16) | le16_to_cpu(h->headersz_lsb); + + printf("Error: Invalid A38x image (header version 0x%x unknown)!\n", + h->version); + return 0; +} + +static uint8_t image_checksum8(const void *start, size_t len) +{ + u8 csum = 0; + const u8 *p = start; + + while (len) { + csum += *p; + ++p; + --len; + } + + return csum; +} +static int check_image_header(void) +{ + u8 checksum; + const struct a38x_main_hdr_v1 *hdr = + (struct a38x_main_hdr_v1 *)get_load_addr(); + const size_t image_size = a38x_header_size(hdr); + + if (!image_size) + return -ENOEXEC; + + checksum = image_checksum8(hdr, image_size); + checksum -= hdr->checksum; + if (checksum != hdr->checksum) { + printf("Error: Bad A38x image checksum. 0x%x != 0x%x\n", + checksum, hdr->checksum); + return -ENOEXEC; + } + + printf("Image checksum...OK!\n"); + return 0; +} #else /* Not ARMADA? */ static int check_image_header(void) { -- 2.20.1
[PATCH 3/4] cmd: mvebu: bubt: verify A38x target device type
Ensure that the device to which an image is being written includes header information indicating boot support for the destination device. This is derived from the support in the SolidRun master-a38x vendor fork branch. Signed-off-by: Joel Johnson --- cmd/mvebu/bubt.c | 49 ++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index b80b81c82a..78061a6a2d 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -107,6 +107,26 @@ struct a38x_main_hdr_v1 { u8 ext; /* 0x1E */ u8 checksum; /* 0x1F */ }; + +#define A38X_BOOT_MODE_MAX 8 + +struct a38x_boot_mode { + unsigned int id; + const char *name; +}; + +/* The blockid header field values used to indicate boot device of image */ +struct a38x_boot_mode a38x_boot_modes[A38X_BOOT_MODE_MAX] = { + { 0x4D, "i2c" }, + { 0x5A, "spi" }, + { 0x69, "uart" }, + { 0x78, "sata" }, + { 0x8B, "nand" }, + { 0x9C, "pex" }, + { 0xAE, "mmc" }, + {}, +}; + #endif struct bubt_dev { @@ -644,6 +664,23 @@ static int check_image_header(void) return 0; } #elif defined(CONFIG_ARMADA_38X) +static int a38x_check_boot_mode(const struct bubt_dev *dst) +{ + int mode; + const struct a38x_main_hdr_v1 *hdr = + (struct a38x_main_hdr_v1 *)get_load_addr(); + + for (mode = 0; mode < A38X_BOOT_MODE_MAX; mode++) { + if (strcmp(a38x_boot_modes[mode].name, dst->name) == 0) + break; + } + + if (a38x_boot_modes[mode].id == hdr->blockid) + return 0; + + return -ENOEXEC; +} + static size_t a38x_header_size(const struct a38x_main_hdr_v1 *h) { if (h->version == 1) @@ -697,7 +734,7 @@ static int check_image_header(void) } #endif -static int bubt_verify(size_t image_size) +static int bubt_verify(const struct bubt_dev *dst) { int err; @@ -708,6 +745,14 @@ static int bubt_verify(size_t image_size) return err; } +#if defined(CONFIG_ARMADA_38X) + err = a38x_check_boot_mode(dst); + if (err) { + puts("Error: image not built for destination device!\n"); + return err; + } +#endif + return 0; } @@ -829,7 +874,7 @@ int do_bubt_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (!image_size) return -EIO; - err = bubt_verify(image_size); + err = bubt_verify(dst); if (err) return err; -- 2.20.1
[PATCH 2/4] cmd: mvebu: bubt: correct U-Boot spelling
Replace "U-BOOT" text with correct spelling Signed-off-by: Joel Johnson --- cmd/mvebu/bubt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index d399fb6da4..b80b81c82a 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -346,7 +346,7 @@ static int nand_burn_image(size_t image_size) /* Align U-Boot size to currently used blocksize */ image_size = ((image_size + (block_size - 1)) & (~(block_size - 1))); - /* Erase the U-BOOT image space */ + /* Erase the U-Boot image space */ printf("Erasing 0x%x - 0x%x:...", 0, (int)image_size); ret = nand_erase(mtd, 0, image_size); if (ret) { @@ -734,7 +734,7 @@ static int bubt_read_file(struct bubt_dev *src) static int bubt_is_dev_active(struct bubt_dev *dev) { if (!dev->active) { - printf("Device \"%s\" not supported by U-BOOT image\n", + printf("Device \"%s\" not supported by U-Boot image\n", dev->name); return 0; } @@ -822,7 +822,7 @@ int do_bubt_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (!bubt_is_dev_active(src)) return -ENODEV; - printf("Burning U-BOOT image \"%s\" from \"%s\" to \"%s\"\n", + printf("Burning U-Boot image \"%s\" from \"%s\" to \"%s\"\n", net_boot_file_name, src->name, dst->name); image_size = bubt_read_file(src); -- 2.20.1
[PATCH 4/4] arm: mvebu: clearfog: enable bubt command
With support added for Armada 38x, include the bubt command in ClearFog defconfig. Signed-off-by: Joel Johnson --- configs/clearfog_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/clearfog_defconfig b/configs/clearfog_defconfig index c938448c30..0d7e19e731 100644 --- a/configs/clearfog_defconfig +++ b/configs/clearfog_defconfig @@ -35,6 +35,7 @@ CONFIG_SPL_CMD_TLV_EEPROM=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y +CONFIG_CMD_MVEBU_BUBT=y CONFIG_CMD_PCI=y CONFIG_CMD_SPI=y CONFIG_CMD_USB=y -- 2.20.1
Re: [PATCH v4 06/12] arm: mvebu: clearfog: Add option for 2.5 Gbps SFP
On 2020-01-26 22:29, Baruch Siach wrote: Hi Joel, On Mon, Jan 27 2020, Joel Johnson wrote: While newer Linux kernels provide autoconfiguration of SFP, provide an option for setting in U-Boot Kconfig for use prior to booting. Signed-off-by: Joel Johnson --- v2 changes: - fixed help indentation v3 changes: - none v4 changes: - adjust static SerDes configuration at runtime instead of #ifdef --- board/solidrun/clearfog/Kconfig| 7 +++ board/solidrun/clearfog/clearfog.c | 3 +++ 2 files changed, 10 insertions(+) diff --git a/board/solidrun/clearfog/Kconfig b/board/solidrun/clearfog/Kconfig index 936d5918f8..c910e17093 100644 --- a/board/solidrun/clearfog/Kconfig +++ b/board/solidrun/clearfog/Kconfig @@ -15,4 +15,11 @@ config TARGET_CLEARFOG_BASE detection via additional EEPROM hardware. This option enables selecting the Base variant for older hardware revisions. +config CLEARFOG_SFP_25GB + bool "Enable 2.5 Gbps mode for SFP" + help + Set the SFP module connection to support 2.5 Gbps transfer speed for the + SGMII connection (requires a supporting SFP). By default, transfer speed + of 1.25 Gbps is used, suitable for a more common 1 Gbps SFP module. + endmenu diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c index 4019e37016..6c5b9a784f 100644 --- a/board/solidrun/clearfog/clearfog.c +++ b/board/solidrun/clearfog/clearfog.c @@ -59,6 +59,9 @@ void config_static_serdes_map(void) board_serdes_map[4].serdes_speed = SERDES_SPEED_5_GBPS; board_serdes_map[4].serdes_mode = SERDES_DEFAULT_MODE; } + + if (IS_ENABLED(CONFIG_CLEARFOG_SFP_25GB)) + board_serdes_map[5].serdes_speed = SERDES_SPEED_3_125_GBPS; config_static_serdes_map() is not called only when TLV EEPROM is present. So CONFIG_CLEARFOG_SFP_25GB has no effect in that case. This code should move to hws_board_topology_load() to avoid that. Yeah, that's what I was trying to ask with the question below embedded in patch 4. "Note that this approach *does not* currently provide any mechanism for EEPROM detected boards to have their SFP speed changed or switch between PCIE/SATA signalling. I'm assuming that will be done based on hardware detection, but confirmation/acceptance in review would be appreciated so it can be revisited if needed. After sending the series and thinking about it more, I didn't see any other mechanism by which the configuration would be changed. The question was really to confirm what I had inferred from code, namely that Pro/Base boards even with EEPROM would still have to have a U-Boot built with custom options in order to change the PCIe/SATA or SFP options. I would like to confirm with you that is desired and expected even in the cases of EEPROM supporting units. If that's the case, I'll rework the location of setting, along with updating the help text for those options. Pending your confirmation, I plan to get rid of the separate config_static_serdes_map function and fold it back in, with the SATA and SFP options coming before the board runtime detection configuration. Joel
[PATCH v4 12/12] arm: mvebu: clearfog: Use Pro DT by default
Switch to explicitly using the Pro variant DT, which has been available since Linux 4.11. --- I separated out this change to the end of the series since it drew questioning on prior review. I'd still advocate for making the change, since especially with the additions of static variants and runtime detection, it becomes easier from within a booted kernel to identify the type and version of U-Boot image installed. Without making this change, it becomes less direct to determine an actual Pro vs. Base, vs old U-Boot image maybe supporting some hybrid variant configuration. Even in the Linux kernel adding of the Pro DTS, it is indicated that it was meant for backwards compatibility. Except for cases where checking is done directly against the product name from userspace, I don't see downsides even from a compatibility perspective for not making this change. In cases where checking *is* done from userspace, the broadening of the Clearfog product line would seem to mean that userspace checking should be flagged as needing to be udpated as well (or glob/regex matched as needed). Signed-off-by: Joel Johnson --- board/solidrun/clearfog/clearfog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c index 3867855aff..31b279d365 100644 --- a/board/solidrun/clearfog/clearfog.c +++ b/board/solidrun/clearfog/clearfog.c @@ -235,7 +235,7 @@ int board_late_init(void) else if (IS_ENABLED(CONFIG_TARGET_CLEARFOG_BASE)) env_set("fdtfile", "armada-388-clearfog-base.dtb"); else - env_set("fdtfile", "armada-388-clearfog.dtb"); + env_set("fdtfile", "armada-388-clearfog-pro.dtb"); return 0; } -- 2.20.1
[PATCH v4 11/12] arm: mvebu: clearfog: Add SATA mode flags
The mPCIe slots on ClearFog Pro and ClearFog Base may be alternately configured for SATA usage. Signed-off-by: Joel Johnson --- v2 changes: - fixed help indentation v3 changes: - none v4 changes: - adjust static SerDes configuration at runtime instead of #ifdef - add setting of swap_rx for SATA (as yet untested on hardware) Baruch, thanks for the pointer on the swap_rx flags. I've added them here based on your input, my drives for testing are in another office so I won't be able to do final testing on the updated series for another day or so. --- board/solidrun/clearfog/Kconfig| 17 + board/solidrun/clearfog/clearfog.c | 12 2 files changed, 29 insertions(+) diff --git a/board/solidrun/clearfog/Kconfig b/board/solidrun/clearfog/Kconfig index fbaeed1a4f..e8c3f53d84 100644 --- a/board/solidrun/clearfog/Kconfig +++ b/board/solidrun/clearfog/Kconfig @@ -15,6 +15,23 @@ config TARGET_CLEARFOG_BASE detection via additional EEPROM hardware. This option enables selecting the Base variant for older hardware revisions. +config CLEARFOG_CON3_SATA + bool "Use CON3 slot in SATA mode" + help + Use the CON3 port with SATA protocol instead of the default PCIe. + The ClearFog port allows usage of either mSATA or miniPCIe + modules, but the desired protocol must be configured at build + time since it affects the SerDes topology layout. + +config CLEARFOG_CON2_SATA + bool "Use CON2 slot in SATA mode" + depends on !TARGET_CLEARFOG_BASE + help + Use the CON2 port with SATA protocol instead of the default PCIe. + The ClearFog port allows usage of either mSATA or miniPCIe + modules, but the desired protocol must be configured at build + time since it affects the SerDes topology layout. + config CLEARFOG_SFP_25GB bool "Enable 2.5 Gbps mode for SFP" help diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c index 6c5b9a784f..3867855aff 100644 --- a/board/solidrun/clearfog/clearfog.c +++ b/board/solidrun/clearfog/clearfog.c @@ -58,6 +58,18 @@ void config_static_serdes_map(void) board_serdes_map[4].serdes_type = USB3_HOST0; board_serdes_map[4].serdes_speed = SERDES_SPEED_5_GBPS; board_serdes_map[4].serdes_mode = SERDES_DEFAULT_MODE; + } else if (IS_ENABLED(CONFIG_CLEARFOG_CON2_SATA)) { + board_serdes_map[4].serdes_type = SATA2; + board_serdes_map[4].serdes_speed = SERDES_SPEED_3_GBPS; + board_serdes_map[4].serdes_mode = SERDES_DEFAULT_MODE; + board_serdes_map[4].swap_rx = 1; + } + + if (IS_ENABLED(CONFIG_CLEARFOG_CON3_SATA)) { + board_serdes_map[2].serdes_type = SATA1; + board_serdes_map[2].serdes_speed = SERDES_SPEED_3_GBPS; + board_serdes_map[2].serdes_mode = SERDES_DEFAULT_MODE; + board_serdes_map[2].swap_rx = 1; } if (IS_ENABLED(CONFIG_CLEARFOG_SFP_25GB)) -- 2.20.1
[PATCH v4 05/12] arm: mvebu: clearfog: Unify DT selection paths
Unify the location of DT selection into board_late_init instead of split between detection and static configuration paths. --- v2 changes - newly added in V2 series based on run-time rebasing v3 changes - none v4 changes - separate change to explicit pro DT into separate commit Signed-off-by: Joel Johnson --- board/solidrun/clearfog/clearfog.c | 2 ++ include/configs/clearfog.h | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c index 04238d2b05..4019e37016 100644 --- a/board/solidrun/clearfog/clearfog.c +++ b/board/solidrun/clearfog/clearfog.c @@ -219,6 +219,8 @@ int board_late_init(void) env_set("fdtfile", "armada-385-clearfog-gtr-l8.dtb"); else if (IS_ENABLED(CONFIG_TARGET_CLEARFOG_BASE)) env_set("fdtfile", "armada-388-clearfog-base.dtb"); + else + env_set("fdtfile", "armada-388-clearfog.dtb"); return 0; } diff --git a/include/configs/clearfog.h b/include/configs/clearfog.h index 633187d86f..6ca0474461 100644 --- a/include/configs/clearfog.h +++ b/include/configs/clearfog.h @@ -134,7 +134,6 @@ #define CONFIG_EXTRA_ENV_SETTINGS \ RELOCATION_LIMITS_ENV_SETTINGS \ LOAD_ADDRESS_ENV_SETTINGS \ - "fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \ "console=ttyS0,115200\0" \ BOOTENV -- 2.20.1
[PATCH v4 10/12] arm: mvebu: clearfog: don't always use SPL MMC
Move MMC booting assuptions from defconfig to Kconfig which includes as needed based on dependent options. Signed-off-by: Joel Johnson --- v2 changes: - rebased on master to use Baruch's dynamic MMC/SD offset logic - update description, will revisit removal of CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC in separate future path if a more viable option is identified v3 changes: - none v4 changes: - none --- arch/arm/mach-mvebu/Kconfig | 1 + configs/clearfog_defconfig | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index 32191e7157..4b381a2936 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig @@ -249,6 +249,7 @@ config MVEBU_SPL_BOOT_DEVICE_MMC select SPL_DM_GPIO select SPL_DM_MMC select SPL_LIBDISK_SUPPORT + select SPL_MMC_SUPPORT config MVEBU_SPL_BOOT_DEVICE_SATA bool "SATA" diff --git a/configs/clearfog_defconfig b/configs/clearfog_defconfig index 6db8b8acf6..601b1997ed 100644 --- a/configs/clearfog_defconfig +++ b/configs/clearfog_defconfig @@ -10,7 +10,6 @@ CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_TARGET_CLEARFOG=y CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC=y CONFIG_DM_GPIO=y -CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_NR_DRAM_BANKS=2 CONFIG_SPL=y @@ -42,7 +41,6 @@ CONFIG_CMD_CACHE=y CONFIG_CMD_TIME=y # CONFIG_SPL_PARTITION_UUIDS is not set CONFIG_DEFAULT_DEVICE_TREE="armada-388-clearfog" -CONFIG_ENV_IS_IN_MMC=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SPL_OF_TRANSLATE=y CONFIG_AHCI_MVEBU=y -- 2.20.1
[PATCH v4 02/12] arm: mvebu: solidrun: remove hardcoded DTS MAC address
Using a consistent hardcoded MAC address from the DTS file causes issues when using multiple devices on the same network segment. Instead rely on environment configuration or random generation. Signed-off-by: Joel Johnson --- v2 changes: - none v3 changes: - none v4 changes: - none --- arch/arm/dts/armada-38x-solidrun-microsom.dtsi | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm/dts/armada-38x-solidrun-microsom.dtsi b/arch/arm/dts/armada-38x-solidrun-microsom.dtsi index a322a28c21..9bbeafc53b 100644 --- a/arch/arm/dts/armada-38x-solidrun-microsom.dtsi +++ b/arch/arm/dts/armada-38x-solidrun-microsom.dtsi @@ -39,7 +39,6 @@ { /* ethernet@7 */ - mac-address = [00 50 43 02 02 01]; pinctrl-0 = <_rgmii_pins>; pinctrl-names = "default"; phy = <_dedicated>; -- 2.20.1
[PATCH v4 09/12] arm: mvebu: clearfog: move ENV params to Kconfig
Migrate the values for ENV_SIZE and ENV_OFFSET into board specific Kconfig defaults so they're more accessible for configuration. --- v2 changes: - none v3 changes: - none v4 changes: - none Signed-off-by: Joel Johnson --- board/solidrun/clearfog/Kconfig | 8 configs/clearfog_defconfig | 2 -- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/board/solidrun/clearfog/Kconfig b/board/solidrun/clearfog/Kconfig index d3209d9b8e..fbaeed1a4f 100644 --- a/board/solidrun/clearfog/Kconfig +++ b/board/solidrun/clearfog/Kconfig @@ -22,6 +22,14 @@ config CLEARFOG_SFP_25GB SGMII connection (requires a supporting SFP). By default, transfer speed of 1.25 Gbps is used, suitable for a more common 1 Gbps SFP module. +config ENV_SIZE + hex "Environment Size" + default 0x1 + +config ENV_OFFSET + hex "Environment offset" + default 0xF + config ENV_SECT_SIZE hex "Environment Sector-Size" # Use SPI flash erase block size of 4 KiB diff --git a/configs/clearfog_defconfig b/configs/clearfog_defconfig index c938448c30..6db8b8acf6 100644 --- a/configs/clearfog_defconfig +++ b/configs/clearfog_defconfig @@ -9,8 +9,6 @@ CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_TARGET_CLEARFOG=y CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC=y -CONFIG_ENV_SIZE=0x1 -CONFIG_ENV_OFFSET=0xF CONFIG_DM_GPIO=y CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y -- 2.20.1
[PATCH v4 00/12] ClearFog Base static variant support
This patch series adds support for ClearFog Base static configuration, as well as updating and fixing the ClearFog support for MMC and SPI booting. v2 changes: - updated against, and dependent on, https://patchwork.ozlabs.org/cover/1200324 v3 changes: - rebased against ClearFog runtime TLV EEPROM changes merged into mvebu/master v4 - adjust static SerDes configuration at runtime instead of #ifdef Joel Johnson (12): arm: mvebu: fix SerDes table alignment arm: mvebu: solidrun: remove hardcoded DTS MAC address arm: mvebu: clearfog: use Pro name by default arm: mvebu: clearfog: initial ClearFog Base variant arm: mvebu: clearfog: Unify DT selection paths arm: mvebu: clearfog: Add option for 2.5 Gbps SFP arm: mvebu: clearfog: add SPI offsets arm: mvebu: enable working default boot support arm: mvebu: clearfog: move ENV params to Kconfig arm: mvebu: clearfog: don't always use SPL MMC arm: mvebu: clearfog: Add SATA mode flags arm: mvebu: clearfog: Use Pro DT by default .../arm/dts/armada-38x-solidrun-microsom.dtsi | 1 - arch/arm/mach-mvebu/Kconfig | 13 .../serdes/a38x/high_speed_env_spec.c | 6 +- board/solidrun/clearfog/Kconfig | 62 +++ board/solidrun/clearfog/clearfog.c| 44 +++-- configs/clearfog_defconfig| 4 -- include/configs/clearfog.h| 1 - 7 files changed, 118 insertions(+), 13 deletions(-) create mode 100644 board/solidrun/clearfog/Kconfig -- 2.20.1
[PATCH v4 06/12] arm: mvebu: clearfog: Add option for 2.5 Gbps SFP
While newer Linux kernels provide autoconfiguration of SFP, provide an option for setting in U-Boot Kconfig for use prior to booting. Signed-off-by: Joel Johnson --- v2 changes: - fixed help indentation v3 changes: - none v4 changes: - adjust static SerDes configuration at runtime instead of #ifdef --- board/solidrun/clearfog/Kconfig| 7 +++ board/solidrun/clearfog/clearfog.c | 3 +++ 2 files changed, 10 insertions(+) diff --git a/board/solidrun/clearfog/Kconfig b/board/solidrun/clearfog/Kconfig index 936d5918f8..c910e17093 100644 --- a/board/solidrun/clearfog/Kconfig +++ b/board/solidrun/clearfog/Kconfig @@ -15,4 +15,11 @@ config TARGET_CLEARFOG_BASE detection via additional EEPROM hardware. This option enables selecting the Base variant for older hardware revisions. +config CLEARFOG_SFP_25GB + bool "Enable 2.5 Gbps mode for SFP" + help + Set the SFP module connection to support 2.5 Gbps transfer speed for the + SGMII connection (requires a supporting SFP). By default, transfer speed + of 1.25 Gbps is used, suitable for a more common 1 Gbps SFP module. + endmenu diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c index 4019e37016..6c5b9a784f 100644 --- a/board/solidrun/clearfog/clearfog.c +++ b/board/solidrun/clearfog/clearfog.c @@ -59,6 +59,9 @@ void config_static_serdes_map(void) board_serdes_map[4].serdes_speed = SERDES_SPEED_5_GBPS; board_serdes_map[4].serdes_mode = SERDES_DEFAULT_MODE; } + + if (IS_ENABLED(CONFIG_CLEARFOG_SFP_25GB)) + board_serdes_map[5].serdes_speed = SERDES_SPEED_3_125_GBPS; } int hws_board_topology_load(struct serdes_map **serdes_map_array, u8 *count) -- 2.20.1
[PATCH v4 07/12] arm: mvebu: clearfog: add SPI offsets
Add reasonable default SPI offsets and ENV size when configured to boot from SPI flash. Signed-off-by: Joel Johnson --- v2 changes: - none v3 changes: - none v4 changes: - none There was some reasonable concern raised about duplicating config entries within a board specific config file rather than making board specific configurations within defconfig. This seems to offer a more board localized mechanism to provide platform defaults for core values. As mentioned in the review, this usage seems to match the Kconfig documented intended usage. As noted at https://www.kernel.org/doc/html/latest/kbuild/kconfig-language.html: "Default values are not limited to the menu entry where they are defined. This means the default can be defined somewhere else or be overridden by an earlier definition." Given that there is some dependency variability with these values I prefer keeping them as Kconfig values, but defer to maintainers. Notably, for the ENV values in this and a later commit, I'm using a pattern already in used several other board configs. --- board/solidrun/clearfog/Kconfig | 12 1 file changed, 12 insertions(+) diff --git a/board/solidrun/clearfog/Kconfig b/board/solidrun/clearfog/Kconfig index c910e17093..d3209d9b8e 100644 --- a/board/solidrun/clearfog/Kconfig +++ b/board/solidrun/clearfog/Kconfig @@ -22,4 +22,16 @@ config CLEARFOG_SFP_25GB SGMII connection (requires a supporting SFP). By default, transfer speed of 1.25 Gbps is used, suitable for a more common 1 Gbps SFP module. +config ENV_SECT_SIZE + hex "Environment Sector-Size" + # Use SPI flash erase block size of 4 KiB + default 0x1000 if MVEBU_SPL_BOOT_DEVICE_SPI + # Use optimistic 64 KiB erase block, will vary between actual media + default 0x1 if MVEBU_SPL_BOOT_DEVICE_MMC + +config SYS_SPI_U_BOOT_OFFS + hex "address of u-boot payload in SPI flash" + default 0x2 + depends on MVEBU_SPL_BOOT_DEVICE_SPI + endmenu -- 2.20.1
[PATCH v4 03/12] arm: mvebu: clearfog: use Pro name by default
Make the board version printed indicate the Pro variant default. Also adjust static name casing to match what is expected for EEPROM product name to share string constants. --- Baruch - can you confirm expected/desired branding casing? The SolidRun website and prior to this commit uses "ClearFog", however the EEPROM checked values use "Clearfog", so I changed to match to be able to use the same string constant values for consistency. Signed-off-by: Joel Johnson --- board/solidrun/clearfog/clearfog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c index e268ef55a2..9b31902c70 100644 --- a/board/solidrun/clearfog/clearfog.c +++ b/board/solidrun/clearfog/clearfog.c @@ -170,7 +170,7 @@ int board_init(void) int checkboard(void) { - char *board = "ClearFog"; + char *board = "Clearfog Pro"; cf_read_tlv_data(); if (strlen(cf_tlv_data.tlv_product_name[0]) > 0) -- 2.20.1
[PATCH v4 04/12] arm: mvebu: clearfog: initial ClearFog Base variant
Add a unique entry for ClearFog Base variant, reflected in the board name and adjusted SerDes topology. Signed-off-by: Joel Johnson --- v2 changes: - reworked based on Baruch's run-time TLV EEPROM detection series v3 changes: - rebased on mvebu merged run-time TLV EEPROM detection series - minor update to help test regarding runtime detection failures v4 changes: - use runtime static config adjust instead of #ifdef in cases where hardware EEPROM detection fails or is disabled in build SPL size change for defconfig increases 36 bytes (122893 to 122929) SPL size change for defconfig+Base increases 60 bytes (122893 to 122953) - add placeholder support for EEPROM based Clearfog Pro, based on initial name confirmation from Baruch. I wanted to include the check at least in the patch for review to indicate expected usage to ensure that a Clearfog Pro EEPROM device boots correctly even if the image is built with Base static configuration. If there are other prerelease concerns and this should be added separately later, I'd be fine with that too. - Note that this approach *does not* currently provide any mechanism for EEPROM detected boards to have their SFP speed changed or switch between PCIE/SATA signalling. I'm assuming that will be done based on hardware detection, but confirmation/acceptance in review would be appreciated so it can be revisited if needed. --- arch/arm/mach-mvebu/Kconfig| 2 ++ board/solidrun/clearfog/Kconfig| 18 ++ board/solidrun/clearfog/clearfog.c | 25 ++--- 3 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 board/solidrun/clearfog/Kconfig diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index bc5eaa5a76..161dee937f 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig @@ -280,4 +280,6 @@ config SECURED_MODE_CSK_INDEX default 0 depends on SECURED_MODE_IMAGE +source "board/solidrun/clearfog/Kconfig" + endif diff --git a/board/solidrun/clearfog/Kconfig b/board/solidrun/clearfog/Kconfig new file mode 100644 index 00..936d5918f8 --- /dev/null +++ b/board/solidrun/clearfog/Kconfig @@ -0,0 +1,18 @@ +menu "ClearFog configuration" + depends on TARGET_CLEARFOG + +config TARGET_CLEARFOG_BASE + bool "Use ClearFog Base static configuration" + help + Use the ClearFog Base as the static configuration instead of the + default which uses the ClearFog Pro. + + Runtime board detection is always attempted and used if available. The + static configuration is used as a fallback in cases where runtime + detection is disabled, is not available in hardware, or otherwise fails. + + Only newer revisions of the ClearFog product line support runtime + detection via additional EEPROM hardware. This option enables selecting + the Base variant for older hardware revisions. + +endmenu diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c index 9b31902c70..04238d2b05 100644 --- a/board/solidrun/clearfog/clearfog.c +++ b/board/solidrun/clearfog/clearfog.c @@ -42,6 +42,7 @@ static void cf_read_tlv_data(void) read_tlv_data(_tlv_data); } +/* The starting board_serdes_map reflects original Clearfog Pro usage */ static struct serdes_map board_serdes_map[] = { {SATA0, SERDES_SPEED_3_GBPS, SERDES_DEFAULT_MODE, 0, 0}, {SGMII1, SERDES_SPEED_1_25_GBPS, SERDES_DEFAULT_MODE, 0, 0}, @@ -51,6 +52,15 @@ static struct serdes_map board_serdes_map[] = { {SGMII2, SERDES_SPEED_1_25_GBPS, SERDES_DEFAULT_MODE, 0, 0}, }; +void config_static_serdes_map(void) +{ + if (IS_ENABLED(CONFIG_TARGET_CLEARFOG_BASE)) { + board_serdes_map[4].serdes_type = USB3_HOST0; + board_serdes_map[4].serdes_speed = SERDES_SPEED_5_GBPS; + board_serdes_map[4].serdes_mode = SERDES_DEFAULT_MODE; + } +} + int hws_board_topology_load(struct serdes_map **serdes_map_array, u8 *count) { cf_read_tlv_data(); @@ -59,12 +69,17 @@ int hws_board_topology_load(struct serdes_map **serdes_map_array, u8 *count) board_serdes_map[0].serdes_type = PEX0; board_serdes_map[0].serdes_speed = SERDES_SPEED_5_GBPS; board_serdes_map[0].serdes_mode = PEX_ROOT_COMPLEX_X1; - } - - if (sr_product_is(_tlv_data, "Clearfog Base")) { + } else if (sr_product_is(_tlv_data, "Clearfog Pro")) { + /* handle recognized product as noop, no adjustment required */ + } else if (sr_product_is(_tlv_data, "Clearfog Base")) { board_serdes_map[4].serdes_type = USB3_HOST0; board_serdes_map[4].serdes_speed = SERDES_SPEED_5_GBPS; board_serdes_map[4].serdes_mode = SERDES_DEFAULT_MODE; + } else { +
[PATCH v4 08/12] arm: mvebu: enable working default boot support
With the move to driver model usage, ensure that the required driver support for SPI and MMC booting is available in SPL. Tested on SolidRun ClearFog devices. Signed-off-by: Joel Johnson --- v2 changes: - change "select" for ENV_IS_IN_X to "imply" to allow disabling the default env location and configuring a different one if desired - remove SPL_DM_GPIO from defconfig, only include if needed for MMC booting v3 changes: - none v4 changes: - none --- arch/arm/mach-mvebu/Kconfig | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index 161dee937f..32191e7157 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig @@ -235,9 +235,19 @@ choice config MVEBU_SPL_BOOT_DEVICE_SPI bool "SPI NOR flash" + imply ENV_IS_IN_SPI_FLASH + select SPL_DM_SPI + select SPL_MTD_SUPPORT + select SPL_SPI_FLASH_SUPPORT + select SPL_SPI_LOAD + select SPL_SPI_SUPPORT config MVEBU_SPL_BOOT_DEVICE_MMC bool "SDIO/MMC card" + imply ENV_IS_IN_MMC + # GPIO required for SD card presence detection line + select SPL_DM_GPIO + select SPL_DM_MMC select SPL_LIBDISK_SUPPORT config MVEBU_SPL_BOOT_DEVICE_SATA -- 2.20.1
[PATCH v4 01/12] arm: mvebu: fix SerDes table alignment
Tested on Solidrun ClearFog Base. Table alignment was: | Lane # | Speed | Type | | 0| 3 | SATA0 | | 1| 0 | SGMII1 | | 2| 3 | SATA1 | | 3| 5 | USB3 HOST1 | | 4| 5 | USB3 HOST0 | | 5| 4 | SGMII2 | After the change, it's correctly aligned as: | Lane # | Speed | Type | | 0| 3 | SATA0 | | 1| 0 | SGMII1 | | 2| 5 | PCIe1 | | 3| 5 | USB3 HOST1 | | 4| 5 | PCIe2 | | 5| 0 | SGMII2 | Signed-off-by: Joel Johnson --- v2 changes - none v3 changes - none v4 changes - none --- arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c b/arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c index 33e70569bc..66409a50c0 100644 --- a/arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c +++ b/arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c @@ -1366,16 +1366,16 @@ static void print_topology_details(const struct serdes_map *serdes_map, DEBUG_INIT_S("board SerDes lanes topology details:\n"); - DEBUG_INIT_S(" | Lane # | Speed | Type |\n"); + DEBUG_INIT_S(" | Lane # | Speed | Type |\n"); DEBUG_INIT_S(" \n"); for (lane_num = 0; lane_num < count; lane_num++) { if (serdes_map[lane_num].serdes_type == DEFAULT_SERDES) continue; DEBUG_INIT_S(" | "); DEBUG_INIT_D(hws_get_physical_serdes_num(lane_num), 1); - DEBUG_INIT_S("| "); + DEBUG_INIT_S("| "); DEBUG_INIT_D(serdes_map[lane_num].serdes_speed, 2); - DEBUG_INIT_S(" | "); + DEBUG_INIT_S(" | "); DEBUG_INIT_S((char *) serdes_type_to_string[serdes_map[lane_num]. serdes_type]); -- 2.20.1
Re: [PATCH 2/2] Revert "common: add blkcache init"
Thanks for the quick response and update! Joel On 2020-01-26 11:34, Angelo Dureghello wrote: Hi Joel, Tom and all, just sent a fix, you can check it here: https://patchwork.ozlabs.org/project/uboot/list/?series=155358 Sorry again, Regards, Angelo On Sun, Jan 26, 2020 at 5:49 PM Joel Johnson wrote: This reverts commit 1526bcce0f7285087621e16e6720636d01839da8. The commit causes boot failure using MMC environment for Marvell A38x (tested with SolidRun Clearfog). The boot hangs after the following message is printed to console: Loading Environment from MMC... Other than bisecting to identify the problematic commit I haven't tested further to determine a better possible fix to be compatible with both A38x and m68k. Signed-off-by: Joel Johnson --- common/board_r.c | 3 --- drivers/block/blkcache.c | 9 + include/blk.h| 6 -- 3 files changed, 1 insertion(+), 17 deletions(-) diff --git a/common/board_r.c b/common/board_r.c index 4f56c19fcc..8a0c1114e7 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -864,9 +864,6 @@ static init_fnc_t init_sequence_r[] = { #endif #if defined(CONFIG_PRAM) initr_mem, -#endif -#ifdef CONFIG_BLOCK_CACHE - blkcache_init, #endif run_main_loop, }; diff --git a/drivers/block/blkcache.c b/drivers/block/blkcache.c index f603aa129d..1fa64989d3 100644 --- a/drivers/block/blkcache.c +++ b/drivers/block/blkcache.c @@ -21,20 +21,13 @@ struct block_cache_node { char *cache; }; -static struct list_head block_cache; +static LIST_HEAD(block_cache); static struct block_cache_stats _stats = { .max_blocks_per_entry = 8, .max_entries = 32 }; -int blkcache_init(void) -{ - INIT_LIST_HEAD(_cache); - - return 0; -} - static struct block_cache_node *cache_find(int iftype, int devnum, lbaint_t start, lbaint_t blkcnt, unsigned long blksz) diff --git a/include/blk.h b/include/blk.h index 6f541bb2ba..ccc66e6a20 100644 --- a/include/blk.h +++ b/include/blk.h @@ -113,12 +113,6 @@ struct blk_desc { (PAD_SIZE(size, blk_desc->blksz)) #if CONFIG_IS_ENABLED(BLOCK_CACHE) - -/** - * blkcache_init() - initialize the block cache list pointers - */ -int blkcache_init(void); - /** * blkcache_read() - attempt to read a set of blocks from cache * -- 2.20.1
[PATCH 1/2] arm: mvebu: fix A38x breakage from commit bb872dd930cc
This function parameter usage of load_addr was incorrectly caught in the clarifying renames of commit bb872dd930cc, which results in boot failures on Marvell A38x. Signed-off-by: Joel Johnson Patch-to: Simon Glass --- drivers/ddr/marvell/a38x/ddr3_training_ip_engine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ddr/marvell/a38x/ddr3_training_ip_engine.c b/drivers/ddr/marvell/a38x/ddr3_training_ip_engine.c index 9293d54e5a..1eababeebd 100644 --- a/drivers/ddr/marvell/a38x/ddr3_training_ip_engine.c +++ b/drivers/ddr/marvell/a38x/ddr3_training_ip_engine.c @@ -615,7 +615,7 @@ int ddr3_tip_load_pattern_to_odpg(u32 dev_num, enum hws_access_type access_type, CHECK_STATUS(ddr3_tip_if_write(dev_num, access_type, if_id, ODPG_DATA_BUFFER_OFFS_REG, - image_load_addr, MASK_ALL_BITS)); + load_addr, MASK_ALL_BITS)); return MV_OK; } -- 2.20.1
[PATCH 2/2] Revert "common: add blkcache init"
This reverts commit 1526bcce0f7285087621e16e6720636d01839da8. The commit causes boot failure using MMC environment for Marvell A38x (tested with SolidRun Clearfog). The boot hangs after the following message is printed to console: Loading Environment from MMC... Other than bisecting to identify the problematic commit I haven't tested further to determine a better possible fix to be compatible with both A38x and m68k. Signed-off-by: Joel Johnson --- common/board_r.c | 3 --- drivers/block/blkcache.c | 9 + include/blk.h| 6 -- 3 files changed, 1 insertion(+), 17 deletions(-) diff --git a/common/board_r.c b/common/board_r.c index 4f56c19fcc..8a0c1114e7 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -864,9 +864,6 @@ static init_fnc_t init_sequence_r[] = { #endif #if defined(CONFIG_PRAM) initr_mem, -#endif -#ifdef CONFIG_BLOCK_CACHE - blkcache_init, #endif run_main_loop, }; diff --git a/drivers/block/blkcache.c b/drivers/block/blkcache.c index f603aa129d..1fa64989d3 100644 --- a/drivers/block/blkcache.c +++ b/drivers/block/blkcache.c @@ -21,20 +21,13 @@ struct block_cache_node { char *cache; }; -static struct list_head block_cache; +static LIST_HEAD(block_cache); static struct block_cache_stats _stats = { .max_blocks_per_entry = 8, .max_entries = 32 }; -int blkcache_init(void) -{ - INIT_LIST_HEAD(_cache); - - return 0; -} - static struct block_cache_node *cache_find(int iftype, int devnum, lbaint_t start, lbaint_t blkcnt, unsigned long blksz) diff --git a/include/blk.h b/include/blk.h index 6f541bb2ba..ccc66e6a20 100644 --- a/include/blk.h +++ b/include/blk.h @@ -113,12 +113,6 @@ struct blk_desc { (PAD_SIZE(size, blk_desc->blksz)) #if CONFIG_IS_ENABLED(BLOCK_CACHE) - -/** - * blkcache_init() - initialize the block cache list pointers - */ -int blkcache_init(void); - /** * blkcache_read() - attempt to read a set of blocks from cache * -- 2.20.1