aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/prom_parse.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2013-08-14powerpc: of_parse_dma_window should take a __be32 *dma_windowAnton Blanchard1-9/+8
We pass dma_window to of_parse_dma_window as a void * and then run through hoops to cast it back to a u32 array. In the process we lose endian annotation. Simplify it by just passing a __be32 * down. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2011-10-31powerpc: remove non-required uses of include <linux/module.h>Paul Gortmaker1-1/+0
None of the files touched here are modules, and they are not exporting any symbols either -- so there is no need to be including the module.h. Builds of all the files remains successful. Even kernel/module.c does not need to include it, since it includes linux/moduleloader.h instead. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2011-02-04of/pci: move of_irq_map_pci() into generic codeSebastian Andrzej Siewior1-84/+0
There is a tiny difference between PPC32 and PPC64. Microblaze uses the PPC32 variant. Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc> [grant.likely@secretlab.ca: Added comment to #endif, moved documentation block to function implementation, fixed for non ppc and microblaze compiles] Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2010-11-01of/net: Move of_get_mac_address() to a common source file.David Daney1-38/+0
There are two identical implementations of of_get_mac_address(), one each in arch/powerpc/kernel/prom_parse.c and arch/microblaze/kernel/prom_parse.c. Move this function to a new common file of_net.{c,h} and adjust all the callers to include the new header. Signed-off-by: David Daney <ddaney@caviumnetworks.com> [grant.likely@secretlab.ca: protect header with #ifdef] Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2010-07-05of/address: Merge all of the bus translation codeGrant Likely1-515/+0
Microblaze and PowerPC share a large chunk of code for translating OF device tree data into usable addresses. Differences between the two consist of cosmetic differences, and the addition of dma-ranges support code to powerpc but not microblaze. This patch moves the powerpc version into common code and applies many of the cosmetic (non-functional) changes from the microblaze version. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> CC: Michal Simek <monstr@monstr.eu> CC: Wolfram Sang <w.sang@pengutronix.de> CC: Stephen Rothwell <sfr@canb.auug.org.au>
2010-07-05of/address: merge of_address_to_resource()Grant Likely1-46/+1
Merge common code between PowerPC and Microblaze. This patch also moves the prototype of pci_address_to_pio() out of pci-bridge.h and into prom.h because the only user of pci_address_to_pio() is of_address_to_resource(). Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> CC: Michal Simek <monstr@monstr.eu> CC: Stephen Rothwell <sfr@canb.auug.org.au>
2010-07-05of/address: merge of_iomap()Grant Likely1-11/+0
Merge common code between Microblaze and PowerPC. This patch creates new of_address.h and address.c files to containing address translation and mapping routines. First routine to be moved it of_iomap() Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> CC: Michal Simek <monstr@monstr.eu> CC: Stephen Rothwell <sfr@canb.auug.org.au>
2010-07-05of/irq: merge irq mapping codeGrant Likely1-266/+0
Merge common irq mapping code between PowerPC and Microblaze. This patch merges of_irq_find_parent(), of_irq_map_raw() and of_irq_map_one(). The functions are dependent on one another, so all three are merged in a single patch. Other than cosmetic difference (ie. DBG() vs. pr_debug()), the implementations are identical. of_irq_to_resource() is also merged, but in this case the implementations are different. This patch drops the microblaze version and uses the powerpc implementation unchanged. The microblaze version essentially open-coded irq_of_parse_and_map() which it does not need to do. Therefore the powerpc version is safe to adopt. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> CC: Michal Simek <monstr@monstr.eu> CC: Benjamin Herrenschmidt <benh@kernel.crashing.org> CC: Stephen Rothwell <sfr@canb.auug.org.au>
2010-07-05of/powerpc: Move Powermac irq quirk code into powermac pic driver codeGrant Likely1-85/+0
The code that figures out what is wrong with the powermac irq device tree data belongs with the rest of the powermac irq code. This patch moves it out of prom_parse.c and into powermac/pic.c so that it is only compiled in when actually needed. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Stephen Rothwell <sfr@canb.auug.org.au>
2009-04-20powerpc: Fix of_node_put() exit path in of_irq_map_one()Ilpo Järvinen1-6/+5
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-01-07PCI: powerpc: use generic pci_swizzle_interrupt_pin()Bjorn Helgaas1-6/+1
Use the generic pci_swizzle_interrupt_pin() instead of arch-specific code. Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2008-12-03Merge branch 'merge'Paul Mackerras1-2/+5
2008-12-01powerpc: Fix IRQ assignment for some PCIe devicesAdhemerval Zanella1-2/+5
Currently, some PCIe devices on POWER6 machines do not get interrupts assigned correctly. The problem is that OF doesn't create an "interrupt" property for them. The fix is for of_irq_map_pci to fall back to using the value in the PCI interrupt-pin register in config space, as we do when there is no OF device-tree node for the device. I have verified that this works fine with a pair of Squib-E SAS adapter on a P6-570. Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-11-19powerpc: Use for_each_node_with_property() in of_irq_map_init()Michael Ellerman1-4/+1
Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-07-22powerpc: Fix OF parsing of 64 bits PCI addressesBenjamin Herrenschmidt1-20/+24
The OF parsing code for PCI addresses isn't always treating properly the address space indication 0b11 (ie. 0x3) as meaning 64 bits memory space. This means that it fails to parse addresses for PCI BARs that have this encoding set by the firmware, which happens on some SLOF versions and breaks offb palette handling on Powerstation. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Acked-by: Segher Boessenkool <segher@kernel.crashing.org>
2007-12-11[POWERPC] Add of_translate_dma_addressBenjamin Herrenschmidt1-4/+16
This adds a variant of of_translate_address that uses the dma-ranges property instead of "ranges", it's to be used by PCI code in parsing the dma-ranges property. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-12-11[POWERPC] pci_controller->arch_data really is a struct device_node *Stephen Rothwell1-1/+1
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-07-26Revert "[POWERPC] Don't complain if size-cells == 0 in prom_parse()"Paul Mackerras1-1/+1
This reverts commit fd6e9d3945ee122eb513ada8b17296d243c1ce5e. Having #size-cells == 0 in a node indicates that things under the node aren't directly accessible, and therefore we shouldn't try to translate addresses for devices under the node into CPU physical addresses. Some drivers, such as the nvram driver for powermacs, rely on of_address_to_resource failing if they are called for a node representing a device whose resources aren't directly accessible by the CPU. These drivers were broken by commit fd6e9d39, resulting in the "Lombard" powerbook hanging early in the boot process. Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-05-12[POWERPC] Don't complain if size-cells == 0 in prom_parse()Kim Phillips1-1/+1
An mdio bus scan was added with ucc_geth phylib migration patches, now machines complain on boot, saying: prom_parse: Bad cell count for /qe@e0100000/mdio@2120/ethernet-phy@00 prom_parse: Bad cell count for /qe@e0100000/mdio@2120/ethernet-phy@01 since size-cells can indeed be 0, this patch fixes the check. Signed-off-by: Kim Phillips <kim.phillips@freescale.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-05-02[POWERPC] Uninline of_iomap functionChristian Krafft1-0/+11
There is no big reason to have that function inlined. Signed-off-by: Christian Krafft <krafft@de.ibm.com> Acked-by: Arnd Bergmann <arnd.bergmann@de.ibm.com> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-05-02[POWERPC] Move of_irq_to_resource from prom.h to prom_parse.cMathieu Desnoyers1-0/+14
In the powerpc architecture, of_irq_to_resource, currently sitting in prom.h, needs irq_of_parse_and_map and NO_IRQ from asm-powerpc/irq.h. The solution suggested by Benjamin Herrenschmidt is to move it to arch/powerpc/kernel/prom_parse.c. Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-04-13[POWERPC] Rename get_property to of_get_property: arch/powerpcStephen Rothwell1-22/+21
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-04-13[POWERPC] Rename prom_n_size_cells to of_n_size_cellsStephen Rothwell1-2/+2
This is more consistent and gets us closer to the Sparc code. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-04-13[POWERPC] Rename prom_n_addr_cells to of_n_addr_cellsStephen Rothwell1-2/+2
This is more consistent and gets us closer to the Sparc code. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-03-08[POWERPC] Fix warning in prom_parse.c of_irq_map_oldworld()Benjamin Herrenschmidt1-1/+1
This function spews a warning due to possible use of an uninitialized variable. This can happen on broken device-trees or when called with a NULL argument. Makes ure we properly fail instead. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-02-17[POWERPC] add of_get_mac_address and update fsl_soc.c to use itTimur Tabi1-0/+40
Add function of_get_mac_address(), which obtains the best MAC address to use from the device tree by checking various properties in order. The order is: 'mac-address', then 'local-mac-address', then 'address'. It skips properties that contain invalid MAC addresses, which were probably not initialized by U-Boot. Update gfar_of_init() and fs_enet_of_init() in fsl_soc.c to call of_get_mac_address(). Signed-off-by: Timur Tabi <timur@freescale.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-12-20[POWERPC] Workaround oldworld OF bug with IRQs & P2P bridgesBenjamin Herrenschmidt1-2/+13
On some oldworld PowerMacs, OF doesn't assign interrupts properly beyond P2P bridges. Fortunately, the fix is easy as all those machines just wire all IRQ lines together to one IRQ which is assigned to the bridge itself. We already have a special function for parsing Apple OldWorld interrupts which are special, so let's add to it the ability to walk up the PCI tree to find interrupts. This fixes irqs on the lower slots of s900 clones among others. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-12-04[POWERPC] Fix OF pci flags parsingOlof Johansson1-0/+2
For PCI devices with only io ports, of_bus_pci_get_flags() will fall through and still mark the resource as IORESOURCE_MEM. Signed-off-by: Olof Johansson <olof@lixom.net> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-10-24[POWERPC] Fix up the OF functions to only do PCI stuff if PCI is actually configuredAndy Fleming1-140/+148
The original problem that inspired this patch was solved quite some time ago (Turning off PCI didn't work), but this patch neatens things up a little (I think), by putting all the PCI stuff inside a single CONFIG_PCI block. It also removes the OF PCI bus matching entries if CONFIG_PCI is off. Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-10-08Revert "[POWERPC] Don't get PCI IRQ from OF for devices with no IRQ"Linus Torvalds1-11/+6
This reverts commit 41550c5128150175197257b6ceab2cd50dea7b51. Quoth Ben Herrenschmidt: "Please revert this one for now. It seems to break G5s :( Looks like PCI cells inside Apple IO ASICs don't have a PCI_INTERRUPT_LINE set. I need to figure out a better fix." Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-06[POWERPC] Don't get PCI IRQ from OF for devices with no IRQBenjamin Herrenschmidt1-6/+11
This patch adds checking of the PCI_INTERRUPT_PIN register before using standard OF parsing to retreive PCI interrupts. The reason is that some PCI devices may have no PCI interrupt, though they may have interrupts attached via other means. In this case, we shall not use irq->pdev, but device-specific code can later retreive those interrupts instead. Without that patch, Maple and derivatives don't get the right interrupt for the second IDE channel as the linux IDE code fallsback to the PCI irq instead of trying to use the legacy ones for the on-board controller (which has no PCI_INTERRUPT_PIN). Having no PCI IRQ assign to it (as it doesn't request any) fixes it. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-08-31Merge branch 'merge'Paul Mackerras1-3/+12
2006-08-30[POWERPC] Make OF irq map code detect more error casesBenjamin Herrenschmidt1-4/+13
Device-tree bugs on js20 with some versions of SLOF were causing the interrupt for IDE to not be parsed correctly and fail to boot. This patch adds a bit more sanity checking to the parser to detect some of those errors and fail instead of returning bogus information. The powerpc PCI code can then trigger a fallback that works on those machines. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-08-25Merge branch 'merge'Paul Mackerras1-6/+7
2006-08-23[POWERPC] Fix compile problem without CONFIG_PCILi Yang1-6/+7
Compile fails without defining CONFIG_PCI. The patch fix this. [paulus@samba.org: Moved of_irq_pci_swizzle so we only need one #ifdef] Signed-off-by: Li Yang <leoli@freescale.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-08-01Merge branch 'merge'Paul Mackerras1-1/+1
2006-07-31[POWERPC] Constify & voidify get_property()Jeremy Kerr1-33/+35
Now that get_property() returns a void *, there's no need to cast its return value. Also, treat the return value as const, so we can constify get_property later. powerpc core changes. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-07-10[PATCH] powerpc: make OF interrupt tree parsing more strictSegher Boessenkool1-1/+1
This patch fixes a bit of boundchecking in the new Open Firmware interrupt tree parsing code. It's important that it fails when things aren't correct in order to trigger fallback mecanisms that are necessary to make some machines work properly. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-07[POWERPC] Use const qualifiers for prom parsing utilitesJeremy Kerr1-10/+12
The of_bus callbacks map and get_flags can be constified, as they don't alter the range or addr arguments. of_dump_addr and of_read_addr can also be constified. Built for 32- and 64-bit powerpc Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-07-03[POWERPC] New device-tree interrupt parsing codeBenjamin Herrenschmidt1-24/+419
Adds new routines to prom_parse to walk the device-tree for interrupt information. This includes both direct mapping of interrupts and low level parsing functions for use with partial trees. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-06-09[PATCH] powerpc: fix of_parse_dma_windowWill Schmidt1-0/+3
My js20 appears to lack the ibm,#dma- properties, and boot fails with a "Kernel panic - not syncing: iommu_init_table: Can't allocate 0 bytes" message. This adds a fallback to the "#address-cells" property in case the "#ibm,dma-address-cells" property is missing. Tested on js20 and power5 lpar. Unless there is a more elegant solution... :-) Signed-off-by: Will Schmidt <willschm@us.ibm.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-05-19[PATCH] powerpc: Add of_parse_dma_window()Jeremy Kerr1-0/+22
Add a function for generic parsing of dma-window properties (ie, ibm,dma-window and ibm,my-dma-window) of pci and virtual device nodes. This function will also be used by cell. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Acked-by: Olof Johansson <olof@lixom.net> Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-02-07[PATCH] powerpc: add refcounting to setup_peg2 and of_get_pci_addressOlaf Hering1-1/+3
setup_peg2 must do some refcounting. of_get_pci_address may need to drop the node Pegasos l2cr : L2 cache was not active, activating PCI bus 0 controlled by pci at 80000000 Badness in kref_get at /home/olaf/kernel/olh/ppc64/linux-2.6.16-rc2-olh/lib/kref.c:32 Call Trace: [C037BD00] [C0007934] show_stack+0x5c/0x184 (unreliable) [C037BD30] [C000E068] program_check_exception+0x184/0x584 [C037BD90] [C000F5F0] ret_from_except_full+0x0/0x4c --- Exception: 700 at kref_get+0xc/0x24 LR = of_node_get+0x24/0x3c [C037BE50] [C004FD94] __pte_alloc_kernel+0x64/0x80 (unreliable) [C037BE70] [C000CA18] of_get_parent+0x34/0x58 [C037BE90] [C0009B18] of_get_address+0x24/0x174 [C037BED0] [C000A108] of_address_to_resource+0x24/0x68 [C037BF00] [C038B128] chrp_find_bridges+0x114/0x470 [C037BF90] [C038AE48] chrp_setup_arch+0x1fc/0x32c [C037BFB0] [C03849B0] setup_arch+0x144/0x188 [C037BFD0] [C037C45C] start_kernel+0x34/0x1a8 [C037BFF0] [000037A0] 0x37a0 Badness in kref_get at /home/olaf/kernel/olh/ppc64/linux-2.6.16-rc2-olh/lib/kref.c:32 Call Trace: [C037BC90] [C0007934] show_stack+0x5c/0x184 (unreliable) [C037BCC0] [C000E068] program_check_exception+0x184/0x584 [C037BD20] [C000F5F0] ret_from_except_full+0x0/0x4c --- Exception: 700 at kref_get+0xc/0x24 LR = of_node_get+0x24/0x3c [C037BDE0] [00000000] 0x0 (unreliable) [C037BE00] [C000CA18] of_get_parent+0x34/0x58 [C037BE20] [C0009CE8] of_translate_address+0x2c/0x2fc [C037BEA0] [C0009FE8] __of_address_to_resource+0x30/0xc4 [C037BED0] [C000A130] of_address_to_resource+0x4c/0x68 [C037BF00] [C038B128] chrp_find_bridges+0x114/0x470 [C037BF90] [C038AE48] chrp_setup_arch+0x1fc/0x32c [C037BFB0] [C03849B0] setup_arch+0x144/0x188 [C037BFD0] [C037C45C] start_kernel+0x34/0x1a8 [C037BFF0] [000037A0] 0x37a0 PCI bus 0 controlled by pci at c0000000 Top of RAM: 0x10000000, Total RAM: 0x10000000 Signed-off-by: Olaf Hering <olh@suse.de> Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-01-14[PATCH] powerpc: Recognize /chaos bridge on old pmacs as PCIPaul Mackerras1-1/+2
The first generation of PCI powermacs had a host bridge called /chaos which was for all intents and purposes a PCI host bridge, but has a device_type of "vci" in the device tree (presumably it's not really PCI at the hardware level or something). The OF parsing stuff in arch/powerpc/kernel/prom_parse.c currently doesn't recognize it as a PCI bridge, which means that controlfb.c can't get its device addresses. This makes prom_parse.c recognize a device_type of "vci" as indicating a PCI host bridge. With this, controlfb works again. Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-01-09[PATCH] powerpc: pci_address_to_pio fixBenjamin Herrenschmidt1-2/+2
This fixes pci_address_to_pio() to return an unsigned long (to be safe) and fixes a bug in the implementation that caused it to return a bogus IO port number Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-01-09[PATCH] powerpc: Update OF address parsersBenjamin Herrenschmidt1-19/+146
This updates the OF address parsers to return the IO flags indicating the type of address obtained. It also adds a PCI call for converting physical addresses that hit IO space into into IO tokens, and add routines that return the translated addresses into struct resource Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-01-09[PATCH] powerpc: udbg updatesBenjamin Herrenschmidt1-1/+1
The udbg low level io layer has an issue with udbg_getc() returning a char (unsigned on ppc) instead of an int, thus the -1 if you had no available input device could end up turned into 0xff, filling your display with bogus characters. This fixes it, along with adding a little blob to xmon to do a delay before exiting when getting an EOF and fixing the detection of ADB keyboards in udbg_adb.c Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-01-09[PATCH] powerpc: Add OF address parsing code (#2)Benjamin Herrenschmidt1-0/+420
Parsing addresses extracted from Open Firmware isn't a simple matter. We have various bits of code that try to do it in various place, including some heuristics in prom.c that pre-parse addresses at boot and fill device-nodes "addrs", but those are dodgy at best and I want to deprecate them. So this patch introduces a new set of routines that should be capable of parsing most types of addresses and translating them into CPU physical addresses. It currently works for things on PCI busses and ISA busses and should work on "standard" busses like the root bus or the MacIO bus that don't put funky flags in addresses. If you have other bus types that do use funky flags, you'll have to add new bus type translators, which is fairly easy. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>