[U-Boot] u-boot hangs on reboot
Hi, u-boot 2016.05/09/11 & 2017.x hangs on reboot with sunxi-next on my Allwinner A20 olimex-micro-emmc. All looks good and stable but on reboot u-boot hangs. I can't figure out why. U-boot 2016.03 works. Has anybody some ideas? ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] disk: part_dos: Use the original allocation scheme for the SPL case
On Thu, Oct 05, 2017 at 05:05:49AM -0400, Rob Clark wrote: > On Thu, Oct 5, 2017 at 12:36 AM, Jonathan Graywrote: > > On Wed, Oct 04, 2017 at 01:12:48PM -0400, Rob Clark wrote: > >> On Wed, Oct 4, 2017 at 12:29 PM, Fabio Estevam > >> wrote: > >> > Since commit ff98cb90514d ("part: extract MBR signature from partitions") > >> > SPL boot on i.MX6 starts to fail: > >> > > >> > U-Boot SPL 2017.09-00221-g0d6ab32 (Oct 02 2017 - 15:13:19) > >> > Trying to boot from MMC1 > >> > (keep in loop) > >> > > >> > Use the original allocation scheme for the SPL case, so that MX6 boards > >> > can boot again. > >> > > >> > This is a temporary solution to avoid the boot regression. > >> > > >> > Signed-off-by: Fabio Estevam > >> > --- > >> > Hi Tom, > >> > > >> > I do not have time this week to further investigate and narrow down > >> > this problem. > >> > > >> > Using the old allocation scheme fixes the mx6 SPL boot problem. > >> > > >> > >> Hi Tom, if you are ok with this as a temporary fix, then this is: > >> > >> Acked-by: Rob Clark > >> > >> I'm getting some help from some of the fedora-arm folks so hopefully I > >> can get some idea what is going wrong, but I'd like to unblock folks > >> w/ mx6 boards.. > >> > >> BR, > >> -R > > > > This does not seem to be a complete fix, cubox is still broken when > > U-Boot proper loads, unless the efi loader commits are to blame > > for introducing unaligned accesses. > > > > Works with 2017.09. > > > > U-Boot SPL 2017.11-rc1-00026-g14b55fc833 (Oct 05 2017 - 15:17:47) > > Trying to boot from MMC1 > > > > > > U-Boot 2017.11-rc1-00026-g14b55fc833 (Oct 05 2017 - 15:17:47 +1100) > > > > CPU: Freescale i.MX6Q rev1.5 996 MHz (running at 792 MHz) > > CPU: Extended Commercial temperature grade (-20C to 105C) at 34C > > Reset cause: WDOG > > Board: MX6 Cubox-i > > DRAM: 2 GiB > > MMC: FSL_SDHC: 0 > > *** Warning - bad CRC, using default environment > > > > No panel detected: default to HDMI > > Display: HDMI (1024x768) > > In:serial > > Out: serial > > Err: serial > > Net: FEC > > Hit any key to stop autoboot: 0 > > switch to partitions #0, OK > > mmc0 is current device > > Scanning mmc 0:1... > > I don't think any efi_loader code is running here, you would see a message > like: > > ## Starting EFI application at XYZ > > But to be sure you can disable CONFIG_EFI_LOADER in menuconfig to confirm. > > I guess this is some unrelated change. I suspect Tom's change to > malloc the fat_itr's which would make the buffers used for > fs_exists()/etc not cache aligned. I thought there was a patch > floating around to change that to memalign(). The imx6 problems still occur with CONFIG_EFI_LOADER disabled indeed. I can no longer load a kernel via efi on bbb though: U-Boot SPL 2017.11-rc1-00066-g4ac7de9239 (Oct 06 2017 - 14:21:51) Trying to boot from MMC1 reading u-boot.img reading u-boot.img U-Boot 2017.11-rc1-00066-g4ac7de9239 (Oct 06 2017 - 14:21:51 +1100) CPU : AM335X-GP rev 2.1 I2C: ready DRAM: 512 MiB No match for driver 'omap_hsmmc' No match for driver 'omap_hsmmc' Some drivers were not found MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1 not set. Validating first E-fuse MAC Net: cpsw, usb_ether Press SPACE to abort autoboot in 2 seconds switch to partitions #0, OK mmc0 is current device SD/MMC found on device 0 ** Unable to read file boot.scr ** ** Unable to read file uEnv.txt ** switch to partitions #0, OK mmc0 is current device Scanning mmc 0:1... reading /am335x-boneblack.dtb 35712 bytes read in 10 ms (3.4 MiB/s) Found EFI removable media binary efi/boot/bootarm.efi reading efi/boot/bootarm.efi 65448 bytes read in 16 ms (3.9 MiB/s) ## Starting EFI application at 8200 ... Scanning disks on usb... Scanning disks on mmc... MMC Device 2 not found MMC Device 3 not found Found 6 disks >> OpenBSD/armv7 BOOTARM 0.9 boot> cannot open sd0a:/etc/random.seed: Device not configured booting sd0a:/bsd: open sd0a:/bsd: Device not configured failed(6). will try /bsd boot> cannot open sd0a:/etc/random.seed: Device not configured booting sd0a:/bsd: open sd0a:/bsd: Device not configured failed(6). will try /bsd Turning timeout off. boot> ls sd1a:/ stat(sd1a:/): Device not configured To reproduce replace the existing MLO/u-boot.img in the FAT fs in https://ftp.openbsd.org/pub/OpenBSD/snapshots/armv7/miniroot-am335x-62.fs U-Boot 2017.09 works fine. U-Boot SPL 2017.09 (Sep 12 2017 - 13:40:28) Trying to boot from MMC1 reading u-boot.img reading u-boot.img U-Boot 2017.09 (Sep 12 2017 - 13:40:28 +1000) CPU : AM335X-GP rev 2.1 I2C: ready DRAM: 512 MiB No match for driver 'omap_hsmmc' No match for driver 'omap_hsmmc' Some drivers were not found MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1 not set. Validating first E-fuse MAC Net: cpsw, usb_ether Press SPACE to abort autoboot in 2 seconds switch to partitions #0, OK mmc0 is current device SD/MMC found on device 0 reading boot.scr ** Unable
Re: [U-Boot] [PATCH] usb: kbd: Fix dangling pointers on probe fail
On Thu, Oct 5, 2017 at 7:48 PM, Bin Mengwrote: > Hi Rob, > > On Wed, Oct 4, 2017 at 1:31 AM, Rob Clark wrote: >> If probe fails, we should unregister the stdio device, else we leave >> dangling pointers to the parent 'struct usb_device'. >> >> Signed-off-by: Rob Clark >> --- >> I finally got around to debugging why things explode so badly without >> fixing usb_kbd vs. iomux[1] (which this patch applies on top of). >> >> [1] https://patchwork.ozlabs.org/patch/818881/ >> >> common/usb_kbd.c | 30 -- >> 1 file changed, 24 insertions(+), 6 deletions(-) >> >> diff --git a/common/usb_kbd.c b/common/usb_kbd.c >> index 4c3ad95fca..82ad93f6ca 100644 >> --- a/common/usb_kbd.c >> +++ b/common/usb_kbd.c >> @@ -535,22 +535,40 @@ static int probe_usb_keyboard(struct usb_device *dev) >> error = iomux_doenv(stdin, stdinname); >> free(newstdin); >> if (error) >> - return error; >> + goto unregister_stdio; >> } else { >> /* Check if this is the standard input device. */ >> - if (strcmp(stdinname, DEVNAME)) >> - return 1; >> + if (strcmp(stdinname, DEVNAME)) { >> + error = -1; > > Could we use some meaningful errno? suggestions welcome.. I wasn't sure what to pick so I just went with <0 >> + goto unregister_stdio; >> + } >> >> /* Reassign the console */ >> - if (overwrite_console()) >> - return 1; >> + if (overwrite_console()) { >> + error = -1; >> + goto unregister_stdio; >> + } >> >> error = console_assign(stdin, DEVNAME); >> if (error) >> - return error; >> + goto unregister_stdio; >> } >> >> return 0; >> + >> +unregister_stdio: >> + /* >> +* If probe fails, the device will be removed.. leaving dangling >> +* pointers if the stdio device is not unregistered. If u-boot > > nits: U-Boot > >> +* is built without stdio_deregister(), just pretend to succeed >> +* in order to avoid dangling pointers. >> +*/ >> +#if CONFIG_IS_ENABLED(SYS_STDIO_DEREGISTER) >> + stdio_deregister(DEVNAME, 1); >> + return error; >> +#else >> + return 0; > > Don't understand why 'return 0' here if probe fails... see above comment, basically we can't fail after we've registered the stdio device unless we can remove it. Suggestions welcome on better wording for the comment if it wasn't clear BR, -R >> +#endif >> } >> >> #ifndef CONFIG_DM_USB >> -- > > Regards, > Bin ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] linux/kernel.h: import DIV_ROUND_{DOWN, UP}_ULL from Linux
Hi Tom, 2017-09-13 19:16 GMT+09:00 Masahiro Yamada: > These macros are useful to avoid link error on 32-bit systems. > > Signed-off-by: Masahiro Yamada > --- > > include/linux/kernel.h | 5 + > 1 file changed, 5 insertions(+) > > diff --git a/include/linux/kernel.h b/include/linux/kernel.h > index 0b61671..87d2d95 100644 > --- a/include/linux/kernel.h > +++ b/include/linux/kernel.h > @@ -57,6 +57,11 @@ > #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) > #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) > > +#define DIV_ROUND_DOWN_ULL(ll, d) \ > + ({ unsigned long long _tmp = (ll); do_div(_tmp, d); _tmp; }) > + > +#define DIV_ROUND_UP_ULL(ll, d)DIV_ROUND_DOWN_ULL((ll) + (d) > - 1, (d)) > + > #if BITS_PER_LONG == 32 > # define DIV_ROUND_UP_SECTOR_T(ll,d) DIV_ROUND_UP_ULL(ll, d) > #else > -- > 2.7.4 Could you pick this up, if you missed it. I am just copying these two macros from Linux. I do not think it is controversial. -- Best Regards Masahiro Yamada ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] fixdep: fix dependency on options surrounded by CONFIG_VAL()
CONFIG options surrounded by CONFIG_IS_ENABLED(...) CONFIG_IS_BUILTIN(...) CONFIG_IS_MODULE(...) CONFIG_VAL(...) need special care for proper dependency tracking. I do not remember why, but I missed to add CONFIG_VAL(...) handling. Signed-off-by: Masahiro Yamada--- scripts/basic/fixdep.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index 9bd0de2..da7fb2c 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c @@ -249,10 +249,17 @@ static void parse_config_file(const char *map, size_t len) if (q - p < 0) continue; - /* U-Boot also handles CONFIG_IS_{ENABLED/BUILTIN/MODULE} */ + /* +* U-Boot also handles +* CONFIG_IS_ENABLED(...) +* CONFIG_IS_BUILTIN(...) +* CONFIG_IS_MODULE(...) +* CONFIG_VAL(...) +*/ if ((q - p == 10 && !memcmp(p, "IS_ENABLED(", 11)) || (q - p == 10 && !memcmp(p, "IS_BUILTIN(", 11)) || - (q - p == 9 && !memcmp(p, "IS_MODULE(", 10))) { + (q - p == 9 && !memcmp(p, "IS_MODULE(", 10)) || + (q - p == 3 && !memcmp(p, "VAL(", 4))) { p = q + 1; for (q = p; q < map + len; q++) if (*q == ')') -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] usb: kbd: Fix dangling pointers on probe fail
Hi Rob, On Wed, Oct 4, 2017 at 1:31 AM, Rob Clarkwrote: > If probe fails, we should unregister the stdio device, else we leave > dangling pointers to the parent 'struct usb_device'. > > Signed-off-by: Rob Clark > --- > I finally got around to debugging why things explode so badly without > fixing usb_kbd vs. iomux[1] (which this patch applies on top of). > > [1] https://patchwork.ozlabs.org/patch/818881/ > > common/usb_kbd.c | 30 -- > 1 file changed, 24 insertions(+), 6 deletions(-) > > diff --git a/common/usb_kbd.c b/common/usb_kbd.c > index 4c3ad95fca..82ad93f6ca 100644 > --- a/common/usb_kbd.c > +++ b/common/usb_kbd.c > @@ -535,22 +535,40 @@ static int probe_usb_keyboard(struct usb_device *dev) > error = iomux_doenv(stdin, stdinname); > free(newstdin); > if (error) > - return error; > + goto unregister_stdio; > } else { > /* Check if this is the standard input device. */ > - if (strcmp(stdinname, DEVNAME)) > - return 1; > + if (strcmp(stdinname, DEVNAME)) { > + error = -1; Could we use some meaningful errno? > + goto unregister_stdio; > + } > > /* Reassign the console */ > - if (overwrite_console()) > - return 1; > + if (overwrite_console()) { > + error = -1; > + goto unregister_stdio; > + } > > error = console_assign(stdin, DEVNAME); > if (error) > - return error; > + goto unregister_stdio; > } > > return 0; > + > +unregister_stdio: > + /* > +* If probe fails, the device will be removed.. leaving dangling > +* pointers if the stdio device is not unregistered. If u-boot nits: U-Boot > +* is built without stdio_deregister(), just pretend to succeed > +* in order to avoid dangling pointers. > +*/ > +#if CONFIG_IS_ENABLED(SYS_STDIO_DEREGISTER) > + stdio_deregister(DEVNAME, 1); > + return error; > +#else > + return 0; Don't understand why 'return 0' here if probe fails... > +#endif > } > > #ifndef CONFIG_DM_USB > -- Regards, Bin ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2] fdt: update bcm283x device tree sources to Linux 4.14 state
Hi Alexander, Am 04.10.2017 um 14:39 schrieb Alexander Graf: Upstream Linux has received a few device tree updates to the RPi which we should propagate into the builtin U-Boot one as well to gain hardware support. This patch bumps the dts files to their 4.14 Linux counterparts with the exception of sdhost on 32bit RPi versions. There we stay with iproc as the sdhost driver is missing in U-Boot. out of curiosity, why is the RPi Zero isn't included? Best regards Stefan Signed-off-by: Alexander Graf--- v1 -> v2: - use sdhost on 32bit RPis --- arch/arm/dts/bcm2835-rpi-a-plus.dts| 74 +++- arch/arm/dts/bcm2835-rpi-a.dts | 76 +++- arch/arm/dts/bcm2835-rpi-b-plus.dts| 75 +++- arch/arm/dts/bcm2835-rpi-b-rev2.dts| 75 +++- arch/arm/dts/bcm2835-rpi-b.dts | 76 +++- arch/arm/dts/bcm2835-rpi.dtsi | 34 +++- arch/arm/dts/bcm2835.dtsi | 10 + arch/arm/dts/bcm2836-rpi-2-b.dts | 9 +- arch/arm/dts/bcm2836.dtsi | 11 ++ arch/arm/dts/bcm2837-rpi-3-b.dts | 35 +++- arch/arm/dts/bcm2837.dtsi | 13 +- arch/arm/dts/bcm283x-rpi-smsc9512.dtsi | 2 +- arch/arm/dts/bcm283x-rpi-smsc9514.dtsi | 2 +- arch/arm/dts/bcm283x-rpi-usb-host.dtsi | 3 + arch/arm/dts/bcm283x.dtsi | 325 - include/dt-bindings/clock/bcm2835.h| 2 + include/dt-bindings/pinctrl/bcm2835.h | 5 + 17 files changed, 801 insertions(+), 26 deletions(-) create mode 100644 arch/arm/dts/bcm283x-rpi-usb-host.dtsi diff --git a/arch/arm/dts/bcm2835-rpi-a-plus.dts b/arch/arm/dts/bcm2835-rpi-a-plus.dts index 35ff4e7a4a..9f866491ef 100644 --- a/arch/arm/dts/bcm2835-rpi-a-plus.dts +++ b/arch/arm/dts/bcm2835-rpi-a-plus.dts @@ -1,6 +1,7 @@ /dts-v1/; #include "bcm2835.dtsi" #include "bcm2835-rpi.dtsi" +#include "bcm283x-rpi-usb-host.dtsi" / { compatible = "raspberrypi,model-a-plus", "brcm,bcm2835"; @@ -21,7 +22,72 @@ }; { - pinctrl-0 = < _alt0 >; + /* +* This is based on the unreleased schematic for the Model A+. +* +* Legend: +* "NC" = not connected (no rail from the SoC) +* "FOO" = GPIO line named "FOO" on the schematic +* "FOO_N" = GPIO line named "FOO" on schematic, active low +*/ + gpio-line-names = "SDA0", + "SCL0", + "SDA1", + "SCL1", + "GPIO_GCLK", + "GPIO5", + "GPIO6", + "SPI_CE1_N", + "SPI_CE0_N", + "SPI_MISO", + "SPI_MOSI", + "SPI_SCLK", + "GPIO12", + "GPIO13", + /* Serial port */ + "TXD0", + "RXD0", + "GPIO16", + "GPIO17", + "GPIO18", + "GPIO19", + "GPIO20", + "GPIO21", + "GPIO22", + "GPIO23", + "GPIO24", + "GPIO25", + "GPIO26", + "GPIO27", + "SDA0", + "SCL0", + "NC", /* GPIO30 */ + "NC", /* GPIO31 */ + "CAM_GPIO1", /* GPIO32 */ + "NC", /* GPIO33 */ + "NC", /* GPIO34 */ + "PWR_LOW_N", /* GPIO35 */ + "NC", /* GPIO36 */ + "NC", /* GPIO37 */ + "USB_LIMIT", /* GPIO38 */ + "NC", /* GPIO39 */ + "PWM0_OUT", /* GPIO40 */ + "CAM_GPIO0", /* GPIO41 */ + "NC", /* GPIO42 */ + "NC", /* GPIO43 */ + "NC", /* GPIO44 */ + "PWM1_OUT", /* GPIO45 */ + "HDMI_HPD_N", + "STATUS_LED", + /* Used by SD Card */ + "SD_CLK_R", + "SD_CMD_R", + "SD_DATA0_R", + "SD_DATA1_R", + "SD_DATA2_R", + "SD_DATA3_R"; + + pinctrl-0 = < _alt0>; /* I2S interface */ i2s_alt0: i2s_alt0 { @@ -33,3 +99,9 @@ { hpd-gpios = < 46 GPIO_ACTIVE_LOW>; }; + + { + pinctrl-names = "default"; + pinctrl-0 = <_gpio14>; + status = "okay"; +}; diff --git a/arch/arm/dts/bcm2835-rpi-a.dts b/arch/arm/dts/bcm2835-rpi-a.dts index 306a84ee98..4b1af06c8d
Re: [U-Boot] [PATCH 1/1] test/py/tests/test_sleep.py: test time approximately
On 10/05/2017 11:10 PM, Stephen Warren wrote: > On 10/05/2017 01:52 PM, Heinrich Schuchardt wrote: >> On qemu errors like >> assert 2.999650001525879 >= 3 >> occur. > > Can you work out why? I guess 1-999650001525879 is a really tiny amount, > so perhaps it's OK. However, I'd like to keep the test strict if > possible; maybe rather than: > >> + assert elapsed >= (sleep_time - 0.25) > > can we use: > >> + assert elapsed >= (sleep_time - 0.01) > > ? > >> According to the comment in the code the test is meant to be >> approximate. So we should accept some milliseconds less. > > This test is deliberately very strict about the minimum time taken > during sleep, and slightly sloppy about over-sleeping. That's because > sleep should never wait too little time, but we allow a little extra > time due to e.g. the test system being a bit busy and not noticing when > the sleep wakes up. > You are making unreasonable assumptions about the accuracy of system clocks. I am not aware of U-Boot making any guarantees that the clock is never too fast. If you want sleep to never consume less time than requested you would at least always have to add 1 timer tick to the requested time in the sleep function. The test does not even use a timer function that is meant to measure with the accuracy that you expect. It uses Python function time.time() that is not guaranteed to have a resolution better than one second and has no guarantee to be non-decreasing. The right way to measure time for performance measurements is Python 3.3 function time.perf_counter(). QEMU provides no guarantees concerning time synchroniation. So shouldn't we be happy with the little randomness that we see in some systems, e.g. 3.000195026397705 3.35047531128 3.000230073928833 2.9996659755706787 3.0026118755340576 3.0025811195373535 3.0034120082855225 3.002816915512085 3.002542018890381 3.0020010471343994 Best regards Heinrich ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] dm: replace dm_dbg() with pr_debug()
On Fri, Sep 29, 2017 at 12:31:20PM +0900, Masahiro Yamada wrote: > As we discussed before in ML, dm_dbg() causes undefined reference > error if #define DEBUG is added to users, but not drivers/core/util.c > > We do not need this macro because we can use pr_debug() instead, and > it is pretty easy to enable it for the DM core by using ccflags-y. > > Signed-off-by: Masahiro YamadaApplied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] disk: part_dos: Use the original allocation scheme for the SPL case
On Wed, Oct 04, 2017 at 01:29:57PM -0300, Fabio Estevam wrote: > Since commit ff98cb90514d ("part: extract MBR signature from partitions") > SPL boot on i.MX6 starts to fail: > > U-Boot SPL 2017.09-00221-g0d6ab32 (Oct 02 2017 - 15:13:19) > Trying to boot from MMC1 > (keep in loop) > > Use the original allocation scheme for the SPL case, so that MX6 boards > can boot again. > > This is a temporary solution to avoid the boot regression. > > Signed-off-by: Fabio Estevam> Acked-by: Rob Clark > Tested-by: Peter Robinson Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, v2] linux/bitfield.h: import from Linux 4.13
On Fri, Sep 29, 2017 at 10:35:17AM +0900, Masahiro Yamada wrote: > Copied from Linux 4.13. > > Commit log of 3e9b3112ec74 of Linux explains well why this header > is useful. > > Signed-off-by: Masahiro YamadaApplied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, v2, 6/8] bug.h: sync BUILD_BUG stuff with Linux 4.13
On Sat, Sep 16, 2017 at 02:10:44PM +0900, Masahiro Yamada wrote: > As commit 84b8bf6d5d2a ("bug.h: move BUILD_BUG_* defines to > include/linux/bug.h") noted, include/linux/bug.h was locally > modified for U-Boot because the name conflict of error() caused > build errors at that time. > > Now error() is gone, so we can fully sync BUILD_BUG* with Linux. > These macros are just compile-time utilities. Nothing depends on > platform code, so it should make sense to simply copy Linux's ones. > > Please note Linux split BUILD_BUG stuff out into > by commit bc6245e5efd7. Let's follow it. > > Signed-off-by: Masahiro YamadaApplied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot,v2,4/8] common.h: remove error()
On Sat, Sep 16, 2017 at 02:10:42PM +0900, Masahiro Yamada wrote: > This macro prevents us from using compiletime_error/assert defined > in . > > Now we can remove it, then we will be able to import more BUILD_BUG > macros from Linux. > > Signed-off-by: Masahiro YamadaApplied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, v2, 1/8] stdio.h: move printf() stuff from to
On Sat, Sep 16, 2017 at 02:10:39PM +0900, Masahiro Yamada wrote: > pulls in a lot of headers. Including it from every .c > file is a bad idea. We need to remove contents until it contains > nothing. > > Move printf() and friends to . > > Signed-off-by: Masahiro YamadaApplied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot,v2,5/8] vsprintf.h: include
On Sat, Sep 16, 2017 at 02:10:43PM +0900, Masahiro Yamada wrote: > This header uses ulong, size_t, loff_t. > Include to make this header self-contained. > > Signed-off-by: Masahiro YamadaApplied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, v2, 7/8] bug.h: move runtime BUG/WARN macros into
On Sat, Sep 16, 2017 at 02:10:45PM +0900, Masahiro Yamada wrote: > Collect runtime BUG/WARN into a self-contained header > to make these macros easier to use. > > Signed-off-by: Masahiro YamadaApplied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, v2, 3/8] treewide: replace with error() with pr_err()
On Sat, Sep 16, 2017 at 02:10:41PM +0900, Masahiro Yamada wrote: > U-Boot widely uses error() as a bit noisier variant of printf(). > > This macro causes name conflict with the following line in > include/linux/compiler-gcc.h: > > # define __compiletime_error(message) __attribute__((error(message))) > > This prevents us from using __compiletime_error(), and makes it > difficult to fully sync BUILD_BUG macros with Linux. (Notice > Linux's BUILD_BUG_ON_MSG is implemented by using compiletime_assert().) > > Let's convert error() into now treewide-available pr_err(). > > Done with the help of Coccinelle, excluing tools/ directory. > > The semantic patch I used is as follows: > > // > > -error > +pr_err > (...) > // > > Signed-off-by: Masahiro Yamada> Reviewed-by: Simon Glass Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, v3, 8/8] dm: define dev_*() log functions in DM header
On Tue, Sep 26, 2017 at 11:58:29AM +0900, Masahiro Yamada wrote: > Many drivers had started to use dev_err, dev_info, etc. for log > functions. Currently, we are relying on , but I > guess the best home is , taking into account that > Linux defines them in . > > For now, I am leaving the ones in because lots of > Linux-originated code uses dev_*(), but the first argument is not > struct udevice, so we need to ignore the bogus argument. More > efforts are needed to iron out the issues. > > Signed-off-by: Masahiro Yamada> Reviewed-by: Simon Glass Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, v2, 2/8] printk: collect printk stuff into with loglevel support
On Sat, Sep 16, 2017 at 02:10:40PM +0900, Masahiro Yamada wrote: > When we import code from Linux, with regular re-sync planned, we want > to use printk() and pr_*(). U-Boot does not support them in a clean > way. So, people end up with local macros, or compat headers here and > there, then we occasionally see build errors of definition conflicts. > > We have include/linux/compat.h, but putting all sorts of unrelated > things into a single header is just a temporal workaround. Hence this > patch, to find the best home for all printk variants. If you want to > use printk() and friends, please include . This header > is self-contained, and pulls in only a few headers. > > When I was testing this clean-up, I noticed the image size exceeded > its platform limit on some boards. This is because all pr_*() that > were previously defined as no-op in include/linux/mtd/mtd.h (unless > CONFIG_MTD_DEBUG is set), are now enabled. > > To make such boards happy, this commit also implements CONFIG_LOGLEVEL. > The concept is similar to the kernel parameter "loglevel". (Actually, > the Kconfig help message was taken from kernel-paremeter.txt of Linux) > Messages with a loglevel smaller than console loglevel will be printed. > > The difference is the loglevel is build-time determined. To save the > image size, lower priority pr_*() are compiled out. I set the default > of CONFIG_LOGLEVEL to 6, i.e. pr_notice and higher priority messages > are compiled in. > > I adjusted CONFIG_LOGLEVEL to avoid build error for some boards. > > Signed-off-by: Masahiro YamadaApplied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] common: Drop LOGLEVEL to 4
On Thu, Oct 05, 2017 at 08:26:16AM -0400, Tom Rini wrote: > While this came in with a default value of 6 I am lowering this to 4. > The MTD/UBI code has a large number of error messages that we include > now. In addition, "normally" warning messages are not included so this > feels like a more natural level to have. > > Signed-off-by: Tom RiniApplied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [GIT PULL v3] u-boot-sunxi/master
On Wed, Oct 04, 2017 at 04:20:53PM +0200, Maxime Ripard wrote: > Hi Tom, > > Hopefully it's going to be the final version of that PR. > > It passed on travis-ci, so we should be all set. > > Thanks! > Maxime > > The following changes since commit 39dd65a059e503883dbf16d4c00ac083d15837da: > > sandbox: Enable btrfs support (2017-10-03 08:44:55 -0400) > > are available in the git repository at: > > git://git.denx.de/u-boot-sunxi sunxi/master > > for you to fetch changes up to e6ee85a6891eca187c9a9364c51690d3f6a36932: > > sunxi: only init USB Ethernet gadget when it's enabled (2017-10-03 19:12:06 > +0200) > Applied to u-boot/master, thanks! > ___ > U-Boot mailing list > U-Boot@lists.denx.de > https://lists.denx.de/listinfo/u-boot -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/1] test/py/tests/test_sleep.py: test time approximately
On Thu, Oct 05, 2017 at 03:10:43PM -0600, Stephen Warren wrote: > On 10/05/2017 01:52 PM, Heinrich Schuchardt wrote: > >On qemu errors like > >assert 2.999650001525879 >= 3 > >occur. > > Can you work out why? I guess 1-999650001525879 is a really tiny amount, so > perhaps it's OK. However, I'd like to keep the test strict if possible; > maybe rather than: It would be good to know. Today we just always skip this on all qemu targets as it fails like this much of the time. -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/1] test/py/tests/test_sleep.py: test time approximately
On 10/05/2017 01:52 PM, Heinrich Schuchardt wrote: On qemu errors like assert 2.999650001525879 >= 3 occur. Can you work out why? I guess 1-999650001525879 is a really tiny amount, so perhaps it's OK. However, I'd like to keep the test strict if possible; maybe rather than: > +assert elapsed >= (sleep_time - 0.25) can we use: > +assert elapsed >= (sleep_time - 0.01) ? According to the comment in the code the test is meant to be approximate. So we should accept some milliseconds less. This test is deliberately very strict about the minimum time taken during sleep, and slightly sloppy about over-sleeping. That's because sleep should never wait too little time, but we allow a little extra time due to e.g. the test system being a bit busy and not noticing when the sleep wakes up. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/1] test/py/tests/test_sleep.py: test time approximately
On qemu errors like assert 2.999650001525879 >= 3 occur. According to the comment in the code the test is meant to be approximate. So we should accept some milliseconds less. Signed-off-by: Heinrich Schuchardt--- test/py/tests/test_sleep.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/py/tests/test_sleep.py b/test/py/tests/test_sleep.py index b59a4cfc0f..5f0c4c2bfc 100644 --- a/test/py/tests/test_sleep.py +++ b/test/py/tests/test_sleep.py @@ -17,7 +17,7 @@ def test_sleep(u_boot_console): u_boot_console.run_command('sleep %d' % sleep_time) tend = time.time() elapsed = tend - tstart -assert elapsed >= sleep_time +assert elapsed >= (sleep_time - 0.25) if not u_boot_console.config.gdbserver: # 0.25s margin is hopefully enough to account for any system overhead. assert elapsed < (sleep_time + 0.25) -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [RESEND PATCH 3/5] video: add anx6345 DM driver
Hi André, On Thu, Oct 5, 2017 at 11:44 AM, André Przywarawrote: > On 19/09/17 06:04, Vasily Khoruzhick wrote: >> This is a eDP bridge similar to ANX9804, it allows to connect eDP panels >> to the chips that can output only parallel signal > > Have you tried using the existing driver? > Icenowy did this some months ago[1], and she got away with quite a small > patch to support the ANX6345 as well: > > https://github.com/Icenowy/u-boot/commit/354b24c2064ab4f1b13568f61ab24ea97294a16d Existing ANX9804 driver is very primitive and moreover it doesn't support DM. Please note that my driver can read EDID and DPCD and thus is more flexible if you compare it to the old driver -- no hardcoded modes, lane configuration, etc. Unfortunately I don't have anything with ANX9804, so I can't make my ANX6345 driver compatible with ANX9804. Regards, Vasily > Cheers, > Andre. > > [1] https://github.com/Icenowy/u-boot/commits/a64-pb-lcd > >> Signed-off-by: Vasily Khoruzhick >> --- >> drivers/video/bridge/Kconfig | 8 + >> drivers/video/bridge/Makefile | 1 + >> drivers/video/bridge/anx6345.c | 419 >> + >> 3 files changed, 428 insertions(+) >> create mode 100644 drivers/video/bridge/anx6345.c >> >> diff --git a/drivers/video/bridge/Kconfig b/drivers/video/bridge/Kconfig >> index 2a3b6c4bee..765f7380b8 100644 >> --- a/drivers/video/bridge/Kconfig >> +++ b/drivers/video/bridge/Kconfig >> @@ -25,3 +25,11 @@ config VIDEO_BRIDGE_NXP_PTN3460 >> signalling) converter. It enables an LVDS LCD panel to be connected >> to an eDP output device such as an SoC that lacks LVDS capability, >> or where LVDS requires too many signals to route on the PCB. >> + >> +config VIDEO_BRIDGE_ANALOGIX_ANX6345 >> + bool "Support Analogix ANX6345 RGB->DP bridge" >> + depends on VIDEO_BRIDGE >> + select DM_I2C >> + help >> + The Analogix ANX6345 is RGB-to-DP converter. It enables an eDP LCD >> + panel to be connected to an parallel LCD interface. >> diff --git a/drivers/video/bridge/Makefile b/drivers/video/bridge/Makefile >> index ce731fa4ca..2a746c6f8b 100644 >> --- a/drivers/video/bridge/Makefile >> +++ b/drivers/video/bridge/Makefile >> @@ -7,3 +7,4 @@ >> obj-$(CONFIG_VIDEO_BRIDGE) += video-bridge-uclass.o >> obj-$(CONFIG_VIDEO_BRIDGE_PARADE_PS862X) += ps862x.o >> obj-$(CONFIG_VIDEO_BRIDGE_NXP_PTN3460) += ptn3460.o >> +obj-$(CONFIG_VIDEO_BRIDGE_ANALOGIX_ANX6345) += anx6345.o >> diff --git a/drivers/video/bridge/anx6345.c b/drivers/video/bridge/anx6345.c >> new file mode 100644 >> index 00..6bac9a51a9 >> --- /dev/null >> +++ b/drivers/video/bridge/anx6345.c >> @@ -0,0 +1,419 @@ >> +/* >> + * Copyright (C) 2017 Vasily Khoruzhick >> + * >> + * SPDX-License-Identifier: GPL-2.0+ >> + */ >> + >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +#define DP_MAX_LINK_RATE 0x001 >> +#define DP_MAX_LANE_COUNT0x002 >> +#define DP_MAX_LANE_COUNT_MASK 0x1f >> + >> +DECLARE_GLOBAL_DATA_PTR; >> + >> +struct anx6345_priv { >> + u8 edid[EDID_SIZE]; >> +}; >> + >> +static int anx6345_write(struct udevice *dev, unsigned addr_off, >> + unsigned char reg_addr, unsigned char value) >> +{ >> + uint8_t buf[2]; >> + struct i2c_msg msg; >> + int ret; >> + >> + msg.addr = addr_off; >> + msg.flags = 0; >> + buf[0] = reg_addr; >> + buf[1] = value; >> + msg.buf = buf; >> + msg.len = 2; >> + ret = dm_i2c_xfer(dev, , 1); >> + if (ret) { >> + debug("%s: write failed, reg=%#x, value=%#x, ret=%d\n", >> + __func__, reg_addr, value, ret); >> + return ret; >> + } >> + >> + return 0; >> +} >> + >> +static int anx6345_read(struct udevice *dev, unsigned addr_off, >> + unsigned char reg_addr, unsigned char *value) >> +{ >> + uint8_t addr, val; >> + struct i2c_msg msg[2]; >> + int ret; >> + >> + msg[0].addr = addr_off; >> + msg[0].flags = 0; >> + addr = reg_addr; >> + msg[0].buf = >> + msg[0].len = 1; >> + msg[1].addr = addr_off; >> + msg[1].flags = I2C_M_RD; >> + msg[1].buf = >> + msg[1].len = 1; >> + ret = dm_i2c_xfer(dev, msg, 2); >> + if (ret) { >> + debug("%s: read failed, reg=%.2x, value=%p, ret=%d\n", >> + __func__, (int)reg_addr, value, ret); >> + return ret; >> + } >> + *value = val; >> + >> + return 0; >> +} >> + >> +static int anx6345_write_r0(struct udevice *dev, unsigned char reg_addr, >> + unsigned char value) >> +{ >> + struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); >> + return anx6345_write(dev, chip->chip_addr, reg_addr, value); >> +} >> + >> +static int anx6345_read_r0(struct udevice *dev, unsigned char reg_addr, >> +
Re: [U-Boot] [RESEND PATCH 3/5] video: add anx6345 DM driver
On 19/09/17 06:04, Vasily Khoruzhick wrote: > This is a eDP bridge similar to ANX9804, it allows to connect eDP panels > to the chips that can output only parallel signal Have you tried using the existing driver? Icenowy did this some months ago[1], and she got away with quite a small patch to support the ANX6345 as well: https://github.com/Icenowy/u-boot/commit/354b24c2064ab4f1b13568f61ab24ea97294a16d Cheers, Andre. [1] https://github.com/Icenowy/u-boot/commits/a64-pb-lcd > Signed-off-by: Vasily Khoruzhick> --- > drivers/video/bridge/Kconfig | 8 + > drivers/video/bridge/Makefile | 1 + > drivers/video/bridge/anx6345.c | 419 > + > 3 files changed, 428 insertions(+) > create mode 100644 drivers/video/bridge/anx6345.c > > diff --git a/drivers/video/bridge/Kconfig b/drivers/video/bridge/Kconfig > index 2a3b6c4bee..765f7380b8 100644 > --- a/drivers/video/bridge/Kconfig > +++ b/drivers/video/bridge/Kconfig > @@ -25,3 +25,11 @@ config VIDEO_BRIDGE_NXP_PTN3460 > signalling) converter. It enables an LVDS LCD panel to be connected > to an eDP output device such as an SoC that lacks LVDS capability, > or where LVDS requires too many signals to route on the PCB. > + > +config VIDEO_BRIDGE_ANALOGIX_ANX6345 > + bool "Support Analogix ANX6345 RGB->DP bridge" > + depends on VIDEO_BRIDGE > + select DM_I2C > + help > + The Analogix ANX6345 is RGB-to-DP converter. It enables an eDP LCD > + panel to be connected to an parallel LCD interface. > diff --git a/drivers/video/bridge/Makefile b/drivers/video/bridge/Makefile > index ce731fa4ca..2a746c6f8b 100644 > --- a/drivers/video/bridge/Makefile > +++ b/drivers/video/bridge/Makefile > @@ -7,3 +7,4 @@ > obj-$(CONFIG_VIDEO_BRIDGE) += video-bridge-uclass.o > obj-$(CONFIG_VIDEO_BRIDGE_PARADE_PS862X) += ps862x.o > obj-$(CONFIG_VIDEO_BRIDGE_NXP_PTN3460) += ptn3460.o > +obj-$(CONFIG_VIDEO_BRIDGE_ANALOGIX_ANX6345) += anx6345.o > diff --git a/drivers/video/bridge/anx6345.c b/drivers/video/bridge/anx6345.c > new file mode 100644 > index 00..6bac9a51a9 > --- /dev/null > +++ b/drivers/video/bridge/anx6345.c > @@ -0,0 +1,419 @@ > +/* > + * Copyright (C) 2017 Vasily Khoruzhick > + * > + * SPDX-License-Identifier: GPL-2.0+ > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#define DP_MAX_LINK_RATE 0x001 > +#define DP_MAX_LANE_COUNT0x002 > +#define DP_MAX_LANE_COUNT_MASK 0x1f > + > +DECLARE_GLOBAL_DATA_PTR; > + > +struct anx6345_priv { > + u8 edid[EDID_SIZE]; > +}; > + > +static int anx6345_write(struct udevice *dev, unsigned addr_off, > + unsigned char reg_addr, unsigned char value) > +{ > + uint8_t buf[2]; > + struct i2c_msg msg; > + int ret; > + > + msg.addr = addr_off; > + msg.flags = 0; > + buf[0] = reg_addr; > + buf[1] = value; > + msg.buf = buf; > + msg.len = 2; > + ret = dm_i2c_xfer(dev, , 1); > + if (ret) { > + debug("%s: write failed, reg=%#x, value=%#x, ret=%d\n", > + __func__, reg_addr, value, ret); > + return ret; > + } > + > + return 0; > +} > + > +static int anx6345_read(struct udevice *dev, unsigned addr_off, > + unsigned char reg_addr, unsigned char *value) > +{ > + uint8_t addr, val; > + struct i2c_msg msg[2]; > + int ret; > + > + msg[0].addr = addr_off; > + msg[0].flags = 0; > + addr = reg_addr; > + msg[0].buf = > + msg[0].len = 1; > + msg[1].addr = addr_off; > + msg[1].flags = I2C_M_RD; > + msg[1].buf = > + msg[1].len = 1; > + ret = dm_i2c_xfer(dev, msg, 2); > + if (ret) { > + debug("%s: read failed, reg=%.2x, value=%p, ret=%d\n", > + __func__, (int)reg_addr, value, ret); > + return ret; > + } > + *value = val; > + > + return 0; > +} > + > +static int anx6345_write_r0(struct udevice *dev, unsigned char reg_addr, > + unsigned char value) > +{ > + struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); > + return anx6345_write(dev, chip->chip_addr, reg_addr, value); > +} > + > +static int anx6345_read_r0(struct udevice *dev, unsigned char reg_addr, > +unsigned char *value) > +{ > + struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); > + return anx6345_read(dev, chip->chip_addr, reg_addr, value); > +} > + > +static int anx6345_write_r1(struct udevice *dev, unsigned char reg_addr, > + unsigned char value) > +{ > + struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); > + return anx6345_write(dev, chip->chip_addr + 1, reg_addr, value); > +} > + > +static int anx6345_read_r1(struct udevice *dev, unsigned char reg_addr, > +unsigned char *value) > +{ > +
Re: [U-Boot] [RESEND PATCH 2/5] video: anx9804: split out registers definitions into a separate header
Hi Vasily, On 19/09/17 06:04, Vasily Khoruzhick wrote: > This header will be used in anx6345 driver In this case it shouldn't live in a generic include directory, as it only contains private driver internals which are of no further use for the rest of U-Boot. So you should move it into drivers/video at least and include it with quotation marks. But actually you can get rid of this whole patch, check my answer on the next patch ... Cheers, Andre. > > Signed-off-by: Vasily Khoruzhick> --- > drivers/video/anx9804.c | 54 +-- > include/anx98xx-edp.h | 98 > + > 2 files changed, 99 insertions(+), 53 deletions(-) > create mode 100644 include/anx98xx-edp.h > > diff --git a/drivers/video/anx9804.c b/drivers/video/anx9804.c > index 37ad69a039..67f7da7d18 100755 > --- a/drivers/video/anx9804.c > +++ b/drivers/video/anx9804.c > @@ -12,61 +12,9 @@ > > #include > #include > +#include > #include "anx9804.h" > > -/* Registers at i2c address 0x38 */ > - > -#define ANX9804_HDCP_CONTROL_0_REG 0x01 > - > -#define ANX9804_SYS_CTRL2_REG0x81 > -#define ANX9804_SYS_CTRL2_CHA_STA0x04 > - > -#define ANX9804_SYS_CTRL3_REG0x82 > -#define ANX9804_SYS_CTRL3_VALID_CTRL BIT(0) > -#define ANX9804_SYS_CTRL3_F_VALIDBIT(1) > -#define ANX9804_SYS_CTRL3_HPD_CTRL BIT(4) > -#define ANX9804_SYS_CTRL3_F_HPD BIT(5) > - > -#define ANX9804_LINK_BW_SET_REG 0xa0 > -#define ANX9804_LANE_COUNT_SET_REG 0xa1 > -#define ANX9804_TRAINING_PTN_SET_REG 0xa2 > -#define ANX9804_TRAINING_LANE0_SET_REG 0xa3 > -#define ANX9804_TRAINING_LANE1_SET_REG 0xa4 > -#define ANX9804_TRAINING_LANE2_SET_REG 0xa5 > -#define ANX9804_TRAINING_LANE3_SET_REG 0xa6 > - > -#define ANX9804_LINK_TRAINING_CTRL_REG 0xa8 > -#define ANX9804_LINK_TRAINING_CTRL_ENBIT(0) > - > -#define ANX9804_LINK_DEBUG_REG 0xb8 > -#define ANX9804_PLL_CTRL_REG 0xc7 > -#define ANX9804_ANALOG_POWER_DOWN_REG0xc8 > - > -/* Registers at i2c address 0x39 */ > - > -#define ANX9804_DEV_IDH_REG 0x03 > - > -#define ANX9804_POWERD_CTRL_REG 0x05 > -#define ANX9804_POWERD_AUDIO BIT(4) > - > -#define ANX9804_RST_CTRL_REG 0x06 > - > -#define ANX9804_RST_CTRL2_REG0x07 > -#define ANX9804_RST_CTRL2_AUXBIT(2) > -#define ANX9804_RST_CTRL2_AC_MODEBIT(6) > - > -#define ANX9804_VID_CTRL1_REG0x08 > -#define ANX9804_VID_CTRL1_VID_EN BIT(7) > -#define ANX9804_VID_CTRL1_EDGE BIT(0) > - > -#define ANX9804_VID_CTRL2_REG0x09 > -#define ANX9804_ANALOG_DEBUG_REG10xdc > -#define ANX9804_ANALOG_DEBUG_REG30xde > -#define ANX9804_PLL_FILTER_CTRL1 0xdf > -#define ANX9804_PLL_FILTER_CTRL3 0xe1 > -#define ANX9804_PLL_FILTER_CTRL 0xe2 > -#define ANX9804_PLL_CTRL30xe6 > - > /** > * anx9804_init() - Init anx9804 parallel lcd to edp bridge chip > * > diff --git a/include/anx98xx-edp.h b/include/anx98xx-edp.h > new file mode 100644 > index 00..f7e8baa167 > --- /dev/null > +++ b/include/anx98xx-edp.h > @@ -0,0 +1,98 @@ > +/* > + * Copyright (C) 2015 Hans de Goede > + * Copyright (C) 2017 Vasily Khoruzhick > + * > + * SPDX-License-Identifier: GPL-2.0+ > + */ > + > +/* Registers at i2c address 0x38 */ > + > +#define ANX9804_HDCP_CONTROL_0_REG 0x01 > + > +#define ANX9804_SYS_CTRL1_REG0x80 > +#define ANX9804_SYS_CTRL1_PD_IO 0x80 > +#define ANX9804_SYS_CTRL1_PD_VID 0x40 > +#define ANX9804_SYS_CTRL1_PD_LINK0x20 > +#define ANX9804_SYS_CTRL1_PD_TOTAL 0x10 > +#define ANX9804_SYS_CTRL1_MODE_SEL 0x08 > +#define ANX9804_SYS_CTRL1_DET_STA0x04 > +#define ANX9804_SYS_CTRL1_FORCE_DET
[U-Boot] [PATCH] iso: Reduce verbosity on test call
The test callback into the partition callback struct is used by the "part list" command on the command line. That command is used by the distro script. With verb=1 set, "part list" thus throws a lot of warnings about partitions it can't find when an upper layer searches for partitions. So let's reduce verbosity to bring it to the same level of noise as the other partition targets. Signed-off-by: Alexander Graf--- disk/part_iso.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/disk/part_iso.c b/disk/part_iso.c index 8aef251f4e..a7fb0a0975 100644 --- a/disk/part_iso.c +++ b/disk/part_iso.c @@ -228,7 +228,7 @@ static int part_test_iso(struct blk_desc *dev_desc) { disk_partition_t info; - return part_get_info_iso_verb(dev_desc, 1, , 1); + return part_get_info_iso_verb(dev_desc, 1, , 0); } U_BOOT_PART_TYPE(iso) = { -- 2.12.3 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] SPL: SPI: select SPL_SPI_FLASH_SUPPORT on SPL_SPI_SUNXI
On Wed, Oct 04, 2017 at 11:27:21PM +, Andre Przywara wrote: > The Allwinner SPI flash SPL boot support is guarded by the SPL_SPI_SUNXI > symbol. But despite its generic name, the actual only use case for this > is to provide SPI flash support to the SPL, which requires > CONFIG_SPL_SPI_FLASH_SUPPORT to be defined. > Select this symbol from the SPL_SPI_SUNXI Kconfig definition. This > avoids doing this explicitly in the defconfig, and fixes SPI booting on > the Pine64 SoPine (and -LTS version) and the OrangePi Win board (both with > SPI flash). > > Signed-off-by: Andre PrzywaraApplied, thanks! Maxime -- Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2] fdt: update bcm283x device tree sources to Linux 4.14 state
On 05.10.17 18:52, Stefan Wahren wrote: Hi Alexander, Am 04.10.2017 um 14:39 schrieb Alexander Graf: Upstream Linux has received a few device tree updates to the RPi which we should propagate into the builtin U-Boot one as well to gain hardware support. This patch bumps the dts files to their 4.14 Linux counterparts with the exception of sdhost on 32bit RPi versions. There we stay with iproc as the sdhost driver is missing in U-Boot. out of curiosity, why is the RPi Zero isn't included? It wasn't included before, so I didn't want to introduce it in this update. Basically we don't have a zero U-Boot target today. I think that's wrong - we should allow for more than a single built-in DT to exist and choose the one we pick based on the target machine we find. But that's bigger than this patch :) Alex ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] tools: bmp_logo: correctly interpret BMP files with larger headers
All BMP files were being treated as though they had a 40 byte header. There are several BMP header formats consisting of additional data. This was causing some of the header to be read as color information, skewing the color palette. Signed-off-by: Jon Smith--- tools/bmp_logo.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/bmp_logo.c b/tools/bmp_logo.c index 2247adcc82..55f833fb9b 100644 --- a/tools/bmp_logo.c +++ b/tools/bmp_logo.c @@ -76,7 +76,7 @@ int main (int argc, char *argv[]) FILE*fp; bitmap_t bmp; bitmap_t *b = - uint16_t data_offset, n_colors; + uint16_t data_offset, n_colors, hdr_size; if (argc < 3) { usage(argv[0]); @@ -108,7 +108,12 @@ int main (int argc, char *argv[]) skip_bytes (fp, 8); if (fread (_offset, sizeof (uint16_t), 1, fp) != 1) error ("Couldn't read bitmap data offset", fp); - skip_bytes (fp, 6); + skip_bytes(fp, 2); + if (fread(_size, sizeof(uint16_t), 1, fp) != 1) + error("Couldn't read bitmap header size", fp); + if (hdr_size < 40) + error("Invalid bitmap header", fp); + skip_bytes(fp, 2); if (fread (>width, sizeof (uint16_t), 1, fp) != 1) error ("Couldn't read bitmap width", fp); skip_bytes (fp, 2); @@ -117,7 +122,7 @@ int main (int argc, char *argv[]) skip_bytes (fp, 22); if (fread (_colors, sizeof (uint16_t), 1, fp) != 1) error ("Couldn't read bitmap colors", fp); - skip_bytes (fp, 6); + skip_bytes(fp, hdr_size - 34); /* * Repair endianess. -- 2.14.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2] arm64: ls1012afrdm: Add distro boot support
On 10/05/2017 01:47 AM, Rajesh Bhagat wrote: > Include common config_distro_defaults.h and config_distro_bootcmd.h > for u-boot enviroments to support automatical distro boot which > scan boot.scr from external storage devices(e.g. SD and USB) > and execute autoboot script. > > Signed-off-by: Bhaskar Upadhaya> Signed-off-by: Rajesh Bhagat > --- > Depends on: > https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatchwork.ozlabs.org%2Fpatch%2F808617%2F=01%7C01%7Cyork.sun%40nxp.com%7C83457d3a96b74d7dd33d08d50bcdb2c9%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0=sKmaJpoaeK1JXMf%2F%2Ba%2BPlUQtY3HumeB08I6MKTWchzc%3D=0 > > Changes in v2: > - Removed the extra "\" character from macro definition > - Dropped the #if for CONFIG_BOOTCOMMAND > > configs/ls1012afrdm_qspi_defconfig | 1 + > include/configs/ls1012afrdm.h | 57 > -- > 2 files changed, 49 insertions(+), 9 deletions(-) > > diff --git a/configs/ls1012afrdm_qspi_defconfig > b/configs/ls1012afrdm_qspi_defconfig > index fe95f04..42acff0 100644 > --- a/configs/ls1012afrdm_qspi_defconfig > +++ b/configs/ls1012afrdm_qspi_defconfig > @@ -46,3 +46,4 @@ CONFIG_DM_USB=y > CONFIG_USB_XHCI_HCD=y > CONFIG_USB_XHCI_DWC3=y > CONFIG_USB_STORAGE=y > +CONFIG_DISTRO_DEFAULTS=y > diff --git a/include/configs/ls1012afrdm.h b/include/configs/ls1012afrdm.h > index 6b1ba57..4d6448b 100644 > --- a/include/configs/ls1012afrdm.h > +++ b/include/configs/ls1012afrdm.h > @@ -20,16 +20,55 @@ > #define CONFIG_SYS_MEMTEST_START 0x8000 > #define CONFIG_SYS_MEMTEST_END 0x9fff > > +#ifndef CONFIG_SPL_BUILD > +#undef BOOT_TARGET_DEVICES > +#define BOOT_TARGET_DEVICES(func) \ > + func(USB, usb, 0) > +#endif > + > #undef CONFIG_EXTRA_ENV_SETTINGS > -#define CONFIG_EXTRA_ENV_SETTINGS \ > - "verify=no\0" \ > - "loadaddr=0x8010\0" \ > - "kernel_addr=0x10\0"\ > - "fdt_high=0x\0" \ > - "initrd_high=0x\0" \ > - "kernel_start=0xa0\0" \ > - "kernel_load=0x9600\0" \ > - "kernel_size=0x280\0" > +#define CONFIG_EXTRA_ENV_SETTINGS\ > + "verify=no\0" \ > + "fdt_high=0x\0" \ > + "initrd_high=0x\0" \ > + "fdt_addr=0x00f0\0" \ > + "kernel_addr=0x0100\0" \ > + "scriptaddr=0x8000\0" \ > + "fdtheader_addr_r=0x8010\0" \ > + "kernelheader_addr_r=0x8020\0" \ > + "kernel_addr_r=0x9600\0"\ > + "fdt_addr_r=0x9000\0" \ > + "load_addr=0x9600\0"\ > + "kernel_size=0x280\0" \ > + "console=ttyS0,115200\0"\ > + BOOTENV \ > + "boot_scripts=ls1012afrdm_boot.scr\0" \ > + "scan_dev_for_boot_part=" \ > + "part list ${devtype} ${devnum} devplist; "\ > + "env exists devplist || setenv devplist 1; " \ > + "for distro_bootpart in ${devplist}; do " \ > + "if fstype ${devtype} " \ > + "${devnum}:${distro_bootpart} " \ > + "bootfstype; then " \ > + "run scan_dev_for_boot; " \ > + "fi; "\ > + "done\0" \ > + "scan_dev_for_boot=" \ > + "echo Scanning ${devtype} " \ > + "${devnum}:${distro_bootpart}...; " \ > + "for prefix in ${boot_prefixes}; do " \ > + "run scan_dev_for_scripts; " \ > + "done;" \ > + "\0" \ > + "installer=load usb 0:2 $load_addr "\ > +"/flex_installer_arm64.itb; "\ > +"bootm $load_addr#$board\0" \ > + "qspi_bootcmd=echo Trying load from qspi..;"\ > + "sf probe && sf read $load_addr " \ > + "$kernel_addr $kernel_size && bootm $load_addr#$board\0" > + http://patchwork.ozlabs.org/patch/808617/ changes CONFIG_EXTRA_ENV_SETTINGS which you just redefined. Do you really depend on that patch? That patch needs an update. York ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v4] arm64: ls1012ardb: Add distro boot support
On 10/05/2017 01:47 AM, Rajesh Bhagat wrote: > Include common config_distro_defaults.h and config_distro_bootcmd.h > for u-boot enviroments to support automatical distro boot which > scan boot.scr from external storage devices(e.g. SD and USB) > and execute autoboot script. > > Signed-off-by: Bhaskar Upadhaya> Signed-off-by: Rajesh Bhagat > --- > Depends on: > https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatchwork.ozlabs.org%2Fpatch%2F808617%2F=01%7C01%7Cyork.sun%40nxp.com%7C4712a6e59b864697f6c108d50bcdaeac%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0=dzkaNe45yeHuhF8P0%2F3DXSfZIX1c%2FWf9%2FMAMUwwIpV4%3D=0 > > Changes in v4: > - Removed the extra "\" character from macro definition > - Dropped the #if for CONFIG_BOOTCOMMAND > > Changes in v3: > Removed pfe stop command from BOOTCMD > > Changes in v2: > Rebased to latest u-boot > > configs/ls1012ardb_qspi_defconfig | 1 + > include/configs/ls1012a_common.h | 10 - > include/configs/ls1012ardb.h | 43 > +++ > 3 files changed, 53 insertions(+), 1 deletion(-) > > diff --git a/configs/ls1012ardb_qspi_defconfig > b/configs/ls1012ardb_qspi_defconfig > index 81702e3..39d7a54 100644 > --- a/configs/ls1012ardb_qspi_defconfig > +++ b/configs/ls1012ardb_qspi_defconfig > @@ -50,3 +50,4 @@ CONFIG_DM_USB=y > CONFIG_USB_XHCI_HCD=y > CONFIG_USB_XHCI_DWC3=y > CONFIG_USB_STORAGE=y > +CONFIG_DISTRO_DEFAULTS=y > diff --git a/include/configs/ls1012a_common.h > b/include/configs/ls1012a_common.h > index 096799e..b2d2307 100644 > --- a/include/configs/ls1012a_common.h > +++ b/include/configs/ls1012a_common.h > @@ -90,6 +90,14 @@ > #define CONFIG_HWCONFIG > #define HWCONFIG_BUFFER_SIZE 128 > > +#include > +#ifndef CONFIG_SPL_BUILD > +#define BOOT_TARGET_DEVICES(func) \ > + func(MMC, mmc, 0) \ > + func(USB, usb, 0) > +#include > +#endif > + > /* Initial environment variables */ > #define CONFIG_EXTRA_ENV_SETTINGS\ > "verify=no\0" \ > @@ -101,6 +109,7 @@ > "kernel_load=0xa000\0" \ > "kernel_size=0x280\0" \ > > +#undef CONFIG_BOOTCOMMAND > #define CONFIG_BOOTCOMMAND "sf probe 0:0; sf read $kernel_load "\ > "$kernel_start $kernel_size && "\ > "bootm $kernel_load" > @@ -108,7 +117,6 @@ > /* Monitor Command Prompt */ > #define CONFIG_SYS_CBSIZE512 /* Console I/O Buffer Size */ > #define CONFIG_SYS_LONGHELP > -#define CONFIG_CMDLINE_EDITING 1 > #define CONFIG_AUTO_COMPLETE > #define CONFIG_SYS_MAXARGS 64 /* max command args */ > > diff --git a/include/configs/ls1012ardb.h b/include/configs/ls1012ardb.h > index e9edcd2..e612840 100644 > --- a/include/configs/ls1012ardb.h > +++ b/include/configs/ls1012ardb.h > @@ -70,6 +70,49 @@ > #define CONFIG_SYS_MEMTEST_START 0x8000 > #define CONFIG_SYS_MEMTEST_END 0x9fff > > +#undef CONFIG_EXTRA_ENV_SETTINGS > +#define CONFIG_EXTRA_ENV_SETTINGS\ > + "verify=no\0" \ > + "fdt_high=0x\0" \ > + "initrd_high=0x\0" \ > + "fdt_addr=0x00f0\0" \ > + "kernel_addr=0x0100\0" \ > + "scriptaddr=0x8000\0" \ > + "fdtheader_addr_r=0x8010\0" \ > + "kernelheader_addr_r=0x8020\0" \ > + "kernel_addr_r=0x8100\0"\ > + "fdt_addr_r=0x9000\0" \ > + "load_addr=0xa000\0"\ > + "kernel_size=0x280\0" \ > + "console=ttyS0,115200\0"\ > + BOOTENV \ > + "boot_scripts=ls1012ardb_boot.scr\0"\ > + "scan_dev_for_boot_part=" \ > + "part list ${devtype} ${devnum} devplist; "\ > + "env exists devplist || setenv devplist 1; " \ > + "for distro_bootpart in ${devplist}; do " \ > + "if fstype ${devtype} " \ > + "${devnum}:${distro_bootpart} " \ > + "bootfstype; then " \ > + "run scan_dev_for_boot; " \ > + "fi; "\ > + "done\0" \ > + "scan_dev_for_boot=" \ > + "echo Scanning ${devtype} " \ > + "${devnum}:${distro_bootpart}...; " \ > + "for prefix in ${boot_prefixes}; do " \ > + "run scan_dev_for_scripts; " \ > + "done;" \ > + "\0" \ > + "installer=load mmc 0:2
[U-Boot] [PATCH v2 07/17] efi_loader: fill simple network protocol revision
Provide the simple network protocol revision. This revision number could be used to identify backwards compatible enhancements of the protocol. Signed-off-by: Heinrich Schuchardt--- v2 no change --- include/efi_api.h| 3 +++ lib/efi_loader/efi_net.c | 1 + 2 files changed, 4 insertions(+) diff --git a/include/efi_api.h b/include/efi_api.h index 8c227ce703..2f31464cb3 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -600,6 +600,9 @@ struct efi_simple_network_mode { #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS 0x08 #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST 0x10 +/* revision of the simple network protocol */ +#define EFI_SIMPLE_NETWORK_PROTOCOL_REVISION 0x0001 + struct efi_simple_network { u64 revision; diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c index 91f1e4a69e..fb23bcf633 100644 --- a/lib/efi_loader/efi_net.c +++ b/lib/efi_loader/efi_net.c @@ -228,6 +228,7 @@ int efi_net_register(void) netobj->parent.protocols[2].guid = _pxe_guid; netobj->parent.protocols[2].protocol_interface = >pxe; netobj->parent.handle = >net; + netobj->net.revision = EFI_SIMPLE_NETWORK_PROTOCOL_REVISION; netobj->net.start = efi_net_start; netobj->net.stop = efi_net_stop; netobj->net.initialize = efi_net_initialize; -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 16/17] efi_selftest: allow printing MAC addresses
Add %pm as format string to print a MAC address. This is helpful when analyzing network problems. Signed-off-by: Heinrich Schuchardt--- v2 no change --- lib/efi_selftest/efi_selftest_console.c | 41 - 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/lib/efi_selftest/efi_selftest_console.c b/lib/efi_selftest/efi_selftest_console.c index 7b5b724a61..840e2290c6 100644 --- a/lib/efi_selftest/efi_selftest_console.c +++ b/lib/efi_selftest/efi_selftest_console.c @@ -12,6 +12,37 @@ struct efi_simple_text_output_protocol *con_out; struct efi_simple_input_interface *con_in; +/* + * Print a MAC address to an u16 string + * + * @pointer: mac address + * @buf: pointer to buffer address + * on return position of terminating zero word + */ +static void mac(void *pointer, u16 **buf) +{ + int i, j; + u16 c; + u8 *p = (u8 *)pointer; + u8 byte; + u16 *pos = *buf; + + for (i = 0; i < ARP_HLEN; ++i) { + if (i) + *pos++ = ':'; + byte = p[i]; + for (j = 4; j >= 0; j -= 4) { + c = (byte >> j) & 0x0f; + c += '0'; + if (c > '9') + c += 'a' - '9' - 1; + *pos++ = c; + } + } + *pos = 0; + *buf = pos; +} + /* * Print a pointer to an u16 string * @@ -146,7 +177,15 @@ void efi_st_printf(const char *fmt, ...) int2dec(va_arg(args, s32), ); break; case 'p': - pointer(va_arg(args, void*), ); + ++c; + switch (*c) { + case 'm': + mac(va_arg(args, void*), ); + break; + default: + --c; + pointer(va_arg(args, void*), ); + } break; case 's': s = va_arg(args, const char *); -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 10/17] efi_loader: use events for efi_net_receive
A timer event is defined. The timer handler cares for receiving new packets. efi_timer_check is called both in efi_net_transmit and efi_net_receive to enable events during network communication. Calling efi_timer_check in efi_net_get_status is implemented in a separate patch. Signed-off-by: Heinrich Schuchardt--- v2 no change --- lib/efi_loader/efi_net.c | 53 +--- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c index 569bf367a8..3498b96f7a 100644 --- a/lib/efi_loader/efi_net.c +++ b/lib/efi_loader/efi_net.c @@ -19,6 +19,11 @@ static const efi_guid_t efi_pxe_guid = EFI_PXE_GUID; static struct efi_pxe_packet *dhcp_ack; static bool new_rx_packet; static void *new_tx_packet; +/* + * The notification function of this event is called in every timer cycle + * to check if a new network packet has been received. + */ +static struct efi_event *network_timer_event; struct efi_net_obj { /* Generic EFI object parent class data */ @@ -143,6 +148,8 @@ static efi_status_t EFIAPI efi_net_transmit(struct efi_simple_network *this, EFI_ENTRY("%p, %lx, %lx, %p, %p, %p, %p", this, header_size, buffer_size, buffer, src_addr, dest_addr, protocol); + efi_timer_check(); + if (header_size) { /* We would need to create the header if header_size != 0 */ return EFI_EXIT(EFI_INVALID_PARAMETER); @@ -174,9 +181,7 @@ static efi_status_t EFIAPI efi_net_receive(struct efi_simple_network *this, EFI_ENTRY("%p, %p, %p, %p, %p, %p, %p", this, header_size, buffer_size, buffer, src_addr, dest_addr, protocol); - push_packet = efi_net_push; - eth_rx(); - push_packet = NULL; + efi_timer_check(); if (!new_rx_packet) return EFI_EXIT(EFI_NOT_READY); @@ -204,10 +209,32 @@ void efi_net_set_dhcp_ack(void *pkt, int len) memcpy(dhcp_ack, pkt, min(len, maxsize)); } +/* + * Check if a new network packet has been received. + * + * This notification function is called in every timer cycle. + * + * @event the event for which this notification function is registered + * @contextevent context - not used in this function + */ +static void EFIAPI efi_network_timer_notify(struct efi_event *event, + void *context) +{ + EFI_ENTRY("%p, %p", event, context); + + if (!new_rx_packet) { + push_packet = efi_net_push; + eth_rx(); + push_packet = NULL; + } + EFI_EXIT(EFI_SUCCESS); +} + /* This gets called from do_bootefi_exec(). */ int efi_net_register(void) { struct efi_net_obj *netobj; + efi_status_t r; if (!eth_get_dev()) { /* No eth device active, don't expose any */ @@ -253,5 +280,25 @@ int efi_net_register(void) /* Hook net up to the device list */ list_add_tail(>parent.link, _obj_list); + /* +* Create a timer event. +* +* The notification function is used to check if an new networkd packet +* has been received. +*/ + r = efi_create_event(EVT_TIMER | EVT_NOTIFY_SIGNAL, TPL_CALLBACK, +efi_network_timer_notify, NULL, +_timer_event); + if (r != EFI_SUCCESS) { + printf("ERROR: Failed to register network event\n"); + return r; + } + /* Network is time critical, create event in every timer cyle */ + r = efi_set_timer(network_timer_event, EFI_TIMER_PERIODIC, 0); + if (r != EFI_SUCCESS) { + printf("ERROR: Failed to set network timer\n"); + return r; + } + return 0; } -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 13/17] efi_loader: size fields in SimpleNetworkProtocol
The size fields in the Simple Network Protocol are all UINTN in the UEFI spec. So use size_t. Provide a function description of the receive function. Signed-off-by: Heinrich Schuchardt--- v2 no change --- include/efi_api.h| 4 ++-- lib/efi_loader/efi_net.c | 24 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/include/efi_api.h b/include/efi_api.h index 1f349db246..a9a6494afe 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -636,11 +636,11 @@ struct efi_simple_network efi_status_t (EFIAPI *get_status)(struct efi_simple_network *this, u32 *int_status, void **txbuf); efi_status_t (EFIAPI *transmit)(struct efi_simple_network *this, - ulong header_size, ulong buffer_size, void *buffer, + size_t header_size, size_t buffer_size, void *buffer, struct efi_mac_address *src_addr, struct efi_mac_address *dest_addr, u16 *protocol); efi_status_t (EFIAPI *receive)(struct efi_simple_network *this, - ulong *header_size, ulong *buffer_size, void *buffer, + size_t *header_size, size_t *buffer_size, void *buffer, struct efi_mac_address *src_addr, struct efi_mac_address *dest_addr, u16 *protocol); struct efi_event *wait_for_packet; diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c index 5866119817..f8ae5578ba 100644 --- a/lib/efi_loader/efi_net.c +++ b/lib/efi_loader/efi_net.c @@ -150,12 +150,13 @@ static efi_status_t EFIAPI efi_net_get_status(struct efi_simple_network *this, } static efi_status_t EFIAPI efi_net_transmit(struct efi_simple_network *this, - ulong header_size, ulong buffer_size, void *buffer, + size_t header_size, size_t buffer_size, void *buffer, struct efi_mac_address *src_addr, struct efi_mac_address *dest_addr, u16 *protocol) { - EFI_ENTRY("%p, %lx, %lx, %p, %p, %p, %p", this, header_size, - buffer_size, buffer, src_addr, dest_addr, protocol); + EFI_ENTRY("%p, %lu, %lu, %p, %p, %p, %p", this, + (unsigned long)header_size, (unsigned long)buffer_size, + buffer, src_addr, dest_addr, protocol); efi_timer_check(); @@ -182,8 +183,23 @@ static void efi_net_push(void *pkt, int len) new_rx_packet = true; } +/* + * Receive a packet from a network interface. + * + * This function implements the Receive service of the Simple Network Protocol. + * See the UEFI spec for details. + * + * @this the instance of the Simple Network Protocol + * @header_sizesize of the media header + * @buffer_sizesize of the buffer to receive the packet + * @buffer buffer to receive the packet + * @src_addr source MAC address + * @dest_addr destination MAC address + * @protocol protocol + * @return status code + */ static efi_status_t EFIAPI efi_net_receive(struct efi_simple_network *this, - ulong *header_size, ulong *buffer_size, void *buffer, + size_t *header_size, size_t *buffer_size, void *buffer, struct efi_mac_address *src_addr, struct efi_mac_address *dest_addr, u16 *protocol) { -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 08/17] efi_loader: efi_net: hwaddr_size = 6
The length of a MAC address is 6. We have to set this length in the EFI_SIMPLE_NETWORK_MODE structure of the EFI_SIMPLE_NETWORK_PROTOCOL. Without this patch iPXE fails to initialize the network with error message SNP MAC(001e0633bcbf,0x0) has invalid hardware address length 0 Signed-off-by: Heinrich Schuchardt--- v2 no change --- lib/efi_loader/efi_net.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c index fb23bcf633..9def34cf93 100644 --- a/lib/efi_loader/efi_net.c +++ b/lib/efi_loader/efi_net.c @@ -245,6 +245,7 @@ int efi_net_register(void) netobj->net.mode = >net_mode; netobj->net_mode.state = EFI_NETWORK_STARTED; memcpy(netobj->net_mode.current_address.mac_addr, eth_get_ethaddr(), 6); + netobj->net_mode.hwaddr_size = ARP_HLEN; netobj->net_mode.max_packet_size = PKTSIZE; netobj->pxe.mode = >pxe_mode; -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 09/17] efi_net: return EFI_UNSUPPORTED where appropriate
U-Boot does not implement all functions of the simple network protocol. The unimplemented functions return either of EFI_SUCCESS and EFI_INVALID_PARAMETER. The UEFI spec foresees to return EFI_UNSUPPORTED in these cases. Signed-off-by: Heinrich Schuchardt--- v2 no change --- lib/efi_loader/efi_net.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c index 9def34cf93..569bf367a8 100644 --- a/lib/efi_loader/efi_net.c +++ b/lib/efi_loader/efi_net.c @@ -78,9 +78,7 @@ static efi_status_t EFIAPI efi_net_receive_filters( EFI_ENTRY("%p, %x, %x, %x, %lx, %p", this, enable, disable, reset_mcast_filter, mcast_filter_count, mcast_filter); - /* XXX Do we care? */ - - return EFI_EXIT(EFI_SUCCESS); + return EFI_EXIT(EFI_UNSUPPORTED); } static efi_status_t EFIAPI efi_net_station_address( @@ -89,7 +87,7 @@ static efi_status_t EFIAPI efi_net_station_address( { EFI_ENTRY("%p, %x, %p", this, reset, new_mac); - return EFI_EXIT(EFI_INVALID_PARAMETER); + return EFI_EXIT(EFI_UNSUPPORTED); } static efi_status_t EFIAPI efi_net_statistics(struct efi_simple_network *this, @@ -98,7 +96,7 @@ static efi_status_t EFIAPI efi_net_statistics(struct efi_simple_network *this, { EFI_ENTRY("%p, %x, %p, %p", this, reset, stat_size, stat_table); - return EFI_EXIT(EFI_INVALID_PARAMETER); + return EFI_EXIT(EFI_UNSUPPORTED); } static efi_status_t EFIAPI efi_net_mcastiptomac(struct efi_simple_network *this, @@ -118,7 +116,7 @@ static efi_status_t EFIAPI efi_net_nvdata(struct efi_simple_network *this, EFI_ENTRY("%p, %x, %lx, %lx, %p", this, read_write, offset, buffer_size, buffer); - return EFI_EXIT(EFI_INVALID_PARAMETER); + return EFI_EXIT(EFI_UNSUPPORTED); } static efi_status_t EFIAPI efi_net_get_status(struct efi_simple_network *this, -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 12/17] efi_loader: fix efi_net_get_status
The returned interrupt status was wrong. As out transmit buffer is empty we need to always set EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT. When we have received a packet we need to set EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT. Furthermore we should call efi_timer_check() to handle events. Signed-off-by: Heinrich Schuchardt--- v2 no change --- include/efi_api.h| 6 ++ lib/efi_loader/efi_net.c | 11 --- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/include/efi_api.h b/include/efi_api.h index 2f31464cb3..1f349db246 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -600,6 +600,12 @@ struct efi_simple_network_mode { #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS 0x08 #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST 0x10 +/* interrupt status bit mask */ +#define EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT 0x01 +#define EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT 0x02 +#define EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT 0x04 +#define EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT 0x08 + /* revision of the simple network protocol */ #define EFI_SIMPLE_NETWORK_PROTOCOL_REVISION 0x0001 diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c index f63db686af..5866119817 100644 --- a/lib/efi_loader/efi_net.c +++ b/lib/efi_loader/efi_net.c @@ -133,9 +133,14 @@ static efi_status_t EFIAPI efi_net_get_status(struct efi_simple_network *this, { EFI_ENTRY("%p, %p, %p", this, int_status, txbuf); - /* We send packets synchronously, so nothing is outstanding */ - if (int_status) - *int_status = 0; + efi_timer_check(); + + if (int_status) { + /* We send packets synchronously, so nothing is outstanding */ + *int_status = EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT; + if (new_rx_packet) + *int_status |= EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT; + } if (txbuf) *txbuf = new_tx_packet; -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 02/17] efi_loader: parameters of CopyMem and SetMem
The UEFI spec defines the length parameters of CopyMem and SetMem as UINTN. We should size_t here. The source buffer of CopyMem should be marked as const. Signed-off-by: Heinrich Schuchardt--- v2 no change --- include/efi_api.h | 7 +++ lib/efi_loader/efi_boottime.c | 10 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/include/efi_api.h b/include/efi_api.h index c3b9032a48..0b1a383e61 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -156,10 +156,9 @@ struct efi_boot_services { void *handle, ...); efi_status_t (EFIAPI *calculate_crc32)(void *data, unsigned long data_size, uint32_t *crc32); - void (EFIAPI *copy_mem)(void *destination, void *source, - unsigned long length); - void (EFIAPI *set_mem)(void *buffer, unsigned long size, - uint8_t value); + void (EFIAPI *copy_mem)(void *destination, const void *source, + size_t length); + void (EFIAPI *set_mem)(void *buffer, size_t size, uint8_t value); void *create_event_ex; }; diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index b8b98f2c4a..c48ff2cd2a 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -1863,10 +1863,10 @@ static efi_status_t EFIAPI efi_calculate_crc32(void *data, * @source source of the copy operation * @length number of bytes to copy */ -static void EFIAPI efi_copy_mem(void *destination, void *source, - unsigned long length) +static void EFIAPI efi_copy_mem(void *destination, const void *source, + size_t length) { - EFI_ENTRY("%p, %p, %ld", destination, source, length); + EFI_ENTRY("%p, %p, %ld", destination, source, (unsigned long)length); memcpy(destination, source, length); EFI_EXIT(EFI_SUCCESS); } @@ -1882,9 +1882,9 @@ static void EFIAPI efi_copy_mem(void *destination, void *source, * @size size of buffer in bytes * @value byte to copy to the buffer */ -static void EFIAPI efi_set_mem(void *buffer, unsigned long size, uint8_t value) +static void EFIAPI efi_set_mem(void *buffer, size_t size, uint8_t value) { - EFI_ENTRY("%p, %ld, 0x%x", buffer, size, value); + EFI_ENTRY("%p, %ld, 0x%x", buffer, (unsigned long)size, value); memset(buffer, value, size); EFI_EXIT(EFI_SUCCESS); } -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 15/17] efi_selftest: correct definition of efi_st_error
Enclose definition in parantheses to allow using efi_st_error like a void function. Signed-off-by: Heinrich Schuchardt--- v2 no change --- include/efi_selftest.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/efi_selftest.h b/include/efi_selftest.h index beb662d4e1..2f0992f06e 100644 --- a/include/efi_selftest.h +++ b/include/efi_selftest.h @@ -23,8 +23,8 @@ * @...format string followed by fields to print */ #define efi_st_error(...) \ - efi_st_printf("%s(%u):\nERROR: ", __FILE__, __LINE__); \ - efi_st_printf(__VA_ARGS__) \ + (efi_st_printf("%s(%u):\nERROR: ", __FILE__, __LINE__), \ + efi_st_printf(__VA_ARGS__)) \ /* * A test may be setup and executed at boottime, -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 11/17] efi_loader: implement WaitForPacket event
The WaitForPacket event informs that a network package has been received by the SimpleNetworkProtocol. Signed-off-by: Heinrich Schuchardt--- v2 signaled has been renamed to is_signaled and is bool --- lib/efi_loader/efi_net.c | 17 + 1 file changed, 17 insertions(+) diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c index 3498b96f7a..f63db686af 100644 --- a/lib/efi_loader/efi_net.c +++ b/lib/efi_loader/efi_net.c @@ -24,6 +24,10 @@ static void *new_tx_packet; * to check if a new network packet has been received. */ static struct efi_event *network_timer_event; +/* + * This event is signaled when a packet has been received. + */ +static struct efi_event *wait_for_packet; struct efi_net_obj { /* Generic EFI object parent class data */ @@ -227,6 +231,8 @@ static void EFIAPI efi_network_timer_notify(struct efi_event *event, eth_rx(); push_packet = NULL; } + if (!new_rx_packet) + wait_for_packet->is_signaled = true; EFI_EXIT(EFI_SUCCESS); } @@ -280,6 +286,17 @@ int efi_net_register(void) /* Hook net up to the device list */ list_add_tail(>parent.link, _obj_list); + /* +* Create WaitForPacket event. +*/ + r = efi_create_event(EVT_NOTIFY_WAIT, TPL_CALLBACK, +efi_network_timer_notify, NULL, +_for_packet); + if (r != EFI_SUCCESS) { + printf("ERROR: Failed to register network event\n"); + return r; + } + netobj->net.wait_for_packet = wait_for_packet; /* * Create a timer event. * -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 14/17] efi_loader: fill return values in SimpleNetworkProtocol
In the receive function all return values should be filled. Signed-off-by: Heinrich Schuchardt--- v2 no change --- lib/efi_loader/efi_net.c | 27 +-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c index f8ae5578ba..9c85e1b72f 100644 --- a/lib/efi_loader/efi_net.c +++ b/lib/efi_loader/efi_net.c @@ -203,6 +203,10 @@ static efi_status_t EFIAPI efi_net_receive(struct efi_simple_network *this, struct efi_mac_address *src_addr, struct efi_mac_address *dest_addr, u16 *protocol) { + struct ethernet_hdr *eth_hdr; + size_t hdr_size = sizeof(struct ethernet_hdr); + u16 protlen; + EFI_ENTRY("%p, %p, %p, %p, %p, %p, %p", this, header_size, buffer_size, buffer, src_addr, dest_addr, protocol); @@ -210,13 +214,32 @@ static efi_status_t EFIAPI efi_net_receive(struct efi_simple_network *this, if (!new_rx_packet) return EFI_EXIT(EFI_NOT_READY); - + /* Check that we at least received an Ethernet header */ + if (net_rx_packet_len < sizeof(struct ethernet_hdr)) { + new_rx_packet = false; + return EFI_EXIT(EFI_NOT_READY); + } + /* Fill export parameters */ + eth_hdr = (struct ethernet_hdr *)net_rx_packet; + protlen = ntohs(eth_hdr->et_protlen); + if (protlen == 0x8100) { + hdr_size += 4; + protlen = ntohs(*(u16 *)_rx_packet[hdr_size - 2]); + } + if (header_size) + *header_size = hdr_size; + if (dest_addr) + memcpy(dest_addr, eth_hdr->et_dest, ARP_HLEN); + if (src_addr) + memcpy(src_addr, eth_hdr->et_src, ARP_HLEN); + if (protocol) + *protocol = protlen; if (*buffer_size < net_rx_packet_len) { /* Packet doesn't fit, try again with bigger buf */ *buffer_size = net_rx_packet_len; return EFI_EXIT(EFI_BUFFER_TOO_SMALL); } - + /* Copy packet */ memcpy(buffer, net_rx_packet, net_rx_packet_len); *buffer_size = net_rx_packet_len; new_rx_packet = false; -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 17/17] efi_loader: supply EFI network test
This patch provices an EFI application to check the correct function of the Simple Network Protocol implementation. It sends a DHCP request and analyzes the DHCP offer. Different error conditions including a 10s timeout are checked. A successful execution will look like this: => bootefi nettest Scanning disk ide.blk#0... Found 1 disks WARNING: Invalid device tree, expect boot to fail Network test DHCP Discover DHCP reply received from 192.168.76.2 (52:55:c0:a8:4c:02) as broadcast message. OK. The test was completed successfully. Signed-off-by: Heinrich Schuchardt--- v2 move efi_st_memcmp to efi_selftest_util.c The function can be reused for other tests. Use constants for return values. --- include/efi_selftest.h | 11 + lib/efi_selftest/Makefile| 8 +- lib/efi_selftest/efi_selftest_snp.c | 424 +++ lib/efi_selftest/efi_selftest_util.c | 25 +++ 4 files changed, 467 insertions(+), 1 deletion(-) create mode 100644 lib/efi_selftest/efi_selftest_snp.c create mode 100644 lib/efi_selftest/efi_selftest_util.c diff --git a/include/efi_selftest.h b/include/efi_selftest.h index 2f0992f06e..7ec42a0406 100644 --- a/include/efi_selftest.h +++ b/include/efi_selftest.h @@ -60,6 +60,17 @@ void efi_st_exit_boot_services(void); void efi_st_printf(const char *fmt, ...) __attribute__ ((format (__printf__, 1, 2))); +/* + * Compare memory. + * We cannot use lib/string.c due to different CFLAGS values. + * + * @buf1: first buffer + * @buf2: second buffer + * @length:number of bytes to compare + * @return:0 if both buffers contain the same bytes + */ +int efi_st_memcmp(const void *buf1, const void *buf2, size_t length); + /* * Reads an Unicode character from the input device. * diff --git a/lib/efi_selftest/Makefile b/lib/efi_selftest/Makefile index 30f1960933..e446046e02 100644 --- a/lib/efi_selftest/Makefile +++ b/lib/efi_selftest/Makefile @@ -15,12 +15,18 @@ CFLAGS_efi_selftest_events.o := $(CFLAGS_EFI) CFLAGS_REMOVE_efi_selftest_events.o := $(CFLAGS_NON_EFI) CFLAGS_efi_selftest_exitbootservices.o := $(CFLAGS_EFI) CFLAGS_REMOVE_efi_selftest_exitbootservices.o := $(CFLAGS_NON_EFI) +CFLAGS_efi_selftest_snp.o := $(CFLAGS_EFI) +CFLAGS_REMOVE_efi_selftest_snp.o := $(CFLAGS_NON_EFI) CFLAGS_efi_selftest_tpl.o := $(CFLAGS_EFI) CFLAGS_REMOVE_efi_selftest_tpl.o := $(CFLAGS_NON_EFI) +CFLAGS_efi_selftest_util.o := $(CFLAGS_EFI) +CFLAGS_REMOVE_efi_selftest_util.o := $(CFLAGS_NON_EFI) obj-$(CONFIG_CMD_BOOTEFI_SELFTEST) += \ efi_selftest.o \ efi_selftest_console.o \ efi_selftest_events.o \ efi_selftest_exitbootservices.o \ -efi_selftest_tpl.o +efi_selftest_snp.o \ +efi_selftest_tpl.o \ +efi_selftest_util.o diff --git a/lib/efi_selftest/efi_selftest_snp.c b/lib/efi_selftest/efi_selftest_snp.c new file mode 100644 index 00..638be0147d --- /dev/null +++ b/lib/efi_selftest/efi_selftest_snp.c @@ -0,0 +1,424 @@ +/* + * efi_selftest_snp + * + * Copyright (c) 2017 Heinrich Schuchardt + * + * SPDX-License-Identifier:GPL-2.0+ + * + * This unit test covers the Simple Network Protocol as well as + * the CopyMem and SetMem boottime services. + * + * A DHCP discover message is sent. The test is successful if a + * DHCP reply is received. + * + * TODO: Once ConnectController and DisconnectController are implemented + * we should connect our code as controller. + */ + +#include + +/* + * MAC address for broadcasts + */ +static const u8 BROADCAST_MAC[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + +struct dhcp_hdr { + u8 op; +#define BOOTREQUEST 1 +#define BOOTREPLY 2 + u8 htype; +# define HWT_ETHER 1 + u8 hlen; +# define HWL_ETHER 6 + u8 hops; + u32 xid; + u16 secs; + u16 flags; +#define DHCP_FLAGS_UNICAST 0x +#define DHCP_FLAGS_BROADCAST 0x0080 + u32 ciaddr; + u32 yiaddr; + u32 siaddr; + u32 giaddr; + u8 chaddr[16]; + u8 sname[64]; + u8 file[128]; +}; + +/* + * Message type option. + */ +#define DHCP_MESSAGE_TYPE 0x35 +#define DHCPDISCOVER 1 +#define DHCPOFFER 2 +#define DHCPREQUEST3 +#define DHCPDECLINE4 +#define DHCPACK5 +#define DHCPNAK6 +#define DHCPRELEASE7 + +struct dhcp { + struct ethernet_hdr eth_hdr; + struct ip_udp_hdr ip_udp; + struct dhcp_hdr dhcp_hdr; + u8 opt[128]; +} __packed; + +static struct efi_boot_services *boottime; +static struct efi_simple_network *net; +static struct efi_event *timer; +static const efi_guid_t efi_net_guid = EFI_SIMPLE_NETWORK_GUID; +/* IP packet ID */ +static unsigned int net_ip_id; + +/* + * Compute the checksum of the IP header. We cover even values of length only. + * We cannot use net/checksum.c due to different CFLAGS values. + * + * @buf: IP header + * @len: length
[U-Boot] [PATCH v2 03/17] efi_loader: pass GUIDs as const efi_guid_t *
We need to call some boottime services internally. Our GUIDs are stored as const efi_guid_t *. The boottime services never change GUIDs. So we can define the parameters as const efi_guid_t *. Signed-off-by: Heinrich Schuchardt--- v2 no change --- include/efi_api.h | 27 ++- lib/efi_loader/efi_boottime.c | 40 +--- 2 files changed, 35 insertions(+), 32 deletions(-) diff --git a/include/efi_api.h b/include/efi_api.h index 0b1a383e61..aa4306aac9 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -77,24 +77,25 @@ struct efi_boot_services { efi_status_t (EFIAPI *check_event)(struct efi_event *event); #define EFI_NATIVE_INTERFACE 0x efi_status_t (EFIAPI *install_protocol_interface)( - void **handle, efi_guid_t *protocol, + void **handle, const efi_guid_t *protocol, int protocol_interface_type, void *protocol_interface); efi_status_t (EFIAPI *reinstall_protocol_interface)( - void *handle, efi_guid_t *protocol, + void *handle, const efi_guid_t *protocol, void *old_interface, void *new_interface); efi_status_t (EFIAPI *uninstall_protocol_interface)(void *handle, - efi_guid_t *protocol, void *protocol_interface); - efi_status_t (EFIAPI *handle_protocol)(efi_handle_t, efi_guid_t *, - void **); + const efi_guid_t *protocol, void *protocol_interface); + efi_status_t (EFIAPI *handle_protocol)(efi_handle_t, + const efi_guid_t *protocol, + void **protocol_interface); void *reserved; efi_status_t (EFIAPI *register_protocol_notify)( - efi_guid_t *protocol, struct efi_event *event, + const efi_guid_t *protocol, struct efi_event *event, void **registration); efi_status_t (EFIAPI *locate_handle)( enum efi_locate_search_type search_type, - efi_guid_t *protocol, void *search_key, + const efi_guid_t *protocol, void *search_key, unsigned long *buffer_size, efi_handle_t *buffer); - efi_status_t (EFIAPI *locate_device_path)(efi_guid_t *protocol, + efi_status_t (EFIAPI *locate_device_path)(const efi_guid_t *protocol, struct efi_device_path **device_path, efi_handle_t *device); efi_status_t (EFIAPI *install_configuration_table)( @@ -131,14 +132,14 @@ struct efi_boot_services { #define EFI_OPEN_PROTOCOL_BY_DRIVER 0x0010 #define EFI_OPEN_PROTOCOL_EXCLUSIVE 0x0020 efi_status_t (EFIAPI *open_protocol)(efi_handle_t handle, - efi_guid_t *protocol, void **interface, + const efi_guid_t *protocol, void **interface, efi_handle_t agent_handle, efi_handle_t controller_handle, u32 attributes); efi_status_t (EFIAPI *close_protocol)(void *handle, - efi_guid_t *protocol, void *agent_handle, + const efi_guid_t *protocol, void *agent_handle, void *controller_handle); efi_status_t(EFIAPI *open_protocol_information)(efi_handle_t handle, - efi_guid_t *protocol, + const efi_guid_t *protocol, struct efi_open_protocol_info_entry **entry_buffer, unsigned long *entry_count); efi_status_t (EFIAPI *protocols_per_handle)(efi_handle_t handle, @@ -146,9 +147,9 @@ struct efi_boot_services { unsigned long *protocols_buffer_count); efi_status_t (EFIAPI *locate_handle_buffer) ( enum efi_locate_search_type search_type, - efi_guid_t *protocol, void *search_key, + const efi_guid_t *protocol, void *search_key, unsigned long *no_handles, efi_handle_t **buffer); - efi_status_t (EFIAPI *locate_protocol)(efi_guid_t *protocol, + efi_status_t (EFIAPI *locate_protocol)(const efi_guid_t *protocol, void *registration, void **protocol_interface); efi_status_t (EFIAPI *install_multiple_protocol_interfaces)( void **handle, ...); diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index c48ff2cd2a..e5adc17fab 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -704,7 +704,7 @@ static efi_status_t EFIAPI efi_check_event(struct efi_event *event) * @return status code */ static efi_status_t
[U-Boot] [PATCH v2 05/17] efi_loader: incorrect definition of EFI_SIMPLE_NETWORK_PROTOCOL
WaitForPacket is an event and not a function pointer. Signed-off-by: Heinrich Schuchardt--- v2 no change --- include/efi_api.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/efi_api.h b/include/efi_api.h index c44dc9d0cb..308baeec49 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -633,7 +633,7 @@ struct efi_simple_network ulong *header_size, ulong *buffer_size, void *buffer, struct efi_mac_address *src_addr, struct efi_mac_address *dest_addr, u16 *protocol); - void (EFIAPI *waitforpacket)(void); + struct efi_event *wait_for_packet; struct efi_simple_network_mode *mode; }; -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 00/17] efi_loader: Simple Network Protocol
This patch series focuses on * correction of parameter types for boot services * fixes for the SetMem and CopyMem boot services * fixes for the simple network protocol implementation (SNP) * a unit test for SetMem, CopyMem and the simple network protocol The unit test broadcasts a DHCPDISCOVER messager over the network and receives the reply. This patch series is based on * efi-next tree https://github.com/agraf/u-boot/tree/efi-next * [PATCH 1/1] efi_selftest: enable CONFIG_CMD_BOOTEFI_SELFTEST https://patchwork.ozlabs.org/patch/816412/ This patch enables the unit test on qemu-x86_defconfig * [PATCH 1/1] efi_loader: provide function comments for boot services https://patchwork.ozlabs.org/patch/817010/ --- v2 Move efi_st_memcmp to a new module. We can reuse it in future tests. Use constants as return values. Reflect renaming of signaled to is_signaled for events. --- Heinrich Schuchardt (17): efi_loader: call EFI_EXIT in efi_copy_mem, efi_set_mem efi_loader: parameters of CopyMem and SetMem efi_loader: pass GUIDs as const efi_guid_t * efi_loader: wrong type in wait_for_event efi_loader: incorrect definition of EFI_SIMPLE_NETWORK_PROTOCOL efi_loader: correct bits of receive_filters bit mask efi_loader: fill simple network protocol revision efi_loader: efi_net: hwaddr_size = 6 efi_net: return EFI_UNSUPPORTED where appropriate efi_loader: use events for efi_net_receive efi_loader: implement WaitForPacket event efi_loader: fix efi_net_get_status efi_loader: size fields in SimpleNetworkProtocol efi_loader: fill return values in SimpleNetworkProtocol efi_selftest: correct definition of efi_st_error efi_selftest: allow printing MAC addresses efi_loader: supply EFI network test include/efi_api.h | 62 +++-- include/efi_selftest.h | 15 +- lib/efi_loader/efi_boottime.c | 54 ++-- lib/efi_loader/efi_net.c| 144 +-- lib/efi_selftest/Makefile | 8 +- lib/efi_selftest/efi_selftest_console.c | 41 ++- lib/efi_selftest/efi_selftest_events.c | 2 +- lib/efi_selftest/efi_selftest_snp.c | 424 lib/efi_selftest/efi_selftest_tpl.c | 2 +- lib/efi_selftest/efi_selftest_util.c| 25 ++ 10 files changed, 702 insertions(+), 75 deletions(-) create mode 100644 lib/efi_selftest/efi_selftest_snp.c create mode 100644 lib/efi_selftest/efi_selftest_util.c -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 06/17] efi_loader: correct bits of receive_filters bit mask
Remove extraneous commas. Add comment. Signed-off-by: Heinrich Schuchardt--- v2 no change --- include/efi_api.h | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/include/efi_api.h b/include/efi_api.h index 308baeec49..8c227ce703 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -593,11 +593,12 @@ struct efi_simple_network_mode { u8 media_present; }; -#define EFI_SIMPLE_NETWORK_RECEIVE_UNICAST 0x01, -#define EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST 0x02, -#define EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST 0x04, -#define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS 0x08, -#define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST 0x10, +/* receive_filters bit mask */ +#define EFI_SIMPLE_NETWORK_RECEIVE_UNICAST 0x01 +#define EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST 0x02 +#define EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST 0x04 +#define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS 0x08 +#define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST 0x10 struct efi_simple_network { -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 04/17] efi_loader: wrong type in wait_for_event
The UEFI spec defines parameter index of WaitForEvent as UINTN*. So we should use size_t here. I deliberately do not use UINTN because I hold a following patch that will eliminate UINTN because uppercase types to not match the U-Boot coding style. Signed-off-by: Heinrich Schuchardt--- v2 no change --- include/efi_api.h | 2 +- lib/efi_loader/efi_boottime.c | 2 +- lib/efi_selftest/efi_selftest_events.c | 2 +- lib/efi_selftest/efi_selftest_tpl.c| 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/efi_api.h b/include/efi_api.h index aa4306aac9..c44dc9d0cb 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -71,7 +71,7 @@ struct efi_boot_services { enum efi_timer_delay type, uint64_t trigger_time); efi_status_t (EFIAPI *wait_for_event)(unsigned long number_of_events, - struct efi_event **event, unsigned long *index); + struct efi_event **event, size_t *index); efi_status_t (EFIAPI *signal_event)(struct efi_event *event); efi_status_t (EFIAPI *close_event)(struct efi_event *event); efi_status_t (EFIAPI *check_event)(struct efi_event *event); diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index e5adc17fab..976d5822f7 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -553,7 +553,7 @@ static efi_status_t EFIAPI efi_set_timer_ext(struct efi_event *event, */ static efi_status_t EFIAPI efi_wait_for_event(unsigned long num_events, struct efi_event **event, - unsigned long *index) + size_t *index) { int i, j; diff --git a/lib/efi_selftest/efi_selftest_events.c b/lib/efi_selftest/efi_selftest_events.c index 532f165d43..b2cdc150da 100644 --- a/lib/efi_selftest/efi_selftest_events.c +++ b/lib/efi_selftest/efi_selftest_events.c @@ -108,7 +108,7 @@ static int teardown(void) */ static int execute(void) { - unsigned long index; + size_t index; efi_status_t ret; /* Set 10 ms timer */ diff --git a/lib/efi_selftest/efi_selftest_tpl.c b/lib/efi_selftest/efi_selftest_tpl.c index 5d13f3b52d..0b78ee7595 100644 --- a/lib/efi_selftest/efi_selftest_tpl.c +++ b/lib/efi_selftest/efi_selftest_tpl.c @@ -110,7 +110,7 @@ static int teardown(void) */ static int execute(void) { - unsigned long index; + size_t index; efi_status_t ret; UINTN old_tpl; -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 01/17] efi_loader: call EFI_EXIT in efi_copy_mem, efi_set_mem
EFI_ENTRY and EFI_EXIT calls must match. Signed-off-by: Heinrich Schuchardt--- v2 no change --- lib/efi_loader/efi_boottime.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 66ce92f654..b8b98f2c4a 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -1868,6 +1868,7 @@ static void EFIAPI efi_copy_mem(void *destination, void *source, { EFI_ENTRY("%p, %p, %ld", destination, source, length); memcpy(destination, source, length); + EFI_EXIT(EFI_SUCCESS); } /* @@ -1885,6 +1886,7 @@ static void EFIAPI efi_set_mem(void *buffer, unsigned long size, uint8_t value) { EFI_ENTRY("%p, %ld, 0x%x", buffer, size, value); memset(buffer, value, size); + EFI_EXIT(EFI_SUCCESS); } /* -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 1/1] efi_loader: replace efi_div10 by do_div
On 05.10.17 16:14, Heinrich Schuchardt wrote: We should use the existing 64bit division instead of reinventing the wheel. Cc: Alexander GrafSigned-off-by: Heinrich Schuchardt Awesome, this version actually even *reduces* code size :). Alex ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 1/1] efi_loader: replace efi_div10 by do_div
We should use the existing 64bit division instead of reinventing the wheel. Cc: Alexander GrafSigned-off-by: Heinrich Schuchardt --- v2 replace efi_div10 by do_div as suggested by Alex v1 replace efi_div10 by div_u64 --- lib/efi_loader/efi_boottime.c | 36 ++-- 1 file changed, 2 insertions(+), 34 deletions(-) diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index df75dd9032..66ce92f654 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -128,39 +129,6 @@ const char *__efi_nesting_dec(void) return indent_string(--nesting_level); } -/* Low 32 bit */ -#define EFI_LOW32(a) (a & 0xULL) -/* High 32 bit */ -#define EFI_HIGH32(a) (a >> 32) - -/* - * 64bit division by 10 implemented as multiplication by 1 / 10 - * - * Decimals of one tenth: 0x1 / 0xA = 0x0.1... - */ -#define EFI_TENTH 0x199A -static u64 efi_div10(u64 a) -{ - u64 prod; - u64 rem; - u64 ret; - - ret = EFI_HIGH32(a) * EFI_HIGH32(EFI_TENTH); - prod = EFI_HIGH32(a) * EFI_LOW32(EFI_TENTH); - rem = EFI_LOW32(prod); - ret += EFI_HIGH32(prod); - prod = EFI_LOW32(a) * EFI_HIGH32(EFI_TENTH); - rem += EFI_LOW32(prod); - ret += EFI_HIGH32(prod); - prod = EFI_LOW32(a) * EFI_LOW32(EFI_TENTH); - rem += EFI_HIGH32(prod); - ret += EFI_HIGH32(rem); - /* Round to nearest integer */ - if (rem >= (1 << 31)) - ++ret; - return ret; -} - /* * Queue an EFI event. * @@ -523,7 +491,7 @@ efi_status_t efi_set_timer(struct efi_event *event, enum efi_timer_delay type, * The parameter defines a multiple of 100ns. * We use multiples of 1000ns. So divide by 10. */ - trigger_time = efi_div10(trigger_time); + do_div(trigger_time, 10); for (i = 0; i < ARRAY_SIZE(efi_events); ++i) { if (event != _events[i]) -- 2.14.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] distro: load FDT from any partition on boot device
On 05.10.17 15:27, Rob Clark wrote: On Thu, Oct 5, 2017 at 8:39 AM, Alexander Grafwrote: On 04.10.17 22:16, Rob Clark wrote: In the EFI_LOADER boot path, we were only checking the FAT partition containing the EFI payload for dtb files. But this is somewhat of a fiction. In reality there will be one small (V)FAT partition containing grub (or whatever the payload may be), and a second boot partition containing kernel/initrd/fdt (typically ext4). It is this second partition where we should be looking for a FDT to load. So instead scan all the partitions of the disk containing the EFI payload. This matches where grub looks for kernel/initrd (barring custom grub.cfg, in which case the user can use grub's 'devicetree' command to load the correct FDT). The other option is somehow passing the ${fdtfile} to grub so that it can load the FDT based on selected kernel version location (which grub knows) and SoC/board specific ${fdtfile} (which grub does not know). Signed-off-by: Rob Clark --- include/config_distro_bootcmd.h | 34 +++--- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h index e232a62996..58b2fe3371 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -126,25 +126,37 @@ "fi\0" \ \ "load_efi_dtb=" \ - "load ${devtype} ${devnum}:${distro_bootpart} " \ - "${fdt_addr_r} ${prefix}${efi_fdtfile}\0" \ + "load ${devtype} ${devnum}:${dtb_devp} " \ + "${fdt_addr_r} ${prefix}${efi_fdtfile} && " \ + "run boot_efi_binary\0" \ \ "efi_dtb_prefixes=/ /dtb/ /dtb/current/\0" \ - "scan_dev_for_efi=" \ + "scan_dev_for_dtb=" \ "setenv efi_fdtfile ${fdtfile}; " \ BOOTENV_EFI_SET_FDTFILE_FALLBACK \ - "for prefix in ${efi_dtb_prefixes}; do " \ - "if test -e ${devtype} " \ - "${devnum}:${distro_bootpart} " \ - "${prefix}${efi_fdtfile}; then " \ - "run load_efi_dtb; " \ - "fi;" \ - "done;" \ + "part list ${devtype} ${devnum} dtb_devplist; " \ part list spawns 128 error messages for me on a USB stick with an iso dd'ed onto it. I'm not sure we want to do that twice during boot. I'm not sure how to avoid doing two 'part list's since one we want to find *all* the partitions, not just the -bootable ones.. I'd suggest you might be better off fixing the root problem here ;-) Most probably, yes. + "env exists dtb_devplist || setenv dtb_devplist " \ + "${distro_bootpart}; " \ + "for dtb_devp in ${dtb_devplist}; do " \ + "for prefix in ${efi_dtb_prefixes}; do " \ + "if test -e ${devtype} " \ + "${devnum}:${dtb_devp} " \ + "${prefix}${efi_fdtfile};"\ + " then " \ + "echo Found DTB ${devtype} " \ + "${devnum}:${dtb_devp} " \ + "${prefix}${efi_fdtfile};"\ + "run load_efi_dtb; " \ + "fi;" \ + "done; " \ + "done; " \ + "run boot_efi_binary\0" \ This will run the EFI binary twice if we find a DT on disk. Or really nr_dtb_parts_found + 1 times :). only if the EFI binary returns, which isn't usually going to be the case for distro boot In a naive view, yes :). All our grub configs on iso have a "Boot local disk" entry which is simply "exit" in UEFI. For those it definitely can occur. And I make quite heavy use of it too ;). That said, if grub scripting supported "break", this would make this much easier Or alternatively set a variable that skips efi execution after you executed once. Then reset the variable at the end of the loop. We also don't want to loop through 50 other partitions if the 1st one already contained a dtb. Instead the loop really should end after the first successful boot attempt on that device. (other distro targets should still get boot attempts, you may want to exit grub from dhcp to enter grub on scsi). Furthermore I remember that Andreas worked in that area too before, let's make sure to CC him. If someone has a better patch, then I'm fine to go with that. I just needed something to get fedora booting I'm not saying better patch, I want to get his input because he worked on the same thing before, so he cares and knows which makes him an ideal reviewer :). Alex ___ U-Boot mailing
Re: [U-Boot] [PATCH] distro: load FDT from any partition on boot device
On Thu, Oct 5, 2017 at 8:39 AM, Alexander Grafwrote: > > > On 04.10.17 22:16, Rob Clark wrote: >> >> In the EFI_LOADER boot path, we were only checking the FAT partition >> containing the EFI payload for dtb files. But this is somewhat of a >> fiction. In reality there will be one small (V)FAT partition containing >> grub (or whatever the payload may be), and a second boot partition >> containing kernel/initrd/fdt (typically ext4). It is this second >> partition where we should be looking for a FDT to load. >> >> So instead scan all the partitions of the disk containing the EFI >> payload. This matches where grub looks for kernel/initrd (barring >> custom grub.cfg, in which case the user can use grub's 'devicetree' >> command to load the correct FDT). >> >> The other option is somehow passing the ${fdtfile} to grub so that it >> can load the FDT based on selected kernel version location (which grub >> knows) and SoC/board specific ${fdtfile} (which grub does not know). >> >> Signed-off-by: Rob Clark >> --- >> include/config_distro_bootcmd.h | 34 +++--- >> 1 file changed, 23 insertions(+), 11 deletions(-) >> >> diff --git a/include/config_distro_bootcmd.h >> b/include/config_distro_bootcmd.h >> index e232a62996..58b2fe3371 100644 >> --- a/include/config_distro_bootcmd.h >> +++ b/include/config_distro_bootcmd.h >> @@ -126,25 +126,37 @@ >> "fi\0" >> \ >> \ >> "load_efi_dtb=" >> \ >> - "load ${devtype} ${devnum}:${distro_bootpart} " >> \ >> - "${fdt_addr_r} ${prefix}${efi_fdtfile}\0" >> \ >> + "load ${devtype} ${devnum}:${dtb_devp} " >> \ >> + "${fdt_addr_r} ${prefix}${efi_fdtfile} && " >> \ >> + "run boot_efi_binary\0" >> \ >> \ >> "efi_dtb_prefixes=/ /dtb/ /dtb/current/\0" >> \ >> - "scan_dev_for_efi=" >> \ >> + "scan_dev_for_dtb=" >> \ >> "setenv efi_fdtfile ${fdtfile}; " >> \ >> BOOTENV_EFI_SET_FDTFILE_FALLBACK >> \ >> - "for prefix in ${efi_dtb_prefixes}; do " >> \ >> - "if test -e ${devtype} " >> \ >> - "${devnum}:${distro_bootpart} " >> \ >> - "${prefix}${efi_fdtfile}; then " >> \ >> - "run load_efi_dtb; " >> \ >> - "fi;" >> \ >> - "done;" >> \ >> + "part list ${devtype} ${devnum} dtb_devplist; " >> \ > > > part list spawns 128 error messages for me on a USB stick with an iso dd'ed > onto it. I'm not sure we want to do that twice during boot. I'm not sure how to avoid doing two 'part list's since one we want to find *all* the partitions, not just the -bootable ones.. I'd suggest you might be better off fixing the root problem here ;-) >> + "env exists dtb_devplist || setenv dtb_devplist " >> \ >> + "${distro_bootpart}; " >> \ >> + "for dtb_devp in ${dtb_devplist}; do " >> \ >> + "for prefix in ${efi_dtb_prefixes}; do " >> \ >> + "if test -e ${devtype} " >> \ >> + "${devnum}:${dtb_devp} " >> \ >> + >> "${prefix}${efi_fdtfile};"\ >> + " then " >> \ >> + "echo Found DTB ${devtype} " >> \ >> + "${devnum}:${dtb_devp} " >> \ >> + >> "${prefix}${efi_fdtfile};"\ >> + "run load_efi_dtb; " >> \ >> + "fi;" >> \ >> + "done; " >> \ >> + "done; " >> \ >> + "run boot_efi_binary\0" >> \ > > > This will run the EFI binary twice if we find a DT on disk. Or really > nr_dtb_parts_found + 1 times :). only if the EFI binary returns, which isn't usually going to be the case for distro boot That said, if grub scripting supported "break", this would make this much easier > We also don't want to loop through 50 other partitions if the 1st one > already contained a dtb. Instead the loop really should end after the first > successful boot attempt on that device. > > (other distro targets should still get boot attempts, you may want to exit > grub from dhcp to enter grub on scsi). > > Furthermore I remember that Andreas worked in that area too before, let's > make sure to CC him. If someone has a better patch, then I'm fine to go with that. I just needed something to get fedora booting BR, -R ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 10/14] arm: socfpga: stratix10: Add SPL driver for Stratix10 SoC
From: Chin Liang SeeAdd SPL driver support for Stratix SoC Signed-off-by: Chin Liang See --- arch/arm/mach-socfpga/Makefile| 4 + arch/arm/mach-socfpga/include/mach/firewall_s10.h | 84 + arch/arm/mach-socfpga/spl_s10.c | 138 ++ 3 files changed, 226 insertions(+) create mode 100644 arch/arm/mach-socfpga/include/mach/firewall_s10.h create mode 100644 arch/arm/mach-socfpga/spl_s10.c diff --git a/arch/arm/mach-socfpga/Makefile b/arch/arm/mach-socfpga/Makefile index b669d43..35b124a 100644 --- a/arch/arm/mach-socfpga/Makefile +++ b/arch/arm/mach-socfpga/Makefile @@ -40,6 +40,7 @@ obj-y += system_manager_s10.o obj-y += wrap_pinmux_config_s10.o obj-y += wrap_pll_config_s10.o endif + ifdef CONFIG_SPL_BUILD ifdef CONFIG_TARGET_SOCFPGA_GEN5 obj-y += spl_gen5.o @@ -51,6 +52,9 @@ endif ifdef CONFIG_TARGET_SOCFPGA_ARRIA10 obj-y += spl_a10.o endif +ifdef CONFIG_TARGET_SOCFPGA_STRATIX10 +obj-y += spl_s10.o +endif endif ifdef CONFIG_TARGET_SOCFPGA_GEN5 diff --git a/arch/arm/mach-socfpga/include/mach/firewall_s10.h b/arch/arm/mach-socfpga/include/mach/firewall_s10.h new file mode 100644 index 000..6894bb9 --- /dev/null +++ b/arch/arm/mach-socfpga/include/mach/firewall_s10.h @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2017 Intel Corporation + * + * SPDX-License-Identifier:GPL-2.0 + */ + +#ifndef_FIREWALL_S10_ +#define_FIREWALL_S10_ + +struct socfpga_firwall_l4_per { + u32 nand; /* 0x00 */ + u32 nand_data; + u32 _pad_0x8; + u32 usb0; + u32 usb1; /* 0x10 */ + u32 _pad_0x14; + u32 _pad_0x18; + u32 spim0; + u32 spim1; /* 0x20 */ + u32 spis0; + u32 spis1; + u32 emac0; + u32 emac1; /* 0x30 */ + u32 emac2; + u32 _pad_0x38; + u32 _pad_0x3c; + u32 sdmmc; /* 0x40 */ + u32 gpio0; + u32 gpio1; + u32 _pad_0x4c; + u32 i2c0; /* 0x50 */ + u32 i2c1; + u32 i2c2; + u32 i2c3; + u32 i2c4; /* 0x60 */ + u32 timer0; + u32 timer1; + u32 uart0; + u32 uart1; /* 0x70 */ +}; + +struct socfpga_firwall_l4_sys { + u32 _pad_0x00; /* 0x00 */ + u32 _pad_0x04; + u32 dma_ecc; + u32 emac0rx_ecc; + u32 emac0tx_ecc;/* 0x10 */ + u32 emac1rx_ecc; + u32 emac1tx_ecc; + u32 emac2rx_ecc; + u32 emac2tx_ecc;/* 0x20 */ + u32 _pad_0x24; + u32 _pad_0x28; + u32 nand_ecc; + u32 nand_read_ecc; /* 0x30 */ + u32 nand_write_ecc; + u32 ocram_ecc; + u32 _pad_0x3c; + u32 sdmmc_ecc; /* 0x40 */ + u32 usb0_ecc; + u32 usb1_ecc; + u32 clock_manager; + u32 _pad_0x50; /* 0x50 */ + u32 io_manager; + u32 reset_manager; + u32 system_manager; + u32 osc0_timer; /* 0x60 */ + u32 osc1_timer; + u32 watchdog0; + u32 watchdog1; + u32 watchdog2; /* 0x70 */ + u32 watchdog3; +}; + +#define FIREWALL_L4_DISABLE_ALL(BIT(0) | BIT(24) | BIT(16)) +#define FIREWALL_BRIDGE_DISABLE_ALL(~0) + +#define CCU_CPU0_MPRT_ADMASK_MEM_RAM0_ADDR 0xf7004688 +#define CCU_IOM_MPRT_ADMASK_MEM_RAM0_ADDR 0xf7018628 + +#define CCU_ADMASK_P_MASK (BIT(0)) +#define CCU_ADMASK_NS_MASK (BIT(1)) + +#endif /* _FIREWALL_S10_ */ diff --git a/arch/arm/mach-socfpga/spl_s10.c b/arch/arm/mach-socfpga/spl_s10.c new file mode 100644 index 000..12cafe6 --- /dev/null +++ b/arch/arm/mach-socfpga/spl_s10.c @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2016-2017 Intel Corporation + * + * SPDX-License-Identifier:GPL-2.0 + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +static const struct socfpga_firwall_l4_per *firwall_l4_per_base = + (struct socfpga_firwall_l4_per *)SOCFPGA_FIREWALL_L4_PER; +static const struct socfpga_firwall_l4_sys *firwall_l4_sys_base = + (struct socfpga_firwall_l4_sys *)SOCFPGA_FIREWALL_L4_SYS; + +u32 spl_boot_device(void) +{ + /* TODO: Get from SDM or handoff */ +/* #ifdef CONFIG_CADENCE_QSPI*/ +#if 0 + return BOOT_DEVICE_SPI; +#else + return BOOT_DEVICE_MMC1; +#endif +} + +#ifdef CONFIG_SPL_MMC_SUPPORT +u32 spl_boot_mode(const u32 boot_device) +{ +#if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT) + return MMCSD_MODE_FS; +#else + return MMCSD_MODE_RAW;
[U-Boot] [PATCH v2 07/14] arm: socfpga: stratix10: Add MMU support for Stratix10 SoC
From: Chin Liang SeeAdd MMU support for Stratix SoC Signed-off-by: Chin Liang See --- arch/arm/mach-socfpga/Makefile| 1 + arch/arm/mach-socfpga/mmu-arm64_s10.c | 71 +++ 2 files changed, 72 insertions(+) create mode 100644 arch/arm/mach-socfpga/mmu-arm64_s10.c diff --git a/arch/arm/mach-socfpga/Makefile b/arch/arm/mach-socfpga/Makefile index 43e18d2..098e5e9 100644 --- a/arch/arm/mach-socfpga/Makefile +++ b/arch/arm/mach-socfpga/Makefile @@ -34,6 +34,7 @@ ifdef CONFIG_TARGET_SOCFPGA_STRATIX10 obj-y += clock_manager_s10.o obj-y += mailbox_s10.o obj-y += misc_s10.o +obj-y += mmu-arm64_s10.o obj-y += reset_manager_s10.o obj-y += system_manager_s10.o obj-y += wrap_pinmux_config_s10.o diff --git a/arch/arm/mach-socfpga/mmu-arm64_s10.c b/arch/arm/mach-socfpga/mmu-arm64_s10.c new file mode 100644 index 000..91c7f2e --- /dev/null +++ b/arch/arm/mach-socfpga/mmu-arm64_s10.c @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2016-2017 Intel Corporation + * + * SPDX-License-Identifier:GPL-2.0 + */ + +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +static struct mm_region socfpga_stratix10_mem_map[] = { + { + /* MEM 2GB*/ + .virt = 0x0UL, + .phys = 0x0UL, + .size = 0x8000UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | + PTE_BLOCK_INNER_SHARE, + }, { + /* FPGA 1.5GB */ + .virt = 0x8000UL, + .phys = 0x8000UL, + .size = 0x6000UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN, + }, { + /* DEVICE 142MB */ + .virt = 0xF700UL, + .phys = 0xF700UL, + .size = 0x08E0UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN, + }, { + /* OCRAM 1MB but available 256KB */ + .virt = 0xFFE0UL, + .phys = 0xFFE0UL, + .size = 0x0010UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | + PTE_BLOCK_INNER_SHARE, + }, { + /* DEVICE 32KB */ + .virt = 0xFFFCUL, + .phys = 0xFFFCUL, + .size = 0x8000UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN, + }, { + /* MEM 124GB */ + .virt = 0x01UL, + .phys = 0x01UL, + .size = 0x1FUL, + .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | + PTE_BLOCK_INNER_SHARE, + }, { + /* DEVICE 4GB */ + .virt = 0x20UL, + .phys = 0x20UL, + .size = 0x01UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN, + }, { + /* List terminator */ + }, +}; + +struct mm_region *mem_map = socfpga_stratix10_mem_map; -- 2.2.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 11/14] arm: socfpga: stratix10: Add timer support for Stratix10 SoC
From: Chin Liang SeeAdd timer support for Stratix SoC Signed-off-by: Chin Liang See --- arch/arm/mach-socfpga/timer.c | 17 - 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-socfpga/timer.c b/arch/arm/mach-socfpga/timer.c index 253cde3..23450b0 100644 --- a/arch/arm/mach-socfpga/timer.c +++ b/arch/arm/mach-socfpga/timer.c @@ -1,5 +1,6 @@ /* - * Copyright (C) 2012 Altera Corporation + * Copyright (C) 2016-2017 Intel Corporation + * Copyright (C) 2012-2016 Altera Corporation * * SPDX-License-Identifier:GPL-2.0+ */ @@ -10,15 +11,29 @@ #define TIMER_LOAD_VAL 0x +#if !defined(CONFIG_TARGET_SOCFPGA_STRATIX10) static const struct socfpga_timer *timer_base = (void *)CONFIG_SYS_TIMERBASE; +#endif /* * Timer initialization */ int timer_init(void) { +#if defined(CONFIG_TARGET_SOCFPGA_STRATIX10) + int enable = 0x3; /* timer enable + output signal masked */ + int loadval = ~0; + + /* enable system counter */ + writel(enable, SOCFPGA_GTIMER_SEC_ADDRESS); + /* enable processor pysical counter */ + asm volatile("msr cntp_ctl_el0, %0" : : "r" (enable)); + asm volatile("msr cntp_tval_el0, %0" : : "r" (loadval)); + +#else writel(TIMER_LOAD_VAL, _base->load_val); writel(TIMER_LOAD_VAL, _base->curr_val); writel(readl(_base->ctrl) | 0x3, _base->ctrl); +#endif return 0; } -- 2.2.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 09/14] arm: socfpga: Restructure the SPL file
From: Chin Liang SeeRestructure the SPL so each devices such as CV, A10 and S10 will have their own dedicated SPL file. SPL file determine the HW initialization flow which is device specific Signed-off-by: Chin Liang See --- arch/arm/mach-socfpga/Makefile | 5 +- arch/arm/mach-socfpga/spl_a10.c | 105 arch/arm/mach-socfpga/{spl.c => spl_gen5.c} | 46 3 files changed, 109 insertions(+), 47 deletions(-) create mode 100644 arch/arm/mach-socfpga/spl_a10.c rename arch/arm/mach-socfpga/{spl.c => spl_gen5.c} (83%) diff --git a/arch/arm/mach-socfpga/Makefile b/arch/arm/mach-socfpga/Makefile index 098e5e9..b669d43 100644 --- a/arch/arm/mach-socfpga/Makefile +++ b/arch/arm/mach-socfpga/Makefile @@ -41,13 +41,16 @@ obj-y += wrap_pinmux_config_s10.o obj-y += wrap_pll_config_s10.o endif ifdef CONFIG_SPL_BUILD -obj-y += spl.o ifdef CONFIG_TARGET_SOCFPGA_GEN5 +obj-y += spl_gen5.o obj-y += freeze_controller.o obj-y += wrap_iocsr_config.o obj-y += wrap_pinmux_config.o obj-y += wrap_sdram_config.o endif +ifdef CONFIG_TARGET_SOCFPGA_ARRIA10 +obj-y += spl_a10.o +endif endif ifdef CONFIG_TARGET_SOCFPGA_GEN5 diff --git a/arch/arm/mach-socfpga/spl_a10.c b/arch/arm/mach-socfpga/spl_a10.c new file mode 100644 index 000..e6fc766 --- /dev/null +++ b/arch/arm/mach-socfpga/spl_a10.c @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2012 Altera Corporation + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +static const struct socfpga_system_manager *sysmgr_regs = + (struct socfpga_system_manager *)SOCFPGA_SYSMGR_ADDRESS; + +u32 spl_boot_device(void) +{ + const u32 bsel = readl(_regs->bootinfo); + + switch (SYSMGR_GET_BOOTINFO_BSEL(bsel)) { + case 0x1: /* FPGA (HPS2FPGA Bridge) */ + return BOOT_DEVICE_RAM; + case 0x2: /* NAND Flash (1.8V) */ + case 0x3: /* NAND Flash (3.0V) */ + socfpga_per_reset(SOCFPGA_RESET(NAND), 0); + return BOOT_DEVICE_NAND; + case 0x4: /* SD/MMC External Transceiver (1.8V) */ + case 0x5: /* SD/MMC Internal Transceiver (3.0V) */ + socfpga_per_reset(SOCFPGA_RESET(SDMMC), 0); + socfpga_per_reset(SOCFPGA_RESET(DMA), 0); + return BOOT_DEVICE_MMC1; + case 0x6: /* QSPI Flash (1.8V) */ + case 0x7: /* QSPI Flash (3.0V) */ + socfpga_per_reset(SOCFPGA_RESET(QSPI), 0); + return BOOT_DEVICE_SPI; + default: + printf("Invalid boot device (bsel=%08x)!\n", bsel); + hang(); + } +} + +#ifdef CONFIG_SPL_MMC_SUPPORT +u32 spl_boot_mode(const u32 boot_device) +{ +#if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT) + return MMCSD_MODE_FS; +#else + return MMCSD_MODE_RAW; +#endif +} +#endif + +void spl_board_init(void) +{ + /* configuring the clock based on handoff */ + cm_basic_init(gd->fdt_blob); + WATCHDOG_RESET(); + + config_dedicated_pins(gd->fdt_blob); + WATCHDOG_RESET(); + + /* Release UART from reset */ + socfpga_reset_uart(0); + + /* enable console uart printing */ + preloader_console_init(); +} + +void board_init_f(ulong dummy) +{ + /* +* Configure Clock Manager to use intosc clock instead external osc to +* ensure success watchdog operation. We do it as early as possible. +*/ + cm_use_intosc(); + + socfpga_watchdog_disable(); + + arch_early_init_r(); + +#ifdef CONFIG_HW_WATCHDOG + /* release osc1 watchdog timer 0 from reset */ + socfpga_reset_deassert_osc1wd0(); + + /* reconfigure and enable the watchdog */ + hw_watchdog_init(); + WATCHDOG_RESET(); +#endif /* CONFIG_HW_WATCHDOG */ +} diff --git a/arch/arm/mach-socfpga/spl.c b/arch/arm/mach-socfpga/spl_gen5.c similarity index 83% rename from arch/arm/mach-socfpga/spl.c rename to arch/arm/mach-socfpga/spl_gen5.c index 71bae82..9864082 100644 --- a/arch/arm/mach-socfpga/spl.c +++ b/arch/arm/mach-socfpga/spl_gen5.c @@ -22,21 +22,15 @@ #include #include #include -#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10) -#include -#endif DECLARE_GLOBAL_DATA_PTR; -#if defined(CONFIG_TARGET_SOCFPGA_GEN5) static struct pl310_regs *const pl310 = (struct pl310_regs *)CONFIG_SYS_PL310_BASE; static struct scu_registers *scu_regs = (struct scu_registers *)SOCFPGA_MPUSCU_ADDRESS; static struct nic301_registers *nic301_regs = (struct nic301_registers *)SOCFPGA_L3REGS_ADDRESS; -#endif - static const struct socfpga_system_manager *sysmgr_regs = (struct
[U-Boot] [PATCH v2 14/14] arm: socfpga: stratix10: Enable Stratix10 SoC build
From: Chin Liang SeeAdd build support for Stratix SoC Signed-off-by: Chin Liang See --- arch/arm/Kconfig | 8 +- arch/arm/mach-socfpga/Kconfig | 13 ++ configs/socfpga_stratix10_defconfig | 39 ++ include/configs/socfpga_stratix10_socdk.h | 216 ++ 4 files changed, 273 insertions(+), 3 deletions(-) create mode 100644 configs/socfpga_stratix10_defconfig create mode 100644 include/configs/socfpga_stratix10_socdk.h diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index d6d9558..4a6b9da 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -656,21 +656,23 @@ config ARCH_SNAPDRAGON config ARCH_SOCFPGA bool "Altera SOCFPGA family" - select CPU_V7 + select CPU_V7 if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10 + select ARM64 if TARGET_SOCFPGA_STRATIX10 select SUPPORT_SPL select OF_CONTROL select SPL_OF_CONTROL select DM select DM_SPI_FLASH select DM_SPI - select ENABLE_ARM_SOC_BOOT0_HOOK + select ENABLE_ARM_SOC_BOOT0_HOOK if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10 select ARCH_EARLY_INIT_R select ARCH_MISC_INIT select SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION - select SYS_THUMB_BUILD + select SYS_THUMB_BUILD if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10 imply CMD_MTDPARTS imply CRC32_VERIFY imply FAT_WRITE + select SPL_SEPARATE_BSS if TARGET_SOCFPGA_STRATIX10 config ARCH_SUNXI bool "Support sunxi (Allwinner) SoCs" diff --git a/arch/arm/mach-socfpga/Kconfig b/arch/arm/mach-socfpga/Kconfig index 45e5379..03ab956 100644 --- a/arch/arm/mach-socfpga/Kconfig +++ b/arch/arm/mach-socfpga/Kconfig @@ -49,6 +49,12 @@ config TARGET_SOCFPGA_GEN5 bool select ALTERA_SDRAM +config TARGET_SOCFPGA_STRATIX10 + bool + select ARMV8_MULTIENTRY + select ARMV8_SPIN_TABLE + select ARMV8_SET_SMPEN + choice prompt "Altera SOCFPGA board select" optional @@ -86,6 +92,10 @@ config TARGET_SOCFPGA_SR1500 bool "SR1500 (Cyclone V)" select TARGET_SOCFPGA_CYCLONE5 +config TARGET_SOCFPGA_STRATIX10_SOCDK + bool "Intel SOCFPGA SoCDK (Stratix 10)" + select TARGET_SOCFPGA_STRATIX10 + config TARGET_SOCFPGA_TERASIC_DE0_NANO bool "Terasic DE0-Nano-Atlas (Cyclone V)" select TARGET_SOCFPGA_CYCLONE5 @@ -116,12 +126,14 @@ config SYS_BOARD default "sockit" if TARGET_SOCFPGA_TERASIC_SOCKIT default "socrates" if TARGET_SOCFPGA_EBV_SOCRATES default "sr1500" if TARGET_SOCFPGA_SR1500 + default "stratix10-socdk" if TARGET_SOCFPGA_STRATIX10_SOCDK default "vining_fpga" if TARGET_SOCFPGA_SAMTEC_VINING_FPGA config SYS_VENDOR default "altera" if TARGET_SOCFPGA_ARRIA5_SOCDK default "altera" if TARGET_SOCFPGA_ARRIA10_SOCDK default "altera" if TARGET_SOCFPGA_CYCLONE5_SOCDK + default "altera" if TARGET_SOCFPGA_STRATIX10_SOCDK default "aries" if TARGET_SOCFPGA_ARIES_MCVEVK default "ebv" if TARGET_SOCFPGA_EBV_SOCRATES default "samtec" if TARGET_SOCFPGA_SAMTEC_VINING_FPGA @@ -145,6 +157,7 @@ config SYS_CONFIG_NAME default "socfpga_sockit" if TARGET_SOCFPGA_TERASIC_SOCKIT default "socfpga_socrates" if TARGET_SOCFPGA_EBV_SOCRATES default "socfpga_sr1500" if TARGET_SOCFPGA_SR1500 + default "socfpga_stratix10_socdk" if TARGET_SOCFPGA_STRATIX10_SOCDK default "socfpga_vining_fpga" if TARGET_SOCFPGA_SAMTEC_VINING_FPGA endif diff --git a/configs/socfpga_stratix10_defconfig b/configs/socfpga_stratix10_defconfig new file mode 100644 index 000..e5a7a69 --- /dev/null +++ b/configs/socfpga_stratix10_defconfig @@ -0,0 +1,39 @@ +CONFIG_ARM=y +CONFIG_ARCH_SOCFPGA=y +CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_SPL_FAT_SUPPORT=y +CONFIG_TARGET_SOCFPGA_STRATIX10_SOCDK=y +CONFIG_IDENT_STRING="socfpga_stratix10" +CONFIG_DEFAULT_DEVICE_TREE="socfpga_stratix10_socdk" +CONFIG_BOOTDELAY=5 +CONFIG_SYS_PROMPT="SOCFPGA_STRATIX10 # " +CONFIG_CMD_CACHE=y +CONFIG_CMD_DHCP=y +CONFIG_CMD_EXT4=y +CONFIG_CMD_FAT=y +# CONFIG_CMD_FLASH is not set +CONFIG_CMD_FS_GENERIC=y +# CONFIG_CMD_IMLS is not set +CONFIG_CMD_MEMTEST=y +CONFIG_CMD_MII=y +CONFIG_CMD_MMC=y +CONFIG_CMD_PING=y +CONFIG_CMD_SF=y +CONFIG_SPL=y +CONFIG_SPL_DM=y +CONFIG_SPL_DM_SEQ_ALIAS=y +CONFIG_DM_MMC=y +CONFIG_ENV_IS_IN_MMC=y +CONFIG_DFU_MMC=y +CONFIG_MMC_DW=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_BAR=y +CONFIG_SPI_FLASH_SPANSION=y +CONFIG_SPI_FLASH_STMICRO=y +# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set +CONFIG_CADENCE_QSPI=y +CONFIG_DM_ETH=y +CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_ETH_DESIGNWARE=y +CONFIG_SYS_NS16550=y +CONFIG_USE_TINY_PRINTF=y diff --git a/include/configs/socfpga_stratix10_socdk.h b/include/configs/socfpga_stratix10_socdk.h new file mode 100644 index 000..0d955f8 --- /dev/null +++
[U-Boot] [PATCH v2 13/14] board: altera: stratix10: Add socdk board support for Stratix10 SoC
From: Chin Liang SeeAdd socdk board support for Stratix SoC Signed-off-by: Chin Liang See --- board/altera/stratix10-socdk/MAINTAINERS | 7 +++ board/altera/stratix10-socdk/Makefile| 7 +++ board/altera/stratix10-socdk/socfpga.c | 7 +++ 3 files changed, 21 insertions(+) create mode 100644 board/altera/stratix10-socdk/MAINTAINERS create mode 100644 board/altera/stratix10-socdk/Makefile create mode 100644 board/altera/stratix10-socdk/socfpga.c diff --git a/board/altera/stratix10-socdk/MAINTAINERS b/board/altera/stratix10-socdk/MAINTAINERS new file mode 100644 index 000..6192bc9 --- /dev/null +++ b/board/altera/stratix10-socdk/MAINTAINERS @@ -0,0 +1,7 @@ +SOCFPGA BOARD +M: Chin-Liang See +M: Dinh Nguyen +S: Maintained +F: board/altera/stratix10-socdk/ +F: include/configs/socfpga_stratix10_socdk.h +F: configs/socfpga_stratix10_defconfig diff --git a/board/altera/stratix10-socdk/Makefile b/board/altera/stratix10-socdk/Makefile new file mode 100644 index 000..02a9cad --- /dev/null +++ b/board/altera/stratix10-socdk/Makefile @@ -0,0 +1,7 @@ +# +# Copyright (C) 2016-2017 Intel Corporation +# +# SPDX-License-Identifier: GPL-2.0 +# + +obj-y := socfpga.o diff --git a/board/altera/stratix10-socdk/socfpga.c b/board/altera/stratix10-socdk/socfpga.c new file mode 100644 index 000..3deb989 --- /dev/null +++ b/board/altera/stratix10-socdk/socfpga.c @@ -0,0 +1,7 @@ +/* + * Copyright (C) 2016-2017 Intel Corporation + * + * SPDX-License-Identifier:GPL-2.0 + */ + +#include -- 2.2.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 08/14] arm: dts: Add dts for Stratix10 SoC
From: Chin Liang SeeDevice tree for Stratix10 SoC Signed-off-by: Chin Liang See --- arch/arm/dts/Makefile| 3 +- arch/arm/dts/socfpga_stratix10_socdk.dts | 180 +++ 2 files changed, 182 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/socfpga_stratix10_socdk.dts diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 7c062f0..f66b9c9 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -171,7 +171,8 @@ dtb-$(CONFIG_ARCH_SOCFPGA) += \ socfpga_cyclone5_sockit.dtb \ socfpga_cyclone5_socrates.dtb \ socfpga_cyclone5_sr1500.dtb \ - socfpga_cyclone5_vining_fpga.dtb + socfpga_cyclone5_vining_fpga.dtb\ + socfpga_stratix10_socdk.dtb dtb-$(CONFIG_TARGET_DRA7XX_EVM) += dra72-evm.dtb dra7-evm.dtb \ dra72-evm-revc.dtb dra71-evm.dtb dra76-evm.dtb diff --git a/arch/arm/dts/socfpga_stratix10_socdk.dts b/arch/arm/dts/socfpga_stratix10_socdk.dts new file mode 100644 index 000..26b407f --- /dev/null +++ b/arch/arm/dts/socfpga_stratix10_socdk.dts @@ -0,0 +1,180 @@ +/* + * Copyright (C) 2016-2017 Intel Corporation + * + * SPDX-License-Identifier:GPL-2.0 + */ + +/dts-v1/; +#include "skeleton.dtsi" +#include + +/ { + model = "Intel SOCFPGA Stratix 10 SoC Development Kit"; + compatible = "altr,socfpga-stratix10", "altr,socfpga"; + + #address-cells = <1>; + #size-cells = <1>; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + aliases { + ethernet0 = + spi0 = + }; + + memory { + name = "memory"; + device_type = "memory"; + reg = <0x0 0x8000>; /* 2GB */ + }; + + regulator_3_3v: 3-3-v-regulator { + compatible = "regulator-fixed"; + regulator-name = "3.3V"; + regulator-min-microvolt = <330>; + regulator-max-microvolt = <330>; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu@0 { + compatible = "arm,cortex-a53", "arm,armv8"; + device_type = "cpu"; + enable-method = "psci"; + reg = <0x0>; + }; + + cpu@1 { + compatible = "arm,cortex-a53", "arm,armv8"; + device_type = "cpu"; + enable-method = "psci"; + reg = <0x1>; + }; + + cpu@2 { + compatible = "arm,cortex-a53", "arm,armv8"; + device_type = "cpu"; + enable-method = "psci"; + reg = <0x2>; + }; + + cpu@3 { + compatible = "arm,cortex-a53", "arm,armv8"; + device_type = "cpu"; + enable-method = "psci"; + reg = <0x3>; + }; + }; + + soc { + #address-cells = <1>; + #size-cells = <1>; + compatible = "simple-bus"; + device_type = "soc"; + ranges; + u-boot,dm-pre-reloc; + + rst: rstmgr@ffd11000 { + #reset-cells = <1>; + compatible = "altr,rst-mgr"; + reg = <0xffd11000 0x100>; + altr,modrst-offset = <0x20>; + }; + + mdio { + phy0: ethernet-phy@0 { + txd0-skew-ps = <0>; /* -420ps */ + txd1-skew-ps = <0>; /* -420ps */ + txd2-skew-ps = <0>; /* -420ps */ + txd3-skew-ps = <0>; /* -420ps */ + rxd0-skew-ps = <420>; /* 0ps */ + rxd1-skew-ps = <420>; /* 0ps */ + rxd2-skew-ps = <420>; /* 0ps */ + rxd3-skew-ps = <420>; /* 0ps */ + txen-skew-ps = <0>; /* -420ps */ + txc-skew-ps = <1860>; /* 960ps */ + rxdv-skew-ps = <420>; /* 0ps */ + rxc-skew-ps = <1680>; /* 780ps */ + }; + }; + + gmac0: ethernet@ff80 { + compatible = "altr,socfpga-stmmac", "snps,dwmac-3.74a", "snps,dwmac"; + reg = <0xff80 0x2000>; + interrupts = <0 90 4>; + interrupt-names = "macirq"; + mac-address = [00 00 00 00 00 00]; +
[U-Boot] [PATCH v2 12/14] ddr: altera: stratix10: Add DDR support for Stratix10 SoC
From: Chin Liang SeeAdd DDR support for Stratix SoC Signed-off-by: Chin Liang See --- arch/arm/mach-socfpga/include/mach/sdram_s10.h | 333 + drivers/ddr/altera/Makefile| 1 + drivers/ddr/altera/sdram_s10.c | 382 + 3 files changed, 716 insertions(+) create mode 100644 arch/arm/mach-socfpga/include/mach/sdram_s10.h create mode 100644 drivers/ddr/altera/sdram_s10.c diff --git a/arch/arm/mach-socfpga/include/mach/sdram_s10.h b/arch/arm/mach-socfpga/include/mach/sdram_s10.h new file mode 100644 index 000..d0fd958 --- /dev/null +++ b/arch/arm/mach-socfpga/include/mach/sdram_s10.h @@ -0,0 +1,333 @@ +/* + * Copyright (C) 2016-2017 Intel Corporation + * + * SPDX-License-Identifier:GPL-2.0 + */ + +#ifndef_SDRAM_S10_H_ +#define_SDRAM_S10_H_ + +unsigned long sdram_calculate_size(void); +int sdram_mmr_init_full(unsigned int sdr_phy_reg); +int sdram_calibration_full(void); + +#define DDR_TWR15 +#define DDR_READ_LATENCY_DELAY 40 +#define DDR_ACTIVATE_FAWBANK 0x1 + + +struct socfpga_ecc_hmc { + uint32_t ip_rev_id; + uint32_t _pad_0x4_0x7; + uint32_t ddrioctrl; + uint32_t ddrcalstat; + uint32_t mpr_0beat1; + uint32_t mpr_1beat1; + uint32_t mpr_2beat1; + uint32_t mpr_3beat1; + uint32_t mpr_4beat1; + uint32_t mpr_5beat1; + uint32_t mpr_6beat1; + uint32_t mpr_7beat1; + uint32_t mpr_8beat1; + uint32_t mpr_0beat2; + uint32_t mpr_1beat2; + uint32_t mpr_2beat2; + uint32_t mpr_3beat2; + uint32_t mpr_4beat2; + uint32_t mpr_5beat2; + uint32_t mpr_6beat2; + uint32_t mpr_7beat2; + uint32_t mpr_8beat2; + uint32_t _pad_0x58_0x5f[2]; + uint32_t auto_precharge; + uint32_t _pad_0x64_0xdf[31]; + uint32_t dramaddrwidth; + uint32_t _pad_0xe4_0xff[7]; + uint32_t eccctrl; + uint32_t eccctrl2; + uint32_t _pad_0x108_0x10f[2]; + uint32_t errinten; + uint32_t errintens; + uint32_t errintenr; + uint32_t intmode; + uint32_t intstat; + uint32_t diaginttest; + uint32_t modstat; + uint32_t derraddra; + uint32_t serraddra; + uint32_t _pad_0x134_0x137; + uint32_t autowb_corraddr; + uint32_t serrcntreg; + uint32_t autowb_drop_cntreg; + uint32_t ecc_reg2wreccdatabus; + uint32_t ecc_rdeccdata2regbus; + uint32_t ecc_reg2rdeccdatabus; + uint32_t ecc_diagon; + uint32_t ecc_decstat; + uint32_t _pad_0x158_0x15f[2]; + uint32_t ecc_errgenaddr_0; + uint32_t ecc_errgenaddr_1; + uint32_t ecc_errgenaddr_2; + uint32_t ecc_errgenaddr_3; + uint32_t ecc_ref2rddatabus_beat0; + uint32_t ecc_ref2rddatabus_beat1; + uint32_t ecc_ref2rddatabus_beat2; + uint32_t ecc_ref2rddatabus_beat3; + uint32_t ecc_errgenhaddr_0; + uint32_t ecc_errgenhaddr_1; + uint32_t ecc_errgenhaddr_2; + uint32_t ecc_errgenhaddr_3; + uint32_t ecc_rdeccdata2regbus_beat0; + uint32_t ecc_rdeccdata2regbus_beat1; + uint32_t ecc_rdeccdata2regbus_beat2; + uint32_t ecc_rdeccdata2regbus_beat3; + uint32_t _pad_0x1a0_0x1af[4]; + uint32_t derrhaddr; + uint32_t serrhaddr; + uint32_t _pad_0x1b8_0x1bb; + uint32_t autowb_corrhaddr; + uint32_t _pad_0x1c0_0x20f[20]; + uint32_t hpsintfcsel; + uint32_t rsthandshakectrl; + uint32_t rsthandshakestat; +}; + +struct socfpga_noc_ddr_scheduler { + uint32_t main_scheduler_id_coreid; + uint32_t main_scheduler_id_revisionid; + uint32_t main_scheduler_ddrconf; + uint32_t main_scheduler_ddrtiming; + uint32_t main_scheduler_ddrmode; + uint32_t main_scheduler_readlatency; + uint32_t _pad_0x18_0x37[8]; + uint32_t main_scheduler_activate; + uint32_t main_scheduler_devtodev; + uint32_t main_scheduler_ddr4timing; +}; + +struct socfpga_io48_mmr { + uint32_t dbgcfg0; + uint32_t dbgcfg1; + uint32_t dbgcfg2; + uint32_t dbgcfg3; + uint32_t dbgcfg4; + uint32_t dbgcfg5; + uint32_t dbgcfg6; + uint32_t reserve0; + uint32_t reserve1; + uint32_t reserve2; + uint32_t ctrlcfg0; + uint32_t ctrlcfg1; + uint32_t ctrlcfg2; + uint32_t ctrlcfg3; + uint32_t ctrlcfg4; + uint32_t ctrlcfg5; + uint32_t ctrlcfg6; + uint32_t ctrlcfg7; + uint32_t ctrlcfg8; + uint32_t ctrlcfg9; + uint32_t dramtiming0; + uint32_t dramodt0; + uint32_t dramodt1; + uint32_t sbcfg0; + uint32_t sbcfg1; + uint32_t sbcfg2; + uint32_t sbcfg3; + uint32_t sbcfg4; + uint32_t sbcfg5; + uint32_t sbcfg6; + uint32_t sbcfg7; + uint32_t caltiming0; +
[U-Boot] [PATCH v2 04/14] arm: socfpga: stratix10: Add pinmux support for Stratix10 SoC
From: Chin Liang SeeAdd pinmux driver support for Stratix SoC Signed-off-by: Chin Liang See --- arch/arm/mach-socfpga/Makefile | 2 + .../arm/mach-socfpga/include/mach/system_manager.h | 5 +- .../mach-socfpga/include/mach/system_manager_s10.h | 169 + arch/arm/mach-socfpga/system_manager_s10.c | 91 +++ arch/arm/mach-socfpga/wrap_pinmux_config_s10.c | 55 +++ 5 files changed, 321 insertions(+), 1 deletion(-) create mode 100644 arch/arm/mach-socfpga/include/mach/system_manager_s10.h create mode 100644 arch/arm/mach-socfpga/system_manager_s10.c create mode 100644 arch/arm/mach-socfpga/wrap_pinmux_config_s10.c diff --git a/arch/arm/mach-socfpga/Makefile b/arch/arm/mach-socfpga/Makefile index f10b05c..910eb6f 100644 --- a/arch/arm/mach-socfpga/Makefile +++ b/arch/arm/mach-socfpga/Makefile @@ -33,6 +33,8 @@ endif ifdef CONFIG_TARGET_SOCFPGA_STRATIX10 obj-y += clock_manager_s10.o obj-y += reset_manager_s10.o +obj-y += system_manager_s10.o +obj-y += wrap_pinmux_config_s10.o obj-y += wrap_pll_config_s10.o endif ifdef CONFIG_SPL_BUILD diff --git a/arch/arm/mach-socfpga/include/mach/system_manager.h b/arch/arm/mach-socfpga/include/mach/system_manager.h index e6d4280..80c7d0b 100644 --- a/arch/arm/mach-socfpga/include/mach/system_manager.h +++ b/arch/arm/mach-socfpga/include/mach/system_manager.h @@ -7,6 +7,9 @@ #ifndef _SYSTEM_MANAGER_H_ #define _SYSTEM_MANAGER_H_ +#if defined(CONFIG_TARGET_SOCFPGA_STRATIX10) +#include +#else #define SYSMGR_ROMCODEGRP_CTRL_WARMRSTCFGPINMUXBIT(0) #define SYSMGR_ROMCODEGRP_CTRL_WARMRSTCFGIOBIT(1) #define SYSMGR_ECC_OCRAM_ENBIT(0) @@ -89,5 +92,5 @@ #define SYSMGR_GET_BOOTINFO_BSEL(bsel) \ (((bsel) >> SYSMGR_BOOTINFO_BSEL_SHIFT) & 7) - +#endif #endif /* _SYSTEM_MANAGER_H_ */ diff --git a/arch/arm/mach-socfpga/include/mach/system_manager_s10.h b/arch/arm/mach-socfpga/include/mach/system_manager_s10.h new file mode 100644 index 000..d992072 --- /dev/null +++ b/arch/arm/mach-socfpga/include/mach/system_manager_s10.h @@ -0,0 +1,169 @@ +/* + * Copyright (C) 2016-2017 Intel Corporation + * + * SPDX-License-Identifier:GPL-2.0 + */ + +#ifndef_SYSTEM_MANAGER_S10_ +#define_SYSTEM_MANAGER_S10_ + +void sysmgr_pinmux_init(void); +void populate_sysmgr_fpgaintf_module(void); +void populate_sysmgr_pinmux(void); +void sysmgr_pinmux_table_sel(const u32 **table, unsigned int *table_len); +void sysmgr_pinmux_table_ctrl(const u32 **table, unsigned int *table_len); +void sysmgr_pinmux_table_fpga(const u32 **table, unsigned int *table_len); +void sysmgr_pinmux_table_delay(const u32 **table, unsigned int *table_len); + +struct socfpga_system_manager { + /* System Manager Module */ + u32 siliconid1; /* 0x00 */ + u32 siliconid2; + u32 wddbg; + u32 _pad_0xc; + u32 mpu_status; /* 0x10 */ + u32 mpu_ace; + u32 _pad_0x18_0x1c[2]; + u32 dma;/* 0x20 */ + u32 dma_periph; + /* SDMMC Controller Group */ + u32 sdmmcgrp_ctrl; + u32 sdmmcgrp_l3master; + /* NAND Flash Controller Register Group */ + u32 nandgrp_bootstrap; /* 0x30 */ + u32 nandgrp_l3master; + /* USB Controller Group */ + u32 usb0_l3master; + u32 usb1_l3master; + /* EMAC Group */ + u32 emac_gbl; /* 0x40 */ + u32 emac0; + u32 emac1; + u32 emac2; + u32 emac0_ace; /* 0x50 */ + u32 emac1_ace; + u32 emac2_ace; + u32 nand_axuser; + u32 _pad_0x60_0x64[2]; /* 0x60 */ + /* FPGA interface Group */ + u32 fpgaintf_en_1; + u32 fpgaintf_en_2; + u32 fpgaintf_en_3; /* 0x70 */ + u32 dma_l3master; + u32 etr_l3master; + u32 _pad_0x7c; + u32 sec_ctrl_slt; /* 0x80 */ + u32 osc_trim; + u32 _pad_0x88_0x8c[2]; + /* ECC Group */ + u32 ecc_intmask_value; /* 0x90 */ + u32 ecc_intmask_set; + u32 ecc_intmask_clr; + u32 ecc_intstatus_serr; + u32 ecc_intstatus_derr; /* 0xa0 */ + u32 _pad_0xa4_0xac[3]; + u32 noc_addr_remap; /* 0xb0 */ + u32 hmc_clk; + u32 io_pa_ctrl; + u32 _pad_0xbc; + /* NOC Group */ + u32 noc_timeout;/* 0xc0 */ + u32 noc_idlereq_set; + u32 noc_idlereq_clr; + u32 noc_idlereq_value; + u32 noc_idleack;/* 0xd0 */ + u32 noc_idlestatus; + u32 fpga2soc_ctrl; + u32
[U-Boot] [PATCH v2 03/14] arm: socfpga: stratix10: Add Reset Manager driver for Stratix10 SoC
From: Chin Liang SeeAdd Reset Manager driver support for Stratix SoC Signed-off-by: Chin Liang See --- arch/arm/mach-socfpga/Makefile | 1 + arch/arm/mach-socfpga/include/mach/reset_manager.h | 2 + .../include/mach/reset_manager_arria10.h | 8 +- .../mach-socfpga/include/mach/reset_manager_s10.h | 116 arch/arm/mach-socfpga/reset_manager.c | 41 +++ arch/arm/mach-socfpga/reset_manager_arria10.c | 67 +++- arch/arm/mach-socfpga/reset_manager_gen5.c | 33 -- arch/arm/mach-socfpga/reset_manager_s10.c | 118 + include/dt-bindings/reset/altr,rst-mgr-s10.h | 97 + 9 files changed, 395 insertions(+), 88 deletions(-) create mode 100644 arch/arm/mach-socfpga/include/mach/reset_manager_s10.h create mode 100644 arch/arm/mach-socfpga/reset_manager_s10.c create mode 100644 include/dt-bindings/reset/altr,rst-mgr-s10.h diff --git a/arch/arm/mach-socfpga/Makefile b/arch/arm/mach-socfpga/Makefile index e5f9dd7..f10b05c 100644 --- a/arch/arm/mach-socfpga/Makefile +++ b/arch/arm/mach-socfpga/Makefile @@ -32,6 +32,7 @@ endif ifdef CONFIG_TARGET_SOCFPGA_STRATIX10 obj-y += clock_manager_s10.o +obj-y += reset_manager_s10.o obj-y += wrap_pll_config_s10.o endif ifdef CONFIG_SPL_BUILD diff --git a/arch/arm/mach-socfpga/include/mach/reset_manager.h b/arch/arm/mach-socfpga/include/mach/reset_manager.h index 6591745..577fcce 100644 --- a/arch/arm/mach-socfpga/include/mach/reset_manager.h +++ b/arch/arm/mach-socfpga/include/mach/reset_manager.h @@ -45,6 +45,8 @@ void socfpga_per_reset_all(void); #include #elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10) #include +#elif defined(CONFIG_TARGET_SOCFPGA_STRATIX10) +#include #endif #endif /* _RESET_MANAGER_H_ */ diff --git a/arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h b/arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h index b6d7f4f..e521839 100644 --- a/arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h +++ b/arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h @@ -28,10 +28,10 @@ struct socfpga_reset_manager { u32 hdskreq; u32 hdskack; u32 counts; - u32 mpumodrst; - u32 per0modrst; - u32 per1modrst; - u32 brgmodrst; + u32 mpu_mod_reset; + u32 per_mod_reset; + u32 per2_mod_reset; + u32 brg_mod_reset; u32 sysmodrst; u32 coldmodrst; u32 nrstmodrst; diff --git a/arch/arm/mach-socfpga/include/mach/reset_manager_s10.h b/arch/arm/mach-socfpga/include/mach/reset_manager_s10.h new file mode 100644 index 000..07ada59 --- /dev/null +++ b/arch/arm/mach-socfpga/include/mach/reset_manager_s10.h @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2016-2017 Intel Corporation + * + * SPDX-License-Identifier:GPL-2.0 + */ + +#ifndef_RESET_MANAGER_S10_ +#define_RESET_MANAGER_S10_ + +void reset_cpu(ulong addr); +void reset_deassert_peripherals_handoff(void); + +void socfpga_bridges_reset(int enable); + +void socfpga_per_reset(u32 reset, int set); +void socfpga_per_reset_all(void); + +struct socfpga_reset_manager { + u32 status; + u32 mpu_rst_stat; + u32 misc_stat; + u32 padding1; + u32 hdsk_en; + u32 hdsk_req; + u32 hdsk_ack; + u32 hdsk_stall; + u32 mpu_mod_reset; + u32 per_mod_reset; /* stated as per0_mod_reset in S10 datasheet */ + u32 per2_mod_reset; /* stated as per1_mod_reset in S10 datasheet */ + u32 brg_mod_reset; + u32 padding2; + u32 cold_mod_reset; + u32 padding3; + u32 dbg_mod_reset; + u32 tap_mod_reset; + u32 padding4; + u32 padding5; + u32 brg_warm_mask; + u32 padding6[3]; + u32 tst_stat; + u32 padding7; + u32 hdsk_timeout; + u32 mpul2flushtimeout; + u32 dbghdsktimeout; +}; + +#define RSTMGR_MPUMODRST_CORE0 0 +#define RSTMGR_PER0MODRST_OCP_MASK 0x0020bf00 +#define RSTMGR_BRGMODRST_DDRSCH_MASK 0X0040 + +/* + * Define a reset identifier, from which a permodrst bank ID + * and reset ID can be extracted using the subsequent macros + * RSTMGR_RESET() and RSTMGR_BANK(). + */ +#define RSTMGR_BANK_OFFSET 8 +#define RSTMGR_BANK_MASK 0x7 +#define RSTMGR_RESET_OFFSET0 +#define RSTMGR_RESET_MASK 0x1f +#define RSTMGR_DEFINE(_bank, _offset) \ + ((_bank) << RSTMGR_BANK_OFFSET) | ((_offset) << RSTMGR_RESET_OFFSET) + +/* Extract reset ID from the reset identifier. */ +#define RSTMGR_RESET(_reset) \ + (((_reset) >> RSTMGR_RESET_OFFSET) & RSTMGR_RESET_MASK) + +/* Extract bank ID from the reset identifier. */ +#define RSTMGR_BANK(_reset)
[U-Boot] [PATCH v2 02/14] arm: socfpga: stratix10: Add Clock Manager driver for Stratix10 SoC
From: Chin Liang SeeAdd Clock Manager driver support for Stratix SoC Signed-off-by: Chin Liang See -- Changes in v2 - Declared defines for constant value used - Fixed spacing and comments --- arch/arm/mach-socfpga/Makefile | 4 + arch/arm/mach-socfpga/clock_manager.c | 4 +- arch/arm/mach-socfpga/clock_manager_s10.c | 355 + arch/arm/mach-socfpga/include/mach/clock_manager.h | 2 + .../mach-socfpga/include/mach/clock_manager_s10.h | 210 arch/arm/mach-socfpga/include/mach/handoff_s10.h | 29 ++ arch/arm/mach-socfpga/wrap_pll_config_s10.c| 44 +++ 7 files changed, 646 insertions(+), 2 deletions(-) create mode 100644 arch/arm/mach-socfpga/clock_manager_s10.c create mode 100644 arch/arm/mach-socfpga/include/mach/clock_manager_s10.h create mode 100644 arch/arm/mach-socfpga/include/mach/handoff_s10.h create mode 100644 arch/arm/mach-socfpga/wrap_pll_config_s10.c diff --git a/arch/arm/mach-socfpga/Makefile b/arch/arm/mach-socfpga/Makefile index 286bfef..e5f9dd7 100644 --- a/arch/arm/mach-socfpga/Makefile +++ b/arch/arm/mach-socfpga/Makefile @@ -30,6 +30,10 @@ obj-y+= pinmux_arria10.o obj-y += reset_manager_arria10.o endif +ifdef CONFIG_TARGET_SOCFPGA_STRATIX10 +obj-y += clock_manager_s10.o +obj-y += wrap_pll_config_s10.o +endif ifdef CONFIG_SPL_BUILD obj-y += spl.o ifdef CONFIG_TARGET_SOCFPGA_GEN5 diff --git a/arch/arm/mach-socfpga/clock_manager.c b/arch/arm/mach-socfpga/clock_manager.c index cb6ae03..f9450a4 100644 --- a/arch/arm/mach-socfpga/clock_manager.c +++ b/arch/arm/mach-socfpga/clock_manager.c @@ -21,7 +21,7 @@ void cm_wait_for_lock(u32 mask) do { #if defined(CONFIG_TARGET_SOCFPGA_GEN5) inter_val = readl(_manager_base->inter) & mask; -#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10) +#else inter_val = readl(_manager_base->stat) & mask; #endif /* Wait for stable lock */ @@ -52,7 +52,7 @@ int set_cpu_clk_info(void) #if defined(CONFIG_TARGET_SOCFPGA_GEN5) gd->bd->bi_ddr_freq = cm_get_sdram_clk_hz() / 100; -#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10) +#else gd->bd->bi_ddr_freq = 0; #endif diff --git a/arch/arm/mach-socfpga/clock_manager_s10.c b/arch/arm/mach-socfpga/clock_manager_s10.c new file mode 100644 index 000..cfb6708 --- /dev/null +++ b/arch/arm/mach-socfpga/clock_manager_s10.c @@ -0,0 +1,355 @@ +/* + * Copyright (C) 2016-2017 Intel Corporation + * + * SPDX-License-Identifier:GPL-2.0 + */ + +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +static const struct socfpga_clock_manager *clock_manager_base = + (struct socfpga_clock_manager *)SOCFPGA_CLKMGR_ADDRESS; + +/* + * function to write the bypass register which requires a poll of the + * busy bit + */ +static void cm_write_bypass_mainpll(uint32_t val) +{ + writel(val, _manager_base->main_pll.bypass); + cm_wait_for_fsm(); +} + +static void cm_write_bypass_perpll(uint32_t val) +{ + writel(val, _manager_base->per_pll.bypass); + cm_wait_for_fsm(); +} + +/* function to write the ctrl register which requires a poll of the busy bit */ +static void cm_write_ctrl(uint32_t val) +{ + writel(val, _manager_base->ctrl); + cm_wait_for_fsm(); +} + +/* + * Setup clocks while making no assumptions about previous state of the clocks. + */ +void cm_basic_init(const struct cm_config * const cfg) +{ + uint32_t mdiv, refclkdiv, mscnt, hscnt, vcocalib; + + if (cfg == 0) + return; + + /* Put all plls in bypass */ + cm_write_bypass_mainpll(CLKMGR_BYPASS_MAINPLL_ALL); + cm_write_bypass_perpll(CLKMGR_BYPASS_PERPLL_ALL); + + /* setup main PLL dividers where calculate the vcocalib value */ + mdiv = (cfg->main_pll_fdbck >> CLKMGR_FDBCK_MDIV_OFFSET) & + CLKMGR_FDBCK_MDIV_MASK; + refclkdiv = (cfg->main_pll_pllglob >> CLKMGR_PLLGLOB_REFCLKDIV_OFFSET) & +CLKMGR_PLLGLOB_REFCLKDIV_MASK; + mscnt = CLKMGR_MSCNT_CONST / (CLKMGR_MDIV_CONST + mdiv) / refclkdiv; + hscnt = (mdiv + CLKMGR_MDIV_CONST) * mscnt / refclkdiv - + CLKMGR_HSCNT_CONST; + vcocalib = (hscnt & CLKMGR_VCOCALIB_HSCNT_MASK) | + ((mscnt & CLKMGR_VCOCALIB_MSCNT_MASK) << + CLKMGR_VCOCALIB_MSCNT_OFFSET); + + writel((cfg->main_pll_pllglob & ~CLKMGR_PLLGLOB_PD_MASK & + ~CLKMGR_PLLGLOB_RST_MASK), + _manager_base->main_pll.pllglob); + writel(cfg->main_pll_fdbck, _manager_base->main_pll.fdbck); + writel(vcocalib, _manager_base->main_pll.vcocalib); + writel(cfg->main_pll_pllc0, _manager_base->main_pll.pllc0); + writel(cfg->main_pll_pllc1, _manager_base->main_pll.pllc1); + writel(cfg->main_pll_nocdiv, _manager_base->main_pll.nocdiv); + + /* setup peripheral PLL dividers */ +
[U-Boot] [PATCH v2 05/14] arm: socfpga: stratix10: Add misc support for Stratix10 SoC
From: Chin Liang SeeAdd misc support such as EMAC and cpu info printout for Stratix SoC Signed-off-by: Chin Liang See --- arch/arm/mach-socfpga/Makefile| 1 + arch/arm/mach-socfpga/include/mach/misc.h | 1 + arch/arm/mach-socfpga/misc.c | 76 arch/arm/mach-socfpga/misc_gen5.c | 75 ++- arch/arm/mach-socfpga/misc_s10.c | 115 ++ 5 files changed, 197 insertions(+), 71 deletions(-) create mode 100644 arch/arm/mach-socfpga/misc_s10.c diff --git a/arch/arm/mach-socfpga/Makefile b/arch/arm/mach-socfpga/Makefile index 910eb6f..b253914 100644 --- a/arch/arm/mach-socfpga/Makefile +++ b/arch/arm/mach-socfpga/Makefile @@ -32,6 +32,7 @@ endif ifdef CONFIG_TARGET_SOCFPGA_STRATIX10 obj-y += clock_manager_s10.o +obj-y += misc_s10.o obj-y += reset_manager_s10.o obj-y += system_manager_s10.o obj-y += wrap_pinmux_config_s10.o diff --git a/arch/arm/mach-socfpga/include/mach/misc.h b/arch/arm/mach-socfpga/include/mach/misc.h index 0b65783..8466023 100644 --- a/arch/arm/mach-socfpga/include/mach/misc.h +++ b/arch/arm/mach-socfpga/include/mach/misc.h @@ -8,6 +8,7 @@ #define _MISC_H_ void dwmac_deassert_reset(const unsigned int of_reset_id, const u32 phymode); +int socfpga_eth_reset(void); struct bsel { const char *mode; diff --git a/arch/arm/mach-socfpga/misc.c b/arch/arm/mach-socfpga/misc.c index 00eff90..cee3296 100644 --- a/arch/arm/mach-socfpga/misc.c +++ b/arch/arm/mach-socfpga/misc.c @@ -20,11 +20,14 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; +#ifdef CONFIG_SYS_L2_PL310 static const struct pl310_regs *const pl310 = (struct pl310_regs *)CONFIG_SYS_PL310_BASE; +#endif struct bsel bsel_str[] = { { "rsvd", "Reserved", }, @@ -53,6 +56,7 @@ void enable_caches(void) #endif } +#ifdef CONFIG_SYS_L2_PL310 void v7_outer_cache_enable(void) { /* Disable the L2 cache */ @@ -73,6 +77,7 @@ void v7_outer_cache_disable(void) /* Disable the L2 cache */ clrbits_le32(>pl310_ctrl, L2X0_CTRL_EN); } +#endif #if defined(CONFIG_SYS_CONSOLE_IS_IN_ENV) && \ defined(CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE) @@ -136,3 +141,74 @@ int arch_cpu_init(void) return 0; } + +#if !defined(CONFIG_TARGET_SOCFPGA_ARRIA10) +static u32 dwmac_phymode_to_modereg(const char *phymode, u32 *modereg) +{ + if (!phymode) + return -EINVAL; + + if (!strcmp(phymode, "mii") || !strcmp(phymode, "gmii")) { + *modereg = SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_GMII_MII; + return 0; + } + + if (!strcmp(phymode, "rgmii")) { + *modereg = SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_RGMII; + return 0; + } + + if (!strcmp(phymode, "rmii")) { + *modereg = SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_RMII; + return 0; + } + + return -EINVAL; +} +#endif + +#ifdef CONFIG_ETH_DESIGNWARE +int socfpga_eth_reset(void) +{ + const void *fdt = gd->fdt_blob; + struct fdtdec_phandle_args args; + const char *phy_mode; + u32 phy_modereg; + int nodes[3]; /* Max. 3 GMACs */ + int ret, count; + int i, node; + + count = fdtdec_find_aliases_for_id(fdt, "ethernet", + COMPAT_ALTERA_SOCFPGA_DWMAC, + nodes, ARRAY_SIZE(nodes)); + for (i = 0; i < count; i++) { + node = nodes[i]; + if (node <= 0) + continue; + + ret = fdtdec_parse_phandle_with_args(fdt, node, "resets", +"#reset-cells", 1, 0, +); + if (ret || (args.args_count != 1)) { + debug("GMAC%i: Failed to parse DT 'resets'!\n", i); + continue; + } + + phy_mode = fdt_getprop(fdt, node, "phy-mode", NULL); + ret = dwmac_phymode_to_modereg(phy_mode, _modereg); + if (ret) { + debug("GMAC%i: Failed to parse DT 'phy-mode'!\n", i); + continue; + } + + dwmac_deassert_reset(args.args[0], phy_modereg); + } + + return 0; +} +#else +int socfpga_eth_reset(void) +{ + return 0; +}; +#endif diff --git a/arch/arm/mach-socfpga/misc_gen5.c b/arch/arm/mach-socfpga/misc_gen5.c index 91ddb79..6149c8a 100644 --- a/arch/arm/mach-socfpga/misc_gen5.c +++ b/arch/arm/mach-socfpga/misc_gen5.c @@ -67,77 +67,6 @@ void dwmac_deassert_reset(const unsigned int of_reset_id, /* Release the EMAC controller from reset */ socfpga_per_reset(reset, 0); } - -static u32 dwmac_phymode_to_modereg(const char *phymode, u32 *modereg) -{ - if (!phymode) - return
[U-Boot] [PATCH v2 01/14] arm: socfpga: stratix10: Add base address map for Statix10 SoC
From: Chin Liang SeeAdd the base address map for Statix10 SoC Signed-off-by: Chin Liang See --- arch/arm/mach-socfpga/include/mach/base_addr_s10.h | 56 ++ 1 file changed, 56 insertions(+) create mode 100644 arch/arm/mach-socfpga/include/mach/base_addr_s10.h diff --git a/arch/arm/mach-socfpga/include/mach/base_addr_s10.h b/arch/arm/mach-socfpga/include/mach/base_addr_s10.h new file mode 100644 index 000..2fdc917 --- /dev/null +++ b/arch/arm/mach-socfpga/include/mach/base_addr_s10.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2016-2017 Intel Corporation + * + * SPDX-License-Identifier:GPL-2.0 + */ + +#ifndef _SOCFPGA_S10_BASE_HARDWARE_H_ +#define _SOCFPGA_S10_BASE_HARDWARE_H_ + +#define SOCFPGA_SDR_SCHEDULER_ADDRESS 0xf8000400 +#define SOCFPGA_HMC_MMR_IO48_ADDRESS 0xf801 +#define SOCFPGA_SDR_ADDRESS0xf8011000 +#define SOCFPGA_SMMU_ADDRESS 0xfa00 +#define SOCFPGA_MAILBOX_ADDRESS0xffA3 +#define SOCFPGA_USB0_ADDRESS 0xffb0 +#define SOCFPGA_USB1_ADDRESS 0xffb4 +#define SOCFPGA_NANDREGS_ADDRESS 0xffb8 +#define SOCFPGA_NANDDATA_ADDRESS 0xffb9 +#define SOCFPGA_UART0_ADDRESS 0xffc02000 +#define SOCFPGA_UART1_ADDRESS 0xffc02100 +#define SOCFPGA_I2C0_ADDRESS 0xffc02800 +#define SOCFPGA_I2C1_ADDRESS 0xffc02900 +#define SOCFPGA_I2C2_ADDRESS 0xffc02a00 +#define SOCFPGA_I2C3_ADDRESS 0xffc02b00 +#define SOCFPGA_I2C4_ADDRESS 0xffc02c00 +#define SOCFPGA_SPTIMER0_ADDRESS 0xffc03000 +#define SOCFPGA_SPTIMER1_ADDRESS 0xffc03100 +#define SOCFPGA_GPIO0_ADDRESS 0xffc03200 +#define SOCFPGA_GPIO1_ADDRESS 0xffc03300 +#define SOCFPGA_SYSTIMER0_ADDRESS 0xffd0 +#define SOCFPGA_SYSTIMER1_ADDRESS 0xffd00100 +#define SOCFPGA_L4WD0_ADDRESS 0xffd00200 +#define SOCFPGA_L4WD1_ADDRESS 0xffd00300 +#define SOCFPGA_L4WD2_ADDRESS 0xffd00400 +#define SOCFPGA_L4WD3_ADDRESS 0xffd00500 +#define SOCFPGA_GTIMER_SEC_ADDRESS 0xffd01000 +#define SOCFPGA_GTIMER_NSEC_ADDRESS0xffd02000 +#define SOCFPGA_CLKMGR_ADDRESS 0xffd1 +#define SOCFPGA_RSTMGR_ADDRESS 0xffd11000 +#define SOCFPGA_SYSMGR_ADDRESS 0xffd12000 +#define SOCFPGA_PINMUX_DEDICATED_IO_ADDRESS0xffd13000 +#define SOCFPGA_FIREWALL_L4_PER0xffd21000 +#define SOCFPGA_FIREWALL_L4_SYS0xffd21100 +#define SOCFPGA_FIREWALL_SOC2FPGA 0xffd21200 +#define SOCFPGA_FIREWALL_LWSOC2FPGA0xffd21300 +#define SOCFPGA_DMANONSECURE_ADDRESS 0xffda +#define SOCFPGA_DMASECURE_ADDRESS 0xffda1000 +#define SOCFPGA_SPIS0_ADDRESS 0xffda2000 +#define SOCFPGA_SPIS1_ADDRESS 0xffda3000 +#define SOCFPGA_SPIM0_ADDRESS 0xffda4000 +#define SOCFPGA_SPIM1_ADDRESS 0xffda5000 +#define SOCFPGA_OCRAM_ADDRESS 0xffe0 +#define GICD_BASE 0xfffc1000 +#define GICC_BASE 0xfffc2000 + +#endif /* _SOCFPGA_S10_BASE_HARDWARE_H_ */ -- 2.2.2 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 00/14] Enable Stratix10 SoC support
From: Chin Liang SeeThis patch series are enabling support for Stratix 10 SoC Changes for v2 - Removed defines for base addresses that can be extracted from DTS - Added CPU node plus MDIO node for Ethernet at DTS - Added defines for constant value for readability - Consolidated common code for Clock Manager and misc code Chin Liang See (14): arm: socfpga: stratix10: Add base address map for Statix10 SoC arm: socfpga: stratix10: Add Clock Manager driver for Stratix10 SoC arm: socfpga: stratix10: Add Reset Manager driver for Stratix10 SoC arm: socfpga: stratix10: Add pinmux support for Stratix10 SoC arm: socfpga: stratix10: Add misc support for Stratix10 SoC arm: socfpga: stratix10: Add mailbox support for Stratix10 SoC arm: socfpga: stratix10: Add MMU support for Stratix10 SoC arm: dts: Add dts for Stratix10 SoC arm: socfpga: Restructure the SPL file arm: socfpga: stratix10: Add SPL driver for Stratix10 SoC arm: socfpga: stratix10: Add timer support for Stratix10 SoC ddr: altera: stratix10: Add DDR support for Stratix10 SoC board: altera: stratix10: Add socdk board support for Stratix10 SoC arm: socfpga: stratix10: Enable Stratix10 SoC build arch/arm/Kconfig | 8 +- arch/arm/dts/Makefile | 3 +- arch/arm/dts/socfpga_stratix10_socdk.dts | 180 ++ arch/arm/mach-socfpga/Kconfig | 13 + arch/arm/mach-socfpga/Makefile | 19 +- arch/arm/mach-socfpga/clock_manager.c | 4 +- arch/arm/mach-socfpga/clock_manager_s10.c | 355 +++ arch/arm/mach-socfpga/include/mach/base_addr_s10.h | 56 +++ arch/arm/mach-socfpga/include/mach/clock_manager.h | 2 + .../mach-socfpga/include/mach/clock_manager_s10.h | 210 +++ arch/arm/mach-socfpga/include/mach/firewall_s10.h | 84 + arch/arm/mach-socfpga/include/mach/handoff_s10.h | 29 ++ arch/arm/mach-socfpga/include/mach/mailbox_s10.h | 108 ++ arch/arm/mach-socfpga/include/mach/misc.h | 1 + arch/arm/mach-socfpga/include/mach/reset_manager.h | 2 + .../include/mach/reset_manager_arria10.h | 8 +- .../mach-socfpga/include/mach/reset_manager_s10.h | 116 +++ arch/arm/mach-socfpga/include/mach/sdram_s10.h | 333 ++ .../arm/mach-socfpga/include/mach/system_manager.h | 5 +- .../mach-socfpga/include/mach/system_manager_s10.h | 169 + arch/arm/mach-socfpga/mailbox_s10.c| 238 + arch/arm/mach-socfpga/misc.c | 76 arch/arm/mach-socfpga/misc_gen5.c | 75 +--- arch/arm/mach-socfpga/misc_s10.c | 115 +++ arch/arm/mach-socfpga/mmu-arm64_s10.c | 71 arch/arm/mach-socfpga/reset_manager.c | 41 +++ arch/arm/mach-socfpga/reset_manager_arria10.c | 67 +--- arch/arm/mach-socfpga/reset_manager_gen5.c | 33 -- arch/arm/mach-socfpga/reset_manager_s10.c | 118 +++ arch/arm/mach-socfpga/spl_a10.c| 105 ++ arch/arm/mach-socfpga/{spl.c => spl_gen5.c}| 46 --- arch/arm/mach-socfpga/spl_s10.c| 138 arch/arm/mach-socfpga/system_manager_s10.c | 91 + arch/arm/mach-socfpga/timer.c | 17 +- arch/arm/mach-socfpga/wrap_pinmux_config_s10.c | 55 +++ arch/arm/mach-socfpga/wrap_pll_config_s10.c| 44 +++ board/altera/stratix10-socdk/MAINTAINERS | 7 + board/altera/stratix10-socdk/Makefile | 7 + board/altera/stratix10-socdk/socfpga.c | 7 + configs/socfpga_stratix10_defconfig| 39 +++ drivers/ddr/altera/Makefile| 1 + drivers/ddr/altera/sdram_s10.c | 382 + include/configs/socfpga_stratix10_socdk.h | 216 include/dt-bindings/reset/altr,rst-mgr-s10.h | 97 ++ 44 files changed, 3577 insertions(+), 214 deletions(-) create mode 100644 arch/arm/dts/socfpga_stratix10_socdk.dts create mode 100644 arch/arm/mach-socfpga/clock_manager_s10.c create mode 100644 arch/arm/mach-socfpga/include/mach/base_addr_s10.h create mode 100644 arch/arm/mach-socfpga/include/mach/clock_manager_s10.h create mode 100644 arch/arm/mach-socfpga/include/mach/firewall_s10.h create mode 100644 arch/arm/mach-socfpga/include/mach/handoff_s10.h create mode 100644 arch/arm/mach-socfpga/include/mach/mailbox_s10.h create mode 100644 arch/arm/mach-socfpga/include/mach/reset_manager_s10.h create mode 100644 arch/arm/mach-socfpga/include/mach/sdram_s10.h create mode 100644 arch/arm/mach-socfpga/include/mach/system_manager_s10.h create mode 100644 arch/arm/mach-socfpga/mailbox_s10.c create mode 100644 arch/arm/mach-socfpga/misc_s10.c create mode 100644 arch/arm/mach-socfpga/mmu-arm64_s10.c create mode 100644
Re: [U-Boot] [PATCH 1/1] efi_loader: replace efi_div10 by div64_u64
On 03.10.17 05:17, Heinrich Schuchardt wrote: We should use the existing 64bit division instead of reinventing the wheel. Signed-off-by: Heinrich SchuchardtThis patch increases the code size by ~200 bytes on armv7 with gcc7 for me. I'm not sure about the runtime - it's probably much slower too. I do agree however that lib/efi_loader is not necessarily the right place to put base math things. How about we just rename the efi_div10 to div64_10 and move it to lib/div64.c? Alex ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/1] efi_loader: use type bool for event states
On 04.10.17 18:39, Rob Clark wrote: On Wed, Oct 4, 2017 at 12:29 PM, Heinrich Schuchardtwrote: On 10/04/2017 05:25 PM, Alexander Graf wrote: On 04.10.17 16:57, Rob Clark wrote: On Wed, Oct 4, 2017 at 10:46 AM, Heinrich Schuchardt wrote: On 10/04/2017 04:14 PM, Rob Clark wrote: On Wed, Oct 4, 2017 at 9:03 AM, Heinrich Schuchardt wrote: Queued and signaled describe boolean states of events. So let's use type bool and rename the structure members to is_queued and is_signaled. Update the comments for is_queued and is_signaled. Reviewed-by: Rob Clark It would be kinda nice to merge my efi_event fixes and rework to use an arbitrary sized list of events before making too many more efi_event changes, since that is kind of annoying to keep rebasing ;-) BR, -R I would not mind if you patch went first. But your patch https://patchwork.ozlabs.org/patch/812967/ is not applicable to U-Boot master and needs rebasing anyway. jfyi, I have it (and other pending patches) rebased on latest master (as of ~yesterday) here: https://github.com/robclark/u-boot/commits/wip-enough-uefi-for-shell I wasn't planning on resending until I get further with FAT write stuff (currently on a local branch, although I might not get much time to work on in the next week or two).. although I can re-send it or any of the other patches to get Shell.efi working if wanted. (Note that I'm also using your patch for efi watchdog support, that was one of the other required bits.) Not sure what agraf's plan is but I think the needed bits for Shell.efi are mergable already. I don't have a concrete plan - in general I consider patches that have unaddressed review comments as "not to be applied atm" though and I'm not sure I have anything pending from you that would not fall into that category :). Can you split off a series that has Heinrich's blessing to get us as far as we can, so we can keep your queue short? These are the two first patches in Rob's queue: efi_loader: support 16 protocols per efi_object https://patchwork.ozlabs.org/patch/806167/ efi_loader: allow creating new handles https://patchwork.ozlabs.org/patch/806173/ btw, you can add for these two: Reviewed-by: Rob Clark I usually apply patches using patchwork which gives me tags that were emailed directly onto the mail thread integrated into the mbox I download. In other words, if you reply to the patch with a reviewed-by tag, I'll automatically have it when applying the patch. If you mention it in an email somewhere chances are quite good it slips through the cracks :) (and yes, I've added those two manually now) Alex ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/1] efi_loader: use type bool for event states
On 04.10.17 18:29, Heinrich Schuchardt wrote: On 10/04/2017 05:25 PM, Alexander Graf wrote: On 04.10.17 16:57, Rob Clark wrote: On Wed, Oct 4, 2017 at 10:46 AM, Heinrich Schuchardtwrote: On 10/04/2017 04:14 PM, Rob Clark wrote: On Wed, Oct 4, 2017 at 9:03 AM, Heinrich Schuchardt wrote: Queued and signaled describe boolean states of events. So let's use type bool and rename the structure members to is_queued and is_signaled. Update the comments for is_queued and is_signaled. Reviewed-by: Rob Clark It would be kinda nice to merge my efi_event fixes and rework to use an arbitrary sized list of events before making too many more efi_event changes, since that is kind of annoying to keep rebasing ;-) BR, -R I would not mind if you patch went first. But your patch https://patchwork.ozlabs.org/patch/812967/ is not applicable to U-Boot master and needs rebasing anyway. jfyi, I have it (and other pending patches) rebased on latest master (as of ~yesterday) here: https://github.com/robclark/u-boot/commits/wip-enough-uefi-for-shell I wasn't planning on resending until I get further with FAT write stuff (currently on a local branch, although I might not get much time to work on in the next week or two).. although I can re-send it or any of the other patches to get Shell.efi working if wanted. (Note that I'm also using your patch for efi watchdog support, that was one of the other required bits.) Not sure what agraf's plan is but I think the needed bits for Shell.efi are mergable already. I don't have a concrete plan - in general I consider patches that have unaddressed review comments as "not to be applied atm" though and I'm not sure I have anything pending from you that would not fall into that category :). Can you split off a series that has Heinrich's blessing to get us as far as we can, so we can keep your queue short? These are the two first patches in Rob's queue: efi_loader: support 16 protocols per efi_object https://patchwork.ozlabs.org/patch/806167/ efi_loader: allow creating new handles https://patchwork.ozlabs.org/patch/806173/ Please, merge these. Done. I am aware that we need to convert the protocols list to a linked list and will do so in a later patch. Please, also merge this patch that definitively does not interfere with Rob's work: efi_selftest: enable CONFIG_CMD_BOOTEFI_SELFTEST https://patchwork.ozlabs.org/patch/816412/ Done. Alex ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] distro: load FDT from any partition on boot device
On 04.10.17 22:16, Rob Clark wrote: In the EFI_LOADER boot path, we were only checking the FAT partition containing the EFI payload for dtb files. But this is somewhat of a fiction. In reality there will be one small (V)FAT partition containing grub (or whatever the payload may be), and a second boot partition containing kernel/initrd/fdt (typically ext4). It is this second partition where we should be looking for a FDT to load. So instead scan all the partitions of the disk containing the EFI payload. This matches where grub looks for kernel/initrd (barring custom grub.cfg, in which case the user can use grub's 'devicetree' command to load the correct FDT). The other option is somehow passing the ${fdtfile} to grub so that it can load the FDT based on selected kernel version location (which grub knows) and SoC/board specific ${fdtfile} (which grub does not know). Signed-off-by: Rob Clark--- include/config_distro_bootcmd.h | 34 +++--- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h index e232a62996..58b2fe3371 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -126,25 +126,37 @@ "fi\0"\ \ "load_efi_dtb=" \ - "load ${devtype} ${devnum}:${distro_bootpart} " \ - "${fdt_addr_r} ${prefix}${efi_fdtfile}\0" \ + "load ${devtype} ${devnum}:${dtb_devp} " \ + "${fdt_addr_r} ${prefix}${efi_fdtfile} && " \ + "run boot_efi_binary\0" \ \ "efi_dtb_prefixes=/ /dtb/ /dtb/current/\0"\ - "scan_dev_for_efi=" \ + "scan_dev_for_dtb=" \ "setenv efi_fdtfile ${fdtfile}; " \ BOOTENV_EFI_SET_FDTFILE_FALLBACK \ - "for prefix in ${efi_dtb_prefixes}; do " \ - "if test -e ${devtype} " \ - "${devnum}:${distro_bootpart} " \ - "${prefix}${efi_fdtfile}; then " \ - "run load_efi_dtb; " \ - "fi;" \ - "done;" \ + "part list ${devtype} ${devnum} dtb_devplist; " \ part list spawns 128 error messages for me on a USB stick with an iso dd'ed onto it. I'm not sure we want to do that twice during boot. + "env exists dtb_devplist || setenv dtb_devplist " \ + "${distro_bootpart}; "\ + "for dtb_devp in ${dtb_devplist}; do "\ + "for prefix in ${efi_dtb_prefixes}; do " \ + "if test -e ${devtype} " \ + "${devnum}:${dtb_devp} " \ + "${prefix}${efi_fdtfile};"\ + " then " \ + "echo Found DTB ${devtype} " \ + "${devnum}:${dtb_devp} " \ + "${prefix}${efi_fdtfile};"\ + "run load_efi_dtb; " \ + "fi;" \ + "done; " \ + "done; " \ + "run boot_efi_binary\0" \ This will run the EFI binary twice if we find a DT on disk. Or really nr_dtb_parts_found + 1 times :). We also don't want to loop through 50 other partitions if the 1st one already contained a dtb. Instead the loop really should end after the first successful boot attempt on that device. (other distro targets should still get boot attempts, you may want to exit grub from dhcp to enter grub on scsi). Furthermore I remember that Andreas worked in that area too before, let's make sure to CC him. Alex ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [GIT PULL v3] u-boot-sunxi/master
On Wed, Oct 04, 2017 at 04:39:22PM +0200, Maxime Ripard wrote: > On Wed, Oct 04, 2017 at 02:20:53PM +, Maxime Ripard wrote: > > Hi Tom, > > > > Hopefully it's going to be the final version of that PR. > > > > It passed on travis-ci, so we should be all set. > > > > Thanks! > > Maxime > > > > The following changes since commit 39dd65a059e503883dbf16d4c00ac083d15837da: > > > > sandbox: Enable btrfs support (2017-10-03 08:44:55 -0400) > > > > are available in the git repository at: > > > > git://git.denx.de/u-boot-sunxi sunxi/master > > The branch should be just master. > > Actually, how does one generate a pull-request without the local > branch name in the output of git request-pull? I'm not sure, sorry. -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] common: Drop LOGLEVEL to 4
While this came in with a default value of 6 I am lowering this to 4. The MTD/UBI code has a large number of error messages that we include now. In addition, "normally" warning messages are not included so this feels like a more natural level to have. Signed-off-by: Tom Rini--- common/Kconfig | 2 +- configs/axm_defconfig | 1 - configs/corvus_defconfig| 1 - configs/omapl138_lcdk_defconfig | 1 - configs/taurus_defconfig| 1 - 5 files changed, 1 insertion(+), 5 deletions(-) diff --git a/common/Kconfig b/common/Kconfig index f53ee9d6d790..3c99650f0c9e 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -243,7 +243,7 @@ config IDENT_STRING config LOGLEVEL int "loglevel" - default 6 + default 4 range 0 8 help All Messages with a loglevel smaller than the console loglevel will diff --git a/configs/axm_defconfig b/configs/axm_defconfig index cd89c2a235ff..81654b230431 100644 --- a/configs/axm_defconfig +++ b/configs/axm_defconfig @@ -41,4 +41,3 @@ CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_STMICRO=y CONFIG_PHYLIB=y CONFIG_USE_TINY_PRINTF=y -CONFIG_LOGLEVEL=4 diff --git a/configs/corvus_defconfig b/configs/corvus_defconfig index 059cb5992e92..705e00145700 100644 --- a/configs/corvus_defconfig +++ b/configs/corvus_defconfig @@ -14,7 +14,6 @@ CONFIG_SYS_EXTRA_OPTIONS="AT91SAM9M10G45,MACH_TYPE=2066,SYS_USE_NANDFLASH" CONFIG_BOOTDELAY=3 CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=ttyS0,115200 earlyprintk mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro,256k(env),256k(env_redundant),256k(spare),512k(dtb),6M(kernel)ro,-(rootfs) root=/dev/mtdblock7 rw rootfstype=jffs2" -CONFIG_LOGLEVEL=4 # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SPL=y diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig index 3e9eb4fa84e2..c95134bcf990 100644 --- a/configs/omapl138_lcdk_defconfig +++ b/configs/omapl138_lcdk_defconfig @@ -8,7 +8,6 @@ CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_SPL_NAND_SUPPORT=y CONFIG_BOOTDELAY=3 -CONFIG_LOGLEVEL=4 CONFIG_VERSION_VARIABLE=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set diff --git a/configs/taurus_defconfig b/configs/taurus_defconfig index 5b7fc8ae1466..71a382a3e132 100644 --- a/configs/taurus_defconfig +++ b/configs/taurus_defconfig @@ -16,7 +16,6 @@ CONFIG_SPL_SPI_SUPPORT=y CONFIG_DEFAULT_DEVICE_TREE="at91sam9g20-taurus" CONFIG_SYS_EXTRA_OPTIONS="AT91SAM9G20,MACH_TYPE=2067,BOARD_TAURUS" CONFIG_BOOTDELAY=3 -CONFIG_LOGLEVEL=4 CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=ttyS0,115200 earlyprintk mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro,256k(env),256k(env_redundant),256k(spare),512k(dtb),6M(kernel)ro,-(rootfs) root=/dev/mtdblock7 rw rootfstype=jffs2" # CONFIG_DISPLAY_BOARDINFO is not set -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/1] efi_loader: provide function comments for boot services
On 25.09.17 07:25, Heinrich Schuchardt wrote: On 09/25/2017 04:14 AM, Simon Glass wrote: On 21 September 2017 at 10:30, Heinrich Schuchardtwrote: Provide comments describing the boot service functions. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_boottime.c | 640 +- 1 file changed, 638 insertions(+), 2 deletions(-) Great to see this - but please can you put these comments in the header file? That's the file that people read to see the API. nit: efi_locate_protocol() needs a @return Most of the functions are static. @Alex Where do you want the comments - for boottime structure members Not sure I understand. Where they're defined? :) Basically always assume that 2 years from now someone who's never touched any efi_loader code touches it. What's the easiest way to ensure that he doesn't disconnect the documentation from the implementation and even creates new documentation :). That said, please make sure that the code does stay readable enough despite the comments :). - for non-static functions Right above the function body itself - for static functions with forward declaration? Same here, wherever the function is actually implemented makes most sense IMHO. Not everyone in the U-Boot world uses an IDE and this way it's most obvious that changes need to get reflected in the documentation when the implementation changes. Alex ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/2] mx6: clock: Add a prototype for do_mx6_showclocks()
When compiling with W=1 the following warning is observed: arch/arm/mach-imx/mx6/clock.c:1268:5: warning: no previous prototype for ‘do_mx6_showclocks’ [-Wmissing-prototypes] int do_mx6_showclocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) Remove this warning by adding the function prototype into arch-mx6/clock.h file. Signed-off-by: Diego Dorta--- arch/arm/include/asm/arch-mx6/clock.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/include/asm/arch-mx6/clock.h b/arch/arm/include/asm/arch-mx6/clock.h index 2d9c45e..26afefb 100644 --- a/arch/arm/include/asm/arch-mx6/clock.h +++ b/arch/arm/include/asm/arch-mx6/clock.h @@ -80,4 +80,5 @@ void enable_thermal_clk(void); void mxs_set_lcdclk(u32 base_addr, u32 freq); void select_ldb_di_clock_source(enum ldb_di_clock clk); void enable_eim_clk(unsigned char enable); +int do_mx6_showclocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]); #endif /* __ASM_ARCH_CLOCK_H */ -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 2/2] mx6: sys_proto: Add prototypes for imx6_pcie_toggle() functions
When compiling with W=1 errors are observed: drivers/pci/pcie_imx.c:517:12: warning: no previous prototype for ‘imx6_pcie_toggle_power’ [-Wmissing-prototypes] __weak int imx6_pcie_toggle_power(void) drivers/pci/pcie_imx.c:528:12: warning: no previous prototype for ‘imx6_pcie_toggle_reset’ [-Wmissing-prototypes] __weak int imx6_pcie_toggle_reset(void) Remove these warnings by adding the functions prototypes on arch-mx6/sys_proto. Signed-off-by: Diego Dorta--- arch/arm/include/asm/arch-mx6/sys_proto.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/include/asm/arch-mx6/sys_proto.h b/arch/arm/include/asm/arch-mx6/sys_proto.h index ba73943..b22a7a0 100644 --- a/arch/arm/include/asm/arch-mx6/sys_proto.h +++ b/arch/arm/include/asm/arch-mx6/sys_proto.h @@ -13,3 +13,6 @@ #define is_usbotg_phy_active(void) (!(readl(USB_PHY0_BASE_ADDR + USBPHY_PWD) & \ USBPHY_PWD_RXPWDRX)) + +int imx6_pcie_toggle_power(void); +int imx6_pcie_toggle_reset(void); -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] common: Add a prototype for s_init()
When compiling with W=1 the following warning is observed: arch/arm/mach-imx/mx6/soc.c:590:6: warning: no previous prototype for ‘s_init’ [-Wmissing-prototypes] void s_init(void) Remove this warning by adding the function prototype into include/common.h file. Signed-off-by: Diego Dorta--- include/common.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/common.h b/include/common.h index aaed131..32b5378 100644 --- a/include/common.h +++ b/include/common.h @@ -529,6 +529,8 @@ int is_core_valid (unsigned int); */ int arch_cpu_init(void); +void s_init(void); + intcheckcpu (void); intcheckicache (void); intcheckdcache (void); -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] usb: kbd: Don't fail with iomux
On Wed, Sep 27, 2017 at 9:19 AM, Rob Clarkwrote: > stdin might not be set, which would cause iomux_doenv() to fail > therefore causing probe_usb_keyboard() to fail. Furthermore if we do > have iomux enabled, the sensible thing (in terms of user experience) > would be to simply add ourselves to the list of stdin devices. > > This fixes an issue with usbkbd on dragonboard410c with distro- > bootcmd, where stdin is not set (so stdinname is null). > > Signed-off-by: Rob Clark > --- > Somehow this patch was dropped on the floor. I don't remember > which version # this is up to, search the list if you care. But > this is the latest. I only noticed it was missing because u-boot > crashes when you boot with usb-keyboard plugged in (at least on > db410c) without it. So someone please apply this patch before it > gets lost again. > > common/usb_kbd.c | 46 +++--- > include/console.h | 2 -- > 2 files changed, 31 insertions(+), 17 deletions(-) > Reviewed-by: Bin Meng ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 0/8] Sync and consolidate Linux-derived printk, BUILD_BUG, BUG, WARN, etc.
On Thu, Oct 05, 2017 at 12:20:36PM +0900, Masahiro Yamada wrote: > Hi Tom, > > > 2017-10-05 12:06 GMT+09:00 Tom Rini: > > On Wed, Oct 04, 2017 at 02:15:19PM +0900, Masahiro Yamada wrote: > >> 2017-09-16 14:10 GMT+09:00 Masahiro Yamada : > >> > > >> > I tested this series with buildman. > >> > > >> > > >> > > >> > Masahiro Yamada (8): > >> > stdio.h: move printf() stuff from to > >> > printk: collect printk stuff into with loglevel > >> > support > >> > treewide: replace with error() with pr_err() > >> > common.h: remove error() > >> > vsprintf.h: include > >> > bug.h: sync BUILD_BUG stuff with Linux 4.13 > >> > bug.h: move runtime BUG/WARN macros into > >> > dm: define dev_*() log functions in DM header > >> > >> I am still worried if this series is dismissed. > >> > >> I am being blocked from importing NAND code from Linux > >> due to missing/incompatible Linux-derived macros. > > > > I am looking at this, but a default LOGLEVEL of 5 is just too high and > > I'm seeing what's reasonable now. > > > > No. I set the default to 6, not 5. > > The reason why I chose 6 was to suppress a bunch of pr_info() > from drivers/mtd/nand/, which is a copy of Linux. > > > If you change it to a bigger number, > some annoying logs would be displayed after NAND: tag. > > If you change it to a smaller number, > pr_notice() would be suppressed. > > > The Linux doc says: > > 5 (KERN_NOTICE) normal but significant condition > > > So, I think this is worth printing by default. > > > If you do not like it, you can change it, > but please make sure to adjust git-log. Yes, sorry. You set it to 6, I had already ruled out 5 as too much. I'm currently looking at 3 globally as otherwise most platforms are growing by 5KiB or more (often much more). And I'm going to do it as a follow-up commit so it's clear. -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] drivers: pci: imx: add imx_pcie_remove function
Hi David, On Fri, Sep 22, 2017 at 11:00 AM, David Müller (ELSOFT AG)wrote: > Hello > > Does the code below really work? > > On my custom MX6Q board, the code hangs on the read of the > "PCIE_PL_PFLR". Please note that this code sequence is not entered the > first time after a power up; I have to execute a U-Boot reset to > actually trigger the hang. Any ideas what is going wrong? Just sent a patch that should probably fix the PCIE_PL_PFLR hang problem. Please give it a try. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] drivers: pci: imx: fix imx_pcie_remove function
From: Sven-Ola TueckeWe have at least a minor count of boards, that failed to re-initialize PCI express in the Linux kernel. Typical failure rate is 20% on affected boards. This is mitigated by commit 6ecbe1375671 ("drivers: pci: imx: add imx_pcie_remove function"). However, at least on some i.MX6 custom boards, when calling assert_core_reset() as part of the first-time PCIe init, read access to PCIE_PL_PFLR simply hangs. Surround this readl() with imx_pcie_fix_dabt_handler() does not help. For this reason, the forced LTSSM detection is only used on the second assert_core_reset() that is called shorly before starting the Linux kernel. Signed-off-by: Sven-Ola Tuecke Signed-off-by: Fabio Estevam --- drivers/pci/pcie_imx.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/pci/pcie_imx.c b/drivers/pci/pcie_imx.c index eab0a2b..2900c8d 100644 --- a/drivers/pci/pcie_imx.c +++ b/drivers/pci/pcie_imx.c @@ -431,7 +431,7 @@ static int imx_pcie_write_config(struct pci_controller *hose, pci_dev_t d, /* * Initial bus setup */ -static int imx6_pcie_assert_core_reset(void) +static int imx6_pcie_assert_core_reset(bool prepare_for_boot) { struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR; @@ -459,7 +459,7 @@ static int imx6_pcie_assert_core_reset(void) * If both LTSSM_ENABLE and REF_SSP_ENABLE are active we have a strong * indication that the bootloader activated the link. */ - if (is_mx6dq()) { + if (is_mx6dq() && prepare_for_boot) { u32 val, gpr1, gpr12; gpr1 = readl(_regs->gpr[1]); @@ -605,7 +605,7 @@ static int imx_pcie_link_up(void) uint32_t tmp; int count = 0; - imx6_pcie_assert_core_reset(); + imx6_pcie_assert_core_reset(false); imx6_pcie_init_phy(); imx6_pcie_deassert_core_reset(); @@ -687,7 +687,7 @@ void imx_pcie_init(void) void imx_pcie_remove(void) { - imx6_pcie_assert_core_reset(); + imx6_pcie_assert_core_reset(true); } /* Probe function. */ -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] INTEL E3900 Apollo Lake I (APL-I) with U-Boot?
> Normally U-Boot boots from SPI NOR, and Linux can be loaded directly > from U-Boot via the 'zboot' command. I am much more interested (since the last stage I know) what would be the initial sequence of events: E3900/APL-I -> IFWI -> MBR -> U-Boot, or ...??? Thank you, Zoran On Thu, Oct 5, 2017 at 1:34 PM, Bin Mengwrote: > Hi Zoran, > > On Thu, Oct 5, 2017 at 6:22 PM, Zoran Stojsavljevic > wrote: > > Hello Bin, > > > >> So far Apollo Lake is not supported in U-Boot. However it is on my todo > >> list. > > > > All Good. Please, take your time. If you do not mind, I would like to > know > > ASAP, do I have correct prediction/anticipation/vision how this whole > thing > > should work? > > > > The one I originally described in my original/intro email to this email > > thread? Namely: E3900/APL-I -> IFWI -> MBR -> U-Boot -> eLinux/YOCTO ?! > > > > I will need investigate this before commenting anything since this is > not a normal boot sequence supported in U-Boot. > > > With the following/forwarding explanation (please, in original email)? > > > > It is very important for me to know how the future U-Boot architecture > will > > look like for E3900/APL-I! > > > > I would like to thank you in advance, > > Normally U-Boot boots from SPI NOR, and Linux can be loaded directly > from U-Boot via the 'zboot' command. > > Regards, > Bin > ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] INTEL E3900 Apollo Lake I (APL-I) with U-Boot?
Hi Zoran, On Thu, Oct 5, 2017 at 6:22 PM, Zoran Stojsavljevicwrote: > Hello Bin, > >> So far Apollo Lake is not supported in U-Boot. However it is on my todo >> list. > > All Good. Please, take your time. If you do not mind, I would like to know > ASAP, do I have correct prediction/anticipation/vision how this whole thing > should work? > > The one I originally described in my original/intro email to this email > thread? Namely: E3900/APL-I -> IFWI -> MBR -> U-Boot -> eLinux/YOCTO ?! > I will need investigate this before commenting anything since this is not a normal boot sequence supported in U-Boot. > With the following/forwarding explanation (please, in original email)? > > It is very important for me to know how the future U-Boot architecture will > look like for E3900/APL-I! > > I would like to thank you in advance, Normally U-Boot boots from SPI NOR, and Linux can be loaded directly from U-Boot via the 'zboot' command. Regards, Bin ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Broadwell-DE bare metal
Hi Bin, Thanks a lot for the reply. Is there something I can do to help you? I mean that's my graduation project and I will have to work on it either I succed or not, and here I have available hardware aswell. Best regards, Vincenzo Sent with [ProtonMail](https://protonmail.com) Secure Email. > Original Message > Subject: Re: [U-Boot] Broadwell-DE bare metal > Local Time: 5 October 2017 11:25 AM > UTC Time: 5 October 2017 09:25 > From: bmeng...@gmail.com > To: vnktux> u-boot@lists.denx.de > > Hi, > > On Tue, Oct 3, 2017 at 10:58 PM, vnktux wrote: >> Hi all, >> >> For my graduation project my company asked to use U-Boot as bare metal >> boot-loader on one of their product. The product in an embedded board with a >> Xeon Broadwell-DE D-1527 Quad Core. The current boot-loader consist of >> Coreboot + U-Boot, but of course they want to get rid of Coreboot. I have >> almost no experience with U-Boot (Just with ARM processor a little bit) and >> so far I don"t even know if it"s possible or not to achieve the final goal. >> What I have understood is that I need the following binary blobs to work: >> fsp.bin, vga.bin, descriptor.bin, me.bin, microcode.bin. Is it true? Can >> somebody point me in the right direction because I am a little bit lost? >> Plus I don"t see many x86 boards implemented in the source code of U-Boot. >> > > So far Broadwell-DE is not supported in U-Boot. However it is on my todo list. > > Regards, > Bin ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] dwc: ep0: Allocate and flush dwc->ep0_trb in a cache aligned manner
On 10/04/2017 03:11 PM, Faiz Abbas wrote: > Hi, > > On Wednesday 04 October 2017 06:01 PM, Marek Vasut wrote: >> On 10/04/2017 12:51 PM, Faiz Abbas wrote: >>> Hi, >>> On Tuesday 03 October 2017 06:48 PM, Marek Vasut wrote: On 10/03/2017 03:17 PM, Faiz Abbas wrote: > Hi, > On Tuesday 03 October 2017 05:34 PM, Marek Vasut wrote: >> On 09/19/2017 01:15 PM, Faiz Abbas wrote: >>> >>> - dwc3_flush_cache((uintptr_t)trb, sizeof(*trb)); >>> + dwc3_flush_cache((uintptr_t)dwc->ep0_trb_addr, sizeof(*trb) * >>> 2); >> >> Why *2 ? > > Because its allocated as sizeof(*dwc->ep0_trb) * 2 below. This is not > strictly required as dwc3_flush_cache() rounds up the size to > CACHELINE_SIZE but from a caller POV, flush everything we allocated. Can the other TRB be in use ? Maybe aligning the TRBs to cacheline size would be better ? >>> A single trb is 16 bytes in size and two of them are allocated >>> contiguously. >> >> Why are two allocated continuously ? (I am not dwc3 expert) > > Neither am I. I did try to pad to the dwc_trb structure such that each > trb is 64 bytes in size but this leads to failures when testing. I > didn't get a chance to debug this though. I suspect its because the code > expects the trbs to be contiguous and/or 16 bytes in size. Maybe that's something you need to check -- why it fails if aligned . Do the TRBs need to be stored back-to-back ? > It'll be great if someone can shed light on this. > >> >>> Originally, a flush on the first trb was flushing both of >>> them anyway as the minimum flush is CACHELINE_SIZE (64 bytes). This is >>> not changing any functionality as far as I have tested. Just making sure >>> cache misaligned warnings don't show up. >> >> If you flush 64bytes, you flush more than 2 TRBs, you flush something >> around those TRBs too. > > Yes and that is why I changed the allocation step to > ROUND(sizeof(trb) * 2, 64). We use only 32 bytes for two trbs but make > sure to allocate 64 bytes so that we can safely flush it. > > Thanks > Faiz > -- Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Broadwell-DE bare metal
> So far Broadwell-DE is not supported in U-Boot. However it is on my todo list. Excellent thread! Just what I needed, and was thinking to enter! ;-) What will be the architecture of this porting effort? The same question as I have asked an hour ago for ATOM E3900/APL-I. Thank you in advance, Zoran Stojsavljevic ___ On Thu, Oct 5, 2017 at 1:21 PM, Bin Mengwrote: > Hi, > > On Thu, Oct 5, 2017 at 5:43 PM, vnktux wrote: > > Hi Bin, > > > > Thanks a lot for the reply. Is there something I can do to help you? I > mean > > that's my graduation project and I will have to work on it either I > succed > > or not, and here I have available hardware aswell. > > > > If you can't wait, you can start trying to port U-Boot on your > Broadwell-DE board, and I can help review. Thanks! > > Regards, > Bin > ___ > U-Boot mailing list > U-Boot@lists.denx.de > https://lists.denx.de/listinfo/u-boot > ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Broadwell-DE bare metal
Hi, On Thu, Oct 5, 2017 at 5:43 PM, vnktuxwrote: > Hi Bin, > > Thanks a lot for the reply. Is there something I can do to help you? I mean > that's my graduation project and I will have to work on it either I succed > or not, and here I have available hardware aswell. > If you can't wait, you can start trying to port U-Boot on your Broadwell-DE board, and I can help review. Thanks! Regards, Bin ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] disk: part_dos: Use the original allocation scheme for the SPL case
On Wed, Oct 4, 2017 at 5:29 PM, Fabio Estevamwrote: > Since commit ff98cb90514d ("part: extract MBR signature from partitions") > SPL boot on i.MX6 starts to fail: > > U-Boot SPL 2017.09-00221-g0d6ab32 (Oct 02 2017 - 15:13:19) > Trying to boot from MMC1 > (keep in loop) > > Use the original allocation scheme for the SPL case, so that MX6 boards > can boot again. > > This is a temporary solution to avoid the boot regression. > > Signed-off-by: Fabio Estevam Tested-by: Peter Robinson Tested on both a wandboard quad and a hummingboard2 (mx6cuboxi) and it works for me. Peter > --- > Hi Tom, > > I do not have time this week to further investigate and narrow down > this problem. > > Using the old allocation scheme fixes the mx6 SPL boot problem. > > > disk/part_dos.c | 10 ++ > 1 file changed, 10 insertions(+) > > diff --git a/disk/part_dos.c b/disk/part_dos.c > index 1a36be0..6dd2c2d 100644 > --- a/disk/part_dos.c > +++ b/disk/part_dos.c > @@ -89,6 +89,7 @@ static int test_block_type(unsigned char *buffer) > > static int part_test_dos(struct blk_desc *dev_desc) > { > +#ifndef CONFIG_SPL_BUILD > ALLOC_CACHE_ALIGN_BUFFER(legacy_mbr, mbr, dev_desc->blksz); > > if (blk_dread(dev_desc, 0, 1, (ulong *)mbr) != 1) > @@ -102,6 +103,15 @@ static int part_test_dos(struct blk_desc *dev_desc) > dev_desc->sig_type = SIG_TYPE_MBR; > dev_desc->mbr_sig = mbr->unique_mbr_signature; > } > +#else > + ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, dev_desc->blksz); > + > + if (blk_dread(dev_desc, 0, 1, (ulong *)buffer) != 1) > + return -1; > + > + if (test_block_type(buffer) != DOS_MBR) > + return -1; > +#endif > > return 0; > } > -- > 2.7.4 > > ___ > U-Boot mailing list > U-Boot@lists.denx.de > https://lists.denx.de/listinfo/u-boot ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] INTEL E3900 Apollo Lake I (APL-I) with U-Boot?
Hello Bin, > So far Apollo Lake is not supported in U-Boot. However it is on my todo list. All Good. Please, take your time. If you do not mind, I would like to know ASAP, do I have correct prediction/anticipation/vision how this whole thing should work? The one I originally described in my original/intro email to this email thread? Namely: E3900/APL-I -> IFWI -> MBR -> U-Boot -> eLinux/YOCTO ?! With the following/forwarding explanation (please, in original email)? It is very important for me to know how the future U-Boot architecture will look like for E3900/APL-I! I would like to thank you in advance, Zoran Stojsavljevic ___ On Thu, Oct 5, 2017 at 11:27 AM, Bin Mengwrote: > Hi Zoran, > > On Wed, Oct 4, 2017 at 1:52 PM, Zoran Stojsavljevic > wrote: > > Hello to the U-Boot Community, > > > > I am curious about the following HW/FW configuration with regards to the > > U-Boot? > > > > Did anybody managed to run the following: INTEL Atom E3900 APL-I with > > U-Boot? > > > > E3900 -> IFWI -> MBR -> U-Boot -> eLinux/YOCTO ?! > > > > Here are some explanations regarding the terms/context: > > > > *IFWI is the Intel FirmWare Interface, a binary blob loaded from the eMMC > > boot partition that executes a secondary loader (in this case U-Boot) > from > > the main eMMC. IFWI blobs for the APL-I are provided by Intel and are > > specific for different flavors of the MID silicon.* > > *Normal IFWI eMMC boot process* > > > >1. *On-chip boot rom inits eMMC and loads IFWI from the MMC boot > >partitions* > >2. *IFWI looks for OSIP header at top of eMMC (MBR boot block)* > >3. *The header directs IFWI to the start, size, load address, and > entry > >of U-Boot in eMMC* > >4. *(need clarification) If u-boot is not found, try the alt u-boot > >image at 5MB into the eMMC* > >5. *U-Boot is loaded into RAM and executed* > > > > *OSIP stands for OS Image Profile, and it is nothing more and less than > > INTEL name for very known old fashion MBR, considering DATA structure.* > > > > So far Apollo Lake is not supported in U-Boot. However it is on my todo > list. > > Regards, > Bin > ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] INTEL E3900 Apollo Lake I (APL-I) with U-Boot?
Hi Zoran, On Wed, Oct 4, 2017 at 1:52 PM, Zoran Stojsavljevicwrote: > Hello to the U-Boot Community, > > I am curious about the following HW/FW configuration with regards to the > U-Boot? > > Did anybody managed to run the following: INTEL Atom E3900 APL-I with > U-Boot? > > E3900 -> IFWI -> MBR -> U-Boot -> eLinux/YOCTO ?! > > Here are some explanations regarding the terms/context: > > *IFWI is the Intel FirmWare Interface, a binary blob loaded from the eMMC > boot partition that executes a secondary loader (in this case U-Boot) from > the main eMMC. IFWI blobs for the APL-I are provided by Intel and are > specific for different flavors of the MID silicon.* > *Normal IFWI eMMC boot process* > >1. *On-chip boot rom inits eMMC and loads IFWI from the MMC boot >partitions* >2. *IFWI looks for OSIP header at top of eMMC (MBR boot block)* >3. *The header directs IFWI to the start, size, load address, and entry >of U-Boot in eMMC* >4. *(need clarification) If u-boot is not found, try the alt u-boot >image at 5MB into the eMMC* >5. *U-Boot is loaded into RAM and executed* > > *OSIP stands for OS Image Profile, and it is nothing more and less than > INTEL name for very known old fashion MBR, considering DATA structure.* > So far Apollo Lake is not supported in U-Boot. However it is on my todo list. Regards, Bin ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Broadwell-DE bare metal
Hi, On Tue, Oct 3, 2017 at 10:58 PM, vnktuxwrote: > Hi all, > > For my graduation project my company asked to use U-Boot as bare metal > boot-loader on one of their product. The product in an embedded board with a > Xeon Broadwell-DE D-1527 Quad Core. The current boot-loader consist of > Coreboot + U-Boot, but of course they want to get rid of Coreboot. I have > almost no experience with U-Boot (Just with ARM processor a little bit) and > so far I don't even know if it's possible or not to achieve the final goal. > What I have understood is that I need the following binary blobs to work: > fsp.bin, vga.bin, descriptor.bin, me.bin, microcode.bin. Is it true? Can > somebody point me in the right direction because I am a little bit lost? > Plus I don't see many x86 boards implemented in the source code of U-Boot. > So far Broadwell-DE is not supported in U-Boot. However it is on my todo list. Regards, Bin ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] disk: part_dos: Use the original allocation scheme for the SPL case
On Thu, Oct 5, 2017 at 12:36 AM, Jonathan Graywrote: > On Wed, Oct 04, 2017 at 01:12:48PM -0400, Rob Clark wrote: >> On Wed, Oct 4, 2017 at 12:29 PM, Fabio Estevam wrote: >> > Since commit ff98cb90514d ("part: extract MBR signature from partitions") >> > SPL boot on i.MX6 starts to fail: >> > >> > U-Boot SPL 2017.09-00221-g0d6ab32 (Oct 02 2017 - 15:13:19) >> > Trying to boot from MMC1 >> > (keep in loop) >> > >> > Use the original allocation scheme for the SPL case, so that MX6 boards >> > can boot again. >> > >> > This is a temporary solution to avoid the boot regression. >> > >> > Signed-off-by: Fabio Estevam >> > --- >> > Hi Tom, >> > >> > I do not have time this week to further investigate and narrow down >> > this problem. >> > >> > Using the old allocation scheme fixes the mx6 SPL boot problem. >> > >> >> Hi Tom, if you are ok with this as a temporary fix, then this is: >> >> Acked-by: Rob Clark >> >> I'm getting some help from some of the fedora-arm folks so hopefully I >> can get some idea what is going wrong, but I'd like to unblock folks >> w/ mx6 boards.. >> >> BR, >> -R > > This does not seem to be a complete fix, cubox is still broken when > U-Boot proper loads, unless the efi loader commits are to blame > for introducing unaligned accesses. > > Works with 2017.09. > > U-Boot SPL 2017.11-rc1-00026-g14b55fc833 (Oct 05 2017 - 15:17:47) > Trying to boot from MMC1 > > > U-Boot 2017.11-rc1-00026-g14b55fc833 (Oct 05 2017 - 15:17:47 +1100) > > CPU: Freescale i.MX6Q rev1.5 996 MHz (running at 792 MHz) > CPU: Extended Commercial temperature grade (-20C to 105C) at 34C > Reset cause: WDOG > Board: MX6 Cubox-i > DRAM: 2 GiB > MMC: FSL_SDHC: 0 > *** Warning - bad CRC, using default environment > > No panel detected: default to HDMI > Display: HDMI (1024x768) > In:serial > Out: serial > Err: serial > Net: FEC > Hit any key to stop autoboot: 0 > switch to partitions #0, OK > mmc0 is current device > Scanning mmc 0:1... I don't think any efi_loader code is running here, you would see a message like: ## Starting EFI application at XYZ But to be sure you can disable CONFIG_EFI_LOADER in menuconfig to confirm. I guess this is some unrelated change. I suspect Tom's change to malloc the fat_itr's which would make the buffers used for fs_exists()/etc not cache aligned. I thought there was a patch floating around to change that to memalign(). BR, -R > CACHE: Misaligned operation at range [8f89da30, 8f89e230] > CACHE: Misaligned operation at range [8f89da30, 8f89e230] > ERROR: v7_outer_cache_inval_range - start address is not aligned - 0x8f89da30 > ERROR: v7_outer_cache_inval_range - stop address is not aligned - 0x8f89e230 > CACHE: Misaligned operation at range [8f89da30, 8f89e230] > CACHE: Misaligned operation at range [8f89da30, 8f89e230] > ERROR: v7_outer_cache_inval_range - start address is not aligned - 0x8f89da30 > ERROR: v7_outer_cache_inval_range - stop address is not aligned - 0x8f89e230 > CACHE: Misaligned operation at range [8f89dca0, 8f89e4a0] > CACHE: Misaligned operation at range [8f89dca0, 8f89e4a0] > CACHE: Misaligned operation at range [8f89dca0, 8f89e4a0] > CACHE: Misaligned operation at range [8f89dca0, 8f89e4a0] > CACHE: Misaligned operation at range [8f89dc68, 8f89e468] > CACHE: Misaligned operation at range [8f89dc68, 8f89e468] > ERROR: v7_outer_cache_inval_range - start address is not aligned - 0x8f89dc68 > ERROR: v7_outer_cache_inval_range - stop address is not aligned - 0x8f89e468 > CACHE: Misaligned operation at range [8f89dc68, 8f89e468] > CACHE: Misaligned operation at range [8f89dc68, 8f89e468] > ERROR: v7_outer_cache_inval_range - start address is not aligned - 0x8f89dc68 > ERROR: v7_outer_cache_inval_range - stop address is not aligned - 0x8f89e468 > CACHE: Misaligned operation at range [8f89dab0, 8f89e2b0] > CACHE: Misaligned operation at range [8f89dab0, 8f89e2b0] > ERROR: v7_outer_cache_inval_range - start address is not aligned - 0x8f89dab0 > ERROR: v7_outer_cache_inval_range - stop address is not aligned - 0x8f89e2b0 > CACHE: Misaligned operation at range [8f89dab0, 8f89e2b0] > CACHE: Misaligned operation at range [8f89dab0, 8f89e2b0] > ERROR: v7_outer_cache_inval_range - start address is not aligned - 0x8f89dab0 > ERROR: v7_outer_cache_inval_range - stop address is not aligned - 0x8f89e2b0 > CACHE: Misaligned operation at range [8f89dca8, 8f89e4a8] > CACHE: Misaligned operation at range [8f89dca8, 8f89e4a8] > ERROR: v7_outer_cache_inval_range - start address is not aligned - 0x8f89dca8 > ERROR: v7_outer_cache_inval_range - stop address is not aligned - 0x8f89e4a8 > CACHE: Misaligned operation at range [8f89dca8, 8f89e4a8] > CACHE: Misaligned operation at range [8f89dca8, 8f89e4a8] > ERROR: v7_outer_cache_inval_range - start address is not aligned - 0x8f89dca8 > ERROR: v7_outer_cache_inval_range - stop address is not aligned - 0x8f89e4a8 > CACHE: Misaligned
[U-Boot] [PATCH v2] arm64: ls1012afrdm: Add distro boot support
Include common config_distro_defaults.h and config_distro_bootcmd.h for u-boot enviroments to support automatical distro boot which scan boot.scr from external storage devices(e.g. SD and USB) and execute autoboot script. Signed-off-by: Bhaskar UpadhayaSigned-off-by: Rajesh Bhagat --- Depends on: http://patchwork.ozlabs.org/patch/808617/ Changes in v2: - Removed the extra "\" character from macro definition - Dropped the #if for CONFIG_BOOTCOMMAND configs/ls1012afrdm_qspi_defconfig | 1 + include/configs/ls1012afrdm.h | 57 -- 2 files changed, 49 insertions(+), 9 deletions(-) diff --git a/configs/ls1012afrdm_qspi_defconfig b/configs/ls1012afrdm_qspi_defconfig index fe95f04..42acff0 100644 --- a/configs/ls1012afrdm_qspi_defconfig +++ b/configs/ls1012afrdm_qspi_defconfig @@ -46,3 +46,4 @@ CONFIG_DM_USB=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_DWC3=y CONFIG_USB_STORAGE=y +CONFIG_DISTRO_DEFAULTS=y diff --git a/include/configs/ls1012afrdm.h b/include/configs/ls1012afrdm.h index 6b1ba57..4d6448b 100644 --- a/include/configs/ls1012afrdm.h +++ b/include/configs/ls1012afrdm.h @@ -20,16 +20,55 @@ #define CONFIG_SYS_MEMTEST_START 0x8000 #define CONFIG_SYS_MEMTEST_END 0x9fff +#ifndef CONFIG_SPL_BUILD +#undef BOOT_TARGET_DEVICES +#define BOOT_TARGET_DEVICES(func) \ + func(USB, usb, 0) +#endif + #undef CONFIG_EXTRA_ENV_SETTINGS -#define CONFIG_EXTRA_ENV_SETTINGS \ - "verify=no\0" \ - "loadaddr=0x8010\0" \ - "kernel_addr=0x10\0"\ - "fdt_high=0x\0" \ - "initrd_high=0x\0" \ - "kernel_start=0xa0\0" \ - "kernel_load=0x9600\0" \ - "kernel_size=0x280\0" +#define CONFIG_EXTRA_ENV_SETTINGS \ + "verify=no\0" \ + "fdt_high=0x\0" \ + "initrd_high=0x\0" \ + "fdt_addr=0x00f0\0" \ + "kernel_addr=0x0100\0" \ + "scriptaddr=0x8000\0" \ + "fdtheader_addr_r=0x8010\0" \ + "kernelheader_addr_r=0x8020\0" \ + "kernel_addr_r=0x9600\0"\ + "fdt_addr_r=0x9000\0" \ + "load_addr=0x9600\0"\ + "kernel_size=0x280\0" \ + "console=ttyS0,115200\0"\ + BOOTENV \ + "boot_scripts=ls1012afrdm_boot.scr\0" \ + "scan_dev_for_boot_part=" \ +"part list ${devtype} ${devnum} devplist; "\ +"env exists devplist || setenv devplist 1; " \ +"for distro_bootpart in ${devplist}; do " \ + "if fstype ${devtype} " \ + "${devnum}:${distro_bootpart} " \ + "bootfstype; then " \ + "run scan_dev_for_boot; " \ + "fi; "\ + "done\0" \ + "scan_dev_for_boot=" \ + "echo Scanning ${devtype} " \ + "${devnum}:${distro_bootpart}...; " \ + "for prefix in ${boot_prefixes}; do " \ + "run scan_dev_for_scripts; " \ + "done;" \ + "\0" \ + "installer=load usb 0:2 $load_addr "\ + "/flex_installer_arm64.itb; "\ + "bootm $load_addr#$board\0" \ + "qspi_bootcmd=echo Trying load from qspi..;"\ + "sf probe && sf read $load_addr " \ + "$kernel_addr $kernel_size && bootm $load_addr#$board\0" + +#undef CONFIG_BOOTCOMMAND +#define CONFIG_BOOTCOMMAND "run distro_bootcmd;run qspi_bootcmd" /* * USB -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4] arm64: ls1012ardb: Add distro boot support
Include common config_distro_defaults.h and config_distro_bootcmd.h for u-boot enviroments to support automatical distro boot which scan boot.scr from external storage devices(e.g. SD and USB) and execute autoboot script. Signed-off-by: Bhaskar UpadhayaSigned-off-by: Rajesh Bhagat --- Depends on: http://patchwork.ozlabs.org/patch/808617/ Changes in v4: - Removed the extra "\" character from macro definition - Dropped the #if for CONFIG_BOOTCOMMAND Changes in v3: Removed pfe stop command from BOOTCMD Changes in v2: Rebased to latest u-boot configs/ls1012ardb_qspi_defconfig | 1 + include/configs/ls1012a_common.h | 10 - include/configs/ls1012ardb.h | 43 +++ 3 files changed, 53 insertions(+), 1 deletion(-) diff --git a/configs/ls1012ardb_qspi_defconfig b/configs/ls1012ardb_qspi_defconfig index 81702e3..39d7a54 100644 --- a/configs/ls1012ardb_qspi_defconfig +++ b/configs/ls1012ardb_qspi_defconfig @@ -50,3 +50,4 @@ CONFIG_DM_USB=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_DWC3=y CONFIG_USB_STORAGE=y +CONFIG_DISTRO_DEFAULTS=y diff --git a/include/configs/ls1012a_common.h b/include/configs/ls1012a_common.h index 096799e..b2d2307 100644 --- a/include/configs/ls1012a_common.h +++ b/include/configs/ls1012a_common.h @@ -90,6 +90,14 @@ #define CONFIG_HWCONFIG #define HWCONFIG_BUFFER_SIZE 128 +#include +#ifndef CONFIG_SPL_BUILD +#define BOOT_TARGET_DEVICES(func) \ + func(MMC, mmc, 0) \ + func(USB, usb, 0) +#include +#endif + /* Initial environment variables */ #define CONFIG_EXTRA_ENV_SETTINGS \ "verify=no\0" \ @@ -101,6 +109,7 @@ "kernel_load=0xa000\0" \ "kernel_size=0x280\0" \ +#undef CONFIG_BOOTCOMMAND #define CONFIG_BOOTCOMMAND "sf probe 0:0; sf read $kernel_load "\ "$kernel_start $kernel_size && "\ "bootm $kernel_load" @@ -108,7 +117,6 @@ /* Monitor Command Prompt */ #define CONFIG_SYS_CBSIZE 512 /* Console I/O Buffer Size */ #define CONFIG_SYS_LONGHELP -#define CONFIG_CMDLINE_EDITING 1 #define CONFIG_AUTO_COMPLETE #define CONFIG_SYS_MAXARGS 64 /* max command args */ diff --git a/include/configs/ls1012ardb.h b/include/configs/ls1012ardb.h index e9edcd2..e612840 100644 --- a/include/configs/ls1012ardb.h +++ b/include/configs/ls1012ardb.h @@ -70,6 +70,49 @@ #define CONFIG_SYS_MEMTEST_START 0x8000 #define CONFIG_SYS_MEMTEST_END 0x9fff +#undef CONFIG_EXTRA_ENV_SETTINGS +#define CONFIG_EXTRA_ENV_SETTINGS \ + "verify=no\0" \ + "fdt_high=0x\0" \ + "initrd_high=0x\0" \ + "fdt_addr=0x00f0\0" \ + "kernel_addr=0x0100\0" \ + "scriptaddr=0x8000\0" \ + "fdtheader_addr_r=0x8010\0" \ + "kernelheader_addr_r=0x8020\0" \ + "kernel_addr_r=0x8100\0"\ + "fdt_addr_r=0x9000\0" \ + "load_addr=0xa000\0"\ + "kernel_size=0x280\0" \ + "console=ttyS0,115200\0"\ + BOOTENV \ + "boot_scripts=ls1012ardb_boot.scr\0"\ + "scan_dev_for_boot_part=" \ +"part list ${devtype} ${devnum} devplist; "\ +"env exists devplist || setenv devplist 1; " \ +"for distro_bootpart in ${devplist}; do " \ + "if fstype ${devtype} " \ + "${devnum}:${distro_bootpart} " \ + "bootfstype; then " \ + "run scan_dev_for_boot; " \ + "fi; "\ + "done\0" \ + "scan_dev_for_boot=" \ + "echo Scanning ${devtype} " \ + "${devnum}:${distro_bootpart}...; " \ + "for prefix in ${boot_prefixes}; do " \ + "run scan_dev_for_scripts; " \ + "done;" \ + "\0" \ + "installer=load mmc 0:2 $load_addr "\ + "/flex_installer_arm64.itb; "\ + "bootm $load_addr#$board\0" \ + "qspi_bootcmd=echo Trying load from qspi..;"\ + "sf probe && sf read $load_addr " \ + "$kernel_addr $kernel_size && bootm $load_addr#$board\0" + +#undef CONFIG_BOOTCOMMAND +#define CONFIG_BOOTCOMMAND "run distro_bootcmd;run qspi_bootcmd" #include --
Re: [U-Boot] [PATCH] usb: kbd: Fix dangling pointers on probe fail
On Tue, Oct 3, 2017 at 6:31 PM, Rob Clarkwrote: > If probe fails, we should unregister the stdio device, else we leave > dangling pointers to the parent 'struct usb_device'. > > Signed-off-by: Rob Clark Tested-by: Peter Robinson Tested on RPi3 and a couple of other devices. > --- > I finally got around to debugging why things explode so badly without > fixing usb_kbd vs. iomux[1] (which this patch applies on top of). > > [1] https://patchwork.ozlabs.org/patch/818881/ > > common/usb_kbd.c | 30 -- > 1 file changed, 24 insertions(+), 6 deletions(-) > > diff --git a/common/usb_kbd.c b/common/usb_kbd.c > index 4c3ad95fca..82ad93f6ca 100644 > --- a/common/usb_kbd.c > +++ b/common/usb_kbd.c > @@ -535,22 +535,40 @@ static int probe_usb_keyboard(struct usb_device *dev) > error = iomux_doenv(stdin, stdinname); > free(newstdin); > if (error) > - return error; > + goto unregister_stdio; > } else { > /* Check if this is the standard input device. */ > - if (strcmp(stdinname, DEVNAME)) > - return 1; > + if (strcmp(stdinname, DEVNAME)) { > + error = -1; > + goto unregister_stdio; > + } > > /* Reassign the console */ > - if (overwrite_console()) > - return 1; > + if (overwrite_console()) { > + error = -1; > + goto unregister_stdio; > + } > > error = console_assign(stdin, DEVNAME); > if (error) > - return error; > + goto unregister_stdio; > } > > return 0; > + > +unregister_stdio: > + /* > +* If probe fails, the device will be removed.. leaving dangling > +* pointers if the stdio device is not unregistered. If u-boot > +* is built without stdio_deregister(), just pretend to succeed > +* in order to avoid dangling pointers. > +*/ > +#if CONFIG_IS_ENABLED(SYS_STDIO_DEREGISTER) > + stdio_deregister(DEVNAME, 1); > + return error; > +#else > + return 0; > +#endif > } > > #ifndef CONFIG_DM_USB > -- > 2.13.5 > > ___ > U-Boot mailing list > U-Boot@lists.denx.de > https://lists.denx.de/listinfo/u-boot ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] usb: kbd: Don't fail with iomux
On Wed, Sep 27, 2017 at 2:19 AM, Rob Clarkwrote: > stdin might not be set, which would cause iomux_doenv() to fail > therefore causing probe_usb_keyboard() to fail. Furthermore if we do > have iomux enabled, the sensible thing (in terms of user experience) > would be to simply add ourselves to the list of stdin devices. > > This fixes an issue with usbkbd on dragonboard410c with distro- > bootcmd, where stdin is not set (so stdinname is null). > > Signed-off-by: Rob Clark Tested-by: Peter Robinson Tested on RPi3 and a couple of other devices. > --- > Somehow this patch was dropped on the floor. I don't remember > which version # this is up to, search the list if you care. But > this is the latest. I only noticed it was missing because u-boot > crashes when you boot with usb-keyboard plugged in (at least on > db410c) without it. So someone please apply this patch before it > gets lost again. > > common/usb_kbd.c | 46 +++--- > include/console.h | 2 -- > 2 files changed, 31 insertions(+), 17 deletions(-) > > diff --git a/common/usb_kbd.c b/common/usb_kbd.c > index a323d72a36..4c3ad95fca 100644 > --- a/common/usb_kbd.c > +++ b/common/usb_kbd.c > @@ -516,23 +516,39 @@ static int probe_usb_keyboard(struct usb_device *dev) > return error; > > stdinname = env_get("stdin"); > -#if CONFIG_IS_ENABLED(CONSOLE_MUX) > - error = iomux_doenv(stdin, stdinname); > - if (error) > - return error; > -#else > - /* Check if this is the standard input device. */ > - if (strcmp(stdinname, DEVNAME)) > - return 1; > + if (CONFIG_IS_ENABLED(CONSOLE_MUX)) { > + char *devname = DEVNAME; > + char *newstdin = NULL; > + /* > +* stdin might not be set yet.. either way, with console- > +* mux the sensible thing to do is add ourselves to the > +* list of stdio devices: > +*/ > + if (stdinname && !strstr(stdinname, DEVNAME)) { > + newstdin = malloc(strlen(stdinname) + > + strlen(","DEVNAME) + 1); > + sprintf(newstdin, "%s,"DEVNAME, stdinname); > + stdinname = newstdin; > + } else if (!stdinname) { > + stdinname = devname; > + } > + error = iomux_doenv(stdin, stdinname); > + free(newstdin); > + if (error) > + return error; > + } else { > + /* Check if this is the standard input device. */ > + if (strcmp(stdinname, DEVNAME)) > + return 1; > > - /* Reassign the console */ > - if (overwrite_console()) > - return 1; > + /* Reassign the console */ > + if (overwrite_console()) > + return 1; > > - error = console_assign(stdin, DEVNAME); > - if (error) > - return error; > -#endif > + error = console_assign(stdin, DEVNAME); > + if (error) > + return error; > + } > > return 0; > } > diff --git a/include/console.h b/include/console.h > index cea29ed6dc..7dfd36d7d1 100644 > --- a/include/console.h > +++ b/include/console.h > @@ -57,8 +57,6 @@ int console_announce_r(void); > /* > * CONSOLE multiplexing. > */ > -#ifdef CONFIG_CONSOLE_MUX > #include > -#endif > > #endif > -- > 2.13.5 > > ___ > U-Boot mailing list > U-Boot@lists.denx.de > https://lists.denx.de/listinfo/u-boot ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/3] armv8: fsl-layerscape: SPL size reduction
> -Original Message- > From: York Sun > Sent: Thursday, October 05, 2017 12:12 AM > To: Sumit Garg; u-boot@lists.denx.de > Cc: Ruchika Gupta ; Prabhakar Kushwaha > ; Ashish Kumar > Subject: Re: [PATCH 1/3] armv8: fsl-layerscape: SPL size reduction > > On 10/03/2017 03:51 AM, Sumit Garg wrote: > >> -Original Message- > >> From: York Sun > >> Sent: Friday, September 15, 2017 2:08 AM > >> To: Sumit Garg ; u-boot@lists.denx.de > >> Cc: Ruchika Gupta ; Prabhakar Kushwaha > >> > >> Subject: Re: [PATCH 1/3] armv8: fsl-layerscape: SPL size reduction > >> > >> On 08/29/2017 12:01 AM, Sumit Garg wrote: > >>> Using changes in this patch we were able to reduce approx 4k size of > >>> u-boot-spl.bin image. Following is breif description of changes to > >>> reduce SPL size: > >>> 1. Compile-off mp.c and libfdt.c in case of SPL build. > >>> 2. Keep MMU and DCACHE specific variable and functions under > >>> CONFIG_SYS_DCACHE_OFF macro. > >>> 3. Compile-off IFC specific funtion call "init_early_memctl_regs" > >>> in case of SPL build. > >>> > >>> Signed-off-by: Sumit Garg > >>> --- > >>> > >>> Dependent on ls1088 base SD boot target. Also dependent on ls1088 > >>> QPSI secure boot target. > >> > >> I don't agree D-cache should be off for SPL boot. Please find other > >> way to reduce SPL image size. > >> > >> York > > > > Sure, let me use GCC 6.2 to reduce SPL image size in upstream rather > > than compiling-off D-cache code. > > > > But I still don't see ls1088ardb sd boot support in upstream. > > > > Ashish, > > > > By when can I expect ls1088ardb sd boot support in upstream? > > > > Sumit, > > SD boot is not completed. I don't see RCW in the final image. Pending Ashish's > investigation. > > York I will wait for SD boot patches to be accepted in upstream. As reducing SPL size for ls1088ardb in upstream does only makes sense once we have base platform support merged in upstream. Sumit ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2] armv8: ls1088a: Update MC boot sequence
The MC boot sequence is contained in mc_env_boot. Update LS1088A boards to use this function, and hook it to reset_phy so that it's called late enough, after the ports have been initialized, for proper DPC / DPL fixup. Signed-off-by: Bogdan Purcareata--- This patch follows the work of previous commits: 5707dfb02e drivers: net: fsl-mc: Fixup MAC addresses in DPC 33a8991a87 drivers: net: fsl-mc: Link MC boot to PHY_RESET_R 1161dbcc0a drivers: net: fsl-mc: Include MAC addr fixup to DPL v1 -> v2: - Refactor commit message board/freescale/ls1088a/eth_ls1088aqds.c | 14 -- board/freescale/ls1088a/eth_ls1088ardb.c | 13 - include/configs/ls1088a_common.h | 6 ++ 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/board/freescale/ls1088a/eth_ls1088aqds.c b/board/freescale/ls1088a/eth_ls1088aqds.c index c19f59a..de70aee 100644 --- a/board/freescale/ls1088a/eth_ls1088aqds.c +++ b/board/freescale/ls1088a/eth_ls1088aqds.c @@ -14,14 +14,13 @@ #include #include #include +#include #include #include "../common/qixis.h" #include "ls1088a_qixis.h" -#define MC_BOOT_ENV_VAR "mcinitcmd" - #ifdef CONFIG_FSL_MC_ENET #define SFP_TX 0 @@ -612,7 +611,6 @@ static void ls1088a_handle_phy_interface_rgmii(int dpmac_id) int board_eth_init(bd_t *bis) { int error = 0, i; - char *mc_boot_env_var; #ifdef CONFIG_FSL_MC_ENET struct memac_mdio_info *memac_mdio0_info; char *env_hwconfig = env_get("hwconfig"); @@ -655,9 +653,6 @@ int board_eth_init(bd_t *bis) } } - mc_boot_env_var = env_get(MC_BOOT_ENV_VAR); - if (mc_boot_env_var) - run_command_list(mc_boot_env_var, -1, 0); error = cpu_eth_init(bis); if (hwconfig_f("xqsgmii", env_hwconfig)) { @@ -681,3 +676,10 @@ int board_eth_init(bd_t *bis) error = pci_eth_init(bis); return error; } + +#if defined(CONFIG_RESET_PHY_R) +void reset_phy(void) +{ + mc_env_boot(); +} +#endif /* CONFIG_RESET_PHY_R */ diff --git a/board/freescale/ls1088a/eth_ls1088ardb.c b/board/freescale/ls1088a/eth_ls1088ardb.c index 853d815..97accc9 100644 --- a/board/freescale/ls1088a/eth_ls1088ardb.c +++ b/board/freescale/ls1088a/eth_ls1088ardb.c @@ -15,15 +15,14 @@ #include #include #include +#include #include DECLARE_GLOBAL_DATA_PTR; -#define MC_BOOT_ENV_VAR "mcinitcmd" int board_eth_init(bd_t *bis) { #if defined(CONFIG_FSL_MC_ENET) - char *mc_boot_env_var; int i, interface; struct memac_mdio_info mdio_info; struct mii_dev *dev; @@ -92,11 +91,15 @@ int board_eth_init(bd_t *bis) dev = miiphy_get_dev_by_name(DEFAULT_WRIOP_MDIO2_NAME); wriop_set_mdio(WRIOP1_DPMAC2, dev); - mc_boot_env_var = env_get(MC_BOOT_ENV_VAR); - if (mc_boot_env_var) - run_command_list(mc_boot_env_var, -1, 0); cpu_eth_init(bis); #endif /* CONFIG_FMAN_ENET */ return pci_eth_init(bis); } + +#if defined(CONFIG_RESET_PHY_R) +void reset_phy(void) +{ + mc_env_boot(); +} +#endif /* CONFIG_RESET_PHY_R */ diff --git a/include/configs/ls1088a_common.h b/include/configs/ls1088a_common.h index 84e9b14..fa058f7 100644 --- a/include/configs/ls1088a_common.h +++ b/include/configs/ls1088a_common.h @@ -122,6 +122,12 @@ unsigned long long get_qixis_addr(void); #define CONFIG_SYS_LS_MC_DRAM_DPL_OFFSET0x00F2 #define CONFIG_SYS_LS_MC_AIOP_IMG_MAX_LENGTH 0x20 #define CONFIG_SYS_LS_MC_DRAM_AIOP_IMG_OFFSET 0x0700 + +/* Define phy_reset function to boot the MC based on mcinitcmd. + * This happens late enough to properly fixup u-boot env MAC addresses. + */ +#define CONFIG_RESET_PHY_R + /* * Carve out a DDR region which will not be used by u-boot/Linux * -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot