[U-Boot] PERSIST_SECONDARY_BOOT in imx53
Dear All, I am trying to use the redundant boot option of imx53, that is working with with freescale's v2009.08, but when I am trying it on v2013.01, system is unable to boot from secondary location(when primary is corrupted). I think it is not supporting booting from any other location except 0x400, even I put the secondary image table at 0x200. Please suggest.. DISCLAIMER: This email may contain confidential information and is intended only for the use of the specific individual(s) to which it is addressed. If you are not the intended recipient of this email, you are hereby notified that any unauthorized use, dissemination or copying of this email or the information contained in it or attached to it is strictly prohibited. If you received this message in error, please immediately notify the sender at Infotech and delete the original message. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] Read uEnv.txt from EXT4 partition
I am running U-Boot 2013.01-05972-gd80f33a. When I power the board I get: ** Unrecognized filesystem type ** 206 bytes read in 21 ms (8.8 KiB/s) Loaded environment from uEnv.txt ** Unrecognized filesystem type ** ** File not found boot.scr ** ** File not found boot/boot.scr ** ** Unrecognized filesystem type ** uboot# So I issue these commands: setenv bootargs 'root=/dev/mmcblk0p1 rw rootwait=3 console=ttyS0,115200n8 loglevel=7 mem=256M@0x4000' ext4load mmc 0 0x4300 /boot/script.bin; ext4load mmc 0 0x4800 /boot/uImage; bootm 0x4800 And the system boots as expected. So I know that uboot can read from my EXT4 partition. Is their any way to change the default filesystem type from FAT or change the default boot scan to search for uEnv.txt in /boot as well as different filesystems? Thanks! ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] patch error
Dear Benoît Thébaude, I git the u-boot-imx from denx.And I patch your patches,but I get error as: git apply U-Boot-v7-14-19-imx-Fix-automatic-make-targets-for-imx-images.patch error: error: patch failed: Makefile:486 error: Makefile: patch does not apply How can i do? thanks wanxs ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] patch error
Dear Marek Vasut, Thanks for your patches.But when I patch them to my u-boot,I get a error. I get u-boot-imx from denx. git apply U-Boot-1-4-common-imx-Implement-generic-u-boot.nand-target.patch error: patch failed: Makefile:470 error: Makefile: patch does not apply error: patch failed: arch/arm/imx-common/Makefile:50 your wanxs ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [u-boot-mips] gp init and -pie option
Hi, I got a problem while I was trying out v2013.01.01 on the u-boot-mips fork repo. It looks like my u-boot binary built with -pie linker option doesn't work due to wrong gp initialization. In the start.S file, the gp is supposed to be initialized with _gp because ra will hold the address of .word _gp line. The below is part of start.S. ... /* Initialize $gp */ bal 1f nop .word _gp 1: lw gp, 0(ra) ... Without the -pie option, linker puts the start address of the .got section. However, with -pie option, the .word _gp is translated to nop. The below is disassembled code. 84001490 reset: ... 840014b8: 40804800mtc0zero,c0_count 840014bc: 40805800mtc0zero,c0_compare 840014c0: 04110002bal 840014cc reset+0x3c 840014c4: nop 840014c8: nop --- 840014cc: 8ffclw gp,0(ra) 840014d0: 3c1d8440lui sp,0x8440 840014d4: 8f9982c0lw t9,-32064(gp) 840014d8: 0328jr t9 840014dc: nop Could anyone tell me what is going on here? Am I missing anything? Thanks, Justin ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [u-boot-mips] gp init and -pie option
2013/2/25 Juhyun (Justin) Oh juhyun...@sigmadesigns.com: Hi, I got a problem while I was trying out v2013.01.01 on the u-boot-mips fork repo. It looks like my u-boot binary built with -pie linker option doesn't work due to wrong gp initialization. In the start.S file, the gp is supposed to be initialized with _gp because ra will hold the address of .word _gp line. The below is part of start.S. ... /* Initialize $gp */ bal 1f nop .word _gp 1: lw gp, 0(ra) ... Without the -pie option, linker puts the start address of the .got section. However, with -pie option, the .word _gp is translated to nop. The below is disassembled code. 84001490 reset: ... 840014b8: 40804800mtc0zero,c0_count 840014bc: 40805800mtc0zero,c0_compare 840014c0: 04110002bal 840014cc reset+0x3c 840014c4: nop 840014c8: nop --- 840014cc: 8ffclw gp,0(ra) 840014d0: 3c1d8440lui sp,0x8440 840014d4: 8f9982c0lw t9,-32064(gp) 840014d8: 0328jr t9 840014dc: nop Could anyone tell me what is going on here? Am I missing anything? Thanks, Justin which board and toolchain do you use? PIE support has been tested with various toolchains from ELDK, CodeSourcery and OpenWRT. -- Best regards, Daniel ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] Flash protection and fw_setenv tool
Hi, I activated flash sector protection for our CFI NOR flash chip (CONFIG_SYS_FLASH_PROTECTION). Protection bits for U-Boot code sectors and environment sector are set by default during U-Boot startup. Thus from Linux, I cannot write to this sectors, which is generally a correct behavior. BUT, with this, changing the environment from user space with the fw_setenv tool does not work anymore. And here's the question: How to deal with this issue correctly? Two approaches came in my mind: a) Unprotecting the flash sectors by the Linux kernel (in CFI driver). This seems not to be implemented yet, at least for AMD CFI command set (0x0002). However, when unprotecting flash sectors from Linux side, does a sector protection actually makes sense? b) Introduce a config option in U-Boot which allows to leave the environment unprotected. See patch below. I called this option CONFIG_ENV_UNPROTECTED When defined, U-Boot does not protect the environment. For compatibility with boards in which the environment sector is already protected, I left the unprotect part in the saveenv function untouched. Any comments about this issue? Thanks and regards Georg Index: common/env_flash.c === --- common/env_flash.c (revision 3966) +++ common/env_flash.c (working copy) @@ -218,9 +218,12 @@ done: if (saved_data) free(saved_data); + +#ifndef CONFIG_ENV_UNPROTECTED /* try to re-protect */ flash_sect_protect(1, (ulong)flash_addr, end_addr); flash_sect_protect(1, (ulong)flash_addr_new, end_addr_new); +#endif return rc; } Index: drivers/mtd/cfi_flash.c === --- drivers/mtd/cfi_flash.c (revision 3966) +++ drivers/mtd/cfi_flash.c (working copy) @@ -2294,7 +2294,7 @@ #endif /* Environment protection ON by default */ -#ifdef CONFIG_ENV_IS_IN_FLASH +#if defined(CONFIG_ENV_IS_IN_FLASH) !defined(CONFIG_ENV_UNPROTECTED) flash_protect(FLAG_PROTECT_SET, CONFIG_ENV_ADDR, CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE - 1, ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [U-boot] unicode support
Hi, experts: Does u-boot supports Unicode language characters display? Such as : Eastern asia language? Best wishes, ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [U-boot] unicode support
Hi, experts: Does u-boot supports Unicode language characters display? Such as : Eastern asia language? Best wishes, ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] patch error
Dear wanxs, On Tuesday, February 26, 2013 2:06:29 AM, wanxs wrote: Dear Marek Vasut, Thanks for your patches.But when I patch them to my u-boot,I get a error. I get u-boot-imx from denx. git apply U-Boot-1-4-common-imx-Implement-generic-u-boot.nand-target.patch error: patch failed: Makefile:470 error: Makefile: patch does not apply error: patch failed: arch/arm/imx-common/Makefile:50 u-boot-imx/master has changed since my v7. For v7, you should use u-boot-imx/master at commit 4adfcd68cc10449e2fda0f9fac8b09f2b5c09a02. For my future v8, u-boot-imx/master at HEAD will be fine. 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 1/4] common: imx: Implement generic u-boot.nand target
On Tuesday, February 26, 2013 8:19:42 AM, Marek Vasut wrote: Dear Benoît Thébaudeau, Dear Scott Wood, On Tuesday, February 26, 2013 12:07:25 AM, Scott Wood wrote: On 02/25/2013 05:03:30 PM, Marek Vasut wrote: Dear Scott Wood, So maybe we need a more general (but optional) CONFIG_BUILD_TARGET. Can you elaborate? Same as CONFIG_SPL_TARGET, but not SPL-specific. Basically a way for a board config file to add to $(ALL-y). So each one would set the appropriate CONFIG_BUILD_TARGET for whatever needs to get built, and then something like CONFIG_NAND_IMAGE could hold the image name that should be linked to produce a standard u-boot-nand.bin output. Yea, sounds reasonable. But why call it CONFIG_ , it can't be stored in the board.h files, it has to be somewhere in the Makefile hierarchy. Why can't it go in the board.h files? We could do all that, but should we? As I said to Marek, I think that it's a big mistake to omit the SPL here. The only other solution to get a reliable boot would be the DBBT, but it's very hard to use in real life, away from a production line. The SPL is really easy to enable here, and it's only a matter of time before someone gets bitten by this lack of reliability, so why not just do things right? The boot time and footprint of an SPL would really be negligible, and it's not because other implementations omit both SPL and a valid DBBT that U-Boot should do the same. I'm not against SPL, but then we're starting to drift away from the whole idea of generating u-boot-nand.bin or similar image. Being able to generate u-boot- nand.bin or u-boot-sd.bin etc ... on a per-CPU basis (since this is CPU specific) is the ultimate goal here, whatever is embedded in the image. OK, I didn't know that this was your goal here. If the contents of the image do not matter, then my u-boot-with-nand-spl.imx could be renamed into your u-boot-nand.bin with the appropriate FCB header, and CONFIG_SPL_TARGET could be changed to something more generic as Scott explained. Best regards, Benoît ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] problem to boot i.MX28 custom platform
Greetings, I'm porting a custom platform based on mx28evk to latest U-Boot. I modified the iomux.c for my platform (different DUART pins) and made some changes to mxs_adjust_memory_params() to accommodate to my DRAM chip. I built the u-boot.sb. The platform however does not boot either from USB or from MMC. When loaded through USB, sb_loader complains with the messages at [1]. I fear the CPU resets before even executing the SPL code, but how could I tell? Is there a way to check if the CPU reaches this code at all? I don't see any ROM error codes either and the CPU seems to reset (when the USB recovery mode fails, the target defaults to boot from flash my old v2009 U-Boot). Is there any other init stuff (linker scripts or something) I should take care of that's preventing sb_loader to fully load the image? Thank you. [1] sb_loader output 'Freescale,Inc.' 'ROM Recovery' device at USB path 0002:0034:00 Downloading 415504 bytes... hid_write report id 01 len 0x1f hid_write report id 02 len 0x400 . hid_write report id 02 len 0x400 . hid_write report id 02 len 0x400 . hid_write report id 02 len 0x400 . hid_write report id 02 len 0x400 . hid_write report id 02 len 0x400 . hid_write report id 02 len 0x400 . hid_write report id 02 len 0x400 . hid_write report id 02 len 0x400 . hid_write report id 02 len 0x400 . hid_write report id 02 len 0x400 . hid_write report id 02 len 0x400 . hid_write report id 02 len 0x400 . hid_write report id 02 len 0x400 ERROR: hid_write() returned -1 (error (null)) -- Héctor Palacios ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] Flash protection and fw_setenv tool
Hi again, the previous patch missed some places to apply the unprotect switch. Here's an improved version: Index: common/env_flash.c === --- common/env_flash.c (revision 4065) +++ common/env_flash.c (working copy) @@ -218,9 +218,12 @@ done: if (saved_data) free(saved_data); + +#ifndef CONFIG_ENV_UNPROTECTED /* try to re-protect */ flash_sect_protect(1, (ulong)flash_addr, end_addr); flash_sect_protect(1, (ulong)flash_addr_new, end_addr_new); +#endif return rc; } @@ -310,7 +313,9 @@ if (saved_data) free(saved_data); /* try to re-protect */ +#ifndef CONFIG_ENV_UNPROTECTED flash_sect_protect(1, (long)flash_addr, end_addr); +#endif return rc; } #endif /* CMD_SAVEENV */ @@ -340,7 +345,9 @@ flash_write(flag, (ulong)(flash_addr_new-flags), sizeof(flash_addr_new-flags)); +#ifndef CONFIG_ENV_UNPROTECTED flash_sect_protect(1, (ulong)flash_addr_new, end_addr_new); +#endif } if (flash_addr-flags != ACTIVE_FLAG @@ -352,7 +359,9 @@ flash_write(flag, (ulong)(flash_addr-flags), sizeof(flash_addr-flags)); +#ifndef CONFIG_ENV_UNPROTECTED flash_sect_protect(1, (ulong)flash_addr, end_addr); +#endif } if (gd-env_valid == 2) Index: drivers/mtd/cfi_flash.c === --- drivers/mtd/cfi_flash.c (revision 4065) +++ drivers/mtd/cfi_flash.c (working copy) @@ -2294,7 +2294,7 @@ #endif /* Environment protection ON by default */ -#ifdef CONFIG_ENV_IS_IN_FLASH +#if defined(CONFIG_ENV_IS_IN_FLASH) !defined(CONFIG_ENV_UNPROTECTED) flash_protect(FLAG_PROTECT_SET, CONFIG_ENV_ADDR, CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE - 1, @@ -2302,7 +2302,7 @@ #endif /* Redundant environment protection ON by default */ -#ifdef CONFIG_ENV_ADDR_REDUND +#if defined(CONFIG_ENV_ADDR_REDUND) !defined(CONFIG_ENV_UNPROTECTED) flash_protect(FLAG_PROTECT_SET, CONFIG_ENV_ADDR_REDUND, CONFIG_ENV_ADDR_REDUND + CONFIG_ENV_SECT_SIZE - 1, Regards Georg -Ursprüngliche Nachricht- Von: u-boot-boun...@lists.denx.de [mailto:u-boot-boun...@lists.denx.de] Im Auftrag von Waibel Georg Gesendet: Dienstag, 26. Februar 2013 12:05 An: 'u-boot@lists.denx.de' Betreff: [U-Boot] Flash protection and fw_setenv tool Hi, I activated flash sector protection for our CFI NOR flash chip (CONFIG_SYS_FLASH_PROTECTION). Protection bits for U-Boot code sectors and environment sector are set by default during U-Boot startup. Thus from Linux, I cannot write to this sectors, which is generally a correct behavior. BUT, with this, changing the environment from user space with the fw_setenv tool does not work anymore. And here's the question: How to deal with this issue correctly? Two approaches came in my mind: a) Unprotecting the flash sectors by the Linux kernel (in CFI driver). This seems not to be implemented yet, at least for AMD CFI command set (0x0002). However, when unprotecting flash sectors from Linux side, does a sector protection actually makes sense? b) Introduce a config option in U-Boot which allows to leave the environment unprotected. See patch below. I called this option CONFIG_ENV_UNPROTECTED When defined, U-Boot does not protect the environment. For compatibility with boards in which the environment sector is already protected, I left the unprotect part in the saveenv function untouched. Any comments about this issue? Thanks and regards Georg Index: common/env_flash.c === --- common/env_flash.c (revision 3966) +++ common/env_flash.c (working copy) @@ -218,9 +218,12 @@ done: if (saved_data) free(saved_data); + +#ifndef CONFIG_ENV_UNPROTECTED /* try to re-protect */ flash_sect_protect(1, (ulong)flash_addr, end_addr); flash_sect_protect(1, (ulong)flash_addr_new, end_addr_new); +#endif return rc; } Index: drivers/mtd/cfi_flash.c === --- drivers/mtd/cfi_flash.c (revision 3966) +++ drivers/mtd/cfi_flash.c (working copy) @@ -2294,7 +2294,7 @@ #endif /* Environment protection ON by default */ -#ifdef CONFIG_ENV_IS_IN_FLASH +#if defined(CONFIG_ENV_IS_IN_FLASH) !defined(CONFIG_ENV_UNPROTECTED) flash_protect(FLAG_PROTECT_SET, CONFIG_ENV_ADDR, CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE - 1, ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v3] Introduced btrfs file-system with btrload command
On 25/02/13 23:02, Simon Glass wrote: Hi, On Mon, Feb 25, 2013 at 7:04 AM, Tom Rini tr...@ti.com wrote: On Mon, Feb 25, 2013 at 12:24:37PM +, Adnan Ali wrote: Introduces btrfs file-system to read file from volume/sub-volumes with btrload command. This implementation has read-only support. This btrfs implementation is based on syslinux btrfs code, commit 269ebc845ebc8b46ef4b0be7fa0005c7fdb95b8d. Signed-off-by: Adnan Ali adnan@codethink.co.uk A few things: - In general in fs/btrfs/btrfs.c I see some coding style problems (lack of spacing, non-printf's longer than 80-wide). Do these come from syslinux and thus will make any re-syncs easier? - It looks like you added support for CONFIG_CMD_FS_GENERIC, if so did you test that? - Can you please enable this support code on at least one platform, preferably the one you've tested and developed with? [snip] diff --git a/fs/fs.c b/fs/fs.c [snip] +//file handle is valid get the size of the file /* Style comments only */ +len=filedata.size; And spacing between variable and assignment. @@ -178,7 +248,6 @@ int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype) for (i = 0; i ARRAY_SIZE(fstypes); i++) { if ((fstype != FS_TYPE_ANY) (fstype != fstypes[i].fstype)) continue; - if (!fstypes[i].probe()) { fs_type = fstypes[i].fstype; return 0; [snip] @@ -208,7 +280,6 @@ static void fs_close(void) int fs_ls(const char *dirname) { int ret; - switch (fs_type) { case FS_TYPE_FAT: ret = fs_ls_fat(dirname); Unrelated, please drop. @@ -237,11 +311,13 @@ int fs_read(const char *filename, ulong addr, int offset, int len) case FS_TYPE_EXT: ret = fs_read_ext(filename, addr, offset, len); break; +case FS_TYPE_BTR: + ret = fs_read_btr(filename, addr, offset, len); + break; default: ret = fs_read_unsupported(filename, addr, offset, len); break; } - fs_close(); And unrelated whitespace changes here as well. diff --git a/include/btrfs.h b/include/btrfs.h [snip] +/* + * Extent structure: contains the mapping of some chunk of a file + * that is contiguous on disk. + */ +struct extent { +//sector_tpstart; /* Physical start sector */ +__le64 pstart; Fix please. +/* + * Our definition of not whitespace + */ +static inline char not_whitespace(char c) +{ + return (unsigned char)c ' '; +} Can't you just use isspace from linux/ctypes.h ? diff --git a/include/crc32c.h b/include/crc32c.h new file mode 100644 index 000..d04916e --- /dev/null +++ b/include/crc32c.h @@ -0,0 +1,48 @@ +/* + * Copied from Linux kernel crypto/crc32c.c + * Copyright (c) 2004 Cisco Systems, Inc. + * Copyright (c) 2008 Herbert Xu herb...@gondor.apana.org.au + * + * 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 is the CRC-32C table + * Generated with: + * width = 32 bits + * poly = 0x1EDC6F41 + * reflect input bytes = true + * reflect output bytes = true + */ + +/* + * Steps through buffer one byte at at time, calculates reflected + * crc using table. + */ + +static inline u32 crc32c_cal(u32 crc, const char *data, size_t length, u32 *crc32c_table) +{ + while (length--) + crc = crc32c_table[(u8)(crc ^ *data++)] ^ (crc 8); + + return crc; +} + +static inline void crc32c_init(u32 *crc32c_table, u32 pol) +{ + int i, j; + u32 v; + const u32 poly = pol; /* Bit-reflected CRC32C polynomial */ + + for (i = 0; i 256; i++) { + v = i; + for (j = 0; j 8; j++) { + v = (v 1) ^ ((v 1) ? poly : 0); + } + crc32c_table[i] = v; + } +} Simon, since you've just been over all the crc32 recently, do we have these functions somewhere already that can be easily tapped in to? Thanks! Should be - see lib/crc32.c. There is already at least one other copy (ubifs I think) so we should try to avoid adding more. Maybe the polynomial is different here? But even so it should go with the existing code I think. I have tried using crc code lib/crc32.c but it always failed even though i did change the polynomial but still result is search for file on btrfs fails due to bad crc calculation. I have also enable dynamic table creation but still result is same. so should add my my crc code under ifdef in lib/crc32.c what do you suggest? Regards, Simon -- Tom ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v7 04/19] imx: mx53ard: Add support for NAND Flash
Hi Benoit, On Fri, Feb 15, 2013 at 6:54 PM, Benoît Thébaudeau benoit.thebaud...@advansee.com wrote: Add support for the Samsung K9LAG08U0M NAND Flash (2-GiB MLC NAND Flash, 2-kiB pages, 256-kiB blocks, 30-ns R/W cycles, 1 CS) on mx53ard. eNFC_CLK_ROOT is set up with a cycle time of 37.5 ns (400 MHz / 3 / 5) for this board, which satisfies the 30-ns NF R/W cycle requirement. Signed-off-by: Benoît Thébaudeau benoit.thebaud...@advansee.com NAND is not detected on my mx53ard. I think we need to adjust the IOMUX as per: http://git.freescale.com/git/cgit.cgi/imx/uboot-imx.git/tree/board/freescale/mx53_ard/mx53_ard.c?h=imx_v2009.08 Regards, Fabio Estevam ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v7 04/19] imx: mx53ard: Add support for NAND Flash
On Tue, Feb 26, 2013 at 10:22 AM, Fabio Estevam feste...@gmail.com wrote: Hi Benoit, On Fri, Feb 15, 2013 at 6:54 PM, Benoît Thébaudeau benoit.thebaud...@advansee.com wrote: Add support for the Samsung K9LAG08U0M NAND Flash (2-GiB MLC NAND Flash, 2-kiB pages, 256-kiB blocks, 30-ns R/W cycles, 1 CS) on mx53ard. eNFC_CLK_ROOT is set up with a cycle time of 37.5 ns (400 MHz / 3 / 5) for this board, which satisfies the 30-ns NF R/W cycle requirement. Signed-off-by: Benoît Thébaudeau benoit.thebaud...@advansee.com NAND is not detected on my mx53ard. I think we need to adjust the IOMUX as per: http://git.freescale.com/git/cgit.cgi/imx/uboot-imx.git/tree/board/freescale/mx53_ard/mx53_ard.c?h=imx_v2009.08 Yes, after using the same IOMUX from FSL U-boot I get: NAND: NAND device: Manufacturer ID: 0xec, Chip ID: 0xd5 (Samsung NAND 2GiB 3,3) NAND bus width 16 instead 8 bit No NAND device found!!! 0 MiB MX53ARD U-Boot nand info Device 0: NAND 2GiB 3,3V 8-bit, sector size 256 KiB Page size 2048 b OOB size 64 b Erase size 262144 b MX53ARD U-Boot ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 4/4] mx5: Add support for DENX M53EVK
On Mon, Feb 25, 2013 at 3:24 PM, Marek Vasut ma...@denx.de wrote: +int print_cpuinfo(void) +{ + u32 cpurev; + + cpurev = get_cpu_rev(); + printf(CPU: Freescale i.MX%x family rev%d.%d at %d MHz\n, + (cpurev 0xFF000) 12, + (cpurev 0x000F0) 4, + (cpurev 0xF) 0, + mxc_get_clock(MXC_ARM_CLK) / 100); + printf(Reset cause: %s\n, get_reset_cause()); + return 0; Do you need to define print_cpuinfo locally? I know I did the same on mx53loco, and the reason is that due to the PMIC I need to read the CPU frequency after the PMIC has raised the core voltage and bumped to 1GHz. I do not see PMIC definitions in this board, so you probably you can just remove this local definition and add #define CONFIG_DISPLAY_CPUINFO into your m53evk.h board instead. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] Flash protection and fw_setenv tool
Hi Georg, maybe removing CONFIG_SYS_FLASH_PROTECTION from your configuration does already what you want to achieve. BTW Linux support should be available here: http://patchwork.ozlabs.org/patch/213602/ Cheers Dirk -Original Message- From: u-boot-boun...@lists.denx.de [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Waibel Georg Sent: Tuesday, February 26, 2013 1:46 PM To: u-boot@lists.denx.de Subject: Re: [U-Boot] Flash protection and fw_setenv tool Hi again, the previous patch missed some places to apply the unprotect switch. Here's an improved version: Index: common/env_flash.c === --- common/env_flash.c(revision 4065) +++ common/env_flash.c(working copy) @@ -218,9 +218,12 @@ done: if (saved_data) free(saved_data); + +#ifndef CONFIG_ENV_UNPROTECTED /* try to re-protect */ flash_sect_protect(1, (ulong)flash_addr, end_addr); flash_sect_protect(1, (ulong)flash_addr_new, end_addr_new); +#endif return rc; } @@ -310,7 +313,9 @@ if (saved_data) free(saved_data); /* try to re-protect */ +#ifndef CONFIG_ENV_UNPROTECTED flash_sect_protect(1, (long)flash_addr, end_addr); +#endif return rc; } #endif /* CMD_SAVEENV */ @@ -340,7 +345,9 @@ flash_write(flag, (ulong)(flash_addr_new-flags), sizeof(flash_addr_new-flags)); +#ifndef CONFIG_ENV_UNPROTECTED flash_sect_protect(1, (ulong)flash_addr_new, end_addr_new); +#endif } if (flash_addr-flags != ACTIVE_FLAG @@ -352,7 +359,9 @@ flash_write(flag, (ulong)(flash_addr-flags), sizeof(flash_addr-flags)); +#ifndef CONFIG_ENV_UNPROTECTED flash_sect_protect(1, (ulong)flash_addr, end_addr); +#endif } if (gd-env_valid == 2) Index: drivers/mtd/cfi_flash.c === --- drivers/mtd/cfi_flash.c (revision 4065) +++ drivers/mtd/cfi_flash.c (working copy) @@ -2294,7 +2294,7 @@ #endif /* Environment protection ON by default */ -#ifdef CONFIG_ENV_IS_IN_FLASH +#if defined(CONFIG_ENV_IS_IN_FLASH) !defined(CONFIG_ENV_UNPROTECTED) flash_protect(FLAG_PROTECT_SET, CONFIG_ENV_ADDR, CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE - 1, @@ -2302,7 +2302,7 @@ #endif /* Redundant environment protection ON by default */ -#ifdef CONFIG_ENV_ADDR_REDUND +#if defined(CONFIG_ENV_ADDR_REDUND) !defined(CONFIG_ENV_UNPROTECTED) flash_protect(FLAG_PROTECT_SET, CONFIG_ENV_ADDR_REDUND, CONFIG_ENV_ADDR_REDUND + CONFIG_ENV_SECT_SIZE - 1, Regards Georg Messe-Highlights 2013. Wir freuen uns auf Ihren Besuch. Broadcast Video Expo 2013 London - 26.02. bis 28.02.2013 - Stand B22 CeBIT 2013 In Hannover - 05.03. bis 09.03.2012 - Halle 11, Stand D31 ATC Global 2013 Amsterdam - 12.03. bis 14.03.2012 - Halle 10, Stand D202 Besuchen Sie unseren Blog auf http://blog.gdsys.de oder folgen Sie uns auf: twitter: http://twitter.com/#!/gdsys facebook: http://www.facebook.com/pages/Guntermann-Drunck-GmbH/318396891518396 Google+ : https://plus.google.com/100228872787564309232/ YouTube: http://www.youtube.com/user/GuntermannDrunck Guntermann Drunck GmbH Systementwicklung Dortmunder Str. 4a D-57234 Wilnsdorf - Germany Tel: +49 (0) 27 39 / 89 01 - 100 Fax: +49 (0) 27 39 / 89 01 - 120 E-Mail: sa...@gdsys.de - Web: www.gdsys.de Geschäftsführer: Udo Guntermann - Martin Drunck - Reiner Ruelmann HRB 2884, Amtsgericht Siegen - WEEE-Reg.-Nr. DE30763240 USt.-Id.-Nr. DE 126575222 - Steuer-Nr. 342 / 5835 / 1041 DQS-zertifiziert nach ISO 9001:2008 -Ursprüngliche Nachricht- Von: u-boot-boun...@lists.denx.de [mailto:u-boot-boun...@lists.denx.de] Im Auftrag von Waibel Georg Gesendet: Dienstag, 26. Februar 2013 12:05 An: 'u-boot@lists.denx.de' Betreff: [U-Boot] Flash protection and fw_setenv tool Hi, I activated flash sector protection for our CFI NOR flash chip (CONFIG_SYS_FLASH_PROTECTION). Protection bits for U-Boot code sectors and environment sector are set
Re: [U-Boot] [PATCH v7 04/19] imx: mx53ard: Add support for NAND Flash
Hi Benoît, On Tue, Feb 26, 2013 at 10:35 AM, Fabio Estevam feste...@gmail.com wrote: Yes, after using the same IOMUX from FSL U-boot I get: NAND: NAND device: Manufacturer ID: 0xec, Chip ID: 0xd5 (Samsung NAND 2GiB 3,3) NAND bus width 16 instead 8 bit No NAND device found!!! 0 MiB This should be fixed separetely and it is not related to your patch. I will submit a patch for this 16-bit detection issue I was able to read and write to NAND, I have also tested to save env vars into NAND and it works fine. So, after changing the IOMUX as per FSL U-boot you can add my: Tested-by: Fabio Estevam fabio.este...@freescale.com ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] bootm: fix conditional compilation for bootm ramdisk subcommand
All code related to the bootm ramdisk subcommand is conditionally enabled by CONFIG_SYS_BOOT_RAMDISK_HIGH except for the help message. Replace the CONFIG_ARCH defines by CONFIG_SYS_BOOT_RAMDISK_HIGH to fix this. Signed-off-by: Daniel Schwierzeck daniel.schwierz...@gmail.com --- common/cmd_bootm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 1b8a8c1..221187f 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -1055,7 +1055,7 @@ static char bootm_help_text[] = issued in the order below (it's ok to not issue all sub-commands):\n \tstart [addr [arg ...]]\n \tloados - load OS image\n -#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_SPARC) +#if defined(CONFIG_SYS_BOOT_RAMDISK_HIGH) \tramdisk - relocate initrd, set env initrd_start/initrd_end\n #endif #if defined(CONFIG_OF_LIBFDT) -- 1.8.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] Flash protection and fw_setenv tool
Hi Dirk, I enabled the flash protection to protect the UBoot from being overwritten, since this means that customers need to send back the device for reprogramming the UBoot (without a valid bootloader, our MPC5200 target can only be accesses by a programmer like the BDI2000 debugger). Thus for our application it makes sense to have the protection on. Having the CONFIG_ENV_UNPROTECTED option fits to our requirements pretty well. I was just wondering if this option is something that is commonly useful... Thanks and regards Georg -Ursprüngliche Nachricht- Von: Eibach, Dirk [mailto:eib...@gdsys.de] Gesendet: Dienstag, 26. Februar 2013 15:07 An: Waibel Georg; u-boot@lists.denx.de Cc: Stefan Roese Betreff: RE: [U-Boot] Flash protection and fw_setenv tool Hi Georg, maybe removing CONFIG_SYS_FLASH_PROTECTION from your configuration does already what you want to achieve. BTW Linux support should be available here: http://patchwork.ozlabs.org/patch/213602/ Cheers Dirk -Original Message- From: u-boot-boun...@lists.denx.de [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Waibel Georg Sent: Tuesday, February 26, 2013 1:46 PM To: u-boot@lists.denx.de Subject: Re: [U-Boot] Flash protection and fw_setenv tool Hi again, the previous patch missed some places to apply the unprotect switch. Here's an improved version: Index: common/env_flash.c == = --- common/env_flash.c (revision 4065) +++ common/env_flash.c (working copy) @@ -218,9 +218,12 @@ done: if (saved_data) free(saved_data); + +#ifndef CONFIG_ENV_UNPROTECTED /* try to re-protect */ flash_sect_protect(1, (ulong)flash_addr, end_addr); flash_sect_protect(1, (ulong)flash_addr_new, end_addr_new); +#endif return rc; } @@ -310,7 +313,9 @@ if (saved_data) free(saved_data); /* try to re-protect */ +#ifndef CONFIG_ENV_UNPROTECTED flash_sect_protect(1, (long)flash_addr, end_addr); +#endif return rc; } #endif /* CMD_SAVEENV */ @@ -340,7 +345,9 @@ flash_write(flag, (ulong)(flash_addr_new-flags), sizeof(flash_addr_new-flags)); +#ifndef CONFIG_ENV_UNPROTECTED flash_sect_protect(1, (ulong)flash_addr_new, end_addr_new); +#endif } if (flash_addr-flags != ACTIVE_FLAG @@ -352,7 +359,9 @@ flash_write(flag, (ulong)(flash_addr-flags), sizeof(flash_addr-flags)); +#ifndef CONFIG_ENV_UNPROTECTED flash_sect_protect(1, (ulong)flash_addr, end_addr); +#endif } if (gd-env_valid == 2) Index: drivers/mtd/cfi_flash.c == = --- drivers/mtd/cfi_flash.c (revision 4065) +++ drivers/mtd/cfi_flash.c (working copy) @@ -2294,7 +2294,7 @@ #endif /* Environment protection ON by default */ -#ifdef CONFIG_ENV_IS_IN_FLASH +#if defined(CONFIG_ENV_IS_IN_FLASH) !defined(CONFIG_ENV_UNPROTECTED) flash_protect(FLAG_PROTECT_SET, CONFIG_ENV_ADDR, CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE - 1, @@ - 2302,7 +2302,7 @@ #endif /* Redundant environment protection ON by default */ -#ifdef CONFIG_ENV_ADDR_REDUND +#if defined(CONFIG_ENV_ADDR_REDUND) !defined(CONFIG_ENV_UNPROTECTED) flash_protect(FLAG_PROTECT_SET, CONFIG_ENV_ADDR_REDUND, CONFIG_ENV_ADDR_REDUND + CONFIG_ENV_SECT_SIZE - 1, Regards Georg -- -- Messe-Highlights 2013. Wir freuen uns auf Ihren Besuch. Broadcast Video Expo 2013 London - 26.02. bis 28.02.2013 - Stand B22 CeBIT 2013 In Hannover - 05.03. bis 09.03.2012 - Halle 11, Stand D31 ATC Global 2013 Amsterdam - 12.03. bis 14.03.2012 - Halle 10, Stand D202 -- -- Besuchen Sie unseren Blog auf http://blog.gdsys.de oder folgen Sie uns auf: twitter: http://twitter.com/#!/gdsys facebook: http://www.facebook.com/pages/Guntermann-Drunck- GmbH/318396891518396 Google+ : https://plus.google.com/100228872787564309232/ YouTube: http://www.youtube.com/user/GuntermannDrunck -- -- Guntermann Drunck GmbH Systementwicklung Dortmunder Str. 4a D-57234 Wilnsdorf - Germany Tel: +49 (0) 27 39 / 89 01 - 100 Fax: +49 (0) 27 39 / 89 01 - 120 E-Mail: sa...@gdsys.de - Web: www.gdsys.de -- -- Geschäftsführer: Udo Guntermann - Martin Drunck - Reiner Ruelmann HRB 2884,
[U-Boot] Remounting UBI image leads to ECC errors
We have a custom made AM335x board I'm working on and I have encountered a problem when mounting an ubifs image from nand. If I ... (1) Write an ubifs image to nand (2) Mount the ubifs image (3) Repeat step (2) ... this then corrupts the ubifs image. Below is a full log. Can anyone help ? Regards Mark J. --- U-Boot SPL 2013.01-00336-g044fbc4-dirty (Feb 26 2013 - 14:07:36) U-Boot 2013.01-00336-g044fbc4-dirty (Feb 26 2013 - 14:07:36) I2C: ready DRAM: 256 MiB WARNING: Caches not enabled NAND: 256 MiB MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1 musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine, bulk split, HB-ISO Rx, HB-ISO Tx, SoftConn) musb-hdrc: MHDRC RTL version 2.0 musb-hdrc: setup fifo_mode 4 musb-hdrc: 28/31 max ep, 16384/16384 memory USB Host mode controller at 47401000 using PIO, IRQ 0 Net: cpsw U-Boot# nandecc hw 2 HW BCH8 selected U-Boot# mw.b 8200 ff 81f000 U-Boot# dhcp 8200 10.0.0.100:/nanobone/rootfs.ubifs link up on port 0, speed 100, full duplex BOOTP broadcast 1 *** Unhandled DHCP Option in OFFER/ACK: 46 *** Unhandled DHCP Option in OFFER/ACK: 46 DHCP client bound to address 10.0.0.104 Using cpsw device TFTP from server 10.0.0.100; our IP address is 10.0.0.104 Filename '/nanobone/rootfs.ubifs'. Load address: 0x8200 Loading: # # # # # # # 657.2 KiB/s done Bytes transferred = 6029312 (5c hex) U-Boot# nand erase 20 400 NAND erase: device 0 offset 0x20, size 0x400 Erasing at 0x41e -- 100% complete. OK U-Boot# nand write 8200 20 81f000 NAND write: device 0 offset 0x20, size 0x81f000 8515584 bytes written: OK U-Boot# nandecc hw 2 HW BCH8 selected U-Boot# mtdparts default U-Boot# ubi part rootfs Creating 1 MTD partitions on nand0: 0x0020-0x0420 : mtd=6 UBI: attaching mtd1 to ubi0 UBI: physical eraseblock size: 131072 bytes (128 KiB) UBI: logical eraseblock size:129024 bytes UBI: smallest flash I/O unit:2048 UBI: sub-page size: 512 UBI: VID header offset: 512 (aligned 512) UBI: data offset:2048 UBI: volume 0 (root) re-sized from 44 to 503 LEBs UBI: attached mtd1 to ubi0 UBI: MTD device name:mtd=6 UBI: MTD device size:64 MiB UBI: number of good PEBs:512 UBI: number of bad PEBs: 0 UBI: max. allowed volumes: 128 UBI: wear-leveling threshold:4096 UBI: number of internal volumes: 1 UBI: number of user volumes: 1 UBI: available PEBs: 0 UBI: total number of reserved PEBs: 512 UBI: number of PEBs reserved for bad PEB handling: 5 UBI: max/mean erase counter: 1/0 U-Boot# nandecc hw 2 HW BCH8 selected U-Boot# mtdparts default U-Boot# ubi part rootfs UBI: mtd1 is detached from ubi0 Creating 1 MTD partitions on nand0: 0x0020-0x0420 : mtd=6 UBI: attaching mtd1 to ubi0 UBI: physical eraseblock size: 131072 bytes (128 KiB) UBI: logical eraseblock size:129024 bytes UBI: smallest flash I/O unit:2048 UBI: sub-page size: 512 UBI: VID header offset: 512 (aligned 512) UBI: data offset:2048 ECC: uncorrectable. ECC: uncorrectable. UBI error: ubi_io_read: error -74 while reading 64 bytes from PEB 510:0, read 64 bytes ECC: uncorrectable. ECC: uncorrectable. UBI error: ubi_io_read: error -74 while reading 512 bytes from PEB 510:512, read 512 bytes ECC: uncorrectable. ECC: uncorrectable. UBI error: ubi_io_read: error -74 while reading 64 bytes from PEB 511:0, read 64 bytes ECC: uncorrectable. ECC: uncorrectable. UBI error: ubi_io_read: error -74 while reading 512 bytes from PEB 511:512, read 512 bytes ECC: uncorrectable. ECC: uncorrectable. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v7 02/19] nand: mxc: Add support for i.MX5
Benoit, On Fri, Feb 15, 2013 at 6:54 PM, Benoît Thébaudeau benoit.thebaud...@advansee.com wrote: +#elif defined(CONFIG_MX51) || defined(CONFIG_MX53) +static int is_16bit_nand(void) +{ + struct src *src = (struct src *)SRC_BASE_ADDR; + + if (readl(src-sbmr) SRC_SBMR_NF16B) + return 1; + else + return 0; This logic is not working on my tests with mx53ard and it results in: NAND: NAND device: Manufacturer ID: 0xec, Chip ID: 0xd5 (Samsung NAND 2GiB 3,3) NAND bus width 16 instead 8 bit No NAND device found!!! 0 MiB I am using NAND, but not booting from it, so I don't think we should use SBMR register to decide the NAND bus width. If we are not booting from NAND, shouldn't we use a CONFIG_ option in mx53ard.h to tell the NAND bus width? Regards, Fabio Estevam ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 0/4] Add NAND support to DFU
Hey all, This is a v2 of Pantelis' DFU for NAND patches. Based on Scott's feedback on the list as well as some further discussion, things have been reworked so that we are not using the command interface but instead calling nand_(read|write)_skip_bad directly. This needed some changes to that code so that we can find out how much space was used for our buffer (as we write in chunks). The NAND changes have been compile-tested on all ARM and PowerPC targets and run-time tested on ARM. A pleasant side-effect of these changes is that we can now, when writing to mtdparts defined partitions at least, check for and prevent cases when badblocks would cause us to previously silently overwrite part of the next partition. For practical reasons, this series depends on Pantelis' previous series of generic DFU changes. Changes since v1: - NAND skip_check_len changes reworked to allow nand_(read|write)_skip_bad to return this information to the caller. - dfu_nand calls nand_(read|write)_skip_bad directly. - Bugfix in dfu_nand to make sure we set dfu-skip_bad to 0 on each iteration. - Define mtdparts for am335x_evm - Set both dfu_alt_info_mmc and dfu_alt_info_nand on am335x_evm so that there working examples for both by default. -- Tom ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 1/4] nand: Extend nand_(read|write)_skip_bad with *actual and limit parameters
We make these two functions take a size_t pointer to how much space was used on NAND to read or write the buffer (when reads/writes happen) so that bad blocks can be accounted for. We also make them take an loff_t limit on how much data can be read or written. This means that we can now catch the case of when writing to a partition would exceed the partition size due to bad blocks. To do this we also need to make check_skip_len care about total actual size used rather than block_size chunks used. All callers of nand_(read|write)_skip_bad are adjusted to call these with the most sensible limits available. The changes were started by Pantelis and finished by Tom. Cc: Scott Wood scottw...@freescale.com Signed-off-by: Pantelis Antoniou pa...@antoniou-consulting.com Signed-off-by: Tom Rini tr...@ti.com --- common/cmd_nand.c| 61 + common/env_nand.c|5 ++-- drivers/mtd/nand/nand_util.c | 62 +++--- include/nand.h |4 +-- 4 files changed, 82 insertions(+), 50 deletions(-) diff --git a/common/cmd_nand.c b/common/cmd_nand.c index 1568594..e091e02 100644 --- a/common/cmd_nand.c +++ b/common/cmd_nand.c @@ -137,7 +137,8 @@ static inline int str2long(const char *p, ulong *num) return *p != '\0' *endptr == '\0'; } -static int get_part(const char *partname, int *idx, loff_t *off, loff_t *size) +static int get_part(const char *partname, int *idx, loff_t *off, loff_t *size, + loff_t *maxsize) { #ifdef CONFIG_CMD_MTDPARTS struct mtd_device *dev; @@ -160,6 +161,7 @@ static int get_part(const char *partname, int *idx, loff_t *off, loff_t *size) *off = part-offset; *size = part-size; + *maxsize = part-offset + part-size; *idx = dev-id-num; ret = set_dev(*idx); @@ -173,10 +175,11 @@ static int get_part(const char *partname, int *idx, loff_t *off, loff_t *size) #endif } -static int arg_off(const char *arg, int *idx, loff_t *off, loff_t *maxsize) +static int arg_off(const char *arg, int *idx, loff_t *off, loff_t *size, + loff_t *maxsize) { if (!str2off(arg, off)) - return get_part(arg, idx, off, maxsize); + return get_part(arg, idx, off, size, maxsize); if (*off = nand_info[*idx].size) { puts(Offset exceeds device limit\n); @@ -188,36 +191,29 @@ static int arg_off(const char *arg, int *idx, loff_t *off, loff_t *maxsize) } static int arg_off_size(int argc, char *const argv[], int *idx, - loff_t *off, loff_t *size) + loff_t *off, loff_t *size, loff_t *maxsize) { int ret; - loff_t maxsize = 0; if (argc == 0) { *off = 0; *size = nand_info[*idx].size; + *maxsize = *size; goto print; } - ret = arg_off(argv[0], idx, off, maxsize); + ret = arg_off(argv[0], idx, off, size, maxsize); if (ret) return ret; - if (argc == 1) { - *size = maxsize; + if (argc == 1) goto print; - } if (!str2off(argv[1], size)) { printf('%s' is not a number\n, argv[1]); return -1; } - if (*size maxsize) { - puts(Size exceeds partition or device limit\n); - return -1; - } - print: printf(device %d , *idx); if (*size == nand_info[*idx].size) @@ -299,15 +295,14 @@ int do_nand_env_oob(cmd_tbl_t *cmdtp, int argc, char *const argv[]) printf(0x%08lx\n, nand_env_oob_offset); } else if (!strcmp(cmd, set)) { - loff_t addr; - loff_t maxsize; + loff_t addr, size, maxsize; struct mtd_oob_ops ops; int idx = 0; if (argc 3) goto usage; - if (arg_off(argv[2], idx, addr, maxsize)) { + if (arg_off(argv[2], idx, addr, size, maxsize)) { puts(Offset or partition name expected\n); return 1; } @@ -432,7 +427,7 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int i, ret = 0; ulong addr; - loff_t off, size; + loff_t off, size, maxsize; char *cmd, *s; nand_info_t *nand; #ifdef CONFIG_SYS_NAND_QUIET @@ -557,7 +552,8 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) printf(\nNAND %s: , cmd); /* skip first two or three arguments, look for offset and size */ - if (arg_off_size(argc - o, argv + o, dev, off, size) != 0) + if (arg_off_size(argc - o, argv + o, dev, off, size, + maxsize) != 0) return 1;
[U-Boot] [PATCH v2 3/4] am335x_evm: Add CONFIG_CMD_MTDPARTS and relevant defaults
Signed-off-by: Tom Rini tr...@ti.com --- include/configs/am335x_evm.h |9 + 1 file changed, 9 insertions(+) diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h index 59647d1..61b861d 100644 --- a/include/configs/am335x_evm.h +++ b/include/configs/am335x_evm.h @@ -60,6 +60,8 @@ fdtfile=\0 \ console=ttyO0,115200n8\0 \ optargs=\0 \ + mtdids= MTDIDS_DEFAULT \0 \ + mtdparts= MTDPARTS_DEFAULT \0 \ mmcdev=0\0 \ mmcroot=/dev/mmcblk0p2 ro\0 \ mmcrootfstype=ext4 rootwait\0 \ @@ -341,6 +343,13 @@ /* NAND support */ #ifdef CONFIG_NAND #define CONFIG_CMD_NAND +#define CONFIG_CMD_MTDPARTS +#define MTDIDS_DEFAULT nand0=omap2-nand.0 +#define MTDPARTS_DEFAULT mtdparts=omap2-nand.0:128k(SPL), \ + 128k(SPL.backup1), \ + 128k(SPL.backup2), \ + 128k(SPL.backup3),1920k(u-boot), \ + 128k(u-boot-env),5m(kernel),-(rootfs) #define CONFIG_NAND_OMAP_GPMC #define GPMC_NAND_ECC_LP_x16_LAYOUT1 #define CONFIG_SYS_NAND_BASE (0x0800)/* physical address */ -- 1.7.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 2/4] dfu: NAND specific routines for DFU operation
From: Pantelis Antoniou pa...@antoniou-consulting.com Support for NAND storage devices to work with the DFU framework. --- Changes in v2: Use nand_(read|write)_skip_bad directly rather than abusing run_command. Reword a comment in nand_block_op and commit message. Initalize bad_skip on start. Cc: Scott Wood scottw...@freescale.com Cc: Lukasz Majewski l.majew...@samsung.com Signed-off-by: Pantelis Antoniou pa...@antoniou-consulting.com Signed-off-by: Tom Rini tr...@ti.com --- drivers/dfu/Makefile |1 + drivers/dfu/dfu.c |8 ++ drivers/dfu/dfu_nand.c | 201 include/dfu.h | 23 ++ 4 files changed, 233 insertions(+) create mode 100644 drivers/dfu/dfu_nand.c diff --git a/drivers/dfu/Makefile b/drivers/dfu/Makefile index 7b717bc..153095d 100644 --- a/drivers/dfu/Makefile +++ b/drivers/dfu/Makefile @@ -27,6 +27,7 @@ LIB = $(obj)libdfu.o COBJS-$(CONFIG_DFU_FUNCTION) += dfu.o COBJS-$(CONFIG_DFU_MMC) += dfu_mmc.o +COBJS-$(CONFIG_DFU_NAND) += dfu_nand.o SRCS:= $(COBJS-y:.o=.c) OBJS := $(addprefix $(obj),$(COBJS-y)) diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c index fb9b417..44d29de 100644 --- a/drivers/dfu/dfu.c +++ b/drivers/dfu/dfu.c @@ -86,6 +86,7 @@ int dfu_write(struct dfu_entity *dfu, void *buf, int size, int blk_seq_num) /* initial state */ dfu-crc = 0; dfu-offset = 0; + dfu-bad_skip = 0; dfu-i_blk_seq_num = 0; dfu-i_buf_start = dfu_buf; dfu-i_buf_end = dfu_buf + sizeof(dfu_buf); @@ -234,6 +235,8 @@ int dfu_read(struct dfu_entity *dfu, void *buf, int size, int blk_seq_num) dfu-i_buf = dfu-i_buf_start; dfu-b_left = 0; + dfu-bad_skip = 0; + dfu-inited = 1; } @@ -263,6 +266,8 @@ int dfu_read(struct dfu_entity *dfu, void *buf, int size, int blk_seq_num) dfu-i_buf = dfu-i_buf_start; dfu-b_left = 0; + dfu-bad_skip = 0; + dfu-inited = 0; } @@ -285,6 +290,9 @@ static int dfu_fill_entity(struct dfu_entity *dfu, char *s, int alt, if (strcmp(interface, mmc) == 0) { if (dfu_fill_entity_mmc(dfu, s)) return -1; + } else if (strcmp(interface, nand) == 0) { + if (dfu_fill_entity_nand(dfu, s)) + return -1; } else { printf(%s: Device %s not (yet) supported!\n, __func__, interface); diff --git a/drivers/dfu/dfu_nand.c b/drivers/dfu/dfu_nand.c new file mode 100644 index 000..e5d39d9 --- /dev/null +++ b/drivers/dfu/dfu_nand.c @@ -0,0 +1,201 @@ +/* + * dfu_nand.c -- DFU for NAND routines. + * + * Copyright (C) 2012-2013 Texas Instruments, Inc. + * + * Based on dfu_mmc.c which is: + * Copyright (C) 2012 Samsung Electronics + * author: Lukasz Majewski l.majew...@samsung.com + * + * 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 + */ + +#include common.h +#include malloc.h +#include errno.h +#include div64.h +#include dfu.h +#include linux/mtd/mtd.h +#include jffs2/load_kernel.h +#include nand.h + +enum dfu_nand_op { + DFU_OP_READ = 1, + DFU_OP_WRITE, +}; + +static int nand_block_op(enum dfu_nand_op op, struct dfu_entity *dfu, + u64 offset, void *buf, long *len) +{ + loff_t start; + size_t count, actual; + int ret; + int dev; + nand_info_t *nand; + + /* if buf == NULL return total size of the area */ + if (buf == NULL) { + *len = dfu-data.nand.size; + return 0; + } + + start = dfu-data.nand.start + offset + dfu-bad_skip; + count = *len; + if (start + count + dfu-data.nand.start + dfu-data.nand.size) { + printf(%s: block_op out of bounds\n, __func__); + return -1; + } + + dev = nand_curr_device; + if (dev 0 || dev = CONFIG_SYS_MAX_NAND_DEVICE || + !nand_info[dev].name) { + printf(%s: invalid nand device\n, __func__); + return -1; + } + + nand = nand_info[dev]; + + if (op == DFU_OP_READ) + ret =
[U-Boot] [PATCH v2 4/4] am335x_evm: Enable DFU for NAND and MMC, provide example alt_info for both
From: Pantelis Antoniou pa...@antoniou-consulting.com - Add CONFIG_DFU_NAND - Set dfu_alt_info_nand and dfu_alt_info_mmc to show a working example for both. - Increase CONFIG_SYS_MAXARGS due to hush parsing bugs that would otherwise disallow 'setenv dfu_alt_info ${dfu_alt_info_nand}'. - Enable CONFIG_FAT_WRITE to allow updating on MMC Signed-off-by: Pantelis Antoniou pa...@antoniou-consulting.com Signed-off-by: Tom Rini tr...@ti.com --- include/configs/am335x_evm.h | 38 -- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h index 61b861d..230e609 100644 --- a/include/configs/am335x_evm.h +++ b/include/configs/am335x_evm.h @@ -62,6 +62,8 @@ optargs=\0 \ mtdids= MTDIDS_DEFAULT \0 \ mtdparts= MTDPARTS_DEFAULT \0 \ + dfu_alt_info_mmc= DFU_ALT_INFO_MMC \0 \ + dfu_alt_info_nand= DFU_ALT_INFO_NAND \0 \ mmcdev=0\0 \ mmcroot=/dev/mmcblk0p2 ro\0 \ mmcrootfstype=ext4 rootwait\0 \ @@ -118,8 +120,8 @@ #define CONFIG_CMD_ECHO -/* max number of command args */ -#define CONFIG_SYS_MAXARGS 16 +/* We set the max number of command args high to avoid HUSH bugs. */ +#define CONFIG_SYS_MAXARGS 64 /* Console I/O Buffer Size */ #define CONFIG_SYS_CBSIZE 512 @@ -148,6 +150,7 @@ #define CONFIG_CMD_MMC #define CONFIG_DOS_PARTITION #define CONFIG_CMD_FAT +#define CONFIG_FAT_WRITE #define CONFIG_CMD_EXT2 #define CONFIG_SPI @@ -158,6 +161,36 @@ #define CONFIG_CMD_SF #define CONFIG_SF_DEFAULT_SPEED(2400) +/* USB Composite download gadget - g_dnl */ +#define CONFIG_USB_GADGET +#define CONFIG_USBDOWNLOAD_GADGET + +/* USB TI's IDs */ +#define CONFIG_USBD_HS +#define CONFIG_G_DNL_VENDOR_NUM 0x0403 +#define CONFIG_G_DNL_PRODUCT_NUM 0xBD00 +#define CONFIG_G_DNL_MANUFACTURER Texas Instruments + +/* USB Device Firmware Update support */ +#define CONFIG_DFU_FUNCTION +#define CONFIG_DFU_MMC +#define CONFIG_DFU_NAND +#define CONFIG_CMD_DFU +#define DFU_ALT_INFO_MMC \ + boot part 0 1; \ + rootfs part 0 2; \ + MLO fat 0 1; \ + u-boot.img fat 0 1; \ + uEnv.txt fat 0 1 +#define DFU_ALT_INFO_NAND \ + SPL part 0 1; \ + SPL.backup1 part 0 2; \ + SPL.backup2 part 0 3; \ + SPL.backup3 part 0 4; \ + u-boot part 0 5; \ + kernel part 0 7; \ + rootfs part 0 8 + /* Physical Memory Map */ #define CONFIG_NR_DRAM_BANKS 1 /* 1 bank of DRAM */ #define PHYS_DRAM_10x8000 /* DRAM Bank #1 */ @@ -302,6 +335,7 @@ #define CONFIG_MUSB_GADGET #define CONFIG_MUSB_PIO_ONLY #define CONFIG_USB_GADGET_DUALSPEED +#define CONFIG_USB_GADGET_VBUS_DRAW2 #define CONFIG_MUSB_HOST #define CONFIG_AM335X_USB0 #define CONFIG_AM335X_USB0_MODEMUSB_PERIPHERAL -- 1.7.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 02/16] 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 s...@chromium.org --- Changes in v3: None 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_BOOTARGSroot=/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] [PATCH v3 01/16] 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 s...@chromium.org --- Changes in v3: - Update config_xxx() to autoconf_xxx() in comments/README/sed - Update config_xxx_enabled() to autoconf_has_xxx() in comments/README/sed - Add comment as to why we use [A-Za-z0-9_][A-Za-z0-9_]* - Rename sed scripts to more useful names 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 | 43 - README | 87 -- include/common.h | 3 ++ include/config_drop.h | 17 + tools/scripts/define2value.sed | 37 ++ tools/scripts/define2zero.sed | 32 6 files changed, 215 insertions(+), 4 deletions(-) create mode 100644 include/config_drop.h create mode 100644 tools/scripts/define2value.sed create mode 100644 tools/scripts/define2zero.sed diff --git a/Makefile b/Makefile index fc18dd4..8ba068d 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,45 @@ $(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 autoconf_xxx() value', or '#define autoconf_xxx() 0' where the +# CONFIG is not used by this board configuration. This allows C code to do +# things like 'if (autoconf_xxx())' and have the compiler remove the dead code, +# instead of using '#ifdef CONFIG_XXX...#endif'. Note that in most cases +# if the autoconf_...() 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 autoconf_has_xxx(), 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/define2value.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/define2zero.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/define2zero.sed | \ + sort $@-enabled.tmp; \ + set -e ; \ + : Find CONFIGs that are not enabled ; \ + comm -13 $@-enabled.tmp $@-all.tmp $@.tmp \ + mv $@.tmp $@ +
[U-Boot] [PATCH v3 03/16] 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 instead of #ifdef for its inclusion. Signed-off-by: Simon Glass s...@chromium.org Acked-by: Joe Hershberger joe.hershber...@ni.com --- Changes in v3: None 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 common.h #include command.h +#include net.h #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_ENVupdatefile -/* 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] [PATCH v3 06/16] main: Use autoconf for boot retry feature
Change this feature to use autoconf instead of #ifdef. Signed-off-by: Simon Glass s...@chromium.org Reviewed-by: Joe Hershberger joe.hershber...@ni.com --- Changes in v3: - Fix missing in if() statement - Remove unneeded retry_min variable Changes in v2: None common/main.c | 73 ++- 1 file changed, 32 insertions(+), 41 deletions(-) diff --git a/common/main.c b/common/main.c index 0df7992..36d8048 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 (INTERRUPT\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 @@ -562,10 +553,10 @@ void init_cmd_timeout(void) 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 +778,13 @@ static int cread_line(const char *const prompt, char *buf, unsigned int *len,
[U-Boot] [PATCH v3 04/16] main: Separate out the two abortboot() functions
There are two implementations of abortboot(). Turn these into two separate functions, and create a single abortboot() which calls either one or the other. Also it seems that nothing uses abortboot() outside main, so make it static. At this point there is no further use of CONFIG_MENU in main.c. Signed-off-by: Simon Glass s...@chromium.org Reviewed-by: Joe Hershberger joe.hershber...@ni.com --- Changes in v3: - Fix commit message which said autoboot() instead of abortboot() - Add note about CONFIG_MENU not being needed in main.c anymore 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] [PATCH v3 15/16] 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 s...@chromium.org Reviewed-by: Joe Hershberger joe.hershber...@ni.com --- Changes in v3: None 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 a464620..8ea9475 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 */ @@ -1105,9 +1109,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 */ @@ -1116,10 +1118,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 */ @@ -1130,10 +1130,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 */ @@ -1141,9 +1139,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); } @@ -1160,12 +1156,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 */ @@ -1253,10 +1247,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); } / @@ -1287,12 +1279,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) { @@ -1310,9 +1302,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) { /* @@ -1341,9 +1331,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
[U-Boot] [PATCH v3 11/16] main: Fix typos and checkpatch warnings in command line reading
There are a few over-long lines and other checkpatch problems in this area of the code. Prepare the ground for the next patch by tidying these up. Signed-off-by: Simon Glass s...@chromium.org --- Changes in v3: - Separate out checkpatch fixes in command line reading code into new patch Changes in v2: None common/main.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/common/main.c b/common/main.c index d49692d..074ba60 100644 --- a/common/main.c +++ b/common/main.c @@ -1021,20 +1021,20 @@ int readline_into_buffer(const char *const prompt, char *buffer, int timeout) * Special character handling */ switch (c) { - case '\r': /* Enter */ + case '\r': /* Enter*/ case '\n': *p = '\0'; puts (\r\n); - return (p - p_buf); + return p - p_buf; - case '\0': /* nul */ + case '\0': /* nul */ continue; - case 0x03: /* ^C - break */ + case 0x03: /* ^C - break */ p_buf[0] = '\0';/* discard input */ - return (-1); + return -1; - case 0x15: /* ^U - erase line */ + case 0x15: /* ^U - erase line */ while (col plen) { puts (erase_seq); --col; @@ -1043,15 +1043,15 @@ int readline_into_buffer(const char *const prompt, char *buffer, int timeout) n = 0; continue; - case 0x17: /* ^W - erase word */ + case 0x17: /* ^W - erase word */ p=delete_char(p_buf, p, col, n, plen); while ((n 0) (*p != ' ')) { p=delete_char(p_buf, p, col, n, plen); } continue; - case 0x08: /* ^H - backspace */ - case 0x7F: /* DEL - backspace */ + case 0x08: /* ^H - backspace */ + case 0x7F: /* DEL - backspace */ p=delete_char(p_buf, p, col, n, plen); continue; @@ -1060,7 +1060,7 @@ int readline_into_buffer(const char *const prompt, char *buffer, int timeout) * Must be a normal character then */ if (n CONFIG_SYS_CBSIZE-2) { - if (c == '\t') {/* expand TABs */ + if (c == '\t') {/* expand TABs */ #ifdef CONFIG_AUTO_COMPLETE /* if auto completion triggered just continue */ *p = '\0'; @@ -1075,7 +1075,7 @@ int readline_into_buffer(const char *const prompt, char *buffer, int timeout) char buf[2]; /* -* Echo input using puts() to force am +* Echo input using puts() to force an * LCD flush if we are using an LCD */ ++col; -- 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/16] 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 s...@chromium.org --- Changes in v3: None Changes in v2: None common/main.c | 164 -- include/command.h | 2 - include/common.h | 2 - 3 files changed, 73 insertions(+), 95 deletions(-) diff --git a/common/main.c b/common/main.c index 074ba60..66b74b6 100644 --- a/common/main.c +++ b/common/main.c @@ -512,8 +512,6 @@ void reset_cmd_timeout(void) } #endif -#ifdef CONFIG_CMDLINE_EDITING - /* * cmdline-editing related codes from vivi. * Author: Janghoon Lyu na...@mizi.com @@ -616,27 +614,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);\ @@ -898,27 +875,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; @@ -934,8 +911,6 @@ static int cread_line(const char *const prompt, char *buf, unsigned int *len, return 0; } -#endif /* CONFIG_CMDLINE_EDITING */ - // /* @@ -957,46 +932,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); -
[U-Boot] [PATCH v3 16/16] 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 s...@chromium.org Reviewed-by: Joe Hershberger joe.hershber...@ni.com --- Changes in v3: None 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 8ea9475..830800b 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] [PATCH v3 07/16] 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 s...@chromium.org Reviewed-by: Joe Hershberger joe.hershber...@ni.com --- Changes in v3: None 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 36d8048..e2eb9ec 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)
[U-Boot] [PATCH v3 10/16] 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 s...@chromium.org Reviewed-by: Joe Hershberger joe.hershber...@ni.com --- Changes in v3: None 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 974fc82..d49692d 100644 --- a/common/main.c +++ b/common/main.c @@ -32,14 +32,11 @@ #include command.h #include fdtdec.h #include fdt_support.h +#include hush.h #include malloc.h #include menu.h #include version.h -#ifdef CONFIG_SYS_HUSH_PARSER -#include hush.h -#endif - #include post.h #include linux/ctype.h @@ -381,12 +378,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 @@ -446,12 +441,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. @@ -486,7 +480,6 @@ void main_loop(void) lastcommand[0] = 0; } } -#endif /*CONFIG_SYS_HUSH_PARSER*/ } /* @@ -1184,7 +1177,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; @@ -1400,7 +1392,6 @@ static int builtin_run_command(const char *cmd, int flag) return rc ? rc : repeatable; } -#endif /* * Run a command using the selected parser. @@ -1411,22 +1402,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. * @@ -1467,7 +1457,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) { @@ -1477,13 +1466,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); @@ -1492,20 +1484,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 -
[U-Boot] [PATCH v3 09/16] 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 s...@chromium.org --- Changes in v3: - Simplify code for finding out bootdelay from config or environment Changes in v2: None common/main.c | 107 ++--- include/menu.h | 2 -- 2 files changed, 42 insertions(+), 67 deletions(-) diff --git a/common/main.c b/common/main.c index 8987444..974fc82 100644 --- a/common/main.c +++ b/common/main.c @@ -31,27 +31,17 @@ #include watchdog.h #include command.h #include fdtdec.h +#include fdt_support.h #include malloc.h +#include menu.h #include version.h -#ifdef CONFIG_MODEM_SUPPORT -#include malloc.h/* for free() prototype */ -#endif #ifdef CONFIG_SYS_HUSH_PARSER #include hush.h #endif -#ifdef CONFIG_OF_CONTROL -#include fdtdec.h -#endif - -#ifdef CONFIG_OF_LIBFDT -#include fdt_support.h -#endif /* CONFIG_OF_LIBFDT */ - #include post.h #include linux/ctype.h -#include menu.h 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,81 @@ 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(); + bootdelay = getenv_ulong(bootdelay, 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 : UNDEFINED); if (bootdelay !=
[U-Boot] [PATCH v3 13/16] 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 s...@chromium.org --- Changes in v3: - Remove the extra config_of_libfdt() condition in main_loop() 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 66b74b6..cd068e7 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. @@ -382,51 +379,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); @@ -434,9 +427,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()) + set_working_fdt_addr((void *)gd-fdt_blob); /* * Main Loop for Monitor Command Processing @@ -471,14 +463,13 @@ void main_loop(void) } if (len == -1) - puts (INTERRUPT\n); + puts(INTERRUPT\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
[U-Boot] [PATCH v3 08/16] main: Use get/setenv_ulong()
These functions are now available, so use them to avoid extra code here. Signed-off-by: Simon Glass s...@chromium.org Reviewed-by: Joe Hershberger joe.hershber...@ni.com --- Changes in v3: None 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 e2eb9ec..8987444 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] [PATCH v3 14/16] main: Correct header order
The headers are a bit out of order, so fix them. Signed-off-by: Simon Glass s...@chromium.org --- Changes in v3: None 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 cd068e7..a464620 100644 --- a/common/main.c +++ b/common/main.c @@ -28,16 +28,15 @@ /* #define DEBUG */ #include common.h -#include watchdog.h #include command.h #include fdtdec.h #include fdt_support.h #include hush.h #include malloc.h #include menu.h -#include version.h - #include post.h +#include version.h +#include watchdog.h #include linux/ctype.h 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] [PATCH v3 05/16] 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 s...@chromium.org Reviewed-by: Joe Hershberger joe.hershber...@ni.com --- Changes in v3: None 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 /*
Re: [U-Boot] [PATCH v7 02/19] nand: mxc: Add support for i.MX5
Hi Fabio, On Tuesday, February 26, 2013 4:33:20 PM, Fabio Estevam wrote: Benoit, On Fri, Feb 15, 2013 at 6:54 PM, Benoît Thébaudeau benoit.thebaud...@advansee.com wrote: +#elif defined(CONFIG_MX51) || defined(CONFIG_MX53) +static int is_16bit_nand(void) +{ + struct src *src = (struct src *)SRC_BASE_ADDR; + + if (readl(src-sbmr) SRC_SBMR_NF16B) + return 1; + else + return 0; This logic is not working on my tests with mx53ard and it results in: NAND: NAND device: Manufacturer ID: 0xec, Chip ID: 0xd5 (Samsung NAND 2GiB 3,3) NAND bus width 16 instead 8 bit No NAND device found!!! 0 MiB I am using NAND, but not booting from it, so I don't think we should use SBMR register to decide the NAND bus width. If we are not booting from NAND, shouldn't we use a CONFIG_ option in mx53ard.h to tell the NAND bus width? This boot pin / fuse config has been used by this driver for all i.MX platforms from the beginning. I don't think that we really need one more software config here. This is hardware stuff, and the i.MX provides a dedicated hardware configuration for it, so I think that we should use it, even if it's made for NAND boot, since it's just describing the present hardware, just like DT would. In the particular case of the mx53ard, there is a DIP switch that you can use to fix this config to 8-bit NAND Flash. But if you have blown the fuses to override the boot pin config, then of course we're doomed because a wrong NAND Flash config has been blow. 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 v3] Introduced btrfs file-system with btrload command
Hi Adnan, On Tue, Feb 26, 2013 at 4:54 AM, Adnan Ali adnan@codethink.co.uk wrote: On 25/02/13 23:02, Simon Glass wrote: Hi, On Mon, Feb 25, 2013 at 7:04 AM, Tom Rini tr...@ti.com wrote: On Mon, Feb 25, 2013 at 12:24:37PM +, Adnan Ali wrote: Introduces btrfs file-system to read file from volume/sub-volumes with btrload command. This implementation has read-only support. This btrfs implementation is based on syslinux btrfs code, commit 269ebc845ebc8b46ef4b0be7fa0005c7fdb95b8d. Signed-off-by: Adnan Ali adnan@codethink.co.uk A few things: - In general in fs/btrfs/btrfs.c I see some coding style problems (lack of spacing, non-printf's longer than 80-wide). Do these come from syslinux and thus will make any re-syncs easier? - It looks like you added support for CONFIG_CMD_FS_GENERIC, if so did you test that? - Can you please enable this support code on at least one platform, preferably the one you've tested and developed with? [snip] diff --git a/fs/fs.c b/fs/fs.c [snip] +//file handle is valid get the size of the file /* Style comments only */ +len=filedata.size; And spacing between variable and assignment. @@ -178,7 +248,6 @@ int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype) for (i = 0; i ARRAY_SIZE(fstypes); i++) { if ((fstype != FS_TYPE_ANY) (fstype != fstypes[i].fstype)) continue; - if (!fstypes[i].probe()) { fs_type = fstypes[i].fstype; return 0; [snip] @@ -208,7 +280,6 @@ static void fs_close(void) int fs_ls(const char *dirname) { int ret; - switch (fs_type) { case FS_TYPE_FAT: ret = fs_ls_fat(dirname); Unrelated, please drop. @@ -237,11 +311,13 @@ int fs_read(const char *filename, ulong addr, int offset, int len) case FS_TYPE_EXT: ret = fs_read_ext(filename, addr, offset, len); break; +case FS_TYPE_BTR: + ret = fs_read_btr(filename, addr, offset, len); + break; default: ret = fs_read_unsupported(filename, addr, offset, len); break; } - fs_close(); And unrelated whitespace changes here as well. diff --git a/include/btrfs.h b/include/btrfs.h [snip] +/* + * Extent structure: contains the mapping of some chunk of a file + * that is contiguous on disk. + */ +struct extent { +//sector_tpstart; /* Physical start sector */ +__le64 pstart; Fix please. +/* + * Our definition of not whitespace + */ +static inline char not_whitespace(char c) +{ + return (unsigned char)c ' '; +} Can't you just use isspace from linux/ctypes.h ? diff --git a/include/crc32c.h b/include/crc32c.h new file mode 100644 index 000..d04916e --- /dev/null +++ b/include/crc32c.h @@ -0,0 +1,48 @@ +/* + * Copied from Linux kernel crypto/crc32c.c + * Copyright (c) 2004 Cisco Systems, Inc. + * Copyright (c) 2008 Herbert Xu herb...@gondor.apana.org.au + * + * 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 is the CRC-32C table + * Generated with: + * width = 32 bits + * poly = 0x1EDC6F41 + * reflect input bytes = true + * reflect output bytes = true + */ + +/* + * Steps through buffer one byte at at time, calculates reflected + * crc using table. + */ + +static inline u32 crc32c_cal(u32 crc, const char *data, size_t length, u32 *crc32c_table) +{ + while (length--) + crc = crc32c_table[(u8)(crc ^ *data++)] ^ (crc 8); + + return crc; +} + +static inline void crc32c_init(u32 *crc32c_table, u32 pol) +{ + int i, j; + u32 v; + const u32 poly = pol; /* Bit-reflected CRC32C polynomial */ + + for (i = 0; i 256; i++) { + v = i; + for (j = 0; j 8; j++) { + v = (v 1) ^ ((v 1) ? poly : 0); + } + crc32c_table[i] = v; + } +} Simon, since you've just been over all the crc32 recently, do we have these functions somewhere already that can be easily tapped in to? Thanks! Should be - see lib/crc32.c. There is already at least one other copy (ubifs I think) so we should try to avoid adding more. Maybe the polynomial is different here? But even so it should go with the existing code I think. I have tried using crc code lib/crc32.c but it always failed even though i did change the polynomial but still result is search for file on btrfs fails due to bad crc calculation. I have also enable dynamic table creation but still result is same. so should add my my crc code under ifdef in lib/crc32.c what do
Re: [U-Boot] [PATCH v7 02/19] nand: mxc: Add support for i.MX5
On Tue, Feb 26, 2013 at 1:08 PM, Benoît Thébaudeau benoit.thebaud...@advansee.com wrote: This boot pin / fuse config has been used by this driver for all i.MX platforms from the beginning. I don't think that we really need one more software config here. This is hardware stuff, and the i.MX provides a dedicated hardware configuration for it, so I think that we should use it, even if it's made for NAND boot, since it's just describing the present hardware, just like DT would. In the particular case of the mx53ard, there is a DIP switch that you can use to fix this config to 8-bit NAND Flash. But if you have blown the fuses to override the boot pin config, then of course we're doomed because a wrong NAND Flash config has been blow. The boot config jumpers are correctly set to boot from MMC card and this is what I am using as the boot media. Why should we decide the NAND width via boot pins if I am not booting from NAND at all? I see that current mxc nand drivers are doing like this, but I don't think this makes sense if we use NAND and does not boot from it. I agree with this comment from tt01.h: /* * it's not 16 bit: * #define CONFIG_SYS_NAND_BUSWIDTH_16BIT *the current u-boot mxc_nand.c tries to auto-detect, but this only *reads the boot settings during reset (which might be wrong) */ and we can also see the a workaround at board/davedenx/qong/qong.c in order to tell the nand bus width is 8 bits: void qong_nand_plat_init(void *chip) { struct nand_chip *nand = (struct nand_chip *)chip; nand-chip_delay = 20; nand-select_chip = qong_nand_select_chip; nand-options = ~NAND_BUSWIDTH_16; board_nand_setup(); } ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] Netgear switch Prosafe GSM7328SO not working after Reset from Uboot
I have Netgear Prosafe GSM7328SO switch with uboot as boot loader.I connected this switch to my computer with serial cable (ttyS0 with 115200 8N1). I was able to login to switch and switch was working fine. In U-boot menu, i entered 'reset' command. After that i am unable to connect to the switch. Switch power LED shows that its in POST state. I tried to hard reset as well as tried all baud rates (9600,11520 etc) in minicom for connection to switch but i am unable to get it working. please suggest the solution as i only gave reset command and switch got bricked. I will be thankful to you for you kind help. -- Warm Regrads Muhammad Sohaib Ayub ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 0/16] 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 series seems to be roughly neutral (below numbers are average change in byte size for each region: x86: (for 1/1 boards) all -12.0 data +4.0 text -16.0 m68k: (for 41/50 boards) all -23.7 text -23.7 powerpc: (for 633/635 boards) all -4.4 bss +2.0 data +0.0 text -6.4 sandbox: (for 1/1 boards) all +16.0 bss +16.0 sh: (for 16/21 boards) all -4.8 bss +3.2 text -8.0 nios2: (for 3/3 boards) all +24.0 bss +1.3 data -1.3 text +24.0 arm: (for 292/292 boards) all -11.1 bss +6.0 spl/u-boot-spl:all +0.4 spl/u-boot-spl:text +0.4 text -17.1 nds32: (for 3/3 boards) all -42.7 bss +10.7 text -53.3 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 v3: - Update config_xxx() to autoconf_xxx() in comments/README/sed - Update config_xxx_enabled() to autoconf_has_xxx() in comments/README/sed - Add comment as to why we use [A-Za-z0-9_][A-Za-z0-9_]* - Rename sed scripts to more useful names - Fix commit message which said autoboot() instead of abortboot() - Add note about CONFIG_MENU not being needed in main.c anymore - Fix missing in if() statement - Remove unneeded retry_min variable - Simplify code for finding out bootdelay from config or environment - Separate out checkpatch fixes in command line reading code into new patch - Remove the extra config_of_libfdt() condition in main_loop() 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 (16): 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: Fix typos and checkpatch warnings in command line reading 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 | 43 ++- README | 87 - common/cmd_fitupd.c| 3 +- common/main.c | 809 ++--- common/update.c| 24 +- include/command.h | 2 - include/common.h
Re: [U-Boot] [PATCH v7 02/19] nand: mxc: Add support for i.MX5
Hi Fabio, On Tuesday, February 26, 2013 5:35:28 PM, Fabio Estevam wrote: On Tue, Feb 26, 2013 at 1:08 PM, Benoît Thébaudeau benoit.thebaud...@advansee.com wrote: This boot pin / fuse config has been used by this driver for all i.MX platforms from the beginning. I don't think that we really need one more software config here. This is hardware stuff, and the i.MX provides a dedicated hardware configuration for it, so I think that we should use it, even if it's made for NAND boot, since it's just describing the present hardware, just like DT would. In the particular case of the mx53ard, there is a DIP switch that you can use to fix this config to 8-bit NAND Flash. But if you have blown the fuses to override the boot pin config, then of course we're doomed because a wrong NAND Flash config has been blow. The boot config jumpers are correctly set to boot from MMC card and this is what I am using as the boot media. OK, then we don't have a choice. Why should we decide the NAND width via boot pins if I am not booting from NAND at all? I see that current mxc nand drivers are doing like this, but I don't think this makes sense if we use NAND and does not boot from it. If the NAND boot config for bus width is not used by the actuel boot config to mean something else (which is not your case), then it's a handy way of describing the NAND hardware setup without involving software. But anyway we're not in this case, so we need a software config. I agree with this comment from tt01.h: /* * it's not 16 bit: * #define CONFIG_SYS_NAND_BUSWIDTH_16BIT *the current u-boot mxc_nand.c tries to auto-detect, but this only *reads the boot settings during reset (which might be wrong) */ and we can also see the a workaround at board/davedenx/qong/qong.c in order to tell the nand bus width is 8 bits: void qong_nand_plat_init(void *chip) { struct nand_chip *nand = (struct nand_chip *)chip; nand-chip_delay = 20; nand-select_chip = qong_nand_select_chip; nand-options = ~NAND_BUSWIDTH_16; board_nand_setup(); } OK, then let's use something like CONFIG_SYS_NAND_BUSWIDTH_16BIT for all boards with mxc_nand enabled. 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 v7 04/19] imx: mx53ard: Add support for NAND Flash
Hi Fabio, On Tuesday, February 26, 2013 3:21:25 PM, Fabio Estevam wrote: Hi Benoît, On Tue, Feb 26, 2013 at 10:35 AM, Fabio Estevam feste...@gmail.com wrote: Yes, after using the same IOMUX from FSL U-boot I get: NAND: NAND device: Manufacturer ID: 0xec, Chip ID: 0xd5 (Samsung NAND 2GiB 3,3) NAND bus width 16 instead 8 bit No NAND device found!!! 0 MiB This should be fixed separetely and it is not related to your patch. I will submit a patch for this 16-bit detection issue OK. Please update all boards using mxc_nand. I was able to read and write to NAND, I have also tested to save env vars into NAND and it works fine. Great! Thanks for testing. So, after changing the IOMUX as per FSL U-boot If I look at FSL's setup_nfc() vs. my setup_iomux_nand(): - The IOMUX setup is the same, with CS1 and DA0-7 left in their reset ALT0 mode. - The pad setups differ from the reset values in FSL's code, so I think that this is all that needs to be changed (i.e. adding the mxc_iomux_set_pad()). Can you confirm? - Are 'M4IF_GPR.MM = 0' and 'EIM_CSxGCR2[12] = 0' also required, or is this handled properly by your board through BOOT_CFG1[6]? I think that we should enforce this too by software for the same reason as for bus width. you can add my: Tested-by: Fabio Estevam fabio.este...@freescale.com Will do, thanks again. So for 01-03, and 15 (with 0x32000). Do you agree? 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 v7 02/19] nand: mxc: Add support for i.MX5
On Tue, Feb 26, 2013 at 1:49 PM, Benoît Thébaudeau benoit.thebaud...@advansee.com wrote: Hi Fabio, On Tuesday, February 26, 2013 5:35:28 PM, Fabio Estevam wrote: On Tue, Feb 26, 2013 at 1:08 PM, Benoît Thébaudeau benoit.thebaud...@advansee.com wrote: This boot pin / fuse config has been used by this driver for all i.MX platforms from the beginning. I don't think that we really need one more software config here. This is hardware stuff, and the i.MX provides a dedicated hardware configuration for it, so I think that we should use it, even if it's made for NAND boot, since it's just describing the present hardware, just like DT would. In the particular case of the mx53ard, there is a DIP switch that you can use to fix this config to 8-bit NAND Flash. But if you have blown the fuses to override the boot pin config, then of course we're doomed because a wrong NAND Flash config has been blow. The boot config jumpers are correctly set to boot from MMC card and this is what I am using as the boot media. OK, then we don't have a choice. Why should we decide the NAND width via boot pins if I am not booting from NAND at all? I see that current mxc nand drivers are doing like this, but I don't think this makes sense if we use NAND and does not boot from it. If the NAND boot config for bus width is not used by the actuel boot config to mean something else (which is not your case), then it's a handy way of describing the NAND hardware setup without involving software. But anyway we're not in this case, so we need a software config. I agree with this comment from tt01.h: /* * it's not 16 bit: * #define CONFIG_SYS_NAND_BUSWIDTH_16BIT *the current u-boot mxc_nand.c tries to auto-detect, but this only *reads the boot settings during reset (which might be wrong) */ and we can also see the a workaround at board/davedenx/qong/qong.c in order to tell the nand bus width is 8 bits: void qong_nand_plat_init(void *chip) { struct nand_chip *nand = (struct nand_chip *)chip; nand-chip_delay = 20; nand-select_chip = qong_nand_select_chip; nand-options = ~NAND_BUSWIDTH_16; board_nand_setup(); } OK, then let's use something like CONFIG_SYS_NAND_BUSWIDTH_16BIT for all boards with mxc_nand enabled. Documentation/devicetree/bindings/mtd/nand.txt says: nand-bus-width : 8 or 16 bus width if not present 8 I think we could do the same here, ie, if CONFIG_SYS_NAND_BUSWIDTH_16BIT is not defined in the board file, then assume it is 8-bit nand. I can send this as a separate patch. Thanks, Fabio Estevam ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v7 02/19] nand: mxc: Add support for i.MX5
Hi Fabio, On Tuesday, February 26, 2013 6:03:56 PM, Fabio Estevam wrote: On Tue, Feb 26, 2013 at 1:49 PM, Benoît Thébaudeau benoit.thebaud...@advansee.com wrote: Hi Fabio, On Tuesday, February 26, 2013 5:35:28 PM, Fabio Estevam wrote: On Tue, Feb 26, 2013 at 1:08 PM, Benoît Thébaudeau benoit.thebaud...@advansee.com wrote: This boot pin / fuse config has been used by this driver for all i.MX platforms from the beginning. I don't think that we really need one more software config here. This is hardware stuff, and the i.MX provides a dedicated hardware configuration for it, so I think that we should use it, even if it's made for NAND boot, since it's just describing the present hardware, just like DT would. In the particular case of the mx53ard, there is a DIP switch that you can use to fix this config to 8-bit NAND Flash. But if you have blown the fuses to override the boot pin config, then of course we're doomed because a wrong NAND Flash config has been blow. The boot config jumpers are correctly set to boot from MMC card and this is what I am using as the boot media. OK, then we don't have a choice. Why should we decide the NAND width via boot pins if I am not booting from NAND at all? I see that current mxc nand drivers are doing like this, but I don't think this makes sense if we use NAND and does not boot from it. If the NAND boot config for bus width is not used by the actuel boot config to mean something else (which is not your case), then it's a handy way of describing the NAND hardware setup without involving software. But anyway we're not in this case, so we need a software config. I agree with this comment from tt01.h: /* * it's not 16 bit: * #define CONFIG_SYS_NAND_BUSWIDTH_16BIT *the current u-boot mxc_nand.c tries to auto-detect, but this only *reads the boot settings during reset (which might be wrong) */ and we can also see the a workaround at board/davedenx/qong/qong.c in order to tell the nand bus width is 8 bits: void qong_nand_plat_init(void *chip) { struct nand_chip *nand = (struct nand_chip *)chip; nand-chip_delay = 20; nand-select_chip = qong_nand_select_chip; nand-options = ~NAND_BUSWIDTH_16; board_nand_setup(); } OK, then let's use something like CONFIG_SYS_NAND_BUSWIDTH_16BIT for all boards with mxc_nand enabled. Documentation/devicetree/bindings/mtd/nand.txt says: nand-bus-width : 8 or 16 bus width if not present 8 I think we could do the same here, ie, if CONFIG_SYS_NAND_BUSWIDTH_16BIT is not defined in the board file, then assume it is 8-bit nand. I 100% agree. This should make your patch quite lite. I can send this as a separate patch. OK, thanks. 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 v7 04/19] imx: mx53ard: Add support for NAND Flash
On Tue, Feb 26, 2013 at 1:53 PM, Benoît Thébaudeau benoit.thebaud...@advansee.com wrote: OK. Please update all boards using mxc_nand. Yes, will send a patch soon. I was able to read and write to NAND, I have also tested to save env vars into NAND and it works fine. Great! Thanks for testing. So, after changing the IOMUX as per FSL U-boot If I look at FSL's setup_nfc() vs. my setup_iomux_nand(): - The IOMUX setup is the same, with CS1 and DA0-7 left in their reset ALT0 mode. - The pad setups differ from the reset values in FSL's code, so I think that this is all that needs to be changed (i.e. adding the mxc_iomux_set_pad()). Can you confirm? Yes, correct. - Are 'M4IF_GPR.MM = 0' and 'EIM_CSxGCR2[12] = 0' also required, or is this handled properly by your board through BOOT_CFG1[6]? I think that we should enforce this too by software for the same reason as for bus width. Yes, we need to enforce this by software. If I skip such settings, NAND is no longer functional on mx53ard. you can add my: Tested-by: Fabio Estevam fabio.este...@freescale.com Will do, thanks again. So for 01-03, and 15 (with 0x32000). Do you agree? Yes, correct. Very good job you did, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] Tegra: Add twarren as maintainer for Tegra30 and Tegra114 SoCs
Signed-off-by: Tom Warren twar...@nvidia.com --- MAINTAINERS |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 175bbe2..feaca34 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -976,6 +976,8 @@ Tom Warren twar...@nvidia.com harmony Tegra20 (ARM7 A9 Dual Core) seaboardTegra20 (ARM7 A9 Dual Core) + cardhu Tegra30 (ARM7 A9 Quad Core) + dalmore Tegra114 (ARM7 A15 Quad Core) Tom Warren twar...@nvidia.com Stephen Warren swar...@nvidia.com -- 1.7.0.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] Tegra: Add twarren as maintainer for Tegra30 and Tegra114 SoCs
On 02/26/2013 10:59 AM, Tom Warren wrote: Signed-off-by: Tom Warren twar...@nvidia.com Commit description is always useful, but, Reviewed-by: Stephen Warren swar...@nvidia.com ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [u-boot-mips] gp init and -pie option
HI Daniel, I'm using CodeSourcery 4.5.2. I've configured and have built the code for incaip board and dbau1000. The results are the same. (i.e. gp has been set with wrong value) Could you tell me the CodeSourcery toolchain versions known to be working? I'd like to try out the same version. Thanks, Justin From: Daniel Schwierzeck [daniel.schwierz...@gmail.com] Sent: Tuesday, February 26, 2013 1:52 AM To: Juhyun (Justin) Oh Cc: u-boot@lists.denx.de Subject: Re: [U-Boot] [u-boot-mips] gp init and -pie option 2013/2/25 Juhyun (Justin) Oh juhyun...@sigmadesigns.com: Hi, I got a problem while I was trying out v2013.01.01 on the u-boot-mips fork repo. It looks like my u-boot binary built with -pie linker option doesn't work due to wrong gp initialization. In the start.S file, the gp is supposed to be initialized with _gp because ra will hold the address of .word _gp line. The below is part of start.S. ... /* Initialize $gp */ bal 1f nop .word _gp 1: lw gp, 0(ra) ... Without the -pie option, linker puts the start address of the .got section. However, with -pie option, the .word _gp is translated to nop. The below is disassembled code. 84001490 reset: ... 840014b8: 40804800mtc0zero,c0_count 840014bc: 40805800mtc0zero,c0_compare 840014c0: 04110002bal 840014cc reset+0x3c 840014c4: nop 840014c8: nop --- 840014cc: 8ffclw gp,0(ra) 840014d0: 3c1d8440lui sp,0x8440 840014d4: 8f9982c0lw t9,-32064(gp) 840014d8: 0328jr t9 840014dc: nop Could anyone tell me what is going on here? Am I missing anything? Thanks, Justin which board and toolchain do you use? PIE support has been tested with various toolchains from ELDK, CodeSourcery and OpenWRT. -- Best regards, Daniel ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 2/2] mtd: nand: mxc_nand: Fix is_16bit_nand()
Currently is_16bit_nand() is a per SoC function and it decides the bus nand width by reading some boot related registers. This method works when NAND is the boot medium, but does not work if another boot medium is used. For example: booting from a SD card and then using NAND to store the environment variables, would lead to the following error: NAND bus width 16 instead 8 bit No NAND device found!!! 0 MiB Use CONFIG_SYS_NAND_BUSWIDTH_16BIT symbol to decide the bus width. If it is defined in the board file, then consider 16-bit NAND bus-width, otherwise assume 8-bit NAND is used. This also aligns with Documentation/devicetree/bindings/mtd/nand.txt, which states: nand-bus-width : 8 or 16 bus width if not present 8 Signed-off-by: Fabio Estevam fabio.este...@freescale.com --- drivers/mtd/nand/mxc_nand.c | 37 +++-- 1 file changed, 3 insertions(+), 34 deletions(-) diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index d0ded48..bb475f2 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c @@ -98,45 +98,14 @@ static struct nand_ecclayout nand_hw_eccoob2k = { #endif #endif -#ifdef CONFIG_MX27 static int is_16bit_nand(void) { - struct system_control_regs *sc_regs = - (struct system_control_regs *)IMX_SYSTEM_CTL_BASE; - - if (readl(sc_regs-fmcr) NF_16BIT_SEL) - return 1; - else - return 0; -} -#elif defined(CONFIG_MX31) -static int is_16bit_nand(void) -{ - struct clock_control_regs *sc_regs = - (struct clock_control_regs *)CCM_BASE; - - if (readl(sc_regs-rcsr) CCM_RCSR_NF16B) - return 1; - else - return 0; -} -#elif defined(CONFIG_MX25) || defined(CONFIG_MX35) -static int is_16bit_nand(void) -{ - struct ccm_regs *ccm = (struct ccm_regs *)IMX_CCM_BASE; - - if (readl(ccm-rcsr) CCM_RCSR_NF_16BIT_SEL) - return 1; - else - return 0; -} +#if defined(CONFIG_SYS_NAND_BUSWIDTH_16BIT) + return 1; #else -#warning 8/16 bit NAND autodetection not supported -static int is_16bit_nand(void) -{ return 0; -} #endif +} static uint32_t *mxc_nand_memcpy32(uint32_t *dest, uint32_t *source, size_t size) { -- 1.7.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/2] mtd: nand: Introduce CONFIG_SYS_NAND_BUSWIDTH_16BIT
Introduce CONFIG_SYS_NAND_BUSWIDTH_16BIT option so that any NAND controller driver could use it when a 16-bit NAND is deployed. drivers/mtd/nand/ndfc has CONFIG_SYS_NDFC_16BIT, so just rename it, so that other NAND drivers could reuse the same symbol. Signed-off-by: Fabio Estevam fabio.este...@freescale.com --- README |6 +++--- drivers/mtd/nand/ndfc.c |4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README b/README index d8cb394..1e265c9 100644 --- a/README +++ b/README @@ -3713,9 +3713,9 @@ Low Level (hardware related) configuration options: - CONFIG_SYS_SRIOn_MEM_SIZE: Size of SRIO port 'n' memory region -- CONFIG_SYS_NDFC_16 - Defined to tell the NDFC that the NAND chip is using a - 16 bit bus. +- CONFIG_SYS_NAND_BUSWIDTH_16BIT + Defined to tell the NAND controller that the NAND chip is using + a 16 bit bus. - CONFIG_SYS_NDFC_EBC0_CFG Sets the EBC0_CFG register for the NDFC. If not defined diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c index 6ebbb5e..213d2c9 100644 --- a/drivers/mtd/nand/ndfc.c +++ b/drivers/mtd/nand/ndfc.c @@ -156,7 +156,7 @@ static uint8_t ndfc_read_byte(struct mtd_info *mtd) struct nand_chip *chip = mtd-priv; -#ifdef CONFIG_SYS_NDFC_16BIT +#ifdef CONFIG_SYS_NAND_BUSWIDTH_16BIT return (uint8_t) readw(chip-IO_ADDR_R); #else return readb(chip-IO_ADDR_R); @@ -218,7 +218,7 @@ int board_nand_init(struct nand_chip *nand) nand-ecc.bytes = 3; nand-select_chip = ndfc_select_chip; -#ifdef CONFIG_SYS_NDFC_16BIT +#ifdef CONFIG_SYS_NAND_BUSWIDTH_16BIT nand-options |= NAND_BUSWIDTH_16; #endif -- 1.7.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 1/2] mtd: nand: Introduce CONFIG_SYS_NAND_BUSWIDTH_16BIT
Introduce CONFIG_SYS_NAND_BUSWIDTH_16BIT option so that other NAND controller drivers could use it when a 16-bit NAND is deployed. drivers/mtd/nand/ndfc has CONFIG_SYS_NDFC_16BIT, so just rename it, so that other NAND drivers could reuse the same symbol. Signed-off-by: Fabio Estevam fabio.este...@freescale.com --- Changes since v1: - Improve README README |9 ++--- drivers/mtd/nand/ndfc.c |4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README b/README index d8cb394..bdd2c81 100644 --- a/README +++ b/README @@ -3713,9 +3713,12 @@ Low Level (hardware related) configuration options: - CONFIG_SYS_SRIOn_MEM_SIZE: Size of SRIO port 'n' memory region -- CONFIG_SYS_NDFC_16 - Defined to tell the NDFC that the NAND chip is using a - 16 bit bus. +- CONFIG_SYS_NAND_BUSWIDTH_16BIT + Defined to tell the NAND controller that the NAND chip is using + a 16 bit bus. + Not all NAND drivers use this symbol. + Example of driver that uses it: + - drivers/mtd/nand/ndfc.c - CONFIG_SYS_NDFC_EBC0_CFG Sets the EBC0_CFG register for the NDFC. If not defined diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c index 6ebbb5e..213d2c9 100644 --- a/drivers/mtd/nand/ndfc.c +++ b/drivers/mtd/nand/ndfc.c @@ -156,7 +156,7 @@ static uint8_t ndfc_read_byte(struct mtd_info *mtd) struct nand_chip *chip = mtd-priv; -#ifdef CONFIG_SYS_NDFC_16BIT +#ifdef CONFIG_SYS_NAND_BUSWIDTH_16BIT return (uint8_t) readw(chip-IO_ADDR_R); #else return readb(chip-IO_ADDR_R); @@ -218,7 +218,7 @@ int board_nand_init(struct nand_chip *nand) nand-ecc.bytes = 3; nand-select_chip = ndfc_select_chip; -#ifdef CONFIG_SYS_NDFC_16BIT +#ifdef CONFIG_SYS_NAND_BUSWIDTH_16BIT nand-options |= NAND_BUSWIDTH_16; #endif -- 1.7.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 2/2] mtd: nand: mxc_nand: Fix is_16bit_nand()
Currently is_16bit_nand() is a per SoC function and it decides the bus nand width by reading some boot related registers. This method works when NAND is the boot medium, but does not work if another boot medium is used. For example: booting from a SD card and then using NAND to store the environment variables, would lead to the following error: NAND bus width 16 instead 8 bit No NAND device found!!! 0 MiB Use CONFIG_SYS_NAND_BUSWIDTH_16BIT symbol to decide the bus width. If it is defined in the board file, then consider 16-bit NAND bus-width, otherwise assume 8-bit NAND is used. This also aligns with Documentation/devicetree/bindings/mtd/nand.txt, which states: nand-bus-width : 8 or 16 bus width if not present 82 Signed-off-by: Fabio Estevam fabio.este...@freescale.com --- Changes since v1: - Add an entry into README README |3 ++- drivers/mtd/nand/mxc_nand.c | 37 +++-- 2 files changed, 5 insertions(+), 35 deletions(-) diff --git a/README b/README index bdd2c81..1a6a7a5 100644 --- a/README +++ b/README @@ -3717,8 +3717,9 @@ Low Level (hardware related) configuration options: Defined to tell the NAND controller that the NAND chip is using a 16 bit bus. Not all NAND drivers use this symbol. - Example of driver that uses it: + Example of drivers that use it: - drivers/mtd/nand/ndfc.c + - drivers/mtd/nand/mxc_nand.c - CONFIG_SYS_NDFC_EBC0_CFG Sets the EBC0_CFG register for the NDFC. If not defined diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index d0ded48..bb475f2 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c @@ -98,45 +98,14 @@ static struct nand_ecclayout nand_hw_eccoob2k = { #endif #endif -#ifdef CONFIG_MX27 static int is_16bit_nand(void) { - struct system_control_regs *sc_regs = - (struct system_control_regs *)IMX_SYSTEM_CTL_BASE; - - if (readl(sc_regs-fmcr) NF_16BIT_SEL) - return 1; - else - return 0; -} -#elif defined(CONFIG_MX31) -static int is_16bit_nand(void) -{ - struct clock_control_regs *sc_regs = - (struct clock_control_regs *)CCM_BASE; - - if (readl(sc_regs-rcsr) CCM_RCSR_NF16B) - return 1; - else - return 0; -} -#elif defined(CONFIG_MX25) || defined(CONFIG_MX35) -static int is_16bit_nand(void) -{ - struct ccm_regs *ccm = (struct ccm_regs *)IMX_CCM_BASE; - - if (readl(ccm-rcsr) CCM_RCSR_NF_16BIT_SEL) - return 1; - else - return 0; -} +#if defined(CONFIG_SYS_NAND_BUSWIDTH_16BIT) + return 1; #else -#warning 8/16 bit NAND autodetection not supported -static int is_16bit_nand(void) -{ return 0; -} #endif +} static uint32_t *mxc_nand_memcpy32(uint32_t *dest, uint32_t *source, size_t size) { -- 1.7.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/2] mtd: nand: Introduce CONFIG_SYS_NAND_BUSWIDTH_16BIT
On 02/26/2013 12:17:01 PM, Fabio Estevam wrote: Introduce CONFIG_SYS_NAND_BUSWIDTH_16BIT option so that any NAND controller driver could use it when a 16-bit NAND is deployed. drivers/mtd/nand/ndfc has CONFIG_SYS_NDFC_16BIT, so just rename it, so that other NAND drivers could reuse the same symbol. Signed-off-by: Fabio Estevam fabio.este...@freescale.com --- README |6 +++--- drivers/mtd/nand/ndfc.c |4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README b/README index d8cb394..1e265c9 100644 --- a/README +++ b/README @@ -3713,9 +3713,9 @@ Low Level (hardware related) configuration options: - CONFIG_SYS_SRIOn_MEM_SIZE: Size of SRIO port 'n' memory region -- CONFIG_SYS_NDFC_16 - Defined to tell the NDFC that the NAND chip is using a - 16 bit bus. +- CONFIG_SYS_NAND_BUSWIDTH_16BIT + Defined to tell the NAND controller that the NAND chip is using + a 16 bit bus. Mention here that not all drivers use this symbol, and provide a list of those that do. E.g. on fsl_ifc, we already have this information elsewhere on a per-chip basis. -Scott ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 2/2] mtd: nand: mxc_nand: Fix is_16bit_nand()
Hi Fabio, On Tuesday, February 26, 2013 7:35:20 PM, Fabio Estevam wrote: Currently is_16bit_nand() is a per SoC function and it decides the bus nand width by reading some boot related registers. This method works when NAND is the boot medium, but does not work if another boot medium is used. For example: booting from a SD card and then using NAND to store the environment variables, would lead to the following error: NAND bus width 16 instead 8 bit No NAND device found!!! 0 MiB Use CONFIG_SYS_NAND_BUSWIDTH_16BIT symbol to decide the bus width. If it is defined in the board file, then consider 16-bit NAND bus-width, otherwise assume 8-bit NAND is used. This also aligns with Documentation/devicetree/bindings/mtd/nand.txt, which states: nand-bus-width : 8 or 16 bus width if not present 82 Signed-off-by: Fabio Estevam fabio.este...@freescale.com --- Changes since v1: - Add an entry into README README |3 ++- drivers/mtd/nand/mxc_nand.c | 37 +++-- 2 files changed, 5 insertions(+), 35 deletions(-) diff --git a/README b/README index bdd2c81..1a6a7a5 100644 --- a/README +++ b/README @@ -3717,8 +3717,9 @@ Low Level (hardware related) configuration options: Defined to tell the NAND controller that the NAND chip is using a 16 bit bus. Not all NAND drivers use this symbol. - Example of driver that uses it: + Example of drivers that use it: - drivers/mtd/nand/ndfc.c + - drivers/mtd/nand/mxc_nand.c - CONFIG_SYS_NDFC_EBC0_CFG Sets the EBC0_CFG register for the NDFC. If not defined diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index d0ded48..bb475f2 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c @@ -98,45 +98,14 @@ static struct nand_ecclayout nand_hw_eccoob2k = { #endif #endif -#ifdef CONFIG_MX27 static int is_16bit_nand(void) { - struct system_control_regs *sc_regs = - (struct system_control_regs *)IMX_SYSTEM_CTL_BASE; - - if (readl(sc_regs-fmcr) NF_16BIT_SEL) - return 1; - else - return 0; -} -#elif defined(CONFIG_MX31) -static int is_16bit_nand(void) -{ - struct clock_control_regs *sc_regs = - (struct clock_control_regs *)CCM_BASE; - - if (readl(sc_regs-rcsr) CCM_RCSR_NF16B) - return 1; - else - return 0; -} -#elif defined(CONFIG_MX25) || defined(CONFIG_MX35) -static int is_16bit_nand(void) -{ - struct ccm_regs *ccm = (struct ccm_regs *)IMX_CCM_BASE; - - if (readl(ccm-rcsr) CCM_RCSR_NF_16BIT_SEL) - return 1; - else - return 0; -} +#if defined(CONFIG_SYS_NAND_BUSWIDTH_16BIT) + return 1; #else -#warning 8/16 bit NAND autodetection not supported -static int is_16bit_nand(void) -{ return 0; -} #endif +} static uint32_t *mxc_nand_memcpy32(uint32_t *dest, uint32_t *source, size_t size) { That's correct. is_16bit_nand() is only used to conditionally set NAND_BUSWIDTH_16 in this-options, then this flag is tested everywhere else, so we could also completely drop is_16bit_nand() and just do: #ifdef CONFIG_SYS_NAND_BUSWIDTH_16BIT this-options |= NAND_BUSWIDTH_16; #endif What do you think is better? I'm fine with your implementation. Should I rebase my series on that, keeping both series separate, or should I integrate these 2 patches as is at the beginning of my series? 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 2/2] mtd: nand: mxc_nand: Fix is_16bit_nand()
On Tue, Feb 26, 2013 at 3:47 PM, Benoît Thébaudeau benoit.thebaud...@advansee.com wrote: That's correct. is_16bit_nand() is only used to conditionally set NAND_BUSWIDTH_16 in this-options, then this flag is tested everywhere else, so we could also completely drop is_16bit_nand() and just do: #ifdef CONFIG_SYS_NAND_BUSWIDTH_16BIT this-options |= NAND_BUSWIDTH_16; #endif Yes, this could be done. What do you think is better? I'm fine with your implementation. My main goal with this patch series was to fix a bug, and I think I can do as you suggest, and get rid of is_16bit_nand() in a future patch. Should I rebase my series on that, keeping both series separate, or should I integrate these 2 patches as is at the beginning of my series? I would say that you could send this series as is at the beginning of your next version in order to avoid conflicts. Thanks, Fabio Estevam ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 4/4] mx5: Add support for DENX M53EVK
Hi Marek, On Mon, Feb 25, 2013 at 3:24 PM, Marek Vasut ma...@denx.de wrote: +/* + * Boot Device : one of + * spi, sd, nand + */ +BOOT_FROM nand Just curious: which method did you use to flash the final binary into the NAND? Did you boot the kernel and used mtd-utils? Maybe we could add such info later into a README? ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [u-boot-mips] gp init and -pie option
Not to hijack this thread, but I've had trouble with recent (2013.01 and perhaps the last 2012) mainline u-boots for Pandaboard when built using recent Codesourcery Lite tools. I've found that arm-2009q1 and arm-2010q1 work but arm-2012.03 and arm-2012.09 do not. SPL works but u-boot hangs very early. It's on my list of things to look into. -Michael Cashwell On Feb 26, 2013, at 1:12 PM, Juhyun (Justin) Oh juhyun...@sigmadesigns.com wrote: HI Daniel, I'm using CodeSourcery 4.5.2. I've configured and have built the code for incaip board and dbau1000. The results are the same. (i.e. gp has been set with wrong value) Could you tell me the CodeSourcery toolchain versions known to be working? I'd like to try out the same version. Thanks, Justin From: Daniel Schwierzeck [daniel.schwierz...@gmail.com] Sent: Tuesday, February 26, 2013 1:52 AM To: Juhyun (Justin) Oh Cc: u-boot@lists.denx.de Subject: Re: [U-Boot] [u-boot-mips] gp init and -pie option 2013/2/25 Juhyun (Justin) Oh juhyun...@sigmadesigns.com: Hi, I got a problem while I was trying out v2013.01.01 on the u-boot-mips fork repo. It looks like my u-boot binary built with -pie linker option doesn't work due to wrong gp initialization. In the start.S file, the gp is supposed to be initialized with _gp because ra will hold the address of .word _gp line. The below is part of start.S. ... /* Initialize $gp */ bal 1f nop .word _gp 1: lw gp, 0(ra) ... Without the -pie option, linker puts the start address of the .got section. However, with -pie option, the .word _gp is translated to nop. The below is disassembled code. 84001490 reset: ... 840014b8: 40804800mtc0zero,c0_count 840014bc: 40805800mtc0zero,c0_compare 840014c0: 04110002bal 840014cc reset+0x3c 840014c4: nop 840014c8: nop --- 840014cc: 8ffclw gp,0(ra) 840014d0: 3c1d8440lui sp,0x8440 840014d4: 8f9982c0lw t9,-32064(gp) 840014d8: 0328jr t9 840014dc: nop Could anyone tell me what is going on here? Am I missing anything? Thanks, Justin which board and toolchain do you use? PIE support has been tested with various toolchains from ELDK, CodeSourcery and OpenWRT. -- Best regards, Daniel ___ 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] [u-boot-mips] gp init and -pie option
Hi Michael, I'm not working on ARM, but on MIPS. Your problem is certainly different from mine. Hi Daniel, I've tried out gcc version 4.6.3 (Sourcery CodeBench Lite 2012.03-63), and this version initialize gp register properly. Thanks, Justin From: Michael Cashwell [mboa...@prograde.net] Sent: Tuesday, February 26, 2013 11:44 AM To: Juhyun (Justin) Oh Cc: Daniel Schwierzeck; u-boot@lists.denx.de Subject: Re: [U-Boot] [u-boot-mips] gp init and -pie option Not to hijack this thread, but I've had trouble with recent (2013.01 and perhaps the last 2012) mainline u-boots for Pandaboard when built using recent Codesourcery Lite tools. I've found that arm-2009q1 and arm-2010q1 work but arm-2012.03 and arm-2012.09 do not. SPL works but u-boot hangs very early. It's on my list of things to look into. -Michael Cashwell On Feb 26, 2013, at 1:12 PM, Juhyun (Justin) Oh juhyun...@sigmadesigns.com wrote: HI Daniel, I'm using CodeSourcery 4.5.2. I've configured and have built the code for incaip board and dbau1000. The results are the same. (i.e. gp has been set with wrong value) Could you tell me the CodeSourcery toolchain versions known to be working? I'd like to try out the same version. Thanks, Justin From: Daniel Schwierzeck [daniel.schwierz...@gmail.com] Sent: Tuesday, February 26, 2013 1:52 AM To: Juhyun (Justin) Oh Cc: u-boot@lists.denx.de Subject: Re: [U-Boot] [u-boot-mips] gp init and -pie option 2013/2/25 Juhyun (Justin) Oh juhyun...@sigmadesigns.com: Hi, I got a problem while I was trying out v2013.01.01 on the u-boot-mips fork repo. It looks like my u-boot binary built with -pie linker option doesn't work due to wrong gp initialization. In the start.S file, the gp is supposed to be initialized with _gp because ra will hold the address of .word _gp line. The below is part of start.S. ... /* Initialize $gp */ bal 1f nop .word _gp 1: lw gp, 0(ra) ... Without the -pie option, linker puts the start address of the .got section. However, with -pie option, the .word _gp is translated to nop. The below is disassembled code. 84001490 reset: ... 840014b8: 40804800mtc0zero,c0_count 840014bc: 40805800mtc0zero,c0_compare 840014c0: 04110002bal 840014cc reset+0x3c 840014c4: nop 840014c8: nop --- 840014cc: 8ffclw gp,0(ra) 840014d0: 3c1d8440lui sp,0x8440 840014d4: 8f9982c0lw t9,-32064(gp) 840014d8: 0328jr t9 840014dc: nop Could anyone tell me what is going on here? Am I missing anything? Thanks, Justin which board and toolchain do you use? PIE support has been tested with various toolchains from ELDK, CodeSourcery and OpenWRT. -- Best regards, Daniel ___ 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] [u-boot-mips] gp init and -pie option
Hi, 2013/2/26 Juhyun (Justin) Oh juhyun...@sigmadesigns.com: HI Daniel, I'm using CodeSourcery 4.5.2. I've configured and have built the code for incaip board and dbau1000. The results are the same. (i.e. gp has been set with wrong value) Could you tell me the CodeSourcery toolchain versions known to be working? I'd like to try out the same version. Which CodeSourcery release do you use? I have tried following toolchains and all of them have _gp initialized correctly. Sourcery CodeBench Lite 2011.09-75 gcc version 4.5.2 (Sourcery CodeBench Lite 2011.09-75) GNU ld (Sourcery CodeBench Lite 2011.09-75) 2.21.53.20110905 Sourcery CodeBench Lite 2012.03-63: gcc version 4.6.3 (Sourcery CodeBench Lite 2012.03-63) GNU ld (Sourcery CodeBench Lite 2012.03-63) 2.21.53.20110905 ELDK-5.2.1: gcc version 4.6.4 20120303 (prerelease) (GCC) GNU ld (GNU Binutils) 2.22 ELDK-5.3: gcc version 4.7.2 (GCC) GNU ld (GNU Binutils) 2.22 -- Best regards, Daniel ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 0/5] Tegra30: MMC: Add DT-based MMC driver for Tegra30/Cardhu
This patchset adds SDMMC device-tree support to the Tegra30 dts files, and enables the Tegra MMC driver on Tegra30 Cardhu. I've tested this on my Cardhu-A04 and everything works fine, including card detect. All Tegra boards also build w/o error, and Seaboard MMC functionality is unchanged. Tom Warren (5): Tegra30: fdt: Add SDMMC (sdhci) nodes for T30 boards (Cardhu for now) Tegra: MMC: Added/update SDMMC registers/base addresses for T20/T30 Tegra30: MMC: Add SD bus power-rail and SDMMC pad init routines mmc: Tegra: Add SD bus power/voltage function and MMC pad init call. Tegra30: MMC: Enable DT MMC driver support for Tegra30 Cardhu boards arch/arm/dts/tegra30.dtsi | 32 +++ arch/arm/include/asm/arch-tegra/tegra_mmc.h| 35 ++--- arch/arm/include/asm/arch-tegra20/tegra.h |5 ++ arch/arm/include/asm/arch-tegra30/gp_padctrl.h |6 +++ arch/arm/include/asm/arch-tegra30/tegra.h |5 ++ board/nvidia/cardhu/cardhu.c | 49 +++ board/nvidia/common/board.c| 50 +++- board/nvidia/dts/tegra30-cardhu.dts| 15 +++ drivers/mmc/tegra_mmc.c| 48 -- include/configs/cardhu.h | 20 +- include/configs/tegra30-common.h |3 + 11 files changed, 255 insertions(+), 13 deletions(-) ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/5] Tegra30: fdt: Add SDMMC (sdhci) nodes for T30 boards (Cardhu for now)
Took these values directly from the kernel dts files. Signed-off-by: Tom Warren twar...@nvidia.com --- arch/arm/dts/tegra30.dtsi | 32 board/nvidia/dts/tegra30-cardhu.dts | 15 +++ 2 files changed, 47 insertions(+), 0 deletions(-) diff --git a/arch/arm/dts/tegra30.dtsi b/arch/arm/dts/tegra30.dtsi index 9483e80..834d617 100644 --- a/arch/arm/dts/tegra30.dtsi +++ b/arch/arm/dts/tegra30.dtsi @@ -184,4 +184,36 @@ clocks = tegra_car 105; status = disabled; }; + + sdhci@7800 { + compatible = nvidia,tegra30-sdhci, nvidia,tegra20-sdhci; + reg = 0x7800 0x200; + interrupts = 0 14 0x04; + clocks = tegra_car 14; + status = disabled; + }; + + sdhci@78000200 { + compatible = nvidia,tegra30-sdhci, nvidia,tegra20-sdhci; + reg = 0x78000200 0x200; + interrupts = 0 15 0x04; + clocks = tegra_car 9; + status = disabled; + }; + + sdhci@78000400 { + compatible = nvidia,tegra30-sdhci, nvidia,tegra20-sdhci; + reg = 0x78000400 0x200; + interrupts = 0 19 0x04; + clocks = tegra_car 69; + status = disabled; + }; + + sdhci@78000600 { + compatible = nvidia,tegra30-sdhci, nvidia,tegra20-sdhci; + reg = 0x78000600 0x200; + interrupts = 0 31 0x04; + clocks = tegra_car 15; + status = disabled; + }; }; diff --git a/board/nvidia/dts/tegra30-cardhu.dts b/board/nvidia/dts/tegra30-cardhu.dts index 48039c9..4d22b48 100644 --- a/board/nvidia/dts/tegra30-cardhu.dts +++ b/board/nvidia/dts/tegra30-cardhu.dts @@ -12,6 +12,8 @@ i2c2 = /i2c@7000c400; i2c3 = /i2c@7000c500; i2c4 = /i2c@7000c700; + sdhci0 = /sdhci@78000600; + sdhci1 = /sdhci@7800; }; memory { @@ -48,4 +50,17 @@ status = okay; spi-max-frequency = 2500; }; + + sdhci@7800 { + status = okay; + cd-gpios = gpio 69 1; /* gpio PI5 */ + wp-gpios = gpio 155 0; /* gpio PT3 */ + power-gpios = gpio 31 0; /* gpio PD7 */ + bus-width = 4; + }; + + sdhci@78000600 { + status = okay; + bus-width = 8; + }; }; -- 1.7.0.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 2/5] Tegra: MMC: Added/update SDMMC registers/base addresses for T20/T30
Moved SDMMC base addresses into each SoC's main header, since they differ. Added pad control settings for T30 from the TRM, and added additional vendor-specific SD/MMC registers and bus power defines. Signed-off-by: Tom Warren twar...@nvidia.com --- arch/arm/include/asm/arch-tegra/tegra_mmc.h| 35 +++ arch/arm/include/asm/arch-tegra20/tegra.h |5 +++ arch/arm/include/asm/arch-tegra30/gp_padctrl.h |6 arch/arm/include/asm/arch-tegra30/tegra.h |5 +++ 4 files changed, 45 insertions(+), 6 deletions(-) diff --git a/arch/arm/include/asm/arch-tegra/tegra_mmc.h b/arch/arm/include/asm/arch-tegra/tegra_mmc.h index bd18f5f..cd896a5 100644 --- a/arch/arm/include/asm/arch-tegra/tegra_mmc.h +++ b/arch/arm/include/asm/arch-tegra/tegra_mmc.h @@ -22,10 +22,7 @@ #ifndef __TEGRA_MMC_H_ #define __TEGRA_MMC_H_ -#define TEGRA_SDMMC1_BASE 0xC800 -#define TEGRA_SDMMC2_BASE 0xC8000200 -#define TEGRA_SDMMC3_BASE 0xC8000400 -#define TEGRA_SDMMC4_BASE 0xC8000600 +#include fdtdec.h #define MAX_HOSTS 4 /* Max number of 'hosts'/controllers */ @@ -64,12 +61,30 @@ struct tegra_mmc { unsigned char admaerr;/* offset 54h */ unsigned char res4[3];/* RESERVED, offset 55h-57h */ unsigned long admaaddr; /* offset 58h-5Fh */ - unsigned char res5[0x9c]; /* RESERVED, offset 60h-FBh */ + unsigned char res5[0xa0]; /* RESERVED, offset 60h-FBh */ unsigned short slotintstatus; /* offset FCh */ unsigned short hcver; /* HOST Version */ - unsigned char res6[0x100];/* RESERVED, offset 100h-1FFh */ + unsigned intvenclkctl; /* _VENDOR_CLOCK_CNTRL_0,100h */ + unsigned intvenspictl; /* _VENDOR_SPI_CNTRL_0, 104h */ + unsigned intvenspiintsts; /* _VENDOR_SPI_INT_STATUS_0, 108h */ + unsigned intvenceatactl;/* _VENDOR_CEATA_CNTRL_0,10Ch */ + unsigned intvenbootctl; /* _VENDOR_BOOT_CNTRL_0, 110h */ + unsigned intvenbootacktout; /* _VENDOR_BOOT_ACK_TIMEOUT, 114h */ + unsigned intvenbootdattout; /* _VENDOR_BOOT_DAT_TIMEOUT, 118h */ + unsigned intvendebouncecnt; /* _VENDOR_DEBOUNCE_COUNT_0, 11Ch */ + unsigned intvenmiscctl; /* _VENDOR_MISC_CNTRL_0, 120h */ + unsigned intres6[47]; /* 0x124 ~ 0x1DC */ + unsigned intsdmemcmppadctl; /* _SDMEMCOMPPADCTRL_0, 1E0h */ + unsigned intautocalcfg; /* _AUTO_CAL_CONFIG_0, 1E4h */ + unsigned intautocalintval; /* _AUTO_CAL_INTERVAL_0, 1E8h */ + unsigned intautocalsts; /* _AUTO_CAL_STATUS_0, 1ECh */ }; +#define TEGRA_MMC_PWRCTL_SD_BUS_POWER (1 0) +#define TEGRA_MMC_PWRCTL_SD_BUS_VOLTAGE_V1_8 (5 1) +#define TEGRA_MMC_PWRCTL_SD_BUS_VOLTAGE_V3_0 (6 1) +#define TEGRA_MMC_PWRCTL_SD_BUS_VOLTAGE_V3_3 (7 1) + #define TEGRA_MMC_HOSTCTL_DMASEL_MASK (3 3) #define TEGRA_MMC_HOSTCTL_DMASEL_SDMA (0 3) #define TEGRA_MMC_HOSTCTL_DMASEL_ADMA2_32BIT (2 3) @@ -119,6 +134,14 @@ struct tegra_mmc { #define TEGRA_MMC_NORINTSIGEN_XFER_COMPLETE(1 1) +/* SDMMC1/3 settings from section 24.6 of T30 TRM */ +#define MEMCOMP_PADCTRL_VREF 7 +#define AUTO_CAL_ENABLED (1 29) +#define AUTO_CAL_PD_OFFSET (0x70 8) +#define AUTO_CAL_PU_OFFSET (0x62 0) + +void pad_init_mmc(struct tegra_mmc *reg); + struct mmc_host { struct tegra_mmc *reg; int id; /* device id/number, 0-3 */ diff --git a/arch/arm/include/asm/arch-tegra20/tegra.h b/arch/arm/include/asm/arch-tegra20/tegra.h index ad5c01d..ba0084e 100644 --- a/arch/arm/include/asm/arch-tegra20/tegra.h +++ b/arch/arm/include/asm/arch-tegra20/tegra.h @@ -30,6 +30,11 @@ #define TEGRA_USB1_BASE0xC500 +#define TEGRA_SDMMC1_BASE 0xC800 +#define TEGRA_SDMMC2_BASE 0xC8000200 +#define TEGRA_SDMMC3_BASE 0xC8000400 +#define TEGRA_SDMMC4_BASE 0xC8000600 + #define BCT_ODMDATA_OFFSET 4068/* 12 bytes from end of BCT */ #define MAX_NUM_CPU2 diff --git a/arch/arm/include/asm/arch-tegra30/gp_padctrl.h b/arch/arm/include/asm/arch-tegra30/gp_padctrl.h index 9b383d0..48b9a3b 100644 --- a/arch/arm/include/asm/arch-tegra30/gp_padctrl.h +++ b/arch/arm/include/asm/arch-tegra30/gp_padctrl.h @@ -56,4 +56,10 @@ struct apb_misc_gp_ctlr { u32 sdio1cfg; /* 0xEC: APB_MISC_GP_SDIO1CFGPADCTRL */ }; +/* SDMMC1/3 settings from section 24.6 of T30 TRM */ +#define GP_SDIOCFG_DRVUP_SLWF (1 30) +#define GP_SDIOCFG_DRVDN_SLWR (1 28) +#define GP_SDIOCFG_DRVUP (0x2E 20) +#define GP_SDIOCFG_DRVDN (0x2A 12) + #endif /* _TEGRA30_GP_PADCTRL_H_ */ diff --git
[U-Boot] [PATCH 3/5] Tegra30: MMC: Add SD bus power-rail and SDMMC pad init routines
T30 requires specific SDMMC pad programming, and bus power-rail bringup. Signed-off-by: Tom Warren twar...@nvidia.com --- board/nvidia/cardhu/cardhu.c | 49 + board/nvidia/common/board.c | 50 +- 2 files changed, 98 insertions(+), 1 deletions(-) diff --git a/board/nvidia/cardhu/cardhu.c b/board/nvidia/cardhu/cardhu.c index df4cb6b..363bddc 100644 --- a/board/nvidia/cardhu/cardhu.c +++ b/board/nvidia/cardhu/cardhu.c @@ -24,6 +24,10 @@ #include common.h #include asm/arch/pinmux.h #include pinmux-config-cardhu.h +#include i2c.h + +#define PMU_I2C_ADDRESS0x2D +#define MAX_I2C_RETRY 3 /* * Routine: pinmux_init @@ -37,3 +41,48 @@ void pinmux_init(void) pinmux_config_table(unused_pins_lowpower, ARRAY_SIZE(unused_pins_lowpower)); } + +#if defined(CONFIG_TEGRA_MMC) +/* + * Do I2C/PMU writes to bring up SD card bus power + * + */ +void board_sdmmc_voltage_init(void) +{ + uchar reg, data_buffer[1]; + int i; + + i2c_set_bus_num(0); /* PMU is on bus 0 */ + + data_buffer[0] = 0x65; + reg = 0x32; + + for (i = 0; i MAX_I2C_RETRY; ++i) { + if (i2c_write(PMU_I2C_ADDRESS, reg, 1, data_buffer, 1)) + udelay(100); + } + + data_buffer[0] = 0x09; + reg = 0x67; + + for (i = 0; i MAX_I2C_RETRY; ++i) { + if (i2c_write(PMU_I2C_ADDRESS, reg, 1, data_buffer, 1)) + udelay(100); + } +} + +/* + * Routine: pin_mux_mmc + * Description: setup the MMC muxes, power rails, etc. + */ +void pin_mux_mmc(void) +{ + /* +* NOTE: We don't do mmc-specific pin muxes here. +* They were done globally in pinmux_init(). +*/ + + /* Bring up the SDIO1 power rail */ + board_sdmmc_voltage_init(); +} +#endif /* MMC */ diff --git a/board/nvidia/common/board.c b/board/nvidia/common/board.c index babbe08..4ca6b29 100644 --- a/board/nvidia/common/board.c +++ b/board/nvidia/common/board.c @@ -49,6 +49,8 @@ #include asm/arch-tegra/usb.h #endif #ifdef CONFIG_TEGRA_MMC +#include asm/arch/gp_padctrl.h +#include asm/arch-tegra/tegra_mmc.h #include asm/arch-tegra/mmc.h #endif #include i2c.h @@ -245,4 +247,50 @@ int board_mmc_init(bd_t *bd) return 0; } -#endif + +void pad_init_mmc(struct tegra_mmc *reg) +{ +#if defined(CONFIG_TEGRA30) + struct apb_misc_gp_ctlr *const gpc = + (struct apb_misc_gp_ctlr *)NV_PA_APB_MISC_GP_BASE; + struct tegra_mmc *const sdmmc = (struct tegra_mmc *)reg; + u32 val, padcfg, padmask, offset = (unsigned int)reg; + + debug(%s: sdmmc address = %08x\n, __func__, (unsigned int)sdmmc); + + /* Set the pad drive strength for SDMMC1 or 3 only */ + if (offset != TEGRA_SDMMC1_BASE offset != TEGRA_SDMMC3_BASE) { + debug(%s: settings are only valid for SDMMC1/SDMMC3!\n, + __func__); + return; + } + + /* Set pads as per T30 TRM, section 24.6.1.2 */ + padcfg = (GP_SDIOCFG_DRVUP_SLWF | GP_SDIOCFG_DRVDN_SLWR | \ + GP_SDIOCFG_DRVUP | GP_SDIOCFG_DRVDN); + padmask = 0x0FFF; + + if (offset == TEGRA_SDMMC1_BASE) { + val = readl(gpc-sdio1cfg); + val = padmask; + val |= padcfg; + writel(val, gpc-sdio1cfg); + } else {/* SDMMC3 */ + val = readl(gpc-sdio3cfg); + val = padmask; + val |= padcfg; + writel(val, gpc-sdio3cfg); + } + + val = readl(sdmmc-sdmemcmppadctl); + val = 0xFFF0; + val |= MEMCOMP_PADCTRL_VREF; + writel(val, sdmmc-sdmemcmppadctl); + + val = readl(sdmmc-autocalcfg); + val = 0x; + val |= AUTO_CAL_PU_OFFSET | AUTO_CAL_PD_OFFSET | AUTO_CAL_ENABLED; + writel(val, sdmmc-autocalcfg); +#endif /* T30 */ +} +#endif /* MMC */ -- 1.7.0.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 4/5] mmc: Tegra: Add SD bus power/voltage function and MMC pad init call.
Tegra30 requires the SD Bus Voltage Power bits be set in the SD Power Control register. Tegra20 works w/o them set, but do it anyway for those SoCs as it's part of the SD spec. Also call a common board pad init routine (pad_init_mmc) in mmc_reset(), used by Tegra30 only for now. Signed-off-by: Tom Warren twar...@nvidia.com --- drivers/mmc/tegra_mmc.c | 48 ++ 1 files changed, 43 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/tegra_mmc.c b/drivers/mmc/tegra_mmc.c index 6063d08..9e44771 100644 --- a/drivers/mmc/tegra_mmc.c +++ b/drivers/mmc/tegra_mmc.c @@ -21,7 +21,6 @@ #include bouncebuf.h #include common.h -#include fdtdec.h #include asm/gpio.h #include asm/io.h #include asm/arch/clock.h @@ -38,6 +37,38 @@ struct mmc_host mmc_host[MAX_HOSTS]; #error Please enable device tree support to use this driver #endif +static void mmc_set_power(struct mmc_host *host, unsigned short power) +{ + u8 pwr = 0; + debug(%s: power = %x\n, __func__, power); + + if (power != (unsigned short)-1) { + switch (1 power) { + case MMC_VDD_165_195: + pwr = TEGRA_MMC_PWRCTL_SD_BUS_VOLTAGE_V1_8; + break; + case MMC_VDD_29_30: + case MMC_VDD_30_31: + pwr = TEGRA_MMC_PWRCTL_SD_BUS_VOLTAGE_V3_0; + break; + case MMC_VDD_32_33: + case MMC_VDD_33_34: + pwr = TEGRA_MMC_PWRCTL_SD_BUS_VOLTAGE_V3_3; + break; + } + } + debug(%s: pwr = %X\n, __func__, pwr); + + /* Set the bus voltage first (if any) */ + writeb(pwr, host-reg-pwrcon); + if (pwr == 0) + return; + + /* Now enable bus power */ + pwr |= TEGRA_MMC_PWRCTL_SD_BUS_POWER; + writeb(pwr, host-reg-pwrcon); +} + static void mmc_prepare_data(struct mmc_host *host, struct mmc_data *data, struct bounce_buffer *bbstate) { @@ -334,8 +365,7 @@ static void mmc_change_clock(struct mmc_host *host, uint clock) debug( mmc_change_clock called\n); /* -* Change Tegra SDMMCx clock divisor here. Source is 216MHz, -* PLLP_OUT0 +* Change Tegra SDMMCx clock divisor here. Source is PLLP_OUT0 */ if (clock == 0) goto out; @@ -410,7 +440,7 @@ static void mmc_set_ios(struct mmc *mmc) debug(mmc_set_ios: hostctl = %08X\n, ctrl); } -static void mmc_reset(struct mmc_host *host) +static void mmc_reset(struct mmc_host *host, struct mmc *mmc) { unsigned int timeout; debug( mmc_reset called\n); @@ -436,6 +466,14 @@ static void mmc_reset(struct mmc_host *host) timeout--; udelay(1000); } + + /* Set SD bus voltage enable bus power */ + mmc_set_power(host, fls(mmc-voltages) - 1); + debug(%s: power control = %02X, host control = %02X\n, __func__, + readb(host-reg-pwrcon), readb(host-reg-hostctl)); + + /* Make sure SDIO pads are set up */ + pad_init_mmc(host-reg); } static int mmc_core_init(struct mmc *mmc) @@ -444,7 +482,7 @@ static int mmc_core_init(struct mmc *mmc) unsigned int mask; debug( mmc_core_init called\n); - mmc_reset(host); + mmc_reset(host, mmc); host-version = readw(host-reg-hcver); debug(host version = %x\n, host-version); -- 1.7.0.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 5/5] Tegra30: MMC: Enable DT MMC driver support for Tegra30 Cardhu boards
Tested on my Cardhu-A04 tablet, eMMC and SD-Card work fine, can load a kernel off of an SD card OK, card detect works, and the env is now stored in eMMC (end of the 2nd 'boot' sector, same as Tegra20). Signed-off-by: Tom Warren twar...@nvidia.com --- include/configs/cardhu.h | 20 +++- include/configs/tegra30-common.h |3 +++ 2 files changed, 22 insertions(+), 1 deletions(-) diff --git a/include/configs/cardhu.h b/include/configs/cardhu.h index 1616b39..18c7eb8 100644 --- a/include/configs/cardhu.h +++ b/include/configs/cardhu.h @@ -47,7 +47,25 @@ #define CONFIG_SYS_I2C_SPEED 10 #define CONFIG_CMD_I2C -#define CONFIG_ENV_IS_NOWHERE +/* SD/MMC */ +#define CONFIG_MMC +#define CONFIG_GENERIC_MMC +#define CONFIG_TEGRA_MMC +#define CONFIG_CMD_MMC + +#define CONFIG_DOS_PARTITION +#define CONFIG_EFI_PARTITION +#define CONFIG_FS_EXT4 +#define CONFIG_FS_FAT +#define CONFIG_CMD_EXT2 +#define CONFIG_CMD_FAT +#define CONFIG_CMD_FS_GENERIC + +/* Environment in eMMC, at the end of 2nd boot sector */ +#define CONFIG_ENV_IS_IN_MMC +#define CONFIG_ENV_OFFSET ((512 * 1024) - CONFIG_ENV_SIZE) +#define CONFIG_SYS_MMC_ENV_DEV 0 +#define CONFIG_SYS_MMC_ENV_PART2 /* SPI */ #define CONFIG_TEGRA_SLINK diff --git a/include/configs/tegra30-common.h b/include/configs/tegra30-common.h index 04517e1..bd1dfe8 100644 --- a/include/configs/tegra30-common.h +++ b/include/configs/tegra30-common.h @@ -86,4 +86,7 @@ /* Total I2C ports on Tegra30 */ #define TEGRA_I2C_NUM_CONTROLLERS 5 +/* Misc utility code */ +#define CONFIG_BOUNCE_BUFFER + #endif /* _TEGRA30_COMMON_H_ */ -- 1.7.0.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/2] am335x_evm: Never set CONFIG_EXTRA_ENV_SETTINGS in SPL
Because of our support for network-based SPL, we don't discard all of the environment related functions. We however never make use of the default CONFIG_EXTRA_ENV_SETTINGS items and as this variable grows, it brings us closer to (or with some toolchains, over) our SPL size limit. Never set this in the case of SPL. Signed-off-by: Tom Rini tr...@ti.com --- include/configs/am335x_evm.h |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h index 0dc2a50..630cd48 100644 --- a/include/configs/am335x_evm.h +++ b/include/configs/am335x_evm.h @@ -49,6 +49,7 @@ #define CONFIG_BOOTDELAY 1 #define CONFIG_ENV_VARS_UBOOT_CONFIG #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG +#ifndef CONFIG_SPL_BUILD #define CONFIG_EXTRA_ENV_SETTINGS \ loadaddr=0x8020\0 \ fdtaddr=0x80F8\0 \ @@ -133,6 +134,8 @@ if test $board_name = A335X_SK; then \ setenv fdtfile am335x-evmsk.dtb; fi\0 \ +#endif + #define CONFIG_BOOTCOMMAND \ mmc dev ${mmcdev}; if mmc rescan; then \ echo SD/MMC found on device ${mmcdev}; \ @@ -367,7 +370,6 @@ */ #undef CONFIG_SPL_ETH_SUPPORT #undef CONFIG_SPL_YMODEM_SUPPORT -#undef CONFIG_EXTRA_ENV_SETTINGS #endif /* -- 1.7.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 2/2] am335x_evm: Add am335x_evm_usbspl build target
We add USB (RNDIS gadget) SPL support as a separate target. We need to pull out YMODEM support in order to be a small enough target binary. Signed-off-by: Tom Rini tr...@ti.com --- board/ti/am335x/board.c |2 +- boards.cfg |1 + include/configs/am335x_evm.h |4 +--- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c index 441758f..f4b972b 100644 --- a/board/ti/am335x/board.c +++ b/board/ti/am335x/board.c @@ -73,7 +73,7 @@ static inline int board_is_idk(void) return !strncmp(header.config, SKU#02, 6); } -static int board_is_gp_evm(void) +static int __maybe_unused board_is_gp_evm(void) { return !strncmp(A33515BB, header.name, 8); } diff --git a/boards.cfg b/boards.cfg index 5766f86..9877f53 100644 --- a/boards.cfg +++ b/boards.cfg @@ -239,6 +239,7 @@ am335x_evm_uart2 arm armv7 am335x ti am335x_evm_uart3 arm armv7 am335x ti am33xx am335x_evm:SERIAL4,CONS_INDEX=4 am335x_evm_uart4 arm armv7 am335x ti am33xx am335x_evm:SERIAL5,CONS_INDEX=5 am335x_evm_uart5 arm armv7 am335x ti am33xx am335x_evm:SERIAL6,CONS_INDEX=6 +am335x_evm_usbsplarm armv7 am335x ti am33xx am335x_evm:SERIAL1,CONS_INDEX=1,SPL_USBETH_SUPPORT pcm051 arm armv7 pcm051 phytec am33xx pcm051 highbank arm armv7 highbank- highbank mx51_efikamx arm armv7 mx51_efikamx genesi mx5 mx51_efikamx:MACH_TYPE=MACH_TYPE_MX51_EFIKAMX,IMX_CONFIG=board/genesi/mx51_efikamx/imximage_mx.cfg diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h index 630cd48..e8b775e 100644 --- a/include/configs/am335x_evm.h +++ b/include/configs/am335x_evm.h @@ -365,11 +365,9 @@ /* disable host part of MUSB in SPL */ #undef CONFIG_MUSB_HOST /* - * Disable UART, CPSW ethernet support and extra environment settings so we - * will fit within 101KiB. + * Disable UART SPL support so we fit within the 101KiB limit. */ #undef CONFIG_SPL_ETH_SUPPORT -#undef CONFIG_SPL_YMODEM_SUPPORT #endif /* -- 1.7.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] am33xx: Update DDR3 EMIF configuration sequence
Based on http://processors.wiki.ti.com/index.php/AM335x_EMIF_Configuration_tips we need to re-work our sequence in config_sdram slightly to match what the TRM describes as the correct sequence. In our current (incorrect) sequence some edge cases may fail to initalize correctly. Signed-off-by: Tom Rini tr...@ti.com --- arch/arm/cpu/armv7/am33xx/ddr.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/arch/arm/cpu/armv7/am33xx/ddr.c b/arch/arm/cpu/armv7/am33xx/ddr.c index fd9fc4a..448cc40 100644 --- a/arch/arm/cpu/armv7/am33xx/ddr.c +++ b/arch/arm/cpu/armv7/am33xx/ddr.c @@ -45,13 +45,19 @@ static struct ddr_cmdtctrl *ioctrl_reg = { */ void config_sdram(const struct emif_regs *regs) { - writel(regs-ref_ctrl, emif_reg-emif_sdram_ref_ctrl); - writel(regs-ref_ctrl, emif_reg-emif_sdram_ref_ctrl_shdw); - if (regs-zq_config){ + if (regs-zq_config) { + /* +* A value of 0x2800 for the REF CTRL will give us +* about 570us for a delay, which will be long enough +* to configure things. +*/ + writel(0x2800, emif_reg-emif_sdram_ref_ctrl); writel(regs-zq_config, emif_reg-emif_zq_config); writel(regs-sdram_config, cstat-secure_emif_sdram_config); } writel(regs-sdram_config, emif_reg-emif_sdram_config); + writel(regs-ref_ctrl, emif_reg-emif_sdram_ref_ctrl); + writel(regs-ref_ctrl, emif_reg-emif_sdram_ref_ctrl_shdw); } /** -- 1.7.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] Pull request: nand flash
The following changes since commit 47104c37de076e2be35ae1b3d144614f4d24a766: MAKEALL: add support for per architecture toolchains (2013-02-20 09:40:34 -0500) are available in the git repository at: git://git.denx.de/u-boot-nand-flash.git master for you to fetch changes up to a1eac57a2001ecf86a46f520cd85ef8e9c8b3687: common/env_nand.c: calculate crc only when readenv was OK (2013-02-22 19:59:53 -0600) Harvey Chapman (1): nand: fix nand read.option parsing Joe Hershberger (1): mtd: nand: Check if NAND is locked tight before lock cmds Phil Sutter (2): env_nand.c: clarify log messages when env reading fails common/env_nand.c: calculate crc only when readenv was OK Vipin Kumar (1): imls: Add support to list images in NAND device README |3 +- common/cmd_bootm.c | 167 +- common/cmd_nand.c|2 +- common/env_nand.c| 18 +++-- drivers/mtd/nand/nand_util.c | 19 - 5 files changed, 197 insertions(+), 12 deletions(-) ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [u-boot-mips] gp init and -pie option
Hi Daniel, I've verified that the CodeSourcery 4.5.2 and 4.6.3 generate the correct _gp as you mentioned. Thanks, Justin From: Daniel Schwierzeck [daniel.schwierz...@gmail.com] Sent: Tuesday, February 26, 2013 12:34 PM To: Juhyun (Justin) Oh Cc: u-boot@lists.denx.de Subject: Re: [U-Boot] [u-boot-mips] gp init and -pie option Hi, 2013/2/26 Juhyun (Justin) Oh juhyun...@sigmadesigns.com: HI Daniel, I'm using CodeSourcery 4.5.2. I've configured and have built the code for incaip board and dbau1000. The results are the same. (i.e. gp has been set with wrong value) Could you tell me the CodeSourcery toolchain versions known to be working? I'd like to try out the same version. Which CodeSourcery release do you use? I have tried following toolchains and all of them have _gp initialized correctly. Sourcery CodeBench Lite 2011.09-75 gcc version 4.5.2 (Sourcery CodeBench Lite 2011.09-75) GNU ld (Sourcery CodeBench Lite 2011.09-75) 2.21.53.20110905 Sourcery CodeBench Lite 2012.03-63: gcc version 4.6.3 (Sourcery CodeBench Lite 2012.03-63) GNU ld (Sourcery CodeBench Lite 2012.03-63) 2.21.53.20110905 ELDK-5.2.1: gcc version 4.6.4 20120303 (prerelease) (GCC) GNU ld (GNU Binutils) 2.22 ELDK-5.3: gcc version 4.7.2 (GCC) GNU ld (GNU Binutils) 2.22 -- Best regards, Daniel ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] Tegra114: fdt: Sync DT nodes with kernel DT files (GPIO, tegra_car)
Minor edit to tegra_car node, add gpio node. Signed-off-by: Tom Warren twar...@nvidia.com --- arch/arm/dts/tegra114.dtsi | 21 +++-- 1 files changed, 19 insertions(+), 2 deletions(-) diff --git a/arch/arm/dts/tegra114.dtsi b/arch/arm/dts/tegra114.dtsi index f0f82de..6c85fb0 100644 --- a/arch/arm/dts/tegra114.dtsi +++ b/arch/arm/dts/tegra114.dtsi @@ -11,12 +11,29 @@ i2c4 = /i2c@7000c700; }; - tegra_car: clock@60006000 { - compatible = nvidia,tegra114-car; + tegra_car: clock { + compatible = nvidia,tegra114-car, nvidia,tegra30-car; reg = 0x60006000 0x1000; #clock-cells = 1; }; + gpio: gpio { + compatible = nvidia,tegra114-gpio, nvidia,tegra30-gpio; + reg = 0x6000d000 0x1000; + interrupts = 0 32 0x04 + 0 33 0x04 + 0 34 0x04 + 0 35 0x04 + 0 55 0x04 + 0 87 0x04 + 0 89 0x04 + 0 125 0x04; + #gpio-cells = 2; + gpio-controller; + #interrupt-cells = 2; + interrupt-controller; + }; + i2c@7000c000 { compatible = nvidia,tegra114-i2c; reg = 0x7000c000 0x100; -- 1.7.0.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] Tegra: Remove unused CONFIG_SYS_CPU_OSC_FREQUENCY define
This wasn't used anywhere in any Tegra build. Signed-off-by: Tom Warren twar...@nvidia.com --- include/configs/tegra-common.h |8 +++- 1 files changed, 3 insertions(+), 5 deletions(-) diff --git a/include/configs/tegra-common.h b/include/configs/tegra-common.h index 4a656bb..80c846c 100644 --- a/include/configs/tegra-common.h +++ b/include/configs/tegra-common.h @@ -21,8 +21,8 @@ * MA 02111-1307 USA */ -#ifndef __TEGRA_COMMON_H -#define __TEGRA_COMMON_H +#ifndef _TEGRA_COMMON_H_ +#define _TEGRA_COMMON_H_ #include asm/sizes.h #include linux/stringify.h @@ -56,10 +56,8 @@ #define CONFIG_SYS_MALLOC_LEN (4 20) /* 4MB */ /* - * PllX Configuration + * NS16550 Configuration */ -#define CONFIG_SYS_CPU_OSC_FREQUENCY 100 /* Set CPU clock to 1GHz */ - #define CONFIG_SYS_NS16550 #define CONFIG_SYS_NS16550_SERIAL #define CONFIG_SYS_NS16550_REG_SIZE(-4) -- 1.7.0.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] problem to boot i.MX28 custom platform
Hi Hector, On Tue, Feb 26, 2013 at 9:19 AM, Hector Palacios hector.palac...@digi.com wrote: Greetings, I'm porting a custom platform based on mx28evk to latest U-Boot. I modified the iomux.c for my platform (different DUART pins) and made some changes to mxs_adjust_memory_params() to accommodate to my DRAM chip. I built the u-boot.sb. The platform however does not boot either from USB or from MMC. Please try booting from NAND as per the instructions from: doc/README.mx28_common When loaded through USB, sb_loader complains with the messages at [1]. I fear the CPU resets before even executing the SPL code, but how could I tell? Is there a way to check if the CPU reaches this code at all? I don't see any ROM error codes either and the CPU seems to reset (when the USB recovery mode fails, the target defaults to boot from flash my old v2009 U-Boot). Is there any other init stuff (linker scripts or something) I should take care of that's preventing sb_loader to fully load the image? Do you have a diff of your bootlets changes from your FSL U-boot? Then make sure these changes are incorporated into U-boot. Or maybe post RFC patches for your board addition into the mailing list, so that people can comment. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/3] ARM: implement some Cortex-A9 errata workarounds
From: Stephen Warren swar...@nvidia.com Various errata exist in the Cortex-A9 CPU, and may be worked around by setting some bits in a CP15 diagnostic register. Add code to implement the workarounds, enabled by new CONFIG_ options. This code was taken from the Linux kernel, v3.8, arch/arm/mm/proc-v7.S, and modified to remove the logic to conditionally apply the WAR (since we know exactly which CPU we're running on given the U-Boot configuration), and use r0 instead of r10 for consistency with the rest of U-Boot's cpu_init_cp15(). Signed-off-by: Stephen Warren swar...@nvidia.com --- README | 10 ++ arch/arm/cpu/armv7/start.S | 19 +++ 2 files changed, 29 insertions(+) diff --git a/README b/README index d8cb394..f2b1c88 100644 --- a/README +++ b/README @@ -485,6 +485,16 @@ The following options need to be configured: Thumb2 this flag will result in Thumb2 code generated by GCC. + CONFIG_ARM_ERRATA_742230 + CONFIG_ARM_ERRATA_743622 + CONFIG_ARM_ERRATA_751472 + + If set, the workarounds for these ARM errata are applied early + during U-Boot startup. Note that these options force the + workarounds to be applied; no CPU-type/version detection + exists, unlike the similar options in the Linux kernel. Do not + set these options unless they apply! + - Linux Kernel Interface: CONFIG_CLOCKS_IN_MHZ diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S index 6b59529d..30f02d3 100644 --- a/arch/arm/cpu/armv7/start.S +++ b/arch/arm/cpu/armv7/start.S @@ -309,6 +309,25 @@ ENTRY(cpu_init_cp15) orr r0, r0, #0x1000 @ set bit 12 (I) I-cache #endif mcr p15, 0, r0, c1, c0, 0 + +#ifdef CONFIG_ARM_ERRATA_742230 + mrc p15, 0, r0, c15, c0, 1 @ read diagnostic register + orr r0, r0, #1 4 @ set bit #4 + mcr p15, 0, r0, c15, c0, 1 @ write diagnostic register +#endif + +#ifdef CONFIG_ARM_ERRATA_743622 + mrc p15, 0, r0, c15, c0, 1 @ read diagnostic register + orr r0, r0, #1 6 @ set bit #6 + mcr p15, 0, r0, c15, c0, 1 @ write diagnostic register +#endif + +#ifdef CONFIG_ARM_ERRATA_751472 + mrc p15, 0, r0, c15, c0, 1 @ read diagnostic register + orr r0, r0, #1 11@ set bit #11 + mcr p15, 0, r0, c15, c0, 1 @ write diagnostic register +#endif + mov pc, lr @ back to my caller ENDPROC(cpu_init_cp15) -- 1.7.10.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 2/3] ARM: tegra: enable some CPU errata workarounds
From: Stephen Warren swar...@nvidia.com Tegra20 has a Cortex A9 r1p1, and Tegra30 has a Cortex A9 r2p9. As such, some CPU errata exist, and must be worked around. These must be worked around in the bootloader, since in general, the kernel (especially a multi-platform kernel) needs to support being launched in non-secure mode (normal world), and hence may not be able to write to the CP15 register to enable these workarounds. Signed-off-by: Stephen Warren swar...@nvidia.com --- include/configs/tegra20-common.h |6 ++ include/configs/tegra30-common.h |6 ++ 2 files changed, 12 insertions(+) diff --git a/include/configs/tegra20-common.h b/include/configs/tegra20-common.h index 33e5f52..186e023 100644 --- a/include/configs/tegra20-common.h +++ b/include/configs/tegra20-common.h @@ -26,6 +26,12 @@ #include tegra-common.h /* + * Errata configuration + */ +#define CONFIG_ARM_ERRATA_742230 +#define CONFIG_ARM_ERRATA_751472 + +/* * NS16550 Configuration */ #define V_NS16550_CLK 21600 /* 216MHz (pllp_out0) */ diff --git a/include/configs/tegra30-common.h b/include/configs/tegra30-common.h index 04517e1..f6c07c6 100644 --- a/include/configs/tegra30-common.h +++ b/include/configs/tegra30-common.h @@ -26,6 +26,12 @@ #include tegra-common.h /* + * Errata configuration + */ +#define CONFIG_ARM_ERRATA_743622 +#define CONFIG_ARM_ERRATA_751472 + +/* * NS16550 Configuration */ #define V_NS16550_CLK 40800 /* 408MHz (pllp_out0) */ -- 1.7.10.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 3/3] ARM: mx6: use common CPU errata config options
From: Stephen Warren swar...@nvidia.com Now that U-Boot has common CONFIG_ options to work around some ARM CPU errata, enable the relevant options on MX6, and remove the custom lowlevel_init.S, since it's just duplicated code now. Signed-off-by: Stephen Warren swar...@nvidia.com --- arch/arm/cpu/armv7/Makefile|2 +- arch/arm/cpu/armv7/mx6/Makefile|1 - arch/arm/cpu/armv7/mx6/lowlevel_init.S | 35 arch/arm/cpu/armv7/mx6/soc.c |4 include/configs/mx6_common.h | 23 + include/configs/mx6qarm2.h |3 +++ include/configs/mx6qsabre_common.h |3 +++ include/configs/mx6qsabrelite.h|3 +++ 8 files changed, 37 insertions(+), 37 deletions(-) delete mode 100644 arch/arm/cpu/armv7/mx6/lowlevel_init.S create mode 100644 include/configs/mx6_common.h diff --git a/arch/arm/cpu/armv7/Makefile b/arch/arm/cpu/armv7/Makefile index ee8c2b3..4668b3c 100644 --- a/arch/arm/cpu/armv7/Makefile +++ b/arch/arm/cpu/armv7/Makefile @@ -32,7 +32,7 @@ COBJS += cache_v7.o COBJS += cpu.o COBJS += syslib.o -ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA),) +ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA)$(CONFIG_MX6),) SOBJS += lowlevel_init.o endif diff --git a/arch/arm/cpu/armv7/mx6/Makefile b/arch/arm/cpu/armv7/mx6/Makefile index cbce411..4f9ca68 100644 --- a/arch/arm/cpu/armv7/mx6/Makefile +++ b/arch/arm/cpu/armv7/mx6/Makefile @@ -28,7 +28,6 @@ include $(TOPDIR)/config.mk LIB= $(obj)lib$(SOC).o COBJS = soc.o clock.o -SOBJS = lowlevel_init.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) diff --git a/arch/arm/cpu/armv7/mx6/lowlevel_init.S b/arch/arm/cpu/armv7/mx6/lowlevel_init.S deleted file mode 100644 index 7b60ca7..000 --- a/arch/arm/cpu/armv7/mx6/lowlevel_init.S +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2010-2011 Freescale Semiconductor, Inc. - * - * 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 - */ -.section .text.init, x - -#include linux/linkage.h - -.macro init_arm_errata - /* ARM erratum ID #743622 */ - mrc p15, 0, r10, c15, c0, 1 /* read diagnostic register */ - orr r10, r10, #1 6 /* set bit #6 */ - /* ARM erratum ID #751472 */ - orr r10, r10, #1 11 /* set bit #11 */ - mcr p15, 0, r10, c15, c0, 1 /* write diagnostic register */ -.endm - -ENTRY(lowlevel_init) - init_arm_errata - mov pc, lr -ENDPROC(lowlevel_init) diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c index a8aad5d..8176249 100644 --- a/arch/arm/cpu/armv7/mx6/soc.c +++ b/arch/arm/cpu/armv7/mx6/soc.c @@ -193,3 +193,7 @@ const struct boot_mode soc_boot_modes[] = { {esdhc4, MAKE_CFGVAL(0x40, 0x38, 0x00, 0x00)}, {NULL, 0}, }; + +void s_init(void) +{ +} diff --git a/include/configs/mx6_common.h b/include/configs/mx6_common.h new file mode 100644 index 000..b333937 --- /dev/null +++ b/include/configs/mx6_common.h @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope 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, see http://www.gnu.org/licenses/. + */ + +#ifndef __MX6_COMMON_H +#define __MX6_COMMON_H + +#define CONFIG_ARM_ERRATA_743622 +#define CONFIG_ARM_ERRATA_751472 + +#endif diff --git a/include/configs/mx6qarm2.h b/include/configs/mx6qarm2.h index 138e460..bd52cde 100644 --- a/include/configs/mx6qarm2.h +++ b/include/configs/mx6qarm2.h @@ -24,6 +24,9 @@ #define CONFIG_MX6 #define CONFIG_MX6Q + +#include mx6_common.h + #define CONFIG_DISPLAY_CPUINFO #define CONFIG_DISPLAY_BOARDINFO diff --git
Re: [U-Boot] [PATCH] Tegra: Remove unused CONFIG_SYS_CPU_OSC_FREQUENCY define
On 02/26/2013 03:18 PM, Tom Warren wrote: This wasn't used anywhere in any Tegra build. Reviewed-by: Stephen Warren swar...@nvidia.com ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] Tegra114: fdt: Sync DT nodes with kernel DT files (GPIO, tegra_car)
On 02/26/2013 03:08 PM, Tom Warren wrote: Minor edit to tegra_car node, add gpio node. diff --git a/arch/arm/dts/tegra114.dtsi b/arch/arm/dts/tegra114.dtsi - compatible = nvidia,tegra114-car; ... + compatible = nvidia,tegra114-car, nvidia,tegra30-car; The former is actually correct; the kernel DT is wrong here (the bug was actually needed to temporarily work around not having a Tegra114 clock driver), and a patch will be applied to fix this as soon as I can start applying patches for 3.10. It's part of: http://patchwork.ozlabs.org/patch/220736/ The GPIO change looks fine. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 2/2] mtd: nand: mxc_nand: Fix is_16bit_nand()
From: Fabio Estevam fabio.este...@freescale.com Currently is_16bit_nand() is a per SoC function and it decides the bus nand width by reading some boot related registers. This method works when NAND is the boot medium, but does not work if another boot medium is used. For example: booting from a SD card and then using NAND to store the environment variables, would lead to the following error: NAND bus width 16 instead 8 bit No NAND device found!!! 0 MiB Use CONFIG_SYS_NAND_BUSWIDTH_16BIT symbol to decide the bus width. If it is defined in the board file, then consider 16-bit NAND bus-width, otherwise assume 8-bit NAND is used. This also aligns with Documentation/devicetree/bindings/mtd/nand.txt, which states: nand-bus-width : 8 or 16 bus width if not present 8 Signed-off-by: Fabio Estevam fabio.este...@freescale.com --- Changes since v2: - Fix typo if not present 82 Changes since v1: - Add an entry into README README |3 ++- drivers/mtd/nand/mxc_nand.c | 37 +++-- 2 files changed, 5 insertions(+), 35 deletions(-) diff --git a/README b/README index bdd2c81..1a6a7a5 100644 --- a/README +++ b/README @@ -3717,8 +3717,9 @@ Low Level (hardware related) configuration options: Defined to tell the NAND controller that the NAND chip is using a 16 bit bus. Not all NAND drivers use this symbol. - Example of driver that uses it: + Example of drivers that use it: - drivers/mtd/nand/ndfc.c + - drivers/mtd/nand/mxc_nand.c - CONFIG_SYS_NDFC_EBC0_CFG Sets the EBC0_CFG register for the NDFC. If not defined diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index d0ded48..bb475f2 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c @@ -98,45 +98,14 @@ static struct nand_ecclayout nand_hw_eccoob2k = { #endif #endif -#ifdef CONFIG_MX27 static int is_16bit_nand(void) { - struct system_control_regs *sc_regs = - (struct system_control_regs *)IMX_SYSTEM_CTL_BASE; - - if (readl(sc_regs-fmcr) NF_16BIT_SEL) - return 1; - else - return 0; -} -#elif defined(CONFIG_MX31) -static int is_16bit_nand(void) -{ - struct clock_control_regs *sc_regs = - (struct clock_control_regs *)CCM_BASE; - - if (readl(sc_regs-rcsr) CCM_RCSR_NF16B) - return 1; - else - return 0; -} -#elif defined(CONFIG_MX25) || defined(CONFIG_MX35) -static int is_16bit_nand(void) -{ - struct ccm_regs *ccm = (struct ccm_regs *)IMX_CCM_BASE; - - if (readl(ccm-rcsr) CCM_RCSR_NF_16BIT_SEL) - return 1; - else - return 0; -} +#if defined(CONFIG_SYS_NAND_BUSWIDTH_16BIT) + return 1; #else -#warning 8/16 bit NAND autodetection not supported -static int is_16bit_nand(void) -{ return 0; -} #endif +} static uint32_t *mxc_nand_memcpy32(uint32_t *dest, uint32_t *source, size_t size) { -- 1.7.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 1/2] mtd: nand: Introduce CONFIG_SYS_NAND_BUSWIDTH_16BIT
From: Fabio Estevam fabio.este...@freescale.com Introduce CONFIG_SYS_NAND_BUSWIDTH_16BIT option so that other NAND controller drivers could use it when a 16-bit NAND is deployed. drivers/mtd/nand/ndfc has CONFIG_SYS_NDFC_16BIT, so just rename it, so that other NAND drivers could reuse the same symbol. Signed-off-by: Fabio Estevam fabio.este...@freescale.com --- Changes since v2: - None Changes since v1: - Improve README README |9 ++--- drivers/mtd/nand/ndfc.c |4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README b/README index d8cb394..bdd2c81 100644 --- a/README +++ b/README @@ -3713,9 +3713,12 @@ Low Level (hardware related) configuration options: - CONFIG_SYS_SRIOn_MEM_SIZE: Size of SRIO port 'n' memory region -- CONFIG_SYS_NDFC_16 - Defined to tell the NDFC that the NAND chip is using a - 16 bit bus. +- CONFIG_SYS_NAND_BUSWIDTH_16BIT + Defined to tell the NAND controller that the NAND chip is using + a 16 bit bus. + Not all NAND drivers use this symbol. + Example of driver that uses it: + - drivers/mtd/nand/ndfc.c - CONFIG_SYS_NDFC_EBC0_CFG Sets the EBC0_CFG register for the NDFC. If not defined diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c index 6ebbb5e..213d2c9 100644 --- a/drivers/mtd/nand/ndfc.c +++ b/drivers/mtd/nand/ndfc.c @@ -156,7 +156,7 @@ static uint8_t ndfc_read_byte(struct mtd_info *mtd) struct nand_chip *chip = mtd-priv; -#ifdef CONFIG_SYS_NDFC_16BIT +#ifdef CONFIG_SYS_NAND_BUSWIDTH_16BIT return (uint8_t) readw(chip-IO_ADDR_R); #else return readb(chip-IO_ADDR_R); @@ -218,7 +218,7 @@ int board_nand_init(struct nand_chip *nand) nand-ecc.bytes = 3; nand-select_chip = ndfc_select_chip; -#ifdef CONFIG_SYS_NDFC_16BIT +#ifdef CONFIG_SYS_NAND_BUSWIDTH_16BIT nand-options |= NAND_BUSWIDTH_16; #endif -- 1.7.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 2/2] ARM: tegra: make CONFIG_CMD_PART common
From: Stephen Warren swar...@nvidia.com This is useful on all Tegras, so that boot.scr on all devices can use the same commands. Hence, move it to tegra-common.h. Signed-off-by: Stephen Warren swar...@nvidia.com --- include/configs/tegra-common.h |2 ++ include/configs/tegra20-common.h |3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/include/configs/tegra-common.h b/include/configs/tegra-common.h index a3cb5b9..45f0099 100644 --- a/include/configs/tegra-common.h +++ b/include/configs/tegra-common.h @@ -141,6 +141,8 @@ #define CONFIG_CMD_GPIO #define CONFIG_CMD_ENTERRCM #define CONFIG_CMD_BOOTZ +#define CONFIG_PARTITION_UUIDS +#define CONFIG_CMD_PART /* Defines for SPL */ #define CONFIG_SPL diff --git a/include/configs/tegra20-common.h b/include/configs/tegra20-common.h index c51de00..e464e06 100644 --- a/include/configs/tegra20-common.h +++ b/include/configs/tegra20-common.h @@ -114,9 +114,6 @@ /* Total I2C ports on Tegra20 */ #define TEGRA_I2C_NUM_CONTROLLERS 4 -#define CONFIG_PARTITION_UUIDS -#define CONFIG_CMD_PART - #define CONFIG_SYS_NAND_SELF_INIT #define CONFIG_SYS_NAND_ONFI_DETECTION -- 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] ARM: tegra: make bounce buffer option
From: Stephen Warren swar...@nvidia.com All Tegra devices will need CONFIG_BOUNCE_BUFFER. Move it to tegra-common.h to ensure it's always set. Signed-off-by: Stephen Warren swar...@nvidia.com --- These are useful on top of Tom's Tegra30 MMC series. include/configs/tegra-common.h |3 +++ include/configs/tegra20-common.h |3 --- include/configs/tegra30-common.h |3 --- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/include/configs/tegra-common.h b/include/configs/tegra-common.h index 4a656bb..a3cb5b9 100644 --- a/include/configs/tegra-common.h +++ b/include/configs/tegra-common.h @@ -157,4 +157,7 @@ #define CONFIG_SPL_SERIAL_SUPPORT #define CONFIG_SPL_GPIO_SUPPORT +/* Misc utility code */ +#define CONFIG_BOUNCE_BUFFER + #endif /* _TEGRA_COMMON_H_ */ diff --git a/include/configs/tegra20-common.h b/include/configs/tegra20-common.h index 186e023..c51de00 100644 --- a/include/configs/tegra20-common.h +++ b/include/configs/tegra20-common.h @@ -120,7 +120,4 @@ #define CONFIG_SYS_NAND_SELF_INIT #define CONFIG_SYS_NAND_ONFI_DETECTION -/* Misc utility code */ -#define CONFIG_BOUNCE_BUFFER - #endif /* _TEGRA20_COMMON_H_ */ diff --git a/include/configs/tegra30-common.h b/include/configs/tegra30-common.h index 82b1c07..f6c07c6 100644 --- a/include/configs/tegra30-common.h +++ b/include/configs/tegra30-common.h @@ -92,7 +92,4 @@ /* Total I2C ports on Tegra30 */ #define TEGRA_I2C_NUM_CONTROLLERS 5 -/* Misc utility code */ -#define CONFIG_BOUNCE_BUFFER - #endif /* _TEGRA30_COMMON_H_ */ -- 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 0/5] Tegra30: MMC: Add DT-based MMC driver for Tegra30/Cardhu
On 02/26/2013 01:46 PM, Tom Warren wrote: This patchset adds SDMMC device-tree support to the Tegra30 dts files, and enables the Tegra MMC driver on Tegra30 Cardhu. I've tested this on my Cardhu-A04 and everything works fine, including card detect. All Tegra boards also build w/o error, and Seaboard MMC functionality is unchanged. The series, Tested-by: Stephen Warren swar...@nvidia.com (also on a Cardhu A04) Now I can re-write our internal wiki to make use of commands like bootz, part and fsload on all our boards :-) :-) :-) ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/4] common: imx: Implement generic u-boot.nand target
On 02/26/2013 01:17:41 AM, Marek Vasut wrote: Dear Scott Wood, On 02/25/2013 05:03:30 PM, Marek Vasut wrote: Dear Scott Wood, So maybe we need a more general (but optional) CONFIG_BUILD_TARGET. Can you elaborate? Same as CONFIG_SPL_TARGET, but not SPL-specific. Basically a way for a board config file to add to $(ALL-y). So each one would set the appropriate CONFIG_BUILD_TARGET for whatever needs to get built, and then something like CONFIG_NAND_IMAGE could hold the image name that should be linked to produce a standard u-boot-nand.bin output. Yea, sounds reasonable. But why call it CONFIG_ , it can't be stored in the board.h files, it has to be somewhere in the Makefile hierarchy. Why can't it go in the board.h files? How would a config file contain the CPU-specific portions of a Makefile? The target rule itself would need to go somewhere in a makefile, but just pointing at which target to use, and which image to link, can go in config.h -- just like CONFIG_SPL_TARGET does. -Scott ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/5] Tegra30: fdt: Add SDMMC (sdhci) nodes for T30 boards (Cardhu for now)
On 02/26/2013 01:46 PM, Tom Warren wrote: Took these values directly from the kernel dts files. diff --git a/arch/arm/dts/tegra30.dtsi b/arch/arm/dts/tegra30.dtsi + sdhci@7800 { + compatible = nvidia,tegra30-sdhci, nvidia,tegra20-sdhci; Looking at this more, I /think/ this should only include the Tegra30 compatible value, since there are new quirks that are required to be enabled on Tegra30 relative to Tegra20 or the HW won't work. The kernel DT file is no doubt buggy here. Cc'ing Rhyland and Pavan to confirm this. (Note: this is Tegra30-vs-Tegra20, not Tegra114-vs-Tegra30 that we just discussed downstream). ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/5] Tegra: MMC: Added/update SDMMC registers/base addresses for T20/T30
On 02/26/2013 01:46 PM, Tom Warren wrote: Moved SDMMC base addresses into each SoC's main header, since they differ. Added pad control settings for T30 from the TRM, and added additional vendor-specific SD/MMC registers and bus power defines. diff --git a/arch/arm/include/asm/arch-tegra/tegra_mmc.h b/arch/arm/include/asm/arch-tegra/tegra_mmc.h -#define TEGRA_SDMMC1_BASE0xC800 -#define TEGRA_SDMMC2_BASE0xC8000200 -#define TEGRA_SDMMC3_BASE0xC8000400 -#define TEGRA_SDMMC4_BASE0xC8000600 This is odd; are these values even used at all now that the registers are described in device tree? Kinda the whole point of DT is that we don't need to SoC-specific register addresses or board-specific data in the code any more. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 3/5] Tegra30: MMC: Add SD bus power-rail and SDMMC pad init routines
On 02/26/2013 01:46 PM, Tom Warren wrote: T30 requires specific SDMMC pad programming, and bus power-rail bringup. diff --git a/board/nvidia/cardhu/cardhu.c b/board/nvidia/cardhu/cardhu.c +/* + * Do I2C/PMU writes to bring up SD card bus power + * + */ +void board_sdmmc_voltage_init(void) We really shouldn't be adding to board files if we're remotely serious about device tree; the whole point of DT is to remove code from the board files, and describe the desired configuration as data in DT instead. This function should be replaced by regulator nodes/properties in the device tree, and the MMC (core?) driver calling into the board-specific regulator driver to request the desired voltages. But so long as we file a bug to replace this code with an explicit regulator driver in the future, I guess it's fine for now. +{ + uchar reg, data_buffer[1]; + int i; + + i2c_set_bus_num(0); /* PMU is on bus 0 */ + + data_buffer[0] = 0x65; + reg = 0x32; We should at least comment what those register numbers and values mean. BTW, I just noticed that commit f01b631 Tegra30: Add/enable Cardhu build (T30 reference board) adds a file called board/nvidia/cardhu/cardhu.c.mmc. That's a mistake, right? diff --git a/board/nvidia/common/board.c b/board/nvidia/common/board.c Hmm. This seems like SoC code, not board code... +void pad_init_mmc(struct tegra_mmc *reg) +{ +#if defined(CONFIG_TEGRA30) + /* Set the pad drive strength for SDMMC1 or 3 only */ + if (offset != TEGRA_SDMMC1_BASE offset != TEGRA_SDMMC3_BASE) { + debug(%s: settings are only valid for SDMMC1/SDMMC3!\n, + __func__); + return; + } Perhaps pass in the MMC instance ID instead of the base address. That'd avoid having to know the base addresses in this code. In fact, just putting this code into the pinmux driver (which owns these registers) seems like a better idea; there's no need to only do this when the SD controller is enabled, is there? ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v3 2/2] mtd: nand: mxc_nand: Fix is_16bit_nand()
Hi Fabio, On Tuesday, February 26, 2013 11:37:45 PM, Fabio Estevam wrote: From: Fabio Estevam fabio.este...@freescale.com Currently is_16bit_nand() is a per SoC function and it decides the bus nand width by reading some boot related registers. This method works when NAND is the boot medium, but does not work if another boot medium is used. For example: booting from a SD card and then using NAND to store the environment variables, would lead to the following error: NAND bus width 16 instead 8 bit No NAND device found!!! 0 MiB Use CONFIG_SYS_NAND_BUSWIDTH_16BIT symbol to decide the bus width. If it is defined in the board file, then consider 16-bit NAND bus-width, otherwise assume 8-bit NAND is used. This also aligns with Documentation/devicetree/bindings/mtd/nand.txt, which states: nand-bus-width : 8 or 16 bus width if not present 8 Signed-off-by: Fabio Estevam fabio.este...@freescale.com --- Changes since v2: - Fix typo if not present 82 Changes since v1: - Add an entry into README README |3 ++- drivers/mtd/nand/mxc_nand.c | 37 +++-- 2 files changed, 5 insertions(+), 35 deletions(-) diff --git a/README b/README index bdd2c81..1a6a7a5 100644 --- a/README +++ b/README @@ -3717,8 +3717,9 @@ Low Level (hardware related) configuration options: Defined to tell the NAND controller that the NAND chip is using a 16 bit bus. Not all NAND drivers use this symbol. - Example of driver that uses it: + Example of drivers that use it: - drivers/mtd/nand/ndfc.c + - drivers/mtd/nand/mxc_nand.c - CONFIG_SYS_NDFC_EBC0_CFG Sets the EBC0_CFG register for the NDFC. If not defined diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index d0ded48..bb475f2 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c @@ -98,45 +98,14 @@ static struct nand_ecclayout nand_hw_eccoob2k = { #endif #endif -#ifdef CONFIG_MX27 static int is_16bit_nand(void) { - struct system_control_regs *sc_regs = - (struct system_control_regs *)IMX_SYSTEM_CTL_BASE; - - if (readl(sc_regs-fmcr) NF_16BIT_SEL) - return 1; - else - return 0; -} -#elif defined(CONFIG_MX31) -static int is_16bit_nand(void) -{ - struct clock_control_regs *sc_regs = - (struct clock_control_regs *)CCM_BASE; - - if (readl(sc_regs-rcsr) CCM_RCSR_NF16B) - return 1; - else - return 0; -} -#elif defined(CONFIG_MX25) || defined(CONFIG_MX35) -static int is_16bit_nand(void) -{ - struct ccm_regs *ccm = (struct ccm_regs *)IMX_CCM_BASE; - - if (readl(ccm-rcsr) CCM_RCSR_NF_16BIT_SEL) - return 1; - else - return 0; -} +#if defined(CONFIG_SYS_NAND_BUSWIDTH_16BIT) + return 1; #else -#warning 8/16 bit NAND autodetection not supported -static int is_16bit_nand(void) -{ return 0; -} #endif +} static uint32_t *mxc_nand_memcpy32(uint32_t *dest, uint32_t *source, size_t size) { -- 1.7.9.5 For this series: Reviewed-by: Benoît Thébaudeau benoit.thebaud...@advansee.com I will integrate it as is at the beginning of the v8 of my series as planned, unless it is applied before. I hope to post my v8 before the end of the week. 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 3/3] ARM: mx6: use common CPU errata config options
On Tue, Feb 26, 2013 at 7:28 PM, Stephen Warren swar...@wwwdotorg.org wrote: From: Stephen Warren swar...@nvidia.com Now that U-Boot has common CONFIG_ options to work around some ARM CPU errata, enable the relevant options on MX6, and remove the custom lowlevel_init.S, since it's just duplicated code now. Signed-off-by: Stephen Warren swar...@nvidia.com Looks good, thanks. Reviewed-by: Fabio Estevam fabio.este...@freescale.com ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] nand/fsl_elbc: detect page size at runtime
This avoids needing a separate U-Boot config when some revisions of a board have small-page NAND and other revisions have large-page NAND (except for NAND SPL targets). CONFIG_FSL_ELBC_FMR is removed -- it was never used nor documented, and it gets in the way of this change. Signed-off-by: Scott Wood scottw...@freescale.com --- drivers/mtd/nand/fsl_elbc_nand.c | 39 +- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c index 834a8a6..fb34d12 100644 --- a/drivers/mtd/nand/fsl_elbc_nand.c +++ b/drivers/mtd/nand/fsl_elbc_nand.c @@ -756,20 +756,8 @@ static int fsl_elbc_chip_init(int devnum, u8 *addr) nand-ecc.read_page = fsl_elbc_read_page; nand-ecc.write_page = fsl_elbc_write_page; -#ifdef CONFIG_FSL_ELBC_FMR - priv-fmr = CONFIG_FSL_ELBC_FMR; -#else priv-fmr = (15 FMR_CWTO_SHIFT) | (2 FMR_AL_SHIFT); - /* -* Hardware expects small page has ECCM0, large page has ECCM1 -* when booting from NAND. Board config can override if not -* booting from NAND. -*/ - if (or OR_FCM_PGS) - priv-fmr |= FMR_ECCM; -#endif - /* If CS Base Register selects full hardware ECC then use it */ if ((br BR_DECC) == BR_DECC_CHK_GEN) { nand-ecc.mode = NAND_ECC_HW; @@ -786,11 +774,26 @@ static int fsl_elbc_chip_init(int devnum, u8 *addr) nand-ecc.mode = NAND_ECC_SOFT; } + ret = nand_scan_ident(mtd, 1, NULL); + if (ret) + return ret; + /* Large-page-specific setup */ - if (or OR_FCM_PGS) { + if (mtd-writesize == 2048) { + setbits_be32(elbc_ctrl-regs-bank[priv-bank].or, +OR_FCM_PGS); + in_be32(elbc_ctrl-regs-bank[priv-bank].or); + priv-page_size = 1; nand-badblock_pattern = largepage_memorybased; + /* +* Hardware expects small page has ECCM0, large page has +* ECCM1 when booting from NAND, and we follow that even +* when not booting from NAND. +*/ + priv-fmr |= FMR_ECCM; + /* adjust ecc setup if needed */ if ((br BR_DECC) == BR_DECC_CHK_GEN) { nand-ecc.steps = 4; @@ -798,12 +801,14 @@ static int fsl_elbc_chip_init(int devnum, u8 *addr) fsl_elbc_oob_lp_eccm1 : fsl_elbc_oob_lp_eccm0; } + } else if (mtd-writesize == 512) { + clrbits_be32(elbc_ctrl-regs-bank[priv-bank].or, +OR_FCM_PGS); + in_be32(elbc_ctrl-regs-bank[priv-bank].or); + } else { + return -ENODEV; } - ret = nand_scan_ident(mtd, 1, NULL); - if (ret) - return ret; - ret = nand_scan_tail(mtd); if (ret) return ret; -- 1.7.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] nand: adjust erase/read/write partition/chip size for bad blocks
On 02/25/2013 11:43:48 PM, Harvey Chapman wrote: Adjust the sizes calculated for whole partition/chip operations by removing the size of bad blocks so we don't try to erase/read/write past a partition/chip boundary. Signed-off-by: Harvey Chapman hchap...@3gfp.com --- common/cmd_nand.c | 51 +++ 1 file changed, 51 insertions(+) Looks OK except for style issues: diff --git a/common/cmd_nand.c b/common/cmd_nand.c index 495610c..657ea23 100644 --- a/common/cmd_nand.c +++ b/common/cmd_nand.c @@ -428,6 +428,32 @@ static int raw_access(nand_info_t *nand, ulong addr, loff_t off, ulong count, return ret; } +static int adjust_size_for_badblocks(loff_t *size, loff_t offset, int dev) { Braces go on their own line for function definitions. + /* We grab the nand info object here fresh because this is usually + * called after arg_off_size() which can change the value of dev. +*/ /* * U-Boot multiline * brace style is like this */ ...in general, U-Boot follows Linux code style. + nand_info_t *nand = nand_info[dev]; + loff_t original_size = *size; + loff_t maxoffset = offset + *size; + int badblocks = 0; + + /* count badblocks in NAND from offset to offset + size */ + for (; offset maxoffset; offset += nand-erasesize) + if (nand_block_isbad(nand, offset)) { + badblocks++; + } Need braces around multi-line statements. + /* adjust size if any bad blocks found */ + if (badblocks) { + *size -= badblocks * nand-erasesize; + printf(size adjusted to 0x%llx (%d bad blocks)\n, + (unsigned long long)*size, badblocks); + } + /* return size adjusted as a positive value so callers +* can use the return code to determine if anything happened +*/ + return (original_size - *size); Unnecessary parens. Do we have any callers that care about the return code? If not, don't bother with it. This is an internal static function, not a public API. It's easy to change later if we need to. + /* The size for erase.part and erase.chip has been calculated + * for us as the remainder of the chip/partition from offset. +* Adjust down for bad blocks, if necessary, so we don't +* erase past the end of the chip/partition by accident. +*/ + if (adjust_size !scrub) { + adjust_size_for_badblocks(size, off, dev); + } + No braces around single-line if-bodies. nand = nand_info[dev]; memset(opts, 0, sizeof(opts)); @@ -644,6 +682,19 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) off, size) != 0) return 1; + /* If no size was given, it has been calculated for us as + * the remainder of the chip/partition from offset. Adjust + * down for bad blocks, if necessary, so we don't + * read/write past the end of the partition by accident. +* +* nand read addr part size size is arg 5 +*/ + if (argc 5) { +/* Don't try to use rwsize here, it's not the +* right type +*/ +adjust_size_for_badblocks(size, off, dev); + } No need to be quite so verbose in the comments. If someone tries to change size to rwsize the compiler will complain about the type mismatch. As for the other comment, the function name adjust_size_for_badblocks explains what's going on well enough IMHO. At most a single comment of /* size is unspecified */ to describe the if block. At least put the explanation on the adjust_size_for_badblocks() function rather than repeat it for read/write and erase. -Scott ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot