Re: [U-Boot] Merging device trees at runtime for module-based systems
On 10/31/2012 1:00 PM, Daniel Mack wrote: cc devicetree-discuss. Here's a reference to the full thread: http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/145221/ On 26.10.2012 20:39, Stephen Warren wrote: On 10/24/2012 03:47 AM, Daniel Mack wrote: Hi, a project I'm involved in uses a module/baseboard combo, and components on either board are described in DT. I'm currently using separate dts files which build upon each other with include statements, which works fine for development. In production though, we will certainly have running changes (and hence different versions) over the lifetime of the product for both the baseboard and the module, and the hardware has support for identifying the versions of both sides at runtime. So let's say we have n versions of the baseboard and m versions of the module, we would much like to only prepare n + m files, instead of n * m by pre-compiling every possible combination (some of which may actually never occur 'in the wild'). So my question is: is it possible to do that kind of assembly of a number of files at runtime in U-Boot? I guess all it takes is merging a number of trees together, right? I browsed through the APIs but couldn't yet find an clear approach to that kind of problem. If not, what would it take to add that functionality? I can probably help with the implementation if someone tells me what would be the right way. Yes, solving this would be very useful; it's a wide-spread problem. Some thoughts though: Simply overlaying two DTBs on top of each-other (in the same fashion that dtc's /include/ statement would do at compile-time) might not be fully general enough, although perhaps it would be sufficient for your immediate needs. For example, lets say that a GPIO is routed from a device on the main board to a device on a daughter board, or even from one daughter board into the main board and back out to a different daughter board. Now, consider that the different board(s) that are the source of the GPIO might use completely different SoCs or versions of the SoC, which might require using a different GPIO specifier to represent the signal. That means you need to change the .dtb file for the client of the GPIO depending on the HW or .dtb that provides the GPIO. That's certainly not a simple matter of merging multiple .dtb blobs together. Hmm. After implementing a very simple overlay approach, I can now see your point :) Yes in fact, that's a real problem. The same issue could easily apply to I2C or SPI buses, chip selects, etc. One solution would be to explicitly represent a connector or connection-point in DT, such that the connector can implement the naming of all signals that pass through it, and provide a translation point for hooking the two DT fragments together. This seems within the spirit of DT. Yes, but you still can't handle references that way. Let me try and conclude this for others. Say the module tree A looks something like this: / { multi-regulator { vcc1v8: regulator@0 { /* ... */ }; }; }; ... and the baseboard (B), that makes use of (and hence depends on) the module, has something like this: / { consumer { main-supply = vcc1v8; }; }; Now, let's say in a subsequent version of the module, we change whatever provides that supply for 1.8 volts, but the consumer on the baseboard shouldn't care much of course, thanks to all the abstraction layers that we have now in the kernel. However, the problem here is that I can't just compile trees A and B individually into .dtbs that get merged later, because dtc will bail on the unresolved reference of vcc1v8 of course. And cases like this are the whole reason why I started to think about modularization of trees in the first place. So the simple overlay method doesn't help here at all, even though I can share the code if anyone's interested. Another solution might be some form of variables/macros/code in the DTB that can be used to parameterize other DTBs that get merged with it. This is probably an enormous can of worms. Yes, exactly, a can of worms and most probably unmaintainble in real life. I start to believe that the cleanest solution to this would be to have full DTC functionality in U-Boot and compile the tree ... which is exactly the way that Open Firmware does it, since the invention of the device tree. The model is that the boot firmware, which needs to know the system configuration to do its job anyway, exports that configuration via the device tree. from dts, but then again I have no clue on how to handle the file lookups that arise from includes. Do you think it would it be worth going that way? If not, I guess we're down to n*m files eventually, which is really sad as they might even
Re: [U-Boot] Merging device trees at runtime for module-based systems
On Fri, Oct 26, 2012 at 09:24:11AM +0200, Daniel Mack wrote: On 26.10.2012 02:53, David Gibson wrote: On Thu, Oct 25, 2012 at 10:46:32PM +0200, Wolfgang Denk wrote: Dear Daniel, In message 50893633.6070...@gmail.com you wrote: Overwrites must be addressed in the first place. The most common example is that a more generic part (the module tree) registers all details about a peripheral up-front but then sets its status to 'disabled'. That way, the more specific part (the base board tree) can overwrite this property to 'okay' at wish to enable it and not care for the pre-defined details. This is also how we do things in our device-trees. Agreed. I definitely can see the benefit of such a feature and would be happy if you could go forward and implement it. Ok then. I guess this should be something that can eventually be merged back into libfdt? I can't speak for the FDT custodian, but I think this makes a lot of sense. As a rule I'm happy to see more functionality for libfdt. I've only seen bits and pieces of this thread, though, so I'd need to see a summary of what exactly is being proposed. That's strange, as I copied you from the very first posting. Anyway, here's the archive: Oh I probably got them somewhere in my mail. But it's only recently that I really noticed - I get a fair bit of mail. http://lists.denx.de/pipermail/u-boot/2012-October/138227.html I would especially like to know where such a new functionality should live, which data types it should operate on and what would be an appropriate name for it. So.. the first thought I have reading the original mail in the thread is that it's arguable that you really want a more heavyweight firmware for this setup, that actively maintains a live device tree as OF does, rather than u-boot which is pretty oriented towards a close-to-static device setup. That's just a thought though, I'm not saying that at least some of this functionality doesn't belong in libfdt. So, my thought would be that stuff for manipulating big chunks of tree should go in a new .c file inside the libfdt tree. We already have del_node and nop_node of course, which can remove whole subtrees. I guess the big extra function you'd want would be something like: fdt_graft(void *fdt, int offset, void *subtree); Which would graft the tree blob give by subtree into the master tree (fdt) at node 'offset'. Actually that might need to take a name for the top-level of the subtree to take in the new tree too. Things get trickier when you consider what might need to be tweaked in the subtree to make it fit into the master tree. If it requires widespread alterations through the subtree that's going to get really ugly and I think you would be better off with a firmware with a fuller handling of a live device tree. But I think that can probably be avoided with proper design of the bindings. To get that to work you'll need to make sure you use some sort of local addressing within the subtree. Then it should only be necessary to insert/alter a ranges property at the top level of the subtree (or possibly its parent) to map that correctly into the global address space. Likewise interrupts within the subtree probably shouldn't address an external interrupt controller but rather the root of the tree. You can then insert an interrupt-map property which will wire those into the global interrupt tree. -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [RFC] mmc: Properly determine maximum supported bus width
At some point, a confusion arose about the use of the bit definitions in host_caps for bus widths, and the value in ext_csd. By coincidence, a simple shift could convert between one and the other: MMC_MODE_1BIT = 0, EXT_CSD_BUS_WIDTH_1 = 0 MMC_MODE_4BIT = 0x100, EXT_CSD_BUS_WIDTH_4 = 1 MMC_MODE_8BIT = 0x200, EXT_CSD_BUS_WIDTH_8 = 2 However, as host_caps is a bitmask of supported things, there is not, in fact, a one-to-one correspondence. host_caps is capable of containing MODE_4BIT | MODE_8BIT, so nonsensical things were happening where we would try to set the bus width to 12. The new code clarifies the very different namespaces: host_caps/card_caps = bitmask (MMC_MODE_*) ext CSD fields are just an index (EXT_CSD_BUS_WIDTH_*) mmc-bus_width integer number of bits (1, 4, 8) We create arrays to map between the namespaces, like in Linux. Signed-off-by: Andy Fleming aflem...@freescale.com --- This is, I think, the approach we should use to identify the proper bus width for an mmc device. Please review and/or test. drivers/mmc/mmc.c | 47 +++ 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 5fbf956..c379a74 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -867,7 +867,7 @@ void mmc_set_bus_width(struct mmc *mmc, uint width) int mmc_startup(struct mmc *mmc) { - int err, width; + int err; uint mult, freq; u64 cmult, csize, capacity; struct mmc_cmd cmd; @@ -1086,21 +1086,44 @@ int mmc_startup(struct mmc *mmc) else mmc-tran_speed = 2500; } else { - width = ((mmc-host_caps MMC_MODE_MASK_WIDTH_BITS) -MMC_MODE_WIDTH_BITS_SHIFT); - for (; width = 0; width--) { - /* Set the card to use 4 bit*/ + int idx; + + /* An array of possible bus widths in order of preference */ + static unsigned ext_csd_bits[] = { + EXT_CSD_BUS_WIDTH_8, + EXT_CSD_BUS_WIDTH_4, + EXT_CSD_BUS_WIDTH_1, + }; + + /* An array to map CSD bus widths to host cap bits */ + static unsigned ext_to_hostcaps[] = { + [EXT_CSD_BUS_WIDTH_4] = MMC_MODE_4BIT, + [EXT_CSD_BUS_WIDTH_8] = MMC_MODE_8BIT, + }; + + /* An array to map chosen bus width to an integer */ + static unsigned widths[] = { + 8, 4, 1, + }; + + for (idx=0; idx ARRAY_SIZE(ext_csd_bits); idx++) { + unsigned int extw = ext_csd_bits[idx]; + + /* +* Check to make sure the controller supports +* this bus width, if it's more than 1 +*/ + if (extw != EXT_CSD_BUS_WIDTH_1 + !(mmc-host_caps ext_to_hostcaps[extw])) + continue; + err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, - EXT_CSD_BUS_WIDTH, width); + EXT_CSD_BUS_WIDTH, extw); if (err) continue; - if (!width) { - mmc_set_bus_width(mmc, 1); - break; - } else - mmc_set_bus_width(mmc, 4 * width); + mmc_set_bus_width(mmc, widths[idx]); err = mmc_send_ext_csd(mmc, test_csd); if (!err ext_csd[EXT_CSD_PARTITIONING_SUPPORT] \ @@ -1114,7 +1137,7 @@ int mmc_startup(struct mmc *mmc) memcmp(ext_csd[EXT_CSD_SEC_CNT], \ test_csd[EXT_CSD_SEC_CNT], 4) == 0) { - mmc-card_caps |= width; + mmc-card_caps |= ext_to_hostcaps[extw]; break; } } -- 1.7.9.7 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] Merging device trees at runtime for module-based systems
On 10/31/2012 6:36 PM, Stephen Warren wrote: On 10/31/2012 05:56 PM, Mitch Bradley wrote: On 10/31/2012 1:00 PM, Daniel Mack wrote: cc devicetree-discuss. Here's a reference to the full thread: http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/145221/ On 26.10.2012 20:39, Stephen Warren wrote: On 10/24/2012 03:47 AM, Daniel Mack wrote: Hi, a project I'm involved in uses a module/baseboard combo, and components on either board are described in DT. I'm currently using separate dts files which build upon each other with include statements, which works fine for development. In production though, we will certainly have running changes (and hence different versions) over the lifetime of the product for both the baseboard and the module, and the hardware has support for identifying the versions of both sides at runtime. ... I start to believe that the cleanest solution to this would be to have full DTC functionality in U-Boot and compile the tree ... which is exactly the way that Open Firmware does it, since the invention of the device tree. The model is that the boot firmware, which needs to know the system configuration to do its job anyway, exports that configuration via the device tree. Doesn't OF generate the DT from internal data structures (although I don't know where those come from...), whereas what Daniel mentions above is more like the bootloader having access to a bunch of .dts fragments, selecting the appropriate subset of those to use, parsing them into an internal data structure (i.e. running dtc), and then generating a DTB from it. The overall result is that the bootloader causes a DTB to be generated at run-time, so at that level it's the same, but the implementation seems pretty different. Yes, which is why I cut the cited sentence at the place I did (before the part about dts fragments). ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] powerpc/corenet_ds: move SATA config to board configuration
board configuration file is included before asm/config_mpc85xx.h. however, CONFIG_FSL_SATA_V2 is defined in asm/config_mpc85xx.h. it will never take effective in the board configuration file for this kind of code : #ifdef CONFIG_FSL_SATA_V2 ... #endif To solve this problem, move CONFIG_FSL_SATA_V2 to board configuration header file. Signed-off-by: Roy Zang tie-fei.z...@freescale.com --- arch/powerpc/include/asm/config_mpc85xx.h |3 --- include/configs/P2041RDB.h|4 +++- include/configs/P3041DS.h |1 + include/configs/P5020DS.h |1 + 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/include/asm/config_mpc85xx.h b/arch/powerpc/include/asm/config_mpc85xx.h index 03baaee..8916d5e 100644 --- a/arch/powerpc/include/asm/config_mpc85xx.h +++ b/arch/powerpc/include/asm/config_mpc85xx.h @@ -318,7 +318,6 @@ #define CONFIG_SYS_FSL_NUM_CC_PLLS 2 #define CONFIG_SYS_FSL_NUM_LAWS32 #define CONFIG_SYS_FSL_SEC_COMPAT 4 -#define CONFIG_FSL_SATA_V2 #define CONFIG_SYS_NUM_FMAN1 #define CONFIG_SYS_NUM_FM1_DTSEC 5 #define CONFIG_SYS_NUM_FM1_10GEC 1 @@ -350,7 +349,6 @@ #define CONFIG_SYS_FSL_NUM_CC_PLLS 2 #define CONFIG_SYS_FSL_NUM_LAWS32 #define CONFIG_SYS_FSL_SEC_COMPAT 4 -#define CONFIG_FSL_SATA_V2 #define CONFIG_SYS_NUM_FMAN1 #define CONFIG_SYS_NUM_FM1_DTSEC 5 #define CONFIG_SYS_NUM_FM1_10GEC 1 @@ -425,7 +423,6 @@ #define CONFIG_SYS_FSL_NUM_CC_PLLS 2 #define CONFIG_SYS_FSL_NUM_LAWS32 #define CONFIG_SYS_FSL_SEC_COMPAT 4 -#define CONFIG_FSL_SATA_V2 #define CONFIG_SYS_NUM_FMAN1 #define CONFIG_SYS_NUM_FM1_DTSEC 5 #define CONFIG_SYS_NUM_FM1_10GEC 1 diff --git a/include/configs/P2041RDB.h b/include/configs/P2041RDB.h index 5cdb628..8509d20 100644 --- a/include/configs/P2041RDB.h +++ b/include/configs/P2041RDB.h @@ -560,8 +560,10 @@ unsigned long get_board_sys_clk(unsigned long dummy); #endif /* CONFIG_PCI */ /* SATA */ +#define CONFIG_FSL_SATA_V2 + +#ifdef CONFIG_FSL_SATA_V2 #define CONFIG_FSL_SATA -#ifdef CONFIG_FSL_SATA #define CONFIG_LIBATA #define CONFIG_SYS_SATA_MAX_DEVICE 2 diff --git a/include/configs/P3041DS.h b/include/configs/P3041DS.h index cf184e7..ce8f9b0 100644 --- a/include/configs/P3041DS.h +++ b/include/configs/P3041DS.h @@ -32,6 +32,7 @@ #define CONFIG_MMC #define CONFIG_NAND_FSL_ELBC +#define CONFIG_FSL_SATA_V2 #define CONFIG_PCIE3 #define CONFIG_PCIE4 #define CONFIG_SYS_DPAA_RMAN diff --git a/include/configs/P5020DS.h b/include/configs/P5020DS.h index 7018d7a..778230d 100644 --- a/include/configs/P5020DS.h +++ b/include/configs/P5020DS.h @@ -32,6 +32,7 @@ #define CONFIG_MMC #define CONFIG_NAND_FSL_ELBC +#define CONFIG_FSL_SATA_V2 #define CONFIG_PCIE3 #define CONFIG_PCIE4 #define CONFIG_SYS_FSL_RAID_ENGINE -- 1.7.8.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/2] WIP: tegra: i2c: Enable new CONFIG_SYS_I2C framework
Hello Stephen, On 31.10.2012 17:25, Stephen Warren wrote: On 10/31/2012 09:56 AM, Simon Glass wrote: Hi Stephen, On Wed, Oct 31, 2012 at 8:41 AM, Stephen Warrenswar...@wwwdotorg.org wrote: On 10/31/2012 12:00 AM, Heiko Schocher wrote: Hello Stephen, On 30.10.2012 23:32, Stephen Warren wrote: On 10/30/2012 11:28 AM, Simon Glass wrote: ... diff --git a/include/configs/seaboard.h b/include/configs/seaboard.h ... +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_ADAPTERS{tegra_i2c_adap[0]} +#define CONFIG_SYS_NUM_I2C_ADAPTERSTEGRA_I2C_NUM_CONTROLLERS But, why is CONFIG_SYS_I2C_ADAPTERS needed; can't the adapter init functions (which presumably would be called from board code or as a result of DT parsing) dynamically register themselves? ... I mainly ask because Simon is pushing to have Tegra's U-Boot completely driven by device tree. If we need to hard-code the list of enabled I2C adapters in the U-Boot config file, and don't also support dynamically added I2C drivers, then that will be incompatible with device tree. Mostly, although with the serial console (which had a similar problem) we just decoded the information onto the stack as needed. It was inefficient, but worked fine for a small number of operations. We might be able to do better with pre-relocation malloc() soon. It's more complex than that. If we use DT, we must be able to: a) Configure exactly which I2C instances the board uses from DT. b) Provide configuration (e.g. max clock rate) for those instances from DT. If all in-use I2C adapters must be specified statically in CONFIG_SYS_I2C_ADAPTERS, then since a board's DT could enable any arbitrary subset of Tegra's I2C adapters, then we must always set CONFIG_SYS_I2C_ADAPTERS to the list of all Tegra's I2C adapters. If we put some subset into CONFIG_SYS_I2C_ADAPTERS, then we're pre-defining the maximal set of I2C adapters that a board can enable, which means DT isn't specifying that, but rather the board config file is, and hence it's pointless to even use DT for this purpose. My current approach needs static specific adapters, yes. But I see not the problem, if we define all tegra adapters per default and ... Now, most boards won't use all I2C adapters, so presumably the Tegra I2C init routine will look for status=disabled (or the inverse) in DT, and only initialize if the DT node for the adapter is present and enabled. ... and it should here be possible to add the used i2c busses! dynamically from the info in the DT, or? We use in U-Boot not direct the i2c adapters, instead i2c busses ... so if we define all 4 tegra i2c adapters per default, but using on one board only adapter 1 and 3 we have two i2c busses: 0 (= adapter 1) and 1 (= adapter 3) ... no gaps between ...) However, this will leave entries in CONFIG_SYS_I2C_ADAPTERS that are not enabled, which will presumably influence the I2C bus numbering in the No, why? You can add all i2c adapters to the CONFIG_SYS_I2C_ADAPTERS define, without really use them in CONFIG_SYS_I2C_BUSSES. And it should be possible (not yet coded, but tried in an older version) to add i2c busses after relocation, or while interpret DT ... something like I did in http://git.denx.de/?p=u-boot/u-boot-i2c.git;a=commitdiff;h=ccb680c8cf9002232bc459e4003e3b47db5e1bf4#patch13 function: int i2c_add_one_bus(char *buf) - while interpreting DT i2c info for above board will result in calling: i2c_add_one_bus(tegra-i2c-1); i2c_add_one_bus(tegra-i2c-3); and results in two new i2c busses 0 and 1 ... Maybe this is a way to go? U-Boot shell; there will be I2C busses that exist but cannot be used. Is this what we want? Perhaps it is in fact a good idea to always make the Now, this is wrong! You mix here i2c bus with i2c adapter! We have some i2c adapters which are defined but (maybe) not used ... U-Boot shell's I2C bus IDs be the same as the HW's, and hence leave gaps when some ports aren't enabled? That would be a departure from the way USB is handled today though. Hmm.. but is this possible? If we have a board with 2 (or more) different i2c adapters (which is now possible with the new framework), for example 2 i2c soft adapters + 4 tegra i2c adapter ... if we say the i2c tegra adapters are the first 4 i2c busses, so we cannot longer say the two soft i2c adapters are starting from 0 too (and vice versa) ... 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] [RFC] mmc: Properly determine maximum supported bus width
Hi Andy, It's working fine on my environment. Tested-by: Jaehoon Chung jh80.ch...@samsung.com Best Regards, Jaehoon Chung On 11/01/2012 02:02 PM, Andy Fleming wrote: At some point, a confusion arose about the use of the bit definitions in host_caps for bus widths, and the value in ext_csd. By coincidence, a simple shift could convert between one and the other: MMC_MODE_1BIT = 0, EXT_CSD_BUS_WIDTH_1 = 0 MMC_MODE_4BIT = 0x100, EXT_CSD_BUS_WIDTH_4 = 1 MMC_MODE_8BIT = 0x200, EXT_CSD_BUS_WIDTH_8 = 2 However, as host_caps is a bitmask of supported things, there is not, in fact, a one-to-one correspondence. host_caps is capable of containing MODE_4BIT | MODE_8BIT, so nonsensical things were happening where we would try to set the bus width to 12. The new code clarifies the very different namespaces: host_caps/card_caps = bitmask (MMC_MODE_*) ext CSD fields are just an index (EXT_CSD_BUS_WIDTH_*) mmc-bus_width integer number of bits (1, 4, 8) We create arrays to map between the namespaces, like in Linux. Signed-off-by: Andy Fleming aflem...@freescale.com --- This is, I think, the approach we should use to identify the proper bus width for an mmc device. Please review and/or test. drivers/mmc/mmc.c | 47 +++ 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 5fbf956..c379a74 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -867,7 +867,7 @@ void mmc_set_bus_width(struct mmc *mmc, uint width) int mmc_startup(struct mmc *mmc) { - int err, width; + int err; uint mult, freq; u64 cmult, csize, capacity; struct mmc_cmd cmd; @@ -1086,21 +1086,44 @@ int mmc_startup(struct mmc *mmc) else mmc-tran_speed = 2500; } else { - width = ((mmc-host_caps MMC_MODE_MASK_WIDTH_BITS) - MMC_MODE_WIDTH_BITS_SHIFT); - for (; width = 0; width--) { - /* Set the card to use 4 bit*/ + int idx; + + /* An array of possible bus widths in order of preference */ + static unsigned ext_csd_bits[] = { + EXT_CSD_BUS_WIDTH_8, + EXT_CSD_BUS_WIDTH_4, + EXT_CSD_BUS_WIDTH_1, + }; + + /* An array to map CSD bus widths to host cap bits */ + static unsigned ext_to_hostcaps[] = { + [EXT_CSD_BUS_WIDTH_4] = MMC_MODE_4BIT, + [EXT_CSD_BUS_WIDTH_8] = MMC_MODE_8BIT, + }; + + /* An array to map chosen bus width to an integer */ + static unsigned widths[] = { + 8, 4, 1, + }; + + for (idx=0; idx ARRAY_SIZE(ext_csd_bits); idx++) { + unsigned int extw = ext_csd_bits[idx]; + + /* + * Check to make sure the controller supports + * this bus width, if it's more than 1 + */ + if (extw != EXT_CSD_BUS_WIDTH_1 + !(mmc-host_caps ext_to_hostcaps[extw])) + continue; + err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, - EXT_CSD_BUS_WIDTH, width); + EXT_CSD_BUS_WIDTH, extw); if (err) continue; - if (!width) { - mmc_set_bus_width(mmc, 1); - break; - } else - mmc_set_bus_width(mmc, 4 * width); + mmc_set_bus_width(mmc, widths[idx]); err = mmc_send_ext_csd(mmc, test_csd); if (!err ext_csd[EXT_CSD_PARTITIONING_SUPPORT] \ @@ -1114,7 +1137,7 @@ int mmc_startup(struct mmc *mmc) memcmp(ext_csd[EXT_CSD_SEC_CNT], \ test_csd[EXT_CSD_SEC_CNT], 4) == 0) { - mmc-card_caps |= width; + mmc-card_caps |= ext_to_hostcaps[extw]; break; } } ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] Merging device trees at runtime for module-based systems
On 01.11.2012 04:26, David Gibson wrote: On Fri, Oct 26, 2012 at 09:24:11AM +0200, Daniel Mack wrote: I would especially like to know where such a new functionality should live, which data types it should operate on and what would be an appropriate name for it. So.. the first thought I have reading the original mail in the thread is that it's arguable that you really want a more heavyweight firmware for this setup, that actively maintains a live device tree as OF does, rather than u-boot which is pretty oriented towards a close-to-static device setup. That's just a thought though, I'm not saying that at least some of this functionality doesn't belong in libfdt. So, my thought would be that stuff for manipulating big chunks of tree should go in a new .c file inside the libfdt tree. We already have del_node and nop_node of course, which can remove whole subtrees. I guess the big extra function you'd want would be something like: fdt_graft(void *fdt, int offset, void *subtree); Which would graft the tree blob give by subtree into the master tree (fdt) at node 'offset'. Actually that might need to take a name for the top-level of the subtree to take in the new tree too. I called the function fdt_overlay, but I guess the implementation is similar to what you thought of. I pushed it here, see the topmost 3 commits: https://github.com/zonque/dtc/commits/overlay Things get trickier when you consider what might need to be tweaked in the subtree to make it fit into the master tree. If it requires widespread alterations through the subtree that's going to get really ugly and I think you would be better off with a firmware with a fuller handling of a live device tree. But I think that can probably be avoided with proper design of the bindings. To get that to work you'll need to make sure you use some sort of local addressing within the subtree. Then it should only be necessary to insert/alter a ranges property at the top level of the subtree (or possibly its parent) to map that correctly into the global address space. Likewise interrupts within the subtree probably shouldn't address an external interrupt controller but rather the root of the tree. You can then insert an interrupt-map property which will wire those into the global interrupt tree. As pointed out on another end of this thread, the use of my simple implementation is rather limited. I need to think about something more sophisticated, or abadon the idea alltogether. Thanks, Daniel ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] fs: zfs: fix illegal use of fp
On 10/31/2012 07:21 PM, Alejandro Mery wrote: the upcoming sunxi (allwinner a10/a13) platform enables zfs by default, and using linaro's hf -msoft-float makes the build fail because this u64 division. Signed-off-by: Alejandro Mery am...@geeks.cl Acked-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
[U-Boot] [PATCH] at91: move get_chip_id() and get_extension_chip_id() to cpu.c, which can share with all at91 board.
Signed-off-by: Josh Wu josh...@atmel.com --- arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c | 12 arch/arm/cpu/arm926ejs/at91/cpu.c| 11 +++ arch/arm/include/asm/arch-at91/at91_dbu.h|4 arch/arm/include/asm/arch-at91/at91sam9x5.h |1 - 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c b/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c index 9348552..6855d3e 100644 --- a/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c +++ b/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c @@ -26,18 +26,6 @@ #include asm/arch/gpio.h #include asm/io.h -unsigned int get_chip_id(void) -{ - /* The 0x40 is the offset of cidr in DBGU */ - return readl(ATMEL_BASE_DBGU + 0x40) ~ARCH_ID_VERSION_MASK; -} - -unsigned int get_extension_chip_id(void) -{ - /* The 0x44 is the offset of exid in DBGU */ - return readl(ATMEL_BASE_DBGU + 0x44); -} - unsigned int has_emac1() { return cpu_is_at91sam9x25(); diff --git a/arch/arm/cpu/arm926ejs/at91/cpu.c b/arch/arm/cpu/arm926ejs/at91/cpu.c index 5cf4fad..351e19c 100644 --- a/arch/arm/cpu/arm926ejs/at91/cpu.c +++ b/arch/arm/cpu/arm926ejs/at91/cpu.c @@ -26,6 +26,7 @@ #include common.h #include asm/io.h #include asm/arch/hardware.h +#include asm/arch/at91_dbu.h #include asm/arch/at91_pmc.h #include asm/arch/at91_pit.h #include asm/arch/at91_gpbr.h @@ -71,3 +72,13 @@ int print_cpuinfo(void) return 0; } #endif + +unsigned int get_chip_id(void) +{ + return readl(ATMEL_BASE_DBGU + AT91_DBU_CIDR) ~AT91_DBU_CIDR_VERSION; +} + +unsigned int get_extension_chip_id(void) +{ + return readl(ATMEL_BASE_DBGU + AT91_DBU_EXID); +} diff --git a/arch/arm/include/asm/arch-at91/at91_dbu.h b/arch/arm/include/asm/arch-at91/at91_dbu.h index 3429293..fe64198 100644 --- a/arch/arm/include/asm/arch-at91/at91_dbu.h +++ b/arch/arm/include/asm/arch-at91/at91_dbu.h @@ -38,4 +38,8 @@ typedef struct at91_dbu { #define AT91_DBU_CID_ARCH_9xx 0x0190 #define AT91_DBU_CID_ARCH_9XExx0x0290 +#define AT91_DBU_CIDR_VERSION (0x1f 0) +#define AT91_DBU_CIDR 0x40 +#define AT91_DBU_EXID 0x44 + #endif diff --git a/arch/arm/include/asm/arch-at91/at91sam9x5.h b/arch/arm/include/asm/arch-at91/at91sam9x5.h index 0e728c9..659c01d 100644 --- a/arch/arm/include/asm/arch-at91/at91sam9x5.h +++ b/arch/arm/include/asm/arch-at91/at91sam9x5.h @@ -118,7 +118,6 @@ /* 9x5 series chip id definitions */ #define ARCH_ID_AT91SAM9X5 0x819a05a0 -#define ARCH_ID_VERSION_MASK 0x1f #define ARCH_EXID_AT91SAM9G15 0x #define ARCH_EXID_AT91SAM9G35 0x0001 #define ARCH_EXID_AT91SAM9X35 0x0002 -- 1.7.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 0/4] ANSI terminal Bootmenu
This patch series adds ANSI terminal Bootmenu command. It use generic menu code for creating menu structures, but use own functions for drawing menu on ANSI terminal. First patch modify generic menu code for using other functions for printing and choosing menu entry, second patch is bootmenu command itself. Third and fourth patches are new in v2. Third adding new command clear which clear ANSI terminal and fourth adding bootmenu support to Nokia RX-51 board. Pali Rohár (4): menu: Added support to use user defined functions New command bootmenu: ANSI terminal Boot Menu support New command clear: Clear the ANSI terminal RX-51: Add support for bootmenu board/ait/cam_enc_4xx/cam_enc_4xx.c |5 +- common/Makefile |2 + common/cmd_bootmenu.c | 471 +++ common/cmd_clear.c | 43 common/cmd_pxe.c|3 +- common/menu.c | 43 ++-- doc/README.bootmenu | 61 + include/ansi.h | 42 include/configs/nokia_rx51.h| 25 +- include/menu.h |6 +- 10 files changed, 678 insertions(+), 23 deletions(-) create mode 100644 common/cmd_bootmenu.c create mode 100644 common/cmd_clear.c create mode 100644 doc/README.bootmenu create mode 100644 include/ansi.h -- 1.7.10.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 1/4] menu: Added support to use user defined functions
* In menu_interactive_choice can be used user specified function item_data_choice (instead hardcoded function which read input from standard input) * Added option to specify user data for menu * menu_display_statusline will pass pointer to user data (instead pointer to menu) * This patch is needed for creating ANSI bootmenu Signed-off-by: Pali Rohár pali.ro...@gmail.com --- Changes in v2: - Rebased on next board/ait/cam_enc_4xx/cam_enc_4xx.c |5 ++-- common/cmd_pxe.c|3 ++- common/menu.c | 43 +++ include/menu.h |6 +++-- 4 files changed, 37 insertions(+), 20 deletions(-) diff --git a/board/ait/cam_enc_4xx/cam_enc_4xx.c b/board/ait/cam_enc_4xx/cam_enc_4xx.c index 32b28f9..5078b01 100644 --- a/board/ait/cam_enc_4xx/cam_enc_4xx.c +++ b/board/ait/cam_enc_4xx/cam_enc_4xx.c @@ -561,7 +561,8 @@ static char *menu_handle(struct menu_display *display) char *s; char temp[6][200]; - m = menu_create(display-title, display-timeout, 1, ait_menu_print); + m = menu_create(display-title, display-timeout, 1, ait_menu_print, + NULL, NULL); for (i = 0; display-menulist[i]; i++) { sprintf(key, %d, i + 1); @@ -1097,7 +1098,7 @@ int menu_show(int bootdelay) return MENU_EXIT; } -void menu_display_statusline(struct menu *m) +void menu_display_statusline(void *data) { char *s1, *s2; diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c index ee75db9..2dbd49c 100644 --- a/common/cmd_pxe.c +++ b/common/cmd_pxe.c @@ -1280,7 +1280,8 @@ static struct menu *pxe_menu_to_menu(struct pxe_menu *cfg) /* * Create a menu and add items for all the labels. */ - m = menu_create(cfg-title, cfg-timeout, cfg-prompt, label_print); + m = menu_create(cfg-title, cfg-timeout, cfg-prompt, label_print, + NULL, NULL); if (!m) return NULL; diff --git a/common/menu.c b/common/menu.c index 6b2a2db..8b27c10 100644 --- a/common/menu.c +++ b/common/menu.c @@ -47,6 +47,8 @@ struct menu { char *title; int prompt; void (*item_data_print)(void *); + char *(*item_data_choice)(void *); + void *data; struct list_head items; }; @@ -113,11 +115,11 @@ static inline void *menu_item_destroy(struct menu *m, return NULL; } -void __menu_display_statusline(struct menu *m) +void __menu_display_statusline(void *menu_data) { return; } -void menu_display_statusline(struct menu *m) +void menu_display_statusline(void *menu_data) __attribute__ ((weak, alias(__menu_display_statusline))); /* @@ -130,7 +132,7 @@ static inline void menu_display(struct menu *m) puts(m-title); putc('\n'); } - menu_display_statusline(m); + menu_display_statusline(m-data); menu_items_iter(m, menu_item_print, NULL); } @@ -204,18 +206,25 @@ static inline int menu_interactive_choice(struct menu *m, void **choice) menu_display(m); - readret = readline_into_buffer(Enter choice: , cbuf, - m-timeout / 10); - - if (readret = 0) { - choice_item = menu_item_by_key(m, cbuf); + if (!m-item_data_choice) { + readret = readline_into_buffer(Enter choice: , cbuf, + m-timeout / 10); + + if (readret = 0) { + choice_item = menu_item_by_key(m, cbuf); + if (!choice_item) + printf(%s not found\n, cbuf); + } else + return menu_default_choice(m, choice); + } else { + char *key = m-item_data_choice(m-data); + if (!key) + return menu_default_choice(m, choice); + choice_item = menu_item_by_key(m, key); + } - if (!choice_item) { - printf(%s not found\n, cbuf); - m-timeout = 0; - } - } else - return menu_default_choice(m, choice); + if (!choice_item) + m-timeout = 0; } *choice = choice_item-data; @@ -352,7 +361,9 @@ int menu_item_add(struct menu *m, char *item_key, void *item_data) * insufficient memory available to create the menu. */ struct menu *menu_create(char *title, int timeout, int prompt, - void (*item_data_print)(void *)) + void (*item_data_print)(void *), + char *(*item_data_choice)(void *), + void *menu_data)
[U-Boot] [PATCH v2 3/4] New command clear: Clear the ANSI terminal
This patch adding new simple command clear which clear ANSI terminal. Signed-off-by: Pali Rohár pali.ro...@gmail.com Cc: Marcel Mol mar...@mesa.nl --- This patch was in Nokia RX-51 patch series (v2). Changes since RX-51 patch v2: - Removed from include/config_cmd_all.h - Removed ANSI escape codes (now in BootMenu command patch) Changes since original version: - Renamed command clr to clear - Use puts instead printf - Move cursor to pos1,1 common/Makefile|1 + common/cmd_clear.c | 43 +++ 2 files changed, 44 insertions(+) create mode 100644 common/cmd_clear.c diff --git a/common/Makefile b/common/Makefile index 1435992..328ca49 100644 --- a/common/Makefile +++ b/common/Makefile @@ -70,6 +70,7 @@ COBJS-$(CONFIG_CMD_BMP) += cmd_bmp.o COBJS-$(CONFIG_CMD_BOOTMENU) += cmd_bootmenu.o COBJS-$(CONFIG_CMD_BOOTLDR) += cmd_bootldr.o COBJS-$(CONFIG_CMD_CACHE) += cmd_cache.o +COBJS-$(CONFIG_CMD_CLEAR) += cmd_clear.o COBJS-$(CONFIG_CMD_CONSOLE) += cmd_console.o COBJS-$(CONFIG_CMD_CPLBINFO) += cmd_cplbinfo.o COBJS-$(CONFIG_DATAFLASH_MMC_SELECT) += cmd_dataflash_mmc_mux.o diff --git a/common/cmd_clear.c b/common/cmd_clear.c new file mode 100644 index 000..29b4718 --- /dev/null +++ b/common/cmd_clear.c @@ -0,0 +1,43 @@ +/* + * Copyright 2011 + * Marcel Mol, MESA Consulting, mar...@mesa.nl + * + * Copyright 2011 + * Pali Rohár, pali.ro...@gmail.com + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include common.h +#include command.h +#include ansi.h + +static int do_clear(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ + puts(ANSI_CLEAR_CONSOLE); + printf(ANSI_CURSOR_POSITION, 1, 1); + return 0; +} + +U_BOOT_CMD( + clear,CONFIG_SYS_MAXARGS, 1, do_clear, + clear, + \n + - clear screen and move cursor to top of screen +); -- 1.7.10.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 2/4] New command bootmenu: ANSI terminal Boot Menu support
This patch adding ANSI terminal bootmenu command. It is extension to generic menu which provide output for ANSI terminals. Signed-off-by: Pali Rohár pali.ro...@gmail.com --- Changes in v2: - Added commit message - Removed bootmenu from include/config_cmd_all.h - Moved ANSI escape codes from include/common.h to include/ansi.h - Fixed style and indentation problems - Use mdelay instead udelay - Removed autoboot delay message when some key is pressed common/Makefile |1 + common/cmd_bootmenu.c | 471 + doc/README.bootmenu | 61 +++ include/ansi.h| 42 + 4 files changed, 575 insertions(+) create mode 100644 common/cmd_bootmenu.c create mode 100644 doc/README.bootmenu create mode 100644 include/ansi.h diff --git a/common/Makefile b/common/Makefile index a4eb477..1435992 100644 --- a/common/Makefile +++ b/common/Makefile @@ -67,6 +67,7 @@ COBJS-$(CONFIG_CMD_SOURCE) += cmd_source.o COBJS-$(CONFIG_CMD_BDI) += cmd_bdinfo.o COBJS-$(CONFIG_CMD_BEDBUG) += bedbug.o cmd_bedbug.o COBJS-$(CONFIG_CMD_BMP) += cmd_bmp.o +COBJS-$(CONFIG_CMD_BOOTMENU) += cmd_bootmenu.o COBJS-$(CONFIG_CMD_BOOTLDR) += cmd_bootldr.o COBJS-$(CONFIG_CMD_CACHE) += cmd_cache.o COBJS-$(CONFIG_CMD_CONSOLE) += cmd_console.o diff --git a/common/cmd_bootmenu.c b/common/cmd_bootmenu.c new file mode 100644 index 000..908e13f --- /dev/null +++ b/common/cmd_bootmenu.c @@ -0,0 +1,471 @@ +/* + * (C) Copyright 2011-2012 Pali Rohár pali.ro...@gmail.com + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include common.h +#include command.h +#include ansi.h +#include menu.h +#include hush.h +#include watchdog.h +#include malloc.h +#include linux/string.h + +struct bootmenu_entry { + int num;/* unique number 0..99 */ + char key[3];/* key idetifier of number */ + char *title;/* title of entry */ + char *command; /* hush command of entry */ + struct bootmenu_data *menu; /* this bootmenu */ + struct bootmenu_entry *next;/* next menu entry (num+1) */ +}; + +struct bootmenu_data { + int delay; /* delay for autoboot */ + int active; /* active menu entry */ + int count; /* total count of menu entries */ + struct bootmenu_entry *first; /* first menu entry */ +}; + +static char *bootmenu_getoption(int n) +{ + char name[] = bootmenu_\0\0; + + if (n 0 || n 99) + return NULL; + + sprintf(name+9, %d, n); + return getenv(name); +} + +static void bootmenu_print_entry(void *data) +{ + struct bootmenu_entry *entry = data; + int reverse = (entry-menu-active == entry-num); + + /* +* Move cursor to line where entry will be drown (entry-num) +* First 3 lines contains Bootmenu header + 1 empty line +*/ + printf(ANSI_CURSOR_POSITION, entry-num + 4, 1); + + if (reverse) + puts(ANSI_COLOR_REVERSE); + + puts( ); + puts(entry-title); + puts(ANSI_CLEAR_LINE_TO_END); + + if (reverse) + puts(ANSI_COLOR_RESET); +} + +static char *bootmenu_choice_entry(void *data) +{ + struct bootmenu_data *menu = data; + int i; + + int key = 0; /* 0 - NONE, 1 - UP, 2 - DOWN, 3 - SELECT */ + int esc = 0; + + while (1) { + + /* Autoboot was not stopped */ + if (menu-delay = 0) { + + if (menu-delay 0) { + printf(ANSI_CURSOR_POSITION, menu-count+5, 1); + printf( Hit any key to stop autoboot: %2d , + menu-delay); + } + + while (menu-delay 0) { + + for (i = 0; i 100; ++i) { + + if (!tstc()) { + WATCHDOG_RESET(); + mdelay(10); + continue; +
[U-Boot] [PATCH v2 4/4] RX-51: Add support for bootmenu
* default bootmenu entries: attached kernel, internal eMMC memory, external SD card, u-boot boot order * in CONFIG_PREBOOT try load bootmenu.scr from first FAT partition of internal eMMC memory (also known as MyDocs) which (should) overwrite default bootmenu entries * when keyboard slide is closed boot first menu entry * when keyborad slide is open in show bootmenu Signed-off-by: Pali Rohár pali.ro...@gmail.com Acked-by: Tom Rini tr...@ti.com --- This patch was in Nokia RX-51 patch series. Changes since RX-51 patch: - Rebased on last Nokia RX-51 patch v5 Changes since original version: - Fixed name of env variables include/configs/nokia_rx51.h | 25 ++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/include/configs/nokia_rx51.h b/include/configs/nokia_rx51.h index 8506604..cd31d21 100644 --- a/include/configs/nokia_rx51.h +++ b/include/configs/nokia_rx51.h @@ -148,6 +148,7 @@ #define CONFIG_CMDLINE_EDITING /* add command line history */ #define CONFIG_AUTO_COMPLETE /* add autocompletion support */ +#define CONFIG_CMD_BOOTMENU/* ANSI terminal Boot Menu */ #define CONFIG_CMD_CLEAR /* ANSI terminal clear screen command */ #ifdef ONENAND_SUPPORT @@ -287,8 +288,6 @@ int rx51_kp_getc(void); #endif /* Environment information */ -#define CONFIG_BOOTDELAY 3 - #define CONFIG_EXTRA_ENV_SETTINGS \ mtdparts= MTDPARTS_DEFAULT \0 \ usbtty=cdc_acm\0 \ @@ -360,10 +359,25 @@ int rx51_kp_getc(void); fi\0 \ emmcboot=setenv mmcnum 1; run trymmcboot\0 \ sdboot=setenv mmcnum 0; run trymmcboot\0 \ + menucmd=bootmenu\0 \ + bootmenu_0=Attached kernel=run attachboot\0 \ + bootmenu_1=Internal eMMC=run emmcboot\0 \ + bootmenu_2=External SD card=run sdboot\0 \ + bootmenu_3=U-Boot boot order=boot\0 \ + bootmenu_delay=30\0 \ #define CONFIG_PREBOOT \ - if run slide; then true; else run attachboot; fi; \ + setenv mmcnum 1; setenv mmcpart 1; setenv mmctype fat; \ + setenv mmcscriptfile bootmenu.scr; \ + run trymmcscriptboot; \ + if run slide; then true; else \ + setenv bootmenu_delay 0; \ + setenv bootdelay 0; \ + fi + +#define CONFIG_POSTBOOTMENU \ + echo; \ echo Extra commands:; \ echo run sercon - Use serial port for control.; \ echo run usbcon - Use usbtty for control.; \ @@ -379,6 +393,11 @@ int rx51_kp_getc(void); run attachboot; \ echo +#define CONFIG_BOOTDELAY 30 +#define CONFIG_AUTOBOOT_KEYED +#define CONFIG_MENU +#define CONFIG_MENU_SHOW + /* * Miscellaneous configurable options */ -- 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 1/2] MAKEALL: Fix kill_children
Dear Andy Fleming, On Wed, Oct 31, 2012 at 9:32 PM, Marek Vasut marek.va...@gmail.com wrote: Dear Joe Hershberger, When building in parallel, make sure that we look up the children based on the the actual process group id instead of just assuming that the MAKEALL pid is the process group id. Also ensure that logs from incomplete builds are deleted in the process. Signed-off-by: Joe Hershberger joe.hershber...@ni.com [...] Nice $subject. btw. is it possible to improve the u-boot build process parallelization? In what way? I recall someone complained the build process wasn't parallelizable enough and thus we need this stuff to run multiple builds at once in MAKEALL. 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] MAKEALL: Fix kill_children
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/01/12 07:35, Marek Vasut wrote: Dear Andy Fleming, On Wed, Oct 31, 2012 at 9:32 PM, Marek Vasut marek.va...@gmail.com wrote: [snip] btw. is it possible to improve the u-boot build process parallelization? In what way? I recall someone complained the build process wasn't parallelizable enough and thus we need this stuff to run multiple builds at once in MAKEALL. I don't know if the first half of that statement is strictly true. It'd be interesting to profile a build on one of the very large boxes but I think the issue is we only have ~300 objects being built. It's hard to run up a load of 32 when you only have that many things to build. But multiplying that by the number of boards in a arch or some cpu or soc combinations is easier to run up the load, except around the tails. But, profiling, please! - -- Tom -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iQIcBAEBAgAGBQJQkpP3AAoJENk4IS6UOR1WkQgP/0oih/weogNgs7Ql9Iv4Ct06 pNlaYJiDEOlKxhdwG80zXnyWSqIKkLIYN09N5NPyYQ3qgeM+uRYRiReDiwudYY+P pkOBWudj4X8SWUOucbRVWgx89DU4VrxCzY7sqqhDsQ+5ZTz8UjwG4wZaZOdewdLr ktxe90NQGVsl6ozQtJoSoJ57y727e07piGuBISRDwYZPwmpCl8d9dNd6liRf7zdv EXLIbO9aLROD67pkpO9OY392CVAU7cO4p5ir0dTGVZfYdPpadM+/Jsay5KsPhCf0 rM4eAFG1BvqhMBCc2NyPH2P71YU6rEsPdH6DyNh10aDRwUd7eep6/pU0tKbYpUR4 z0nsE1QOVLD5DY43/N0fEMN2G62LMiwnPuEQWT89N9uyDaFP7SS8lLRp/Sj7EhQF NLEMtMKvN8bVIBiVFXW8WOVRJqlc5uVpoeRqfbOctl50x9zGNHhypJlH65qtEeg/ UlroM1tw3p0j6Xk9zrNioGFy5/mpkF1hw2pirUAKF06yomg0FM9oAOwp/tfjyjgU uU2myW+lgWk0VfW/H00fyEBBs3vPnLo1PSL2WUKg43WRiEdY5C0/+E+lSIN7ph/z eeWKelSu6BUWPkuqBnxhUkMFRYtPCNqE5x6BdVv5p8TPxacD842qDP930Vg3YhqQ 1KG0rtSB69QqzAtVYDmO =4XRP -END PGP SIGNATURE- ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] powerpc/corenet_ds: move SATA config to board configuration
On Thu, Nov 1, 2012 at 3:13 AM, Roy Zang tie-fei.z...@freescale.com wrote: board configuration file is included before asm/config_mpc85xx.h. however, CONFIG_FSL_SATA_V2 is defined in asm/config_mpc85xx.h. it will never take effective in the board configuration file for this kind of code : #ifdef CONFIG_FSL_SATA_V2 ... #endif To solve this problem, move CONFIG_FSL_SATA_V2 to board configuration header file. http://patchwork.ozlabs.org/patch/126958/ -- 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] powerpc/corenet_ds: move SATA config to board configuration
On Thu, Nov 1, 2012 at 11:20 AM, Tabi Timur-B04825 b04...@freescale.com wrote: To solve this problem, move CONFIG_FSL_SATA_V2 to board configuration header file. http://patchwork.ozlabs.org/patch/126958/ To be clear, I think you should say in the patch description that your patch effectively reverts mine. -- Timur Tabi Linux kernel developer at Freescale ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] PCIe on the i.MX6?
Hello, Does anyone have any experience with PCIe on an i.MX6 processor (in particular the i.MX6 Solo)? I can access the config space of my PCIe device but can't seem to get its BARs mapped in properly. I thought I had the viewports set up but when I try to access the space, I just get a processor lockup. Any suggestions would be greatly appreciated. Thanks, Carolyn ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 09/18] env: Add a bootfile env handler
Remove the hard-coded bootfile handler and use a callback instead Signed-off-by: Joe Hershberger joe.hershber...@ni.com --- common/cmd_nvedit.c| 9 - include/env_callback.h | 1 + net/net.c | 17 + 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index 12949aa..b3d0894 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -50,9 +50,6 @@ #include serial.h #include linux/stddef.h #include asm/byteorder.h -#if defined(CONFIG_CMD_NET) -#include net.h -#endif DECLARE_GLOBAL_DATA_PTR; @@ -327,12 +324,6 @@ int env_change_ok(const ENTRY *item, const char *newval, enum env_op op, load_addr = simple_strtoul(newval, NULL, 16); return 0; } -#if defined(CONFIG_CMD_NET) - else if (strcmp(name, bootfile) == 0) { - copy_filename(BootFile, newval, sizeof(BootFile)); - return 0; - } -#endif return 0; } diff --git a/include/env_callback.h b/include/env_callback.h index 1a25e3f..caf2cc4 100644 --- a/include/env_callback.h +++ b/include/env_callback.h @@ -39,6 +39,7 @@ * a new assogiation in the .callbacks environment variable. */ #define ENV_CALLBACK_LIST_STATIC ENV_CALLBACK_VAR :callbacks, \ + bootfile:bootfile, \ CONFIG_ENV_CALLBACK_LIST_STATIC struct env_clbk_tbl { diff --git a/net/net.c b/net/net.c index c1fe00a..65be934 100644 --- a/net/net.c +++ b/net/net.c @@ -82,6 +82,7 @@ #include common.h #include command.h +#include environment.h #include net.h #if defined(CONFIG_STATUS_LED) #include miiphy.h @@ -208,6 +209,22 @@ static int NetTryCount; /**/ +static int on_bootfile(const char *name, const char *value, enum env_op op, + int flags) +{ + switch (op) { + case env_op_create: + case env_op_overwrite: + copy_filename(BootFile, value, sizeof(BootFile)); + break; + default: + break; + } + + return 0; +} +U_BOOT_ENV_CALLBACK(bootfile, on_bootfile); + /* * Check if autoload is enabled. If so, use either NFS or TFTP to download * the boot file. -- 1.7.11.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 18/18] env: Handle write-once ethaddr and serial# generically
Use the variable access flags to implement the protection for ethaddr and serial# instead of hard-coding them. Signed-off-by: Joe Hershberger joe.hershber...@ni.com --- common/env_flags.c | 19 --- include/env_flags.h | 22 ++ tools/env/fw_env.c | 17 - 3 files changed, 22 insertions(+), 36 deletions(-) diff --git a/common/env_flags.c b/common/env_flags.c index 9bf7f2d..8d2a12c 100644 --- a/common/env_flags.c +++ b/common/env_flags.c @@ -492,25 +492,6 @@ int env_flags_validate(const ENTRY *item, const char *newval, enum env_op op, /* Default value for NULL to protect string-manipulating functions */ newval = newval ? : ; -#ifndef CONFIG_ENV_OVERWRITE - /* -* Some variables like ethaddr and serial# can be set only once and -* cannot be deleted, unless CONFIG_ENV_OVERWRITE is defined. -*/ - if (op != env_op_create /* variable exists */ - (flag H_FORCE) == 0) {/* and we are not forced */ - if (strcmp(name, serial#) == 0 || - (strcmp(name, ethaddr) == 0 -#if defined(CONFIG_OVERWRITE_ETHADDR_ONCE) defined(CONFIG_ETHADDR) - strcmp(oldval, __stringify(CONFIG_ETHADDR)) != 0 -#endif /* CONFIG_OVERWRITE_ETHADDR_ONCE CONFIG_ETHADDR */ - )) { - printf(Can't overwrite \%s\\n, name); - return 1; - } - } -#endif - /* validate the value to match the variable type */ if (op != env_op_delete) { enum env_flags_vartype type; diff --git a/include/env_flags.h b/include/env_flags.h index 0bdae07..d1aa144 100644 --- a/include/env_flags.h +++ b/include/env_flags.h @@ -53,7 +53,29 @@ enum env_flags_varaccess { #define CONFIG_ENV_FLAGS_LIST_STATIC #endif +#ifdef CONFIG_CMD_NET +#ifdef CONFIG_ENV_OVERWRITE +#define ETHADDR_FLAGS ethaddr:ma, +#else +#ifdef CONFIG_OVERWRITE_ETHADDR_ONCE +#define ETHADDR_FLAGS ethaddr:mc, +#else +#define ETHADDR_FLAGS ethaddr:mo, +#endif +#endif +#else +#define ETHADDR_FLAGS +#endif + +#ifndef CONFIG_ENV_OVERWRITE +#define SERIAL_FLAGS serial#:so, +#else +#define SERIAL_FLAGS +#endif + #define ENV_FLAGS_LIST_STATIC \ + ETHADDR_FLAGS \ + SERIAL_FLAGS \ CONFIG_ENV_FLAGS_LIST_STATIC #ifdef CONFIG_CMD_ENV_FLAGS diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index a596a1b..90c7a5d 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -369,23 +369,6 @@ int fw_env_write(char *name, char *value) return 0; if (deleting || overwriting) { -#ifndef CONFIG_ENV_OVERWRITE - /* -* Ethernet Address and serial# can be set only once -*/ - if ( - (strcmp(name, serial#) == 0) || - ((strcmp(name, ethaddr) == 0) -#if defined(CONFIG_OVERWRITE_ETHADDR_ONCE) defined(CONFIG_ETHADDR) -(strcmp(oldval, __stringify(CONFIG_ETHADDR)) != 0) -#endif /* CONFIG_OVERWRITE_ETHADDR_ONCE CONFIG_ETHADDR */ - ) ) { - fprintf (stderr, Can't overwrite \%s\\n, name); - errno = EROFS; - return -1; - } -#endif /* CONFIG_ENV_OVERWRITE */ - if (*++nxt == '\0') { *env = '\0'; } else { -- 1.7.11.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 10/18] env: Add a baudrate env handler
Remove the hard-coded baudrate handler and use a callback instead Signed-off-by: Joe Hershberger joe.hershber...@ni.com --- common/cmd_nvedit.c | 47 - drivers/serial/serial.c | 70 + include/env_callback.h | 1 + 3 files changed, 71 insertions(+), 47 deletions(-) diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index b3d0894..49f15f5 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -78,12 +78,6 @@ ulong save_addr; /* Default Save Address */ ulong save_size; /* Default Save Size (in bytes) */ /* - * Table with supported baudrates (defined in config_xyz.h) - */ -static const unsigned long baudrate_table[] = CONFIG_SYS_BAUDRATE_TABLE; -#defineN_BAUDRATES (sizeof(baudrate_table) / sizeof(baudrate_table[0])) - -/* * This variable is incremented on each do_env_set(), so it can * be used via get_env_id() as an indication, if the environment * has changed or not. So it is possible to reread an environment @@ -274,47 +268,6 @@ int env_change_ok(const ENTRY *item, const char *newval, enum env_op op, } } #endif - /* -* When we change baudrate, or we are doing an env default -a -* (which will erase all variables prior to calling this), -* we want the baudrate to actually change - for real. -*/ - if (op != env_op_create || /* variable exists */ - (flag H_NOCLEAR) == 0) { /* or env is clear */ - /* -* Switch to new baudrate if new baudrate is supported -*/ - if (strcmp(name, baudrate) == 0) { - int baudrate = simple_strtoul(newval, NULL, 10); - int i; - for (i = 0; i N_BAUDRATES; ++i) { - if (baudrate == baudrate_table[i]) - break; - } - if (i == N_BAUDRATES) { - if ((flag H_FORCE) == 0) - printf(## Baudrate %d bps not - supported\n, baudrate); - return 1; - } - if (gd-baudrate == baudrate) { - /* If unchanged, we just say it's OK */ - return 0; - } - printf(## Switch baudrate to %d bps and - press ENTER ...\n, baudrate); - udelay(5); - gd-baudrate = baudrate; -#if defined(CONFIG_PPC) || defined(CONFIG_MCF52x2) - gd-bd-bi_baudrate = baudrate; -#endif - - serial_setbrg(); - udelay(5); - while (getc() != '\r') - ; - } - } /* * Some variables should be updated when the corresponding diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c index f5f43a6..1f8955a 100644 --- a/drivers/serial/serial.c +++ b/drivers/serial/serial.c @@ -22,6 +22,7 @@ */ #include common.h +#include environment.h #include serial.h #include stdio_dev.h #include post.h @@ -32,6 +33,11 @@ DECLARE_GLOBAL_DATA_PTR; static struct serial_device *serial_devices; static struct serial_device *serial_current; +/* + * Table with supported baudrates (defined in config_xyz.h) + */ +static const unsigned long baudrate_table[] = CONFIG_SYS_BAUDRATE_TABLE; +#defineN_BAUDRATES (sizeof(baudrate_table) / sizeof(baudrate_table[0])) /** * serial_null() - Void registration routine of a serial driver @@ -46,6 +52,70 @@ static void serial_null(void) } /** + * on_baudrate() - Update the actual baudrate when the env var changes + * + * This will check for a valid baudrate and only apply it if valid. + */ +static int on_baudrate(const char *name, const char *value, enum env_op op, + int flags) +{ + int i; + int baudrate; + + switch (op) { + case env_op_create: + case env_op_overwrite: + /* +* Switch to new baudrate if new baudrate is supported +*/ + baudrate = simple_strtoul(value, NULL, 10); + + /* Not actually changing */ + if (gd-baudrate == baudrate) + return 0; + + for (i = 0; i N_BAUDRATES; ++i) { + if (baudrate == baudrate_table[i]) + break; + } + if (i == N_BAUDRATES) { + if ((flags H_FORCE) == 0) + printf(## Baudrate %d bps not supported\n, + baudrate); +
[U-Boot] [PATCH v3 0/18] Add environment call-back and flags capability
When a variable with a registered callback is inserted, deleted, or overwritten the callback is called and gives the system an opportunity to do something in response to the change. It also has the opportunuty to reject the change by returning non-zero. The flags on variables can control their type as well as their allowed access. The format of the list is: type_attribute = [s|d|x|b|i|m] attributes = type_attribute entry = variable_name[:attributes] list = entry[,list] The type attributes are: s - String (default) d - Decimal x - Hexadecimal b - Boolean ([1yYtT|0nNfF]) i - IP address m - MAC address The access attributes are: a - Any (default) r - Read-only o - Write-once c - Change-default Changes in v3: - Rebase onto Gerlando Falauto's env patches - Refactor himport_r() and hsearch_r()'s parameters - Split hdelete_r() into the core delete and the validation before delete - Delete vars on failed insertion - Use Marek's linker lists instead of implementing it directly - Rebase onto latest master - Add flags parameter to callbacks - Implement reverse search in env_attr_lookup() - Fix space skipping in env_attr_lookup() - All errors coming back from hsearch_r() are no longer fatal. Don't abort import on failed ENTER action. - Removed checkpatch.pl warning Changes in v2: - Added much-needed documentation - Factored out prevch and nextch in env_attr_lookup() Joe Hershberger (18): Make linux kernel string funcs available to tools env: Refactor do_apply to a flag env: Consolidate common code in hsearch_r() env: Refactor apply into change_ok env: Use getenv_yesno() more generally env: Hide '.' variables in env print by default env: Add support for callbacks to environment vars env: Add a command to view callbacks env: Add a bootfile env handler env: Add a baudrate env handler env: Add a loadaddr env handler env: Add a console env handler env: Add a silent env handler env: Add environment variable flags tools/env: Add environment variable flags support env: Add a command to display details about env flags env: Add support for access control to .flags env: Handle write-once ethaddr and serial# generically README | 80 ++ arch/arm/lib/board.c| 4 +- arch/m68k/lib/board.c | 3 +- arch/microblaze/lib/board.c | 4 +- arch/powerpc/cpu/mpc85xx/mp.c | 4 +- arch/powerpc/lib/board.c| 9 +- arch/sparc/lib/board.c | 3 +- board/Marvell/db64360/db64360.c | 10 +- board/Marvell/db64460/db64460.c | 10 +- board/esd/cpci750/cpci750.c | 10 +- board/esd/pmc440/cmd_pmc440.c | 2 +- board/gw8260/gw8260.c | 10 +- board/prodrive/p3mx/p3mx.c | 10 +- common/Makefile | 6 + common/cmd_nvedit.c | 337 common/console.c| 67 + common/env_attr.c | 229 + common/env_callback.c | 132 ++ common/env_common.c | 60 +++-- common/env_dataflash.c | 2 +- common/env_eeprom.c | 2 +- common/env_fat.c| 2 +- common/env_flags.c | 549 common/env_flash.c | 4 +- common/env_mmc.c| 2 +- common/env_nand.c | 4 +- common/env_nvram.c | 2 +- common/env_onenand.c| 2 +- common/env_sf.c | 4 +- common/image.c | 21 +- doc/README.silent | 14 +- drivers/serial/serial.c | 70 + include/common.h| 5 + include/env_attr.h | 55 include/env_callback.h | 75 ++ include/env_default.h | 8 + include/env_flags.h | 172 + include/environment.h | 15 +- include/image.h | 1 - include/linux/linux_string.h| 8 + include/linux/string.h | 5 +- include/search.h| 37 ++- lib/Makefile| 1 + lib/hashtable.c | 244 -- lib/linux_string.c | 51 lib/string.c| 39 --- net/net.c | 49 ++-- tools/env/Makefile | 3 + tools/env/fw_env.c | 92 +-- 49 files changed, 2093 insertions(+), 435 deletions(-) create mode 100644 common/env_attr.c create mode 100644 common/env_callback.c create mode 100644 common/env_flags.c create mode 100644 include/env_attr.h create mode 100644 include/env_callback.h create mode 100644 include/env_flags.h create mode 100644 include/linux/linux_string.h create mode 100644
[U-Boot] [PATCH v3 01/18] Make linux kernel string funcs available to tools
isspace() and strim() are not in the typical user-mode string.h, so put them in a separate compilation unit so that they can be built into tools that need them independent of the other common string functions. This allows code shared by u-boot and the linux user-mode tools to link. Signed-off-by: Joe Hershberger joe.hershber...@ni.com --- include/linux/linux_string.h | 8 +++ include/linux/string.h | 5 + lib/Makefile | 1 + lib/linux_string.c | 51 lib/string.c | 39 - 5 files changed, 61 insertions(+), 43 deletions(-) create mode 100644 include/linux/linux_string.h create mode 100644 lib/linux_string.c diff --git a/include/linux/linux_string.h b/include/linux/linux_string.h new file mode 100644 index 000..192b4c9 --- /dev/null +++ b/include/linux/linux_string.h @@ -0,0 +1,8 @@ +#ifndef _LINUX_LINUX_STRING_H_ +#define _LINUX_LINUX_STRING_H_ + +extern char * skip_spaces(const char *); + +extern char *strim(char *); + +#endif diff --git a/include/linux/string.h b/include/linux/string.h index 9a8cbc2..2a6e52f 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -47,10 +47,7 @@ extern char * strchr(const char *,int); #ifndef __HAVE_ARCH_STRRCHR extern char * strrchr(const char *,int); #endif -extern char * skip_spaces(const char *); - -extern char *strim(char *); - +#include linux/linux_string.h #ifndef __HAVE_ARCH_STRSTR extern char * strstr(const char *,const char *); #endif diff --git a/lib/Makefile b/lib/Makefile index e44e045..5652986 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -68,6 +68,7 @@ endif COBJS-y += crc32.o COBJS-y += ctype.o COBJS-y += div64.o +COBJS-y += linux_string.o COBJS-y += string.o COBJS-y += time.o COBJS-$(CONFIG_BOOTP_PXE) += uuid.o diff --git a/lib/linux_string.c b/lib/linux_string.c new file mode 100644 index 000..d5a5e08 --- /dev/null +++ b/lib/linux_string.c @@ -0,0 +1,51 @@ +/* + * linux/lib/string.c + * + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#ifdef USE_HOSTCC +#include stdio.h +#endif + +#include linux/ctype.h +#include linux/string.h + +/** + * skip_spaces - Removes leading whitespace from @str. + * @str: The string to be stripped. + * + * Returns a pointer to the first non-whitespace character in @str. + */ +char *skip_spaces(const char *str) +{ + while (isspace(*str)) + ++str; + return (char *)str; +} + +/** + * strim - Removes leading and trailing whitespace from @s. + * @s: The string to be stripped. + * + * Note that the first trailing whitespace is replaced with a %NUL-terminator + * in the given string @s. Returns a pointer to the first non-whitespace + * character in @s. + */ +char *strim(char *s) +{ + size_t size; + char *end; + + s = skip_spaces(s); + size = strlen(s); + if (!size) + return s; + + end = s + size - 1; + while (end = s isspace(*end)) + end--; + *(end + 1) = '\0'; + + return s; +} diff --git a/lib/string.c b/lib/string.c index c3ad055..2c4f0ec 100644 --- a/lib/string.c +++ b/lib/string.c @@ -214,45 +214,6 @@ char * strrchr(const char * s, int c) } #endif - -/** - * skip_spaces - Removes leading whitespace from @str. - * @str: The string to be stripped. - * - * Returns a pointer to the first non-whitespace character in @str. - */ -char *skip_spaces(const char *str) -{ - while (isspace(*str)) - ++str; - return (char *)str; -} - -/** - * strim - Removes leading and trailing whitespace from @s. - * @s: The string to be stripped. - * - * Note that the first trailing whitespace is replaced with a %NUL-terminator - * in the given string @s. Returns a pointer to the first non-whitespace - * character in @s. - */ -char *strim(char *s) -{ - size_t size; - char *end; - - s = skip_spaces(s); - size = strlen(s); - if (!size) - return s; - - end = s + size - 1; - while (end = s isspace(*end)) - end--; - *(end + 1) = '\0'; - - return s; -} #ifndef __HAVE_ARCH_STRLEN /** * strlen - Find the length of a string -- 1.7.11.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 16/18] env: Add a command to display details about env flags
Similar to the env callback command, this will show details about the options available, the static list, and the currently active variables. Signed-off-by: Joe Hershberger joe.hershber...@ni.com --- README | 1 + common/cmd_nvedit.c | 56 + common/env_flags.c | 34 include/env_flags.h | 11 +++ 4 files changed, 102 insertions(+) diff --git a/README b/README index 315ed36..58ac4e7 100644 --- a/README +++ b/README @@ -807,6 +807,7 @@ The following options need to be configured: CONFIG_CMD_EEPROM * EEPROM read/write support CONFIG_CMD_ELF * bootelf, bootvx CONFIG_CMD_ENV_CALLBACK * display details about env callbacks + CONFIG_CMD_ENV_FLAGS* display details about env flags CONFIG_CMD_EXPORTENV* export the environment CONFIG_CMD_EXT2 * ext2 command support CONFIG_CMD_EXT4 * ext4 command support diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index cadf0df..4d2e86d 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -438,6 +438,59 @@ int do_env_callback(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } #endif +#if defined(CONFIG_CMD_ENV_FLAGS) +static int print_static_flags(const char *var_name, const char *flags) +{ + enum env_flags_vartype type = env_flags_parse_vartype(flags); + + printf(\t%-20s %-20s\n, var_name, env_flags_get_vartype_name(type)); + + return 0; +} + +static int print_active_flags(ENTRY *entry) +{ + enum env_flags_vartype type; + + if (entry-flags == 0) + return 0; + + type = (enum env_flags_vartype) + (entry-flags ENV_FLAGS_VARTYPE_BIN_MASK); + printf(\t%-20s %-20s\n, entry-key, env_flags_get_vartype_name(type)); + + return 0; +} + +/* + * Print the flags available and what variables have flags + */ +int do_env_flags(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ + /* Print the available variable types */ + printf(Available variable type flags (position %d):\n, + ENV_FLAGS_VARTYPE_LOC); + puts(\tFlag\tVariable Type Name\n); + puts(\t\t--\n); + env_flags_print_vartypes(); + puts(\n); + + /* Print the static flags that may exist */ + puts(Static flags:\n); + printf(\t%-20s %-20s\n, Variable Name, Variable Type); + printf(\t%-20s %-20s\n, -, -); + env_attr_walk(ENV_FLAGS_LIST_STATIC, print_static_flags); + puts(\n); + + /* walk through each variable and print the flags if non-default */ + puts(Active flags:\n); + printf(\t%-20s %-20s\n, Variable Name, Variable Type); + printf(\t%-20s %-20s\n, -, -); + hwalk_r(env_htab, print_active_flags); + return 0; +} +#endif + /* * Interactively edit an environment variable */ @@ -906,6 +959,9 @@ static cmd_tbl_t cmd_env_sub[] = { #if defined(CONFIG_CMD_ENV_CALLBACK) U_BOOT_CMD_MKENT(callback, 1, 0, do_env_callback, , ), #endif +#if defined(CONFIG_CMD_ENV_FLAGS) + U_BOOT_CMD_MKENT(flags, 1, 0, do_env_flags, , ), +#endif #if defined(CONFIG_CMD_EXPORTENV) U_BOOT_CMD_MKENT(export, 4, 0, do_env_export, , ), #endif diff --git a/common/env_flags.c b/common/env_flags.c index 6ea995a..7afc423 100644 --- a/common/env_flags.c +++ b/common/env_flags.c @@ -43,6 +43,40 @@ #endif static const char env_flags_vartype_rep[] = sdxb ENV_FLAGS_NET_VARTYPE_REPS; +#ifdef CONFIG_CMD_ENV_FLAGS +static const char * const env_flags_vartype_names[] = { + string, + decimal, + hexadecimal, + boolean, +#ifdef CONFIG_CMD_NET + IP address, + MAC address, +#endif +}; + +/* + * Print the whole list of available type flags. + */ +void env_flags_print_vartypes(void) +{ + enum env_flags_vartype curtype = (enum env_flags_vartype)0; + + while (curtype != env_flags_vartype_end) { + printf(\t%c -\t%s\n, env_flags_vartype_rep[curtype], + env_flags_vartype_names[curtype]); + curtype++; + } +} + +/* + * Return the name of the type. + */ +const char *env_flags_get_vartype_name(enum env_flags_vartype type) +{ + return env_flags_vartype_names[type]; +} +#endif /* CONFIG_CMD_ENV_FLAGS */ /* * Parse the flags string from a .flags attribute list into the vartype enum. diff --git a/include/env_flags.h b/include/env_flags.h index 446..7e72523 100644 --- a/include/env_flags.h +++ b/include/env_flags.h @@ -47,6 +47,17 @@ enum env_flags_vartype { #define ENV_FLAGS_LIST_STATIC \ CONFIG_ENV_FLAGS_LIST_STATIC +#ifdef CONFIG_CMD_ENV_FLAGS +/* + * Print the whole list of available type flags. + */ +void env_flags_print_vartypes(void); +/* + * Return the name of the type. + */ +const
[U-Boot] [PATCH v3 13/18] env: Add a silent env handler
The silent variable now updates the global data flag anytime it is changed as well as after the env relocation (in case its value is different from the default env in such cases as NAND env) Signed-off-by: Joe Hershberger joe.hershber...@ni.com --- common/console.c | 23 +++ doc/README.silent | 14 ++ include/env_callback.h | 7 +++ 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/common/console.c b/common/console.c index 713bd34..0e51d67 100644 --- a/common/console.c +++ b/common/console.c @@ -73,6 +73,29 @@ static int on_console(const char *name, const char *value, enum env_op op, } U_BOOT_ENV_CALLBACK(console, on_console); +#ifdef CONFIG_SILENT_CONSOLE +static int on_silent(const char *name, const char *value, enum env_op op, + int flags) +{ +#ifndef CONFIG_SILENT_CONSOLE_UPDATE_ON_SET + if (flags H_INTERACTIVE) + return 0; +#endif +#ifndef CONFIG_SILENT_CONSOLE_UPDATE_ON_RELOC + if ((flags H_INTERACTIVE) == 0) + return 0; +#endif + + if (value != NULL) + gd-flags |= GD_FLG_SILENT; + else + gd-flags = ~GD_FLG_SILENT; + + return 0; +} +U_BOOT_ENV_CALLBACK(silent, on_silent); +#endif + #ifdef CONFIG_SYS_CONSOLE_IS_IN_ENV /* * if overwrite_console returns 1, the stdin, stderr and stdout diff --git a/doc/README.silent b/doc/README.silent index a26e3df..70202ce 100644 --- a/doc/README.silent +++ b/doc/README.silent @@ -1,9 +1,15 @@ The config option CONFIG_SILENT_CONSOLE can be used to quiet messages on the console. If the option has been enabled, the output can be -silenced by setting the environment variable silent. The variable -is latched into the global data at an early stage in the boot process -so deleting it with setenv will not take effect until the system is -restarted. +silenced by setting the environment variable silent. + +- CONFIG_SILENT_CONSOLE_UPDATE_ON_SET + When the silent variable is changed with env set, the change + will take effect immediately. + +- CONFIG_SILENT_CONSOLE_UPDATE_ON_RELOC + Some environments are not available until relocation (e.g. NAND) + so this will make the value in the flash env take effect at + relocation. The following actions are taken if silent is set at boot time: diff --git a/include/env_callback.h b/include/env_callback.h index a614744..d0e0e00 100644 --- a/include/env_callback.h +++ b/include/env_callback.h @@ -34,6 +34,12 @@ #define CONFIG_ENV_CALLBACK_LIST_STATIC #endif +#ifdef CONFIG_SILENT_CONSOLE +#define SILENT_CALLBACK silent:silent, +#else +#define SILENT_CALLBACK +#endif + /* * This list of callback bindings is static, but may be overridden by defining * a new assogiation in the .callbacks environment variable. @@ -42,6 +48,7 @@ baudrate:baudrate, \ bootfile:bootfile, \ loadaddr:loadaddr, \ + SILENT_CALLBACK \ stdin:console,stdout:console,stderr:console, \ CONFIG_ENV_CALLBACK_LIST_STATIC -- 1.7.11.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 08/18] env: Add a command to view callbacks
The callbacks can be bound, but are otherwise invisible. Add a command to show what callbacks are available. Signed-off-by: Joe Hershberger joe.hershber...@ni.com --- README | 1 + common/cmd_nvedit.c | 77 + 2 files changed, 78 insertions(+) diff --git a/README b/README index 2834b52..ef19d21 100644 --- a/README +++ b/README @@ -806,6 +806,7 @@ The following options need to be configured: CONFIG_CMD_EDITENVedit env variable CONFIG_CMD_EEPROM * EEPROM read/write support CONFIG_CMD_ELF * bootelf, bootvx + CONFIG_CMD_ENV_CALLBACK * display details about env callbacks CONFIG_CMD_EXPORTENV* export the environment CONFIG_CMD_EXT2 * ext2 command support CONFIG_CMD_EXT4 * ext4 command support diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index a0cdc4b..12949aa 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -513,6 +513,77 @@ int do_env_ask(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } #endif +#if defined(CONFIG_CMD_ENV_CALLBACK) +static int print_static_binding(const char *var_name, const char *callback_name) +{ + printf(\t%-20s %-20s\n, var_name, callback_name); + + return 0; +} + +static int print_active_callback(ENTRY *entry) +{ + struct env_clbk_tbl *clbkp; + int i; + int num_callbacks; + + if (entry-callback == NULL) + return 0; + + /* look up the callback in the linker-list */ + num_callbacks = ll_entry_count(struct env_clbk_tbl, env_clbk); + for (i = 0, clbkp = ll_entry_start(struct env_clbk_tbl, env_clbk); +i num_callbacks; +i++, clbkp++) { + if (entry-callback == clbkp-callback) + break; + } + + if (i == num_callbacks) + /* this should probably never happen, but just in case... */ + printf(\t%-20s %p\n, entry-key, entry-callback); + else + printf(\t%-20s %-20s\n, entry-key, clbkp-name); + + return 0; +} + +/* + * Print the callbacks available and what they are bound to + */ +int do_env_callback(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ + struct env_clbk_tbl *clbkp; + int i; + int num_callbacks; + + /* Print the available callbacks */ + puts(Available callbacks:\n); + puts(\tCallback Name\n); + puts(\t-\n); + num_callbacks = ll_entry_count(struct env_clbk_tbl, env_clbk); + for (i = 0, clbkp = ll_entry_start(struct env_clbk_tbl, env_clbk); +i num_callbacks; +i++, clbkp++) + printf(\t%s\n, clbkp-name); + puts(\n); + + /* Print the static bindings that may exist */ + puts(Static callback bindings:\n); + printf(\t%-20s %-20s\n, Variable Name, Callback Name); + printf(\t%-20s %-20s\n, -, -); + env_attr_walk(ENV_CALLBACK_LIST_STATIC, print_static_binding); + puts(\n); + + /* walk through each variable and print the callback if it has one */ + puts(Active callback bindings:\n); + printf(\t%-20s %-20s\n, Variable Name, Callback Name); + printf(\t%-20s %-20s\n, -, -); + hwalk_r(env_htab, print_active_callback); + return 0; +} +#endif + /* * Interactively edit an environment variable */ @@ -978,6 +1049,9 @@ static cmd_tbl_t cmd_env_sub[] = { #if defined(CONFIG_CMD_EDITENV) U_BOOT_CMD_MKENT(edit, 2, 0, do_env_edit, , ), #endif +#if defined(CONFIG_CMD_ENV_CALLBACK) + U_BOOT_CMD_MKENT(callback, 1, 0, do_env_callback, , ), +#endif #if defined(CONFIG_CMD_EXPORTENV) U_BOOT_CMD_MKENT(export, 4, 0, do_env_export, , ), #endif @@ -1029,6 +1103,9 @@ U_BOOT_CMD( #if defined(CONFIG_CMD_ASKENV) ask name [message] [size] - ask for environment variable\nenv #endif +#if defined(CONFIG_CMD_CALLBACKENV) + callback [name] - print callbacks and their associated variables\nenv +#endif default [-f] -a - [forcibly] reset default environment\n env default [-f] var [...] - [forcibly] reset variable(s) to their default values\n #if defined(CONFIG_CMD_EDITENV) -- 1.7.11.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 12/18] env: Add a console env handler
Remove the hard-coded console handler and use a callback instead Signed-off-by: Joe Hershberger joe.hershber...@ni.com --- common/cmd_nvedit.c| 33 +++-- common/console.c | 44 include/env_callback.h | 1 + 3 files changed, 48 insertions(+), 30 deletions(-) diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index 7b48560..9cb6629 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -47,7 +47,6 @@ #include errno.h #include malloc.h #include watchdog.h -#include serial.h #include linux/stddef.h #include asm/byteorder.h @@ -205,10 +204,9 @@ static int do_env_grep(cmd_tbl_t *cmdtp, int flag, int env_change_ok(const ENTRY *item, const char *newval, enum env_op op, int flag) { - int console = -1; +#ifndef CONFIG_ENV_OVERWRITE const char *name; -#if !defined(CONFIG_ENV_OVERWRITE) defined(CONFIG_OVERWRITE_ETHADDR_ONCE) \ - defined(CONFIG_ETHADDR) +#if defined(CONFIG_OVERWRITE_ETHADDR_ONCE) defined(CONFIG_ETHADDR) const char *oldval = NULL; if (op != env_op_create) @@ -216,36 +214,11 @@ int env_change_ok(const ENTRY *item, const char *newval, enum env_op op, #endif name = item-key; +#endif /* Default value for NULL to protect string-manipulating functions */ newval = newval ? : ; - /* Check for console redirection */ - if (strcmp(name, stdin) == 0) - console = stdin; - else if (strcmp(name, stdout) == 0) - console = stdout; - else if (strcmp(name, stderr) == 0) - console = stderr; - - if (console != -1) { - if ((newval == NULL) || (*newval == '\0')) { - /* We cannot delete stdin/stdout/stderr */ - if ((flag H_FORCE) == 0) - printf(Can't delete \%s\\n, name); - return 1; - } - -#ifdef CONFIG_CONSOLE_MUX - if (iomux_doenv(console, newval)) - return 1; -#else - /* Try assigning specified device */ - if (console_assign(console, newval) 0) - return 1; -#endif /* CONFIG_CONSOLE_MUX */ - } - #ifndef CONFIG_ENV_OVERWRITE /* * Some variables like ethaddr and serial# can be set only once and diff --git a/common/console.c b/common/console.c index 1177f7d..713bd34 100644 --- a/common/console.c +++ b/common/console.c @@ -24,11 +24,55 @@ #include common.h #include stdarg.h #include malloc.h +#include serial.h #include stdio_dev.h #include exports.h +#include environment.h DECLARE_GLOBAL_DATA_PTR; +static int on_console(const char *name, const char *value, enum env_op op, + int flags) +{ + int console = -1; + + /* Check for console redirection */ + if (strcmp(name, stdin) == 0) + console = stdin; + else if (strcmp(name, stdout) == 0) + console = stdout; + else if (strcmp(name, stderr) == 0) + console = stderr; + + /* if not actually setting a console variable, we don't care */ + if (console == -1) + return 0; + + switch (op) { + case env_op_create: + case env_op_overwrite: + +#ifdef CONFIG_CONSOLE_MUX + if (iomux_doenv(console, value)) + return 1; +#else + /* Try assigning specified device */ + if (console_assign(console, value) 0) + return 1; +#endif /* CONFIG_CONSOLE_MUX */ + return 0; + + case env_op_delete: + if ((flags H_FORCE) == 0) + printf(Can't delete \%s\\n, name); + return 1; + + default: + return 0; + } +} +U_BOOT_ENV_CALLBACK(console, on_console); + #ifdef CONFIG_SYS_CONSOLE_IS_IN_ENV /* * if overwrite_console returns 1, the stdin, stderr and stdout diff --git a/include/env_callback.h b/include/env_callback.h index 309ff9b..a614744 100644 --- a/include/env_callback.h +++ b/include/env_callback.h @@ -42,6 +42,7 @@ baudrate:baudrate, \ bootfile:bootfile, \ loadaddr:loadaddr, \ + stdin:console,stdout:console,stderr:console, \ CONFIG_ENV_CALLBACK_LIST_STATIC struct env_clbk_tbl { -- 1.7.11.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 04/18] env: Refactor apply into change_ok
Move the read of the old value to inside the check function. In some cases it can be avoided all together and at the least the code is only called from one place. Also name the function and the callback to more clearly describe what it does. Pass the ENTRY instead of just the name for direct access to the whole data structure. Pass an enum to the callback that specifies the operation being approved. Signed-off-by: Joe Hershberger joe.hershber...@ni.com --- Changes in v3: - Split hdelete_r() into the core delete and the validation before delete - Delete vars on failed insertion common/cmd_nvedit.c | 34 +++-- common/env_common.c | 2 +- include/environment.h | 7 +++--- include/search.h | 13 +++--- lib/hashtable.c | 70 +++ 5 files changed, 71 insertions(+), 55 deletions(-) diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index 4820008..119796b 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -207,10 +207,20 @@ static int do_env_grep(cmd_tbl_t *cmdtp, int flag, * overwriting of write-once variables. */ -int env_check_apply(const char *name, const char *oldval, - const char *newval, int flag) +int env_change_ok(const ENTRY *item, const char *newval, enum env_op op, + int flag) { int console = -1; + const char *name; +#if !defined(CONFIG_ENV_OVERWRITE) defined(CONFIG_OVERWRITE_ETHADDR_ONCE) \ + defined(CONFIG_ETHADDR) + const char *oldval = NULL; + + if (op != env_op_create) + oldval = item-data; +#endif + + name = item-key; /* Default value for NULL to protect string-manipulating functions */ newval = newval ? : ; @@ -241,12 +251,12 @@ int env_check_apply(const char *name, const char *oldval, #endif /* CONFIG_CONSOLE_MUX */ } +#ifndef CONFIG_ENV_OVERWRITE /* * Some variables like ethaddr and serial# can be set only once and * cannot be deleted, unless CONFIG_ENV_OVERWRITE is defined. */ -#ifndef CONFIG_ENV_OVERWRITE - if (oldval != NULL/* variable exists */ + if (op != env_op_create /* variable exists */ (flag H_FORCE) == 0) {/* and we are not forced */ if (strcmp(name, serial#) == 0 || (strcmp(name, ethaddr) == 0 @@ -264,7 +274,7 @@ int env_check_apply(const char *name, const char *oldval, * (which will erase all variables prior to calling this), * we want the baudrate to actually change - for real. */ - if (oldval != NULL || /* variable exists */ + if (op != env_op_create || /* variable exists */ (flag H_NOCLEAR) == 0) { /* or env is clear */ /* * Switch to new baudrate if new baudrate is supported @@ -338,20 +348,6 @@ int _do_env_set(int flag, int argc, char * const argv[]) } env_id++; - /* -* search if variable with this name already exists -*/ - e.key = name; - e.data = NULL; - hsearch_r(e, FIND, ep, env_htab, 0); - - /* -* Perform requested checks. -*/ - if (env_check_apply(name, ep ? ep-data : NULL, value, 0)) { - debug(check function did not approve, refusing\n); - return 1; - } /* Delete only ? */ if (argc 3 || argv[2] == NULL) { diff --git a/common/env_common.c b/common/env_common.c index f22f5b9..919f535 100644 --- a/common/env_common.c +++ b/common/env_common.c @@ -40,7 +40,7 @@ DECLARE_GLOBAL_DATA_PTR; #include env_default.h struct hsearch_data env_htab = { - .apply = env_check_apply, + .change_ok = env_change_ok, }; static uchar __env_get_char_spec(int index) diff --git a/include/environment.h b/include/environment.h index e8ab703..4b19f32 100644 --- a/include/environment.h +++ b/include/environment.h @@ -188,13 +188,12 @@ int set_default_vars(int nvars, char * const vars[]); int env_import(const char *buf, int check); /* - * Check if variable name can be changed from oldval to newval, - * and if so, apply the changes (e.g. baudrate). + * Check if variable item can be changed to newval * When (flag H_FORCE) is set, it does not print out any error * message and forces overwriting of write-once variables. */ -int env_check_apply(const char *name, const char *oldval, - const char *newval, int flag); +int env_change_ok(const ENTRY *item, const char *newval, enum env_op op, + int flag); #endif /* DO_DEPS_ONLY */ diff --git a/include/search.h b/include/search.h index f5165b0..fa00ea1 100644 --- a/include/search.h +++ b/include/search.h @@ -32,6 +32,12 @@ #define __set_errno(val) do { errno = val; } while (0) +enum env_op { + env_op_create, + env_op_delete, + env_op_overwrite, +}; + /*
[U-Boot] [PATCH v3 15/18] tools/env: Add environment variable flags support
Currently just validates variable types as decimal, hexidecimal, boolean, ip address, and mac address. Call env_acl_validate_setenv_params() from setenv() in fw_env.c. If the entry is not found in the env .flags, then look in the static one. This allows the env to override the static definitions, but prevents the need to have every definition in the environment distracting you. Need to build in _ctype for isdigit for Linux. Signed-off-by: Joe Hershberger joe.hershber...@ni.com --- common/env_attr.c | 7 + common/env_flags.c | 75 + include/env_flags.h | 19 ++ tools/env/Makefile | 3 +++ tools/env/fw_env.c | 9 +++ 5 files changed, 113 insertions(+) diff --git a/common/env_attr.c b/common/env_attr.c index 7d330a5..210c98d 100644 --- a/common/env_attr.c +++ b/common/env_attr.c @@ -21,7 +21,14 @@ * MA 02111-1307 USA */ +#ifdef USE_HOSTCC /* Eliminate ANSI does not permit... warnings */ +#include stdint.h +#include stdio.h +#include linux/linux_string.h +#else #include common.h +#endif + #include env_attr.h #include errno.h #include linux/string.h diff --git a/common/env_flags.c b/common/env_flags.c index 2292569..6ea995a 100644 --- a/common/env_flags.c +++ b/common/env_flags.c @@ -24,8 +24,17 @@ #include linux/string.h #include linux/ctype.h +#ifdef USE_HOSTCC /* Eliminate ANSI does not permit... warnings */ +#include stdint.h +#include stdio.h +#include fw_env.h +#include env_attr.h +#include env_flags.h +#define getenv fw_getenv +#else #include common.h #include environment.h +#endif #ifdef CONFIG_CMD_NET #define ENV_FLAGS_NET_VARTYPE_REPS im @@ -174,6 +183,70 @@ static inline int env_flags_lookup(const char *flags_list, const char *name, return ret; } +#ifdef USE_HOSTCC /* Functions only used from tools/env */ +/* + * Look up any flags directly from the .flags variable and the static list + * and convert them to the vartype enum. + */ +enum env_flags_vartype env_flags_get_type(const char *name) +{ + const char *flags_list = getenv(ENV_FLAGS_VAR); + char flags[ENV_FLAGS_ATTR_MAX_LEN + 1]; + + if (env_flags_lookup(flags_list, name, flags)) + return env_flags_vartype_string; + + if (strlen(flags) = ENV_FLAGS_VARTYPE_LOC) + return env_flags_vartype_string; + + return env_flags_parse_vartype(flags); +} + +/* + * Validate that the proposed new value for name is valid according to the + * defined flags for that variable, if any. + */ +int env_flags_validate_type(const char *name, const char *value) +{ + enum env_flags_vartype type; + + if (value == NULL) + return 0; + type = env_flags_get_type(name); + if (_env_flags_validate_type(value, type) 0) { + printf(## Error: flags type check failure for + \%s\ = \%s\ (type: %c)\n, + name, value, env_flags_vartype_rep[type]); + return -1; + } + return 0; +} + +/* + * Validate the parameters to env set directly + */ +int env_flags_validate_env_set_params(int argc, char * const argv[]) +{ + if ((argc = 3) argv[2] != NULL) { + enum env_flags_vartype type = env_flags_get_type(argv[1]); + + /* +* we don't currently check types that need more than +* one argument +*/ + if (type != env_flags_vartype_string argc 3) { + printf(## Error: too many parameters for setting + \%s\\n, argv[1]); + return -1; + } + return env_flags_validate_type(argv[1], argv[2]); + } + /* ok */ + return 0; +} + +#else /* !USE_HOSTCC - Functions only used from lib/hashtable.c */ + /* * Parse the flag charachters from the .flags attribute list into the binary * form to be stored in the environment entry-flags field. @@ -312,3 +385,5 @@ int env_flags_validate(const ENTRY *item, const char *newval, enum env_op op, return 0; } + +#endif diff --git a/include/env_flags.h b/include/env_flags.h index bf25f27..446 100644 --- a/include/env_flags.h +++ b/include/env_flags.h @@ -52,6 +52,23 @@ enum env_flags_vartype { */ enum env_flags_vartype env_flags_parse_vartype(const char *flags); +#ifdef USE_HOSTCC +/* + * Look up the type of a variable directly from the .flags var. + */ +enum env_flags_vartype env_flags_get_type(const char *name); +/* + * Validate the newval for its type to conform with the requirements defined by + * its flags (directly looked at the .flags var). + */ +int env_flags_validate_type(const char *name, const char *newval); +/* + * Validate the parameters passed to env set for type compliance + */ +int env_flags_validate_env_set_params(int argc, char * const argv[]); + +#else /* !USE_HOSTCC */ + #include search.h /* @@ -73,4 +90,6 @@ int
[U-Boot] [PATCH v3 06/18] env: Hide '.' variables in env print by default
When printing all variables with env print, don't print variables that begin with '.'. If env print is called with a '-a' switch, then include variables that begin with '.' (just like the ls command). Variables printed explicitly will be printed even without the -a. Signed-off-by: Joe Hershberger joe.hershber...@ni.com --- board/esd/pmc440/cmd_pmc440.c | 2 +- common/cmd_nvedit.c | 24 common/env_dataflash.c| 2 +- common/env_eeprom.c | 2 +- common/env_fat.c | 2 +- common/env_flash.c| 4 ++-- common/env_mmc.c | 2 +- common/env_nand.c | 4 ++-- common/env_nvram.c| 2 +- common/env_onenand.c | 2 +- common/env_sf.c | 4 ++-- include/search.h | 5 +++-- lib/hashtable.c | 5 - 13 files changed, 36 insertions(+), 24 deletions(-) diff --git a/board/esd/pmc440/cmd_pmc440.c b/board/esd/pmc440/cmd_pmc440.c index f1ffb7b..e9a78a3 100644 --- a/board/esd/pmc440/cmd_pmc440.c +++ b/board/esd/pmc440/cmd_pmc440.c @@ -391,7 +391,7 @@ int do_painit(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) nextbase -= ((CONFIG_ENV_SIZE + 4096 - 1) ~(4096 - 1)); envp = (env_t *)nextbase; res = (char *)envp-data; - len = hexport_r(env_htab, '\0', res, ENV_SIZE, 0, NULL); + len = hexport_r(env_htab, '\0', 0, res, ENV_SIZE, 0, NULL); if (len 0) { error(Cannot export environment: errno = %d\n, errno); return 1; diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index 119796b..a0cdc4b 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -106,7 +106,7 @@ int get_env_id(void) * * Returns 0 in case of error, or length of printed string */ -static int env_print(char *name) +static int env_print(char *name, int flag) { char *res = NULL; size_t len; @@ -116,7 +116,7 @@ static int env_print(char *name) e.key = name; e.data = NULL; - hsearch_r(e, FIND, ep, env_htab, 0); + hsearch_r(e, FIND, ep, env_htab, flag); if (ep == NULL) return 0; len = printf(%s=%s\n, ep-key, ep-data); @@ -124,7 +124,7 @@ static int env_print(char *name) } /* print whole list */ - len = hexport_r(env_htab, '\n', res, 0, 0, NULL); + len = hexport_r(env_htab, '\n', flag, res, 0, 0, NULL); if (len 0) { puts(res); @@ -140,10 +140,17 @@ int do_env_print (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int i; int rcode = 0; + int env_flag = H_HIDE_DOT; + + if (argc 1 argv[1][0] == '-' argv[1][1] == 'a') { + argc--; + argv++; + env_flag = ~H_HIDE_DOT; + } if (argc == 1) { /* print all env vars */ - rcode = env_print(NULL); + rcode = env_print(NULL, env_flag); if (!rcode) return 1; printf(\nEnvironment size: %d/%ld bytes\n, @@ -152,8 +159,9 @@ int do_env_print (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } /* print selected env vars */ + env_flag = ~H_HIDE_DOT; for (i = 1; i argc; ++i) { - int rc = env_print(argv[i]); + int rc = env_print(argv[i], env_flag); if (!rc) { printf(## Error: \%s\ not defined\n, argv[i]); ++rcode; @@ -804,7 +812,7 @@ NXTARG: ; argv++; if (sep) { /* export as text file */ - len = hexport_r(env_htab, sep, addr, size, argc, argv); + len = hexport_r(env_htab, sep, 0, addr, size, argc, argv); if (len 0) { error(Cannot export environment: errno = %d\n, errno); return 1; @@ -822,7 +830,7 @@ NXTARG: ; else/* export as raw binary data */ res = addr; - len = hexport_r(env_htab, '\0', res, ENV_SIZE, argc, argv); + len = hexport_r(env_htab, '\0', 0, res, ENV_SIZE, argc, argv); if (len 0) { error(Cannot export environment: errno = %d\n, errno); return 1; @@ -1062,7 +1070,7 @@ U_BOOT_CMD_COMPLETE( U_BOOT_CMD_COMPLETE( printenv, CONFIG_SYS_MAXARGS, 1,do_env_print, print environment variables, - \n- print values of all environment variables\n + [-a]\n- print [all] values of all environment variables\n printenv name ...\n - print value of environment variable 'name', var_complete diff --git a/common/env_dataflash.c b/common/env_dataflash.c index 3c5af37..38c9615 100644 --- a/common/env_dataflash.c +++ b/common/env_dataflash.c @@ -60,7
[U-Boot] [PATCH v3 11/18] env: Add a loadaddr env handler
Remove the hard-coded loadaddr handler and use a callback instead Signed-off-by: Joe Hershberger joe.hershber...@ni.com --- common/cmd_nvedit.c| 12 common/image.c | 21 + include/env_callback.h | 1 + 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index 49f15f5..7b48560 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -73,10 +73,6 @@ SPI_FLASH|NVRAM|MMC|FAT|REMOTE} or CONFIG_ENV_IS_NOWHERE */ #defineMAX_ENV_SIZE(1 20) /* 1 MiB */ -ulong load_addr = CONFIG_SYS_LOAD_ADDR;/* Default Load Address */ -ulong save_addr; /* Default Save Address */ -ulong save_size; /* Default Save Size (in bytes) */ - /* * This variable is incremented on each do_env_set(), so it can * be used via get_env_id() as an indication, if the environment @@ -269,14 +265,6 @@ int env_change_ok(const ENTRY *item, const char *newval, enum env_op op, } #endif - /* -* Some variables should be updated when the corresponding -* entry in the environment is changed -*/ - if (strcmp(name, loadaddr) == 0) { - load_addr = simple_strtoul(newval, NULL, 16); - return 0; - } return 0; } diff --git a/common/image.c b/common/image.c index 60428c7..664df2d 100644 --- a/common/image.c +++ b/common/image.c @@ -43,6 +43,7 @@ #include rtc.h #endif +#include environment.h #include image.h #if defined(CONFIG_FIT) || defined(CONFIG_OF_LIBFDT) @@ -416,6 +417,26 @@ static const image_header_t *image_get_ramdisk(ulong rd_addr, uint8_t arch, /* Shared dual-format routines */ /*/ #ifndef USE_HOSTCC +ulong load_addr = CONFIG_SYS_LOAD_ADDR;/* Default Load Address */ +ulong save_addr; /* Default Save Address */ +ulong save_size; /* Default Save Size (in bytes) */ + +static int on_loadaddr(const char *name, const char *value, enum env_op op, + int flags) +{ + switch (op) { + case env_op_create: + case env_op_overwrite: + load_addr = simple_strtoul(value, NULL, 16); + break; + default: + break; + } + + return 0; +} +U_BOOT_ENV_CALLBACK(loadaddr, on_loadaddr); + ulong getenv_bootm_low(void) { char *s = getenv(bootm_low); diff --git a/include/env_callback.h b/include/env_callback.h index c3e800a..309ff9b 100644 --- a/include/env_callback.h +++ b/include/env_callback.h @@ -41,6 +41,7 @@ #define ENV_CALLBACK_LIST_STATIC ENV_CALLBACK_VAR :callbacks, \ baudrate:baudrate, \ bootfile:bootfile, \ + loadaddr:loadaddr, \ CONFIG_ENV_CALLBACK_LIST_STATIC struct env_clbk_tbl { -- 1.7.11.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 03/18] env: Consolidate common code in hsearch_r()
The same chunk of code was replicated in two places and the following changes will make that chunk grow a bit, so combine into a static func. Signed-off-by: Joe Hershberger joe.hershber...@ni.com --- lib/hashtable.c | 71 ++--- 1 file changed, 37 insertions(+), 34 deletions(-) diff --git a/lib/hashtable.c b/lib/hashtable.c index f0056ac..f4d5795 100644 --- a/lib/hashtable.c +++ b/lib/hashtable.c @@ -247,6 +247,34 @@ int hmatch_r(const char *match, int last_idx, ENTRY ** retval, return 0; } +/* + * Compare an existing entry with the desired key, and overwrite if the action + * is ENTER. This is simply a helper function for hsearch_r(). + */ +static inline int _compare_and_overwrite_entry(ENTRY item, ACTION action, + ENTRY **retval, struct hsearch_data *htab, int flag, + unsigned int hval, unsigned int idx) +{ + if (htab-table[idx].used == hval +strcmp(item.key, htab-table[idx].entry.key) == 0) { + /* Overwrite existing value? */ + if ((action == ENTER) (item.data != NULL)) { + free(htab-table[idx].entry.data); + htab-table[idx].entry.data = strdup(item.data); + if (!htab-table[idx].entry.data) { + __set_errno(ENOMEM); + *retval = NULL; + return 0; + } + } + /* return found entry */ + *retval = htab-table[idx].entry; + return idx; + } + /* keep searching */ + return -1; +} + int hsearch_r(ENTRY item, ACTION action, ENTRY ** retval, struct hsearch_data *htab, int flag) { @@ -255,6 +283,7 @@ int hsearch_r(ENTRY item, ACTION action, ENTRY ** retval, unsigned int len = strlen(item.key); unsigned int idx; unsigned int first_deleted = 0; + int ret; /* Compute an value for the given string. Perhaps use a better method. */ hval = len; @@ -286,23 +315,10 @@ int hsearch_r(ENTRY item, ACTION action, ENTRY ** retval, !first_deleted) first_deleted = idx; - if (htab-table[idx].used == hval -strcmp(item.key, htab-table[idx].entry.key) == 0) { - /* Overwrite existing value? */ - if ((action == ENTER) (item.data != NULL)) { - free(htab-table[idx].entry.data); - htab-table[idx].entry.data = - strdup(item.data); - if (!htab-table[idx].entry.data) { - __set_errno(ENOMEM); - *retval = NULL; - return 0; - } - } - /* return found entry */ - *retval = htab-table[idx].entry; - return idx; - } + ret = _compare_and_overwrite_entry(item, action, retval, htab, + flag, hval, idx); + if (ret != -1) + return ret; /* * Second hash function: @@ -328,23 +344,10 @@ int hsearch_r(ENTRY item, ACTION action, ENTRY ** retval, break; /* If entry is found use it. */ - if ((htab-table[idx].used == hval) -strcmp(item.key, htab-table[idx].entry.key) == 0) { - /* Overwrite existing value? */ - if ((action == ENTER) (item.data != NULL)) { - free(htab-table[idx].entry.data); - htab-table[idx].entry.data = - strdup(item.data); - if (!htab-table[idx].entry.data) { - __set_errno(ENOMEM); - *retval = NULL; - return 0; - } - } - /* return found entry */ - *retval = htab-table[idx].entry; - return idx; - } + ret = _compare_and_overwrite_entry(item, action, retval, + htab, flag, hval, idx); + if (ret != -1) + return ret; } while (htab-table[idx].used); } -- 1.7.11.5 ___ U-Boot mailing list
[U-Boot] [PATCH v3 14/18] env: Add environment variable flags
Currently just validates variable types as decimal, hexidecimal, boolean, ip address, and mac address. If the entry is not found in the env .flags, then look in the static one. This allows the env to override the static definitions, but prevents the need to have every definition in the environment distracting you. Signed-off-by: Joe Hershberger joe.hershber...@ni.com --- README | 37 ++ common/Makefile| 2 + common/cmd_nvedit.c| 53 + common/env_common.c| 2 +- common/env_flags.c | 314 + include/env_callback.h | 2 + include/env_default.h | 3 + include/env_flags.h| 76 include/environment.h | 9 +- include/search.h | 1 + lib/hashtable.c| 4 + 11 files changed, 442 insertions(+), 61 deletions(-) create mode 100644 common/env_flags.c create mode 100644 include/env_flags.h diff --git a/README b/README index ef19d21..315ed36 100644 --- a/README +++ b/README @@ -2156,6 +2156,11 @@ CBFS (Coreboot Filesystem) support serial# is unaffected by this, i. e. it remains read-only.] + The same can be accomplished in a more flexible way + for any variable by configuring the type of access + to allow for those variables in the .flags variable + or define CONFIG_ENV_FLAGS_LIST_STATIC. + - Protected RAM: CONFIG_PRAM @@ -3007,6 +3012,38 @@ Configuration Settings: cases. This setting can be used to tune behaviour; see lib/hashtable.c for details. +- CONFIG_ENV_FLAGS_LIST_DEFAULT +- CONFIG_ENV_FLAGS_LIST_STATIC + Enable validation of the values given to enviroment variables when + calling env set. Variables can be restricted to only decimal, + hexadecimal, or boolean. If CONFIG_CMD_NET is also defined, + the variables can also be restricted to IP address or MAC address. + + The format of the list is: + type_attribute = [s|d|x|b|i|m] + attributes = type_attribute + entry = variable_name[:attributes] + list = entry[,list] + + The type attributes are: + s - String (default) + d - Decimal + x - Hexadecimal + b - Boolean ([1yYtT|0nNfF]) + i - IP address + m - MAC address + + - CONFIG_ENV_FLAGS_LIST_DEFAULT + Define this to a list (string) to define the .flags + envirnoment variable in the default or embedded environment. + + - CONFIG_ENV_FLAGS_LIST_STATIC + Define this to a list (string) to define validation that + should be done if an entry is not found in the .flags + environment variable. To override a setting in the static + list, simply add an entry for the same variable name to the + .flags variable. + The following definitions that deal with the placement and management of environment data (variable area); in general, we support the following configurations: diff --git a/common/Makefile b/common/Makefile index af6e8f9..ef2bd00 100644 --- a/common/Makefile +++ b/common/Makefile @@ -46,6 +46,7 @@ COBJS-y += cmd_version.o COBJS-y += env_attr.o COBJS-y += env_callback.o COBJS-y += env_common.o +COBJS-y += env_flags.o COBJS-$(CONFIG_ENV_IS_IN_DATAFLASH) += env_dataflash.o COBJS-$(CONFIG_ENV_IS_IN_EEPROM) += env_eeprom.o XCOBJS-$(CONFIG_ENV_IS_EMBEDDED) += env_embedded.o @@ -202,6 +203,7 @@ COBJS-$(CONFIG_SPL_NET_SUPPORT) += cmd_nvedit.o COBJS-$(CONFIG_SPL_NET_SUPPORT) += env_attr.o COBJS-$(CONFIG_SPL_NET_SUPPORT) += env_callback.o COBJS-$(CONFIG_SPL_NET_SUPPORT) += env_common.o +COBJS-$(CONFIG_SPL_NET_SUPPORT) += env_flags.o COBJS-$(CONFIG_SPL_NET_SUPPORT) += env_nowhere.o COBJS-$(CONFIG_SPL_NET_SUPPORT) += miiphyutil.o endif diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index 9cb6629..cadf0df 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -191,60 +191,9 @@ static int do_env_grep(cmd_tbl_t *cmdtp, int flag, #endif /* CONFIG_SPL_BUILD */ /* - * Perform consistency checking before setting, replacing, or deleting an - * environment variable, then (if successful) apply the changes to internals so - * to make them effective. Code for this function was taken out of - * _do_env_set(), which now calls it instead. - * Also called as a callback function by himport_r(). - * Returns 0 in case of success, 1 in case of failure. - * When (flag H_FORCE) is set, do not print out any error message and force - * overwriting of write-once variables. - */ - -int env_change_ok(const ENTRY *item, const char *newval, enum env_op op, - int flag) -{ -#ifndef CONFIG_ENV_OVERWRITE - const char *name; -#if defined(CONFIG_OVERWRITE_ETHADDR_ONCE) defined(CONFIG_ETHADDR) - const char *oldval = NULL; - - if (op != env_op_create) -
[U-Boot] [PATCH v3 05/18] env: Use getenv_yesno() more generally
Move the getenv_yesno() to env_common.c and change most checks for 'y' or 'n' to use this helper. Signed-off-by: Joe Hershberger joe.hershber...@ni.com --- arch/arm/lib/board.c| 4 +--- arch/m68k/lib/board.c | 3 +-- arch/microblaze/lib/board.c | 4 +--- arch/powerpc/cpu/mpc85xx/mp.c | 4 +--- arch/powerpc/lib/board.c| 9 ++--- arch/sparc/lib/board.c | 3 +-- board/Marvell/db64360/db64360.c | 10 +++--- board/Marvell/db64460/db64460.c | 10 +++--- board/esd/cpci750/cpci750.c | 10 +++--- board/gw8260/gw8260.c | 10 +++--- board/prodrive/p3mx/p3mx.c | 10 +++--- common/env_common.c | 14 ++ common/image.c | 6 -- include/common.h| 5 + include/image.h | 1 - net/net.c | 32 +++- 16 files changed, 56 insertions(+), 79 deletions(-) diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index 92cad9a..2e7a9b5 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -532,15 +532,13 @@ void board_init_r(gd_t *id, ulong dest_addr) flash_size = flash_init(); if (flash_size 0) { # ifdef CONFIG_SYS_FLASH_CHECKSUM - char *s = getenv(flashchecksum); - print_size(flash_size, ); /* * Compute and print flash CRC if flashchecksum is set to 'y' * * NOTE: Maybe we should add some WATCHDOG_RESET()? XXX */ - if (s (*s == 'y')) { + if (getenv_yesno(flashchecksum) == 1) { printf( CRC: %08X, crc32(0, (const unsigned char *) CONFIG_SYS_FLASH_BASE, flash_size)); diff --git a/arch/m68k/lib/board.c b/arch/m68k/lib/board.c index 02d73fd..794b867 100644 --- a/arch/m68k/lib/board.c +++ b/arch/m68k/lib/board.c @@ -462,8 +462,7 @@ void board_init_r (gd_t *id, ulong dest_addr) * * NOTE: Maybe we should add some WATCHDOG_RESET()? XXX */ - s = getenv (flashchecksum); - if (s (*s == 'y')) { + if (getenv_yesno(flashchecksum) == 1) { printf ( CRC: %08X, crc32 (0, (const unsigned char *) CONFIG_SYS_FLASH_BASE, diff --git a/arch/microblaze/lib/board.c b/arch/microblaze/lib/board.c index efd63cd..a7c2f76 100644 --- a/arch/microblaze/lib/board.c +++ b/arch/microblaze/lib/board.c @@ -74,7 +74,6 @@ void board_init_f(ulong not_used) gd = (gd_t *) (CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_GBL_DATA_OFFSET); bd = (bd_t *) (CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_GBL_DATA_OFFSET \ - GENERATED_BD_INFO_SIZE); - __maybe_unused char *s; #if defined(CONFIG_CMD_FLASH) ulong flash_size = 0; #endif @@ -143,8 +142,7 @@ void board_init_f(ulong not_used) * * NOTE: Maybe we should add some WATCHDOG_RESET()? XXX */ - s = getenv (flashchecksum); - if (s (*s == 'y')) { + if (getenv_yesno(flashchecksum) == 1) { printf ( CRC: %08X, crc32(0, (const u8 *)bd-bi_flashstart, flash_size) diff --git a/arch/powerpc/cpu/mpc85xx/mp.c b/arch/powerpc/cpu/mpc85xx/mp.c index e1197ac..43d4836 100644 --- a/arch/powerpc/cpu/mpc85xx/mp.c +++ b/arch/powerpc/cpu/mpc85xx/mp.c @@ -46,10 +46,8 @@ u32 get_my_id() */ int hold_cores_in_reset(int verbose) { - const char *s = getenv(mp_holdoff); - /* Default to no, overriden by 'y', 'yes', 'Y', 'Yes', or '1' */ - if (s (*s == 'y' || *s == 'Y' || *s == '1')) { + if (getenv_yesno(mp_holdoff) == 1) { if (verbose) { puts(Secondary cores are being held in reset.\n); puts(See 'mp_holdoff' environment variable\n); diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c index ebf4008..b918c01 100644 --- a/arch/powerpc/lib/board.c +++ b/arch/powerpc/lib/board.c @@ -739,16 +739,13 @@ void board_init_r(gd_t *id, ulong dest_addr) flash_size = 0; } else if ((flash_size = flash_init()) 0) { #ifdef CONFIG_SYS_FLASH_CHECKSUM - char *s; - print_size(flash_size, ); /* * Compute and print flash CRC if flashchecksum is set to 'y' * * NOTE: Maybe we should add some WATCHDOG_RESET()? XXX */ - s = getenv(flashchecksum); - if (s (*s == 'y')) { + if (getenv_yesno(flashchecksum) == 1) { printf( CRC: %08X,
[U-Boot] [PATCH v3 02/18] env: Refactor do_apply to a flag
Use a flag in hsearch_r for insert mode passed from import to allow the behavior be different based on use. Signed-off-by: Joe Hershberger joe.hershber...@ni.com --- Changes in v3: - Rebase onto Gerlando Falauto's env patches - Refactor himport_r() and hsearch_r()'s parameters common/cmd_nvedit.c | 17 - common/env_common.c | 26 -- include/search.h| 15 --- lib/hashtable.c | 37 - 4 files changed, 44 insertions(+), 51 deletions(-) diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index 68c38f4..4820008 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -116,7 +116,7 @@ static int env_print(char *name) e.key = name; e.data = NULL; - hsearch_r(e, FIND, ep, env_htab); + hsearch_r(e, FIND, ep, env_htab, 0); if (ep == NULL) return 0; len = printf(%s=%s\n, ep-key, ep-data); @@ -343,20 +343,19 @@ int _do_env_set(int flag, int argc, char * const argv[]) */ e.key = name; e.data = NULL; - hsearch_r(e, FIND, ep, env_htab); + hsearch_r(e, FIND, ep, env_htab, 0); /* -* Perform requested checks. Notice how since we are overwriting -* a single variable, we need to set H_NOCLEAR +* Perform requested checks. */ - if (env_check_apply(name, ep ? ep-data : NULL, value, H_NOCLEAR)) { + if (env_check_apply(name, ep ? ep-data : NULL, value, 0)) { debug(check function did not approve, refusing\n); return 1; } /* Delete only ? */ if (argc 3 || argv[2] == NULL) { - int rc = hdelete_r(name, env_htab, 0); + int rc = hdelete_r(name, env_htab, H_INTERACTIVE); return !rc; } @@ -383,7 +382,7 @@ int _do_env_set(int flag, int argc, char * const argv[]) e.key = name; e.data = value; - hsearch_r(e, ENTER, ep, env_htab); + hsearch_r(e, ENTER, ep, env_htab, H_INTERACTIVE); free(value); if (!ep) { printf(## Error inserting \%s\ variable, errno=%d\n, @@ -550,7 +549,7 @@ char *getenv(const char *name) e.key = name; e.data = NULL; - hsearch_r(e, FIND, ep, env_htab); + hsearch_r(e, FIND, ep, env_htab, 0); return ep ? ep-data : NULL; } @@ -948,7 +947,7 @@ static int do_env_import(cmd_tbl_t *cmdtp, int flag, } if (himport_r(env_htab, addr, size, sep, del ? 0 : H_NOCLEAR, - 0, NULL, 0 /* do_apply */) == 0) { + 0, NULL) == 0) { error(Environment import failed: errno = %d\n, errno); return 1; } diff --git a/common/env_common.c b/common/env_common.c index 3d3cb70..f22f5b9 100644 --- a/common/env_common.c +++ b/common/env_common.c @@ -83,11 +83,8 @@ const uchar *env_get_addr(int index) void set_default_env(const char *s) { - /* -* By default, do not apply changes as they will eventually -* be applied by someone else -*/ - int do_apply = 0; + int flags = 0; + if (sizeof(default_environment) ENV_SIZE) { puts(*** Error - default environment is too large\n\n); return; @@ -99,14 +96,7 @@ void set_default_env(const char *s) using default environment\n\n, s + 1); } else { - /* -* This set_to_default was explicitly asked for -* by the user, as opposed to being a recovery -* mechanism. Therefore we check every single -* variable and apply changes to the system -* right away (e.g. baudrate, console). -*/ - do_apply = 1; + flags = H_INTERACTIVE; puts(s); } } else { @@ -114,8 +104,8 @@ void set_default_env(const char *s) } if (himport_r(env_htab, (char *)default_environment, - sizeof(default_environment), '\0', 0, - 0, NULL, do_apply) == 0) + sizeof(default_environment), '\0', flags, + 0, NULL) == 0) error(Environment import failed: errno = %d\n, errno); gd-flags |= GD_FLG_ENV_READY; @@ -130,8 +120,8 @@ int set_default_vars(int nvars, char * const vars[]) * (and use \0 as a separator) */ return himport_r(env_htab, (const char *)default_environment, - sizeof(default_environment), '\0', H_NOCLEAR, - nvars, vars, 1 /* do_apply */); +
[U-Boot] [PATCH v3 17/18] env: Add support for access control to .flags
Add support for read-only, write-once, and change-default. Signed-off-by: Joe Hershberger joe.hershber...@ni.com --- README| 13 - common/cmd_nvedit.c | 31 -- common/env_common.c | 18 ++ common/env_flags.c| 153 -- include/env_flags.h | 50 - include/environment.h | 3 + tools/env/fw_env.c| 74 ++-- 7 files changed, 324 insertions(+), 18 deletions(-) diff --git a/README b/README index 58ac4e7..ed3f57d 100644 --- a/README +++ b/README @@ -3022,7 +3022,8 @@ Configuration Settings: The format of the list is: type_attribute = [s|d|x|b|i|m] - attributes = type_attribute + access_atribute = [a|r|o|c] + attributes = type_attribute[access_atribute] entry = variable_name[:attributes] list = entry[,list] @@ -3034,6 +3035,12 @@ Configuration Settings: i - IP address m - MAC address + The access attributes are: + a - Any (default) + r - Read-only + o - Write-once + c - Change-default + - CONFIG_ENV_FLAGS_LIST_DEFAULT Define this to a list (string) to define the .flags envirnoment variable in the default or embedded environment. @@ -3045,6 +3052,10 @@ Configuration Settings: list, simply add an entry for the same variable name to the .flags variable. +- CONFIG_ENV_ACCESS_IGNORE_FORCE + If defined, don't allow the -f switch to env set override variable + access flags. + The following definitions that deal with the placement and management of environment data (variable area); in general, we support the following configurations: diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index 4d2e86d..4c77ced 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -442,8 +442,11 @@ int do_env_callback(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) static int print_static_flags(const char *var_name, const char *flags) { enum env_flags_vartype type = env_flags_parse_vartype(flags); + enum env_flags_varaccess access = env_flags_parse_varaccess(flags); - printf(\t%-20s %-20s\n, var_name, env_flags_get_vartype_name(type)); + printf(\t%-20s %-20s %-20s\n, var_name, + env_flags_get_vartype_name(type), + env_flags_get_varaccess_name(access)); return 0; } @@ -451,13 +454,17 @@ static int print_static_flags(const char *var_name, const char *flags) static int print_active_flags(ENTRY *entry) { enum env_flags_vartype type; + enum env_flags_varaccess access; if (entry-flags == 0) return 0; type = (enum env_flags_vartype) (entry-flags ENV_FLAGS_VARTYPE_BIN_MASK); - printf(\t%-20s %-20s\n, entry-key, env_flags_get_vartype_name(type)); + access = env_flags_parse_varaccess_from_binflags(entry-flags); + printf(\t%-20s %-20s %-20s\n, entry-key, + env_flags_get_vartype_name(type), + env_flags_get_varaccess_name(access)); return 0; } @@ -475,17 +482,29 @@ int do_env_flags(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) env_flags_print_vartypes(); puts(\n); + /* Print the available variable access types */ + printf(Available variable access flags (position %d):\n, + ENV_FLAGS_VARACCESS_LOC); + puts(\tFlag\tVariable Access Name\n); + puts(\t\t\n); + env_flags_print_varaccess(); + puts(\n); + /* Print the static flags that may exist */ puts(Static flags:\n); - printf(\t%-20s %-20s\n, Variable Name, Variable Type); - printf(\t%-20s %-20s\n, -, -); + printf(\t%-20s %-20s %-20s\n, Variable Name, Variable Type, + Variable Access); + printf(\t%-20s %-20s %-20s\n, -, -, + ---); env_attr_walk(ENV_FLAGS_LIST_STATIC, print_static_flags); puts(\n); /* walk through each variable and print the flags if non-default */ puts(Active flags:\n); - printf(\t%-20s %-20s\n, Variable Name, Variable Type); - printf(\t%-20s %-20s\n, -, -); + printf(\t%-20s %-20s %-20s\n, Variable Name, Variable Type, + Variable Access); + printf(\t%-20s %-20s %-20s\n, -, -, + ---); hwalk_r(env_htab, print_active_flags); return 0; } diff --git a/common/env_common.c b/common/env_common.c index b711337..3021efe 100644 --- a/common/env_common.c +++ b/common/env_common.c @@ -95,6 +95,24 @@ int getenv_yesno(const char *var) 1 : 0; } +/* + * Look up the
[U-Boot] [PATCH v3 07/18] env: Add support for callbacks to environment vars
Add support for per-variable callbacks to the hashtable functions. Signed-off-by: Joe Hershberger joe.hershber...@ni.com --- Changes in v3: - Use Marek's linker lists instead of implementing it directly - Rebase onto latest master - Add flags parameter to callbacks - Implement reverse search in env_attr_lookup() - Fix space skipping in env_attr_lookup() - All errors coming back from hsearch_r() are no longer fatal. Don't abort import on failed ENTER action. - Removed checkpatch.pl warning Changes in v2: - Added much-needed documentation - Factored out prevch and nextch in env_attr_lookup() README | 30 +++ common/Makefile| 4 + common/env_attr.c | 222 + common/env_callback.c | 132 + include/env_attr.h | 55 include/env_callback.h | 62 ++ include/env_default.h | 5 ++ include/environment.h | 2 + include/search.h | 5 ++ lib/hashtable.c| 67 ++- 10 files changed, 580 insertions(+), 4 deletions(-) create mode 100644 common/env_attr.c create mode 100644 common/env_callback.c create mode 100644 include/env_attr.h create mode 100644 include/env_callback.h diff --git a/README b/README index 22fd6b7..2834b52 100644 --- a/README +++ b/README @@ -4096,6 +4096,36 @@ Please note that changes to some configuration parameters may take only effect after the next boot (yes, that's just like Windoze :-). +Callback functions for environment variables: +- + +For some environment variables, the behavior of u-boot needs to change +when their values are changed. This functionailty allows functions to +be associated with arbitrary variables. On creation, overwrite, or +deletion, the callback will provide the opportunity for some side +effect to happen or for the change to be rejected. + +The callbacks are named and associated with a function using the +U_BOOT_ENV_CALLBACK macro in your board or driver code. + +These callbacks are associated with variables in one of two ways. The +static list can be added to by defining CONFIG_ENV_CALLBACK_LIST_STATIC +in the board configuration to a string that defines a list of +associations. The list must be in the following format: + + entry = variable_name[:callback_name] + list = entry[,list] + +If the callback name is not specified, then the callback is deleted. +Spaces are also allowed anywhere in the list. + +Callbacks can also be associated by defining the .callbacks variable +with the same list format above. Any association in .callbacks will +override any association in the static list. You can define +CONFIG_ENV_CALLBACK_LIST_DEFAULT to a list (string) to define the +.callbacks envirnoment variable in the default or embedded environment. + + Command Line Parsing: = diff --git a/common/Makefile b/common/Makefile index 9e43322..af6e8f9 100644 --- a/common/Makefile +++ b/common/Makefile @@ -43,6 +43,8 @@ COBJS-y += cmd_nvedit.o COBJS-y += cmd_version.o # environment +COBJS-y += env_attr.o +COBJS-y += env_callback.o COBJS-y += env_common.o COBJS-$(CONFIG_ENV_IS_IN_DATAFLASH) += env_dataflash.o COBJS-$(CONFIG_ENV_IS_IN_EEPROM) += env_eeprom.o @@ -197,6 +199,8 @@ endif ifdef CONFIG_SPL_BUILD COBJS-$(CONFIG_SPL_YMODEM_SUPPORT) += xyzModem.o COBJS-$(CONFIG_SPL_NET_SUPPORT) += cmd_nvedit.o +COBJS-$(CONFIG_SPL_NET_SUPPORT) += env_attr.o +COBJS-$(CONFIG_SPL_NET_SUPPORT) += env_callback.o COBJS-$(CONFIG_SPL_NET_SUPPORT) += env_common.o COBJS-$(CONFIG_SPL_NET_SUPPORT) += env_nowhere.o COBJS-$(CONFIG_SPL_NET_SUPPORT) += miiphyutil.o diff --git a/common/env_attr.c b/common/env_attr.c new file mode 100644 index 000..7d330a5 --- /dev/null +++ b/common/env_attr.c @@ -0,0 +1,222 @@ +/* + * (C) Copyright 2012 + * Joe Hershberger, National Instruments, joe.hershber...@ni.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 env_attr.h +#include errno.h +#include linux/string.h +#include malloc.h + +/* + * Iterate through the whole list calling the callback for each found element. + * attr_list takes the form: + *
Re: [U-Boot] [PATCH 2/2] WIP: tegra: i2c: Enable new CONFIG_SYS_I2C framework
On 11/01/2012 01:42 AM, Heiko Schocher wrote: Hello Stephen, On 31.10.2012 17:25, Stephen Warren wrote: On 10/31/2012 09:56 AM, Simon Glass wrote: Hi Stephen, On Wed, Oct 31, 2012 at 8:41 AM, Stephen Warrenswar...@wwwdotorg.org wrote: On 10/31/2012 12:00 AM, Heiko Schocher wrote: Hello Stephen, On 30.10.2012 23:32, Stephen Warren wrote: On 10/30/2012 11:28 AM, Simon Glass wrote: ... diff --git a/include/configs/seaboard.h b/include/configs/seaboard.h ... +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_ADAPTERS{tegra_i2c_adap[0]} +#define CONFIG_SYS_NUM_I2C_ADAPTERSTEGRA_I2C_NUM_CONTROLLERS But, why is CONFIG_SYS_I2C_ADAPTERS needed; can't the adapter init functions (which presumably would be called from board code or as a result of DT parsing) dynamically register themselves? ... I mainly ask because Simon is pushing to have Tegra's U-Boot completely driven by device tree. If we need to hard-code the list of enabled I2C adapters in the U-Boot config file, and don't also support dynamically added I2C drivers, then that will be incompatible with device tree. Mostly, although with the serial console (which had a similar problem) we just decoded the information onto the stack as needed. It was inefficient, but worked fine for a small number of operations. We might be able to do better with pre-relocation malloc() soon. It's more complex than that. If we use DT, we must be able to: a) Configure exactly which I2C instances the board uses from DT. b) Provide configuration (e.g. max clock rate) for those instances from DT. If all in-use I2C adapters must be specified statically in CONFIG_SYS_I2C_ADAPTERS, then since a board's DT could enable any arbitrary subset of Tegra's I2C adapters, then we must always set CONFIG_SYS_I2C_ADAPTERS to the list of all Tegra's I2C adapters. If we put some subset into CONFIG_SYS_I2C_ADAPTERS, then we're pre-defining the maximal set of I2C adapters that a board can enable, which means DT isn't specifying that, but rather the board config file is, and hence it's pointless to even use DT for this purpose. My current approach needs static specific adapters, yes. But I see not the problem, if we define all tegra adapters per default and ... Now, most boards won't use all I2C adapters, so presumably the Tegra I2C init routine will look for status=disabled (or the inverse) in DT, and only initialize if the DT node for the adapter is present and enabled. ... and it should here be possible to add the used i2c busses! dynamically from the info in the DT, or? Does the I2C adapter registration function call an I2C core function to dynamically register the actual buses that exist on the system? If so, then everything seems fine. However, your later responses re: CONFIG_SYS_I2C_BUSSES then would confuse me... We use in U-Boot not direct the i2c adapters, instead i2c busses ... so if we define all 4 tegra i2c adapters per default, but using on one board only adapter 1 and 3 we have two i2c busses: 0 (= adapter 1) and 1 (= adapter 3) ... no gaps between ...) However, this will leave entries in CONFIG_SYS_I2C_ADAPTERS that are not enabled, which will presumably influence the I2C bus numbering in the No, why? You can add all i2c adapters to the CONFIG_SYS_I2C_ADAPTERS define, without really use them in CONFIG_SYS_I2C_BUSSES. And it Oh, so CONFIG_SYS_I2C_ADAPTERS defines which adapters get initialized, and CONFIG_SYS_I2C_BUSSES statically defines which I2C buses exist, so CONFIG_SYS_I2C_BUSSES could end up not defining a bus that uses a particular adapter, or could end up defining multiple buses that use a particular bus (in the presence of a mux). That all seems fine, but... However, CONFIG_SYS_I2C_BUSSES sounds like a config variable defined at compile time, not something dynamic. If that's true, then I'll just re-state my previous comments but say CONFIG_SYS_I2C_BUSSES anywhere I said CONFIG_SYS_I2C_ADAPTERS... should be possible (not yet coded, but tried in an older version) to add i2c busses after relocation, or while interpret DT ... something like I did in http://git.denx.de/?p=u-boot/u-boot-i2c.git;a=commitdiff;h=ccb680c8cf9002232bc459e4003e3b47db5e1bf4#patch13 I guess my question is: Why even have a CONFIG_SYS_I2C_ADAPTERS or CONFIG_SYS_I2C_BUSSES variable at all? Surely if we intend to make this dynamic in the long run we should just make it dynamic from the start as part of the API rework. If we don't, we'll just have to do another pass over all the drivers converting them to dynamic registration later anyway. I'd suggest having a CONFIG_SYS_I2C_DRIVERS variable at most, and each driver registers an arbitrary number of adapters and/or buses during its initialization. We could probably even get away without CONFIG_SYS_I2C_DRIVERS at all; just have each driver define a structure that gets put into a special linker section, so that the I2C core can iterate over all linked drivers at boot
Re: [U-Boot] PCIe on the i.MX6?
On Thu, Nov 1, 2012 at 2:32 PM, Carolyn Smith carolynsm...@gmail.com wrote: Hello, Does anyone have any experience with PCIe on an i.MX6 processor (in particular the i.MX6 Solo)? I can access the config space of my PCIe device but can't seem to get its BARs mapped in properly. I thought I had the viewports set up but when I try to access the space, I just get a processor lockup. Have you turned on the PCI clocks? ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 2/2] powerpc/85xx: implement check for erratum A-004580 work-around
The work-around for erratum A-004580 (Internal tracking loop can falsely lock causing unrecoverable bit errors) is implemented via the PBI (pre-boot initialization code, typically attached to the RCW binary). This is because the work-around is easier to implement in PBI than in U-Boot itself. It is still useful, however, for the 'errata' command to tell us whether the work-around has been applied. For A-004580, we can do this by verifying that the values in the specific registers that the work-around says to update. This change requires access to the SerDes lane sub-structure in serdes_corenet_t, so we make it a named struct. Signed-off-by: Timur Tabi ti...@freescale.com --- arch/powerpc/cpu/mpc85xx/cmd_errata.c | 48 + arch/powerpc/include/asm/config_mpc85xx.h |1 + arch/powerpc/include/asm/immap_85xx.h |2 +- 3 files changed, 50 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/cpu/mpc85xx/cmd_errata.c b/arch/powerpc/cpu/mpc85xx/cmd_errata.c index ccfad56..7d38e1c 100644 --- a/arch/powerpc/cpu/mpc85xx/cmd_errata.c +++ b/arch/powerpc/cpu/mpc85xx/cmd_errata.c @@ -24,6 +24,7 @@ #include command.h #include linux/compiler.h #include asm/processor.h +#include fsl_corenet_serdes.h #ifdef CONFIG_SYS_FSL_ERRATUM_A004849 /* @@ -84,6 +85,49 @@ static void check_erratum_a4849(uint32_t svr) } #endif +#ifdef CONFIG_SYS_FSL_ERRATUM_A004580 +/* + * This work-around is implemented in PBI, so just check to see if the + * work-around was actually applied. To do this, we check for specific data + * at specific addresses in the SerDes register block. + * + * The work-around says that for each SerDes lane, write BnTTLCRy0 = + * 0x1B00_0001, Register 2 = 0x0088_, and Register 3 = 0x4000_. + + */ +static void check_erratum_a4580(uint32_t svr) +{ + const serdes_corenet_t __iomem *srds_regs = + (void *)CONFIG_SYS_FSL_CORENET_SERDES_ADDR; + unsigned int lane; + + for (lane = 0; lane SRDS_MAX_LANES; lane++) { + if (serdes_lane_enabled(lane)) { + const struct serdes_lane __iomem *srds_lane = + srds_regs-lane[serdes_get_lane_idx(lane)]; + + /* +* Verify that the values we were supposed to write in +* the PBI are actually there. Also, the lower 15 +* bits of res4[3] should be the same as the upper 15 +* bits of res4[1]. +*/ + if ((in_be32(srds_lane-ttlcr0) != 0x1b01) || + (in_be32(srds_lane-res4[1]) != 0x88) || + (in_be32(srds_lane-res4[3]) != 0x4044)) { + printf(Work-around for Erratum A004580 is + not enabled\n); + return; + } + } + } + + /* Everything matches, so the erratum work-around was applied */ + + printf(Work-around for Erratum A004580 enabled\n); +} +#endif + static int do_errata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { #ifdef CONFIG_SYS_FSL_ERRATUM_NMG_CPU_A011 @@ -200,6 +244,10 @@ static int do_errata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) /* This work-around is implemented in PBI, so just check for it */ check_erratum_a4849(svr); #endif +#ifdef CONFIG_SYS_FSL_ERRATUM_A004580 + /* This work-around is implemented in PBI, so just check for it */ + check_erratum_a4580(svr); +#endif return 0; } diff --git a/arch/powerpc/include/asm/config_mpc85xx.h b/arch/powerpc/include/asm/config_mpc85xx.h index 3bde0f4..35a8ad1 100644 --- a/arch/powerpc/include/asm/config_mpc85xx.h +++ b/arch/powerpc/include/asm/config_mpc85xx.h @@ -420,6 +420,7 @@ #define CONFIG_SYS_FSL_CORENET_SNOOPVEC_COREONLY 0xff00 #define CONFIG_SYS_FSL_ERRATUM_SRIO_A004034 #define CONFIG_SYS_FSL_ERRATUM_A004849 +#define CONFIG_SYS_FSL_ERRATUM_A004580 #elif defined(CONFIG_PPC_P5020) /* also supports P5010 */ #define CONFIG_SYS_PPC64 /* 64-bit core */ diff --git a/arch/powerpc/include/asm/immap_85xx.h b/arch/powerpc/include/asm/immap_85xx.h index 128a4ae..2bac331 100644 --- a/arch/powerpc/include/asm/immap_85xx.h +++ b/arch/powerpc/include/asm/immap_85xx.h @@ -2619,7 +2619,7 @@ typedef struct serdes_corenet { #define SRDS_PCCR2_RST_XGMII1 0x0080 #define SRDS_PCCR2_RST_XGMII2 0x0040 u32 res5[197]; - struct { + struct serdes_lane { u32 gcr0; /* General Control Register 0 */ #define SRDS_GCR0_RRST 0x0040 #define SRDS_GCR0_1STLANE 0x0001 -- 1.7.3.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] PCIe on the i.MX6?
Yes, I have the PCI clocks on. I can read the config space and can see the PCIe bus traffic using a logic analyzer when I do so. When I try reading memory or I/O space, I don't see any bus traffic. Thanks, Carolyn On Thu, Nov 1, 2012 at 11:18 AM, Fabio Estevam feste...@gmail.com wrote: On Thu, Nov 1, 2012 at 2:32 PM, Carolyn Smith carolynsm...@gmail.com wrote: Hello, Does anyone have any experience with PCIe on an i.MX6 processor (in particular the i.MX6 Solo)? I can access the config space of my PCIe device but can't seem to get its BARs mapped in properly. I thought I had the viewports set up but when I try to access the space, I just get a processor lockup. Have you turned on the PCI clocks? ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/2] powerpc/85xx: update the work-around for P4080 erratum SERDES-9
The documented work-around for P4080 erratum SERDES-9 has been updated. It is now compatible with the work-around for erratum A-4580. This requires adding a few bitfield macros for the BnTTLCRy0 register. Signed-off-by: Timur Tabi ti...@freescale.com --- arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c | 20 +--- arch/powerpc/include/asm/immap_85xx.h |3 +++ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c b/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c index e6b1b1b..fcd3bff 100644 --- a/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c +++ b/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c @@ -714,9 +714,13 @@ void fsl_serdes_init(void) #ifdef CONFIG_SYS_P4080_ERRATUM_SERDES9 /* -* Set BnTTLCRy0[FLT_SEL] = 11 and set BnTTLCRy0[17] = 1 for -* each of the SerDes lanes selected as SGMII, XAUI, SRIO, or -* AURORA before the device is initialized. +* Set BnTTLCRy0[FLT_SEL] = 011011 and set BnTTLCRy0[31] = 1 +* for each of the SerDes lanes selected as SGMII, XAUI, SRIO, +* or AURORA before the device is initialized. +* +* Note that this part of the SERDES-9 work-around is +* redundant if the work-around for A-4580 has already been +* applied via PBI. */ switch (lane_prtcl) { case SGMII_FM1_DTSEC1: @@ -733,10 +737,12 @@ void fsl_serdes_init(void) case SRIO1: case SRIO2: case AURORA: - clrsetbits_be32(srds_regs-lane[idx].ttlcr0, - SRDS_TTLCR0_FLT_SEL_MASK, - SRDS_TTLCR0_FLT_SEL_750PPM | - SRDS_TTLCR0_PM_DIS); + out_be32(srds_regs-lane[idx].ttlcr0, +SRDS_TTLCR0_FLT_SEL_KFR_26 | +SRDS_TTLCR0_FLT_SEL_KPH_28 | +SRDS_TTLCR0_FLT_SEL_750PPM | +SRDS_TTLCR0_FREQOVD_EN); + break; default: break; } diff --git a/arch/powerpc/include/asm/immap_85xx.h b/arch/powerpc/include/asm/immap_85xx.h index 969f726..128a4ae 100644 --- a/arch/powerpc/include/asm/immap_85xx.h +++ b/arch/powerpc/include/asm/immap_85xx.h @@ -2637,8 +2637,11 @@ typedef struct serdes_corenet { u32 res3; u32 ttlcr0; /* Transition Tracking Loop Ctrl 0 */ #define SRDS_TTLCR0_FLT_SEL_MASK 0x3f00 +#define SRDS_TTLCR0_FLT_SEL_KFR_26 0x1000 +#define SRDS_TTLCR0_FLT_SEL_KPH_28 0x0800 #define SRDS_TTLCR0_FLT_SEL_750PPM 0x0300 #define SRDS_TTLCR0_PM_DIS 0x4000 +#define SRDS_TTLCR0_FREQOVD_EN 0x0001 u32 res4[7]; } lane[24]; u32 res6[384]; -- 1.7.3.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] hashtable lib and escaping
Hi, I used to have a working setup using U-Boot 2009.03 before upgrading to U-Boot 2012.07. The problem I'm facing is related to the escaping policies of lib/hashtable.c. What I did before was for example having something like this in my default environment: bootcmd=run first_boot first_boot=setenv bootcmd my_select\;run ubi_boot;saveenv;boot The trick accomplished was that the environment was saved after setting the real bootcmd (to my_select;run ubi_boot) on first boot so that the booted OS could always be relying on a valid environment in one of the flash env partitions. With the escape parsing of himport_r(), the '\' is simply dropped and it is no longer possible to escape ';' so the run ubi_boot is immediately executed and nothing is saved... The function header mentions the possibility for multi-line values but this should not come at the cost of not being able to escape ';'. I am not sure about what other uses the escape may have or used to have so I have not come up with a patch yet. Does anyone have any feedback/opinions concerning this? BR // Mats ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] hashtable lib and escaping
Dear Mats Kärrman, In message ed3e0bcacd909541ba94a34c4a164d4c425ce...@post.tritech.se you wrote: I used to have a working setup using U-Boot 2009.03 before upgrading to U-Boot 2012.07. The problem I'm facing is related to the escaping policies of lib/hashtable.c. What I did before was for example having something like this in my default environment: bootcmd=run first_boot first_boot=setenv bootcmd my_select\;run ubi_boot;saveenv;boot THis syntax has never been correct. If it ever worked, than only by chance (read: because of incorrect/imperfect code). With the escape parsing of himport_r(), the '\' is simply dropped and it is no longer possible to escape ';' so the run ubi_boot is immediately executed and nothing is saved... The function header mentions the possibility for multi-line values but thi s should not come at the cost of not being able to escape ';'. You have to be casreful here and keep in mind that (de-) escaping will take place in a different places: himport() (resp. setenv()) is only one part of this story - the other part is when you will actually pass this string to the command processor (the shell). See here: = setenv foo 'echo part one\;echo part two' ; print foo ; run foo foo=echo part one;echo part two part one part two = setenv foo 'echo part one\\;echo part two' ; print foo ; run foo foo=echo part one\;echo part two part one;echo part two = 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] [PATCH 1/2] WIP: Changes to patman libraries
Hi Wolfgang, On Wed, Oct 31, 2012 at 5:04 PM, Simon Glass s...@chromium.org wrote: Hi Wolfgang, On Wed, Oct 31, 2012 at 4:40 PM, Wolfgang Denk w...@denx.de wrote: Dear Simon, In message capnjgz3us4yoeqohxozq6vphxhakjdlwfb0hpwhwvnnuaz0...@mail.gmail.com you wrote: These changes are required to the patman libraries. This is not a proper patch yet, just sometime to try out. ...are required. So. And why exactly? Or what is the purpose of these changes? Just so that people can try the builder if they want to. The patches enhance functions in patman, mostly on the git side, so that the builder can do its job. For example it needs to clone a repo, checkout code into a different directory and work with branches a bit more. This is not a useful patch for any other purpose (e.g. review) - it is just a lump of code. If there is interest in this it will need to be turned into proper patches. Hm... I apologize, but I'm just an old man, and a bit slow of wits these days. I cannot review any such code without knowing what it is suppose to acchieve. Maybe you should add such explanations to the commit message, even if it's only a WIP patch? I would definitely appreciate this (as it would help me to understand what this is all about). Here are the notes for the changes. When I split this into commits I will put these comments with each commit. checkpatch.py: - remove two commented-out lines which are no-longer needed command.py: Change these functions to return a CommandResult class instead of just a return code. This allows us to capture output, errors and return codes. Should we need to expand the functionality in the future, it will be fairly easy - just add new members to the class. Also provide an option to raise an exception on error (non-zero return code), rather than always just returning the return code. This can make it easier to handle unforseen errors. Provide a back-door way of killing all tasks (although this needs further work). cros_subprocess.py: This is a slight enhancement of the build-in python subprocess module. It permits access to command output while it is in progress. This is important if we want to filter it for errors, etc., while still displaying it on the terminal. Since some tasks can take a minute to complete, it is not acceptable to show no output during this time. gitutils.py: Several functions are enhanced so that you can specify a --git-dir with the command, and also a --work-tree. This allows us to work with git repositories outside the current directory. This is needed for buildman, since it has multiple threads working in their own place with their own checked-out commit. New methods are added to clone a repo, fetch updates from a repo, checkout a commit, and obtain an expression for the list of commits in a branch. patchstream.py GetMetaDataForList() now supports --git-dir, and also allows an existing Series to be added too. This allows us to call it twice with different commit ranges and get a single, unified series. The old GetMetaData() function now calls this. terminal.py: This now supports both bright and normal ANSI colours. Colours are automatically supressed if the stdout is not a terminal. The avoids getting ANSI characters in piped output. Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/2] WIP: Test version of buildman - U-Boot builder
Hi Andy / Tom, On Wed, Oct 31, 2012 at 9:17 PM, Andy Fleming aflem...@gmail.com wrote: On Wed, Oct 31, 2012 at 8:18 PM, Tom Rini tr...@ti.com wrote: On Wed, Oct 31, 2012 at 05:11:51PM -0700, Simon Glass wrote: [snip] Also rather than running with 'make -j40' or whatever, it uses 'make -j1' but with 40 threads. This increases CPU utilisation quite substantially (almost 50%) - I think this was discussed some time ago, MAKEALL supports this, but doesn't default to it, today. I'm wondering if we ought to make it the default for all non-single board builds. The winning point is right around boards-to-build == `grep -c processor /proc/cpuinfo` and I think is right around setting NBUILDS to that value, both on consumer multicore and heavy-duty 32/64 core boxes. Yeah, I usually set BUILD_NBUILDS to 24-50 on my 24-thread system, and then set BUILD_NCPUS to 1-4. It's nice to offer a little bit of parallelism on the individual builds, sometimes. I did a bunch of tests, but not in a scientific fashion. Enough to agree with you that maxing out builds seems to win for u-boot. As a bit of an unscientific test, what sort of time does it take to build all 1000-or-so boards on your systems? Andy Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 2/2] serial: Make nulldev a serial device
This allows the default console to be specified as the nulldev. This is specifically helpful when the real serial console's init() cannot run early in the boot process. When the init can be run, then the console can be switched to the real device using the std* env vars. Signed-off-by: Joe Hershberger joe.hershber...@ni.com --- common/stdio.c | 37 --- drivers/serial/serial.c | 52 + include/serial.h| 4 3 files changed, 56 insertions(+), 37 deletions(-) diff --git a/common/stdio.c b/common/stdio.c index e9bdc0e..37d36cb 100644 --- a/common/stdio.c +++ b/common/stdio.c @@ -40,29 +40,6 @@ static struct stdio_dev devs; struct stdio_dev *stdio_devices[] = { NULL, NULL, NULL }; char *stdio_names[MAX_FILES] = { stdin, stdout, stderr }; -#if defined(CONFIG_SPLASH_SCREEN) !defined(CONFIG_SYS_DEVICE_NULLDEV) -#defineCONFIG_SYS_DEVICE_NULLDEV 1 -#endif - - -#ifdef CONFIG_SYS_DEVICE_NULLDEV -void nulldev_putc(const char c) -{ - /* nulldev is empty! */ -} - -void nulldev_puts(const char *s) -{ - /* nulldev is empty! */ -} - -int nulldev_input(void) -{ - /* nulldev is empty! */ - return 0; -} -#endif - /** * SYSTEM DRIVERS ** @@ -70,20 +47,6 @@ int nulldev_input(void) static void drv_system_init (void) { -#ifdef CONFIG_SYS_DEVICE_NULLDEV - struct stdio_dev dev; - - memset (dev, 0, sizeof (dev)); - - strcpy (dev.name, nulldev); - dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM; - dev.putc = nulldev_putc; - dev.puts = nulldev_puts; - dev.getc = nulldev_input; - dev.tstc = nulldev_input; - - stdio_register (dev); -#endif } /** diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c index f5f43a6..5031b00 100644 --- a/drivers/serial/serial.c +++ b/drivers/serial/serial.c @@ -110,6 +110,57 @@ serial_initfunc(s3c44b0_serial_initialize); serial_initfunc(sa1100_serial_initialize); serial_initfunc(sh_serial_initialize); +#if defined(CONFIG_SPLASH_SCREEN) !defined(CONFIG_SYS_DEVICE_NULLDEV) +#defineCONFIG_SYS_DEVICE_NULLDEV +#endif + +#if defined(CONFIG_SYS_DEVICE_NULLDEV) +int nulldev_init(void) +{ + /* nulldev is empty! */ + return 0; +} + +void nulldev_setbrg(void) +{ + /* nulldev is empty! */ +} + +void nulldev_putc(const char c) +{ + /* nulldev is empty! */ +} + +void nulldev_puts(const char *s) +{ + /* nulldev is empty! */ +} + +int nulldev_input(void) +{ + /* nulldev is empty! */ + return 0; +} + +struct serial_device nulldev_serial_device = { + nulldev, + nulldev_init, + NULL, + nulldev_setbrg, + nulldev_input, + nulldev_input, + nulldev_putc, + nulldev_puts, +}; + +void nulldev_serial_initalize(void) +{ + serial_register(nulldev_serial_device); +} +#else +serial_initfunc(nulldev_serial_initalize); +#endif + /** * serial_register() - Register serial driver with serial driver core * @dev: Pointer to the serial driver structure @@ -154,6 +205,7 @@ void serial_register(struct serial_device *dev) */ void serial_initialize(void) { + nulldev_serial_initalize(); mpc8xx_serial_initialize(); ns16550_serial_initialize(); pxa_serial_initialize(); diff --git a/include/serial.h b/include/serial.h index 14f863e..3d404da 100644 --- a/include/serial.h +++ b/include/serial.h @@ -22,6 +22,10 @@ struct serial_device { void default_serial_puts(const char *s); +#if defined(CONFIG_SYS_DEVICE_NULLDEV) +extern struct serial_device nulldev_serial_device; +#endif + extern struct serial_device serial_smc_device; extern struct serial_device serial_scc_device; extern struct serial_device *default_serial_console(void); -- 1.7.11.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/2] serial: Remove the serial console device
Each serial device is added as a console device. There was also the serial device that points to the most-recently-assigned-to-some- console-handle device. This can be confusing. Instead, only show the actual serial devices. Signed-off-by: Joe Hershberger joe.hershber...@ni.com --- common/console.c | 37 +++-- common/stdio.c | 12 +--- 2 files changed, 20 insertions(+), 29 deletions(-) diff --git a/common/console.c b/common/console.c index 1177f7d..9cc8197 100644 --- a/common/console.c +++ b/common/console.c @@ -26,6 +26,7 @@ #include malloc.h #include stdio_dev.h #include exports.h +#include serial.h DECLARE_GLOBAL_DATA_PTR; @@ -550,6 +551,7 @@ int console_assign(int file, const char *devname) { int flag; struct stdio_dev *dev; + const char *realdevname; /* Check for valid file */ switch (file) { @@ -565,8 +567,12 @@ int console_assign(int file, const char *devname) } /* Check for valid device name */ + if (strcmp(devname, serial) == 0) + realdevname = default_serial_console()-name; + else + realdevname = devname; - dev = search_device(flag, devname); + dev = search_device(flag, realdevname); if (dev) return console_setfile(file, dev); @@ -657,13 +663,16 @@ int console_init_r(void) } /* if the devices are overwritten or not found, use default device */ if (inputdev == NULL) { - inputdev = search_device(DEV_FLAGS_INPUT, serial); + inputdev = search_device(DEV_FLAGS_INPUT, + default_serial_console()-name); } if (outputdev == NULL) { - outputdev = search_device(DEV_FLAGS_OUTPUT, serial); + outputdev = search_device(DEV_FLAGS_OUTPUT, + default_serial_console()-name); } if (errdev == NULL) { - errdev= search_device(DEV_FLAGS_OUTPUT, serial); + errdev = search_device(DEV_FLAGS_OUTPUT, + default_serial_console()-name); } /* Initializes output console first */ if (outputdev != NULL) { @@ -713,18 +722,10 @@ int console_init_r(void) struct list_head *pos; struct stdio_dev *dev; -#ifdef CONFIG_SPLASH_SCREEN - /* -* suppress all output if splash screen is enabled and we have -* a bmp to display. We redirect the output from frame buffer -* console to serial console in this case or suppress it if -* silent mode was requested. -*/ - if (getenv(splashimage) != NULL) { - if (!(gd-flags GD_FLG_SILENT)) - outputdev = search_device (DEV_FLAGS_OUTPUT, serial); - } -#endif + outputdev = search_device(DEV_FLAGS_OUTPUT, + default_serial_console()-name); + inputdev = search_device(DEV_FLAGS_INPUT, + default_serial_console()-name); /* Scan devices looking for input and output devices */ list_for_each(pos, list) { @@ -760,13 +761,13 @@ int console_init_r(void) gd-flags |= GD_FLG_DEVINIT;/* device initialization completed */ - stdio_print_current_devices(); - /* Setting environment variables */ for (i = 0; i 3; i++) { setenv(stdio_names[i], stdio_devices[i]-name); } + stdio_print_current_devices(); + #if 0 /* If nothing usable installed, use only the initial console */ if ((stdio_devices[stdin] == NULL) (stdio_devices[stdout] == NULL)) diff --git a/common/stdio.c b/common/stdio.c index 605ff3f..e9bdc0e 100644 --- a/common/stdio.c +++ b/common/stdio.c @@ -70,21 +70,11 @@ int nulldev_input(void) static void drv_system_init (void) { +#ifdef CONFIG_SYS_DEVICE_NULLDEV struct stdio_dev dev; memset (dev, 0, sizeof (dev)); - strcpy (dev.name, serial); - dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM; - dev.putc = serial_putc; - dev.puts = serial_puts; - dev.getc = serial_getc; - dev.tstc = serial_tstc; - stdio_register (dev); - -#ifdef CONFIG_SYS_DEVICE_NULLDEV - memset (dev, 0, sizeof (dev)); - strcpy (dev.name, nulldev); dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM; dev.putc = nulldev_putc; -- 1.7.11.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v4 6/6] tegra: Enable NAND on Seaboard
On 07/30/2012 12:53 AM, Simon Glass wrote: This enables NAND support for the Seaboard. diff --git a/include/configs/seaboard.h b/include/configs/seaboard.h #include tegra20-common-post.h +/* NAND support */ +#define CONFIG_CMD_NAND +#define CONFIG_TEGRA_NAND + +/* Max number of NAND devices */ +#define CONFIG_SYS_MAX_NAND_DEVICE 1 + +/* Somewhat oddly, the NAND base address must be a config option */ +#define CONFIG_SYS_NAND_BASE TEGRA20_NAND_BASE Simon, I just noticed that all these config options are added after the include of tegra20-common-post.h. That file should be included at the very end in case it needs to do something different based on the board-specific configuration. I don't suppose you could move those lines before the include? ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] ARM: tegra: TrimSlice: add support for USB1 port
From: Stephen Warren swar...@nvidia.com TrimSlice's USB1 port has two purposes; it either acts as a device port hosting Tegra's USB recovery protocol, or acts as a host port connected to the internal USB-SATA bridge chip, which may in turn be connected to an SSD or HDD. Add the appropriate device tree and board configuration options to enable this port as a host port, and route the port to the SATA bridge using the VBUS GPIO. Signed-off-by: Stephen Warren swar...@nvidia.com --- board/compulab/dts/tegra20-trimslice.dts |3 ++- board/compulab/trimslice/trimslice.c |8 include/configs/trimslice.h |1 + 3 files changed, 11 insertions(+), 1 deletions(-) diff --git a/board/compulab/dts/tegra20-trimslice.dts b/board/compulab/dts/tegra20-trimslice.dts index db79e77..4450674 100644 --- a/board/compulab/dts/tegra20-trimslice.dts +++ b/board/compulab/dts/tegra20-trimslice.dts @@ -8,6 +8,7 @@ aliases { usb0 = /usb@c5008000; + usb1 = /usb@c500; }; memory { @@ -48,7 +49,7 @@ }; usb@c500 { - status = disabled; + nvidia,vbus-gpio = gpio 170 0; /* PV2 */ }; usb@c5004000 { diff --git a/board/compulab/trimslice/trimslice.c b/board/compulab/trimslice/trimslice.c index 9ef66fd..8f4dd09 100644 --- a/board/compulab/trimslice/trimslice.c +++ b/board/compulab/trimslice/trimslice.c @@ -34,6 +34,14 @@ #include mmc.h #endif +void pin_mux_usb(void) +{ + /* +* USB1 internal/external mux GPIO, which masquerades as a VBUS GPIO +* in the current device tree. +*/ + pinmux_tristate_disable(PINGRP_UAC); +} void pin_mux_spi(void) { diff --git a/include/configs/trimslice.h b/include/configs/trimslice.h index eeb0dbe..165bc73 100644 --- a/include/configs/trimslice.h +++ b/include/configs/trimslice.h @@ -80,6 +80,7 @@ #define CONFIG_ENV_OFFSET (512 * 1024) /* USB Host support */ +#define CONFIG_USB_MAX_CONTROLLER_COUNT 3 #define CONFIG_USB_EHCI #define CONFIG_USB_EHCI_TEGRA #define CONFIG_USB_STORAGE -- 1.7.0.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/2] ubi: Only read the actual size of the VID header
If sub-page reads are supported, this will save reading unneeded data Signed-off-by: Joe Hershberger joe.hershber...@ni.com --- drivers/mtd/ubi/io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c index 8423894..23660e3 100644 --- a/drivers/mtd/ubi/io.c +++ b/drivers/mtd/ubi/io.c @@ -916,7 +916,7 @@ int ubi_io_read_vid_hdr(struct ubi_device *ubi, int pnum, p = (char *)vid_hdr - ubi-vid_hdr_shift; err = ubi_io_read(ubi, p, pnum, ubi-vid_hdr_aloffset, - ubi-vid_hdr_alsize); + UBI_VID_HDR_SIZE); if (err) { if (err != UBI_IO_BITFLIPS err != -EBADMSG) return err; -- 1.7.11.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 2/2] nand: Move the sub-page read support enable to a flag
Use a flag instead of a hard-coded macro so that sub-page reads can be enabled in other cases (such as on-die ecc). Signed-off-by: Joe Hershberger joe.hershber...@ni.com --- drivers/mtd/nand/nand_base.c | 9 +++-- include/linux/mtd/nand.h | 7 --- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 71f5027..4f2963b 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -1245,7 +1245,8 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from, if (unlikely(ops-mode == MTD_OOB_RAW)) ret = chip-ecc.read_page_raw(mtd, chip, bufpoi, page); - else if (!aligned NAND_SUBPAGE_READ(chip) !oob) + else if (!aligned NAND_HAS_SUBPAGE_READ(chip) + !oob) ret = chip-ecc.read_subpage(mtd, chip, col, bytes, bufpoi); else @@ -1256,7 +1257,7 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from, /* Transfer not aligned data */ if (!aligned) { - if (!NAND_SUBPAGE_READ(chip) !oob + if (!NAND_HAS_SUBPAGE_READ(chip) !oob !(mtd-ecc_stats.failed - stats.failed)) chip-pagebuf = realpage; memcpy(buf, chip-buffers-databuf + col, bytes); @@ -3149,6 +3150,10 @@ int nand_scan_tail(struct mtd_info *mtd) /* Invalidate the pagebuffer reference */ chip-pagebuf = -1; + /* Large page NAND with SOFT_ECC should support subpage reads */ + if ((chip-ecc.mode == NAND_ECC_SOFT) (chip-page_shift 9)) + chip-options |= NAND_SUBPAGE_READ; + /* Fill in remaining MTD driver data */ mtd-type = MTD_NANDFLASH; mtd-flags = (chip-options NAND_ROM) ? MTD_CAP_ROM : diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index f63e04b..e9e9045 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h @@ -194,6 +194,9 @@ typedef enum { /* Device behaves just like nand, but is readonly */ #define NAND_ROM 0x0800 +/* Device supports subpage reads */ +#define NAND_SUBPAGE_READ 0x1000 + /* Options valid for Samsung large page devices */ #define NAND_SAMSUNG_LP_OPTIONS \ (NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK) @@ -203,9 +206,7 @@ typedef enum { #define NAND_MUST_PAD(chip) (!(chip-options NAND_NO_PADDING)) #define NAND_HAS_CACHEPROG(chip) ((chip-options NAND_CACHEPRG)) #define NAND_HAS_COPYBACK(chip) ((chip-options NAND_COPYBACK)) -/* Large page NAND with SOFT_ECC should support subpage reads */ -#define NAND_SUBPAGE_READ(chip) ((chip-ecc.mode == NAND_ECC_SOFT) \ -(chip-page_shift 9)) +#define NAND_HAS_SUBPAGE_READ(chip) ((chip-options NAND_SUBPAGE_READ)) /* Non chip related options */ /* -- 1.7.11.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v4 6/6] tegra: Enable NAND on Seaboard
Am Donnerstag, den 01.11.2012, 15:57 -0600 schrieb Stephen Warren: On 07/30/2012 12:53 AM, Simon Glass wrote: This enables NAND support for the Seaboard. diff --git a/include/configs/seaboard.h b/include/configs/seaboard.h #include tegra20-common-post.h +/* NAND support */ +#define CONFIG_CMD_NAND +#define CONFIG_TEGRA_NAND + +/* Max number of NAND devices */ +#define CONFIG_SYS_MAX_NAND_DEVICE 1 + +/* Somewhat oddly, the NAND base address must be a config option */ +#define CONFIG_SYS_NAND_BASE TEGRA20_NAND_BASE Simon, I just noticed that all these config options are added after the include of tegra20-common-post.h. That file should be included at the very end in case it needs to do something different based on the board-specific configuration. I don't suppose you could move those lines before the include? Also CONFIG_SYS_NAND_BASE is not really used in the current Tegra nand controller codebase, in fact you can get away with not defining it. We should probably use this define in our driver code, but then we should add this define to some common Tegra place and not to individual board files. Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v4 6/6] tegra: Enable NAND on Seaboard
Hi, On Thu, Nov 1, 2012 at 4:13 PM, Lucas Stach d...@lynxeye.de wrote: Am Donnerstag, den 01.11.2012, 15:57 -0600 schrieb Stephen Warren: On 07/30/2012 12:53 AM, Simon Glass wrote: This enables NAND support for the Seaboard. diff --git a/include/configs/seaboard.h b/include/configs/seaboard.h #include tegra20-common-post.h +/* NAND support */ +#define CONFIG_CMD_NAND +#define CONFIG_TEGRA_NAND + +/* Max number of NAND devices */ +#define CONFIG_SYS_MAX_NAND_DEVICE 1 + +/* Somewhat oddly, the NAND base address must be a config option */ +#define CONFIG_SYS_NAND_BASE TEGRA20_NAND_BASE Simon, I just noticed that all these config options are added after the include of tegra20-common-post.h. That file should be included at the very end in case it needs to do something different based on the board-specific configuration. I don't suppose you could move those lines before the include? Also CONFIG_SYS_NAND_BASE is not really used in the current Tegra nand controller codebase, in fact you can get away with not defining it. We should probably use this define in our driver code, but then we should add this define to some common Tegra place and not to individual board files. OK I will look at these next week. Regards, Simon Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] ARM: tegra: TrimSlice: add support for USB1 port
Hi Stephen, Am Donnerstag, den 01.11.2012, 16:14 -0600 schrieb Stephen Warren: From: Stephen Warren swar...@nvidia.com TrimSlice's USB1 port has two purposes; it either acts as a device port hosting Tegra's USB recovery protocol, or acts as a host port connected to the internal USB-SATA bridge chip, which may in turn be connected to an SSD or HDD. Add the appropriate device tree and board configuration options to enable this port as a host port, and route the port to the SATA bridge using the VBUS GPIO. Hm, I don't really like to abuse the VBUS GPIO for this function. As the GPIO controlled routing is more a sort of pinmux can't you just add the GPIO enable to pin_mux_usb()? Signed-off-by: Stephen Warren swar...@nvidia.com --- board/compulab/dts/tegra20-trimslice.dts |3 ++- board/compulab/trimslice/trimslice.c |8 include/configs/trimslice.h |1 + 3 files changed, 11 insertions(+), 1 deletions(-) diff --git a/board/compulab/dts/tegra20-trimslice.dts b/board/compulab/dts/tegra20-trimslice.dts index db79e77..4450674 100644 --- a/board/compulab/dts/tegra20-trimslice.dts +++ b/board/compulab/dts/tegra20-trimslice.dts @@ -8,6 +8,7 @@ aliases { usb0 = /usb@c5008000; + usb1 = /usb@c500; }; memory { @@ -48,7 +49,7 @@ }; usb@c500 { - status = disabled; + nvidia,vbus-gpio = gpio 170 0; /* PV2 */ }; usb@c5004000 { diff --git a/board/compulab/trimslice/trimslice.c b/board/compulab/trimslice/trimslice.c index 9ef66fd..8f4dd09 100644 --- a/board/compulab/trimslice/trimslice.c +++ b/board/compulab/trimslice/trimslice.c @@ -34,6 +34,14 @@ #include mmc.h #endif +void pin_mux_usb(void) +{ + /* + * USB1 internal/external mux GPIO, which masquerades as a VBUS GPIO + * in the current device tree. + */ + pinmux_tristate_disable(PINGRP_UAC); +} void pin_mux_spi(void) { diff --git a/include/configs/trimslice.h b/include/configs/trimslice.h index eeb0dbe..165bc73 100644 --- a/include/configs/trimslice.h +++ b/include/configs/trimslice.h @@ -80,6 +80,7 @@ #define CONFIG_ENV_OFFSET(512 * 1024) /* USB Host support */ +#define CONFIG_USB_MAX_CONTROLLER_COUNT 3 #define CONFIG_USB_EHCI #define CONFIG_USB_EHCI_TEGRA #define CONFIG_USB_STORAGE ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/2] WIP: Test version of buildman - U-Boot builder
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/01/12 14:01, Simon Glass wrote: Hi Andy / Tom, On Wed, Oct 31, 2012 at 9:17 PM, Andy Fleming aflem...@gmail.com wrote: On Wed, Oct 31, 2012 at 8:18 PM, Tom Rini tr...@ti.com wrote: On Wed, Oct 31, 2012 at 05:11:51PM -0700, Simon Glass wrote: [snip] Also rather than running with 'make -j40' or whatever, it uses 'make -j1' but with 40 threads. This increases CPU utilisation quite substantially (almost 50%) - I think this was discussed some time ago, MAKEALL supports this, but doesn't default to it, today. I'm wondering if we ought to make it the default for all non-single board builds. The winning point is right around boards-to-build == `grep -c processor /proc/cpuinfo` and I think is right around setting NBUILDS to that value, both on consumer multicore and heavy-duty 32/64 core boxes. Yeah, I usually set BUILD_NBUILDS to 24-50 on my 24-thread system, and then set BUILD_NCPUS to 1-4. It's nice to offer a little bit of parallelism on the individual builds, sometimes. I did a bunch of tests, but not in a scientific fashion. Enough to agree with you that maxing out builds seems to win for u-boot. As a bit of an unscientific test, what sort of time does it take to build all 1000-or-so boards on your systems? My setup using MAKEALL does 921 boards (arm/powerpc/mips) with ELDK 5.2 in 54min wall-clock with 397% CPU util (on a 6 core machine). - -- Tom -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iQIcBAEBAgAGBQJQkwXKAAoJENk4IS6UOR1Ws+oP/A2Estr8LHk2zt3cclDrshwI 9iNpiMvwJ2a/Qj3DzK6q3tuLKIJq/Chfsgczrz3wlv6RGqN5SB8U/Cbl9/OAg9oC jmSEjpGxT3pJyRKscyf/78cjMb06BadHVybPjkMtmfdlay3+H4CLLFkVahM1BKut +7MxTFtQIkPkHtXUwcTSYXuIhwwz61d6R65colHoHWVIbtRWpksaWa64107mEg3K 0A4Ite+FYoMK0BeswA1mPGknDCCLfgE32oXI4k4tQBAXrLcYWKlxLcirGydiZ46l Mrqh+62EA4U2FEVj3VbRjB2JtqRiqtbYYNSk9fwkdU0Fa/eYZacYYxStZVnVTfaQ RgZd0Gq7knJUed8bS0RvptDKLnMCadc0CgVEQ6Svj2JgfeZ9l/HOJkUX/MI7bCmv eKrtQQium4cJfXx2fGGdR2O21g+oQML/V0UTHkq78qMr3Z9Bqj3wRRyVGc5ch7kb 3P8aYjlJG8qU6OtDiwvRNIMvAQzovetJu18L+F/X3lgxqsvrEjk1Ugdach0smmkl TcM9U21la7oOAxhFg4J5W6aatdDx6kKU6s4K68kpcvpQ0MJjQ6bhjKASzf/VFuTl 6vLXUiN+qHc/2yBmuxgMluRfAzFEsLWZ3Y6r3bQC4f3mfmUZxt7CJ8D+rYqSQKUW TDHABRVdUDJxbypUaA8q =VhSN -END PGP SIGNATURE- ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] ARM: tegra: TrimSlice: add support for USB1 port
On 11/01/2012 05:17 PM, Lucas Stach wrote: Hi Stephen, Am Donnerstag, den 01.11.2012, 16:14 -0600 schrieb Stephen Warren: From: Stephen Warren swar...@nvidia.com TrimSlice's USB1 port has two purposes; it either acts as a device port hosting Tegra's USB recovery protocol, or acts as a host port connected to the internal USB-SATA bridge chip, which may in turn be connected to an SSD or HDD. Add the appropriate device tree and board configuration options to enable this port as a host port, and route the port to the SATA bridge using the VBUS GPIO. Hm, I don't really like to abuse the VBUS GPIO for this function. As the GPIO controlled routing is more a sort of pinmux can't you just add the GPIO enable to pin_mux_usb()? I don't know, I think it's fine. It's certainly this way in the kernel. And for all I know, this GPIO does actually affect VBUS as well as flipping any mux (and the more I think about that, the more likely it is) although I can't actually know for sure since I don't have the schematics. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] ARM: tegra: TrimSlice: add support for USB1 port
Am Donnerstag, den 01.11.2012, 17:30 -0600 schrieb Stephen Warren: On 11/01/2012 05:17 PM, Lucas Stach wrote: Hi Stephen, Am Donnerstag, den 01.11.2012, 16:14 -0600 schrieb Stephen Warren: From: Stephen Warren swar...@nvidia.com TrimSlice's USB1 port has two purposes; it either acts as a device port hosting Tegra's USB recovery protocol, or acts as a host port connected to the internal USB-SATA bridge chip, which may in turn be connected to an SSD or HDD. Add the appropriate device tree and board configuration options to enable this port as a host port, and route the port to the SATA bridge using the VBUS GPIO. Hm, I don't really like to abuse the VBUS GPIO for this function. As the GPIO controlled routing is more a sort of pinmux can't you just add the GPIO enable to pin_mux_usb()? I don't know, I think it's fine. It's certainly this way in the kernel. And for all I know, this GPIO does actually affect VBUS as well as flipping any mux (and the more I think about that, the more likely it is) although I can't actually know for sure since I don't have the schematics. If it's really triggering VBUS I'm fine with this, but then the comment in pin_mux_usb() is a bit off. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] tegra: add CONSOLE_MUX support to tegra-kbc
Add support for CONSOLE_MUX to tegra-kbc driver. This requires adding a flag to struct keyb to know the driver has already been initialized so if we try to initialize it again we can just return success. Also call into iomux_doenv() from drv_keyboard_init to re-evaluate the stdin string. Signed-off-by: Allen Martin amar...@nvidia.com --- drivers/input/tegra-kbc.c | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/input/tegra-kbc.c b/drivers/input/tegra-kbc.c index ab7a9e3..88471d3 100644 --- a/drivers/input/tegra-kbc.c +++ b/drivers/input/tegra-kbc.c @@ -63,6 +63,7 @@ static struct keyb { struct kbc_tegra *kbc; /* tegra keyboard controller */ unsigned char inited; /* 1 if keyboard has been inited */ unsigned char first_scan; /* 1 if this is our first key scan */ + unsigned char created; /* 1 if driver has been created */ /* * After init we must wait a short time before polling the keyboard. @@ -306,6 +307,10 @@ static void tegra_kbc_open(void) */ static int init_tegra_keyboard(void) { + /* check if already created */ + if (config.created) + return 0; + #ifdef CONFIG_OF_CONTROL int node; @@ -349,6 +354,7 @@ static int init_tegra_keyboard(void) config_kbc_gpio(config.kbc); tegra_kbc_open(); + config.created = 1; debug(%s: Tegra keyboard ready\n, __func__); return 0; @@ -357,6 +363,8 @@ static int init_tegra_keyboard(void) int drv_keyboard_init(void) { struct stdio_dev dev; + char *stdinname = getenv(stdin); + int error; if (input_init(config.input, 0)) { debug(%s: Cannot set up input\n, __func__); @@ -372,5 +380,13 @@ int drv_keyboard_init(void) dev.start = init_tegra_keyboard; /* Register the device. init_tegra_keyboard() will be called soon */ - return input_stdio_register(dev); + error = input_stdio_register(dev); + if (error) + return error; +#ifdef CONFIG_CONSOLE_MUX + error = iomux_doenv(stdin, stdinname); + if (error) + return error; +#endif + return 0; } -- 1.7.10.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 01/10] arm: Compile cache_disable() with -O2 to avoid failure
It is good to have these functions written in C instead of assembler, but with -O0 the cache_disable() function doesn't return. Rather than revert to assembler, this fix just forces this to be built with -O2. Signed-off-by: Simon Glass s...@chromium.org --- arch/arm/lib/cache-cp15.c | 10 ++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/arch/arm/lib/cache-cp15.c b/arch/arm/lib/cache-cp15.c index 939de10..8f8385d 100644 --- a/arch/arm/lib/cache-cp15.c +++ b/arch/arm/lib/cache-cp15.c @@ -110,6 +110,16 @@ static void cache_enable(uint32_t cache_bit) set_cr(reg | cache_bit); } +/* + * Big hack warning! + * + * Devs like to compile with -O0 to get a nice debugging illusion. But this + * function does not survive that since -O0 causes the compiler to read the + * PC back from the stack after the dcache flush. Might it be possible to fix + * this by flushing the write buffer? + */ +static void cache_disable(uint32_t cache_bit) __attribute__ ((optimize(2))); + /* cache_bit must be either CR_I or CR_C */ static void cache_disable(uint32_t cache_bit) { -- 1.7.7.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 03/10] arm: Keep track of the tlb size as well as its location
From: Gabe Black gabebl...@chromium.org It may be necessary to know where the TLB area ends as well as where it starts. This allows board code to complete a secure memory erase without destroying the page tables. Signed-off-by: Gabe Black gabebl...@google.com Signed-off-by: Simon Glass s...@chromium.org --- arch/arm/include/asm/global_data.h |1 + arch/arm/lib/board.c |5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h index 2b9af93..41a26ed 100644 --- a/arch/arm/include/asm/global_data.h +++ b/arch/arm/include/asm/global_data.h @@ -73,6 +73,7 @@ typedef struct global_data { unsigned long reloc_off; #if !(defined(CONFIG_SYS_ICACHE_OFF) defined(CONFIG_SYS_DCACHE_OFF)) unsigned long tlb_addr; + unsigned long tlb_size; #endif const void *fdt_blob; /* Our device tree, NULL if none */ void**jt; /* jump table */ diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index 92cad9a..6e048aa 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -346,13 +346,14 @@ void board_init_f(ulong bootflag) #if !(defined(CONFIG_SYS_ICACHE_OFF) defined(CONFIG_SYS_DCACHE_OFF)) /* reserve TLB table */ - addr -= (4096 * 4); + gd-tlb_size = 4096 * 4; + addr -= gd-tlb_size; /* round down to next 64 kB limit */ addr = ~(0x1 - 1); gd-tlb_addr = addr; - debug(TLB table at: %08lx\n, addr); + debug(TLB table from %08lx to %08lx\n, addr, addr + gd-tlb_size); #endif /* round down to next 4 kB limit */ -- 1.7.7.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 06/10] arm: Add CONFIG_DISPLAY_BOARDINFO_LATE to display board info on LCD
This option displays board info after stdio is running, so that it will appear on the LCD. If it is displayed earlier, the board info will appear on the serial console but not on the LCD. Signed-off-by: Simon Glass s...@chromium.org --- README |9 + arch/arm/lib/board.c | 19 +++ 2 files changed, 28 insertions(+), 0 deletions(-) diff --git a/README b/README index 589e22a..76a8436 100644 --- a/README +++ b/README @@ -3290,6 +3290,15 @@ use the saveenv command to store a valid environment. space for already greatly restricted images, including but not limited to NAND_SPL configurations. +- CONFIG_DISPLAY_BOARDINFO + Display information about the board that U-Boot is running on + when U-Boot starts up. + +- CONFIG_DISPLAY_BOARDINFO_LATE + Similar to the previous option, but display this information + later, once stdio is running and output goes to the LCD, if + present. + Low Level (hardware related) configuration options: --- diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index d3053d8..b879507 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -491,6 +491,16 @@ static int should_load_env(void) #endif } +#if defined(CONFIG_DISPLAY_BOARDINFO_LATE) defined(CONFIG_OF_CONTROL) +static void display_fdt_model(const void *blob) +{ + const char *model; + + model = (char *)fdt_getprop(blob, 0, model, NULL); + printf(Model: %s\n, model ? model : unknown); +} +#endif + / * * This is the next part if the initialization sequence: we are now @@ -617,6 +627,15 @@ void board_init_r(gd_t *id, ulong dest_addr) console_init_r(); /* fully init console as a device */ +#ifdef CONFIG_DISPLAY_BOARDINFO_LATE +# ifdef CONFIG_OF_CONTROL + /* Put this here so it appears on the LCD, now it is ready */ + display_fdt_model(gd-fdt_blob); +# else + checkboard(); +# endif +#endif + #if defined(CONFIG_ARCH_MISC_INIT) /* miscellaneous arch dependent initialisations */ arch_misc_init(); -- 1.7.7.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 05/10] arm: Add CONFIG_DELAY_ENVIRONMENT to delay environment loading
This option delays loading of the environment until later, so that only the default environment will be available to U-Boot. This can address the security risk of untrusted data being used during boot. When CONFIG_DELAY_ENVIRONMENT is defined, it is convenient to have a run-time way of enabling loadinlg of the environment. Add this to the fdt as /config/delay-environment. Note: This patch depends on http://patchwork.ozlabs.org/patch/194342/ Signed-off-by: Doug Anderson diand...@chromium.org Signed-off-by: Simon Glass s...@chromium.org --- README |9 + arch/arm/lib/board.c | 29 +++-- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/README b/README index 22fd6b7..589e22a 100644 --- a/README +++ b/README @@ -2311,6 +2311,15 @@ CBFS (Coreboot Filesystem) support - CONFIG_SYS_VENDOR - CONFIG_SYS_SOC + CONFIG_DELAY_ENVIRONMENT + + Normally the environment is loaded when the board is + intialised so that it is available to U-Boot. This inhibits + that so that the environment is not available until + explicitly loaded later by U-Boot code. With CONFIG_OF_CONTROL + this is instead controlled by the value of + /config/load-environment. + - DataFlash Support: CONFIG_HAS_DATAFLASH diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index 2ec6a43..d3053d8 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -40,6 +40,7 @@ #include common.h #include command.h +#include environment.h #include malloc.h #include stdio_dev.h #include version.h @@ -469,7 +470,28 @@ static char *failed = *** failed ***\n; #endif /* - + * Tell if it's OK to load the environment early in boot. + * + * If CONFIG_OF_CONFIG is defined, we'll check with the FDT to see + * if this is OK (defaulting to saying it's not OK). + * + * NOTE: Loading the environment early can be a bad idea if security is + * important, since no verification is done on the environment. + * + * @return 0 if environment should not be loaded, !=0 if it is ok to load + */ +static int should_load_env(void) +{ +#ifdef CONFIG_OF_CONTROL + return fdtdec_get_config_int(gd-fdt_blob, load-environment, 0); +#elif defined CONFIG_DELAY_ENVIRONMENT + return 0; +#else + return 1; +#endif +} + +/ * * This is the next part if the initialization sequence: we are now * running from RAM and have a normal C environment, i. e. global @@ -575,7 +597,10 @@ void board_init_r(gd_t *id, ulong dest_addr) #endif /* initialize environment */ - env_relocate(); + if (should_load_env()) + env_relocate(); + else + set_default_env(NULL); #if defined(CONFIG_CMD_PCI) || defined(CONFIG_PCI) arm_pci_init(); -- 1.7.7.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 08/10] arm: Make interrupts.o and reset.o in libarm also appear in SPL
From: Tom Wai-Hong Tam waih...@chromium.org SPL u-boot may call do_reset() which depends on interrupts.o and reset.o. So make them also appear in SPL. Signed-off-by: Tom Wai-Hong Tam waih...@chromium.org Signed-off-by: Simon Glass s...@chromium.org --- arch/arm/lib/Makefile |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile index 3422ac1..2fbdc07 100644 --- a/arch/arm/lib/Makefile +++ b/arch/arm/lib/Makefile @@ -40,14 +40,15 @@ ifndef CONFIG_SPL_BUILD COBJS-y+= board.o COBJS-y+= bootm.o COBJS-$(CONFIG_SYS_L2_PL310) += cache-pl310.o -COBJS-y+= interrupts.o -COBJS-y+= reset.o SOBJS-$(CONFIG_USE_ARCH_MEMSET) += memset.o SOBJS-$(CONFIG_USE_ARCH_MEMCPY) += memcpy.o else COBJS-$(CONFIG_SPL_FRAMEWORK) += spl.o endif +COBJS-y+= interrupts.o +COBJS-y+= reset.o + COBJS-y+= cache.o COBJS-y+= cache-cp15.o -- 1.7.7.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 04/10] arm: Move fdt check earlier so that board_early_init_f() can use it
We want to use the fdt inside board_early_init_f(), so check for its presence earlier in the pre-reloc init sequence. Signed-off-by: Simon Glass s...@chromium.org --- arch/arm/lib/board.c |7 +++ 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index 6e048aa..2ec6a43 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -226,13 +226,12 @@ int arch_cpu_init(void) init_fnc_t *init_sequence[] = { arch_cpu_init, /* basic arch cpu dependent setup */ - -#if defined(CONFIG_BOARD_EARLY_INIT_F) - board_early_init_f, -#endif #ifdef CONFIG_OF_CONTROL fdtdec_check_fdt, #endif +#if defined(CONFIG_BOARD_EARLY_INIT_F) + board_early_init_f, +#endif timer_init, /* initialize timer */ #ifdef CONFIG_BOARD_POSTCLK_INIT board_postclk_init, -- 1.7.7.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 02/10] arm: move flush_dcache_all() to just before disable cache
From: Arun Mankuzhi aru...@samsung.com In Cortex-A15 architecture, when we run cache invalidate the cache clean operation executes automatically. So if there are any dirty cache lines before disabling the L2 cache these will be synchronized with the main memory when invalidate_dcache_all() runs in the last part of U-boot The two functions after flush_dcache_all is using the stack. So this data will be on the cache. After disable when invalidate is called the data will be flushed from cache to memory. This corrupts the stack in invalida_dcache_all. So this change is required to avoid the u-boot hang. So flush has to be done just before clearing CR_C bit Signed-off-by: Arun Mankuzhi aru...@samsung.com Signed-off-by: Simon Glass s...@chromium.org --- arch/arm/lib/cache-cp15.c |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/arch/arm/lib/cache-cp15.c b/arch/arm/lib/cache-cp15.c index 8f8385d..03b9c80 100644 --- a/arch/arm/lib/cache-cp15.c +++ b/arch/arm/lib/cache-cp15.c @@ -134,8 +134,11 @@ static void cache_disable(uint32_t cache_bit) return; /* if disabling data cache, disable mmu too */ cache_bit |= CR_M; - flush_dcache_all(); } + reg = get_cr(); + cp_delay(); + if (cache_bit == (CR_C | CR_M)) + flush_dcache_all(); set_cr(reg ~cache_bit); } #endif -- 1.7.7.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 10/10] arm: Tabify code for MMC initialization
From: Taylor Hutt th...@chromium.org The two modified lines were indented with spaces. They are now indented with tabs. Signed-off-by: Taylor Hutt th...@chromium.org Signed-off-by: Simon Glass s...@chromium.org --- arch/arm/lib/board.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index ec3739f..288ce45 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -612,8 +612,8 @@ void board_init_r(gd_t *id, ulong dest_addr) #endif #ifdef CONFIG_GENERIC_MMC - puts(MMC: ); - mmc_initialize(gd-bd); + puts(MMC: ); + mmc_initialize(gd-bd); #endif #ifdef CONFIG_HAS_DATAFLASH -- 1.7.7.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 09/10] arm: Move bootstage record for board_init_f() to after arch_cpu_init()
The timer may be inited in arch_cpu_init() so it is not safe to make a bootstage mark before this is called. Arrange the code to fix this. We now get a correct time for board_init_f: Timer summary in microseconds: MarkElapsed Stage 0 0 reset 100,000100,000 spl_start 848,530748,530 board_init_f 907,301 58,771 board_init_r 910,478 3,177 board_init Signed-off-by: Simon Glass s...@chromium.org --- arch/arm/lib/board.c | 11 +-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index d420307..ec3739f 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -233,8 +233,17 @@ int __arch_cpu_init(void) int arch_cpu_init(void) __attribute__((weak, alias(__arch_cpu_init))); +/* Record the board_init_f() bootstage (after arch_cpu_init()) */ +static int mark_bootstage(void) +{ + bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_F, board_init_f); + + return 0; +} + init_fnc_t *init_sequence[] = { arch_cpu_init, /* basic arch cpu dependent setup */ + mark_bootstage, #ifdef CONFIG_OF_CONTROL fdtdec_check_fdt, #endif @@ -278,8 +287,6 @@ void board_init_f(ulong bootflag) void *new_fdt = NULL; size_t fdt_size = 0; - bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_F, board_init_f); - /* Pointer is writable since we allocated a register for it */ gd = (gd_t *) ((CONFIG_SYS_INIT_SP_ADDR) ~0x07); /* compiler optimization barrier needed for GCC = 3.4 */ -- 1.7.7.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 07/10] arm: Add option to display customised memory information
Some boards want to report more than just memory size. For example, it might be useful to display the memory type (DDR2, DDR3) or manufacturer. Add a weak function to support this requirement. Any example of the DRAM: output is below, just for illustration: U-Boot 2011.12-02470-gd64a0f8-dirty (Sep 14 2012 - 10:46:39) for SMDK5250 CPU: S5PC520 @ 1700MHz I2C: ready DRAM: 2 GiB Samsung DDR3 @ 800MHz MMC: S5P MSHC0: 0, S5P MSHC1: 1 Using default environment Signed-off-by: Simon Glass s...@chromium.org --- arch/arm/lib/board.c | 12 ++-- include/common.h |9 + 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index b879507..d420307 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -133,6 +133,15 @@ static int display_banner(void) return (0); } +inline void __board_show_dram(ulong size) +{ + puts(DRAM: ); + print_size(size, \n); +} + +void board_show_dram(ulong size) + __attribute__((weak, alias(__board_show_dram))); + /* * WARNING: this code looks cleaner than the PowerPC version, but * has the disadvantage that you either get nothing, or everything. @@ -157,8 +166,7 @@ static int display_dram_config(void) for (i = 0; i CONFIG_NR_DRAM_BANKS; i++) size += gd-bd-bi_dram[i].size; - puts(DRAM: ); - print_size(size, \n); + board_show_dram(size); #endif return (0); diff --git a/include/common.h b/include/common.h index b23e90b..6270b44 100644 --- a/include/common.h +++ b/include/common.h @@ -311,6 +311,15 @@ int mac_read_from_eeprom(void); extern u8 _binary_dt_dtb_start[]; /* embedded device tree blob */ int set_cpu_clk_info(void); +/** + * Show the DRAM size in a board-specific way + * + * This is used by boards to display DRAM information in their own way. + * + * @param size Size of DRAM (which should be displayed along with other info) + */ +void board_show_dram(ulong size); + /* common/flash.c */ void flash_perror (int); -- 1.7.7.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] tegra: add CONSOLE_MUX support to tegra-kbc
Dear Allen Martin, Add support for CONSOLE_MUX to tegra-kbc driver. This requires adding a flag to struct keyb to know the driver has already been initialized so if we try to initialize it again we can just return success. Also call into iomux_doenv() from drv_keyboard_init to re-evaluate the stdin string. Thanks ;-) I'll soon be tearing iomux apart btw., it looks like a bucket of crap :-( 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] powerpc/esdhc: force the bus width to 4bit
Best Regards Jerry Huang -Original Message- From: u-boot-boun...@lists.denx.de [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Andy Fleming Sent: Thursday, November 01, 2012 12:09 PM To: Lukasz Majewski Cc: Jaehoon Chung; Marek Vasut; Lei Wen; u-boot@lists.denx.de Subject: Re: [U-Boot] [PATCH] powerpc/esdhc: force the bus width to 4bit Hmm... looks like it is code done by me :-) So little explanation shall be given. This code is necessary for some targets (like Samsung's Goni) which can only support 4 bit MMC mode. for (; width = 0; width--) { So for FSL ESDHC, the width = 3, after implement mmc_switch successfully, will set the bus to 4 * width. Therefore, I will get the 12bit (4 x 3) bus width. This problem is MMC subsystem's bug. I think good that will modify the code in mmc.c. If caps is set to MMC_MODE_4BIT | MMC_MODE_8BIT, we can see the 12bit support with using mmcinfo command The mmc_set_bus_width(mmc, 4 * width) in conjunction to above code causes the problem. I agree, that this code shall be refactored. Lei, what do you think? I am... very confused by this whole thread. And the code associated with it. The host_caps field has a bitmask which declares the widths supported by a given controller. What would possess you to index them by addition, and convert their values by multiplication?? It's a bitfield! I'm embarrassed that I allowed this code in, and will review future submissions from you with a very skeptical eye. Ah, and further review indicates it is Lei Wen who introduced the idea of iterating through a bitfield by subtraction, though I can see how iterating through the EXT_CSD *field* definition (which looks a lot like a bitfield, but may not be) *might* be considered reasonable. Meanwhile, Huang Changming, why would you see this broken code, and then decide the best workaround was to cripple our controller by eliminating support for 8-bit? I see 12bit width when using mmcinfo, then found out the mmc.c has been changed, and I assume this change is right, So I have to force our controller to just support 4bit width, otherwise, the 12bit bus width is not correct. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] powerpc/esdhc: force the bus width to 4bit
Hi, Andy has sent the patch related with this problem. Check the patch [RFC] mmc: Properly determine maximum supported bus width Best Regards, Jaehoon Chung decide the best workaround was to cripple our controller by eliminating support for 8-bit? I see 12bit width when using mmcinfo, then found out the mmc.c has been changed, and I assume this change is right, So I have to force our controller to just support 4bit width, otherwise, the 12bit bus width is not correct. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] ARM: tegra: TrimSlice: add support for USB1 port
On Thu, Nov 1, 2012 at 3:14 PM, Stephen Warren swar...@wwwdotorg.org wrote: From: Stephen Warren swar...@nvidia.com TrimSlice's USB1 port has two purposes; it either acts as a device port hosting Tegra's USB recovery protocol, or acts as a host port connected to the internal USB-SATA bridge chip, which may in turn be connected to an SSD or HDD. Add the appropriate device tree and board configuration options to enable this port as a host port, and route the port to the SATA bridge using the VBUS GPIO. Signed-off-by: Stephen Warren swar...@nvidia.com Looks right to me. Acked-by: Simon Glass s...@chromium.org --- board/compulab/dts/tegra20-trimslice.dts |3 ++- board/compulab/trimslice/trimslice.c |8 include/configs/trimslice.h |1 + 3 files changed, 11 insertions(+), 1 deletions(-) ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] powerpc/esdhc: force the bus width to 4bit
Thanks, Jaehoon, I saw it. Best Regards Jerry Huang -Original Message- From: Jaehoon Chung [mailto:jh80.ch...@samsung.com] Sent: Friday, November 02, 2012 10:03 AM To: Huang Changming-R66093 Cc: Andy Fleming; Lukasz Majewski; Jaehoon Chung; Marek Vasut; u- b...@lists.denx.de; Wen; l...@theia.denx.de Subject: Re: [U-Boot] [PATCH] powerpc/esdhc: force the bus width to 4bit Hi, Andy has sent the patch related with this problem. Check the patch [RFC] mmc: Properly determine maximum supported bus width Best Regards, Jaehoon Chung decide the best workaround was to cripple our controller by eliminating support for 8-bit? I see 12bit width when using mmcinfo, then found out the mmc.c has been changed, and I assume this change is right, So I have to force our controller to just support 4bit width, otherwise, the 12bit bus width is not correct. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2] Add a simple load option to setexpr
Make setexpr accept a 2 parameter variant that will simply load a value into a variable. This is useful for loading a value from memory. Signed-off-by: Joe Hershberger joe.hershber...@ni.com --- Changes in v2: - Replaced memory get command with option to setexpr common/cmd_setexpr.c | 19 --- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/common/cmd_setexpr.c b/common/cmd_setexpr.c index 1b3edb7..70133b0 100644 --- a/common/cmd_setexpr.c +++ b/common/cmd_setexpr.c @@ -57,12 +57,22 @@ int do_setexpr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) int w; /* Validate arguments */ - if ((argc != 5) || (strlen(argv[3]) != 1)) + if (argc != 5 argc != 3) + return CMD_RET_USAGE; + if (argc == 5 strlen(argv[3]) != 1) return CMD_RET_USAGE; w = cmd_get_data_size(argv[0], 4); a = get_arg(argv[2], w); + + if (argc == 3) { + sprintf(buf, %lx, a); + setenv(argv[1], buf); + + return 0; + } + b = get_arg(argv[4], w); switch (argv[3][0]) { @@ -87,8 +97,11 @@ int do_setexpr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) U_BOOT_CMD( setexpr, 5, 0, do_setexpr, set environment variable as the result of eval expression, - [.b, .w, .l] name value1 op value2\n + [.b, .w, .l] name [*]value1 op [*]value2\n - set environment variable 'name' to the result of the evaluated\n express specified by op. op can be , |, ^, +, -, *, /, %\n - size argument is only meaningful if value1 and/or value2 are memory addresses + size argument is only meaningful if value1 and/or value2 are\n + memory addresses (*)\n + setexpr[.b, .w, .l] name *value\n + - load a memory address into a variable ); -- 1.7.11.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] WIP: cbfs: Add docbook template
Hi Marek, On Wed, Oct 31, 2012 at 4:39 PM, Marek Vasut ma...@denx.de wrote: Dear Simon Glass, This adds a docbook template for fs, and makes CBFS use it. Problems (advise please as I have enough 500pp books in my bookshelf): 1. It requires the function names to be repeated. I would like to do this: Repeating function names is good, you can be sure what the comment is associated with. Hmmm, well I already know that, since the comment appears immediately above the function... [...] 2. It will not accept the doxygen @param style for parameters: It's not doxygen, sorry. Read [1]. Yes, I was rather hoping there was an easy way to fix these two things. Never mind. btw. I'd like some kind of @return, but maybe describing the return value in comment is enough. Maybe, but it's nice to be explicit. The return value is at least as important as the parameters, and they are called out. Anyway I will rev the patch with the above in mind. Regads, Simon [...] [1] http://www.denx.de/wiki/U-Boot/CodingStyle 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 6/7] fs: Add a Coreboot Filesystem (CBFS) driver and commands
Hi, On Wed, Oct 31, 2012 at 6:22 PM, Tom Rini tr...@ti.com wrote: On Wed, Oct 31, 2012 at 11:41:20PM +0100, Wolfgang Denk wrote: Dear Simon Glass, In message 1350087972-1581-6-git-send-email-...@chromium.org you wrote: From: Gabe Black gabebl...@chromium.org This change adds CBFS support and some commands to use it to u-boot. These commands are: ... --- /dev/null +++ b/common/cmd_cbfs.c @@ -0,0 +1,214 @@ +/* + * Copyright (c) 2011 The Chromium OS Authors. All rights reserved. + * + * See file CREDITS for list of people who contributed to this + * project. file CREDITS ? Please fix globally... Is any of this code taken from any other project? If yes, then please attribute properly... Sorry? U-Boot has a CREDITS file but only ~10% of the files reference it. Tom or Wolfgang, can you please explain what I should do here? I don't know what to do about the CREDITS line. Regards, Simon -- Tom ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] ubifs: Allow ubifsmount volume reference by number
UBI can mount volumes by name or number The current code forces you to name the volume by prepending every name with ubi:. From fs/ubifs/super.c * There are several ways to specify UBI volumes when mounting UBIFS: * o ubiX_Y- UBI device number X, volume Y; * o ubiY - UBI device number 0, volume Y; * o ubiX:NAME - mount UBI device X, volume with name NAME; * o ubi:NAME - mount UBI device 0, volume with name NAME. Now any name passed in any of the above forms are allowed. Also update the configs that referenced ubifsmount. Signed-off-by: Joe Hershberger joe.hershber...@ni.com --- fs/ubifs/super.c| 4 +--- include/configs/apx4devkit.h| 2 +- include/configs/cam_enc_4xx.h | 2 +- include/configs/dockstar.h | 2 +- include/configs/ea20.h | 6 +++--- include/configs/ib62x0.h| 2 +- include/configs/iconnect.h | 2 +- include/configs/omap3_pandora.h | 3 ++- include/configs/tricorder.h | 2 +- include/configs/x600.h | 2 +- 10 files changed, 13 insertions(+), 14 deletions(-) diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 30ccd98..9acf243 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -1164,10 +1164,9 @@ static struct file_system_type ubifs_fs_type = { .get_sb = ubifs_get_sb, }; -int ubifs_mount(char *vol_name) +int ubifs_mount(char *name) { int flags; - char name[80] = ubi:; void *data; struct vfsmount *mnt; int ret; @@ -1186,7 +1185,6 @@ int ubifs_mount(char *vol_name) * Mount in read-only mode */ flags = MS_RDONLY; - strcat(name, vol_name); data = NULL; mnt = NULL; ret = ubifs_get_sb(ubifs_fs_type, flags, name, data, mnt); diff --git a/include/configs/apx4devkit.h b/include/configs/apx4devkit.h index 6764b47..b809dfe 100644 --- a/include/configs/apx4devkit.h +++ b/include/configs/apx4devkit.h @@ -223,7 +223,7 @@ root=ubi0:rootfs rootfstype=ubifs ${mtdparts} rw\0 \ bootcmd_nand= \ run bootargs_nand ubi part root 2048 \ - ubifsmount rootfs ubifsload 4100 boot/uImage \ + ubifsmount ubi:rootfs ubifsload 4100 boot/uImage \ bootm 4100\0 \ bootargs_mmc= \ setenv bootargs ${kernelargs} \ diff --git a/include/configs/cam_enc_4xx.h b/include/configs/cam_enc_4xx.h index 56dc1cb..38a2c1b 100644 --- a/include/configs/cam_enc_4xx.h +++ b/include/configs/cam_enc_4xx.h @@ -448,7 +448,7 @@ bootfile= __stringify(CONFIG_HOSTNAME) /uImage \0 \ kernel_addr_r=8060\0 \ load_kernel=tftp ${kernel_addr_r} ${bootfile}\0 \ - ubi_load_kernel=ubi part ubi 2048;ubifsmount ${img_volume}; \ + ubi_load_kernel=ubi part ubi 2048;ubifsmount ubi:${img_volume}; \ ubifsload ${kernel_addr_r} boot/uImage\0 \ fit_addr_r= __stringify(CONFIG_BOARD_IMG_ADDR_R) \0 \ img_addr_r= __stringify(CONFIG_BOARD_IMG_ADDR_R) \0 \ diff --git a/include/configs/dockstar.h b/include/configs/dockstar.h index 249f93b..63d5e35 100644 --- a/include/configs/dockstar.h +++ b/include/configs/dockstar.h @@ -85,7 +85,7 @@ #define CONFIG_BOOTCOMMAND \ setenv bootargs ${console} ${mtdparts} ${bootargs_root}; \ ubi part root; \ - ubifsmount root; \ + ubifsmount ubi:root; \ ubifsload 0x80 ${kernel}; \ ubifsload 0x110 ${initrd}; \ bootm 0x80 0x110 diff --git a/include/configs/ea20.h b/include/configs/ea20.h index d3eb596..a8c08e8 100644 --- a/include/configs/ea20.h +++ b/include/configs/ea20.h @@ -293,12 +293,12 @@ bootm ${kernel_addr_r}\0 \ net_self_load=tftp ${kernel_addr_r} ${bootfile}; \ tftp ${ramdisk_addr_r} ${ramdisk_file};\0 \ - nand_nand=ubi part nand0,${as};ubifsmount rootfs; \ + nand_nand=ubi part nand0,${as};ubifsmount ubi:rootfs; \ ubifsload ${kernel_addr_r} /boot/uImage; \ ubifsumount; run nandargs addip addtty\ addmtd addmisc addmem;clrlogo;\ bootm ${kernel_addr_r}\0 \ - nand_nandrw=ubi part nand0,${as};ubifsmount rootfs; \ + nand_nandrw=ubi part nand0,${as};ubifsmount ubi:rootfs; \ ubifsload ${kernel_addr_r} /boot/uImage; \ ubifsumount; run nandrwargs addip addtty \ addmtd addmisc addmem;clrlogo;\ @@ -309,7 +309,7 @@ u-boot= __stringify(CONFIG_HOSTNAME) /u-boot.bin\0 \ load_magic=if sf probe 0;then sf \ read c000 0x1 0x6;fi\0
[U-Boot] [PATCH] net: Fix endianness bug in link-local
The ip is stored in network order, so we can't test it in host order. Signed-off-by: Joe Hershberger joe.hershber...@ni.com --- net/link_local.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/link_local.c b/net/link_local.c index d52f13a..8a8f605 100644 --- a/net/link_local.c +++ b/net/link_local.c @@ -103,7 +103,7 @@ static void configure_wait(void) void link_local_start(void) { ip = getenv_IPaddr(llipaddr); - if (ip != 0 (ip IN_CLASSB_NET) != LINKLOCAL_ADDR) { + if (ip != 0 (htonl(ip) IN_CLASSB_NET) != LINKLOCAL_ADDR) { puts(invalid link address); net_set_state(NETLOOP_FAIL); return; -- 1.7.11.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] WIP: cbfs: Add docbook template
Dear Simon Glass, Hi Marek, On Wed, Oct 31, 2012 at 4:39 PM, Marek Vasut ma...@denx.de wrote: Dear Simon Glass, This adds a docbook template for fs, and makes CBFS use it. Problems (advise please as I have enough 500pp books in my bookshelf): 1. It requires the function names to be repeated. I would like to do this: Repeating function names is good, you can be sure what the comment is associated with. Hmmm, well I already know that, since the comment appears immediately above the function... At the time of writing, yes. But some adjustment of code might mess that up. [...] 2. It will not accept the doxygen @param style for parameters: It's not doxygen, sorry. Read [1]. Yes, I was rather hoping there was an easy way to fix these two things. Never mind. I'd say there is, but let's fix it in Linux kernel too. Actually, I have a pile of patches for Linux kernel's documentation, but it's hard to get any documentation patches in :-C btw. I'd like some kind of @return, but maybe describing the return value in comment is enough. Maybe, but it's nice to be explicit. The return value is at least as important as the parameters, and they are called out. I agree (!). Anyway I will rev the patch with the above in mind. [...] btw. It'd be nice to be able to patch the upstream (linux's) kerneldoc :-( 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] powerpc/esdhc: force the bus width to 4bit
Dear Huang Changming-R66093, Thanks, Jaehoon, I saw it. Best Regards Jerry Huang I wonder if you're just making fun of all of us or what you're actually trying to acomplish here with the constant top-posting ... I'm really stunned :-( -Original Message- From: Jaehoon Chung [mailto:jh80.ch...@samsung.com] Sent: Friday, November 02, 2012 10:03 AM To: Huang Changming-R66093 Cc: Andy Fleming; Lukasz Majewski; Jaehoon Chung; Marek Vasut; u- b...@lists.denx.de; Wen; l...@theia.denx.de Subject: Re: [U-Boot] [PATCH] powerpc/esdhc: force the bus width to 4bit Hi, Andy has sent the patch related with this problem. Check the patch [RFC] mmc: Properly determine maximum supported bus width Best Regards, Jaehoon Chung decide the best workaround was to cripple our controller by eliminating support for 8-bit? I see 12bit width when using mmcinfo, then found out the mmc.c has been changed, and I assume this change is right, So I have to force our controller to just support 4bit width, otherwise, the 12bit bus width is not correct. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot