summaryrefslogtreecommitdiffstats
path: root/drivers/of/platform.c
Commit message (Collapse)AuthorAgeFilesLines
* devicetree: Add empty of_platform_populate() for !CONFIG_OF_ADDRESS (sparc)Grant Likely2012-02-261-2/+2
| | | | | | | | | | | | Sparc has its own helpers for translating address ranges when the device tree is parsed at boot time, and it isn't able to use of_platform_populate(). However, there are some device drivers that want to use that function on other DT enabled platforms (ie. TWL4030). This patch adds an empty of_platform_populate() implementation that returns an error when CONFIG_OF_ADDRESS is not selected. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Cc: Benoit Cousson <b-cousson@ti.com> Cc: Samuel Ortiz <sameo@linux.intel.com>
* dt/device: Fix auxdata matching to handle entries without a name overrideGrant Likely2011-12-121-1/+1
| | | | | | | | There is no requirement to override name entries in auxdata. Fix the entry matching to use .compatible instead of .name to find the end of the list. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
* dt/platform: minor cleanupOlof Johansson2011-11-031-12/+16
| | | | | | | | | * Correct description of of_platform_bus_create to match implementation * Remove a level of indentation in of_dev_lookup Signed-off-by: Olof Johansson <olof@lixom.net> Acked-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
* Merge branch 'next' of ↵Linus Torvalds2011-07-251-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (99 commits) drivers/virt: add missing linux/interrupt.h to fsl_hypervisor.c powerpc/85xx: fix mpic configuration in CAMP mode powerpc: Copy back TIF flags on return from softirq stack powerpc/64: Make server perfmon only built on ppc64 server devices powerpc/pseries: Fix hvc_vio.c build due to recent changes powerpc: Exporting boot_cpuid_phys powerpc: Add CFAR to oops output hvc_console: Add kdb support powerpc/pseries: Fix hvterm_raw_get_chars to accept < 16 chars, fixing xmon powerpc/irq: Quieten irq mapping printks powerpc: Enable lockup and hung task detectors in pseries and ppc64 defeconfigs powerpc: Add mpt2sas driver to pseries and ppc64 defconfig powerpc: Disable IRQs off tracer in ppc64 defconfig powerpc: Sync pseries and ppc64 defconfigs powerpc/pseries/hvconsole: Fix dropped console output hvc_console: Improve tty/console put_chars handling powerpc/kdump: Fix timeout in crash_kexec_wait_realmode powerpc/mm: Fix output of total_ram. powerpc/cpufreq: Add cpufreq driver for Momentum Maple boards powerpc: Correct annotations of pmu registration functions ... Fix up trivial Kconfig/Makefile conflicts in arch/powerpc, drivers, and drivers/cpufreq
| * powerpc: implement arch_setup_pdev_archdataKumar Gala2011-07-081-2/+2
| | | | | | | | | | | | | | | | | | We have a long standing issues with platform devices not have a valid dma_mask pointer. This hasn't been an issue to date as no platform device has tried to set its dma_mask value to a non-default value. Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* | dt/platform: allow device name to be overriddenGrant Likely2011-06-211-10/+63
| | | | | | | | | | | | | | | | Some platform code has specific requirements on the naming of devices. This patch allows callers of of_platform_populate() to provide a device name lookup table. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
* | drivers/amba: create devices from device treeGrant Likely2011-06-211-0/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a function to create amba_devices (i.e. primecell peripherals) from device tree nodes. The device tree scanning is done by the of_platform_populate() function which can call of_amba_device_create based on a match table entry. Nodes with a "arm,primecell-periphid" property can override the h/w peripheral id value. Based on the original work by Jeremy Kerr. Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Rob Herring <rob.herring@calxeda.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> [grant.likely: add Jeremy's original s-o-b line, changes from review comments, and moved all code to drivers/of/platform.c] Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
* | dt: add of_platform_populate() for creating device from the device treeGrant Likely2011-06-211-4/+50
| | | | | | | | | | | | | | | | | | of_platform_populate() is similar to of_platform_bus_probe() except that it strictly enforces that all device nodes must have a compatible property, and it can be used to register devices (not buses) which are children of the root node. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
* | dt: Add default match table for bus idsGrant Likely2011-06-211-0/+8
|/ | | | | | | No need for most platforms to define their own bus table when calling of_platform_populate(). Supply a stock one. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
* dt: eliminate OF_NO_DEEP_PROBE and test for NULL match tableGrant Likely2011-03-231-12/+5
| | | | | | | | | | | There are no users of OF_NO_DEEP_PROBE, and of_match_node() now gracefully handles being passed a NULL pointer, so the checks at the top of of_platform_bus_probe can be dropped. While at it, consolidate the root node pointer check to be easier to read and tidy up related comments. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
* dt: Refactor of_platform_bus_probe()Grant Likely2011-03-231-37/+18
| | | | | | | The current implementation uses three copies of of basically identical code. This patch consolidates them to make the code simpler. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
* dt: eliminate of_platform_driver shim codeGrant Likely2011-03-011-68/+0
| | | | | | | | | | | | Commit eca393016, "of: Merge of_platform_bus_type with platform_bus_type" added a shim to allow of_platform_drivers to get registers onto the platform bus so that there was time to migrate the existing drivers to the platform_bus_type. This patch removes the shim since there are no more users of the old interface. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
* dt/powerpc: move of_bus_type infrastructure to ibmebusGrant Likely2011-02-281-393/+0
| | | | | | | | | | | | | | | | | arch/powerpc/kernel/ibmebus.c is the only remaining user of the of_bus_type support code for initializing the bus and registering drivers. All others have either been switched to the vanilla platform bus or already have their own infrastructure. This patch moves the functionality that ibmebus is using out of drivers/of/{platform,device}.c and into ibmebus.c where it is actually used. Also renames the moved symbols from of_platform_* to ibmebus_bus_* to reflect the actual usage. This patch is part of moving all of the of_platform_bus_type users over to the platform_bus_type. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
* of/device: Don't register disabled devicesGrant Likely2011-01-031-8/+14
| | | | | | | | | | | | 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>
* of/device: Rework to use common platform_device_alloc() for allocating devicesGrant Likely2010-10-211-11/+13
| | | | | | | | | | | | | | | | | | | 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>
* of/irq: remove references to NO_IRQ in drivers/of/platform.cAndres Salomon2010-10-121-7/+3
| | | | | | | | | 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>
* of/platform: Register of_platform_drivers with an "of:" prefixGrant Likely2010-08-011-0/+16
| | | | | | | | | 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.
* of/device: Make of_device_make_bus_id() usable by other code.Grant Likely2010-07-301-1/+1
| | | | | | | | 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>
* of: remove of_default_bus_idsJonas Bonn2010-07-241-3/+1
| | | | | | | | | | | | | | | | | 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>
* of: make of_find_device_by_node genericJonas Bonn2010-07-241-0/+20
| | | | | | | | | | | 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>
* of/device: Replace of_device with platform_device in includes and core codeGrant Likely2010-07-241-12/+12
| | | | | | | | | 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>
* of/device: Protect against binding of_platform_drivers to non-OF devicesGrant Likely2010-07-241-1/+6
| | | | | | | | 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>
* of: Merge of_platform_bus_type with platform_bus_typeGrant Likely2010-07-241-3/+64
| | | | | | | | | | | | | | | | | | | | 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>
* of/device: Fix build errors for non-ppc and non-microblazeGrant Likely2010-07-181-0/+6
| | | | | | | 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>
* of/flattree: Fix crash when device tree absentGrant Likely2010-07-181-0/+2
| | | | | | | | | 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>
* drivers/of: fix build error when CONFIG_PPC_DCR is setGrant Likely2010-07-141-0/+4
| | | | | | | | | | | | | | Commit 94c0931983ee9d1cd96c32d52ac64c17464f0bbd (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>
* of: Fix missing includeGrant Likely2010-07-051-0/+1
| | | | | | Fix a build failure on ARM Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
* of/device: populate platform_device (of_device) resource table on allocationGrant Likely2010-07-051-2/+27
| | | | | | | | | | | | | | | | | | | | | When allocating a platform_device to represent an OF node, also allocate space for the resource table and populate it with IRQ and reg property information. This change is in preparation for merging the of_platform_bus_type with the platform_bus_type so that existing platform_driver code can retrieve base addresses and IRQs data. Background: a previous commit removed struct of_device and made it a #define alias for platform_device. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> CC: Michal Simek <monstr@monstr.eu> CC: Grant Likely <grant.likely@secretlab.ca> CC: Benjamin Herrenschmidt <benh@kernel.crashing.org> CC: Stephen Rothwell <sfr@canb.auug.org.au> CC: microblaze-uclinux@itee.uq.edu.au CC: linuxppc-dev@ozlabs.org CC: devicetree-discuss@lists.ozlabs.org
* of: Merge of_device_alloc() and of_device_make_bus_id()Grant Likely2010-07-051-0/+87
| | | | | | | | | | | | | | This patch merges the common routines of_device_alloc() and of_device_make_bus_id() from powerpc and microblaze. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> CC: Michal Simek <monstr@monstr.eu> CC: Grant Likely <grant.likely@secretlab.ca> CC: Benjamin Herrenschmidt <benh@kernel.crashing.org> CC: Stephen Rothwell <sfr@canb.auug.org.au> CC: microblaze-uclinux@itee.uq.edu.au CC: linuxppc-dev@ozlabs.org CC: devicetree-discuss@lists.ozlabs.org
* of/device: Merge of_platform_bus_probe()Grant Likely2010-07-051-0/+143
| | | | | | | | | | | | | | | | | | | | Merge common code between PowerPC and microblaze. This patch merges the code that scans the tree and registers devices. The functions merged are of_platform_bus_probe(), of_platform_bus_create(), and of_platform_device_create(). This patch also move the of_default_bus_ids[] table out of a Microblaze header file and makes it non-static. The device ids table isn't merged because powerpc and microblaze use different default data. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> CC: Michal Simek <monstr@monstr.eu> CC: Grant Likely <grant.likely@secretlab.ca> CC: Benjamin Herrenschmidt <benh@kernel.crashing.org> CC: Stephen Rothwell <sfr@canb.auug.org.au> CC: microblaze-uclinux@itee.uq.edu.au CC: linuxppc-dev@ozlabs.org
* of: change of_match_device to work with struct deviceGrant Likely2010-05-221-3/+2
| | | | | | | | | | The of_node pointer is now stored directly in struct device, so of_match_device() should work with any device, not just struct of_device. This patch changes the interface to of_match_device() to accept a struct device instead of struct of_device. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
* of: Remove duplicate fields from of_platform_driverGrant Likely2010-05-221-7/+0
| | | | | | | | | | | | | | | | .name, .match_table and .owner are duplicated in both of_platform_driver and device_driver. This patch is a removes the extra copies from struct of_platform_driver and converts all users to the device_driver members. This patch is a pretty mechanical change. The usage model doesn't change and if any drivers have been missed, or if anything has been fixed up incorrectly, then it will fail with a compile time error, and the fixup will be trivial. This patch looks big and scary because it touches so many files, but it should be pretty safe. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: Sean MacLennan <smaclennan@pikatech.com>
* drivercore: Add of_match_table to the common device driversGrant Likely2010-05-221-3/+4
| | | | | | | | | | OF-style matching can be available to any device, on any type of bus. This patch allows any driver to provide an OF match table when CONFIG_OF is enabled so that drivers can be bound against devices described in the device tree. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
* of/platform: Implement support for dev_pm_opsAnton Vorontsov2009-10-301-15/+290
| | | | | | | | | | | | Linux power management subsystem supports vast amount of new PM callbacks that are crucial for proper suspend and hibernation support in drivers. This patch implements support for dev_pm_ops, preserving support for legacy callbacks. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* [POWERPC] Create modalias file in sysfs for of_platform busOlaf Hering2008-05-141-0/+3
| | | | | | | | | | | | | | Create /sys/bus/of_platform/devices/*/modalias file to allow autoloading of modules. Modalias files are already present for many other bus types. This adds also a newline to the devspec files. Also create a devspec file for mac-io devices. They were created as a side effect. Use correct buffer size for mac-io modalias buffer. Tested on iBook1 and Efika. Signed-off-by: Olaf Hering <olaf@aepfle.de> Signed-off-by: Paul Mackerras <paulus@samba.org>
* [POWERPC] Create and hook up of_platform_device_shutdownMichael Ellerman2008-02-061-0/+10
| | | | | | | | | | Although of_platform_device's can have a shutdown routine, at the moment the bus code doesn't actually call it. So add the required glue to hook the shutdown routine. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
* [SPARC/64]: Consolidate of_register_driverStephen Rothwell2007-10-171-0/+21
| | | | | | | | Also of_unregister_driver. These will be shortly also used by the PowerPC code. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
* Create drivers/of/platform.cStephen Rothwell2007-07-201-0/+96
and populate it with the common parts from PowerPC and Sparc[64]. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Acked-by: Paul Mackerras <paulus@samba.org> Acked-by: David S. Miller <davem@davemloft.net>
OpenPOWER on IntegriCloud