aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/fdt
Commit message (Collapse)AuthorAgeFilesLines
* Rename fdt_find_child to ofw_bus_find_child. There is nothing FDT-specificOleksandr Tymoshenko2015-05-242-18/+0
| | | | | | | | | in this function. Suggested by: andrew@ Notes: svn path=/head/; revision=283503
* Add helper method fdt_find_child to make access to child nodes easier.Oleksandr Tymoshenko2015-05-222-0/+18
| | | | | | | | | Some FDT nodes have complex properties organized as a child sub-nodes (e.g. timing for LCD panel) we need easy way to obtain handles for these sub-nodes Notes: svn path=/head/; revision=283275
* Provide the number of interrupt resources added to the listRuslan Bukin2015-05-151-1/+1
| | | | | | | by using extra argument, so caller will know that. Notes: svn path=/head/; revision=282972
* Bring in the start of the arm64 kernel.Andrew Turner2015-04-131-0/+49
| | | | | | | | | | | | | | | | | | | | | | | | | This is only the minimum set of files needed to boot in qemu. As such it is missing a few things. The bus_dma code is currently only stub functions with a full implementation from the development tree to follow. The gic driver has been copied as the interrupt framework is different. It is expected the two drivers will be merged by the arm intrng project, however this will need to be imported into the tree and support for arm64 would need to be added. This includes code developed by myself, SemiHalf, Ed Maste, and Robin Randhawa from ARM. This has been funded by the FreeBSD Foundation, with early development by myself in my spare time with assistance from Robin. Differential Revision: https://reviews.freebsd.org/D2199 Reviewed by: emaste, imp Relnotes: yes Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=281494
* Use OF_getencpropalloc() to handle endianess of the properties.Ian Lepore2015-04-101-3/+3
| | | | | | | Submitted by: Michal Meloun Notes: svn path=/head/; revision=281371
* Make simplebus a base class of ofwbus. This allows the elimination ofIan Lepore2015-03-272-45/+112
| | | | | | | | | | | | | | duplicated code in the two classes, and also allows devices in FDT-based systems to declare simplebus as their parent and still work correctly when the FDT data describes the device at the root of the tree rather than as a child of a simplebus (which is common for interrupt, clock, and power controllers). Differential Revision: https://reviews.freebsd.org/D1990 Submitted by: Michal Meloun Notes: svn path=/head/; revision=280772
* Allow creating subclass of FDT simplebusJayachandran C.2015-02-272-25/+60
| | | | | | | | | | | Provide sys/dev/fdt/simplebus.h with the class declaration so that it is possible to subclass FDT simplebus. Differential Revision: https://reviews.freebsd.org/D1886 Reviewed by: nwhitehorn, imp Notes: svn path=/head/; revision=279368
* Fix whitespace glitch from prior comit.Ian Lepore2015-01-311-1/+1
| | | | Notes: svn path=/head/; revision=277989
* Reimplement fdt_clock_register_provider() correctly. It turns out youIan Lepore2015-01-241-1/+2
| | | | | | | | | | | can't use OF_xref_from_device() to implement the function that registers the xref association with the device. Pointy hat: ian Submitted by: loos Notes: svn path=/head/; revision=277655
* Introduce ofw_bus_reg_to_rl() to replace part of common bus codeZbigniew Bodek2015-01-131-30/+1
| | | | | | | | | | | | | | Instead of reusing the same reg parsing code, create one, common function that puts reg contents to the resource list. Address cells and size cells are passed rather than acquired here so that any bus can have different default values. Obtained from: Semihalf Reviewed by: andrew, ian, nwhitehorn Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=277098
* Add support for empty ranges properties within the tree, some vendorAndrew Turner2014-12-191-3/+8
| | | | | | | | | device trees have these, for example the ARM AArch64 Foundation Model. Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=275937
* Eliminate fdt_data_verify(). The verification it proceed is wrongRuslan Bukin2014-12-152-66/+6
| | | | | | | | | disallowing us to encode 64-bit register numbers. Discussed with: nwhitehorn, andrew Notes: svn path=/head/; revision=275792
* The ranges parent bus address may just be a tag to the entry in the parentAndrew Turner2014-11-201-4/+87
| | | | | | | | | | | | | node. Take this in to account by searching until we find the range for the root node. Differential Revision: https://reviews.freebsd.org/D1160 Reviewed by: ian Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=274751
* Remove an #ifdef DEBUG wrapper, and instead use if (bootverbose).Ian Lepore2014-11-121-6/+5
| | | | Notes: svn path=/head/; revision=274413
* Fail to probe on simplebus nodes that lack a "ranges" property.Ian Lepore2014-10-191-1/+7
| | | | | | | | | | Increasingly, FDT data has the "simple-bus" compatible string on nodes that have children, but we wouldn't consider them to be busses. If the node lacks a ranges property then we will fail to attach successfully, so fail to probe as well. Notes: svn path=/head/; revision=273282
* Replace multiple nearly-identical copies of code to walk through an FDTIan Lepore2014-09-253-72/+2
| | | | | | | | | | | | | | | | | | | node's interrupts=<...> property creating resource list entries with a single common implementation. This change makes ofw_bus_intr_to_rl() the one true copy of that code and removes the copies of it from other places. This also adds handling of the interrupts-extended property, which allows specifying multiple interrupts for a node where each interrupt can have a separate interrupt-parent. The bindings for this state that the property cells contain an xref phandle to the interrupt parent followed by whatever interrupt info that parent normally expects. This leads to having a variable number of icells per interrupt in the property. For example you could have <&intc1 1 &intc2 26 9 0 &intc3 9 4>. Differential Revision: https://reviews.freebsd.org/D803 Notes: svn path=/head/; revision=272109
* Create an interface and support routines for drivers that handle IO pinIan Lepore2014-09-133-0/+256
| | | | | | | | | multiplexing and configuration based on FDT data. Reviewed by: imp Notes: svn path=/head/; revision=271546
* Use OF_xref_from_device(), not OF_xref_from_node(). Also, use bzero()Ian Lepore2014-09-021-3/+4
| | | | | | | rather than memset(). Notes: svn path=/head/; revision=270959
* Create an interface for drivers to enable or disable their clocks as listedIan Lepore2014-09-023-0/+296
| | | | | | | | | | | | | | | | in the clocks=<...> properties of their FDT data. The clock properties consist of 2-cell tuples, each containing a clock device node reference and a clock number. A clock device driver can register itself as providing this interface, then other drivers can turn the FDT clock node reference into the corresponding device_t so that they can use the interface to query and manipulate their clocks. This provides convenience functions to enable or disable all the clocks listed in the properties for a device, so most drivers will be able to manage their clocks with a single call to fdt_clock_enable_all(dev). Notes: svn path=/head/; revision=270957
* Rename OF_xref_phandle() to OF_node_from_xref() and add a new functionIan Lepore2014-09-012-3/+3
| | | | | | | | | that provides the inverse translation, OF_xref_from_node(). Discussed with: nwhitehorn Notes: svn path=/head/; revision=270945
* Adjust ofwbus and simplebus to attach at BUS_PASS_ORDER_MIDDLE, so thatIan Lepore2014-08-051-1/+1
| | | | | | | a platform can attach some other bus first if necessary. Notes: svn path=/head/; revision=269597
* Set ofwbus and simplebus to attach during BUS_PASS_BUS.Ian Lepore2014-08-051-2/+4
| | | | Notes: svn path=/head/; revision=269594
* Add the start of the ARM platform code. This is based on the PowerPCAndrew Turner2014-05-171-0/+72
| | | | | | | | | | | | | platform code, it is expected these will be merged in the future when the ARM code is more complete. Until more boards can be tested only use this with the Raspberry Pi and rrename the functions on the other SoCs. Reviewed by: ian@ Notes: svn path=/head/; revision=266301
* Catch up with last-second name change.Ian Lepore2014-02-161-1/+1
| | | | Notes: svn path=/head/; revision=261958
* Add a helper routine to depth-search the device tree for a node with aIan Lepore2014-02-162-0/+22
| | | | | | | | | | matching 'compatible' property. This probably has a short half-life (as do most of the fdt_ functions), but it helps solve some near-term needs until we work out the larger problems of device instantiation order versus the order of things in the fdt data. Notes: svn path=/head/; revision=261955
* Better nomatch messages: include compat string. Also, flag devices asWarner Losh2014-02-121-4/+11
| | | | | | | | disabled in the successful probe message, but leave what that means to the actual driver (no semantic changes). Notes: svn path=/head/; revision=261791
* Move Open Firmware device root on PowerPC, ARM, and MIPS systems toNathan Whitehorn2014-02-052-92/+1
| | | | | | | | | | | a sub-node of nexus (ofwbus) rather than direct attach under nexus. This fixes FDT on x86 and will make coexistence with ACPI on ARM systems easier. SPARC is unchanged. Reviewed by: imp, ian Notes: svn path=/head/; revision=261513
* Follow r261352 by updating all drivers which are children of simplebusIan Lepore2014-02-021-0/+3
| | | | | | | | | | | | | | | | to check the status property in their probe routines. Simplebus used to only instantiate its children whose status="okay" but that was improper behavior, fixed in r261352. Now that it doesn't check anymore and probes all its children; the children all have to do the check because really only the children know how to properly interpret their status property strings. Right now all existing drivers only understand "okay" versus something- that's-not-okay, so they all use the new ofw_bus_status_okay() helper. Notes: svn path=/head/; revision=261410
* Be more robust with malformed interrupt config data. Instead of crashingIan Lepore2014-02-021-5/+17
| | | | | | | | or going into a near-infinite loop, warn and make potentially-reasonable assumptions. Notes: svn path=/head/; revision=261405
* Fix missing offset.Nathan Whitehorn2014-02-021-1/+2
| | | | Notes: svn path=/head/; revision=261398
* Allow nesting of simplebuses.Nathan Whitehorn2014-02-021-0/+1
| | | | Notes: svn path=/head/; revision=261397
* Provide a simpler and more standards-compliant simplebus implementation toNathan Whitehorn2014-02-012-531/+252
| | | | | | | | | | get the Routerboard 800 up and running with the vendor device tree. This does not implement some BERI-specific features (which hopefully won't be necessary soon), so move the old code to mips/beri, with a higher attach priority when built, until MIPS interrupt domain support is rearranged. Notes: svn path=/head/; revision=261352
* Open Firmware interrupt specifiers can consist of arbitrary-length byteNathan Whitehorn2014-02-011-3/+1
| | | | | | | | | | | | strings and include arbitrary information (IRQ line/domain/sense). When the ofw_bus_map_intr() API was introduced, it assumed that, as on most systems, these were either 1 cell, containing an interrupt line, or 2, containing a line number plus a sense code. It turns out a non-negligible number of ARM systems use 3 (or even 4!) cells for interrupts, so make this more general. Notes: svn path=/head/; revision=261351
* Be more robust with malformed interrupt config data. Instead of crashingIan Lepore2014-01-241-5/+17
| | | | | | | | | | or going into a near-infinite loop, warn and make potentially-reasonable assumptions. Reviewed by: brooks, nwhitehorn Notes: svn path=/head/; revision=261094
* Remove dev/fdt/fdt_pci.c, which was code specific to Marvell ARM SoCs,Ian Lepore2014-01-052-220/+0
| | | | | | | | | related to setting up static device mappings. Since it was only used by arm/mv/mv_pci.c, it's now just static functions within that file, plus one public function that gets called only from arm/mv/mv_machdep.c. Notes: svn path=/head/; revision=260340
* Retire machine/fdt.h as a header used by MI code, as its function is nowNathan Whitehorn2014-01-055-44/+5
| | | | | | | | | | | | | | | | | | obsolete. This involves the following pieces: - Remove it entirely on PowerPC, where it is not used by MD code either - Remove all references to machine/fdt.h in non-architecture-specific code (aside from uart_cpu_fdt.c, shared by ARM and MIPS, and so is somewhat non-arch-specific). - Fix code relying on header pollution from machine/fdt.h includes - Legacy fdtbus.c (still used on x86 FDT systems) now passes resource requests to its parent (nexus). This allows x86 FDT devices to allocate both memory and IO requests and removes the last notionally MI use of fdtbus_bs_tag. - On those architectures that retain a machine/fdt.h, unused bits like FDT_MAP_IRQ and FDT_INTR_MAX have been removed. Notes: svn path=/head/; revision=260327
* Remove fdt_pic_table code from MIPS, PowerPC, and x86, as it is no longerNathan Whitehorn2014-01-043-131/+0
| | | | | | | | used by anything. The equivalent functionality is provided by the PIC drivers themselves on PowerPC and this is a no-op on MIPS and x86. Notes: svn path=/head/; revision=260285
* Reimplement fdt_intr_to_rl() in terms of OFW_BUS_MAP_INTR() andNathan Whitehorn2014-01-043-96/+23
| | | | | | | | OFW_BUS_CONFIG_INTR(). This function is only used by simplebus, so will likely be moved there in the future. Notes: svn path=/head/; revision=260282
* Remove dead code. Most of this was in an #if 0 block; the rest is notNathan Whitehorn2013-12-172-377/+0
| | | | | | | used and duplicates functionality in dev/ofw. Notes: svn path=/head/; revision=259514
* Teach nexus(4) about Open Firmware (e.g. FDT) on ARM and MIPS, retiringNathan Whitehorn2013-11-051-1/+1
| | | | | | | | | | | | | | | | | | | | fdtbus in most cases. This brings ARM and MIPS more in line with existing Open Firmware platforms like sparc64 and powerpc, as well as preventing double-enumeration of the OF tree on embedded PowerPC (first through nexus, then through fdtbus). This change is also designed to simplify resource management on FDT platforms by letting there exist a platform-defined root bus resource_activate() call instead of replying on fdtbus to do the right thing through fdt_bs_tag. The OFW_BUS_MAP_INTR() and OFW_BUS_CONFIG_INTR() kobj methods are also available to implement for similar purposes. Discussed on: -arm, -mips Tested by: zbb, brooks, imp, and others MFC after: 6 weeks Notes: svn path=/head/; revision=257702
* Move remaining code and data related to static device mapping into theIan Lepore2013-11-041-1/+1
| | | | | | | | | | new devmap.[ch] files. Emphasize the MD nature of these things by using the prefix arm_devmap_ on the function and type names (already a few of these things found their way into MI code, hopefully it will be harder to do by accident in the future). Notes: svn path=/head/; revision=257660
* This files should have been included in r257648.Ian Lepore2013-11-041-0/+3
| | | | Notes: svn path=/head/; revision=257649
* Remove all the instances of '#undef DEBUG' from kernel.Luiz Otavio O Souza2013-10-251-3/+0
| | | | | | | | Suggested by: rpaulo Approved by: adrian (mentor) Notes: svn path=/head/; revision=257127
* Use common OFW root code to set up fdtbus. This is an almost purelyNathan Whitehorn2013-10-251-553/+9
| | | | | | | | | | | negative diff that should improve reliability somewhat. There should be no differences in behavior -- please report any that crop up. This has been tested on ARM and PPC systems. Tested by: ray Notes: svn path=/head/; revision=257114
* Do not map IRQs twice. This fixes PowerPC/FDT systems with multiple PICs,Nathan Whitehorn2013-10-241-3/+2
| | | | | | | | which would try to treat the previously-mapped interrupts from fdt_decode_intr() as interrupt line numbers on the same parent PIC. Notes: svn path=/head/; revision=257060
* Remove OF_instance_to_package() hack for FDT and replace with use of theNathan Whitehorn2013-10-233-9/+7
| | | | | | | | generic OF_xref_phandle() API universally. Also replace some related explicit uses of fdt32_to_cpu() with OF_getencprop() calls. Notes: svn path=/head/; revision=256967
* MFP4: 223121 (PIC portion), 225861, 227822, 229692 (PIC only), 229693,Brooks Davis2013-10-221-0/+19
| | | | | | | | | | | | | | | | | | | | | 230523, 1123614 Implement a driver for Robert Norton's PIC as an FDT interrupt controller. Devices whose interrupt-parent property points to a beripic device will have their interrupt allocation, activation , and setup operations routed through the IC rather than down the traditional bus hierarchy. This driver largely abstracts the underlying CPU away allowing the PIC to be implemented on CPU's other than BERI. Due to insufficient abstractions a small amount of MIPS specific code is currently required in fdt_mips.c and to implement counters. MFC after: 3 days Sponsored by: DARPA/AFRL Notes: svn path=/head/; revision=256911
* Allow lots of interrupts (useful on multi-domain platforms) and do notNathan Whitehorn2013-10-221-4/+2
| | | | | | | set device_quiet() on all devices attached under nexus(4). Notes: svn path=/head/; revision=256899
* Standards-conformance and code deduplication:Nathan Whitehorn2013-10-223-14/+21
| | | | | | | | | | | | | - Use bus reference phandles in place of FDT offsets as IRQ domain keys - Unify the identical macio/fdt/mambo OpenPIC drivers into one - Be more forgiving (following ePAPR) about what we need from the device tree to identify an OpenPIC - Correctly map all IRQs into an interrupt domain - Set IRQ_*_CONFORM for interrupts on an unknown PIC type instead of failing attachment for that device. Notes: svn path=/head/; revision=256898
* MFP4: 223121 (FDT infrastructure portion)Brooks Davis2013-10-214-9/+392
| | | | | | | | | | | | | Implement support for interrupt-parent nodes in simplebus. The current implementation requires that device declarations have an interrupt-parent node and that it point to a device that has registered itself as a interrupt controller in fdt_ic_list_head and implements the fdt_ic interface. Sponsored by: DARPA/AFRL Notes: svn path=/head/; revision=256861