[U-Boot] uboot 2013.01.01 compile error
Hello,I'm trying to compile the uboot for the smdk6400 board. but there is an error while compiling. first I make distclean then make smdk6400_config then make the error appeared says that arm-linux-gnueabi-ld.bfd:u- boot.lds:19: syntax error my working environment is kubuntu 12.10 toolchain version is gcc-arm 4.7.2 Sorry to disturb you. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2] mxs: timrot: Add support to i.MX23
Dear Fadil Berisha, > This patch add timer support to i.MX23 and complete bit fields and values > on regs-timrot.h. > Testet on imx23-olinuxino board. Also document that you renamed some macros, even if I'd prefer if you pulled those out into separate patch to make this easier to review. Moreover: $ ./tools/checkpatch.pl /tmp/\[PATCH\ v2\]\ mxs_timrot_Add\ support\ to\ i.MX23.mbox ERROR: trailing whitespace #149: FILE: arch/arm/cpu/arm926ejs/mxs/timer.c:106: +^Inow = readl(&timrot_regs->hw_timrot_timcount0) >> $ ERROR: trailing whitespace #376: FILE: arch/arm/include/asm/arch-mxs/regs-timrot.h:261: +#define^ITIMROT_TIMCOUNT3_HIGH_FIXED_COUNT_MASK^I0x $ total: 2 errors, 0 warnings, 287 lines checked NOTE: whitespace errors detected, you may wish to use scripts/cleanpatch or scripts/cleanfile NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO MINMAX MULTISTATEMENT_MACRO_USE_DO_WHILE /tmp/[PATCH v2] mxs_timrot_Add support to i.MX23.mbox has style problems, please review. If any of these errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. [...] ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] uboot 2013.01.01 compile error
Dear Daniel-D Dax, On Sunday, February 24, 2013 9:10:32 AM, Daniel-D Dax wrote: > Hello,I'm trying to compile the uboot for the smdk6400 board. > but there is an error while compiling. > first I make distclean > then make smdk6400_config > then make > > the error appeared says that > > arm-linux-gnueabi-ld.bfd:u- > boot.lds:19: syntax error > > my working environment is kubuntu 12.10 > toolchain version is gcc-arm 4.7.2 > Sorry to disturb you. This board has been broken for a while in U-Boot. Please try a previous release of U-Boot until it works (I don't know from which release it stopped working), or fix it. With Tom Rini's approval, next week I will post a series removing support for this board because it is broken and it does not follow U-Boot evolutions, which prevents some improvements in U-Boot. It will still be possible to restore it to fix it later, using Git's history. Best regards, Benoît ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2] mxs: timrot: Add support to i.MX23
Dear Fadil Berisha, > Dear Marek Vasut > > > Also document that you renamed some macros, even if I'd prefer if you > > pulled those out into separate patch to make this easier to review. > > This is documented in comment for patch version v2: > "v2 - Updated the struct mxs_timrot_regs so the mapping works for all > registers" Since macro names corespondent to registers names, no need for > extra documentation. I meant MXS_INCREMENTER_HZ macro and such. > > ERROR: trailing whitespace > > Will fix in next version > > Fadil Berisha Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2] mxs: timrot: Add support to i.MX23
Dear Marek Vasut > Also document that you renamed some macros, even if I'd prefer if you pulled > those out into separate patch to make this easier to review. This is documented in comment for patch version v2: "v2 - Updated the struct mxs_timrot_regs so the mapping works for all registers" Since macro names corespondent to registers names, no need for extra documentation. > ERROR: trailing whitespace Will fix in next version Fadil Berisha ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 0/4] sf: Accessing > 16MBytes flashes in existing 3-byte addr mode.
Hello Jagan, thanks for your contribution. As there is currently no explicit custodian for sf, I would like to give some comments to your code. Am 23.02.2013 12:38, schrieb Jagannadha Sutradharudu Teki: > The current implementation in spi_flash supports 3-byte address mode > due to this up to 16MB amount of flash is able to access for those > flashes which has an actual size of > 16MB. > > List of flashes: > S25FL256S > N25Q256 > N25Q256A > W25Q256(not yet mainlined) > > extended/bank address register contains an information to access the > 4th byte addressing hence the flashes which has > 16MB can be accessible. > I don't see a config option described here (and also don't find it in the patches). Please keep in mind that the code size for existing boards should not increase! See http://www.denx.de/wiki/U-Boot/DesignPrinciples , points 1 and 5 The code might fit for your use-case, but has influence on other boards/systems, and this is not acceptable. Please add a config option for this new code and also use the existing options, like CONFIG_SPI_FLASH_SPANSION, in your code. > > Thanks, > Jagan. > Best Regards, Thomas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/4] sf: Add extended address register writing support
Hello Jagan, > > diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c > index 00aece9..232ccc0 100644 > --- a/drivers/mtd/spi/spi_flash.c > +++ b/drivers/mtd/spi/spi_flash.c > @@ -269,6 +269,47 @@ int spi_flash_cmd_write_status(struct spi_flash *flash, > u8 sr) > return 0; > } > > +int spi_flash_cmd_extaddr_write(struct spi_flash *flash, u8 ear) > +{ > + u8 cmd; > + u8 idcode0; > + int ret; > + > + ret = spi_flash_cmd(flash->spi, CMD_READ_ID, &idcode0, 1); > + if (ret) { > + debug("SF: fail to read read id\n"); > + return ret; > + } Instead of reading the id each time this function is executed, it should be decided during flash probing, if the feature is available and calling this functions should be done only then. > + > + if (idcode0 == 0x01) > + cmd = CMD_EXT_BRWR; > + else { > + printf("SF: unable to support extaddr reg write" > + " for %s flash\n", flash->name); This error will be hit every time for non-Spansion flashes, after you add the calls in patch 3/4 unconditionally! > + return -1; > + } > + > + ret = spi_flash_cmd_write_enable(flash); > + if (ret < 0) { > + debug("SF: enabling write failed\n"); > + return ret; > + } > + > + ret = spi_flash_cmd_write(flash->spi, &cmd, 1, &ear, 1); > + if (ret) { > + debug("SF: fail to write ext addr register\n"); > + return ret; > + } > + > + ret = spi_flash_cmd_wait_ready(flash, SPI_FLASH_PROG_TIMEOUT); > + if (ret < 0) { > + debug("SF: write config register timed out\n"); > + return ret; > + } > + > + return 0; > +} > + > /* >* The following table holds all device probe functions >* > diff --git a/drivers/mtd/spi/spi_flash_internal.h > b/drivers/mtd/spi/spi_flash_internal.h > index 141cfa8..dbceb81 100644 > --- a/drivers/mtd/spi/spi_flash_internal.h > +++ b/drivers/mtd/spi/spi_flash_internal.h > @@ -28,6 +28,9 @@ > #define CMD_ERASE_64K 0xd8 > #define CMD_ERASE_CHIP 0xc7 > > +/* Extended addr acess commands */ > +#define CMD_EXT_BRWR 0x17 Please comment, that this is the Spansion-only code. > + > /* Common status */ > #define STATUS_WIP 0x01 > > @@ -77,6 +80,9 @@ static inline int spi_flash_cmd_write_disable(struct > spi_flash *flash) > /* Program the status register. */ > int spi_flash_cmd_write_status(struct spi_flash *flash, u8 sr); > > +/* Program the extended address register */ > +int spi_flash_cmd_extaddr_write(struct spi_flash *flash, u8 ear); > + > /* >* Same as spi_flash_cmd_read() except it also claims/releases the SPI >* bus. Used as common part of the ->read() operation. > Best Regards, Thomas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/4] sf: Add extended address register reading support
Hello Jagan, Am 23.02.2013 12:38, schrieb Jagannadha Sutradharudu Teki: > This patch provides support to read a flash extended address register. > > reading extended/bank address register will give whether the flash is operated > on extended addressing or normal addressing in 3-byte address mode. > > Currently added an extended/bank address register reading support for > spansion flashes. The same comments as for patch 1/4 apply here. [...] Best Regards, Thomas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 3/4] sf: Add extended address access support
Hello Jagan, Am 23.02.2013 12:39, schrieb Jagannadha Sutradharudu Teki: > This patch provides support to access an extended addressing > in 3-byte address mode. > > The current implementation in spi_flash supports 3-byte address mode > due to this up to 16MB amount of flash is able to access for those > flashes which has an actual size of > 16MB. > > extended/bank address register contains an information to access the > 4th byte addressing hence the flashes which has > 16MB can be accessible. > > Signed-off-by: Jagannadha Sutradharudu Teki > --- > drivers/mtd/spi/spi_flash.c | 81 > ++ > drivers/mtd/spi/spi_flash_internal.h |8 +++ > 2 files changed, 89 insertions(+), 0 deletions(-) > > diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c > index c168c1c..16e5f59 100644 > --- a/drivers/mtd/spi/spi_flash.c > +++ b/drivers/mtd/spi/spi_flash.c > @@ -23,6 +23,30 @@ static void spi_flash_addr(u32 addr, u8 *cmd) > cmd[3] = addr >> 0; > } > > +static int spi_flash_check_extaddr_access(struct spi_flash *flash, u32 > *offset) > +{ > + int ret; > + > + if (*offset >= 0x100) { > + ret = spi_flash_extaddr_access(flash, STATUS_EXTADDR_ENABLE); Restricting this to a single bit here would give the next size limit at 32M. Please make it future-prov as much as possible: Why not directly use the upper byte of the offset as parameter? > + if (ret) { > + debug("SF: fail to %s ext addr bit\n", > + STATUS_EXTADDR_ENABLE ? "set" : "reset"); > + return ret; > + } > + *offset -= 0x100; Are you sure that manipulating the value of the caller has no side-effect? Is it even necessary, if the callers only do 3-byte-addressing and probably ignore the upper byte? > + } else { > + ret = spi_flash_extaddr_access(flash, STATUS_EXTADDR_DISABLE); > + if (ret) { > + debug("SF: fail to %s ext addr bit\n", > + STATUS_EXTADDR_DISABLE ? "set" : "reset"); > + return ret; > + } > + } > + > + return ret; > +} > + > static int spi_flash_read_write(struct spi_slave *spi, > const u8 *cmd, size_t cmd_len, > const u8 *data_out, u8 *data_in, > @@ -73,6 +97,14 @@ int spi_flash_cmd_write_multi(struct spi_flash *flash, u32 > offset, > int ret; > u8 cmd[4]; > > + if (flash->size > 0x100) { As already said in my comments to patch 1/4, this check (and the check for manufacturer ID) should be done only once once during probing of the flash. Then, if necessary, adapted functions for read, write and erase should be assigned to the function-pointers. Or use an additional function-pointer, which can be set to this or a similar function. Then the call of this function should be included in the loops, which all these functions have. Otherwise, as with your current code, you have a problem if the current accessed block crosses the boundary at 16M. Have you ever tried this? > + ret = spi_flash_check_extaddr_access(flash, &offset); > + if (ret) { > + debug("SF: fail to acess ext_addr\n"); > + return ret; > + } > + } > + > page_size = flash->page_size; > page_addr = offset / page_size; > byte_addr = offset % page_size; > @@ -139,6 +171,15 @@ int spi_flash_cmd_read_fast(struct spi_flash *flash, u32 > offset, > size_t len, void *data) > { > u8 cmd[5]; > + int ret; > + > + if (flash->size > 0x100) { > + ret = spi_flash_check_extaddr_access(flash, &offset); > + if (ret) { > + debug("SF: fail to acess ext_addr\n"); > + return ret; > + } > + } > > cmd[0] = CMD_READ_ARRAY_FAST; > spi_flash_addr(offset, cmd); > @@ -196,6 +237,14 @@ int spi_flash_cmd_erase(struct spi_flash *flash, u32 > offset, size_t len) > int ret; > u8 cmd[4]; > > + if (flash->size > 0x100) { > + ret = spi_flash_check_extaddr_access(flash, &offset); > + if (ret) { > + debug("SF: fail to acess ext_addr\n"); > + return ret; > + } > + } > + > erase_size = flash->sector_size; > if (offset % erase_size || len % erase_size) { > debug("SF: Erase offset/length not multiple of erase size\n"); > @@ -333,6 +382,38 @@ int spi_flash_cmd_extaddr_read(struct spi_flash *flash, > void *data) > return spi_flash_read_common(flash, &cmd, 1, data, 1); > } > > +int spi_flash_extaddr_access(struct spi_flash *flash, u8 status) > +{ > + int ret, pass; > + u8 data = 0, write_done = 0; > + > + for (pass = 0; pass < 2; pass++) { Why this i
Re: [U-Boot] [PATCH 4/4] sf: winbond: Add support for W25Q256
Hi Jagan, Am 23.02.2013 12:39, schrieb Jagannadha Sutradharudu Teki: > Add support for Winbond W25Q256 SPI flash. > As the other patches are only supporting spansion flashes, this is unrelated and should be resend independent of them. Even if not the full capacity of this flash is usable until the extended address support for winbond is added, it might be useful for others to detect this chip and use the first 16 MB of it. Best Regards, Thomas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] FDT howto
Hi Jagan, On Thu, Feb 21, 2013 at 9:03 AM, Jagan Teki wrote: > Hi All, > > I am planning to use devicetree on u-boot. > I have an experience to work with devicetree on Linux. > > For u-boot, I have read doc from doc/README.fdt-control. > I see some dts usages on tegra boards. > > I have lot of confusions with the concept itself. > > Is Linux and u-boot devicetree concept and build system are same? I don't really understand this question sorry. U-Boot and Linux use the device tree mainly for run-time configuration of drivers, so that the same driver code can operate on different boards. > > Suppose I have 4 boards J1, J2, J3 & J4 on my soc "emb".of vendor "vast" >For this requirement I have >board/vast/dts/J1.dts >board/vast/dts/J2.dts >board/vast/dts/J3.dts >board/vast/dts/J4.dts > >include/configs/emb_common.h ==> single configuration of all SOC > needed definitions >like defconfig in Linux. > >do I need any more files? That's enough for the basics I think. > >In emb_common.h i am defining >CONFIG_OF_SEPARATE is it sufficient? And CONFIG_OF_CONTROL > >My plan is to build u-boot and then build the dtb with specific > board and then combine. That's fine, and is how we do things on Chromium also. U-Boot tries to build an FDT even with CONFIG_OF_SEPARATE, so you need to put a default device tree file in your emb_common.h file that it can find. But you can ignore it, and for flashing your boards just use u-boot.bin plus whatever .dtb you want to select. > > I saw that all tegra boards config files are defining > CONFIG_DEFAULT_DEVICE_TREE if ie. the case dts is a compile time > option right. > am i correct? Yes - see above. This is convenient for testing and development. > > Please let me know your inputs. Regards, Simon > > -- > Thanks, > Jagan. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] FDT howto
Hi Simon, Thanks for your response, please find my below comments. On Sun, Feb 24, 2013 at 9:24 PM, Simon Glass wrote: > Hi Jagan, > > On Thu, Feb 21, 2013 at 9:03 AM, Jagan Teki wrote: >> Hi All, >> >> I am planning to use devicetree on u-boot. >> I have an experience to work with devicetree on Linux. >> >> For u-boot, I have read doc from doc/README.fdt-control. >> I see some dts usages on tegra boards. >> >> I have lot of confusions with the concept itself. >> >> Is Linux and u-boot devicetree concept and build system are same? > > I don't really understand this question sorry. U-Boot and Linux use > the device tree mainly for run-time configuration of drivers, so that > the same driver code can operate on different boards. I am some how confusing the fdt usage in u-boot. Because when compared to Linux, u-boot fdt setup mandatory to require the CONFIG_DEFAULT_DEVICE_TREE on the config file [from your previous comments]. is this the only difference when compared to Linux i guess..is it? Linux defconfig file does need to hot-code the dts. > >> >> Suppose I have 4 boards J1, J2, J3 & J4 on my soc "emb".of vendor "vast" >>For this requirement I have >>board/vast/dts/J1.dts >>board/vast/dts/J2.dts >>board/vast/dts/J3.dts >>board/vast/dts/J4.dts >> >>include/configs/emb_common.h ==> single configuration of all SOC >> needed definitions >>like defconfig in Linux. >> >>do I need any more files? > > That's enough for the basics I think. Is dtsi file require to add it on arch folder along with above. > >> >>In emb_common.h i am defining >>CONFIG_OF_SEPARATE is it sufficient? > > And CONFIG_OF_CONTROL > >> >>My plan is to build u-boot and then build the dtb with specific >> board and then combine. > > That's fine, and is how we do things on Chromium also. U-Boot tries to > build an FDT even with CONFIG_OF_SEPARATE, so you need to put a > default device tree file in your emb_common.h file that it can find. > But you can ignore it, and for flashing your boards just use > u-boot.bin plus whatever .dtb you want to select. So I will add the fdt support and then build the u-boot. Is there any separate u-boot build command to build dts file. My plan is to combine both u-boot and dtb. Thanks, Jagan. > >> >> I saw that all tegra boards config files are defining >> CONFIG_DEFAULT_DEVICE_TREE if ie. the case dts is a compile time >> option right. >> am i correct? > > Yes - see above. This is convenient for testing and development. > >> >> Please let me know your inputs. > > Regards, > Simon > >> >> -- >> Thanks, >> Jagan. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 0/2] Protect splashimage from improperly aligned addresses
As discussed in the links below, one needs to be careful about choosing an address for a splash image BMP file when working on architectures that can't handle unaligned memory accesses. A bad address may lead to a bricked board, and the safe addresses are not obvious due to the internal structure of BMP files. This patchset documents the problem and implements an optional callback that prevents the environment variable from being set to a bad value. Finally, it turns this protection on for cm_t35. http://lists.denx.de/pipermail/u-boot/2013-January/144666.html http://lists.denx.de/pipermail/u-boot/2013-February/146021.html Nikita Kiryanov (2): lcd: implement a callback for splashimage cm_t35: prevent splashimage from being set to a bad value README | 11 +++ common/lcd.c | 26 ++ doc/README.displaying-bmps | 27 +++ include/configs/cm_t35.h |2 ++ include/env_callback.h |7 +++ 5 files changed, 73 insertions(+) create mode 100644 doc/README.displaying-bmps -- 1.7.10.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/2] lcd: implement a callback for splashimage
On some architectures certain values of splashimage will lead to a data abort exception. Document the problem, and implement a callback for splashimage to reject such values. Cc: Anatolij Gustschin Cc: Wolfgang Denk Signed-off-by: Nikita Kiryanov Acked-by: Igor Grinberg --- README | 11 +++ common/lcd.c | 26 ++ doc/README.displaying-bmps | 27 +++ include/env_callback.h |7 +++ 4 files changed, 71 insertions(+) create mode 100644 doc/README.displaying-bmps diff --git a/README b/README index d8cb394..f1e416a 100644 --- a/README +++ b/README @@ -1530,6 +1530,17 @@ CBFS (Coreboot Filesystem) support allows for a "silent" boot where a splash screen is loaded very quickly after power-on. + CONFIG_SPLASHIMAGE_GUARD + + If this option is set, then U-Boot will prevent the environment + variable "splashimage" from being set to a problematic address + (see README.displaying-bmps and README.arm-unaligned-accesses). + This option is useful for targets where, due to alignment + restrictions, an improperly aligned BMP image will cause a data + abort. If you don't think you will not have problems with + unaligned accesses (for example because your toolchain prevents + them) there is no need to set this option. + CONFIG_SPLASH_SCREEN_ALIGN If this option is set the splash image can be freely positioned diff --git a/common/lcd.c b/common/lcd.c index 66d4f94..5d54168 100644 --- a/common/lcd.c +++ b/common/lcd.c @@ -33,6 +33,8 @@ #include #include #include +#include +#include #include #include #if defined(CONFIG_POST) @@ -1084,6 +1086,30 @@ static void *lcd_logo(void) #endif /* CONFIG_LCD_LOGO && !CONFIG_LCD_INFO_BELOW_LOGO */ } +#ifdef CONFIG_SPLASHIMAGE_GUARD +static int on_splashimage(const char *name, const char *value, enum env_op op, + int flags) +{ + ulong addr; + int aligned; + + if (op == env_op_delete) + return 0; + + addr = simple_strtoul(value, NULL, 16); + /* See README.displaying-bmps */ + aligned = (addr % 4 == 2); + if (!aligned) { + printf("Invalid splashimage value. Value must be 16 bit aligned, but not 32 bit aligned\n"); + return -1; + } + + return 0; +} + +U_BOOT_ENV_CALLBACK(splashimage, on_splashimage); +#endif + void lcd_position_cursor(unsigned col, unsigned row) { console_col = min(col, CONSOLE_COLS - 1); diff --git a/doc/README.displaying-bmps b/doc/README.displaying-bmps new file mode 100644 index 000..3311541 --- /dev/null +++ b/doc/README.displaying-bmps @@ -0,0 +1,27 @@ +If you are experiencing hangups/data-aborts when trying to display a BMP image, +the following might be relevant to your situation... + +Some architectures cannot handle unaligned memory accesses, and an attempt to +perform one will lead to a data abort. On such architectures it is necessary to +make sure all data is properly aligned, and in many situations simply choosing +a 32 bit aligned address is enough to ensure proper alignment. This is not +always the case when dealing with data that has an internal layout such as a +BMP image: + +BMP images have a header that starts with 2 byte-size fields followed by mostly +32 bit fields. The packed struct that represents this header can be seen below: + +typedef struct bmp_header { + /* Header */ + char signature[2]; + __u32 file_size; + __u32 reserved; + __u32 data_offset; + ... etc +} __attribute__ ((packed)) bmp_header_t; + +When placed in an aligned address such as 0x80a0, char signature offsets +the __u32 fields into unaligned addresses (in our example 0x80a2, +0x80a6, and so on...). When these fields are accessed by U-Boot, a 32 bit +access is generated at a non-32-bit-aligned address, causing a data abort. +The proper alignment for BMP images is therefore: 32-bit-aligned-address + 2. diff --git a/include/env_callback.h b/include/env_callback.h index c583120..62428d1 100644 --- a/include/env_callback.h +++ b/include/env_callback.h @@ -41,6 +41,12 @@ #define SILENT_CALLBACK #endif +#ifdef CONFIG_SPLASHIMAGE_GUARD +#define SPLASHIMAGE_CALLBACK "splashimage:splashimage," +#else +#define SPLASHIMAGE_CALLBACK +#endif + /* * This list of callback bindings is static, but may be overridden by defining * a new association in the ".callbacks" environment variable. @@ -51,6 +57,7 @@ "bootfile:bootfile," \ "loadaddr:loadaddr," \ SILENT_CALLBACK \ + SPLASHIMAGE_CALLBACK \ "stdin:console,stdout:console,stderr:console," \ CONFIG_ENV_CALLBACK_LIST_STATIC -- 1.7.10.4 ___ U-Boot mailing list U-Boot@lis
[U-Boot] [PATCH 2/2] cm_t35: prevent splashimage from being set to a bad value
Define CONFIG_SPLASHIMAGE_GUARD to prevent splashimage from being set to a value that will cause U-Boot to hang while displaying a splash screen. Signed-off-by: Nikita Kiryanov Acked-by: Igor Grinberg --- include/configs/cm_t35.h |2 ++ 1 file changed, 2 insertions(+) diff --git a/include/configs/cm_t35.h b/include/configs/cm_t35.h index 943b658..dec94d2 100644 --- a/include/configs/cm_t35.h +++ b/include/configs/cm_t35.h @@ -331,6 +331,8 @@ #define STATUS_LED_BOOTSTATUS_LED_BIT #define GREEN_LED_GPIO 186 /* CM-T35 Green LED is GPIO186 */ +#define CONFIG_SPLASHIMAGE_GUARD + /* GPIO banks */ #ifdef CONFIG_STATUS_LED #define CONFIG_OMAP3_GPIO_6/* GPIO186 is in GPIO bank 6 */ -- 1.7.10.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2] mxs: timrot: Add support to i.MX23
Dear Marek Vasut > I meant MXS_INCREMENTER_HZ macro and such. This change is made to respect Otavio's comment related to this patch http://lists.denx.de/pipermail/u-boot/2013-February/146906.html I did also changes to local macro MXS_HW_DIGCTL_MICROSECONDS. Let me know If you want to submit those changes on separate patch. Best Regards Fadil Berisha ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2] mxs: timrot: Add support to i.MX23
Dear Fadil Berisha, > Dear Marek Vasut > > > I meant MXS_INCREMENTER_HZ macro and such. > > This change is made to respect Otavio's comment related to this patch > http://lists.denx.de/pipermail/u-boot/2013-February/146906.html I did > also changes to local macro MXS_HW_DIGCTL_MICROSECONDS. > > Let me know If you want to submit those changes on separate patch. Yes, it'd be nice to have the macro renames and the other stuff submitted separatelly. > Best Regards > Fadil Berisha Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [RFC PATCH v2 01/15] Implement autoconf header file
Add support for generating an autoconf.h header file that can be used in the source instead of #ifdef. For example, instead of: #ifdef CONFIG_VERSION_VARIABLE setenv("ver", version_string); /* set version variable */ #endif you can do: if (autoconf_version_variable()) setenv("ver", version_string); /* set version variable */ The compiler will ensure that the dead code is eliminated, so the result is the same. Where the value of the CONFIG define is 0, you can use the autoconf_has...() form. For example CONFIG_BOOTDELAY can be -ve, 0 or +ve, but if it is defined at all, it affects behaviour: #if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) s = getenv ("bootdelay"); #endif So we use: if (autoconf_has_bootdelay() && autoconf_bootdelay() >= 0) s = getenv ("bootdelay"); This later form should only be used for such 'difficult' defines where a zero value still means that the CONFIG should be considered to be defined. Signed-off-by: Simon Glass --- Changes in v2: - Split out changes to main.c into separate patches - Fix up a few errors and comments in the original RFC - Use autoconf_...() instead of config_...() - Use autoconf_has_...() instead of config_..._enabled() - Add a grep to the sed/sort pipe to speed up processing Makefile | 42 - README| 87 +-- include/common.h | 3 ++ include/config_drop.h | 17 + tools/scripts/define2conf.sed | 37 ++ tools/scripts/define2list.sed | 31 +++ 6 files changed, 213 insertions(+), 4 deletions(-) create mode 100644 include/config_drop.h create mode 100644 tools/scripts/define2conf.sed create mode 100644 tools/scripts/define2list.sed diff --git a/Makefile b/Makefile index fc18dd4..9f4f55d 100644 --- a/Makefile +++ b/Makefile @@ -614,6 +614,7 @@ updater: # parallel sub-makes creating .depend files simultaneously. depend dep:$(TIMESTAMP_FILE) $(VERSION_FILE) \ $(obj)include/autoconf.mk \ + $(obj)include/generated/autoconf.h \ $(obj)include/generated/generic-asm-offsets.h \ $(obj)include/generated/asm-offsets.h for dir in $(SUBDIRS) $(CPUDIR) $(LDSCRIPT_MAKEFILE_DIR) ; do \ @@ -688,6 +689,44 @@ $(obj)include/autoconf.mk: $(obj)include/config.h sed -n -f tools/scripts/define2mk.sed > $@.tmp && \ mv $@.tmp $@ +# Create a C header file where every '#define CONFIG_XXX value' becomes +# '#define config_xxx() value', or '#define config_xxx() 0' where the CONFIG +# is not used by this board configuration. This allows C code to do things +# like 'if (config_xxx())' and have the compiler remove the dead code, +# instead of using '#ifdef CONFIG_XXX...#endif'. Note that in most cases +# if the config_...() returns 0 then the option is not enabled. In some rare +# cases such as CONFIG_BOOTDELAY, the config can be enabled but still have a +# a value of 0. So in addition we a #define config_xxx_enabled(), setting the +# value to 0 if the option is disabled, 1 if enabled. This last feature will +# hopefully be deprecated soon. +# The file is regenerated when any U-Boot header file changes. +$(obj)include/generated/autoconf.h: $(obj)include/config.h + @$(XECHO) Generating $@ ; \ + set -e ; \ + : Extract the config macros to a C header file ; \ + $(CPP) $(CFLAGS) -DDO_DEPS_ONLY -dM include/common.h | \ + sed -n -f tools/scripts/define2conf.sed > $@.tmp; \ + : Regenerate our list of all config macros if neeed ; \ + if [ ! -f $@-all.tmp ] || \ + find $(src) -name '*.h' -type f -newer $@-all.tmp | \ + egrep -qv 'include/(autoconf.h|generated|config.h)'; \ + then \ + : Extract all config macros from all C header files ; \ + : We can grep for CONFIG since the value will be dropped ; \ + ( \ + find ${src} -name "*.h" -type f | xargs \ + cat | grep CONFIG | \ + sed -n -f tools/scripts/define2list.sed \ + ) | sort | uniq > $@-all.tmp; \ + fi; \ + : Extract the enabled config macros to a C header file ; \ + $(CPP) $(CFLAGS) -DDO_DEPS_ONLY -dM include/common.h | \ + sed -n -f tools/scripts/define2list.sed | sort > $@-enabled.tmp; \ + set -e ; \ + : Find CONFIGs that are not enabled ; \ + comm -13 $@-enabled.tmp $@-all.tmp >>$@.tmp && \ + mv $@.tmp $@ + $(obj)include/generated/generic-asm-offsets.h: $(obj)include/autoconf.mk.dep \ $(obj)lib/asm-offsets.s @$(XECHO) Generating $@ @@ -770,7 +809,8 @@ include/license.h: tools/bin2header COPYING unconfig: @rm -f $(obj)include/config.h $(obj)include/config.mk \ $(obj)board/*/
[U-Boot] [RFC PATCH v2 03/15] net: Add prototype for update_tftp, and use autoconf
This function should be declared in net.h. At the same time, let's use autoconf insteaf of #ifdef for its inclusion. Signed-off-by: Simon Glass --- Changes in v2: None common/cmd_fitupd.c | 3 +-- common/main.c | 9 ++--- common/update.c | 24 include/net.h | 3 +++ 4 files changed, 14 insertions(+), 25 deletions(-) diff --git a/common/cmd_fitupd.c b/common/cmd_fitupd.c index 7a3789e..618ff7c 100644 --- a/common/cmd_fitupd.c +++ b/common/cmd_fitupd.c @@ -8,13 +8,12 @@ #include #include +#include #if !defined(CONFIG_UPDATE_TFTP) #error "CONFIG_UPDATE_TFTP required" #endif -extern int update_tftp(ulong addr); - static int do_fitupd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { ulong addr = 0UL; diff --git a/common/main.c b/common/main.c index e2d2e09..2b8af2c 100644 --- a/common/main.c +++ b/common/main.c @@ -61,10 +61,6 @@ DECLARE_GLOBAL_DATA_PTR; void inline __show_boot_progress (int val) {} void show_boot_progress (int val) __attribute__((weak, alias("__show_boot_progress"))); -#if defined(CONFIG_UPDATE_TFTP) -int update_tftp (ulong addr); -#endif /* CONFIG_UPDATE_TFTP */ - #define MAX_DELAY_STOP_STR 32 #undef DEBUG_PARSER @@ -427,9 +423,8 @@ void main_loop (void) } #endif /* CONFIG_PREBOOT */ -#if defined(CONFIG_UPDATE_TFTP) - update_tftp (0UL); -#endif /* CONFIG_UPDATE_TFTP */ + if (autoconf_update_tftp()) + update_tftp(0UL); #if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) s = getenv ("bootdelay"); diff --git a/common/update.c b/common/update.c index 94d6a82..9cd9ca2 100644 --- a/common/update.c +++ b/common/update.c @@ -43,19 +43,6 @@ /* env variable holding the location of the update file */ #define UPDATE_FILE_ENV"updatefile" -/* set configuration defaults if needed */ -#ifndef CONFIG_UPDATE_LOAD_ADDR -#define CONFIG_UPDATE_LOAD_ADDR0x10 -#endif - -#ifndef CONFIG_UPDATE_TFTP_MSEC_MAX -#define CONFIG_UPDATE_TFTP_MSEC_MAX100 -#endif - -#ifndef CONFIG_UPDATE_TFTP_CNT_MAX -#define CONFIG_UPDATE_TFTP_CNT_MAX 0 -#endif - extern ulong TftpRRQTimeoutMSecs; extern int TftpRRQTimeoutCountMax; extern flash_info_t flash_info[]; @@ -244,6 +231,7 @@ int update_tftp(ulong addr) char *filename, *env_addr; int images_noffset, ndepth, noffset; ulong update_addr, update_fladdr, update_size; + int msec_max; void *fit; int ret = 0; @@ -266,12 +254,16 @@ int update_tftp(ulong addr) /* get load address of downloaded update file */ if ((env_addr = getenv("loadaddr")) != NULL) addr = simple_strtoul(env_addr, NULL, 16); + else if (autoconf_has_update_load_addr()) + addr = autoconf_update_load_addr(); else - addr = CONFIG_UPDATE_LOAD_ADDR; + addr = 0x10; + msec_max = autoconf_has_update_tftp_msec_max() ? + autoconf_update_tftp_msec_max() : 100; - if (update_load(filename, CONFIG_UPDATE_TFTP_MSEC_MAX, - CONFIG_UPDATE_TFTP_CNT_MAX, addr)) { + if (update_load(filename, msec_max, autoconf_update_tftp_cnt_max(), + addr)) { printf("Can't load update file, aborting auto-update\n"); return 1; } diff --git a/include/net.h b/include/net.h index 970d4d1..23fb947 100644 --- a/include/net.h +++ b/include/net.h @@ -695,6 +695,9 @@ extern void copy_filename(char *dst, const char *src, int size); /* get a random source port */ extern unsigned int random_port(void); +/* Update U-Boot over TFTP */ +extern int update_tftp(ulong addr); + /**/ #endif /* __NET_H__ */ -- 1.8.1.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [RFC PATCH v2 07/15] main: Remove CONFIG #ifdefs from the abortboot() code
Move this code over to using autoconf. We can add the autoconf values to the delaykey[] array, and move the code that checks for autoconf values into the loop. Also change to using ARRAY_SIZE on delaykey[]. Signed-off-by: Simon Glass --- Changes in v2: None common/main.c | 86 ++- 1 file changed, 32 insertions(+), 54 deletions(-) diff --git a/common/main.c b/common/main.c index c00c5bd..37e42ca 100644 --- a/common/main.c +++ b/common/main.c @@ -90,15 +90,20 @@ static int abortboot_keyed(int bootdelay) int abort = 0; uint64_t etime = endtick(bootdelay); struct { - char* str; + const char *str; u_int len; int retry; + const char *conf; /* Configuration value */ } delaykey [] = { - { str: getenv ("bootdelaykey"), retry: 1 }, - { str: getenv ("bootdelaykey2"), retry: 1 }, - { str: getenv ("bootstopkey"), retry: 0 }, - { str: getenv ("bootstopkey2"), retry: 0 }, + { str: getenv("bootdelaykey"), retry: 1, + conf: autoconf_autoboot_delay_str() }, + { str: getenv("bootdelaykey2"), retry: 1, + conf: autoconf_autoboot_delay_str2() }, + { str: getenv("bootstopkey"), retry: 0, + conf: autoconf_autoboot_stop_str() }, + { str: getenv("bootstopkey2"), retry: 0, + conf: autoconf_autoboot_stop_str2() }, }; char presskey [MAX_DELAY_STOP_STR]; @@ -106,33 +111,15 @@ static int abortboot_keyed(int bootdelay) u_int presskey_max = 0; u_int i; -#ifndef CONFIG_ZERO_BOOTDELAY_CHECK - if (bootdelay == 0) + if (!autoconf_zero_bootdelay_check() && bootdelay == 0) return 0; -#endif - -# ifdef CONFIG_AUTOBOOT_PROMPT - printf(CONFIG_AUTOBOOT_PROMPT); -# endif -# ifdef CONFIG_AUTOBOOT_DELAY_STR - if (delaykey[0].str == NULL) - delaykey[0].str = CONFIG_AUTOBOOT_DELAY_STR; -# endif -# ifdef CONFIG_AUTOBOOT_DELAY_STR2 - if (delaykey[1].str == NULL) - delaykey[1].str = CONFIG_AUTOBOOT_DELAY_STR2; -# endif -# ifdef CONFIG_AUTOBOOT_STOP_STR - if (delaykey[2].str == NULL) - delaykey[2].str = CONFIG_AUTOBOOT_STOP_STR; -# endif -# ifdef CONFIG_AUTOBOOT_STOP_STR2 - if (delaykey[3].str == NULL) - delaykey[3].str = CONFIG_AUTOBOOT_STOP_STR2; -# endif + if (autoconf_has_autoboot_prompt()) + printf(autoconf_autoboot_prompt()); - for (i = 0; i < sizeof(delaykey) / sizeof(delaykey[0]); i ++) { + for (i = 0; i < ARRAY_SIZE(delaykey); i++) { + if (delaykey[i].conf && !delaykey[i].str) + delaykey[i].str = delaykey[i].conf; delaykey[i].len = delaykey[i].str == NULL ? 0 : strlen (delaykey[i].str); delaykey[i].len = delaykey[i].len > MAX_DELAY_STOP_STR ? @@ -164,7 +151,7 @@ static int abortboot_keyed(int bootdelay) } } - for (i = 0; i < sizeof(delaykey) / sizeof(delaykey[0]); i ++) { + for (i = 0; i < ARRAY_SIZE(delaykey); i++) { if (delaykey[i].len > 0 && presskey_len >= delaykey[i].len && memcmp (presskey + presskey_len - delaykey[i].len, @@ -189,43 +176,37 @@ static int abortboot_keyed(int bootdelay) puts("key timeout\n"); # endif -#ifdef CONFIG_SILENT_CONSOLE - if (abort) + if (autoconf_silent_console() && abort) gd->flags &= ~GD_FLG_SILENT; -#endif return abort; } -#ifdef CONFIG_MENUKEY static int menukey = 0; -#endif static int abortboot_normal(int bootdelay) { int abort = 0; unsigned long ts; -#ifdef CONFIG_MENUPROMPT - printf(CONFIG_MENUPROMPT); -#else - if (bootdelay >= 0) + if (autoconf_menuprompt()) + printf(autoconf_menuprompt()); + else if (bootdelay >= 0) printf("Hit any key to stop autoboot: %2d ", bootdelay); -#endif -#if defined CONFIG_ZERO_BOOTDELAY_CHECK /* -* Check if key already pressed -* Don't check if bootdelay < 0 +* If we need to do a bootdelay check even if bootdelay is 0, do +* it here, since the loop below will be skipped in this case. +* We don't do this check if bootdelay < 0. */ - if (bootdelay >= 0) { - if (tstc()) { /* we got a key press */ + if (autoconf_zero_bootdelay_check() && bootdelay >= 0) { + /* Check if key already pressed */ + if (tstc()) { /* we got a key press */ (void) getc(); /* consume input*/
[U-Boot] [RFC PATCH v2 10/15] main: Use autoconf for parser selection
Allow parser selection to make use of autoconf instead of #ifdefs. This requires us to make header includes unconditional, but this is simpler anyway. Signed-off-by: Simon Glass --- Changes in v2: None common/main.c | 92 +++--- include/hush.h | 2 -- 2 files changed, 42 insertions(+), 52 deletions(-) diff --git a/common/main.c b/common/main.c index a5d3f82..e1483db 100644 --- a/common/main.c +++ b/common/main.c @@ -32,14 +32,11 @@ #include #include #include +#include #include #include #include -#ifdef CONFIG_SYS_HUSH_PARSER -#include -#endif - #include #include @@ -382,12 +379,10 @@ static void process_boot_delay(void) void main_loop(void) { -#ifndef CONFIG_SYS_HUSH_PARSER static char lastcommand[CONFIG_SYS_CBSIZE] = { 0, }; int len; int rc = 1; int flag; -#endif #ifdef CONFIG_PREBOOT char *p; #endif @@ -447,12 +442,11 @@ void main_loop(void) /* * Main Loop for Monitor Command Processing */ -#ifdef CONFIG_SYS_HUSH_PARSER - parse_file_outer(); - /* This point is never reached */ - for (;;); -#else - for (;;) { + if (autoconf_sys_hush_parser()) { + parse_file_outer(); + /* This point is never reached */ + for (;;); + } else { if (autoconf_boot_retry_time() && rc >= 0) { /* Saw enough of a valid command to * restart the timeout. @@ -487,7 +481,6 @@ void main_loop(void) lastcommand[0] = 0; } } -#endif /*CONFIG_SYS_HUSH_PARSER*/ } /* @@ -1186,7 +1179,6 @@ int parse_line (char *line, char *argv[]) // -#ifndef CONFIG_SYS_HUSH_PARSER static void process_macros (const char *input, char *output) { char c, prev; @@ -1402,7 +1394,6 @@ static int builtin_run_command(const char *cmd, int flag) return rc ? rc : repeatable; } -#endif /* * Run a command using the selected parser. @@ -1413,22 +1404,21 @@ static int builtin_run_command(const char *cmd, int flag) */ int run_command(const char *cmd, int flag) { -#ifndef CONFIG_SYS_HUSH_PARSER - /* -* builtin_run_command can return 0 or 1 for success, so clean up -* its result. -*/ - if (builtin_run_command(cmd, flag) == -1) - return 1; - - return 0; -#else - return parse_string_outer(cmd, + if (autoconf_sys_hush_parser()) { + return parse_string_outer(cmd, FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP); -#endif + } else { + /* + * builtin_run_command can return 0 or 1 for success, so + * clean up its result. + */ + if (builtin_run_command(cmd, flag) == -1) + return 1; + + return 0; + } } -#ifndef CONFIG_SYS_HUSH_PARSER /** * Execute a list of command separated by ; or \n using the built-in parser. * @@ -1469,7 +1459,6 @@ static int builtin_run_command_list(char *cmd, int flag) return rcode; } -#endif int run_command_list(const char *cmd, int len, int flag) { @@ -1479,13 +1468,16 @@ int run_command_list(const char *cmd, int len, int flag) if (len == -1) { len = strlen(cmd); -#ifdef CONFIG_SYS_HUSH_PARSER - /* hush will never change our string */ - need_buff = 0; -#else - /* the built-in parser will change our string if it sees \n */ - need_buff = strchr(cmd, '\n') != NULL; -#endif + if (autoconf_sys_hush_parser()) { + /* hush will never change our string */ + need_buff = 0; + } else { + /* +* the built-in parser will change our string if it +* sees \n +*/ + need_buff = strchr(cmd, '\n') != NULL; + } } if (need_buff) { buff = malloc(len + 1); @@ -1494,20 +1486,20 @@ int run_command_list(const char *cmd, int len, int flag) memcpy(buff, cmd, len); buff[len] = '\0'; } -#ifdef CONFIG_SYS_HUSH_PARSER - rcode = parse_string_outer(buff, FLAG_PARSE_SEMICOLON); -#else - /* -* This function will overwrite any \n it sees with a \0, which -* is why it can't work with a const char *. Here we are making -* using of internal knowledge of this function, to avoid always -* doing a malloc() which is actually required only in a case that -* is pretty rare. -*/ - rcode = builtin_run_command_list(buff, flag); - if (need_buff) - free(buff); -#endif + if (autoconf_sys_hu
[U-Boot] [RFC PATCH v2 14/15] main: Add debug_parser() to avoid #ifdefs
Define a simple debug condition at the top of the file, to avoid using lots of #ifdefs later on. Signed-off-by: Simon Glass --- Changes in v2: None common/main.c | 58 +++--- 1 file changed, 23 insertions(+), 35 deletions(-) diff --git a/common/main.c b/common/main.c index 905d0c2..75a184c 100644 --- a/common/main.c +++ b/common/main.c @@ -49,7 +49,11 @@ void show_boot_progress (int val) __attribute__((weak, alias("__show_boot_progre #define MAX_DELAY_STOP_STR 32 -#undef DEBUG_PARSER +#define DEBUG_PARSER 0 /* set to 1 to debug */ + +#define debug_parser(fmt, args...) \ + debug_cond(DEBUG_PARSER, fmt, ##args) + charconsole_buffer[CONFIG_SYS_CBSIZE + 1]; /* console I/O buffer */ @@ -1107,9 +,7 @@ int parse_line (char *line, char *argv[]) { int nargs = 0; -#ifdef DEBUG_PARSER - printf ("parse_line: \"%s\"\n", line); -#endif + debug_parser("parse_line: \"%s\"\n", line); while (nargs < CONFIG_SYS_MAXARGS) { /* skip any white space */ @@ -1118,10 +1120,8 @@ int parse_line (char *line, char *argv[]) if (*line == '\0') {/* end of line, no more args*/ argv[nargs] = NULL; -#ifdef DEBUG_PARSER - printf ("parse_line: nargs=%d\n", nargs); -#endif - return (nargs); + debug_parser("parse_line: nargs=%d\n", nargs); + return nargs; } argv[nargs++] = line; /* begin of argument string */ @@ -1132,10 +1132,8 @@ int parse_line (char *line, char *argv[]) if (*line == '\0') {/* end of line, no more args*/ argv[nargs] = NULL; -#ifdef DEBUG_PARSER - printf ("parse_line: nargs=%d\n", nargs); -#endif - return (nargs); + debug_parser("parse_line: nargs=%d\n", nargs); + return nargs; } *line++ = '\0'; /* terminate current arg */ @@ -1143,9 +1141,7 @@ int parse_line (char *line, char *argv[]) printf ("** Too many args (max. %d) **\n", CONFIG_SYS_MAXARGS); -#ifdef DEBUG_PARSER - printf ("parse_line: nargs=%d\n", nargs); -#endif + debug_parser("parse_line: nargs=%d\n", nargs); return (nargs); } @@ -1162,12 +1158,10 @@ static void process_macros (const char *input, char *output) /* 1 = waiting for '(' or '{' */ /* 2 = waiting for ')' or '}' */ /* 3 = waiting for ''' */ -#ifdef DEBUG_PARSER char *output_start = output; - printf ("[PROCESS_MACROS] INPUT len %d: \"%s\"\n", strlen (input), - input); -#endif + debug_parser("[PROCESS_MACROS] INPUT len %zd: \"%s\"\n", strlen(input), +input); prev = '\0';/* previous character */ @@ -1255,10 +1249,8 @@ static void process_macros (const char *input, char *output) else *(output - 1) = 0; -#ifdef DEBUG_PARSER - printf ("[PROCESS_MACROS] OUTPUT len %d: \"%s\"\n", - strlen (output_start), output_start); -#endif + debug_parser("[PROCESS_MACROS] OUTPUT len %zd: \"%s\"\n", + strlen(output_start), output_start); } / @@ -1289,12 +1281,12 @@ static int builtin_run_command(const char *cmd, int flag) int repeatable = 1; int rc = 0; -#ifdef DEBUG_PARSER - printf ("[RUN_COMMAND] cmd[%p]=\"", cmd); - puts (cmd ? cmd : "NULL"); /* use puts - string may be lng */ - puts ("\"\n"); -#endif - + debug_parser("[RUN_COMMAND] cmd[%p]=\"", cmd); + if (DEBUG_PARSER) { + /* use puts - string may be lng */ + puts(cmd ? cmd : "NULL"); + puts("\"\n"); + } clear_ctrlc(); /* forget any previous Control C */ if (!cmd || !*cmd) { @@ -1312,9 +1304,7 @@ static int builtin_run_command(const char *cmd, int flag) * repeatable commands */ -#ifdef DEBUG_PARSER - printf ("[PROCESS_SEPARATORS] %s\n", cmd); -#endif + debug_parser("[PROCESS_SEPARATORS] %s\n", cmd); while (*str) { /* @@ -1343,9 +1333,7 @@ static int builtin_run_command(const char *cmd, int flag) } else str = sep; /* no more commands for next pass */ -#ifdef DEBUG_PARSER - printf ("token: \"%s\"\n", token); -#endif + debug_parser("token: \"%s\"\n", token); /* find macros in this token and replace them */ process_macros (token, finaltoken); -- 1.8.1.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u
[U-Boot] [RFC PATCH v2 05/15] main: Move boot_delay code into its own function
Move this code into its own function, since it clutters up main_loop(). Signed-off-by: Simon Glass --- Changes in v2: None common/main.c | 155 ++ 1 file changed, 79 insertions(+), 76 deletions(-) diff --git a/common/main.c b/common/main.c index 1e12e55..0df7992 100644 --- a/common/main.c +++ b/common/main.c @@ -91,7 +91,6 @@ extern void mdm_init(void); /* defined in board.c */ * Watch for 'delay' seconds for autoboot stop or autoboot delay string. * returns: 0 - no key string, allow autoboot 1 - got key string, abort */ -#if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) static int abortboot_keyed(int bootdelay) { int abort = 0; @@ -273,7 +272,6 @@ static int abortboot(int bootdelay) else return abortboot_normal(bootdelay); } -#endif /* CONFIG_BOOTDELAY >= 0 */ /* * Runs the given boot command securely. Specifically: @@ -289,8 +287,7 @@ static int abortboot(int bootdelay) * printing the error message to console. */ -#if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) && \ - defined(CONFIG_OF_CONTROL) +#ifdef CONFIG_OF_CONTROL static void secure_boot_cmd(char *cmd) { cmd_tbl_t *cmdtp; @@ -331,46 +328,33 @@ static void process_fdt_options(const void *blob) /* Add an env variable to point to a kernel payload, if available */ addr = fdtdec_get_config_int(gd->fdt_blob, "kernel-offset", 0); - if (addr) - setenv_addr("kernaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr)); + if (addr) { + setenv_addr("kernaddr", + (void *)(autoconf_sys_text_base() + addr)); + } /* Add an env variable to point to a root disk, if available */ addr = fdtdec_get_config_int(gd->fdt_blob, "rootdisk-offset", 0); - if (addr) - setenv_addr("rootaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr)); + if (addr) { + setenv_addr("rootaddr", + (void *)(autoconf_sys_text_base() + addr)); + } } #endif /* CONFIG_OF_CONTROL */ - -// - -void main_loop (void) +static void process_boot_delay(void) { -#ifndef CONFIG_SYS_HUSH_PARSER - static char lastcommand[CONFIG_SYS_CBSIZE] = { 0, }; - int len; - int rc = 1; - int flag; -#endif -#if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) && \ - defined(CONFIG_OF_CONTROL) - char *env; -#endif -#if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) - char *s; - int bootdelay; -#endif -#ifdef CONFIG_PREBOOT - char *p; -#endif #ifdef CONFIG_BOOTCOUNT_LIMIT unsigned long bootcount = 0; unsigned long bootlimit = 0; char *bcs; char bcs_set[16]; #endif /* CONFIG_BOOTCOUNT_LIMIT */ - - bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, "main_loop"); +#ifdef CONFIG_OF_CONTROL + char *env; +#endif + char *s; + int bootdelay; #ifdef CONFIG_BOOTCOUNT_LIMIT bootcount = bootcount_load(); @@ -382,51 +366,8 @@ void main_loop (void) bootlimit = bcs ? simple_strtoul (bcs, NULL, 10) : 0; #endif /* CONFIG_BOOTCOUNT_LIMIT */ -#ifdef CONFIG_MODEM_SUPPORT - debug ("DEBUG: main_loop: do_mdm_init=%d\n", do_mdm_init); - if (do_mdm_init) { - char *str = strdup(getenv("mdm_cmd")); - setenv ("preboot", str); /* set or delete definition */ - if (str != NULL) - free (str); - mdm_init(); /* wait for modem connection */ - } -#endif /* CONFIG_MODEM_SUPPORT */ - -#ifdef CONFIG_VERSION_VARIABLE - { - setenv ("ver", version_string); /* set version variable */ - } -#endif /* CONFIG_VERSION_VARIABLE */ - -#ifdef CONFIG_SYS_HUSH_PARSER - u_boot_hush_start (); -#endif - -#if defined(CONFIG_HUSH_INIT_VAR) - hush_init_var (); -#endif - -#ifdef CONFIG_PREBOOT - if ((p = getenv ("preboot")) != NULL) { -# ifdef CONFIG_AUTOBOOT_KEYED - int prev = disable_ctrlc(1);/* disable Control C checking */ -# endif - - run_command_list(p, -1, 0); - -# ifdef CONFIG_AUTOBOOT_KEYED - disable_ctrlc(prev);/* restore Control C checking */ -# endif - } -#endif /* CONFIG_PREBOOT */ - - if (autoconf_update_tftp()) - update_tftp(0UL); - -#if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) s = getenv ("bootdelay"); - bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY; + bootdelay = s ? (int)simple_strtol(s, NULL, 10) : autoconf_bootdelay(); debug ("### main_loop entered: bootdelay=%d\n\n", bootdelay); @@ -491,7 +432,69 @@ void main_loop (void) run_command_list(s, -1, 0); } #endif /* CONFIG_MENUKEY */ -#endif /* CONFIG_BOOTDELAY */ +} + +/
[U-Boot] [RFC PATCH v2 02/15] at91: Correct CONFIG_AUTOBOOT_PROMPT definition for pm9263
This is not currently used, since autoboot is not enabled for this board, but the string is missing a parameter. Add it. Signed-off-by: Simon Glass --- Changes in v2: None include/configs/pm9263.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/configs/pm9263.h b/include/configs/pm9263.h index b60a9ad..6f6ddfa 100644 --- a/include/configs/pm9263.h +++ b/include/configs/pm9263.h @@ -355,7 +355,7 @@ #define CONFIG_BOOTCOMMAND "run flashboot" #define CONFIG_ROOTPATH"/ronetix/rootfs" -#define CONFIG_AUTOBOOT_PROMPT "autoboot in %d seconds\n" +#define CONFIG_AUTOBOOT_PROMPT "autoboot in %d seconds\n", bootdelay #define CONFIG_CON_ROT "fbcon=rotate:3 " #define CONFIG_BOOTARGS"root=/dev/mtdblock4 rootfstype=jffs2 "\ -- 1.8.1.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [RFC PATCH v2 08/15] main: Use get/setenv_ulong()
These functions are now available, so use them to avoid extra code here. Signed-off-by: Simon Glass --- Changes in v2: None common/main.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/common/main.c b/common/main.c index 37e42ca..4f11e58 100644 --- a/common/main.c +++ b/common/main.c @@ -318,8 +318,6 @@ static void process_boot_delay(void) #ifdef CONFIG_BOOTCOUNT_LIMIT unsigned long bootcount = 0; unsigned long bootlimit = 0; - char *bcs; - char bcs_set[16]; #endif /* CONFIG_BOOTCOUNT_LIMIT */ #ifdef CONFIG_OF_CONTROL char *env; @@ -331,10 +329,8 @@ static void process_boot_delay(void) bootcount = bootcount_load(); bootcount++; bootcount_store (bootcount); - sprintf (bcs_set, "%lu", bootcount); - setenv ("bootcount", bcs_set); - bcs = getenv ("bootlimit"); - bootlimit = bcs ? simple_strtoul (bcs, NULL, 10) : 0; + setenv_ulong("bootcount", bootcount); + bootlimit = getenv_ulong("bootlimit", 10, 0); #endif /* CONFIG_BOOTCOUNT_LIMIT */ s = getenv ("bootdelay"); -- 1.8.1.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [RFC PATCH v2 04/15] main: Separate out the two abortboot() functions
There are two implementations of autoboot(). Turn these into two separate functions, and create a single autoboot() which calls either one or the other. Also it seems that nothing uses autoboot() outside main, so make it static. Signed-off-by: Simon Glass --- Changes in v2: None common/main.c| 22 ++ include/common.h | 3 --- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/common/main.c b/common/main.c index 2b8af2c..1e12e55 100644 --- a/common/main.c +++ b/common/main.c @@ -92,11 +92,7 @@ extern void mdm_init(void); /* defined in board.c */ * returns: 0 - no key string, allow autoboot 1 - got key string, abort */ #if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) -# if defined(CONFIG_AUTOBOOT_KEYED) -#ifndef CONFIG_MENU -static inline -#endif -int abortboot(int bootdelay) +static int abortboot_keyed(int bootdelay) { int abort = 0; uint64_t etime = endtick(bootdelay); @@ -209,16 +205,11 @@ int abortboot(int bootdelay) return abort; } -# else /* !defined(CONFIG_AUTOBOOT_KEYED) */ - #ifdef CONFIG_MENUKEY static int menukey = 0; #endif -#ifndef CONFIG_MENU -static inline -#endif -int abortboot(int bootdelay) +static int abortboot_normal(int bootdelay) { int abort = 0; unsigned long ts; @@ -274,7 +265,14 @@ int abortboot(int bootdelay) return abort; } -# endif/* CONFIG_AUTOBOOT_KEYED */ + +static int abortboot(int bootdelay) +{ + if (autoconf_autoboot_keyed()) + return abortboot_keyed(bootdelay); + else + return abortboot_normal(bootdelay); +} #endif /* CONFIG_BOOTDELAY >= 0 */ /* diff --git a/include/common.h b/include/common.h index 491783b..fb219fd 100644 --- a/include/common.h +++ b/include/common.h @@ -297,9 +297,6 @@ int readline_into_buffer(const char *const prompt, char *buffer, intparse_line (char *, char *[]); void init_cmd_timeout(void); void reset_cmd_timeout(void); -#ifdef CONFIG_MENU -intabortboot(int bootdelay); -#endif extern char console_buffer[]; /* arch/$(ARCH)/lib/board.c */ -- 1.8.1.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [RFC PATCH v2 12/15] main: Use autoconf in main_loop()
Convert main_loop() over to use autoconf, and add a required prototype to common.h. The do_mdm_init variable is now always defined, but this seems like an acceptable compromise. In fdt_support.h the #ifdef used is CONFIG_OF_LIBFDT. However, even if this is not defined we want to make the functions available for our conditional-compilation scheme. The only place where we really don't have access to these support functions is when USE_HOSTCC is defined. So change the #ifdef to that. Signed-off-by: Simon Glass --- Changes in v2: None common/main.c | 77 +++ include/common.h | 1 + include/fdt_support.h | 4 +-- 3 files changed, 37 insertions(+), 45 deletions(-) diff --git a/common/main.c b/common/main.c index 3966321..40a79b7 100644 --- a/common/main.c +++ b/common/main.c @@ -63,10 +63,7 @@ static int retry_time = -1; /* -1 so can call readline before main_loop */ #defineendtick(seconds) (get_ticks() + (uint64_t)(seconds) * get_tbclk()) -#ifdef CONFIG_MODEM_SUPPORT int do_mdm_init = 0; -extern void mdm_init(void); /* defined in board.c */ -#endif /*** * Watch for 'delay' seconds for autoboot stop or autoboot delay string. @@ -383,51 +380,47 @@ void main_loop(void) int len; int rc = 1; int flag; -#ifdef CONFIG_PREBOOT - char *p; -#endif bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, "main_loop"); -#ifdef CONFIG_MODEM_SUPPORT - debug("DEBUG: main_loop: do_mdm_init=%d\n", do_mdm_init); - if (do_mdm_init) { - char *str = strdup(getenv("mdm_cmd")); - setenv("preboot", str); /* set or delete definition */ - if (str != NULL) - free(str); - mdm_init(); /* wait for modem connection */ + if (autoconf_modem_support()) { + debug("DEBUG: main_loop: do_mdm_init=%d\n", do_mdm_init); + if (do_mdm_init) { + char *str = strdup(getenv("mdm_cmd")); + + setenv("preboot", str); /* set or delete definition */ + if (str != NULL) + free(str); + mdm_init(); /* wait for modem connection */ + } } -#endif /* CONFIG_MODEM_SUPPORT */ -#ifdef CONFIG_VERSION_VARIABLE - { + if (autoconf_version_variable()) setenv("ver", version_string); /* set version variable */ - } -#endif /* CONFIG_VERSION_VARIABLE */ -#ifdef CONFIG_SYS_HUSH_PARSER - u_boot_hush_start(); -#endif + if (autoconf_sys_hush_parser()) + u_boot_hush_start(); -#if defined(CONFIG_HUSH_INIT_VAR) - hush_init_var(); -#endif + if (autoconf_hush_init_var()) + hush_init_var(); + + if (autoconf_preboot()) { + char *p = getenv("preboot"); + + if (p) { + int prev; -#ifdef CONFIG_PREBOOT - p = getenv("preboot"); - if (p) { -# ifdef CONFIG_AUTOBOOT_KEYED - int prev = disable_ctrlc(1);/* disable Control C checking */ -# endif + /* disable Control C checking */ + if (autoconf_autoboot_keyed()) + prev = disable_ctrlc(1); - run_command_list(p, -1, 0); + run_command_list(p, -1, 0); -# ifdef CONFIG_AUTOBOOT_KEYED - disable_ctrlc(prev);/* restore Control C checking */ -# endif + /* restore Control C checking */ + if (autoconf_autoboot_keyed()) + disable_ctrlc(prev); + } } -#endif /* CONFIG_PREBOOT */ if (autoconf_update_tftp()) update_tftp(0UL); @@ -435,9 +428,8 @@ void main_loop(void) if (autoconf_has_bootdelay() && autoconf_bootdelay() >= 0) process_boot_delay(); -#if defined CONFIG_OF_CONTROL - set_working_fdt_addr((void *)gd->fdt_blob); -#endif /* CONFIG_OF_CONTROL */ + if (autoconf_of_control() && autoconf_of_libfdt()) + set_working_fdt_addr((void *)gd->fdt_blob); /* * Main Loop for Monitor Command Processing @@ -472,14 +464,13 @@ void main_loop(void) } if (len == -1) - puts ("\n"); + puts("\n"); else rc = run_command(lastcommand, flag); - if (rc <= 0) { - /* invalid command or not repeatable, forget it */ + /* If an invalid command or not repeatable, forget it */ + if (rc <= 0) lastcommand[0] = 0; - } } } diff --git a/include/common.h b/include/common.h index 1457349..e5eb882 100644 --- a/include/com
[U-Boot] [RFC PATCH v2 15/15] main: Add debug_bootkeys to avoid #ifdefs
Define a simple debug condition at the top of the file, to avoid using lots of #ifdefs later on. Signed-off-by: Simon Glass --- Changes in v2: None common/main.c | 19 +-- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/common/main.c b/common/main.c index 75a184c..22ed6ef 100644 --- a/common/main.c +++ b/common/main.c @@ -54,6 +54,11 @@ void show_boot_progress (int val) __attribute__((weak, alias("__show_boot_progre #define debug_parser(fmt, args...) \ debug_cond(DEBUG_PARSER, fmt, ##args) +#ifndef DEBUG_BOOTKEYS +#define DEBUG_BOOTKEYS 0 +#endif +#define debug_bootkeys(fmt, args...) \ + debug_cond(DEBUG_BOOTKEYS, fmt, ##args) charconsole_buffer[CONFIG_SYS_CBSIZE + 1]; /* console I/O buffer */ @@ -115,11 +120,9 @@ static int abortboot_keyed(int bootdelay) presskey_max = presskey_max > delaykey[i].len ? presskey_max : delaykey[i].len; -# if DEBUG_BOOTKEYS - printf("%s key:<%s>\n", + debug_bootkeys("%s key:<%s>\n", delaykey[i].retry ? "delay" : "stop", delaykey[i].str ? delaykey[i].str : "NULL"); -# endif } /* In order to keep up with incoming data, check timeout only @@ -144,10 +147,8 @@ static int abortboot_keyed(int bootdelay) memcmp (presskey + presskey_len - delaykey[i].len, delaykey[i].str, delaykey[i].len) == 0) { -# if DEBUG_BOOTKEYS - printf("got %skey\n", - delaykey[i].retry ? "delay" : "stop"); -# endif + debug_bootkeys("got %skey\n", + delaykey[i].retry ? "delay" : "stop"); /* don't retry auto boot? */ if (autoconf_boot_retry_time() && @@ -158,10 +159,8 @@ static int abortboot_keyed(int bootdelay) } } while (!abort && get_ticks() <= etime); -# if DEBUG_BOOTKEYS if (!abort) - puts("key timeout\n"); -# endif + debug_bootkeys("key timeout\n"); if (autoconf_silent_console() && abort) gd->flags &= ~GD_FLG_SILENT; -- 1.8.1.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [RFC PATCH v2 11/15] main: Use autoconf in command line reading
Remove #ifdefs in favour of autoconf for this code. This involves removing a few unnecessary #ifdefs in headers also. We have two versions of the code - one that handles command line editing and one that is just a simple implementation. Create a new function called readline_into_buffer() which calls either cread_line() or the new simple_readline(), created to hold the 'simple' code. The cread_print_hist_list() function is not actually used anywhere, so punt it. Signed-off-by: Simon Glass --- Changes in v2: None common/main.c | 186 -- include/command.h | 2 - include/common.h | 2 - 3 files changed, 84 insertions(+), 106 deletions(-) diff --git a/common/main.c b/common/main.c index e1483db..3966321 100644 --- a/common/main.c +++ b/common/main.c @@ -514,8 +514,6 @@ void reset_cmd_timeout(void) } #endif -#ifdef CONFIG_CMDLINE_EDITING - /* * cmdline-editing related codes from vivi. * Author: Janghoon Lyu @@ -618,27 +616,6 @@ static char* hist_next(void) return (ret); } -#ifndef CONFIG_CMDLINE_EDITING -static void cread_print_hist_list(void) -{ - int i; - unsigned long n; - - n = hist_num - hist_max; - - i = hist_add_idx + 1; - while (1) { - if (i > hist_max) - i = 0; - if (i == hist_add_idx) - break; - printf("%s\n", hist_list[i]); - n++; - i++; - } -} -#endif /* CONFIG_CMDLINE_EDITING */ - #define BEGINNING_OF_LINE() { \ while (num) { \ getcmd_putch(CTL_BACKSPACE);\ @@ -900,27 +877,27 @@ static int cread_line(const char *const prompt, char *buf, unsigned int *len, REFRESH_TO_EOL(); continue; } -#ifdef CONFIG_AUTO_COMPLETE - case '\t': { - int num2, col; + case '\t': + if (autoconf_auto_complete()) { + int num2, col; - /* do not autocomplete when in the middle */ - if (num < eol_num) { - getcmd_cbeep(); - break; - } + /* do not autocomplete when in the middle */ + if (num < eol_num) { + getcmd_cbeep(); + break; + } - buf[num] = '\0'; - col = strlen(prompt) + eol_num; - num2 = num; - if (cmd_auto_complete(prompt, buf, &num2, &col)) { - col = num2 - num; - num += col; - eol_num += col; + buf[num] = '\0'; + col = strlen(prompt) + eol_num; + num2 = num; + if (cmd_auto_complete(prompt, buf, &num2, + &col)) { + col = num2 - num; + num += col; + eol_num += col; + } + break; } - break; - } -#endif default: cread_add_char(ichar, insert, &num, &eol_num, buf, *len); break; @@ -936,8 +913,6 @@ static int cread_line(const char *const prompt, char *buf, unsigned int *len, return 0; } -#endif /* CONFIG_CMDLINE_EDITING */ - // /* @@ -959,46 +934,14 @@ int readline (const char *const prompt) return readline_into_buffer(prompt, console_buffer, 0); } - -int readline_into_buffer(const char *const prompt, char *buffer, int timeout) +static int simple_readline(const char *const prompt, int plen, char *p, + int timeout) { - char *p = buffer; -#ifdef CONFIG_CMDLINE_EDITING - unsigned int len = CONFIG_SYS_CBSIZE; - int rc; - static int initted = 0; - - /* -* History uses a global array which is not -* writable until after relocation to RAM. -* Revert to non-history version if still -* running from flash. -*/ - if (gd->flags & GD_FLG_RELOC) { - if (!initted) { - hist_init(); - initted = 1; - } - - if (prompt) - puts (prompt); - - rc = cread_line(prompt, p, &len, timeout); - return rc < 0 ? rc : len; - - }
Re: [U-Boot] [PATCH 0/11] sandbox: Add filesystem support
Hi, On Wed, Dec 26, 2012 at 11:53 AM, Simon Glass wrote: > This series adds support for filesystems to sandbox. While we don't yet have > access to host machine block devices, we can access files on the host through > a new 'host' filesystem type and the new sandbox command 'sb'. > > For example: > > sb load host 0 1000 foo.bar > > will load foo.bar from the host into memory at address 1000. The '0' > parameter is the device number, currently unused. > > While doing this work, I noticed that fs.c had code that probably belongs > more in the filesystems themselves. So this series moves fat/ext4 code into > those files. This removes most of the #ifdefs from this file, as well as > the #defines of functions to 'unsupported'. Now there is a list of > filesystems that we support, and if we don't find the one we need, we > automatically fall back to the 'unsupported' one. > > Finally, the ext4 write support is moved into a separate file since ext4fs.c > was over 3500 lines and the write support seems entirely separate from the > main function in that file. Are there any comments on this series please? It adds new methods to the filesystem interface, and a new 'host' filesystem type for sandbox. Regards, Simon > > > Simon Glass (11): > ext4: Split write support into its own file > fs: Fully populate the filesystem method struct > fs: Use filesystem methods instead of switch() > fs: Tell probe functions where to put their results > fs: Use map_sysmem() on read > fs: Move ls and read methods into ext4, fat > sandbox: Add a way of obtaining directory listings > sandbox: Add host filesystem > sandbox: Add 'sb' command to access filesystem features > sandbox: Enable ext4 and fat filesystems > sandbox: config: Enable sandbox command > > Makefile |1 + > README|1 + > arch/sandbox/cpu/os.c | 101 + > common/Makefile |1 + > common/cmd_sandbox.c | 63 +++ > disk/part.c | 17 + > fs/ext4/Makefile |2 +- > fs/ext4/ext4_write.c | 996 > + > fs/ext4/ext4fs.c | 962 +-- > fs/fat/fat.c | 17 + > fs/fs.c | 237 +--- > fs/sandbox/Makefile | 47 +++ > fs/sandbox/sandboxfs.c| 83 > include/config_cmd_all.h |1 + > include/configs/sandbox.h |9 + > include/ext4fs.h |3 + > include/fat.h |2 + > include/fs.h |1 + > include/os.h | 48 +++ > include/sandboxfs.h | 30 ++ > 20 files changed, 1533 insertions(+), 1089 deletions(-) > create mode 100644 common/cmd_sandbox.c > create mode 100644 fs/ext4/ext4_write.c > create mode 100644 fs/sandbox/Makefile > create mode 100644 fs/sandbox/sandboxfs.c > create mode 100644 include/sandboxfs.h > > -- > 1.7.7.3 > ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [RFC PATCH v2 06/15] main: Use autoconf for boot retry feature
Change this feature to use autoconf instead of #ifdef. Signed-off-by: Simon Glass --- Changes in v2: None common/main.c | 74 ++- 1 file changed, 33 insertions(+), 41 deletions(-) diff --git a/common/main.c b/common/main.c index 0df7992..c00c5bd 100644 --- a/common/main.c +++ b/common/main.c @@ -71,17 +71,11 @@ static char * delete_char (char *buffer, char *p, int *colp, int *np, int plen); static const char erase_seq[] = "\b \b"; /* erase sequence */ static const char tab_seq[] = "";/* used to expand TABs */ -#ifdef CONFIG_BOOT_RETRY_TIME static uint64_t endtime = 0; /* must be set, default is instant timeout */ static int retry_time = -1; /* -1 so can call readline before main_loop */ -#endif #defineendtick(seconds) (get_ticks() + (uint64_t)(seconds) * get_tbclk()) -#ifndef CONFIG_BOOT_RETRY_MIN -#define CONFIG_BOOT_RETRY_MIN CONFIG_BOOT_RETRY_TIME -#endif - #ifdef CONFIG_MODEM_SUPPORT int do_mdm_init = 0; extern void mdm_init(void); /* defined in board.c */ @@ -181,11 +175,10 @@ static int abortboot_keyed(int bootdelay) delaykey[i].retry ? "delay" : "stop"); # endif -# ifdef CONFIG_BOOT_RETRY_TIME - /* don't retry auto boot */ - if (! delaykey[i].retry) + /* don't retry auto boot? */ + if (autoconf_boot_retry_time() && + !delaykey[i].retry) retry_time = -1; -# endif abort = 1; } } @@ -374,9 +367,8 @@ static void process_boot_delay(void) #if defined(CONFIG_MENU_SHOW) bootdelay = menu_show(bootdelay); #endif -# ifdef CONFIG_BOOT_RETRY_TIME - init_cmd_timeout (); -# endif/* CONFIG_BOOT_RETRY_TIME */ + if (autoconf_boot_retry_time()) + init_cmd_timeout(); #ifdef CONFIG_POST if (gd->flags & GD_FLG_POSTFAIL) { @@ -509,14 +501,12 @@ void main_loop(void) for (;;); #else for (;;) { -#ifdef CONFIG_BOOT_RETRY_TIME - if (rc >= 0) { + if (autoconf_boot_retry_time() && rc >= 0) { /* Saw enough of a valid command to * restart the timeout. */ reset_cmd_timeout(); } -#endif len = readline (CONFIG_SYS_PROMPT); flag = 0; /* assume no special flags for now */ @@ -524,19 +514,16 @@ void main_loop(void) strcpy (lastcommand, console_buffer); else if (len == 0) flag |= CMD_FLAG_REPEAT; -#ifdef CONFIG_BOOT_RETRY_TIME - else if (len == -2) { + else if (autoconf_boot_retry_time() && len == -2) { /* -2 means timed out, retry autoboot */ - puts ("\nTimed out waiting for command\n"); -# ifdef CONFIG_RESET_TO_RETRY + puts("\nTimed out waiting for command\n"); /* Reinit board to run initialization code again */ - do_reset (NULL, 0, 0, NULL); -# else - return; /* retry autoboot */ -# endif + if (autoconf_reset_to_retry()) + do_reset(NULL, 0, 0, NULL); + else + return; /* retry autoboot */ } -#endif if (len == -1) puts ("\n"); @@ -551,6 +538,10 @@ void main_loop(void) #endif /*CONFIG_SYS_HUSH_PARSER*/ } +/* + * Use ifdef here for the benefit of those archs not using + * -ffunction-sections, since these functions are exported. + */ #ifdef CONFIG_BOOT_RETRY_TIME /*** * initialize command line timeout @@ -558,14 +549,15 @@ void main_loop(void) void init_cmd_timeout(void) { char *s = getenv ("bootretry"); + int retry_min; if (s != NULL) retry_time = (int)simple_strtol(s, NULL, 10); else - retry_time = CONFIG_BOOT_RETRY_TIME; + retry_time = autoconf_boot_retry_time(); - if (retry_time >= 0 && retry_time < CONFIG_BOOT_RETRY_MIN) - retry_time = CONFIG_BOOT_RETRY_MIN; + if (retry_time >= 0 retry_time < autoconf_boot_retry_min()) + retry_time = autoconf_boot_retry_min(); } /*** @@ -787,13 +779,13 @@ static int cread_line(const char *const prompt, char *buf, unsigned int *len, cread_add_str(buf, init_len, 1, &num, &eol_num, buf, *len);
[U-Boot] [RFC PATCH v2 13/15] main: Correct header order
The headers are a bit out of order, so fix them. Signed-off-by: Simon Glass --- Changes in v2: None common/main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/common/main.c b/common/main.c index 40a79b7..905d0c2 100644 --- a/common/main.c +++ b/common/main.c @@ -28,16 +28,15 @@ /* #define DEBUG */ #include -#include #include #include #include #include #include #include -#include - #include +#include +#include #include DECLARE_GLOBAL_DATA_PTR; -- 1.8.1.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [RFC PATCH v2 09/15] main: Use autoconf for boot_delay code
Convert this function and its children to use autoconf instead of #ifdef. Some header files must now be included unconditionally, so remove some of the #ifdefs from the header section, and put these header files into the right order. Signed-off-by: Simon Glass --- Changes in v2: None common/main.c | 104 +++-- include/menu.h | 2 -- 2 files changed, 41 insertions(+), 65 deletions(-) diff --git a/common/main.c b/common/main.c index 4f11e58..a5d3f82 100644 --- a/common/main.c +++ b/common/main.c @@ -31,27 +31,17 @@ #include #include #include +#include #include +#include #include -#ifdef CONFIG_MODEM_SUPPORT -#include /* for free() prototype */ -#endif #ifdef CONFIG_SYS_HUSH_PARSER #include #endif -#ifdef CONFIG_OF_CONTROL -#include -#endif - -#ifdef CONFIG_OF_LIBFDT -#include -#endif /* CONFIG_OF_LIBFDT */ - #include #include -#include DECLARE_GLOBAL_DATA_PTR; @@ -258,7 +248,6 @@ static int abortboot(int bootdelay) * printing the error message to console. */ -#ifdef CONFIG_OF_CONTROL static void secure_boot_cmd(char *cmd) { cmd_tbl_t *cmdtp; @@ -311,93 +300,82 @@ static void process_fdt_options(const void *blob) (void *)(autoconf_sys_text_base() + addr)); } } -#endif /* CONFIG_OF_CONTROL */ static void process_boot_delay(void) { -#ifdef CONFIG_BOOTCOUNT_LIMIT unsigned long bootcount = 0; unsigned long bootlimit = 0; -#endif /* CONFIG_BOOTCOUNT_LIMIT */ -#ifdef CONFIG_OF_CONTROL - char *env; -#endif - char *s; + const char *s; int bootdelay; -#ifdef CONFIG_BOOTCOUNT_LIMIT - bootcount = bootcount_load(); - bootcount++; - bootcount_store (bootcount); - setenv_ulong("bootcount", bootcount); - bootlimit = getenv_ulong("bootlimit", 10, 0); -#endif /* CONFIG_BOOTCOUNT_LIMIT */ + if (autoconf_bootcount_limit()) { + bootcount = bootcount_load(); + bootcount++; + bootcount_store(bootcount); + setenv_ulong("bootcount", bootcount); + bootlimit = getenv_ulong("bootlimit", 10, 0); + } s = getenv ("bootdelay"); bootdelay = s ? (int)simple_strtol(s, NULL, 10) : autoconf_bootdelay(); debug ("### main_loop entered: bootdelay=%d\n\n", bootdelay); -#if defined(CONFIG_MENU_SHOW) - bootdelay = menu_show(bootdelay); -#endif + if (autoconf_menu_show()) + bootdelay = menu_show(bootdelay); if (autoconf_boot_retry_time()) init_cmd_timeout(); -#ifdef CONFIG_POST - if (gd->flags & GD_FLG_POSTFAIL) { + if (autoconf_post() && (gd->flags & GD_FLG_POSTFAIL)) { s = getenv("failbootcmd"); - } - else -#endif /* CONFIG_POST */ -#ifdef CONFIG_BOOTCOUNT_LIMIT - if (bootlimit && (bootcount > bootlimit)) { + } else if (autoconf_bootcount_limit() && bootlimit && + (bootcount > bootlimit)) { printf ("Warning: Bootlimit (%u) exceeded. Using altbootcmd.\n", (unsigned)bootlimit); s = getenv ("altbootcmd"); - } - else -#endif /* CONFIG_BOOTCOUNT_LIMIT */ + } else { s = getenv ("bootcmd"); -#ifdef CONFIG_OF_CONTROL - /* Allow the fdt to override the boot command */ - env = fdtdec_get_config_string(gd->fdt_blob, "bootcmd"); - if (env) - s = env; + } + if (autoconf_of_control()) { + char *env; - process_fdt_options(gd->fdt_blob); + /* Allow the fdt to override the boot command */ + env = fdtdec_get_config_string(gd->fdt_blob, "bootcmd"); + if (env) + s = env; - /* -* If the bootsecure option was chosen, use secure_boot_cmd(). -* Always use 'env' in this case, since bootsecure requres that the -* bootcmd was specified in the FDT too. -*/ - if (fdtdec_get_config_int(gd->fdt_blob, "bootsecure", 0)) - secure_boot_cmd(env); + process_fdt_options(gd->fdt_blob); -#endif /* CONFIG_OF_CONTROL */ + /* + * If the bootsecure option was chosen, use secure_boot_cmd(). + * Always use 'env' in this case, since bootsecure requres that + * the bootcmd was specified in the FDT too. + */ + if (fdtdec_get_config_int(gd->fdt_blob, "bootsecure", 0)) + secure_boot_cmd(env); + } debug ("### main_loop: bootcmd=\"%s\"\n", s ? s : ""); if (bootdelay != -1 && s && !abortboot(bootdelay)) { -# ifdef CONFIG_AUTOBOOT_KEYED - int prev = disable_ctrlc(1);/* disable Control C checking */ -# endif + int prev; + + /* disable Control C checking */ + if
Re: [U-Boot] FDT howto
Hi Jagan, On Sun, Feb 24, 2013 at 8:19 AM, Jagan Teki wrote: > Hi Simon, > > Thanks for your response, please find my below comments. > > On Sun, Feb 24, 2013 at 9:24 PM, Simon Glass wrote: >> Hi Jagan, >> >> On Thu, Feb 21, 2013 at 9:03 AM, Jagan Teki wrote: >>> Hi All, >>> >>> I am planning to use devicetree on u-boot. >>> I have an experience to work with devicetree on Linux. >>> >>> For u-boot, I have read doc from doc/README.fdt-control. >>> I see some dts usages on tegra boards. >>> >>> I have lot of confusions with the concept itself. >>> >>> Is Linux and u-boot devicetree concept and build system are same? >> >> I don't really understand this question sorry. U-Boot and Linux use >> the device tree mainly for run-time configuration of drivers, so that >> the same driver code can operate on different boards. > > I am some how confusing the fdt usage in u-boot. > Because when compared to Linux, u-boot fdt setup mandatory to require > the CONFIG_DEFAULT_DEVICE_TREE > on the config file [from your previous comments]. > > is this the only difference when compared to Linux i guess..is it? > Linux defconfig file does need to hot-code > the dts. Yes - that is a difference. Linux provides a way to build .dts files but it is not mandatory. At present it is mandatory with U-Boot, and only one file is built. It can easily be ignored though. > >> >>> >>> Suppose I have 4 boards J1, J2, J3 & J4 on my soc "emb".of vendor "vast" >>>For this requirement I have >>>board/vast/dts/J1.dts >>>board/vast/dts/J2.dts >>>board/vast/dts/J3.dts >>>board/vast/dts/J4.dts >>> >>>include/configs/emb_common.h ==> single configuration of all SOC >>> needed definitions >>>like defconfig in Linux. >>> >>>do I need any more files? >> >> That's enough for the basics I think. > > Is dtsi file require to add it on arch folder along with above. If your architecture is not one of those already supported (like arm tegra/exynos and x86) then yes you need to add this file in arch//dts. What architecture are you using? > >> >>> >>>In emb_common.h i am defining >>>CONFIG_OF_SEPARATE is it sufficient? >> >> And CONFIG_OF_CONTROL >> >>> >>>My plan is to build u-boot and then build the dtb with specific >>> board and then combine. >> >> That's fine, and is how we do things on Chromium also. U-Boot tries to >> build an FDT even with CONFIG_OF_SEPARATE, so you need to put a >> default device tree file in your emb_common.h file that it can find. >> But you can ignore it, and for flashing your boards just use >> u-boot.bin plus whatever .dtb you want to select. > > So I will add the fdt support and then build the u-boot. > Is there any separate u-boot build command to build dts file. > My plan is to combine both u-boot and dtb. You can run dtc yourself if you like - see Makefile/dts for how it is done there. Once you have the .dtb binary, the easiest thing is to add it to the end of u-boot.bin, as described in README.fdt-control. > > Thanks, > Jagan. > >> >>> >>> I saw that all tegra boards config files are defining >>> CONFIG_DEFAULT_DEVICE_TREE if ie. the case dts is a compile time >>> option right. >>> am i correct? >> >> Yes - see above. This is convenient for testing and development. >> >>> >>> Please let me know your inputs. >> >> Regards, >> Simon >> >>> >>> -- >>> Thanks, >>> Jagan. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 12/20] common: Use new numeric setenv functions
Hi Tom, On Mon, Feb 18, 2013 at 2:08 PM, Tom Rini wrote: > On Wed, Dec 26, 2012 at 10:57:05AM -0800, Simon Glass wrote: > >> Use setenv_ulong(), setenv_hex() and setenv_addr() in common/ >> >> Signed-off-by: Simon Glass > [snip] >> diff --git a/common/cmd_fdos.c b/common/cmd_fdos.c >> index fbee861..5a35cc1 100644 >> --- a/common/cmd_fdos.c >> +++ b/common/cmd_fdos.c > [snip] >> @@ -91,8 +90,7 @@ int do_fdosboot(cmd_tbl_t *cmdtp, int flag, int argc, char >> * const argv[]) >> } >> flush_cache (load_addr, size); >> >> -sprintf(buf, "%x", size); >> -setenv("filesize", buf); >> + setenv_hex("filesize", size); > > Tab and space mixing in the function. I'll fix if git am > --whitespace=fix doesn't spot and fix. I'll change it back to spaces so that it is consistent, even if checkpatch is upset. There are now 5 patches changed so I will send out the whole series again. > > -- > Tom Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] FDT howto
Hi Jegan, On Sun, Feb 24, 2013 at 9:45 AM, Jagan Teki wrote: > Hi Simon, > > On Sun, Feb 24, 2013 at 11:08 PM, Simon Glass wrote: >> Hi Jagan, >> >> On Sun, Feb 24, 2013 at 8:19 AM, Jagan Teki wrote: >>> Hi Simon, >>> >>> Thanks for your response, please find my below comments. >>> >>> On Sun, Feb 24, 2013 at 9:24 PM, Simon Glass wrote: Hi Jagan, On Thu, Feb 21, 2013 at 9:03 AM, Jagan Teki wrote: > Hi All, > > I am planning to use devicetree on u-boot. > I have an experience to work with devicetree on Linux. > > For u-boot, I have read doc from doc/README.fdt-control. > I see some dts usages on tegra boards. > > I have lot of confusions with the concept itself. > > Is Linux and u-boot devicetree concept and build system are same? I don't really understand this question sorry. U-Boot and Linux use the device tree mainly for run-time configuration of drivers, so that the same driver code can operate on different boards. >>> >>> I am some how confusing the fdt usage in u-boot. >>> Because when compared to Linux, u-boot fdt setup mandatory to require >>> the CONFIG_DEFAULT_DEVICE_TREE >>> on the config file [from your previous comments]. >>> >>> is this the only difference when compared to Linux i guess..is it? >>> Linux defconfig file does need to hot-code >>> the dts. >> >> Yes - that is a difference. Linux provides a way to build .dts files >> but it is not mandatory. At present it is mandatory with U-Boot, and >> only one file is built. It can easily be ignored though. > > Ok. > >> >>> > > Suppose I have 4 boards J1, J2, J3 & J4 on my soc "emb".of vendor "vast" >For this requirement I have >board/vast/dts/J1.dts >board/vast/dts/J2.dts >board/vast/dts/J3.dts >board/vast/dts/J4.dts > >include/configs/emb_common.h ==> single configuration of all SOC > needed definitions >like defconfig in Linux. > >do I need any more files? That's enough for the basics I think. >>> >>> Is dtsi file require to add it on arch folder along with above. >> >> If your architecture is not one of those already supported (like arm >> tegra/exynos and x86) then yes you need to add this file in >> arch//dts. What architecture are you using? > > My architecture is armv7, may be for me dtsi not required as arm is > existing architecture > to support fdt on u-boot.. is it? Which sub-arch? If it is tegra/exynos5250 then you might be OK. For something else, you should get the kernel's .dtsi file for that chip. > >> >>> > >In emb_common.h i am defining >CONFIG_OF_SEPARATE is it sufficient? And CONFIG_OF_CONTROL > >My plan is to build u-boot and then build the dtb with specific > board and then combine. That's fine, and is how we do things on Chromium also. U-Boot tries to build an FDT even with CONFIG_OF_SEPARATE, so you need to put a default device tree file in your emb_common.h file that it can find. But you can ignore it, and for flashing your boards just use u-boot.bin plus whatever .dtb you want to select. >>> >>> So I will add the fdt support and then build the u-boot. >>> Is there any separate u-boot build command to build dts file. >>> My plan is to combine both u-boot and dtb. >> >> You can run dtc yourself if you like - see Makefile/dts for how it is >> done there. Once you have the .dtb binary, the easiest thing is to add >> it to the end of u-boot.bin, as described in README.fdt-control. > > Thanks, I tried with above setup for adding dts. > I have added simple dts file on my board. > > I got the below build error > /proj/mypc/u-boot/include/asm/gpio.h:1:27: fatal error: > asm/arch/gpio.h: No such file or directory > compilation terminated. > make[1]: *** No rule to make target `.depend.fdtdec', needed by > `.depend'. Stop. > > is gpio.h is mandatory for fdt build? Yes because basic GPIO support is included. You can create one for your sub-arch and make it #include as a starting point. Regards, Simon > > Thanks, > Jagan. > >> >>> >>> Thanks, >>> Jagan. >>> > > I saw that all tegra boards config files are defining > CONFIG_DEFAULT_DEVICE_TREE if ie. the case dts is a compile time > option right. > am i correct? Yes - see above. This is convenient for testing and development. > > Please let me know your inputs. Regards, Simon > > -- > Thanks, > Jagan. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] FDT howto
Hi Simon, On Sun, Feb 24, 2013 at 11:08 PM, Simon Glass wrote: > Hi Jagan, > > On Sun, Feb 24, 2013 at 8:19 AM, Jagan Teki wrote: >> Hi Simon, >> >> Thanks for your response, please find my below comments. >> >> On Sun, Feb 24, 2013 at 9:24 PM, Simon Glass wrote: >>> Hi Jagan, >>> >>> On Thu, Feb 21, 2013 at 9:03 AM, Jagan Teki >>> wrote: Hi All, I am planning to use devicetree on u-boot. I have an experience to work with devicetree on Linux. For u-boot, I have read doc from doc/README.fdt-control. I see some dts usages on tegra boards. I have lot of confusions with the concept itself. Is Linux and u-boot devicetree concept and build system are same? >>> >>> I don't really understand this question sorry. U-Boot and Linux use >>> the device tree mainly for run-time configuration of drivers, so that >>> the same driver code can operate on different boards. >> >> I am some how confusing the fdt usage in u-boot. >> Because when compared to Linux, u-boot fdt setup mandatory to require >> the CONFIG_DEFAULT_DEVICE_TREE >> on the config file [from your previous comments]. >> >> is this the only difference when compared to Linux i guess..is it? >> Linux defconfig file does need to hot-code >> the dts. > > Yes - that is a difference. Linux provides a way to build .dts files > but it is not mandatory. At present it is mandatory with U-Boot, and > only one file is built. It can easily be ignored though. Ok. > >> >>> Suppose I have 4 boards J1, J2, J3 & J4 on my soc "emb".of vendor "vast" For this requirement I have board/vast/dts/J1.dts board/vast/dts/J2.dts board/vast/dts/J3.dts board/vast/dts/J4.dts include/configs/emb_common.h ==> single configuration of all SOC needed definitions like defconfig in Linux. do I need any more files? >>> >>> That's enough for the basics I think. >> >> Is dtsi file require to add it on arch folder along with above. > > If your architecture is not one of those already supported (like arm > tegra/exynos and x86) then yes you need to add this file in > arch//dts. What architecture are you using? My architecture is armv7, may be for me dtsi not required as arm is existing architecture to support fdt on u-boot.. is it? > >> >>> In emb_common.h i am defining CONFIG_OF_SEPARATE is it sufficient? >>> >>> And CONFIG_OF_CONTROL >>> My plan is to build u-boot and then build the dtb with specific board and then combine. >>> >>> That's fine, and is how we do things on Chromium also. U-Boot tries to >>> build an FDT even with CONFIG_OF_SEPARATE, so you need to put a >>> default device tree file in your emb_common.h file that it can find. >>> But you can ignore it, and for flashing your boards just use >>> u-boot.bin plus whatever .dtb you want to select. >> >> So I will add the fdt support and then build the u-boot. >> Is there any separate u-boot build command to build dts file. >> My plan is to combine both u-boot and dtb. > > You can run dtc yourself if you like - see Makefile/dts for how it is > done there. Once you have the .dtb binary, the easiest thing is to add > it to the end of u-boot.bin, as described in README.fdt-control. Thanks, I tried with above setup for adding dts. I have added simple dts file on my board. I got the below build error /proj/mypc/u-boot/include/asm/gpio.h:1:27: fatal error: asm/arch/gpio.h: No such file or directory compilation terminated. make[1]: *** No rule to make target `.depend.fdtdec', needed by `.depend'. Stop. is gpio.h is mandatory for fdt build? Thanks, Jagan. > >> >> Thanks, >> Jagan. >> >>> I saw that all tegra boards config files are defining CONFIG_DEFAULT_DEVICE_TREE if ie. the case dts is a compile time option right. am i correct? >>> >>> Yes - see above. This is convenient for testing and development. >>> Please let me know your inputs. >>> >>> Regards, >>> Simon >>> -- Thanks, Jagan. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] FDT howto
Hi Simon, On Sun, Feb 24, 2013 at 11:18 PM, Simon Glass wrote: > Hi Jegan, > > On Sun, Feb 24, 2013 at 9:45 AM, Jagan Teki wrote: >> Hi Simon, >> >> On Sun, Feb 24, 2013 at 11:08 PM, Simon Glass wrote: >>> Hi Jagan, >>> >>> On Sun, Feb 24, 2013 at 8:19 AM, Jagan Teki >>> wrote: Hi Simon, Thanks for your response, please find my below comments. On Sun, Feb 24, 2013 at 9:24 PM, Simon Glass wrote: > Hi Jagan, > > On Thu, Feb 21, 2013 at 9:03 AM, Jagan Teki > wrote: >> Hi All, >> >> I am planning to use devicetree on u-boot. >> I have an experience to work with devicetree on Linux. >> >> For u-boot, I have read doc from doc/README.fdt-control. >> I see some dts usages on tegra boards. >> >> I have lot of confusions with the concept itself. >> >> Is Linux and u-boot devicetree concept and build system are same? > > I don't really understand this question sorry. U-Boot and Linux use > the device tree mainly for run-time configuration of drivers, so that > the same driver code can operate on different boards. I am some how confusing the fdt usage in u-boot. Because when compared to Linux, u-boot fdt setup mandatory to require the CONFIG_DEFAULT_DEVICE_TREE on the config file [from your previous comments]. is this the only difference when compared to Linux i guess..is it? Linux defconfig file does need to hot-code the dts. >>> >>> Yes - that is a difference. Linux provides a way to build .dts files >>> but it is not mandatory. At present it is mandatory with U-Boot, and >>> only one file is built. It can easily be ignored though. >> >> Ok. >> >>> > >> >> Suppose I have 4 boards J1, J2, J3 & J4 on my soc "emb".of vendor "vast" >>For this requirement I have >>board/vast/dts/J1.dts >>board/vast/dts/J2.dts >>board/vast/dts/J3.dts >>board/vast/dts/J4.dts >> >>include/configs/emb_common.h ==> single configuration of all SOC >> needed definitions >>like defconfig in Linux. >> >>do I need any more files? > > That's enough for the basics I think. Is dtsi file require to add it on arch folder along with above. >>> >>> If your architecture is not one of those already supported (like arm >>> tegra/exynos and x86) then yes you need to add this file in >>> arch//dts. What architecture are you using? >> >> My architecture is armv7, may be for me dtsi not required as arm is >> existing architecture >> to support fdt on u-boot.. is it? > > Which sub-arch? If it is tegra/exynos5250 then you might be OK. For > something else, you should get the kernel's .dtsi file for that chip. I am having armv7, xilinx zynq soc..but i coun't get any .dtsi on kernel source. may be I will create new one. > >> >>> > >> >>In emb_common.h i am defining >>CONFIG_OF_SEPARATE is it sufficient? > > And CONFIG_OF_CONTROL > >> >>My plan is to build u-boot and then build the dtb with specific >> board and then combine. > > That's fine, and is how we do things on Chromium also. U-Boot tries to > build an FDT even with CONFIG_OF_SEPARATE, so you need to put a > default device tree file in your emb_common.h file that it can find. > But you can ignore it, and for flashing your boards just use > u-boot.bin plus whatever .dtb you want to select. So I will add the fdt support and then build the u-boot. Is there any separate u-boot build command to build dts file. My plan is to combine both u-boot and dtb. >>> >>> You can run dtc yourself if you like - see Makefile/dts for how it is >>> done there. Once you have the .dtb binary, the easiest thing is to add >>> it to the end of u-boot.bin, as described in README.fdt-control. >> >> Thanks, I tried with above setup for adding dts. >> I have added simple dts file on my board. >> >> I got the below build error >> /proj/mypc/u-boot/include/asm/gpio.h:1:27: fatal error: >> asm/arch/gpio.h: No such file or directory >> compilation terminated. >> make[1]: *** No rule to make target `.depend.fdtdec', needed by >> `.depend'. Stop. >> >> is gpio.h is mandatory for fdt build? > > Yes because basic GPIO support is included. You can create one for > your sub-arch and make it #include as a starting > point. > Should I create an empty gpio.h file..it still asking some gpio definitions right.. Thanks, Jagan. > Regards, > Simon > >> >> Thanks, >> Jagan. >> >>> Thanks, Jagan. > >> >> I saw that all tegra boards config files are defining >> CONFIG_DEFAULT_DEVICE_TREE if ie. the case dts is a compile time >> option right. >> am i correct? > > Yes - see above. This is convenient for testing and development. > >> >> Please let me know your inputs. > > Regards, > Simon > >> >> -- >> T
[U-Boot] [RFC PATCH v2 0/15] Provide a mechanism to avoid using #ifdef everywhere
Many parts of the U-Boot code base are sprinkled with #ifdefs. This makes different boards compile different versions of the source code, meaning that we must build all boards to check for failures. It is easy to misspell an #ifdef and there is not as much checking of this by the compiler. Multiple dependent #ifdefs are harder to do than with if..then..else. Variable declarations must be #idefed as well as the code that uses them, often much later in the file/function. #ifdef indents don't match code indents and have their own separate indent feature. Overall, excessive use of #idef hurts readability and makes the code harder to modify and refactor. For people coming newly into the code base, #ifdefs can be a big barrier. The use of #ifdef in U-Boot has possibly got a little out of hand. In an attempt to turn the tide, this series includes a patch which provides a way to make CONFIG macros available to C code without using the preprocessor. This makes it possible to use standard C conditional features such as if/then instead of #ifdef. A README update exhorts compliance. As an example of how to use this, this series replaces all but two #ifdefs from the main code body of common/main.c, which has the dubious distinction of having the most #ifdefs by at least one measure: $ for f in $(find . -name *.c); do echo $(grep -c "ifdef" $f) $f; done \ |sort -nr |head 57 ./common/main.c 57 ./arch/powerpc/cpu/mpc83xx/cpu_init.c 48 ./arch/powerpc/lib/board.c 46 ./drivers/video/cfb_console.c 40 ./drivers/mtd/cfi_flash.c 38 ./net/tftp.c 38 ./common/cmd_bootm.c 37 ./drivers/usb/host/ohci-hcd.c 36 ./drivers/fpga/ivm_core.c 35 ./drivers/usb/gadget/ether.c Code size for this patch seems to be roughly neutral (below numbers are average change in byte size for each region: x86: (3 boards) text -1.3 data +1.3 sandbox: (1 boards) bss +16.0 m68k: (50 boards) text -4.2 powerpc: (622 boards) text +9.1 data +0.0 bss +1.9 sh: (21 boards) bss +2.5 nios2: (3 boards) text +24.0 data -1.3 bss +1.3 arm: (285 boards) spl/u-boot-spl:text +0.4 text -2.3 bss +5.5 nds32: (3 boards) text -29.3 bss +10.7 Note that a config_drop.h file is added - this defines all the CONFIGs which are not used in any board config file. Without this, autoconf cannot define the macros for this CONFIGs. Compile time for main.c does not seem to be any different in my tests. The time to perform the 'dep' step (which now creates autoconf.h) increases, from about 2.8s to about 4.6s. This additional time is used to grep, sed and sort the contents of all the header file in U-Boot. The time for an incremental build is not affected. It would be much more efficient to maintain a list of all available CONFIG defines, but no such list exists at present. Changes in v2: - Split out changes to main.c into separate patches - Fix up a few errors and comments in the original RFC - Use autoconf_...() instead of config_...() - Use autoconf_has_...() instead of config_..._enabled() - Add a grep to the sed/sort pipe to speed up processing Simon Glass (15): Implement autoconf header file at91: Correct CONFIG_AUTOBOOT_PROMPT definition for pm9263 net: Add prototype for update_tftp, and use autoconf main: Separate out the two abortboot() functions main: Move boot_delay code into its own function main: Use autoconf for boot retry feature main: Remove CONFIG #ifdefs from the abortboot() code main: Use get/setenv_ulong() main: Use autoconf for boot_delay code main: Use autoconf for parser selection main: Use autoconf in command line reading main: Use autoconf in main_loop() main: Correct header order main: Add debug_parser() to avoid #ifdefs main: Add debug_bootkeys to avoid #ifdefs Makefile | 42 ++- README| 87 - common/cmd_fitupd.c | 3 +- common/main.c | 809 ++ common/update.c | 24 +- include/command.h | 2 - include/common.h | 9 +- include/config_drop.h | 17 + include/configs/pm9263.h | 2 +- include/fdt_support.h | 4 +- include/hush.h| 2 - include/menu.h| 2 - include/net.h | 3 + tools/scripts/define2conf.sed | 37 ++ tools/scripts/define2list.sed | 31 ++ 15 files changed, 579 insertions(+), 495 deletions(-) create mode 100644 include/config_drop.h create mode 100644 tools/scripts/define2conf.sed create mode 100644 tools/scripts/define2list.sed -- 1.8.1.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] FDT howto
Hi, On Sun, Feb 24, 2013 at 9:55 AM, Jagan Teki wrote: > Hi Simon, > > On Sun, Feb 24, 2013 at 11:18 PM, Simon Glass wrote: >> Hi Jegan, >> >> On Sun, Feb 24, 2013 at 9:45 AM, Jagan Teki wrote: >>> Hi Simon, >>> >>> On Sun, Feb 24, 2013 at 11:08 PM, Simon Glass wrote: Hi Jagan, On Sun, Feb 24, 2013 at 8:19 AM, Jagan Teki wrote: > Hi Simon, > > Thanks for your response, please find my below comments. > > On Sun, Feb 24, 2013 at 9:24 PM, Simon Glass wrote: >> Hi Jagan, >> >> On Thu, Feb 21, 2013 at 9:03 AM, Jagan Teki >> wrote: >>> Hi All, >>> >>> I am planning to use devicetree on u-boot. >>> I have an experience to work with devicetree on Linux. >>> >>> For u-boot, I have read doc from doc/README.fdt-control. >>> I see some dts usages on tegra boards. >>> >>> I have lot of confusions with the concept itself. >>> >>> Is Linux and u-boot devicetree concept and build system are same? >> >> I don't really understand this question sorry. U-Boot and Linux use >> the device tree mainly for run-time configuration of drivers, so that >> the same driver code can operate on different boards. > > I am some how confusing the fdt usage in u-boot. > Because when compared to Linux, u-boot fdt setup mandatory to require > the CONFIG_DEFAULT_DEVICE_TREE > on the config file [from your previous comments]. > > is this the only difference when compared to Linux i guess..is it? > Linux defconfig file does need to hot-code > the dts. Yes - that is a difference. Linux provides a way to build .dts files but it is not mandatory. At present it is mandatory with U-Boot, and only one file is built. It can easily be ignored though. >>> >>> Ok. >>> > >> >>> >>> Suppose I have 4 boards J1, J2, J3 & J4 on my soc "emb".of vendor "vast" >>>For this requirement I have >>>board/vast/dts/J1.dts >>>board/vast/dts/J2.dts >>>board/vast/dts/J3.dts >>>board/vast/dts/J4.dts >>> >>>include/configs/emb_common.h ==> single configuration of all SOC >>> needed definitions >>>like defconfig in Linux. >>> >>>do I need any more files? >> >> That's enough for the basics I think. > > Is dtsi file require to add it on arch folder along with above. If your architecture is not one of those already supported (like arm tegra/exynos and x86) then yes you need to add this file in arch//dts. What architecture are you using? >>> >>> My architecture is armv7, may be for me dtsi not required as arm is >>> existing architecture >>> to support fdt on u-boot.. is it? >> >> Which sub-arch? If it is tegra/exynos5250 then you might be OK. For >> something else, you should get the kernel's .dtsi file for that chip. > > I am having armv7, xilinx zynq soc..but i coun't get any .dtsi on kernel > source. > may be I will create new one. OK, well if the kernel doesn't have FDT support yet then yes you will need to create a new one. > >> >>> > >> >>> >>>In emb_common.h i am defining >>>CONFIG_OF_SEPARATE is it sufficient? >> >> And CONFIG_OF_CONTROL >> >>> >>>My plan is to build u-boot and then build the dtb with specific >>> board and then combine. >> >> That's fine, and is how we do things on Chromium also. U-Boot tries to >> build an FDT even with CONFIG_OF_SEPARATE, so you need to put a >> default device tree file in your emb_common.h file that it can find. >> But you can ignore it, and for flashing your boards just use >> u-boot.bin plus whatever .dtb you want to select. > > So I will add the fdt support and then build the u-boot. > Is there any separate u-boot build command to build dts file. > My plan is to combine both u-boot and dtb. You can run dtc yourself if you like - see Makefile/dts for how it is done there. Once you have the .dtb binary, the easiest thing is to add it to the end of u-boot.bin, as described in README.fdt-control. >>> >>> Thanks, I tried with above setup for adding dts. >>> I have added simple dts file on my board. >>> >>> I got the below build error >>> /proj/mypc/u-boot/include/asm/gpio.h:1:27: fatal error: >>> asm/arch/gpio.h: No such file or directory >>> compilation terminated. >>> make[1]: *** No rule to make target `.depend.fdtdec', needed by >>> `.depend'. Stop. >>> >>> is gpio.h is mandatory for fdt build? >> >> Yes because basic GPIO support is included. You can create one for >> your sub-arch and make it #include as a starting >> point. >> > > Should I create an empty gpio.h file..it still asking some gpio > definitions right.. It might be OK if you just have "#include " in that file. Regads, Simon [snip] ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.d
Re: [U-Boot] FDT howto
Hi Simon, On Sun, Feb 24, 2013 at 11:50 PM, Simon Glass wrote: > Hi, > > On Sun, Feb 24, 2013 at 9:55 AM, Jagan Teki wrote: >> Hi Simon, >> >> On Sun, Feb 24, 2013 at 11:18 PM, Simon Glass wrote: >>> Hi Jegan, >>> >>> On Sun, Feb 24, 2013 at 9:45 AM, Jagan Teki >>> wrote: Hi Simon, On Sun, Feb 24, 2013 at 11:08 PM, Simon Glass wrote: > Hi Jagan, > > On Sun, Feb 24, 2013 at 8:19 AM, Jagan Teki > wrote: >> Hi Simon, >> >> Thanks for your response, please find my below comments. >> >> On Sun, Feb 24, 2013 at 9:24 PM, Simon Glass wrote: >>> Hi Jagan, >>> >>> On Thu, Feb 21, 2013 at 9:03 AM, Jagan Teki >>> wrote: Hi All, I am planning to use devicetree on u-boot. I have an experience to work with devicetree on Linux. For u-boot, I have read doc from doc/README.fdt-control. I see some dts usages on tegra boards. I have lot of confusions with the concept itself. Is Linux and u-boot devicetree concept and build system are same? >>> >>> I don't really understand this question sorry. U-Boot and Linux use >>> the device tree mainly for run-time configuration of drivers, so that >>> the same driver code can operate on different boards. >> >> I am some how confusing the fdt usage in u-boot. >> Because when compared to Linux, u-boot fdt setup mandatory to require >> the CONFIG_DEFAULT_DEVICE_TREE >> on the config file [from your previous comments]. >> >> is this the only difference when compared to Linux i guess..is it? >> Linux defconfig file does need to hot-code >> the dts. > > Yes - that is a difference. Linux provides a way to build .dts files > but it is not mandatory. At present it is mandatory with U-Boot, and > only one file is built. It can easily be ignored though. Ok. > >> >>> Suppose I have 4 boards J1, J2, J3 & J4 on my soc "emb".of vendor "vast" For this requirement I have board/vast/dts/J1.dts board/vast/dts/J2.dts board/vast/dts/J3.dts board/vast/dts/J4.dts include/configs/emb_common.h ==> single configuration of all SOC needed definitions like defconfig in Linux. do I need any more files? >>> >>> That's enough for the basics I think. >> >> Is dtsi file require to add it on arch folder along with above. > > If your architecture is not one of those already supported (like arm > tegra/exynos and x86) then yes you need to add this file in > arch//dts. What architecture are you using? My architecture is armv7, may be for me dtsi not required as arm is existing architecture to support fdt on u-boot.. is it? >>> >>> Which sub-arch? If it is tegra/exynos5250 then you might be OK. For >>> something else, you should get the kernel's .dtsi file for that chip. >> >> I am having armv7, xilinx zynq soc..but i coun't get any .dtsi on kernel >> source. >> may be I will create new one. > > OK, well if the kernel doesn't have FDT support yet then yes you will > need to create a new one. > >> >>> > >> >>> In emb_common.h i am defining CONFIG_OF_SEPARATE is it sufficient? >>> >>> And CONFIG_OF_CONTROL >>> My plan is to build u-boot and then build the dtb with specific board and then combine. >>> >>> That's fine, and is how we do things on Chromium also. U-Boot tries to >>> build an FDT even with CONFIG_OF_SEPARATE, so you need to put a >>> default device tree file in your emb_common.h file that it can find. >>> But you can ignore it, and for flashing your boards just use >>> u-boot.bin plus whatever .dtb you want to select. >> >> So I will add the fdt support and then build the u-boot. >> Is there any separate u-boot build command to build dts file. >> My plan is to combine both u-boot and dtb. > > You can run dtc yourself if you like - see Makefile/dts for how it is > done there. Once you have the .dtb binary, the easiest thing is to add > it to the end of u-boot.bin, as described in README.fdt-control. Thanks, I tried with above setup for adding dts. I have added simple dts file on my board. I got the below build error /proj/mypc/u-boot/include/asm/gpio.h:1:27: fatal error: asm/arch/gpio.h: No such file or directory compilation terminated. make[1]: *** No rule to make target `.depend.fdtdec', needed by `.depend'. Stop. is gpio.h is mandatory for fdt build? >>> >>> Yes because basic GPIO support is included. You can create one for >>> your sub-arch and make it #include as a starting >>> point. >>> >> >> Should I create an empty gpio.h file..it sti
Re: [U-Boot] FDT howto
Hi Simon, On Sun, Feb 24, 2013 at 11:55 PM, Jagan Teki wrote: > Hi Simon, > > On Sun, Feb 24, 2013 at 11:50 PM, Simon Glass wrote: >> Hi, >> >> On Sun, Feb 24, 2013 at 9:55 AM, Jagan Teki wrote: >>> Hi Simon, >>> >>> On Sun, Feb 24, 2013 at 11:18 PM, Simon Glass wrote: Hi Jegan, On Sun, Feb 24, 2013 at 9:45 AM, Jagan Teki wrote: > Hi Simon, > > On Sun, Feb 24, 2013 at 11:08 PM, Simon Glass wrote: >> Hi Jagan, >> >> On Sun, Feb 24, 2013 at 8:19 AM, Jagan Teki >> wrote: >>> Hi Simon, >>> >>> Thanks for your response, please find my below comments. >>> >>> On Sun, Feb 24, 2013 at 9:24 PM, Simon Glass wrote: Hi Jagan, On Thu, Feb 21, 2013 at 9:03 AM, Jagan Teki wrote: > Hi All, > > I am planning to use devicetree on u-boot. > I have an experience to work with devicetree on Linux. > > For u-boot, I have read doc from doc/README.fdt-control. > I see some dts usages on tegra boards. > > I have lot of confusions with the concept itself. > > Is Linux and u-boot devicetree concept and build system are same? I don't really understand this question sorry. U-Boot and Linux use the device tree mainly for run-time configuration of drivers, so that the same driver code can operate on different boards. >>> >>> I am some how confusing the fdt usage in u-boot. >>> Because when compared to Linux, u-boot fdt setup mandatory to require >>> the CONFIG_DEFAULT_DEVICE_TREE >>> on the config file [from your previous comments]. >>> >>> is this the only difference when compared to Linux i guess..is it? >>> Linux defconfig file does need to hot-code >>> the dts. >> >> Yes - that is a difference. Linux provides a way to build .dts files >> but it is not mandatory. At present it is mandatory with U-Boot, and >> only one file is built. It can easily be ignored though. > > Ok. > >> >>> > > Suppose I have 4 boards J1, J2, J3 & J4 on my soc "emb".of vendor > "vast" >For this requirement I have >board/vast/dts/J1.dts >board/vast/dts/J2.dts >board/vast/dts/J3.dts >board/vast/dts/J4.dts > >include/configs/emb_common.h ==> single configuration of all SOC > needed definitions >like defconfig in Linux. > >do I need any more files? That's enough for the basics I think. >>> >>> Is dtsi file require to add it on arch folder along with above. >> >> If your architecture is not one of those already supported (like arm >> tegra/exynos and x86) then yes you need to add this file in >> arch//dts. What architecture are you using? > > My architecture is armv7, may be for me dtsi not required as arm is > existing architecture > to support fdt on u-boot.. is it? Which sub-arch? If it is tegra/exynos5250 then you might be OK. For something else, you should get the kernel's .dtsi file for that chip. >>> >>> I am having armv7, xilinx zynq soc..but i coun't get any .dtsi on kernel >>> source. >>> may be I will create new one. >> >> OK, well if the kernel doesn't have FDT support yet then yes you will >> need to create a new one. >> >>> > >> >>> > >In emb_common.h i am defining >CONFIG_OF_SEPARATE is it sufficient? And CONFIG_OF_CONTROL > >My plan is to build u-boot and then build the dtb with specific > board and then combine. That's fine, and is how we do things on Chromium also. U-Boot tries to build an FDT even with CONFIG_OF_SEPARATE, so you need to put a default device tree file in your emb_common.h file that it can find. But you can ignore it, and for flashing your boards just use u-boot.bin plus whatever .dtb you want to select. >>> >>> So I will add the fdt support and then build the u-boot. >>> Is there any separate u-boot build command to build dts file. >>> My plan is to combine both u-boot and dtb. >> >> You can run dtc yourself if you like - see Makefile/dts for how it is >> done there. Once you have the .dtb binary, the easiest thing is to add >> it to the end of u-boot.bin, as described in README.fdt-control. > > Thanks, I tried with above setup for adding dts. > I have added simple dts file on my board. > > I got the below build error > /proj/mypc/u-boot/include/asm/gpio.h:1:27: fatal error: > asm/arch/gpio.h: No such file or directory > compilation terminated. > make[1]: *** No rule to make target `.depend.fdtdec', needed by > `.depend'. Stop. > > is gpio.h is mandatory fo
[U-Boot] [PATCH v3] mxs: timrot: Add support to i.MX23
From: Fadil Berisha This patch add timer support to i.MX23 and complete bit fields and values on regs-timrot.h. Testet on imx23-olinuxino board. Signed-off-by: Fadil Berisha --- v2 - Updated the struct mxs_timrot_regs so the mapping works for all registers v3 - Revert macro MX28_INCREMENTER_HZ, MX28_HW_DIGCTL_MICROSECONDS and fix whitespaces arch/arm/cpu/arm926ejs/mxs/timer.c | 23 +- arch/arm/include/asm/arch-mxs/regs-timrot.h | 101 +++ 2 files changed, 122 insertions(+), 2 deletions(-) diff --git a/arch/arm/cpu/arm926ejs/mxs/timer.c b/arch/arm/cpu/arm926ejs/mxs/timer.c index 4ed75e6..f41ad1c 100644 --- a/arch/arm/cpu/arm926ejs/mxs/timer.c +++ b/arch/arm/cpu/arm926ejs/mxs/timer.c @@ -32,7 +32,11 @@ #include /* Maximum fixed count */ -#define TIMER_LOAD_VAL 0x +#if defined(CONFIG_MX23) +#define TIMER_LOAD_VAL 0x +#elif defined(CONFIG_MX28) +#define TIMER_LOAD_VAL 0x +#endif DECLARE_GLOBAL_DATA_PTR; @@ -69,7 +73,11 @@ int timer_init(void) mxs_reset_block(&timrot_regs->hw_timrot_rotctrl_reg); /* Set fixed_count to 0 */ +#if defined(CONFIG_MX23) + writel(0, &timrot_regs->hw_timrot_timcount0); +#elif defined(CONFIG_MX28) writel(0, &timrot_regs->hw_timrot_fixed_count0); +#endif /* Set UPDATE bit and 1Khz frequency */ writel(TIMROT_TIMCTRLn_UPDATE | TIMROT_TIMCTRLn_RELOAD | @@ -77,7 +85,11 @@ int timer_init(void) &timrot_regs->hw_timrot_timctrl0); /* Set fixed_count to maximal value */ +#if defined(CONFIG_MX23) + writel(TIMER_LOAD_VAL-1, &timrot_regs->hw_timrot_timcount0); +#elif defined(CONFIG_MX28) writel(TIMER_LOAD_VAL, &timrot_regs->hw_timrot_fixed_count0); +#endif return 0; } @@ -86,9 +98,16 @@ unsigned long long get_ticks(void) { struct mxs_timrot_regs *timrot_regs = (struct mxs_timrot_regs *)MXS_TIMROT_BASE; + uint32_t now; /* Current tick value */ - uint32_t now = readl(&timrot_regs->hw_timrot_running_count0); +#if defined(CONFIG_MX23) + /* upper bits are the valid */ + now = readl(&timrot_regs->hw_timrot_timcount0) >> + TIMROT_RUNNING_COUNTn_RUNNING_COUNT_OFFSET; +#elif defined(CONFIG_MX28) + now = readl(&timrot_regs->hw_timrot_running_count0); +#endif if (lastdec >= now) { /* diff --git a/arch/arm/include/asm/arch-mxs/regs-timrot.h b/arch/arm/include/asm/arch-mxs/regs-timrot.h index 529a3bc..f8537f1 100644 --- a/arch/arm/include/asm/arch-mxs/regs-timrot.h +++ b/arch/arm/include/asm/arch-mxs/regs-timrot.h @@ -31,6 +31,16 @@ struct mxs_timrot_regs { mxs_reg_32(hw_timrot_rotctrl) mxs_reg_32(hw_timrot_rotcount) +#if defined(CONFIG_MX23) + mxs_reg_32(hw_timrot_timctrl0) + mxs_reg_32(hw_timrot_timcount0) + mxs_reg_32(hw_timrot_timctrl1) + mxs_reg_32(hw_timrot_timcount1) + mxs_reg_32(hw_timrot_timctrl2) + mxs_reg_32(hw_timrot_timcount2) + mxs_reg_32(hw_timrot_timctrl3) + mxs_reg_32(hw_timrot_timcount3) +#elif defined(CONFIG_MX28) mxs_reg_32(hw_timrot_timctrl0) mxs_reg_32(hw_timrot_running_count0) mxs_reg_32(hw_timrot_fixed_count0) @@ -47,6 +57,7 @@ struct mxs_timrot_regs { mxs_reg_32(hw_timrot_running_count3) mxs_reg_32(hw_timrot_fixed_count3) mxs_reg_32(hw_timrot_match_count3) +#endif mxs_reg_32(hw_timrot_version) }; #endif @@ -71,7 +82,11 @@ struct mxs_timrot_regs { #defineTIMROT_ROTCTRL_OVERSAMPLE_1X(0x3 << 10) #defineTIMROT_ROTCTRL_POLARITY_B (1 << 9) #defineTIMROT_ROTCTRL_POLARITY_A (1 << 8) +#if defined(CONFIG_MX23) +#defineTIMROT_ROTCTRL_SELECT_B_MASK(0x7 << 4) +#elif defined(CONFIG_MX28) #defineTIMROT_ROTCTRL_SELECT_B_MASK(0xf << 4) +#endif #defineTIMROT_ROTCTRL_SELECT_B_OFFSET 4 #defineTIMROT_ROTCTRL_SELECT_B_NEVER_TICK (0x0 << 4) #defineTIMROT_ROTCTRL_SELECT_B_PWM0(0x1 << 4) @@ -79,12 +94,21 @@ struct mxs_timrot_regs { #defineTIMROT_ROTCTRL_SELECT_B_PWM2(0x3 << 4) #defineTIMROT_ROTCTRL_SELECT_B_PWM3(0x4 << 4) #defineTIMROT_ROTCTRL_SELECT_B_PWM4(0x5 << 4) +#if defined(CONFIG_MX23) +#defineTIMROT_ROTCTRL_SELECT_B_ROTARYA (0x6 << 4) +#defineTIMROT_ROTCTRL_SELECT_B_ROTARYB (0x7 << 4) +#elif defined(CONFIG_MX28) #defineTIMROT_ROTCTRL_SELECT_B_PWM5(0x6 << 4) #defineTIMROT_ROTCTRL_SELECT_B_PWM6(0x7 << 4) #defineTIMROT_ROTCTRL_SELECT_B_PWM7(0x8 << 4) #defineTIMROT_ROTCTRL_SELECT_B_ROTARYA (0x9 << 4) #defineTIMROT_ROTCTRL_SELECT_B_ROTARYB
Re: [U-Boot] [RFC PATCH v2 02/15] at91: Correct CONFIG_AUTOBOOT_PROMPT definition for pm9263
Hi Simon, On Sun, Feb 24, 2013 at 11:26 AM, Simon Glass wrote: > This is not currently used, since autoboot is not enabled for this > board, but the string is missing a parameter. Add it. > Why not enable autoboot for this board so that this setting gets testing? > > Signed-off-by: Simon Glass > --- > Changes in v2: None > > include/configs/pm9263.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/configs/pm9263.h b/include/configs/pm9263.h > index b60a9ad..6f6ddfa 100644 > --- a/include/configs/pm9263.h > +++ b/include/configs/pm9263.h > @@ -355,7 +355,7 @@ > > #define CONFIG_BOOTCOMMAND "run flashboot" > #define CONFIG_ROOTPATH"/ronetix/rootfs" > -#define CONFIG_AUTOBOOT_PROMPT "autoboot in %d seconds\n" > +#define CONFIG_AUTOBOOT_PROMPT "autoboot in %d seconds\n", bootdelay > > #define CONFIG_CON_ROT "fbcon=rotate:3 " > #define CONFIG_BOOTARGS"root=/dev/mtdblock4 > rootfstype=jffs2 "\ > -- > 1.8.1.3 > > ___ > U-Boot mailing list > U-Boot@lists.denx.de > http://lists.denx.de/mailman/listinfo/u-boot ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [RFC PATCH v2 01/15] Implement autoconf header file
Hi Simon, On Sun, Feb 24, 2013 at 11:25 AM, Simon Glass wrote: > Add support for generating an autoconf.h header file that can be used in > the source instead of #ifdef. > > For example, instead of: > > #ifdef CONFIG_VERSION_VARIABLE > setenv("ver", version_string); /* set version variable */ > #endif > > you can do: > > if (autoconf_version_variable()) > setenv("ver", version_string); /* set version variable */ You are changing the meaning between these two examples. The old code was #ifDEF, which means the new example needs to be autoconf_HAS_*. Is there a reason to muddy the waters by recommending people use this automatic value of 0 instead of using the "has" function? Any more than without this patch we should go change most all the #ifdef to #if? > The compiler will ensure that the dead code is eliminated, so the result > is the same. > > Where the value of the CONFIG define is 0, you can use the autoconf_has...() > form. For example CONFIG_BOOTDELAY can be -ve, 0 or +ve, but if it is > defined at all, it affects behaviour: > > #if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) > s = getenv ("bootdelay"); > #endif > > So we use: > > if (autoconf_has_bootdelay() && autoconf_bootdelay() >= 0) > s = getenv ("bootdelay"); > > This later form should only be used for such 'difficult' defines where a > zero value still means that the CONFIG should be considered to be defined. > > Signed-off-by: Simon Glass > --- > Changes in v2: > - Split out changes to main.c into separate patches > - Fix up a few errors and comments in the original RFC > - Use autoconf_...() instead of config_...() > - Use autoconf_has_...() instead of config_..._enabled() > - Add a grep to the sed/sort pipe to speed up processing > > Makefile | 42 - > README| 87 > +-- > include/common.h | 3 ++ > include/config_drop.h | 17 + > tools/scripts/define2conf.sed | 37 ++ > tools/scripts/define2list.sed | 31 +++ > 6 files changed, 213 insertions(+), 4 deletions(-) > create mode 100644 include/config_drop.h > create mode 100644 tools/scripts/define2conf.sed > create mode 100644 tools/scripts/define2list.sed > > diff --git a/Makefile b/Makefile > index fc18dd4..9f4f55d 100644 > --- a/Makefile > +++ b/Makefile > @@ -614,6 +614,7 @@ updater: > # parallel sub-makes creating .depend files simultaneously. > depend dep:$(TIMESTAMP_FILE) $(VERSION_FILE) \ > $(obj)include/autoconf.mk \ > + $(obj)include/generated/autoconf.h \ > $(obj)include/generated/generic-asm-offsets.h \ > $(obj)include/generated/asm-offsets.h > for dir in $(SUBDIRS) $(CPUDIR) $(LDSCRIPT_MAKEFILE_DIR) ; do > \ > @@ -688,6 +689,44 @@ $(obj)include/autoconf.mk: $(obj)include/config.h > sed -n -f tools/scripts/define2mk.sed > $@.tmp && \ > mv $@.tmp $@ > > +# Create a C header file where every '#define CONFIG_XXX value' becomes > +# '#define config_xxx() value', or '#define config_xxx() 0' where the CONFIG > +# is not used by this board configuration. This allows C code to do things > +# like 'if (config_xxx())' and have the compiler remove the dead code, > +# instead of using '#ifdef CONFIG_XXX...#endif'. Note that in most cases > +# if the config_...() returns 0 then the option is not enabled. In some rare > +# cases such as CONFIG_BOOTDELAY, the config can be enabled but still have a > +# a value of 0. So in addition we a #define config_xxx_enabled(), setting the You forgot to update this comment when changing to autoconf_has. Grep perhaps? > +# value to 0 if the option is disabled, 1 if enabled. This last feature will > +# hopefully be deprecated soon. > +# The file is regenerated when any U-Boot header file changes. > +$(obj)include/generated/autoconf.h: $(obj)include/config.h > + @$(XECHO) Generating $@ ; \ > + set -e ; \ > + : Extract the config macros to a C header file ; \ > + $(CPP) $(CFLAGS) -DDO_DEPS_ONLY -dM include/common.h | \ > + sed -n -f tools/scripts/define2conf.sed > $@.tmp; \ > + : Regenerate our list of all config macros if neeed ; \ > + if [ ! -f $@-all.tmp ] || \ > + find $(src) -name '*.h' -type f -newer $@-all.tmp | \ > + egrep -qv 'include/(autoconf.h|generated|config.h)'; \ > + then \ > + : Extract all config macros from all C header files ; \ > + : We can grep for CONFIG since the value will be dropped ; \ > + ( \ > + find ${src} -name "*.h" -type f | xargs \ > + cat | grep CONFIG | \ > + sed -n -f tools/scripts/define2list.sed \ > + ) | sort | uniq > $@-all.tmp; \ > +
Re: [U-Boot] [PATCH 1/2] lcd: implement a callback for splashimage
Dear Nikita Kiryanov, In message <1361722763-22953-2-git-send-email-nik...@compulab.co.il> you wrote: > On some architectures certain values of splashimage will lead to > a data abort exception. > > Document the problem, and implement a callback for splashimage to > reject such values. > > Cc: Anatolij Gustschin > Cc: Wolfgang Denk > Signed-off-by: Nikita Kiryanov > Acked-by: Igor Grinberg > --- > > README | 11 +++ > common/lcd.c | 26 ++ > doc/README.displaying-bmps | 27 +++ > include/env_callback.h |7 +++ > 4 files changed, 71 insertions(+) > create mode 100644 doc/README.displaying-bmps Thanks. Acked-by: Wolfgang Denk Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de God made the integers; all else is the work of Man. - Kronecker ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [RFC PATCH v2 03/15] net: Add prototype for update_tftp, and use autoconf
Hi Simon, On Sun, Feb 24, 2013 at 11:26 AM, Simon Glass wrote: > This function should be declared in net.h. At the same time, let's use > autoconf insteaf of #ifdef for its inclusion. > > Signed-off-by: Simon Glass > --- > Changes in v2: None > > common/cmd_fitupd.c | 3 +-- > common/main.c | 9 ++--- > common/update.c | 24 > include/net.h | 3 +++ > 4 files changed, 14 insertions(+), 25 deletions(-) > > diff --git a/common/cmd_fitupd.c b/common/cmd_fitupd.c > index 7a3789e..618ff7c 100644 > --- a/common/cmd_fitupd.c > +++ b/common/cmd_fitupd.c > @@ -8,13 +8,12 @@ > > #include > #include > +#include > > #if !defined(CONFIG_UPDATE_TFTP) > #error "CONFIG_UPDATE_TFTP required" > #endif > > -extern int update_tftp(ulong addr); > - > static int do_fitupd(cmd_tbl_t *cmdtp, int flag, int argc, char * const > argv[]) > { > ulong addr = 0UL; > diff --git a/common/main.c b/common/main.c > index e2d2e09..2b8af2c 100644 > --- a/common/main.c > +++ b/common/main.c > @@ -61,10 +61,6 @@ DECLARE_GLOBAL_DATA_PTR; > void inline __show_boot_progress (int val) {} > void show_boot_progress (int val) __attribute__((weak, > alias("__show_boot_progress"))); > > -#if defined(CONFIG_UPDATE_TFTP) > -int update_tftp (ulong addr); > -#endif /* CONFIG_UPDATE_TFTP */ > - > #define MAX_DELAY_STOP_STR 32 > > #undef DEBUG_PARSER > @@ -427,9 +423,8 @@ void main_loop (void) > } > #endif /* CONFIG_PREBOOT */ > > -#if defined(CONFIG_UPDATE_TFTP) > - update_tftp (0UL); > -#endif /* CONFIG_UPDATE_TFTP */ > + if (autoconf_update_tftp()) Shouldn't you be using the _has version here? > + update_tftp(0UL); > > #if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) > s = getenv ("bootdelay"); > diff --git a/common/update.c b/common/update.c > index 94d6a82..9cd9ca2 100644 > --- a/common/update.c > +++ b/common/update.c > @@ -43,19 +43,6 @@ > /* env variable holding the location of the update file */ > #define UPDATE_FILE_ENV"updatefile" > > -/* set configuration defaults if needed */ > -#ifndef CONFIG_UPDATE_LOAD_ADDR > -#define CONFIG_UPDATE_LOAD_ADDR0x10 > -#endif > - > -#ifndef CONFIG_UPDATE_TFTP_MSEC_MAX > -#define CONFIG_UPDATE_TFTP_MSEC_MAX100 > -#endif > - > -#ifndef CONFIG_UPDATE_TFTP_CNT_MAX > -#define CONFIG_UPDATE_TFTP_CNT_MAX 0 > -#endif > - > extern ulong TftpRRQTimeoutMSecs; > extern int TftpRRQTimeoutCountMax; > extern flash_info_t flash_info[]; > @@ -244,6 +231,7 @@ int update_tftp(ulong addr) > char *filename, *env_addr; > int images_noffset, ndepth, noffset; > ulong update_addr, update_fladdr, update_size; > + int msec_max; > void *fit; > int ret = 0; > > @@ -266,12 +254,16 @@ int update_tftp(ulong addr) > /* get load address of downloaded update file */ > if ((env_addr = getenv("loadaddr")) != NULL) > addr = simple_strtoul(env_addr, NULL, 16); > + else if (autoconf_has_update_load_addr()) > + addr = autoconf_update_load_addr(); > else > - addr = CONFIG_UPDATE_LOAD_ADDR; > + addr = 0x10; > > + msec_max = autoconf_has_update_tftp_msec_max() ? > + autoconf_update_tftp_msec_max() : 100; > > - if (update_load(filename, CONFIG_UPDATE_TFTP_MSEC_MAX, > - CONFIG_UPDATE_TFTP_CNT_MAX, addr)) { > + if (update_load(filename, msec_max, autoconf_update_tftp_cnt_max(), > + addr)) { Sneaky using autoconf_update_tftp_cnt_max() to default to 0. > printf("Can't load update file, aborting auto-update\n"); > return 1; > } > diff --git a/include/net.h b/include/net.h > index 970d4d1..23fb947 100644 > --- a/include/net.h > +++ b/include/net.h > @@ -695,6 +695,9 @@ extern void copy_filename(char *dst, const char *src, int > size); > /* get a random source port */ > extern unsigned int random_port(void); > > +/* Update U-Boot over TFTP */ > +extern int update_tftp(ulong addr); > + > /**/ > > #endif /* __NET_H__ */ > -- > 1.8.1.3 Acked-by: Joe Hershberger ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [RFC PATCH v2 04/15] main: Separate out the two abortboot() functions
Hi Simon, On Sun, Feb 24, 2013 at 11:26 AM, Simon Glass wrote: > There are two implementations of autoboot(). Turn these into two separate > functions, and create a single autoboot() which calls either one or the > other. > > Also it seems that nothing uses autoboot() outside main, so make it static. You say "autoboot" in this change log, but I think you mean to say "abortboot". > > Signed-off-by: Simon Glass > --- > Changes in v2: None > > common/main.c| 22 ++ > include/common.h | 3 --- > 2 files changed, 10 insertions(+), 15 deletions(-) > > diff --git a/common/main.c b/common/main.c > index 2b8af2c..1e12e55 100644 > --- a/common/main.c > +++ b/common/main.c > @@ -92,11 +92,7 @@ extern void mdm_init(void); /* defined in board.c */ > * returns: 0 - no key string, allow autoboot 1 - got key string, abort > */ > #if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) > -# if defined(CONFIG_AUTOBOOT_KEYED) > -#ifndef CONFIG_MENU > -static inline > -#endif > -int abortboot(int bootdelay) > +static int abortboot_keyed(int bootdelay) > { > int abort = 0; > uint64_t etime = endtick(bootdelay); > @@ -209,16 +205,11 @@ int abortboot(int bootdelay) > return abort; > } > > -# else /* !defined(CONFIG_AUTOBOOT_KEYED) */ > - > #ifdef CONFIG_MENUKEY > static int menukey = 0; > #endif > > -#ifndef CONFIG_MENU > -static inline > -#endif > -int abortboot(int bootdelay) > +static int abortboot_normal(int bootdelay) > { > int abort = 0; > unsigned long ts; > @@ -274,7 +265,14 @@ int abortboot(int bootdelay) > > return abort; > } > -# endif/* CONFIG_AUTOBOOT_KEYED */ > + > +static int abortboot(int bootdelay) > +{ > + if (autoconf_autoboot_keyed()) > + return abortboot_keyed(bootdelay); > + else > + return abortboot_normal(bootdelay); > +} > #endif /* CONFIG_BOOTDELAY >= 0 */ > > /* > diff --git a/include/common.h b/include/common.h > index 491783b..fb219fd 100644 > --- a/include/common.h > +++ b/include/common.h > @@ -297,9 +297,6 @@ int readline_into_buffer(const char *const prompt, char > *buffer, > intparse_line (char *, char *[]); > void init_cmd_timeout(void); > void reset_cmd_timeout(void); > -#ifdef CONFIG_MENU > -intabortboot(int bootdelay); > -#endif Is CONFIG_MENU gone at this point? Does it no longer reference abortboot()? > extern char console_buffer[]; > > /* arch/$(ARCH)/lib/board.c */ > -- > 1.8.1.3 > > ___ > U-Boot mailing list > U-Boot@lists.denx.de > http://lists.denx.de/mailman/listinfo/u-boot Reviewed-by: Joe Hershberger ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [RFC PATCH v2 05/15] main: Move boot_delay code into its own function
HI Simon, On Sun, Feb 24, 2013 at 11:26 AM, Simon Glass wrote: > Move this code into its own function, since it clutters up main_loop(). > > Signed-off-by: Simon Glass > --- > Changes in v2: None > > common/main.c | 155 > ++ > 1 file changed, 79 insertions(+), 76 deletions(-) > > diff --git a/common/main.c b/common/main.c > index 1e12e55..0df7992 100644 > --- a/common/main.c > +++ b/common/main.c > @@ -91,7 +91,6 @@ extern void mdm_init(void); /* defined in board.c */ > * Watch for 'delay' seconds for autoboot stop or autoboot delay string. > * returns: 0 - no key string, allow autoboot 1 - got key string, abort > */ > -#if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) > static int abortboot_keyed(int bootdelay) > { > int abort = 0; > @@ -273,7 +272,6 @@ static int abortboot(int bootdelay) > else > return abortboot_normal(bootdelay); > } > -#endif /* CONFIG_BOOTDELAY >= 0 */ > > /* > * Runs the given boot command securely. Specifically: > @@ -289,8 +287,7 @@ static int abortboot(int bootdelay) > * printing the error message to console. > */ > > -#if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) && \ > - defined(CONFIG_OF_CONTROL) > +#ifdef CONFIG_OF_CONTROL > static void secure_boot_cmd(char *cmd) > { > cmd_tbl_t *cmdtp; > @@ -331,46 +328,33 @@ static void process_fdt_options(const void *blob) > > /* Add an env variable to point to a kernel payload, if available */ > addr = fdtdec_get_config_int(gd->fdt_blob, "kernel-offset", 0); > - if (addr) > - setenv_addr("kernaddr", (void *)(CONFIG_SYS_TEXT_BASE + > addr)); > + if (addr) { > + setenv_addr("kernaddr", > + (void *)(autoconf_sys_text_base() + addr)); > + } > > /* Add an env variable to point to a root disk, if available */ > addr = fdtdec_get_config_int(gd->fdt_blob, "rootdisk-offset", 0); > - if (addr) > - setenv_addr("rootaddr", (void *)(CONFIG_SYS_TEXT_BASE + > addr)); > + if (addr) { > + setenv_addr("rootaddr", > + (void *)(autoconf_sys_text_base() + addr)); > + } > } > #endif /* CONFIG_OF_CONTROL */ > > - > -// > - > -void main_loop (void) > +static void process_boot_delay(void) > { > -#ifndef CONFIG_SYS_HUSH_PARSER > - static char lastcommand[CONFIG_SYS_CBSIZE] = { 0, }; > - int len; > - int rc = 1; > - int flag; > -#endif > -#if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) && \ > - defined(CONFIG_OF_CONTROL) > - char *env; > -#endif > -#if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) > - char *s; > - int bootdelay; > -#endif > -#ifdef CONFIG_PREBOOT > - char *p; > -#endif > #ifdef CONFIG_BOOTCOUNT_LIMIT > unsigned long bootcount = 0; > unsigned long bootlimit = 0; > char *bcs; > char bcs_set[16]; > #endif /* CONFIG_BOOTCOUNT_LIMIT */ > - > - bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, "main_loop"); > +#ifdef CONFIG_OF_CONTROL > + char *env; > +#endif > + char *s; > + int bootdelay; > > #ifdef CONFIG_BOOTCOUNT_LIMIT > bootcount = bootcount_load(); > @@ -382,51 +366,8 @@ void main_loop (void) > bootlimit = bcs ? simple_strtoul (bcs, NULL, 10) : 0; > #endif /* CONFIG_BOOTCOUNT_LIMIT */ > > -#ifdef CONFIG_MODEM_SUPPORT > - debug ("DEBUG: main_loop: do_mdm_init=%d\n", do_mdm_init); > - if (do_mdm_init) { > - char *str = strdup(getenv("mdm_cmd")); > - setenv ("preboot", str); /* set or delete definition */ > - if (str != NULL) > - free (str); > - mdm_init(); /* wait for modem connection */ > - } > -#endif /* CONFIG_MODEM_SUPPORT */ > - > -#ifdef CONFIG_VERSION_VARIABLE > - { > - setenv ("ver", version_string); /* set version variable */ > - } > -#endif /* CONFIG_VERSION_VARIABLE */ > - > -#ifdef CONFIG_SYS_HUSH_PARSER > - u_boot_hush_start (); > -#endif > - > -#if defined(CONFIG_HUSH_INIT_VAR) > - hush_init_var (); > -#endif > - > -#ifdef CONFIG_PREBOOT > - if ((p = getenv ("preboot")) != NULL) { > -# ifdef CONFIG_AUTOBOOT_KEYED > - int prev = disable_ctrlc(1);/* disable Control C checking > */ > -# endif > - > - run_command_list(p, -1, 0); > - > -# ifdef CONFIG_AUTOBOOT_KEYED > - disable_ctrlc(prev);/* restore Control C checking */ > -# endif > - } > -#endif /* CONFIG_PREBOOT */ > - > - if (autoconf_update_tftp()) > - update_tftp(0UL); > - > -#if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) > s = getenv ("bootdelay"); > - bootdelay = s ? (int)simple_strtol(s, NULL, 10)
Re: [U-Boot] [RFC PATCH v2 06/15] main: Use autoconf for boot retry feature
Hi Simon, On Sun, Feb 24, 2013 at 11:26 AM, Simon Glass wrote: > Change this feature to use autoconf instead of #ifdef. > > Signed-off-by: Simon Glass > --- > Changes in v2: None > > common/main.c | 74 > ++- > 1 file changed, 33 insertions(+), 41 deletions(-) > Reviewed-by: Joe Hershberger ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [RFC PATCH v2 07/15] main: Remove CONFIG #ifdefs from the abortboot() code
Hi Simon, On Sun, Feb 24, 2013 at 11:26 AM, Simon Glass wrote: > Move this code over to using autoconf. We can add the autoconf values to > the delaykey[] array, and move the code that checks for autoconf values into > the loop. > > Also change to using ARRAY_SIZE on delaykey[]. > > Signed-off-by: Simon Glass > --- > Changes in v2: None > > common/main.c | 86 > ++- > 1 file changed, 32 insertions(+), 54 deletions(-) > Reviewed-by: Joe Hershberger ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [RFC PATCH v2 08/15] main: Use get/setenv_ulong()
Hi Simon. On Sun, Feb 24, 2013 at 11:26 AM, Simon Glass wrote: > These functions are now available, so use them to avoid extra code here. > > Signed-off-by: Simon Glass > --- > Changes in v2: None > > common/main.c | 8 ++-- > 1 file changed, 2 insertions(+), 6 deletions(-) > Reviewed-by: Joe Hershberger ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [RFC PATCH v2 09/15] main: Use autoconf for boot_delay code
Hi Simon, On Sun, Feb 24, 2013 at 11:26 AM, Simon Glass wrote: > Convert this function and its children to use autoconf instead of #ifdef. > > Some header files must now be included unconditionally, so remove some of > the #ifdefs from the header section, and put these header files into the > right order. > > Signed-off-by: Simon Glass > --- > Changes in v2: None > > common/main.c | 104 > +++-- > include/menu.h | 2 -- > 2 files changed, 41 insertions(+), 65 deletions(-) > > diff --git a/common/main.c b/common/main.c > index 4f11e58..a5d3f82 100644 > --- a/common/main.c > +++ b/common/main.c > @@ -31,27 +31,17 @@ > #include > #include > #include > +#include > #include > +#include > #include > -#ifdef CONFIG_MODEM_SUPPORT > -#include /* for free() prototype */ > -#endif > > #ifdef CONFIG_SYS_HUSH_PARSER > #include > #endif > > -#ifdef CONFIG_OF_CONTROL > -#include > -#endif > - > -#ifdef CONFIG_OF_LIBFDT > -#include > -#endif /* CONFIG_OF_LIBFDT */ > - > #include > #include > -#include > > DECLARE_GLOBAL_DATA_PTR; > > @@ -258,7 +248,6 @@ static int abortboot(int bootdelay) > * printing the error message to console. > */ > > -#ifdef CONFIG_OF_CONTROL > static void secure_boot_cmd(char *cmd) > { > cmd_tbl_t *cmdtp; > @@ -311,93 +300,82 @@ static void process_fdt_options(const void *blob) > (void *)(autoconf_sys_text_base() + addr)); > } > } > -#endif /* CONFIG_OF_CONTROL */ > > static void process_boot_delay(void) > { > -#ifdef CONFIG_BOOTCOUNT_LIMIT > unsigned long bootcount = 0; > unsigned long bootlimit = 0; > -#endif /* CONFIG_BOOTCOUNT_LIMIT */ > -#ifdef CONFIG_OF_CONTROL > - char *env; > -#endif > - char *s; > + const char *s; > int bootdelay; > > -#ifdef CONFIG_BOOTCOUNT_LIMIT > - bootcount = bootcount_load(); > - bootcount++; > - bootcount_store (bootcount); > - setenv_ulong("bootcount", bootcount); > - bootlimit = getenv_ulong("bootlimit", 10, 0); > -#endif /* CONFIG_BOOTCOUNT_LIMIT */ > + if (autoconf_bootcount_limit()) { > + bootcount = bootcount_load(); > + bootcount++; > + bootcount_store(bootcount); > + setenv_ulong("bootcount", bootcount); > + bootlimit = getenv_ulong("bootlimit", 10, 0); > + } > > s = getenv ("bootdelay"); > bootdelay = s ? (int)simple_strtol(s, NULL, 10) : > autoconf_bootdelay(); This would look a lot nicer as: bootdelay = getenv_ulong_def("bootdelay", autoconf_bootdelay()); > > debug ("### main_loop entered: bootdelay=%d\n\n", bootdelay); > > -#if defined(CONFIG_MENU_SHOW) > - bootdelay = menu_show(bootdelay); > -#endif > + if (autoconf_menu_show()) > + bootdelay = menu_show(bootdelay); > if (autoconf_boot_retry_time()) > init_cmd_timeout(); > > -#ifdef CONFIG_POST > - if (gd->flags & GD_FLG_POSTFAIL) { > + if (autoconf_post() && (gd->flags & GD_FLG_POSTFAIL)) { > s = getenv("failbootcmd"); > - } > - else > -#endif /* CONFIG_POST */ > -#ifdef CONFIG_BOOTCOUNT_LIMIT > - if (bootlimit && (bootcount > bootlimit)) { > + } else if (autoconf_bootcount_limit() && bootlimit && > + (bootcount > bootlimit)) { > printf ("Warning: Bootlimit (%u) exceeded. Using > altbootcmd.\n", > (unsigned)bootlimit); > s = getenv ("altbootcmd"); > - } > - else > -#endif /* CONFIG_BOOTCOUNT_LIMIT */ > + } else { > s = getenv ("bootcmd"); > -#ifdef CONFIG_OF_CONTROL > - /* Allow the fdt to override the boot command */ > - env = fdtdec_get_config_string(gd->fdt_blob, "bootcmd"); > - if (env) > - s = env; > + } > + if (autoconf_of_control()) { > + char *env; > > - process_fdt_options(gd->fdt_blob); > + /* Allow the fdt to override the boot command */ > + env = fdtdec_get_config_string(gd->fdt_blob, "bootcmd"); > + if (env) > + s = env; > > - /* > -* If the bootsecure option was chosen, use secure_boot_cmd(). > -* Always use 'env' in this case, since bootsecure requres that the > -* bootcmd was specified in the FDT too. > -*/ > - if (fdtdec_get_config_int(gd->fdt_blob, "bootsecure", 0)) > - secure_boot_cmd(env); > + process_fdt_options(gd->fdt_blob); > > -#endif /* CONFIG_OF_CONTROL */ > + /* > + * If the bootsecure option was chosen, use secure_boot_cmd(). > + * Always use 'env' in this case, since bootsecure requres that > + * the bootcmd was specified in the FDT too. > + */ > + if (fdtd
Re: [U-Boot] [RFC PATCH v2 10/15] main: Use autoconf for parser selection
Hi Simon, On Sun, Feb 24, 2013 at 11:26 AM, Simon Glass wrote: > Allow parser selection to make use of autoconf instead of #ifdefs. This > requires us to make header includes unconditional, but this is simpler > anyway. > > Signed-off-by: Simon Glass > --- > Changes in v2: None > > common/main.c | 92 > +++--- > include/hush.h | 2 -- > 2 files changed, 42 insertions(+), 52 deletions(-) > > diff --git a/common/main.c b/common/main.c > index a5d3f82..e1483db 100644 > --- a/common/main.c > +++ b/common/main.c > @@ -32,14 +32,11 @@ > #include > #include > #include > +#include > #include > #include > #include > > -#ifdef CONFIG_SYS_HUSH_PARSER > -#include > -#endif > - > #include > #include > > @@ -382,12 +379,10 @@ static void process_boot_delay(void) > > void main_loop(void) > { > -#ifndef CONFIG_SYS_HUSH_PARSER > static char lastcommand[CONFIG_SYS_CBSIZE] = { 0, }; > int len; > int rc = 1; > int flag; > -#endif > #ifdef CONFIG_PREBOOT > char *p; > #endif > @@ -447,12 +442,11 @@ void main_loop(void) > /* > * Main Loop for Monitor Command Processing > */ > -#ifdef CONFIG_SYS_HUSH_PARSER > - parse_file_outer(); > - /* This point is never reached */ > - for (;;); > -#else > - for (;;) { > + if (autoconf_sys_hush_parser()) { > + parse_file_outer(); > + /* This point is never reached */ > + for (;;); > + } else { > if (autoconf_boot_retry_time() && rc >= 0) { > /* Saw enough of a valid command to > * restart the timeout. > @@ -487,7 +481,6 @@ void main_loop(void) > lastcommand[0] = 0; > } > } > -#endif /*CONFIG_SYS_HUSH_PARSER*/ > } > > /* > @@ -1186,7 +1179,6 @@ int parse_line (char *line, char *argv[]) > > > // > > -#ifndef CONFIG_SYS_HUSH_PARSER > static void process_macros (const char *input, char *output) > { > char c, prev; > @@ -1402,7 +1394,6 @@ static int builtin_run_command(const char *cmd, int > flag) > > return rc ? rc : repeatable; > } > -#endif > > /* > * Run a command using the selected parser. > @@ -1413,22 +1404,21 @@ static int builtin_run_command(const char *cmd, int > flag) > */ > int run_command(const char *cmd, int flag) > { > -#ifndef CONFIG_SYS_HUSH_PARSER > - /* > -* builtin_run_command can return 0 or 1 for success, so clean up > -* its result. > -*/ > - if (builtin_run_command(cmd, flag) == -1) > - return 1; > - > - return 0; > -#else > - return parse_string_outer(cmd, > + if (autoconf_sys_hush_parser()) { > + return parse_string_outer(cmd, > FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP); > -#endif > + } else { > + /* > + * builtin_run_command can return 0 or 1 for success, so > + * clean up its result. > + */ > + if (builtin_run_command(cmd, flag) == -1) > + return 1; > + > + return 0; > + } > } > > -#ifndef CONFIG_SYS_HUSH_PARSER > /** > * Execute a list of command separated by ; or \n using the built-in parser. > * > @@ -1469,7 +1459,6 @@ static int builtin_run_command_list(char *cmd, int flag) > > return rcode; > } > -#endif > > int run_command_list(const char *cmd, int len, int flag) > { > @@ -1479,13 +1468,16 @@ int run_command_list(const char *cmd, int len, int > flag) > > if (len == -1) { > len = strlen(cmd); > -#ifdef CONFIG_SYS_HUSH_PARSER > - /* hush will never change our string */ > - need_buff = 0; > -#else > - /* the built-in parser will change our string if it sees \n */ > - need_buff = strchr(cmd, '\n') != NULL; > -#endif > + if (autoconf_sys_hush_parser()) { > + /* hush will never change our string */ > + need_buff = 0; > + } else { > + /* > +* the built-in parser will change our string if it > +* sees \n > +*/ > + need_buff = strchr(cmd, '\n') != NULL; > + } > } > if (need_buff) { > buff = malloc(len + 1); > @@ -1494,20 +1486,20 @@ int run_command_list(const char *cmd, int len, int > flag) > memcpy(buff, cmd, len); > buff[len] = '\0'; > } > -#ifdef CONFIG_SYS_HUSH_PARSER > - rcode = parse_string_outer(buff, FLAG_PARSE_SEMICOLON); > -#else > - /* > -* This function will overwrite any \n it sees with a \0, which > -* is wh
Re: [U-Boot] [PATCH 12/20] common: Use new numeric setenv functions
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 02/24/2013 12:45 PM, Simon Glass wrote: > Hi Tom, > > On Mon, Feb 18, 2013 at 2:08 PM, Tom Rini wrote: >> On Wed, Dec 26, 2012 at 10:57:05AM -0800, Simon Glass wrote: >> >>> Use setenv_ulong(), setenv_hex() and setenv_addr() in common/ >>> >>> Signed-off-by: Simon Glass >> [snip] >>> diff --git a/common/cmd_fdos.c b/common/cmd_fdos.c index >>> fbee861..5a35cc1 100644 --- a/common/cmd_fdos.c +++ >>> b/common/cmd_fdos.c >> [snip] >>> @@ -91,8 +90,7 @@ int do_fdosboot(cmd_tbl_t *cmdtp, int flag, >>> int argc, char * const argv[]) } flush_cache (load_addr, >>> size); >>> >>> -sprintf(buf, "%x", size); -setenv("filesize", buf); + >>> setenv_hex("filesize", size); >> >> Tab and space mixing in the function. I'll fix if git am >> --whitespace=fix doesn't spot and fix. > > I'll change it back to spaces so that it is consistent, even if > checkpatch is upset. There are now 5 patches changed so I will send > out the whole series again. Right, we should always be consistent with the file. From my read of the series, this was the only one where the file used spaces and the new insert was tabs, that's what I'm getting at. I guess the others didn't stick out as obviously? - -- Tom -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBAgAGBQJRKn3kAAoJENk4IS6UOR1WV5gP/Ro7jY8wwUV0O4UMYuFidIVG 9SsElNnJoFaoO+qske9MAR6YknpJNb0hu10ZSZWoA+Db1gGeHMwAydG/F8eYJOad IE26MJVzzSbjmsQx7UJcRKNPfDLKWcZDUMtDC+2YAjT8PvUDRkOqHKqLc/WxcawM ytsw7o+6lf7GWYABjjEdJkRqd4kd+lq+l6sQoBk0qqQkergjP4+Si3BN3h77ZupV 8hTA7idf3/6ezKjHB3jyMl5kSFrgEPPdhrRNlaYAFriYKpDIwINHEWAYXgQpAtWW YSA0CQBKZMVE9liMWy3ZWDFslcfk0i72H3m2IP1kNsyRRx0wuekkUlVONc9AQoVe x3aSnw3LDt0b3SaGhoMLwVKoL6ZI6IKUfAvJNh/tmc/vNbrDmrot2z8mPd4ccKp4 AfrhlpH4KE8eU6zsVpsVWJ85LHaIBu/5SvW73UFLCDZwwnUUIKCj4A903cweCuoG i8VrY11OliR/yABz+NRRek7Y8pyBMqq40ES4lZJYrcKXwi0k3OwAraCrA73IZeg3 d50ME2WTBQ+tR0cFfp8BZxTVYxrTpHA2diOHL7rdFRfAlii3Wt6Ee9Zbb+ozir6q TKfxVqJYmHpTYiEt6CuYpq6GD+wQnWbAYkZw5DbmEeq65UUid/UUPcLhDhEinmg6 wbo0UcLD2TLRqc9IS9fX =lxH4 -END PGP SIGNATURE- ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [RFC PATCH v2 11/15] main: Use autoconf in command line reading
Hi Simon, On Sun, Feb 24, 2013 at 11:26 AM, Simon Glass wrote: > Remove #ifdefs in favour of autoconf for this code. This involves removing > a few unnecessary #ifdefs in headers also. > > We have two versions of the code - one that handles command line editing and > one that is just a simple implementation. Create a new function called > readline_into_buffer() which calls either cread_line() or the new > simple_readline(), created to hold the 'simple' code. > > The cread_print_hist_list() function is not actually used anywhere, so punt > it. > > Signed-off-by: Simon Glass > --- > Changes in v2: None > > common/main.c | 186 > -- > include/command.h | 2 - > include/common.h | 2 - > 3 files changed, 84 insertions(+), 106 deletions(-) > > diff --git a/common/main.c b/common/main.c > index e1483db..3966321 100644 > --- a/common/main.c > +++ b/common/main.c > @@ -514,8 +514,6 @@ void reset_cmd_timeout(void) > } > #endif > > -#ifdef CONFIG_CMDLINE_EDITING > - > /* > * cmdline-editing related codes from vivi. > * Author: Janghoon Lyu > @@ -618,27 +616,6 @@ static char* hist_next(void) > return (ret); > } > > -#ifndef CONFIG_CMDLINE_EDITING > -static void cread_print_hist_list(void) > -{ > - int i; > - unsigned long n; > - > - n = hist_num - hist_max; > - > - i = hist_add_idx + 1; > - while (1) { > - if (i > hist_max) > - i = 0; > - if (i == hist_add_idx) > - break; > - printf("%s\n", hist_list[i]); > - n++; > - i++; > - } > -} > -#endif /* CONFIG_CMDLINE_EDITING */ > - > #define BEGINNING_OF_LINE() { \ > while (num) { \ > getcmd_putch(CTL_BACKSPACE);\ > @@ -900,27 +877,27 @@ static int cread_line(const char *const prompt, char > *buf, unsigned int *len, > REFRESH_TO_EOL(); > continue; > } > -#ifdef CONFIG_AUTO_COMPLETE > - case '\t': { > - int num2, col; > + case '\t': > + if (autoconf_auto_complete()) { > + int num2, col; > > - /* do not autocomplete when in the middle */ > - if (num < eol_num) { > - getcmd_cbeep(); > - break; > - } > + /* do not autocomplete when in the middle */ > + if (num < eol_num) { > + getcmd_cbeep(); > + break; > + } > > - buf[num] = '\0'; > - col = strlen(prompt) + eol_num; > - num2 = num; > - if (cmd_auto_complete(prompt, buf, &num2, &col)) { > - col = num2 - num; > - num += col; > - eol_num += col; > + buf[num] = '\0'; > + col = strlen(prompt) + eol_num; > + num2 = num; > + if (cmd_auto_complete(prompt, buf, &num2, > + &col)) { > + col = num2 - num; > + num += col; > + eol_num += col; > + } > + break; > } > - break; > - } > -#endif > default: > cread_add_char(ichar, insert, &num, &eol_num, buf, > *len); > break; > @@ -936,8 +913,6 @@ static int cread_line(const char *const prompt, char > *buf, unsigned int *len, > return 0; > } > > -#endif /* CONFIG_CMDLINE_EDITING */ > - > > // > > /* > @@ -959,46 +934,14 @@ int readline (const char *const prompt) > return readline_into_buffer(prompt, console_buffer, 0); > } > > - > -int readline_into_buffer(const char *const prompt, char *buffer, int timeout) > +static int simple_readline(const char *const prompt, int plen, char *p, > + int timeout) > { > - char *p = buffer; > -#ifdef CONFIG_CMDLINE_EDITING > - unsigned int len = CONFIG_SYS_CBSIZE; > - int rc; > - static int initted = 0; > - > - /* > -* History uses a global array which is not > -* writable until after relocation to RAM. > -* Revert to non-history version if still > -* running from flash. > -*/ > - if (g
Re: [U-Boot] [RFC PATCH v2 12/15] main: Use autoconf in main_loop()
Hi Simon, On Sun, Feb 24, 2013 at 11:26 AM, Simon Glass wrote: > Convert main_loop() over to use autoconf, and add a required prototype > to common.h. > > The do_mdm_init variable is now always defined, but this seems like an > acceptable compromise. > > In fdt_support.h the #ifdef used is CONFIG_OF_LIBFDT. However, even if > this is not defined we want to make the functions available for our > conditional-compilation scheme. The only place where we really don't > have access to these support functions is when USE_HOSTCC is defined. > So change the #ifdef to that. > > Signed-off-by: Simon Glass > --- > Changes in v2: None > > common/main.c | 77 > +++ > include/common.h | 1 + > include/fdt_support.h | 4 +-- > 3 files changed, 37 insertions(+), 45 deletions(-) > > diff --git a/common/main.c b/common/main.c > index 3966321..40a79b7 100644 > --- a/common/main.c > +++ b/common/main.c > @@ -63,10 +63,7 @@ static int retry_time = -1; /* -1 so can call > readline before main_loop */ > > #defineendtick(seconds) (get_ticks() + (uint64_t)(seconds) * > get_tbclk()) > > -#ifdef CONFIG_MODEM_SUPPORT > int do_mdm_init = 0; > -extern void mdm_init(void); /* defined in board.c */ > -#endif > > /*** > * Watch for 'delay' seconds for autoboot stop or autoboot delay string. > @@ -383,51 +380,47 @@ void main_loop(void) > int len; > int rc = 1; > int flag; > -#ifdef CONFIG_PREBOOT > - char *p; > -#endif > > bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, "main_loop"); > > -#ifdef CONFIG_MODEM_SUPPORT > - debug("DEBUG: main_loop: do_mdm_init=%d\n", do_mdm_init); > - if (do_mdm_init) { > - char *str = strdup(getenv("mdm_cmd")); > - setenv("preboot", str); /* set or delete definition */ > - if (str != NULL) > - free(str); > - mdm_init(); /* wait for modem connection */ > + if (autoconf_modem_support()) { Why not just remove do_mdm_init and use gd->do_mdm_init here? > + debug("DEBUG: main_loop: do_mdm_init=%d\n", do_mdm_init); > + if (do_mdm_init) { > + char *str = strdup(getenv("mdm_cmd")); > + > + setenv("preboot", str); /* set or delete definition > */ > + if (str != NULL) > + free(str); > + mdm_init(); /* wait for modem connection */ > + } > } > -#endif /* CONFIG_MODEM_SUPPORT */ > > -#ifdef CONFIG_VERSION_VARIABLE > - { > + if (autoconf_version_variable()) > setenv("ver", version_string); /* set version variable */ > - } > -#endif /* CONFIG_VERSION_VARIABLE */ > > -#ifdef CONFIG_SYS_HUSH_PARSER > - u_boot_hush_start(); > -#endif > + if (autoconf_sys_hush_parser()) > + u_boot_hush_start(); > > -#if defined(CONFIG_HUSH_INIT_VAR) > - hush_init_var(); > -#endif > + if (autoconf_hush_init_var()) > + hush_init_var(); > + > + if (autoconf_preboot()) { > + char *p = getenv("preboot"); > + > + if (p) { > + int prev; > > -#ifdef CONFIG_PREBOOT > - p = getenv("preboot"); > - if (p) { > -# ifdef CONFIG_AUTOBOOT_KEYED > - int prev = disable_ctrlc(1);/* disable Control C checking > */ > -# endif > + /* disable Control C checking */ > + if (autoconf_autoboot_keyed()) > + prev = disable_ctrlc(1); > > - run_command_list(p, -1, 0); > + run_command_list(p, -1, 0); > > -# ifdef CONFIG_AUTOBOOT_KEYED > - disable_ctrlc(prev);/* restore Control C checking */ > -# endif > + /* restore Control C checking */ > + if (autoconf_autoboot_keyed()) > + disable_ctrlc(prev); > + } > } > -#endif /* CONFIG_PREBOOT */ > > if (autoconf_update_tftp()) > update_tftp(0UL); > @@ -435,9 +428,8 @@ void main_loop(void) > if (autoconf_has_bootdelay() && autoconf_bootdelay() >= 0) > process_boot_delay(); > > -#if defined CONFIG_OF_CONTROL > - set_working_fdt_addr((void *)gd->fdt_blob); > -#endif /* CONFIG_OF_CONTROL */ > + if (autoconf_of_control() && autoconf_of_libfdt()) Why are you adding an additional condition on autoconf_of_libfdt()? > + set_working_fdt_addr((void *)gd->fdt_blob); > > /* > * Main Loop for Monitor Command Processing > @@ -472,14 +464,13 @@ void main_loop(void) > } > > if (len == -1) > - puts ("\n"); > + puts("\n"); >
Re: [U-Boot] [RFC PATCH v2 14/15] main: Add debug_parser() to avoid #ifdefs
Hi Simon, On Sun, Feb 24, 2013 at 11:26 AM, Simon Glass wrote: > Define a simple debug condition at the top of the file, to avoid using > lots of #ifdefs later on. > > Signed-off-by: Simon Glass > --- > Changes in v2: None > > common/main.c | 58 +++--- > 1 file changed, 23 insertions(+), 35 deletions(-) > Reviewed-by: Joe Hershberger ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [RFC PATCH v2 15/15] main: Add debug_bootkeys to avoid #ifdefs
Hi Simon On Sun, Feb 24, 2013 at 11:26 AM, Simon Glass wrote: > Define a simple debug condition at the top of the file, to avoid using > lots of #ifdefs later on. > > Signed-off-by: Simon Glass > --- > Changes in v2: None > > common/main.c | 19 +-- > 1 file changed, 9 insertions(+), 10 deletions(-) > Reviewed-by: Joe Hershberger ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] FDT howto
Hi Jagan, On Sun, Feb 24, 2013 at 10:58 AM, Jagan Teki wrote: > Hi Simon, > > On Sun, Feb 24, 2013 at 11:55 PM, Jagan Teki wrote: >> Hi Simon, >> >> On Sun, Feb 24, 2013 at 11:50 PM, Simon Glass wrote: >>> Hi, >>> >>> On Sun, Feb 24, 2013 at 9:55 AM, Jagan Teki >>> wrote: Hi Simon, On Sun, Feb 24, 2013 at 11:18 PM, Simon Glass wrote: > Hi Jegan, > > On Sun, Feb 24, 2013 at 9:45 AM, Jagan Teki > wrote: >> Hi Simon, >> >> On Sun, Feb 24, 2013 at 11:08 PM, Simon Glass wrote: >>> Hi Jagan, >>> >>> On Sun, Feb 24, 2013 at 8:19 AM, Jagan Teki >>> wrote: Hi Simon, Thanks for your response, please find my below comments. On Sun, Feb 24, 2013 at 9:24 PM, Simon Glass wrote: > Hi Jagan, > > On Thu, Feb 21, 2013 at 9:03 AM, Jagan Teki > wrote: >> Hi All, >> >> I am planning to use devicetree on u-boot. >> I have an experience to work with devicetree on Linux. >> >> For u-boot, I have read doc from doc/README.fdt-control. >> I see some dts usages on tegra boards. >> >> I have lot of confusions with the concept itself. >> >> Is Linux and u-boot devicetree concept and build system are same? > > I don't really understand this question sorry. U-Boot and Linux use > the device tree mainly for run-time configuration of drivers, so that > the same driver code can operate on different boards. I am some how confusing the fdt usage in u-boot. Because when compared to Linux, u-boot fdt setup mandatory to require the CONFIG_DEFAULT_DEVICE_TREE on the config file [from your previous comments]. is this the only difference when compared to Linux i guess..is it? Linux defconfig file does need to hot-code the dts. >>> >>> Yes - that is a difference. Linux provides a way to build .dts files >>> but it is not mandatory. At present it is mandatory with U-Boot, and >>> only one file is built. It can easily be ignored though. >> >> Ok. >> >>> > >> >> Suppose I have 4 boards J1, J2, J3 & J4 on my soc "emb".of vendor >> "vast" >>For this requirement I have >>board/vast/dts/J1.dts >>board/vast/dts/J2.dts >>board/vast/dts/J3.dts >>board/vast/dts/J4.dts >> >>include/configs/emb_common.h ==> single configuration of all SOC >> needed definitions >>like defconfig in Linux. >> >>do I need any more files? > > That's enough for the basics I think. Is dtsi file require to add it on arch folder along with above. >>> >>> If your architecture is not one of those already supported (like arm >>> tegra/exynos and x86) then yes you need to add this file in >>> arch//dts. What architecture are you using? >> >> My architecture is armv7, may be for me dtsi not required as arm is >> existing architecture >> to support fdt on u-boot.. is it? > > Which sub-arch? If it is tegra/exynos5250 then you might be OK. For > something else, you should get the kernel's .dtsi file for that chip. I am having armv7, xilinx zynq soc..but i coun't get any .dtsi on kernel source. may be I will create new one. >>> >>> OK, well if the kernel doesn't have FDT support yet then yes you will >>> need to create a new one. >>> > >> >>> > >> >>In emb_common.h i am defining >>CONFIG_OF_SEPARATE is it sufficient? > > And CONFIG_OF_CONTROL > >> >>My plan is to build u-boot and then build the dtb with specific >> board and then combine. > > That's fine, and is how we do things on Chromium also. U-Boot tries to > build an FDT even with CONFIG_OF_SEPARATE, so you need to put a > default device tree file in your emb_common.h file that it can find. > But you can ignore it, and for flashing your boards just use > u-boot.bin plus whatever .dtb you want to select. So I will add the fdt support and then build the u-boot. Is there any separate u-boot build command to build dts file. My plan is to combine both u-boot and dtb. >>> >>> You can run dtc yourself if you like - see Makefile/dts for how it is >>> done there. Once you have the .dtb binary, the easiest thing is to add >>> it to the end of u-boot.bin, as described in README.fdt-control. >> >> Thanks, I tried with above setup for adding dts. >> I have added simple dts file on my board. >> >> I got the below build error >> /proj/mypc/u-boot/include/asm/gpio.h:1:27: fatal error: >
Re: [U-Boot] [PATCH v3] mxs: timrot: Add support to i.MX23
Dear Fadil Berisha, > From: Fadil Berisha > > This patch add timer support to i.MX23 and complete bit fields and values > on regs-timrot.h. > Testet on imx23-olinuxino board. > > Signed-off-by: Fadil Berisha Boring nits below, fix them and add my ack in the next version: Acked-by: Marek Vasut btw. if you don't want to add --cc="" to the git send-email command line, just put lines in format of: Cc: Us Er in the git commit message just below the "Signed-off-by:". Just run git log on most of the mxs-related files and you'll see how it's done. > --- > v2 - Updated the struct mxs_timrot_regs so the mapping works for all > registers v3 - Revert macro MX28_INCREMENTER_HZ, > MX28_HW_DIGCTL_MICROSECONDS and fix whitespaces > > arch/arm/cpu/arm926ejs/mxs/timer.c | 23 +- > arch/arm/include/asm/arch-mxs/regs-timrot.h | 101 > +++ 2 files changed, 122 insertions(+), 2 > deletions(-) > > diff --git a/arch/arm/cpu/arm926ejs/mxs/timer.c > b/arch/arm/cpu/arm926ejs/mxs/timer.c index 4ed75e6..f41ad1c 100644 > --- a/arch/arm/cpu/arm926ejs/mxs/timer.c > +++ b/arch/arm/cpu/arm926ejs/mxs/timer.c > @@ -32,7 +32,11 @@ > #include > > /* Maximum fixed count */ > -#define TIMER_LOAD_VAL 0x > +#if defined(CONFIG_MX23) > +#define TIMER_LOAD_VAL 0x > +#elif defined(CONFIG_MX28) > +#define TIMER_LOAD_VAL 0x > +#endif > > DECLARE_GLOBAL_DATA_PTR; > > @@ -69,7 +73,11 @@ int timer_init(void) > mxs_reset_block(&timrot_regs->hw_timrot_rotctrl_reg); > > /* Set fixed_count to 0 */ > +#if defined(CONFIG_MX23) > + writel(0, &timrot_regs->hw_timrot_timcount0); > +#elif defined(CONFIG_MX28) > writel(0, &timrot_regs->hw_timrot_fixed_count0); > +#endif > > /* Set UPDATE bit and 1Khz frequency */ > writel(TIMROT_TIMCTRLn_UPDATE | TIMROT_TIMCTRLn_RELOAD | > @@ -77,7 +85,11 @@ int timer_init(void) > &timrot_regs->hw_timrot_timctrl0); > > /* Set fixed_count to maximal value */ > +#if defined(CONFIG_MX23) > + writel(TIMER_LOAD_VAL-1, &timrot_regs->hw_timrot_timcount0); Put a space here ... 'TIMER_LOAD_VAL - 1' > +#elif defined(CONFIG_MX28) > writel(TIMER_LOAD_VAL, &timrot_regs->hw_timrot_fixed_count0); > +#endif > > return 0; > } > @@ -86,9 +98,16 @@ unsigned long long get_ticks(void) > { > struct mxs_timrot_regs *timrot_regs = > (struct mxs_timrot_regs *)MXS_TIMROT_BASE; > + uint32_t now; > > /* Current tick value */ > - uint32_t now = readl(&timrot_regs->hw_timrot_running_count0); > +#if defined(CONFIG_MX23) > + /* upper bits are the valid */ /* Upper bits are the valid ones. */ > + now = readl(&timrot_regs->hw_timrot_timcount0) >> > + TIMROT_RUNNING_COUNTn_RUNNING_COUNT_OFFSET; > +#elif defined(CONFIG_MX28) > + now = readl(&timrot_regs->hw_timrot_running_count0); > +#endif > > if (lastdec >= now) { > /* [...] ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 0/22] Improvements to memory, hashing functions for sandbox
This series aims to get all the memory functions running correctly on sandbox. There was some discussion about this a while ago, and a commit was added to show a possible approach: 355a8357 sandbox: Change md command to use map_physmem This commit was subsequently reverted because it used map_physmem() instead of the NOP that most architectures need for the memory functions. This series introduces map_sysmem(), a NOP on all architectures except sandbox. It allows us to use a ram buffer to which all U-Boot addresses are relative. The memory commands (including hashing) are updated to use this so that sandbox can now use those commands. Half of the mtest code is behind #ifdefs and there is duplication of some functions in both versions of the memory test. Several patches here clean this up a bit and get it working on sandbox. The numeric setenv_ulong() function is a useful way of avoiding a 'char buf[17]; sprintf(buf, "%ld", ...); setenv("...", buf)' sequence. There is also setenv_addr(). What is missing is setenv_hex() which sets a ulong in hex format. Add this function and then make use of it in the main places: common/ drivers/ and net/. The recently added and very basic hash instructure can help reduce code duplication in some cases. The crc32 command is redone to use this, and crc32 is now available through the 'hash' command. Also a few bugs were found in hashing with verify disabled - the arg count was not checked and a variable declaration was missing. To permit the memory tester to run on sandbox, we need ctrl-C to work. To achieve this, add a proper implementation of sandbox's tstc(), with a simple FIFO for character input. An os_usleep() is added to ensure that U-Boot does not consume infinite CPU when setting at the command prompt. Changes in v3: - Rebase mtest indent patch on top of mainline to resolve conflicts - Use spaces instead of tabs for indent in cmd_fdoc.c - Change incorrect commit title from drivers: to fs: - Fix 'it ia' typo - Fix 'bahviour' typo - Make sha1 code dependent on CONFIG_CMD_SHA1, for code size reasons Changes in v2: - Add new patch to control saving hashes in the environment - Rewrite crc32 support in hash to improve code size - Rebase on top of earlier patches Simon Glass (21): Tidy up error checking and fix bug in hash command Update print_buffer() to use const sandbox: Add un/map_sysmen() to deal with sandbox's ram_buf sandbox: Change memory commands to use map_physmem Split out the memory tests into separate functions Use common mtest iteration counting Fix mtest indenting Bring mtest putc() into common code Reduce casting in mtest Update set_working_fdt_addr() to use setenv_addr() common: Use new numeric setenv functions fs: Use new numeric setenv functions net: Use new numeric setenv functions image: Use crc header file instead of C prototypes hash: Add a flag to support saving hashes in the environment Roll crc32 into hash infrastructure sandbox: config: Enable hash functions and mtest Move CONFIG_SYS_MEMTEST_SCRATCH #ifdef to top of file sandbox: Update mtest to fix crashes sandbox: Allow hash functions to work correctly hash: Use lower case for hash algorithm names Taylor Hutt (1): sandbox: Improve sandbox serial port keyboard interface README| 9 + arch/sandbox/config.mk| 1 + arch/sandbox/cpu/os.c | 8 + arch/sandbox/include/asm/io.h | 10 + common/cmd_bootm.c| 11 +- common/cmd_cbfs.c | 4 +- common/cmd_cramfs.c | 4 +- common/cmd_fdos.c | 4 +- common/cmd_fdt.c | 11 +- common/cmd_hash.c | 14 +- common/cmd_jffs2.c| 4 +- common/cmd_load.c | 12 +- common/cmd_mem.c | 798 +- common/cmd_mtdparts.c | 4 +- common/cmd_nand.c | 12 +- common/cmd_nvedit.c | 11 +- common/cmd_reiser.c | 4 +- common/cmd_setexpr.c | 39 ++- common/cmd_sha1sum.c | 6 +- common/cmd_unzip.c| 4 +- common/cmd_ximg.c | 7 +- common/cmd_zfs.c | 3 +- common/cmd_zip.c | 4 +- common/hash.c | 194 +++--- common/image.c| 4 +- drivers/net/fm/fm.c | 4 +- drivers/serial/sandbox.c | 44 ++- fs/fs.c | 4 +- fs/ubifs/ubifs.c | 4 +- include/common.h | 29 +- include/configs/sandbox.h | 9 +- include/hash.h| 13 +- include/os.h | 10 + include/u-boot/crc.h | 11 + lib/crc32.c | 9 + lib/display_options.c | 3 +- net/net.c | 8 +- 37 files changed, 747 insertions(+), 583 deletions(-) -- 1.8.1.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/m
[U-Boot] [PATCH v3 16/22] hash: Add a flag to support saving hashes in the environment
Some hashing commands permit saving the hash in an environment variable, and verifying a hash from there. But the crc32 command does not support this. In order to permit crc32 to use the generic hashing infrastructure, add a flag to select which behaviour to use. Signed-off-by: Simon Glass --- Changes in v3: - Fix 'it ia' typo Changes in v2: - Add new patch to control saving hashes in the environment common/cmd_hash.c| 8 +++--- common/cmd_sha1sum.c | 6 ++--- common/hash.c| 69 +++- include/hash.h | 9 +-- 4 files changed, 66 insertions(+), 26 deletions(-) diff --git a/common/cmd_hash.c b/common/cmd_hash.c index eb6a338..8c03b5c 100644 --- a/common/cmd_hash.c +++ b/common/cmd_hash.c @@ -30,22 +30,22 @@ static int do_hash(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { #ifdef CONFIG_HASH_VERIFY - int verify = 0; + int flags = HASH_FLAG_ENV; if (argc < 4) return CMD_RET_USAGE; if (!strcmp(argv[1], "-v")) { - verify = 1; + flags |= HASH_FLAG_VERIFY; argc--; argv++; } #else - const int verify = 0; + const int flags = HASH_FLAG_ENV; #endif /* Move forward to 'algorithm' parameter */ argc--; argv++; - return hash_command(*argv, verify, cmdtp, flag, argc - 1, argv + 1); + return hash_command(*argv, flags, cmdtp, flag, argc - 1, argv + 1); } #ifdef CONFIG_HASH_VERIFY diff --git a/common/cmd_sha1sum.c b/common/cmd_sha1sum.c index fe927ab..9f08629 100644 --- a/common/cmd_sha1sum.c +++ b/common/cmd_sha1sum.c @@ -31,7 +31,7 @@ int do_sha1sum(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { - int verify = 0; + int flags = HASH_FLAG_ENV; int ac; char * const *av; @@ -42,13 +42,13 @@ int do_sha1sum(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) ac = argc - 1; #ifdef CONFIG_SHA1SUM_VERIFY if (strcmp(*av, "-v") == 0) { - verify = 1; + flags |= HASH_FLAG_VERIFY; av++; ac--; } #endif - return hash_command("sha1", verify, cmdtp, flag, ac, av); + return hash_command("sha1", flags, cmdtp, flag, ac, av); } #ifdef CONFIG_SHA1SUM_VERIFY diff --git a/common/hash.c b/common/hash.c index e3a6e43..462853d 100644 --- a/common/hash.c +++ b/common/hash.c @@ -58,19 +58,31 @@ static struct hash_algo hash_algo[] = { * @algo: Hash algorithm being used * @sum: Hash digest (algo->digest_size bytes) * @dest: Destination, interpreted as a hex address if it starts - * with * or otherwise as an environment variable. + * with * (or allow_env_vars is 0) or otherwise as an + * environment variable. + * @allow_env_vars:non-zero to permit storing the result to an + * variable environment */ static void store_result(struct hash_algo *algo, const u8 *sum, -const char *dest) +const char *dest, int allow_env_vars) { unsigned int i; + int env_var = 0; - if (*dest == '*') { - u8 *ptr; + /* +* If environment variables are allowed, then we assume that 'dest' +* is an environment variable, unless it starts with *, in which +* case we assume it is an address. If not allowed, it is always an +* address. This is to support the crc32 command. +*/ + if (allow_env_vars) { + if (*dest == '*') + dest++; + else + env_var = 1; + } - ptr = (u8 *)simple_strtoul(dest + 1, NULL, 16); - memcpy(ptr, sum, algo->digest_size); - } else { + if (env_var) { char str_output[HASH_MAX_DIGEST_SIZE * 2 + 1]; char *str_ptr = str_output; @@ -80,6 +92,11 @@ static void store_result(struct hash_algo *algo, const u8 *sum, } str_ptr = '\0'; setenv(dest, str_output); + } else { + u8 *ptr; + + ptr = (u8 *)simple_strtoul(dest, NULL, 16); + memcpy(ptr, sum, algo->digest_size); } } @@ -94,14 +111,28 @@ static void store_result(struct hash_algo *algo, const u8 *sum, * Otherwise we assume it is an environment variable, and * look up its value (it must contain a hex digest). * @vsum: Returns binary digest value (algo->digest_size bytes) + * @allow_env_vars:non-zero to permit storing the result to an environment + * variable. If 0 then verify_str is assumed to be an + * address, and the * prefix is not expected. * @return 0 if ok, non-zero on error */ -sta
[U-Boot] [PATCH v3 04/22] sandbox: Add un/map_sysmen() to deal with sandbox's ram_buf
Sandbox doesn't actually provide U-Boot access to the machine's physical memory. Instead it provides a RAM buffer of configurable size, and all memory accesses are within that buffer. Sandbox memory starts at 0 and is CONFIG_DRAM_SIZE bytes in size. Allowing access outside this buffer might produce unpredictable results in the event of an error, and would expose the host machine's memory architecture to the sandbox U-Boot. Most U-Boot functions assume that they can just access memory at given address. For sandbox this is not true. Add a map_sysmem() call which converts a U-Boot address to a system address. In most cases this is a NOP, but for sandbox it returns a pointer to that memory inside the RAM buffer. To get a U-Boot feature to work correctly within sandbox, you should call map_sysmem() to get a pointer to the address, and then use that address for any U-Boot memory accesses. Signed-off-by: Simon Glass --- Changes in v3: None Changes in v2: None README| 9 + arch/sandbox/config.mk| 1 + arch/sandbox/include/asm/io.h | 10 ++ include/common.h | 12 4 files changed, 32 insertions(+) diff --git a/README b/README index d8cb394..affa096 100644 --- a/README +++ b/README @@ -3810,6 +3810,15 @@ Low Level (hardware related) configuration options: that is executed before the actual U-Boot. E.g. when compiling a NAND SPL. +- CONFIG_ARCH_MAP_SYSMEM + Generally U-Boot (and in particular the md command) uses + effective address. It is therefore not necessary to regard + U-Boot address as virtual addresses that need to be translated + to physical addresses. However, sandbox requires this, since + it maintains its own little RAM buffer which contains all + addressable memory. This option causes some memory accesses + to be mapped through map_sysmem() / unmap_sysmem(). + - CONFIG_USE_ARCH_MEMCPY CONFIG_USE_ARCH_MEMSET If these options are used a optimized version of memcpy/memset will diff --git a/arch/sandbox/config.mk b/arch/sandbox/config.mk index 02ce4a4..4fd0d4e 100644 --- a/arch/sandbox/config.mk +++ b/arch/sandbox/config.mk @@ -18,4 +18,5 @@ # MA 02111-1307 USA PLATFORM_CPPFLAGS += -DCONFIG_SANDBOX -D__SANDBOX__ -U_FORTIFY_SOURCE +PLATFORM_CPPFLAGS += -DCONFIG_ARCH_MAP_SYSMEM PLATFORM_LIBS += -lrt diff --git a/arch/sandbox/include/asm/io.h b/arch/sandbox/include/asm/io.h index 0392d21..d8c0236 100644 --- a/arch/sandbox/include/asm/io.h +++ b/arch/sandbox/include/asm/io.h @@ -39,3 +39,13 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags) { } + +/* For sandbox, we want addresses to point into our RAM buffer */ +static inline void *map_sysmem(phys_addr_t paddr, unsigned long len) +{ + return map_physmem(paddr, len, MAP_WRBACK); +} + +static inline void unmap_sysmem(const void *vaddr) +{ +} diff --git a/include/common.h b/include/common.h index 170f439..1d0728f 100644 --- a/include/common.h +++ b/include/common.h @@ -870,6 +870,18 @@ int cpu_disable(int nr); int cpu_release(int nr, int argc, char * const argv[]); #endif +/* Define a null map_sysmem() if the architecture doesn't use it */ +# ifndef CONFIG_ARCH_MAP_SYSMEM +static inline void *map_sysmem(phys_addr_t paddr, unsigned long len) +{ + return (void *)(uintptr_t)paddr; +} + +static inline void unmap_sysmem(const void *vaddr) +{ +} +# endif + #endif /* __ASSEMBLY__ */ #ifdef CONFIG_PPC -- 1.8.1.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 02/22] Update print_buffer() to use const
The buffer cannot be changed by this function, so change the buffer pointer to a const. This allows callers with const pointer to use the function without a cast. Signed-off-by: Simon Glass --- Changes in v3: None Changes in v2: None include/common.h | 3 ++- lib/display_options.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/common.h b/include/common.h index 4ad17ea..170f439 100644 --- a/include/common.h +++ b/include/common.h @@ -270,7 +270,8 @@ int cpu_init(void); phys_size_t initdram (int); intdisplay_options (void); void print_size(unsigned long long, const char *); -intprint_buffer (ulong addr, void* data, uint width, uint count, uint linelen); +int print_buffer(ulong addr, const void *data, uint width, uint count, +uint linelen); /* common/main.c */ void main_loop (void); diff --git a/lib/display_options.c b/lib/display_options.c index 694d2f2..0339970 100644 --- a/lib/display_options.c +++ b/lib/display_options.c @@ -98,7 +98,8 @@ void print_size(unsigned long long size, const char *s) */ #define MAX_LINE_LENGTH_BYTES (64) #define DEFAULT_LINE_LENGTH_BYTES (16) -int print_buffer (ulong addr, void* data, uint width, uint count, uint linelen) +int print_buffer(ulong addr, const void *data, uint width, uint count, +uint linelen) { /* linebuf as a union causes proper alignment */ union linebuf { -- 1.8.1.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 06/22] Split out the memory tests into separate functions
Half of the code is currently hidden behind an #ifdef. Move the two memory tests into their own functions and use the compiler to eliminate the unused code. Signed-off-by: Simon Glass --- Changes in v3: None Changes in v2: None common/cmd_mem.c | 217 +-- 1 file changed, 116 insertions(+), 101 deletions(-) diff --git a/common/cmd_mem.c b/common/cmd_mem.c index ee7bf9a..0e7a4c6 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -626,36 +626,26 @@ int do_mem_loopw (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } #endif /* CONFIG_LOOPW */ -/* - * Perform a memory test. A more complete alternative test can be - * configured using CONFIG_SYS_ALT_MEMTEST. The complete test loops until - * interrupted by ctrl-c or by a failure of one of the sub-tests. - */ -static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc, - char * const argv[]) +static int mem_test_alt(vu_long *start, vu_long *end, + int iteration_limit) { - vu_long *addr, *start, *end; - ulong val; - ulong readback; - ulong errs = 0; + vu_long *addr; int iterations = 1; - int iteration_limit; - -#if defined(CONFIG_SYS_ALT_MEMTEST) - vu_long len; - vu_long offset; - vu_long test_offset; - vu_long pattern; - vu_long temp; - vu_long anti_pattern; - vu_long num_words; + ulong errs = 0; + ulong val, readback; + int j; + vu_long len; + vu_long offset; + vu_long test_offset; + vu_long pattern; + vu_long temp; + vu_long anti_pattern; + vu_long num_words; #if defined(CONFIG_SYS_MEMTEST_SCRATCH) - vu_long *dummy = (vu_long*)CONFIG_SYS_MEMTEST_SCRATCH; + vu_long *dummy = (vu_long *)CONFIG_SYS_MEMTEST_SCRATCH; #else vu_long *dummy = NULL; /* yes, this is address 0x0, not NULL */ #endif - int j; - static const ulong bitpattern[] = { 0x0001, /* single bit */ 0x0003, /* two adjacent bits */ @@ -666,43 +656,18 @@ static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc, 0x0055, /* four non-adjacent bits */ 0x, /* alternating 1/0 */ }; -#else - ulong incr; - ulong pattern; -#endif - if (argc > 1) - start = (ulong *)simple_strtoul(argv[1], NULL, 16); - else - start = (ulong *)CONFIG_SYS_MEMTEST_START; - - if (argc > 2) - end = (ulong *)simple_strtoul(argv[2], NULL, 16); - else - end = (ulong *)(CONFIG_SYS_MEMTEST_END); - - if (argc > 3) - pattern = (ulong)simple_strtoul(argv[3], NULL, 16); - else - pattern = 0; - - if (argc > 4) - iteration_limit = (ulong)simple_strtoul(argv[4], NULL, 16); - else - iteration_limit = 0; - -#if defined(CONFIG_SYS_ALT_MEMTEST) - printf ("Testing %08x ... %08x:\n", (uint)start, (uint)end); + printf("Testing %08x ... %08x:\n", (uint)(uintptr_t)start, + (uint)(uintptr_t)end); debug("%s:%d: start 0x%p end 0x%p\n", - __FUNCTION__, __LINE__, start, end); + __func__, __LINE__, start, end); for (;;) { if (ctrlc()) { - putc ('\n'); + putc('\n'); return 1; } - if (iteration_limit && iterations > iteration_limit) { printf("Tested %d iteration(s) with %lu errors.\n", iterations-1, errs); @@ -731,34 +696,35 @@ static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc, * pattern and ~pattern). */ addr = start; - for (j = 0; j < sizeof(bitpattern)/sizeof(bitpattern[0]); j++) { + for (j = 0; j < sizeof(bitpattern) / sizeof(bitpattern[0]); + j++) { val = bitpattern[j]; - for(; val != 0; val <<= 1) { + for (; val != 0; val <<= 1) { *addr = val; - *dummy = ~val; /* clear the test data off of the bus */ + *dummy = ~val; /* clear the test data off the bus */ readback = *addr; if(readback != val) { - printf ("FAILURE (data line): " - "expected %08lx, actual %08lx\n", - val, readback); - errs++; - if (ctrlc()) { - putc ('\n'); - return 1; - } + printf("FAILURE (data line): " +
[U-Boot] [PATCH v3 14/22] net: Use new numeric setenv functions
Use setenv_ulong(), setenv_hex() and setenv_addr() in net/ Signed-off-by: Simon Glass --- Changes in v3: None Changes in v2: None drivers/net/fm/fm.c | 4 +--- net/net.c | 8 ++-- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/net/fm/fm.c b/drivers/net/fm/fm.c index 49c74c2..8d70586 100644 --- a/drivers/net/fm/fm.c +++ b/drivers/net/fm/fm.c @@ -362,7 +362,6 @@ static void fm_init_qmi(struct fm_qmi_common *qmi) int fm_init_common(int index, struct ccsr_fman *reg) { int rc; - char env_addr[32]; #if defined(CONFIG_SYS_QE_FMAN_FW_IN_NOR) void *addr = (void *)CONFIG_SYS_QE_FMAN_FW_ADDR; #elif defined(CONFIG_SYS_QE_FMAN_FW_IN_NAND) @@ -416,8 +415,7 @@ int fm_init_common(int index, struct ccsr_fman *reg) rc = fman_upload_firmware(index, ®->fm_imem, addr); if (rc) return rc; - sprintf(env_addr, "0x%lx", (long unsigned int)addr); - setenv("fman_ucode", env_addr); + setenv_addr("fman_ucode", addr); fm_init_muram(index, ®->muram); fm_init_qmi(®->fm_qmi_common); diff --git a/net/net.c b/net/net.c index a40cde1..df94789 100644 --- a/net/net.c +++ b/net/net.c @@ -528,15 +528,11 @@ restart: case NETLOOP_SUCCESS: net_cleanup_loop(); if (NetBootFileXferSize > 0) { - char buf[20]; printf("Bytes transferred = %ld (%lx hex)\n", NetBootFileXferSize, NetBootFileXferSize); - sprintf(buf, "%lX", NetBootFileXferSize); - setenv("filesize", buf); - - sprintf(buf, "%lX", (unsigned long)load_addr); - setenv("fileaddr", buf); + setenv_hex("filesize", NetBootFileXferSize); + setenv_hex("fileaddr", load_addr); } if (protocol != NETCONS) eth_halt(); -- 1.8.1.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 08/22] Fix mtest indenting
Some of the inner loops are not indented correctly. Fix this. Signed-off-by: Simon Glass --- Changes in v3: - Rebase mtest indent patch on top of mainline to resolve conflicts Changes in v2: None common/cmd_mem.c | 322 +++ 1 file changed, 161 insertions(+), 161 deletions(-) diff --git a/common/cmd_mem.c b/common/cmd_mem.c index 02ff658..5235bfe 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -655,32 +655,31 @@ static ulong mem_test_alt(vu_long *start, vu_long *end) 0x, /* alternating 1/0 */ }; - /* -* Data line test: write a pattern to the first -* location, write the 1's complement to a 'parking' -* address (changes the state of the data bus so a -* floating bus doesn't give a false OK), and then -* read the value back. Note that we read it back -* into a variable because the next time we read it, -* it might be right (been there, tough to explain to -* the quality guys why it prints a failure when the -* "is" and "should be" are obviously the same in the -* error message). -* -* Rather than exhaustively testing, we test some -* patterns by shifting '1' bits through a field of -* '0's and '0' bits through a field of '1's (i.e. -* pattern and ~pattern). -*/ - addr = start; - for (j = 0; j < sizeof(bitpattern) / sizeof(bitpattern[0]); - j++) { - val = bitpattern[j]; - for (; val != 0; val <<= 1) { + /* +* Data line test: write a pattern to the first +* location, write the 1's complement to a 'parking' +* address (changes the state of the data bus so a +* floating bus doesn't give a false OK), and then +* read the value back. Note that we read it back +* into a variable because the next time we read it, +* it might be right (been there, tough to explain to +* the quality guys why it prints a failure when the +* "is" and "should be" are obviously the same in the +* error message). +* +* Rather than exhaustively testing, we test some +* patterns by shifting '1' bits through a field of +* '0's and '0' bits through a field of '1's (i.e. +* pattern and ~pattern). +*/ + addr = start; + for (j = 0; j < sizeof(bitpattern) / sizeof(bitpattern[0]); j++) { + val = bitpattern[j]; + for (; val != 0; val <<= 1) { *addr = val; *dummy = ~val; /* clear the test data off the bus */ readback = *addr; - if(readback != val) { + if (readback != val) { printf("FAILURE (data line): " "expected %08lx, actual %08lx\n", val, readback); @@ -703,129 +702,130 @@ static ulong mem_test_alt(vu_long *start, vu_long *end) return -1; } } - } } + } - /* -* Based on code whose Original Author and Copyright -* information follows: Copyright (c) 1998 by Michael -* Barr. This software is placed into the public -* domain and may be used for any purpose. However, -* this notice must not be changed or removed and no -* warranty is either expressed or implied by its -* publication or distribution. -*/ + /* +* Based on code whose Original Author and Copyright +* information follows: Copyright (c) 1998 by Michael +* Barr. This software is placed into the public +* domain and may be used for any purpose. However, +* this notice must not be changed or removed and no +* warranty is either expressed or implied by its +* publication or distribution. +*/ - /* -* Address line test -* -* Description: Test the address bus wiring in a -* memory region by performing a walking -* 1's test on the relevant bits of the -* address and checking for aliasing. -* This test will find single-bit -* address failures such as stuck-high, -* stuck-low, and shorted pins. The base -* address and size of the regi
[U-Boot] [PATCH v3 03/22] sandbox: Improve sandbox serial port keyboard interface
From: Taylor Hutt Implements the tstc() interface for the serial driver. Multiplexing the console between the serial port and a keyboard uses a polling method of checking if characters are available; this means that the serial console must be non-blocking when attempting to read characters. Signed-off-by: Taylor Hutt Signed-off-by: Simon Glass --- Changes in v3: None Changes in v2: None arch/sandbox/cpu/os.c| 8 drivers/serial/sandbox.c | 44 ++-- include/os.h | 10 ++ 3 files changed, 56 insertions(+), 6 deletions(-) diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 36637af..3e37c93 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -44,6 +44,14 @@ ssize_t os_read(int fd, void *buf, size_t count) return read(fd, buf, count); } +ssize_t os_read_no_block(int fd, void *buf, size_t count) +{ + const int flags = fcntl(fd, F_GETFL, 0); + + fcntl(fd, F_SETFL, flags | O_NONBLOCK); + return os_read(fd, buf, count); +} + ssize_t os_write(int fd, const void *buf, size_t count) { return write(fd, buf, count); diff --git a/drivers/serial/sandbox.c b/drivers/serial/sandbox.c index cb19401..b73520c 100644 --- a/drivers/serial/sandbox.c +++ b/drivers/serial/sandbox.c @@ -30,6 +30,19 @@ #include #include +/* + * + * serial_buf: A buffer that holds keyboard characters for the + * Sandbox U-boot. + * + * invariants: + * serial_buf_write == serial_buf_read -> empty buffer + * (serial_buf_write + 1) % 16 == serial_buf_read -> full buffer + */ +static char serial_buf[16]; +static unsigned int serial_buf_write; +static unsigned int serial_buf_read; + static int sandbox_serial_init(void) { os_tty_raw(0); @@ -50,18 +63,37 @@ static void sandbox_serial_puts(const char *str) os_write(1, str, strlen(str)); } -static int sandbox_serial_getc(void) +static unsigned int increment_buffer_index(unsigned int index) +{ + return (index + 1) % ARRAY_SIZE(serial_buf); +} + +static int sandbox_serial_tstc(void) { - char buf; + const unsigned int next_index = + increment_buffer_index(serial_buf_write); ssize_t count; - count = os_read(0, &buf, 1); - return count == 1 ? buf : 0; + os_usleep(100); + if (next_index == serial_buf_read) + return 1; /* buffer full */ + + count = os_read_no_block(0, &serial_buf[serial_buf_write], 1); + if (count == 1) + serial_buf_write = next_index; + return serial_buf_write != serial_buf_read; } -static int sandbox_serial_tstc(void) +static int sandbox_serial_getc(void) { - return 0; + int result; + + while (!sandbox_serial_tstc()) + ; /* buffer empty */ + + result = serial_buf[serial_buf_read]; + serial_buf_read = increment_buffer_index(serial_buf_read); + return result; } static struct serial_device sandbox_serial_drv = { diff --git a/include/os.h b/include/os.h index 699682a..c452d1b 100644 --- a/include/os.h +++ b/include/os.h @@ -40,6 +40,16 @@ struct sandbox_state; ssize_t os_read(int fd, void *buf, size_t count); /** + * Access to the OS read() system call with non-blocking access + * + * \param fd File descriptor as returned by os_open() + * \param buf Buffer to place data + * \param countNumber of bytes to read + * \return number of bytes read, or -1 on error + */ +ssize_t os_read_no_block(int fd, void *buf, size_t count); + +/** * Access to the OS write() system call * * \param fd File descriptor as returned by os_open() -- 1.8.1.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 09/22] Bring mtest putc() into common code
If we get a Ctrl-C abort, we always print a newline. Move this repeated code out of the functions and into a single place in the caller. Signed-off-by: Simon Glass --- Changes in v3: None Changes in v2: None common/cmd_mem.c | 32 +--- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/common/cmd_mem.c b/common/cmd_mem.c index 5235bfe..f5dd56d 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -684,10 +684,8 @@ static ulong mem_test_alt(vu_long *start, vu_long *end) "expected %08lx, actual %08lx\n", val, readback); errs++; - if (ctrlc()) { - putc('\n'); + if (ctrlc()) return -1; - } } *addr = ~val; *dummy = val; @@ -697,10 +695,8 @@ static ulong mem_test_alt(vu_long *start, vu_long *end) "Is %08lx, should be %08lx\n", readback, ~val); errs++; - if (ctrlc()) { - putc('\n'); + if (ctrlc()) return -1; - } } } } @@ -765,10 +761,8 @@ static ulong mem_test_alt(vu_long *start, vu_long *end) " expected 0x%.8lx, actual 0x%.8lx\n", (ulong)&start[offset], pattern, temp); errs++; - if (ctrlc()) { - putc('\n'); + if (ctrlc()) return -1; - } } } start[test_offset] = pattern; @@ -788,10 +782,8 @@ static ulong mem_test_alt(vu_long *start, vu_long *end) " actual 0x%.8lx\n", (ulong)&start[offset], pattern, temp); errs++; - if (ctrlc()) { - putc('\n'); + if (ctrlc()) return -1; - } } } start[test_offset] = pattern; @@ -830,10 +822,8 @@ static ulong mem_test_alt(vu_long *start, vu_long *end) " expected 0x%.8lx, actual 0x%.8lx)\n", (ulong)&start[offset], pattern, temp); errs++; - if (ctrlc()) { - putc('\n'); + if (ctrlc()) return -1; - } } anti_pattern = ~pattern; @@ -852,10 +842,8 @@ static ulong mem_test_alt(vu_long *start, vu_long *end) " expected 0x%.8lx, actual 0x%.8lx)\n", (ulong)&start[offset], anti_pattern, temp); errs++; - if (ctrlc()) { - putc('\n'); + if (ctrlc()) return -1; - } } start[offset] = 0; } @@ -907,10 +895,8 @@ static ulong mem_test_quick(vu_long *start, vu_long *end, vu_long pattern, "found %08lX, expected %08lX\n", (uint)(uintptr_t)addr, readback, val); errs++; - if (ctrlc()) { - putc('\n'); + if (ctrlc()) return -1; - } } val += incr; } @@ -967,7 +953,6 @@ static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc, !iteration_limit || iteration < iteration_limit; iteration++) { if (ctrlc()) { - putc('\n'); errs = -1UL; break; } @@ -981,7 +966,8 @@ static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc, } if (errs == -1UL) { - /* Memory test was aborted */ + /* Memory test was aborted - write a newline to finish off */ + putc('\n'); ret = 1; } else { printf("Tested %d iteration(s) with %lu errors.\n", -- 1.8.1.3 ___ U-Boot mailing list U-Boot@lists.d
[U-Boot] [PATCH v3 10/22] Reduce casting in mtest
Use a ulong for the command arguments, and only cast to an address when needed. This fixes warnings in sandbox where pointers are typically 64 bits long. Signed-off-by: Simon Glass --- Changes in v3: None Changes in v2: None common/cmd_mem.c | 30 ++ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/common/cmd_mem.c b/common/cmd_mem.c index f5dd56d..12dbc16 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -626,8 +626,9 @@ int do_mem_loopw (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } #endif /* CONFIG_LOOPW */ -static ulong mem_test_alt(vu_long *start, vu_long *end) +static ulong mem_test_alt(ulong start_addr, ulong end_addr) { + vu_long *start, *end; vu_long *addr; ulong errs = 0; ulong val, readback; @@ -655,6 +656,9 @@ static ulong mem_test_alt(vu_long *start, vu_long *end) 0x, /* alternating 1/0 */ }; + start = (vu_long *)start_addr; + end = (vu_long *)end_addr; + /* * Data line test: write a pattern to the first * location, write the 1's complement to a 'parking' @@ -735,7 +739,7 @@ static ulong mem_test_alt(vu_long *start, vu_long *end) * * Returns: 0 if the test succeeds, 1 if the test fails. */ - len = ((ulong)end - (ulong)start)/sizeof(vu_long); + len = (end_addr - start_addr) / sizeof(vu_long); pattern = (vu_long) 0x; anti_pattern = (vu_long) 0x; @@ -851,9 +855,10 @@ static ulong mem_test_alt(vu_long *start, vu_long *end) return 0; } -static ulong mem_test_quick(vu_long *start, vu_long *end, vu_long pattern, +static ulong mem_test_quick(ulong start_addr, ulong end_addr, vu_long pattern, int iteration) { + vu_long *start, *end; vu_long *addr; ulong errs = 0; ulong incr; @@ -874,6 +879,8 @@ static ulong mem_test_quick(vu_long *start, vu_long *end, vu_long pattern, else pattern = ~pattern; } + start = (vu_long *)start_addr; + end = (vu_long *)end_addr; printf("\rPattern %08lX Writing..." "%12s" "\b\b\b\b\b\b\b\b\b\b", @@ -912,7 +919,7 @@ static ulong mem_test_quick(vu_long *start, vu_long *end, vu_long pattern, static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { - vu_long *start, *end; + ulong start, end; int iteration_limit; int ret; ulong errs = 0; /* number of errors, or -1 if interrupted */ @@ -925,14 +932,14 @@ static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc, #endif if (argc > 1) - start = (ulong *)simple_strtoul(argv[1], NULL, 16); + start = simple_strtoul(argv[1], NULL, 16); else - start = (ulong *)CONFIG_SYS_MEMTEST_START; + start = CONFIG_SYS_MEMTEST_START; if (argc > 2) - end = (ulong *)simple_strtoul(argv[2], NULL, 16); + end = simple_strtoul(argv[2], NULL, 16); else - end = (ulong *)(CONFIG_SYS_MEMTEST_END); + end = CONFIG_SYS_MEMTEST_END; if (argc > 3) pattern = (ulong)simple_strtoul(argv[3], NULL, 16); @@ -944,10 +951,9 @@ static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc, else iteration_limit = 0; - printf("Testing %08x ... %08x:\n", (uint)(uintptr_t)start, - (uint)(uintptr_t)end); - debug("%s:%d: start 0x%p end 0x%p\n", - __func__, __LINE__, start, end); + printf("Testing %08x ... %08x:\n", (uint)start, (uint)end); + debug("%s:%d: start %#08lx end %#08lx\n", __func__, __LINE__, + start, end); for (iteration = 0; !iteration_limit || iteration < iteration_limit; -- 1.8.1.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 05/22] sandbox: Change memory commands to use map_physmem
Sandbox wants to support commands which use memory. The map_sysmen() call provides this feature, so use this in the memory commands. Signed-off-by: Simon Glass --- Changes in v3: None Changes in v2: None common/cmd_mem.c | 122 +++ 1 file changed, 79 insertions(+), 43 deletions(-) diff --git a/common/cmd_mem.c b/common/cmd_mem.c index d44aa1d..ee7bf9a 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -33,6 +33,7 @@ #include #endif #include +#include #include DECLARE_GLOBAL_DATA_PTR; @@ -138,9 +139,13 @@ static int do_mem_md(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) # endif { + ulong bytes = size * length; + const void *buf = map_sysmem(addr, bytes); + /* Print the lines. */ - print_buffer(addr, (void*)addr, size, length, DISP_LINE_LEN/size); - addr += size*length; + print_buffer(addr, buf, size, length, DISP_LINE_LEN / size); + addr += bytes; + unmap_sysmem(buf); } #endif @@ -163,6 +168,8 @@ static int do_mem_mw(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { ulong addr, writeval, count; int size; + void *buf; + ulong bytes; if ((argc < 3) || (argc > 4)) return CMD_RET_USAGE; @@ -188,15 +195,18 @@ static int do_mem_mw(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) count = 1; } + bytes = size * count; + buf = map_sysmem(addr, bytes); while (count-- > 0) { if (size == 4) - *((ulong *)addr) = (ulong )writeval; + *((ulong *)buf) = (ulong)writeval; else if (size == 2) - *((ushort *)addr) = (ushort)writeval; + *((ushort *)buf) = (ushort)writeval; else - *((u_char *)addr) = (u_char)writeval; - addr += size; + *((u_char *)buf) = (u_char)writeval; + buf += size; } + unmap_sysmem(buf); return 0; } @@ -258,10 +268,11 @@ int do_mem_mwc ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) static int do_mem_cmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { - ulong addr1, addr2, count, ngood; + ulong addr1, addr2, count, ngood, bytes; int size; int rcode = 0; const char *type; + const void *buf1, *buf2, *base; if (argc != 4) return CMD_RET_USAGE; @@ -294,33 +305,40 @@ static int do_mem_cmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } #endif + bytes = size * count; + base = buf1 = map_sysmem(addr1, bytes); + buf2 = map_sysmem(addr2, bytes); for (ngood = 0; ngood < count; ++ngood) { ulong word1, word2; if (size == 4) { - word1 = *(ulong *)addr1; - word2 = *(ulong *)addr2; + word1 = *(ulong *)buf1; + word2 = *(ulong *)buf2; } else if (size == 2) { - word1 = *(ushort *)addr1; - word2 = *(ushort *)addr2; + word1 = *(ushort *)buf1; + word2 = *(ushort *)buf2; } else { - word1 = *(u_char *)addr1; - word2 = *(u_char *)addr2; + word1 = *(u_char *)buf1; + word2 = *(u_char *)buf2; } if (word1 != word2) { + ulong offset = buf1 - base; + printf("%s at 0x%08lx (%#0*lx) != %s at 0x%08lx (%#0*lx)\n", - type, addr1, size, word1, - type, addr2, size, word2); + type, (ulong)(addr1 + offset), size, word1, + type, (ulong)(addr2 + offset), size, word2); rcode = 1; break; } - addr1 += size; - addr2 += size; + buf1 += size; + buf2 += size; /* reset watchdog from time to time */ if ((ngood % (64 << 10)) == 0) WATCHDOG_RESET(); } + unmap_sysmem(buf1); + unmap_sysmem(buf2); printf("Total of %ld %s(s) were the same\n", ngood, type); return rcode; @@ -328,8 +346,10 @@ static int do_mem_cmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) static int do_mem_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { - ulong addr, dest, count; + ulong addr, dest, count, bytes; int size; + const void *src; + void *buf;
[U-Boot] [PATCH v3 01/22] Tidy up error checking and fix bug in hash command
There are two problems: 1. The argument count needs to be checked before argv is used 2. When verify is not enabled, we need to define a constant zero value Signed-off-by: Simon Glass --- Changes in v3: None Changes in v2: None common/cmd_hash.c | 4 1 file changed, 4 insertions(+) diff --git a/common/cmd_hash.c b/common/cmd_hash.c index 689c608..eb6a338 100644 --- a/common/cmd_hash.c +++ b/common/cmd_hash.c @@ -32,11 +32,15 @@ static int do_hash(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) #ifdef CONFIG_HASH_VERIFY int verify = 0; + if (argc < 4) + return CMD_RET_USAGE; if (!strcmp(argv[1], "-v")) { verify = 1; argc--; argv++; } +#else + const int verify = 0; #endif /* Move forward to 'algorithm' parameter */ argc--; -- 1.8.1.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 15/22] image: Use crc header file instead of C prototypes
We have an existing header which the crc32 definitions, so use it. Signed-off-by: Simon Glass --- Changes in v3: None Changes in v2: None common/image.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/image.c b/common/image.c index ae1a9d3..6afbb40 100644 --- a/common/image.c +++ b/common/image.c @@ -74,6 +74,8 @@ static const image_header_t *image_get_ramdisk(ulong rd_addr, uint8_t arch, #include #endif /* !USE_HOSTCC*/ +#include + static const table_entry_t uimage_arch[] = { { IH_ARCH_INVALID,NULL, "Invalid ARCH", }, { IH_ARCH_ALPHA, "alpha","Alpha",}, @@ -160,8 +162,6 @@ static const table_entry_t uimage_comp[] = { { -1, "", "", }, }; -uint32_t crc32(uint32_t, const unsigned char *, uint); -uint32_t crc32_wd(uint32_t, const unsigned char *, uint, uint); #if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE) || defined(USE_HOSTCC) static void genimg_print_time(time_t timestamp); #endif -- 1.8.1.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 12/22] common: Use new numeric setenv functions
Use setenv_ulong(), setenv_hex() and setenv_addr() in common/ Signed-off-by: Simon Glass --- Changes in v3: - Use spaces instead of tabs for indent in cmd_fdoc.c Changes in v2: None common/cmd_bootm.c| 11 +++ common/cmd_cbfs.c | 4 +--- common/cmd_cramfs.c | 4 +--- common/cmd_fdos.c | 4 +--- common/cmd_jffs2.c| 4 +--- common/cmd_load.c | 12 +++- common/cmd_mtdparts.c | 4 +--- common/cmd_nand.c | 12 +++- common/cmd_nvedit.c | 3 +-- common/cmd_reiser.c | 4 +--- common/cmd_setexpr.c | 39 +++ common/cmd_unzip.c| 4 +--- common/cmd_ximg.c | 7 ++- common/cmd_zfs.c | 3 +-- common/cmd_zip.c | 4 +--- 15 files changed, 48 insertions(+), 71 deletions(-) diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index f0338ba..06b1742 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -446,9 +446,7 @@ static int bootm_start_standalone(ulong iflag, int argc, char * const argv[]) /* Don't start if "autostart" is set to "no" */ if (((s = getenv("autostart")) != NULL) && (strcmp(s, "no") == 0)) { - char buf[32]; - sprintf(buf, "%lX", images.os.image_len); - setenv("filesize", buf); + setenv_hex("filesize", images.os.image_len); return 0; } appl = (int (*)(int, char * const []))(ulong)ntohl(images.ep); @@ -523,17 +521,14 @@ static int do_bootm_subcommand(cmd_tbl_t *cmdtp, int flag, int argc, case BOOTM_STATE_RAMDISK: { ulong rd_len = images.rd_end - images.rd_start; - char str[17]; ret = boot_ramdisk_high(&images.lmb, images.rd_start, rd_len, &images.initrd_start, &images.initrd_end); if (ret) return ret; - sprintf(str, "%lx", images.initrd_start); - setenv("initrd_start", str); - sprintf(str, "%lx", images.initrd_end); - setenv("initrd_end", str); + setenv_hex("initrd_start", images.initrd_start); + setenv_hex("initrd_end", images.initrd_end); } break; #endif diff --git a/common/cmd_cbfs.c b/common/cmd_cbfs.c index 3b6cfd8..f51534b 100644 --- a/common/cmd_cbfs.c +++ b/common/cmd_cbfs.c @@ -65,7 +65,6 @@ int do_cbfs_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) const struct cbfs_cachenode *file; unsigned long offset; unsigned long count; - char buf[12]; long size; if (argc < 3) { @@ -95,8 +94,7 @@ int do_cbfs_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) printf("\n%ld bytes read\n", size); - sprintf(buf, "%lX", size); - setenv("filesize", buf); + setenv_hex("filesize", size); return 0; } diff --git a/common/cmd_cramfs.c b/common/cmd_cramfs.c index e7f496e..0e43ab6 100644 --- a/common/cmd_cramfs.c +++ b/common/cmd_cramfs.c @@ -146,11 +146,9 @@ int do_cramfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) size = cramfs_load ((char *) offset, &part, filename); if (size > 0) { - char buf[10]; printf("### CRAMFS load complete: %d bytes loaded to 0x%lx\n", size, offset); - sprintf(buf, "%x", size); - setenv("filesize", buf); + setenv_hex("filesize", size); } else { printf("### CRAMFS LOAD ERROR<%x> for %s!\n", size, filename); } diff --git a/common/cmd_fdos.c b/common/cmd_fdos.c index fbee861..8ea1140 100644 --- a/common/cmd_fdos.c +++ b/common/cmd_fdos.c @@ -40,7 +40,6 @@ int do_fdosboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) char *name; char *ep; int size; -char buf [12]; int drive = CONFIG_SYS_FDC_DRIVE_NUMBER; /* pre-set load_addr */ @@ -91,8 +90,7 @@ int do_fdosboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } flush_cache (load_addr, size); -sprintf(buf, "%x", size); -setenv("filesize", buf); +setenv_hex("filesize", size); printf("Floppy DOS load complete: %d bytes loaded to 0x%lx\n", size, load_addr); diff --git a/common/cmd_jffs2.c b/common/cmd_jffs2.c index 27296dd..4a4a000 100644 --- a/common/cmd_jffs2.c +++ b/common/cmd_jffs2.c @@ -525,11 +525,9 @@ int do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } if (size > 0) { - char buf[10]; printf("### %s load complete: %d bytes loaded to 0x%lx\n", fsname, size, offset); - sprintf(buf, "%x", size); -
[U-Boot] [PATCH v3 21/22] sandbox: Allow hash functions to work correctly
Use map_sysmem() so that hashing is possible on sandbox. Signed-off-by: Simon Glass --- Changes in v3: None Changes in v2: - Rebase on top of earlier patches common/hash.c | 24 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/common/hash.c b/common/hash.c index 2617316..d6f4aa1 100644 --- a/common/hash.c +++ b/common/hash.c @@ -28,6 +28,7 @@ #include #include #include +#include /* * These are the hash algorithms we support. Chips which support accelerated @@ -117,10 +118,13 @@ static void store_result(struct hash_algo *algo, const u8 *sum, str_ptr = '\0'; setenv(dest, str_output); } else { - u8 *ptr; + ulong addr; + void *buf; - ptr = (u8 *)simple_strtoul(dest, NULL, 16); - memcpy(ptr, sum, algo->digest_size); + addr = simple_strtoul(dest, NULL, 16); + buf = map_sysmem(addr, algo->digest_size); + memcpy(buf, sum, algo->digest_size); + unmap_sysmem(buf); } } @@ -154,10 +158,12 @@ static int parse_verify_sum(struct hash_algo *algo, char *verify_str, u8 *vsum, } if (env_var) { - u8 *ptr; + ulong addr; + void *buf; - ptr = (u8 *)simple_strtoul(verify_str, NULL, 16); - memcpy(vsum, ptr, algo->digest_size); + addr = simple_strtoul(verify_str, NULL, 16); + buf = map_sysmem(addr, algo->digest_size); + memcpy(vsum, buf, algo->digest_size); } else { unsigned int i; char *vsum_str; @@ -228,6 +234,7 @@ int hash_command(const char *algo_name, int flags, cmd_tbl_t *cmdtp, int flag, struct hash_algo *algo; u8 output[HASH_MAX_DIGEST_SIZE]; u8 vsum[HASH_MAX_DIGEST_SIZE]; + void *buf; algo = find_hash_algo(algo_name); if (!algo) { @@ -241,8 +248,9 @@ int hash_command(const char *algo_name, int flags, cmd_tbl_t *cmdtp, int flag, return 1; } - algo->hash_func_ws((const unsigned char *)addr, len, output, - algo->chunk_size); + buf = map_sysmem(addr, len); + algo->hash_func_ws(buf, len, output, algo->chunk_size); + unmap_sysmem(buf); /* Try to avoid code bloat when verify is not needed */ #ifdef CONFIG_HASH_VERIFY -- 1.8.1.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 13/22] fs: Use new numeric setenv functions
Use setenv_ulong(), setenv_hex() and setenv_addr() in fs/ Signed-off-by: Simon Glass --- Changes in v3: - Change incorrect commit title from drivers: to fs: Changes in v2: None fs/fs.c | 4 +--- fs/ubifs/ubifs.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/fs/fs.c b/fs/fs.c index 023e7ef..2c9f2c5 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -256,7 +256,6 @@ int do_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[], unsigned long bytes; unsigned long pos; int len_read; - char buf[12]; unsigned long time; if (argc < 2) @@ -308,8 +307,7 @@ int do_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[], } puts("\n"); - sprintf(buf, "0x%x", len_read); - setenv("filesize", buf); + setenv_hex("filesize", len_read); return 0; } diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c index 44be3f5..273c0a9 100644 --- a/fs/ubifs/ubifs.c +++ b/fs/ubifs/ubifs.c @@ -687,7 +687,6 @@ int ubifs_load(char *filename, u32 addr, u32 size) int i; int count; int last_block_size = 0; - char buf [10]; c->ubi = ubi_open_volume(c->vi.ubi_num, c->vi.vol_id, UBI_READONLY); /* ubifs_findfile will resolve symlinks, so we know that we get @@ -740,8 +739,7 @@ int ubifs_load(char *filename, u32 addr, u32 size) if (err) printf("Error reading file '%s'\n", filename); else { - sprintf(buf, "%X", size); - setenv("filesize", buf); + setenv_hex("filesize", size); printf("Done\n"); } -- 1.8.1.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 11/22] Update set_working_fdt_addr() to use setenv_addr()
We might as well use this common function instead of repeating the same code. Signed-off-by: Simon Glass --- Changes in v3: None Changes in v2: None common/cmd_fdt.c| 11 ++- common/cmd_nvedit.c | 8 include/common.h| 14 +- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c index 6eec947..ac77a08 100644 --- a/common/cmd_fdt.c +++ b/common/cmd_fdt.c @@ -55,12 +55,8 @@ struct fdt_header *working_fdt; void set_working_fdt_addr(void *addr) { - char buf[17]; - working_fdt = addr; - - sprintf(buf, "%lx", (unsigned long)addr); - setenv("fdtaddr", buf); + setenv_addr("fdtaddr", addr); } /* @@ -347,10 +343,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } if (subcmd[0] == 's') { /* get the num nodes at this level */ - char buf[11]; - - sprintf(buf, "%d", curIndex + 1); - setenv(var, buf); + setenv_ulong(var, curIndex + 1); } else { /* node index not found */ printf("libfdt node not found\n"); diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index 7633f0c..44e88aa 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -295,17 +295,17 @@ int setenv_ulong(const char *varname, ulong value) } /** - * Set an environment variable to an address in hex + * Set an environment variable to an value in hex * * @param varname Environmet variable to set - * @param addr Value to set it to + * @param valueValue to set it to * @return 0 if ok, 1 on error */ -int setenv_addr(const char *varname, const void *addr) +int setenv_hex(const char *varname, ulong value) { char str[17]; - sprintf(str, "%lx", (uintptr_t)addr); + sprintf(str, "%lx", value); return setenv(varname, str); } diff --git a/include/common.h b/include/common.h index 1d0728f..6d52924 100644 --- a/include/common.h +++ b/include/common.h @@ -358,7 +358,19 @@ int getenv_yesno(const char *var); intsaveenv (void); intsetenv (const char *, const char *); int setenv_ulong(const char *varname, ulong value); -int setenv_addr(const char *varname, const void *addr); +int setenv_hex(const char *varname, ulong value); +/** + * setenv_addr - Set an environment variable to an address in hex + * + * @varname: Environmet variable to set + * @addr: Value to set it to + * @return 0 if ok, 1 on error + */ +static inline int setenv_addr(const char *varname, const void *addr) +{ + return setenv_hex(varname, (ulong)addr); +} + #ifdef CONFIG_ARM # include # include -- 1.8.1.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 19/22] Move CONFIG_SYS_MEMTEST_SCRATCH #ifdef to top of file
This config effectively has a default value of 0, so add this setting at the top of the code to remove an #ifdef in the C function. Signed-off-by: Simon Glass --- Changes in v3: None Changes in v2: None common/cmd_mem.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/cmd_mem.c b/common/cmd_mem.c index 95b49b2..50838a7 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -39,6 +39,10 @@ DECLARE_GLOBAL_DATA_PTR; +#ifndef CONFIG_SYS_MEMTEST_SCRATCH +#define CONFIG_SYS_MEMTEST_SCRATCH 0 +#endif + static int mod_mem(cmd_tbl_t *, int, int, int, char * const []); /* Display values from last command. @@ -641,11 +645,7 @@ static ulong mem_test_alt(ulong start_addr, ulong end_addr) vu_long temp; vu_long anti_pattern; vu_long num_words; -#if defined(CONFIG_SYS_MEMTEST_SCRATCH) vu_long *dummy = (vu_long *)CONFIG_SYS_MEMTEST_SCRATCH; -#else - vu_long *dummy = NULL; /* yes, this is address 0x0, not NULL */ -#endif static const ulong bitpattern[] = { 0x0001, /* single bit */ 0x0003, /* two adjacent bits */ -- 1.8.1.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 18/22] sandbox: config: Enable hash functions and mtest
Enable the hash command and sha1/256 hashing for sandbox. Also use a better address for memory testing (since the existing one is set up for linux host memory space). Signed-off-by: Simon Glass --- Changes in v3: None Changes in v2: None include/configs/sandbox.h | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h index 9c431bf..9f51a0b 100644 --- a/include/configs/sandbox.h +++ b/include/configs/sandbox.h @@ -63,8 +63,8 @@ #define CONFIG_SYS_HZ 1000 /* Memory things - we don't really want a memory test */ -#define CONFIG_SYS_LOAD_ADDR 0x1000 -#define CONFIG_SYS_MEMTEST_START 0x1000 +#define CONFIG_SYS_LOAD_ADDR 0x +#define CONFIG_SYS_MEMTEST_START 0x0010 #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + 0x1000) #define CONFIG_PHYS_64BIT @@ -85,6 +85,11 @@ #undef CONFIG_CMD_NET #undef CONFIG_CMD_NFS +#define CONFIG_CMD_HASH +#define CONFIG_HASH_VERIFY +#define CONFIG_SHA1 +#define CONFIG_SHA256 + #define CONFIG_BOOTARGS "" #define CONFIG_EXTRA_ENV_SETTINGS "stdin=serial\0" \ -- 1.8.1.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 20/22] sandbox: Update mtest to fix crashes
Use map_sysmem() in the memory tester so that it works as expected on sandbox. Signed-off-by: Simon Glass --- Changes in v3: None Changes in v2: None common/cmd_mem.c | 97 ++-- 1 file changed, 52 insertions(+), 45 deletions(-) diff --git a/common/cmd_mem.c b/common/cmd_mem.c index 50838a7..9c30a2e 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -631,21 +631,19 @@ int do_mem_loopw (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } #endif /* CONFIG_LOOPW */ -static ulong mem_test_alt(ulong start_addr, ulong end_addr) +static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr, + vu_long *dummy) { - vu_long *start, *end; vu_long *addr; ulong errs = 0; ulong val, readback; int j; - vu_long len; vu_long offset; vu_long test_offset; vu_long pattern; vu_long temp; vu_long anti_pattern; vu_long num_words; - vu_long *dummy = (vu_long *)CONFIG_SYS_MEMTEST_SCRATCH; static const ulong bitpattern[] = { 0x0001, /* single bit */ 0x0003, /* two adjacent bits */ @@ -657,8 +655,7 @@ static ulong mem_test_alt(ulong start_addr, ulong end_addr) 0x, /* alternating 1/0 */ }; - start = (vu_long *)start_addr; - end = (vu_long *)end_addr; + num_words = (end_addr - start_addr) / sizeof(vu_long); /* * Data line test: write a pattern to the first @@ -677,11 +674,11 @@ static ulong mem_test_alt(ulong start_addr, ulong end_addr) * '0's and '0' bits through a field of '1's (i.e. * pattern and ~pattern). */ - addr = start; + addr = buf; for (j = 0; j < sizeof(bitpattern) / sizeof(bitpattern[0]); j++) { val = bitpattern[j]; for (; val != 0; val <<= 1) { - *addr = val; + *addr = val; *dummy = ~val; /* clear the test data off the bus */ readback = *addr; if (readback != val) { @@ -740,58 +737,56 @@ static ulong mem_test_alt(ulong start_addr, ulong end_addr) * * Returns: 0 if the test succeeds, 1 if the test fails. */ - len = (end_addr - start_addr) / sizeof(vu_long); pattern = (vu_long) 0x; anti_pattern = (vu_long) 0x; - debug("%s:%d: length = 0x%.8lx\n", - __func__, __LINE__, len); + debug("%s:%d: length = 0x%.8lx\n", __func__, __LINE__, num_words); /* * Write the default pattern at each of the * power-of-two offsets. */ - for (offset = 1; offset < len; offset <<= 1) - start[offset] = pattern; + for (offset = 1; offset < num_words; offset <<= 1) + addr[offset] = pattern; /* * Check for address bits stuck high. */ test_offset = 0; - start[test_offset] = anti_pattern; + addr[test_offset] = anti_pattern; - for (offset = 1; offset < len; offset <<= 1) { - temp = start[offset]; + for (offset = 1; offset < num_words; offset <<= 1) { + temp = addr[offset]; if (temp != pattern) { printf("\nFAILURE: Address bit stuck high @ 0x%.8lx:" " expected 0x%.8lx, actual 0x%.8lx\n", - (ulong)&start[offset], pattern, temp); + start_addr + offset, pattern, temp); errs++; if (ctrlc()) return -1; } } - start[test_offset] = pattern; + addr[test_offset] = pattern; WATCHDOG_RESET(); /* * Check for addr bits stuck low or shorted. */ - for (test_offset = 1; test_offset < len; test_offset <<= 1) { - start[test_offset] = anti_pattern; + for (test_offset = 1; test_offset < num_words; test_offset <<= 1) { + addr[test_offset] = anti_pattern; - for (offset = 1; offset < len; offset <<= 1) { - temp = start[offset]; + for (offset = 1; offset < num_words; offset <<= 1) { + temp = addr[offset]; if ((temp != pattern) && (offset != test_offset)) { printf("\nFAILURE: Address bit stuck low or" " shorted @ 0x%.8lx: expected 0x%.8lx," " actual 0x%.8lx\n", - (ulong)&start[offset], pattern, temp); + start_addr + offset, pattern, temp); errs++;
[U-Boot] [PATCH v3 22/22] hash: Use lower case for hash algorithm names
Rather than use strcasecmp() in the hash algorithm search, require the caller to do this first. Most of U-Boot can use lower case anyway, and the hash command can convert to lower case before calling hash_command(). This saves needing strcasecmp() for boards that use hashing but not the hash command. Signed-off-by: Simon Glass --- Changes in v3: None Changes in v2: None common/cmd_hash.c | 4 common/hash.c | 11 ++- include/hash.h| 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/common/cmd_hash.c b/common/cmd_hash.c index 8c03b5c..4fe0e78 100644 --- a/common/cmd_hash.c +++ b/common/cmd_hash.c @@ -26,9 +26,11 @@ #include #include #include +#include static int do_hash(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { + char *s; #ifdef CONFIG_HASH_VERIFY int flags = HASH_FLAG_ENV; @@ -45,6 +47,8 @@ static int do_hash(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) /* Move forward to 'algorithm' parameter */ argc--; argv++; + for (s = *argv; *s; s++) + *s = tolower(*s); return hash_command(*argv, flags, cmdtp, flag, argc - 1, argv + 1); } diff --git a/common/hash.c b/common/hash.c index d6f4aa1..dc15596 100644 --- a/common/hash.c +++ b/common/hash.c @@ -32,7 +32,8 @@ /* * These are the hash algorithms we support. Chips which support accelerated - * crypto could perhaps add named version of these algorithms here. + * crypto could perhaps add named version of these algorithms here. Note that + * algorithm names must be in lower case. */ static struct hash_algo hash_algo[] = { /* @@ -42,7 +43,7 @@ static struct hash_algo hash_algo[] = { */ #ifdef CONFIG_CMD_SHA1 { - "SHA1", + "sha1", SHA1_SUM_LEN, sha1_csum_wd, CHUNKSZ_SHA1, @@ -51,7 +52,7 @@ static struct hash_algo hash_algo[] = { #endif #ifdef CONFIG_SHA256 { - "SHA256", + "sha256", SHA256_SUM_LEN, sha256_csum_wd, CHUNKSZ_SHA256, @@ -59,7 +60,7 @@ static struct hash_algo hash_algo[] = { #define MULTI_HASH #endif { - "CRC32", + "crc32", 4, crc32_wd_buf, CHUNKSZ_CRC32, @@ -202,7 +203,7 @@ static struct hash_algo *find_hash_algo(const char *name) int i; for (i = 0; i < ARRAY_SIZE(hash_algo); i++) { - if (!strcasecmp(name, hash_algo[i].name)) + if (!strcmp(name, hash_algo[i].name)) return &hash_algo[i]; } diff --git a/include/hash.h b/include/hash.h index f2b2c45..2dbbd9b 100644 --- a/include/hash.h +++ b/include/hash.h @@ -61,7 +61,7 @@ enum { * * This common function is used to implement specific hash commands. * - * @algo_name: Hash algorithm being used + * @algo_name: Hash algorithm being used (lower case!) * @flags: Flags value (HASH_FLAG_...) * @cmdtp: Pointer to command table entry * @flag: Some flags normally 0 (see CMD_FLAG_.. above) -- 1.8.1.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 17/22] Roll crc32 into hash infrastructure
Add the CRC32 algorithm to the list of available hashes, and make the crc32 command use hash_command(). Add a new crc32_wd_buf() to make this possible, which puts its result in a buffer rather than returning it as a 32-bit value. Note: For some boards the hash command is not enabled, neither are sha1, sha256 or the verify option. In this case the full hash implementation adds about 500 bytes of overhead. So as a special case, we use #ifdef to select very simple bahaviour in that case. The justification for this is that it is currently a very common case (virtually all boards enable crc32 but only some enable more advanced features). Signed-off-by: Simon Glass --- Changes in v3: - Fix 'bahviour' typo - Make sha1 code dependent on CONFIG_CMD_SHA1, for code size reasons Changes in v2: - Rewrite crc32 support in hash to improve code size common/cmd_mem.c | 75 +++- common/hash.c| 118 ++- include/hash.h | 2 +- include/u-boot/crc.h | 11 + lib/crc32.c | 9 5 files changed, 108 insertions(+), 107 deletions(-) diff --git a/common/cmd_mem.c b/common/cmd_mem.c index 12dbc16..95b49b2 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -32,6 +32,7 @@ #ifdef CONFIG_HAS_DATAFLASH #include #endif +#include #include #include #include @@ -1098,89 +1099,27 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[]) #ifdef CONFIG_CMD_CRC32 -#ifndef CONFIG_CRC32_VERIFY - static int do_mem_crc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { - ulong addr, length; - ulong crc; - ulong *ptr; - - if (argc < 3) - return CMD_RET_USAGE; - - addr = simple_strtoul (argv[1], NULL, 16); - addr += base_address; - - length = simple_strtoul (argv[2], NULL, 16); - - crc = crc32_wd (0, (const uchar *) addr, length, CHUNKSZ_CRC32); - - printf ("CRC32 for %08lx ... %08lx ==> %08lx\n", - addr, addr + length - 1, crc); - - if (argc > 3) { - ptr = (ulong *) simple_strtoul (argv[3], NULL, 16); - *ptr = crc; - } - - return 0; -} - -#else /* CONFIG_CRC32_VERIFY */ - -int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) -{ - ulong addr, length; - ulong crc; - ulong *ptr; - ulong vcrc; - int verify; + int flags = 0; int ac; char * const *av; - if (argc < 3) { -usage: + if (argc < 3) return CMD_RET_USAGE; - } av = argv + 1; ac = argc - 1; +#ifdef CONFIG_HASH_VERIFY if (strcmp(*av, "-v") == 0) { - verify = 1; + flags |= HASH_FLAG_VERIFY; av++; ac--; - if (ac < 3) - goto usage; - } else - verify = 0; - - addr = simple_strtoul(*av++, NULL, 16); - addr += base_address; - length = simple_strtoul(*av++, NULL, 16); - - crc = crc32_wd (0, (const uchar *) addr, length, CHUNKSZ_CRC32); - - if (!verify) { - printf ("CRC32 for %08lx ... %08lx ==> %08lx\n", - addr, addr + length - 1, crc); - if (ac > 2) { - ptr = (ulong *) simple_strtoul (*av++, NULL, 16); - *ptr = crc; - } - } else { - vcrc = simple_strtoul(*av++, NULL, 16); - if (vcrc != crc) { - printf ("CRC32 for %08lx ... %08lx ==> %08lx != %08lx ** ERROR **\n", - addr, addr + length - 1, crc, vcrc); - return 1; - } } +#endif - return 0; - + return hash_command("crc32", flags, cmdtp, flag, ac, av); } -#endif /* CONFIG_CRC32_VERIFY */ #endif diff --git a/common/hash.c b/common/hash.c index 462853d..2617316 100644 --- a/common/hash.c +++ b/common/hash.c @@ -34,13 +34,19 @@ * crypto could perhaps add named version of these algorithms here. */ static struct hash_algo hash_algo[] = { -#ifdef CONFIG_SHA1 + /* +* This is CONFIG_CMD_SHA1 instead of CONFIG_SHA1 since otherwise it +* bloats the code for boards which use SHA1 but not the 'hash' +* or 'sha1sum' commands. +*/ +#ifdef CONFIG_CMD_SHA1 { "SHA1", SHA1_SUM_LEN, sha1_csum_wd, CHUNKSZ_SHA1, }, +#define MULTI_HASH #endif #ifdef CONFIG_SHA256 { @@ -49,9 +55,27 @@ static struct hash_algo hash_algo[] = { sha256_csum_wd, CHUNKSZ_SHA256, }, +#define MULTI_HASH #endif + { + "CRC32", + 4, + crc32_wd_buf, + CHUNKSZ_CRC32, + }, }; +#if defined(CONFIG_HASH_VERIFY) || de
[U-Boot] [PATCH v3 07/22] Use common mtest iteration counting
The iteration code is the same for each version of the memory test, so pull it out into the common function. Signed-off-by: Simon Glass --- Changes in v3: None Changes in v2: None common/cmd_mem.c | 123 ++- 1 file changed, 59 insertions(+), 64 deletions(-) diff --git a/common/cmd_mem.c b/common/cmd_mem.c index 0e7a4c6..02ff658 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -626,11 +626,9 @@ int do_mem_loopw (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } #endif /* CONFIG_LOOPW */ -static int mem_test_alt(vu_long *start, vu_long *end, - int iteration_limit) +static ulong mem_test_alt(vu_long *start, vu_long *end) { vu_long *addr; - int iterations = 1; ulong errs = 0; ulong val, readback; int j; @@ -657,27 +655,6 @@ static int mem_test_alt(vu_long *start, vu_long *end, 0x, /* alternating 1/0 */ }; - printf("Testing %08x ... %08x:\n", (uint)(uintptr_t)start, - (uint)(uintptr_t)end); - debug("%s:%d: start 0x%p end 0x%p\n", - __func__, __LINE__, start, end); - - for (;;) { - if (ctrlc()) { - putc('\n'); - return 1; - } - - if (iteration_limit && iterations > iteration_limit) { - printf("Tested %d iteration(s) with %lu errors.\n", - iterations-1, errs); - return errs != 0; - } - - printf("Iteration: %6d\r", iterations); - debug("\n"); - iterations++; - /* * Data line test: write a pattern to the first * location, write the 1's complement to a 'parking' @@ -710,7 +687,7 @@ static int mem_test_alt(vu_long *start, vu_long *end, errs++; if (ctrlc()) { putc('\n'); - return 1; + return -1; } } *addr = ~val; @@ -723,7 +700,7 @@ static int mem_test_alt(vu_long *start, vu_long *end, errs++; if (ctrlc()) { putc('\n'); - return 1; + return -1; } } } @@ -791,7 +768,7 @@ static int mem_test_alt(vu_long *start, vu_long *end, errs++; if (ctrlc()) { putc('\n'); - return 1; + return -1; } } } @@ -813,7 +790,7 @@ static int mem_test_alt(vu_long *start, vu_long *end, errs++; if (ctrlc()) { putc('\n'); - return 1; + return -1; } } } @@ -855,7 +832,7 @@ static int mem_test_alt(vu_long *start, vu_long *end, errs++; if (ctrlc()) { putc('\n'); - return 1; + return -1; } } @@ -877,37 +854,38 @@ static int mem_test_alt(vu_long *start, vu_long *end, errs++; if (ctrlc()) { putc('\n'); - return 1; + return -1; } } start[offset] = 0; } - } + + return 0; } -static int mem_test_quick(vu_long *start, vu_long *end, - int iteration_limit, vu_long pattern) +static ulong mem_test_quick(vu_long *start, vu_long *end, vu_long pattern, + int iteration) { vu_long *addr; - int iterations = 1; ulong errs = 0; ulong incr; ulong val, readback; + /* Alternate the pattern */ incr = 1; - for (;;) { - if (ctrlc()) { - putc('\n'); - return 1; - } - - if (iteration_limit && iterations > iteration_limit) { - printf("Tested %d iteration(s) with %lu errors.\n", - iterations-1, errs); - return errs != 0; - } - ++iterations; - + if (iteration & 1) { +
Re: [U-Boot] [PATCH 12/20] common: Use new numeric setenv functions
Hi Tom, On Sun, Feb 24, 2013 at 12:53 PM, Tom Rini wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 02/24/2013 12:45 PM, Simon Glass wrote: >> Hi Tom, >> >> On Mon, Feb 18, 2013 at 2:08 PM, Tom Rini wrote: >>> On Wed, Dec 26, 2012 at 10:57:05AM -0800, Simon Glass wrote: >>> Use setenv_ulong(), setenv_hex() and setenv_addr() in common/ Signed-off-by: Simon Glass >>> [snip] diff --git a/common/cmd_fdos.c b/common/cmd_fdos.c index fbee861..5a35cc1 100644 --- a/common/cmd_fdos.c +++ b/common/cmd_fdos.c >>> [snip] @@ -91,8 +90,7 @@ int do_fdosboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } flush_cache (load_addr, size); -sprintf(buf, "%x", size); -setenv("filesize", buf); + setenv_hex("filesize", size); >>> >>> Tab and space mixing in the function. I'll fix if git am >>> --whitespace=fix doesn't spot and fix. >> >> I'll change it back to spaces so that it is consistent, even if >> checkpatch is upset. There are now 5 patches changed so I will send >> out the whole series again. > > Right, we should always be consistent with the file. From my read of > the series, this was the only one where the file used spaces and the > new insert was tabs, that's what I'm getting at. I guess the others > didn't stick out as obviously? Well I didn't see any other similar problem. There are a few warnings - in one case I am moving code and then fixing it up in a later commit. But I think this is the only one where I am deliberating following the prevailing style to fit in with the surrounding code. Regards, Simon > > - -- > Tom > -BEGIN PGP SIGNATURE- > Version: GnuPG v1.4.11 (GNU/Linux) > Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ > > iQIcBAEBAgAGBQJRKn3kAAoJENk4IS6UOR1WV5gP/Ro7jY8wwUV0O4UMYuFidIVG > 9SsElNnJoFaoO+qske9MAR6YknpJNb0hu10ZSZWoA+Db1gGeHMwAydG/F8eYJOad > IE26MJVzzSbjmsQx7UJcRKNPfDLKWcZDUMtDC+2YAjT8PvUDRkOqHKqLc/WxcawM > ytsw7o+6lf7GWYABjjEdJkRqd4kd+lq+l6sQoBk0qqQkergjP4+Si3BN3h77ZupV > 8hTA7idf3/6ezKjHB3jyMl5kSFrgEPPdhrRNlaYAFriYKpDIwINHEWAYXgQpAtWW > YSA0CQBKZMVE9liMWy3ZWDFslcfk0i72H3m2IP1kNsyRRx0wuekkUlVONc9AQoVe > x3aSnw3LDt0b3SaGhoMLwVKoL6ZI6IKUfAvJNh/tmc/vNbrDmrot2z8mPd4ccKp4 > AfrhlpH4KE8eU6zsVpsVWJ85LHaIBu/5SvW73UFLCDZwwnUUIKCj4A903cweCuoG > i8VrY11OliR/yABz+NRRek7Y8pyBMqq40ES4lZJYrcKXwi0k3OwAraCrA73IZeg3 > d50ME2WTBQ+tR0cFfp8BZxTVYxrTpHA2diOHL7rdFRfAlii3Wt6Ee9Zbb+ozir6q > TKfxVqJYmHpTYiEt6CuYpq6GD+wQnWbAYkZw5DbmEeq65UUid/UUPcLhDhEinmg6 > wbo0UcLD2TLRqc9IS9fX > =lxH4 > -END PGP SIGNATURE- ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/2 V2] EXYNOS5: Snow: Add a configuration file
Dear Rajeshwari, On 21/02/13 15:43, Rajeshwari Shinde wrote: > This patch adds the configuration file for Snow Board and > defines the same in boards.cfg. > > Signed-off-by: Rajeshwari Shinde > --- > Changes in V2: > - Added Maintainer > MAINTAINERS|4 > boards.cfg |1 + > include/configs/snow.h | 33 + > 3 files changed, 38 insertions(+), 0 deletions(-) > create mode 100644 include/configs/snow.h > > diff --git a/MAINTAINERS b/MAINTAINERS > index 45e2dd4..5fc5b4d 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -736,6 +736,10 @@ Chander Kashyap > SMDKV310ARM ARMV7 (EXYNOS4210 SoC) > SMDK5250ARM ARMV7 (EXYNOS5250 SoC) > > +Rajeshwari Shinde Please keep this list to alphabetically. your name should be moved to "S" section. > + > + snowARM ARMV7 (EXYNOS5250 SoC) > + > Lukasz Majewski > > trats ARM ARMV7 (EXYNOS4210 SoC) > diff --git a/boards.cfg b/boards.cfg > index b1319aa..54357eb 100644 > --- a/boards.cfg > +++ b/boards.cfg > @@ -286,6 +286,7 @@ s5p_goni arm armv7 goni >samsung > smdkc100 arm armv7 smdkc100 > samsungs5pc1xx > origenarm armv7 origen > samsungexynos > s5pc210_universalarm armv7 universal_c210 > samsungexynos > +snow arm armv7 smdk5250 > samsungexynos > smdk5250 arm armv7 smdk5250 > samsungexynos > smdkv310 arm armv7 smdkv310 > samsungexynos > tratsarm armv7 trats > samsungexynos > diff --git a/include/configs/snow.h b/include/configs/snow.h > new file mode 100644 > index 000..b8460fd > --- /dev/null > +++ b/include/configs/snow.h > @@ -0,0 +1,33 @@ > +/* > + * Copyright (C) 2013 Samsung Electronics > + * > + * Configuration settings for the SAMSUNG EXYNOS5 Snow board. > + * > + * See file CREDITS for list of people who contributed to this > + * project. > + * > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of the GNU General Public License as > + * published by the Free Software Foundation; either version 2 of > + * the License, or (at your option) any later version. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + * > + * You should have received a copy of the GNU General Public License > + * along with this program; if not, write to the Free Software > + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, > + * MA 02111-1307 USA > + */ > + > +#ifndef __CONFIG_SNOW_H > +#define __CONFIG_SNOW_H > + > +#include > + > +#undef CONFIG_DEFAULT_DEVICE_TREE > +#define CONFIG_DEFAULT_DEVICE_TREE exynos5250-snow > + > +#endif /* __CONFIG_SNOW_H */ > Thanks, Minkyu Kang. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] SMDK5250: FDT: Retrieve board model via DT
On Mon, Feb 18, 2013 at 4:51 AM, Rajeshwari Shinde wrote: > Print out the board model by parsing the device tree file. > > Signed-off-by: Rajeshwari Shinde Acked-by: Simon Glass > --- > board/samsung/smdk5250/smdk5250.c | 11 ++- > 1 files changed, 10 insertions(+), 1 deletions(-) > > diff --git a/board/samsung/smdk5250/smdk5250.c > b/board/samsung/smdk5250/smdk5250.c > index 6f6f2c2..0097b3f 100644 > --- a/board/samsung/smdk5250/smdk5250.c > +++ b/board/samsung/smdk5250/smdk5250.c > @@ -336,8 +336,17 @@ int board_eth_init(bd_t *bis) > #ifdef CONFIG_DISPLAY_BOARDINFO > int checkboard(void) > { > - printf("\nBoard: SMDK5250\n"); > +#ifdef CONFIG_OF_CONTROL > + const char *board_name; > > + board_name = fdt_getprop(gd->fdt_blob, 0, "model", NULL); > + if (board_name == NULL) > + printf("\nUnknown Board\n"); > + else > + printf("\nBoard: %s\n", board_name); > +#else > + printf("\nBoard: SMDK5250\n"); > +#endif > return 0; > } > #endif > -- > 1.7.4.4 > ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/9 v9] EXYNOS5: TMU: Add driver for Thermal Management Unit
Dear Aksahy Saraswat, On 21/02/13 18:20, Akshay Saraswat wrote: > Hi Promsoft, > > > > I have done all the changes suggested by you and pushed new patches except > for one. > > As suggested to keep only one among tmu.h and exynos_tmu.h is not possible > because of the following reasons: please don't top posting. > > 1)There could be many SoC's in future using TMU which need to implement > few TMU related functions not specific to any SoC. > 2)We are using tmu.h to be included in generic files like > common/cmd_dtt.c to call such generic functions like tmu_monitor() as > discussed above. > 3)We need one header file to declare exynos specific registers and > functions which could not be included in generic files, hence, exynos_tmu.h. It doesn't make sense. 1. your code is SoC specific. 2. #include is different from #include 3. exynos-tmu.h is already in arch-exynos. we don't need exynos prefix. > > > Thanks & Regards, > > Akshay Saraswat > > > > --- *Original Message* --- > > *Sender* : Minkyu Kang S4/Engineer/Next Generation > Computing Lab./Samsung Electronics > > *Date* : Feb 20, 2013 17:36 (GMT+09:00) > > *Title* : Re: [U-Boot] [PATCH 1/9 v9] EXYNOS5: TMU: Add driver for Thermal > Management Unit > > > > Dear Akshay, > > On 06/02/13 22:18, Akshay Saraswat wrote: >> Adding Exynos Thermal Management Unit driver to monitor SOC >> temperature and take actions corresponding to states of TMU. >> >> Signed-off-by: Akshay Saraswat >> Acked-by: Simon Glass >> --- >> Changes since v8: >> - None. >> >> arch/arm/include/asm/arch-exynos/exynos-tmu.h | 58 + >> drivers/power/Makefile|1 + >> drivers/power/exynos-tmu.c| 302 >> + >> include/tmu.h | 46 >> 4 files changed, 407 insertions(+) >> create mode 100644 arch/arm/include/asm/arch-exynos/exynos-tmu.h >> create mode 100644 drivers/power/exynos-tmu.c >> create mode 100644 include/tmu.h >> >> diff --git a/arch/arm/include/asm/arch-exynos/exynos-tmu.h >> b/arch/arm/include/asm/arch-exynos/exynos-tmu.h >> new file mode 100644 >> index 000..c79a520 >> --- /dev/null >> +++ b/arch/arm/include/asm/arch-exynos/exynos-tmu.h > > just tmu.h please. > >> @@ -0,0 +1,58 @@ >> +/* >> + * Copyright (c) 2012 Samsung Electronics Co., Ltd. >> + * http://www.samsung.com >> + * Akshay Saraswat >> + * >> + * EXYNOS - Thermal Management Unit >> + * >> + * See file CREDITS for list of people who contributed to this >> + * project. >> + * >> + * This program is free software; you can redistribute it and/or modify >> + * it under the terms of the GNU General Public License version 2 as >> + * published by the Free Software Foundation. >> + * You should have received a copy of the GNU General Public License >> + * along with this program; if not, write to the Free Software >> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, >> + * MA 02111-1307 USA >> + */ >> + >> +#ifndef __ASM_ARCH_TMU_H >> +#define __ASM_ARCH_TMU_H >> + >> +struct tmu_reg { > > is it for exynos5? or exynos4? or both? > >> + unsigned triminfo; >> + unsigned rsvd1; >> + unsigned rsvd2; >> + unsigned rsvd3; >> + unsigned rsvd4; >> + unsigned triminfo_control; >> + unsigned rsvd5; >> + unsigned rsvd6; >> + unsigned tmu_control; >> + unsigned rsvd7; >> + unsigned tmu_status; >> + unsigned sampling_internal; >> + unsigned counter_value0; >> + unsigned counter_value1; >> + unsigned rsvd8; >> + unsigned rsvd9; >> + unsigned current_temp; >> + unsigned rsvd10; >> + unsigned rsvd11; >> + unsigned rsvd12; >> + unsigned threshold_temp_rise; >> + unsigned threshold_temp_fall; >> + unsigned rsvd13; >> + unsigned rsvd14; >> + unsigned past_temp3_0; >> + unsigned past_temp7_4; >> + unsigned past_temp11_8; >> + unsigned past_temp15_12; >> + unsigned inten; >> + unsigned intstat; >> + unsigned intclear; >> + unsigned rsvd15; >> + unsigned emul_con; >> +}; >> +#endif /* __ASM_ARCH_THERMAL_H */ >> diff --git a/drivers/power/Makefile b/drivers/power/Makefile >> index 8c71901..1dac16a 100644 >> --- a/drivers/power/Makefile >> +++ b/drivers/power/Makefile >> @@ -25,6 +25,7 @@ include $(TOPDIR)/config.mk >> >> LIB := $(obj)libpower.o >> >> +COBJS-$(CONFIG_EXYNOS_TMU) += exynos-tmu.o >> COBJS-$(CONFIG_FTPMU010_POWER) += ftpmu010.o >> COBJS-$(CONFIG_TPS6586X_POWER) += tps6586x.o >> COBJS-$(CONFIG_TWL4030_POWER) += twl4030.o >> diff --git a/drivers/power/exynos-tmu.c b/drivers/power/exynos-tmu.c >> new file mode 100644 >> index 000..b010883 >> --- /dev/null >> +++ b/drivers/power/exynos-tmu.c >> @@ -0,0 +1,302 @@ >> +/* >> + * Copyright (c) 2012 Samsung Electronics Co., Ltd. >> + * http://www.samsung.com >> + * Akshay Saraswat >> + * >> + * EXYNOS - Thermal Management Unit >> + * >> + * See file CREDITS for list of people who contributed to this >> + * project. >> + * >> + * This program is free software; you can redistribute it and
Re: [U-Boot] [PATCH v3 17/22] Roll crc32 into hash infrastructure
Hi, On Sun, Feb 24, 2013 at 7:33 PM, Simon Glass wrote: > Add the CRC32 algorithm to the list of available hashes, and make > the crc32 command use hash_command(). Add a new crc32_wd_buf() to > make this possible, which puts its result in a buffer rather than > returning it as a 32-bit value. > > Note: For some boards the hash command is not enabled, neither > are sha1, sha256 or the verify option. In this case the full > hash implementation adds about 500 bytes of overhead. So as a > special case, we use #ifdef to select very simple bahaviour in > that case. The justification for this is that it is currently > a very common case (virtually all boards enable crc32 but only > some enable more advanced features). > > Signed-off-by: Simon Glass > --- > Changes in v3: > - Fix 'bahviour' typo > - Make sha1 code dependent on CONFIG_CMD_SHA1, for code size reasons > > Changes in v2: > - Rewrite crc32 support in hash to improve code size > > common/cmd_mem.c | 75 +++- > common/hash.c| 118 > ++- > include/hash.h | 2 +- > include/u-boot/crc.h | 11 + > lib/crc32.c | 9 > 5 files changed, 108 insertions(+), 107 deletions(-) > ... > diff --git a/common/hash.c b/common/hash.c > index 462853d..2617316 100644 > --- a/common/hash.c > +++ b/common/hash.c > @@ -34,13 +34,19 @@ > * crypto could perhaps add named version of these algorithms here. > */ > static struct hash_algo hash_algo[] = { > -#ifdef CONFIG_SHA1 > + /* > +* This is CONFIG_CMD_SHA1 instead of CONFIG_SHA1 since otherwise it > +* bloats the code for boards which use SHA1 but not the 'hash' > +* or 'sha1sum' commands. > +*/ > +#ifdef CONFIG_CMD_SHA1 Unfortunately this is completely wrong - it should be CONFIG_CMD_SHA1SUM. I will update with a new patch once my build complete. Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] May I join the maintainers of the u-boot blackfin custodian git tree?
Hi all, On Tue, Feb 19, 2013 at 3:27 PM, Sonic Zhang wrote: > Dear Das U-boot developers and upstream git maintainers, > > I am Sonic Zhang from the Blackfin Linux team in > Analog Devices Inc. Blackfin is one of the high performance general > purpose DSPs, which can run complete OS without MMU, such as Linux. I > have worked on the Linux kernel and u-boot porting and driver > developing for Blackfin architecture since year 2005. In addition, I > also manage the annual open source releases for Blackfin GNU > toolchain, Das U-boot and Linux distribution in Analog Devices. The > latest 2012R2 releases was just done on Feb. 4, 2013. The details can > be found on http://blackfin.uclinux.org > > Mike Frysinger used to be our upstream maintainer for the the u-boot > blackfin custodian tree. But, he is no longer with Analog Devices. So, > I take over the u-boot maintaining work for Blackfin now. May I join > the maintainers of the u-boot blackfin custodian git tree at > git://git.denx.de/u-boot-blackfin.git ? My public rsa key file is > attached. > Any comments? Regards, Sonic Zhang ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [RFC PATCH v2 01/15] Implement autoconf header file
Hi Joe, On Sun, Feb 24, 2013 at 11:50 AM, Joe Hershberger wrote: > Hi Simon, > > On Sun, Feb 24, 2013 at 11:25 AM, Simon Glass wrote: >> Add support for generating an autoconf.h header file that can be used in >> the source instead of #ifdef. >> >> For example, instead of: >> >> #ifdef CONFIG_VERSION_VARIABLE >> setenv("ver", version_string); /* set version variable */ >> #endif >> >> you can do: >> >> if (autoconf_version_variable()) >> setenv("ver", version_string); /* set version variable */ > > You are changing the meaning between these two examples. The old code > was #ifDEF, which means the new example needs to be autoconf_HAS_*. > Is there a reason to muddy the waters by recommending people use this > automatic value of 0 instead of using the "has" function? Any more > than without this patch we should go change most all the #ifdef to > #if? Thanks much for going through this so carefully. Here is my thinking on this point - I will respond to the rest of your comments when I get back to this. I believe we should get rid of the 'has' function eventually. Most features are anyway just a 0 or a 1 - either the feature is enabled or it is disabled. There are some where a value is provided, and that means that the feature is automatically enabled. I'm not a huge fan of that. To me we should have two completely different concepts in U-Boot: - enabling an option, which generally just affects which files are compiled - i.e. an option that should generally only appear in Makefiles - configuring something, by which I mean giving the code a value to work with. This should come either from CONFIG for compile-time config, or device tree for run-time config At present these two are mixed up, and I don't think it aids clarity. There are very very few CONFIGs that need this 'has' option I think. I know about BOOTDELAY, and I'm sure there are others, but there was recent discussion on the list about whether we should separate out the bootdelay/autoboot value from the enablement, wasn't there? > >> The compiler will ensure that the dead code is eliminated, so the result >> is the same. >> >> Where the value of the CONFIG define is 0, you can use the autoconf_has...() >> form. For example CONFIG_BOOTDELAY can be -ve, 0 or +ve, but if it is >> defined at all, it affects behaviour: >> >> #if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) >> s = getenv ("bootdelay"); >> #endif >> >> So we use: >> >> if (autoconf_has_bootdelay() && autoconf_bootdelay() >= 0) >> s = getenv ("bootdelay"); >> >> This later form should only be used for such 'difficult' defines where a >> zero value still means that the CONFIG should be considered to be defined. >> >> Signed-off-by: Simon Glass >> --- >> Changes in v2: >> - Split out changes to main.c into separate patches >> - Fix up a few errors and comments in the original RFC >> - Use autoconf_...() instead of config_...() >> - Use autoconf_has_...() instead of config_..._enabled() >> - Add a grep to the sed/sort pipe to speed up processing >> >> Makefile | 42 - >> README| 87 >> +-- >> include/common.h | 3 ++ >> include/config_drop.h | 17 + >> tools/scripts/define2conf.sed | 37 ++ >> tools/scripts/define2list.sed | 31 +++ >> 6 files changed, 213 insertions(+), 4 deletions(-) >> create mode 100644 include/config_drop.h >> create mode 100644 tools/scripts/define2conf.sed >> create mode 100644 tools/scripts/define2list.sed >> >> diff --git a/Makefile b/Makefile >> index fc18dd4..9f4f55d 100644 >> --- a/Makefile >> +++ b/Makefile >> @@ -614,6 +614,7 @@ updater: >> # parallel sub-makes creating .depend files simultaneously. >> depend dep:$(TIMESTAMP_FILE) $(VERSION_FILE) \ >> $(obj)include/autoconf.mk \ >> + $(obj)include/generated/autoconf.h \ >> $(obj)include/generated/generic-asm-offsets.h \ >> $(obj)include/generated/asm-offsets.h >> for dir in $(SUBDIRS) $(CPUDIR) $(LDSCRIPT_MAKEFILE_DIR) ; >> do \ >> @@ -688,6 +689,44 @@ $(obj)include/autoconf.mk: $(obj)include/config.h >> sed -n -f tools/scripts/define2mk.sed > $@.tmp && \ >> mv $@.tmp $@ >> >> +# Create a C header file where every '#define CONFIG_XXX value' becomes >> +# '#define config_xxx() value', or '#define config_xxx() 0' where the CONFIG >> +# is not used by this board configuration. This allows C code to do things >> +# like 'if (config_xxx())' and have the compiler remove the dead code, >> +# instead of using '#ifdef CONFIG_XXX...#endif'. Note that in most cases >> +# if the config_...() returns 0 then the option is not enabled. In some rare >> +# cases such as CONFIG_BOOTDELAY, the config can be enabled but still have a >> +# a value of 0. So in addition we a #d
Re: [U-Boot] [PATCH v2 16/21] hash: Add a flag to support saving hashes in the environment
Hi Wolfgang, On Thu, Feb 21, 2013 at 4:04 AM, Wolfgang Denk wrote: > Dear Simon Glass, > > In message <1361379515-23802-17-git-send-email-...@chromium.org> you wrote: >> Some hashing commands permit saving the hash in an environment variable, >> and verifying a hash from there. But the crc32 command does not support >> this. In order to permit crc32 to use the generic hashing infrastructure, >> add a flag to select which behaviour to use. > > > > ... >> + /* >> + * If environment variables are allowed, then we assume that 'dest' >> + * is an environment variable, unless it starts with *, in which >> + * case we assume it is an address. If not allowed, it ia always an > > s/it ia/it is/ > > > > What's the impact of these changes on the memory footprint? Overall it is pretty neutral, although there are some variations. For powerpc the overall affect is to save an average of 13.9 bytes across the whole image. arm does a bit better: 24: hash: Use lower case for hash algorithm names sandbox:sandbox x86: (for 1/1 boards) all -74.0 data +16.0 rodata +10.0 text -100.0 m68k: (for 41/50 boards) all -44.7 bss +0.5 data +0.8 rodata -1.0 text -44.9 powerpc: (for 633/635 boards) all -13.9 bss +14.4 data -3.6 rodata -19.6 text -5.1 sandbox: (for 1/1 boards) all +24336.0 bss +48.0 data +168.0 rodata +432.0 text +23688.0 sh: (for 16/21 boards) all +18.8 rodata -1.2 text +20.0 nios2: (for 3/3 boards) all +277.3 text +277.3 microblaze: (for 1/1 boards) all -832.0 bss +8.0 data -16.0 rodata -120.0 text -704.0 arm: (for 292/292 boards) all -277.8 bss +0.4 data +0.3 rodata -3.8 spl/u-boot-spl:all -0.2 spl/u-boot-spl:rodata -0.1 spl/u-boot-spl:text -0.1 text -274.7 nds32: (for 3/3 boards) all -116.0 data +4.0 rodata -16.0 text -104.0 Bad boards define CONFIG_CMD_CRC32 along with CONFIG_CRC32_VERIFY, thus bringing in the hash code, but they don't enable the hash command or have sha1, so this is the worst case. Good boards benefit from the getenv/setenv helpers and use the small version of the hash code (since they only define CONFIG_CMD_CRC32). The vast majority of boards show a slight improvement overall. This is the worst powerpc board: powerpc: (for 2/2 boards) all +284.5 bss +12.0 rodata -13.5 text +286.0 stxxtc : all +941 bss +24 data +16 rodata +89 text +812 u-boot: add: 8/0, grow: 3/-10 bytes: 1254/-432 (822) function old new delta hash_command - 740+740 show_hash- 108+108 simple_itoa - 104+104 crc32_wd_buf - 76 +76 setenv_hex - 64 +64 setenv_ulong - 52 +52 do_mem_mtest 468 512 +44 static.local - 22 +22 do_mem_loop268 288 +20 hash_algo- 16 +16 do_mem_cmp 356 364 +8 do_mem_mw 224 220 -4 set_working_fdt_addr68 52 -16 load_serial_ymodem 288 272 -16 load_serial504 488 -16 do_load_serial_bin18121796 -16 do_imgextract 656 620 -36 NetLoop784 748 -36 do_bootm 12161164 -52 do_mem_cp 344 288 -56 do_mem_crc 308 124-184 This is the best powerpc board: P2041RDB_SRIO_PCIE_BOOT: all -372 data -16 rodata -116 text -240 u-boot: add: 5/-1, grow: 2/-15 bytes: 446/-640 (-194) function old new delta hash_command - 176+176 simple_itoa - 104+104 setenv_hex - 64 +64 setenv_ulong - 52 +52 static.local - 22 +22 do_mem_loop268 288 +2
[U-Boot] [PATCH v4 18/22] sandbox: config: Enable hash functions and mtest
Enable the hash command and sha1/256 hashing for sandbox. Also use a better address for memory testing (since the existing one is set up for linux host memory space). Signed-off-by: Simon Glass --- Changes in v4: None Changes in v3: None Changes in v2: None include/configs/sandbox.h | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h index 9c431bf..9f51a0b 100644 --- a/include/configs/sandbox.h +++ b/include/configs/sandbox.h @@ -63,8 +63,8 @@ #define CONFIG_SYS_HZ 1000 /* Memory things - we don't really want a memory test */ -#define CONFIG_SYS_LOAD_ADDR 0x1000 -#define CONFIG_SYS_MEMTEST_START 0x1000 +#define CONFIG_SYS_LOAD_ADDR 0x +#define CONFIG_SYS_MEMTEST_START 0x0010 #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + 0x1000) #define CONFIG_PHYS_64BIT @@ -85,6 +85,11 @@ #undef CONFIG_CMD_NET #undef CONFIG_CMD_NFS +#define CONFIG_CMD_HASH +#define CONFIG_HASH_VERIFY +#define CONFIG_SHA1 +#define CONFIG_SHA256 + #define CONFIG_BOOTARGS "" #define CONFIG_EXTRA_ENV_SETTINGS "stdin=serial\0" \ -- 1.8.1.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v4 17/22] Roll crc32 into hash infrastructure
Add the CRC32 algorithm to the list of available hashes, and make the crc32 command use hash_command(). Add a new crc32_wd_buf() to make this possible, which puts its result in a buffer rather than returning it as a 32-bit value. Note: For some boards the hash command is not enabled, neither are sha1, sha256 or the verify option. In this case the full hash implementation adds about 500 bytes of overhead. So as a special case, we use #ifdef to select very simple bahaviour in that case. The justification for this is that it is currently a very common case (virtually all boards enable crc32 but only some enable more advanced features). Signed-off-by: Simon Glass --- Changes in v4: - Use CONFIG_CMD_SHA1SUM instead of the non-existent CONFIG_CMD_SHA1 Changes in v3: - Fix 'bahviour' typo - Make sha1 code dependent on CONFIG_CMD_SHA1, for code size reasons Changes in v2: - Rewrite crc32 support in hash to improve code size common/cmd_mem.c | 75 +++- common/hash.c| 118 ++- include/hash.h | 2 +- include/u-boot/crc.h | 11 + lib/crc32.c | 9 5 files changed, 108 insertions(+), 107 deletions(-) diff --git a/common/cmd_mem.c b/common/cmd_mem.c index 12dbc16..95b49b2 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -32,6 +32,7 @@ #ifdef CONFIG_HAS_DATAFLASH #include #endif +#include #include #include #include @@ -1098,89 +1099,27 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[]) #ifdef CONFIG_CMD_CRC32 -#ifndef CONFIG_CRC32_VERIFY - static int do_mem_crc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { - ulong addr, length; - ulong crc; - ulong *ptr; - - if (argc < 3) - return CMD_RET_USAGE; - - addr = simple_strtoul (argv[1], NULL, 16); - addr += base_address; - - length = simple_strtoul (argv[2], NULL, 16); - - crc = crc32_wd (0, (const uchar *) addr, length, CHUNKSZ_CRC32); - - printf ("CRC32 for %08lx ... %08lx ==> %08lx\n", - addr, addr + length - 1, crc); - - if (argc > 3) { - ptr = (ulong *) simple_strtoul (argv[3], NULL, 16); - *ptr = crc; - } - - return 0; -} - -#else /* CONFIG_CRC32_VERIFY */ - -int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) -{ - ulong addr, length; - ulong crc; - ulong *ptr; - ulong vcrc; - int verify; + int flags = 0; int ac; char * const *av; - if (argc < 3) { -usage: + if (argc < 3) return CMD_RET_USAGE; - } av = argv + 1; ac = argc - 1; +#ifdef CONFIG_HASH_VERIFY if (strcmp(*av, "-v") == 0) { - verify = 1; + flags |= HASH_FLAG_VERIFY; av++; ac--; - if (ac < 3) - goto usage; - } else - verify = 0; - - addr = simple_strtoul(*av++, NULL, 16); - addr += base_address; - length = simple_strtoul(*av++, NULL, 16); - - crc = crc32_wd (0, (const uchar *) addr, length, CHUNKSZ_CRC32); - - if (!verify) { - printf ("CRC32 for %08lx ... %08lx ==> %08lx\n", - addr, addr + length - 1, crc); - if (ac > 2) { - ptr = (ulong *) simple_strtoul (*av++, NULL, 16); - *ptr = crc; - } - } else { - vcrc = simple_strtoul(*av++, NULL, 16); - if (vcrc != crc) { - printf ("CRC32 for %08lx ... %08lx ==> %08lx != %08lx ** ERROR **\n", - addr, addr + length - 1, crc, vcrc); - return 1; - } } +#endif - return 0; - + return hash_command("crc32", flags, cmdtp, flag, ac, av); } -#endif /* CONFIG_CRC32_VERIFY */ #endif diff --git a/common/hash.c b/common/hash.c index 462853d..ef6fe37 100644 --- a/common/hash.c +++ b/common/hash.c @@ -34,13 +34,19 @@ * crypto could perhaps add named version of these algorithms here. */ static struct hash_algo hash_algo[] = { -#ifdef CONFIG_SHA1 + /* +* This is CONFIG_CMD_SHA1SUM instead of CONFIG_SHA1 since otherwise +* it bloats the code for boards which use SHA1 but not the 'hash' +* or 'sha1sum' commands. +*/ +#ifdef CONFIG_CMD_SHA1SUM { "SHA1", SHA1_SUM_LEN, sha1_csum_wd, CHUNKSZ_SHA1, }, +#define MULTI_HASH #endif #ifdef CONFIG_SHA256 { @@ -49,9 +55,27 @@ static struct hash_algo hash_algo[] = { sha256_csum_wd, CHUNKSZ_SHA256, }, +#define MULTI_HASH #endif + { + "CRC32", + 4, + crc32_wd_
[U-Boot] [PATCH V2 1/2] lcd: implement a callback for splashimage
On some architectures certain values of splashimage will lead to a data abort exception. Document the problem, and implement a callback for splashimage to reject such values. Cc: Anatolij Gustschin Cc: Wolfgang Denk Signed-off-by: Nikita Kiryanov Acked-by: Igor Grinberg --- Changes in V2: - A grammar correction in README: s/If you don't think you will not/If you think you will not README | 11 +++ common/lcd.c | 26 ++ doc/README.displaying-bmps | 27 +++ include/env_callback.h |7 +++ 4 files changed, 71 insertions(+) create mode 100644 doc/README.displaying-bmps diff --git a/README b/README index 4e4fd7d..f5bdab9 100644 --- a/README +++ b/README @@ -1530,6 +1530,17 @@ CBFS (Coreboot Filesystem) support allows for a "silent" boot where a splash screen is loaded very quickly after power-on. + CONFIG_SPLASHIMAGE_GUARD + + If this option is set, then U-Boot will prevent the environment + variable "splashimage" from being set to a problematic address + (see README.displaying-bmps and README.arm-unaligned-accesses). + This option is useful for targets where, due to alignment + restrictions, an improperly aligned BMP image will cause a data + abort. If you think you will not have problems with unaligned + accesses (for example because your toolchain prevents them) + there is no need to set this option. + CONFIG_SPLASH_SCREEN_ALIGN If this option is set the splash image can be freely positioned diff --git a/common/lcd.c b/common/lcd.c index ba6975b..590bbb9 100644 --- a/common/lcd.c +++ b/common/lcd.c @@ -33,6 +33,8 @@ #include #include #include +#include +#include #include #include #if defined(CONFIG_POST) @@ -1099,6 +1101,30 @@ static void *lcd_logo(void) #endif /* CONFIG_LCD_LOGO && !CONFIG_LCD_INFO_BELOW_LOGO */ } +#ifdef CONFIG_SPLASHIMAGE_GUARD +static int on_splashimage(const char *name, const char *value, enum env_op op, + int flags) +{ + ulong addr; + int aligned; + + if (op == env_op_delete) + return 0; + + addr = simple_strtoul(value, NULL, 16); + /* See README.displaying-bmps */ + aligned = (addr % 4 == 2); + if (!aligned) { + printf("Invalid splashimage value. Value must be 16 bit aligned, but not 32 bit aligned\n"); + return -1; + } + + return 0; +} + +U_BOOT_ENV_CALLBACK(splashimage, on_splashimage); +#endif + void lcd_position_cursor(unsigned col, unsigned row) { console_col = min(col, CONSOLE_COLS - 1); diff --git a/doc/README.displaying-bmps b/doc/README.displaying-bmps new file mode 100644 index 000..3311541 --- /dev/null +++ b/doc/README.displaying-bmps @@ -0,0 +1,27 @@ +If you are experiencing hangups/data-aborts when trying to display a BMP image, +the following might be relevant to your situation... + +Some architectures cannot handle unaligned memory accesses, and an attempt to +perform one will lead to a data abort. On such architectures it is necessary to +make sure all data is properly aligned, and in many situations simply choosing +a 32 bit aligned address is enough to ensure proper alignment. This is not +always the case when dealing with data that has an internal layout such as a +BMP image: + +BMP images have a header that starts with 2 byte-size fields followed by mostly +32 bit fields. The packed struct that represents this header can be seen below: + +typedef struct bmp_header { + /* Header */ + char signature[2]; + __u32 file_size; + __u32 reserved; + __u32 data_offset; + ... etc +} __attribute__ ((packed)) bmp_header_t; + +When placed in an aligned address such as 0x80a0, char signature offsets +the __u32 fields into unaligned addresses (in our example 0x80a2, +0x80a6, and so on...). When these fields are accessed by U-Boot, a 32 bit +access is generated at a non-32-bit-aligned address, causing a data abort. +The proper alignment for BMP images is therefore: 32-bit-aligned-address + 2. diff --git a/include/env_callback.h b/include/env_callback.h index c583120..62428d1 100644 --- a/include/env_callback.h +++ b/include/env_callback.h @@ -41,6 +41,12 @@ #define SILENT_CALLBACK #endif +#ifdef CONFIG_SPLASHIMAGE_GUARD +#define SPLASHIMAGE_CALLBACK "splashimage:splashimage," +#else +#define SPLASHIMAGE_CALLBACK +#endif + /* * This list of callback bindings is static, but may be overridden by defining * a new association in the ".callbacks" environment variable. @@ -51,6 +57,7 @@ "bootfile:bootfile," \ "loadaddr:loadaddr," \ SILENT_CALLBACK \ + SPLASHIMAGE_CALLBACK \ "stdin:console,stdout:console,stderr:console," \ CONFIG_
Re: [U-Boot] [PATCH] powerpc/mpc85xx: add setting of clock-frequency for mpic node
Hi Andy, Could you ack this patch? Thanks. > -Original Message- > From: Wang Dongsheng-B40534 > Sent: Thursday, January 31, 2013 12:52 PM > To: u-boot@lists.denx.de > Cc: Wang Dongsheng-B40534 > Subject: [PATCH] powerpc/mpc85xx: add setting of clock-frequency for mpic > node > > Set the device tree property associated with the mpic source > frequency. The frequency is used for mpic timer. > > Signed-off-by: Wang Dongsheng > --- > arch/powerpc/cpu/mpc85xx/fdt.c |5 + > 1 files changed, 5 insertions(+), 0 deletions(-) > > diff --git a/arch/powerpc/cpu/mpc85xx/fdt.c > b/arch/powerpc/cpu/mpc85xx/fdt.c > index 3a268aa..f07d1cf 100644 > --- a/arch/powerpc/cpu/mpc85xx/fdt.c > +++ b/arch/powerpc/cpu/mpc85xx/fdt.c > @@ -663,6 +663,11 @@ void ft_cpu_setup(void *blob, bd_t *bd) > #ifdef CONFIG_FSL_CORENET > do_fixup_by_compat_u32(blob, "fsl,qoriq-clockgen-1.0", > "clock-frequency", CONFIG_SYS_CLK_FREQ, 1); > + do_fixup_by_compat_u32(blob, "fsl,mpic", > + "clock-frequency", get_bus_freq(0)/2, 1); > +#else > + do_fixup_by_compat_u32(blob, "fsl,mpic", > + "clock-frequency", get_bus_freq(0), 1); > #endif > > fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize); > -- > 1.7.5.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot