Re: [U-Boot] [RFC PATCH] MIPS: incaip: move board specific code out of generic code
Dear Daniel, In message CACUy__WJBfHdHs2xjbyK24Fw1apdWwmSqM=1sheqjd0h2lq...@mail.gmail.com you wrote: Still one question. You respectively DENX generate and provide a DULG for INCA-IP [1]. Does it serve as reference for the MIPS ELDK? When NO, this is dead as well. yes may I suggest to replace it with Malta board? Malta is the only platform which is concurrently supported in mainline kernel and U-Boot and it is also supported by Qemu. Yes, this is a good idea, I think. However, there is currently no maintained version of the DULG for MIPS. Volunteers to add one are welcome. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de No matter where you go, there you are... - Buckaroo Banzai ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] How can I save U-Boot env vars to HUSH shell vars.
Dear James, In message 5345d493.4080...@gmail.com you wrote: Heh. As soon as you have to change _any_ code, you can as well upgrade. I was hoping (in vain perhaps) to do my work modifying only the environment. Yes, I understand this. But I have to admit that I don't see an easy way. Hm... thinking about it, you _can_ do this, but it's a bit ugly... POC code: = print ethaddr ipaddr serverip ethaddr=00:10:ec:01:08:84 ipaddr=192.168.100.6 serverip=192.168.1.1 = echo E=$foo_ethaddr I=$foo_ipaddr S=$foo_serverip E= I= S= = setenv setvar 'setenv tmp foo_$arg=$$arg' = for arg in ethaddr ipaddr serverip ; do run setvar run tmp echo E=$foo_ethaddr I=$foo_ipaddr S=$foo_serverip done E=00:10:ec:01:08:84 I= S= E=00:10:ec:01:08:84 I=192.168.100.6 S= E=00:10:ec:01:08:84 I=192.168.100.6 S=192.168.1.1 As you can see, I'm useing a two-step approach to first constuct a command and then to run it. This consumes 2 environment variables (tmp and arg), but this should be an acceptable price... This is a definite drawback to having an old U-Boot; I'm sure I would benefit from the bug fixes and other enhancements. Yes. Exporting a list of values sounds like a nice addition that would be helpful to me. The new env command allows for a lot of interesting features, like maintaining a set of user profiles, i. e. independent sets of environment settings which can be loaded and restored as you lik, including things like perfoming a reset to factory defaults (which still can be changed, i. e. you can update the factory default settings and are not limited to the fixed compiled in default env values. I suppose, with my 2010.12, I could export everything to memory and then parse through it to find the values I need then import them. Sounds vaguely possible but it's probably more complex than doing the U-Boot upgrade. You don't have enough tools in the shell to do this parsing by any scripts, so you would need code. And if you add new code, you change the binary anyway, so you could upgrade as well. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de I knew then (in 1970) that a 4-kbyte minicomputer would cost as much as a house. So I reasoned that after college, I'd have to live cheaply in an apartment and put all my money into owning a computer. - Apple co-founder Steve Wozniak, EE Times, June 6, 1988, pg 45 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] am335x: Switch to CONFIG_SKIP_LOWLEVEL_INIT from guarding SPL or NOR_BOOT
Dear Tom Rini, In message 1397046357-12804-1-git-send-email-tr...@ti.com you wrote: In the case of SPL or NOR_BOOT (no SPL involved) we need to include certain code in the build. Use !CONFIG_SKIP_LOWLEVEL_INIT rather than CONFIG_SPL_BUILD || CONFIG_NOR_BOOT to make the code clearer, and to make supporting XIP QSPI boot clearer in the code. Signed-off-by: Tom Rini tr...@ti.com --- arch/arm/cpu/armv7/am33xx/board.c |4 +--- arch/arm/cpu/armv7/am33xx/emif4.c |2 +- board/silica/pengwyn/Makefile |2 +- board/ti/am335x/Makefile |2 +- board/ti/am335x/board.c |2 +- 5 files changed, 5 insertions(+), 7 deletions(-) Reviewed-by: Wolfgang Denk w...@denx.de Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de Wenn Du ein' weise Antwort verlangst, Mußt Du vernünftig fragen. -- Goethe, Invektiven ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] Data abort in omap_gpio
Dear Tom Rini, On 04/09/2014 05:37 PM, Tom Rini wrote: On Wed, Apr 09, 2014 at 05:22:57PM +0200, Andreas Bießmann wrote: (gdb) s 118 __raw_writel(l, reg); (gdb) print/s l $17 = 2048 (gdb) print/x l $18 = 0x800 (gdb) print/x reg $19 = 0x49050090 (gdb) s ^C Program received signal SIGSTOP, Stopped (signal). _start () at /home/abiessmann/src/u-boot/arch/arm/cpu/armv7/start.S:27 27 ldr pc, _data_abort (gdb) ---8--- (Encounterd with tricorder board current ToT) I'll dive into that tomorrow. If anyone has some pointeres, please speak out loud ;) You need to add the relevant CONFIG_OMAP3_GPIO_n define to enable clocks/etc for the gpios being used. Well, it is GPIO 42/43 which is located in bank 1. These clocks are not enabled explicitly in 708cfb74b7c6df9c37d3c48988a154be79daefeb. I haven't followed the dsicussen but wonder why we do not switch the clocks on gpio_request(). So is it seems that 708cfb74b7c6df9c37d3c48988a154be79daefeb missed to enable clocks for bank 1. I'll try that. Best regards Best regards Andreas Bießmann ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [u-boot][coreboot-x86] Incremental Make fails
Hi, When doing make for coreboot-x86, in arch/x86/lib/Makefile it re-generates libgcc.a from the original toolchain libgcc.a and did some patching for certain libgcc functions. And this seems having some issues when you try to do incremental compilation. Steps to reproduce the issue: 1. Setup toolchain 2. make coreboot-x86 # sucess for the first time 3. make # second make fails with message: make[1]: Entering directory `/home/hua/git/u-boot/arch/x86/lib' make[1]: *** No rule to make target `.depend', needed by `built-in.o'. Stop. make[1]: Leaving directory `/home/hua/git/u-boot/arch/x86/lib' Can anyone give some hints in how to solve this issue? Regards, Yanghao ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] Data abort in omap_gpio
On 04/10/2014 09:22 AM, Andreas Bießmann wrote: On 04/09/2014 05:37 PM, Tom Rini wrote: On Wed, Apr 09, 2014 at 05:22:57PM +0200, Andreas Bießmann wrote: (gdb) s 118 __raw_writel(l, reg); (gdb) print/s l $17 = 2048 (gdb) print/x l $18 = 0x800 (gdb) print/x reg $19 = 0x49050090 (gdb) s ^C Program received signal SIGSTOP, Stopped (signal). _start () at /home/abiessmann/src/u-boot/arch/arm/cpu/armv7/start.S:27 27 ldr pc, _data_abort (gdb) ---8--- (Encounterd with tricorder board current ToT) I'll dive into that tomorrow. If anyone has some pointeres, please speak out loud ;) You need to add the relevant CONFIG_OMAP3_GPIO_n define to enable clocks/etc for the gpios being used. Well, it is GPIO 42/43 which is located in bank 1. These clocks are not enabled explicitly in 708cfb74b7c6df9c37d3c48988a154be79daefeb. I haven't followed the dsicussen but wonder why we do not switch the clocks on gpio_request(). So is it seems that 708cfb74b7c6df9c37d3c48988a154be79daefeb missed to enable clocks for bank 1. I'll try that. Got it working. The numbering starts with '1' here (not '0'). Therefore GPIO 42/43 is in bank 2. Enabling that bank with CONFIG_OMAP3_GPIO_2 stops data abort Thanks for the hint! Fixup patch series for 2014.04 coming today. Best Regards Andreas Bießmann ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] mx28: U-Boot fails to boot with VDD5V only power configuration
Dear Friends, I'm bringing up a custom i.MX28 based board. I'm having trouble bringing up the u-boot (version v2013.04) loader. The Powersupply has been design as detailed in section 4.1.2.1 (VDD5V source only) of application note AN4199: http://www.freescale.com/files/32bit/doc/app_note/AN4199.pdf I am referring Patch L2.6.35_10.12_SDK_5V_SUPPLY_PATCH.tar.gz at freescale website which is for bootlets with VDD5V only support. I have even applied the patch to bootlet code imx-bootlets-src-10.12.01.tar.gz which is working fine. Based on the bootlet patch, I have modified the u-boot code but I couldn't able to boot. Please find the u-boot patch at http://pastebin.com/VudxqTHQ Can anyone please review it and share what is missing in the patch? Regards, Ankur I am struggling to run u-boot spl with VDD5v. Please share if you need any debug information to analyse? Regards, Ankur. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [u-boot][coreboot-x86] Incremental Make fails
Hi Hua, As far as I tested, the problem you mentioned did not happen. On Thu, 10 Apr 2014 14:59:33 +0800 Hua Yanghao huayang...@gmail.com wrote: Hi, When doing make for coreboot-x86, in arch/x86/lib/Makefile it re-generates libgcc.a from the original toolchain libgcc.a and did some patching for certain libgcc functions. And this seems having some issues when you try to do incremental compilation. Steps to reproduce the issue: 1. Setup toolchain 2. make coreboot-x86 # sucess for the first time Strange. make coreboot-x86 is not supported anymore. Now, we must do make coreboot-x86_config all instead. 3. make # second make fails with message: make[1]: Entering directory `/home/hua/git/u-boot/arch/x86/lib' make[1]: *** No rule to make target `.depend', needed by `built-in.o'. Stop. make[1]: Leaving directory `/home/hua/git/u-boot/arch/x86/lib' Strange again. .depend files are not used any more. (They were used in the old build system prior to Kbuild.) Can anyone give some hints in how to solve this issue? Which version are you using? I guess you are not using the latest version in the git repository. The most recommended solution is to use the latest version. Best Regards Masahiro Yamada ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] Modify go to allow chain loading a second u-boot
This kind of option is clearly not what other u-boot commands use, I could not find a single command that supports '-' style options. If this had been widely used, I wouldn't have asked in the first place. It seems you did not look very carefully. Just for example: = help env env - environment handling commands Yes it seems ;-) Thx, I'll look into that. Helmut -- Scanned by MailScanner. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] Enable big-endian processors to use EHCI interrupt transfers
On Wednesday, April 09, 2014 at 11:03:02 PM, Adrian Cox wrote: Add endian support macros to interrupt transfers in the EHCI driver, to allow operation on PowerPC. Signed-off-by: Adrian Cox adr...@humboldt.co.uk Other than style issues, which need to be fixes (you can check for them with ./scripts/checkpatch.pl /path/to/your/0001-patch.patch) : WARNING: line over 80 characters #103: FILE: drivers/usb/host/ehci-hcd.c:1193: + qh-qh_endpt1 = cpu_to_hc32((0 28) | /* No NAK reload (ehci 4.9) */ WARNING: line over 80 characters #141: FILE: drivers/usb/host/ehci-hcd.c:1217: + td-qt_buffer[0] = cpu_to_hc32((uint32_t)buffer + i * elementsize); WARNING: line over 80 characters #142: FILE: drivers/usb/host/ehci-hcd.c:1218: + td-qt_buffer[1] = cpu_to_hc32((td-qt_buffer[0] + 0x1000) ~0xfff); WARNING: line over 80 characters #143: FILE: drivers/usb/host/ehci-hcd.c:1219: + td-qt_buffer[2] = cpu_to_hc32((td-qt_buffer[0] + 0x2000) ~0xfff); WARNING: line over 80 characters #144: FILE: drivers/usb/host/ehci-hcd.c:1220: + td-qt_buffer[3] = cpu_to_hc32((td-qt_buffer[0] + 0x3000) ~0xfff); WARNING: line over 80 characters #145: FILE: drivers/usb/host/ehci-hcd.c:1221: + td-qt_buffer[4] = cpu_to_hc32((td-qt_buffer[0] + 0x4000) ~0xfff); total: 0 errors, 6 warnings, 0 checks, 102 lines checked NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO MINMAX MULTISTATEMENT_MACRO_USE_DO_WHILE NETWORKING_BLOCK_COMMENT_STYLE USLEEP_RANGE Reviewed-by: Marek Vasut ma...@denx.de Also, use: $ git format-patch HEAD~1 -o /path/to/your/patch $ git send-email --annotate --to=u-boot. /path/to/your/patch/00*.patch Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] Fix USB keyboard polling via control endpoint
On Sunday, April 06, 2014 at 01:17:46 PM, Wolfgang Denk wrote: [...] @@ -131,7 +133,9 @@ void usb_kbd_generic_poll(void) /* Submit a interrupt transfer request */ maxp = usb_maxpacket(usb_kbd_dev, pipe); usb_submit_int_msg(usb_kbd_dev, pipe, data-new, - maxp 8 ? 8 : maxp, ep-bInterval); + maxp USB_KBD_PDATA_SIZE ? + USB_KBD_PDATA_SIZE : maxp, + ep-bInterval); Can we use min(8, USB_KBD_PDATA_SIZE) here instead of this multi-line monster call please ? Also, this USB_KBD_PDATA_SIZE should instead be called USB_KBD_LS_REPORT_SIZE according to USB HID spec v1.11 section 5.6 : 5.6 Reports Using USB terminology, a device may send or receive a transaction every USB frame (1 millisecond). A transaction may be made up of multiple packets (token, data, handshake) but is limited in size to 8 bytes for low-speed devices and 64 bytes for high-speed devices. A transfer is one or more transactions creating a set of data that is meaningful to the device—for example, Input, Output, and Feature reports. In this document, a transfer is synonymous with a report. What worries me a bit is that 64-byte high-speed report, but I never saw a device that would generate those. This section 5.6 is also the only place that mentions the high-speed HID device report size limit. [...] @@ -333,7 +340,9 @@ static inline void usb_kbd_poll_for_event(struct usb_device *dev) /* Submit a interrupt transfer request */ maxp = usb_maxpacket(dev, pipe); usb_submit_int_msg(dev, pipe, data-new[0], - maxp 8 ? 8 : maxp, ep-bInterval); + maxp USB_KBD_PDATA_SIZE ? + USB_KBD_PDATA_SIZE : maxp, min(USB_KBD_LS_REPORT_SIZE, maxp) would be nice. + ep-bInterval); usb_kbd_irq_worker(dev); #elifdefined(CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP) [...] @@ -459,7 +469,9 @@ static int usb_kbd_probe(struct usb_device *dev, unsigned int ifnum) usb_set_idle(dev, iface-desc.bInterfaceNumber, REPEAT_RATE, 0); debug(USB KBD: enable interrupt pipe...\n); - if (usb_submit_int_msg(dev, pipe, data-new, maxp 8 ? 8 : maxp, + if (usb_submit_int_msg(dev, pipe, data-new, +maxp USB_KBD_PDATA_SIZE ? + USB_KBD_PDATA_SIZE : maxp, Here as well. Other than that, I don't see a problem. Thank you! ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/2] dfu, nand: add medium specific polltimeout function
On Thursday, April 10, 2014 at 07:08:06 AM, Heiko Schocher wrote: add a possibility to add a medium specific polltimeout function. So it is possible to define different poll timeouts. Used on nand medium, for setting the DFU_MANIFEST_POLL_TIMEOUT only on nand ubi partitions, which is currently the only usecase. Signed-off-by: Heiko Schocher h...@denx.de Cc: Lukasz Majewski l.majew...@samsung.com Cc: Kyungmin Park kyungmin.p...@samsung.com Cc: Marek Vasut ma...@denx.de Cc: Pantelis Antoniou pa...@antoniou-consulting.com [...] @@ -174,6 +174,17 @@ static void dnload_request_flush(struct usb_ep *ep, struct usb_request *req) req-length, f_dfu-blk_seq_num); } +static void dfu_set_poll_timeout_manifest(struct dfu_status *dstat, + struct f_dfu *f_dfu) +{ + struct dfu_entity *dfu = dfu_get_entity(f_dfu-altsetting); + + if (dfu-poll_timeout) + dfu_set_poll_timeout(dstat, dfu-poll_timeout(dfu)); + else + dfu_set_poll_timeout(dstat, DFU_MANIFEST_POLL_TIMEOUT); +} Don't you think it'd be better (yet more intrusive) to have all the DFU users have default implementation of dfu-poll_timeout() ? Then you'd be able to avoid this if and even get rid of this dfu_set_poll_timeout_manifest() function. [...] Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/2] musb-new, dfu: first send request answer then call completions
On Thursday, April 10, 2014 at 07:08:05 AM, Heiko Schocher wrote: comment in ep0_txstate() states: report completions as soon as the fifo's loaded; there's no win in waiting till this last packet gets acked. This is wrong for using dfu. In the dfu usecase we must send a PollTimeout to the host, so the host can wait until the U-Boot Code is ready for answering new usb requests. So the answer which contains the PollTimeout must send *before* U-Boot calls req-complete. The req-complete is used in the dfu case for flushing the medium, when entering DFU_STATE_dfuMANIFEST_SYNC state. Signed-off-by: Heiko Schocher h...@denx.de Cc: Lukasz Majewski l.majew...@samsung.com Cc: Kyungmin Park kyungmin.p...@samsung.com Cc: Marek Vasut ma...@denx.de Cc: Pantelis Antoniou pa...@antoniou-consulting.com To me, this looks OK, yes. We need to commit the packet into the hardware before calling -complete. Acked-by: Marek Vasut ma...@denx.de Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/2] dfu, nand: add medium specific polltimeout function
Hi Marek, On Apr 10, 2014, at 10:54 AM, Marek Vasut wrote: On Thursday, April 10, 2014 at 07:08:06 AM, Heiko Schocher wrote: add a possibility to add a medium specific polltimeout function. So it is possible to define different poll timeouts. Used on nand medium, for setting the DFU_MANIFEST_POLL_TIMEOUT only on nand ubi partitions, which is currently the only usecase. Signed-off-by: Heiko Schocher h...@denx.de Cc: Lukasz Majewski l.majew...@samsung.com Cc: Kyungmin Park kyungmin.p...@samsung.com Cc: Marek Vasut ma...@denx.de Cc: Pantelis Antoniou pa...@antoniou-consulting.com [...] @@ -174,6 +174,17 @@ static void dnload_request_flush(struct usb_ep *ep, struct usb_request *req) req-length, f_dfu-blk_seq_num); } +static void dfu_set_poll_timeout_manifest(struct dfu_status *dstat, + struct f_dfu *f_dfu) +{ +struct dfu_entity *dfu = dfu_get_entity(f_dfu-altsetting); + +if (dfu-poll_timeout) +dfu_set_poll_timeout(dstat, dfu-poll_timeout(dfu)); +else +dfu_set_poll_timeout(dstat, DFU_MANIFEST_POLL_TIMEOUT); +} Don't you think it'd be better (yet more intrusive) to have all the DFU users have default implementation of dfu-poll_timeout() ? Then you'd be able to avoid this if and even get rid of this dfu_set_poll_timeout_manifest() function. Could work, but why not a simple accessor like this: static inline unsigned int dfu_get_poll_timeout(struct dfu_entity *dfu) { return dfu-poll_timeout ? dfu-poll_timeout(dfu); DFU_MANIFEST_POLL_TIMEOUT); } and dfu_set_poll_timeout(dstat, dfu_get_poll_timeout(dfu)); You even get the benefit of have a method to read the timeout value if we ever needed sometime in the future. [...] Best regards, Marek Vasut Regards -- Pantelis ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [u-boot][coreboot-x86] Incremental Make fails
Hi Masahiro, Strange. make coreboot-x86 is not supported anymore. Now, we must do make coreboot-x86_config all instead. We are still using U-boot 2014.01, which seems to be the latest stable release, isn't it? 3. make # second make fails with message: make[1]: Entering directory `/home/hua/git/u-boot/arch/x86/lib' make[1]: *** No rule to make target `.depend', needed by `built-in.o'. Stop. make[1]: Leaving directory `/home/hua/git/u-boot/arch/x86/lib' Strange again. .depend files are not used any more. (They were used in the old build system prior to Kbuild.) Are you sure? I can see the .depend files is created all over the places. For both ARM x86. Can anyone give some hints in how to solve this issue? Which version are you using? U-boot 2014.01 I guess you are not using the latest version in the git repository. The most recommended solution is to use the latest version. Indeed the latest version have things fixed. :-) Will switch over. Best Regards Masahiro Yamada ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] Fix USB keyboard polling via control endpoint
From: Marek Vasut ma...@denx.de Also, this USB_KBD_PDATA_SIZE should instead be called USB_KBD_LS_REPORT_SIZE [...] What worries me a bit is that 64-byte high-speed report, but I never saw a device that would generate those. This section 5.6 is also the only place that mentions the high-speed HID device report size limit. How about renaming to USB_KBD_BOOT_REPORT_SIZE? We know that the keyboard report will be 8 bytes because we explicitly set the keyboard into boot protocol (Appendix B of HID 1.11: The report may not exceed 8 bytes in length.). Regards, Adrian Cox ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] Fix USB keyboard polling via control endpoint
On Thursday, April 10, 2014 at 10:49:56 AM, Adrian Cox wrote: From: Marek Vasut ma...@denx.de Also, this USB_KBD_PDATA_SIZE should instead be called USB_KBD_LS_REPORT_SIZE [...] What worries me a bit is that 64-byte high-speed report, but I never saw a device that would generate those. This section 5.6 is also the only place that mentions the high-speed HID device report size limit. How about renaming to USB_KBD_BOOT_REPORT_SIZE? We know that the keyboard report will be 8 bytes because we explicitly set the keyboard into boot protocol (Appendix B of HID 1.11: The report may not exceed 8 bytes in length.). Good point, thanks. A comment in the code about where this number '8' comes from would be nice. Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v1 1/6] mtd: nand: omap_elm: remove #include omap_gpmc.h
There is no dependency of omap_elm.c on omap_gpmc.h Signed-off-by: Pekon Gupta pe...@ti.com --- drivers/mtd/nand/omap_elm.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/mtd/nand/omap_elm.c b/drivers/mtd/nand/omap_elm.c index 47b1f1b..4c65f3b 100644 --- a/drivers/mtd/nand/omap_elm.c +++ b/drivers/mtd/nand/omap_elm.c @@ -16,7 +16,6 @@ #include common.h #include asm/io.h #include asm/errno.h -#include linux/mtd/omap_gpmc.h #include linux/mtd/omap_elm.h #include asm/arch/hardware.h -- 1.8.5.1.163.gd7aced9 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v1 0/6] mtd: nand: omap: clean up of omap_elm and omap_gpmc driver
This patch series - removes un-wanted redundant code in omap_elm and omap_gpmc drivers - refactors some private struct in omap_gpmc to make them generic across ecc-schemes - minor code fixes and clean-ups This series can be as-it-is applied on u-boot 'v2014.04-rc3'. *Testing Procedure* Boot tested on am335x_evm (MLO - U-boot - kernel with filesystem flashed from U-boot) using OMAP_ECC_BCH8_CODE_HW and OMAP_ECC_BCH8_CODE_HW_DETECTION_SW ecc-schemes Pekon Gupta (6): mtd: nand: omap_elm: remove #include omap_gpmc.h mtd: nand: omap_elm: use bch_type instead of nibble count to differentiate between BCH4/BCH8/BCH16 mtd: nand: omap_elm: use macros for register definitions mtd: nand: omap_gpmc: remove unused members of 'struct nand_bch_priv' mtd: nand: omap_gpmc: rename struct nand_bch_priv to struct omap_nand_info mtd: nand: omap_gpmc: minor cleanup of omap_correct_data_bch drivers/mtd/nand/omap_elm.c | 21 -- drivers/mtd/nand/omap_gpmc.c | 97 +--- include/linux/mtd/omap_elm.h | 11 +++-- 3 files changed, 52 insertions(+), 77 deletions(-) -- 1.8.5.1.163.gd7aced9 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v1 2/6] mtd: nand: omap_elm: use bch_type instead of nibble count to differentiate between BCH4/BCH8/BCH16
ELM hardware engine support ECC error detection for multiple ECC strengths like +--++ |Type | ECC syndrome length| +--++ |BCH4 | 6.5 bytes = 13 nibbles | |BCH8 | 13 byte = 26 nibbles | |BCH16 | 26 bytes = 52 nibbles | +--++ Current implementation of omap_elm driver uses ECC syndrom length (in 'nibbles') to differentiate between BCH4/BCH8/BCH16. This patch replaces it with 'bch_type' Signed-off-by: Pekon Gupta pe...@ti.com --- drivers/mtd/nand/omap_elm.c | 20 drivers/mtd/nand/omap_gpmc.c | 10 ++ include/linux/mtd/omap_elm.h | 2 +- 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/drivers/mtd/nand/omap_elm.c b/drivers/mtd/nand/omap_elm.c index 4c65f3b..5b2172a 100644 --- a/drivers/mtd/nand/omap_elm.c +++ b/drivers/mtd/nand/omap_elm.c @@ -24,14 +24,12 @@ struct elm *elm_cfg; /** - * elm_load_syndromes - Load BCH syndromes based on nibble selection + * elm_load_syndromes - Load BCH syndromes based on bch_type selection * @syndrome: BCH syndrome - * @nibbles: + * @bch_type: BCH4/BCH8/BCH16 * @poly: Syndrome Polynomial set to use - * - * Load BCH syndromes based on nibble selection */ -static void elm_load_syndromes(u8 *syndrome, u32 nibbles, u8 poly) +static void elm_load_syndromes(u8 *syndrome, enum bch_level bch_type, u8 poly) { u32 *ptr; u32 val; @@ -47,8 +45,7 @@ static void elm_load_syndromes(u8 *syndrome, u32 nibbles, u8 poly) (syndrome[7] 24); writel(val, ptr); - /* BCH 8-bit with 26 nibbles (4*8=32) */ - if (nibbles 13) { + if (bch_type == BCH_4_BIT || bch_type == BCH_8_BIT) { /* reg 2 */ ptr = elm_cfg-syndrome_fragments[poly].syndrome_fragment_x[2]; val = syndrome[8] | (syndrome[9] 8) | (syndrome[10] 16) | @@ -61,8 +58,7 @@ static void elm_load_syndromes(u8 *syndrome, u32 nibbles, u8 poly) writel(val, ptr); } - /* BCH 16-bit with 52 nibbles (7*8=56) */ - if (nibbles 26) { + if (bch_type == BCH_16_BIT) { /* reg 4 */ ptr = elm_cfg-syndrome_fragments[poly].syndrome_fragment_x[4]; val = syndrome[16] | (syndrome[17] 8) | @@ -86,7 +82,7 @@ static void elm_load_syndromes(u8 *syndrome, u32 nibbles, u8 poly) /** * elm_check_errors - Check for BCH errors and return error locations * @syndrome: BCH syndrome - * @nibbles: + * @bch_type: BCH4/BCH8/BCH16 * @error_count: Returns number of errrors in the syndrome * @error_locations: Returns error locations (in decimal) in this array * @@ -94,14 +90,14 @@ static void elm_load_syndromes(u8 *syndrome, u32 nibbles, u8 poly) * and locations in the array passed. Returns -1 if error is not correctable, * else returns 0 */ -int elm_check_error(u8 *syndrome, u32 nibbles, u32 *error_count, +int elm_check_error(u8 *syndrome, enum bch_level bch_type, u32 *error_count, u32 *error_locations) { u8 poly = ELM_DEFAULT_POLY; s8 i; u32 location_status; - elm_load_syndromes(syndrome, nibbles, poly); + elm_load_syndromes(syndrome, bch_type, poly); /* start processing */ writel((readl(elm_cfg-syndrome_fragments[poly].syndrome_fragment_x[6]) diff --git a/drivers/mtd/nand/omap_gpmc.c b/drivers/mtd/nand/omap_gpmc.c index 881a636..af38f00 100644 --- a/drivers/mtd/nand/omap_gpmc.c +++ b/drivers/mtd/nand/omap_gpmc.c @@ -153,7 +153,6 @@ static int __maybe_unused omap_correct_data(struct mtd_info *mtd, uint8_t *dat, struct nand_bch_priv { uint8_t mode; uint8_t type; - uint8_t nibbles; struct bch_control *control; enum omap_ecc ecc_scheme; }; @@ -163,11 +162,6 @@ struct nand_bch_priv { #define ECC_BCH8 1 #define ECC_BCH16 2 -/* BCH nibbles for diff bch levels */ -#define ECC_BCH4_NIBBLES 13 -#define ECC_BCH8_NIBBLES 26 -#define ECC_BCH16_NIBBLES 52 - /* * This can be a single instance cause all current users have only one NAND * with nearly the same setup (BCH8, some with ELM and others with sw BCH @@ -176,7 +170,6 @@ struct nand_bch_priv { */ static __maybe_unused struct nand_bch_priv bch_priv = { .type = ECC_BCH8, - .nibbles = ECC_BCH8_NIBBLES, .control = NULL }; @@ -383,7 +376,8 @@ static int omap_correct_data_bch(struct mtd_info *mtd, uint8_t *dat, } /* use elm module to check for errors */ elm_config((enum bch_level)(bch-type)); - if (elm_check_error(calc_ecc, bch-nibbles, error_count, error_loc)) { + if (elm_check_error(calc_ecc, (enum bch_level)bch-type, + error_count, error_loc)) { printf(nand: error: uncorrectable ECC errors\n); return -EINVAL; } diff --git a/include/linux/mtd/omap_elm.h
[U-Boot] [PATCH v1 4/6] mtd: nand: omap_gpmc: remove unused members of 'struct nand_bch_priv'
This patch prepares to refactor 'struct nand_bch_priv' - 'struct omap_nand_info' And thus performs following clean-ups: - remove nand_bch_priv.type: use nand_bch_priv.ecc_scheme instead - remove nand_bch_priv.mode: unused Signed-off-by: Pekon Gupta pe...@ti.com --- drivers/mtd/nand/omap_gpmc.c | 23 ++- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/drivers/mtd/nand/omap_gpmc.c b/drivers/mtd/nand/omap_gpmc.c index af38f00..4bd296e 100644 --- a/drivers/mtd/nand/omap_gpmc.c +++ b/drivers/mtd/nand/omap_gpmc.c @@ -151,17 +151,10 @@ static int __maybe_unused omap_correct_data(struct mtd_info *mtd, uint8_t *dat, * Generic BCH interface */ struct nand_bch_priv { - uint8_t mode; - uint8_t type; struct bch_control *control; enum omap_ecc ecc_scheme; }; -/* bch types */ -#define ECC_BCH4 0 -#define ECC_BCH8 1 -#define ECC_BCH16 2 - /* * This can be a single instance cause all current users have only one NAND * with nearly the same setup (BCH8, some with ELM and others with sw BCH @@ -169,7 +162,6 @@ struct nand_bch_priv { * When some users with other BCH strength will exists this have to change! */ static __maybe_unused struct nand_bch_priv bch_priv = { - .type = ECC_BCH8, .control = NULL }; @@ -342,6 +334,7 @@ static int omap_correct_data_bch(struct mtd_info *mtd, uint8_t *dat, uint32_t eccbytes = chip-ecc.bytes; uint32_t error_count = 0, error_max; uint32_t error_loc[8]; + enum bch_level bch_type; uint32_t i, ecc_flag = 0; uint8_t count, err = 0; uint32_t byte_pos, bit_pos; @@ -369,22 +362,22 @@ static int omap_correct_data_bch(struct mtd_info *mtd, uint8_t *dat, */ switch (bch-ecc_scheme) { case OMAP_ECC_BCH8_CODE_HW: + bch_type = BCH_8_BIT; omap_reverse_list(calc_ecc, eccbytes - 1); break; default: return -EINVAL; } /* use elm module to check for errors */ - elm_config((enum bch_level)(bch-type)); - if (elm_check_error(calc_ecc, (enum bch_level)bch-type, - error_count, error_loc)) { + elm_config(bch_type); + if (elm_check_error(calc_ecc, bch_type, error_count, error_loc)) { printf(nand: error: uncorrectable ECC errors\n); return -EINVAL; } /* correct bch error */ for (count = 0; count error_count; count++) { - switch (bch-type) { - case ECC_BCH8: + switch (bch-ecc_scheme) { + case OMAP_ECC_BCH8_CODE_HW: /* 14th byte in ECC is reserved to match ROM layout */ error_max = SECTOR_BYTES + (eccbytes - 1); break; @@ -562,7 +555,6 @@ static int omap_select_ecc_scheme(struct nand_chip *nand, /* For this ecc-scheme, ecc.bytes, ecc.layout, ... are * initialized in nand_scan_tail(), so just set ecc.mode */ bch_priv.control= NULL; - bch_priv.type = 0; nand-ecc.mode = NAND_ECC_SOFT; nand-ecc.layout= NULL; nand-ecc.size = 0; @@ -578,7 +570,6 @@ static int omap_select_ecc_scheme(struct nand_chip *nand, return -EINVAL; } bch_priv.control= NULL; - bch_priv.type = 0; /* populate ecc specific fields */ memset(nand-ecc, 0, sizeof(struct nand_ecc_ctrl)); nand-ecc.mode = NAND_ECC_HW; @@ -617,7 +608,6 @@ static int omap_select_ecc_scheme(struct nand_chip *nand, printf(nand: error: could not init_bch()\n); return -ENODEV; } - bch_priv.type = ECC_BCH8; /* populate ecc specific fields */ memset(nand-ecc, 0, sizeof(struct nand_ecc_ctrl)); nand-ecc.mode = NAND_ECC_HW; @@ -659,7 +649,6 @@ static int omap_select_ecc_scheme(struct nand_chip *nand, } /* intialize ELM for ECC error detection */ elm_init(); - bch_priv.type = ECC_BCH8; /* populate ecc specific fields */ memset(nand-ecc, 0, sizeof(struct nand_ecc_ctrl)); nand-ecc.mode = NAND_ECC_HW; -- 1.8.5.1.163.gd7aced9 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v1 6/6] mtd: nand: omap_gpmc: minor cleanup of omap_correct_data_bch
This patch tries to avoid some local pointer dereferences, by using common local variables in omap_correct_data_bch() Signed-off-by: Pekon Gupta pe...@ti.com --- drivers/mtd/nand/omap_gpmc.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/mtd/nand/omap_gpmc.c b/drivers/mtd/nand/omap_gpmc.c index ae541c2..a96f310 100644 --- a/drivers/mtd/nand/omap_gpmc.c +++ b/drivers/mtd/nand/omap_gpmc.c @@ -331,7 +331,7 @@ static int omap_correct_data_bch(struct mtd_info *mtd, uint8_t *dat, { struct nand_chip *chip = mtd-priv; struct omap_nand_info *info = chip-priv; - uint32_t eccbytes = chip-ecc.bytes; + struct nand_ecc_ctrl*ecc = chip-ecc; uint32_t error_count = 0, error_max; uint32_t error_loc[8]; enum bch_level bch_type; @@ -340,7 +340,7 @@ static int omap_correct_data_bch(struct mtd_info *mtd, uint8_t *dat, uint32_t byte_pos, bit_pos; /* check calculated ecc */ - for (i = 0; i chip-ecc.bytes !ecc_flag; i++) { + for (i = 0; i ecc-bytes !ecc_flag; i++) { if (calc_ecc[i] != 0x00) ecc_flag = 1; } @@ -349,7 +349,7 @@ static int omap_correct_data_bch(struct mtd_info *mtd, uint8_t *dat, /* check for whether its a erased-page */ ecc_flag = 0; - for (i = 0; i chip-ecc.bytes !ecc_flag; i++) { + for (i = 0; i ecc-bytes !ecc_flag; i++) { if (read_ecc[i] != 0xff) ecc_flag = 1; } @@ -363,7 +363,7 @@ static int omap_correct_data_bch(struct mtd_info *mtd, uint8_t *dat, switch (info-ecc_scheme) { case OMAP_ECC_BCH8_CODE_HW: bch_type = BCH_8_BIT; - omap_reverse_list(calc_ecc, eccbytes - 1); + omap_reverse_list(calc_ecc, ecc-bytes - 1); break; default: return -EINVAL; @@ -372,14 +372,14 @@ static int omap_correct_data_bch(struct mtd_info *mtd, uint8_t *dat, elm_config(bch_type); if (elm_check_error(calc_ecc, bch_type, error_count, error_loc)) { printf(nand: error: uncorrectable ECC errors\n); - return -EINVAL; + return -EBADMSG; } /* correct bch error */ for (count = 0; count error_count; count++) { switch (info-ecc_scheme) { case OMAP_ECC_BCH8_CODE_HW: /* 14th byte in ECC is reserved to match ROM layout */ - error_max = SECTOR_BYTES + (eccbytes - 1); + error_max = SECTOR_BYTES + (ecc-bytes - 1); break; default: return -EINVAL; -- 1.8.5.1.163.gd7aced9 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v1 5/6] mtd: nand: omap_gpmc: rename struct nand_bch_priv to struct omap_nand_info
This patch renames 'struct nand_bch_priv' which currently holds private data only for BCH ECC schemes, into 'struct omap_nand_info' so that same can be used for all ECC schemes Signed-off-by: Pekon Gupta pe...@ti.com --- drivers/mtd/nand/omap_gpmc.c | 58 1 file changed, 26 insertions(+), 32 deletions(-) diff --git a/drivers/mtd/nand/omap_gpmc.c b/drivers/mtd/nand/omap_gpmc.c index 4bd296e..ae541c2 100644 --- a/drivers/mtd/nand/omap_gpmc.c +++ b/drivers/mtd/nand/omap_gpmc.c @@ -148,9 +148,9 @@ static int __maybe_unused omap_correct_data(struct mtd_info *mtd, uint8_t *dat, } /* - * Generic BCH interface + * Driver configurations */ -struct nand_bch_priv { +struct omap_nand_info { struct bch_control *control; enum omap_ecc ecc_scheme; }; @@ -161,7 +161,7 @@ struct nand_bch_priv { * library). * When some users with other BCH strength will exists this have to change! */ -static __maybe_unused struct nand_bch_priv bch_priv = { +static __maybe_unused struct omap_nand_info omap_nand_info = { .control = NULL }; @@ -191,7 +191,7 @@ __maybe_unused static void omap_enable_hwecc(struct mtd_info *mtd, int32_t mode) { struct nand_chip*nand = mtd-priv; - struct nand_bch_priv*bch= nand-priv; + struct omap_nand_info *info = nand-priv; unsigned int dev_width = (nand-options NAND_BUSWIDTH_16) ? 1 : 0; unsigned int ecc_algo = 0; unsigned int bch_type = 0; @@ -200,7 +200,7 @@ static void omap_enable_hwecc(struct mtd_info *mtd, int32_t mode) u32 ecc_config_val = 0; /* configure GPMC for specific ecc-scheme */ - switch (bch-ecc_scheme) { + switch (info-ecc_scheme) { case OMAP_ECC_HAM1_CODE_SW: return; case OMAP_ECC_HAM1_CODE_HW: @@ -262,11 +262,11 @@ static int omap_calculate_ecc(struct mtd_info *mtd, const uint8_t *dat, uint8_t *ecc_code) { struct nand_chip *chip = mtd-priv; - struct nand_bch_priv *bch = chip-priv; + struct omap_nand_info *info = chip-priv; uint32_t *ptr, val = 0; int8_t i = 0, j; - switch (bch-ecc_scheme) { + switch (info-ecc_scheme) { case OMAP_ECC_HAM1_CODE_HW: val = readl(gpmc_cfg-ecc1_result); ecc_code[0] = val 0xFF; @@ -294,7 +294,7 @@ static int omap_calculate_ecc(struct mtd_info *mtd, const uint8_t *dat, return -EINVAL; } /* ECC scheme specific syndrome customizations */ - switch (bch-ecc_scheme) { + switch (info-ecc_scheme) { case OMAP_ECC_HAM1_CODE_HW: break; #ifdef CONFIG_BCH @@ -330,7 +330,7 @@ static int omap_correct_data_bch(struct mtd_info *mtd, uint8_t *dat, uint8_t *read_ecc, uint8_t *calc_ecc) { struct nand_chip *chip = mtd-priv; - struct nand_bch_priv *bch = chip-priv; + struct omap_nand_info *info = chip-priv; uint32_t eccbytes = chip-ecc.bytes; uint32_t error_count = 0, error_max; uint32_t error_loc[8]; @@ -360,7 +360,7 @@ static int omap_correct_data_bch(struct mtd_info *mtd, uint8_t *dat, * while reading ECC result we read it in big endian. * Hence while loading to ELM we have rotate to get the right endian. */ - switch (bch-ecc_scheme) { + switch (info-ecc_scheme) { case OMAP_ECC_BCH8_CODE_HW: bch_type = BCH_8_BIT; omap_reverse_list(calc_ecc, eccbytes - 1); @@ -376,7 +376,7 @@ static int omap_correct_data_bch(struct mtd_info *mtd, uint8_t *dat, } /* correct bch error */ for (count = 0; count error_count; count++) { - switch (bch-ecc_scheme) { + switch (info-ecc_scheme) { case OMAP_ECC_BCH8_CODE_HW: /* 14th byte in ECC is reserved to match ROM layout */ error_max = SECTOR_BYTES + (eccbytes - 1); @@ -483,10 +483,10 @@ static int omap_correct_data_bch_sw(struct mtd_info *mtd, u_char *data, /* cannot correct more than 8 errors */ unsigned int errloc[8]; struct nand_chip *chip = mtd-priv; - struct nand_bch_priv *chip_priv = chip-priv; - struct bch_control *bch = chip_priv-control; + struct omap_nand_info *info = chip-priv; - count = decode_bch(bch, NULL, 512, read_ecc, calc_ecc, NULL, errloc); + count = decode_bch(info-control, NULL, 512, read_ecc, calc_ecc, + NULL, errloc); if (count 0) { /* correct errors */ for (i = 0; i count; i++) { @@ -522,15 +522,11 @@ static int omap_correct_data_bch_sw(struct mtd_info *mtd, u_char *data, static void __maybe_unused omap_free_bch(struct mtd_info *mtd) { struct nand_chip *chip = mtd-priv; - struct
[U-Boot] [PATCH v1 3/6] mtd: nand: omap_elm: use macros for register definitions
This patch adds macros for following parameters of ELM Hardware engine - ELM_MAX_CHANNELS: ELM can process 8 data streams simultaneously - ELM_MAX_ERRORS: ELM can detect upto 16 ECC error when using BCH16 scheme Signed-off-by: Pekon Gupta pe...@ti.com --- include/linux/mtd/omap_elm.h | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/linux/mtd/omap_elm.h b/include/linux/mtd/omap_elm.h index a6e9591..b8096b0 100644 --- a/include/linux/mtd/omap_elm.h +++ b/include/linux/mtd/omap_elm.h @@ -24,6 +24,9 @@ #define ELM_LOCATION_STATUS_ECC_CORRECTABLE_MASK (0x100) #define ELM_LOCATION_STATUS_ECC_NB_ERRORS_MASK (0x1F) +#define ELM_MAX_CHANNELS 8 +#define ELM_MAX_ERROR_COUNT16 + #ifndef __ASSEMBLY__ enum bch_level { @@ -43,7 +46,7 @@ struct syndrome { struct location { u32 location_status;/* 0x800 */ u8 res1[124]; /* 0x804 */ - u32 error_location_x[16]; /* 0x880 */ + u32 error_location_x[ELM_MAX_ERROR_COUNT]; /* 0x880, 0x980, .. */ u8 res2[64];/* 0x8c0 */ }; @@ -63,9 +66,9 @@ struct elm { u8 res2[92];/* 0x024 */ u32 page_ctrl; /* 0x080 */ u8 res3[892]; /* 0x084 */ - struct syndrome syndrome_fragments[8]; /* 0x400 */ + struct syndrome syndrome_fragments[ELM_MAX_CHANNELS]; /* 0x400,0x420 */ u8 res4[512]; /* 0x600 */ - struct location error_location[8]; /* 0x800 */ + struct location error_location[ELM_MAX_CHANNELS]; /* 0x800,0x900 ... */ }; int elm_check_error(u8 *syndrome, enum bch_level bch_type, u32 *error_count, -- 1.8.5.1.163.gd7aced9 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] am33xx: add SSC enable macro
From: Yegor Yefremov yegorsli...@googlemail.com Signed-off-by: Yegor Yefremov yegorsli...@googlemail.com --- arch/arm/include/asm/arch-am33xx/clock.h |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/arch/arm/include/asm/arch-am33xx/clock.h b/arch/arm/include/asm/arch-am33xx/clock.h index 7637457..f00fad3 100644 --- a/arch/arm/include/asm/arch-am33xx/clock.h +++ b/arch/arm/include/asm/arch-am33xx/clock.h @@ -42,6 +42,8 @@ #define MODULE_CLKCTRL_IDLEST_DISABLED 3 /* CM_CLKMODE_DPLL */ +#define CM_CLKMODE_DPLL_SSC_EN_SHIFT 12 +#define CM_CLKMODE_DPLL_SSC_EN_MASK(1 12) #define CM_CLKMODE_DPLL_REGM4XEN_SHIFT 11 #define CM_CLKMODE_DPLL_REGM4XEN_MASK (1 11) #define CM_CLKMODE_DPLL_LPMODE_EN_SHIFT10 -- 1.7.7 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/2] dfu, nand: add medium specific polltimeout function
Hi Pantelis, Hi Marek, On Apr 10, 2014, at 10:54 AM, Marek Vasut wrote: On Thursday, April 10, 2014 at 07:08:06 AM, Heiko Schocher wrote: add a possibility to add a medium specific polltimeout function. So it is possible to define different poll timeouts. Used on nand medium, for setting the DFU_MANIFEST_POLL_TIMEOUT only on nand ubi partitions, which is currently the only usecase. Signed-off-by: Heiko Schocher h...@denx.de Cc: Lukasz Majewski l.majew...@samsung.com Cc: Kyungmin Park kyungmin.p...@samsung.com Cc: Marek Vasut ma...@denx.de Cc: Pantelis Antoniou pa...@antoniou-consulting.com [...] @@ -174,6 +174,17 @@ static void dnload_request_flush(struct usb_ep *ep, struct usb_request *req) req-length, f_dfu-blk_seq_num); } +static void dfu_set_poll_timeout_manifest(struct dfu_status *dstat, +struct f_dfu *f_dfu) +{ + struct dfu_entity *dfu = dfu_get_entity(f_dfu-altsetting); + + if (dfu-poll_timeout) + dfu_set_poll_timeout(dstat, dfu-poll_timeout(dfu)); + else + dfu_set_poll_timeout(dstat, DFU_MANIFEST_POLL_TIMEOUT); +} Don't you think it'd be better (yet more intrusive) to have all the DFU users have default implementation of dfu-poll_timeout() ? Then you'd be able to avoid this if and even get rid of this dfu_set_poll_timeout_manifest() function. Could work, but why not a simple accessor like this: static inline unsigned int dfu_get_poll_timeout(struct dfu_entity *dfu) { return dfu-poll_timeout ? dfu-poll_timeout(dfu); DFU_MANIFEST_POLL_TIMEOUT); } and dfu_set_poll_timeout(dstat, dfu_get_poll_timeout(dfu)); You even get the benefit of have a method to read the timeout value if we ever needed sometime in the future. Seems reasonable for me: +1 Some comment: Guys, please be consistent with CCing people. I didn't receive this thread. Also this original reply from Pantelis was not CCed to Heiko. [...] Best regards, Marek Vasut Regards -- Pantelis -- Best regards, Lukasz Majewski Samsung RD Institute Poland (SRPOL) | Linux Platform Group ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [RFC] am33xx: add spread spectrum clock (SSC) support
I've found following source code implementing SSC in kernel on TI's forum (http://e2e.ti.com/support/arm/sitara_arm/f/791/t/198104.aspx source file: http://e2e.ti.com/cfs-file.ashx/__key/telligent-evolution-components-attachments/00-791-01-00-01-12-33-83/AM335x_5F00_Spread_5F00_Spectrum.c). Now I'm trying to port it to u-boot. One of Siemens boards is already using it (http://git.denx.de/?p=u-boot.git;a=blob;f=board/siemens/rut/board.c;h=f2b04768179533c2567212446e7057e4d0e03cfc;hb=c0dcece7d9925506a950e45028cbd25614aad791 DISPL_PLL_SPREAD_SPECTRUM macro). But this codes uses static values, TI's kernel code calculates needed values dynamically. So far I could convert all read/write calls using cmwkup structure. The only part, that is not clear is /* Calculate Fref */ clock = clk_get(NULL, sys_clkin_ck); f = clk_get_rate(clock); f = f/(1+n); What is u-boot analog for this code? Second question is, when should one invoke spread_spectrum_setup() in the board file? board_init()? Regards, Yegor ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] Fix USB keyboard polling via control endpoint
Dear Marek, In message 201404101012.42527.ma...@denx.de you wrote: On Sunday, April 06, 2014 at 01:17:46 PM, Wolfgang Denk wrote: [...] @@ -131,7 +133,9 @@ void usb_kbd_generic_poll(void) /* Submit a interrupt transfer request */ maxp = usb_maxpacket(usb_kbd_dev, pipe); usb_submit_int_msg(usb_kbd_dev, pipe, data-new, - maxp 8 ? 8 : maxp, ep-bInterval); + maxp USB_KBD_PDATA_SIZE ? + USB_KBD_PDATA_SIZE : maxp, + ep-bInterval); Can we use min(8, USB_KBD_PDATA_SIZE) here instead of this multi-line monster call please ? Agreed. Also, this USB_KBD_PDATA_SIZE should instead be called USB_KBD_LS_REPORT_S IZE according to USB HID spec v1.11 section 5.6 : Fine with me. What worries me a bit is that 64-byte high-speed report, but I never saw a device that would generate those. This section 5.6 is also the only place that mentions the high-speed HID device report size limit. I'm not an USB expert; I cannot comment on this. Other than that, I don't see a problem. So how should we proceed? Shall I prepare an updated patch - or Adrian, will you do that? Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de Remember that the best relationship is one in which your love for each other exceeds your need for each other. - Dalai Lama ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/2] dfu, nand: add medium specific polltimeout function
Hello Lukasz, Am 10.04.2014 12:08, schrieb Lukasz Majewski: Hi Pantelis, Hi Marek, On Apr 10, 2014, at 10:54 AM, Marek Vasut wrote: On Thursday, April 10, 2014 at 07:08:06 AM, Heiko Schocher wrote: add a possibility to add a medium specific polltimeout function. So it is possible to define different poll timeouts. Used on nand medium, for setting the DFU_MANIFEST_POLL_TIMEOUT only on nand ubi partitions, which is currently the only usecase. Signed-off-by: Heiko Schocherh...@denx.de Cc: Lukasz Majewskil.majew...@samsung.com Cc: Kyungmin Parkkyungmin.p...@samsung.com Cc: Marek Vasutma...@denx.de Cc: Pantelis Antonioupa...@antoniou-consulting.com [...] @@ -174,6 +174,17 @@ static void dnload_request_flush(struct usb_ep *ep, struct usb_request *req) req-length, f_dfu-blk_seq_num); } +static void dfu_set_poll_timeout_manifest(struct dfu_status *dstat, + struct f_dfu *f_dfu) +{ + struct dfu_entity *dfu = dfu_get_entity(f_dfu-altsetting); + + if (dfu-poll_timeout) + dfu_set_poll_timeout(dstat, dfu-poll_timeout(dfu)); + else + dfu_set_poll_timeout(dstat, DFU_MANIFEST_POLL_TIMEOUT); +} Don't you think it'd be better (yet more intrusive) to have all the DFU users have default implementation of dfu-poll_timeout() ? Then you'd be able to avoid this if and even get rid of this dfu_set_poll_timeout_manifest() function. Could work, but why not a simple accessor like this: static inline unsigned int dfu_get_poll_timeout(struct dfu_entity *dfu) { return dfu-poll_timeout ? dfu-poll_timeout(dfu); DFU_MANIFEST_POLL_TIMEOUT); } and dfu_set_poll_timeout(dstat, dfu_get_poll_timeout(dfu)); You even get the benefit of have a method to read the timeout value if we ever needed sometime in the future. Seems reasonable for me: +1 Yep, good idea, I change this. Some comment: Guys, please be consistent with CCing people. I didn't receive this thread. Also this original reply from Pantelis was not CCed to Heiko. Hmm.. I lloked in my received EMails, and I see you always on cc ... ? bye, Heiko -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/3] board:tricorder: always work with valid eeprom data
From: Andreas Bießmann andreas.biessm...@corscience.de Commit 890880583d84607e36b52a785a96b167728bbf73 introduced EEPROM parsing and board detection but faild to return a valid tricorder_eeprom struct for backup case. When pressing S200 while reading EEPROM we ignore the value. We returned falsely a tricorder_eeprom struct with uninitialized data which is just garbage. Initialize it by zeroing the whole structure. Signed-off-by: Andreas Bießmann andreas.biessm...@corscience.de Cc: Thomas Weber thomas.we...@corscience.de Signed-off-by: Andreas Bießmann andreas.de...@googlemail.com --- board/corscience/tricorder/tricorder.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/board/corscience/tricorder/tricorder.c b/board/corscience/tricorder/tricorder.c index 2dfcb27..9e81bf3 100644 --- a/board/corscience/tricorder/tricorder.c +++ b/board/corscience/tricorder/tricorder.c @@ -79,6 +79,8 @@ static void get_eeprom(struct tricorder_eeprom *eeprom) } else { panic(Could not get board revision\n); } + } else { + memset(eeprom, 0, TRICORDER_EEPROM_SIZE); } } -- 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] board:tricorder: enable omap_gpio clocks
From: Andreas Bießmann andreas.biessm...@corscience.de Signed-off-by: Andreas Bießmann andreas.biessm...@corscience.de Cc: Thomas Weber thomas.we...@corscience.de Signed-off-by: Andreas Bießmann andreas.de...@googlemail.com --- include/configs/tricorder.h |3 +++ 1 file changed, 3 insertions(+) diff --git a/include/configs/tricorder.h b/include/configs/tricorder.h index 62f97d2..a609861 100644 --- a/include/configs/tricorder.h +++ b/include/configs/tricorder.h @@ -63,6 +63,9 @@ /* GPIO support */ #define CONFIG_OMAP_GPIO +/* GPIO banks */ +#define CONFIG_OMAP3_GPIO_2/* GPIO32..63 are in GPIO bank 2 */ + /* LED support */ #define CONFIG_STATUS_LED #define CONFIG_BOARD_SPECIFIC_LED -- 1.7.10.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 0/3] board:tricorder: late fixups for 2014.04
These fixups are required for tricorder board to run with 2014.04. One big change is a different ecc layout which came in by Pekon Gupta's changes to the omap_gpmc driver. Another point was changed behaviour of omap_gpio driver, we need to switch the clocks now explicitely. Thomas, could you please chack the patches and send your ACK ASAP? Best regards Andreas Bießmann Andreas Bießmann (3): board:tricorder: always work with valid eeprom data board:tricorder: enable omap_gpio clocks board:tricorder: fixup SPL OOB layout board/corscience/tricorder/tricorder.c |2 ++ include/configs/tricorder.h| 14 +- 2 files changed, 11 insertions(+), 5 deletions(-) -- 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] board:tricorder: fixup SPL OOB layout
From: Andreas Bießmann andreas.biessm...@corscience.de Commit d016dc42cedbf6102e100fa9ecb58462edfb14f8 changed the layout of BCH8 SW on omap3 boards. We need to adopt the ecc layout for the nand_spl_simle driver to avoid wrong ecc errors. Signed-off-by: Andreas Bießmann andreas.biessm...@corscience.de Cc: Thomas Weber thomas.we...@corscience.de Signed-off-by: Andreas Bießmann andreas.de...@googlemail.com --- include/configs/tricorder.h | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/include/configs/tricorder.h b/include/configs/tricorder.h index a609861..80985a2 100644 --- a/include/configs/tricorder.h +++ b/include/configs/tricorder.h @@ -368,11 +368,12 @@ #define CONFIG_SYS_NAND_OOBSIZE64 #define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024) #define CONFIG_SYS_NAND_BAD_BLOCK_POS NAND_LARGE_BADBLOCK_POS -#define CONFIG_SYS_NAND_ECCPOS {12, 13, 14, 15, 16, 17, 18, 19, 20,\ - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,\ - 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,\ - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,\ - 60, 61, 62, 63} +#define CONFIG_SYS_NAND_ECCPOS {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, \ +13, 14, 16, 17, 18, 19, 20, 21, 22, \ +23, 24, 25, 26, 27, 28, 30, 31, 32, \ +33, 34, 35, 36, 37, 38, 39, 40, 41, \ +42, 44, 45, 46, 47, 48, 49, 50, 51, \ +52, 53, 54, 55, 56} #define CONFIG_SYS_NAND_ECCSIZE512 #define CONFIG_SYS_NAND_ECCBYTES 13 -- 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 v1 1/6] mtd: nand: omap_elm: remove #include omap_gpmc.h
On 10.04.2014 11:35, Pekon Gupta wrote: There is no dependency of omap_elm.c on omap_gpmc.h Signed-off-by: Pekon Gupta pe...@ti.com Reviewed-by: Stefan Roese s...@denx.de Thanks, Stefan ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v1 2/6] mtd: nand: omap_elm: use bch_type instead of nibble count to differentiate between BCH4/BCH8/BCH16
On 10.04.2014 11:35, Pekon Gupta wrote: ELM hardware engine support ECC error detection for multiple ECC strengths like +--++ |Type | ECC syndrome length| +--++ |BCH4 | 6.5 bytes = 13 nibbles | |BCH8 | 13 byte = 26 nibbles | |BCH16 | 26 bytes = 52 nibbles | +--++ Current implementation of omap_elm driver uses ECC syndrom length (in 'nibbles') to differentiate between BCH4/BCH8/BCH16. This patch replaces it with 'bch_type' Signed-off-by: Pekon Gupta pe...@ti.com --- drivers/mtd/nand/omap_elm.c | 20 drivers/mtd/nand/omap_gpmc.c | 10 ++ include/linux/mtd/omap_elm.h | 2 +- 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/drivers/mtd/nand/omap_elm.c b/drivers/mtd/nand/omap_elm.c index 4c65f3b..5b2172a 100644 --- a/drivers/mtd/nand/omap_elm.c +++ b/drivers/mtd/nand/omap_elm.c @@ -24,14 +24,12 @@ struct elm *elm_cfg; /** - * elm_load_syndromes - Load BCH syndromes based on nibble selection + * elm_load_syndromes - Load BCH syndromes based on bch_type selection * @syndrome: BCH syndrome - * @nibbles: + * @bch_type: BCH4/BCH8/BCH16 * @poly: Syndrome Polynomial set to use - * - * Load BCH syndromes based on nibble selection */ -static void elm_load_syndromes(u8 *syndrome, u32 nibbles, u8 poly) +static void elm_load_syndromes(u8 *syndrome, enum bch_level bch_type, u8 poly) { u32 *ptr; u32 val; @@ -47,8 +45,7 @@ static void elm_load_syndromes(u8 *syndrome, u32 nibbles, u8 poly) (syndrome[7] 24); writel(val, ptr); - /* BCH 8-bit with 26 nibbles (4*8=32) */ - if (nibbles 13) { + if (bch_type == BCH_4_BIT || bch_type == BCH_8_BIT) { Is this correct? Shouldn't this be: + if (bch_type == BCH_8_BIT || bch_type == BCH_16_BIT) { instead? Thanks, Stefan ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v1 3/6] mtd: nand: omap_elm: use macros for register definitions
On 10.04.2014 11:35, Pekon Gupta wrote: This patch adds macros for following parameters of ELM Hardware engine - ELM_MAX_CHANNELS: ELM can process 8 data streams simultaneously - ELM_MAX_ERRORS: ELM can detect upto 16 ECC error when using BCH16 scheme Signed-off-by: Pekon Gupta pe...@ti.com Reviewed-by: Stefan Roese s...@denx.de Thanks, Stefan ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v1 4/6] mtd: nand: omap_gpmc: remove unused members of 'struct nand_bch_priv'
On 10.04.2014 11:35, Pekon Gupta wrote: This patch prepares to refactor 'struct nand_bch_priv' - 'struct omap_nand_info' And thus performs following clean-ups: - remove nand_bch_priv.type: use nand_bch_priv.ecc_scheme instead - remove nand_bch_priv.mode: unused Signed-off-by: Pekon Gupta pe...@ti.com Reviewed-by: Stefan Roese s...@denx.de Thanks, Stefan ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v1 5/6] mtd: nand: omap_gpmc: rename struct nand_bch_priv to struct omap_nand_info
On 10.04.2014 11:35, Pekon Gupta wrote: This patch renames 'struct nand_bch_priv' which currently holds private data only for BCH ECC schemes, into 'struct omap_nand_info' so that same can be used for all ECC schemes Signed-off-by: Pekon Gupta pe...@ti.com --- drivers/mtd/nand/omap_gpmc.c | 58 1 file changed, 26 insertions(+), 32 deletions(-) diff --git a/drivers/mtd/nand/omap_gpmc.c b/drivers/mtd/nand/omap_gpmc.c index 4bd296e..ae541c2 100644 --- a/drivers/mtd/nand/omap_gpmc.c +++ b/drivers/mtd/nand/omap_gpmc.c @@ -148,9 +148,9 @@ static int __maybe_unused omap_correct_data(struct mtd_info *mtd, uint8_t *dat, } /* - * Generic BCH interface + * Driver configurations */ -struct nand_bch_priv { +struct omap_nand_info { struct bch_control *control; enum omap_ecc ecc_scheme; }; @@ -161,7 +161,7 @@ struct nand_bch_priv { * library). * When some users with other BCH strength will exists this have to change! */ -static __maybe_unused struct nand_bch_priv bch_priv = { +static __maybe_unused struct omap_nand_info omap_nand_info = { .control = NULL }; @@ -191,7 +191,7 @@ __maybe_unused static void omap_enable_hwecc(struct mtd_info *mtd, int32_t mode) { struct nand_chip*nand = mtd-priv; - struct nand_bch_priv*bch= nand-priv; + struct omap_nand_info *info = nand-priv; unsigned int dev_width = (nand-options NAND_BUSWIDTH_16) ? 1 : 0; unsigned int ecc_algo = 0; unsigned int bch_type = 0; @@ -200,7 +200,7 @@ static void omap_enable_hwecc(struct mtd_info *mtd, int32_t mode) u32 ecc_config_val = 0; /* configure GPMC for specific ecc-scheme */ - switch (bch-ecc_scheme) { + switch (info-ecc_scheme) { case OMAP_ECC_HAM1_CODE_SW: return; case OMAP_ECC_HAM1_CODE_HW: @@ -262,11 +262,11 @@ static int omap_calculate_ecc(struct mtd_info *mtd, const uint8_t *dat, uint8_t *ecc_code) { struct nand_chip *chip = mtd-priv; - struct nand_bch_priv *bch = chip-priv; + struct omap_nand_info *info = chip-priv; uint32_t *ptr, val = 0; int8_t i = 0, j; Nitpicking: This seems to be the only variable declaration with a tab for indentation. As the others are not aligned via tab's I suggest to use one space here as well. There are other places in this source where this indentation is inconsistent. Please re-check. Other than this: Reviewed-by: Stefan Roese s...@denx.de Thanks, Stefan ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v1 2/6] mtd: nand: omap_elm: use bch_type instead of nibble count to differentiate between BCH4/BCH8/BCH16
Hi Stefan, From: Stefan Roese [mailto:s...@denx.de] On 10.04.2014 11:35, Pekon Gupta wrote: ELM hardware engine support ECC error detection for multiple ECC strengths like +--++ |Type | ECC syndrome length| +--++ |BCH4 | 6.5 bytes = 13 nibbles | |BCH8 | 13 byte = 26 nibbles | |BCH16 | 26 bytes = 52 nibbles | +--++ Current implementation of omap_elm driver uses ECC syndrom length (in 'nibbles') to differentiate between BCH4/BCH8/BCH16. This patch replaces it with 'bch_type' Signed-off-by: Pekon Gupta pe...@ti.com --- drivers/mtd/nand/omap_elm.c | 20 drivers/mtd/nand/omap_gpmc.c | 10 ++ include/linux/mtd/omap_elm.h | 2 +- 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/drivers/mtd/nand/omap_elm.c b/drivers/mtd/nand/omap_elm.c index 4c65f3b..5b2172a 100644 --- a/drivers/mtd/nand/omap_elm.c +++ b/drivers/mtd/nand/omap_elm.c @@ -24,14 +24,12 @@ struct elm *elm_cfg; /** - * elm_load_syndromes - Load BCH syndromes based on nibble selection + * elm_load_syndromes - Load BCH syndromes based on bch_type selection * @syndrome: BCH syndrome - * @nibbles: + * @bch_type: BCH4/BCH8/BCH16 * @poly: Syndrome Polynomial set to use - * - * Load BCH syndromes based on nibble selection */ -static void elm_load_syndromes(u8 *syndrome, u32 nibbles, u8 poly) +static void elm_load_syndromes(u8 *syndrome, enum bch_level bch_type, u8 poly) { u32 *ptr; u32 val; @@ -47,8 +45,7 @@ static void elm_load_syndromes(u8 *syndrome, u32 nibbles, u8 poly) (syndrome[7] 24); writel(val, ptr); -/* BCH 8-bit with 26 nibbles (4*8=32) */ -if (nibbles 13) { +if (bch_type == BCH_4_BIT || bch_type == BCH_8_BIT) { Is this correct? Shouldn't this be: + if (bch_type == BCH_8_BIT || bch_type == BCH_16_BIT) { instead? yes you are correct. Thanks for pointing this out. Sorry, as BCH_4_BIT and BCH_16_BIT support is still not added to omap_gpmc driver so this bug wasn't detected. I'll fix this in next version. with regards, pekon ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v1 6/6] mtd: nand: omap_gpmc: minor cleanup of omap_correct_data_bch
On 10.04.2014 11:35, Pekon Gupta wrote: This patch tries to avoid some local pointer dereferences, by using common local variables in omap_correct_data_bch() Signed-off-by: Pekon Gupta pe...@ti.com --- drivers/mtd/nand/omap_gpmc.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/mtd/nand/omap_gpmc.c b/drivers/mtd/nand/omap_gpmc.c index ae541c2..a96f310 100644 --- a/drivers/mtd/nand/omap_gpmc.c +++ b/drivers/mtd/nand/omap_gpmc.c @@ -331,7 +331,7 @@ static int omap_correct_data_bch(struct mtd_info *mtd, uint8_t *dat, { struct nand_chip *chip = mtd-priv; struct omap_nand_info *info = chip-priv; - uint32_t eccbytes = chip-ecc.bytes; + struct nand_ecc_ctrl*ecc = chip-ecc; Again, nitpicking because of inconsistent indentation. uint32_t error_count = 0, error_max; uint32_t error_loc[8]; enum bch_level bch_type; @@ -340,7 +340,7 @@ static int omap_correct_data_bch(struct mtd_info *mtd, uint8_t *dat, uint32_t byte_pos, bit_pos; /* check calculated ecc */ - for (i = 0; i chip-ecc.bytes !ecc_flag; i++) { + for (i = 0; i ecc-bytes !ecc_flag; i++) { if (calc_ecc[i] != 0x00) ecc_flag = 1; } @@ -349,7 +349,7 @@ static int omap_correct_data_bch(struct mtd_info *mtd, uint8_t *dat, /* check for whether its a erased-page */ ecc_flag = 0; - for (i = 0; i chip-ecc.bytes !ecc_flag; i++) { + for (i = 0; i ecc-bytes !ecc_flag; i++) { if (read_ecc[i] != 0xff) ecc_flag = 1; } @@ -363,7 +363,7 @@ static int omap_correct_data_bch(struct mtd_info *mtd, uint8_t *dat, switch (info-ecc_scheme) { case OMAP_ECC_BCH8_CODE_HW: bch_type = BCH_8_BIT; - omap_reverse_list(calc_ecc, eccbytes - 1); + omap_reverse_list(calc_ecc, ecc-bytes - 1); break; default: return -EINVAL; @@ -372,14 +372,14 @@ static int omap_correct_data_bch(struct mtd_info *mtd, uint8_t *dat, elm_config(bch_type); if (elm_check_error(calc_ecc, bch_type, error_count, error_loc)) { printf(nand: error: uncorrectable ECC errors\n); - return -EINVAL; + return -EBADMSG; This change is not mentioned in the commit log. Is it intentional? Or should it be moved to a separate patch? Thanks, Stefan ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/2] dfu, nand: add medium specific polltimeout function
On Thursday, April 10, 2014 at 12:08:44 PM, Lukasz Majewski wrote: [...] Seems reasonable for me: +1 Some comment: Guys, please be consistent with CCing people. I didn't receive this thread. Also this original reply from Pantelis was not CCed to Heiko. For mutt, I have the key 'a' bound to: bind index,pager a group-reply Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] Fix USB keyboard polling via control endpoint
On Thursday, April 10, 2014 at 12:15:30 PM, Wolfgang Denk wrote: Dear Marek, In message 201404101012.42527.ma...@denx.de you wrote: On Sunday, April 06, 2014 at 01:17:46 PM, Wolfgang Denk wrote: [...] @@ -131,7 +133,9 @@ void usb_kbd_generic_poll(void) /* Submit a interrupt transfer request */ maxp = usb_maxpacket(usb_kbd_dev, pipe); usb_submit_int_msg(usb_kbd_dev, pipe, data-new, - maxp 8 ? 8 : maxp, ep-bInterval); + maxp USB_KBD_PDATA_SIZE ? + USB_KBD_PDATA_SIZE : maxp, + ep-bInterval); Can we use min(8, USB_KBD_PDATA_SIZE) here instead of this multi-line monster call please ? Agreed. Also, this USB_KBD_PDATA_SIZE should instead be called USB_KBD_LS_REPORT_S IZE according to USB HID spec v1.11 section 5.6 : Fine with me. What worries me a bit is that 64-byte high-speed report, but I never saw a device that would generate those. This section 5.6 is also the only place that mentions the high-speed HID device report size limit. I'm not an USB expert; I cannot comment on this. Other than that, I don't see a problem. So how should we proceed? Shall I prepare an updated patch - or Adrian, will you do that? Adrian, can you please take all the discussion here and roll out a new patch please ? Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2] Add endian support macros to interrupt transfers in the EHCI driver.
Update the EHCI driver to support interrupt transfers on PowerPC. Signed-off-by: Adrian Cox adr...@humboldt.co.uk --- Changes in v2: - Whitespace and line length fixes for checkstyle drivers/usb/host/ehci-hcd.c | 56 --- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 6017090..eaf5913 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -998,8 +998,8 @@ int usb_lowlevel_init(int index, enum usb_init_type init, void **controller) if (!ehcic[index].periodic_list) return -ENOMEM; for (i = 0; i 1024; i++) { - ehcic[index].periodic_list[i] = (uint32_t)periodic - | QH_LINK_TYPE_QH; + ehcic[index].periodic_list[i] = cpu_to_hc32((uint32_t)periodic + | QH_LINK_TYPE_QH); } flush_dcache_range((uint32_t)ehcic[index].periodic_list, @@ -1089,7 +1089,7 @@ struct int_queue { struct qTD *tds; }; -#define NEXT_QH(qh) (struct QH *)((qh)-qh_link ~0x1f) +#define NEXT_QH(qh) (struct QH *)(hc32_to_cpu((qh)-qh_link) ~0x1f) static int enable_periodic(struct ehci_ctrl *ctrl) @@ -1184,41 +1184,47 @@ create_int_queue(struct usb_device *dev, unsigned long pipe, int queuesize, struct qTD *td = result-tds + i; void **buf = qh-buffer; - qh-qh_link = (uint32_t)(qh+1) | QH_LINK_TYPE_QH; + qh-qh_link = cpu_to_hc32((uint32_t)(qh+1) | QH_LINK_TYPE_QH); if (i == queuesize - 1) - qh-qh_link = QH_LINK_TERMINATE; + qh-qh_link = cpu_to_hc32(QH_LINK_TERMINATE); - qh-qh_overlay.qt_next = (uint32_t)td; - qh-qh_overlay.qt_altnext = QT_NEXT_TERMINATE; - qh-qh_endpt1 = (0 28) | /* No NAK reload (ehci 4.9) */ + qh-qh_overlay.qt_next = cpu_to_hc32((uint32_t)td); + qh-qh_overlay.qt_altnext = cpu_to_hc32(QT_NEXT_TERMINATE); + qh-qh_endpt1 = + cpu_to_hc32((0 28) | /* No NAK reload (ehci 4.9) */ (usb_maxpacket(dev, pipe) 16) | /* MPS */ (1 14) | QH_ENDPT1_EPS(ehci_encode_speed(dev-speed)) | (usb_pipeendpoint(pipe) 8) | /* Endpoint Number */ - (usb_pipedevice(pipe) 0); - qh-qh_endpt2 = (1 30) | /* 1 Tx per mframe */ - (1 0); /* S-mask: microframe 0 */ + (usb_pipedevice(pipe) 0)); + qh-qh_endpt2 = cpu_to_hc32((1 30) | /* 1 Tx per mframe */ + (1 0)); /* S-mask: microframe 0 */ if (dev-speed == USB_SPEED_LOW || dev-speed == USB_SPEED_FULL) { debug(TT: port: %d, hub address: %d\n, dev-portnr, dev-parent-devnum); - qh-qh_endpt2 |= (dev-portnr 23) | + qh-qh_endpt2 |= cpu_to_hc32((dev-portnr 23) | (dev-parent-devnum 16) | - (0x1c 8); /* C-mask: microframes 2-4 */ + (0x1c 8)); /* C-mask: microframes 2-4 */ } - td-qt_next = QT_NEXT_TERMINATE; - td-qt_altnext = QT_NEXT_TERMINATE; + td-qt_next = cpu_to_hc32(QT_NEXT_TERMINATE); + td-qt_altnext = cpu_to_hc32(QT_NEXT_TERMINATE); debug(communication direction is '%s'\n, usb_pipein(pipe) ? in : out); - td-qt_token = (elementsize 16) | + td-qt_token = cpu_to_hc32((elementsize 16) | ((usb_pipein(pipe) ? 1 : 0) 8) | /* IN/OUT token */ - 0x80; /* active */ - td-qt_buffer[0] = (uint32_t)buffer + i * elementsize; - td-qt_buffer[1] = (td-qt_buffer[0] + 0x1000) ~0xfff; - td-qt_buffer[2] = (td-qt_buffer[0] + 0x2000) ~0xfff; - td-qt_buffer[3] = (td-qt_buffer[0] + 0x3000) ~0xfff; - td-qt_buffer[4] = (td-qt_buffer[0] + 0x4000) ~0xfff; + 0x80); /* active */ + td-qt_buffer[0] = + cpu_to_hc32((uint32_t)buffer + i * elementsize); + td-qt_buffer[1] = + cpu_to_hc32((td-qt_buffer[0] + 0x1000) ~0xfff); + td-qt_buffer[2] = + cpu_to_hc32((td-qt_buffer[0] + 0x2000) ~0xfff); + td-qt_buffer[3] = + cpu_to_hc32((td-qt_buffer[0] + 0x3000) ~0xfff); + td-qt_buffer[4] = + cpu_to_hc32((td-qt_buffer[0] + 0x4000) ~0xfff); *buf = buffer + i * elementsize; } @@ -1241,7
[U-Boot] [PATCH v3] Fix USB keyboard polling via control endpoint
USB keyboard polling failed for some keyboards on PowerPC 5020. This was caused by requesting only 4 bytes of data from keyboards that produce an 8 byte HID report. Signed-off-by: Adrian Cox adr...@humboldt.co.uk Signed-off-by: Wolfgang Denk w...@denx.de Cc: Marek Vasut ma...@denx.de --- Changes in v3: - Fixed checkstyle warnings - Renamed constant to USB_KBD_BOOT_REPORT_SIZE - Use min() for readability common/usb_kbd.c | 36 +--- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/common/usb_kbd.c b/common/usb_kbd.c index 1ad67ca..0b77c16 100644 --- a/common/usb_kbd.c +++ b/common/usb_kbd.c @@ -91,6 +91,12 @@ static const unsigned char usb_kbd_arrow[] = { #define USB_KBD_LEDMASK\ (USB_KBD_NUMLOCK | USB_KBD_CAPSLOCK | USB_KBD_SCROLLLOCK) +/* + * USB Keyboard reports are 8 bytes in boot protocol. + * Appendix B of HID Device Class Definition 1.11 + */ +#define USB_KBD_BOOT_REPORT_SIZE 8 + struct usb_kbd_pdata { uint32_trepeat_delay; @@ -99,7 +105,7 @@ struct usb_kbd_pdata { uint8_t usb_kbd_buffer[USB_KBD_BUFFER_LEN]; uint8_t *new; - uint8_t old[8]; + uint8_t old[USB_KBD_BOOT_REPORT_SIZE]; uint8_t flags; }; @@ -131,7 +137,8 @@ void usb_kbd_generic_poll(void) /* Submit a interrupt transfer request */ maxp = usb_maxpacket(usb_kbd_dev, pipe); usb_submit_int_msg(usb_kbd_dev, pipe, data-new, - maxp 8 ? 8 : maxp, ep-bInterval); + min(maxp, USB_KBD_BOOT_REPORT_SIZE), + ep-bInterval); } /* Puts character in the queue and sets up the in and out pointer. */ @@ -266,8 +273,11 @@ static uint32_t usb_kbd_service_key(struct usb_device *dev, int i, int up) old = data-old; } - if ((old[i] 3) (memscan(new + 2, old[i], 6) == new + 8)) + if ((old[i] 3) + (memscan(new + 2, old[i], USB_KBD_BOOT_REPORT_SIZE - 2) == + new + USB_KBD_BOOT_REPORT_SIZE)) { res |= usb_kbd_translate(data, old[i], data-new[0], up); + } return res; } @@ -285,7 +295,7 @@ static int usb_kbd_irq_worker(struct usb_device *dev) else if ((data-new[0] == LEFT_CNTR) || (data-new[0] == RIGHT_CNTR)) data-flags |= USB_KBD_CTRL; - for (i = 2; i 8; i++) { + for (i = 2; i USB_KBD_BOOT_REPORT_SIZE; i++) { res |= usb_kbd_service_key(dev, i, 0); res |= usb_kbd_service_key(dev, i, 1); } @@ -297,7 +307,7 @@ static int usb_kbd_irq_worker(struct usb_device *dev) if (res == 1) usb_kbd_setled(dev); - memcpy(data-old, data-new, 8); + memcpy(data-old, data-new, USB_KBD_BOOT_REPORT_SIZE); return 1; } @@ -305,7 +315,8 @@ static int usb_kbd_irq_worker(struct usb_device *dev) /* Keyboard interrupt handler */ static int usb_kbd_irq(struct usb_device *dev) { - if ((dev-irq_status != 0) || (dev-irq_act_len != 8)) { + if ((dev-irq_status != 0) || + (dev-irq_act_len != USB_KBD_BOOT_REPORT_SIZE)) { debug(USB KBD: Error %lX, len %d\n, dev-irq_status, dev-irq_act_len); return 1; @@ -333,7 +344,8 @@ static inline void usb_kbd_poll_for_event(struct usb_device *dev) /* Submit a interrupt transfer request */ maxp = usb_maxpacket(dev, pipe); usb_submit_int_msg(dev, pipe, data-new[0], - maxp 8 ? 8 : maxp, ep-bInterval); + min(maxp, USB_KBD_BOOT_REPORT_SIZE), + ep-bInterval); usb_kbd_irq_worker(dev); #elif defined(CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP) @@ -341,8 +353,8 @@ static inline void usb_kbd_poll_for_event(struct usb_device *dev) struct usb_kbd_pdata *data = dev-privptr; iface = dev-config.if_desc[0]; usb_get_report(dev, iface-desc.bInterfaceNumber, - 1, 0, data-new, sizeof(data-new)); - if (memcmp(data-old, data-new, sizeof(data-new))) + 1, 0, data-new, USB_KBD_BOOT_REPORT_SIZE); + if (memcmp(data-old, data-new, USB_KBD_BOOT_REPORT_SIZE)) usb_kbd_irq_worker(dev); #endif } @@ -441,7 +453,8 @@ static int usb_kbd_probe(struct usb_device *dev, unsigned int ifnum) memset(data, 0, sizeof(struct usb_kbd_pdata)); /* allocate input buffer aligned and sized to USB DMA alignment */ - data-new = memalign(USB_DMA_MINALIGN, roundup(8, USB_DMA_MINALIGN)); + data-new = memalign(USB_DMA_MINALIGN, + roundup(USB_KBD_BOOT_REPORT_SIZE, USB_DMA_MINALIGN)); /* Insert private data into USB device structure */ dev-privptr = data; @@ -459,7 +472,8 @@ static int usb_kbd_probe(struct usb_device *dev, unsigned int ifnum) usb_set_idle(dev, iface-desc.bInterfaceNumber, REPEAT_RATE, 0);
Re: [U-Boot] [PATCH 07/11] MX6: use macro building for MX6Q/MX6DL iomux regs
On 04/09/2014 06:46 PM, Tim Harvey wrote: On Wed, Apr 9, 2014 at 7:57 AM, Nikita Kiryanov nik...@compulab.co.il wrote: Hi Tim, On 04/03/2014 09:01 AM, Tim Harvey wrote: This is an attempt at using a macro to allow mx6dl-ddr.h and mx6q-ddr.h registers to be used together which is needed for an SPL bootloader that can run on either CPU's and must configure MMDC iomux dynamically. I am trying to come up with a solution similar to Eric's approach with the similar issue regarding IMX pinmux but this approach is broken in that imximage will choke on the cfgtmp file due to the fact that the pre-processor won't use the enum's as it did the #defines. I'm looking for some positive suggestions here or perhaps someone else can come up with a solution for this particular issue which I haven't been able to resolve. Why can't you just rename the register name #defines without enclosing them in an anonymous enum? Then they could coexist and will be usable by imximage. -- Regards, Nikita. Nikita, The cfg files are currently all written to use the IOMUX register names as MX6_ (no Q vs DL) so that a single cfg file can be used for a build-time configuration of IMX6Q or IMX6DL. OK now I understand. It seems to me that you only have this problem because you are using these address #defines as values for mx6_mmdc_ioregs structs to define a register mapping. You can also define this mapping by using a struct template that matches the register layout and a base address, both of which change between CPU types. You can find an example of this in the Wandboard SPL implementation. It's not in mainline ATM so you'll have to download their BSP. The template + base addr method also doesn't use up additional memory to define this layout, which is a point in its favor. Regards, Tim -- Regards, Nikita. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2] Add endian support macros to interrupt transfers in the EHCI driver.
On Thursday, April 10, 2014 at 02:29:45 PM, Adrian Cox wrote: Update the EHCI driver to support interrupt transfers on PowerPC. Signed-off-by: Adrian Cox adr...@humboldt.co.uk Applied for -next, thanks! Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v3] Fix USB keyboard polling via control endpoint
On Thursday, April 10, 2014 at 03:02:44 PM, Adrian Cox wrote: USB keyboard polling failed for some keyboards on PowerPC 5020. This was caused by requesting only 4 bytes of data from keyboards that produce an 8 byte HID report. Signed-off-by: Adrian Cox adr...@humboldt.co.uk Signed-off-by: Wolfgang Denk w...@denx.de Applied for -next, thanks! Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/2] dfu, nand: add medium specific polltimeout function
Hi Heiko, Hello Lukasz, Am 10.04.2014 12:08, schrieb Lukasz Majewski: Hi Pantelis, Hi Marek, On Apr 10, 2014, at 10:54 AM, Marek Vasut wrote: On Thursday, April 10, 2014 at 07:08:06 AM, Heiko Schocher wrote: add a possibility to add a medium specific polltimeout function. So it is possible to define different poll timeouts. Used on nand medium, for setting the DFU_MANIFEST_POLL_TIMEOUT only on nand ubi partitions, which is currently the only usecase. Signed-off-by: Heiko Schocherh...@denx.de Cc: Lukasz Majewskil.majew...@samsung.com Cc: Kyungmin Parkkyungmin.p...@samsung.com Cc: Marek Vasutma...@denx.de Cc: Pantelis Antonioupa...@antoniou-consulting.com [...] @@ -174,6 +174,17 @@ static void dnload_request_flush(struct usb_ep *ep, struct usb_request *req) req-length, f_dfu-blk_seq_num); } +static void dfu_set_poll_timeout_manifest(struct dfu_status *dstat, + struct f_dfu *f_dfu) +{ +struct dfu_entity *dfu = dfu_get_entity(f_dfu-altsetting); + +if (dfu-poll_timeout) +dfu_set_poll_timeout(dstat, dfu-poll_timeout(dfu)); +else +dfu_set_poll_timeout(dstat, DFU_MANIFEST_POLL_TIMEOUT); +} Don't you think it'd be better (yet more intrusive) to have all the DFU users have default implementation of dfu-poll_timeout() ? Then you'd be able to avoid this if and even get rid of this dfu_set_poll_timeout_manifest() function. Could work, but why not a simple accessor like this: static inline unsigned int dfu_get_poll_timeout(struct dfu_entity *dfu) { return dfu-poll_timeout ? dfu-poll_timeout(dfu); DFU_MANIFEST_POLL_TIMEOUT); } and dfu_set_poll_timeout(dstat, dfu_get_poll_timeout(dfu)); You even get the benefit of have a method to read the timeout value if we ever needed sometime in the future. Seems reasonable for me: +1 Yep, good idea, I change this. Some comment: Guys, please be consistent with CCing people. I didn't receive this thread. Also this original reply from Pantelis was not CCed to Heiko. Hmm.. I lloked in my received EMails, and I see you always on cc ... ? I wasn't added to CC in the original patch 2/2. I was only added to Cc below the Signed-of-by, but then I was missing in the CC of the message itself. bye, Heiko -- Best regards, Lukasz Majewski Samsung RD Institute Poland (SRPOL) | Linux Platform Group ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 04/11] MX6: add common SPL configuration
On 04/09/2014 06:32 PM, Tim Harvey wrote: On Wed, Apr 9, 2014 at 7:55 AM, Nikita Kiryanov nik...@compulab.co.il wrote: Hi Tim, On 04/03/2014 09:01 AM, Tim Harvey wrote: Add a common header which can hopefully be shared among imx6 SPL users Signed-off-by: Tim Harvey thar...@gateworks.com --- include/configs/imx6_spl.h | 64 ++ 1 file changed, 64 insertions(+) create mode 100644 include/configs/imx6_spl.h diff --git a/include/configs/imx6_spl.h b/include/configs/imx6_spl.h new file mode 100644 index 000..f9bdf55 --- /dev/null +++ b/include/configs/imx6_spl.h @@ -0,0 +1,64 @@ +/* + * Author: Tim Harvey thar...@gateworks.com + * + * SPDX-License-Identifier: GPL-2.0+ + */ +#ifndef __IMX6_SPL_CONFIG_H +#define __IMX6_SPL_CONFIG_H + +#ifdef CONFIG_SPL + +#define CONFIG_SPL_FRAMEWORK + +/* + * IMX6 OCRAM (IRAM) is from 0x00907000 to 0x0093 That's not true for all IMX6 SoCs. On i.MX6 Solo and DualLite it's 0x00907000 to 0x0091. + * - we start at 0x00908000 so as to leave some room for IVT/DCD + * - recommended stack (from IMX6DQRM Figure 8-3) is at 0x0093FFB8 + * - this leaves about 224K for SPL image and stack + */ +#define CONFIG_SPL_LDSCRIPT arch/arm/cpu/armv7/mx6/u-boot-spl.lds +#define CONFIG_SPL_TEXT_BASE 0x00908000 +#define CONFIG_SPL_MAX_SIZE(128 * 1024) This should be a smaller value if we want this config to apply for i.MX6 Solo and DualLite, which have a 68KB OCRAM free area. Hi Nikita, Agreed - I just discovered this yesterday. I had tested on an IMX6DL/SOLO via boot from OTG, but I had not tested those combinations when booting from flash and indeed they failed. The 68KB OCRAM free area also assumes that you start at 0x00907000 and as we start at 0x00908000 to leave room for the IVT+DCD this becomes 65KB +#define CONFIG_SPL_START_S_PATHarch/arm/cpu/armv7 +#define CONFIG_SPL_STACK 0x0093FFB8 For i.MX6 Solo and DualLite this address should be lower (recommended address is 0x0091FFB8). Agreed +#define CONFIG_SPL_LIBCOMMON_SUPPORT +#define CONFIG_SPL_LIBGENERIC_SUPPORT +#define CONFIG_SPL_SERIAL_SUPPORT +#define CONFIG_SPL_I2C_SUPPORT +#define CONFIG_SPL_GPIO_SUPPORT + +/* NAND support */ +#if defined(CONFIG_SPL_NAND_SUPPORT) +#define CONFIG_SPL_NAND_MXS +#define CONFIG_SPL_NAND_BASE +#define CONFIG_SPL_DMA_SUPPORT +#endif -- Regards, Nikita. This presents another challenge for SPL NAND as currently my SPL is ~70K. There is a lot of unnecessary code in the mtd nand layer that I'm including because that layer includes support for both read and write (I don't need write for SPL) as well as various NAND types (and I only need BCH). I'm not sure yet what the best approach is to resolve that. I can either: a) add a lot of ifdef's around functions in drivers/mtd/nand/{nand_base.c,nand_bbt.c} to remove NAND write and non BCH support for CONFIG_SPL_BUILD b) re-write the necessary functionality (code duplication) into drivers/mtd/nand/mxs_nand_spl.c Thanks for the review! You're welcome. Let's see if the NAND maintainer can offer some suggestions. Cc-ing Scott Wood Tim -- Regards, Nikita. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 09/11] IMX: add additional function for pinmux using an array
On 04/09/2014 06:40 PM, Tim Harvey wrote: On Wed, Apr 9, 2014 at 7:56 AM, Nikita Kiryanov nik...@compulab.co.il wrote: Hi Tim, On 04/03/2014 09:01 AM, Tim Harvey wrote: Add new function that can take an array of iomux configs, an index, and a stride to allow a multi-dimentional array of pinmux values to be used to define pinmux values per cpu-type. This takes a different approach to previously proposed solutions which used multiple arrays of pad lists. The goal is to eliminate having these multiple arrays such as 'mx6q_uart1_pads' and 'mx6dl_uart1_pads' which are almost identical copies of each other except for the MX6Q/MX6DL prefix on the PAD. I like this approach, but I think you should also define the IOMUX, SETUP_PAD, and SETUP_PADS macros from patch 10 in this file, as they (macros and function) are clearly meant to be used together. I agree with this. Do the macro names IOMUX, SETUP_PAD, SETUP_PADS make sense? My suggestion would be MX6QDL_DDR_IOMUX, MX6QDL_DDR_SETUP_PADS, and MX6QDL_SETUP_PAD (this last one is not DDR specific). -- Regards, Nikita. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 07/11] MX6: use macro building for MX6Q/MX6DL iomux regs
On 04/10/2014 05:08 PM, Nikita Kiryanov wrote: On 04/09/2014 06:46 PM, Tim Harvey wrote: On Wed, Apr 9, 2014 at 7:57 AM, Nikita Kiryanov nik...@compulab.co.il wrote: Hi Tim, On 04/03/2014 09:01 AM, Tim Harvey wrote: This is an attempt at using a macro to allow mx6dl-ddr.h and mx6q-ddr.h registers to be used together which is needed for an SPL bootloader that can run on either CPU's and must configure MMDC iomux dynamically. I am trying to come up with a solution similar to Eric's approach with the similar issue regarding IMX pinmux but this approach is broken in that imximage will choke on the cfgtmp file due to the fact that the pre-processor won't use the enum's as it did the #defines. I'm looking for some positive suggestions here or perhaps someone else can come up with a solution for this particular issue which I haven't been able to resolve. Why can't you just rename the register name #defines without enclosing them in an anonymous enum? Then they could coexist and will be usable by imximage. -- Regards, Nikita. Nikita, The cfg files are currently all written to use the IOMUX register names as MX6_ (no Q vs DL) so that a single cfg file can be used for a build-time configuration of IMX6Q or IMX6DL. OK now I understand. It seems to me that you only have this problem because you are using these address #defines as values for mx6_mmdc_ioregs structs to define a register mapping. You can also define this mapping by using a struct template that matches the register layout and a base address, both of which change between CPU types. You can find an example of this in the Wandboard SPL implementation. Here I'm referring to the file arch/arm/include/asm/arch-mx6/mx6_ddr_regs.h (which I'm guessing you may have already seen based on your comment on patch 11...) It's not in mainline ATM so you'll have to download their BSP. The template + base addr method also doesn't use up additional memory to define this layout, which is a point in its favor. Regards, Tim -- Regards, Nikita. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] board/freescale/mx6slevk: Add support for SPI NOR on the Freescale MCIMX6SLEVK Board
I hope this email is now in the right format. Hi All, I am trying to add support for the SPI NOR device on the Freescale MCIMX6SLEVK Board. I have created a patch that should enable support but the u-boot probe command still does not find the device. The process fails during the ECSPI transfer. I have tried the following patch to the latest git master of u-boot: http://pastebin.com/hamK7Ybb U-Boot Output: = sf probe SF: Unsupported flash IDs: manuf 00, jedec , ext_jedec Failed to initialize SPI flash at 0:27392 Does anyone have any insight as to why the Probe may be failing? I modeled the changes on the mx6sabresd board. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] board/freescale/mx6slevk: Add support for SPI NOR on the Freescale MCIMX6SLEVK Board
On Thu, Apr 10, 2014 at 12:05 PM, Sam Catch dsblue.s...@gmail.com wrote: I hope this email is now in the right format. Hi All, I am trying to add support for the SPI NOR device on the Freescale MCIMX6SLEVK Board. I have created a patch that should enable support but the u-boot probe command still does not find the device. The process fails during the ECSPI transfer. I have tried the following patch to the latest git master of u-boot: http://pastebin.com/hamK7Ybb U-Boot Output: = sf probe SF: Unsupported flash IDs: manuf 00, jedec , ext_jedec Failed to initialize SPI flash at 0:27392 Does anyone have any insight as to why the Probe may be failing? I modeled the changes on the mx6sabresd board. I see the same error here. I measured with a scope and the chip select signal behaves very differently compared to the mx6qsabresd board. When I do 'sf probe' on a mx6qsabresd the chip select line stays low for 10us and then stays high. On mx6slevk the chip select line stays low for 0.5us, then it goes high, goes low for 2us and they stays high. So there is something very wrong with the timings on mx6sl, but I haven't had a chance to debug this yet. Regards, Fabio Estevam ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] How can I save U-Boot env vars to HUSH shell vars.
Dear Wolfgang, With your help, I have satisfied my need. On 04/09/2014 11:52 PM, Wolfgang Denk wrote: Dear James, In message 5345d493.4080...@gmail.com you wrote: Heh. As soon as you have to change _any_ code, you can as well upgrade. I was hoping (in vain perhaps) to do my work modifying only the environment. Yes, I understand this. But I have to admit that I don't see an easy way. Hm... thinking about it, you _can_ do this, but it's a bit ugly... POC code: = print ethaddr ipaddr serverip ethaddr=00:10:ec:01:08:84 ipaddr=192.168.100.6 serverip=192.168.1.1 = echo E=$foo_ethaddr I=$foo_ipaddr S=$foo_serverip E= I= S= = setenv setvar 'setenv tmp foo_$arg=$$arg' = for arg in ethaddr ipaddr serverip ; do run setvar run tmp echo E=$foo_ethaddr I=$foo_ipaddr S=$foo_serverip done E=00:10:ec:01:08:84 I= S= E=00:10:ec:01:08:84 I=192.168.100.6 S= E=00:10:ec:01:08:84 I=192.168.100.6 S=192.168.1.1 As you can see, I'm useing a two-step approach to first constuct a command and then to run it. This consumes 2 environment variables (tmp and arg), but this should be an acceptable price... Extending this a bit further to include yet another env var, I have the following that allows a list to be saved and restored. = setenv setvar 'setenv tmp v_$arg=$$arg' = setenv usevar 'setenv t v_$arg;setenv tmp setenv $arg $$t' = And testing these: = setenv list ipaddr ethaddr list = printenv ipaddr ethaddr ipaddr=10.3.134.80 ethaddr=00:00:17:88:09:36 = = # to save = for arg in $list; do run setvar; run tmp; done = showvar HUSH_VERSION=0.01 arg=list v_ipaddr=10.3.134.80 v_ethaddr=00:00:17:88:09:36 v_list=ipaddr ethaddr list = = # simulate env default -f = setenv ethaddr; setenv ipaddr; setenv list = = # to restore (note use of v_list rather than list) = for arg in $v_list; do run usevar; run tmp; done = printenv ipaddr ethaddr list ipaddr=10.3.134.80 ethaddr=00:00:17:88:09:36 list=ipaddr ethaddr list = Perhaps this isn't as nice looking as it could be. But, it does solve the problem at hand, which has value for me. The solution boils down to two definitions in the default environment (setvar and usevar) and then a single script line to save the values and another single script line to restore them. I don't consider this addition burdensome at all. And to paraphrase a former US Sec Def, You code with the tools you have rather than with the tools you might like to have. Setting temporaries to commands that are then executed as a means to getting evaluations done when needed seems like a great addition to the bag of tricks ... The new env command allows for a lot of interesting features, ... I look forward to using these new facilities. And, I appreciate you help very much. Best regards, Jim -- Jim Chargin AJA Video Systems j...@aja.com (530) 271-3334 http://www.aja.com ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH RESEND-WITH-JUSTIFICATION] spi: soft_spi: Support NULL din/dout buffers
This mirrors the conventions used in other SPI drivers (kirkwood, davinci, atmel, et al) where the din/dout buffer can be NULL when the received/transmitted data isn't important. This reduces the need for allocating additional buffers when write-only/read-only functionality is needed. In the din == NULL case, the received data is simply not stored. In the dout == NULL case, zeroes are transmitted. Signed-off-by: Andrew Ruder andrew.ru...@elecsyscorp.com Cc: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com Cc: Jagan Teki jagannadh.t...@gmail.com --- So going through and cleaning up some of my trees and determining which patches have not been taken. A little more justification for this patch - I've gone through all of the current SPI implementations and have determined what (if any) support the driver has for half duplex operation by giving NULL for one of the two buffers (din/dout). This greatly reduces the need for temporary buffers for writing or reading large amounts of half-duplex data to devices over SPI. Here's the list: altera_spi.c - SUPPORTS NULL din or dout andes_spi.c - REQUIRES NULL din or dout armada100_spi.c - SUPPORTS NULL din or dout atmel_spi.c - SUPPORTS NULL din or dout bfin_spi6xx.c - SUPPORTS NULL din or dout bfin_spi.c- SUPPORTS NULL din or dout cf_qspi.c - SUPPORTS NULL din or dout cf_spi.c - SUPPORTS NULL din or dout davinci_spi.c - SUPPORTS NULL din or dout exynos_spi.c - SUPPORTS NULL din or dout fdt_spi.c-tegra20_sf - SUPPORTS NULL din or dout fdt_spi.c-tegra20_sl - SUPPORTS NULL din or dout fdt_spi.c-tegra114- SUPPORTS NULL din or dout fsl_espi.c- SUPPORTS NULL din (NOT dout) ftssp010_spi.c- SUPPORTS NULL din or dout ich.c - SUPPORTS NULL din or dout kirkwood_spi.c- SUPPORTS NULL din or dout mpc52xx_spi.c - NO SUPPORT mpc8xxx_spi.c - NO SUPPORT mxc_spi.c - NO SUPPORT mxs_spi.c - REQUIRES NULL din or dout oc_tiny_spi.c - SUPPORTS NULL din or dout omap3_spi.c - SUPPORTS NULL din or dout sandbox_spi.c - SUPPORTS NULL din or dout sh_qspi.c - SUPPORTS NULL din or dout sh_spi.c - SUPPORTS NULL din or dout soft_spi.c- NO SUPPORT ti_qspi.c - SUPPORTS NULL din or dout xilinx_spi.c - SUPPORTS NULL din or dout zynq_spi.c- SUPPORTS NULL din or dout Furthermore, this would not affect any board already using temporary buffers and it would continue to work as usual. The *only* obscure corner case that this will not work is if NULL (0x0) is a valid buffer address in your system and you are transferring SPI to/from it. This seems very unlikely and would probably break in other ways from library functions that check their arguments. drivers/spi/soft_spi.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/spi/soft_spi.c b/drivers/spi/soft_spi.c index 5d22351..5fdd091 100644 --- a/drivers/spi/soft_spi.c +++ b/drivers/spi/soft_spi.c @@ -137,9 +137,15 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, * Check if it is time to work on a new byte. */ if((j % 8) == 0) { - tmpdout = *txd++; + if (txd) { + tmpdout = *txd++; + } else { + tmpdout = 0; + } if(j != 0) { - *rxd++ = tmpdin; + if (rxd) { + *rxd++ = tmpdin; + } } tmpdin = 0; } @@ -164,9 +170,11 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, * bits over to left-justify them. Then store the last byte * read in. */ - if((bitlen % 8) != 0) - tmpdin = 8 - (bitlen % 8); - *rxd++ = tmpdin; + if (rxd) { + if((bitlen % 8) != 0) + tmpdin = 8 - (bitlen % 8); + *rxd++ = tmpdin; + } if (flags SPI_XFER_END) spi_cs_deactivate(slave); -- 1.9.0.rc3.12.gbc97e2d ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] How can I save U-Boot env vars to HUSH shell vars.
Dear James, In message 5346cdc2.40...@gmail.com you wrote: With your help, I have satisfied my need. I'm happy that I was able to help. Thanks for the summary and your actual code. And, I appreciate you help very much. You are welcome. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de God made the integers; all else is the work of Man. - Kronecker ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH RESEND-WITH-JUSTIFICATION] spi: soft_spi: Support NULL din/dout buffers
I further justify this with a list of drivers that depend on half-duplex SPI operation: drivers/mmc/mmc_spi.c: spi_xfer(spi, 2 * 8, tok, NULL, 0); drivers/mtd/spi/eeprom_m95xxx.c:if (spi_xfer(slave, 8, buf, NULL, SPI_XFER_BEGIN | SPI_XFER_END)) drivers/mtd/spi/sf_ops.c: ret = spi_xfer(spi, 8, NULL, status, 0); drivers/net/e1000_spi.c:return e1000_spi_xfer(hw, 8*sizeof(op), op, NULL, intr); drivers/net/enc28j60.c: spi_xfer(enc-slave, 2 * 8, dout, NULL, drivers/rtc/m41t94.c: ret = spi_xfer(slave, 64, buf, NULL, SPI_XFER_BEGIN | SPI_XFER_END); And an old email first highlighting this issue in 2010 with the soft_spi driver: http://article.gmane.org/gmane.comp.boot-loaders.u-boot/75839/match=soft_spi ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH RESEND-WITH-JUSTIFICATION] spi: soft_spi: Support NULL din/dout buffers
On Thu, Apr 10, 2014 at 9:49 PM, Andrew Ruder andrew.ru...@elecsyscorp.com wrote: This mirrors the conventions used in other SPI drivers (kirkwood, davinci, atmel, et al) where the din/dout buffer can be NULL when the received/transmitted data isn't important. This reduces the need for allocating additional buffers when write-only/read-only functionality is needed. In the din == NULL case, the received data is simply not stored. In the dout == NULL case, zeroes are transmitted. Signed-off-by: Andrew Ruder andrew.ru...@elecsyscorp.com Cc: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com Cc: Jagan Teki jagannadh.t...@gmail.com --- So going through and cleaning up some of my trees and determining which patches have not been taken. A little more justification for this patch - I've gone through all of the current SPI implementations and have determined what (if any) support the driver has for half duplex operation by giving NULL for one of the two buffers (din/dout). This greatly reduces the need for temporary buffers for writing or reading large amounts of half-duplex data to devices over SPI. Here's the list: altera_spi.c - SUPPORTS NULL din or dout andes_spi.c - REQUIRES NULL din or dout armada100_spi.c - SUPPORTS NULL din or dout atmel_spi.c - SUPPORTS NULL din or dout bfin_spi6xx.c - SUPPORTS NULL din or dout bfin_spi.c- SUPPORTS NULL din or dout cf_qspi.c - SUPPORTS NULL din or dout cf_spi.c - SUPPORTS NULL din or dout davinci_spi.c - SUPPORTS NULL din or dout exynos_spi.c - SUPPORTS NULL din or dout fdt_spi.c-tegra20_sf - SUPPORTS NULL din or dout fdt_spi.c-tegra20_sl - SUPPORTS NULL din or dout fdt_spi.c-tegra114- SUPPORTS NULL din or dout fsl_espi.c- SUPPORTS NULL din (NOT dout) ftssp010_spi.c- SUPPORTS NULL din or dout ich.c - SUPPORTS NULL din or dout kirkwood_spi.c- SUPPORTS NULL din or dout mpc52xx_spi.c - NO SUPPORT mpc8xxx_spi.c - NO SUPPORT mxc_spi.c - NO SUPPORT mxs_spi.c - REQUIRES NULL din or dout oc_tiny_spi.c - SUPPORTS NULL din or dout omap3_spi.c - SUPPORTS NULL din or dout sandbox_spi.c - SUPPORTS NULL din or dout sh_qspi.c - SUPPORTS NULL din or dout sh_spi.c - SUPPORTS NULL din or dout soft_spi.c- NO SUPPORT ti_qspi.c - SUPPORTS NULL din or dout xilinx_spi.c - SUPPORTS NULL din or dout zynq_spi.c- SUPPORTS NULL din or dout Furthermore, this would not affect any board already using temporary buffers and it would continue to work as usual. The *only* obscure corner case that this will not work is if NULL (0x0) is a valid buffer address in your system and you are transferring SPI to/from it. This seems very unlikely and would probably break in other ways from library functions that check their arguments. At-least from zynq_spi.c case - I wouldn't find that obscure case as you pointed and even with dout NULL which is status poll from (sf_ops.c). Let me come back again and will show my results for zynq_spi.c It would be great if you mentioned issue scenario for status poll case drivers/mtd/spi/sf_ops.c: ret = spi_xfer(spi, 8, NULL, status, 0); drivers/spi/soft_spi.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/spi/soft_spi.c b/drivers/spi/soft_spi.c index 5d22351..5fdd091 100644 --- a/drivers/spi/soft_spi.c +++ b/drivers/spi/soft_spi.c @@ -137,9 +137,15 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, * Check if it is time to work on a new byte. */ if((j % 8) == 0) { - tmpdout = *txd++; + if (txd) { + tmpdout = *txd++; + } else { + tmpdout = 0; + } if(j != 0) { - *rxd++ = tmpdin; + if (rxd) { + *rxd++ = tmpdin; + } } tmpdin = 0; } @@ -164,9 +170,11 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, * bits over to left-justify them. Then store the last byte * read in. */ - if((bitlen % 8) != 0) - tmpdin = 8 - (bitlen % 8); - *rxd++ = tmpdin; + if (rxd) { + if((bitlen % 8) != 0) + tmpdin = 8 - (bitlen % 8); + *rxd++ = tmpdin; + } if (flags SPI_XFER_END) spi_cs_deactivate(slave); -- 1.9.0.rc3.12.gbc97e2d thanks! -- Jagan.
Re: [U-Boot] [PATCH RESEND-WITH-JUSTIFICATION] spi: soft_spi: Support NULL din/dout buffers
On Fri, Apr 11, 2014 at 12:24:20AM +0530, Jagan Teki wrote: At-least from zynq_spi.c case - I wouldn't find that obscure case as you pointed and even with dout NULL which is status poll from (sf_ops.c). zynq_spi is correct, soft_spi is not. zynq_spi.c: int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout, void *din, unsigned long flags) { const u8 *tx_buf = dout; u8 *rx_buf = din, buf; [...] if (tx_buf) buf = *tx_buf++; else buf = 0; [...] if (rx_buf) *rx_buf++ = buf; [...] It would be great if you mentioned issue scenario for status poll case drivers/mtd/spi/sf_ops.c: ret = spi_xfer(spi, 8, NULL, status, 0); That breaks on soft_spi, hence the patch. Cheers, Andy ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH RESEND-WITH-JUSTIFICATION] spi: soft_spi: Support NULL din/dout buffers
On Fri, Apr 11, 2014 at 12:33:45AM +0530, Jagan Teki wrote: It would be great if you mentioned issue scenario for status poll case drivers/mtd/spi/sf_ops.c: ret = spi_xfer(spi, 8, NULL, status, 0); OK - means issue only with soft_spi.c is it? Yes, and a couple other drivers. Can you share the issue log or typical use case scenario w.r.t soft_spi.c, I need to understand how this got resolved with your change. Yes, you actually posted one such case that will not work correctly with soft_spi. In the line of code you posted above, soft_spi will actually perform a read from address 0x0. In most cases, the read side isn't a huge deal, but on the write side it can cause all kinds of surprises. I understand you assigned '0' when dout is NULL and you took the buf only when din is !NULL. Yes, just handling NULL case to be how most drivers are handling it and how apparently most users of the spi modules (like mtd/spi/sf_ops) are clearly expecting it to work. - Andy ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 2/5] usb: handle NULL table in usb_gadget_get_string
From: Rob Herring r...@kernel.org Allow a NULL table to be passed to usb_gadget_get_string for cases when a string table may not be populated. Signed-off-by: Rob Herring r...@kernel.org --- drivers/usb/gadget/usbstring.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/gadget/usbstring.c b/drivers/usb/gadget/usbstring.c index de5fa3f..8c3ff64 100644 --- a/drivers/usb/gadget/usbstring.c +++ b/drivers/usb/gadget/usbstring.c @@ -108,6 +108,9 @@ usb_gadget_get_string(struct usb_gadget_strings *table, int id, u8 *buf) struct usb_string *s; int len; + if (!table) + return -EINVAL; + /* descriptor 0 has the language id */ if (id == 0) { buf[0] = 4; -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 5/5] beagle: fastboot support
From: Rob Herring r...@kernel.org Signed-off-by: Rob Herring r...@kernel.org --- include/configs/omap3_beagle.h | 5 + 1 file changed, 5 insertions(+) diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h index 0b57421..e070760 100644 --- a/include/configs/omap3_beagle.h +++ b/include/configs/omap3_beagle.h @@ -110,6 +110,11 @@ #define CONFIG_TWL4030_USB 1 #define CONFIG_USB_ETHER #define CONFIG_USB_ETHER_RNDIS +#define CONFIG_USB_GADGET +#define CONFIG_CMD_FASTBOOT +#define CONFIG_ANDROID_BOOT_IMAGE +#define CONFIG_USB_FASTBOOT_VENDOR_ID 0x0451 +#define CONFIG_USB_FASTBOOT_PRODUCT_ID 0xd022 /* USB EHCI */ #define CONFIG_CMD_USB -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 0/5] Android Fastboot support
From: Rob Herring r...@kernel.org I'm reviving the Android Fastboot support after 2+ years since the last posting[1]. The previous postings had some questions about licensing and source of some code. I believe I've traced the history sufficiently that the copyrights and source information are complete and correct. The Android code used or referenced is BSD 2-clause license. This was originally raised by Wolfgang that it was not compatible with GPLv2+. I believe that has since been demonstrated and agreed that the BSD 2-clause license is compatible with u-boot. As far as the history of the code, I have traced that back. The u-boot code started in 2008/2009 by Tom Rix @ Windriver. This initial support was then adopted and extended by TI (eMMC support primarily, not included here) in their OMAP u-boot tree[2]. In 2011, the TI code was used as a basis for upstream patches by Sebastian Siewior @ Linutronix. The code has been rearranged quite a bit since the original, but the content is pretty much the same. Some of the re-arranging left stale or missing copyrights in the v2 version which I have corrected. I've reworked the previous version to make enabling board support more simple including re-using the existing settings for image loading address. I've tested this series on a BeagleBoard. Rob [1] http://lists.denx.de/pipermail/u-boot/2011-November/110557.html [2] http://git.omapzoom.org/?p=repo/u-boot.git;a=commit;h=601ff71c8d46b5e90e13613974a16d10f2006bb3 Rob Herring (3): common: introduce maximum load size usb: handle NULL table in usb_gadget_get_string arm: beagle: enable Android fastboot support Sebastian Siewior (2): image: add support for Android's boot image format usb/gadget: add the fastboot gadget README | 3 + common/Makefile | 3 + common/board_r.c | 1 + common/cmd_bootm.c | 23 +- common/cmd_fastboot.c| 36 +++ common/image-android.c | 84 ++ common/image.c | 37 ++- doc/README.android-fastboot | 86 ++ doc/README.android-fastboot-protocol | 170 +++ drivers/usb/gadget/Makefile | 1 + drivers/usb/gadget/f_fastboot.c | 535 +++ drivers/usb/gadget/g_fastboot.h | 15 + drivers/usb/gadget/u_fastboot.c | 260 + drivers/usb/gadget/usbstring.c | 3 + include/android_image.h | 69 + include/common.h | 1 + include/config_fallbacks.h | 4 + include/configs/omap3_beagle.h | 5 + include/image.h | 13 + include/usb/fastboot.h | 36 +++ 20 files changed, 1379 insertions(+), 6 deletions(-) create mode 100644 common/cmd_fastboot.c create mode 100644 common/image-android.c create mode 100644 doc/README.android-fastboot create mode 100644 doc/README.android-fastboot-protocol create mode 100644 drivers/usb/gadget/f_fastboot.c create mode 100644 drivers/usb/gadget/g_fastboot.h create mode 100644 drivers/usb/gadget/u_fastboot.c create mode 100644 include/android_image.h create mode 100644 include/usb/fastboot.h -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 1/5] common: introduce maximum load size
From: Rob Herring r...@kernel.org Various commands that load images have no checks that a loaded image does not exceed the available RAM space and will happily continue overwriting u-boot or other RAM that should not be touched. Also, some commands such as USB DFU or fastboot need to know the maximum buffer size, but there is no common way to define this. Introduce a global load_size and environment variable loadsize to specify the size. The default is ~0UL which is effectively unlimited. Signed-off-by: Rob Herring r...@kernel.org --- README | 3 +++ common/board_r.c | 1 + common/image.c | 17 + include/common.h | 1 + include/config_fallbacks.h | 4 5 files changed, 26 insertions(+) diff --git a/README b/README index 39e05d3..45c0438 100644 --- a/README +++ b/README @@ -4871,6 +4871,9 @@ List of environment variables (most likely not complete): loadaddr - Default load address for commands like bootp, rarpboot, tftpboot, loadb or diskboot + loadsize - Maximum load size for commands like bootp, + rarpboot, tftpboot, loadb or diskboot + loads_echo - see CONFIG_LOADS_ECHO serverip - TFTP server IP address; needed for tftpboot command diff --git a/common/board_r.c b/common/board_r.c index 8629a65..b420f43 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -451,6 +451,7 @@ static int initr_env(void) /* Initialize from environment */ load_addr = getenv_ulong(loadaddr, 16, load_addr); + load_size = getenv_ulong(loadsize, 16, load_size); #if defined(CONFIG_SYS_EXTBDINFO) #if defined(CONFIG_405GP) || defined(CONFIG_405EP) #if defined(CONFIG_I2CFAST) diff --git a/common/image.c b/common/image.c index 9c6bec5..afbf806 100644 --- a/common/image.c +++ b/common/image.c @@ -396,6 +396,7 @@ static const image_header_t *image_get_ramdisk(ulong rd_addr, uint8_t arch, /*/ #ifndef USE_HOSTCC ulong load_addr = CONFIG_SYS_LOAD_ADDR;/* Default Load Address */ +ulong load_size = CONFIG_SYS_LOAD_SIZE;/* Default Load Size */ ulong save_addr; /* Default Save Address */ ulong save_size; /* Default Save Size (in bytes) */ @@ -415,6 +416,22 @@ static int on_loadaddr(const char *name, const char *value, enum env_op op, } U_BOOT_ENV_CALLBACK(loadaddr, on_loadaddr); +static int on_loadsize(const char *name, const char *value, enum env_op op, + int flags) +{ + switch (op) { + case env_op_create: + case env_op_overwrite: + load_size = simple_strtoul(value, NULL, 16); + break; + default: + break; + } + + return 0; +} +U_BOOT_ENV_CALLBACK(loadsize, on_loadsize); + ulong getenv_bootm_low(void) { char *s = getenv(bootm_low); diff --git a/include/common.h b/include/common.h index cbd3c9e..80f366e 100644 --- a/include/common.h +++ b/include/common.h @@ -342,6 +342,7 @@ void flash_perror (int); intsource (ulong addr, const char *fit_uname); extern ulong load_addr;/* Default Load Address */ +extern ulong load_size;/* Default Load Size (maximum) */ extern ulong save_addr;/* Default Save Address */ extern ulong save_size;/* Default Save Size */ diff --git a/include/config_fallbacks.h b/include/config_fallbacks.h index e6fb47b..92a36f5 100644 --- a/include/config_fallbacks.h +++ b/include/config_fallbacks.h @@ -79,4 +79,8 @@ #define CONFIG_SYS_HZ 1000 #endif +#ifndef CONFIG_SYS_LOAD_SIZE +#define CONFIG_SYS_LOAD_SIZE (~0UL) +#endif + #endif /* __CONFIG_FALLBACKS_H */ -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 5/5] arm: beagle: enable Android fastboot support
From: Rob Herring r...@kernel.org Enable Android Fastboot support on omap3_beagle board. Signed-off-by: Rob Herring r...@kernel.org --- include/configs/omap3_beagle.h | 5 + 1 file changed, 5 insertions(+) diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h index 0b57421..e070760 100644 --- a/include/configs/omap3_beagle.h +++ b/include/configs/omap3_beagle.h @@ -110,6 +110,11 @@ #define CONFIG_TWL4030_USB 1 #define CONFIG_USB_ETHER #define CONFIG_USB_ETHER_RNDIS +#define CONFIG_USB_GADGET +#define CONFIG_CMD_FASTBOOT +#define CONFIG_ANDROID_BOOT_IMAGE +#define CONFIG_USB_FASTBOOT_VENDOR_ID 0x0451 +#define CONFIG_USB_FASTBOOT_PRODUCT_ID 0xd022 /* USB EHCI */ #define CONFIG_CMD_USB -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 3/5] image: add support for Android's boot image format
From: Sebastian Siewior bige...@linutronix.de This patch adds support for the Android boot-image format. The header file is from the Android project and got slightly alterted so the struct + its defines are not generic but have something like a namespace. The header file is from bootloader/legacy/include/boot/bootimg.h. The header parsing has been written from scratch and I looked at bootloader/legacy/usbloader/usbloader.c for some details. The image contains the physical address (load address) of the kernel and ramdisk. This address is considered only for the kernel image. The second image is currently ignored. I haven't found anything that is creating this. v3 (Rob Herring): This is based on http://patchwork.ozlabs.org/patch/126797/ with the following changes: - Rebased to current mainline - Moved android image handling to separate functions in common/image-android.c - s/u8/char/ in header to fix string function warnings - Use SPDX identifiers for licenses - Cleaned-up file source information: android_image.h is from file include/boot/bootimg.h in repository: https://android.googlesource.com/platform/bootable/bootloader/legacy The git commit hash is 4205b865141ff2e255fe1d3bd16de18e217ef06a usbloader.c would be from the same commit, but it does not appear to have been used for any actual code. Cc: Wolfgang Denk w...@denx.de Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de Signed-off-by: Rob Herring r...@kernel.org --- common/Makefile | 1 + common/cmd_bootm.c | 23 +- common/image-android.c | 84 + common/image.c | 20 +--- include/android_image.h | 69 include/image.h | 13 6 files changed, 204 insertions(+), 6 deletions(-) create mode 100644 common/image-android.c create mode 100644 include/android_image.h diff --git a/common/Makefile b/common/Makefile index cecd81a..da208f3 100644 --- a/common/Makefile +++ b/common/Makefile @@ -236,6 +236,7 @@ obj-y += console.o obj-$(CONFIG_CROS_EC) += cros_ec.o obj-y += dlmalloc.o obj-y += image.o +obj-$(CONFIG_ANDROID_BOOT_IMAGE) += image-android.o obj-$(CONFIG_OF_LIBFDT) += image-fdt.o obj-$(CONFIG_FIT) += image-fit.o obj-$(CONFIG_FIT_SIGNATURE) += image-sig.o diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 9751edc..b6c8288 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -223,6 +223,8 @@ static int bootm_find_os(cmd_tbl_t *cmdtp, int flag, int argc, { const void *os_hdr; + images.ep = ~0UL; + /* get kernel image header, start address and length */ os_hdr = boot_get_kernel(cmdtp, flag, argc, argv, images, images.os.image_start, images.os.image_len); @@ -274,6 +276,17 @@ static int bootm_find_os(cmd_tbl_t *cmdtp, int flag, int argc, } break; #endif +#ifdef CONFIG_ANDROID_BOOT_IMAGE + case IMAGE_FORMAT_ANDROID: + images.os.type = IH_TYPE_KERNEL; + images.os.comp = IH_COMP_NONE; + images.os.os = IH_OS_LINUX; + images.ep = images.os.load; + + images.os.end = android_image_get_end(os_hdr); + images.os.load = android_image_get_kload(os_hdr); + break; +#endif default: puts(ERROR: unknown image format type!\n); return 1; @@ -293,7 +306,7 @@ static int bootm_find_os(cmd_tbl_t *cmdtp, int flag, int argc, return 1; } #endif - } else { + } else if (images.ep == ~0UL) { puts(Could not find kernel entry point!\n); return 1; } @@ -1002,6 +1015,14 @@ static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc, images-fit_noffset_os = os_noffset; break; #endif +#ifdef CONFIG_ANDROID_BOOT_IMAGE + case IMAGE_FORMAT_ANDROID: + printf(## Booting Android Image at 0x%08lx ...\n, img_addr); + if (android_image_get_kernel((void *)img_addr, images-verify, +os_data, os_len)) + return NULL; + break; +#endif default: printf(Wrong Image Format for %s command\n, cmdtp-name); bootstage_error(BOOTSTAGE_ID_FIT_KERNEL_INFO); diff --git a/common/image-android.c b/common/image-android.c new file mode 100644 index 000..ec6fb3d --- /dev/null +++ b/common/image-android.c @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2011 Sebastian Andrzej Siewior bige...@linutronix.de + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +#include common.h +#include image.h +#include android_image.h + +static char andr_tmp_str[ANDR_BOOT_ARGS_SIZE + 1]; + +int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify, +ulong *os_data, ulong *os_len) +{ +
[U-Boot] [PATCH v3 4/5] usb/gadget: add the fastboot gadget
From: Sebastian Siewior bige...@linutronix.de This patch contains an implementation of the fastboot protocol on the device side and a little of documentation. The gadget expects the new-style gadget framework. The gadget implements the getvar, reboot, download and reboot commands. What is missing is the flash handling i.e. writting the image to media. v3 (Rob Herring): This is based on http://patchwork.ozlabs.org/patch/126798/ with the following changes: - Rebase to current mainline and updates for current gadget API - Use SPDX identifiers for licenses - Traced the history and added missing copyright to cmd_fastboot.c - Use load_addr/load_size for transfer buffer - Allow vendor strings to be optional - Set vendor/product ID from config defines - Allow Ctrl-C to exit fastboot mode Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de Signed-off-by: Rob Herring r...@kernel.org --- common/Makefile | 2 + common/cmd_fastboot.c| 36 +++ doc/README.android-fastboot | 86 ++ doc/README.android-fastboot-protocol | 170 +++ drivers/usb/gadget/Makefile | 1 + drivers/usb/gadget/f_fastboot.c | 535 +++ drivers/usb/gadget/g_fastboot.h | 15 + drivers/usb/gadget/u_fastboot.c | 260 + include/usb/fastboot.h | 36 +++ 9 files changed, 1141 insertions(+) create mode 100644 common/cmd_fastboot.c create mode 100644 doc/README.android-fastboot create mode 100644 doc/README.android-fastboot-protocol create mode 100644 drivers/usb/gadget/f_fastboot.c create mode 100644 drivers/usb/gadget/g_fastboot.h create mode 100644 drivers/usb/gadget/u_fastboot.c create mode 100644 include/usb/fastboot.h diff --git a/common/Makefile b/common/Makefile index da208f3..fe1d8b9 100644 --- a/common/Makefile +++ b/common/Makefile @@ -167,6 +167,8 @@ obj-y += cmd_usb.o obj-y += usb.o usb_hub.o obj-$(CONFIG_USB_STORAGE) += usb_storage.o endif +obj-$(CONFIG_CMD_FASTBOOT) += cmd_fastboot.o + obj-$(CONFIG_CMD_USB_MASS_STORAGE) += cmd_usb_mass_storage.o obj-$(CONFIG_CMD_THOR_DOWNLOAD) += cmd_thordown.o obj-$(CONFIG_CMD_XIMG) += cmd_ximg.o diff --git a/common/cmd_fastboot.c b/common/cmd_fastboot.c new file mode 100644 index 000..fc8d9e0 --- /dev/null +++ b/common/cmd_fastboot.c @@ -0,0 +1,36 @@ +/* + * Copyright 2008 - 2009 Windriver, www.windriver.com + * Author: Tom Rix tom@windriver.com + * + * SPDX-License-Identifier:GPL-2.0+ + */ +#include common.h +#include command.h +#include usb/fastboot.h + +static int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) +{ + int ret = 1; + + if (!fastboot_init()) { + printf(Fastboot entered...\n); + + ret = 0; + + while (1) { + if (fastboot_poll()) + break; + if (ctrlc()) + break; + } + } + + fastboot_shutdown(); + return ret; +} + +U_BOOT_CMD( + fastboot, 1, 1, do_fastboot, + fastboot - enter USB Fastboot protocol, + +); diff --git a/doc/README.android-fastboot b/doc/README.android-fastboot new file mode 100644 index 000..4b2a9aa --- /dev/null +++ b/doc/README.android-fastboot @@ -0,0 +1,86 @@ +Android Fastboot + + +Overview + +The protocol that is used over USB is described in +README.android-fastboot-protocol in same folder. + +The current implementation does not yet support the flash and erase +commands. + +Client installation +=== +The counterpart to this gadget is the fastboot client which can +be found in Android's platform/system/core repository in the fastboot +folder. It runs on Windows, Linux and even OSx. Linux user are lucky since +they only need libusb. +Windows users need to bring some time until they have Android SDK (currently +http://dl.google.com/android/installer_r12-windows.exe) installed. You +need to install ADB package which contains the required glue libraries for +accessing USB. Also you need Google USB driver package and SDK platform +tools. Once installed the usb driver is placed in your SDK folder under +extras\google\usb_driver. The android_winusb.inf needs a line like + + %SingleBootLoaderInterface% = USB_Install, USB\VID_0451PID_D022 + +either in the [Google.NTx86] section for 32bit Windows or [Google.NTamd64] +for 64bit Windows. VID and PID should match whatever the fastboot is +advertising. + +Board specific +== +The gadget calls at probe time the function fastboot_board_init() which +should be provided by the board to setup its specific configuration. +It is possible here to overwrite specific strings like Vendor or Serial +number. Strings which are not specified here will return a default value. +This init function must also provide a memory area for the +transfer_buffer and its size. This
Re: [U-Boot] [PATCH 5/5] beagle: fastboot support
On Thu, Apr 10, 2014 at 2:18 PM, Rob Herring robherri...@gmail.com wrote: From: Rob Herring r...@kernel.org Signed-off-by: Rob Herring r...@kernel.org Oops. Ignore this one... Rob ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] config: enable CONFIG_API in distro config
From: Rob Herring r...@kernel.org CONFIG_API is needed for u-boot apps such as grub2, so enable it for distro config. Cc: Dennis Gilmore den...@ausil.us Signed-off-by: Rob Herring r...@kernel.org --- include/config_distro_defaults.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/config_distro_defaults.h b/include/config_distro_defaults.h index 5d18a4b..75eb6f5 100644 --- a/include/config_distro_defaults.h +++ b/include/config_distro_defaults.h @@ -30,6 +30,7 @@ #endif #define CONFIG_OF_LIBFDT +#define CONFIG_API #define CONFIG_CMD_BOOTZ #define CONFIG_CMD_DHCP -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 04/11] MX6: add common SPL configuration
On Thu, 2014-04-10 at 17:37 +0300, Nikita Kiryanov wrote: On 04/09/2014 06:32 PM, Tim Harvey wrote: This presents another challenge for SPL NAND as currently my SPL is ~70K. There is a lot of unnecessary code in the mtd nand layer that I'm including because that layer includes support for both read and write (I don't need write for SPL) as well as various NAND types (and I only need BCH). I'm not sure yet what the best approach is to resolve that. I can either: a) add a lot of ifdef's around functions in drivers/mtd/nand/{nand_base.c,nand_bbt.c} to remove NAND write and non BCH support for CONFIG_SPL_BUILD b) re-write the necessary functionality (code duplication) into drivers/mtd/nand/mxs_nand_spl.c Thanks for the review! You're welcome. Let's see if the NAND maintainer can offer some suggestions. Cc-ing Scott Wood While I certainly wouldn't mind someone putting in the effort to slim down the main NAND code, so far we've followed option b when we need a tiny NAND SPL. -Scott ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/2] ARM: highbank: use config_distro_defaults.h
From: Rob Herring r...@kernel.org Adapt highbank to use config_distro_defaults.h and remove the redundant defines. Signed-off-by: Rob Herring r...@kernel.org --- include/configs/highbank.h | 25 ++--- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/include/configs/highbank.h b/include/configs/highbank.h index 7dbee3c..f8794dc 100644 --- a/include/configs/highbank.h +++ b/include/configs/highbank.h @@ -7,15 +7,15 @@ #ifndef __CONFIG_H #define __CONFIG_H +#include config_distro_defaults.h + #define CONFIG_SYS_DCACHE_OFF #define CONFIG_SYS_THUMB_BUILD #define CONFIG_SYS_NO_FLASH -#define CONFIG_OF_LIBFDT #define CONFIG_OF_BOARD_SETUP #define CONFIG_FIT -#define CONFIG_SUPPORT_RAW_INITRD #define CONFIG_SYS_BOOTMAPSZ (16 20) #define CONFIG_SYS_TIMER_RATE (15000/256) @@ -48,35 +48,18 @@ #define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \ CONFIG_SYS_SCSI_MAX_LUN) -#define CONFIG_DOS_PARTITION -#define CONFIG_EFI_PARTITION - #define CONFIG_CALXEDA_XGMAC -/* PXE support */ -#define CONFIG_BOOTP_PXE -#define CONFIG_BOOTP_PXE_CLIENTARCH0x100 -#define CONFIG_BOOTP_VCI_STRINGU-boot.armv7.highbank - /* * Command line configuration. */ #include config_cmd_default.h #define CONFIG_CMD_BDI -#define CONFIG_CMD_BOOTZ -#define CONFIG_CMD_DHCP -#define CONFIG_CMD_ELF #define CONFIG_CMD_MEMORY #define CONFIG_CMD_LOADS #define CONFIG_CMD_SCSI -#define CONFIG_CMD_EXT2 -#define CONFIG_CMD_EXT4 -#define CONFIG_CMD_FAT -#define CONFIG_CMD_PXE -#define CONFIG_MENU -#define CONFIG_BOOTDELAY 2 #define CONFIG_BOOT_RETRY_TIME -1 #define CONFIG_RESET_TO_RETRY #define CONFIG_AUTOBOOT_KEYED @@ -85,14 +68,10 @@ /* * Miscellaneous configurable options */ -#define CONFIG_CMDLINE_EDITING -#define CONFIG_AUTO_COMPLETE -#define CONFIG_SYS_LONGHELP/* undef to save memory */ #define CONFIG_SYS_CBSIZE 1024/* Console I/O Buffer Size */ #define CONFIG_SYS_MAXARGS 16 /* max number of cmd args */ #define CONFIG_SYS_BARGSIZECONFIG_SYS_CBSIZE #define CONFIG_SYS_PROMPT Highbank # -#define CONFIG_SYS_HUSH_PARSER /* Print Buffer Size */ #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ sizeof(CONFIG_SYS_PROMPT)+16) -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 2/2] ARM: highbank: use default prompt
From: Rob Herring r...@kernel.org Since highbank is actually shared between Highbank and Midway platforms, remove the Highbank name from the prompt and use the default. Signed-off-by: Rob Herring r...@kernel.org --- include/configs/highbank.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/configs/highbank.h b/include/configs/highbank.h index f8794dc..a6202cf 100644 --- a/include/configs/highbank.h +++ b/include/configs/highbank.h @@ -71,7 +71,6 @@ #define CONFIG_SYS_CBSIZE 1024/* Console I/O Buffer Size */ #define CONFIG_SYS_MAXARGS 16 /* max number of cmd args */ #define CONFIG_SYS_BARGSIZECONFIG_SYS_CBSIZE -#define CONFIG_SYS_PROMPT Highbank # /* Print Buffer Size */ #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ sizeof(CONFIG_SYS_PROMPT)+16) -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 0/14] Split out code from the enormous main.c
A previous series created a way of using if () instead of #ifdef for controlling feature inclusion in U-Boot. The primary target of that series was common/main.c which is full of #ifdefs. That work was put on hold while the kbuild work was in progress. Since kbuild is now complete, it is time to take another look. However, in the meantime main.c has not improved. It seems like a good idea to try to split the code out a bit, to make it more obvious what is happening in the U-Boot start-up. This series splits main into two main program and a CLI (Command-line interpreter) parts. There are two CLIs - hush and simple, and each is put in its own file, with a new cli.c to unify them. New files are also created for autoboot and bootretry functionality. Overall this series makes it easier to read what is happening in main.c, and also clarifies the parser code. Simon Glass (14): Remove unnecessary use of hush header file Rename hush to cli_hush move CLI prototypes to cli.h and add comments Split out simple parser and readline into separate files Add cli_ prefix to readline functions Move autoboot code to autoboot.c Move command line API into cli.c Move bootretry code into bootretry.c and clean up Rename bootretry functions and remove #ifdefs m68k: powerpc: Clean up do_mdm_init Simplify the main loop main: Hide the hush/simple details inside cli.c main: Make the execution path a little clearer in main.c main: Avoid unncessary strdup()/free() arch/arm/cpu/arm926ejs/kirkwood/cpu.c |1 - arch/arm/cpu/arm926ejs/orion5x/cpu.c |1 - arch/m68k/lib/board.c |7 - arch/powerpc/lib/board.c |8 - board/ait/cam_enc_4xx/cam_enc_4xx.c |4 +- board/amcc/yucca/cmd_yucca.c | 21 +- board/eltec/elppc/misc.c | 15 +- board/eltec/mhpc/mhpc.c | 13 +- board/hymod/hymod.c |8 +- board/hymod/input.c | 14 +- board/keymile/common/common.c |2 +- board/keymile/common/ivm.c|2 +- board/mcc200/auto_update.c|7 +- common/Makefile | 20 +- common/autoboot.c | 303 +++ common/board_r.c | 14 - common/bootretry.c| 59 ++ common/cli.c | 194 + common/{hush.c = cli_hush.c} | 17 +- common/cli_readline.c | 621 ++ common/cli_simple.c | 337 common/cmd_bedbug.c | 29 +- common/cmd_bootm.c|4 - common/cmd_bootmenu.c |1 - common/cmd_dcr.c |3 +- common/cmd_i2c.c | 17 +- common/cmd_mem.c | 17 +- common/cmd_nvedit.c |5 +- common/cmd_pci.c | 13 +- common/main.c | 1527 + common/menu.c |6 +- drivers/ddr/fsl/interactive.c |8 +- include/autoboot.h| 47 + include/bootretry.h | 59 ++ include/cli.h | 149 include/{hush.h = cli_hush.h}|4 +- include/common.h |7 +- 37 files changed, 1917 insertions(+), 1647 deletions(-) create mode 100644 common/autoboot.c create mode 100644 common/bootretry.c create mode 100644 common/cli.c rename common/{hush.c = cli_hush.c} (99%) create mode 100644 common/cli_readline.c create mode 100644 common/cli_simple.c create mode 100644 include/autoboot.h create mode 100644 include/bootretry.h create mode 100644 include/cli.h rename include/{hush.h = cli_hush.h} (93%) -- 1.9.1.423.g4596e3a ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 02/14] Rename hush to cli_hush
Hush is a command-line interpreter, so rename it to make that clearer. Signed-off-by: Simon Glass s...@chromium.org --- board/keymile/common/common.c | 2 +- board/keymile/common/ivm.c | 2 +- common/Makefile| 2 +- common/{hush.c = cli_hush.c} | 4 ++-- common/main.c | 2 +- include/{hush.h = cli_hush.h} | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) rename common/{hush.c = cli_hush.c} (99%) rename include/{hush.h = cli_hush.h} (93%) diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c index f941e44..2ddb3da 100644 --- a/board/keymile/common/common.c +++ b/board/keymile/common/common.c @@ -12,7 +12,7 @@ #include ioports.h #include command.h #include malloc.h -#include hush.h +#include cli_hush.h #include net.h #include netdev.h #include asm/io.h diff --git a/board/keymile/common/ivm.c b/board/keymile/common/ivm.c index f0e91bb..bffc08b 100644 --- a/board/keymile/common/ivm.c +++ b/board/keymile/common/ivm.c @@ -6,7 +6,7 @@ */ #include common.h -#include hush.h +#include cli_hush.h #include i2c.h #include common.h diff --git a/common/Makefile b/common/Makefile index cecd81a..12068ac 100644 --- a/common/Makefile +++ b/common/Makefile @@ -11,7 +11,7 @@ obj-y += main.o obj-y += command.o obj-y += exports.o obj-y += hash.o -obj-$(CONFIG_SYS_HUSH_PARSER) += hush.o +obj-$(CONFIG_SYS_HUSH_PARSER) += cli_hush.o obj-y += s_record.o obj-y += xyzModem.o obj-y += cmd_disk.o diff --git a/common/hush.c b/common/cli_hush.c similarity index 99% rename from common/hush.c rename to common/cli_hush.c index df10267..070519f 100644 --- a/common/hush.c +++ b/common/cli_hush.c @@ -79,7 +79,7 @@ #include malloc.h /* malloc, free, realloc*/ #include linux/ctype.h/* isalpha, isdigit */ #include common.h/* readline */ -#include hush.h +#include cli_hush.h #include command.h/* find_cmd */ #ifndef CONFIG_SYS_PROMPT_HUSH_PS2 #define CONFIG_SYS_PROMPT_HUSH_PS2 @@ -222,7 +222,7 @@ struct child_prog { #endif char **argv;/* program name and arguments */ /* was quoted when parsed; copy of struct o_string.nonnull field */ - int *argv_nonnull; + int *argv_nonnull; #ifdef __U_BOOT__ intargc;/* number of program arguments */ #endif diff --git a/common/main.c b/common/main.c index 8b6f274..2eea9c5 100644 --- a/common/main.c +++ b/common/main.c @@ -14,7 +14,7 @@ #include common.h #include command.h #include fdtdec.h -#include hush.h +#include cli_hush.h #include malloc.h #include menu.h #include post.h diff --git a/include/hush.h b/include/cli_hush.h similarity index 93% rename from include/hush.h rename to include/cli_hush.h index 595303a..4951eef 100644 --- a/include/hush.h +++ b/include/cli_hush.h @@ -5,8 +5,8 @@ * SPDX-License-Identifier:GPL-2.0+ */ -#ifndef _HUSH_H_ -#define _HUSH_H_ +#ifndef _CLI_HUSH_H_ +#define _CLI_HUSH_H_ #define FLAG_EXIT_FROM_LOOP 1 #define FLAG_PARSE_SEMICOLON (1 1)/* symbol ';' is special for parser */ -- 1.9.1.423.g4596e3a ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 07/14] Move command line API into cli.c
We now have a single entry point to the CLI, whether simple or hush. Put this in its own file. Signed-off-by: Simon Glass s...@chromium.org --- common/Makefile | 1 + common/cli.c| 106 common/main.c | 93 - 3 files changed, 107 insertions(+), 93 deletions(-) create mode 100644 common/cli.c diff --git a/common/Makefile b/common/Makefile index b707e39..41b6ef5 100644 --- a/common/Makefile +++ b/common/Makefile @@ -18,6 +18,7 @@ endif # We always have this since drivers/ddr/fs/interactive.c needs it obj-y += cli_simple.o +obj-y += cli.o obj-y += cli_readline.o obj-y += s_record.o obj-y += xyzModem.o diff --git a/common/cli.c b/common/cli.c new file mode 100644 index 000..9cf7ba1 --- /dev/null +++ b/common/cli.c @@ -0,0 +1,106 @@ +/* + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, w...@denx.de. + * + * Add to readline cmdline-editing by + * (C) Copyright 2005 + * JinHua Luo, GuangDong Linux Center, luo.jin...@gd-linux.com + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +#include common.h +#include cli.h +#include cli_hush.h +#include malloc.h + +/* + * Run a command using the selected parser. + * + * @param cmd Command to run + * @param flag Execution flags (CMD_FLAG_...) + * @return 0 on success, or != 0 on error. + */ +int run_command(const char *cmd, int flag) +{ +#ifndef CONFIG_SYS_HUSH_PARSER + /* +* cli_run_command can return 0 or 1 for success, so clean up +* its result. +*/ + if (cli_simple_run_command(cmd, flag) == -1) + return 1; + + return 0; +#else + return parse_string_outer(cmd, + FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP); +#endif +} + +int run_command_list(const char *cmd, int len, int flag) +{ + int need_buff = 1; + char *buff = (char *)cmd; /* cast away const */ + int rcode = 0; + + 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 (need_buff) { + buff = malloc(len + 1); + if (!buff) + return 1; + memcpy(buff, cmd, len); + buff[len] = '\0'; + } +#ifdef CONFIG_SYS_HUSH_PARSER + rcode = parse_string_outer(buff, FLAG_PARSE_SEMICOLON); +#else + /* +* This function will overwrite any \n it sees with a \0, which +* is why it can't work with a const char *. Here we are making +* using of internal knowledge of this function, to avoid always +* doing a malloc() which is actually required only in a case that +* is pretty rare. +*/ + rcode = cli_simple_run_command_list(buff, flag); + if (need_buff) + free(buff); +#endif + + return rcode; +} + +// + +#if defined(CONFIG_CMD_RUN) +int do_run(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ + int i; + + if (argc 2) + return CMD_RET_USAGE; + + for (i = 1; i argc; ++i) { + char *arg; + + arg = getenv(argv[i]); + if (arg == NULL) { + printf(## Error: \%s\ not defined\n, argv[i]); + return 1; + } + + if (run_command(arg, flag) != 0) + return 1; + } + return 0; +} +#endif diff --git a/common/main.c b/common/main.c index 45f1b5c..91a5b18 100644 --- a/common/main.c +++ b/common/main.c @@ -10,7 +10,6 @@ #include common.h #include autoboot.h #include cli.h -#include command.h #include cli_hush.h #include malloc.h #include version.h @@ -90,95 +89,3 @@ void main_loop(void) cli_loop(); #endif /*CONFIG_SYS_HUSH_PARSER*/ } - -// - -/* - * Run a command using the selected parser. - * - * @param cmd Command to run - * @param flag Execution flags (CMD_FLAG_...) - * @return 0 on success, or != 0 on error. - */ -int run_command(const char *cmd, int flag) -{ -#ifndef CONFIG_SYS_HUSH_PARSER - /* -* cli_run_command can return 0 or 1 for success, so clean up -* its result. -*/ - if (cli_simple_run_command(cmd, flag) == -1) - return 1; - - return 0; -#else - return parse_string_outer(cmd, - FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP); -#endif -} - -int run_command_list(const char *cmd, int len, int flag) -{ - int need_buff = 1; - char *buff = (char *)cmd; /* cast away const */ - int rcode = 0;
[U-Boot] [PATCH 03/14] move CLI prototypes to cli.h and add comments
Move the CLI prototypes from common.h to cli.h as part of an effort to reduce the size of common.h. Signed-off-by: Simon Glass s...@chromium.org --- board/ait/cam_enc_4xx/cam_enc_4xx.c | 1 + board/amcc/yucca/cmd_yucca.c| 1 + board/eltec/elppc/misc.c| 1 + board/eltec/mhpc/mhpc.c | 1 + board/hymod/hymod.c | 1 + board/hymod/input.c | 1 + common/cli_hush.c | 1 + common/cmd_bedbug.c | 1 + common/cmd_dcr.c| 1 + common/cmd_i2c.c| 1 + common/cmd_mem.c| 1 + common/cmd_nvedit.c | 1 + common/cmd_pci.c| 1 + common/main.c | 1 + common/menu.c | 1 + drivers/ddr/fsl/interactive.c | 1 + include/cli.h | 102 include/common.h| 4 -- 18 files changed, 118 insertions(+), 4 deletions(-) create mode 100644 include/cli.h diff --git a/board/ait/cam_enc_4xx/cam_enc_4xx.c b/board/ait/cam_enc_4xx/cam_enc_4xx.c index b5cc3ed..7c26ba0 100644 --- a/board/ait/cam_enc_4xx/cam_enc_4xx.c +++ b/board/ait/cam_enc_4xx/cam_enc_4xx.c @@ -8,6 +8,7 @@ */ #include common.h +#include cli.h #include errno.h #include linux/mtd/nand.h #include nand.h diff --git a/board/amcc/yucca/cmd_yucca.c b/board/amcc/yucca/cmd_yucca.c index dc78b73..3257c29 100644 --- a/board/amcc/yucca/cmd_yucca.c +++ b/board/amcc/yucca/cmd_yucca.c @@ -8,6 +8,7 @@ */ #include common.h +#include cli.h #include command.h #include yucca.h #include i2c.h diff --git a/board/eltec/elppc/misc.c b/board/eltec/elppc/misc.c index d80eaba..70d1f9a 100644 --- a/board/eltec/elppc/misc.c +++ b/board/eltec/elppc/misc.c @@ -7,6 +7,7 @@ /* includes */ #include common.h +#include cli.h #include linux/ctype.h #include pci.h #include net.h diff --git a/board/eltec/mhpc/mhpc.c b/board/eltec/mhpc/mhpc.c index f3f564f..ff9e0ab 100644 --- a/board/eltec/mhpc/mhpc.c +++ b/board/eltec/mhpc/mhpc.c @@ -14,6 +14,7 @@ * SPDX-License-Identifier:GPL-2.0+ */ #include common.h +#include cli.h #include linux/ctype.h #include commproc.h #include mpc8xx.h diff --git a/board/hymod/hymod.c b/board/hymod/hymod.c index 5fec914..ea49e26 100644 --- a/board/hymod/hymod.c +++ b/board/hymod/hymod.c @@ -8,6 +8,7 @@ */ #include common.h +#include cli.h #include mpc8260.h #include mpc8260_irq.h #include ioports.h diff --git a/board/hymod/input.c b/board/hymod/input.c index 184902c..23d3f19 100644 --- a/board/hymod/input.c +++ b/board/hymod/input.c @@ -6,6 +6,7 @@ */ #include common.h +#include cli.h int hymod_get_serno (const char *prompt) diff --git a/common/cli_hush.c b/common/cli_hush.c index 070519f..48cec88 100644 --- a/common/cli_hush.c +++ b/common/cli_hush.c @@ -79,6 +79,7 @@ #include malloc.h /* malloc, free, realloc*/ #include linux/ctype.h/* isalpha, isdigit */ #include common.h/* readline */ +#include cli.h #include cli_hush.h #include command.h/* find_cmd */ #ifndef CONFIG_SYS_PROMPT_HUSH_PS2 diff --git a/common/cmd_bedbug.c b/common/cmd_bedbug.c index 77b6e3e..f1a70ef 100644 --- a/common/cmd_bedbug.c +++ b/common/cmd_bedbug.c @@ -3,6 +3,7 @@ */ #include common.h +#include cli.h #include command.h #include linux/ctype.h #include net.h diff --git a/common/cmd_dcr.c b/common/cmd_dcr.c index 896f79f..c5bcb8b 100644 --- a/common/cmd_dcr.c +++ b/common/cmd_dcr.c @@ -10,6 +10,7 @@ */ #include common.h +#include cli.h #include config.h #include command.h diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c index ebce7d4..8ccde68 100644 --- a/common/cmd_i2c.c +++ b/common/cmd_i2c.c @@ -66,6 +66,7 @@ */ #include common.h +#include cli.h #include command.h #include edid.h #include environment.h diff --git a/common/cmd_mem.c b/common/cmd_mem.c index 5b03c2d..4b8738b 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -12,6 +12,7 @@ */ #include common.h +#include cli.h #include command.h #ifdef CONFIG_HAS_DATAFLASH #include dataflash.h diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index c53601c..99a21b2 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -25,6 +25,7 @@ */ #include common.h +#include cli.h #include command.h #include environment.h #include search.h diff --git a/common/cmd_pci.c b/common/cmd_pci.c index d3e7c08..ddda207 100644 --- a/common/cmd_pci.c +++ b/common/cmd_pci.c @@ -14,6 +14,7 @@ */ #include common.h +#include cli.h #include command.h #include asm/processor.h #include asm/io.h diff --git a/common/main.c b/common/main.c index 2eea9c5..815759a 100644 --- a/common/main.c +++ b/common/main.c @@ -12,6 +12,7 @@ /* #define DEBUG */ #include common.h +#include cli.h #include command.h #include fdtdec.h #include cli_hush.h diff --git a/common/menu.c b/common/menu.c index
[U-Boot] [PATCH 04/14] Split out simple parser and readline into separate files
It doesn't make sense to have the simple parser and the readline code all in main. Split them out into separate files. Signed-off-by: Simon Glass s...@chromium.org --- common/Makefile |9 +- common/cli_readline.c | 670 common/cli_simple.c | 338 common/main.c | 1017 + include/cli.h |5 + 5 files changed, 1026 insertions(+), 1013 deletions(-) create mode 100644 common/cli_readline.c create mode 100644 common/cli_simple.c diff --git a/common/Makefile b/common/Makefile index 12068ac..44967ea 100644 --- a/common/Makefile +++ b/common/Makefile @@ -11,7 +11,14 @@ obj-y += main.o obj-y += command.o obj-y += exports.o obj-y += hash.o -obj-$(CONFIG_SYS_HUSH_PARSER) += cli_hush.o +ifdef CONFIG_SYS_HUSH_PARSER +obj-y += cli_hush.o +endif + +# We always have this since drivers/ddr/fs/interactive.c needs it +obj-y += cli_simple.o + +obj-y += cli_readline.o obj-y += s_record.o obj-y += xyzModem.o obj-y += cmd_disk.o diff --git a/common/cli_readline.c b/common/cli_readline.c new file mode 100644 index 000..cea0b7c --- /dev/null +++ b/common/cli_readline.c @@ -0,0 +1,670 @@ +/* + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, w...@denx.de. + * + * Add to readline cmdline-editing by + * (C) Copyright 2005 + * JinHua Luo, GuangDong Linux Center, luo.jin...@gd-linux.com + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +#include common.h +#include cli.h +#include watchdog.h + +DECLARE_GLOBAL_DATA_PTR; + +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; /* must be set, default is instant timeout */ +static int retry_time = -1; /* -1 so can call readline before main_loop */ +#endif + +char console_buffer[CONFIG_SYS_CBSIZE + 1];/* console I/O buffer */ + +#ifndef CONFIG_BOOT_RETRY_MIN +#define CONFIG_BOOT_RETRY_MIN CONFIG_BOOT_RETRY_TIME +#endif + +static char *delete_char (char *buffer, char *p, int *colp, int *np, int plen) +{ + char *s; + + if (*np == 0) + return p; + + if (*(--p) == '\t') { /* will retype the whole line */ + while (*colp plen) { + puts(erase_seq); + (*colp)--; + } + for (s = buffer; s p; ++s) { + if (*s == '\t') { + puts(tab_seq + ((*colp) 07)); + *colp += 8 - ((*colp) 07); + } else { + ++(*colp); + putc(*s); + } + } + } else { + puts(erase_seq); + (*colp)--; + } + (*np)--; + + return p; +} + +#ifdef CONFIG_CMDLINE_EDITING + +/* + * cmdline-editing related codes from vivi. + * Author: Janghoon Lyu na...@mizi.com + */ + +#define putnstr(str, n)printf(%.*s, (int)n, str) + +#define CTL_CH(c) ((c) - 'a' + 1) +#define CTL_BACKSPACE ('\b') +#define DEL((char)255) +#define DEL7 ((char)127) +#define CREAD_HIST_CHAR('!') + +#define getcmd_putch(ch) putc(ch) +#define getcmd_getch() getc() +#define getcmd_cbeep() getcmd_putch('\a') + +#define HIST_MAX 20 +#define HIST_SIZE CONFIG_SYS_CBSIZE + +static int hist_max; +static int hist_add_idx; +static int hist_cur = -1; +static unsigned hist_num; + +static char *hist_list[HIST_MAX]; +static char hist_lines[HIST_MAX][HIST_SIZE + 1]; /* Save room for NULL */ + +#define add_idx_minus_one() ((hist_add_idx == 0) ? hist_max : hist_add_idx-1) + +static void hist_init(void) +{ + int i; + + hist_max = 0; + hist_add_idx = 0; + hist_cur = -1; + hist_num = 0; + + for (i = 0; i HIST_MAX; i++) { + hist_list[i] = hist_lines[i]; + hist_list[i][0] = '\0'; + } +} + +static void cread_add_to_hist(char *line) +{ + strcpy(hist_list[hist_add_idx], line); + + if (++hist_add_idx = HIST_MAX) + hist_add_idx = 0; + + if (hist_add_idx hist_max) + hist_max = hist_add_idx; + + hist_num++; +} + +static char *hist_prev(void) +{ + char *ret; + int old_cur; + + if (hist_cur 0) + return NULL; + + old_cur = hist_cur; + if (--hist_cur 0) + hist_cur = hist_max; + + if (hist_cur == hist_add_idx) { + hist_cur = old_cur; + ret = NULL; + } else { + ret = hist_list[hist_cur]; + } + + return ret; +} + +static char *hist_next(void) +{ + char *ret; + + if (hist_cur 0) + return NULL; + + if
[U-Boot] [PATCH 12/14] main: Hide the hush/simple details inside cli.c
Move these details from main (which doesn't care which parser is used) to cli.c where they belong. Signed-off-by: Simon Glass s...@chromium.org --- common/cli.c| 22 ++ common/cli_simple.c | 2 +- common/main.c | 16 ++-- include/cli.h | 13 - 4 files changed, 37 insertions(+), 16 deletions(-) diff --git a/common/cli.c b/common/cli.c index 9cf7ba1..4ac9b3f 100644 --- a/common/cli.c +++ b/common/cli.c @@ -104,3 +104,25 @@ int do_run(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return 0; } #endif + +void cli_loop(void) +{ +#ifdef CONFIG_SYS_HUSH_PARSER + parse_file_outer(); + /* This point is never reached */ + for (;;); +#else + cli_simple_loop(); +#endif /*CONFIG_SYS_HUSH_PARSER*/ +} + +void cli_init(void) +{ +#ifdef CONFIG_SYS_HUSH_PARSER + u_boot_hush_start(); +#endif + +#if defined(CONFIG_HUSH_INIT_VAR) + hush_init_var(); +#endif +} diff --git a/common/cli_simple.c b/common/cli_simple.c index bba586e..413c2eb 100644 --- a/common/cli_simple.c +++ b/common/cli_simple.c @@ -256,7 +256,7 @@ int cli_simple_run_command(const char *cmd, int flag) return rc ? rc : repeatable; } -void cli_loop(void) +void cli_simple_loop(void) { static char lastcommand[CONFIG_SYS_CBSIZE] = { 0, }; diff --git a/common/main.c b/common/main.c index d95e5fc..12f6ac4 100644 --- a/common/main.c +++ b/common/main.c @@ -10,7 +10,6 @@ #include common.h #include autoboot.h #include cli.h -#include cli_hush.h #include malloc.h #include version.h @@ -65,13 +64,7 @@ void main_loop(void) 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 + cli_init(); run_preboot_environment_command(); @@ -83,11 +76,6 @@ 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 + cli_loop(); -#endif /*CONFIG_SYS_HUSH_PARSER*/ } diff --git a/include/cli.h b/include/cli.h index 10dbc66..5158976 100644 --- a/include/cli.h +++ b/include/cli.h @@ -14,7 +14,7 @@ * This will return if we get a timeout waiting for a command. See * CONFIG_BOOT_RETRY_TIME. */ -void cli_loop(void); +void cli_simple_loop(void); /** * cli_simple_run_command() - Execute a command with the simple CLI @@ -100,6 +100,17 @@ int cli_readline_into_buffer(const char *const prompt, char *buffer, */ int cli_simple_parse_line(char *line, char *argv[]); +/** + * Go into the command loop + * + * This will return if we get a timeout waiting for a command, but only for + * the simple parser (not hush). See CONFIG_BOOT_RETRY_TIME. + */ +void cli_loop(void); + +/** Set up the command line interpreter ready for action */ +void cli_init(void); + #define endtick(seconds) (get_ticks() + (uint64_t)(seconds) * get_tbclk()) #endif -- 1.9.1.423.g4596e3a ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 14/14] main: Avoid unncessary strdup()/free()
It doesn't seem necessary to use memory allocation in this code. The setenv() will make a copy anyway. Signed-off-by: Simon Glass s...@chromium.org --- common/main.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/common/main.c b/common/main.c index b0d3ea4..ab1f708 100644 --- a/common/main.c +++ b/common/main.c @@ -10,7 +10,6 @@ #include common.h #include autoboot.h #include cli.h -#include malloc.h #include version.h DECLARE_GLOBAL_DATA_PTR; @@ -26,10 +25,9 @@ static void modem_init(void) #ifdef CONFIG_MODEM_SUPPORT debug(DEBUG: main_loop: gd-do_mdm_init=%lu\n, gd-do_mdm_init); if (gd-do_mdm_init) { - char *str = strdup(getenv(mdm_cmd)); + char *str = 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 */ -- 1.9.1.423.g4596e3a ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 01/14] Remove unnecessary use of hush header file
Some files include hush.h but don't actually use it. Remove this where possible. Signed-off-by: Simon Glass s...@chromium.org --- arch/arm/cpu/arm926ejs/kirkwood/cpu.c | 1 - arch/arm/cpu/arm926ejs/orion5x/cpu.c | 1 - board/ait/cam_enc_4xx/cam_enc_4xx.c | 1 - board/mcc200/auto_update.c| 7 +-- common/cmd_bootm.c| 4 common/cmd_bootmenu.c | 1 - 6 files changed, 1 insertion(+), 14 deletions(-) diff --git a/arch/arm/cpu/arm926ejs/kirkwood/cpu.c b/arch/arm/cpu/arm926ejs/kirkwood/cpu.c index d4711c0..0937506 100644 --- a/arch/arm/cpu/arm926ejs/kirkwood/cpu.c +++ b/arch/arm/cpu/arm926ejs/kirkwood/cpu.c @@ -13,7 +13,6 @@ #include asm/io.h #include asm/arch/cpu.h #include asm/arch/kirkwood.h -#include hush.h #define BUFLEN 16 diff --git a/arch/arm/cpu/arm926ejs/orion5x/cpu.c b/arch/arm/cpu/arm926ejs/orion5x/cpu.c index b55c5f0..f88db3b 100644 --- a/arch/arm/cpu/arm926ejs/orion5x/cpu.c +++ b/arch/arm/cpu/arm926ejs/orion5x/cpu.c @@ -15,7 +15,6 @@ #include asm/io.h #include u-boot/md5.h #include asm/arch/cpu.h -#include hush.h #define BUFLEN 16 diff --git a/board/ait/cam_enc_4xx/cam_enc_4xx.c b/board/ait/cam_enc_4xx/cam_enc_4xx.c index 7e1b16a..b5cc3ed 100644 --- a/board/ait/cam_enc_4xx/cam_enc_4xx.c +++ b/board/ait/cam_enc_4xx/cam_enc_4xx.c @@ -9,7 +9,6 @@ #include common.h #include errno.h -#include hush.h #include linux/mtd/nand.h #include nand.h #include miiphy.h diff --git a/board/mcc200/auto_update.c b/board/mcc200/auto_update.c index 2f622b0..43173ce 100644 --- a/board/mcc200/auto_update.c +++ b/board/mcc200/auto_update.c @@ -12,11 +12,6 @@ #include usb.h #include part.h -#ifdef CONFIG_SYS_HUSH_PARSER -#include hush.h -#endif - - #ifdef CONFIG_AUTO_UPDATE #ifndef CONFIG_USB_OHCI @@ -247,7 +242,7 @@ int au_do_update(int idx, long sz) /* parse_string_outer() runs off the end. */ addr[image_get_data_size (hdr)] = 0; addr += 8; - parse_string_outer(addr, FLAG_PARSE_SEMICOLON); + run_command_list(addr, -1, 0); return 0; } diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 9751edc..bfca006 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -32,10 +32,6 @@ #include usb.h #endif -#ifdef CONFIG_SYS_HUSH_PARSER -#include hush.h -#endif - #if defined(CONFIG_OF_LIBFDT) #include libfdt.h #include fdt_support.h diff --git a/common/cmd_bootmenu.c b/common/cmd_bootmenu.c index 163d5b2..5879065 100644 --- a/common/cmd_bootmenu.c +++ b/common/cmd_bootmenu.c @@ -8,7 +8,6 @@ #include command.h #include ansi.h #include menu.h -#include hush.h #include watchdog.h #include malloc.h #include linux/string.h -- 1.9.1.423.g4596e3a ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 11/14] Simplify the main loop
The main loop is easier to follow if the code is grouped into separate functions. Make this change, so that main_loop() is easier to read. Signed-off-by: Simon Glass s...@chromium.org --- common/main.c | 47 ++- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/common/main.c b/common/main.c index 0cb3973..d95e5fc 100644 --- a/common/main.c +++ b/common/main.c @@ -22,14 +22,8 @@ DECLARE_GLOBAL_DATA_PTR; void inline __show_boot_progress (int val) {} void show_boot_progress (int val) __attribute__((weak, alias(__show_boot_progress))); -void main_loop(void) +static void modem_init(void) { -#ifdef CONFIG_PREBOOT - char *p; -#endif - - bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, main_loop); - #ifdef CONFIG_MODEM_SUPPORT debug(DEBUG: main_loop: gd-do_mdm_init=%lu\n, gd-do_mdm_init); if (gd-do_mdm_init) { @@ -40,22 +34,13 @@ void main_loop(void) 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 - +static void run_preboot_environment_command(void) +{ #ifdef CONFIG_PREBOOT + char *p; + p = getenv(preboot); if (p != NULL) { # ifdef CONFIG_AUTOBOOT_KEYED @@ -69,6 +54,26 @@ void main_loop(void) # endif } #endif /* CONFIG_PREBOOT */ +} + +void main_loop(void) +{ + bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, main_loop); + + modem_init(); +#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 + + run_preboot_environment_command(); #if defined(CONFIG_UPDATE_TFTP) update_tftp(0UL); -- 1.9.1.423.g4596e3a ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 10/14] m68k: powerpc: Clean up do_mdm_init
This code seems unnecessarily complex. We really just need to check the global_data. Now that is it all in one place, and not arch-specific, this is pretty easy. Signed-off-by: Simon Glass s...@chromium.org --- arch/m68k/lib/board.c| 7 --- arch/powerpc/lib/board.c | 8 common/board_r.c | 14 -- common/main.c| 11 --- include/common.h | 1 + 5 files changed, 5 insertions(+), 36 deletions(-) diff --git a/arch/m68k/lib/board.c b/arch/m68k/lib/board.c index e75b6a9..5a853ad 100644 --- a/arch/m68k/lib/board.c +++ b/arch/m68k/lib/board.c @@ -629,13 +629,6 @@ void board_init_r (gd_t *id, ulong dest_addr) } #endif -#ifdef CONFIG_MODEM_SUPPORT - { -extern int do_mdm_init; -do_mdm_init = gd-do_mdm_init; - } -#endif - #ifdef CONFIG_WATCHDOG /* disable watchdog if environment is set */ if ((s = getenv (watchdog)) != NULL) { diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c index f86c6f3..8c0f817 100644 --- a/arch/powerpc/lib/board.c +++ b/arch/powerpc/lib/board.c @@ -976,14 +976,6 @@ void board_init_r(gd_t *id, ulong dest_addr) kbd_init(); #endif -#ifdef CONFIG_MODEM_SUPPORT - { - extern int do_mdm_init; - - do_mdm_init = gd-do_mdm_init; - } -#endif - /* Initialization complete - start the monitor */ /* main_loop() can return to retry autoboot, if so just run it again. */ diff --git a/common/board_r.c b/common/board_r.c index 8629a65..31f90ea 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -703,17 +703,6 @@ static int initr_kbd(void) } #endif -#ifdef CONFIG_MODEM_SUPPORT -static int initr_modem(void) -{ - /* TODO: with new initcalls, move this into the driver */ - extern int do_mdm_init; - - do_mdm_init = gd-do_mdm_init; - return 0; -} -#endif - static int run_main_loop(void) { #ifdef CONFIG_SANDBOX @@ -928,9 +917,6 @@ init_fnc_t init_sequence_r[] = { #ifdef CONFIG_PS2KBD initr_kbd, #endif -#ifdef CONFIG_MODEM_SUPPORT - initr_modem, -#endif run_main_loop, }; diff --git a/common/main.c b/common/main.c index 91a5b18..0cb3973 100644 --- a/common/main.c +++ b/common/main.c @@ -14,17 +14,14 @@ #include malloc.h #include version.h +DECLARE_GLOBAL_DATA_PTR; + /* * Board-specific Platform code can reimplement show_boot_progress () if needed */ void inline __show_boot_progress (int val) {} void show_boot_progress (int val) __attribute__((weak, alias(__show_boot_progress))); -#ifdef CONFIG_MODEM_SUPPORT -int do_mdm_init = 0; -extern void mdm_init(void); /* defined in board.c */ -#endif - void main_loop(void) { #ifdef CONFIG_PREBOOT @@ -34,8 +31,8 @@ void main_loop(void) 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) { + debug(DEBUG: main_loop: gd-do_mdm_init=%lu\n, gd-do_mdm_init); + if (gd-do_mdm_init) { char *str = strdup(getenv(mdm_cmd)); setenv(preboot, str); /* set or delete definition */ if (str != NULL) diff --git a/include/common.h b/include/common.h index fbf3b14..3975e34 100644 --- a/include/common.h +++ b/include/common.h @@ -299,6 +299,7 @@ extern ulong monitor_flash_len; int mac_read_from_eeprom(void); extern u8 __dtb_dt_begin[];/* embedded device tree blob */ int set_cpu_clk_info(void); +int mdm_init(void); #if defined(CONFIG_DISPLAY_CPUINFO) int print_cpuinfo(void); #else -- 1.9.1.423.g4596e3a ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 09/14] Rename bootretry functions and remove #ifdefs
Add a bootretry_ prefix to these two functions, and remove the need for the #ifdef around everything (it moves to the Makefile). Signed-off-by: Simon Glass s...@chromium.org --- board/hymod/hymod.c | 4 +--- board/hymod/input.c | 8 ++-- common/autoboot.c | 6 +- common/bootretry.c | 4 ++-- common/cli_hush.c | 7 +-- common/cli_simple.c | 4 +--- common/cmd_i2c.c| 13 - common/cmd_mem.c| 13 - common/cmd_pci.c| 9 +++-- include/bootretry.h | 38 +- include/cli.h | 3 --- 11 files changed, 52 insertions(+), 57 deletions(-) diff --git a/board/hymod/hymod.c b/board/hymod/hymod.c index f6990e9..0183f78 100644 --- a/board/hymod/hymod.c +++ b/board/hymod/hymod.c @@ -415,13 +415,11 @@ last_stage_init (void) hymod_conf_t *cp = gd-bd-bi_hymod_conf; int rc; -#ifdef CONFIG_BOOT_RETRY_TIME /* * we use the cli_readline() function, but we also want * command timeout enabled */ - init_cmd_timeout (); -#endif + bootretry_init_cmd_timeout(); memset ((void *) cp, 0, sizeof (*cp)); diff --git a/board/hymod/input.c b/board/hymod/input.c index 2f857c0..a9035d3 100644 --- a/board/hymod/input.c +++ b/board/hymod/input.c @@ -16,9 +16,7 @@ hymod_get_serno (const char *prompt) int n, serno; char *p; -#ifdef CONFIG_BOOT_RETRY_TIME - reset_cmd_timeout (); -#endif + bootretry_reset_cmd_timeout(); n = cli_readline(prompt); @@ -44,9 +42,7 @@ hymod_get_ethaddr (void) for (;;) { int n; -#ifdef CONFIG_BOOT_RETRY_TIME - reset_cmd_timeout (); -#endif + bootretry_reset_cmd_timeout(); n = cli_readline(Enter board ethernet address: ); diff --git a/common/autoboot.c b/common/autoboot.c index 5f8d9c3..9843898 100644 --- a/common/autoboot.c +++ b/common/autoboot.c @@ -113,11 +113,9 @@ static int abortboot_keyed(int bootdelay) delaykey[i].retry ? delay : stop); -# ifdef CONFIG_BOOT_RETRY_TIME /* don't retry auto boot */ if (!delaykey[i].retry) bootretry_dont_retry(); -# endif abort = 1; } } @@ -305,9 +303,7 @@ void bootdelay_process(void) #if defined(CONFIG_MENU_SHOW) bootdelay = menu_show(bootdelay); #endif -# ifdef CONFIG_BOOT_RETRY_TIME - init_cmd_timeout(); -# endif/* CONFIG_BOOT_RETRY_TIME */ + bootretry_init_cmd_timeout(); #ifdef CONFIG_POST if (gd-flags GD_FLG_POSTFAIL) { diff --git a/common/bootretry.c b/common/bootretry.c index 12653c0..2d82798 100644 --- a/common/bootretry.c +++ b/common/bootretry.c @@ -21,7 +21,7 @@ static int retry_time = -1; /* -1 so can call readline before main_loop */ /*** * initialize command line timeout */ -void init_cmd_timeout(void) +void bootretry_init_cmd_timeout(void) { char *s = getenv(bootretry); @@ -37,7 +37,7 @@ void init_cmd_timeout(void) /*** * reset command line timeout to retry_time seconds */ -void reset_cmd_timeout(void) +void bootretry_reset_cmd_timeout(void) { endtime = endtick(retry_time); } diff --git a/common/cli_hush.c b/common/cli_hush.c index 2515b69..990c080 100644 --- a/common/cli_hush.c +++ b/common/cli_hush.c @@ -1000,12 +1000,7 @@ static void get_user_input(struct in_str *i) int n; static char the_command[CONFIG_SYS_CBSIZE]; -#ifdef CONFIG_BOOT_RETRY_TIME -# ifndef CONFIG_RESET_TO_RETRY -# error This currently only works with CONFIG_RESET_TO_RETRY enabled -# endif - reset_cmd_timeout(); -#endif + bootretry_reset_cmd_timeout(); i-__promptme = 1; if (i-promptmode == 1) { n = cli_readline(CONFIG_SYS_PROMPT); diff --git a/common/cli_simple.c b/common/cli_simple.c index 5b7e2ce..bba586e 100644 --- a/common/cli_simple.c +++ b/common/cli_simple.c @@ -265,14 +265,12 @@ void cli_loop(void) int rc = 1; for (;;) { -#ifdef CONFIG_BOOT_RETRY_TIME if (rc = 0) { /* Saw enough of a valid command to * restart the timeout. */ - reset_cmd_timeout(); + bootretry_reset_cmd_timeout(); } -#endif len = cli_readline(CONFIG_SYS_PROMPT); flag = 0; /* assume no special flags for now */ diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c index 4fa1213..d714658 100644 --- a/common/cmd_i2c.c +++ b/common/cmd_i2c.c @@
[U-Boot] [PATCH 13/14] main: Make the execution path a little clearer in main.c
bootdelay_process() never returns in some circumstances, whichs makes the control flow confusing. Change it so that the decision about how to execute the boot command is made in the main_loop() code, so it is easier to follow. Move CLI stuff to cli.c. Signed-off-by: Simon Glass s...@chromium.org --- common/autoboot.c | 81 -- common/cli.c | 66 common/main.c | 12 +--- include/autoboot.h | 28 +-- include/cli.h | 33 ++ 5 files changed, 145 insertions(+), 75 deletions(-) diff --git a/common/autoboot.c b/common/autoboot.c index 9843898..dc24cae 100644 --- a/common/autoboot.c +++ b/common/autoboot.c @@ -22,6 +22,9 @@ DECLARE_GLOBAL_DATA_PTR; #define debug_bootkeys(fmt, args...) \ debug_cond(DEBUG_BOOTKEYS, fmt, ##args) +/* Stored value of bootdelay, used by autoboot_command() */ +static int stored_bootdelay; + /*** * Watch for 'delay' seconds for autoboot stop or autoboot delay string. * returns: 0 - no key string, allow autoboot 1 - got key string, abort @@ -205,57 +208,9 @@ static int abortboot(int bootdelay) #endif } -/* - * Runs the given boot command securely. Specifically: - * - Doesn't run the command with the shell (run_command or parse_string_outer), - * since that's a lot of code surface that an attacker might exploit. - * Because of this, we don't do any argument parsing--the secure boot command - * has to be a full-fledged u-boot command. - * - Doesn't check for keypresses before booting, since that could be a - * security hole; also disables Ctrl-C. - * - Doesn't allow the command to return. - * - * Upon any failures, this function will drop into an infinite loop after - * printing the error message to console. - */ - -#if defined(CONFIG_OF_CONTROL) -static void secure_boot_cmd(char *cmd) -{ - cmd_tbl_t *cmdtp; - int rc; - - if (!cmd) { - printf(## Error: Secure boot command not specified\n); - goto err; - } - - /* Disable Ctrl-C just in case some command is used that checks it. */ - disable_ctrlc(1); - - /* Find the command directly. */ - cmdtp = find_cmd(cmd); - if (!cmdtp) { - printf(## Error: \%s\ not defined\n, cmd); - goto err; - } - - /* Run the command, forcing no flags and faking argc and argv. */ - rc = (cmdtp-cmd)(cmdtp, 0, 1, cmd); - - /* Shouldn't ever return from boot command. */ - printf(## Error: \%s\ returned (code %d)\n, cmd, rc); - -err: - /* -* Not a whole lot to do here. Rebooting won't help much, since we'll -* just end up right back here. Just loop. -*/ - hang(); -} - static void process_fdt_options(const void *blob) { +#if defined(CONFIG_OF_CONTROL) ulong addr; /* Add an env variable to point to a kernel payload, if available */ @@ -267,14 +222,11 @@ static void process_fdt_options(const void *blob) addr = fdtdec_get_config_int(gd-fdt_blob, rootdisk-offset, 0); if (addr) setenv_addr(rootaddr, (void *)(CONFIG_SYS_TEXT_BASE + addr)); -} #endif /* CONFIG_OF_CONTROL */ +} -void bootdelay_process(void) +const char *bootdelay_process(void) { -#ifdef CONFIG_OF_CONTROL - char *env; -#endif char *s; int bootdelay; #ifdef CONFIG_BOOTCOUNT_LIMIT @@ -318,27 +270,18 @@ void bootdelay_process(void) } else #endif /* CONFIG_BOOTCOUNT_LIMIT */ 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; process_fdt_options(gd-fdt_blob); + stored_bootdelay = bootdelay; - /* -* 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); - -#endif /* CONFIG_OF_CONTROL */ + return s; +} +void autoboot_command(const char *s) +{ debug(### main_loop: bootcmd=\%s\\n, s ? s : UNDEFINED); - if (bootdelay != -1 s !abortboot(bootdelay)) { + if (stored_bootdelay != -1 s !abortboot(stored_bootdelay)) { #if defined(CONFIG_AUTOBOOT_KEYED) !defined(CONFIG_AUTOBOOT_KEYED_CTRLC) int prev = disable_ctrlc(1);/* disable Control C checking */ #endif diff --git a/common/cli.c b/common/cli.c index 4ac9b3f..ea6bfb3 100644 --- a/common/cli.c +++ b/common/cli.c @@ -12,8 +12,11 @@ #include common.h #include cli.h #include cli_hush.h +#include fdtdec.h #include malloc.h +DECLARE_GLOBAL_DATA_PTR; + /*
[U-Boot] [PATCH 06/14] Move autoboot code to autoboot.c
The autoboot code is complex and long. It deserves its own file with a simple interface from main.c. Signed-off-by: Simon Glass s...@chromium.org --- common/Makefile| 5 + common/autoboot.c | 363 common/main.c | 366 + include/autoboot.h | 23 4 files changed, 393 insertions(+), 364 deletions(-) create mode 100644 common/autoboot.c create mode 100644 include/autoboot.h diff --git a/common/Makefile b/common/Makefile index 44967ea..b707e39 100644 --- a/common/Makefile +++ b/common/Makefile @@ -23,6 +23,11 @@ obj-y += s_record.o obj-y += xyzModem.o obj-y += cmd_disk.o +# This option is not just y/n - it can have a numeric value +ifdef CONFIG_BOOTDELAY +obj-y += autoboot.o +endif + # boards obj-$(CONFIG_SYS_GENERIC_BOARD) += board_f.o obj-$(CONFIG_SYS_GENERIC_BOARD) += board_r.o diff --git a/common/autoboot.c b/common/autoboot.c new file mode 100644 index 000..6933e3f --- /dev/null +++ b/common/autoboot.c @@ -0,0 +1,363 @@ +/* + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, w...@denx.de. + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +#include common.h +#include cli.h +#include fdtdec.h +#include menu.h +#include post.h + +DECLARE_GLOBAL_DATA_PTR; + +#define MAX_DELAY_STOP_STR 32 + +#ifndef DEBUG_BOOTKEYS +#define DEBUG_BOOTKEYS 0 +#endif +#define debug_bootkeys(fmt, args...) \ + debug_cond(DEBUG_BOOTKEYS, fmt, ##args) + +/*** + * 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_AUTOBOOT_KEYED) +static int abortboot_keyed(int bootdelay) +{ + int abort = 0; + uint64_t etime = endtick(bootdelay); + struct { + char *str; + u_int len; + int retry; + } + delaykey[] = { + { str: getenv(bootdelaykey), retry: 1 }, + { str: getenv(bootdelaykey2), retry: 1 }, + { str: getenv(bootstopkey), retry: 0 }, + { str: getenv(bootstopkey2), retry: 0 }, + }; + + char presskey[MAX_DELAY_STOP_STR]; + u_int presskey_len = 0; + u_int presskey_max = 0; + u_int i; + +#ifndef CONFIG_ZERO_BOOTDELAY_CHECK + if (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 + + for (i = 0; i sizeof(delaykey) / sizeof(delaykey[0]); i++) { + delaykey[i].len = delaykey[i].str == NULL ? + 0 : strlen(delaykey[i].str); + delaykey[i].len = delaykey[i].len MAX_DELAY_STOP_STR ? + MAX_DELAY_STOP_STR : delaykey[i].len; + + presskey_max = presskey_max delaykey[i].len ? + presskey_max : delaykey[i].len; + + debug_bootkeys(%s key:%s\n, + delaykey[i].retry ? delay : stop, + delaykey[i].str ? delaykey[i].str : NULL); + } + + /* In order to keep up with incoming data, check timeout only +* when catch up. +*/ + do { + if (tstc()) { + if (presskey_len presskey_max) { + presskey[presskey_len++] = getc(); + } else { + for (i = 0; i presskey_max - 1; i++) + presskey[i] = presskey[i + 1]; + + presskey[i] = getc(); + } + } + + for (i = 0; i sizeof(delaykey) / sizeof(delaykey[0]); i++) { + if (delaykey[i].len 0 + presskey_len = delaykey[i].len + memcmp(presskey + presskey_len - + delaykey[i].len, delaykey[i].str, + delaykey[i].len) == 0) { + debug_bootkeys(got %skey\n, + delaykey[i].retry ? delay : + stop); + +# ifdef
[U-Boot] [PATCH 05/14] Add cli_ prefix to readline functions
This makes it clear where the code resides. Signed-off-by: Simon Glass s...@chromium.org --- board/ait/cam_enc_4xx/cam_enc_4xx.c | 2 +- board/amcc/yucca/cmd_yucca.c| 20 ++-- board/eltec/elppc/misc.c| 14 +++--- board/eltec/mhpc/mhpc.c | 12 ++-- board/hymod/hymod.c | 2 +- board/hymod/input.c | 4 ++-- common/cli_hush.c | 4 ++-- common/cli_readline.c | 7 --- common/cli_simple.c | 6 +++--- common/cmd_bedbug.c | 28 ++-- common/cmd_dcr.c| 2 +- common/cmd_i2c.c| 2 +- common/cmd_mem.c| 2 +- common/cmd_nvedit.c | 4 ++-- common/cmd_pci.c| 2 +- common/menu.c | 5 +++-- drivers/ddr/fsl/interactive.c | 7 --- include/cli.h | 7 --- 18 files changed, 67 insertions(+), 63 deletions(-) diff --git a/board/ait/cam_enc_4xx/cam_enc_4xx.c b/board/ait/cam_enc_4xx/cam_enc_4xx.c index 7c26ba0..9aa1d7a 100644 --- a/board/ait/cam_enc_4xx/cam_enc_4xx.c +++ b/board/ait/cam_enc_4xx/cam_enc_4xx.c @@ -777,7 +777,7 @@ static void ait_menu_read_env(char *name) sprintf(output, %s old: %s value: , name, getenv(name)); memset(cbuf, 0, CONFIG_SYS_CBSIZE); - readret = readline_into_buffer(output, cbuf, 0); + readret = cli_readline_into_buffer(output, cbuf, 0); if (readret = 0) { ret = setenv(name, cbuf); diff --git a/board/amcc/yucca/cmd_yucca.c b/board/amcc/yucca/cmd_yucca.c index 3257c29..c1724bf 100644 --- a/board/amcc/yucca/cmd_yucca.c +++ b/board/amcc/yucca/cmd_yucca.c @@ -52,7 +52,7 @@ static int setBootStrapClock(cmd_tbl_t *cmdtp, int incrflag, int flag, do { printf(enter sys clock frequency 33 or 66 MHz or quit to abort\n); - nbytes = readline ( ? ); + nbytes = cli_readline( ? ); if (strcmp(console_buffer, quit) == 0) return 0; @@ -75,7 +75,7 @@ static int setBootStrapClock(cmd_tbl_t *cmdtp, int incrflag, int flag, printf(enter cpu clock frequency 400, 500, 533 MHz or quit to abort\n); #endif } - nbytes = readline ( ? ); + nbytes = cli_readline( ? ); if (strcmp(console_buffer, quit) == 0) return 0; @@ -119,7 +119,7 @@ static int setBootStrapClock(cmd_tbl_t *cmdtp, int incrflag, int flag, printf(enter plb clock frequency 133, 166 MHz or quit to abort\n); #endif - nbytes = readline ( ? ); + nbytes = cli_readline( ? ); if (strcmp(console_buffer, quit) == 0) return 0; @@ -143,7 +143,7 @@ static int setBootStrapClock(cmd_tbl_t *cmdtp, int incrflag, int flag, do { printf(enter Pci-X clock frequency 33, 66, 100 or 133 MHz or quit to abort\n); - nbytes = readline ( ? ); + nbytes = cli_readline( ? ); if (strcmp(console_buffer, quit) == 0) return 0; @@ -164,13 +164,13 @@ static int setBootStrapClock(cmd_tbl_t *cmdtp, int incrflag, int flag, printf(Pci-X clk = %s MHz\n, pcixClock); do { - printf(\npress [y] to write I2C bootstrap \n); - printf(or [n] to abort. \n); - printf(Don't forget to set board switches \n); - printf(according to your choice before re-starting \n); - printf((refer to 440spe_uboot_kit_um_1_01.pdf) \n); + printf(\npress [y] to write I2C bootstrap\n); + printf(or [n] to abort.\n); + printf(Don't forget to set board switches\n); + printf(according to your choice before re-starting\n); + printf((refer to 440spe_uboot_kit_um_1_01.pdf)\n); - nbytes = readline ( ? ); + nbytes = cli_readline( ? ); if (strcmp(console_buffer, n) == 0) return 0; diff --git a/board/eltec/elppc/misc.c b/board/eltec/elppc/misc.c index 70d1f9a..2acf800 100644 --- a/board/eltec/elppc/misc.c +++ b/board/eltec/elppc/misc.c @@ -114,7 +114,7 @@ int misc_init_r (void) printf (Press key:\n c to copy current revision info to nvram.\n); printf ( r to reenter revision info.\n); printf (= ); - if (0 != readline (NULL)) { + if (0 != cli_readline(NULL)) { switch ((char) toupper (console_buffer[0])) { case 'C': copyNv = 1; @@ -131,7 +131,7 @@ int misc_init_r (void) memcpy (buf, eerev.revision[0][0], 14);
[U-Boot] [PATCH 08/14] Move bootretry code into bootretry.c and clean up
This code is only used by one board, so it seems a shame to clutter up the readline code with it. Move it into its own file. Signed-off-by: Simon Glass s...@chromium.org --- board/hymod/hymod.c | 1 + board/hymod/input.c | 1 + common/Makefile | 5 + common/autoboot.c | 1 + common/bootretry.c| 59 ++ common/cli_hush.c | 1 + common/cli_readline.c | 60 +-- common/cli_simple.c | 1 + common/cmd_i2c.c | 1 + common/cmd_mem.c | 1 + common/cmd_pci.c | 1 + include/bootretry.h | 31 ++ include/common.h | 2 -- 13 files changed, 108 insertions(+), 57 deletions(-) create mode 100644 common/bootretry.c create mode 100644 include/bootretry.h diff --git a/board/hymod/hymod.c b/board/hymod/hymod.c index 55ffd67..f6990e9 100644 --- a/board/hymod/hymod.c +++ b/board/hymod/hymod.c @@ -8,6 +8,7 @@ */ #include common.h +#include bootretry.h #include cli.h #include mpc8260.h #include mpc8260_irq.h diff --git a/board/hymod/input.c b/board/hymod/input.c index 59ad6aa..2f857c0 100644 --- a/board/hymod/input.c +++ b/board/hymod/input.c @@ -6,6 +6,7 @@ */ #include common.h +#include bootretry.h #include cli.h int diff --git a/common/Makefile b/common/Makefile index 41b6ef5..9fdb752 100644 --- a/common/Makefile +++ b/common/Makefile @@ -29,6 +29,11 @@ ifdef CONFIG_BOOTDELAY obj-y += autoboot.o endif +# This option is not just y/n - it can have a numeric value +ifdef CONFIG_BOOT_RETRY_TIME +obj-y += bootretry.o +endif + # boards obj-$(CONFIG_SYS_GENERIC_BOARD) += board_f.o obj-$(CONFIG_SYS_GENERIC_BOARD) += board_r.o diff --git a/common/autoboot.c b/common/autoboot.c index 6933e3f..5f8d9c3 100644 --- a/common/autoboot.c +++ b/common/autoboot.c @@ -6,6 +6,7 @@ */ #include common.h +#include bootretry.h #include cli.h #include fdtdec.h #include menu.h diff --git a/common/bootretry.c b/common/bootretry.c new file mode 100644 index 000..12653c0 --- /dev/null +++ b/common/bootretry.c @@ -0,0 +1,59 @@ +/* + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, w...@denx.de. + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +#include common.h +#include bootretry.h +#include cli.h +#include errno.h +#include watchdog.h + +#ifndef CONFIG_BOOT_RETRY_MIN +#define CONFIG_BOOT_RETRY_MIN CONFIG_BOOT_RETRY_TIME +#endif + +static uint64_t endtime; /* must be set, default is instant timeout */ +static int retry_time = -1; /* -1 so can call readline before main_loop */ + +/*** + * initialize command line timeout + */ +void init_cmd_timeout(void) +{ + char *s = getenv(bootretry); + + if (s != NULL) + retry_time = (int)simple_strtol(s, NULL, 10); + else + retry_time = CONFIG_BOOT_RETRY_TIME; + + if (retry_time = 0 retry_time CONFIG_BOOT_RETRY_MIN) + retry_time = CONFIG_BOOT_RETRY_MIN; +} + +/*** + * reset command line timeout to retry_time seconds + */ +void reset_cmd_timeout(void) +{ + endtime = endtick(retry_time); +} + +int bootretry_tstc_timeout(void) +{ + while (!tstc()) { /* while no incoming data */ + if (retry_time = 0 get_ticks() endtime) + return -ETIMEDOUT; + WATCHDOG_RESET(); + } + + return 0; +} + +void bootretry_dont_retry(void) +{ + retry_time = -1; +} diff --git a/common/cli_hush.c b/common/cli_hush.c index c6bb30b..2515b69 100644 --- a/common/cli_hush.c +++ b/common/cli_hush.c @@ -79,6 +79,7 @@ #include malloc.h /* malloc, free, realloc*/ #include linux/ctype.h/* isalpha, isdigit */ #include common.h/* readline */ +#include bootretry.h #include cli.h #include cli_hush.h #include command.h/* find_cmd */ diff --git a/common/cli_readline.c b/common/cli_readline.c index df446b8..9a9fb35 100644 --- a/common/cli_readline.c +++ b/common/cli_readline.c @@ -10,6 +10,7 @@ */ #include common.h +#include bootretry.h #include cli.h #include watchdog.h @@ -18,17 +19,8 @@ DECLARE_GLOBAL_DATA_PTR; 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; /* must be set, default is instant timeout */ -static int retry_time = -1; /* -1 so can call readline before main_loop */ -#endif - char console_buffer[CONFIG_SYS_CBSIZE + 1];/* console I/O buffer */ -#ifndef CONFIG_BOOT_RETRY_MIN -#define CONFIG_BOOT_RETRY_MIN CONFIG_BOOT_RETRY_TIME -#endif - static char *delete_char (char *buffer, char *p, int *colp, int *np, int plen) { char *s; @@ -267,13 +259,8 @@ static int cread_line(const char *const prompt, char
[U-Boot] [PATCH] arm, da850: staticize funtions
Make funtions static which are locally used in file and remove the declaration from header file. Signed-off-by: Manish Badarkhe badarkhe.man...@gmail.com --- :100644 100644 a38... b91e948... M arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c :100644 100644 7f9c3f6... 45a325c... M arch/arm/include/asm/arch-davinci/da850_lowlevel.h arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c|6 +++--- arch/arm/include/asm/arch-davinci/da850_lowlevel.h |3 --- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c b/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c index a38..b91e948 100644 --- a/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c +++ b/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c @@ -26,7 +26,7 @@ void davinci_enable_uart0(void) } #if defined(CONFIG_SYS_DA850_PLL_INIT) -void da850_waitloop(unsigned long loopcnt) +static void da850_waitloop(unsigned long loopcnt) { unsigned long i; @@ -34,7 +34,7 @@ void da850_waitloop(unsigned long loopcnt) asm( NOP); } -int da850_pll_init(struct davinci_pllc_regs *reg, unsigned long pllmult) +static int da850_pll_init(struct davinci_pllc_regs *reg, unsigned long pllmult) { if (reg == davinci_pllc0_regs) /* Unlock PLL registers. */ @@ -160,7 +160,7 @@ int da850_pll_init(struct davinci_pllc_regs *reg, unsigned long pllmult) #endif /* CONFIG_SYS_DA850_PLL_INIT */ #if defined(CONFIG_SYS_DA850_DDR_INIT) -int da850_ddr_setup(void) +static int da850_ddr_setup(void) { unsigned long tmp; diff --git a/arch/arm/include/asm/arch-davinci/da850_lowlevel.h b/arch/arm/include/asm/arch-davinci/da850_lowlevel.h index 7f9c3f6..45a325c 100644 --- a/arch/arm/include/asm/arch-davinci/da850_lowlevel.h +++ b/arch/arm/include/asm/arch-davinci/da850_lowlevel.h @@ -26,11 +26,8 @@ extern const int lpsc_size; #define dv_maskbits(addr, val) \ writel((readl(addr) val), addr) -void da850_waitloop(unsigned long loopcnt); -int da850_pll_init(struct davinci_pllc_regs *reg, unsigned long pllmult); void da850_lpc_transition(unsigned char pscnum, unsigned char module, unsigned char domain, unsigned char state); -int da850_ddr_setup(void); void da850_psc_init(void); void da850_pinmux_ctl(unsigned long offset, unsigned long mask, unsigned long value); -- 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 10/10][v2] board/t104xrdb: Add support of NAND, SD, SPI boot for T104xRDB
Dear Prabhakar Kushwaha, Prabhakar Kushwaha prabhakar at freescale.com writes: Add support of 2 stage NAND, SD, SPI boot loader using SPL framework. here, PBL initialise the internal SRAM and copy SPL(160KB). This further initialise DDR using SPD and environment and copy u-boot(768 KB) from NAND to DDR. Finally SPL transer control to u-boot. Initialise/create followings required for SPL framework - Add spl.c which defines board_init_f, board_init_r - update tlb and ddr accordingly Signed-off-by: Prabhakar Kushwaha prabhakar at freescale.com I've copied these modifications and changed them for T1040QDS (it's the only board I have). SPL boot does not proceed. SPL stops in spi_xfer() during spi_spl_load_image(). The Data TLB error seems to be caused by an stbx but the register operands contain zeroes. SPL hangs with a Data TLB error at this time CPC-SRAM is also corrupted. There are 4-bytes mangled in the [U-boot SPL] area. Original: 000: 27051956 552d426f 6f742032 3031332e '..VU-Boot 2013. After: 000: 27051956 fffd9584 6f742032 3031332e '..Vot 2013. fffd9584 is the address of trap_init(). These errors also occurs in u-boot-fsl-qoriq tree (2014.04). Tried different compilers from ELDK 5.3, ELDK 5.4 to FSL 1.2. Any ideas on the cause of these errors? All the best, Rommel ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/2] dfu, nand: add medium specific polltimeout function
Hello Lukasz, Am 10.04.2014 16:31, schrieb Lukasz Majewski: Hi Heiko, Hello Lukasz, Am 10.04.2014 12:08, schrieb Lukasz Majewski: Hi Pantelis, Hi Marek, On Apr 10, 2014, at 10:54 AM, Marek Vasut wrote: On Thursday, April 10, 2014 at 07:08:06 AM, Heiko Schocher wrote: add a possibility to add a medium specific polltimeout function. So it is possible to define different poll timeouts. Used on nand medium, for setting the DFU_MANIFEST_POLL_TIMEOUT only on nand ubi partitions, which is currently the only usecase. Signed-off-by: Heiko Schocherh...@denx.de Cc: Lukasz Majewskil.majew...@samsung.com Cc: Kyungmin Parkkyungmin.p...@samsung.com Cc: Marek Vasutma...@denx.de Cc: Pantelis Antonioupa...@antoniou-consulting.com [...] @@ -174,6 +174,17 @@ static void dnload_request_flush(struct usb_ep *ep, struct usb_request *req) req-length, f_dfu-blk_seq_num); } +static void dfu_set_poll_timeout_manifest(struct dfu_status *dstat, + struct f_dfu *f_dfu) +{ + struct dfu_entity *dfu = dfu_get_entity(f_dfu-altsetting); + + if (dfu-poll_timeout) + dfu_set_poll_timeout(dstat, dfu-poll_timeout(dfu)); + else + dfu_set_poll_timeout(dstat, DFU_MANIFEST_POLL_TIMEOUT); +} Don't you think it'd be better (yet more intrusive) to have all the DFU users have default implementation of dfu-poll_timeout() ? Then you'd be able to avoid this if and even get rid of this dfu_set_poll_timeout_manifest() function. Could work, but why not a simple accessor like this: static inline unsigned int dfu_get_poll_timeout(struct dfu_entity *dfu) { return dfu-poll_timeout ? dfu-poll_timeout(dfu); DFU_MANIFEST_POLL_TIMEOUT); } and dfu_set_poll_timeout(dstat, dfu_get_poll_timeout(dfu)); You even get the benefit of have a method to read the timeout value if we ever needed sometime in the future. Seems reasonable for me: +1 Yep, good idea, I change this. Some comment: Guys, please be consistent with CCing people. I didn't receive this thread. Also this original reply from Pantelis was not CCed to Heiko. Hmm.. I lloked in my received EMails, and I see you always on cc ... ? I wasn't added to CC in the original patch 2/2. I was only added to Cc below the Signed-of-by, but then I was missing in the CC of the message itself. Yes, I see ... Hmm.. I sent patches always with git send-mail ... Header I got: From - Thu Apr 10 07:12:33 2014 X-Account-Key: account2 X-UIDL: 1130185039.262989 X-Mozilla-Status: 0001 X-Mozilla-Status2: X-Mozilla-Keys: Return-Path: h...@denx.de Received: from murder ([192.168.8.180]) by backend11 (Cyrus v2.2.12) with LMTPA; Thu, 10 Apr 2014 07:08:28 +0200 X-Sieve: CMU Sieve 2.2 Received: from mail.m-online.net (localhost [127.0.0.1]) by frontend1.mail.m-online.net (Cyrus v2.2.12) with LMTPA; Thu, 10 Apr 2014 07:08:27 +0200 [...] Received: from pollux.denx.de (pollux [192.168.1.1]) by mail.denx.de (Postfix) with ESMTP id D0851342155; Thu, 10 Apr 2014 07:08:08 +0200 (CEST) Received: by pollux.denx.de (Postfix, from userid 515) id 98C9BF6E; Thu, 10 Apr 2014 07:08:08 +0200 (CEST) From: Heiko Schocher h...@denx.de To: u-boot@lists.denx.de Cc: Heiko Schocher h...@denx.de, Lukasz Majewski l.majew...@samsung.com, Kyungmin Park kyungmin.p...@samsung.com, Marek Vasut ma...@denx.de, Pantelis Antoniou pa...@antoniou-consulting.com Subject: [PATCH 2/2] dfu, nand: add medium specific polltimeout function Date: Thu, 10 Apr 2014 07:08:06 +0200 Message-Id: 1397106486-1233-2-git-send-email...@denx.de X-Mailer: git-send-email 1.8.3.1 In-Reply-To: 1397106486-1233-1-git-send-email...@denx.de References: 1397106486-1233-1-git-send-email...@denx.de There you are in the cc list ... but I see, in patchwork: http://patchwork.ozlabs.org/patch/337981/ (click on Headers show) [...] Message-Id: 1397106486-1233-2-git-send-email...@denx.de X-Mailer: git-send-email 1.8.3.1 In-Reply-To: 1397106486-1233-1-git-send-email...@denx.de References: 1397106486-1233-1-git-send-email...@denx.de Cc: Marek Vasut ma...@denx.de, Pantelis Antoniou pa...@antoniou-consulting.com, Kyungmin Park kyungmin.p...@samsung.com Subject: [U-Boot] [PATCH 2/2] dfu, nand: add medium specific polltimeout function There you are missing ... ? bye, Heiko -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 07/11] MX6: use macro building for MX6Q/MX6DL iomux regs
On Thu, Apr 10, 2014 at 7:51 AM, Nikita Kiryanov nik...@compulab.co.il wrote: On 04/10/2014 05:08 PM, Nikita Kiryanov wrote: snip Here I'm referring to the file arch/arm/include/asm/arch-mx6/mx6_ddr_regs.h (which I'm guessing you may have already seen based on your comment on patch 11...) Nikita, Yes, I started with that but I thought from the previous discussion that the structures were disliked. I will revert back to that approach for my v2 patch and see how well its received. Regards, Tim ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCHv3 00/13] mmc: exynos: code cleanup and support DDR mode
If card and host are supported DDR mode, then it can be used the DDR mode. This patch-set has dependency about beomho's patch-set. (Based-on u-boot-samsung repository) It's result for loading image. sdhci controller -5260488 bytes read in 259 ms (19.4 MiB/s) dwmmc controller without DDR mode - 5260488 bytes read in 202 ms (24.8 MiB/s) dwmmc controller with DDR mode - 5260488 bytes read in 118 ms (42.5 MiB/s) Download the 400M image with lthor. sdhci controller - 59.4sec (Avg 6.95 MB/s) dwmmc controller without DDR mode - 61.6sec (Avg 6.72MB/s) dwmmc controller with DDR mode - 60.4sec (Avg 6.85MB/s) Beomho Seo (3): arm: exynos: pinmux: add sdmmc4 gpio configratuion arm: exynos: clock: Remove exynos4x12_set_mmc_clk function board: trats2: Enable device tree on Trats2 Jaehoon Chung (10): ARM: exynos: board: change the mmc/sd init sequence ARM: exynos: clock: modify the set_mmc_clk for exynos4 mmc: exynos_dw_mmc: restore the property into host mmc: remove the unnecessary define and fix the wrong bit control mmc: support the DDR mode for eMMC mmc: dw_mmc: support the DDR mode ARM: dts: exnyos: enable dw-mmc controller mmc: exynos_dw_mmc: enable the DDR mode ARM: exynos4: enable the dwmmc configuration mmc: s5p_sdhci: add the s5p_sdhci_core_init function arch/arm/cpu/armv7/exynos/clock.c | 45 ++- arch/arm/cpu/armv7/exynos/pinmux.c | 18 ++- arch/arm/dts/exynos4.dtsi |8 ++ arch/arm/dts/exynos4412-trats2.dts | 12 ++ arch/arm/include/asm/arch-exynos/clk.h |5 + board/samsung/common/board.c | 13 +- drivers/mmc/dw_mmc.c | 12 +- drivers/mmc/exynos_dw_mmc.c| 209 drivers/mmc/mmc.c | 16 ++- drivers/mmc/s5p_sdhci.c| 42 +++ include/configs/exynos4-dt.h |3 + include/dwmmc.h|5 + include/mmc.h | 25 ++-- 13 files changed, 250 insertions(+), 163 deletions(-) -- 1.7.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCHv3 03/13] board: trats2: Enable device tree on Trats2
From: Beomho Seo beomho@samsung.com This patch add dwmmc emmc controller node on exynos4 and exynos4412 device tree. Signed-off-by: Beomho Seo beomho@samsung.com Signed-off-by: Jaehoon Chung jh80.ch...@samsung.com Tested-by: Piotr Wilczek p.wilc...@samsung.com Cc: Lukasz Majewski l.majew...@samsung.com Cc: Piotr Wilczek p.wilc...@samsung.com Cc: Minkyu Kang mk7.k...@samsung.com --- arch/arm/dts/exynos4.dtsi |8 arch/arm/dts/exynos4412-trats2.dts |8 2 files changed, 16 insertions(+) diff --git a/arch/arm/dts/exynos4.dtsi b/arch/arm/dts/exynos4.dtsi index 71dc7eb..110eb43 100644 --- a/arch/arm/dts/exynos4.dtsi +++ b/arch/arm/dts/exynos4.dtsi @@ -128,6 +128,14 @@ interrupts = 0 78 0; }; + dwmmc@1255 { + #address-cells = 1; + #size-cells = 0; + compatible = samsung,exynos-dwmmc; + reg = 0x1255 0x1000; + interrupts = 0 131 0; + }; + gpio: gpio { gpio-controller; #gpio-cells = 2; diff --git a/arch/arm/dts/exynos4412-trats2.dts b/arch/arm/dts/exynos4412-trats2.dts index 7d32067..438e70e 100644 --- a/arch/arm/dts/exynos4412-trats2.dts +++ b/arch/arm/dts/exynos4412-trats2.dts @@ -31,6 +31,7 @@ console = /serial@1382; mmc0 = sdhci@1251; mmc2 = sdhci@1253; + mmc4 = dwmmc@1255; }; i2c@138d { @@ -431,4 +432,11 @@ sdhci@1254 { status = disabled; }; + + dwmmc@1255 { + samsung,bus-width = 8; + samsung,timing = 0 1 0; + pwr-gpios = gpio 0x2004002 0; + index = 4; + }; }; -- 1.7.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCHv3 01/13] arm: exynos: pinmux: add sdmmc4 gpio configratuion
From: Beomho Seo beomho@samsung.com For use dwmmc controller at exynos4, add SDMMC4 gpio configuration. In case SDMMC2, do not use 8 bit mode at exynos4. Signed-off-by: Beomho Seo beomho@samsung.com Signed-off-by: Jaehoon Chung jh80.ch...@samsung.com Tested-by: Piotr Wilczek p.wilc...@samsung.com Cc: Lukasz Majewski l.majew...@samsung.com Cc: Piotr Wilczek p.wilc...@samsung.com Cc: Minkyu Kang mk7.k...@samsung.com --- arch/arm/cpu/armv7/exynos/pinmux.c | 18 +++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/arch/arm/cpu/armv7/exynos/pinmux.c b/arch/arm/cpu/armv7/exynos/pinmux.c index 9edb475..55c1c95 100644 --- a/arch/arm/cpu/armv7/exynos/pinmux.c +++ b/arch/arm/cpu/armv7/exynos/pinmux.c @@ -632,16 +632,27 @@ static int exynos4_mmc_config(int peripheral, int flags) struct exynos4_gpio_part2 *gpio2 = (struct exynos4_gpio_part2 *)samsung_get_base_gpio_part2(); struct s5p_gpio_bank *bank, *bank_ext; + unsigned int func, func_ext; int i; switch (peripheral) { case PERIPH_ID_SDMMC0: bank = gpio2-k0; bank_ext = gpio2-k1; + func = GPIO_FUNC(0x2); + func_ext = GPIO_FUNC(0x3); break; case PERIPH_ID_SDMMC2: bank = gpio2-k2; bank_ext = gpio2-k3; + func = GPIO_FUNC(0x2); + func_ext = GPIO_FUNC(0x3); + break; + case PERIPH_ID_SDMMC4: + bank = gpio2-k0; + bank_ext = gpio2-k1; + func = GPIO_FUNC(0x3); + func_ext = GPIO_FUNC(0x4); break; default: return -1; @@ -649,13 +660,14 @@ static int exynos4_mmc_config(int peripheral, int flags) for (i = 0; i 7; i++) { if (i == 2) continue; - s5p_gpio_cfg_pin(bank, i, GPIO_FUNC(0x2)); + s5p_gpio_cfg_pin(bank, i, func); s5p_gpio_set_pull(bank, i, GPIO_PULL_NONE); s5p_gpio_set_drv(bank, i, GPIO_DRV_4X); } + /* SDMMC2 do not use 8bit mode at exynos4 */ if (flags PINMUX_FLAG_8BIT_MODE) { for (i = 3; i 7; i++) { - s5p_gpio_cfg_pin(bank_ext, i, GPIO_FUNC(0x3)); + s5p_gpio_cfg_pin(bank_ext, i, func_ext); s5p_gpio_set_pull(bank_ext, i, GPIO_PULL_NONE); s5p_gpio_set_drv(bank_ext, i, GPIO_DRV_4X); } @@ -722,10 +734,10 @@ static int exynos4_pinmux_config(int peripheral, int flags) break; case PERIPH_ID_SDMMC0: case PERIPH_ID_SDMMC2: + case PERIPH_ID_SDMMC4: return exynos4_mmc_config(peripheral, flags); case PERIPH_ID_SDMMC1: case PERIPH_ID_SDMMC3: - case PERIPH_ID_SDMMC4: debug(SDMMC device %d not implemented\n, peripheral); return -1; default: -- 1.7.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCHv3 04/13] ARM: exynos: board: change the mmc/sd init sequence
Exynos4 can be used the dwmmc controller for eMMC. Then it needs to check dwmmc_init() at first. Signed-off-by: Jaehoon Chung jh80.ch...@samsung.com Reviewed-by: Lukasz Majewski l.majew...@samsung.com Tested-by: Lukasz Majewski l.majew...@samsung.com Acked-by: Lukasz Majewski l.majew...@samsung.com --- board/samsung/common/board.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c index de154e0..9dc7c83 100644 --- a/board/samsung/common/board.c +++ b/board/samsung/common/board.c @@ -243,13 +243,6 @@ int board_eth_init(bd_t *bis) int board_mmc_init(bd_t *bis) { int ret; - -#ifdef CONFIG_SDHCI - /* mmc initializattion for available channels */ - ret = exynos_mmc_init(gd-fdt_blob); - if (ret) - debug(mmc init failed\n); -#endif #ifdef CONFIG_DWMMC /* dwmmc initializattion for available channels */ ret = exynos_dwmmc_init(gd-fdt_blob); @@ -257,6 +250,12 @@ int board_mmc_init(bd_t *bis) debug(dwmmc init failed\n); #endif +#ifdef CONFIG_SDHCI + /* mmc initializattion for available channels */ + ret = exynos_mmc_init(gd-fdt_blob); + if (ret) + debug(mmc init failed\n); +#endif return ret; } #endif -- 1.7.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCHv3 05/13] ARM: exynos: clock: modify the set_mmc_clk for exynos4
Modified the mmc_set_clock for eynos4. The goal of this patch is that fsys-div register should be reset. And retore the div-value, not using the value of lowlevel_init. (For using SDMMC4, this patch is needs) Signed-off-by: Jaehoon Chung jh80.ch...@samsung.com Tested-by: Lukasz Majewski l.majew...@samsung.com Acked-by: Lukasz Majewski l.majew...@samsung.com --- arch/arm/cpu/armv7/exynos/clock.c | 16 +++- arch/arm/include/asm/arch-exynos/clk.h |5 + 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/arch/arm/cpu/armv7/exynos/clock.c b/arch/arm/cpu/armv7/exynos/clock.c index 2c2029a..400d134 100644 --- a/arch/arm/cpu/armv7/exynos/clock.c +++ b/arch/arm/cpu/armv7/exynos/clock.c @@ -869,7 +869,7 @@ static void exynos4_set_mmc_clk(int dev_index, unsigned int div) { struct exynos4_clock *clk = (struct exynos4_clock *)samsung_get_base_clock(); - unsigned int addr; + unsigned int addr, clear_bit, set_bit; /* * CLK_DIV_FSYS1 @@ -877,20 +877,26 @@ static void exynos4_set_mmc_clk(int dev_index, unsigned int div) * CLK_DIV_FSYS2 * MMC2_PRE_RATIO [15:8], MMC3_PRE_RATIO [31:24] * CLK_DIV_FSYS3 -* MMC4_PRE_RATIO [15:8] +* MMC4_RATIO [3:0] */ if (dev_index 2) { addr = (unsigned int)clk-div_fsys1; - } else if (dev_index == 4) { + clear_bit = MASK_PRE_RATIO(dev_index); + set_bit = SET_PRE_RATIO(dev_index, div); + } else if (dev_index == 4) { addr = (unsigned int)clk-div_fsys3; dev_index -= 4; + /* MMC4 is controlled with the MMC4_RATIO value */ + clear_bit = MASK_RATIO(dev_index); + set_bit = SET_RATIO(dev_index, div); } else { addr = (unsigned int)clk-div_fsys2; dev_index -= 2; + clear_bit = MASK_PRE_RATIO(dev_index); + set_bit = SET_PRE_RATIO(dev_index, div); } - clrsetbits_le32(addr, 0xff ((dev_index 4) + 8), - (div 0xff) ((dev_index 4) + 8)); + clrsetbits_le32(addr, clear_bit, set_bit); } /* exynos5: set the mmc clock */ diff --git a/arch/arm/include/asm/arch-exynos/clk.h b/arch/arm/include/asm/arch-exynos/clk.h index cdeef32..ffbc07e 100644 --- a/arch/arm/include/asm/arch-exynos/clk.h +++ b/arch/arm/include/asm/arch-exynos/clk.h @@ -16,6 +16,11 @@ #define BPLL 5 #define RPLL 6 +#define MASK_PRE_RATIO(x) (0xff ((x 4) + 8)) +#define MASK_RATIO(x) (0xf (x 4)) +#define SET_PRE_RATIO(x, y)((y 0xff) ((x 4) + 8)) +#define SET_RATIO(x, y)((y 0xf) (x 4)) + enum pll_src_bit { EXYNOS_SRC_MPLL = 6, EXYNOS_SRC_EPLL, -- 1.7.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCHv3 09/13] mmc: dw_mmc: support the DDR mode
Support the DDR mode at dw-mmc controller Signed-off-by: Jaehoon Chung jh80.ch...@samsung.com Tested-by: Lukasz Majewski l.majew...@samsung.com Acked-by: Lukasz Majewski l.majew...@samsung.com --- drivers/mmc/dw_mmc.c | 12 ++-- include/dwmmc.h |3 +++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c index eb4e2be..5bf36a0 100644 --- a/drivers/mmc/dw_mmc.c +++ b/drivers/mmc/dw_mmc.c @@ -284,8 +284,8 @@ static int dwmci_setup_bus(struct dwmci_host *host, u32 freq) static void dwmci_set_ios(struct mmc *mmc) { - struct dwmci_host *host = mmc-priv; - u32 ctype; + struct dwmci_host *host = (struct dwmci_host *)mmc-priv; + u32 ctype, regs; debug(Buswidth = %d, clock: %d\n,mmc-bus_width, mmc-clock); @@ -304,6 +304,14 @@ static void dwmci_set_ios(struct mmc *mmc) dwmci_writel(host, DWMCI_CTYPE, ctype); + regs = dwmci_readl(host, DWMCI_UHS_REG); + if (mmc-card_caps MMC_MODE_DDR_52MHz) + regs |= DWMCI_DDR_MODE; + else + regs = DWMCI_DDR_MODE; + + dwmci_writel(host, DWMCI_UHS_REG, regs); + if (host-clksel) host-clksel(host); } diff --git a/include/dwmmc.h b/include/dwmmc.h index 14c7db8..b67f11b 100644 --- a/include/dwmmc.h +++ b/include/dwmmc.h @@ -123,6 +123,9 @@ #define DWMCI_BMOD_IDMAC_FB(1 1) #define DWMCI_BMOD_IDMAC_EN(1 7) +/* UHS register */ +#define DWMCI_DDR_MODE (1 16) + /* quirks */ #define DWMCI_QUIRK_DISABLE_SMU(1 0) -- 1.7.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCHv3 10/13] ARM: dts: exnyos: enable dw-mmc controller
Enabled the dw-mmc controller. Signed-off-by: Jaehoon Chung jh80.ch...@samsung.com Tested-by: Lukasz Majewski l.majew...@samsung.com Acked-by: Lukasz Majewski l.majew...@samsung.com --- arch/arm/dts/exynos4412-trats2.dts |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm/dts/exynos4412-trats2.dts b/arch/arm/dts/exynos4412-trats2.dts index 438e70e..d27f2bc 100644 --- a/arch/arm/dts/exynos4412-trats2.dts +++ b/arch/arm/dts/exynos4412-trats2.dts @@ -417,6 +417,7 @@ samsung,bus-width = 8; samsung,timing = 1 3 3; pwr-gpios = gpio 0x2004002 0; + status = disabled; }; sdhci@1252 { @@ -435,7 +436,10 @@ dwmmc@1255 { samsung,bus-width = 8; - samsung,timing = 0 1 0; + samsung,timing = 2 1 0; + fifoth_val = 0x203f0040; + bus_hz = 4; + div = 0x3; pwr-gpios = gpio 0x2004002 0; index = 4; }; -- 1.7.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCHv3 06/13] mmc: exynos_dw_mmc: restore the property into host
Restore the platdata(property of dt) into host struct. Then data's information is maintained and reused anywhere. Signed-off-by: Jaehoon Chung jh80.ch...@samsung.com Tested-by: Lukasz Majewski l.majew...@samsung.com Acked-by: Lukasz Majewski l.majew...@samsung.com --- drivers/mmc/exynos_dw_mmc.c | 208 +++ include/dwmmc.h |2 + 2 files changed, 132 insertions(+), 78 deletions(-) diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index e9d00e7..131ff72 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -14,6 +14,7 @@ #include asm/arch/clk.h #include asm/arch/pinmux.h #include asm/gpio.h +#include asm-generic/errno.h #defineDWMMC_MAX_CH_NUM4 #defineDWMMC_MAX_FREQ 5200 @@ -45,6 +46,13 @@ unsigned int exynos_dwmci_get_clk(struct dwmci_host *host) DWMCI_DIVRATIO_MASK) + 1; sclk = get_mmc_clk(host-dev_index); + /* +* Assume to know divider value. +* When clock unit is broken, need to set host-div +*/ + if (host-div) + sclk /= (host-div + 1); + return sclk / clk_div; } @@ -61,26 +69,17 @@ static void exynos_dwmci_board_init(struct dwmci_host *host) } } -/* - * This function adds the mmc channel to be registered with mmc core. - * index - mmc channel number. - * regbase - register base address of mmc channel specified in 'index'. - * bus_width - operating bus width of mmc channel specified in 'index'. - * clksel -value to be written into CLKSEL register in case of FDT. - * NULL in case od non-FDT. - */ -int exynos_dwmci_add_port(int index, u32 regbase, int bus_width, u32 clksel) +static int exynos_dwmci_core_init(struct dwmci_host *host, int index) { - struct dwmci_host *host = NULL; unsigned int div; unsigned long freq, sclk; - host = malloc(sizeof(struct dwmci_host)); - if (!host) { - printf(dwmci_host malloc fail!\n); - return 1; - } + + if (host-bus_hz) + freq = host-bus_hz; + else + freq = DWMMC_MAX_FREQ; + /* request mmc clock vlaue of 52MHz. */ - freq = 5200; sclk = get_mmc_clk(index); /* @@ -94,19 +93,15 @@ int exynos_dwmci_add_port(int index, u32 regbase, int bus_width, u32 clksel) set_mmc_clk(index, div); host-name = EXYNOS DWMMC; - host-ioaddr = (void *)regbase; - host-buswidth = bus_width; #ifdef CONFIG_EXYNOS5420 host-quirks = DWMCI_QUIRK_DISABLE_SMU; #endif host-board_init = exynos_dwmci_board_init; - if (clksel) { - host-clksel_val = clksel; - } else { - if (0 == index) + if (!host-clksel_val) { + if (index == 0) host-clksel_val = DWMMC_MMC0_CLKSEL_VAL; - if (2 == index) + if (index == 2) host-clksel_val = DWMMC_MMC2_CLKSEL_VAL; } @@ -121,77 +116,134 @@ int exynos_dwmci_add_port(int index, u32 regbase, int bus_width, u32 clksel) return 0; } +/* + * This function adds the mmc channel to be registered with mmc core. + * index - mmc channel number. + * regbase - register base address of mmc channel specified in 'index'. + * bus_width - operating bus width of mmc channel specified in 'index'. + * clksel -value to be written into CLKSEL register in case of FDT. + * NULL in case od non-FDT. + */ +int exynos_dwmci_add_port(int index, u32 regbase, int bus_width, u32 clksel) +{ + struct dwmci_host *host = NULL; + + host = malloc(sizeof(struct dwmci_host)); + if (!host) { + error(dwmci_host malloc fail!\n); + return -ENOMEM; + } + + host-ioaddr = (void *)regbase; + host-buswidth = bus_width; + + if (clksel) + host-clksel_val = clksel; + + return exynos_dwmci_core_init(host, index); +} + #ifdef CONFIG_OF_CONTROL -int exynos_dwmmc_init(const void *blob) +struct dwmci_host dwmci_host[DWMMC_MAX_CH_NUM]; + +static int do_dwmci_init(struct dwmci_host *host) { - int index, bus_width; - int node_list[DWMMC_MAX_CH_NUM]; - int err = 0, dev_id, flag, count, i, compat_id; - u32 clksel_val, base, timing[3]; + int index, flag = 0, err = 0; - compat_id = COMPAT_SAMSUNG_EXYNOS_DWMMC; + index = host-dev_index; - count = fdtdec_find_aliases_for_id(blob, mmc, - compat_id, node_list, DWMMC_MAX_CH_NUM); + flag = host-buswidth == 8 ? PINMUX_FLAG_8BIT_MODE : PINMUX_FLAG_NONE; + err = exynos_pinmux_config(host-dev_id, flag); + if (err) { + debug(DWMMC not configure\n); + return err; + } - for (i = 0; i count; i++) { - int node
[U-Boot] [PATCHv3 11/13] mmc: exynos_dw_mmc: enable the DDR mode
Set the ddr mode capability by default. Signed-off-by: Jaehoon Chung jh80.ch...@samsung.com Tested-by: Lukasz Majewski l.majew...@samsung.com Acked-by: Lukasz Majewski l.majew...@samsung.com --- drivers/mmc/exynos_dw_mmc.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index 131ff72..96b5ab6 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -105,6 +105,7 @@ static int exynos_dwmci_core_init(struct dwmci_host *host, int index) host-clksel_val = DWMMC_MMC2_CLKSEL_VAL; } + host-caps = MMC_MODE_DDR_52MHz; host-clksel = exynos_dwmci_clksel; host-dev_index = index; host-get_mmc_clk = exynos_dwmci_get_clk; -- 1.7.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot