summaryrefslogtreecommitdiff
path: root/common/fdt_support.c
Commit message (Collapse)AuthorAgeLines
* fdt_support: Add multi-serial support for stdout fixupAnton Vorontsov2009-10-26-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-24-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-23-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-09-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-12-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-07-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-17-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-30-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-24-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-24-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-13-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-26-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-26-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-25-7/+23
|\
| * fdt_support: fdt_fixup_dr_usb: add support for phy_type fixupsAnton Vorontsov2008-07-16-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-21-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-14-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-20-2/+2
| | | | Signed-off-by: Detlev Zundel <dzu@denx.de>
* libfdt: Move the working_fdt pointer to cmd_fdt.cGerald Van Baren2008-06-10-5/+0
| | | | | | | | The working_fdt pointer was declared in common/fdt_support.c but was not used there. Move it to common/cmd_fdt.c where it is used (it is also used in lib_ppc/bootm.c). Signed-off-by: Gerald Van Baren <vanbaren@cideas.com>
* fdt: unshadow global working fdt variableKim Phillips2008-06-10-1/+1
| | | | | | | differentiate with local variables of the same name by renaming the global 'fdt' variable 'working_fdt'. Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
* 83xx/fdt_support: let user specifiy FSL USB Dual-Role controller roleAnton Vorontsov2008-03-25-0/+25
| | | | | | | | | Linux understands "host" (default), "peripheral" and "otg" (broken). Though, U-Boot doesn't restrict dr_mode variable to these values (think of renames in future). Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
* Remove deprecated CONFIG_OF_HAS_UBOOT_ENV and CONFIG_OF_HAS_BD_TJerry Van Baren2008-03-26-193/+0
| | | | | | | | | | | | | | These defines embedded the u-boot env variables and/or the bd_t structure in the fdt blob. The conclusion of discussion on the u-boot email list was that embedding these in the fdt blob is not useful: there are better ways of passing the data (in fact, the fdt blob itself replaces the bd_t struct). The only board that enables these is the stxxtc and they don't appear to be used by linux. Signed-off-by: Gerald Van Baren <vanbaren@cideas.com> Acked-by: Kim Phillips <kim.phillips@freescale.com>
* Fix building of fdt_support.c if DEBUG setKumar Gala2008-02-13-3/+3
| | | | Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* QE: Move FDT support into a common fileKumar Gala2008-02-12-48/+0
| | | | | | | Move the flat device tree setup for QE related devices into a common file shared between 83xx & 85xx platforms that have QE's. Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* 85xx: add ability to upload QE firmwareTimur Tabi2008-01-09-0/+48
| | | | | | | | | | | Define the layout of a binary blob that contains a QE firmware and instructions on how to upload it. Add function qe_upload_firmware() to parse the blob and perform the actual upload. Add command-line command "qe fw" to take a firmware blob in memory and upload it. Update ft_cpu_setup() on 85xx to create the 'firmware' device tree node if U-Boot has uploaded a firmware. Fully define 'struct rsp' in immap_qe.h to include the actual RISC Special Registers. Signed-off-by: Timur Tabi <timur@freescale.com>
* Fine grained per property /chosen updating.Gerald Van Baren2008-01-08-33/+40
| | | | | | | | | | Implement a suggestion by Scott Wood to make the /chosen handling fine grained. Don't overwrite pre-existing properties on a per-property basis, so if /chosen exists but a necessary /chosen/property doesn't, it gets created. If a /chosen property exists, it is NOT overwritten unless the "force" flag is true. Signed-off-by: Gerald Van Baren <vanbaren@cideas.com>
* Conditionally compile fdt_fixup_ethernet()Gerald Van Baren2007-12-07-0/+4
| | | | | Fix compiler warnings: On boards that don't have ethernets defined, don't compile fdt_fixup_ethernet().
* Added fdt_fixup_stdout that uses aliases to set linux,stdout-pathKumar Gala2007-12-07-0/+43
| | | | | | | We use a combination of the serialN alias and CONFIG_CONS_INDEX to determine which serial alias we should set linux,stdout-path to. Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* Add common memory fixup functionKumar Gala2007-12-07-0/+78
| | | | | | Add the function fdt_fixup_memory() to fixup the /memory node of the fdt Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* Conditionally compile fdt_support.cKumar Gala2007-12-07-5/+0
| | | | | | | Modify common/Makefile to conditionally compile fdt_support.c based on CONFIG_OF_LIBFDT. Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* Add additional fdt fixup helper functionsKumar Gala2007-11-21-0/+55
| | | | | | | | | | | Added the following fdt fixup helpers: * do_fixup_by_prop{_u32} - Find matching nodes by property name/value * do_fixup_by_compat{_u32} - Find matching nodes by compat The _u32 variants work the same only the property they are setting is know to be a 32-bit integer instead of a byte buffer. Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* Add fdt_fixup_ethernet helper to set mac addressesKumar Gala2007-11-21-0/+46
| | | | | | | Added a fixup helper that uses aliases to set mac addresses in the device tree based on the bd_t Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* Update libfdt from device tree compiler (dtc)Kumar Gala2007-11-21-23/+12
| | | | | | | Update libfdt to commit 8eaf5e358366017aa2e846c5038d1aa19958314e from the device tree compiler (dtc) project. Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* Move do_fixup* for libfdt into common codeKumar Gala2007-11-21-0/+23
| | | | | | | | | | Moved the generic fixup handling code out of cpu/mpc5xxx and cpu/mpc8260 into common/fdt_support.c and renamed: do_fixup() -> do_fixup_by_path() do_fixup_u32() -> do_fixup_by_path_u32() Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* Removed some nonused fdt functions and moved fdt_find_and_setprop out of libfdtKumar Gala2007-11-21-0/+26
| | | | | | | | | | | | | | Removed: fdt_node_is_compatible fdt_find_node_by_type fdt_find_compatible_node To ease merge of newer libfdt as we aren't using them anywhere at this time. Also moved fdt_find_and_setprop out of libfdt into fdt_support.c for the same reason. Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* fdt: suppress unused variable 'bd' warningKim Phillips2007-08-16-1/+0
| | | | Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
* Improve error print messages.Gerald Van Baren2007-08-10-31/+21
| | | | Signed-off-by: Gerald Van Baren <vanbaren@cideas.com>
* Create new fdt boardsetup command, fix bug parsing [] form of set values.Gerald Van Baren2007-08-10-15/+0
| | | | | | | | | | | | Previously ft_board_setup() was called by fdt_chosen() which was not really correctly structured. This splits ft_board_setup() out by creating a new fdt boardsetup command. Fix a bug when parsing fdt set command values which have the square bracket form [00 11 22 33] - the length was updated incorrectly in when parsing that form. Signed-off-by: Gerald Van Baren <vanbaren@cideas.com>
* Tighten up the error messages.Gerald Van Baren2007-08-10-22/+11
| | | | Signed-off-by: Gerald Van Baren <vanbaren@cideas.com>
* Fix fdt_chosen() to call ft_board_setup(), clean up long lines.Gerald Van Baren2007-08-10-39/+74
| | | | | | | | | The fdt_chosen() function was adding/seting some properties ad-hoc improperly and duplicated (poorly) what was done in ft_board_setup() Clean up long lines (setting properties, printing errors). Signed-off-by: Gerald Van Baren <vanbaren@cideas.com>
* Replace fdt_node_offset() with fdt_find_node_by_path().Gerald Van Baren2007-08-10-5/+5
| | | | | | | | The new name matches more closely the kernel's name, which is also a much better description. Signed-off-by: Wolfgang Grandegger <wg@grandegger.com> Acked-by: Gerald Van Baren <vanbaren@cideas.com>
* Minor code clean up.Gerald Van Baren2007-08-10-0/+5
| | | | | | | | Declare the variable fdt properly as extern. Call the "set_fn" function pointer the "short way" without the full dereferencing syntax. Signed-off-by: Gerald Van Baren <vanbaren@cideas.com>
* Improve error messages, more informative.Gerald Van Baren2007-08-10-13/+14
| | | | | | | | Print more than the raw libfdt error message strings. This is especially useful for cluing in the user when the bootm command aborts due to blob problems. Signed-off-by: Gerald Van Baren <vanbaren@cideas.com>
* Fix serious pointer bug with bootm and reserve map.Gerald Van Baren2007-04-19-2/+2
| | | | | | | What was suppose to be a stack variable was declared as a pointer, overwriting random memory. Also moved the libfdt.a requirement into the main Makefile. That is The U-Boot Way.
* Improve the bootm command for CONFIG_OF_LIBFDTGerald Van Baren2007-04-14-5/+29
| | | | | | In bootm, create the "/chosen" node only if it doesn't already exist (better matches the previous behavior). Update for proper reserved memory map handling for initrd.
* Moved fdt command support code to fdt_support.cGerald Van Baren2007-04-06-0/+323
...in preparation for improving the bootm command's handling of fdt blobs. Also cleaned up some coding sloppiness.