Re: [U-Boot] [PATCH v2 06/16] sf: Update sf to support all sizes of flashes
Hi Simon, On Sat, Jun 8, 2013 at 4:44 AM, Simon Glass s...@chromium.org wrote: Hi Jagan, On Fri, May 31, 2013 at 5:52 AM, Jagannadha Sutradharudu Teki jagannadha.sutradharudu-t...@xilinx.com wrote: Updated the spi_flash framework to handle all sizes of flashes using bank/extd addr reg facility The current implementation in spi_flash supports 3-byte address mode due to this up to 16Mbytes amount of flash is able to access for those flashes which has an actual size of 16MB. As most of the flashes introduces a bank/extd address registers for accessing the flashes in 16Mbytes of banks if the flash size is 16Mbytes, this new scheme will add the bank selection feature for performing write/erase operations on all flashes. Signed-off-by: Jagannadha Sutradharudu Teki jaga...@xilinx.com I have a few comments on this series, but it mostly looks fine. I think the new code is correct. The patches did not apply cleanly for me. Perhaps I am missing something. My tree looks like this after I did a bit of merging: Which patches you had an issues while applying,we have few patches on u-boot-spi.git i created these on top of it. 5864e87 (HEAD, try-spi) cfi_flash: Fix detection of 8-bit bus flash devices via address shift f700095 sf: Add Flag status register polling support 42f4b70 sf: Remove spi_flash_cmd_poll_bit() fc31387 sf: Use spi_flash_read_common() in write status poll 923e40e sf: spansion: Add support for S25FL512S_256K c72e52a sf: stmicro: Add support for N25Q1024A 4066f71 sf: stmicro: Add support for N25Q1024 0efaf86 sf: stmicro: Add support for N25Q512A 8fd962f sf: stmicro: Add support for N25Q512 f1a2080 sf: Use spi_flash_addr() in write call 31ed498 sf: Update sf read to support all sizes of flashes 0f77642 sf: Update sf to support all sizes of flashes 9e57220 sf: read flash bank addr register at probe time e99a43d sf: Add extended addr read support for winbond|stmicro 2f06d56 sf: Add extended addr write support for winbond|stmicro f02ecf1 sf: Add bank address register reading support 02ba27c sf: Add bank address register writing support Also do you think spi_flash_cmd_bankaddr_write() and related stuff should be behind a flag like CONFIG_SPI_BANK_ADDR or similar? How much code space does this add? Initially i thought of the same, but I just updated sf which is generic to all sizes of flashes. due to this i haven't included the bank read/write on macros, and the flash ops will call these bank write call irrespective of flash sizes. As flashes which has below 16Mbytes will have a bank_curr value 0 so-that even bank write will exit for bank 0 operations. + if (flash-bank_curr == bank_sel) { + debug(SF: not require to enable bank%d\n, bank_sel); + return 0; + } + And due to these framework changes bank+flash ops addition, bin size increases appr' ~600bytes by enabling stmicro, winbond and spansion flash drivers.(please check the size from your end also if required) Please see the commit body on below thread for more info http://patchwork.ozlabs.org/patch/247954/ In your change to spi_flash_cmd_poll_bit() the effect is not the same I think. It is designed to hold CS active and read the status byte continuously until it changes. But your implementation asserts CS, reads the status byte, de-asserts CS, then repeats. Why do we want to change this? I commented on the actual patch thread, please refer, --- Changes for v2: - none drivers/mtd/spi/spi_flash.c | 39 ++- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c index 4576a16..5386884 100644 --- a/drivers/mtd/spi/spi_flash.c +++ b/drivers/mtd/spi/spi_flash.c @@ -74,11 +74,9 @@ int spi_flash_cmd_write_multi(struct spi_flash *flash, u32 offset, unsigned long page_addr, byte_addr, page_size; size_t chunk_len, actual; int ret; - u8 cmd[4]; + u8 cmd[4], bank_sel; page_size = flash-page_size; - page_addr = offset / page_size; - byte_addr = offset % page_size; ret = spi_claim_bus(flash-spi); if (ret) { @@ -88,6 +86,16 @@ int spi_flash_cmd_write_multi(struct spi_flash *flash, u32 offset, cmd[0] = CMD_PAGE_PROGRAM; for (actual = 0; actual len; actual += chunk_len) { + bank_sel = offset / SPI_FLASH_16MB_BOUN; + + ret = spi_flash_cmd_bankaddr_write(flash, bank_sel); + if (ret) { + debug(SF: fail to set bank%d\n, bank_sel); + return ret; + } So we are now doing this for all chips. But isn't it true that only some chips (16MB?) have a bank address. If so, then I think we should have a flag somewhere to enable this feature APAMK, currently stmicro, winbond, spansion and macronix have a flashes which has 16Mbytes flashes. And
Re: [U-Boot] [PATCH v2 16/16] sf: Add Flag status register polling support
Hi Simon, Please let know your comments. I have changed the logic, but removed spi_flash_cmd_poll_bit() use poll code on spi_flash_cmd_wait_ready() as no other call for spi_flash_cmd_poll_bit() this. And also for read_status the check_status i assigned as 0,earlier it has direct 0 (w/o check_status variable). To add the support for flag status on the same code, i define this check_status. I don't see any coding functionality change for now, compared to before. -- Thanks, Jagan. On Fri, May 31, 2013 at 6:22 PM, Jagannadha Sutradharudu Teki jagannadha.sutradharudu-t...@xilinx.com wrote: Flag status register polling is required for micron 512Mb flash devices onwards, for performing erase/program operations. Like polling for WIP(Write-In-Progress) bit in read status register, spi_flash_cmd_wait_ready will poll for PEC(Program-Erase-Control) bit in flag status register. Signed-off-by: Jagannadha Sutradharudu Teki jaga...@xilinx.com --- Changes for v2: - none drivers/mtd/spi/spi_flash.c | 15 --- drivers/mtd/spi/spi_flash_internal.h | 3 +++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c index 527423d..8cd2988 100644 --- a/drivers/mtd/spi/spi_flash.c +++ b/drivers/mtd/spi/spi_flash.c @@ -195,25 +195,34 @@ int spi_flash_cmd_wait_ready(struct spi_flash *flash, unsigned long timeout) unsigned long timebase; int ret; u8 status; + u8 check_status = 0x0; u8 poll_bit = STATUS_WIP; u8 cmd = CMD_READ_STATUS; + if ((flash-idcode0 == 0x20) + (flash-size = SPI_FLASH_512MB_STMIC)) { + poll_bit = STATUS_PEC; + check_status = poll_bit; + cmd = CMD_FLAG_STATUS; + } + timebase = get_timer(0); do { WATCHDOG_RESET(); ret = spi_flash_read_common(flash, cmd, 1, status, 1); if (ret 0) { - debug(SF: fail to read read status register\n); + debug(SF: fail to read %s status register\n, + cmd == CMD_READ_STATUS ? read : flag); return ret; } - if ((status poll_bit) == 0) + if ((status poll_bit) == check_status) break; } while (get_timer(timebase) timeout); - if ((status poll_bit) == 0) + if ((status poll_bit) == check_status) return 0; /* Timed out */ diff --git a/drivers/mtd/spi/spi_flash_internal.h b/drivers/mtd/spi/spi_flash_internal.h index ac4530f..cb7a505 100644 --- a/drivers/mtd/spi/spi_flash_internal.h +++ b/drivers/mtd/spi/spi_flash_internal.h @@ -13,6 +13,7 @@ #define SPI_FLASH_SECTOR_ERASE_TIMEOUT (10 * CONFIG_SYS_HZ) #define SPI_FLASH_16MB_BOUN0x100 +#define SPI_FLASH_512MB_STMIC 0x400 /* Common commands */ #define CMD_READ_ID0x9f @@ -24,6 +25,7 @@ #define CMD_PAGE_PROGRAM 0x02 #define CMD_WRITE_DISABLE 0x04 #define CMD_READ_STATUS0x05 +#define CMD_FLAG_STATUS0x70 #define CMD_WRITE_ENABLE 0x06 #define CMD_ERASE_4K 0x20 #define CMD_ERASE_32K 0x52 @@ -38,6 +40,7 @@ /* Common status */ #define STATUS_WIP 0x01 +#define STATUS_PEC 0x80 /* Send a single-byte command to the device and read the response */ int spi_flash_cmd(struct spi_slave *spi, u8 cmd, void *response, size_t len); -- 1.8.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] cfi_flash: Fix detection of 8-bit bus flash devices via address shift
Hi Wolfgang, On 06/07/2013 03:02 PM, Jagannadha Sutradharudu Teki wrote: We had a problem detecting 8/16bit flash devices connected only via 8bits to the SoC for quite a while. Commit 239cb9d9 [mtd: cfi_flash: Fix CFI flash driver for 8-bit bus support] finally fixed this 8-bit bus support. But also broke some other boards using this cfi driver. So this patch had to be reverted. I spotted a different, simpler approach for this 8-bit bus support on the barebox mailing list posted by Oleksij Rempel bug-tr...@fisher-privat.net: http://www.spinics.net/lists/u-boot-v2/msg14687.html Here the commit text: Many cfi chips support 16 and 8 bit modes. Most important difference is use of so called Q15/A-1 pin. In 16bit mode this pin is used for data IO. In 8bit mode, it is an address input which add one more least significant bit (LSB). In this case we should shift all adresses by one: For example 0xaa 1 = 0x154 This patch now is a port of this barebox patch to U-Boot. Along with the change w.r.t from barebox, Some flash chips can support multiple bus widths, override the interface width and limit it to the port width. Tested on 16-bit Spansion flash on sequoia. Tested 8-bit flashes like 256M29EW, 512M29EW. Signed-off-by: Stefan Roese s...@denx.de Tested-by: Jagannadha Sutradharudu Teki jaga...@xilinx.com Wolfgang, you remember that s few weeks ago a similar CFI patch resulted in breaking flash support for one TQ board. Which one was that? Could you please either test this patch on this board or let me know which board this was? Then I'll do the testing next week. Thanks, Stefan -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: off...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] MIPS FLASH mapping
Hello, I have been working for a while trying to port U-Boot over to a MIPS AR7161 SoC chip. The actual product is a Buffalo WZR-HP-AG300H router. I have been making quite a bit of successful progress, bu the two FLASH chip archetecture is throwing me off a little. There are two FLASH chips, 16MiB W25Q128BV. The first FLASH chip is where U-Boot resides and is mapped to 0xBF00 to 0xBFFF. The second FLASH chip is suppsed to map to 0xBE00 to 0xBEFF. I have been successful in modifying the driver (with a few glitches that I am still fixing) to support the second chip. Since the FLASH is SPI based, the first or second chip is selected with a CS line, which I added support for in the driver. The two chips are detected properly at startup, and the size is correct, however, the mapping (KSEG1?) is mapping only the first chip, and I have been looking for how to get the second chip mapped. I think it has to do with the lowlevel init functions, but am difficulty understanding where the FLASH is mapped. I am fairly sure I have the low level setup correct, PLL, DDR, etc, which took a little work since I can't locate any techinical manuals for this chip, I had to go off reverse engineering the registers based on other ar71xx based boards. The original bootloader maps these correctly, and in openocd I can read data from the second FLASH chip. However, when I run the new bootloader I am working on the addresses are not mapped correctly for the second FLASH chip, even in openocd. Any assistance would be appreciated. When I get something working a little better I would like to contribute the results. Allan ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PULL] : Please pull u-boot-imx
Hi Stefano, On Thu, 06 Jun 2013 17:55:33 +0200, Stefano Babic sba...@denx.de wrote: Hi Albert, please pull from u-boot-imx, thanks. The following changes since commit cac423a730d3506154744485af1bbc1cd3a1e6a8: Merge branch 'u-boot-ti/master' into 'u-boot-arm/master' (2013-05-11 22:24:28 +0200) are available in the git repository at: git://www.denx.de/git/u-boot-imx.git master for you to fetch changes up to 4a1c7b13ae104d4526d3176793b7f6b06694df15: vf610twr: Drop unneeded 'status' variable (2013-06-06 17:52:08 +0200) Alison Wang (7): arm: vf610: Add IOMUX support for Vybrid VF610 arm: vf610: Add Vybrid VF610 CPU support net: fec_mxc: Add support for Vybrid VF610 arm: vf610: Add watchdog support for Vybrid VF610 arm: vf610: Add uart support for Vybrid VF610 arm: vf610: Add Vybrid VF610 to mxc_ocotp document arm: vf610: Add basic support for Vybrid VF610TWR board Andrew Gabbasov (1): mx6: mx6qsabrelite/nitrogen6x: Remove incorrect setting of gpio CS signal Benoît Thébaudeau (1): imx: spl: Merge libimx-common make rules Fabio Estevam (7): mx28evk: Add splash screen support mx23evk: Add splash screen support video: mxsfb: Add an entry for mx23evk/mx28vk video modes mx6slevk: Allow booting a device tree kernel wandboard: Enable HDMI splashscreen ARM: imx: Fix incorrect usage of CONFIG_SYS_MMC_ENV_PART vf610twr: Drop unneeded 'status' variable Luka Perkov (1): wandboard: fix typo in README Marek Vasut (1): arm: mxs: Fix vectoring table crafting Otavio Salvador (2): build: Use generic boot logo matching wandboard: Add Boot Splash image with Wandboard logo Renato Frias (2): mx6qsabreauto: Add i2c to mx6qsabreauto board mx6qsabreauto: Add Port Expander reset SARTRE Leo (1): Add support for Congatec Conga-QEVAl board MAINTAINERS |8 + Makefile |2 +- arch/arm/cpu/arm926ejs/mxs/mxs.c | 25 +- arch/arm/cpu/armv7/vf610/Makefile | 42 +++ arch/arm/cpu/armv7/vf610/generic.c| 324 +++ arch/arm/cpu/armv7/vf610/timer.c | 103 ++ arch/arm/imx-common/Makefile |2 +- arch/arm/imx-common/iomux-v3.c|6 + arch/arm/include/asm/arch-vf610/clock.h | 39 +++ arch/arm/include/asm/arch-vf610/crm_regs.h| 225 + arch/arm/include/asm/arch-vf610/imx-regs.h| 419 + arch/arm/include/asm/arch-vf610/iomux-vf610.h | 101 ++ arch/arm/include/asm/imx-common/iomux-v3.h| 18 ++ board/boundary/nitrogen6x/nitrogen6x.c|1 - board/congatec/cgtqmx6eval/Makefile | 42 +++ board/congatec/cgtqmx6eval/README | 29 ++ board/congatec/cgtqmx6eval/cgtqmx6eval.c | 167 ++ board/freescale/mx23evk/mx23evk.c |6 + board/freescale/mx23evk/spl_boot.c| 32 ++ board/freescale/mx28evk/iomux.c | 33 ++ board/freescale/mx28evk/mx28evk.c |6 + board/freescale/mx6qsabreauto/mx6qsabreauto.c | 57 board/freescale/mx6qsabrelite/mx6qsabrelite.c |1 - board/freescale/vf610twr/Makefile | 39 +++ board/freescale/vf610twr/imximage.cfg | 33 ++ board/freescale/vf610twr/vf610twr.c | 407 board/wandboard/README|4 +- board/wandboard/wandboard.c | 98 ++ boards.cfg|2 + doc/README.mxc_ocotp |1 + doc/README.vf610 | 10 + drivers/net/fec_mxc.c |4 +- drivers/serial/Makefile |1 + drivers/serial/serial_lpuart.c| 132 drivers/video/mxsfb.c |5 + drivers/watchdog/Makefile |2 +- include/configs/cgtqmx6eval.h | 194 include/configs/mx23evk.h | 17 + include/configs/mx28evk.h | 17 + include/configs/mx53ard.h |3 +- include/configs/mx6qsabre_common.h|2 +- include/configs/mx6qsabreauto.h |7 +- include/configs/mx6qsabresd.h |1 - include/configs/mx6slevk.h|2 +- include/configs/vf610twr.h| 140 + include/configs/wandboard.h | 20 +- spl/Makefile |6 +- tools/Makefile| 27 +- tools/logos/wandboard.bmp | Bin 0 - 22390 bytes 49
Re: [U-Boot] [PATCH v2 16/16] sf: Add Flag status register polling support
Hi Jagan, On Sat, Jun 8, 2013 at 1:32 AM, Jagan Teki jagannadh.t...@gmail.com wrote: Hi Simon, Please let know your comments. I have changed the logic, but removed spi_flash_cmd_poll_bit() use poll code on spi_flash_cmd_wait_ready() as no other call for spi_flash_cmd_poll_bit() this. And also for read_status the check_status i assigned as 0,earlier it has direct 0 (w/o check_status variable). To add the support for flag status on the same code, i define this check_status. I don't see any coding functionality change for now, compared to before. This is not the right patch, but in one of them you remove spi_flash_cmd_poll_bit(), so that it no longer works the same way. You will get lots of individual SPI transactions on the bus instead of a single one that reads the status byte continuously. Do we need to change this? Regards, Simon -- Thanks, Jagan. On Fri, May 31, 2013 at 6:22 PM, Jagannadha Sutradharudu Teki jagannadha.sutradharudu-t...@xilinx.com wrote: Flag status register polling is required for micron 512Mb flash devices onwards, for performing erase/program operations. Like polling for WIP(Write-In-Progress) bit in read status register, spi_flash_cmd_wait_ready will poll for PEC(Program-Erase-Control) bit in flag status register. Signed-off-by: Jagannadha Sutradharudu Teki jaga...@xilinx.com --- Changes for v2: - none drivers/mtd/spi/spi_flash.c | 15 --- drivers/mtd/spi/spi_flash_internal.h | 3 +++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c index 527423d..8cd2988 100644 --- a/drivers/mtd/spi/spi_flash.c +++ b/drivers/mtd/spi/spi_flash.c @@ -195,25 +195,34 @@ int spi_flash_cmd_wait_ready(struct spi_flash *flash, unsigned long timeout) unsigned long timebase; int ret; u8 status; + u8 check_status = 0x0; u8 poll_bit = STATUS_WIP; u8 cmd = CMD_READ_STATUS; + if ((flash-idcode0 == 0x20) + (flash-size = SPI_FLASH_512MB_STMIC)) { + poll_bit = STATUS_PEC; + check_status = poll_bit; + cmd = CMD_FLAG_STATUS; + } + timebase = get_timer(0); do { WATCHDOG_RESET(); ret = spi_flash_read_common(flash, cmd, 1, status, 1); if (ret 0) { - debug(SF: fail to read read status register\n); + debug(SF: fail to read %s status register\n, + cmd == CMD_READ_STATUS ? read : flag); return ret; } - if ((status poll_bit) == 0) + if ((status poll_bit) == check_status) break; } while (get_timer(timebase) timeout); - if ((status poll_bit) == 0) + if ((status poll_bit) == check_status) return 0; /* Timed out */ diff --git a/drivers/mtd/spi/spi_flash_internal.h b/drivers/mtd/spi/spi_flash_internal.h index ac4530f..cb7a505 100644 --- a/drivers/mtd/spi/spi_flash_internal.h +++ b/drivers/mtd/spi/spi_flash_internal.h @@ -13,6 +13,7 @@ #define SPI_FLASH_SECTOR_ERASE_TIMEOUT (10 * CONFIG_SYS_HZ) #define SPI_FLASH_16MB_BOUN0x100 +#define SPI_FLASH_512MB_STMIC 0x400 /* Common commands */ #define CMD_READ_ID0x9f @@ -24,6 +25,7 @@ #define CMD_PAGE_PROGRAM 0x02 #define CMD_WRITE_DISABLE 0x04 #define CMD_READ_STATUS0x05 +#define CMD_FLAG_STATUS0x70 #define CMD_WRITE_ENABLE 0x06 #define CMD_ERASE_4K 0x20 #define CMD_ERASE_32K 0x52 @@ -38,6 +40,7 @@ /* Common status */ #define STATUS_WIP 0x01 +#define STATUS_PEC 0x80 /* Send a single-byte command to the device and read the response */ int spi_flash_cmd(struct spi_slave *spi, u8 cmd, void *response, size_t len); -- 1.8.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 06/16] sf: Update sf to support all sizes of flashes
Hi, On Sat, Jun 8, 2013 at 1:22 AM, Jagan Teki jagannadh.t...@gmail.com wrote: Hi Simon, On Sat, Jun 8, 2013 at 4:44 AM, Simon Glass s...@chromium.org wrote: Hi Jagan, On Fri, May 31, 2013 at 5:52 AM, Jagannadha Sutradharudu Teki jagannadha.sutradharudu-t...@xilinx.com wrote: Updated the spi_flash framework to handle all sizes of flashes using bank/extd addr reg facility The current implementation in spi_flash supports 3-byte address mode due to this up to 16Mbytes amount of flash is able to access for those flashes which has an actual size of 16MB. As most of the flashes introduces a bank/extd address registers for accessing the flashes in 16Mbytes of banks if the flash size is 16Mbytes, this new scheme will add the bank selection feature for performing write/erase operations on all flashes. Signed-off-by: Jagannadha Sutradharudu Teki jaga...@xilinx.com I have a few comments on this series, but it mostly looks fine. I think the new code is correct. The patches did not apply cleanly for me. Perhaps I am missing something. My tree looks like this after I did a bit of merging: Which patches you had an issues while applying,we have few patches on u-boot-spi.git i created these on top of it. I am not sure now - sorry I did not keep a record. But the bundle I used is here, and it doesn't apply cleanly. http://patchwork.ozlabs.org/bundle/sjg/jagan/ git am ~/Downloads/bundle-4407-jagan.mbox Applying: sf: Add bank address register writing support Applying: sf: Add bank address register reading support Applying: sf: Add extended addr write support for winbond|stmicro Applying: sf: Add extended addr read support for winbond|stmicro Applying: sf: read flash bank addr register at probe time Applying: sf: Update sf to support all sizes of flashes error: patch failed: drivers/mtd/spi/spi_flash.c:117 error: drivers/mtd/spi/spi_flash.c: patch does not apply Patch failed at 0006 sf: Update sf to support all sizes of flashes The copy of the patch that failed is found in: /home/sjg/u/.git/rebase-apply/patch When you have resolved this problem, run git am --resolved. If you prefer to skip this patch, run git am --skip instead. To restore the original branch and stop patching, run git am --abort 5864e87 (HEAD, try-spi) cfi_flash: Fix detection of 8-bit bus flash devices via address shift f700095 sf: Add Flag status register polling support 42f4b70 sf: Remove spi_flash_cmd_poll_bit() fc31387 sf: Use spi_flash_read_common() in write status poll 923e40e sf: spansion: Add support for S25FL512S_256K c72e52a sf: stmicro: Add support for N25Q1024A 4066f71 sf: stmicro: Add support for N25Q1024 0efaf86 sf: stmicro: Add support for N25Q512A 8fd962f sf: stmicro: Add support for N25Q512 f1a2080 sf: Use spi_flash_addr() in write call 31ed498 sf: Update sf read to support all sizes of flashes 0f77642 sf: Update sf to support all sizes of flashes 9e57220 sf: read flash bank addr register at probe time e99a43d sf: Add extended addr read support for winbond|stmicro 2f06d56 sf: Add extended addr write support for winbond|stmicro f02ecf1 sf: Add bank address register reading support 02ba27c sf: Add bank address register writing support Also do you think spi_flash_cmd_bankaddr_write() and related stuff should be behind a flag like CONFIG_SPI_BANK_ADDR or similar? How much code space does this add? Initially i thought of the same, but I just updated sf which is generic to all sizes of flashes. due to this i haven't included the bank read/write on macros, and the flash ops will call these bank write call irrespective of flash sizes. As flashes which has below 16Mbytes will have a bank_curr value 0 so-that even bank write will exit for bank 0 operations. Yes this is fine. + if (flash-bank_curr == bank_sel) { + debug(SF: not require to enable bank%d\n, bank_sel); + return 0; + } + And due to these framework changes bank+flash ops addition, bin size increases appr' ~600bytes by enabling stmicro, winbond and spansion flash drivers.(please check the size from your end also if required) I suggest you make that function a nop (perhaps using an #ifdef CONFIG_SPI_BANK_ADDR inside it or some other name) so that your patches don't increase U-Boot code size for those boards that don't need support larger devices (which I guess is almost all of them, right now). U-Boot is quite concerned about code size. Tom may chime in and decide it is fine, though. Please see the commit body on below thread for more info http://patchwork.ozlabs.org/patch/247954/ In your change to spi_flash_cmd_poll_bit() the effect is not the same I think. It is designed to hold CS active and read the status byte continuously until it changes. But your implementation asserts CS, reads the status byte, de-asserts CS, then repeats. Why do we want to change this? I commented on the actual
Re: [U-Boot] [PATCH v2 14/16] sf: Use spi_flash_read_common() in write status poll
Hi Jagan, On Fri, May 31, 2013 at 5:52 AM, Jagannadha Sutradharudu Teki jagannadha.sutradharudu-t...@xilinx.com wrote: Instead of using spi_xfer for SPI_XFER_BEGIN and SPI_XFER_END separatley use common read call spi_flash_read_common() which does the same. Signed-off-by: Jagannadha Sutradharudu Teki jaga...@xilinx.com --- Changes for v2: - none drivers/mtd/spi/spi_flash.c | 17 + 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c index 821aa2e..765d4bc 100644 --- a/drivers/mtd/spi/spi_flash.c +++ b/drivers/mtd/spi/spi_flash.c @@ -193,32 +193,25 @@ int spi_flash_cmd_read_fast(struct spi_flash *flash, u32 offset, int spi_flash_cmd_poll_bit(struct spi_flash *flash, unsigned long timeout, u8 cmd, u8 poll_bit) { - struct spi_slave *spi = flash-spi; unsigned long timebase; int ret; u8 status; - ret = spi_xfer(spi, 8, cmd, NULL, SPI_XFER_BEGIN); - if (ret) { - debug(SF: Failed to send command %02x: %d\n, cmd, ret); - return ret; - } - timebase = get_timer(0); do { WATCHDOG_RESET(); - ret = spi_xfer(spi, 8, NULL, status, 0); - if (ret) - return -1; + ret = spi_flash_read_common(flash, cmd, 1, status, 1); + if (ret 0) { + debug(SF: fail to read read status register\n); + return ret; + } As mentioned elsewhere, do you need to make this change? Is it not possible to read the status register in the same way as now? spi_flash_read_common() does a separate SPI transaction for each read. if ((status poll_bit) == 0) break; } while (get_timer(timebase) timeout); - spi_xfer(spi, 0, NULL, NULL, SPI_XFER_END); - if ((status poll_bit) == 0) return 0; -- 1.8.3 Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 16/16] sf: Add Flag status register polling support
Hi Simon, On Sat, Jun 8, 2013 at 8:02 PM, Simon Glass s...@chromium.org wrote: Hi Jagan, On Sat, Jun 8, 2013 at 1:32 AM, Jagan Teki jagannadh.t...@gmail.com wrote: Hi Simon, Please let know your comments. I have changed the logic, but removed spi_flash_cmd_poll_bit() use poll code on spi_flash_cmd_wait_ready() as no other call for spi_flash_cmd_poll_bit() this. And also for read_status the check_status i assigned as 0,earlier it has direct 0 (w/o check_status variable). To add the support for flag status on the same code, i define this check_status. I don't see any coding functionality change for now, compared to before. This is not the right patch, but in one of them you remove spi_flash_cmd_poll_bit(), so that it no longer works the same way. You will get lots of individual SPI transactions on the bus instead of a single one that reads the status byte continuously. I couldn't understand you clearly. Earlier all erase/write they were calling spi_flash_cmd_wait_ready with flash, timeout values. spi_flash_cmd_wait_ready() is intern call to spi_flash_cmd_poll_bit() with CMD_READ_STATUS and STATUS_WIP. In my changes I have removed spi_flash_cmd_poll_bit() as there is no other caller except spi_flash_cmd_wait_ready() so all polling stuff on spi_flash_cmd_wait_ready() means, still erase/program can call spi_flash_cmd_wait_ready() with flash, timeout and CMD_READ_STATUS and STAUS_WIP were use directly used on spi_flash_cmd_wait_ready() instead of passing through spi_flash_cmd_poll_bit(). Any wrong here, please comment. Thanks, Jagan. Do we need to change this? -- Thanks, Jagan. On Fri, May 31, 2013 at 6:22 PM, Jagannadha Sutradharudu Teki jagannadha.sutradharudu-t...@xilinx.com wrote: Flag status register polling is required for micron 512Mb flash devices onwards, for performing erase/program operations. Like polling for WIP(Write-In-Progress) bit in read status register, spi_flash_cmd_wait_ready will poll for PEC(Program-Erase-Control) bit in flag status register. Signed-off-by: Jagannadha Sutradharudu Teki jaga...@xilinx.com --- Changes for v2: - none drivers/mtd/spi/spi_flash.c | 15 --- drivers/mtd/spi/spi_flash_internal.h | 3 +++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c index 527423d..8cd2988 100644 --- a/drivers/mtd/spi/spi_flash.c +++ b/drivers/mtd/spi/spi_flash.c @@ -195,25 +195,34 @@ int spi_flash_cmd_wait_ready(struct spi_flash *flash, unsigned long timeout) unsigned long timebase; int ret; u8 status; + u8 check_status = 0x0; u8 poll_bit = STATUS_WIP; u8 cmd = CMD_READ_STATUS; + if ((flash-idcode0 == 0x20) + (flash-size = SPI_FLASH_512MB_STMIC)) { + poll_bit = STATUS_PEC; + check_status = poll_bit; + cmd = CMD_FLAG_STATUS; + } + timebase = get_timer(0); do { WATCHDOG_RESET(); ret = spi_flash_read_common(flash, cmd, 1, status, 1); if (ret 0) { - debug(SF: fail to read read status register\n); + debug(SF: fail to read %s status register\n, + cmd == CMD_READ_STATUS ? read : flag); return ret; } - if ((status poll_bit) == 0) + if ((status poll_bit) == check_status) break; } while (get_timer(timebase) timeout); - if ((status poll_bit) == 0) + if ((status poll_bit) == check_status) return 0; /* Timed out */ diff --git a/drivers/mtd/spi/spi_flash_internal.h b/drivers/mtd/spi/spi_flash_internal.h index ac4530f..cb7a505 100644 --- a/drivers/mtd/spi/spi_flash_internal.h +++ b/drivers/mtd/spi/spi_flash_internal.h @@ -13,6 +13,7 @@ #define SPI_FLASH_SECTOR_ERASE_TIMEOUT (10 * CONFIG_SYS_HZ) #define SPI_FLASH_16MB_BOUN0x100 +#define SPI_FLASH_512MB_STMIC 0x400 /* Common commands */ #define CMD_READ_ID0x9f @@ -24,6 +25,7 @@ #define CMD_PAGE_PROGRAM 0x02 #define CMD_WRITE_DISABLE 0x04 #define CMD_READ_STATUS0x05 +#define CMD_FLAG_STATUS0x70 #define CMD_WRITE_ENABLE 0x06 #define CMD_ERASE_4K 0x20 #define CMD_ERASE_32K 0x52 @@ -38,6 +40,7 @@ /* Common status */ #define STATUS_WIP 0x01 +#define STATUS_PEC 0x80 /* Send a single-byte command to the device and read the response */ int spi_flash_cmd(struct spi_slave *spi, u8 cmd, void *response, size_t len); -- 1.8.3
Re: [U-Boot] [PATCH v2 06/16] sf: Update sf to support all sizes of flashes
Hi Simon, On Sat, Jun 8, 2013 at 8:11 PM, Simon Glass s...@chromium.org wrote: Hi, On Sat, Jun 8, 2013 at 1:22 AM, Jagan Teki jagannadh.t...@gmail.com wrote: Hi Simon, On Sat, Jun 8, 2013 at 4:44 AM, Simon Glass s...@chromium.org wrote: Hi Jagan, On Fri, May 31, 2013 at 5:52 AM, Jagannadha Sutradharudu Teki jagannadha.sutradharudu-t...@xilinx.com wrote: Updated the spi_flash framework to handle all sizes of flashes using bank/extd addr reg facility The current implementation in spi_flash supports 3-byte address mode due to this up to 16Mbytes amount of flash is able to access for those flashes which has an actual size of 16MB. As most of the flashes introduces a bank/extd address registers for accessing the flashes in 16Mbytes of banks if the flash size is 16Mbytes, this new scheme will add the bank selection feature for performing write/erase operations on all flashes. Signed-off-by: Jagannadha Sutradharudu Teki jaga...@xilinx.com I have a few comments on this series, but it mostly looks fine. I think the new code is correct. The patches did not apply cleanly for me. Perhaps I am missing something. My tree looks like this after I did a bit of merging: Which patches you had an issues while applying,we have few patches on u-boot-spi.git i created these on top of it. I am not sure now - sorry I did not keep a record. But the bundle I used is here, and it doesn't apply cleanly. http://patchwork.ozlabs.org/bundle/sjg/jagan/ git am ~/Downloads/bundle-4407-jagan.mbox Applying: sf: Add bank address register writing support Applying: sf: Add bank address register reading support Applying: sf: Add extended addr write support for winbond|stmicro Applying: sf: Add extended addr read support for winbond|stmicro Applying: sf: read flash bank addr register at probe time Applying: sf: Update sf to support all sizes of flashes error: patch failed: drivers/mtd/spi/spi_flash.c:117 error: drivers/mtd/spi/spi_flash.c: patch does not apply Patch failed at 0006 sf: Update sf to support all sizes of flashes The copy of the patch that failed is found in: /home/sjg/u/.git/rebase-apply/patch When you have resolved this problem, run git am --resolved. If you prefer to skip this patch, run git am --skip instead. To restore the original branch and stop patching, run git am --abort 5864e87 (HEAD, try-spi) cfi_flash: Fix detection of 8-bit bus flash devices via address shift f700095 sf: Add Flag status register polling support 42f4b70 sf: Remove spi_flash_cmd_poll_bit() fc31387 sf: Use spi_flash_read_common() in write status poll 923e40e sf: spansion: Add support for S25FL512S_256K c72e52a sf: stmicro: Add support for N25Q1024A 4066f71 sf: stmicro: Add support for N25Q1024 0efaf86 sf: stmicro: Add support for N25Q512A 8fd962f sf: stmicro: Add support for N25Q512 f1a2080 sf: Use spi_flash_addr() in write call 31ed498 sf: Update sf read to support all sizes of flashes 0f77642 sf: Update sf to support all sizes of flashes 9e57220 sf: read flash bank addr register at probe time e99a43d sf: Add extended addr read support for winbond|stmicro 2f06d56 sf: Add extended addr write support for winbond|stmicro f02ecf1 sf: Add bank address register reading support 02ba27c sf: Add bank address register writing support Also do you think spi_flash_cmd_bankaddr_write() and related stuff should be behind a flag like CONFIG_SPI_BANK_ADDR or similar? How much code space does this add? Initially i thought of the same, but I just updated sf which is generic to all sizes of flashes. due to this i haven't included the bank read/write on macros, and the flash ops will call these bank write call irrespective of flash sizes. As flashes which has below 16Mbytes will have a bank_curr value 0 so-that even bank write will exit for bank 0 operations. Yes this is fine. + if (flash-bank_curr == bank_sel) { + debug(SF: not require to enable bank%d\n, bank_sel); + return 0; + } + And due to these framework changes bank+flash ops addition, bin size increases appr' ~600bytes by enabling stmicro, winbond and spansion flash drivers.(please check the size from your end also if required) I suggest you make that function a nop (perhaps using an #ifdef CONFIG_SPI_BANK_ADDR inside it or some other name) so that your patches don't increase U-Boot code size for those boards that don't need support larger devices (which I guess is almost all of them, right now). U-Boot is quite concerned about code size. Little concern here, the point here I stated is this new changes is common for all sizes of flashes.(which are less or greater than 16Mbytes). and yes it increase the code size little bit but i don't think it will require the separate macro. Thanks, Jagan. Tom may chime in and decide it is fine, though. Please see the commit body on below thread for more
Re: [U-Boot] [PATCH] cmd_bootm: Add command line arguments to Plan 9
On Thu, Jun 6, 2013 at 4:41 PM, Steven Stallion sstall...@gmail.com wrote: This patch introduces support for command line arguments to Plan 9. Plan 9 generally dedicates a small region of kernel memory (known as CONFADDR) for runtime configuration. A new environment variable named confaddr was introduced to indicate this location when copying arguments. Apologies for the double post - it looks like the message had been sitting in an mqueue waiting to resend. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] cmd_bootm: Add command line arguments to Plan 9
This patch introduces support for command line arguments to Plan 9. Plan 9 generally dedicates a small region of kernel memory (known as CONFADDR) for runtime configuration. A new environment variable named confaddr was introduced to indicate this location when copying arguments. Signed-off-by: Steven Stallion sstall...@gmail.com --- common/cmd_bootm.c | 19 +++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 05130b6..5c62271 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -1533,6 +1533,7 @@ static int do_bootm_plan9(int flag, int argc, char * const argv[], bootm_headers_t *images) { void (*entry_point)(void); + char *s; if ((flag != 0) (flag != BOOTM_STATE_OS_GO)) return 1; @@ -1544,6 +1545,24 @@ static int do_bootm_plan9(int flag, int argc, char * const argv[], } #endif + if ((s = getenv(confaddr)) != NULL) { + char *confaddr = (char *)simple_strtoul(s, NULL, 16); + + if (argc 2) { + int i; + + s = confaddr; + for (i = 2; i argc; i++) { + if (i 2) + *s++ = '\n'; + strcpy(s, argv[i]); + s += strlen(argv[i]); + } + } else if ((s = getenv(bootargs)) != NULL) { + strcpy(confaddr, s); + } + } + entry_point = (void (*)(void))images-ep; printf(## Transferring control to Plan 9 (at address %08lx) ...\n, -- 1.7.0.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] Please pull u-boot-ti/master
Hi Tom, Michael, Hello, The following changes since commit 3da0e5750b24a9491058df6126c7be577a276c09: arm: factorize relocate_code routine (2013-05-30 20:24:38 +0200) are available in the git repository at: git://git.denx.de/u-boot-ti.git master for you to fetch changes up to 80dd596d1b442ff53dbeb33eccdb8efd2283be79: [snip] Michael Trimarchi (1): usb: omap: ulpi: fix ulpi transceiver access [snip] drivers/usb/ulpi/omap-ulpi-viewport.c | 40 +- [snip] I just made a clean clone of u-boot-ti/master, manually applied the changes to the ehci files, added my board files and made a build. Everything seems to work fine, but I see an error message regarding ULPI reset that was not present before, and obviously it is due to Michael's changes: SOM5_EVB # usb start (Re)start USB... USB0: ULPI: ulpi_reset: failed writing reset bit USB EHCI 1.00 scanning bus 0 for devices... 6 USB Device(s) found scanning usb for storage devices... 3 Storage Device(s) found scanning usb for ethernet devices... 1 Ethernet Device(s) found SOM5_EVB # usb tree USB device tree: 1 Hub (480 Mb/s, 0mA) | u-boot EHCI Host Controller | +-2 Mass Storage (480 Mb/s, 200mA) |FSC MEMORYBIRD USB2 C157040817120315AA | +-3 Hub (480 Mb/s, 2mA) | | | +-4 Mass Storage (480 Mb/s, 96mA) | |Generic Ultra Fast Media Reader 00264001 | | | +-5 Mass Storage (480 Mb/s, 100mA) | USB Flash Drive 531C43B21928F11F | +-6 Vendor specific (480 Mb/s, 500mA) SOM5_EVB # Otherwise everything is OK, the device on the ULPI port is working (it is #2 above). It is now late and I shall investigate in detail tomorrow, this is just an early warning ;) Best regards, Lubo ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] mtd: nand: fix initialization of BBT options
commit dfe64e2c89731a3f9950d7acd8681b68df2bae03 Author: Sergey Lapin sla...@ossfans.org Date: Mon Jan 14 03:46:50 2013 + mtd: resync with Linux-3.7.1 changed the initialization of BBT options. Fix drivers jz4740 and s3c2410 which have not been updated yet and cause compile errors. Signed-off-by: Daniel Schwierzeck daniel.schwierz...@gmail.com --- Patch is compile tested on boards smdk2410 and qi_lb60 --- drivers/mtd/nand/jz4740_nand.c | 2 +- drivers/mtd/nand/s3c2410_nand.c | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/nand/jz4740_nand.c b/drivers/mtd/nand/jz4740_nand.c index a691fbc..9421e56 100644 --- a/drivers/mtd/nand/jz4740_nand.c +++ b/drivers/mtd/nand/jz4740_nand.c @@ -256,7 +256,7 @@ int board_nand_init(struct nand_chip *nand) nand-ecc.strength = 4; nand-ecc.layout= qi_lb60_ecclayout_2gb; nand-chip_delay= 50; - nand-options = NAND_USE_FLASH_BBT; + nand-bbt_options |= NAND_BBT_USE_FLASH; return 0; } diff --git a/drivers/mtd/nand/s3c2410_nand.c b/drivers/mtd/nand/s3c2410_nand.c index 43d8213..1187b9f 100644 --- a/drivers/mtd/nand/s3c2410_nand.c +++ b/drivers/mtd/nand/s3c2410_nand.c @@ -179,9 +179,7 @@ int board_nand_init(struct nand_chip *nand) #endif #ifdef CONFIG_S3C2410_NAND_BBT - nand-options = NAND_USE_FLASH_BBT; -#else - nand-options = 0; + nand-bbt_options |= NAND_BBT_USE_FLASH; #endif debug(end of nand_init\n); -- 1.8.1.2 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] MIPS: asm/errno.h: switch to asm-generic/errno.h
This fixes several warnings like In file included from ./u-boot/include/linux/mtd/mtd.h:13:0, from env_onenand.c:37: ./u-boot/build/vct_platinumavc_onenand_small/include2/asm/errno.h:52:0: warning: ENOMSG redefined [enabled by default] Signed-off-by: Daniel Schwierzeck daniel.schwierz...@gmail.com --- arch/mips/include/asm/errno.h | 144 +- 1 file changed, 1 insertion(+), 143 deletions(-) diff --git a/arch/mips/include/asm/errno.h b/arch/mips/include/asm/errno.h index 1665a63..4c82b50 100644 --- a/arch/mips/include/asm/errno.h +++ b/arch/mips/include/asm/errno.h @@ -1,143 +1 @@ -/* - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file COPYING in the main directory of this archive - * for more details. - * - * Copyright (C) 1995, 1999, 2001, 2002 by Ralf Baechle - */ -#ifndef _ASM_MIPS_ERRNO_H -#define _ASM_MIPS_ERRNO_H - -/* - * These first 34 error codes are from Linux 2.6, asm-generic/errno-base.h - */ -#defineEPERM1 /* Operation not permitted */ -#defineENOENT 2 /* No such file or directory */ -#defineESRCH3 /* No such process */ -#defineEINTR4 /* Interrupted system call */ -#defineEIO 5 /* I/O error */ -#defineENXIO6 /* No such device or address */ -#defineE2BIG7 /* Argument list too long */ -#defineENOEXEC 8 /* Exec format error */ -#defineEBADF9 /* Bad file number */ -#defineECHILD 10 /* No child processes */ -#defineEAGAIN 11 /* Try again */ -#defineENOMEM 12 /* Out of memory */ -#defineEACCES 13 /* Permission denied */ -#defineEFAULT 14 /* Bad address */ -#defineENOTBLK 15 /* Block device required */ -#defineEBUSY 16 /* Device or resource busy */ -#defineEEXIST 17 /* File exists */ -#defineEXDEV 18 /* Cross-device link */ -#defineENODEV 19 /* No such device */ -#defineENOTDIR 20 /* Not a directory */ -#defineEISDIR 21 /* Is a directory */ -#defineEINVAL 22 /* Invalid argument */ -#defineENFILE 23 /* File table overflow */ -#defineEMFILE 24 /* Too many open files */ -#defineENOTTY 25 /* Not a typewriter */ -#defineETXTBSY 26 /* Text file busy */ -#defineEFBIG 27 /* File too large */ -#defineENOSPC 28 /* No space left on device */ -#defineESPIPE 29 /* Illegal seek */ -#defineEROFS 30 /* Read-only file system */ -#defineEMLINK 31 /* Too many links */ -#defineEPIPE 32 /* Broken pipe */ -#defineEDOM33 /* Math argument out of domain of func */ -#defineERANGE 34 /* Math result not representable */ - -/* - * These error numbers are intended to be MIPS ABI compatible - */ -#defineENOMSG 35 /* No message of desired type */ -#defineEIDRM 36 /* Identifier removed */ -#defineECHRNG 37 /* Channel number out of range */ -#defineEL2NSYNC38 /* Level 2 not synchronized */ -#defineEL3HLT 39 /* Level 3 halted */ -#defineEL3RST 40 /* Level 3 reset */ -#defineELNRNG 41 /* Link number out of range */ -#defineEUNATCH 42 /* Protocol driver not attached */ -#defineENOCSI 43 /* No CSI structure available */ -#defineEL2HLT 44 /* Level 2 halted */ -#defineEDEADLK 45 /* Resource deadlock would occur */ -#defineENOLCK 46 /* No record locks available */ -#defineEBADE 50 /* Invalid exchange */ -#defineEBADR 51 /* Invalid request descriptor */ -#defineEXFULL 52 /* Exchange full */ -#defineENOANO 53 /* No anode */ -#defineEBADRQC 54 /* Invalid request code */ -#defineEBADSLT 55 /* Invalid slot */ -#defineEDEADLOCK 56 /* File locking deadlock error */ -#defineEBFONT 59 /* Bad font file format */ -#defineENOSTR 60 /* Device not a stream */ -#defineENODATA 61 /* No data available */ -#defineETIME 62 /* Timer expired */ -#defineENOSR 63 /* Out of streams resources */ -#defineENONET 64 /* Machine is not on the network */
[U-Boot] [GIT PULL] u-boot-mips/fixes
Hi Tom, please pull two fixes for MIPS. These patches and [1] are required to cleanly run 'MAKEALL -a mips' again on master. [1] http://patchwork.ozlabs.org/patch/249980/ The following changes since commit 842033e6964e9e5d34aca893c1845416dd8ac2cc: pci: introduce CONFIG_PCI_INDIRECT_BRIDGE option (2013-06-07 14:17:01 -0400) are available in the git repository at: git://git.denx.de/u-boot-mips.git fixes for you to fetch changes up to e1208c2fe5e07f9a248cfbf9bbb212aa34ad2806: MIPS: asm/errno.h: switch to asm-generic/errno.h (2013-06-08 23:10:10 +0200) Daniel Schwierzeck (1): MIPS: asm/errno.h: switch to asm-generic/errno.h Gabor Juhos (1): MIPS: fix __raw_* IO accessors arch/mips/include/asm/errno.h | 144 +-- arch/mips/include/asm/io.h| 26 - 2 files changed, 14 insertions(+), 156 deletions(-) ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] Please pull u-boot-ti/master
Hi Tom, On Fri, 7 Jun 2013 15:19:21 -0400, Tom Rini tr...@ti.com wrote: Tom Rini (4): arm: Remove OMAP2420H4 and all omap24xx support This one removes not only 2420h4 but also tnetv107x_evm. Is that normal? Amicalement, -- Albert. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 04/11] MIPS: bootm: refactor initialisation of kernel cmdline
Move initialisation of Linux command line to separate functions. Also add support for bootm subcommand 'cmdline'. Signed-off-by: Daniel Schwierzeck daniel.schwierz...@gmail.com --- arch/mips/lib/bootm.c | 130 -- 1 file changed, 84 insertions(+), 46 deletions(-) diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index 1b0b06a..6045905 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -35,12 +35,13 @@ DECLARE_GLOBAL_DATA_PTR; static int linux_argc; static char **linux_argv; +static char *linux_argp; static char **linux_env; static char *linux_env_p; static int linux_env_idx; -static void linux_params_init(ulong start, char *commandline); +static void linux_params_init(void); static void linux_env_set(char *env_name, char *env_val); static ulong arch_get_sp(void) @@ -64,13 +65,84 @@ void arch_lmb_reserve(struct lmb *lmb) lmb_reserve(lmb, sp, CONFIG_SYS_SDRAM_BASE + gd-ram_size - sp); } +static void linux_cmdline_init(void) +{ + linux_argc = 1; + linux_argv = (char **)UNCACHED_SDRAM(gd-bd-bi_boot_params); + linux_argv[0] = 0; + linux_argp = (char *)(linux_argv + LINUX_MAX_ARGS); +} + +static void linux_cmdline_set(const char *value, size_t len) +{ + linux_argv[linux_argc] = linux_argp; + memcpy(linux_argp, value, len); + linux_argp[len] = 0; + + linux_argp += len + 1; + linux_argc++; +} + +static void linux_cmdline_dump(void) +{ +#ifdef DEBUG + int i; + + printf(## cmdline argv at 0x%p, argp at 0x%p\n, + linux_argv, linux_argp); + + for (i = 1; i linux_argc; i++) + printf( arg %03d: %s\n, i, linux_argv[i]); +#endif +} + +static void boot_cmdline_linux(bootm_headers_t *images) +{ + const char *bootargs, *next, *quote; + + linux_cmdline_init(); + + bootargs = getenv(bootargs); + if (!bootargs) + return; + + next = bootargs; + + while (bootargs *bootargs linux_argc LINUX_MAX_ARGS) { + quote = strchr(bootargs, ''); + next = strchr(bootargs, ' '); + + while (next quote quote next) { + /* we found a left quote before the next blank +* now we have to find the matching right quote +*/ + next = strchr(quote + 1, ''); + if (next) { + quote = strchr(next + 1, ''); + next = strchr(next + 1, ' '); + } + } + + if (!next) + next = bootargs + strlen(bootargs); + + linux_cmdline_set(bootargs, next - bootargs); + + if (*next) + next++; + + bootargs = next; + } + + linux_cmdline_dump(); +} + static void boot_prep_linux(bootm_headers_t *images) { - char *commandline = getenv(bootargs); char env_buf[12]; char *cp; - linux_params_init(UNCACHED_SDRAM(gd-bd-bi_boot_params), commandline); + linux_params_init(); #ifdef CONFIG_MEMSIZE_IN_BYTES sprintf(env_buf, %lu, (ulong)gd-ram_size); @@ -123,9 +195,14 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *images) { /* No need for those on MIPS */ - if (flag BOOTM_STATE_OS_BD_T || flag BOOTM_STATE_OS_CMDLINE) + if (flag BOOTM_STATE_OS_BD_T) return -1; + if (flag BOOTM_STATE_OS_CMDLINE) { + boot_cmdline_linux(images); + return 0; + } + if (flag BOOTM_STATE_OS_PREP) { boot_prep_linux(images); return 0; @@ -136,6 +213,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], return 0; } + boot_cmdline_linux(images); boot_prep_linux(images); boot_jump_linux(images); @@ -143,49 +221,9 @@ int do_bootm_linux(int flag, int argc, char * const argv[], return 1; } -static void linux_params_init(ulong start, char *line) +static void linux_params_init(void) { - char *next, *quote, *argp; - - linux_argc = 1; - linux_argv = (char **)start; - linux_argv[0] = 0; - argp = (char *)(linux_argv + LINUX_MAX_ARGS); - - next = line; - - while (line *line linux_argc LINUX_MAX_ARGS) { - quote = strchr(line, ''); - next = strchr(line, ' '); - - while (next quote quote next) { - /* we found a left quote before the next blank -* now we have to find the matching right quote -*/ - next = strchr(quote + 1, ''); - if (next) { - quote = strchr(next + 1, ''); -
[U-Boot] [PATCH 03/11] MIPS: bootm: add support for LMB
This is required for init ramdisk relocation and device tree support. Signed-off-by: Gabor Juhos juh...@openwrt.org Signed-off-by: Daniel Schwierzeck daniel.schwierz...@gmail.com --- arch/mips/include/asm/config.h | 2 ++ arch/mips/lib/bootm.c | 21 + 2 files changed, 23 insertions(+) diff --git a/arch/mips/include/asm/config.h b/arch/mips/include/asm/config.h index 049c44e..36438be 100644 --- a/arch/mips/include/asm/config.h +++ b/arch/mips/include/asm/config.h @@ -21,4 +21,6 @@ #ifndef _ASM_CONFIG_H_ #define _ASM_CONFIG_H_ +#define CONFIG_LMB + #endif diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index 5540477..1b0b06a 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -43,6 +43,27 @@ static int linux_env_idx; static void linux_params_init(ulong start, char *commandline); static void linux_env_set(char *env_name, char *env_val); +static ulong arch_get_sp(void) +{ + ulong ret; + + __asm__ __volatile__(move %0, $sp : =r(ret) : ); + + return ret; +} + +void arch_lmb_reserve(struct lmb *lmb) +{ + ulong sp; + + sp = arch_get_sp(); + debug(## Current stack ends at 0x%08lx\n, sp); + + /* adjust sp by 4K to be safe */ + sp -= 4096; + lmb_reserve(lmb, sp, CONFIG_SYS_SDRAM_BASE + gd-ram_size - sp); +} + static void boot_prep_linux(bootm_headers_t *images) { char *commandline = getenv(bootargs); -- 1.8.1.2 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 08/11] MIPS: bootm: automatically initialise kernel cmdline variable 'mem'
This replaces the passing of memory size via the traditional Linux environment. This is required for recent Linux kernels. Signed-off-by: Daniel Schwierzeck daniel.schwierz...@gmail.com --- arch/mips/lib/bootm.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index 741e088..796d405 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -102,9 +102,15 @@ static void linux_cmdline_dump(void) static void boot_cmdline_linux(bootm_headers_t *images) { const char *bootargs, *next, *quote; + char buf[12]; + unsigned int mem = gd-ram_size 20; linux_cmdline_init(); + /* append mem */ + sprintf(buf, mem=%uM, mem); + linux_cmdline_set(buf, strlen(buf)); + bootargs = getenv(bootargs); if (!bootargs) return; -- 1.8.1.2 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 01/11] MIPS: bootm: fix checkpatch.pl warnings
Signed-off-by: Daniel Schwierzeck daniel.schwierz...@gmail.com --- arch/mips/lib/bootm.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index a36154a..6b38955 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -57,7 +57,7 @@ static void boot_prep_linux(bootm_headers_t *images) #else sprintf(env_buf, %lu, (ulong)(gd-ram_size 20)); debug(## Giving linux memsize in MB, %lu\n, - (ulong)(gd-ram_size 20)); + (ulong)(gd-ram_size 20)); #endif /* CONFIG_MEMSIZE_IN_BYTES */ linux_env_set(memsize, env_buf); @@ -130,9 +130,9 @@ static void linux_params_init(ulong start, char *line) char *next, *quote, *argp; linux_argc = 1; - linux_argv = (char **) start; + linux_argv = (char **)start; linux_argv[0] = 0; - argp = (char *) (linux_argv + LINUX_MAX_ARGS); + argp = (char *)(linux_argv + LINUX_MAX_ARGS); next = line; @@ -167,9 +167,9 @@ static void linux_params_init(ulong start, char *line) line = next; } - linux_env = (char **) (((ulong) argp + 15) ~15); + linux_env = (char **)(((ulong) argp + 15) ~15); linux_env[0] = 0; - linux_env_p = (char *) (linux_env + LINUX_MAX_ENVS); + linux_env_p = (char *)(linux_env + LINUX_MAX_ENVS); linux_env_idx = 0; } -- 1.8.1.2 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 0/11] MIPS: bootm updates
- refactoring and optimization of bootm command - add support for logical memory blocks (LMB) - make external init ramdisks working again with recent kernels - add support for bootm subcommand 'cmdline' - prepare bootm for upcoming device tree support - add bootm support for newly added MIPS Malta Qemu - drop obsolete bootm support of MIPS Qemu Daniel Schwierzeck (11): MIPS: bootm: fix checkpatch.pl warnings MIPS: bootm: optimise kernel entry call MIPS: bootm: add support for LMB MIPS: bootm: refactor initialisation of kernel cmdline MIPS: bootm: refactor initialisation of kernel environment MIPS: bootm: make initialisation of Linux environment optional MIPS: bootm: add support for generic relocation of init ramdisks MIPS: bootm: automatically initialise kernel cmdline variable 'mem' MIPS: bootm: automatically initialise kernel cmdline variables 'rd_start' and 'rd_size' MIPS: bootm: add YAMON style Linux preparation/jump code for Qemu Malta MIPS: bootm: drop obsolete Qemu specific bootm implementation README | 6 + arch/mips/include/asm/config.h | 3 + arch/mips/lib/Makefile | 4 - arch/mips/lib/bootm.c | 274 +++- arch/mips/lib/bootm_qemu_mips.c | 78 5 files changed, 198 insertions(+), 167 deletions(-) delete mode 100644 arch/mips/lib/bootm_qemu_mips.c -- 1.8.1.2 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 07/11] MIPS: bootm: add support for generic relocation of init ramdisks
All linux kernels after v2.6 require a page-aligned location of an external init ramdisk. Enable CONFIG_SYS_BOOT_RAMDISK_HIGH to support this with the generic U-Boot relocation code. Signed-off-by: Daniel Schwierzeck daniel.schwierz...@gmail.com --- arch/mips/include/asm/config.h | 1 + arch/mips/lib/bootm.c | 8 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/mips/include/asm/config.h b/arch/mips/include/asm/config.h index 36438be..6ddc349 100644 --- a/arch/mips/include/asm/config.h +++ b/arch/mips/include/asm/config.h @@ -22,5 +22,6 @@ #define _ASM_CONFIG_H_ #define CONFIG_LMB +#define CONFIG_SYS_BOOT_RAMDISK_HIGH #endif diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index e13e0d5..741e088 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -170,6 +170,7 @@ static void boot_prep_linux_legacy(bootm_headers_t *images) { char env_buf[12]; const char *cp; + ulong rd_start, rd_size; #ifdef CONFIG_MEMSIZE_IN_BYTES sprintf(env_buf, %lu, (ulong)gd-ram_size); @@ -180,14 +181,17 @@ static void boot_prep_linux_legacy(bootm_headers_t *images) (ulong)(gd-ram_size 20)); #endif /* CONFIG_MEMSIZE_IN_BYTES */ + rd_start = UNCACHED_SDRAM(images-initrd_start); + rd_size = images-initrd_end - images-initrd_start; + linux_env_init(); linux_env_set(memsize, env_buf); - sprintf(env_buf, 0x%08X, (uint) UNCACHED_SDRAM(images-rd_start)); + sprintf(env_buf, 0x%08lX, rd_start); linux_env_set(initrd_start, env_buf); - sprintf(env_buf, 0x%X, (uint) (images-rd_end - images-rd_start)); + sprintf(env_buf, 0x%lX, rd_size); linux_env_set(initrd_size, env_buf); sprintf(env_buf, 0x%08X, (uint) (gd-bd-bi_flashstart)); -- 1.8.1.2 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 09/11] MIPS: bootm: automatically initialise kernel cmdline variables 'rd_start' and 'rd_size'
This replaces the passing of the location and size of an external init ramdisk via the traditional Linux environment. This is required to supporta again external init ramdisks with recent Linux kernels. Signed-off-by: Daniel Schwierzeck daniel.schwierz...@gmail.com --- arch/mips/lib/bootm.c | 12 1 file changed, 12 insertions(+) diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index 796d405..68b57d7 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -104,6 +104,7 @@ static void boot_cmdline_linux(bootm_headers_t *images) const char *bootargs, *next, *quote; char buf[12]; unsigned int mem = gd-ram_size 20; + ulong rd_start, rd_size; linux_cmdline_init(); @@ -111,6 +112,17 @@ static void boot_cmdline_linux(bootm_headers_t *images) sprintf(buf, mem=%uM, mem); linux_cmdline_set(buf, strlen(buf)); + /* append rd_start and rd_size */ + rd_start = images-initrd_start; + rd_size = images-initrd_end - images-initrd_start; + + if (rd_size) { + sprintf(buf, rd_start=0x%08lX, rd_start); + linux_cmdline_set(buf, strlen(buf)); + sprintf(buf, rd_size=0x%lX, rd_size); + linux_cmdline_set(buf, strlen(buf)); + } + bootargs = getenv(bootargs); if (!bootargs) return; -- 1.8.1.2 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 11/11] MIPS: bootm: drop obsolete Qemu specific bootm implementation
The Qemu specific bootm implementation was intended for a special Qemu target in Linux kernel. But this target has been dropped in v2.6.25-rc1 by commit 302922e5f6901eb6f29c58539631f71b3d9746b8 Author: Ralf Baechle r...@linux-mips.org Date: Tue Jan 29 10:15:02 2008 + [MIPS] Qemu: Remove platform. The Qemu platform was originally implemented to have an easily supportable platform until Qemu reaches a state where it emulates a real world system. Since the latest release Qemu is capable of emulating the MIPSsim and Malta platforms, so this goal has been reached. The Qemu plaform is also rather underfeatured so less useful than a Malta emulation. Thus the special bootm implementation is obsolete by now and can be dropped. The Qemu support in U-Boot is going to be replaced by MIPS Malta board support. Signed-off-by: Gabor Juhos juh...@openwrt.org Signed-off-by: Daniel Schwierzeck daniel.schwierz...@gmail.com --- arch/mips/lib/Makefile | 4 --- arch/mips/lib/bootm_qemu_mips.c | 78 - 2 files changed, 82 deletions(-) delete mode 100644 arch/mips/lib/bootm_qemu_mips.c diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile index 967e98a..a68a564 100644 --- a/arch/mips/lib/Makefile +++ b/arch/mips/lib/Makefile @@ -35,11 +35,7 @@ LGOBJS := $(addprefix $(obj),$(GLSOBJS)) SOBJS-y+= COBJS-y+= board.o -ifeq ($(CONFIG_QEMU_MIPS),y) -COBJS-y+= bootm_qemu_mips.o -else COBJS-y+= bootm.o -endif SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y)) diff --git a/arch/mips/lib/bootm_qemu_mips.c b/arch/mips/lib/bootm_qemu_mips.c deleted file mode 100644 index 0815c9c..000 --- a/arch/mips/lib/bootm_qemu_mips.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * (C) Copyright 2008 - * Jean-Christophe PLAGNIOL-VILLARD jcplagn...@jcrosoft.com - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include common.h -#include command.h -#include image.h -#include asm/byteorder.h -#include asm/addrspace.h - -DECLARE_GLOBAL_DATA_PTR; - -int do_bootm_linux(int flag, int argc, char * const argv[], - bootm_headers_t *images) -{ - void (*theKernel) (int, char **, char **, int *); - char *bootargs = getenv(bootargs); - char *start; - uint len; - - /* find kernel entry point */ - theKernel = (void (*)(int, char **, char **, int *))images-ep; - - bootstage_mark(BOOTSTAGE_ID_RUN_OS); - - debug(## Transferring control to Linux (at address %08lx) ...\n, - (ulong) theKernel); - - gd-bd-bi_boot_params = gd-bd-bi_memstart + (16 20) - 256; - debug(%-12s= 0x%08lX\n, boot_params, (ulong)gd-bd-bi_boot_params); - - /* set Magic */ - *(int32_t *)(gd-bd-bi_boot_params - 4) = 0x12345678; - /* set ram_size */ - *(int32_t *)(gd-bd-bi_boot_params - 8) = gd-ram_size; - - start = (char *)gd-bd-bi_boot_params; - - len = strlen(bootargs); - - strncpy(start, bootargs, len + 1); - - start += len; - - len = images-rd_end - images-rd_start; - if (len 0) { - start += sprintf(start, rd_start=0x%08X rd_size=0x%0X, - (uint) UNCACHED_SDRAM(images-rd_start), - (uint) len); - } - - /* we assume that the kernel is in place */ - printf(\nStarting kernel ...\n\n); - - theKernel(0, NULL, NULL, 0); - - /* does not return */ - return 1; -} -- 1.8.1.2 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 06/11] MIPS: bootm: make initialisation of Linux environment optional
Recent linux kernels do not use that special environment variables anymore. Add an option to disable compilation of that code but keep it for compatibilty with older kernels. Signed-off-by: Daniel Schwierzeck daniel.schwierz...@gmail.com --- README| 6 ++ arch/mips/lib/bootm.c | 9 - 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README b/README index 33bda8c..1623616 100644 --- a/README +++ b/README @@ -522,6 +522,12 @@ The following options need to be configured: expect it to be in bytes, others in MB. Define CONFIG_MEMSIZE_IN_BYTES to make it in bytes. + CONFIG_DISABLE_ENV_INIT [relevant for MIPS only] + + Disable initialization of traditional environment variables + passed to Linux. Modern kernels only use variables from command + line. + CONFIG_OF_LIBFDT New kernel versions are expecting firmware settings to be diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index 304ee53..e13e0d5 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -33,6 +33,12 @@ DECLARE_GLOBAL_DATA_PTR; #defineLINUX_MAX_ENVS 256 #defineLINUX_MAX_ARGS 256 +#if defined(CONFIG_DISABLE_ENV_INIT) +#define need_linux_env 0 +#else +#define need_linux_env 1 +#endif + static int linux_argc; static char **linux_argv; static char *linux_argp; @@ -201,7 +207,8 @@ static void boot_prep_linux_legacy(bootm_headers_t *images) static void boot_prep_linux(bootm_headers_t *images) { - boot_prep_linux_legacy(images); + if (need_linux_env) + boot_prep_linux_legacy(images); } static void boot_jump_linux(bootm_headers_t *images) -- 1.8.1.2 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 10/11] MIPS: bootm: add YAMON style Linux preparation/jump code for Qemu Malta
Signed-off-by: Gabor Juhos juh...@openwrt.org Signed-off-by: Daniel Schwierzeck daniel.schwierz...@gmail.com --- arch/mips/lib/bootm.c | 22 -- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index 68b57d7..1dc4e73 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -39,6 +39,12 @@ DECLARE_GLOBAL_DATA_PTR; #define need_linux_env 1 #endif +#if defined(CONFIG_QEMU_MALTA) +#define board_is_qemu_malta1 +#else +#define board_is_qemu_malta0 +#endif + static int linux_argc; static char **linux_argv; static char *linux_argp; @@ -174,7 +180,12 @@ static void linux_env_set(const char *env_name, const char *env_val) strcpy(linux_env_p, env_name); linux_env_p += strlen(env_name); - *linux_env_p++ = '='; + if (board_is_qemu_malta) { + linux_env_p++; + linux_env[++linux_env_idx] = linux_env_p; + } else { + *linux_env_p++ = '='; + } strcpy(linux_env_p, env_val); linux_env_p += strlen(env_val); @@ -225,6 +236,9 @@ static void boot_prep_linux_legacy(bootm_headers_t *images) cp = getenv(eth1addr); if (cp) linux_env_set(eth1addr, cp); + + if (board_is_qemu_malta) + linux_env_set(modetty0, 38400n8r); } static void boot_prep_linux(bootm_headers_t *images) @@ -237,15 +251,19 @@ static void boot_jump_linux(bootm_headers_t *images) { typedef void __noreturn (*kernel_entry_t)(int, ulong, ulong, ulong); kernel_entry_t kernel = (kernel_entry_t) images-ep; + ulong linux_extra = 0; debug(## Transferring control to Linux (at address %p) ...\n, kernel); bootstage_mark(BOOTSTAGE_ID_RUN_OS); + if (board_is_qemu_malta) + linux_extra = gd-ram_size; + /* we assume that the kernel is in place */ printf(\nStarting kernel ...\n\n); - kernel(linux_argc, (ulong)linux_argv, (ulong)linux_env, 0); + kernel(linux_argc, (ulong)linux_argv, (ulong)linux_env, linux_extra); } int do_bootm_linux(int flag, int argc, char * const argv[], -- 1.8.1.2 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 02/11] MIPS: bootm: optimise kernel entry call
Fix signature of kernel entry function. Mark the kernel entry with __noreturn for better code optimisation. Signed-off-by: Daniel Schwierzeck daniel.schwierz...@gmail.com --- arch/mips/lib/bootm.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index 6b38955..5540477 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -85,20 +85,17 @@ static void boot_prep_linux(bootm_headers_t *images) static void boot_jump_linux(bootm_headers_t *images) { - void (*theKernel) (int, char **, char **, int *); + typedef void __noreturn (*kernel_entry_t)(int, ulong, ulong, ulong); + kernel_entry_t kernel = (kernel_entry_t) images-ep; - /* find kernel entry point */ - theKernel = (void (*)(int, char **, char **, int *))images-ep; - - debug(## Transferring control to Linux (at address %08lx) ...\n, - (ulong) theKernel); + debug(## Transferring control to Linux (at address %p) ...\n, kernel); bootstage_mark(BOOTSTAGE_ID_RUN_OS); /* we assume that the kernel is in place */ printf(\nStarting kernel ...\n\n); - theKernel(linux_argc, linux_argv, linux_env, 0); + kernel(linux_argc, (ulong)linux_argv, (ulong)linux_env, 0); } int do_bootm_linux(int flag, int argc, char * const argv[], -- 1.8.1.2 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 05/11] MIPS: bootm: refactor initialisation of kernel environment
Move initialisation of Linux environment to separate functions. Signed-off-by: Daniel Schwierzeck daniel.schwierz...@gmail.com --- arch/mips/lib/bootm.c | 69 ++- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index 6045905..304ee53 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -41,9 +41,6 @@ static char **linux_env; static char *linux_env_p; static int linux_env_idx; -static void linux_params_init(void); -static void linux_env_set(char *env_name, char *env_val); - static ulong arch_get_sp(void) { ulong ret; @@ -137,12 +134,36 @@ static void boot_cmdline_linux(bootm_headers_t *images) linux_cmdline_dump(); } -static void boot_prep_linux(bootm_headers_t *images) +static void linux_env_init(void) { - char env_buf[12]; - char *cp; + linux_env = (char **)(((ulong) linux_argp + 15) ~15); + linux_env[0] = 0; + linux_env_p = (char *)(linux_env + LINUX_MAX_ENVS); + linux_env_idx = 0; +} - linux_params_init(); +static void linux_env_set(const char *env_name, const char *env_val) +{ + if (linux_env_idx LINUX_MAX_ENVS - 1) { + linux_env[linux_env_idx] = linux_env_p; + + strcpy(linux_env_p, env_name); + linux_env_p += strlen(env_name); + + *linux_env_p++ = '='; + + strcpy(linux_env_p, env_val); + linux_env_p += strlen(env_val); + + linux_env_p++; + linux_env[++linux_env_idx] = 0; + } +} + +static void boot_prep_linux_legacy(bootm_headers_t *images) +{ + char env_buf[12]; + const char *cp; #ifdef CONFIG_MEMSIZE_IN_BYTES sprintf(env_buf, %lu, (ulong)gd-ram_size); @@ -153,6 +174,8 @@ static void boot_prep_linux(bootm_headers_t *images) (ulong)(gd-ram_size 20)); #endif /* CONFIG_MEMSIZE_IN_BYTES */ + linux_env_init(); + linux_env_set(memsize, env_buf); sprintf(env_buf, 0x%08X, (uint) UNCACHED_SDRAM(images-rd_start)); @@ -176,6 +199,11 @@ static void boot_prep_linux(bootm_headers_t *images) linux_env_set(eth1addr, cp); } +static void boot_prep_linux(bootm_headers_t *images) +{ + boot_prep_linux_legacy(images); +} + static void boot_jump_linux(bootm_headers_t *images) { typedef void __noreturn (*kernel_entry_t)(int, ulong, ulong, ulong); @@ -220,30 +248,3 @@ int do_bootm_linux(int flag, int argc, char * const argv[], /* does not return */ return 1; } - -static void linux_params_init(void) -{ - linux_env = (char **)(((ulong) linux_argp + 15) ~15); - linux_env[0] = 0; - linux_env_p = (char *)(linux_env + LINUX_MAX_ENVS); - linux_env_idx = 0; -} - -static void linux_env_set(char *env_name, char *env_val) -{ - if (linux_env_idx LINUX_MAX_ENVS - 1) { - linux_env[linux_env_idx] = linux_env_p; - - strcpy(linux_env_p, env_name); - linux_env_p += strlen(env_name); - - strcpy(linux_env_p, =); - linux_env_p += 1; - - strcpy(linux_env_p, env_val); - linux_env_p += strlen(env_val); - - linux_env_p++; - linux_env[++linux_env_idx] = 0; - } -} -- 1.8.1.2 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot