summaryrefslogtreecommitdiffstats
path: root/common/fdt_support.c
Commit message (Collapse)AuthorAgeFilesLines
* common/fdt_support.c: sparse fixesKim Phillips2013-02-071-39/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | trivial: fdt_support.c:89:64: warning: Using plain integer as NULL pointer fdt_support.c:325:65: warning: Using plain integer as NULL pointer fdt_support.c:352:65: warning: Using plain integer as NULL pointer For the following bad constant expression, We hardcode the max. number of memory banks to four for the foreseeable future, and add an error with instructions on what to do once it's exceeded: fdt_support.c:397:22: error: bad constant expression For the rest below, sparse found a couple of wrong endian conversions in of_bus_default_translate() and fdt_get_base_address(), but otherwise the rest is mostly annotation fixes: fdt_support.c:64:24: warning: cast to restricted __be32 fdt_support.c:192:21: warning: incorrect type in assignment (different base types) fdt_support.c:192:21: expected unsigned int [unsigned] [usertype] tmp fdt_support.c:192:21: got restricted __be32 [usertype] <noident> fdt_support.c:201:21: warning: incorrect type in assignment (different base types) fdt_support.c:201:21: expected unsigned int [unsigned] [addressable] [usertype] tmp fdt_support.c:201:21: got restricted __be32 [usertype] <noident> fdt_support.c:304:13: warning: incorrect type in assignment (different base types) fdt_support.c:304:13: expected unsigned int [unsigned] [usertype] val fdt_support.c:304:13: got restricted __be32 [usertype] <noident> fdt_support.c:333:13: warning: incorrect type in assignment (different base types) fdt_support.c:333:13: expected unsigned int [unsigned] [usertype] val fdt_support.c:333:13: got restricted __be32 [usertype] <noident> fdt_support.c:359:13: warning: incorrect type in assignment (different base types) fdt_support.c:359:13: expected unsigned int [unsigned] [usertype] val fdt_support.c:359:13: got restricted __be32 [usertype] <noident> fdt_support.c:373:21: warning: cast to restricted __be32 fdt_support.c:963:48: warning: incorrect type in argument 1 (different base types) fdt_support.c:963:48: expected restricted __be32 const [usertype] *p fdt_support.c:963:48: got unsigned int [usertype] *<noident> fdt_support.c:971:48: warning: incorrect type in argument 1 (different base types) fdt_support.c:971:48: expected restricted __be32 const [usertype] *p fdt_support.c:971:48: got unsigned int [usertype] *<noident> fdt_support.c:984:29: warning: incorrect type in argument 1 (different base types) fdt_support.c:984:29: expected restricted __be32 const [usertype] *cell fdt_support.c:984:29: got unsigned int [usertype] *addr fdt_support.c:996:32: warning: incorrect type in argument 1 (different base types) fdt_support.c:996:32: expected restricted __be32 const [usertype] *cell fdt_support.c:996:32: got unsigned int [usertype] *addr fdt_support.c:1041:41: warning: incorrect type in argument 1 (different base types) fdt_support.c:1041:41: expected restricted __be32 const [usertype] *cell fdt_support.c:1041:41: got unsigned int [usertype] *addr fdt_support.c:1053:41: warning: incorrect type in argument 2 (different base types) fdt_support.c:1053:41: expected restricted __be32 const [usertype] *range fdt_support.c:1053:41: got unsigned int const [usertype] *[assigned] ranges fdt_support.c:1064:53: warning: incorrect type in argument 2 (different base types) fdt_support.c:1064:53: expected restricted __be32 const [usertype] *addr fdt_support.c:1064:53: got unsigned int [usertype] *addr fdt_support.c:1110:50: warning: incorrect type in argument 2 (different base types) fdt_support.c:1110:50: expected restricted __be32 const [usertype] *addr fdt_support.c:1110:50: got unsigned int *<noident> fdt_support.c:1121:49: warning: incorrect type in argument 1 (different base types) fdt_support.c:1121:49: expected restricted __be32 const [usertype] *cell fdt_support.c:1121:49: got unsigned int *<noident> fdt_support.c:1147:60: warning: incorrect type in argument 2 (different base types) fdt_support.c:1147:60: expected restricted __be32 const [usertype] *addr fdt_support.c:1147:60: got unsigned int *<noident> fdt_support.c:1081:5: warning: symbol '__of_translate_address' was not declared. Should it be static? fdt_support.c:1154:5: error: symbol 'fdt_translate_address' redeclared with different type (originally declared at include/fdt_support.h:95) - incompatible argument 3 (different base types) fdt_support.c: In function 'fdt_node_offset_by_compat_reg': fdt_support.c:1173:17: warning: initialization discards 'const' qualifier from pointer target type [enabled by default] See also linux kernel commit 0131d897 "of/address: use proper endianess in get_flags". Signed-off-by: Kim Phillips <kim.phillips@freescale.com> Cc: Jerry Van Baren <gvb.uboot@gmail.com>
* treewide: include libfdt_env.h before fdt.hKim Phillips2013-02-071-1/+0
| | | | | | | | | | | and, if including libfdt.h which includes libfdt_env.h in the correct order, don't include fdt.h before libfdt.h. this is needed to get the fdt type definitions set from the project environment before fdt.h uses them. Signed-off-by: Kim Phillips <kim.phillips@freescale.com> Cc: Jerry Van Baren <gvb.uboot@gmail.com>
* fdt: edid: Enable fdt_add_edid() function when CONFIG_LCD definedTom Wai-Hong Tam2012-12-111-1/+1
| | | | | | | This function can be used for LCDs as well as monitors. Signed-off-by: Tom Wai-Hong Tam <waihong@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
* serial: Remove CONFIG_SERIAL_MULTI from remaining sourcesMarek Vasut2012-10-151-4/+2
| | | | | | | | | | | | Remove the parts depending either on disabled CONFIG_SERIAL_MULTI or ifdefs around CONFIG_SERIAL_MULTI parts since CONFIG_SERIAL_MULTI is now enabled by default. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Marek Vasut <marek.vasut@gmail.com> Cc: Tom Rini <trini@ti.com> Cc: Anatolij Gustschin <agust@denx.de> Cc: Stefan Roese <sr@denx.de>
* Fix constness of the fdt void pointer in fdt_getprop_u32_defaultGabe Black2011-11-131-2/+2
| | | | | | | The function fdt_getprop_u32_default doesn't modify the fdt, so it can use a const void * for its fdt argument. Signed-off-by: Gabe Black <gabeblack@chromium.org>
* Add some missing endian conversions in fdt_support.cGabe Black2011-11-131-2/+2
| | | | | | | | | | Some functions in fdt_support.c use fdt_getprop to read 32 bit values out of the device tree, but then use them directly without doing any endian conversion. Because they check for a value that doesn't actually appear in practice, the functions continued to work even though they're incorrect. This change adds the missing conversions. Signed-off-by: Gabe Black <gabeblack@chromium.org>
* fdt: Add new fdt_set_node_status & fdt_set_status_by_alias helpersShengzhou Liu2011-10-181-1/+59
| | | | | | | | | | | | | | | | | | | | | | | | Add common function fdt_set_node_status() to assist in various locations that we set a nodes status. This function utilizes the status values that are part of the EPAPR spec (on power.org). fdt_set_status_by_alias() is based on fdt_set_node_status() but uses an alias string to identify the node to update. We also add some shortcut functions to help the common cases of setting "okay" and "disabled": fdt_status_okay() fdt_status_disabled() fdt_status_okay_by_alias() fdt_status_disabled_by_alias() Finally, we fixup the corenet_ds ethernet code which previously had a function by the same name that can be replaced with the new helpers. Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Acked-by: Gerald Van Baren <vanbaren@cideas.com>
* sandbox: Use uintptr_t for 32/64-bit compatibilitySimon Glass2011-10-171-4/+4
| | | | | | This fixes a problems when building on some 64-bit machines. Signed-off-by: Simon Glass <sjg@chromium.org>
* fdt: update fdt_alloc_phandle to use fdt_get_phandleTimur Tabi2011-10-151-5/+2
| | | | | | | | | | | | | | | | | | | The device tree compiler, dtc, can use "phandle" and/or "linux,phandle" properties to specify the phandle for any node. By default, it uses both, but "linux,phandle" is deprecated. One day, we'd like to stop using "linux,phandle", but U-boot needs to support both properties equally first. fdt_alloc_phandle() generates a unique phandle, but it was only checking the "linux,phandle" properties. Instead, we use fdt_get_phandle(), which checks both properties automatically. This ensures that we support dtbs that only use "phandle". The side-effect is that fdt_alloc_phandle() now takes twice as long, since it has to check for two properties instead of one in each node that it searches. Signed-off-by: Timur Tabi <timur@freescale.com>
* fdt: check for fdt errors in fdt_create_phandleTimur Tabi2011-10-151-2/+9
| | | | | | | | | fdt_create_phandle() was ignoring errors from fdt_set_phandle(). If an error occurs, print an error message and return 0, which is an invalid phandle. We also need to change the return type for fdt_create_phandle() to indicate that it cannot return an error code. Signed-off-by: Timur Tabi <timur@freescale.com>
* fdt: Add new fdt_create_phandle helperKumar Gala2011-09-291-0/+20
| | | | | | | | Add a helper function that will return a phandle value for the given node. If the node doesn't have a phandle already one will be created. Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Acked-by: Gerald Van Baren <vanbaren@cideas.com>
* fdt: Rename fdt_create_phandle to fdt_set_phandleKumar Gala2011-09-291-3/+3
| | | | | | | | The old fdt_create_phandle didn't actually create a phandle it just set one. We'll introduce a new helper that actually does creation. Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Acked-by: Gerald Van Baren <vanbaren@cideas.com>
* fdt: introduce fdt_create_phandle()Gerald Van Baren2011-07-141-0/+40
| | | | | | | | | | | The ePAPR specification says that phandle properties should be called "phandle", and not "linux,phandle". To facilitate the migration from "linux,phandle" to "phandle", introduce function fdt_create_phandle(), which creates a phandle in a given node. For now, we create both the "phandle" and "linux,phandle" properties. A later version of this function will remove support for "linux,phandle". Signed-off-by: Timur Tabi <timur@freescale.com>
* fdt: introduce fdt_verify_alias_address() and fdt_get_base_address()Timur Tabi2011-07-141-0/+67
| | | | | | | | | | | | | Introduce two functions, fdt_verify_alias_address() and fdt_get_base_address(), which can be used to verify the physical address of a device in a device tree. fdt_get_base_address() returns the base address of an SOC or PCI node. fdt_verify_alias_address() prints a message if the address of a node specified by an alias does not match the given physical address. Signed-off-by: Timur Tabi <timur@freescale.com>
* Fix off-by-one error in passing initrd end address via device treeGrant Likely2011-04-251-1/+1
| | | | | | | | The initrd_end variable contains the address immediately *after* the initrd blob, not the last address containing data. This patch fixes an inadvertent off-by-one when setting up the initrd reserved map. Signed-off-by: Grant Likely <grant.likely@linaro.org>
* fdt_support: Fix buffer overflow in fdt_fixup_memory_banksKyle Moffett2011-04-171-1/+1
| | | | | | | | | | | | | When fdt_fixup_memory_banks is called with 2-cell address and size fields in the device-tree (IE: 64-bit address and size), then it will overflow its on-stack "tmp" buffer. This fixes the buffer size and adds a comment explaining how many bytes need to be allocated per record. Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com> Cc: Jerry Van Baren <vanbaren@cideas.com> Acked-by: Gerald Van Baren <vanbaren@cideas.com>
* Fix compiler warning in fdt_support.cDirk Behme2010-11-281-2/+2
| | | | | | | | | | | | Fix compiler warning fdt_support.c: In function 'of_bus_default_count_cells': fdt_support.c:957: warning: passing argument 1 of '__swab32p' discards qualifiers from pointer target type fdt_support.c:965: warning: passing argument 1 of '__swab32p' discards qualifiers from pointer target type be32_to_cpup() expects an 'u32 *' while prop is 'const u32 *'. Signed-off-by: Dirk Behme <dirk.behme@googlemail.com>
* common/fdt_support.c: Fix compile warningsWolfgang Denk2010-10-201-1/+0
| | | | | | | | | | | | | | Commit a6bd9e8 "FDT: Add fixup support for multiple banks of memory" removed code but forgot to remove the variables used by it, resulting in warnings: fdt_support.c: In function 'fdt_fixup_memory_banks': fdt_support.c:399: warning: unused variable 'sizecell' fdt_support.c:399: warning: unused variable 'addrcell' Remove the declarations, too. Signed-off-by: Wolfgang Denk <wd@denx.de>
* FDT: Add fixup support for multiple banks of memoryJohn Rigby2010-10-181-40/+46
| | | | | | | | | | Add fdt_fixup_memory_banks and reimplement fdt_fixup_memory using it. Tested on OMAP3 beagle board with two banks of memory. Signed-off-by: John Rigby <john.rigby@linaro.org> CC: Jerry Van Baren <vanbaren@cideas.com> Acked-by: Gerald Van Baren <vanbaren@cideas.com>
* common/fdt_support.c: fix compile errorMatthew McClintock2010-10-131-10/+10
| | | | | | | | | | | Fix build error introduced in beca5a5f5bf0d88125580e5e9c1730469cd50ab8 common/libcommon.a(fdt_support.o): In function `fdt_add_edid': /local/hudson/jobs/mirrors-u-boot.git/workspace/common/fdt_support.c:1205: undefined reference to `fdt_increase_size' make: *** [u-boot] Error 1 Signed-off-by: Matthew McClintock <msm@freescale.com> Signed-off-by: Anatolij Gustschin <agust@denx.de>
* fdt_support: support adding EDID property to FDT display nodesAnatolij Gustschin2010-10-121-0/+29
| | | | | | | | | | | | | | | | | Boards can pass display timing info for drivers using EDID block. Provide common function to add board specific EDID data to the device tree. Subsequent patch makes use of this functionality. Detailed timing descriptor data from EDID is used for programming the display controller. This is currently implemented on the Linux side by the fsl-diu-fb frame buffer driver and it is documented there in Documentation/powerpc/dts-bindings/fsl/diu.txt. Signed-off-by: Anatolij Gustschin <agust@denx.de> Acked-by: Detlev Zundel <dzu@denx.de> Cc: Gerald Van Baren <vanbaren@cideas.com>
* ppc4xx/fdt/flash: Fix bug in fdt_fixup_nor_flash_node()Stefan Roese2010-10-041-7/+10
| | | | | | | | | | | | This patch fixes a bug in fdt_fixup_nor_flash_node() when the reg property has multiple reg tuples, like: reg = <0 0x00000000 0x04000000 0 0x04000000 0x04000000>; In this case this function did not update the reg property correctly. Signed-off-by: Stefan Roese <sr@denx.de>
* ppc4xx/fdt/flash: Change fdt_fixup_nor_flash_node() to not rely on cs sizeStefan Roese2010-09-231-10/+41
| | | | | | | | | | | | | | | | | | | | | | This patch changes the behaviour of the fdt_fixup_nor_flash_node() function. Now it doesn't patch the size of the "reg" property with the chip-select size, but with the size returned from the new function flash_get_bank_size(). This function will return per weak default the flash size of the bank (bank = chip-select numer) detected by the flash driver. If this does not fit your needs, this function may be overridden by a board specific one. For this the parameters needed to be changed. So I intentionally squashed the PPC4xx stuff using this routine into this patch. Otherwise it would not be git-bisectable anymore. The board specific function for the AMCC/APM Ebony eval board is now included in this patch version. Signed-off-by: Stefan Roese <sr@denx.de> Tested-by: Detlev Zundel <dzu@denx.de> Cc: Gerald Van Baren <vanbaren@cideas.com> Cc: Wolfgang Denk <wd@denx.de>
* fdt: call fdt_parent_offset fewer times while translating addressesScott Wood2010-08-191-37/+21
| | | | | | | | | | | | | | | fdt_parent_offset() is an expensive operation, so we'd like to reduce unnecessary calls to it. Further, the practice of iterating up to the root if address/size cells aren't found was apparently done for Linux for compatibility with certain buggy Open Firmware implementations, and U-Boot inherited the code. The compliant behavior is to treat a missing #address-cells as 2, and a missing #size-cells as 1 -- never looking anywhere but the immediate parent of the node of interest. Signed-off-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* fdt: Fix bug in size calculation in fdt_resize() with initrd useFeng Wang2010-08-091-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Original bug description from Feng (fdt_resize() bug caused "WARNING: could not set linux, initrd-start FDT_ERR_NOSPACE."): What I got is an error: "WARNING: could not set linux,initrd-start FDT_ERR_NOSPACE." after loading Device Tree blob. This in turn caused linux to miss init part. After some digging, I found out the reason for this error, it is caused by fdt_resize(). FDT blob got resized after filling in all board specific information of PowerPC. (in boot_body_linux()). It reduced blob size with only extra space for two fdt_reserve_entry, one for fdt itself, and one for initrd. Then it's aligned to a 0x1000 page boundary. However, later in fdt_initrd(), it could add two more properties, initrd-start AND initrd-end, each one needs at least two fdt_reserve_entry sizes done by _fdt_add_property() (name and value). Thus, the two fdt_reserve_entry extra space is not sufficient. So for some specific fdt size which is just under the page boundary after resizing, this will cause an error of FDT_ERR_NOSPACE in fdt_initrd() when setting those two properties, and failed to pass initrd information to linux. My fix is in fdt_resize(), leave at least 4 fdt_reserve_entry for initrd. So instead of 2*sizeof(struct fdt_reserve_entry) for actual_totalsize, use 5*sizeof(struc fdt_reserve_entry). Stefan: I got this same error on katmai, when trying to boot with initrd (run flash_self). This patch fixes this issue. Signed-off-by: Feng Wang <fwang02@harris.com> Tested-by: Stefan Roese <sr@denx.de> Cc: Jerry Van Baren <gvb.uboot@gmail.com> Acked-by: Gerald Van Baren <vanbaren@cideas.com>
* fdt: Add function to alloc phandle valuesKumar Gala2010-07-261-0/+18
| | | | | | | | | | If we are creating reference (handles) to nodes in a device tree we need to first create a new phandle in node and this needs a new phandle value. So we search through the whole dtb to find the max phandle value and return the next greater value for a new phandle allocation. Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Acked-by: Gerald Van Baren <vanbaren@cideas.com>
* fdt: Add fdt_node_offset_by_compat_reg helperKumar Gala2010-07-201-0/+27
| | | | | | | | | | | Given a compatible string and physical address try and find a node that matches. This is useful when we want to find a specific device node to update (for example if we have multiple PCI nodes we can use the physical address to distinguish them when trying to update the device tree). Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Acked-by: Gerald Van Baren <vanbaren@cideas.com>
* fdt: Add fdt_translate_address to convert reg node to cpu phys addrKumar Gala2010-07-201-0/+264
| | | | | | | | | | | | | This code is extracted out of the Linux Kernel code from arch/powerpc/kernel/prom_parse.c. We maintain some of the same structure to support multiple bus types even though we only have one in the current code. In the future we might want to translate across a PCI bus and thus it will be easier to add that functionality back in. Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Acked-by: Gerald Van Baren <vanbaren@cideas.com>
* fdt: move fsl specific code from common fdt area to mpc8xxx/fdt.cKim Phillips2010-07-161-129/+0
| | | | | Signed-off-by: Kim Phillips <kim.phillips@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* fdt_support: add entry for sec3.1 and fix sec3.3Kim Phillips2010-05-301-1/+2
| | | | | | | | | | | | | | Add sec3.1 h/w geometry for fdt node fixups. Also, technically, whilst SEC v3.3 h/w honours the tls_ssl_stream descriptor type, it lacks the ARC4 algorithm execution unit required to be able to execute anything meaningful with it. Change the node to agree with the documentation that declares that the sec3.3 really doesn't have such a descriptor type. Reported-by: Haiying Wang <Haiying.Wang@freescale.com> Signed-off-by: Kim Phillips <kim.phillips@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* fdt: Add fdt_del_node_and_alias helperKumar Gala2010-04-071-0/+13
| | | | | | | | Add a helper function that given an alias will delete both the node the alias points to and the alias itself Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Acked-by: Gerald Van Baren <vanbaren@cideas.com>
* fdt_support: add partitions fixup in mtd nodeAnatolij Gustschin2010-03-211-0/+219
| | | | | | | | | Allow overwriting defined partitions in the device tree blob using partition info defined in the 'mtdparts' environment variable. Signed-off-by: Anatolij Gustschin <agust@denx.de> Cc: Gerald Van Baren <vanbaren@cideas.com>
* fdt_support: Add multi-serial support for stdout fixupAnton Vorontsov2009-10-261-1/+21
| | | | | | | | | | | | Currently fdt_fixup_stdout() is using hard-coded CONFIG_CONS_INDEX constant. With multi-serial support, the CONS_INDEX may no longer represent actual console, so we should try to extract port number from the current stdio device name instead of always hard-coding the constant value. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Acked-by: Gerald Van Baren <vanbaren@cideas.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* fdt: Fix fdt padding issue for initrd mem_rsvKumar Gala2009-10-241-2/+3
| | | | | | | | | | | | | Its possible that we end up with a device tree that happens to be a particular size that after we call fdt_resize() we don't have any space left for the initrd mem_rsv. Fix this be adding a second mem_rsv into the size calculation. We had one to cover the fdt itself and we have the potential of adding a second for the initrd. Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Acked-by: Gerald Van Baren <vanbaren@cideas.com>
* fdt: Add fdt_fixup_nor_flash_size() to fixup NOR FLASH size in dtbStefan Roese2009-10-231-0/+44
| | | | | | | | | | This function can be used to update the size in the "reg" property of the NOR FLASH device nodes. This is necessary for boards with non-fixed NOR FLASH sizes. Signed-off-by: Stefan Roese <sr@denx.de> Acked-by: Gerald Van Baren <vanbaren@cideas.com> Acked-by: Wolfgang Denk <wd@denx.de>
* fdt: Fix fdt_pci_dma_ranges handling of 64-bit rangesKumar Gala2009-08-091-2/+2
| | | | | | | | | | If the size of a region equal to 4G it can't be represnted in a 32-bit BAR so we should have marked that case as MEM64. Additionally bump the number of inbound windows up to 4 to handle the fact that Freescale PPCs that have an implicit window for CCSRBAR. Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* 83xx: Replace CONFIG_MPC83XX with CONFIG_MPC83xxPeter Tyser2009-06-121-2/+2
| | | | | | | | Use the standard lowercase "xx" capitalization that other Freescale architectures use for CPU defines to prevent confusion and errors Signed-off-by: Peter Tyser <ptyser@xes-inc.com> Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
* pci: Rename PCI_REGION_MEMORY to PCI_REGION_SYS_MEMORY for clarityKumar Gala2009-02-071-2/+2
| | | | | | | | | | The PCI_REGION_MEMORY and PCI_REGION_MEM are a bit to similar and can be confusing when reading the code. Rename PCI_REGION_MEMORY to PCI_REGION_SYS_MEMORY to clarify its used for system memory mapping purposes. Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* fdt_resize(): fix actualsize calculations with unaligned blobsPeter Korsgaard2009-01-171-1/+1
| | | | | | | | | | | | | The code in fdt_resize() to extend the fdt size to end on a page boundary is wrong for fdt's not located at an address aligned on a page boundary. What's even worse, the code would make actualsize shrink rather than grow if (blob & 0xfff) was bigger than the amount of padding added by ALIGN(), causing fdt_add_mem_rsv to fail. Fix it by aligning end address (blob + size) to a page boundary instead. For aligned fdt's this is equivalent to what we had before. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* fdt_resize(): ensure minimum paddingPeter Korsgaard2008-10-301-2/+5
| | | | | | | | | fdt_add_mem_rsv() requires space for a struct fdt_reserve_entry (16 bytes), so make sure that fdt_resize at least adds that much padding, no matter what the location or size of the fdt is. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk> Acked-by: Andy Fleming <afleming@freescale.com>
* fdt: Added helper to set PCI dma-ranges propertyKumar Gala2008-10-241-0/+69
| | | | | | | | | | | Added fdt_pci_dma_ranges() that parses the pci_region info from the struct pci_controller and populates the dma-ranges based on it. The max # of windws/dma-ranges we support is 3 since on embedded PowerPC based systems this is the max number of windows. Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Signed-off-by: Andrew Fleming-AFLEMING <afleming@freescale.com>
* fdt: Add fdt_getprop_u32_default helpersKumar Gala2008-10-241-0/+27
| | | | | | | | | Add helper functions to return find a node and return it's property or a default value. Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Signed-off-by: Andrew Fleming-AFLEMING <afleming@freescale.com> Acked-by: Gerald Van Baren <vanbaren@cideas.com>
* powerpc: Fix bootm to boot up again with a RamdiskHeiko Schocher2008-09-131-3/+1
| | | | | | | | | | | | | | | Commit 2a1a2cb6 didnt remove the dummy mem reservation in fdt_chosen, and this stopped Linux from booting with a Ramdisk. This patch fixes this, by deleting the useless dummy mem reservation. When booting with a Ramdisk, a fix offset FDT_RAMDISK_OVERHEAD is now added to of_size, so we dont need anymore a dummy mem reservation. I measured the value of FDT_RAMDISK_OVERHEAD on a MPC8270 based system (=0x44 bytes) and rounded it up to 0x80). Signed-off-by: Heiko Schocher <hs@denx.de> Acked-by: Kumar Gala <galak@kernel.crashing.org>
* fdt: refactor initrd related codeKumar Gala2008-08-261-42/+67
| | | | | | | | | Created a new fdt_initrd() to deal with setting the initrd properties in the device tree and fixing up the mem reserve. We can use this both in the choosen node handling and lets us remove some duplicated code when we fixup the initrd info in bootm on PPC. Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* fdt: refactor fdt resize codeKumar Gala2008-08-261-0/+39
| | | | | | | Move the fdt resizing code out of ppc specific boot code and into common fdt support code. Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* Merge branch 'next'Kim Phillips2008-08-251-7/+23
|\
| * fdt_support: fdt_fixup_dr_usb: add support for phy_type fixupsAnton Vorontsov2008-07-161-7/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently U-Boot can only fixup the usb dr_mode, but some boards (namely MPC8315E-RDB) can use two PHY types: ULPI (stand-alone OTG port) or UTMI (connected to the four-ports hub, usb host only). This patch implements support for passing Dual-Role USB controller's device tree property phy_type through the usb_phy_type environment variable. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Acked-by: Gerald Van Baren <vanbaren@cideas.com> Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
* | fdt: rework fdt_fixup_ethernet() to use env instead of bd_tKumar Gala2008-08-211-41/+27
|/ | | | | | | | | | Move to using the environment variables 'ethaddr', 'eth1addr', etc.. instead of bd->bi_enetaddr, bi_enet1addr, etc. This makes the code a bit more flexible to the number of ethernet interfaces. Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* fdt: add crypto node handling for MPC8{3, 5}xxE processorsKim Phillips2008-07-141-0/+87
| | | | | | | | Delete the crypto node if not on an E-processor. If on 8360 or 834x family, check rev and up-rev crypto node (to SEC rev. 2.4 property values) if on an 'EA' processor, e.g. MPC8349EA. Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
* fdt: Fix typo in variable name.Detlev Zundel2008-06-201-2/+2
| | | | Signed-off-by: Detlev Zundel <dzu@denx.de>
OpenPOWER on IntegriCloud