Re: [U-Boot] U-Boot public API example desired
This is a reposted and slightly reformatted version of a previous post, please see http://lists.denx.de/pipermail/u-boot/2010-May/071243.html. I did not receive a response to my previous post, so I am trying again. Dear jimc at sdateam.com, In message 8139.1273161587 at sdateam.com you wrote: Is there an example available of the use of the U-Boot public API or of a stand-alone application, that can be, or is, sanctioned by someone who would definitely know (for example, Wolfgang Denk) as being not a derived work? The code in the examples/standalone/ is supposed to provide example code, and doc/README.standalone is supposed to provide documentation. I appreciate the answer, I think this topic has been discussed several times, so thanks for spending time re-visiting it once again. I have looked at both the examples/standalone code and the README.standalone. I've seen several discussions in various mailing lists about these interfaces but I have not seen a definite example that qualifies. It What are these various mailing lists, and what exactluy is not clear to you? I have also seen 1) http://old.nabble.com/-U-Boot--How-to-get-GPL-free-standalone-programs-with-u-boot-td27182861.html 2) http://lists.denx.de/pipermail/u-boot/2009-August/058650.html 3) http://osdir.com/ml/boot-loaders.u-boot/2003-11/msg00072.html 4) http://osdir.com/ml/freebsd.embedded/2008-01/msg00019.html 5) http://old.nabble.com/Re%3A--U-Boot--How-to-get-GPL-free-standalone-programs-with-u-boot-p27338654.html Some of these are forums, rather that mailing lists, I apologize for not being specific in my previous message. Best regards, Wolfgang Denk The part that is not clear to me is if a conclusion has ever been reached as to the availability of a set of GPL-free headers that can be included in a stand-alone application. I think the GPL is quite valuable, but there are situations involving closed-source software where GPL licensed source files must be avoided (I'm sure this is news to nobody). Has such a set of GPL-free headers been developed, or must I develop them myself if I want to use them? In 5) above, you write In message you wrote: I have a question concerning standalone programs based on u-boot and GPL, since I'm not really sure whether the way how the u-boot source files are set up allows GPL free standalone programs. This is the intention; if the current code or documentation should conflict with this intention, it should be fixed. and exports.h should be added to the allowed file list; there should be no need to include common.h. Eventually this needs fixing. Patches are welcome. In the latest U-Boot sources, this issue seems to still exist; headers available for inclusion in stand-alone application seem to include the GPL license language. I can't find equivalent headers that are GPL-free, but maybe I am looking in the wrong place. This last comment includes mention of the allowed file list; I can't locate anything of this nature either. Again, thank you for your time and best regards, Jim -- James E. Chargin Jr. Sierra Design Associates(530) 478-6689 117 New Mohawk Rd, Suite H jimc at sdateam.com [13] Nevada City, CA 95959 USA http:\www.sdateam.com [14] ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] Support for MB86R01 cpu
Hi Matthias, I am going to use u-boot alone for my development. Which debugger is suitable for debugging u-boot and initial board bringup activity? My choice is BDI2000. Is it ok. Also tell me what toolchains need to be used. Is ELDK supports? Whether the video driver is available on u-boot ? -Thirumalai - Original Message - From: Matthias Weißer weiss...@arcor.de To: Thirumalai thirumala...@datapatterns.co.in Cc: u-boot@lists.denx.de Sent: Tuesday, May 18, 2010 11:18 AM Subject: Re: [U-Boot] Support for MB86R01 cpu Hello Thirumalai Am 18.05.2010 07:37, schrieb Thirumalai: Hi Matthias, We are using MB86R01 processor in our design. We just want to know what emulator/debugger can be used for initial board bring-up activity and also whether the latest u-boot(2010.03) is supporting this processor ? I recently posted a patch series adding support for MB86R01 to u-boot. I did not receive any comments on V2 so I thinks its more or less fine and I hope it will be merged within the upcoming merge window. See http://lists.denx.de/pipermail/u-boot/2010-May/071097.html for the initial mail of the patch series. I am using a BDI2000 (http://www.abatron.ch/products/bdi-family.html) for initial flash programming. A Segger JLink (http://www.segger.com/cms/jlink.html) works also. Hope this helped. Matthias ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] CONFIG_SYS_LINUX_LOWMEM_MAX_SIZE
Hi, We are using taishan based board having 1GB DDR. In u-boot code we found that CONFIG_SYS_LINUX_LOWMEM_MAX_SIZE is set to 768MB hence if (size bootm_size) condition becomes true and u-boot throw WARNING: adjusting available memory to 0x3000 message on console. Let me know will it possible to set CONFIG_SYS_LINUX_LOWMEM_MAX_SIZE to 1GB or is there any fix for above warning message? Regards, Anup ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] *** Warning - bad CRC, using default environment
Hi, While using u-boot for ppc440 based board we are getting *** Warning - bad CRC, using default environment message. On denx site we came to know that message is printed because the flash sector or ERPROM containing the environment variables has never been initialized yet. Is there any fix to remove this warning message without passing the saveenv command on u-boot prompt? ~Anup ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2] Add support for LPC2468 from NXP
On 12-05-10 18:09, Wolfgang Denk wrote: I just see that my mail client wrapped the lines again on send. I'll see how I can fix this. I don't think it's a problem right now, I doubt the patch will be completely fine this time. Yes, it is a problem, because I cannot apply it for testing, nur run any automatic checking tools over it. Hi, Yesterday I tried resending my patch using 'git send-email'. I received an aknowledgement from Mailman, but the message didn't show up on the list. Did I do something wrong? Can someone check the Mailman logs? Kind regards, Remco Poelstra ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2] Add support for LPC2468 from NXP
On Tue, 18 May 2010 09:39:54 +0200 Remco Poelstra remco.poels...@duran-audio.com wrote: On 12-05-10 18:09, Wolfgang Denk wrote: I just see that my mail client wrapped the lines again on send. I'll see how I can fix this. I don't think it's a problem right now, I doubt the patch will be completely fine this time. Yes, it is a problem, because I cannot apply it for testing, nur run any automatic checking tools over it. Hi, Yesterday I tried resending my patch using 'git send-email'. I received an aknowledgement from Mailman, but the message didn't show up on the list. Did I do something wrong? Can someone check the Mailman logs? No. You have send your patch two times and both patches showed up on the list. See http://lists.denx.de/pipermail/u-boot/2010-May/071528.html or http://lists.denx.de/pipermail/u-boot/2010-May/071541.html Best regards, Anatolij ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] *** Warning - bad CRC, using default environment
On Tuesday 18 May 2010 09:11:16 anup behare wrote: While using u-boot for ppc440 based board we are getting *** Warning - bad CRC, using default environment message. On denx site we came to know that message is printed because the flash sector or ERPROM containing the environment variables has never been initialized yet. Is there any fix to remove this warning message without passing the saveenv command on u-boot prompt? No, these is no fix, since this is not a bug but a desired feature. Why do you want to change this behaviour? Don't you have any environment storage area at all? Then you should define CONFIG_ENV_IS_NOWHERE in your board config header. Cheers, Stefan -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: off...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] CONFIG_SYS_LINUX_LOWMEM_MAX_SIZE
Hi Anup, On Tuesday 18 May 2010 09:03:25 anup behare wrote: We are using taishan based board having 1GB DDR. In u-boot code we found that CONFIG_SYS_LINUX_LOWMEM_MAX_SIZE is set to 768MB hence if (size bootm_size) condition becomes true and u-boot throw WARNING: adjusting available memory to 0x3000 message on console. Let me know will it possible to set CONFIG_SYS_LINUX_LOWMEM_MAX_SIZE to 1GB or is there any fix for above warning message? Linux lowmem size is 768MB for PowerPC. Loading at a higher address results in a non-booting Linux kernel. So this warning makes sense and it's not possible to load to 1GB. Why do you want to change this? Does this cause you any troubles? Is Linux not booting correctly? I don't see what you would gain by loading to 1GB. Cheers, Stefan -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: off...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] hardware flash protect kept during a reboot?
On Monday 17 May 2010 16:11:22 Timur Tabi wrote: Stefan Roese wrote: This protection is chip specific. IIRC, then some Intel (Strata) chips either protect all sectors or have a sectore-wise protection mechanism. You need to check your FLASH documentation for the exact behaviour. Which chip are you using? I just want to know whether hardware protection works at all for anyone through a reboot. Is the CFI protect sector command persistent through a hardware power reset or power loss? Yes. Its working at least for Intel Strata FLASH chips. Cheers, Stefan -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: off...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 0/1] Fix hang trying to protect flash sectors
Hi Mark, On Tuesday 18 May 2010 07:26:34 Mark Tomlinson wrote: Our hardware has part of the flash mapped in two address ranges. The CONFIG_SYS_MONITOR_BASE is in the upper 'boot' area, whereas the CONFIG_SYS_FLASH_BANKS_LIST has the full flash available at a lower address. Just to be sure: You have 2 FLASH chips? Mapped at which addresses? And where does CONFIG_SYS_MONITOR_BASE point to? This all works fine until the code in cfi_flash.c:flash_init(), which uses flash_get_info() to find the flash_info_t associated with the monitor and environment. These are not in the probed flash range, so flash_get_info() returns NULL. You mean that flash_get_info(CONFIG_SYS_MONITOR_BASE) returns NULL? Please explain again, why is this the case? This is not checked and is passed directly to flash_protect(). Since flash_protect() was not checking for this NULL pointer either, random memory would be clobbered causing the device to lock up. This patch changes flash_protect() to check for the NULL, and the error goes unreported. I would prefer to fix the real problem, that flash_get_info() returns NULL, instead. Cheers, Stefan -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: off...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] Fixed two typos in arch/powerpc/cpu/mpc83xx/start.S.
Signed-off-by: Horst Kronstorfer hkron...@frequentis.com --- arch/powerpc/cpu/mpc83xx/start.S |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/cpu/mpc83xx/start.S b/arch/powerpc/cpu/mpc83xx/start.S index a7c8079..aa263e3 100644 --- a/arch/powerpc/cpu/mpc83xx/start.S +++ b/arch/powerpc/cpu/mpc83xx/start.S @@ -507,7 +507,7 @@ init_e300_core: /* time t 10 */ lis r3, config_sys_i...@h #if defined(CONFIG_WATCHDOG) - /* Initialise the Wathcdog values and reset it (if req) */ + /* Initialise the Watchdog values and reset it (if req) */ /*--*/ lis r4, CONFIG_SYS_WATCHDOG_VALUE ori r4, r4, (SWCRR_SWEN | SWCRR_SWRI | SWCRR_SWPR) @@ -520,7 +520,7 @@ init_e300_core: /* time t 10 */ li r4, -0x55C7 sth r4, sw...@l(r3) #else - /* Disable Wathcdog */ + /* Disable Watchdog */ /*---*/ lwz r4, SWCRR(r3) /* Check to see if its enabled for disabling -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 0/3] Makefile: rework / cleanup
Hi Wolfgang, The top level Makefile is growing and growing. Once, wehn we suppoted only a few tens of boards, it was possible to implement board configuration logic in the Makefile, but it quickly turned out that this doesn't scale. Also, it is not really needed (at least not any more) - we noch have mechanisnms in place, that allow for more efficient code. The following patch series is an attempt to start some cleanup and reduce the size of the top level Makefile. The solution is neither perfect nor complete - there are quite a lot of boards that resist such a cleanup and need more thorough cleanup. But it's an initial step, showing what could and should be done, which boards have problems, and why this is the case. Eentually this paves the ground for a more friendly way to add new board configurations. Wow, thanks for these cleanups. This is absolutely a good direction to simplify the makefile. For all three parts you have my Acked-by: Detlev Zundel d...@denx.de Cheers Detlev -- As a general remark, you're more likely to get meaningful feedback if you just submit what you think is best. You'll get more feedback when people don't like what you did, but any EE will tell you that negative feedback is the path to stability. -- Ben Warren 4baa6f5c.5060...@gmail.com -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: d...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] *** Warning - bad CRC, using default environment
Stefan, I don't want to change the behavior and I can't use CONFIG_ENV_IS_NOWHERE because we may change the environment variable and save it. Here my intention was to remove the warning runtime. ~Anup On Tue, May 18, 2010 at 1:25 PM, Stefan Roese s...@denx.de wrote: On Tuesday 18 May 2010 09:11:16 anup behare wrote: While using u-boot for ppc440 based board we are getting *** Warning - bad CRC, using default environment message. On denx site we came to know that message is printed because the flash sector or ERPROM containing the environment variables has never been initialized yet. Is there any fix to remove this warning message without passing the saveenv command on u-boot prompt? No, these is no fix, since this is not a bug but a desired feature. Why do you want to change this behaviour? Don't you have any environment storage area at all? Then you should define CONFIG_ENV_IS_NOWHERE in your board config header. Cheers, Stefan -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: off...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] *** Warning - bad CRC, using default environment
On Tuesday 18 May 2010 11:12:26 anup behare wrote: I don't want to change the behavior and I can't use CONFIG_ENV_IS_NOWHERE because we may change the environment variable and save it. And this usually happens upon board bring-up and/or factory testing. So in the normal use-case this warning will not be seen. Here my intention was to remove the warning runtime. Why? Cheers, Stefan -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: off...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] CONFIG_SYS_LINUX_LOWMEM_MAX_SIZE
Hi Stefan, My intention was only to remove this warning. My Linux is booting correctly and it is not causing any trouble but I observed WARNING: adjusting available memory to 0x3000 on u-boot console. I have couple of question here with 768MB: 1. Is that mean u-boot will use only 768MB DDR? 2. What about kernel will it use complete DDR or will work with 768MB only? 3. Means we can’t remove this warning and this warning will come for DDR more than 768MB? ~Anup On Tue, May 18, 2010 at 1:37 PM, Stefan Roese s...@denx.de wrote: Hi Anup, On Tuesday 18 May 2010 09:03:25 anup behare wrote: We are using taishan based board having 1GB DDR. In u-boot code we found that CONFIG_SYS_LINUX_LOWMEM_MAX_SIZE is set to 768MB hence if (size bootm_size) condition becomes true and u-boot throw WARNING: adjusting available memory to 0x3000 message on console. Let me know will it possible to set CONFIG_SYS_LINUX_LOWMEM_MAX_SIZE to 1GB or is there any fix for above warning message? Linux lowmem size is 768MB for PowerPC. Loading at a higher address results in a non-booting Linux kernel. So this warning makes sense and it's not possible to load to 1GB. Why do you want to change this? Does this cause you any troubles? Is Linux not booting correctly? I don't see what you would gain by loading to 1GB. Cheers, Stefan -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: off...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] *** Warning - bad CRC, using default environment
I removing the console warning and this is one of the warning. On Tue, May 18, 2010 at 2:53 PM, Stefan Roese s...@denx.de wrote: On Tuesday 18 May 2010 11:12:26 anup behare wrote: I don't want to change the behavior and I can't use CONFIG_ENV_IS_NOWHERE because we may change the environment variable and save it. And this usually happens upon board bring-up and/or factory testing. So in the normal use-case this warning will not be seen. Here my intention was to remove the warning runtime. Why? Cheers, Stefan -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: off...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] CONFIG_SYS_LINUX_LOWMEM_MAX_SIZE
Hi Anup, On Tuesday 18 May 2010 11:24:42 anup behare wrote: My intention was only to remove this warning. Perhaps it makes sense, to change this WARNUNG: to NOTE:. I suggest you send a patch for this and we might accept it. My Linux is booting correctly and it is not causing any trouble but I observed WARNING: adjusting available memory to 0x3000 on u-boot console. I have couple of question here with 768MB: 1. Is that mean u-boot will use only 768MB DDR? No. 2. What about kernel will it use complete DDR or will work with 768MB only? That depends on your kernel configuration. For more than 768MB (lowmem) you need to enable highmem support of course. 3. Means we can’t remove this warning and this warning will come for DDR more than 768MB? Yes. But we might change the text from WARNING to NOTE or something like this (see above). Cheers, Stefan -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: off...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] Improve DaVinci SPI speed
Hi Delio, On Thu, May 13, 2010 at 18:27:51, Delio Brignoli wrote: Reduce the number of reads per byte transferred on the BUF register from 2 to 1 and take advantage of the TX buffer in the SPI module. The patch looks good to me. Can you please publish some sort of numbers in the patch description indicating the performance improvement achieved? A minor nit below: Signed-off-by: Delio Brignoli dbrign...@audioscience.com --- drivers/spi/davinci_spi.c | 67 +++- 1 files changed, 35 insertions(+), 32 deletions(-) diff --git a/drivers/spi/davinci_spi.c b/drivers/spi/davinci_spi.c index 60ba007..b4a74de 100644 --- a/drivers/spi/davinci_spi.c +++ b/drivers/spi/davinci_spi.c @@ -131,6 +131,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, { [...] + /* write to DAT1 is required to keep the serial transfer going */ + /* we just terminate when we reach the end */ + if((o_cnt == (len -1)) (flags SPI_XFER_END)) { Please include a space before the '-' Thanks, Sekhar ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 01/17] SPARC: added unaligned definitions, patch supplied by Magnus Sjalander.
Signed-off-by: Daniel Hellstrom dan...@gaisler.com --- arch/sparc/include/asm/byteorder.h |1 + arch/sparc/include/asm/unaligned.h | 10 ++ 2 files changed, 11 insertions(+), 0 deletions(-) create mode 100644 arch/sparc/include/asm/unaligned.h diff --git a/arch/sparc/include/asm/byteorder.h b/arch/sparc/include/asm/byteorder.h index b9fc656..e3b3dec 100644 --- a/arch/sparc/include/asm/byteorder.h +++ b/arch/sparc/include/asm/byteorder.h @@ -32,6 +32,7 @@ #if defined(__GNUC__) !defined(__STRICT_ANSI__) #define __BYTEORDER_HAS_U64__ +#define __SWAB_64_THRU_32__ #endif #include linux/byteorder/big_endian.h #endif /* _SPARC_BYTEORDER_H */ diff --git a/arch/sparc/include/asm/unaligned.h b/arch/sparc/include/asm/unaligned.h new file mode 100644 index 000..0e646f7 --- /dev/null +++ b/arch/sparc/include/asm/unaligned.h @@ -0,0 +1,10 @@ +#ifndef _ASM_SPARC_UNALIGNED_H +#define _ASM_SPARC_UNALIGNED_H + +/* + * The SPARC can not do unaligned accesses, it must be split into multiple + * byte accesses. The SPARC is in big endian mode. + */ +#include asm-generic/unaligned.h + +#endif /* _ASM_SPARC_UNALIGNED_H */ -- 1.5.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 02/17] GRETH: Added support for selecting PHY address from config, PHY address was always set to zero before.
Signed-off-by: Daniel Hellstrom dan...@gaisler.com --- drivers/net/greth.c | 69 +++--- 1 files changed, 43 insertions(+), 26 deletions(-) diff --git a/drivers/net/greth.c b/drivers/net/greth.c index 79bc4d9..a1a88f9 100644 --- a/drivers/net/greth.c +++ b/drivers/net/greth.c @@ -45,7 +45,7 @@ /* ByPass Cache when reading regs */ #define GRETH_REGLOAD(addr)SPARC_NOCACHE_READ(addr) /* Write-through cache == no bypassing needed on writes */ -#define GRETH_REGSAVE(addr,data) (*(unsigned int *)(addr) = (data)) +#define GRETH_REGSAVE(addr,data) (*(volatile unsigned int *)(addr) = (data)) #define GRETH_REGORIN(addr,data) GRETH_REGSAVE(addr,GRETH_REGLOAD(addr)|data) #define GRETH_REGANDIN(addr,data) GRETH_REGSAVE(addr,GRETH_REGLOAD(addr)data) @@ -102,12 +102,12 @@ typedef struct { } greth_priv; /* Read MII register 'addr' from core 'regs' */ -static int read_mii(int addr, volatile greth_regs * regs) +static int read_mii(int phyaddr, int regaddr, volatile greth_regs * regs) { while (GRETH_REGLOAD(regs-mdio) GRETH_MII_BUSY) { } - GRETH_REGSAVE(regs-mdio, (0 11) | ((addr 0x1F) 6) | 2); + GRETH_REGSAVE(regs-mdio, ((phyaddr 0x1F) 11) | ((regaddr 0x1F) 6) | 2); while (GRETH_REGLOAD(regs-mdio) GRETH_MII_BUSY) { } @@ -119,14 +119,14 @@ static int read_mii(int addr, volatile greth_regs * regs) } } -static void write_mii(int addr, int data, volatile greth_regs * regs) +static void write_mii(int phyaddr, int regaddr, int data, volatile greth_regs * regs) { while (GRETH_REGLOAD(regs-mdio) GRETH_MII_BUSY) { } GRETH_REGSAVE(regs-mdio, - ((data 0x) 16) | (0 11) | ((addr 0x1F) 6) - | 1); + ((data 0x) 16) | ((phyaddr 0x1F) 11) | + ((regaddr 0x1F) 6) | 1); while (GRETH_REGLOAD(regs-mdio) GRETH_MII_BUSY) { } @@ -146,8 +146,6 @@ int greth_init(struct eth_device *dev, bd_t * bis) printf(greth_init\n); #endif - GRETH_REGSAVE(regs-control, 0); - if (!greth-rxbd_base) { /* allocate descriptors */ @@ -161,6 +159,7 @@ int greth_init(struct eth_device *dev, bd_t * bis) malloc(GRETH_RXBUF_EFF_SIZE * GRETH_RXBD_CNT); } + memset(greth-rxbuf_base, 0, GRETH_RXBUF_EFF_SIZE * GRETH_RXBD_CNT); /* initate rx decriptors */ for (i = 0; i GRETH_RXBD_CNT; i++) { greth-rxbd_base[i].addr = (unsigned int) @@ -219,6 +218,11 @@ int greth_init_phy(greth_priv * dev, bd_t * bis) greth_regs *regs = dev-regs; int tmp, tmp1, tmp2, i; unsigned int start, timeout; +#ifdef CONFIG_SYS_GRLIB_GRETH_PHYADDR + int phyaddr = CONFIG_SYS_GRLIB_GRETH_PHYADDR; +#else + int phyaddr = 0; +#endif /* X msecs to ticks */ timeout = usec2ticks(GRETH_PHY_TIMEOUT_MS * 1000); @@ -230,17 +234,25 @@ int greth_init_phy(greth_priv * dev, bd_t * bis) /* get phy control register default values */ - while ((tmp = read_mii(0, regs)) 0x8000) { - if (get_timer(start) timeout) + while ((tmp = read_mii(phyaddr, 0, regs)) 0x8000) { + if (get_timer(start) timeout) { +#ifdef DEBUG + printf(greth_init_phy: PHY read 1 failed\n); +#endif return 1; /* Fail */ + } } /* reset PHY and wait for completion */ - write_mii(0, 0x8000 | tmp, regs); + write_mii(phyaddr, 0, 0x8000 | tmp, regs); - while (((tmp = read_mii(0, regs))) 0x8000) { - if (get_timer(start) timeout) + while (((tmp = read_mii(phyaddr, 0, regs))) 0x8000) { + if (get_timer(start) timeout) { +#ifdef DEBUG + printf(greth_init_phy: PHY read 2 failed\n); +#endif return 1; /* Fail */ + } } /* Check if PHY is autoneg capable and then determine operating @@ -251,16 +263,16 @@ int greth_init_phy(greth_priv * dev, bd_t * bis) dev-sp = 0; dev-auto_neg = 0; if (!((tmp 12) 1)) { - write_mii(0, 0, regs); + write_mii(phyaddr, 0, 0, regs); } else { /* wait for auto negotiation to complete and then check operating mode */ dev-auto_neg = 1; i = 0; - while (!(((tmp = read_mii(1, regs)) 5) 1)) { + while (!(((tmp = read_mii(phyaddr, 1, regs)) 5) 1)) { if (get_timer(start) timeout) { printf(Auto negotiation timed out. Selecting default config\n); - tmp = read_mii(0, regs); + tmp = read_mii(phyaddr, 0, regs);
[U-Boot] [PATCH 03/17] GRETH: Added extra RESET, this is needed if GRETH was stopped during an ethernet frame reception.
Signed-off-by: Daniel Hellstrom dan...@gaisler.com --- drivers/net/greth.c | 14 -- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/net/greth.c b/drivers/net/greth.c index a1a88f9..143c773 100644 --- a/drivers/net/greth.c +++ b/drivers/net/greth.c @@ -146,13 +146,23 @@ int greth_init(struct eth_device *dev, bd_t * bis) printf(greth_init\n); #endif + /* Reset core */ + GRETH_REGSAVE(regs-control, (GRETH_RESET | (greth-gb 8) | + (greth-sp 7) | (greth-fd 4))); + + /* Wait for Reset to complete */ + while ( GRETH_REGLOAD(regs-control) GRETH_RESET) ; + + GRETH_REGSAVE(regs-control, + ((greth-gb 8) | (greth-sp 7) | (greth-fd 4))); + if (!greth-rxbd_base) { /* allocate descriptors */ greth-rxbd_base = (greth_bd *) memalign(0x1000, GRETH_RXBD_CNT * sizeof(greth_bd)); greth-txbd_base = (greth_bd *) - memalign(0x1000, GRETH_RXBD_CNT * sizeof(greth_bd)); + memalign(0x1000, GRETH_TXBD_CNT * sizeof(greth_bd)); /* allocate buffers to all descriptors */ greth-rxbuf_base = @@ -185,7 +195,7 @@ int greth_init(struct eth_device *dev, bd_t * bis) for (i = 0; i GRETH_TXBD_CNT; i++) { greth-txbd_base[i].addr = 0; /* enable desciptor set wrap bit if last descriptor */ - if (i = (GRETH_RXBD_CNT - 1)) { + if (i = (GRETH_TXBD_CNT - 1)) { greth-txbd_base[i].stat = GRETH_BD_WR; } else { greth-txbd_base[i].stat = 0; -- 1.5.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 05/17] LEON3: added memory controller initialization using the new AMBA PnP routines.
Signed-off-by: Daniel Hellstrom dan...@gaisler.com --- arch/sparc/cpu/leon3/Makefile |5 +- arch/sparc/cpu/leon3/memcfg.c | 276 + arch/sparc/cpu/leon3/memcfg.h | 106 ++ arch/sparc/cpu/leon3/memcfg_low.S | 270 arch/sparc/cpu/leon3/start.S | 36 + include/configs/gr_cpci_ax2000.h | 27 ++-- include/configs/gr_ep2s60.h | 32 +++-- include/configs/gr_xc3s_1500.h| 23 ++-- include/configs/grsim.h | 27 ++-- 9 files changed, 754 insertions(+), 48 deletions(-) create mode 100644 arch/sparc/cpu/leon3/memcfg.c create mode 100644 arch/sparc/cpu/leon3/memcfg.h create mode 100644 arch/sparc/cpu/leon3/memcfg_low.S diff --git a/arch/sparc/cpu/leon3/Makefile b/arch/sparc/cpu/leon3/Makefile index d8f89bc..f1bb808 100644 --- a/arch/sparc/cpu/leon3/Makefile +++ b/arch/sparc/cpu/leon3/Makefile @@ -26,8 +26,9 @@ include $(TOPDIR)/config.mk LIB= $(obj)lib$(CPU).a START = start.o -SOBJS = ambapp_low.o ambapp_low_c.o -COBJS = cpu_init.o serial.o cpu.o ambapp.o interrupts.o prom.o usb_uhci.o +SOBJS = ambapp_low.o ambapp_low_c.o memcfg_low.o +COBJS = cpu_init.o serial.o cpu.o ambapp.o interrupts.o prom.o usb_uhci.o \ + memcfg.o SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) diff --git a/arch/sparc/cpu/leon3/memcfg.c b/arch/sparc/cpu/leon3/memcfg.c new file mode 100644 index 000..4a9bded --- /dev/null +++ b/arch/sparc/cpu/leon3/memcfg.c @@ -0,0 +1,276 @@ +/* GRLIB Memory controller setup. The register values are used + * from the associated low level assembler routine implemented + * in memcfg_low.S. + * + * (C) Copyright 2010 + * Daniel Hellstrom, Aeroflex Gaisler, dan...@gaisler.com. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + */ + +#include ambapp.h +#include memcfg.h +#include config.h + +#ifdef CONFIG_SYS_GRLIB_ESA_MCTRL1 +struct mctrl_setup esa_mctrl1_cfg = +{ + .reg_mask = 0x7, + .regs = + { + { + .mask = 0x0300, + .value = CONFIG_SYS_GRLIB_ESA_MCTRL1_CFG1, + }, + { + .mask = 0x, + .value = CONFIG_SYS_GRLIB_ESA_MCTRL1_CFG2, + }, + { + .mask = 0x, + .value = CONFIG_SYS_GRLIB_ESA_MCTRL1_CFG3, + }, + } +}; +#ifdef CONFIG_SYS_GRLIB_ESA_MCTRL2 +struct mctrl_setup esa_mctrl2_cfg = +{ + .reg_mask = 0x7, + .regs = + { + { + .mask = 0x0300, + .value = CONFIG_SYS_GRLIB_ESA_MCTRL2_CFG1, + }, + { + .mask = 0x, + .value = CONFIG_SYS_GRLIB_ESA_MCTRL2_CFG2, + }, + { + .mask = 0x, + .value = CONFIG_SYS_GRLIB_ESA_MCTRL2_CFG3, + }, + } +}; +#endif +#endif + +#ifdef CONFIG_SYS_GRLIB_GAISLER_FTMCTRL1 +struct mctrl_setup gaisler_ftmctrl1_cfg = +{ + .reg_mask = 0x7, + .regs = + { + { + .mask = 0x0300, + .value = CONFIG_SYS_GRLIB_GAISLER_FTMCTRL1_CFG1, + }, + { + .mask = 0x, + .value = CONFIG_SYS_GRLIB_GAISLER_FTMCTRL1_CFG2, + }, + { + .mask = 0x, + .value = CONFIG_SYS_GRLIB_GAISLER_FTMCTRL1_CFG3, + }, + } +}; +#ifdef CONFIG_SYS_GRLIB_GAISLER_FTMCTRL2 +struct mctrl_setup gaisler_ftmctrl2_cfg = +{ + .reg_mask = 0x7, + .regs = + { + { + .mask = 0x0300, + .value = CONFIG_SYS_GRLIB_GAISLER_FTMCTRL2_CFG1, + }, + { + .mask = 0x, + .value = CONFIG_SYS_GRLIB_GAISLER_FTMCTRL2_CFG2, + }, + { +
[U-Boot] [PATCH 06/17] LEON3: Moved GRLIB core header files to common include/grlib directory
Signed-off-by: Daniel Hellstrom dan...@gaisler.com --- arch/sparc/cpu/leon3/cpu_init.c | 10 +-- arch/sparc/cpu/leon3/interrupts.c |7 +- arch/sparc/cpu/leon3/memcfg.h |1 - arch/sparc/cpu/leon3/prom.c |7 ++- arch/sparc/cpu/leon3/serial.c | 16 ++-- drivers/net/greth.c |2 +- include/ambapp.h | 137 - include/grlib/apbuart.h | 63 + include/grlib/gptimer.h | 50 + include/grlib/greth.h | 103 include/grlib/irqmp.h | 39 +++ 11 files changed, 277 insertions(+), 158 deletions(-) create mode 100644 include/grlib/apbuart.h create mode 100644 include/grlib/gptimer.h create mode 100644 include/grlib/greth.h create mode 100644 include/grlib/irqmp.h diff --git a/arch/sparc/cpu/leon3/cpu_init.c b/arch/sparc/cpu/leon3/cpu_init.c index bc7e493..fd3e757 100644 --- a/arch/sparc/cpu/leon3/cpu_init.c +++ b/arch/sparc/cpu/leon3/cpu_init.c @@ -28,6 +28,8 @@ #include asm/asi.h #include asm/leon.h #include ambapp.h +#include grlib/irqmp.h +#include grlib/gptimer.h #include config.h @@ -41,11 +43,7 @@ DECLARE_GLOBAL_DATA_PTR; /* reset CPU (jump to 0, without reset) */ void start(void); -/* find initialize the memory controller */ -int init_memory_ctrl(void); - ambapp_dev_irqmp *irqmp = NULL; -ambapp_dev_mctrl memctrl; ambapp_dev_gptimer *gptimer = NULL; unsigned int gptimer_irq = 0; int leon3_snooping_avail = 0; @@ -164,8 +162,8 @@ int timer_interrupt_init_cpu(void) gptimer-e[0].val = 0; gptimer-e[0].rld = 999;/* (((100 / 100) - 1)) */ gptimer-e[0].ctrl = - (LEON3_GPTIMER_EN | -LEON3_GPTIMER_RL | LEON3_GPTIMER_LD | LEON3_GPTIMER_IRQEN); + (GPTIMER_CTRL_EN | GPTIMER_CTRL_RS | +GPTIMER_CTRL_LD | GPTIMER_CTRL_IE); return gptimer_irq; } diff --git a/arch/sparc/cpu/leon3/interrupts.c b/arch/sparc/cpu/leon3/interrupts.c index ac6aca5..d927de1 100644 --- a/arch/sparc/cpu/leon3/interrupts.c +++ b/arch/sparc/cpu/leon3/interrupts.c @@ -39,6 +39,8 @@ #include asm/leon.h #include ambapp.h +#include grlib/irqmp.h +#include grlib/gptimer.h /* 15 normal irqs and a non maskable interrupt */ #define NR_IRQS 15 @@ -141,9 +143,8 @@ int interrupt_init_cpu(void) /* Handle Timer 0 IRQ */ void timer_interrupt_cpu(void *arg) { - gptimer-e[0].ctrl = (LEON3_GPTIMER_EN | - LEON3_GPTIMER_RL | - LEON3_GPTIMER_LD | LEON3_GPTIMER_IRQEN); + gptimer-e[0].ctrl = (GPTIMER_CTRL_EN | GPTIMER_CTRL_RS | + GPTIMER_CTRL_LD | GPTIMER_CTRL_IE); /* nothing to do here */ return; } diff --git a/arch/sparc/cpu/leon3/memcfg.h b/arch/sparc/cpu/leon3/memcfg.h index 0b4738e..02086ce 100644 --- a/arch/sparc/cpu/leon3/memcfg.h +++ b/arch/sparc/cpu/leon3/memcfg.h @@ -54,7 +54,6 @@ extern struct grlib_mctrl_handler grlib_mctrl_handlers[]; #define MH_STRUCT_SIZE (4*4) #define MH_TYPE0x00 #define MH_INDEX 0x01 -#define MH_UNUSED 0x02 #define MH_VENDOR_DEVICE 0x04 #define MH_FUNC0x08 #define MH_PRIV0x0c diff --git a/arch/sparc/cpu/leon3/prom.c b/arch/sparc/cpu/leon3/prom.c index 18d2fb2..86376bb 100644 --- a/arch/sparc/cpu/leon3/prom.c +++ b/arch/sparc/cpu/leon3/prom.c @@ -32,6 +32,9 @@ #include asm/irq.h #include asm/leon.h #include ambapp.h +#include grlib/apbuart.h +#include grlib/irqmp.h +#include grlib/gptimer.h #include config.h /* @@ -757,14 +760,14 @@ static int PROM_TEXT leon_nbputchar(int c) /* Wait for last character to go. */ while (!(SPARC_BYPASS_READ(uart-status) - LEON_REG_UART_STATUS_THE)) ; + APBUART_STATUS_THE)) ; /* Send data */ SPARC_BYPASS_WRITE(uart-data, c); /* Wait for data to be sent */ while (!(SPARC_BYPASS_READ(uart-status) - LEON_REG_UART_STATUS_TSE)) ; + APBUART_STATUS_TSE)) ; return 0; } diff --git a/arch/sparc/cpu/leon3/serial.c b/arch/sparc/cpu/leon3/serial.c index 15c380e..8964310 100644 --- a/arch/sparc/cpu/leon3/serial.c +++ b/arch/sparc/cpu/leon3/serial.c @@ -27,6 +27,7 @@ #include asm/processor.h #include asm/leon.h #include ambapp.h +#include grlib/apbuart.h DECLARE_GLOBAL_DATA_PTR; @@ -69,9 +70,9 @@ int serial_init(void) /* Let bit 11 be unchanged (debug bit for GRMON) */ tmp = READ_WORD(leon3_apbuart-ctrl); - leon3_apbuart-ctrl = ((tmp LEON_REG_UART_CTRL_DBG) | - LEON_REG_UART_CTRL_RE | - LEON_REG_UART_CTRL_TE); + leon3_apbuart-ctrl = ((tmp APBUART_CTRL_DBG) | +
[U-Boot] [PATCH 07/17] LEON3: serial baud rate register support multiple buses with different frequency.
Signed-off-by: Daniel Hellstrom dan...@gaisler.com --- arch/sparc/cpu/leon3/serial.c | 17 ++--- 1 files changed, 14 insertions(+), 3 deletions(-) diff --git a/arch/sparc/cpu/leon3/serial.c b/arch/sparc/cpu/leon3/serial.c index 8964310..1f17ede 100644 --- a/arch/sparc/cpu/leon3/serial.c +++ b/arch/sparc/cpu/leon3/serial.c @@ -47,11 +47,18 @@ DECLARE_GLOBAL_DATA_PTR; #endif ambapp_dev_apbuart *leon3_apbuart = NULL; +unsigned int apbuart_freq = CONFIG_SYS_CLK_FREQ; + +unsigned int apbuart_calc_scaler(unsigned int apbuart_freq, unsigned int baud) +{ + return apbuart_freq*10)/(baud*8))-5)/10); +} int serial_init(void) { ambapp_apbdev apbdev; unsigned int tmp; + unsigned int freq; /* find UART */ if (ambapp_apb_find(ambapp_plb, VENDOR_GAISLER, GAISLER_APBUART, @@ -65,7 +72,13 @@ int serial_init(void) * * Receiver transmitter enable */ +#ifdef CONFIG_SYS_GRLIB_APBUART_SCALER leon3_apbuart-scaler = CONFIG_SYS_GRLIB_APBUART_SCALER; +#else + /* APBUART Frequency is equal to bus frequency */ + freq = ambapp_bus_freq(ambapp_plb, apbdev.ahb_bus_index); + leon3_apbuart-scaler = apbuart_calc_scaler(freq, CONFIG_BAUDRATE); +#endif /* Let bit 11 be unchanged (debug bit for GRMON) */ tmp = READ_WORD(leon3_apbuart-ctrl); @@ -136,9 +149,7 @@ void serial_setbrg(void) /* update baud rate settings, read it from gd-baudrate */ unsigned int scaler; if (leon3_apbuart (gd-baudrate 0)) { - scaler = - (((CONFIG_SYS_CLK_FREQ * 10) / (gd-baudrate * 8)) - -5) / 10; + scaler = apbuart_calc_scaler(apbuart_freq, gd-baudrate); leon3_apbuart-scaler = scaler; } return; -- 1.5.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 08/17] SPARC: added function that checks if IRQ is on or off.
Signed-off-by: Daniel Hellstrom dan...@gaisler.com --- arch/sparc/include/asm/irq.h |3 +++ arch/sparc/lib/interrupts.c |7 +++ 2 files changed, 10 insertions(+), 0 deletions(-) diff --git a/arch/sparc/include/asm/irq.h b/arch/sparc/include/asm/irq.h index c5538c0..ce78169 100644 --- a/arch/sparc/include/asm/irq.h +++ b/arch/sparc/include/asm/irq.h @@ -46,4 +46,7 @@ extern int intLock(void); /* Sets the PIL to oldLevel */ extern void intUnlock(int oldLevel); +/* Return non-zero if interrupts are currently enabled */ +extern int interrupt_is_enabled(void); + #endif diff --git a/arch/sparc/lib/interrupts.c b/arch/sparc/lib/interrupts.c index 4c73b82..4d53e8c 100644 --- a/arch/sparc/lib/interrupts.c +++ b/arch/sparc/lib/interrupts.c @@ -63,6 +63,13 @@ int disable_interrupts(void) return intLock(); } +int interrupt_is_enabled(void) +{ + if ( get_pil() == 15 ) + return 0; + return 1; +} + int interrupt_init(void) { int ret; -- 1.5.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 11/17] SPARC: removed USB stop from linux bootm, arch-independent bootm stop USB.
Signed-off-by: Daniel Hellstrom dan...@gaisler.com --- arch/sparc/lib/bootm.c |8 1 files changed, 0 insertions(+), 8 deletions(-) diff --git a/arch/sparc/lib/bootm.c b/arch/sparc/lib/bootm.c index c62cf57..f517325 100644 --- a/arch/sparc/lib/bootm.c +++ b/arch/sparc/lib/bootm.c @@ -35,10 +35,6 @@ extern image_header_t header; extern void srmmu_init_cpu(unsigned int entry); extern void prepare_bootargs(char *bootargs); -#ifdef CONFIG_USB_UHCI -extern int usb_lowlevel_stop(void); -#endif - /* sparc kernel argument (the ROM vector) */ struct linux_romvec *kernel_arg_promvec; @@ -125,10 +121,6 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t * images) linux_hdr-linuxver_minor, linux_hdr-linuxver_revision); #endif -#ifdef CONFIG_USB_UHCI - usb_lowlevel_stop(); -#endif - /* set basic boot params in kernel header now that it has been * extracted and is writeable. */ -- 1.5.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 09/17] LEON3: added busy wait function, made wait_ms() work when IRQ is disabled.
Signed-off-by: Daniel Hellstrom dan...@gaisler.com --- arch/sparc/cpu/leon3/cpu_init.c | 30 -- 1 files changed, 28 insertions(+), 2 deletions(-) diff --git a/arch/sparc/cpu/leon3/cpu_init.c b/arch/sparc/cpu/leon3/cpu_init.c index fd3e757..1829a08 100644 --- a/arch/sparc/cpu/leon3/cpu_init.c +++ b/arch/sparc/cpu/leon3/cpu_init.c @@ -142,14 +142,40 @@ int cpu_init_r(void) return (0); } +/* Busy wait a number of ms */ +void cpu_wait_ms_busy(unsigned long ms) +{ + unsigned int ms_delay; + volatile unsigned int tmp; + + /* ~10-20 cycles per decrement */ + ms_delay = leon_cpu_freq / (1000 * 10); + do { + /* Wait ~1ms */ + tmp = ms_delay; + while ( tmp-- 0 ) + ; + } while ( --ms 0 ); +} + /* Uses Timer 0 to get accurate * pauses. Max 2 raised to 32 ticks * */ void cpu_wait_ticks(unsigned long ticks) { - unsigned long start = get_timer(0); - while (get_timer(start) ticks) ; + unsigned long start; + + if ( interrupt_is_enabled() ) { + start = get_timer(0); + while (get_timer(start) ticks) ; + } else { + /* Interrupts disabled, this means that we cannot +* use get_timer(), it relies on IRQ. Instead the +* CPU frequency is used. +*/ + cpu_wait_ms_busy( ticks2usec(ticks) / 1000 ); + } } /* initiate and setup timer0 interrupt to 1MHz -- 1.5.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 13/17] LEON3: Added GRETH EDCL debug link IP address initialization.
Signed-off-by: Daniel Hellstrom dan...@gaisler.com --- arch/sparc/cpu/leon3/cpu_init.c | 14 arch/sparc/cpu/leon3/greth.c| 152 +++ 2 files changed, 166 insertions(+), 0 deletions(-) create mode 100644 arch/sparc/cpu/leon3/greth.c diff --git a/arch/sparc/cpu/leon3/cpu_init.c b/arch/sparc/cpu/leon3/cpu_init.c index 1829a08..bb394a1 100644 --- a/arch/sparc/cpu/leon3/cpu_init.c +++ b/arch/sparc/cpu/leon3/cpu_init.c @@ -43,6 +43,9 @@ DECLARE_GLOBAL_DATA_PTR; /* reset CPU (jump to 0, without reset) */ void start(void); +/* Initialize GRETH EDCL on startup */ +extern void greth_edcl_init(void); + ambapp_dev_irqmp *irqmp = NULL; ambapp_dev_gptimer *gptimer = NULL; unsigned int gptimer_irq = 0; @@ -142,6 +145,17 @@ int cpu_init_r(void) return (0); } +/* Late CPU initialization + * + * At this point environment variables is available. + */ +void cpu_late_init(void) +{ +#ifdef CONFIG_SYS_GRETH_EDCL_IP + greth_edcl_init(); +#endif +} + /* Busy wait a number of ms */ void cpu_wait_ms_busy(unsigned long ms) { diff --git a/arch/sparc/cpu/leon3/greth.c b/arch/sparc/cpu/leon3/greth.c new file mode 100644 index 000..2e2ee14 --- /dev/null +++ b/arch/sparc/cpu/leon3/greth.c @@ -0,0 +1,152 @@ +/* GRETH EDCL IP number initialization + * + * (C) Copyright 2010 + * Daniel Hellstrom, Aeroflex Gaisler, dan...@gaisler.com. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + */ + +#include common.h +#include ambapp.h +#include config.h +#include grlib/greth.h + +#ifdef CONFIG_SYS_GRETH_EDCL_IP + +/* Set EDCL IP of GRETH[core_index] to IP number as indicated by ip_str + * + * This is useful for designs that have a disabled EDCL (IP=0.0.0.0) on + * reset, or when the default EDCL IP is no correct. Often 192.168.0.51 + * is default, the IP must be unique which is a problem when multiple + * boards are used. + * + * NOTE: The EDCL IP must not be the same IP as U-BOOT is using. + * + * NOTE: This code should not be located in the GRETH driver, because + * we might want to set the EDCL debug link IP but not enable + * u-boot networking. + */ +int greth_edcl_ip_set(int core_index, char *ip_str) +{ + ambapp_apbdev apbdev; + unsigned int *greth_ip_reg; + unsigned int ip; + char *start, *end; + unsigned char ipbyte; + int i; + + /* Find Device IRQ via AMBA PlugPlay information, +* CONFIG_SYS_GRLIB_GRETH_INDEX select which GRETH if multiple +* GRETHs in system. +*/ + if (ambapp_apb_find(ambapp_plb, VENDOR_GAISLER, GAISLER_ETHMAC, + core_index, apbdev) != 1) { + return -1; /* GRETH not found */ + } + greth_ip_reg = (unsigned int *)(apbdev.address + 0x1C); + + /* Convert IP String into IP number */ + ip = 0; + start = ip_str; + for (i = 0; i 4; i++) { + ipbyte = simple_strtoul(start, end, 10); + ip |= ipbyte (24-i*8); + start = end + 1; /* Next byte in IP-string */ + } + + /* Set new IP address of EDCL */ + *greth_ip_reg = ip; + + printf(GRETH[0x%08x] EDCL IP: %s\n, + (unsigned int)greth_ip_reg, ip_str); + + return 0; +}; + +char *greth_edcl_ip_table[8] = +{ +#ifdef CONFIG_SYS_GRETH0_EDCL_IP_STR + CONFIG_SYS_GRETH0_EDCL_IP_STR, +#else + NULL, +#endif +#ifdef CONFIG_SYS_GRETH1_EDCL_IP_STR + CONFIG_SYS_GRETH1_EDCL_IP_STR, +#else + NULL, +#endif +#ifdef CONFIG_SYS_GRETH2_EDCL_IP_STR + CONFIG_SYS_GRETH2_EDCL_IP_STR, +#else + NULL, +#endif +#ifdef CONFIG_SYS_GRETH3_EDCL_IP_STR + CONFIG_SYS_GRETH3_EDCL_IP_STR, +#else + NULL, +#endif +#ifdef CONFIG_SYS_GRETH4_EDCL_IP_STR + CONFIG_SYS_GRETH4_EDCL_IP_STR, +#else + NULL, +#endif +#ifdef CONFIG_SYS_GRETH5_EDCL_IP_STR + CONFIG_SYS_GRETH5_EDCL_IP_STR, +#else + NULL, +#endif +#ifdef CONFIG_SYS_GRETH6_EDCL_IP_STR + CONFIG_SYS_GRETH6_EDCL_IP_STR, +#else + NULL, +#endif +#ifdef CONFIG_SYS_GRETH7_EDCL_IP_STR + CONFIG_SYS_GRETH7_EDCL_IP_STR, +#else + NULL, +#endif +}; + +void greth_edcl_init(void) +{ + int i; + char
[U-Boot] [PATCH 12/17] SPARC: added optional cpu_late_init routine.
Signed-off-by: Daniel Hellstrom dan...@gaisler.com --- arch/sparc/lib/board.c |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/arch/sparc/lib/board.c b/arch/sparc/lib/board.c index 11eea60..d829af0 100644 --- a/arch/sparc/lib/board.c +++ b/arch/sparc/lib/board.c @@ -65,6 +65,7 @@ extern void timer_interrupt_init(void); extern void malloc_bin_reloc(void); extern int do_ambapp_print(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]); extern int prom_init(void); +extern void cpu_late_init(void); #if defined(CONFIG__CMD_DOC) void doc_init(void); @@ -353,6 +354,10 @@ void board_init_f(ulong bootflag) /* relocate environment function pointers etc. */ env_relocate(); +#if defined(CONFIG_CPU_LATE_INIT) + cpu_late_init(); +#endif + #if defined(CONFIG_BOARD_LATE_INIT) board_late_init(); #endif -- 1.5.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 14/17] LEON: added support for GRLIB SPI Memory controller, spi command interface.
Signed-off-by: Daniel Hellstrom dan...@gaisler.com --- arch/sparc/lib/board.c | 14 +++ drivers/spi/Makefile |1 + drivers/spi/spimctrl_spi.c | 263 include/grlib/spimctrl.h | 69 4 files changed, 347 insertions(+), 0 deletions(-) create mode 100644 drivers/spi/spimctrl_spi.c create mode 100644 include/grlib/spimctrl.h diff --git a/arch/sparc/lib/board.c b/arch/sparc/lib/board.c index d829af0..3362f39 100644 --- a/arch/sparc/lib/board.c +++ b/arch/sparc/lib/board.c @@ -97,6 +97,16 @@ static int init_baudrate(void) return (0); } +#if defined(CONFIG_HARD_SPI) +static int init_func_spi (void) +{ +puts (SPI: ); +spi_init (); +puts (ready\n); +return (0); +} +#endif + /***/ /* @@ -304,6 +314,10 @@ void board_init_f(ulong bootflag) CONFIG_SYS_MALLOC_END - CONFIG_SYS_MALLOC_BASE); malloc_bin_reloc(); +#if defined(CONFIG_HARD_SPI) + init_func_spi(); +#endif + #if !defined(CONFIG_SYS_NO_FLASH) puts(FLASH: ); diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile index f112ed0..9f7d81d 100644 --- a/drivers/spi/Makefile +++ b/drivers/spi/Makefile @@ -35,6 +35,7 @@ COBJS-$(CONFIG_MPC52XX_SPI) += mpc52xx_spi.o COBJS-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o COBJS-$(CONFIG_MXC_SPI) += mxc_spi.o COBJS-$(CONFIG_SOFT_SPI) += soft_spi.o +COBJS-$(CONFIG_SPIMCTRL_SPI) += spimctrl_spi.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) diff --git a/drivers/spi/spimctrl_spi.c b/drivers/spi/spimctrl_spi.c new file mode 100644 index 000..c52e1f4 --- /dev/null +++ b/drivers/spi/spimctrl_spi.c @@ -0,0 +1,263 @@ +/* SPI interface driver for GRLIB SPIMCTRL (SPI Memory controller) + * + * (C) Copyright 2010 + * Daniel Hellstrom dan...@gaisler.com + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include common.h +#include malloc.h +#include spi.h +#include ambapp.h +#include grlib/spimctrl.h + +struct spimctrl_priv { + struct spimctrl_regs *regs; + int irq; + unsigned int mode; + unsigned int max_hz; +}; + +struct spi_slave_internal { + struct spi_slave dev; + struct spimctrl_priv *priv; + int locked; +}; + +static int spimctrl_cnt = 0; +static struct spimctrl_priv *spimctrl_devs; + +int spimctrl_probe(void) +{ + int cnt, i, found; + ambapp_ahbdev ahbdev; + struct spimctrl_priv *priv; + + cnt = ambapp_ahbslv_count(ambapp_plb,VENDOR_GAISLER,GAISLER_SPIMCTRL); + debug(Found %d SPIMCTRLS\n, cnt); + if ( cnt 1 ) + return 0; + + spimctrl_cnt = cnt; + spimctrl_devs = (struct spimctrl_priv *) malloc(sizeof(*priv) * cnt); + memset(spimctrl_devs, 0, sizeof(struct spimctrl_priv) * cnt); + + for (i=0; icnt; i++) { + found = ambapp_ahbslv_find(ambapp_plb, VENDOR_GAISLER, + GAISLER_SPIMCTRL, i, ahbdev); + if ( !found ) { + printf(spimctrl_probe: internal AMBA error\n); + while (1) ; + } + + priv = spimctrl_devs[i]; + priv-regs = (struct spimctrl_regs *)ahbdev.address[0]; + priv-irq = ahbdev.irq; + + debug(SPIMCTRL[%d]: 0x%x irq %d\n, + i, (unsigned int)priv-regs, priv-irq); + } + + return cnt; +} + +void spimctrl_init(struct spimctrl_priv *priv) +{ + debug(SPIMCTRL_INIT\n); + + priv-regs-ctrl = SPIMCTRL_CTRL_RST; + + /* Finish any previous ongoing user activity, this should +* not normally happen, but may when debugging. +*/ + if ( priv-regs-stat SPIMCTRL_STAT_DONE ) + priv-regs-stat = SPIMCTRL_STAT_DONE; + + if ( priv-regs-ctrl SPIMCTRL_CTRL_USRC ) { + /* Exit User mode */ + priv-regs-ctrl = SPIMCTRL_CTRL_CSN; + } +} + +void spimctrl_cs_activate(struct spimctrl_priv *priv) +{ + debug(CS ACT\n); + + if ( priv-regs-stat SPIMCTRL_STAT_DONE ) + priv-regs-stat = SPIMCTRL_STAT_DONE; + + /* Enter
[U-Boot] [PATCH 15/17] LEON3: fixed MMU table for systems with larger memory than 128MB.
Signed-off-by: Daniel Hellstrom dan...@gaisler.com --- arch/sparc/cpu/leon3/prom.c | 16 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/arch/sparc/cpu/leon3/prom.c b/arch/sparc/cpu/leon3/prom.c index 86376bb..e0a69af 100644 --- a/arch/sparc/cpu/leon3/prom.c +++ b/arch/sparc/cpu/leon3/prom.c @@ -1059,6 +1059,22 @@ void srmmu_init_cpu(unsigned int entry) ((CONFIG_SYS_SDRAM_BASE + 0x600) 4) | ACC_SU_ALL | PTE; psrmmu_tables-pgd_table[0xf7] = ((CONFIG_SYS_SDRAM_BASE + 0x700) 4) | ACC_SU_ALL | PTE; + psrmmu_tables-pgd_table[0xf8] = + ((CONFIG_SYS_SDRAM_BASE + 0x800) 4) | ACC_SU_ALL | PTE; + psrmmu_tables-pgd_table[0xf9] = + ((CONFIG_SYS_SDRAM_BASE + 0x900) 4) | ACC_SU_ALL | PTE; + psrmmu_tables-pgd_table[0xfa] = + ((CONFIG_SYS_SDRAM_BASE + 0xa00) 4) | ACC_SU_ALL | PTE; + psrmmu_tables-pgd_table[0xfb] = + ((CONFIG_SYS_SDRAM_BASE + 0xb00) 4) | ACC_SU_ALL | PTE; + psrmmu_tables-pgd_table[0xfc] = + ((CONFIG_SYS_SDRAM_BASE + 0xc00) 4) | ACC_SU_ALL | PTE; + psrmmu_tables-pgd_table[0xfd] = + ((CONFIG_SYS_SDRAM_BASE + 0xd00) 4) | ACC_SU_ALL | PTE; + psrmmu_tables-pgd_table[0xfe] = + ((CONFIG_SYS_SDRAM_BASE + 0xe00) 4) | ACC_SU_ALL | PTE; + psrmmu_tables-pgd_table[0xff] = + ((CONFIG_SYS_SDRAM_BASE + 0xf00) 4) | ACC_SU_ALL | PTE; /* convert rom vec pointer to virtual address */ kernel_arg_promvec = (struct linux_romvec *) -- 1.5.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 16/17] bootm command: added argument to arch_preboot_os, function may depend on OS type.
Signed-off-by: Daniel Hellstrom dan...@gaisler.com --- arch/powerpc/cpu/mpc85xx/cpu_init.c |2 +- common/cmd_bootm.c |8 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c b/arch/powerpc/cpu/mpc85xx/cpu_init.c index e578b29..61dd7ad 100644 --- a/arch/powerpc/cpu/mpc85xx/cpu_init.c +++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c @@ -403,7 +403,7 @@ int cpu_init_r(void) extern void setup_ivors(void); -void arch_preboot_os(void) +void arch_preboot_os(int os) { u32 msr; diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index da06009..f5ca5c9 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -154,11 +154,11 @@ ulong load_addr = CONFIG_SYS_LOAD_ADDR; /* Default Load Address */ static bootm_headers_t images; /* pointers to os/initrd/fdt images */ /* Allow for arch specific config before we boot */ -void __arch_preboot_os(void) +void __arch_preboot_os(int os) { /* please define platform specific arch_preboot_os() */ } -void arch_preboot_os(void) __attribute__((weak, alias(__arch_preboot_os))); +void arch_preboot_os(int os) __attribute__((weak, alias(__arch_preboot_os))); #if defined(__ARM__) #define IH_INITRD_ARCH IH_ARCH_ARM @@ -566,7 +566,7 @@ int do_bootm_subcommand (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) break; case BOOTM_STATE_OS_GO: disable_interrupts(); - arch_preboot_os(); + arch_preboot_os(images.os.os); boot_fn(BOOTM_STATE_OS_GO, argc, argv, images); break; } @@ -699,7 +699,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 1; } - arch_preboot_os(); + arch_preboot_os(images.os.os); boot_fn(0, argc, argv, images); -- 1.5.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 17/17] SPARC, LEON3: added support for multiprocessing, tested Linux 2.6.21.1 SMP and RTEMS-4.10 AMP.
Signed-off-by: Daniel Hellstrom dan...@gaisler.com --- arch/sparc/cpu/leon3/Makefile |2 +- arch/sparc/cpu/leon3/cpu.c | 10 ++- arch/sparc/cpu/leon3/cpu_mp.c | 87 +++ arch/sparc/cpu/leon3/prom.c | 32 +++--- arch/sparc/cpu/leon3/start.S| 70 arch/sparc/include/asm/boot_mp.h| 70 arch/sparc/lib/Makefile |2 +- arch/sparc/lib/boot_mp.c| 177 +++ arch/sparc/lib/bootm.c | 57 -- board/gaisler/gr_cpci_ax2000/u-boot.lds |7 ++ board/gaisler/gr_ep2s60/u-boot.lds |7 ++ board/gaisler/gr_xc3s_1500/u-boot.lds |7 ++ board/gaisler/grsim/u-boot.lds |7 ++ include/configs/gr_cpci_ax2000.h| 12 ++- include/configs/gr_ep2s60.h | 12 ++- include/configs/gr_xc3s_1500.h | 14 ++- include/configs/grsim.h | 12 ++- 17 files changed, 547 insertions(+), 38 deletions(-) create mode 100644 arch/sparc/cpu/leon3/cpu_mp.c create mode 100644 arch/sparc/include/asm/boot_mp.h create mode 100644 arch/sparc/lib/boot_mp.c diff --git a/arch/sparc/cpu/leon3/Makefile b/arch/sparc/cpu/leon3/Makefile index f1bb808..4d36061 100644 --- a/arch/sparc/cpu/leon3/Makefile +++ b/arch/sparc/cpu/leon3/Makefile @@ -28,7 +28,7 @@ LIB = $(obj)lib$(CPU).a START = start.o SOBJS = ambapp_low.o ambapp_low_c.o memcfg_low.o COBJS = cpu_init.o serial.o cpu.o ambapp.o interrupts.o prom.o usb_uhci.o \ - memcfg.o + memcfg.o cpu_mp.o SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) diff --git a/arch/sparc/cpu/leon3/cpu.c b/arch/sparc/cpu/leon3/cpu.c index 5cc9513..13d3dd7 100644 --- a/arch/sparc/cpu/leon3/cpu.c +++ b/arch/sparc/cpu/leon3/cpu.c @@ -83,8 +83,14 @@ int checkcpu(void) /* - */ -void cpu_reset(void) +int cpu_reset(int nr) { + if ( nr 0 ) { + puts( CPU[N] RESET NOT SUPPORTED BY ARCHITECTURE (N0), +SYSTEM RESET IS POSSIBLE.); + return -1; + } + /* Interrupts off */ disable_interrupts(); @@ -94,7 +100,7 @@ void cpu_reset(void) int do_reset(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) { - cpu_reset(); + cpu_reset(0); return 1; diff --git a/arch/sparc/cpu/leon3/cpu_mp.c b/arch/sparc/cpu/leon3/cpu_mp.c new file mode 100644 index 000..9074149 --- /dev/null +++ b/arch/sparc/cpu/leon3/cpu_mp.c @@ -0,0 +1,87 @@ +/* Interface implementation for cmd_mp.c on multi processor LEON + * CPUs + * + * (C) Copyright 2010 + * Daniel Hellstrom, Gaisler Research, dan...@gaisler.com + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include common.h +#include config.h + +#ifdef CONFIG_MP + +#include grlib/irqmp.h + +extern int leon_cpu_cnt; +extern ambapp_dev_irqmp *irqmp; + +int cpu_numcores(void) +{ + return leon_cpu_cnt; +} + +int cpu_status(int nr) +{ + printf(LEON CPUs available: %d\n, leon_cpu_cnt); + + return 0; +} + +int cpu_disable(int nr) +{ + printf(LEON CPU disable not available\n); + + return 0; +} + +int cpu_release(int nr, int argc, char *argv[]) +{ + unsigned int ep, stack, arg0, arg1; + + /* Get entry point, stack and argument */ + if ( argc 2 ) { + printf( At least 5 arguments must be given.\n +Argument 4 is entry point\n +Argument 5 is stack\n +Argument 6-7 is kernel arg 0 and 1 (OPTIONAL)\n); + return -1; + } + ep = simple_strtoul(argv[0], NULL, 16); + stack = simple_strtoul(argv[1], NULL, 16); + arg0 = arg1 = 0; + + if ( argc 2 ) { + arg0 = simple_strtoul(argv[2], NULL, 16); + } + if ( argc 3 ) { + arg1 = simple_strtoul(argv[3], NULL, 16); + } + + /* Register CPU start up options into MP table */ + boot_mp_cpu_setup(nr, ep, stack, (void *)arg0, (void *)arg1); + + /* Release CPU by writing to IRQ
Re: [U-Boot] [PATCH] Improve DaVinci SPI speed
Hello Sekhar, On 18/05/2010, at 14:25, Nori, Sekhar wrote: The patch looks good to me. Can you please publish some sort of numbers in the patch description indicating the performance improvement achieved? will do. A minor nit below: [...] + if((o_cnt == (len -1)) (flags SPI_XFER_END)) { Please include a space before the '-' Thanks -- Delio Thanks, Sekhar ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] libfdt: make fdt_increase_size() available to everyone
Dear Timur Tabi, In message 4bf29fe9.1070...@freescale.com you wrote: Wolfgang Denk wrote: Assume the case that the DTB is stored in NOR flash, and I pass the NOR flash address to the bootm command... I'm not sure if there is any guarantee for free room behind the DTB in this case. We can never guarantee this. The code that calls fdt_increase_size() will just have to ensure that there is enough room. Such an ensure that there is enough room is exactly what I'm asking for. If the fdt is in NOR flash, then boot_relocate_fdt() will copy it to RAM via lmb_alloc_base(), which uses CONFIG_SYS_FDT_PAD to determine how much extra room is needed. Hm... it seems that not a single board uses this setting, which also happens to be completely undocumented. So it appear to me that there are two ways the fdt is allocated in memory: 1) It is copied to a location allocated via lmb_alloc_base() by boot_relocate_fdt(). 2) It is simply placed somewhere in memory (via tftp) and left there. I don't believe we ever use malloc() to allocate the memory for the fdt, so these two should cover 100% of all cases. For me lmb_alloc_base() is just another form of malloc()... So for case #1, we can use CONFIG_SYS_FDT_PAD. For case #2, we just have to assume that when the user did tftp c my.dtb, that he knows what he's doing. I'm not sure if we have the same intentions here. I think, that for case #1 the available size is known, so we can check if we exceed the limits. And this is what we should do then. I assume that fdt_increase_size() will only be used to increase the available space by a significant amount. One example of this (and the reason I posted this patch in the first place), is to embed firmware inside the device tree. A new binding for Freescale QE firmware allows for this, and I have code in-house which implements this. If we are talking about such substantial increments then it is all the more important to check for available room. So I say that a particular board will know whether it needs to significantly expand the available amount of RAM beyond the default CONFIG_SYS_FDT_PAD. Therefore, we can define a new value of CONFIG_SYS_FDT_PAD in the board header files for those boards that need it. No. We should check if the programmed value is sufficient. 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 If in any problem you find yourself doing an immense amount of work, the answer can be obtained by simple inspection. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] libfdt: make fdt_increase_size() available to everyone
Wolfgang Denk wrote: We can never guarantee this. The code that calls fdt_increase_size() will just have to ensure that there is enough room. Such an ensure that there is enough room is exactly what I'm asking for. Maybe I don't understand what you're getting at. My point is that, whenever someone writes code that calls fdt_increase_size(), *that* person needs to provide the assurance, not me. Within fdt_increase_size(), there is no way to ensure anything. And since my patch only deals with fdt_increase_size() itself, I don't understand what you want from *me* within the context of *this* patch. If the fdt is in NOR flash, then boot_relocate_fdt() will copy it to RAM via lmb_alloc_base(), which uses CONFIG_SYS_FDT_PAD to determine how much extra room is needed. Hm... it seems that not a single board uses this setting, That's because the default has been sufficient so far. which also happens to be completely undocumented. That's got nothing to do with me. I didn't write the code that uses CONFIG_SYS_FDT_PAD. For me lmb_alloc_base() is just another form of malloc()... True, but it's not the same as malloc(). For example, I cannot use realloc() to make the allocation bigger. If all fdts were allocated via malloc(), then I could modify fdt_increase_size() to call realloc(). So for case #1, we can use CONFIG_SYS_FDT_PAD. For case #2, we just have to assume that when the user did tftp c my.dtb, that he knows what he's doing. I'm not sure if we have the same intentions here. I think, that for case #1 the available size is known, so we can check if we exceed the limits. And this is what we should do then. But within fdt_increase_size(), how do I know if the memory is allocated via lmb_alloc_base()? The heap management data structure for an lmb is managed external to the heap itself. I assume that fdt_increase_size() will only be used to increase the available space by a significant amount. One example of this (and the reason I posted this patch in the first place), is to embed firmware inside the device tree. A new binding for Freescale QE firmware allows for this, and I have code in-house which implements this. If we are talking about such substantial increments then it is all the more important to check for available room. And again, the point *I* am trying to make is that it's okay to put the onus of that check on the *caller* of fdt_increase_size(), and not on fdt_increase_size() itself. So I say that a particular board will know whether it needs to significantly expand the available amount of RAM beyond the default CONFIG_SYS_FDT_PAD. Therefore, we can define a new value of CONFIG_SYS_FDT_PAD in the board header files for those boards that need it. No. We should check if the programmed value is sufficient. But that is only meaningful if the fdt is allocated via an lmb, which is not true in case #2. In case #2, there is no allocation of memory, so there's no way to know within fdt_increase_size()! -- Timur Tabi Linux kernel developer at Freescale ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 0/1] Fix hang trying to protect flash sectors
Yes we do have 2 flash chips. Here's the mapping: #define CONFIG_SYS_FLASH_BASE 0xf800 /* 2 chips*16M */ #define CONFIG_SYS_MONITOR_BASE TEXT_BASE /* start of monitor */ and in our config.mk file: TEXT_BASE = 0xfff4 This is the same flash chip as that at 0xf800, but remapped at reset by a CPLD to the high memory area too. The conditional code in cfi_flash.c: #if (CONFIG_SYS_MONITOR_BASE = CONFIG_SYS_FLASH_BASE) \ (!defined(CONFIG_MONITOR_IS_IN_RAM)) is therefore included since 0xfff4 is greater than 0xf800, but flash_get_info(0xfff4) returns NULL (as expected). I understand that not passing NULL to flash_protect() would be a better idea, and there's nothing wrong with doing both. I was going to fix it in cfi_flash.c, but noticed that many other areas of code (in different flash.c files) do the same thing. In our own build, I have just removed the code that tries to protect the monitor area, and will use an auto-protect area instead to do the same job. - Mark Stefan Roese s...@denx.de 5/18/2010 8:20 PM Hi Mark, On Tuesday 18 May 2010 07:26:34 Mark Tomlinson wrote: Our hardware has part of the flash mapped in two address ranges. The CONFIG_SYS_MONITOR_BASE is in the upper 'boot' area, whereas the CONFIG_SYS_FLASH_BANKS_LIST has the full flash available at a lower address. Just to be sure: You have 2 FLASH chips? Mapped at which addresses? And where does CONFIG_SYS_MONITOR_BASE point to? This all works fine until the code in cfi_flash.c:flash_init(), which uses flash_get_info() to find the flash_info_t associated with the monitor and environment. These are not in the probed flash range, so flash_get_info() returns NULL. You mean that flash_get_info(CONFIG_SYS_MONITOR_BASE) returns NULL? Please explain again, why is this the case? This is not checked and is passed directly to flash_protect(). Since flash_protect() was not checking for this NULL pointer either, random memory would be clobbered causing the device to lock up. This patch changes flash_protect() to check for the NULL, and the error goes unreported. I would prefer to fix the real problem, that flash_get_info() returns NULL, instead. Cheers, Stefan -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: off...@denx.de NOTICE: This message contains privileged and confidential information intended only for the use of the addressee named above. If you are not the intended recipient of this message you are hereby notified that you must not disseminate, copy or take any action in reliance on it. If you have received this message in error please notify Allied Telesis Labs Ltd immediately. Any views expressed in this message are those of the individual sender, except where the sender has the authority to issue and specifically states them to be the views of Allied Telesis Labs. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] libfdt: make fdt_increase_size() available to everyone
Dear Timur Tabi, In message 4bf2b302.2030...@freescale.com you wrote: We can never guarantee this. The code that calls fdt_increase_size() will just have to ensure that there is enough room. Such an ensure that there is enough room is exactly what I'm asking for. Maybe I don't understand what you're getting at. My point is that, whenever someone writes code that calls fdt_increase_size(), *that* person needs to provide the assurance, not me. Within fdt_increase_size(), there is no way to ensure anything. And since my patch only deals with fdt_increase_size() itself, I don't understand what you want from *me* within the context of *this* patch. Your problem is that you are too much focussed on your patch only. You need to keep your eyes open for the bigger whole. Your patch has the potential of causing nasty crashes, and I ask you to prevent this. This may require changes outside the current scope of your patch. If the fdt is in NOR flash, then boot_relocate_fdt() will copy it to RAM via lmb_alloc_base(), which uses CONFIG_SYS_FDT_PAD to determine how much extra room is needed. Hm... it seems that not a single board uses this setting, That's because the default has been sufficient so far. Right. But your patch is supposed to change this. which also happens to be completely undocumented. That's got nothing to do with me. I didn't write the code that uses CONFIG_SYS_FDT_PAD. No. But you are trying to get code into mainline where the current code is insufficient. So you also got to extend the code to make yourpatch acceptable. I think, that for case #1 the available size is known, so we can check if we exceed the limits. And this is what we should do then. But within fdt_increase_size(), how do I know if the memory is allocated via lmb_alloc_base()? The heap management data structure for an lmb is managed external to the heap itself. If you don't know this in fdt_increase_size(), then either make it known there (for example by extending other code to pass on such information), or add such checking to other parts of the code in the call chain. If we are talking about such substantial increments then it is all the more important to check for available room. And again, the point *I* am trying to make is that it's okay to put the onus of that check on the *caller* of fdt_increase_size(), and not on fdt_increase_size() itself. OK. I have no problem with that. I am just missing this other part of the required changes in your patch. No. We should check if the programmed value is sufficient. But that is only meaningful if the fdt is allocated via an lmb, which is not true in case #2. In case #2, there is no allocation of memory, so there's no way to know within fdt_increase_size()! Maybe. But there is still case #1, where we have a real problem, and I will not accept your patch without seing this problem properly addressed. 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 Do not underestimate the value of print statements for debugging. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] libfdt: make fdt_increase_size() available to everyone
On Tue, May 18, 2010 at 5:20 PM, Wolfgang Denk w...@denx.de wrote: And again, the point *I* am trying to make is that it's okay to put the onus of that check on the *caller* of fdt_increase_size(), and not on fdt_increase_size() itself. OK. I have no problem with that. I am just missing this other part of the required changes in your patch. I'm not ready to submit any code that calls fdt_increase_size() yet. I'm just trying to create the infrastructure here so that I can be sure that my in-house code is correct. If this patch is rejected because there's a better way to increase the size of an fdt, then I need to know that *now*. But that is only meaningful if the fdt is allocated via an lmb, which is not true in case #2. In case #2, there is no allocation of memory, so there's no way to know within fdt_increase_size()! Maybe. But there is still case #1, where we have a real problem, and I will not accept your patch without seing this problem properly addressed. And I said that we'll handle this by setting a new value of CONFIG_SYS_FDT_PAD. This will ensure that the initial memory allocation is large enough. Technically speaking, even without my patch we already have the problem that bothers you. When boot_relocate_fdt() allocates the LMB, it gives it an additional buffer of 12KB. There's nothing stopping some code from calling fdt_setprop() and/or fdt_add_subnode() a thousand times, which will cause the fdt to grow outside of the allocated area. -- Timur Tabi Linux kernel developer at Freescale ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/3 v2] mmc: control message print in find_mmc_device
Thomas Chou wrote: An argument, verbose, is added to enable/disable the Device not found message. Because we need to query mmc devices in mmc_spi subcommand and don't want the message. Please drop this one. Because I reduced the cmd_mmc_spi.c, so that the query is not needed. - Thomas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 3/3 v8] mmc: add generic mmc spi driver
This patch supports mmc/sd card with spi interface. It is based on the generic mmc framework. It works with SDHC and supports multi blocks read/write. The crc checksum on data packet is enabled with the def, #define CONFIG_MMC_SPI_CRC_ON There is a subcomamnd mmc_spi to setup spi bus and cs at run time. Signed-off-by: Thomas Chou tho...@wytron.com.tw --- v8: make mmc.c core aware of spi protocol, per Andy. work with multi blocks read/write. reduce cmd_mmc_spi.c, doesnt query to mmc dev list. v7: use find_mmc_device(dev, verbose), per Wolfgang. v6: add constant macros, crc check on data, per Andy. v5: remove dev_num limit to search. v4: change mmc_spi subcommand to search and create new mmc dev. v3: add mmc_spi_init() proto to mmc_spi.h. v2: add crc7, use cmd58 to read ocr, add subcommand mmc_spi. common/Makefile |1 + common/cmd_mmc_spi.c | 82 ++ drivers/mmc/Makefile |1 + drivers/mmc/mmc.c | 81 +++--- drivers/mmc/mmc_spi.c | 296 + include/mmc.h |8 ++ 6 files changed, 451 insertions(+), 18 deletions(-) create mode 100644 common/cmd_mmc_spi.c create mode 100644 drivers/mmc/mmc_spi.c diff --git a/common/Makefile b/common/Makefile index 2c37073..55beac5 100644 --- a/common/Makefile +++ b/common/Makefile @@ -119,6 +119,7 @@ COBJS-$(CONFIG_CMD_MII) += miiphyutil.o COBJS-$(CONFIG_CMD_MII) += cmd_mii.o COBJS-$(CONFIG_CMD_MISC) += cmd_misc.o COBJS-$(CONFIG_CMD_MMC) += cmd_mmc.o +COBJS-$(CONFIG_CMD_MMC_SPI) += cmd_mmc_spi.o COBJS-$(CONFIG_MP) += cmd_mp.o COBJS-$(CONFIG_CMD_MTDPARTS) += cmd_mtdparts.o COBJS-$(CONFIG_CMD_NAND) += cmd_nand.o diff --git a/common/cmd_mmc_spi.c b/common/cmd_mmc_spi.c new file mode 100644 index 000..13933b0 --- /dev/null +++ b/common/cmd_mmc_spi.c @@ -0,0 +1,82 @@ +/* + * Command for mmc_spi setup. + * + * Copyright (C) 2010 Thomas Chou tho...@wytron.com.tw + * Licensed under the GPL-2 or later. + */ + +#include common.h +#include mmc.h +#include spi.h + +#ifndef CONFIG_MMC_SPI_BUS +# define CONFIG_MMC_SPI_BUS 0 +#endif +#ifndef CONFIG_MMC_SPI_CS +# define CONFIG_MMC_SPI_CS 1 +#endif +#ifndef CONFIG_MMC_SPI_SPEED +# define CONFIG_MMC_SPI_SPEED 2500 +#endif +#ifndef CONFIG_MMC_SPI_MODE +# define CONFIG_MMC_SPI_MODE SPI_MODE_3 +#endif + +static int do_mmc_spi(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ + uint bus = CONFIG_MMC_SPI_BUS; + uint cs = CONFIG_MMC_SPI_CS; + uint speed = CONFIG_MMC_SPI_SPEED; + uint mode = CONFIG_MMC_SPI_MODE; + char *endp; + struct mmc *mmc; + + if (argc 2) + goto usage; + + cs = simple_strtoul(argv[1], endp, 0); + if (*argv[1] == 0 || (*endp != 0 *endp != ':')) + goto usage; + if (*endp == ':') { + if (endp[1] == 0) + goto usage; + bus = cs; + cs = simple_strtoul(endp + 1, endp, 0); + if (*endp != 0) + goto usage; + } + if (argc = 3) { + speed = simple_strtoul(argv[2], endp, 0); + if (*argv[2] == 0 || *endp != 0) + goto usage; + } + if (argc = 4) { + mode = simple_strtoul(argv[3], endp, 16); + if (*argv[3] == 0 || *endp != 0) + goto usage; + } + if (!spi_cs_is_valid(bus, cs)) { + printf(Invalid SPI bus %u cs %u\n, bus, cs); + return 1; + } + + mmc = mmc_spi_init(bus, cs, speed, mode); + if (!mmc) { + printf(Failed to create MMC Device\n); + return 1; + } + printf(%s: %d at %u:%u %u %u\n, mmc-name, mmc-block_dev.dev, + bus, cs, speed, mode); + return 0; + +usage: + cmd_usage(cmdtp); + return 1; +} + +U_BOOT_CMD( + mmc_spi,4, 0, do_mmc_spi, + mmc_spi setup, + [bus:]cs [hz] [mode] - setup mmc_spi device on given\n + SPI bus and chip select\n +); diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile index 6fa04b8..02ed329 100644 --- a/drivers/mmc/Makefile +++ b/drivers/mmc/Makefile @@ -28,6 +28,7 @@ LIB := $(obj)libmmc.a COBJS-$(CONFIG_GENERIC_MMC) += mmc.o COBJS-$(CONFIG_ATMEL_MCI) += atmel_mci.o COBJS-$(CONFIG_BFIN_SDH) += bfin_sdh.o +COBJS-$(CONFIG_MMC_SPI) += mmc_spi.o COBJS-$(CONFIG_OMAP3_MMC) += omap3_mmc.o COBJS-$(CONFIG_FSL_ESDHC) += fsl_esdhc.o COBJS-$(CONFIG_MXC_MMC) += mxcmmc.o diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index aefd721..0e819f8 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -283,7 +283,10 @@ static int mmc_write_blocks(struct mmc *mmc, const char *src, uint start, return err; } - if (blkcnt 1) { + /* SPI multiblock writes terminate using a special +* token, not a STOP_TRANSMISSION request. +*/ +
[U-Boot] [PATCH] bugfix: Guruplug: Use standard miiphy call to reset PHY chip.
From: Mahavir Jain mj...@marvell.com Current PHY Software Reset operation in guruplug does not poll reset bit in control register to go to 0(auto clearing) for making sure reset was successful.This patch uses standard miiphy call miiphy_reset to make sure proper PHY reset operation. Signed-off-by: Mahavir Jain mj...@marvell.com --- board/Marvell/guruplug/guruplug.c |9 + 1 files changed, 1 insertions(+), 8 deletions(-) diff --git a/board/Marvell/guruplug/guruplug.c b/board/Marvell/guruplug/guruplug.c index ba47ca1..c028a53 100644 --- a/board/Marvell/guruplug/guruplug.c +++ b/board/Marvell/guruplug/guruplug.c @@ -146,14 +146,7 @@ void mv_phy_88e1121_init(char *name) miiphy_write(name, devadr, MV88E1121_PGADR_REG, 0); /* reset the phy */ - if (miiphy_read (name, devadr, PHY_BMCR, reg) != 0) { - printf(Err..(%s) PHY status read failed\n, __FUNCTION__); - return; - } - if (miiphy_write (name, devadr, PHY_BMCR, reg | 0x8000) != 0) { - printf(Err..(%s) PHY reset failed\n, __FUNCTION__); - return; - } + miiphy_reset(name, devadr); printf(88E1121 Initialized on %s\n, name); } -- 1.5.4.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot