- 02 Mar, 2011 1 commit
-
-
Andres Salomon authored
Commit e2f2a93b , "of/promtree: add package-to-path support to pdt" changed dp->name from using the 'name' property to using package-to-path. This fixed /proc/device-tree creation by eliminating conflicts between names (the 'name' property provides names like 'battery', whereas package-to-path provides names like '/foo/bar/battery@0', which we stripped to 'battery@0'). However, it also breaks of_device_id table matching. The fix that we _really_ wanted was to keep dp->name based upon the name property ('battery'), but based dp->full_name upon package-to-path ('battery@0'). This patch does just that. This changes all users (except SPARC) of promtree to use the full result from package-to-path for full_name, rather than stripping the directory out. In practice, the strings end up being exactly the same; this change saves time, code, and memory. SPARC continues to use the existing build_path_component() code. v2: combine two patches and revert of_pdt_node_name to original version v3: use dp->phandle instead of passing around node v4: warn/bail out for non-sparc archs if pkg2path is not set v5: split of_pdt_build_full_name into sparc & non-sparc versions v6: Pass NULL to pkg2path before buf gets assigned. Drop check for pkg2path hook on each and every node. v7: Don't BUG() when unable to get the full_path; create a known-unique name instead. Signed-off-by:
Andres Salomon <dilinger@queued.net> Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
- 16 Jan, 2011 1 commit
-
-
Grant Likely authored
The physical address is never used by the device tree code when allocating memory for unflattening. Change the architecture's alloc hook to return the virutal address instead. Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
- 03 Jan, 2011 1 commit
-
-
Grant Likely authored
Device nodes with the property status="disabled" are not usable and so don't register them when parsing the device tree for devices. Signed-off-by:
Grant Likely <grant.likely@secretlab.ca> Cc: Hollis Blanchard <hollis_blanchard@mentor.com> Cc: Deepak Saxena <deepak_saxena@mentor.com> Cc: Scott Wood <scottwood@freescale.com>, Cc: David Gibson <david@gibson.dropbear.id.au> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-
- 01 Jan, 2011 1 commit
-
-
Grant Likely authored
This patch adds of_flat_dt_match() which tests a node for compatibility with a list of values and converts the relevant powerpc platform code to use it. This approach simplifies the board support code a bit. Signed-off-by:
Grant Likely <grant.likely@secretlab.ca> Reviewed-by:
Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
-
- 30 Dec, 2010 2 commits
-
-
Stephen Neuendorffer authored
unflatten_device_tree has two dependencies on things that happen during boot time. Firstly, it references the initial device tree directly. Secondly, it allocates memory using the early boot allocator. This patch factors out these dependencies and uses the new __unflatten_device_tree function to implement a driver-visible fdt_unflatten_tree function, which can be used to unflatten a blob after boot time. V2: - remove extra __va() call - make dt_alloc functions return void *. This doesn't fix the general strangeness in this code that constantly casts back and forth between unsigned long and __be32 * Signed-off-by:
Stephen Neuendorffer <stephen.neuendorffer@xilinx.com> Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
Stephen Neuendorffer authored
Move unflatten_dt_node to be grouped with non-__init functions. Signed-off-by:
Stephen Neuendorffer <stephen.neuendorffer@xilinx.com> Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
- 29 Dec, 2010 3 commits
-
-
Stephen Neuendorffer authored
unflatten_dt_node is a helper function that does most of the work to convert a device tree blob into tree of device nodes. This code now uses a passed-in blob instead of using the single boot-time blob, allowing it to be called in more contexts. Signed-off-by:
Stephen Neuendorffer <stephen.neuendorffer@xilinx.com> Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
Stephen Neuendorffer authored
In preparation for providing run-time handling of device trees, factor out some of the basic functions so that they take an arbitrary blob, rather than relying on the single boot-time tree. V2: - functions have of_fdt_* names - removed find_flat_dt_string - blob argument is first Signed-off-by:
Stephen Neuendorffer <stephen.neuendorffer@xilinx.com> Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
Stephen Neuendorffer authored
The device tree code is now in two pieces: some which can be used generically on any platform which selects CONFIG_OF_FLATTREE, and some early which is used at boot time on only a few architectures. This patch segregates the early code so that only those architectures which care about it need compile it. This also means that some of the requirements in the early code (such as a cmd_line variable) that most architectures (e.g. X86) don't provide can be ignored. Signed-off-by:
Stephen Neuendorffer <stephen.neuendorffer@xilinx.com> [grant.likely@secretlab.ca: remove extra blank line addition] [grant.likely@secretlab.ca: fixed incorrect #ifdef CONFIG_EARLY_FLATTREE check] [grant.likely@secretlab.ca: Made OF_EARLY_FLATTREE select instead of depend on OF_FLATTREE] Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
- 24 Dec, 2010 2 commits
-
-
David Daney authored
If we are registering an i2c device that has a device tree node like this real-world example: rtc@68 { compatible = "dallas,ds1337"; reg = <0x68>; }; of_i2c_register_devices() will try to load a module called ds1337.ko. There is no such module, so it will fail. If we look in modules.alias we will find entries like these: . . . alias i2c:ds1339 rtc_ds1307 alias i2c:ds1338 rtc_ds1307 alias i2c:ds1337 rtc_ds1307 alias i2c:ds1307 rtc_ds1307 alias i2c:ds1374 rtc_ds1374 . . . The module we want is really called rtc_ds1307.ko. If we request a module called "i2c:ds1337", the userspace module loader will do the right thing (unless it is busybox) and load rtc_ds1307.ko. So we add the I2C_MODULE_PREFIX to the request_module() string. Signed-off-by:
David Daney <ddaney@caviumnetworks.com> Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
David Daney authored
In of_mdiobus_register(), the __be32 *addr variable is dereferenced. This will not work on little-endian targets. Also since it is unsigned, checking for less than zero is redundant. Fix these two issues. Signed-off-by:
David Daney <ddaney@caviumnetworks.com> [grant.likely@secretlab.ca: removed goto] Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
- 23 Dec, 2010 1 commit
-
-
Sebastian Andrzej Siewior authored
This patch changes u32 to __be32 for all "ranges", "prop" and "addr" and such. Those variables are pointing to the device tree which contains integers in big endian format. Most functions are doing it right because of_read_number() is doing the right thing for them. of_bus_isa_get_flags(), of_bus_pci_get_flags() and of_bus_isa_map() were accessing the data directly and were doing it wrong. Signed-off-by:
Sebastian Andrzej Siewior <bigeasy@linutronix.de> Acked-by:
Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
- 09 Dec, 2010 1 commit
-
-
Sebastian Siewior authored
This patch changes u32 to __be32 for all "ranges", "prop" and "addr" and such. Those variables are pointing to the device tree which containts intergers in big endian format. Most functions are doing it right because of_read_number() is doing the right thing for them. of_bus_isa_get_flags(), of_bus_pci_get_flags() and of_bus_isa_map() were accessing the data directly and were doing it wrong. Signed-off-by:
Sebastian Andrzej Siewior <bigeasy@linutronix.de> Acked-by:
Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by:
Benjamin Herrenschmidt <benh@kernel.crashing.org>
-
- 01 Nov, 2010 1 commit
-
-
David Daney authored
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>
-
- 21 Oct, 2010 3 commits
-
-
David Daney authored
The __init directives should go on the definitions of things, not the declaration, also __init is meaningless for inline functions, so remove it from prom.h. This allows us to get rid of a useless #include, but most of the rest of them are useless too, so kill them as well. If of_i2c.c needs irq definitions, it should include linux/irq.h directly, not assume indirect inclusion via asm/prom.h. Signed-off-by:
David Daney <ddaney@caviumnetworks.com> Acked-by:
Ralf Baechle <ralf@linux-mips.org> Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
Grant Likely authored
This patch refactors the early init parsing of the chosen node so that architectures aren't forced to provide an empty implementation of early_init_dt_scan_chosen_arch. Instead, if an architecture wants to do something different, it can either use a wrapper function around early_init_dt_scan_chosen(), or it can replace it altogether. This patch was written in preparation to adding device tree support to both x86 ad MIPS. Signed-off-by:
Grant Likely <grant.likely@secretlab.ca> Tested-by:
David Daney <ddaney@caviumnetworks.com>
-
Grant Likely authored
The current code allocates and manages platform_devices created from the device tree manually. It also uses an unsafe shortcut for allocating the platform_device and the resource table at the same time. (which I added in the last rework; sorry). This patch refactors the code to use platform_device_alloc() for allocating new devices. This reduces the amount of custom code implemented by of_platform, eliminates the unsafe alloc trick, and has the side benefit of letting the platform_bus code manage freeing the device data and resources when the device is freed. Signed-off-by:
Grant Likely <grant.likely@secretlab.ca> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Greg Kroah-Hartman <gregkh@suse.de> Cc: "David S. Miller" <davem@davemloft.net> Cc: Michal Simek <monstr@monstr.eu>
-
- 13 Oct, 2010 5 commits
-
-
Jeremy Kerr authored
Use the sparse annotations so we can keep track of endianness. Signed-off-by:
Jeremy Kerr <jeremy.kerr@canonical.com> Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
Andres Salomon authored
Instead of referencing NO_IRQ in platform.c, define some helper functions in irq.c to call instead from platform.c. Keep NO_IRQ usage local to irq.c, and define NO_IRQ if not defined in headers. Signed-off-by:
Andres Salomon <dilinger@queued.net> Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
Andres Salomon authored
package-to-path is a PROM function which tells us the real (full) name of the node. This provides a hook for that in the prom ops struct, and makes use of it in the pdt code when attempting to determine a node's name. If the hook is available, try using it (falling back to looking at the "name" property if it fails). Signed-off-by:
Andres Salomon <dilinger@queued.net> Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
Andres Salomon authored
For symbols still lacking namespace qualifiers, add an of_pdt_ prefix. Signed-off-by:
Andres Salomon <dilinger@queued.net> Acked-by:
David S. Miller <davem@davemloft.net> Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
Andres Salomon authored
Rather than assuming an architecture defines prom_getchild and friends, define an ops struct with hooks for the various prom functions that pdt.c needs. This ops struct is filled in by the arch-(and sometimes firmware-)specific code, and passed to of_pdt_build_devicetree. Update sparc code to define the ops struct as well. Signed-off-by:
Andres Salomon <dilinger@queued.net> Acked-by:
David S. Miller <davem@davemloft.net> Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
- 11 Oct, 2010 1 commit
-
-
Andres Salomon authored
Clean up pdt.c: - make build dependent upon config OF_PROMTREE - #ifdef out the sparc-specific stuff - create pdt-specific header Signed-off-by:
Andres Salomon <dilinger@queued.net> Acked-by:
David S. Miller <davem@davemloft.net> Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
- 09 Oct, 2010 1 commit
-
-
Andres Salomon authored
Transitioning into making this useful for architectures other than sparc. This is a verbatim copy of all functions/variables that've been moved. Signed-off-by:
Andres Salomon <dilinger@queued.net> Acked-by:
David S. Miller <davem@davemloft.net> Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
- 06 Aug, 2010 1 commit
-
-
Grant Likely authored
of_device is just an alias for platform_device, so remove it entirely. Also replace to_of_device() with to_platform_device() and update comment blocks. This patch was initially generated from the following semantic patch, and then edited by hand to pick up the bits that coccinelle didn't catch. @@ @@ -struct of_device +struct platform_device Signed-off-by:
Grant Likely <grant.likely@secretlab.ca> Reviewed-by:
David S. Miller <davem@davemloft.net>
-
- 01 Aug, 2010 1 commit
-
-
Grant Likely authored
Currently there are some drivers in tree which register both a platform_driver and an of_platform_driver with the same name. This is a temporary situation until all the relevant of_platform_drivers are converted to be normal platform_drivers. Until then, this patch gives all the of_platform_drivers an "of:" prefix to protect against bogus matches and namespace conflicts.
-
- 30 Jul, 2010 2 commits
-
-
Anatolij Gustschin authored
Move of_register_spi_devices() call from drivers to spi_register_master(). Also change the function to use the struct device_node pointer from master spi device instead of passing it as function argument. Signed-off-by:
Anatolij Gustschin <agust@denx.de> Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
Grant Likely authored
The AMBA bus should also use of_device_make_bus_id() when populating device out of device tree data. This patch makes the function non-static, and adds a suitable prototype in of_device.h Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
- 24 Jul, 2010 8 commits
-
-
Grant Likely authored
This patch fixes some instances where interrupt specifiers are dereferenced directly instead of doing a be32_to_cpu() conversion first. Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
Grant Likely authored
The flat tree code wasn't fixing the endianness on phandle values when unflattening the tree, and the code in drivers/of wasn't always doing a be32_to_cpu before trying to dereference the phandle values. This patch fixes them. Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
Stuart Yoder authored
With the current string comparison, a device tree compatible of "foo-bar" would match as compatible with a driver looking for "foo". This patch fixes the function to use the of_compat_cmp() macro so that it does the right thing on all platforms (If sparc ever uses this code, it will still want the strncasecmp() behaviour). Signed-off-by:
Stuart Yoder <stuart.yoder@freescale.com> Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
Jonas Bonn authored
This list used was by only two platforms with all other platforms defining an own list of valid bus id's to pass to of_platform_bus_probe. This patch: i) copies the default list to the two platforms that depended on it (powerpc) ii) remove the usage of of_default_bus_ids in of_platform_bus_probe iii) removes the definition of the list from all architectures that defined it Passing a NULL 'matches' parameter to of_platform_bus_probe is still valid; the function returns no error in that case as the NULL value is equivalent to an empty list. Signed-off-by:
Jonas Bonn <jonas@southpole.se> [grant.likely@secretlab.ca: added __initdata annotations, warn on and return error on missing match table, and fix whitespace errors] Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
Jonas Bonn authored
There's no need for this function to be architecture specific and all four architectures defining it had the same definition. The function has been moved to drivers/of/platform.c. Signed-off-by:
Jonas Bonn <jonas@southpole.se> [grant.likely@secretlab.ca: moved to drivers/of/platform.c, simplified code, and added kerneldoc comment] Signed-off-by:
Grant Likely <grant.likely@secretlab.ca> Acked-by:
David S. Miller <davem@davemloft.net>
-
Grant Likely authored
of_device is currently just an #define alias to platform_device until it gets removed entirely. This patch removes references to it from the include directories and the core drivers/of code. Signed-off-by:
Grant Likely <grant.likely@secretlab.ca> Acked-by:
David S. Miller <davem@davemloft.net>
-
Grant Likely authored
There is an unlikely chance of this situation is occurring, but it is easy to protect against. If a matching entry cannot be found in the of_match_table, then don't bind the driver. Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
Grant Likely authored
of_platform_bus was being used in the same manner as the platform_bus. The only difference being that of_platform_bus devices are generated from data in the device tree, and platform_bus devices are usually statically allocated in platform code. Having them separate causes the problem of device drivers having to be registered twice if it was possible for the same device to appear on either bus. This patch removes of_platform_bus_type and registers all of_platform bus devices and drivers on the platform bus instead. A previous patch made the of_device structure an alias for the platform_device structure, and a shim is used to adapt of_platform_drivers to the platform bus. After all of of_platform_bus drivers are converted to be normal platform drivers, the shim code can be removed. Signed-off-by:
Grant Likely <grant.likely@secretlab.ca> Acked-by:
David S. Miller <davem@davemloft.net>
-
- 19 Jul, 2010 2 commits
-
-
Grant Likely authored
Only powerpc and microblaze supply (struct device *)->archdata.dma_mask. This patch stops referencing it on other architectures. Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
Grant Likely authored
This patch fixes the condition where device tree support is compiled in, but no device tree was proved by firmware. It makes of_platform_bus_probe() explicitly check for a NULL device tree pointer. Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-
- 15 Jul, 2010 2 commits
-
-
Grant Likely authored
There's no reason to use the powerpc-specific _ALIGN macro in the fdt code. Replace it with ALIGN() from kernel.h Signed-off-by:
Grant Likely <grant.likely@secretlab.ca> Acked-By:
Jeremy Kerr <jeremy.kerr@canonical.com> Acked-by:
Benjamin Herrenschmidt <benh@kernel.crashing.org>
-
Grant Likely authored
Commit 94c09319 (of: Merge of_device_alloc() and of_device_make_bus_id()) moved code that does calls a dcr routine without including the correct header which causes the following build error on some powerpc configurations: drivers/of/platform.c: In function 'of_device_make_bus_id': drivers/of/platform.c:437: error: implicit declaration of function 'of_translate_dcr_address' This patch adds the appropriate header to drivers/of/platform.c Signed-off-by:
Grant Likely <grant.likely@secretlab.ca>
-