CONFIG_AUTOBOOT_KEYED_CTRLC default yes?
Hi, I have a pi4 running u-boot 2019.01. When I use the following config options ``` CONFIG_AUTOBOOT=y # CONFIG_AUTOBOOT_KEYED is not set ``` CTRL-C would continue to interrupt autoboot. Was quite surprised to see that. Took a look at the code. https://github.com/u-boot/u-boot/blob/master/common/autoboot.c#L367-L375 ``` lock = IS_ENABLED(CONFIG_AUTOBOOT_KEYED) && !IS_ENABLED(CONFIG_AUTOBOOT_KEYED_CTRLC); if (lock) prev = disable_ctrlc(1); /* disable Ctrl-C checking */ ``` So if `CONFIG_AUTOBOOT_KEYED=y` and `CONFIG_AUTOBOOT_KEYED_CTRLC=N`, then disable ctrl-c checking. That means if we disable `CONFIG_AUTOBOOT_KEYED`, we can still end up with ctrl-c checking? Why is Ctrl-C checking default ON instead of being enabled only when `CONFIG_AUTOBOOT_KEYED_CTRLC=y` Am I missing something here? Thanks ZubairLK
Re: [U-Boot] rpi: bcm2835_sdhost: occasional errors while writing
On Mon, Feb 25, 2019 at 10:43 AM Zubair Lutfullah Kakakhel wrote: > > Hi, > > I've encountered occasional glitches while writing to the sd card > via u-boot(2018.07) on a Pi 3 B+. The goal is to write the bootcount > in the boot partition. As a test, this is the loop I used to read, display > contents, write to the same file over and over again. > > ``` > mw 20 0 > while itest *20 == 0 ; do > fatload mmc 0:1 $kernel_addr_r resin-image > md $kernel_addr_r 18 > fatwrite mmc 0:1 $kernel_addr_r resin-image 18 > echo === done > done > ``` > resin-image is a file in the boot partition that has some text in it. > > After a few minutes of this loop running, I 'sometimes' get this error > and the sd card stops working > > ``` > writing resin-image > wait_transfer_complete - still waiting after 11 retries > mmc write failed > Error: flush fat buffer > > ** Unable to write "resin-image" from mmc 0:1 ** > WARNING at > /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:376/bcm2835_prepare_data()! > WARNING at > /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! > WARNING at > /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! > WARNING at > /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! > WARNING at > /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! > WARNING at > /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! > ** Can't read partition table on 0:0 ** > ** Invalid partition 1 ** > 0008: 4e204f44 5220544f 564f4d45 48542045DO NOT REMOVE TH > 00080010: 46205349 0a454c49 0f030f03 0f030f03IS FILE. > 00080020: 0f030f03 0f030f03 01600103 03030300..`. > 00080030: 03030303 03030303 03030303 03030303 > 00080040: 03030303 03030303 03030303 03034103.A.. > 00080050: 03030303 03030303 03030303 03030303 > WARNING at > /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! > WARNING at > /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! > WARNING at > /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! > WARNING at > /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! > WARNING at > /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! > WARNING at > /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! > ** Can't read partition table on 0:0 ** > ** Invalid partition 1 ** > ``` > > What is even more concerning is that the device can't boot. Even if a > write failed. > Subsequent reads seem to fail as well. > > ``` > U-Boot> mmc part > > Partition Map for MMC device 0 -- Partition Type: DOS > > PartStart SectorNum Sectors UUIDType > WARNING at > /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! > WARNING at > /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! > WARNING at > /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! > WARNING at > /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-pok
[U-Boot] rpi: bcm2835_sdhost: occasional errors while writing
Hi, I've encountered occasional glitches while writing to the sd card via u-boot(2018.07) on a Pi 3 B+. The goal is to write the bootcount in the boot partition. As a test, this is the loop I used to read, display contents, write to the same file over and over again. ``` mw 20 0 while itest *20 == 0 ; do fatload mmc 0:1 $kernel_addr_r resin-image md $kernel_addr_r 18 fatwrite mmc 0:1 $kernel_addr_r resin-image 18 echo === done done ``` resin-image is a file in the boot partition that has some text in it. After a few minutes of this loop running, I 'sometimes' get this error and the sd card stops working ``` writing resin-image wait_transfer_complete - still waiting after 11 retries mmc write failed Error: flush fat buffer ** Unable to write "resin-image" from mmc 0:1 ** WARNING at /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:376/bcm2835_prepare_data()! WARNING at /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! WARNING at /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! WARNING at /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! WARNING at /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! WARNING at /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! ** Can't read partition table on 0:0 ** ** Invalid partition 1 ** 0008: 4e204f44 5220544f 564f4d45 48542045DO NOT REMOVE TH 00080010: 46205349 0a454c49 0f030f03 0f030f03IS FILE. 00080020: 0f030f03 0f030f03 01600103 03030300..`. 00080030: 03030303 03030303 03030303 03030303 00080040: 03030303 03030303 03030303 03034103.A.. 00080050: 03030303 03030303 03030303 03030303 WARNING at /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! WARNING at /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! WARNING at /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! WARNING at /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! WARNING at /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! WARNING at /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! ** Can't read partition table on 0:0 ** ** Invalid partition 1 ** ``` What is even more concerning is that the device can't boot. Even if a write failed. Subsequent reads seem to fail as well. ``` U-Boot> mmc part Partition Map for MMC device 0 -- Partition Type: DOS PartStart SectorNum Sectors UUIDType WARNING at /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! WARNING at /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! WARNING at /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! WARNING at /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! WARNING at /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! WARNING at /home/zubairlk/resin/yocto/resin-raspberrypi3/build/tmp/work/raspberrypi3-poky-linux-gnueabi/u-boot/1_2018.07-r0/git/drivers/mmc/bcm2835_sdhost.c:408/bcm2835_send_command()! ** Can't read partition table on
[U-Boot] [PATCH] hashtable: Fix length calculation in hexport_r
The length returned by hexport_r has a few redundant characters. This appears as NULL characters at the end so seems harmless. Remove the surplus counts in two places totlen += strlen(ep->key) + 2; I'm guessing the +2 here is for = and sep char. But there is another totlen += 2; line that does that. size = totletn + 1; Doesn't make sense and isn't justified with any comment. Signed-off-by: Zubair Lutfullah Kakakhel --- lib/hashtable.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/hashtable.c b/lib/hashtable.c index 52aab6d..64faa63 100644 --- a/lib/hashtable.c +++ b/lib/hashtable.c @@ -622,7 +622,7 @@ ssize_t hexport_r(struct hsearch_data *htab, const char sep, int flag, list[n++] = ep; - totlen += strlen(ep->key) + 2; + totlen += strlen(ep->key); if (sep == '\0') { totlen += strlen(ep->data); @@ -662,7 +662,7 @@ ssize_t hexport_r(struct hsearch_data *htab, const char sep, int flag, return (-1); } } else { - size = totlen + 1; + size = totlen; } /* Check if the user provided a buffer */ -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] MIPS: bootm: Fix broken boot_env_legacy codepath
This patch fixes 2 bugs introduced by the following commit 2bb5b63 MIPS: bootm: rework and fix broken bootm code The CONFIG_IS_ENABLED macro prepends 'CONFIG_' Hence, remove CONFIG_ from CONFIG_MIPS_BOOT_ENV_LEGACY usage. Also, 2bb5b63 reworks bootm so that linux_env_legacy runs before linux_cmdline_legacy. However, linux_env_legacy depends on linux_cmdline_legacy running first as linux_cmdline_init initialilzes linux_argp which linux_env_legacy later depends on during its initialization. Reorder the code so that linux_cmdline_legacy runs before linux_env_legacy. Signed-off-by: Zubair Lutfullah Kakakhel <zubair.kakak...@imgtec.com> --- Found this while working on SEAD3 u-boot patches (which are not upstream yet) --- arch/mips/lib/bootm.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index be87762..2b67905 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -279,17 +279,17 @@ static void boot_prep_linux(bootm_headers_t *images) boot_reloc_fdt(images); boot_setup_fdt(images); } else { - if (CONFIG_IS_ENABLED(CONFIG_MIPS_BOOT_ENV_LEGACY)) - linux_env_legacy(images); - if (CONFIG_IS_ENABLED(MIPS_BOOT_CMDLINE_LEGACY)) { linux_cmdline_legacy(images); - if (!CONFIG_IS_ENABLED(CONFIG_MIPS_BOOT_ENV_LEGACY)) + if (!CONFIG_IS_ENABLED(MIPS_BOOT_ENV_LEGACY)) linux_cmdline_append(images); linux_cmdline_dump(); } + + if (CONFIG_IS_ENABLED(MIPS_BOOT_ENV_LEGACY)) + linux_env_legacy(images); } } -- 2.10.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [RFC v2] bootm: fix passing argc to standalone apps
Hi, comments at end On 09/19/2016 01:57 AM, Simon Glass wrote: On 9 September 2016 at 02:18, Zubair Lutfullah Kakakhel <zubair.kakak...@imgtec.com> wrote: This bug appears in b6396403 which makes u-boot unable to pass arguments via bootm to a standalone application without this patch. Steps to reproduce. Compile a u-boot. Use mkimage to package the standalone hello_world.bin file. e.g. For the MIPS Boston platform mkimage -n "hello" -A mips -O u-boot -C none -T standalone \ -a 0x8020 -d hello_world.bin \ -ep 0x8020 hello_out Then tftp hello_out and run it using boston # dhcp 192.168.154.45:hello_out ... boston # bootm $loadaddr 123 321 Without the patch the following output is observed. boston # bootm $loadaddr 123 321 Image Name: hello Image Type: MIPS U-Boot Standalone Program (uncompressed) Data Size:1240 Bytes = 1.2 KiB Load Address: 8020 Entry Point: 8020 Verifying Checksum ... OK Loading Standalone Program ... OK Example expects ABI version 8 Actual U-Boot ABI version 8 Hello World argc = 0 argv[0] = "0x8800" With the patch, you see the following. boston # bootm $loadaddr 123 321 Image Name: hello Image Type: MIPS U-Boot Standalone Program (uncompressed) Data Size:1240 Bytes = 1.2 KiB Load Address: 8020 Entry Point: 8020 Verifying Checksum ... OK Loading Standalone Program ... OK Example expects ABI version 8 Actual U-Boot ABI version 8 Hello World argc = 3 argv[0] = "0x8800" argv[1] = "123" argv[2] = "321" argv[3] = "" Without the patch, the go command at the entry point seems to work. boston # go 0x8020 123 321 Example expects ABI version 8 Actual U-Boot ABI version 8 Hello World argc = 3 argv[0] = "0x8020" argv[1] = "123" argv[2] = "321" argv[3] = "" Hit any key to exit ... Signed-off-by: Zubair Lutfullah Kakakhel <zubair.kakak...@imgtec.com> --- Tested on the MIPS Boston platform. --- common/bootm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/common/bootm.c b/common/bootm.c index e6da551..a26ada4 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -602,10 +602,8 @@ int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[], if (!ret && (states & BOOTM_STATE_FINDOS)) ret = bootm_find_os(cmdtp, flag, argc, argv); - if (!ret && (states & BOOTM_STATE_FINDOTHER)) { + if (!ret && (states & BOOTM_STATE_FINDOTHER)) ret = bootm_find_other(cmdtp, flag, argc, argv); - argc = 0; /* consume the args */ - } /* Load the OS */ if (!ret && (states & BOOTM_STATE_LOADOS)) { -- 1.9.1 Reviewed-by: Simon Glass <s...@chromium.org> Thanks for the review. Can this be applied as is or do I need to send it again without the RFC and as a Patch? Regards, ZubairLK ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [RFC v2] bootm: fix passing argc to standalone apps
This bug appears in b6396403 which makes u-boot unable to pass arguments via bootm to a standalone application without this patch. Steps to reproduce. Compile a u-boot. Use mkimage to package the standalone hello_world.bin file. e.g. For the MIPS Boston platform mkimage -n "hello" -A mips -O u-boot -C none -T standalone \ -a 0x8020 -d hello_world.bin \ -ep 0x8020 hello_out Then tftp hello_out and run it using boston # dhcp 192.168.154.45:hello_out ... boston # bootm $loadaddr 123 321 Without the patch the following output is observed. boston # bootm $loadaddr 123 321 Image Name: hello Image Type: MIPS U-Boot Standalone Program (uncompressed) Data Size:1240 Bytes = 1.2 KiB Load Address: 8020 Entry Point: 8020 Verifying Checksum ... OK Loading Standalone Program ... OK Example expects ABI version 8 Actual U-Boot ABI version 8 Hello World argc = 0 argv[0] = "0x8800" With the patch, you see the following. boston # bootm $loadaddr 123 321 Image Name: hello Image Type: MIPS U-Boot Standalone Program (uncompressed) Data Size:1240 Bytes = 1.2 KiB Load Address: 8020 Entry Point: 8020 Verifying Checksum ... OK Loading Standalone Program ... OK Example expects ABI version 8 Actual U-Boot ABI version 8 Hello World argc = 3 argv[0] = "0x8800" argv[1] = "123" argv[2] = "321" argv[3] = "" Without the patch, the go command at the entry point seems to work. boston # go 0x8020 123 321 Example expects ABI version 8 Actual U-Boot ABI version 8 Hello World argc = 3 argv[0] = "0x8020" argv[1] = "123" argv[2] = "321" argv[3] = "" Hit any key to exit ... Signed-off-by: Zubair Lutfullah Kakakhel <zubair.kakak...@imgtec.com> --- Tested on the MIPS Boston platform. --- common/bootm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/common/bootm.c b/common/bootm.c index e6da551..a26ada4 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -602,10 +602,8 @@ int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[], if (!ret && (states & BOOTM_STATE_FINDOS)) ret = bootm_find_os(cmdtp, flag, argc, argv); - if (!ret && (states & BOOTM_STATE_FINDOTHER)) { + if (!ret && (states & BOOTM_STATE_FINDOTHER)) ret = bootm_find_other(cmdtp, flag, argc, argv); - argc = 0; /* consume the args */ - } /* Load the OS */ if (!ret && (states & BOOTM_STATE_LOADOS)) { -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [RFC] bootm: fix passing argc to standalone apps
Hi, On 09/08/2016 09:23 AM, Zubair Lutfullah Kakakhel wrote: This bug appears in b6396403 which makes u-boot unable to pass arguments via bootm to a standalone application without this patch. Steps to reproduce. Compile a u-boot. Use mkimage to package the standalone hello_world.bin file. e.g. For the MIPS Boston platform mkimage -n "hello" -A mips -O u-boot -C none -T standalone \ -a 0x8020 -d hello_world.bin \ -ep 0x8020 hello_out Then tftp hello_out and run it using boston # dhcp 192.168.154.45:hello_out ... boston # bootm $loadaddr 123 321 Without the patch the following output is observed. Example expects ABI version 8 Actual U-Boot ABI version 8 Hello World argc = 0 argv[0] = "0x8800" With the patch, you see the following. boston # bootm $loadaddr 123 321 Image Name: hello Image Type: MIPS U-Boot Standalone Program (uncompressed) Data Size:1240 Bytes = 1.2 KiB Load Address: 8020 Entry Point: 8020 Verifying Checksum ... OK Loading Standalone Program ... OK Example expects ABI version 8 Actual U-Boot ABI version 8 Hello World argc = 0 argc = 3 argv[0] = "0x8800" argv[1] = 123 argv[2] = 321 Copy paste fluke in the git log. Sorry. The above appears in reality Regards, ZubairLK Hit any key to exit ... The go command at the entry point seems to work. boston # go 0x8020 123 321 Example expects ABI version 8 Actual U-Boot ABI version 8 Hello World argc = 3 argv[0] = "0x8020" argv[1] = "123" argv[2] = "321" argv[3] = "" Hit any key to exit ... Signed-off-by: Zubair Lutfullah Kakakhel <zubair.kakak...@imgtec.com> --- Tested on the MIPS Boston platform. --- common/bootm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/common/bootm.c b/common/bootm.c index a4d22a6..b2c0912 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -619,10 +619,8 @@ int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[], if (!ret && (states & BOOTM_STATE_FINDOS)) ret = bootm_find_os(cmdtp, flag, argc, argv); - if (!ret && (states & BOOTM_STATE_FINDOTHER)) { + if (!ret && (states & BOOTM_STATE_FINDOTHER)) ret = bootm_find_other(cmdtp, flag, argc, argv); - argc = 0; /* consume the args */ - } /* Load the OS */ if (!ret && (states & BOOTM_STATE_LOADOS)) { ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [RFC] bootm: fix passing argc to standalone apps
This bug appears in b6396403 which makes u-boot unable to pass arguments via bootm to a standalone application without this patch. Steps to reproduce. Compile a u-boot. Use mkimage to package the standalone hello_world.bin file. e.g. For the MIPS Boston platform mkimage -n "hello" -A mips -O u-boot -C none -T standalone \ -a 0x8020 -d hello_world.bin \ -ep 0x8020 hello_out Then tftp hello_out and run it using boston # dhcp 192.168.154.45:hello_out ... boston # bootm $loadaddr 123 321 Without the patch the following output is observed. Example expects ABI version 8 Actual U-Boot ABI version 8 Hello World argc = 0 argv[0] = "0x8800" With the patch, you see the following. boston # bootm $loadaddr 123 321 Image Name: hello Image Type: MIPS U-Boot Standalone Program (uncompressed) Data Size:1240 Bytes = 1.2 KiB Load Address: 8020 Entry Point: 8020 Verifying Checksum ... OK Loading Standalone Program ... OK Example expects ABI version 8 Actual U-Boot ABI version 8 Hello World argc = 0 argv[0] = "0x8800" Hit any key to exit ... The go command at the entry point seems to work. boston # go 0x8020 123 321 Example expects ABI version 8 Actual U-Boot ABI version 8 Hello World argc = 3 argv[0] = "0x8020" argv[1] = "123" argv[2] = "321" argv[3] = "" Hit any key to exit ... Signed-off-by: Zubair Lutfullah Kakakhel <zubair.kakak...@imgtec.com> --- Tested on the MIPS Boston platform. --- common/bootm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/common/bootm.c b/common/bootm.c index a4d22a6..b2c0912 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -619,10 +619,8 @@ int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[], if (!ret && (states & BOOTM_STATE_FINDOS)) ret = bootm_find_os(cmdtp, flag, argc, argv); - if (!ret && (states & BOOTM_STATE_FINDOTHER)) { + if (!ret && (states & BOOTM_STATE_FINDOTHER)) ret = bootm_find_other(cmdtp, flag, argc, argv); - argc = 0; /* consume the args */ - } /* Load the OS */ if (!ret && (states & BOOTM_STATE_LOADOS)) { -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH_v2 2/2] mips: Add MIPSfpga platform support
MIPSfpga is an FPGA based dev platform. In a nutshell, its a microAptiv cpu core with lots of Xilinx IP blocks The FPGA dev board used is the Nexys4DDR board by Digilent. For more information, check the Readme file in board/imgtec/xilfpga Signed-off-by: Zubair Lutfullah Kakakhel <zubair.kakak...@imgtec.com> Reviewed-by: Paul Burton <paul.bur...@imgtec.com> Reviewed-by: Daniel Schwierzeck <daniel.schwierz...@gmail.com> --- V1 -> V2 - Added Reviewed-by: Daniel Schwierzeck <daniel.schwierz...@gmail.com> - Removed select SYS_MIPS_CACHE_INIT_RAM_LOAD in Kconfig for Target XILFPGA - Used CONFIG_SYS_SDRAM_SIZE in xilfpga.c instead of 128*1024*1024 --- arch/mips/Kconfig| 15 + board/imgtec/xilfpga/Kconfig | 15 + board/imgtec/xilfpga/MAINTAINERS | 6 board/imgtec/xilfpga/Makefile| 7 + board/imgtec/xilfpga/README | 55 board/imgtec/xilfpga/xilfpga.c | 20 configs/imgtec_xilfpga_defconfig | 25 +++ include/configs/imgtec_xilfpga.h | 68 8 files changed, 211 insertions(+) create mode 100644 board/imgtec/xilfpga/Kconfig create mode 100644 board/imgtec/xilfpga/MAINTAINERS create mode 100644 board/imgtec/xilfpga/Makefile create mode 100644 board/imgtec/xilfpga/README create mode 100644 board/imgtec/xilfpga/xilfpga.c create mode 100644 configs/imgtec_xilfpga_defconfig create mode 100644 include/configs/imgtec_xilfpga.h diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 21066f0..fa344a7 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -73,10 +73,25 @@ config MACH_PIC32 select OF_CONTROL select DM +config TARGET_XILFPGA + bool "Support Imagination Xilfpga" + select OF_CONTROL + select DM + select DM_SERIAL + select DM_GPIO + select DM_ETH + select SUPPORTS_LITTLE_ENDIAN + select SUPPORTS_CPU_MIPS32_R1 + select SUPPORTS_CPU_MIPS32_R2 + select MIPS_L1_CACHE_SHIFT_4 + help + This supports IMGTEC MIPSfpga platform + endchoice source "board/dbau1x00/Kconfig" source "board/imgtec/malta/Kconfig" +source "board/imgtec/xilfpga/Kconfig" source "board/micronas/vct/Kconfig" source "board/pb1x00/Kconfig" source "board/qemu-mips/Kconfig" diff --git a/board/imgtec/xilfpga/Kconfig b/board/imgtec/xilfpga/Kconfig new file mode 100644 index 000..b078278 --- /dev/null +++ b/board/imgtec/xilfpga/Kconfig @@ -0,0 +1,15 @@ +if TARGET_XILFPGA + +config SYS_BOARD + default "xilfpga" + +config SYS_VENDOR + default "imgtec" + +config SYS_CONFIG_NAME + default "imgtec_xilfpga" + +config SYS_TEXT_BASE + default 0x80C0 + +endif diff --git a/board/imgtec/xilfpga/MAINTAINERS b/board/imgtec/xilfpga/MAINTAINERS new file mode 100644 index 000..aa04532 --- /dev/null +++ b/board/imgtec/xilfpga/MAINTAINERS @@ -0,0 +1,6 @@ +XILFPGA BOARD +M: Zubair Lutfullah Kakakhel <zubair.kakak...@imgtec.com> +S: Maintained +F: board/imgtec/xilfpga +F: include/configs/xilfpga.h +F: configs/imgtec_xilfpga_defconfig diff --git a/board/imgtec/xilfpga/Makefile b/board/imgtec/xilfpga/Makefile new file mode 100644 index 000..9aaf9ce --- /dev/null +++ b/board/imgtec/xilfpga/Makefile @@ -0,0 +1,7 @@ +# +# Copyright (C) 2016, Imagination Technologies Ltd. +# Zubair Lutfullah Kakakhel <zubair.kakak...@imgtec.com> +# +# SPDX-License-Identifier: GPL-2.0+ +# +obj-y := xilfpga.o diff --git a/board/imgtec/xilfpga/README b/board/imgtec/xilfpga/README new file mode 100644 index 000..ac19d48 --- /dev/null +++ b/board/imgtec/xilfpga/README @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2016, Imagination Technologies Ltd. + * + * Zubair Lutfullah Kakakhel, zubair.kakak...@imgtec.com + */ + +MIPSfpga +=== + +MIPSfpga is an FPGA based development platform by Imagination Technologies +As we are dealing with a MIPS core instantiated on an FPGA, specifications +are fluid and can be varied in RTL. + +The example project provided by IMGTEC runs on the Nexys4DDR board by +Digilent powered by the ARTIX-7 FPGA by Xilinx. Relevant details about +the example project and the Nexys4DDR board: + +- microAptiv UP core m14Kc +- 50MHz clock speed +- 128Mbyte DDR RAM at 0x_ +- 8Kbyte RAM at 0x1000_ +- axi_intc at 0x1020_ +- axi_uart16550at 0x1040_ +- axi_gpio at 0x1060_ +- axi_i2c at 0x10A0_ +- custom_gpio at 0x10C0_ +- axi_ethernetlite at 0x10E0_ +- 8Kbyte BootRAM at 0x1FC0_ +- 16Mbyte QPI at 0x1D00_ + +Boot protocol: +-- + +The BootRAM is a writeable "RAM" in FPGA at 0x1FC0_. +This is for easy reprogrammibility via JTAG.
[U-Boot] [PATCH_v2 0/2] MIPS: Add MIPSfpga u-boot port
MIPSfpga is an FPGA based dev platform by Imagination Technologies Ltd. DDR is already initialized before u-boot. And the peripherals supported in the u-boot port are an n16550 uart and a xilinx ethernet IP (axi_emaclite) which already have drivers in u-boot. Hence the port is mostly DT + config files and very little C code. Based on v2016.09-rc1. Kindly accept these patches in this cycle. Regards, ZubairLK V1 -> V2 changes Added Reviewed-by: Daniel Schwierzeck <daniel.schwierz...@gmail.com> Reordered patches so that DT files come before platform stuff Some minor nit picks Zubair Lutfullah Kakakhel (2): mips: xilfpga: Add device tree files mips: Add MIPSfpga platform support arch/mips/Kconfig| 15 + arch/mips/dts/Makefile | 1 + arch/mips/dts/microAptiv.dtsi| 21 + arch/mips/dts/nexys4ddr.dts | 62 board/imgtec/xilfpga/Kconfig | 15 + board/imgtec/xilfpga/MAINTAINERS | 6 board/imgtec/xilfpga/Makefile| 7 + board/imgtec/xilfpga/README | 55 board/imgtec/xilfpga/xilfpga.c | 20 configs/imgtec_xilfpga_defconfig | 25 +++ include/configs/imgtec_xilfpga.h | 68 11 files changed, 295 insertions(+) create mode 100644 arch/mips/dts/microAptiv.dtsi create mode 100644 arch/mips/dts/nexys4ddr.dts create mode 100644 board/imgtec/xilfpga/Kconfig create mode 100644 board/imgtec/xilfpga/MAINTAINERS create mode 100644 board/imgtec/xilfpga/Makefile create mode 100644 board/imgtec/xilfpga/README create mode 100644 board/imgtec/xilfpga/xilfpga.c create mode 100644 configs/imgtec_xilfpga_defconfig create mode 100644 include/configs/imgtec_xilfpga.h -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH_v2 1/2] mips: xilfpga: Add device tree files
Mostly the same as the Kernel upstream device tree file except for - alias for the serial console node - ethernet node as the ethernet stuff isn't upstream on kernel.org yet - uart clock-frequency passed directly in the node Signed-off-by: Zubair Lutfullah Kakakhel <zubair.kakak...@imgtec.com> Reviewed-by: Paul Burton <paul.bur...@imgtec.com> Reviewed-by: Daniel Schwierzeck <daniel.schwierz...@gmail.com> --- V1 -> V2 Added Reviewed-by: Daniel Schwierzeck <daniel.schwierz...@gmail.com> Reorded patches so that DT files go before platform Kconfig for bisectibility --- arch/mips/dts/Makefile| 1 + arch/mips/dts/microAptiv.dtsi | 21 +++ arch/mips/dts/nexys4ddr.dts | 62 +++ 3 files changed, 84 insertions(+) create mode 100644 arch/mips/dts/microAptiv.dtsi create mode 100644 arch/mips/dts/nexys4ddr.dts diff --git a/arch/mips/dts/Makefile b/arch/mips/dts/Makefile index 2f04d73..5f311d4 100644 --- a/arch/mips/dts/Makefile +++ b/arch/mips/dts/Makefile @@ -6,6 +6,7 @@ dtb-$(CONFIG_TARGET_AP121) += ap121.dtb dtb-$(CONFIG_TARGET_AP143) += ap143.dtb dtb-$(CONFIG_TARGET_MALTA) += mti,malta.dtb dtb-$(CONFIG_TARGET_PIC32MZDASK) += pic32mzda_sk.dtb +dtb-$(CONFIG_TARGET_XILFPGA) += nexys4ddr.dtb dtb-$(CONFIG_BOARD_TPLINK_WDR4300) += tplink_wdr4300.dtb targets += $(dtb-y) diff --git a/arch/mips/dts/microAptiv.dtsi b/arch/mips/dts/microAptiv.dtsi new file mode 100644 index 000..81d518e --- /dev/null +++ b/arch/mips/dts/microAptiv.dtsi @@ -0,0 +1,21 @@ +/ { + #address-cells = <1>; + #size-cells = <1>; + compatible = "img,xilfpga"; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + cpu@0 { + device_type = "cpu"; + compatible = "mips,m14Kc"; + clocks = <>; + reg = <0>; + }; + }; + + ext: ext { + compatible = "fixed-clock"; + #clock-cells = <0>; + }; +}; diff --git a/arch/mips/dts/nexys4ddr.dts b/arch/mips/dts/nexys4ddr.dts new file mode 100644 index 000..e254ab1 --- /dev/null +++ b/arch/mips/dts/nexys4ddr.dts @@ -0,0 +1,62 @@ +/dts-v1/; + +#include "microAptiv.dtsi" + +/ { + compatible = "digilent,nexys4ddr"; + + memory { + device_type = "memory"; + reg = <0x0 0x0800>; + }; + + cpuintc: interrupt-controller@0 { + #address-cells = <0>; + #interrupt-cells = <1>; + interrupt-controller; + compatible = "mti,cpu-interrupt-controller"; + }; + + aliases { + console = _uart16550; + }; + + axi_ethernetlite: ethernet@10e0 { + compatible = "xlnx,xps-ethernetlite-1.00.a"; + device_type = "network"; + local-mac-address = [08 86 4C 0D F7 09]; + phy-handle = <>; + reg = <0x10e0 0x1>; + xlnx,duplex = <0x1>; + xlnx,include-global-buffers = <0x1>; + xlnx,include-internal-loopback = <0x0>; + xlnx,include-mdio = <0x1>; + xlnx,instance = "axi_ethernetlite_inst"; + xlnx,rx-ping-pong = <0x1>; + xlnx,s-axi-id-width = <0x1>; + xlnx,tx-ping-pong = <0x1>; + xlnx,use-internal = <0x0>; + mdio { + #address-cells = <1>; + #size-cells = <0>; + phy0: phy@1 { + compatible = <0x0007c0f0 0xfff0>; + device_type = "ethernet-phy"; + reg = <1>; + } ; + } ; +} ; + + + axi_uart16550: serial@1040 { + compatible = "ns16550a"; + reg = <0x1040 0x1>; + + reg-shift = <2>; + reg-offset = <0x1000>; + + clock-frequency = <5000>; + + }; +}; + -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/2] mips: Add MIPSfpga platform support
Hi, On 27/07/16 13:13, Daniel Schwierzeck wrote: Am 27.07.2016 um 12:51 schrieb Zubair Lutfullah Kakakhel: MIPSfpga is an FPGA based dev platform. In a nutshell, its a microAptiv cpu core with lots of Xilinx IP blocks The FPGA dev board used is the Nexys4DDR board by Digilent. For more information, check the Readme file in board/imgtec/xilfpga Signed-off-by: Zubair Lutfullah Kakakhel <zubair.kakak...@imgtec.com> Reviewed-by: Paul Burton <paul.bur...@imgtec.com> Reviewed-by: Daniel Schwierzeck <daniel.schwierz...@gmail.com> some nits below Thanks for the review. I will resend v2 today with your suggestions. Response inline below. --- arch/mips/Kconfig| 16 ++ board/imgtec/xilfpga/Kconfig | 15 + board/imgtec/xilfpga/MAINTAINERS | 6 board/imgtec/xilfpga/Makefile| 7 + board/imgtec/xilfpga/README | 55 board/imgtec/xilfpga/xilfpga.c | 20 configs/imgtec_xilfpga_defconfig | 25 +++ include/configs/imgtec_xilfpga.h | 68 8 files changed, 212 insertions(+) create mode 100644 board/imgtec/xilfpga/Kconfig create mode 100644 board/imgtec/xilfpga/MAINTAINERS create mode 100644 board/imgtec/xilfpga/Makefile create mode 100644 board/imgtec/xilfpga/README create mode 100644 board/imgtec/xilfpga/xilfpga.c create mode 100644 configs/imgtec_xilfpga_defconfig create mode 100644 include/configs/imgtec_xilfpga.h diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 21066f0..c81c9ea 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -73,10 +73,26 @@ config MACH_PIC32 select OF_CONTROL select DM +config TARGET_XILFPGA + bool "Support Imagination Xilfpga" + select OF_CONTROL + select DM + select DM_SERIAL + select DM_GPIO + select DM_ETH + select SUPPORTS_LITTLE_ENDIAN + select SUPPORTS_CPU_MIPS32_R1 + select SUPPORTS_CPU_MIPS32_R2 + select MIPS_L1_CACHE_SHIFT_4 + select SYS_MIPS_CACHE_INIT_RAM_LOAD you don't need this option on a microAptiv core and because don't do any cache initialization in software at all Ok. I'll check. Thanks. + help + This supports IMGTEC MIPSfpga platform + endchoice source "board/dbau1x00/Kconfig" source "board/imgtec/malta/Kconfig" +source "board/imgtec/xilfpga/Kconfig" source "board/micronas/vct/Kconfig" source "board/pb1x00/Kconfig" source "board/qemu-mips/Kconfig" diff --git a/board/imgtec/xilfpga/Kconfig b/board/imgtec/xilfpga/Kconfig new file mode 100644 index 000..b078278 --- /dev/null +++ b/board/imgtec/xilfpga/Kconfig @@ -0,0 +1,15 @@ +if TARGET_XILFPGA + +config SYS_BOARD + default "xilfpga" + +config SYS_VENDOR + default "imgtec" + +config SYS_CONFIG_NAME + default "imgtec_xilfpga" + +config SYS_TEXT_BASE + default 0x80C0 + +endif diff --git a/board/imgtec/xilfpga/MAINTAINERS b/board/imgtec/xilfpga/MAINTAINERS new file mode 100644 index 000..aa04532 --- /dev/null +++ b/board/imgtec/xilfpga/MAINTAINERS @@ -0,0 +1,6 @@ +XILFPGA BOARD +M: Zubair Lutfullah Kakakhel <zubair.kakak...@imgtec.com> +S: Maintained +F: board/imgtec/xilfpga +F: include/configs/xilfpga.h +F: configs/imgtec_xilfpga_defconfig diff --git a/board/imgtec/xilfpga/Makefile b/board/imgtec/xilfpga/Makefile new file mode 100644 index 000..9aaf9ce --- /dev/null +++ b/board/imgtec/xilfpga/Makefile @@ -0,0 +1,7 @@ +# +# Copyright (C) 2016, Imagination Technologies Ltd. +# Zubair Lutfullah Kakakhel <zubair.kakak...@imgtec.com> +# +# SPDX-License-Identifier: GPL-2.0+ +# +obj-y := xilfpga.o diff --git a/board/imgtec/xilfpga/README b/board/imgtec/xilfpga/README new file mode 100644 index 000..ac19d48 --- /dev/null +++ b/board/imgtec/xilfpga/README @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2016, Imagination Technologies Ltd. + * + * Zubair Lutfullah Kakakhel, zubair.kakak...@imgtec.com + */ + +MIPSfpga +=== + +MIPSfpga is an FPGA based development platform by Imagination Technologies +As we are dealing with a MIPS core instantiated on an FPGA, specifications +are fluid and can be varied in RTL. + +The example project provided by IMGTEC runs on the Nexys4DDR board by +Digilent powered by the ARTIX-7 FPGA by Xilinx. Relevant details about +the example project and the Nexys4DDR board: + +- microAptiv UP core m14Kc +- 50MHz clock speed +- 128Mbyte DDR RAM at 0x_ +- 8Kbyte RAM at 0x1000_ +- axi_intc at 0x1020_ +- axi_uart16550at 0x1040_ +- axi_gpio at 0x1060_ +- axi_i2c at 0x10A0_ +- custom_gpio at 0x10C0_ +- axi_ethernetlite at 0x10E0_ +- 8Kbyte BootRAM a
Re: [U-Boot] [PATCH 2/2] mips: xilfpga: Add device tree files
On 27/07/16 13:02, Daniel Schwierzeck wrote: Am 27.07.2016 um 12:51 schrieb Zubair Lutfullah Kakakhel: Mostly the same as the Kernel upstream device tree file except for - alias for the serial console node - ethernet node as the ethernet stuff isn't upstream on kernel.org yet - uart clock-frequency passed directly in the node Signed-off-by: Zubair Lutfullah Kakakhel <zubair.kakak...@imgtec.com> Reviewed-by: Paul Burton <paul.bur...@imgtec.com> actually this should be the first patch in this series because you can't build the xilfpga board without these device tree files which would break bisectability. Reviewed-by: Daniel Schwierzeck <daniel.schwierz...@gmail.com> Thanks. I'll resend v2 with the correct order Regards, ZubairLK ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 2/3] net: emaclite: use __raw_readl/writel instead of weird define
out_be32 and in_be32 are actually #defined to little endian writel/readl in arch/microblaze. Just use __raw_writel/readl instead. That is also what is used in the Linux kernel driver for this IP block Tested on MIPSfpga. Can tftp a kernel. Signed-off-by: Zubair Lutfullah Kakakhel <zubair.kakak...@imgtec.com> Reviewed-by: Paul Burton <paul.bur...@imgtec.com> --- drivers/net/xilinx_emaclite.c | 86 ++- 1 file changed, 45 insertions(+), 41 deletions(-) diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c index 6df222b..d86e7a3 100644 --- a/drivers/net/xilinx_emaclite.c +++ b/drivers/net/xilinx_emaclite.c @@ -155,7 +155,7 @@ static int wait_for_bit(const char *func, u32 *reg, const u32 mask, unsigned long start = get_timer(0); while (1) { - val = readl(reg); + val = __raw_readl(reg); if (!set) val = ~val; @@ -194,16 +194,17 @@ static u32 phyread(struct xemaclite *emaclite, u32 phyaddress, u32 registernum, if (mdio_wait(regs)) return 1; - u32 ctrl_reg = in_be32(>mdioctrl); - out_be32(>mdioaddr, XEL_MDIOADDR_OP_MASK | -((phyaddress << XEL_MDIOADDR_PHYADR_SHIFT) | registernum)); - out_be32(>mdioctrl, ctrl_reg | XEL_MDIOCTRL_MDIOSTS_MASK); + u32 ctrl_reg = __raw_readl(>mdioctrl); + __raw_writel(XEL_MDIOADDR_OP_MASK + | ((phyaddress << XEL_MDIOADDR_PHYADR_SHIFT) + | registernum), >mdioaddr); + __raw_writel(ctrl_reg | XEL_MDIOCTRL_MDIOSTS_MASK, >mdioctrl); if (mdio_wait(regs)) return 1; /* Read data */ - *data = in_be32(>mdiord); + *data = __raw_readl(>mdiord); return 0; } @@ -221,11 +222,12 @@ static u32 phywrite(struct xemaclite *emaclite, u32 phyaddress, u32 registernum, * Data register. Finally, set the Status bit in the MDIO Control * register to start a MDIO write transaction. */ - u32 ctrl_reg = in_be32(>mdioctrl); - out_be32(>mdioaddr, ~XEL_MDIOADDR_OP_MASK & -((phyaddress << XEL_MDIOADDR_PHYADR_SHIFT) | registernum)); - out_be32(>mdiowr, data); - out_be32(>mdioctrl, ctrl_reg | XEL_MDIOCTRL_MDIOSTS_MASK); + u32 ctrl_reg = __raw_readl(>mdioctrl); + __raw_writel(~XEL_MDIOADDR_OP_MASK + & ((phyaddress << XEL_MDIOADDR_PHYADR_SHIFT) + | registernum), >mdioaddr); + __raw_writel(data, >mdiowr); + __raw_writel(ctrl_reg | XEL_MDIOCTRL_MDIOSTS_MASK, >mdioctrl); if (mdio_wait(regs)) return 1; @@ -328,27 +330,27 @@ static int emaclite_start(struct udevice *dev) * TX - TX_PING & TX_PONG initialization */ /* Restart PING TX */ - out_be32(>tx_ping_tsr, 0); + __raw_writel(0, >tx_ping_tsr); /* Copy MAC address */ xemaclite_alignedwrite(pdata->enetaddr, >tx_ping, ENET_ADDR_LENGTH); /* Set the length */ - out_be32(>tx_ping_tplr, ENET_ADDR_LENGTH); + __raw_writel(ENET_ADDR_LENGTH, >tx_ping_tplr); /* Update the MAC address in the EMAC Lite */ - out_be32(>tx_ping_tsr, XEL_TSR_PROG_MAC_ADDR); + __raw_writel(XEL_TSR_PROG_MAC_ADDR, >tx_ping_tsr); /* Wait for EMAC Lite to finish with the MAC address update */ - while ((in_be32 (>tx_ping_tsr) & + while ((__raw_readl(>tx_ping_tsr) & XEL_TSR_PROG_MAC_ADDR) != 0) ; if (emaclite->txpp) { /* The same operation with PONG TX */ - out_be32(>tx_pong_tsr, 0); + __raw_writel(0, >tx_pong_tsr); xemaclite_alignedwrite(pdata->enetaddr, >tx_pong, ENET_ADDR_LENGTH); - out_be32(>tx_pong_tplr, ENET_ADDR_LENGTH); - out_be32(>tx_pong_tsr, XEL_TSR_PROG_MAC_ADDR); - while ((in_be32(>tx_pong_tsr) & + __raw_writel(ENET_ADDR_LENGTH, >tx_pong_tplr); + __raw_writel(XEL_TSR_PROG_MAC_ADDR, >tx_pong_tsr); + while ((__raw_readl(>tx_pong_tsr) & XEL_TSR_PROG_MAC_ADDR) != 0) ; } @@ -357,13 +359,13 @@ static int emaclite_start(struct udevice *dev) * RX - RX_PING & RX_PONG initialization */ /* Write out the value to flush the RX buffer */ - out_be32(>rx_ping_rsr, XEL_RSR_RECV_IE_MASK); + __raw_writel(XEL_RSR_RECV_IE_MASK, >rx_ping_rsr); if (emaclite->rxpp) - out_be32(>rx_pong_rsr, XEL_RSR_RECV_IE_MASK); + __raw_writel(XEL_RSR_RECV_IE_MASK, >rx_pong_rsr); - out_be32(>mdioctrl, XEL_MDIOC
[U-Boot] [PATCH 3/3] net: emaclite: Enable driver for MIPS
Signed-off-by: Zubair Lutfullah Kakakhel <zubair.kakak...@imgtec.com> Reviewed-by: Paul Burton <paul.bur...@imgtec.com> --- drivers/net/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 88d8e83..4efb5d6 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -170,7 +170,7 @@ config XILINX_AXIEMAC This MAC is present in Xilinx Microblaze, Zynq and ZynqMP SoCs. config XILINX_EMACLITE - depends on DM_ETH && (MICROBLAZE || ARCH_ZYNQ || ARCH_ZYNQMP) + depends on DM_ETH && (MICROBLAZE || ARCH_ZYNQ || ARCH_ZYNQMP || MIPS) select PHYLIB select MII bool "Xilinx Ethernetlite" -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/3] net: emaclite: Use ioremap_nocache
Virtual to physical mapping isn't necessarily 1:1 for all architectures Using ioremap_nocache allows for the arch code to translate the physical address to a virtual address. Signed-off-by: Zubair Lutfullah Kakakhel <zubair.kakak...@imgtec.com> Reviewed-by: Paul Burton <paul.bur...@imgtec.com> --- drivers/net/xilinx_emaclite.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c index 7b85aa0..6df222b 100644 --- a/drivers/net/xilinx_emaclite.c +++ b/drivers/net/xilinx_emaclite.c @@ -19,6 +19,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -595,7 +596,8 @@ static int emaclite_ofdata_to_platdata(struct udevice *dev) int offset = 0; pdata->iobase = (phys_addr_t)dev_get_addr(dev); - emaclite->regs = (struct emaclite_regs *)pdata->iobase; + emaclite->regs = (struct emaclite_regs *)ioremap_nocache(pdata->iobase, +0x1); emaclite->phyaddr = -1; -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 0/2] MIPS: Add MIPSfpga u-boot port
MIPSfpga is an FPGA based dev platform by Imagination Technologies Ltd. DDR is already initialized before u-boot. And the peripherals supported in the u-boot port are an n16550 uart and a xilinx ethernet IP (axi_emaclite) which already have drivers in u-boot. Hence the port is mostly DT + config files and very little C code. Based on v2016.09-rc1. Kindly accept these patches in this cycle. Regards, ZubairLK Zubair Lutfullah Kakakhel (2): mips: Add MIPSfpga platform support mips: xilfpga: Add device tree files arch/mips/Kconfig| 16 ++ arch/mips/dts/Makefile | 1 + arch/mips/dts/microAptiv.dtsi| 21 + arch/mips/dts/nexys4ddr.dts | 62 board/imgtec/xilfpga/Kconfig | 15 + board/imgtec/xilfpga/MAINTAINERS | 6 board/imgtec/xilfpga/Makefile| 7 + board/imgtec/xilfpga/README | 55 board/imgtec/xilfpga/xilfpga.c | 20 configs/imgtec_xilfpga_defconfig | 25 +++ include/configs/imgtec_xilfpga.h | 68 11 files changed, 296 insertions(+) create mode 100644 arch/mips/dts/microAptiv.dtsi create mode 100644 arch/mips/dts/nexys4ddr.dts create mode 100644 board/imgtec/xilfpga/Kconfig create mode 100644 board/imgtec/xilfpga/MAINTAINERS create mode 100644 board/imgtec/xilfpga/Makefile create mode 100644 board/imgtec/xilfpga/README create mode 100644 board/imgtec/xilfpga/xilfpga.c create mode 100644 configs/imgtec_xilfpga_defconfig create mode 100644 include/configs/imgtec_xilfpga.h -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 0/3] net: emaclite: fixes and enable for MIPS
Hi, This patch series changes the emaclite driver to be slightly more generic and then enables it for the MIPS arch. Regards, ZubairLK Zubair Lutfullah Kakakhel (3): net: emaclite: Use ioremap_nocache net: emaclite: use __raw_readl/writel instead of weird define net: emaclite: Enable driver for MIPS drivers/net/Kconfig | 2 +- drivers/net/xilinx_emaclite.c | 90 +++ 2 files changed, 49 insertions(+), 43 deletions(-) -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 2/2] mips: xilfpga: Add device tree files
Mostly the same as the Kernel upstream device tree file except for - alias for the serial console node - ethernet node as the ethernet stuff isn't upstream on kernel.org yet - uart clock-frequency passed directly in the node Signed-off-by: Zubair Lutfullah Kakakhel <zubair.kakak...@imgtec.com> Reviewed-by: Paul Burton <paul.bur...@imgtec.com> --- arch/mips/dts/Makefile| 1 + arch/mips/dts/microAptiv.dtsi | 21 +++ arch/mips/dts/nexys4ddr.dts | 62 +++ 3 files changed, 84 insertions(+) create mode 100644 arch/mips/dts/microAptiv.dtsi create mode 100644 arch/mips/dts/nexys4ddr.dts diff --git a/arch/mips/dts/Makefile b/arch/mips/dts/Makefile index 2f04d73..5f311d4 100644 --- a/arch/mips/dts/Makefile +++ b/arch/mips/dts/Makefile @@ -6,6 +6,7 @@ dtb-$(CONFIG_TARGET_AP121) += ap121.dtb dtb-$(CONFIG_TARGET_AP143) += ap143.dtb dtb-$(CONFIG_TARGET_MALTA) += mti,malta.dtb dtb-$(CONFIG_TARGET_PIC32MZDASK) += pic32mzda_sk.dtb +dtb-$(CONFIG_TARGET_XILFPGA) += nexys4ddr.dtb dtb-$(CONFIG_BOARD_TPLINK_WDR4300) += tplink_wdr4300.dtb targets += $(dtb-y) diff --git a/arch/mips/dts/microAptiv.dtsi b/arch/mips/dts/microAptiv.dtsi new file mode 100644 index 000..81d518e --- /dev/null +++ b/arch/mips/dts/microAptiv.dtsi @@ -0,0 +1,21 @@ +/ { + #address-cells = <1>; + #size-cells = <1>; + compatible = "img,xilfpga"; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + cpu@0 { + device_type = "cpu"; + compatible = "mips,m14Kc"; + clocks = <>; + reg = <0>; + }; + }; + + ext: ext { + compatible = "fixed-clock"; + #clock-cells = <0>; + }; +}; diff --git a/arch/mips/dts/nexys4ddr.dts b/arch/mips/dts/nexys4ddr.dts new file mode 100644 index 000..e254ab1 --- /dev/null +++ b/arch/mips/dts/nexys4ddr.dts @@ -0,0 +1,62 @@ +/dts-v1/; + +#include "microAptiv.dtsi" + +/ { + compatible = "digilent,nexys4ddr"; + + memory { + device_type = "memory"; + reg = <0x0 0x0800>; + }; + + cpuintc: interrupt-controller@0 { + #address-cells = <0>; + #interrupt-cells = <1>; + interrupt-controller; + compatible = "mti,cpu-interrupt-controller"; + }; + + aliases { + console = _uart16550; + }; + + axi_ethernetlite: ethernet@10e0 { + compatible = "xlnx,xps-ethernetlite-1.00.a"; + device_type = "network"; + local-mac-address = [08 86 4C 0D F7 09]; + phy-handle = <>; + reg = <0x10e0 0x1>; + xlnx,duplex = <0x1>; + xlnx,include-global-buffers = <0x1>; + xlnx,include-internal-loopback = <0x0>; + xlnx,include-mdio = <0x1>; + xlnx,instance = "axi_ethernetlite_inst"; + xlnx,rx-ping-pong = <0x1>; + xlnx,s-axi-id-width = <0x1>; + xlnx,tx-ping-pong = <0x1>; + xlnx,use-internal = <0x0>; + mdio { + #address-cells = <1>; + #size-cells = <0>; + phy0: phy@1 { + compatible = <0x0007c0f0 0xfff0>; + device_type = "ethernet-phy"; + reg = <1>; + } ; + } ; +} ; + + + axi_uart16550: serial@1040 { + compatible = "ns16550a"; + reg = <0x1040 0x1>; + + reg-shift = <2>; + reg-offset = <0x1000>; + + clock-frequency = <5000>; + + }; +}; + -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/2] mips: Add MIPSfpga platform support
MIPSfpga is an FPGA based dev platform. In a nutshell, its a microAptiv cpu core with lots of Xilinx IP blocks The FPGA dev board used is the Nexys4DDR board by Digilent. For more information, check the Readme file in board/imgtec/xilfpga Signed-off-by: Zubair Lutfullah Kakakhel <zubair.kakak...@imgtec.com> Reviewed-by: Paul Burton <paul.bur...@imgtec.com> --- arch/mips/Kconfig| 16 ++ board/imgtec/xilfpga/Kconfig | 15 + board/imgtec/xilfpga/MAINTAINERS | 6 board/imgtec/xilfpga/Makefile| 7 + board/imgtec/xilfpga/README | 55 board/imgtec/xilfpga/xilfpga.c | 20 configs/imgtec_xilfpga_defconfig | 25 +++ include/configs/imgtec_xilfpga.h | 68 8 files changed, 212 insertions(+) create mode 100644 board/imgtec/xilfpga/Kconfig create mode 100644 board/imgtec/xilfpga/MAINTAINERS create mode 100644 board/imgtec/xilfpga/Makefile create mode 100644 board/imgtec/xilfpga/README create mode 100644 board/imgtec/xilfpga/xilfpga.c create mode 100644 configs/imgtec_xilfpga_defconfig create mode 100644 include/configs/imgtec_xilfpga.h diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 21066f0..c81c9ea 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -73,10 +73,26 @@ config MACH_PIC32 select OF_CONTROL select DM +config TARGET_XILFPGA + bool "Support Imagination Xilfpga" + select OF_CONTROL + select DM + select DM_SERIAL + select DM_GPIO + select DM_ETH + select SUPPORTS_LITTLE_ENDIAN + select SUPPORTS_CPU_MIPS32_R1 + select SUPPORTS_CPU_MIPS32_R2 + select MIPS_L1_CACHE_SHIFT_4 + select SYS_MIPS_CACHE_INIT_RAM_LOAD + help + This supports IMGTEC MIPSfpga platform + endchoice source "board/dbau1x00/Kconfig" source "board/imgtec/malta/Kconfig" +source "board/imgtec/xilfpga/Kconfig" source "board/micronas/vct/Kconfig" source "board/pb1x00/Kconfig" source "board/qemu-mips/Kconfig" diff --git a/board/imgtec/xilfpga/Kconfig b/board/imgtec/xilfpga/Kconfig new file mode 100644 index 000..b078278 --- /dev/null +++ b/board/imgtec/xilfpga/Kconfig @@ -0,0 +1,15 @@ +if TARGET_XILFPGA + +config SYS_BOARD + default "xilfpga" + +config SYS_VENDOR + default "imgtec" + +config SYS_CONFIG_NAME + default "imgtec_xilfpga" + +config SYS_TEXT_BASE + default 0x80C0 + +endif diff --git a/board/imgtec/xilfpga/MAINTAINERS b/board/imgtec/xilfpga/MAINTAINERS new file mode 100644 index 0000000..aa04532 --- /dev/null +++ b/board/imgtec/xilfpga/MAINTAINERS @@ -0,0 +1,6 @@ +XILFPGA BOARD +M: Zubair Lutfullah Kakakhel <zubair.kakak...@imgtec.com> +S: Maintained +F: board/imgtec/xilfpga +F: include/configs/xilfpga.h +F: configs/imgtec_xilfpga_defconfig diff --git a/board/imgtec/xilfpga/Makefile b/board/imgtec/xilfpga/Makefile new file mode 100644 index 000..9aaf9ce --- /dev/null +++ b/board/imgtec/xilfpga/Makefile @@ -0,0 +1,7 @@ +# +# Copyright (C) 2016, Imagination Technologies Ltd. +# Zubair Lutfullah Kakakhel <zubair.kakak...@imgtec.com> +# +# SPDX-License-Identifier: GPL-2.0+ +# +obj-y := xilfpga.o diff --git a/board/imgtec/xilfpga/README b/board/imgtec/xilfpga/README new file mode 100644 index 000..ac19d48 --- /dev/null +++ b/board/imgtec/xilfpga/README @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2016, Imagination Technologies Ltd. + * + * Zubair Lutfullah Kakakhel, zubair.kakak...@imgtec.com + */ + +MIPSfpga +=== + +MIPSfpga is an FPGA based development platform by Imagination Technologies +As we are dealing with a MIPS core instantiated on an FPGA, specifications +are fluid and can be varied in RTL. + +The example project provided by IMGTEC runs on the Nexys4DDR board by +Digilent powered by the ARTIX-7 FPGA by Xilinx. Relevant details about +the example project and the Nexys4DDR board: + +- microAptiv UP core m14Kc +- 50MHz clock speed +- 128Mbyte DDR RAM at 0x_ +- 8Kbyte RAM at 0x1000_ +- axi_intc at 0x1020_ +- axi_uart16550at 0x1040_ +- axi_gpio at 0x1060_ +- axi_i2c at 0x10A0_ +- custom_gpio at 0x10C0_ +- axi_ethernetlite at 0x10E0_ +- 8Kbyte BootRAM at 0x1FC0_ +- 16Mbyte QPI at 0x1D00_ + +Boot protocol: +-- + +The BootRAM is a writeable "RAM" in FPGA at 0x1FC0_. +This is for easy reprogrammibility via JTAG. + +DDR initialization is already handled by a HW IP block. + +When the example project bitstream is loaded, the cpu_reset button +needs to be pressed. + +The bootram initializes the cache and axi_uart +Then checks if there is anything non 0x_ at location 0x1D40_
Re: [U-Boot] [PATCH 1/3] MIPS: Move cache sizes to Kconfig
Marek Vasut denx.de> writes: ... > > Off-topic: Is malta that mipsfpga or is that something else ? > Can I synthesise that mipsfpga into some altera FPGA ? If so, which one > is a good pick ? Hi Marek Malta is a generic MIPS evaluation platform. https://www.linux-mips.org/wiki/MIPS_Malta MIPSfpga is currently for universities/academics. A microAptiv core (including verilog source code) is given to academics to play with. The whole pack includes teaching resources, exercises, guides etc. If you do come under the definition of a University/Academic, do check it out https://community.imgtec.com/university/ Reference designs to run bare metal code runs on both Xilinx/Altera FPGAs. However, reference designs to run the Linux Kernel are Xilinx specific. Some more detail here. https://kernel.org/doc/Documentation/devicetree/bindings/mips/img/xilfpga.txt Hope that helps. Thanks ZubairLK ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot