aboutsummaryrefslogtreecommitdiff
path: root/drivers/of
AgeCommit message (Collapse)Author
2012-11-26Merge branch 'merge' into nextBenjamin Herrenschmidt
Merge my own merge branch to get various fixes from there and upstream, especially the hvc console tty refcouting fixes which which testing is quite a bit harder...
2012-11-20of: introduce for_each_matching_node_and_match()Stephen Warren
The following pattern of code is tempting: for_each_matching_node(np, table) { match = of_match_node(table, np); However, this results in iterating over table twice; the second time inside of_match_node(). The implementation of for_each_matching_node() already found the match, so this is redundant. Invent new function of_find_matching_node_and_match() and macro for_each_matching_node_and_match() to remove the double iteration, thus transforming the above code to: for_each_matching_node_and_match(np, table, &match) Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-11-20dt: add helper function to read u8 & u16 variables & arraysViresh Kumar
This adds following helper routines: - of_property_read_u8_array() - of_property_read_u16_array() - of_property_read_u8() - of_property_read_u16() This expects arrays from DT to be passed as: - u8 array: property = /bits/ 8 <0x50 0x60 0x70>; - u16 array: property = /bits/ 16 <0x5000 0x6000 0x7000>; Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-11-20of/fdt: NULL-terminate the root node pathCatalin Marinas
Commit 509b7455 (of/fdt: Don't copy garbage after "/" in root node path) sets the path length to 0 to ignore any garbage after "/" in the root node path. This has the side effect of also ignoring '\0' at the end of the root node path. This patch sets the ignores the garbage by setting the last character to '\0' and length to 1. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-11-20of: fdt: Constify 'pathp'Fabio Estevam
Constify 'pathp' in order to get rid of the following warning: drivers/of/fdt.c:491:10: warning: assignment discards 'const' qualifier from pointer target type [enabled by default] Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> [Rob Herring: also constify np and lp] Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-11-17drivers/of: Constify device_node->name and ->path_component_nameGrant Likely
Neither of these should ever be changed once set. Make them const and fix up the users that try to modify it in-place. In one case kmalloc+memcpy is replaced with kstrdup() to avoid modifying the string. Build tested with defconfigs on ARM, PowerPC, Sparc, MIPS, x86 among others. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: David S. Miller <davem@davemloft.net> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Julian Calaby <julian.calaby@gmail.com>
2012-11-15powerpc+of: Rename the drivers/of prom_* functions to of_*Nathan Fontenot
Rename the prom_*_property routines of the generic OF code to of_*_property. This brings them in line with the naming used by the rest of the OF code. Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com> Acked-by: Geoff Levand <geoff@infradead.org> Acked-by: Rob Herring <rob.herring@calxeda.com> Acked-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2012-11-15powerpc+of: Add of node/property notification chain for adds and removesNathan Fontenot
This patch moves the notification chain for updates to the device tree from the powerpc/pseries code to the base OF code. This makes this functionality available to all architectures. Additionally the notification chain is updated to allow notifications for property add/remove/update. To make this work a pointer to a new struct (of_prop_reconfig) is passed to the routines in the notification chain. The of_prop_reconfig property contains a pointer to the node containing the property and a pointer to the property itself. In the case of property updates, the property pointer refers to the new property. Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com> Acked-by: Rob Herring <rob.herring@calxeda.com> Acked-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2012-11-15powerpc+of: Add /proc device tree updating to of node add/removeNathan Fontenot
When adding or removing a device tree node we should also update the device tree in /proc/device-tree. This action is already done in the generic OF code for adding/removing properties of a node. This patch adds this functionality for nodes. Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com> Acked-by: Rob Herring <rob.herring@calxeda.com> Acked-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2012-11-10of/fdt: Don't copy garbage after "/" in root node pathBenjamin Herrenschmidt
The root node path must be internally converted to "/", or various pieces of code looking for it that way will fail. The code to do that however had a bug where we might incorrectly append pieces of the original path from the fdt to the "/". We should probably add a proper dedicated accessor for the root node but in the meantime this patch should fix it. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-10-17of/platform: sparse fixKim Phillips
drivers/of/platform.c:110:59: warning: incorrect type in argument 2 (different base types) drivers/of/platform.c:110:59: expected restricted __be32 const [usertype] *addr drivers/of/platform.c:110:59: got unsigned int const [usertype] *[assigned] reg Signed-off-by: Kim Phillips <kim.phillips@freescale.com> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-10-17of/irq: sparse fixesKim Phillips
drivers/of/irq.c:195:57: warning: restricted __be32 degrades to integer drivers/of/irq.c:196:51: warning: restricted __be32 degrades to integer drivers/of/irq.c:199:57: warning: restricted __be32 degrades to integer drivers/of/irq.c:201:58: warning: restricted __be32 degrades to integer drivers/of/irq.c:470:37: warning: incorrect type in assignment (different modifiers) drivers/of/irq.c:470:37: expected int ( *[usertype] irq_init_cb )( ... ) drivers/of/irq.c:470:37: got void const *const data drivers/of/irq.c:96:5: error: symbol 'of_irq_map_raw' redeclared with different type (originally declared at include/linux/of_irq.h:61) - incompatible argument 2 (different base types) drivers/of/of_pci_irq.c:91:40: warning: incorrect type in argument 2 (different base types) drivers/of/of_pci_irq.c:91:40: expected unsigned int const [usertype] *intspec drivers/of/of_pci_irq.c:91:40: got restricted __be32 *<noident> drivers/of/of_pci_irq.c:91:53: warning: incorrect type in argument 4 (different base types) drivers/of/of_pci_irq.c:91:53: expected unsigned int const [usertype] *addr drivers/of/of_pci_irq.c:91:53: got restricted __be32 *<noident> Signed-off-by: Kim Phillips <kim.phillips@freescale.com> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-10-17of/address: sparse fixesKim Phillips
drivers/of/address.c:66:29: warning: incorrect type in argument 1 (different base types) drivers/of/address.c:66:29: expected restricted __be32 const [usertype] *cell drivers/of/address.c:66:29: got unsigned int [usertype] *addr drivers/of/address.c:87:32: warning: incorrect type in argument 1 (different base types) drivers/of/address.c:87:32: expected restricted __be32 const [usertype] *cell drivers/of/address.c:87:32: got unsigned int [usertype] *addr drivers/of/address.c:91:30: warning: incorrect type in assignment (different base types) drivers/of/address.c:91:30: expected unsigned int [unsigned] [usertype] <noident> drivers/of/address.c:91:30: got restricted __be32 [usertype] <noident> drivers/of/address.c:92:22: warning: incorrect type in assignment (different base types) drivers/of/address.c:92:22: expected unsigned int [unsigned] [usertype] <noident> drivers/of/address.c:92:22: got restricted __be32 [usertype] <noident> drivers/of/address.c:147:35: warning: incorrect type in argument 1 (different base types) drivers/of/address.c:147:35: expected restricted __be32 const [usertype] *addr drivers/of/address.c:147:35: got unsigned int [usertype] *addr drivers/of/address.c:157:34: warning: incorrect type in argument 1 (different base types) drivers/of/address.c:157:34: expected restricted __be32 const [usertype] *cell drivers/of/address.c:157:34: got unsigned int [usertype] * drivers/of/address.c:256:29: warning: restricted __be32 degrades to integer drivers/of/address.c:256:36: warning: restricted __be32 degrades to integer drivers/of/address.c:262:34: warning: incorrect type in argument 1 (different base types) drivers/of/address.c:262:34: expected restricted __be32 const [usertype] *cell drivers/of/address.c:262:34: got unsigned int [usertype] * drivers/of/address.c:372:41: warning: incorrect type in argument 1 (different base types) drivers/of/address.c:372:41: expected restricted __be32 const [usertype] *cell drivers/of/address.c:372:41: got unsigned int [usertype] *addr drivers/of/address.c:395:53: warning: incorrect type in argument 2 (different base types) drivers/of/address.c:395:53: expected restricted __be32 const [usertype] *addr drivers/of/address.c:395:53: got unsigned int [usertype] *addr drivers/of/address.c:443:50: warning: incorrect type in argument 2 (different base types) drivers/of/address.c:443:50: expected restricted __be32 const [usertype] *addr drivers/of/address.c:443:50: got unsigned int *<noident> drivers/of/address.c:455:49: warning: incorrect type in argument 1 (different base types) drivers/of/address.c:455:49: expected restricted __be32 const [usertype] *cell drivers/of/address.c:455:49: got unsigned int *<noident> drivers/of/address.c:480:60: warning: incorrect type in argument 2 (different base types) drivers/of/address.c:480:60: expected restricted __be32 const [usertype] *addr drivers/of/address.c:480:60: got unsigned int *<noident> drivers/of/address.c:412:5: warning: symbol '__of_translate_address' was not declared. Should it be static? drivers/of/address.c:520:14: error: symbol 'of_get_address' redeclared with different type (originally declared at include/linux/of_address.h:22) - different base types Signed-off-by: Kim Phillips <kim.phillips@freescale.com> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-10-03Merge tag 'dt-for-3.7' of git://sources.calxeda.com/kernel/linuxLinus Torvalds
Pull devicetree updates from Rob Herring: - Import of latest upstream device tree compiler (dtc) - New function of_get_child_by_name - Support for #size-cells of 0 and #addr-cells of >2 - Couple of DT binding documentation updates Fix up trivial conflicts due to of_get_child_by_name() having been added next to the new of_get_next_available_child(). * tag 'dt-for-3.7' of git://sources.calxeda.com/kernel/linux: MAINTAINERS: add scripts/dtc under Devicetree maintainers dtc: import latest upstream dtc dt: Document general interrupt controller bindings dt/s3c64xx/spi: Use of_get_child_by_name to get a named child dt: introduce of_get_child_by_name to get child node by name of: i2c: add support for wakeup-source property of/address: Handle #address-cells > 2 specially DT: export of_irq_to_resource_table() devicetree: serial: Add documentation for imx serial devicetree: pwm: mxs-pwm.txt: Fix reg field annotation of: Allow busses with #size-cells=0
2012-10-01dt: introduce of_get_child_by_name to get child node by nameSrinivas Kandagatla
This patch introduces of_get_child_by_name function to get a child node by its name in a given parent node. Without this patch each driver code has to iterate the parent and do a string compare, However having of_get_child_by_name libary function would avoid code duplication, errors and is more convenient. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-09-07of: i2c: add support for wakeup-source propertyOlof Johansson
Add support for specifying a generic "wakeup-source" property on i2c clients, which will set the I2C_CLIENT_WAKE flag, thus configuring the device to wake the system from suspend (via IRQ). This obviously doesn't make sense on devices lacking IRQ, but since we still allow that in the i2c_board_info case, I don't see a reason to restrict it here. Note: Since the generic i2c bindings aren't documented in the kernel, I didn't find a good place to add documentation for this binding extension. I still think it makes sense to have a generic property instead of having each device do its own binding for the same. Signed-off-by: Olof Johansson <olof@lixom.net> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-09-07of/address: Handle #address-cells > 2 speciallyThierry Reding
When a bus specifies #address-cells > 2, of_bus_default_map() now assumes that the mapping isn't for a physical address but rather an identifier that needs to match exactly. This is required by bindings that use multiple cells to translate a resource to the parent bus (device index, type, ...). See here for the discussion: https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-June/016577.html Originally-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-09-06DT: export of_irq_to_resource_table()John Crispin
Trivial patch that exports the of_irq_to_resource_table() symbol so that modules can use it. Signed-off-by: John Crispin <blogic@openwrt.org> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-08-20dt: introduce for_each_available_child_of_node, of_get_next_available_childTimur Tabi
Macro for_each_child_of_node() makes it easy to iterate over all of the children for a given device tree node, including those nodes that are marked as unavailable (i.e. status = "disabled"). Introduce for_each_available_child_of_node(), which is like for_each_child_of_node(), but it automatically skips unavailable nodes. This also requires the introduction of helper function of_get_next_available_child(), which returns the next available child node. Signed-off-by: Timur Tabi <timur@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-08-03of: Allow busses with #size-cells=0Stephen Warren
It's quite legitimate for a DT node to specify #size-cells=0. One example is a node that's used to collect a number of non-memory-mapped devices. In that scenario, there may be multiple child nodes with the same name (type) thus necessitating the use of unit addresses in node names, and reg properties: / { regulators { compatible = "simple-bus"; #address-cells = <1>; #size-cells = <0>; regulator@0 { compatible = "regulator-fixed"; reg = <0>; ... }; regulator@1 { compatible = "regulator-fixed"; reg = <1>; ... }; ... }; }; However, #size-cells=0 prevents translation of reg property values into the parent node's address space. In turn, this triggers the kernel to emit error messages during boot, such as: prom_parse: Bad cell count for /regulators/regulator@0 To prevent printing these error messages for legitimate DT content, a number of changes are made: 1) of_get_address()/of_get_pci_address() are modified only to validate the value of #address-cells, and not #size-cells. 2) of_can_translate_address() is added to indicate whether address translation is possible. 3) of_device_make_bus_id() is modified to name devices based on the translated address only where possible, and otherwise fall back to using the (first cell of the) raw untranslated address. 4) of_device_alloc() is modified to create memory resources for a device only if the address can be translated into the CPU's address space. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-07-24Merge tag 'dt-for-3.6' of git://sources.calxeda.com/kernel/linuxLinus Torvalds
Pull devicetree updates from Rob Herring: "A small set of changes for devicetree: - Couple of Documentation fixes - Addition of new helper function of_node_full_name - Improve of_parse_phandle_with_args return values - Some NULL related sparse fixes" Grant's busy packing. * tag 'dt-for-3.6' of git://sources.calxeda.com/kernel/linux: of: mtd: nuke useless const qualifier devicetree: add helper inline for retrieving a node's full name of: return -ENOENT when no property usage-model.txt: fix typo machine_init->init_machine of: Fix null pointer related warnings in base.c file LED: Fix missing semicolon in OF documentation of: fix a few typos in the binding documentation
2012-07-24Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-nextLinus Torvalds
Pull networking changes from David S Miller: 1) Remove the ipv4 routing cache. Now lookups go directly into the FIB trie and use prebuilt routes cached there. No more garbage collection, no more rDOS attacks on the routing cache. Instead we now get predictable and consistent performance, no matter what the pattern of traffic we service. This has been almost 2 years in the making. Special thanks to Julian Anastasov, Eric Dumazet, Steffen Klassert, and others who have helped along the way. I'm sure that with a change of this magnitude there will be some kind of fallout, but such things ought the be simple to fix at this point. Luckily I'm not European so I'll be around all of August to fix things :-) The major stages of this work here are each fronted by a forced merge commit whose commit message contains a top-level description of the motivations and implementation issues. 2) Pre-demux of established ipv4 TCP sockets, saves a route demux on input. 3) TCP SYN/ACK performance tweaks from Eric Dumazet. 4) Add namespace support for netfilter L4 conntrack helpers, from Gao Feng. 5) Add config mechanism for Energy Efficient Ethernet to ethtool, from Yuval Mintz. 6) Remove quadratic behavior from /proc/net/unix, from Eric Dumazet. 7) Support for connection tracker helpers in userspace, from Pablo Neira Ayuso. 8) Allow userspace driven TX load balancing functions in TEAM driver, from Jiri Pirko. 9) Kill off NLMSG_PUT and RTA_PUT macros, more gross stuff with embedded gotos. 10) TCP Small Queues, essentially minimize the amount of TCP data queued up in the packet scheduler layer. Whereas the existing BQL (Byte Queue Limits) limits the pkt_sched --> netdevice queuing levels, this controls the TCP --> pkt_sched queueing levels. From Eric Dumazet. 11) Reduce the number of get_page/put_page ops done on SKB fragments, from Alexander Duyck. 12) Implement protection against blind resets in TCP (RFC 5961), from Eric Dumazet. 13) Support the client side of TCP Fast Open, basically the ability to send data in the SYN exchange, from Yuchung Cheng. Basically, the sender queues up data with a sendmsg() call using MSG_FASTOPEN, then they do the connect() which emits the queued up fastopen data. 14) Avoid all the problems we get into in TCP when timers or PMTU events hit a locked socket. The TCP Small Queues changes added a tcp_release_cb() that allows us to queue work up to the release_sock() caller, and that's what we use here too. From Eric Dumazet. 15) Zero copy on TX support for TUN driver, from Michael S. Tsirkin. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1870 commits) genetlink: define lockdep_genl_is_held() when CONFIG_LOCKDEP r8169: revert "add byte queue limit support". ipv4: Change rt->rt_iif encoding. net: Make skb->skb_iif always track skb->dev ipv4: Prepare for change of rt->rt_iif encoding. ipv4: Remove all RTCF_DIRECTSRC handliing. ipv4: Really ignore ICMP address requests/replies. decnet: Don't set RTCF_DIRECTSRC. net/ipv4/ip_vti.c: Fix __rcu warnings detected by sparse. ipv4: Remove redundant assignment rds: set correct msg_namelen openvswitch: potential NULL deref in sample() tcp: dont drop MTU reduction indications bnx2x: Add new 57840 device IDs tcp: avoid oops in tcp_metrics and reset tcpm_stamp niu: Change niu_rbr_fill() to use unlikely() to check niu_rbr_add_page() return value niu: Fix to check for dma mapping errors. net: Fix references to out-of-scope variables in put_cmsg_compat() net: ethernet: davinci_emac: add pm_runtime support net: ethernet: davinci_emac: Remove unnecessary #include ...
2012-07-23Merge branch 'next' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc Pull powerpc updates from Benjamin Herrenschmidt: "Notable highlights: - iommu improvements from Anton removing the per-iommu global lock in favor of dividing the DMA space into pools, each with its own lock, and hashed on the CPU number. Along with making the locking more fine grained, this gives significant improvements in multiqueue networking scalability. - Still from Anton, we know provide a vdso based variant of getcpu which makes sched_getcpu with the appropriate glibc patch something like 18 times faster. - More anton goodness (he's been busy !) in other areas such as a faster __clear_user and copy_page on P7, various perf fixes to improve sampling quality, etc... - One more step toward removing legacy i2c interfaces by using new device-tree based probing of platform devices for the AOA audio drivers - A nice series of patches from Michael Neuling that helps avoiding confusion between register numbers and litterals in assembly code, trying to enforce the use of "%rN" register names in gas rather than plain numbers. - A pile of FSL updates - The usual bunch of small fixes, cleanups etc... You may spot a change to drivers/char/mem. The patch got no comment or ack from outside, it's a trivial patch to allow the architecture to skip creating /dev/port, which we use to disable it on ppc64 that don't have a legacy brige. On those, IO ports 0...64K are not mapped in kernel space at all, so accesses to /dev/port cause oopses (and yes, distros -still- ship userspace that bangs hard coded ports such as kbdrate)." * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (106 commits) powerpc/mpic: Create a revmap with enough entries for IPIs and timers Remove stale .rej file powerpc/iommu: Fix iommu pool initialization powerpc/eeh: Check handle_eeh_events() return value powerpc/85xx: Add phy nodes in SGMII mode for MPC8536/44/72DS & P2020DS powerpc/e500: add paravirt QEMU platform powerpc/mpc85xx_ds: convert to unified PCI init powerpc/fsl-pci: get PCI init out of board files powerpc/85xx: Update corenet64_smp_defconfig powerpc/85xx: Update corenet32_smp_defconfig powerpc/85xx: Rename P1021RDB-PC device trees to be consistent powerpc/watchdog: move booke watchdog param related code to setup-common.c sound/aoa: Adapt to new i2c probing scheme i2c/powermac: Improve detection of devices from device-tree powerpc: Disable /dev/port interface on systems without an ISA bridge of: Improve prom_update_property() function powerpc: Add "memory" attribute for mfmsr() powerpc/ftrace: Fix assembly trampoline register usage powerpc/hw_breakpoints: Fix incorrect pointer access powerpc: Put the gpr save/restore functions in their own section ...
2012-07-19Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller
Conflicts: drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
2012-07-11Merge tag 'fixes-for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc Pull ARM SoC fixes from Arnd Bergmann: - multiple omap2+ bug fixes - a regression on ux500 dt support - a build failure on shmobile * tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: ARM: OMAP2+: omap2plus_defconfig: EHCI driver is not stable, disable it ARM: shmobile: fix platsmp.c build when ARCH_SH73A0=n ARM: ux500: Over-ride the DT device naming scheme for pinctrl ARM: ux500: Fix build errors/warnings when MACH_UX500_DT is not set of: address: Don't fail a lookup just because a node has no reg property ARM: OMAP2+: hwmod code/clockdomain data: fix 32K sync timer
2012-07-11of: Improve prom_update_property() functionDong Aisheng
prom_update_property() currently fails if the property doesn't actually exist yet which isn't what we want. Change to add-or-update instead of update-only, then we can remove a lot duplicated lines. Suggested-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org> Acked-by: Rob Herring <rob.herring@calxeda.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2012-07-10Revert "of: match by compatible property first"Linus Torvalds
This reverts commit 107a84e61cdd3406c842a0e4be7efffd3a05dba6. Meelis Roos reports a regression since 3.5-rc5 that stops Sun Fire V100 and Sun Netra X1 sparc64 machines from booting, hanging after enabling serial console. He bisected it to commit 107a84e61cdd. Rob Herring explains: "The problem is match combinations of compatible plus name and/or type fail to match correctly. I have a fix for this, but given how late it is for 3.5 I think it is best to revert this for now. There could be other cases that rely on the current although wrong behavior. I will post an updated version for 3.6." Bisected-and-reported-by: Meelis Roos <mroos@linux.ee> Requested-by: Rob Herring <rob.herring@calxeda.com> Cc: Thierry Reding <thierry.reding@avionic-design.de> Cc: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-07-10of: mtd: nuke useless const qualifierArtem Bityutskiy
This patch does the following: -const int of_get_nand_ecc_mode(struct device_node *np) +int of_get_nand_ecc_mode(struct device_node *np) because: 1. it is probably just a typo? 2. it causes warnings like this when people assing the returned value to an 'int' variable: include/linux/of_mtd.h:14:18: warning: type qualifiers ignored on functi= on return type [-Wignored-qualifiers] Remove also the unnecessary "extern" qualifier to be consistent with other declarations in this file. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-07-06of: address: Don't fail a lookup just because a node has no reg propertyLee Jones
Sometimes it doesn't make any sense for a node to have an address. In this case device lookup will always be unsuccessful because we currently assume every node will have a reg property. This patch changes the semantics so that the resource address and the lookup address will only be compared if one exists. Things like AUXDATA() rely on of_dev_lookup to return the lookup entry of a particular device in order to do things like apply platform_data to a device. However, this is currently broken for nodes which do not have a reg property, meaning that platform_data can not be passed in those cases. Acked-by: Rob Herring <rob.herring@calxeda.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2012-07-06devicetree: add helper inline for retrieving a node's full nameGrant Likely
The pattern (np ? np->full_name : "<none>") is rather common in the kernel, but can also make for quite long lines. This patch adds a new inline function, of_node_full_name() so that the test for a valid node pointer doesn't need to be open coded at all call sites. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Cc: Paul Mundt <lethal@linux-sh.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-07-06of: return -ENOENT when no propertyAlexandre Courbot
Make of_parse_phandle_with_args return -ENOENT instead of -EINVAL when no matching property is found, which allows to discriminate between absence of property and parsing error. Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-07-06of: Fix null pointer related warnings in base.c fileSachin Kamat
Fixes the following sparse warnings: drivers/of/base.c:176:41: warning: Using plain integer as NULL pointer drivers/of/base.c:178:37: warning: Using plain integer as NULL pointer drivers/of/base.c:500:49: warning: Using plain integer as NULL pointer Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-06-27netdev/phy/of: Handle IEEE802.3 clause 45 Ethernet PHYs in of_mdiobus_register()David Daney
Define two new "compatible" values for Ethernet PHYs. "ethernet-phy-ieee802.3-c22" and "ethernet-phy-ieee802.3-c45" are used to indicate a PHY uses the corresponding protocol. If a PHY is "compatible" with "ethernet-phy-ieee802.3-c45", we indicate this so that get_phy_device() can properly probe the device. If get_phy_device() fails, it was probably due to failing the probe of the PHY identifier registers. Since we have the device tree telling us the PHY exists, go ahead and add it anyhow with a phy_id of zero. There may be a driver match based on the "compatible" property. Signed-off-by: David Daney <david.daney@cavium.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-06-27netdev/phy: Handle IEEE802.3 clause 45 Ethernet PHYsDavid Daney
The IEEE802.3 clause 45 MDIO bus protocol allows for directly addressing PHY registers using a 21 bit address, and is used by many 10G Ethernet PHYS. Already existing is the ability of MDIO bus drivers to use clause 45, with the MII_ADDR_C45 flag. Here we add struct phy_c45_device_ids to hold the device identifier registers present in clause 45. struct phy_device gets a couple of new fields: c45_ids to hold the identifiers and is_c45 to signal that it is clause 45. get_phy_device() gets a new parameter is_c45 to indicate that the PHY device should use the clause 45 protocol, and its callers are adjusted to pass false. The follow-on patch to of_mdio.c will pass true where appropriate. EXPORT phy_device_create() so that the follow-on patch to of_mdio.c can use it to create phy devices for PHYs, that have non-standard device identifier registers, based on the device tree bindings. Signed-off-by: David Daney <david.daney@cavium.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-06-14of: match by compatible property firstThierry Reding
When matching devices against an OF device ID table, the first string of the compatible property that is listed in the table should match, regardless of its position in the table. Cc: Grant Likely <grant.likely@secretlab.ca> Cc: Rob Herring <rob.herring@calxeda.com> Cc: devicetree-discuss@lists.ozlabs.org Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-06-13of: export of_platform_populate()Stephen Warren
Without this, modules can't use this API, leading to build failures. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-05-29Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linusLinus Torvalds
Pull MIPS updates from Ralf Baechle: "The whole series has been sitting in -next for quite a while with no complaints. The last change to the series was before the weekend the removal of an SPI patch which Grant - even though previously acked by himself - appeared to raise objections. So I removed it until the situation is clarified. Other than that all the patches have the acks from their respective maintainers, all MIPS and x86 defconfigs are building fine and I'm not aware of any problems introduced by this series. Among the key features for this patch series is a sizable patchset for Lantiq which among other things introduces support for Lantiq's flagship product, the FALCON SOC. It also means that the opensource developers behind this patchset have overtaken Lantiq's competing inhouse development team that was working behind closed doors. Less noteworthy the ath79 patchset which adds support for a few more chip variants, cleanups and fixes. Finally the usual dose of tweaking of generic code." Fix up trivial conflicts in arch/mips/lantiq/xway/gpio_{ebu,stp}.c where printk spelling fixes clashed with file move and eventual removal of the printk. * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (81 commits) MIPS: lantiq: remove orphaned code MIPS: Remove all -Wall and almost all -Werror usage from arch/mips. MIPS: lantiq: implement support for FALCON soc MTD: MIPS: lantiq: verify that the NOR interface is available on falcon soc MTD: MIPS: lantiq: implement OF support watchdog: MIPS: lantiq: implement OF support and minor fixes SERIAL: MIPS: lantiq: implement OF support GPIO: MIPS: lantiq: convert gpio-stp-xway to OF GPIO: MIPS: lantiq: convert gpio-mm-lantiq to OF and of_mm_gpio GPIO: MIPS: lantiq: move gpio-stp and gpio-ebu to the subsystem folder MIPS: pci: convert lantiq driver to OF MIPS: lantiq: convert dma to platform driver MIPS: lantiq: implement support for clkdev api MIPS: lantiq: drop ltq_gpio_request() and gpio_to_irq() OF: MIPS: lantiq: implement irq_domain support OF: MIPS: lantiq: implement OF support MIPS: lantiq: drop mips_machine support OF: PCI: const usage needed by MIPS MIPS: Cavium: Remove smp_reserve_lock. MIPS: Move cache setup to setup_arch(). ...
2012-05-26Merge branch 'i2c-embedded/for-next' of git://git.pengutronix.de/git/wsa/linuxLinus Torvalds
Pull i2c-embedded changes from Wolfram Sang: "Major changes: - lots of devicetree additions for existing drivers. I tried hard to make sure the bindings are proper. In more complicated cases, I requested acks from people having more experience with them than me. That took a bit of extra time and also some time went into discussions with developers about what bindings are and what not. I have the feeling that the workflow with bindings should be improved to scale better. I will spend some more thought on this... - i2c-muxes are succesfully used meanwhile, so we dropped EXPERIMENTAL for them and renamed the drivers to a standard pattern to match the rest of the subsystem. They can also be used with devicetree now. - ixp2000 was removed since the whole platform goes away. - cleanups (strlcpy instead of strcpy, NULL instead of 0) - The rest is typical driver fixes I assume. All patches have been in linux-next at least since v3.4-rc6." Fixed up trivial conflict in arch/arm/mach-lpc32xx/common.c due to the same patch already having come in through the arm/soc trees, with additional patches on top of it. * 'i2c-embedded/for-next' of git://git.pengutronix.de/git/wsa/linux: (35 commits) i2c: davinci: Free requested IRQ in remove i2c: ocores: register OF i2c devices i2c: tegra: notify transfer-complete after clearing status. I2C: xiic: Add OF binding support i2c: Rename last mux driver to standard pattern i2c: tegra: fix 10bit address configuration i2c: muxes: rename first set of drivers to a standard pattern of/i2c: implement of_find_i2c_adapter_by_node i2c: implement i2c_verify_adapter i2c-s3c2410: Add HDMIPHY quirk for S3C2440 i2c-s3c2410: Rework device type handling i2c: muxes are not EXPERIMENTAL anymore i2c/of: Automatically populate i2c mux busses from device tree data. i2c: Add a struct device * parameter to i2c_add_mux_adapter() of/i2c: call i2c_verify_client from of_find_i2c_device_by_node i2c: designware: Add clk_{un}prepare() support i2c: designware: add PM support i2c: ixp2000: remove driver i2c: pnx: add device tree support i2c: imx: don't use strcpy but strlcpy ...
2012-05-24Merge tag 'gpio-for-linus' of git://git.secretlab.ca/git/linux-2.6Linus Torvalds
Pull GPIO driver changes from Grant Likely: "Lots of gpio changes, both to core code and drivers. Changes do touch architecture code to remove the need for separate arm/gpio.h includes in most architectures. Some new drivers are added, and a number of gpio drivers are converted to use irq_domains for gpio inputs used as interrupts. Device tree support has been amended to allow multiple gpio_chips to use the same device tree node. Remaining changes are primarily bug fixes." * tag 'gpio-for-linus' of git://git.secretlab.ca/git/linux-2.6: (33 commits) gpio/generic: initialize basic_mmio_gpio shadow variables properly gpiolib: Remove 'const' from data argument of gpiochip_find() gpio/rc5t583: add gpio driver for RICOH PMIC RC5T583 gpiolib: quiet gpiochip_add boot message noise gpio: mpc8xxx: Prevent NULL pointer deref in demux handler gpio/lpc32xx: Add device tree support gpio: Adjust of_xlate API to support multiple GPIO chips gpiolib: Implement devm_gpio_request_one() gpio-mcp23s08: dbg_show: fix pullup configuration display Add support for TCA6424A gpio/omap: (re)fix wakeups on level-triggered GPIOs gpio/omap: fix broken context restore for non-OFF mode transitions gpio/omap: fix missing check in *_runtime_suspend() gpio/omap: remove cpu_is_omapxxxx() checks from *_runtime_resume() gpio/omap: remove suspend/resume callbacks gpio/omap: remove retrigger variable in gpio_irq_handler gpio/omap: remove saved_wakeup field from struct gpio_bank gpio/omap: remove suspend_wakeup field from struct gpio_bank gpio/omap: remove saved_fallingdetect, saved_risingdetect gpio/omap: remove virtual_irq_start variable ... Conflicts: drivers/gpio/gpio-samsung.c
2012-05-24Merge tag 'spi-for-linus' of git://git.secretlab.ca/git/linux-2.6Linus Torvalds
Pull SPI changes from Grant Likely: "Bug fixes and new features for SPI device drivers. Also move device tree support code out of drivers/of and into drivers/spi/spi.c where it makes more sense." * tag 'spi-for-linus' of git://git.secretlab.ca/git/linux-2.6: spi: By default setup spi_masters with 1 chipselect and dynamics bus number SPI: PRIMA2: use the newest APIs of PINCTRL to fix compiling errors spi/spi-fsl-spi: reference correct pdata in fsl_spi_cs_control spi: refactor spi-coldfire-qspi to use SPI queue framework. spi/omap2-mcspi: convert to the pump message infrastructure spi/rspi: add dmaengine support spi/topcliff: use correct __devexit_p annotation spi: Dont call prepare/unprepare transfer if not populated spi/ep93xx: clean probe/remove routines spi/devicetree: Move devicetree support code into spi directory spi: use module_pci_driver spi/omap2-mcspi: Trivial optimisation spi: omap2-mcspi: add support for pm_runtime autosuspend spi/omap: Remove bus_num usage for instance index OMAP : SPI : use devm_* functions spi: omap2-mcspi: convert to module_platform_driver spi: omap2-mcspi: make it behave as a module
2012-05-22Merge tag 'dt' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-socLinus Torvalds
Pull device tree conversions for arm-soc, part 1, from Olof Johansson: "The spear3xx, lpc32xx, shmobile and mmp platforms are joining the game of booting using device trees, which is a great step forward for them. at91 and spear have pretty much completed this process with a huge amount of work being put into at91. The other platforms are continuing the process. We finally start to see the payback on this investment, as new machines are getting supported purely by adding a .dts source file that can be completely independent of the kernel source." Fix up trivial conflict in arch/arm/Kconfig * tag 'dt' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (83 commits) ARM: at91: Add ADC driver to at91sam9260/at91sam9g20 dtsi files arm/dts: omap4-panda: Add LEDs support arm/dts: omap4-sdp: Add LEDs support arm/dts: twl4030: Add twl4030-gpio node OMAP4: devices: Do not create mcpdm device if the dtb has been provided OMAP4: devices: Do not create dmic device if the dtb has been provided Documentation: update docs for mmp dt ARM: dts: refresh dts file for arch mmp ARM: mmp: support pxa910 with device tree ARM: mmp: support mmp2 with device tree gpio: pxa: parse gpio from DTS file ARM: mmp: support DT in timer ARM: mmp: support DT in irq ARM: mmp: append CONFIG_MACH_MMP2_DT ARM: mmp: fix build issue on mmp with device tree ARM: ux500: Enable PRCMU Timer 4 (clocksource) for Device Tree ARM: ux500: Disable SMSC911x platform code registration when DT is enabled ARM: ux500: Fork cpu-db8500 platform_devs for sequential DT enablement ARM: ux500: Do not attempt to register non-existent i2c devices on Snowball ARM: SPEAr3xx: Correct keyboard data passed from DT ...
2012-05-21Merge tag 'pinctrl-for-v3.5' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl Pull pin control subsystem changes from Linus Walleij: - Generic Device Tree bindings and hooks for drivers so we can move over modern drivers to using this. - Device Tree bindings for Tegra SoCs. - Funneling some devicetree helper code for the drivers/of subsystem. - New pin control drivers for: * Freescale MXS * Freescale i.MX51 * Freescale i.MX53 All of these use Device Tree bindings. - Dummy pinctrl handles for stepwise migration to pinctrl, akin to dummy regulators. - Minor non-urgent fixes and improvments. Fix up trivial conflicts in Documentation/driver-model/devres.txt and drivers/pinctrl/core.c, * tag 'pinctrl-for-v3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (46 commits) pinctrl: pinctrl-imx: add imx51 pinctrl driver pinctrl: pinctrl-imx: add imx53 pinctrl driver pinctrl: pinctrl-pxa3xx: remove empty pinmux disable function pinctrl: pinctrl-mxs: remove empty pinmux disable function pinctrl: pinctrl-imx: remove empty pinmux disable function pinctrl: make pinmux disable function optional pinctrl: a minor error checking improvement for pinconf pinctrl: mxs: skip gpio nodes for group creation pinctrl: mxs: create group for pin config node pinctrl: (cosmetic) fix two entries in DocBook comments pinctrl: add more info to error msgs in pin_request pinctrl: add pinctrl-mxs support pinctrl: pinctrl-imx: add imx6q pinctrl driver pinctrl: pinctrl-imx: add imx pinctrl core driver dt: add of_get_child_count helper function pinctrl: support gpio request deferred probing pinctrl: add pinctrl_provide_dummies interface for platforms to use pinctrl: enhance reporting of errors when loading from DT pinctrl: add kerneldoc for pinctrl_ops device tree functions pinctrl: propagate map validation errors ...
2012-05-21OF: PCI: const usage needed by MIPSJohn Crispin
On MIPS we want to call of_irq_map_pci from inside arch/mips/include/asm/pci.h:extern int pcibios_map_irq( const struct pci_dev *dev, u8 slot, u8 pin); For this to work we need to change several functions to const usage. Signed-off-by: John Crispin <blogic@openwrt.org> Cc: linux-pci@vger.kernel.org Cc: devicetree-discuss@lists.ozlabs.org Cc: linux-mips@linux-mips.org Acked-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Grant Likely <grant.likely@secretlab.ca> Patchwork: https://patchwork.linux-mips.org/patch/3710/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2012-05-12of/i2c: implement of_find_i2c_adapter_by_nodeStephen Warren
This finds the struct i2c_adapter * for a given device tree node. Just like of_find_i2c_device_by_node. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
2012-05-12of/i2c: call i2c_verify_client from of_find_i2c_device_by_nodeStephen Warren
i2c_bus_type may contain both I2C clients and I2C adapters. Fix of_find_i2c_device_by_node to call i2c_verify_client to ensure that it only returns non-NULL of I2C clients. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Rob Herring <rob.herring@calxeda.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
2012-05-09Merge tag 'v3.4-rc6' into spi/nextGrant Likely
Linux 3.4-rc6
2012-05-07netdev/of/phy: New function: of_mdio_find_bus().David Daney
Add of_mdio_find_bus() which allows an mii_bus to be located given its associated the device tree node. This is needed by the follow-on patch to add a driver for MDIO bus multiplexers. The of_mdiobus_register() function is modified so that the device tree node is recorded in the mii_bus. Then we can find it again by iterating over all mdio_bus_class devices. Because the OF device tree has now become an integral part of the kernel, this can live in mdio_bus.c (which contains the needed mdio_bus_class structure) instead of of_mdio.c. Signed-off-by: David Daney <david.daney@cavium.com> Cc: Grant Likely <grant.likely@secretlab.ca> Cc: "David S. Miller" <davem@davemloft.net> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-04-22ARM: spear: remove most mach/*.h header contentsArnd Bergmann
The register and irq definitions in mach/*.h for spear3xx and spear6xx are now mostly obsolete, after the platforms have been converted to device tree based probing and the data is now part of the device tree files. The misc_regs.h contents are moved into clock.c because that is the only user, aside from the DMA_CHN_CFG that should eventually get handled differently. Some of the contents of mach/spear.h still remain, because they are used to set up the static map table, timer, uart and auxdata tables, but almost everything got removed. We might remove everything but the map table as the DT conversion completes, but that is not a priority. I've also made sure to make both copies of spear.h more or less identical so we can eventually combine them. The spear3?0.h files were only used by the spear3?0.c files, so I merged the contents in there and removed the bits that were unused. This is something that should still be looked at. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Viresh Kumar <viresh.kumar@st.com>
2012-04-18dt: add property iteration helpersStephen Warren
This patch adds macros of_property_for_each_u32() and of_property_for_each_string(), which iterate over an array of values within a device-tree property. Usage is for example: struct property *prop; const __be32 *p; u32 u; of_property_for_each_u32(np, "propname", prop, p, u) printk("U32 value: %x\n", u); struct property *prop; const char *s; of_property_for_each_string(np, "propname", prop, s) printk("String value: %s\n", s); Based on work by Rob Herring <robherring2@gmail.com> Cc: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Rob Herring <rob.herring@calxeda.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2012-04-13spi/devicetree: Move devicetree support code into spi directoryGrant Likely
The SPI device tree support code isn't shared by any other subsystem. It can be moved into the core drivers/spi directory and the exported symbol can be removed. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Cc: Rob Herring <rob.herring@calxeda.com>