Commit b58ed041 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'devicetree-for-linus' of git://git.secretlab.ca/git/linux-2.6

Pull device tree changes from Grant Likely:
 "Here are the DT changes I've got queued up for v3.8.  As described
  below, there are a lot of bug fixes here and documentation updates but
  nothing major:

  Bug fixes, little cleanups, and documentation changes.  The most
  invasive thing here touches a bunch of the arch directories to use a
  common build rule for .dtb files.  There are no major changes to
  functionality here other than a few new helper functions."

* tag 'devicetree-for-linus' of git://git.secretlab.ca/git/linux-2.6: (34 commits)
  arm64: Fix the dtbs target building
  mtd: nand: davinci: fix the binding documentation
  rtc: rtc-mv: Add the device tree binding documentation
  devicetree/bindings: Move gpio-leds binding into leds directory
  of/vendor-prefixes: add Imagination Technologies
  microblaze: use new common dtc rule
  c6x: use new common dtc rule
  openrisc: use new common dtc rule
  arm64: Add dtbs target for building all the enabled dtb files
  arm64: use new common dtc rule
  ARM: dt: change .dtb build rules to build in dts directory
  kbuild: centralize .dts->.dtb rule
  Fix build when CONFIG_W1_MASTER_GPIO=m b exporting "allnodes"
  of/spi: Honour "status=disabled" property of device
  of_mdio: Honour "status=disabled" property of device
  of_i2c: Honour "status=disabled" property of device
  powerpc: Fix fallout from device_node->name constification
  of: add 'const' for of_parse_phandle parameter *np
  Documentation: correct of_platform_populate() argument list
  script: dtc: clean generated files
  ...
parents 259cdbee 58fea354
...@@ -23,29 +23,16 @@ Recommended properties : ...@@ -23,29 +23,16 @@ Recommended properties :
- ti,davinci-nand-buswidth: buswidth 8 or 16 - ti,davinci-nand-buswidth: buswidth 8 or 16
- ti,davinci-nand-use-bbt: use flash based bad block table support. - ti,davinci-nand-use-bbt: use flash based bad block table support.
Example (enbw_cmc board): Example(da850 EVM ):
aemif@60000000 { nand_cs3@62000000 {
compatible = "ti,davinci-aemif"; compatible = "ti,davinci-nand";
#address-cells = <2>; reg = <0x62000000 0x807ff
#size-cells = <1>; 0x68000000 0x8000>;
reg = <0x68000000 0x80000>; ti,davinci-chipselect = <1>;
ranges = <2 0 0x60000000 0x02000000 ti,davinci-mask-ale = <0>;
3 0 0x62000000 0x02000000 ti,davinci-mask-cle = <0>;
4 0 0x64000000 0x02000000 ti,davinci-mask-chipsel = <0>;
5 0 0x66000000 0x02000000 ti,davinci-ecc-mode = "hw";
6 0 0x68000000 0x02000000>; ti,davinci-ecc-bits = <4>;
nand@3,0 { ti,davinci-nand-use-bbt;
compatible = "ti,davinci-nand";
reg = <3 0x0 0x807ff
6 0x0 0x8000>;
#address-cells = <1>;
#size-cells = <1>;
ti,davinci-chipselect = <1>;
ti,davinci-mask-ale = <0>;
ti,davinci-mask-cle = <0>;
ti,davinci-mask-chipsel = <0>;
ti,davinci-ecc-mode = "hw";
ti,davinci-ecc-bits = <4>;
ti,davinci-nand-use-bbt;
};
}; };
...@@ -37,7 +37,7 @@ L2: cache-controller { ...@@ -37,7 +37,7 @@ L2: cache-controller {
reg = <0xfff12000 0x1000>; reg = <0xfff12000 0x1000>;
arm,data-latency = <1 1 1>; arm,data-latency = <1 1 1>;
arm,tag-latency = <2 2 2>; arm,tag-latency = <2 2 2>;
arm,filter-latency = <0x80000000 0x8000000>; arm,filter-ranges = <0x80000000 0x8000000>;
cache-unified; cache-unified;
cache-level = <2>; cache-level = <2>;
interrupts = <45>; interrupts = <45>;
......
* Marvell MV64XXX I2C controller
Required properties :
- reg : Offset and length of the register set for the device
- compatible : Should be "marvell,mv64xxx-i2c"
- interrupts : The interrupt number
- clock-frequency : Desired I2C bus clock frequency in Hz.
Examples:
i2c@11000 {
compatible = "marvell,mv64xxx-i2c";
reg = <0x11000 0x20>;
interrupts = <29>;
clock-frequency = <100000>;
};
...@@ -31,21 +31,3 @@ Examples: ...@@ -31,21 +31,3 @@ Examples:
reg = <0xd4025000 0x1000>; reg = <0xd4025000 0x1000>;
interrupts = <58>; interrupts = <58>;
}; };
* Marvell MV64XXX I2C controller
Required properties :
- reg : Offset and length of the register set for the device
- compatible : Should be "marvell,mv64xxx-i2c"
- interrupts : The interrupt number
- clock-frequency : Desired I2C bus clock frequency in Hz.
Examples:
i2c@11000 {
compatible = "marvell,mv64xxx-i2c";
reg = <0x11000 0x20>;
interrupts = <29>;
clock-frequency = <100000>;
};
Common leds properties.
Optional properties for child nodes:
- label : The label for this LED. If omitted, the label is
taken from the node name (excluding the unit address).
- linux,default-trigger : This parameter, if present, is a
string defining the trigger assigned to the LED. Current triggers are:
"backlight" - LED will act as a back-light, controlled by the framebuffer
system
"default-on" - LED will turn on (but for leds-gpio see "default-state"
property in Documentation/devicetree/bindings/gpio/led.txt)
"heartbeat" - LED "double" flashes at a load average based rate
"ide-disk" - LED indicates disk activity
"timer" - LED flashes at a fixed, configurable rate
Examples:
system-status {
label = "Status";
linux,default-trigger = "heartbeat";
...
};
...@@ -10,16 +10,10 @@ LED sub-node properties: ...@@ -10,16 +10,10 @@ LED sub-node properties:
- gpios : Should specify the LED's GPIO, see "gpios property" in - gpios : Should specify the LED's GPIO, see "gpios property" in
Documentation/devicetree/bindings/gpio/gpio.txt. Active low LEDs should be Documentation/devicetree/bindings/gpio/gpio.txt. Active low LEDs should be
indicated using flags in the GPIO specifier. indicated using flags in the GPIO specifier.
- label : (optional) The label for this LED. If omitted, the label is - label : (optional)
taken from the node name (excluding the unit address). see Documentation/devicetree/bindings/leds/common.txt
- linux,default-trigger : (optional) This parameter, if present, is a - linux,default-trigger : (optional)
string defining the trigger assigned to the LED. Current triggers are: see Documentation/devicetree/bindings/leds/common.txt
"backlight" - LED will act as a back-light, controlled by the framebuffer
system
"default-on" - LED will turn on, but see "default-state" below
"heartbeat" - LED "double" flashes at a load average based rate
"ide-disk" - LED indicates disk activity
"timer" - LED flashes at a fixed, configurable rate
- default-state: (optional) The initial state of the LED. Valid - default-state: (optional) The initial state of the LED. Valid
values are "on", "off", and "keep". If the LED is already on or off values are "on", "off", and "keep". If the LED is already on or off
and the default-state property is set the to same value, then no and the default-state property is set the to same value, then no
......
* Mvebu Real Time Clock
RTC controller for the Kirkwood, the Dove, the Armada 370 and the
Armada XP SoCs
Required properties:
- compatible : Should be "marvell,orion-rtc"
- reg: physical base address of the controller and length of memory mapped
region.
- interrupts: IRQ line for the RTC.
Example:
rtc@10300 {
compatible = "marvell,orion-rtc";
reg = <0xd0010300 0x20>;
interrupts = <50>;
};
...@@ -5,6 +5,7 @@ using them to avoid name-space collisions. ...@@ -5,6 +5,7 @@ using them to avoid name-space collisions.
ad Avionic Design GmbH ad Avionic Design GmbH
adi Analog Devices, Inc. adi Analog Devices, Inc.
ak Asahi Kasei Corp.
amcc Applied Micro Circuits Corporation (APM, formally AMCC) amcc Applied Micro Circuits Corporation (APM, formally AMCC)
apm Applied Micro Circuits Corporation (APM) apm Applied Micro Circuits Corporation (APM)
arm ARM Ltd. arm ARM Ltd.
...@@ -25,6 +26,7 @@ gef GE Fanuc Intelligent Platforms Embedded Systems, Inc. ...@@ -25,6 +26,7 @@ gef GE Fanuc Intelligent Platforms Embedded Systems, Inc.
hp Hewlett Packard hp Hewlett Packard
ibm International Business Machines (IBM) ibm International Business Machines (IBM)
idt Integrated Device Technologies, Inc. idt Integrated Device Technologies, Inc.
img Imagination Technologies Ltd.
intercontrol Inter Control Group intercontrol Inter Control Group
linux Linux-specific binding linux Linux-specific binding
marvell Marvell Technology Group Ltd. marvell Marvell Technology Group Ltd.
...@@ -34,8 +36,9 @@ national National Semiconductor ...@@ -34,8 +36,9 @@ national National Semiconductor
nintendo Nintendo nintendo Nintendo
nvidia NVIDIA nvidia NVIDIA
nxp NXP Semiconductors nxp NXP Semiconductors
onnn ON Semiconductor Corp.
picochip Picochip Ltd picochip Picochip Ltd
powervr Imagination Technologies powervr PowerVR (deprecated, use img)
qcom Qualcomm, Inc. qcom Qualcomm, Inc.
ramtron Ramtron International ramtron Ramtron International
realtek Realtek Semiconductor Corp. realtek Realtek Semiconductor Corp.
...@@ -45,6 +48,7 @@ schindler Schindler ...@@ -45,6 +48,7 @@ schindler Schindler
sil Silicon Image sil Silicon Image
simtek simtek
sirf SiRF Technology, Inc. sirf SiRF Technology, Inc.
snps Synopsys, Inc.
st STMicroelectronics st STMicroelectronics
stericsson ST-Ericsson stericsson ST-Ericsson
ti Texas Instruments ti Texas Instruments
......
...@@ -347,7 +347,7 @@ later), which will happily live at the base of the Linux /sys/devices ...@@ -347,7 +347,7 @@ later), which will happily live at the base of the Linux /sys/devices
tree. Therefore, if a DT node is at the root of the tree, then it tree. Therefore, if a DT node is at the root of the tree, then it
really probably is best registered as a platform_device. really probably is best registered as a platform_device.
Linux board support code calls of_platform_populate(NULL, NULL, NULL) Linux board support code calls of_platform_populate(NULL, NULL, NULL, NULL)
to kick off discovery of devices at the root of the tree. The to kick off discovery of devices at the root of the tree. The
parameters are all NULL because when starting from the root of the parameters are all NULL because when starting from the root of the
tree, there is no need to provide a starting node (the first NULL), a tree, there is no need to provide a starting node (the first NULL), a
......
...@@ -1175,15 +1175,16 @@ When kbuild executes, the following steps are followed (roughly): ...@@ -1175,15 +1175,16 @@ When kbuild executes, the following steps are followed (roughly):
in an init section in the image. Platform code *must* copy the in an init section in the image. Platform code *must* copy the
blob to non-init memory prior to calling unflatten_device_tree(). blob to non-init memory prior to calling unflatten_device_tree().
Example: To use this command, simply add *.dtb into obj-y or targets, or make
#arch/x86/platform/ce4100/Makefile some other target depend on %.dtb
clean-files := *dtb.S
DTC_FLAGS := -p 1024 A central rule exists to create $(obj)/%.dtb from $(src)/%.dts;
obj-y += foo.dtb.o architecture Makefiles do no need to explicitly write out that rule.
$(obj)/%.dtb: $(src)/%.dts Example:
$(call cmd,dtc) targets += $(dtb-y)
clean-files += *.dtb
DTC_FLAGS ?= -p 1024
--- 6.8 Custom kbuild commands --- 6.8 Custom kbuild commands
......
...@@ -292,10 +292,10 @@ zinstall uinstall install: vmlinux ...@@ -292,10 +292,10 @@ zinstall uinstall install: vmlinux
$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@ $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
%.dtb: scripts %.dtb: scripts
$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@ $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@
dtbs: scripts dtbs: scripts
$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@ $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) dtbs
# We use MRPROPER_FILES and CLEAN_FILES now # We use MRPROPER_FILES and CLEAN_FILES now
archclean: archclean:
......
...@@ -15,8 +15,6 @@ ifneq ($(MACHINE),) ...@@ -15,8 +15,6 @@ ifneq ($(MACHINE),)
include $(srctree)/$(MACHINE)/Makefile.boot include $(srctree)/$(MACHINE)/Makefile.boot
endif endif
include $(srctree)/arch/arm/boot/dts/Makefile
# Note: the following conditions must always be true: # Note: the following conditions must always be true:
# ZRELADDR == virt_to_phys(PAGE_OFFSET + TEXT_OFFSET) # ZRELADDR == virt_to_phys(PAGE_OFFSET + TEXT_OFFSET)
# PARAMS_PHYS must be within 4MB of ZRELADDR # PARAMS_PHYS must be within 4MB of ZRELADDR
...@@ -59,16 +57,6 @@ $(obj)/zImage: $(obj)/compressed/vmlinux FORCE ...@@ -59,16 +57,6 @@ $(obj)/zImage: $(obj)/compressed/vmlinux FORCE
endif endif
targets += $(dtb-y)
# Rule to build device tree blobs
$(obj)/%.dtb: $(src)/dts/%.dts FORCE
$(call if_changed_dep,dtc)
$(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y))
clean-files := *.dtb
ifneq ($(LOADADDR),) ifneq ($(LOADADDR),)
UIMAGE_LOADADDR=$(LOADADDR) UIMAGE_LOADADDR=$(LOADADDR)
else else
......
...@@ -120,4 +120,12 @@ dtb-$(CONFIG_ARCH_VT8500) += vt8500-bv07.dtb \ ...@@ -120,4 +120,12 @@ dtb-$(CONFIG_ARCH_VT8500) += vt8500-bv07.dtb \
wm8505-ref.dtb \ wm8505-ref.dtb \
wm8650-mid.dtb wm8650-mid.dtb
targets += dtbs
endif endif
# *.dtb used to be generated in the directory above. Clean out the
# old build results so people don't accidentally use them.
dtbs: $(addprefix $(obj)/, $(dtb-y))
$(Q)rm -f $(obj)/../*.dtb
clean-files := *.dtb
...@@ -523,12 +523,12 @@ regulator@14 { ...@@ -523,12 +523,12 @@ regulator@14 {
}; };
temperature-sensor@4c { temperature-sensor@4c {
compatible = "nct1008"; compatible = "onnn,nct1008";
reg = <0x4c>; reg = <0x4c>;
}; };
magnetometer@c { magnetometer@c {
compatible = "ak8975"; compatible = "ak,ak8975";
reg = <0xc>; reg = <0xc>;
interrupt-parent = <&gpio>; interrupt-parent = <&gpio>;
interrupts = <109 0x04>; /* gpio PN5 */ interrupts = <109 0x04>; /* gpio PN5 */
......
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#ifndef __ASMARM_PROM_H #ifndef __ASMARM_PROM_H
#define __ASMARM_PROM_H #define __ASMARM_PROM_H
#define HAVE_ARCH_DEVTREE_FIXUPS
#ifdef CONFIG_OF #ifdef CONFIG_OF
extern struct machine_desc *setup_machine_fdt(unsigned int dt_phys); extern struct machine_desc *setup_machine_fdt(unsigned int dt_phys);
......
...@@ -589,7 +589,7 @@ void __init v2m_dt_init_early(void) ...@@ -589,7 +589,7 @@ void __init v2m_dt_init_early(void)
return; return;
/* Confirm board type against DT property, if available */ /* Confirm board type against DT property, if available */
if (of_property_read_u32(allnodes, "arm,hbi", &dt_hbi) == 0) { if (of_property_read_u32(of_allnodes, "arm,hbi", &dt_hbi) == 0) {
int site = v2m_get_master_site(); int site = v2m_get_master_site();
u32 id = readl(v2m_sysreg_base + (site == SYS_CFG_SITE_DB2 ? u32 id = readl(v2m_sysreg_base + (site == SYS_CFG_SITE_DB2 ?
V2M_SYS_PROCID1 : V2M_SYS_PROCID0)); V2M_SYS_PROCID1 : V2M_SYS_PROCID0));
......
...@@ -41,20 +41,24 @@ libs-y := arch/arm64/lib/ $(libs-y) ...@@ -41,20 +41,24 @@ libs-y := arch/arm64/lib/ $(libs-y)
libs-y += $(LIBGCC) libs-y += $(LIBGCC)
# Default target when executing plain make # Default target when executing plain make
KBUILD_IMAGE := Image.gz KBUILD_IMAGE := Image.gz
KBUILD_DTBS := dtbs
all: $(KBUILD_IMAGE) all: $(KBUILD_IMAGE) $(KBUILD_DTBS)
boot := arch/arm64/boot boot := arch/arm64/boot
Image Image.gz: vmlinux Image Image.gz: vmlinux
$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@ $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
zinstall install: vmlinux zinstall install: vmlinux
$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@ $(Q)$(MAKE) $(build)=$(boot) $@
%.dtb: %.dtb: scripts
$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@ $(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
dtbs: scripts
$(Q)$(MAKE) $(build)=$(boot)/dts dtbs
# We use MRPROPER_FILES and CLEAN_FILES now # We use MRPROPER_FILES and CLEAN_FILES now
archclean: archclean:
...@@ -63,6 +67,7 @@ archclean: ...@@ -63,6 +67,7 @@ archclean:
define archhelp define archhelp
echo '* Image.gz - Compressed kernel image (arch/$(ARCH)/boot/Image.gz)' echo '* Image.gz - Compressed kernel image (arch/$(ARCH)/boot/Image.gz)'
echo ' Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)' echo ' Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
echo '* dtbs - Build device tree blobs for enabled boards'
echo ' install - Install uncompressed kernel' echo ' install - Install uncompressed kernel'
echo ' zinstall - Install compressed kernel' echo ' zinstall - Install compressed kernel'
echo ' Install using (your) ~/bin/installkernel or' echo ' Install using (your) ~/bin/installkernel or'
......
...@@ -22,9 +22,6 @@ $(obj)/Image: vmlinux FORCE ...@@ -22,9 +22,6 @@ $(obj)/Image: vmlinux FORCE
$(obj)/Image.gz: $(obj)/Image FORCE $(obj)/Image.gz: $(obj)/Image FORCE
$(call if_changed,gzip) $(call if_changed,gzip)
$(obj)/%.dtb: $(src)/dts/%.dts
$(call cmd,dtc)
install: $(obj)/Image install: $(obj)/Image
$(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \
$(obj)/Image System.map "$(INSTALL_PATH)" $(obj)/Image System.map "$(INSTALL_PATH)"
...@@ -32,5 +29,3 @@ install: $(obj)/Image ...@@ -32,5 +29,3 @@ install: $(obj)/Image
zinstall: $(obj)/Image.gz zinstall: $(obj)/Image.gz
$(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \
$(obj)/Image.gz System.map "$(INSTALL_PATH)" $(obj)/Image.gz System.map "$(INSTALL_PATH)"
clean-files += *.dtb
targets += dtbs
dtbs: $(addprefix $(obj)/, $(dtb-y))
clean-files := *.dtb
...@@ -41,7 +41,7 @@ DTB:=$(subst dtbImage.,,$(filter dtbImage.%, $(MAKECMDGOALS))) ...@@ -41,7 +41,7 @@ DTB:=$(subst dtbImage.,,$(filter dtbImage.%, $(MAKECMDGOALS)))
export DTB export DTB
ifneq ($(DTB),) ifneq ($(DTB),)
core-y += $(boot)/ core-y += $(boot)/dts/
endif endif
# With make 3.82 we cannot mix normal and wildcard targets # With make 3.82 we cannot mix normal and wildcard targets
......
...@@ -6,25 +6,5 @@ OBJCOPYFLAGS_vmlinux.bin := -O binary ...@@ -6,25 +6,5 @@ OBJCOPYFLAGS_vmlinux.bin := -O binary
$(obj)/vmlinux.bin: vmlinux FORCE $(obj)/vmlinux.bin: vmlinux FORCE
$(call if_changed,objcopy) $(call if_changed,objcopy)
DTC_FLAGS ?= -p 1024
ifneq ($(DTB),)
obj-y += linked_dtb.o
endif
$(obj)/%.dtb: $(src)/dts/%.dts FORCE
$(call if_changed_dep,dtc)
quiet_cmd_cp = CP $< $@$2
cmd_cp = cat $< >$@$2 || (rm -f $@ && echo false)
# Generate builtin.dtb from $(DTB).dtb
$(obj)/builtin.dtb: $(obj)/$(DTB).dtb
$(call if_changed,cp)
$(obj)/linked_dtb.o: $(obj)/builtin.dtb
$(obj)/dtbImage.%: vmlinux $(obj)/dtbImage.%: vmlinux
$(call if_changed,objcopy) $(call if_changed,objcopy)
clean-files := $(obj)/*.dtb
#
# Makefile for device trees
#
DTC_FLAGS ?= -p 1024
ifneq ($(DTB),)
obj-y += linked_dtb.o
endif
quiet_cmd_cp = CP $< $@$2
cmd_cp = cat $< >$@$2 || (rm -f $@ && echo false)
# Generate builtin.dtb from $(DTB).dtb
$(obj)/builtin.dtb: $(obj)/$(DTB).dtb
$(call if_changed,cp)
$(obj)/linked_dtb.o: $(obj)/builtin.dtb
clean-files := *.dtb
.section __fdt_blob,"a" .section __fdt_blob,"a"
.incbin "arch/c6x/boot/builtin.dtb" .incbin "arch/c6x/boot/dts/builtin.dtb"
...@@ -57,7 +57,7 @@ boot := arch/microblaze/boot ...@@ -57,7 +57,7 @@ boot := arch/microblaze/boot
DTB:=$(subst simpleImage.,,$(filter simpleImage.%, $(MAKECMDGOALS))) DTB:=$(subst simpleImage.,,$(filter simpleImage.%, $(MAKECMDGOALS)))
ifneq ($(DTB),) ifneq ($(DTB),)
core-y += $(boot)/ core-y += $(boot)/dts/
endif endif
# defines filename extension depending memory management type # defines filename extension depending memory management type
......
...@@ -2,21 +2,10 @@ ...@@ -2,21 +2,10 @@
# arch/microblaze/boot/Makefile # arch/microblaze/boot/Makefile
# #
obj-y += linked_dtb.o
targets := linux.bin linux.bin.gz simpleImage.% targets := linux.bin linux.bin.gz simpleImage.%
OBJCOPYFLAGS := -R .note -R .comment -R .note.gnu.build-id -O binary OBJCOPYFLAGS := -R .note -R .comment -R .note.gnu.build-id -O binary
# Ensure system.dtb exists
$(obj)/linked_dtb.o: $(obj)/system.dtb
# Generate system.dtb from $(DTB).dtb
ifneq ($(DTB),system)
$(obj)/system.dtb: $(obj)/$(DTB).dtb
$(call if_changed,cp)
endif
$(obj)/linux.bin: vmlinux FORCE $(obj)/linux.bin: vmlinux FORCE
$(call if_changed,objcopy) $(call if_changed,objcopy)
$(call if_changed,uimage) $(call if_changed,uimage)
...@@ -45,10 +34,4 @@ $(obj)/simpleImage.%: vmlinux FORCE ...@@ -45,10 +34,4 @@ $(obj)/simpleImage.%: vmlinux FORCE
@echo 'Kernel: $@ is ready' ' (#'`cat .version`')' @echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
# Rule to build device tree blobs clean-files += simpleImage.*.unstrip linux.bin.ub
DTC_FLAGS := -p 1024
$(obj)/%.dtb: $(src)/dts/%.dts FORCE
$(call if_changed_dep,dtc)
clean-files += *.dtb simpleImage.*.unstrip linux.bin.ub
#
# arch/microblaze/boot/Makefile
#
obj-y += linked_dtb.o
# Ensure system.dtb exists
$(obj)/linked_dtb.o: $(obj)/system.dtb
# Generate system.dtb from $(DTB).dtb
ifneq ($(DTB),system)
$(obj)/system.dtb: $(obj)/$(DTB).dtb
$(call if_changed,cp)
endif
quiet_cmd_cp = CP $< $@$2
cmd_cp = cat $< >$@$2 || (rm -f $@ && echo false)
# Rule to build device tree blobs
DTC_FLAGS := -p 1024
clean-files += *.dtb
.section __fdt_blob,"a" .section __fdt_blob,"a"
.incbin "arch/microblaze/boot/system.dtb" .incbin "arch/microblaze/boot/dts/system.dtb"
...@@ -24,9 +24,6 @@ DTB_FILES = $(patsubst %.dts, %.dtb, $(DTS_FILES)) ...@@ -24,9 +24,6 @@ DTB_FILES = $(patsubst %.dts, %.dtb, $(DTS_FILES))
obj-y += $(patsubst %.dts, %.dtb.o, $(DTS_FILES)) obj-y += $(patsubst %.dts, %.dtb.o, $(DTS_FILES))
$(obj)/%.dtb: $(src)/%.dts FORCE
$(call if_changed_dep,dtc)
# Let's keep the .dtb files around in case we want to look at them. # Let's keep the .dtb files around in case we want to look at them.
.SECONDARY: $(addprefix $(obj)/, $(DTB_FILES)) .SECONDARY: $(addprefix $(obj)/, $(DTB_FILES))
......
obj-$(CONFIG_DT_EASY50712) := easy50712.dtb.o obj-$(CONFIG_DT_EASY50712) := easy50712.dtb.o
$(obj)/%.dtb: $(obj)/%.dts
$(call if_changed,dtc)
obj-$(CONFIG_DT_XLP_EVP) := xlp_evp.dtb.o obj-$(CONFIG_DT_XLP_EVP) := xlp_evp.dtb.o
$(obj)/%.dtb: $(obj)/%.dts
$(call if_changed,dtc)
...@@ -50,6 +50,6 @@ BUILTIN_DTB := y ...@@ -50,6 +50,6 @@ BUILTIN_DTB := y
else else
BUILTIN_DTB := n BUILTIN_DTB := n
endif endif
core-$(BUILTIN_DTB) += arch/openrisc/boot/ core-$(BUILTIN_DTB) += arch/openrisc/boot/dts/
all: vmlinux all: vmlinux
ifneq '$(CONFIG_OPENRISC_BUILTIN_DTB)' '""' ifneq '$(CONFIG_OPENRISC_BUILTIN_DTB)' '""'
BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_OPENRISC_BUILTIN_DTB)).dtb.o BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_OPENRISC_BUILTIN_DTB)).dtb.o
else else
...@@ -10,6 +8,3 @@ obj-y += $(BUILTIN_DTB) ...@@ -10,6 +8,3 @@ obj-y += $(BUILTIN_DTB)
clean-files := *.dtb.S clean-files := *.dtb.S
#DTC_FLAGS ?= -p 1024 #DTC_FLAGS ?= -p 1024
$(obj)/%.dtb: $(src)/dts/%.dts FORCE
$(call if_changed_dep,dtc)
...@@ -686,7 +686,7 @@ static int pmf_add_functions(struct pmf_device *dev, void *driverdata) ...@@ -686,7 +686,7 @@ static int pmf_add_functions(struct pmf_device *dev, void *driverdata)
int count = 0; int count = 0;
for (pp = dev->node->properties; pp != 0; pp = pp->next) { for (pp = dev->node->properties; pp != 0; pp = pp->next) {
char *name; const char *name;
if (strncmp(pp->name, PP_PREFIX, plen) != 0) if (strncmp(pp->name, PP_PREFIX, plen) != 0)
continue; continue;
name = pp->name + plen; name = pp->name + plen;
......
...@@ -281,12 +281,11 @@ static struct property *new_property(const char *name, const int length, ...@@ -281,12 +281,11 @@ static struct property *new_property(const char *name, const int length,
if (!new) if (!new)
return NULL; return NULL;
if (!(new->name = kmalloc(strlen(name) + 1, GFP_KERNEL))) if (!(new->name = kstrdup(name, GFP_KERNEL)))
goto cleanup; goto cleanup;
if (!(new->value = kmalloc(length + 1, GFP_KERNEL))) if (!(new->value = kmalloc(length + 1, GFP_KERNEL)))
goto cleanup; goto cleanup;
strcpy(new->name, name);
memcpy(new->value, value, length); memcpy(new->value, value, length);
*(((char *)new->value) + length) = 0; *(((char *)new->value) + length) = 0;
new->length = length; new->length = length;
......
...@@ -136,7 +136,7 @@ static void __init setup_pci_atmu(struct pci_controller *hose, ...@@ -136,7 +136,7 @@ static void __init setup_pci_atmu(struct pci_controller *hose,
u32 pcicsrbar = 0, pcicsrbar_sz; u32 pcicsrbar = 0, pcicsrbar_sz;
u32 piwar = PIWAR_EN | PIWAR_PF | PIWAR_TGI_LOCAL | u32 piwar = PIWAR_EN | PIWAR_PF | PIWAR_TGI_LOCAL |
PIWAR_READ_SNOOP | PIWAR_WRITE_SNOOP; PIWAR_READ_SNOOP | PIWAR_WRITE_SNOOP;
char *name = hose->dn->full_name; const char *name = hose->dn->full_name;
const u64 *reg; const u64 *reg;
int len; int len;
......
...@@ -157,7 +157,7 @@ static int scom_debug_init_one(struct dentry *root, struct device_node *dn, ...@@ -157,7 +157,7 @@ static int scom_debug_init_one(struct dentry *root, struct device_node *dn,
ent->map = SCOM_MAP_INVALID; ent->map = SCOM_MAP_INVALID;
spin_lock_init(&ent->lock); spin_lock_init(&ent->lock);
snprintf(ent->name, 8, "scom%d", i); snprintf(ent->name, 8, "scom%d", i);
ent->blob.data = dn->full_name; ent->blob.data = (void*) dn->full_name;
ent->blob.size = strlen(dn->full_name); ent->blob.size = strlen(dn->full_name);
dir = debugfs_create_dir(ent->name, root); dir = debugfs_create_dir(ent->name, root);
......
...@@ -88,7 +88,7 @@ struct pci_pbm_info { ...@@ -88,7 +88,7 @@ struct pci_pbm_info {
int chip_revision; int chip_revision;
/* Name used for top-level resources. */ /* Name used for top-level resources. */
char *name; const char *name;
/* OBP specific information. */ /* OBP specific information. */
struct platform_device *op; struct platform_device *op;
......
...@@ -9,10 +9,6 @@ ...@@ -9,10 +9,6 @@
* kind, whether express or implied. * kind, whether express or implied.
*/ */
/*
* This driver can be used from the device tree, see
* Documentation/devicetree/bindings/i2c/ocore-i2c.txt
*/
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
......
...@@ -45,7 +45,8 @@ struct alias_prop { ...@@ -45,7 +45,8 @@ struct alias_prop {
static LIST_HEAD(aliases_lookup); static LIST_HEAD(aliases_lookup);
struct device_node *allnodes; struct device_node *of_allnodes;
EXPORT_SYMBOL(of_allnodes);
struct device_node *of_chosen; struct device_node *of_chosen;
struct device_node *of_aliases; struct device_node *of_aliases;
...@@ -199,7 +200,7 @@ struct device_node *of_find_all_nodes(struct device_node *prev) ...@@ -199,7 +200,7 @@ struct device_node *of_find_all_nodes(struct device_node *prev)
struct device_node *np; struct device_node *np;
read_lock(&devtree_lock); read_lock(&devtree_lock);
np = prev ? prev->allnext : allnodes; np = prev ? prev->allnext : of_allnodes;
for (; np != NULL; np = np->allnext) for (; np != NULL; np = np->allnext)
if (of_node_get(np)) if (of_node_get(np))
break; break;
...@@ -422,7 +423,7 @@ EXPORT_SYMBOL(of_get_child_by_name); ...@@ -422,7 +423,7 @@ EXPORT_SYMBOL(of_get_child_by_name);
*/ */
struct device_node *of_find_node_by_path(const char *path) struct device_node *of_find_node_by_path(const char *path)
{ {
struct device_node *np = allnodes; struct device_node *np = of_allnodes;
read_lock(&devtree_lock); read_lock(&devtree_lock);
for (; np; np = np->allnext) { for (; np; np = np->allnext) {
...@@ -452,7 +453,7 @@ struct device_node *of_find_node_by_name(struct device_node *from, ...@@ -452,7 +453,7 @@ struct device_node *of_find_node_by_name(struct device_node *from,
struct device_node *np; struct device_node *np;
read_lock(&devtree_lock); read_lock(&devtree_lock);
np = from ? from->allnext : allnodes; np = from ? from->allnext : of_allnodes;
for (; np; np = np->allnext) for (; np; np = np->allnext)
if (np->name && (of_node_cmp(np->name, name) == 0) if (np->name && (of_node_cmp(np->name, name) == 0)
&& of_node_get(np)) && of_node_get(np))
...@@ -481,7 +482,7 @@ struct device_node *of_find_node_by_type(struct device_node *from, ...@@ -481,7 +482,7 @@ struct device_node *of_find_node_by_type(struct device_node *from,
struct device_node *np; struct device_node *np;
read_lock(&devtree_lock); read_lock(&devtree_lock);
np = from ? from->allnext : allnodes; np = from ? from->allnext : of_allnodes;
for (; np; np = np->allnext) for (; np; np = np->allnext)
if (np->type && (of_node_cmp(np->type, type) == 0) if (np->type && (of_node_cmp(np->type, type) == 0)
&& of_node_get(np)) && of_node_get(np))
...@@ -512,7 +513,7 @@ struct device_node *of_find_compatible_node(struct device_node *from, ...@@ -512,7 +513,7 @@ struct device_node *of_find_compatible_node(struct device_node *from,
struct device_node *np; struct device_node *np;
read_lock(&devtree_lock); read_lock(&devtree_lock);
np = from ? from->allnext : allnodes; np = from ? from->allnext : of_allnodes;
for (; np; np = np->allnext) { for (; np; np = np->allnext) {
if (type if (type
&& !(np->type && (of_node_cmp(np->type, type) == 0))) && !(np->type && (of_node_cmp(np->type, type) == 0)))
...@@ -545,7 +546,7 @@ struct device_node *of_find_node_with_property(struct device_node *from, ...@@ -545,7 +546,7 @@ struct device_node *of_find_node_with_property(struct device_node *from,
struct property *pp; struct property *pp;
read_lock(&devtree_lock); read_lock(&devtree_lock);
np = from ? from->allnext : allnodes; np = from ? from->allnext : of_allnodes;
for (; np; np = np->allnext) { for (; np; np = np->allnext) {
for (pp = np->properties; pp; pp = pp->next) { for (pp = np->properties; pp; pp = pp->next) {
if (of_prop_cmp(pp->name, prop_name) == 0) { if (of_prop_cmp(pp->name, prop_name) == 0) {
...@@ -594,27 +595,35 @@ const struct of_device_id *of_match_node(const struct of_device_id *matches, ...@@ -594,27 +595,35 @@ const struct of_device_id *of_match_node(const struct of_device_id *matches,
EXPORT_SYMBOL(of_match_node); EXPORT_SYMBOL(of_match_node);
/** /**
* of_find_matching_node - Find a node based on an of_device_id match * of_find_matching_node_and_match - Find a node based on an of_device_id
* table. * match table.
* @from: The node to start searching from or NULL, the node * @from: The node to start searching from or NULL, the node
* you pass will not be searched, only the next one * you pass will not be searched, only the next one
* will; typically, you pass what the previous call * will; typically, you pass what the previous call
* returned. of_node_put() will be called on it * returned. of_node_put() will be called on it
* @matches: array of of device match structures to search in * @matches: array of of device match structures to search in
* @match Updated to point at the matches entry which matched
* *
* Returns a node pointer with refcount incremented, use * Returns a node pointer with refcount incremented, use
* of_node_put() on it when done. * of_node_put() on it when done.
*/ */
struct device_node *of_find_matching_node(struct device_node *from, struct device_node *of_find_matching_node_and_match(struct device_node *from,
const struct of_device_id *matches) const struct of_device_id *matches,
const struct of_device_id **match)
{ {
struct device_node *np; struct device_node *np;
if (match)
*match = NULL;
read_lock(&devtree_lock); read_lock(&devtree_lock);
np = from ? from->allnext : allnodes; np = from ? from->allnext : of_allnodes;
for (; np; np = np->allnext) { for (; np; np = np->allnext) {
if (of_match_node(matches, np) && of_node_get(np)) if (of_match_node(matches, np) && of_node_get(np)) {
if (match)
*match = matches;
break; break;
}
} }
of_node_put(from); of_node_put(from);
read_unlock(&devtree_lock); read_unlock(&devtree_lock);
...@@ -661,7 +670,7 @@ struct device_node *of_find_node_by_phandle(phandle handle) ...@@ -661,7 +670,7 @@ struct device_node *of_find_node_by_phandle(phandle handle)
struct device_node *np; struct device_node *np;
read_lock(&devtree_lock); read_lock(&devtree_lock);
for (np = allnodes; np; np = np->allnext) for (np = of_allnodes; np; np = np->allnext)
if (np->phandle == handle) if (np->phandle == handle)
break; break;
of_node_get(np); of_node_get(np);
...@@ -670,6 +679,82 @@ struct device_node *of_find_node_by_phandle(phandle handle) ...@@ -670,6 +679,82 @@ struct device_node *of_find_node_by_phandle(phandle handle)
} }
EXPORT_SYMBOL(of_find_node_by_phandle); EXPORT_SYMBOL(of_find_node_by_phandle);
/**
* of_property_read_u8_array - Find and read an array of u8 from a property.
*
* @np: device node from which the property value is to be read.
* @propname: name of the property to be searched.
* @out_value: pointer to return value, modified only if return value is 0.
* @sz: number of array elements to read
*
* Search for a property in a device node and read 8-bit value(s) from
* it. Returns 0 on success, -EINVAL if the property does not exist,
* -ENODATA if property does not have a value, and -EOVERFLOW if the
* property data isn't large enough.
*
* dts entry of array should be like:
* property = /bits/ 8 <0x50 0x60 0x70>;
*
* The out_value is modified only if a valid u8 value can be decoded.
*/
int of_property_read_u8_array(const struct device_node *np,
const char *propname, u8 *out_values, size_t sz)
{
struct property *prop = of_find_property(np, propname, NULL);
const u8 *val;
if (!prop)
return -EINVAL;
if (!prop->value)
return -ENODATA;
if ((sz * sizeof(*out_values)) > prop->length)
return -EOVERFLOW;
val = prop->value;
while (sz--)
*out_values++ = *val++;
return 0;
}
EXPORT_SYMBOL_GPL(of_property_read_u8_array);
/**
* of_property_read_u16_array - Find and read an array of u16 from a property.
*
* @np: device node from which the property value is to be read.
* @propname: name of the property to be searched.
* @out_value: pointer to return value, modified only if return value is 0.
* @sz: number of array elements to read
*
* Search for a property in a device node and read 16-bit value(s) from
* it. Returns 0 on success, -EINVAL if the property does not exist,
* -ENODATA if property does not have a value, and -EOVERFLOW if the
* property data isn't large enough.
*
* dts entry of array should be like:
* property = /bits/ 16 <0x5000 0x6000 0x7000>;
*
* The out_value is modified only if a valid u16 value can be decoded.
*/
int of_property_read_u16_array(const struct device_node *np,
const char *propname, u16 *out_values, size_t sz)
{
struct property *prop = of_find_property(np, propname, NULL);
const __be16 *val;
if (!prop)
return -EINVAL;
if (!prop->value)
return -ENODATA;
if ((sz * sizeof(*out_values)) > prop->length)
return -EOVERFLOW;
val = prop->value;
while (sz--)
*out_values++ = be16_to_cpup(val++);
return 0;
}
EXPORT_SYMBOL_GPL(of_property_read_u16_array);
/** /**
* of_property_read_u32_array - Find and read an array of 32 bit integers * of_property_read_u32_array - Find and read an array of 32 bit integers
* from a property. * from a property.
...@@ -677,6 +762,7 @@ EXPORT_SYMBOL(of_find_node_by_phandle); ...@@ -677,6 +762,7 @@ EXPORT_SYMBOL(of_find_node_by_phandle);
* @np: device node from which the property value is to be read. * @np: device node from which the property value is to be read.
* @propname: name of the property to be searched. * @propname: name of the property to be searched.
* @out_value: pointer to return value, modified only if return value is 0. * @out_value: pointer to return value, modified only if return value is 0.
* @sz: number of array elements to read
* *
* Search for a property in a device node and read 32-bit value(s) from * Search for a property in a device node and read 32-bit value(s) from
* it. Returns 0 on success, -EINVAL if the property does not exist, * it. Returns 0 on success, -EINVAL if the property does not exist,
...@@ -893,8 +979,8 @@ EXPORT_SYMBOL_GPL(of_property_count_strings); ...@@ -893,8 +979,8 @@ EXPORT_SYMBOL_GPL(of_property_count_strings);
* Returns the device_node pointer with refcount incremented. Use * Returns the device_node pointer with refcount incremented. Use
* of_node_put() on it when done. * of_node_put() on it when done.
*/ */
struct device_node * struct device_node *of_parse_phandle(const struct device_node *np,
of_parse_phandle(struct device_node *np, const char *phandle_name, int index) const char *phandle_name, int index)
{ {
const __be32 *phandle; const __be32 *phandle;
int size; int size;
...@@ -1169,9 +1255,9 @@ void of_attach_node(struct device_node *np) ...@@ -1169,9 +1255,9 @@ void of_attach_node(struct device_node *np)
write_lock_irqsave(&devtree_lock, flags); write_lock_irqsave(&devtree_lock, flags);
np->sibling = np->parent->child; np->sibling = np->parent->child;
np->allnext = allnodes; np->allnext = of_allnodes;
np->parent->child = np; np->parent->child = np;
allnodes = np; of_allnodes = np;
write_unlock_irqrestore(&devtree_lock, flags); write_unlock_irqrestore(&devtree_lock, flags);
} }
...@@ -1192,11 +1278,11 @@ void of_detach_node(struct device_node *np) ...@@ -1192,11 +1278,11 @@ void of_detach_node(struct device_node *np)
if (!parent) if (!parent)
goto out_unlock; goto out_unlock;
if (allnodes == np) if (of_allnodes == np)
allnodes = np->allnext; of_allnodes = np->allnext;
else { else {
struct device_node *prev; struct device_node *prev;
for (prev = allnodes; for (prev = of_allnodes;
prev->allnext != np; prev->allnext != np;
prev = prev->allnext) prev = prev->allnext)
; ;
......
...@@ -186,6 +186,8 @@ static unsigned long unflatten_dt_node(struct boot_param_header *blob, ...@@ -186,6 +186,8 @@ static unsigned long unflatten_dt_node(struct boot_param_header *blob,
*/ */
fpsize = 1; fpsize = 1;
allocl = 2; allocl = 2;
l = 1;
*pathp = '\0';
} else { } else {
/* account for '/' and path size minus terminal 0 /* account for '/' and path size minus terminal 0
* already in 'l' * already in 'l'
...@@ -198,10 +200,10 @@ static unsigned long unflatten_dt_node(struct boot_param_header *blob, ...@@ -198,10 +200,10 @@ static unsigned long unflatten_dt_node(struct boot_param_header *blob,
np = unflatten_dt_alloc(&mem, sizeof(struct device_node) + allocl, np = unflatten_dt_alloc(&mem, sizeof(struct device_node) + allocl,
__alignof__(struct device_node)); __alignof__(struct device_node));
if (allnextpp) { if (allnextpp) {
char *fn;
memset(np, 0, sizeof(*np)); memset(np, 0, sizeof(*np));
np->full_name = ((char *)np) + sizeof(struct device_node); np->full_name = fn = ((char *)np) + sizeof(*np);
if (new_format) { if (new_format) {
char *fn = np->full_name;
/* rebuild full path for new format */ /* rebuild full path for new format */
if (dad && dad->parent) { if (dad && dad->parent) {
strcpy(fn, dad->full_name); strcpy(fn, dad->full_name);
...@@ -215,9 +217,9 @@ static unsigned long unflatten_dt_node(struct boot_param_header *blob, ...@@ -215,9 +217,9 @@ static unsigned long unflatten_dt_node(struct boot_param_header *blob,
fn += strlen(fn); fn += strlen(fn);
} }
*(fn++) = '/'; *(fn++) = '/';
memcpy(fn, pathp, l); }
} else memcpy(fn, pathp, l);
memcpy(np->full_name, pathp, l);
prev_pp = &np->properties; prev_pp = &np->properties;
**allnextpp = np; **allnextpp = np;
*allnextpp = &np->allnext; *allnextpp = &np->allnext;
...@@ -459,7 +461,7 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node, ...@@ -459,7 +461,7 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node,
do { do {
u32 tag = be32_to_cpup((__be32 *)p); u32 tag = be32_to_cpup((__be32 *)p);
char *pathp; const char *pathp;
p += 4; p += 4;
if (tag == OF_DT_END_NODE) { if (tag == OF_DT_END_NODE) {
...@@ -487,7 +489,7 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node, ...@@ -487,7 +489,7 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node,
pathp = (char *)p; pathp = (char *)p;
p = ALIGN(p + strlen(pathp) + 1, 4); p = ALIGN(p + strlen(pathp) + 1, 4);
if ((*pathp) == '/') { if ((*pathp) == '/') {
char *lp, *np; const char *lp, *np;
for (lp = NULL, np = pathp; *np; np++) for (lp = NULL, np = pathp; *np; np++)
if ((*np) == '/') if ((*np) == '/')
lp = np+1; lp = np+1;
...@@ -710,7 +712,7 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, ...@@ -710,7 +712,7 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
*/ */
void __init unflatten_device_tree(void) void __init unflatten_device_tree(void)
{ {
__unflatten_device_tree(initial_boot_params, &allnodes, __unflatten_device_tree(initial_boot_params, &of_allnodes,
early_init_dt_alloc_memory_arch); early_init_dt_alloc_memory_arch);
/* Get pointer to "/chosen" and "/aliasas" nodes for use everywhere */ /* Get pointer to "/chosen" and "/aliasas" nodes for use everywhere */
......
...@@ -29,7 +29,7 @@ void of_i2c_register_devices(struct i2c_adapter *adap) ...@@ -29,7 +29,7 @@ void of_i2c_register_devices(struct i2c_adapter *adap)
dev_dbg(&adap->dev, "of_i2c: walking child nodes\n"); dev_dbg(&adap->dev, "of_i2c: walking child nodes\n");
for_each_child_of_node(adap->dev.of_node, node) { for_each_available_child_of_node(adap->dev.of_node, node) {
struct i2c_board_info info = {}; struct i2c_board_info info = {};
struct dev_archdata dev_ad = {}; struct dev_archdata dev_ad = {};
const __be32 *addr; const __be32 *addr;
......
...@@ -53,7 +53,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) ...@@ -53,7 +53,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
return rc; return rc;
/* Loop over the child nodes and register a phy_device for each one */ /* Loop over the child nodes and register a phy_device for each one */
for_each_child_of_node(np, child) { for_each_available_child_of_node(np, child) {
const __be32 *paddr; const __be32 *paddr;
u32 addr; u32 addr;
int len; int len;
......
...@@ -241,15 +241,15 @@ void __init of_pdt_build_devicetree(phandle root_node, struct of_pdt_ops *ops) ...@@ -241,15 +241,15 @@ void __init of_pdt_build_devicetree(phandle root_node, struct of_pdt_ops *ops)
BUG_ON(!ops); BUG_ON(!ops);
of_pdt_prom_ops = ops; of_pdt_prom_ops = ops;
allnodes = of_pdt_create_node(root_node, NULL); of_allnodes = of_pdt_create_node(root_node, NULL);
#if defined(CONFIG_SPARC) #if defined(CONFIG_SPARC)
allnodes->path_component_name = ""; of_allnodes->path_component_name = "";
#endif #endif
allnodes->full_name = "/"; of_allnodes->full_name = "/";
nextp = &allnodes->allnext; nextp = &of_allnodes->allnext;
allnodes->child = of_pdt_build_tree(allnodes, of_allnodes->child = of_pdt_build_tree(of_allnodes,
of_pdt_prom_ops->getchild(allnodes->phandle), &nextp); of_pdt_prom_ops->getchild(of_allnodes->phandle), &nextp);
/* Get pointer to "/chosen" and "/aliasas" nodes for use everywhere */ /* Get pointer to "/chosen" and "/aliasas" nodes for use everywhere */
of_alias_scan(kernel_tree_alloc); of_alias_scan(kernel_tree_alloc);
......
...@@ -819,7 +819,7 @@ static void of_register_spi_devices(struct spi_master *master) ...@@ -819,7 +819,7 @@ static void of_register_spi_devices(struct spi_master *master)
if (!master->dev.of_node) if (!master->dev.of_node)
return; return;
for_each_child_of_node(master->dev.of_node, nc) { for_each_available_child_of_node(master->dev.of_node, nc) {
/* Alloc an spi_device */ /* Alloc an spi_device */
spi = spi_alloc_device(master); spi = spi_alloc_device(master);
if (!spi) { if (!spi) {
......
...@@ -46,7 +46,7 @@ struct device_node { ...@@ -46,7 +46,7 @@ struct device_node {
const char *name; const char *name;
const char *type; const char *type;
phandle phandle; phandle phandle;
char *full_name; const char *full_name;
struct property *properties; struct property *properties;
struct property *deadprops; /* removed properties */ struct property *deadprops; /* removed properties */
...@@ -60,7 +60,7 @@ struct device_node { ...@@ -60,7 +60,7 @@ struct device_node {
unsigned long _flags; unsigned long _flags;
void *data; void *data;
#if defined(CONFIG_SPARC) #if defined(CONFIG_SPARC)
char *path_component_name; const char *path_component_name;
unsigned int unique_id; unsigned int unique_id;
struct of_irq_controller *irq_trans; struct of_irq_controller *irq_trans;
#endif #endif
...@@ -88,14 +88,14 @@ static inline void of_node_put(struct device_node *node) { } ...@@ -88,14 +88,14 @@ static inline void of_node_put(struct device_node *node) { }
#ifdef CONFIG_OF #ifdef CONFIG_OF
/* Pointer for first entry in chain of all nodes. */ /* Pointer for first entry in chain of all nodes. */
extern struct device_node *allnodes; extern struct device_node *of_allnodes;
extern struct device_node *of_chosen; extern struct device_node *of_chosen;
extern struct device_node *of_aliases; extern struct device_node *of_aliases;
extern rwlock_t devtree_lock; extern rwlock_t devtree_lock;
static inline bool of_have_populated_dt(void) static inline bool of_have_populated_dt(void)
{ {
return allnodes != NULL; return of_allnodes != NULL;
} }
static inline bool of_node_is_root(const struct device_node *node) static inline bool of_node_is_root(const struct device_node *node)
...@@ -179,11 +179,22 @@ extern struct device_node *of_find_compatible_node(struct device_node *from, ...@@ -179,11 +179,22 @@ extern struct device_node *of_find_compatible_node(struct device_node *from,
#define for_each_compatible_node(dn, type, compatible) \ #define for_each_compatible_node(dn, type, compatible) \
for (dn = of_find_compatible_node(NULL, type, compatible); dn; \ for (dn = of_find_compatible_node(NULL, type, compatible); dn; \
dn = of_find_compatible_node(dn, type, compatible)) dn = of_find_compatible_node(dn, type, compatible))
extern struct device_node *of_find_matching_node(struct device_node *from, extern struct device_node *of_find_matching_node_and_match(
const struct of_device_id *matches); struct device_node *from,
const struct of_device_id *matches,
const struct of_device_id **match);
static inline struct device_node *of_find_matching_node(
struct device_node *from,
const struct of_device_id *matches)
{
return of_find_matching_node_and_match(from, matches, NULL);
}
#define for_each_matching_node(dn, matches) \ #define for_each_matching_node(dn, matches) \
for (dn = of_find_matching_node(NULL, matches); dn; \ for (dn = of_find_matching_node(NULL, matches); dn; \
dn = of_find_matching_node(dn, matches)) dn = of_find_matching_node(dn, matches))
#define for_each_matching_node_and_match(dn, matches, match) \
for (dn = of_find_matching_node_and_match(NULL, matches, match); \
dn; dn = of_find_matching_node_and_match(dn, matches, match))
extern struct device_node *of_find_node_by_path(const char *path); extern struct device_node *of_find_node_by_path(const char *path);
extern struct device_node *of_find_node_by_phandle(phandle handle); extern struct device_node *of_find_node_by_phandle(phandle handle);
extern struct device_node *of_get_parent(const struct device_node *node); extern struct device_node *of_get_parent(const struct device_node *node);
...@@ -223,6 +234,10 @@ extern struct device_node *of_find_node_with_property( ...@@ -223,6 +234,10 @@ extern struct device_node *of_find_node_with_property(
extern struct property *of_find_property(const struct device_node *np, extern struct property *of_find_property(const struct device_node *np,
const char *name, const char *name,
int *lenp); int *lenp);
extern int of_property_read_u8_array(const struct device_node *np,
const char *propname, u8 *out_values, size_t sz);
extern int of_property_read_u16_array(const struct device_node *np,
const char *propname, u16 *out_values, size_t sz);
extern int of_property_read_u32_array(const struct device_node *np, extern int of_property_read_u32_array(const struct device_node *np,
const char *propname, const char *propname,
u32 *out_values, u32 *out_values,
...@@ -255,7 +270,7 @@ extern int of_n_size_cells(struct device_node *np); ...@@ -255,7 +270,7 @@ extern int of_n_size_cells(struct device_node *np);
extern const struct of_device_id *of_match_node( extern const struct of_device_id *of_match_node(
const struct of_device_id *matches, const struct device_node *node); const struct of_device_id *matches, const struct device_node *node);
extern int of_modalias_node(struct device_node *node, char *modalias, int len); extern int of_modalias_node(struct device_node *node, char *modalias, int len);
extern struct device_node *of_parse_phandle(struct device_node *np, extern struct device_node *of_parse_phandle(const struct device_node *np,
const char *phandle_name, const char *phandle_name,
int index); int index);
extern int of_parse_phandle_with_args(struct device_node *np, extern int of_parse_phandle_with_args(struct device_node *np,
...@@ -364,6 +379,18 @@ static inline struct device_node *of_find_compatible_node( ...@@ -364,6 +379,18 @@ static inline struct device_node *of_find_compatible_node(
return NULL; return NULL;
} }
static inline int of_property_read_u8_array(const struct device_node *np,
const char *propname, u8 *out_values, size_t sz)
{
return -ENOSYS;
}
static inline int of_property_read_u16_array(const struct device_node *np,
const char *propname, u16 *out_values, size_t sz)
{
return -ENOSYS;
}
static inline int of_property_read_u32_array(const struct device_node *np, static inline int of_property_read_u32_array(const struct device_node *np,
const char *propname, const char *propname,
u32 *out_values, size_t sz) u32 *out_values, size_t sz)
...@@ -411,7 +438,7 @@ static inline int of_property_match_string(struct device_node *np, ...@@ -411,7 +438,7 @@ static inline int of_property_match_string(struct device_node *np,
return -ENOSYS; return -ENOSYS;
} }
static inline struct device_node *of_parse_phandle(struct device_node *np, static inline struct device_node *of_parse_phandle(const struct device_node *np,
const char *phandle_name, const char *phandle_name,
int index) int index)
{ {
...@@ -470,6 +497,20 @@ static inline bool of_property_read_bool(const struct device_node *np, ...@@ -470,6 +497,20 @@ static inline bool of_property_read_bool(const struct device_node *np,
return prop ? true : false; return prop ? true : false;
} }
static inline int of_property_read_u8(const struct device_node *np,
const char *propname,
u8 *out_value)
{
return of_property_read_u8_array(np, propname, out_value, 1);
}
static inline int of_property_read_u16(const struct device_node *np,
const char *propname,
u16 *out_value)
{
return of_property_read_u16_array(np, propname, out_value, 1);
}
static inline int of_property_read_u32(const struct device_node *np, static inline int of_property_read_u32(const struct device_node *np,
const char *propname, const char *propname,
u32 *out_value) u32 *out_value)
......
...@@ -266,6 +266,9 @@ $(obj)/%.dtb.S: $(obj)/%.dtb ...@@ -266,6 +266,9 @@ $(obj)/%.dtb.S: $(obj)/%.dtb
quiet_cmd_dtc = DTC $@ quiet_cmd_dtc = DTC $@
cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) -d $(depfile) $< cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) -d $(depfile) $<
$(obj)/%.dtb: $(src)/%.dts FORCE
$(call if_changed_dep,dtc)
# Bzip2 # Bzip2
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
......
...@@ -27,3 +27,5 @@ HOSTCFLAGS_dtc-parser.tab.o := $(HOSTCFLAGS_DTC) ...@@ -27,3 +27,5 @@ HOSTCFLAGS_dtc-parser.tab.o := $(HOSTCFLAGS_DTC)
# dependencies on generated files need to be listed explicitly # dependencies on generated files need to be listed explicitly
$(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h $(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h
# generated files need to be cleaned explicitly
clean-files := dtc-lexer.lex.c dtc-parser.tab.c dtc-parser.tab.h
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment