Commit f64d6e2a authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'devicetree-for-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux

Pull DeviceTree updates from Rob Herring:

 - remove most of_platform_populate() calls in arch code.  Now the DT
   core code calls it in the default case and platforms only need to
   call it if they have special needs

 - use pr_fmt on all the DT core print statements

 - CoreSight binding doc improvements to block name descriptions

 - add dt_to_config script which can parse dts files and list
   corresponding kernel config options

 - fix memory leak hit with a PowerMac DT

 - correct a bunch of STMicro compatible strings to use the correct
   vendor prefix

 - fix DA9052 PMIC binding doc to match what is actually used in dts
   files

* tag 'devicetree-for-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (35 commits)
  documentation: da9052: Update regulator bindings names to match DA9052/53 DTS expectations
  xtensa: Partially Revert "xtensa: Remove unnecessary of_platform_populate with default match table"
  xtensa: Fix build error due to missing include file
  MIPS: ath79: Add missing include file
  Fix spelling errors in Documentation/devicetree
  ARM: dts: fix STMicroelectronics compatible strings
  powerpc/dts: fix STMicroelectronics compatible strings
  Documentation: dt: i2c: use correct STMicroelectronics vendor prefix
  scripts/dtc: dt_to_config - kernel config options for a devicetree
  of: fdt: mark unflattened tree as detached
  of: overlay: add resolver error prints
  coresight: document binding acronyms
  Documentation/devicetree: document cavium-pip rx-delay/tx-delay properties
  of: use pr_fmt prefix for all console printing
  of/irq: Mark initialised interrupt controllers as populated
  of: fix memory leak related to safe_name()
  Revert "of/platform: export of_default_bus_match_table"
  of: unittest: use of_platform_default_populate() to populate default bus
  memory: omap-gpmc: use of_platform_default_populate() to populate default bus
  bus: uniphier-system-bus: use of_platform_default_populate() to populate default bus
  ...
parents 1056c9bd 099c0cbd
......@@ -12,14 +12,33 @@ its hardware characteristcs.
* compatible: These have to be supplemented with "arm,primecell" as
drivers are using the AMBA bus interface. Possible values include:
- "arm,coresight-etb10", "arm,primecell";
- "arm,coresight-tpiu", "arm,primecell";
- "arm,coresight-tmc", "arm,primecell";
- "arm,coresight-funnel", "arm,primecell";
- "arm,coresight-etm3x", "arm,primecell";
- "arm,coresight-etm4x", "arm,primecell";
- "qcom,coresight-replicator1x", "arm,primecell";
- "arm,coresight-stm", "arm,primecell"; [1]
- Embedded Trace Buffer (version 1.0):
"arm,coresight-etb10", "arm,primecell";
- Trace Port Interface Unit:
"arm,coresight-tpiu", "arm,primecell";
- Trace Memory Controller, used for Embedded Trace Buffer(ETB),
Embedded Trace FIFO(ETF) and Embedded Trace Router(ETR)
configuration. The configuration mode (ETB, ETF, ETR) is
discovered at boot time when the device is probed.
"arm,coresight-tmc", "arm,primecell";
- Trace Funnel:
"arm,coresight-funnel", "arm,primecell";
- Embedded Trace Macrocell (version 3.x) and
Program Flow Trace Macrocell:
"arm,coresight-etm3x", "arm,primecell";
- Embedded Trace Macrocell (version 4.x):
"arm,coresight-etm4x", "arm,primecell";
- Qualcomm Configurable Replicator (version 1.x):
"qcom,coresight-replicator1x", "arm,primecell";
- System Trace Macrocell:
"arm,coresight-stm", "arm,primecell"; [1]
* reg: physical base address and length of the register
set(s) of the component.
......
......@@ -86,10 +86,10 @@ Optional properties:
firmware)
- arm,dynamic-clock-gating : L2 dynamic clock gating. Value: <0> (forcibly
disable), <1> (forcibly enable), property absent (OS specific behavior,
preferrably retain firmware settings)
preferably retain firmware settings)
- arm,standby-mode: L2 standby mode enable. Value <0> (forcibly disable),
<1> (forcibly enable), property absent (OS specific behavior,
preferrably retain firmware settings)
preferably retain firmware settings)
Example:
......
......@@ -146,10 +146,10 @@ samsung,24ad0xd1 S524AD0XF1 (128K/256K-bit Serial EEPROM for Low Power)
sgx,vz89x SGX Sensortech VZ89X Sensors
sii,s35390a 2-wire CMOS real-time clock
skyworks,sky81452 Skyworks SKY81452: Six-Channel White LED Driver with Touch Panel Bias Supply
st-micro,24c256 i2c serial eeprom (24cxx)
stm,m41t00 Serial Access TIMEKEEPER
stm,m41t62 Serial real-time clock (RTC) with alarm
stm,m41t80 M41T80 - SERIAL ACCESS RTC WITH ALARMS
st,24c256 i2c serial eeprom (24cxx)
st,m41t00 Serial real-time clock (RTC)
st,m41t62 Serial real-time clock (RTC) with alarm
st,m41t80 M41T80 - SERIAL ACCESS RTC WITH ALARMS
taos,tsl2550 Ambient Light Sensor with SMBUS/Two Wire Serial Interface
ti,ads7828 8-Channels, 12-bit ADC
ti,ads7830 8-Channels, 8-bit ADC
......
......@@ -8,10 +8,13 @@ Sub-nodes:
- regulators : Contain the regulator nodes. The DA9052/53 regulators are
bound using their names as listed below:
buck0 : regulator BUCK0
buck1 : regulator BUCK1
buck2 : regulator BUCK2
buck3 : regulator BUCK3
buck1 : regulator BUCK CORE
buck2 : regulator BUCK PRO
buck3 : regulator BUCK MEM
buck4 : regulator BUCK PERI
ldo1 : regulator LDO1
ldo2 : regulator LDO2
ldo3 : regulator LDO3
ldo4 : regulator LDO4
ldo5 : regulator LDO5
ldo6 : regulator LDO6
......@@ -19,9 +22,6 @@ Sub-nodes:
ldo8 : regulator LDO8
ldo9 : regulator LDO9
ldo10 : regulator LDO10
ldo11 : regulator LDO11
ldo12 : regulator LDO12
ldo13 : regulator LDO13
The bindings details of individual regulator device can be found in:
Documentation/devicetree/bindings/regulator/regulator.txt
......@@ -36,22 +36,22 @@ i2c@63fc8000 { /* I2C1 */
reg = <0x48>;
regulators {
buck0 {
buck1 {
regulator-min-microvolt = <500000>;
regulator-max-microvolt = <2075000>;
};
buck1 {
buck2 {
regulator-min-microvolt = <500000>;
regulator-max-microvolt = <2075000>;
};
buck2 {
buck3 {
regulator-min-microvolt = <925000>;
regulator-max-microvolt = <2500000>;
};
buck3 {
buck4 {
regulator-min-microvolt = <925000>;
regulator-max-microvolt = <2500000>;
};
......
......@@ -37,6 +37,12 @@ Properties for PIP port which is a child the PIP interface:
- phy-handle: Optional, see ethernet.txt file in the same directory.
- rx-delay: Delay value for RGMII receive clock. Optional. Disabled if 0.
Value range is 1-31, and mapping to the actual delay varies depending on HW.
- tx-delay: Delay value for RGMII transmit clock. Optional. Disabled if 0.
Value range is 1-31, and mapping to the actual delay varies depending on HW.
Example:
pip@11800a0000000 {
......
......@@ -317,7 +317,7 @@ Each port children node must have the following mandatory properties:
Note that a port labelled "dsa" will imply checking for the uplink phandle
described below.
Optionnal property:
Optional property:
- link : Should be a list of phandles to another switch's DSA port.
This property is only used when switches are being
chained/cascaded together. This port is used as outgoing port
......
......@@ -35,7 +35,7 @@ PROPERTIES
Definition: Specifies the index of the FMan unit.
The cell-index value may be used by the SoC, to identify the
FMan unit in the SoC memory map. In the table bellow,
FMan unit in the SoC memory map. In the table below,
there's a description of the cell-index use in each SoC:
- P1023:
......@@ -247,7 +247,7 @@ PROPERTIES
The cell-index value may be used by the FMan or the SoC, to
identify the MAC unit in the FMan (or SoC) memory map.
In the tables bellow there's a description of the cell-index
In the tables below there's a description of the cell-index
use, there are two tables, one describes the use of cell-index
by the FMan, the second describes the use by the SoC:
......
......@@ -14,7 +14,7 @@ architectures that typically run big-endian operating systems
be marked that way in the devicetree.
On SoCs that can be operated in both big-endian and little-endian
modes, with a single hardware switch controlling both the endianess
modes, with a single hardware switch controlling both the endianness
of the CPU and a byteswap for MMIO registers (e.g. many Broadcom MIPS
chips), "native-endian" is used to allow using the same device tree
blob in both cases.
......
......@@ -28,10 +28,10 @@ Optional properties:
- dma-names: Should contain "tx" for transmit and "rx" for receive channels
- qcom,tx-crci: Identificator <u32> for Client Rate Control Interface to be
used with TX DMA channel. Required when using DMA for transmission
with UARTDM v1.3 and bellow.
with UARTDM v1.3 and below.
- qcom,rx-crci: Identificator <u32> for Client Rate Control Interface to be
used with RX DMA channel. Required when using DMA for reception
with UARTDM v1.3 and bellow.
with UARTDM v1.3 and below.
Note: Aliases may be defined to ensure the correct ordering of the UARTs.
The alias serialN will result in the UART being assigned port N. If any
......
......@@ -30,7 +30,7 @@ Optional subnodes:
sub-nodes. This container may be
omitted when the card has only one
DAI link. See the examples and the
section bellow.
section below.
Dai-link subnode properties and subnodes:
......
......@@ -9,7 +9,7 @@ Required properties:
one)
- clocks: phandle to the source clock (usually the AHB clock)
Optionnal properties:
Optional properties:
- resets: phandle to a reset controller asserting the timer
Example:
......
......@@ -15,7 +15,6 @@
#include <linux/cpu.h>
#include <linux/of_fdt.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/cache.h>
#include <asm/sections.h>
#include <asm/arcregs.h>
......@@ -436,12 +435,6 @@ void __init setup_arch(char **cmdline_p)
static int __init customize_machine(void)
{
/*
* Traverses flattened DeviceTree - registering platform devices
* (if any) complete with their resources
*/
of_platform_default_populate(NULL, NULL, NULL);
if (machine_desc->init_machine)
machine_desc->init_machine();
......
......@@ -37,7 +37,7 @@ i2c0: i2c@80058000 {
status = "okay";
rtc: rtc@68 {
compatible = "stm,m41t62";
compatible = "st,m41t62";
reg = <0x68>;
};
};
......
......@@ -102,7 +102,7 @@ &i2c2 {
status = "okay";
rtc: m41t00@68 {
compatible = "stm,m41t00";
compatible = "st,m41t00";
reg = <0x68>;
};
};
......
......@@ -84,7 +84,7 @@ eeprom: eeprom@50 {
};
rtc: rtc@68 {
compatible = "stm,m41t62";
compatible = "st,m41t62";
reg = <0x68>;
};
};
......
......@@ -282,7 +282,7 @@ temp2: ad7414@4d {
};
rtc: m41t62@68 {
compatible = "stm,m41t62";
compatible = "st,m41t62";
reg = <0x68>;
};
};
......
......@@ -52,7 +52,7 @@ &i2c0 {
status = "okay";
rtc: rtc@68 {
compatible = "stm,m41t82";
compatible = "st,m41t82";
reg = <0x68>;
};
};
......
......@@ -19,7 +19,6 @@
#include <linux/bootmem.h>
#include <linux/seq_file.h>
#include <linux/screen_info.h>
#include <linux/of_iommu.h>
#include <linux/of_platform.h>
#include <linux/init.h>
#include <linux/kexec.h>
......@@ -903,14 +902,9 @@ static int __init customize_machine(void)
* machine from the device tree, if no callback is provided,
* otherwise we would always need an init_machine callback.
*/
of_iommu_init();
if (machine_desc->init_machine)
machine_desc->init_machine();
#ifdef CONFIG_OF
else
of_platform_populate(NULL, of_default_bus_match_table,
NULL, NULL);
#endif
return 0;
}
arch_initcall(customize_machine);
......
......@@ -13,7 +13,6 @@
#include <linux/irqchip.h>
#include <linux/irqchip/arm-gic.h>
#include <linux/mfd/syscon.h>
#include <linux/of_platform.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/clk-provider.h>
......@@ -44,8 +43,6 @@ static void __init artpec6_init_machine(void)
regmap_write(regmap, ARTPEC6_DMACFG_REGNUM,
ARTPEC6_DMACFG_UARTS_BURST);
};
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
}
static void artpec6_l2c310_write_sec(unsigned long val, unsigned reg)
......
......@@ -30,7 +30,7 @@ static void __init at91rm9200_dt_device_init(void)
if (soc != NULL)
soc_dev = soc_device_to_device(soc);
of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev);
of_platform_default_populate(NULL, NULL, soc_dev);
at91rm9200_pm_init();
}
......
......@@ -61,7 +61,7 @@ static void __init at91sam9_common_init(void)
if (soc != NULL)
soc_dev = soc_device_to_device(soc);
of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev);
of_platform_default_populate(NULL, NULL, soc_dev);
}
static void __init at91sam9_dt_device_init(void)
......
......@@ -68,7 +68,7 @@ static void __init sama5_dt_device_init(void)
if (soc != NULL)
soc_dev = soc_device_to_device(soc);
of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev);
of_platform_default_populate(NULL, NULL, soc_dev);
sama5_pm_init();
}
......
......@@ -12,7 +12,6 @@
*/
#include <linux/of_address.h>
#include <linux/of_platform.h>
#include <linux/io.h>
#include <asm/mach/arch.h>
......@@ -60,7 +59,6 @@ static void bcm21664_restart(enum reboot_mode mode, const char *cmd)
static void __init bcm21664_init(void)
{
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
kona_l2_cache_init();
}
......
......@@ -13,7 +13,6 @@
#include <linux/clocksource.h>
#include <linux/of_address.h>
#include <linux/of_platform.h>
#include <asm/mach/arch.h>
......@@ -58,7 +57,6 @@ static void bcm281xx_restart(enum reboot_mode mode, const char *cmd)
static void __init bcm281xx_init(void)
{
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
kona_l2_cache_init();
}
......
......@@ -15,7 +15,6 @@
#include <linux/init.h>
#include <linux/irqchip.h>
#include <linux/of_address.h>
#include <linux/of_platform.h>
#include <linux/clk/bcm2835.h>
#include <asm/mach/arch.h>
......@@ -23,16 +22,7 @@
static void __init bcm2835_init(void)
{
int ret;
bcm2835_init_clocks();
ret = of_platform_populate(NULL, of_default_bus_match_table, NULL,
NULL);
if (ret) {
pr_err("of_platform_populate failed: %d\n", ret);
BUG();
}
}
static const char * const bcm2835_compat[] = {
......
......@@ -395,8 +395,7 @@ static void __init cns3xxx_init(void)
pm_power_off = cns3xxx_power_off;
of_platform_populate(NULL, of_default_bus_match_table,
cns3xxx_auxdata, NULL);
of_platform_default_populate(NULL, cns3xxx_auxdata, NULL);
}
static const char *const cns3xxx_dt_compat[] __initconst = {
......
......@@ -14,7 +14,6 @@
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_fdt.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/irqchip.h>
#include <linux/soc/samsung/exynos-regs-pmu.h>
......@@ -217,8 +216,6 @@ static void __init exynos_dt_machine_init(void)
of_machine_is_compatible("samsung,exynos3250") ||
of_machine_is_compatible("samsung,exynos5250"))
platform_device_register(&exynos_cpuidle);
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
}
static char const *const exynos_dt_compat[] __initconst = {
......
......@@ -23,7 +23,6 @@
#include <linux/pl320-ipc.h>
#include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/of_platform.h>
#include <linux/of_address.h>
#include <linux/reboot.h>
#include <linux/amba/bus.h>
......@@ -163,8 +162,6 @@ static void __init highbank_init(void)
pl320_ipc_register_notifier(&hb_keys_nb);
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
if (psci_ops.cpu_suspend)
platform_device_register(&highbank_cpuidle_device);
}
......
......@@ -52,8 +52,6 @@ static void __init imx51_dt_init(void)
{
imx51_ipu_mipi_setup();
imx_src_init();
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
}
static void __init imx51_init_late(void)
......
......@@ -32,8 +32,6 @@ static void __init imx53_dt_init(void)
{
imx_src_init();
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
imx_aips_allow_unprivileged_access("fsl,imx53-aipstz");
}
......
......@@ -278,7 +278,7 @@ static void __init imx6q_init_machine(void)
imx6q_enet_phy_init();
of_platform_populate(NULL, of_default_bus_match_table, NULL, parent);
of_platform_default_populate(NULL, NULL, parent);
imx_anatop_init();
cpu_is_imx6q() ? imx6q_pm_init() : imx6dl_pm_init();
......
......@@ -52,7 +52,7 @@ static void __init imx6sl_init_machine(void)
if (parent == NULL)
pr_warn("failed to initialize soc device\n");
of_platform_populate(NULL, of_default_bus_match_table, NULL, parent);
of_platform_default_populate(NULL, NULL, parent);
imx6sl_fec_init();
imx_anatop_init();
......
......@@ -72,7 +72,7 @@ static void __init imx6sx_init_machine(void)
if (parent == NULL)
pr_warn("failed to initialize soc device\n");
of_platform_populate(NULL, of_default_bus_match_table, NULL, parent);
of_platform_default_populate(NULL, NULL, parent);
imx6sx_enet_init();
imx_anatop_init();
......
......@@ -64,7 +64,6 @@ static void __init imx6ul_init_machine(void)
if (parent == NULL)
pr_warn("failed to initialize soc device\n");
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
imx6ul_enet_init();
imx_anatop_init();
imx6ul_pm_init();
......
......@@ -93,7 +93,6 @@ static void __init imx7d_init_machine(void)
if (parent == NULL)
pr_warn("failed to initialize soc device\n");
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
imx_anatop_init();
imx7d_enet_init();
}
......
......@@ -240,8 +240,7 @@ static void __init ap_init_of(void)
if (!ebi_base)
return;
of_platform_populate(NULL, of_default_bus_match_table,
ap_auxdata_lookup, NULL);
of_platform_default_populate(NULL, ap_auxdata_lookup, NULL);
sc_dec = readl(ap_syscon_base + INTEGRATOR_SC_DEC_OFFSET);
for (i = 0; i < 4; i++) {
......
......@@ -231,8 +231,7 @@ static void __init intcp_init_of(void)
if (!intcp_con_base)
return;
of_platform_populate(NULL, of_default_bus_match_table,
intcp_auxdata_lookup, NULL);
of_platform_default_populate(NULL, intcp_auxdata_lookup, NULL);
}
static const char * intcp_dt_board_compat[] = {
......
......@@ -60,7 +60,6 @@ static void __init keystone_init(void)
bus_register_notifier(&platform_bus_type, &platform_nb);
}
keystone_pm_runtime_init();
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
}
static long long __init keystone_pv_fixup(void)
......
......@@ -191,8 +191,7 @@ static void __init lpc3250_machine_init(void)
LPC32XX_CLKPWR_TESTCLK_TESTCLK2_EN,
LPC32XX_CLKPWR_TEST_CLK_SEL);
of_platform_populate(NULL, of_default_bus_match_table,
lpc32xx_auxdata_lookup, NULL);
of_platform_default_populate(NULL, lpc32xx_auxdata_lookup, NULL);
}
static const char *const lpc32xx_dt_compat[] __initconst = {
......
......@@ -16,7 +16,6 @@
#include <linux/init.h>
#include <linux/of_address.h>
#include <linux/of_fdt.h>
#include <linux/of_platform.h>
#include <linux/io.h>
#include <linux/clocksource.h>
#include <linux/dma-mapping.h>
......@@ -144,8 +143,6 @@ static void __init mvebu_dt_init(void)
{
if (of_machine_is_compatible("marvell,armadaxp"))
i2c_quirk();
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
}
static const char * const armada_370_xp_dt_compat[] __initconst = {
......
......@@ -11,7 +11,6 @@
#include <linux/init.h>
#include <linux/mbus.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/soc/dove/pmu.h>
#include <asm/hardware/cache-tauros2.h>
#include <asm/mach/arch.h>
......@@ -26,7 +25,6 @@ static void __init dove_init(void)
#endif
BUG_ON(mvebu_mbus_dt_init(false));
dove_init_pmu();
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
}
static const char * const dove_dt_compat[] __initconst = {
......
......@@ -179,7 +179,7 @@ static void __init kirkwood_dt_init(void)
kirkwood_pm_init();
kirkwood_dt_eth_fixup();
of_platform_populate(NULL, of_default_bus_match_table, auxdata, NULL);
of_platform_default_populate(NULL, auxdata, NULL);
}
static const char * const kirkwood_dt_board_compat[] __initconst = {
......
......@@ -498,8 +498,7 @@ static void __init mxs_machine_init(void)
else if (of_machine_is_compatible("msr,m28cu3"))
m28cu3_init();
of_platform_populate(NULL, of_default_bus_match_table,
NULL, parent);
of_platform_default_populate(NULL, NULL, parent);
mxs_restart_init();
......
......@@ -57,8 +57,7 @@ static struct of_dev_auxdata nspire_auxdata[] __initdata = {
static void __init nspire_init(void)
{
of_platform_populate(NULL, of_default_bus_match_table,
nspire_auxdata, NULL);
of_platform_default_populate(NULL, nspire_auxdata, NULL);
}
static void nspire_restart(enum reboot_mode mode, const char *cmd)
......
......@@ -63,8 +63,7 @@ static void __init orion5x_dt_init(void)
if (of_machine_is_compatible("maxtor,shared-storage-2"))
mss2_init();
of_platform_populate(NULL, of_default_bus_match_table,
orion5x_auxdata_lookup, NULL);
of_platform_default_populate(NULL, orion5x_auxdata_lookup, NULL);
}
static const char *orion5x_dt_compat[] = {
......
......@@ -10,7 +10,6 @@
#include <linux/delay.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_platform.h>
#include <linux/reboot.h>
#include <asm/mach/arch.h>
......@@ -54,7 +53,6 @@ static void __init picoxcell_map_io(void)
static void __init picoxcell_init_machine(void)
{
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
picoxcell_setup_restart();
}
......
......@@ -73,7 +73,6 @@ static void __init rockchip_timer_init(void)
static void __init rockchip_dt_init(void)
{
rockchip_suspend_init();
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
}
static const char * const rockchip_board_dt_compat[] = {
......
......@@ -17,7 +17,6 @@
#include <linux/clocksource.h>
#include <linux/irqchip.h>
#include <linux/of_platform.h>
#include <linux/serial_s3c.h>
#include <asm/mach/arch.h>
......@@ -35,7 +34,6 @@ static void __init s3c2416_dt_map_io(void)
static void __init s3c2416_dt_machine_init(void)
{
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
s3c_pm_init();
}
......
......@@ -8,8 +8,6 @@
* published by the Free Software Foundation.
*/
#include <linux/of_platform.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/system_misc.h>
......@@ -48,7 +46,6 @@ static void __init s3c64xx_dt_map_io(void)
static void __init s3c64xx_dt_init_machine(void)
{
samsung_wdt_reset_of_init();
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
}
static void s3c64xx_dt_restart(enum reboot_mode mode, const char *cmd)
......
......@@ -18,7 +18,6 @@
#include <linux/io.h>
#include <linux/irqchip.h>
#include <linux/irqchip/arm-gic.h>
#include <linux/of_platform.h>
#include <asm/mach/map.h>
#include <asm/mach/arch.h>
......@@ -77,8 +76,6 @@ static void __init r8a7740_init_irq_of(void)
static void __init r8a7740_generic_init(void)
{
r8a7740_meram_workaround();
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
}
static const char *const r8a7740_boards_compat_dt[] __initconst = {
......
......@@ -18,7 +18,6 @@
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/of_platform.h>
#include <linux/delay.h>
#include <linux/input.h>
#include <linux/io.h>
......@@ -55,7 +54,6 @@ static void __init sh73a0_generic_init(void)
/* Shared attribute override enable, 64K*8way */
l2x0_init(IOMEM(0xf0100000), 0x00400000, 0xc20f0fff);
#endif
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
}
static const char *const sh73a0_boards_compat_dt[] __initconst = {
......
......@@ -14,7 +14,6 @@
#define pr_fmt(fmt) "SPEAr1310: " fmt
#include <linux/amba/pl022.h>
#include <linux/of_platform.h>
#include <linux/pata_arasan_cf_data.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
......@@ -27,7 +26,6 @@
static void __init spear1310_dt_init(void)
{
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
platform_device_register_simple("spear-cpufreq", -1, NULL, 0);
}
......
......@@ -19,7 +19,6 @@
static void __init spear1340_dt_init(void)
{
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
platform_device_register_simple("spear-cpufreq", -1, NULL, 0);
}
......
......@@ -194,8 +194,7 @@ static void __init spear300_dt_init(void)
pl080_plat_data.slave_channels = spear300_dma_info;
pl080_plat_data.num_slave_channels = ARRAY_SIZE(spear300_dma_info);
of_platform_populate(NULL, of_default_bus_match_table,
spear300_auxdata_lookup, NULL);
of_platform_default_populate(NULL, spear300_auxdata_lookup, NULL);
}
static const char * const spear300_dt_board_compat[] = {
......
......@@ -236,8 +236,7 @@ static void __init spear310_dt_init(void)
pl080_plat_data.slave_channels = spear310_dma_info;
pl080_plat_data.num_slave_channels = ARRAY_SIZE(spear310_dma_info);
of_platform_populate(NULL, of_default_bus_match_table,
spear310_auxdata_lookup, NULL);
of_platform_default_populate(NULL, spear310_auxdata_lookup, NULL);
}
static const char * const spear310_dt_board_compat[] = {
......
......@@ -240,8 +240,7 @@ static void __init spear320_dt_init(void)
pl080_plat_data.slave_channels = spear320_dma_info;
pl080_plat_data.num_slave_channels = ARRAY_SIZE(spear320_dma_info);
of_platform_populate(NULL, of_default_bus_match_table,
spear320_auxdata_lookup, NULL);
of_platform_default_populate(NULL, spear320_auxdata_lookup, NULL);
}
static const char * const spear320_dt_board_compat[] = {
......
......@@ -411,8 +411,7 @@ struct of_dev_auxdata spear6xx_auxdata_lookup[] __initdata = {
static void __init spear600_dt_init(void)
{
of_platform_populate(NULL, of_default_bus_match_table,
spear6xx_auxdata_lookup, NULL);
of_platform_default_populate(NULL, spear6xx_auxdata_lookup, NULL);
}
static const char *spear600_dt_board_compat[] = {
......
......@@ -115,7 +115,7 @@ static void __init tegra_dt_init(void)
* devices
*/
out:
of_platform_populate(NULL, of_default_bus_match_table, NULL, parent);
of_platform_default_populate(NULL, NULL, parent);
}
static void __init paz00_init(void)
......
......@@ -391,8 +391,7 @@ static void __init u300_init_machine_dt(void)
pinctrl_register_mappings(u300_pinmux_map,
ARRAY_SIZE(u300_pinmux_map));
of_platform_populate(NULL, of_default_bus_match_table,
u300_auxdata_lookup, NULL);
of_platform_default_populate(NULL, u300_auxdata_lookup, NULL);
/* Enable SEMI self refresh */
val = readw(syscon_base + U300_SYSCON_SMCR) |
......
......@@ -344,8 +344,7 @@ static void __init versatile_dt_init(void)
versatile_dt_pci_init();
of_platform_populate(NULL, of_default_bus_match_table,
versatile_auxdata_lookup, NULL);
of_platform_default_populate(NULL, versatile_auxdata_lookup, NULL);
}
static const char *const versatile_dt_match[] __initconst = {
......
......@@ -30,7 +30,6 @@
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/of_platform.h>
#define LEGACY_GPIO_BASE 0xD8110000
#define LEGACY_PMC_BASE 0xD8130000
......@@ -158,8 +157,6 @@ static void __init vt8500_init(void)
pm_power_off = &vt8500_power_off;
else
pr_err("%s: PMC Hibernation register could not be remapped, not enabling power off!\n", __func__);
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
}
static const char * const vt8500_dt_compat[] = {
......
......@@ -141,7 +141,7 @@ static void __init zynq_init_machine(void)
* Finished with the static registrations now; fill in the missing
* devices
*/
of_platform_populate(NULL, of_default_bus_match_table, NULL, parent);
of_platform_default_populate(NULL, NULL, parent);
platform_device_register(&zynq_cpuidle_device);
}
......
......@@ -39,9 +39,7 @@
#include <linux/fs.h>
#include <linux/proc_fs.h>
#include <linux/memblock.h>
#include <linux/of_iommu.h>
#include <linux/of_fdt.h>
#include <linux/of_platform.h>
#include <linux/efi.h>
#include <linux/psci.h>
......@@ -303,19 +301,6 @@ void __init setup_arch(char **cmdline_p)
}
}
static int __init arm64_device_init(void)
{
if (of_have_populated_dt()) {
of_iommu_init();
of_platform_populate(NULL, of_default_bus_match_table,
NULL, NULL);
} else if (acpi_disabled) {
pr_crit("Device tree not populated\n");
}
return 0;
}
arch_initcall_sync(arm64_device_init);
static int __init topology_init(void)
{
int i;
......
......@@ -4,7 +4,7 @@
# Copyright 2010, 2011 Texas Instruments Incorporated
#
obj-y = platform.o cache.o megamod-pic.o pll.o plldata.o timer64.o
obj-y = cache.o megamod-pic.o pll.o plldata.o timer64.o
obj-y += dscr.o
# SoC objects
......
/*
* Copyright 2011 Texas Instruments Incorporated
*
* This file is licensed under the terms of the GNU General Public License
* version 2. This program is licensed "as is" without any warranty of any
* kind, whether express or implied.
*/
#include <linux/init.h>
#include <linux/of_platform.h>
static int __init c6x_device_probe(void)
{
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
return 0;
}
core_initcall(c6x_device_probe);
......@@ -21,7 +21,6 @@
#include <linux/cpu.h>
#include <linux/of.h>
#include <linux/of_fdt.h>
#include <linux/of_platform.h>
#include <asm/setup.h>
#include <arch/system.h>
......@@ -212,10 +211,3 @@ static int __init topology_init(void)
}
subsys_initcall(topology_init);
static int __init cris_of_init(void)
{
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
return 0;
}
core_initcall(cris_of_init);
......@@ -20,7 +20,6 @@
#include <linux/memblock.h>
#include <linux/mm.h>
#include <linux/of_fdt.h>
#include <linux/of_platform.h>
#include <linux/pfn.h>
#include <linux/root_dev.h>
#include <linux/sched.h>
......@@ -414,9 +413,7 @@ static int __init customize_machine(void)
/* customizes platform devices, or adds new ones */
if (machine_desc->init_machine)
machine_desc->init_machine();
else
of_platform_populate(NULL, of_default_bus_match_table, NULL,
NULL);
return 0;
}
arch_initcall(customize_machine);
......
......@@ -18,7 +18,6 @@
#include <linux/err.h>
#include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/of_platform.h>
#include <linux/of_fdt.h>
#include <asm/bootinfo.h>
......@@ -285,7 +284,6 @@ void __init plat_time_init(void)
static int __init ath79_setup(void)
{
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
if (mips_machtype == ATH79_MACH_GENERIC_OF)
return 0;
......
......@@ -20,7 +20,6 @@
#include <linux/kernel.h>
#include <linux/libfdt.h>
#include <linux/of_fdt.h>
#include <linux/of_platform.h>
#include <asm/bootinfo.h>
#include <asm/prom.h>
......@@ -74,13 +73,6 @@ void __init device_tree_init(void)
unflatten_and_copy_device_tree();
}
static int __init populate_machine(void)
{
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
return 0;
}
arch_initcall(populate_machine);
const char *get_system_type(void)
{
if (config_enabled(CONFIG_MACH_JZ4780))
......
......@@ -8,7 +8,6 @@
*/
#include <linux/init.h>
#include <linux/libfdt.h>
#include <linux/of_platform.h>
#include <linux/of_fdt.h>
#include <asm/prom.h>
......@@ -107,10 +106,3 @@ void __init device_tree_init(void)
unflatten_and_copy_device_tree();
}
static int __init customize_machine(void)
{
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
return 0;
}
arch_initcall(customize_machine);
......@@ -147,8 +147,7 @@ static int __init plat_of_setup(void)
panic("Device tree not present");
pic32_of_prepare_platform_data(pic32_auxdata_lookup);
if (of_platform_populate(NULL, of_default_bus_match_table,
pic32_auxdata_lookup, NULL))
if (of_platform_default_populate(NULL, pic32_auxdata_lookup, NULL))
panic("Failed to populate DT");
return 0;
......
......@@ -14,7 +14,6 @@
#include <linux/kernel.h>
#include <linux/of_address.h>
#include <linux/of_fdt.h>
#include <linux/of_platform.h>
#include <asm/cacheflush.h>
#include <asm/dma-coherence.h>
......@@ -159,15 +158,3 @@ void __init device_tree_init(void)
unflatten_and_copy_device_tree();
}
static int __init plat_of_setup(void)
{
if (!of_have_populated_dt())
panic("Device tree not present");
if (of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL))
panic("Failed to populate DT");
return 0;
}
arch_initcall(plat_of_setup);
......@@ -10,7 +10,6 @@
*/
#include <linux/of_fdt.h>
#include <linux/of_platform.h>
#include <asm/prom.h>
......@@ -43,15 +42,3 @@ void __init device_tree_init(void)
unflatten_and_copy_device_tree();
}
static int __init plat_of_setup(void)
{
if (!of_have_populated_dt())
panic("Device tree not present");
if (of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL))
panic("Failed to populate DT");
return 0;
}
arch_initcall(plat_of_setup);
......@@ -9,7 +9,6 @@
*/
#include <linux/init.h>
#include <linux/of_platform.h>
#include <linux/of_address.h>
#include <linux/of_fdt.h>
#include <linux/err.h>
......@@ -39,8 +38,7 @@ static int __init nios2_soc_device_init(void)
}
}
return of_platform_populate(NULL, of_default_bus_match_table,
NULL, NULL);
return 0;
}
device_initcall(nios2_soc_device_init);
......@@ -231,7 +231,7 @@ at24@57 {
};
rtc@68 {
compatible = "stm,m41t00";
compatible = "st,m41t00";
reg = <0x68>;
};
};
......
......@@ -224,7 +224,7 @@ IIC0: i2c@00000000 {
#address-cells = <1>;
#size-cells = <0>;
rtc@68 {
compatible = "stm,m41t80", "m41st85";
compatible = "st,m41t80", "m41st85";
reg = <0x68>;
};
};
......
......@@ -279,7 +279,7 @@ IIC0: i2c@ef600700 {
#address-cells = <1>;
#size-cells = <0>;
rtc@68 {
compatible = "stm,m41t80";
compatible = "st,m41t80";
reg = <0x68>;
interrupt-parent = <&UIC0>;
interrupts = <0x9 0x8>;
......
......@@ -319,7 +319,7 @@ IIC0: i2c@ef600700 {
#address-cells = <1>;
#size-cells = <0>;
rtc@68 {
compatible = "stm,m41t80";
compatible = "st,m41t80";
reg = <0x68>;
interrupt-parent = <&UIC2>;
interrupts = <0x19 0x8>;
......
......@@ -116,7 +116,7 @@ IIC0: i2c@00000000 {
#address-cells = <1>;
#size-cells = <0>;
rtc@68 {
compatible = "stm,m41t80", "m41st85";
compatible = "st,m41t80", "m41st85";
reg = <0x68>;
};
};
......
......@@ -232,7 +232,7 @@ spi@4c0 {
mode = "cpu-qe";
serial-flash@0 {
compatible = "stm,m25p40";
compatible = "st,m25p40";
reg = <0>;
spi-max-frequency = <25000000>;
};
......
......@@ -57,7 +57,7 @@ wm8960:codec@1a {
clock-frequency = <12288000>;
};
rtc@68 {
compatible = "stm,m41t62";
compatible = "st,m41t62";
reg = <0x68>;
};
adt7461@4c{
......
......@@ -287,7 +287,7 @@ IIC0: i2c@ef600700 {
#address-cells = <1>;
#size-cells = <0>;
rtc@68 {
compatible = "stm,m41t80";
compatible = "st,m41t80";
reg = <0x68>;
interrupt-parent = <&UIC2>;
interrupts = <0x19 0x8>;
......
......@@ -256,7 +256,7 @@ IIC1: i2c@f0000500 {
#size-cells = <0>;
rtc@68 {
compatible = "stm,m41t00";
compatible = "st,m41t00";
reg = <0x68>;
};
};
......
......@@ -99,7 +99,7 @@ eeprom@50 {
};
rtc@68 {
compatible = "stm,m41t62";
compatible = "st,m41t62";
reg = <0x68>;
};
};
......
......@@ -92,7 +92,7 @@ i2c@3000 {
dfsrr;
eeprom: at24@50 {
compatible = "st-micro,24c256";
compatible = "st,24c256";
reg = <0x50>;
};
......
......@@ -416,7 +416,7 @@ upm@1,0 {
gpios = <&qe_pio_e 18 0>;
flash {
compatible = "stm,nand512-a";
compatible = "st,nand512-a";
};
};
......
......@@ -103,7 +103,7 @@ eeprom@50 {
};
rtc@68 {
compatible = "stm,m41t00";
compatible = "st,m41t00";
reg = <0x68>;
};
};
......
......@@ -196,7 +196,7 @@ IIC0: i2c@ef600700 {
interrupt-parent = <&UIC0>;
interrupts = <2 4>;
rtc@68 {
compatible = "stm,m41t80";
compatible = "st,m41t80";
reg = <0x68>;
};
};
......
......@@ -238,7 +238,7 @@ eeprom@54 {
};
rtc@68 {
compatible = "stm,m41t00",
compatible = "st,m41t00",
"dallas,ds1338";
reg = <0x68>;
};
......
......@@ -130,7 +130,7 @@ eeprom@50 {
};
rtc@68 {
compatible = "stm,m41t00",
compatible = "st,m41t00",
"dallas,ds1338";
reg = <0x68>;
};
......
......@@ -134,7 +134,7 @@ eeprom@50 {
};
rtc@68 {
compatible = "stm,m41t00",
compatible = "st,m41t00",
"dallas,ds1338";
reg = <0x68>;
};
......
......@@ -231,7 +231,7 @@ eeprom@54 {
};
rtc@68 {
compatible = "stm,m41t00",
compatible = "st,m41t00",
"dallas,ds1338";
reg = <0x68>;
};
......
......@@ -267,7 +267,7 @@ eeprom@54 {
};
rtc@68 {
compatible = "stm,m41t00",
compatible = "st,m41t00",
"dallas,ds1338";
reg = <0x68>;
};
......
......@@ -229,7 +229,7 @@ eeprom@54 {
};
rtc@68 {
compatible = "stm,m41t00",
compatible = "st,m41t00",
"dallas,ds1338";
reg = <0x68>;
};
......
......@@ -9,9 +9,7 @@
*/
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/of_fdt.h>
#include <linux/of_iommu.h>
#include <linux/clocksource.h>
#include <linux/irqchip.h>
#include <linux/clk-provider.h>
......@@ -180,17 +178,3 @@ void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx)
void __init plat_irq_setup(void)
{
}
static int __init sh_of_device_init(void)
{
pr_info("SH generic board support: populating platform devices\n");
if (of_have_populated_dt()) {
of_iommu_init();
of_platform_populate(NULL, of_default_bus_match_table,
NULL, NULL);
} else {
pr_crit("Device tree not populated\n");
}
return 0;
}
arch_initcall_sync(sh_of_device_init);
......@@ -24,8 +24,8 @@
#include <linux/percpu.h>
#include <linux/clk-provider.h>
#include <linux/cpu.h>
#include <linux/of.h>
#include <linux/of_fdt.h>
#include <linux/of_platform.h>
#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
# include <linux/console.h>
......@@ -255,7 +255,6 @@ void __init early_init_devtree(void *params)
static int __init xtensa_device_probe(void)
{
of_clk_init(NULL);
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
return 0;
}
......
......@@ -163,8 +163,7 @@ static int __init weim_parse_dt(struct platform_device *pdev,
}
if (have_child)
ret = of_platform_populate(pdev->dev.of_node,
of_default_bus_match_table,
ret = of_platform_default_populate(pdev->dev.of_node,
NULL, &pdev->dev);
if (ret)
dev_err(&pdev->dev, "%s fail to create devices.\n",
......
......@@ -257,8 +257,7 @@ static int uniphier_system_bus_probe(struct platform_device *pdev)
uniphier_system_bus_set_reg(priv);
/* Now, the bus is configured. Populate platform_devices below it */
return of_platform_populate(dev->of_node, of_default_bus_match_table,
NULL, dev);
return of_platform_default_populate(dev->of_node, NULL, dev);
}
static const struct of_device_id uniphier_system_bus_match[] = {
......
......@@ -174,7 +174,7 @@ const struct iommu_ops *of_iommu_configure(struct device *dev,
return NULL;
}
void __init of_iommu_init(void)
static int __init of_iommu_init(void)
{
struct device_node *np;
const struct of_device_id *match, *matches = &__iommu_of_table;
......@@ -186,4 +186,7 @@ void __init of_iommu_init(void)
pr_err("Failed to initialise IOMMU %s\n",
of_node_full_name(np));
}
return 0;
}
postcore_initcall_sync(of_iommu_init);
......@@ -2134,8 +2134,7 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,
/* is child a common bus? */
if (of_match_node(of_default_bus_match_table, child))
/* create children and other common bus children */
if (of_platform_populate(child, of_default_bus_match_table,
NULL, &pdev->dev))
if (of_platform_default_populate(child, NULL, &pdev->dev))
goto err_child_fail;
return 0;
......
#define pr_fmt(fmt) "OF: " fmt
#include <linux/device.h>
#include <linux/io.h>
#include <linux/ioport.h>
......@@ -24,10 +26,10 @@ static int __of_address_to_resource(struct device_node *dev,
#ifdef DEBUG
static void of_dump_addr(const char *s, const __be32 *addr, int na)
{
printk(KERN_DEBUG "%s", s);
pr_debug("%s", s);
while (na--)
printk(" %08x", be32_to_cpu(*(addr++)));
printk("\n");
pr_cont(" %08x", be32_to_cpu(*(addr++)));
pr_cont("\n");
}
#else
static void of_dump_addr(const char *s, const __be32 *addr, int na) { }
......@@ -68,7 +70,7 @@ static u64 of_bus_default_map(__be32 *addr, const __be32 *range,
s = of_read_number(range + na + pna, ns);
da = of_read_number(addr, na);
pr_debug("OF: default map, cp=%llx, s=%llx, da=%llx\n",
pr_debug("default map, cp=%llx, s=%llx, da=%llx\n",
(unsigned long long)cp, (unsigned long long)s,
(unsigned long long)da);
......@@ -156,7 +158,7 @@ static u64 of_bus_pci_map(__be32 *addr, const __be32 *range, int na, int ns,
s = of_read_number(range + na + pna, ns);
da = of_read_number(addr + 1, na - 1);
pr_debug("OF: PCI map, cp=%llx, s=%llx, da=%llx\n",
pr_debug("PCI map, cp=%llx, s=%llx, da=%llx\n",
(unsigned long long)cp, (unsigned long long)s,
(unsigned long long)da);
......@@ -381,7 +383,7 @@ static u64 of_bus_isa_map(__be32 *addr, const __be32 *range, int na, int ns,
s = of_read_number(range + na + pna, ns);
da = of_read_number(addr + 1, na - 1);
pr_debug("OF: ISA map, cp=%llx, s=%llx, da=%llx\n",
pr_debug("ISA map, cp=%llx, s=%llx, da=%llx\n",
(unsigned long long)cp, (unsigned long long)s,
(unsigned long long)da);
......@@ -504,17 +506,17 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,
*/
ranges = of_get_property(parent, rprop, &rlen);
if (ranges == NULL && !of_empty_ranges_quirk(parent)) {
pr_debug("OF: no ranges; cannot translate\n");
pr_debug("no ranges; cannot translate\n");
return 1;
}
if (ranges == NULL || rlen == 0) {
offset = of_read_number(addr, na);
memset(addr, 0, pna * 4);
pr_debug("OF: empty ranges; 1:1 translation\n");
pr_debug("empty ranges; 1:1 translation\n");
goto finish;
}
pr_debug("OF: walking ranges...\n");
pr_debug("walking ranges...\n");
/* Now walk through the ranges */
rlen /= 4;
......@@ -525,14 +527,14 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,
break;
}
if (offset == OF_BAD_ADDR) {
pr_debug("OF: not found !\n");
pr_debug("not found !\n");
return 1;
}
memcpy(addr, ranges + na, 4 * pna);
finish:
of_dump_addr("OF: parent translation for:", addr, pna);
pr_debug("OF: with offset: %llx\n", (unsigned long long)offset);
of_dump_addr("parent translation for:", addr, pna);
pr_debug("with offset: %llx\n", (unsigned long long)offset);
/* Translate it into parent bus space */
return pbus->translate(addr, offset, pna);
......@@ -557,7 +559,7 @@ static u64 __of_translate_address(struct device_node *dev,
int na, ns, pna, pns;
u64 result = OF_BAD_ADDR;
pr_debug("OF: ** translation for device %s **\n", of_node_full_name(dev));
pr_debug("** translation for device %s **\n", of_node_full_name(dev));
/* Increase refcount at current level */
of_node_get(dev);
......@@ -571,14 +573,14 @@ static u64 __of_translate_address(struct device_node *dev,
/* Count address cells & copy address locally */
bus->count_cells(dev, &na, &ns);
if (!OF_CHECK_COUNTS(na, ns)) {
pr_debug("OF: Bad cell count for %s\n", of_node_full_name(dev));
pr_debug("Bad cell count for %s\n", of_node_full_name(dev));
goto bail;
}
memcpy(addr, in_addr, na * 4);
pr_debug("OF: bus is %s (na=%d, ns=%d) on %s\n",
pr_debug("bus is %s (na=%d, ns=%d) on %s\n",
bus->name, na, ns, of_node_full_name(parent));
of_dump_addr("OF: translating address:", addr, na);
of_dump_addr("translating address:", addr, na);
/* Translate */
for (;;) {
......@@ -589,7 +591,7 @@ static u64 __of_translate_address(struct device_node *dev,
/* If root, we have finished */
if (parent == NULL) {
pr_debug("OF: reached root node\n");
pr_debug("reached root node\n");
result = of_read_number(addr, na);
break;
}
......@@ -598,12 +600,12 @@ static u64 __of_translate_address(struct device_node *dev,
pbus = of_match_bus(parent);
pbus->count_cells(dev, &pna, &pns);
if (!OF_CHECK_COUNTS(pna, pns)) {
pr_err("prom_parse: Bad cell count for %s\n",
pr_err("Bad cell count for %s\n",
of_node_full_name(dev));
break;
}
pr_debug("OF: parent bus is %s (na=%d, ns=%d) on %s\n",
pr_debug("parent bus is %s (na=%d, ns=%d) on %s\n",
pbus->name, pna, pns, of_node_full_name(parent));
/* Apply bus translation */
......@@ -615,7 +617,7 @@ static u64 __of_translate_address(struct device_node *dev,
ns = pns;
bus = pbus;
of_dump_addr("OF: one level translation:", addr, na);
of_dump_addr("one level translation:", addr, na);
}
bail:
of_node_put(parent);
......@@ -853,8 +855,7 @@ int of_dma_get_range(struct device_node *np, u64 *dma_addr, u64 *paddr, u64 *siz
}
if (!ranges) {
pr_debug("%s: no dma-ranges found for node(%s)\n",
__func__, np->full_name);
pr_debug("no dma-ranges found for node(%s)\n", np->full_name);
ret = -ENODEV;
goto out;
}
......@@ -871,8 +872,8 @@ int of_dma_get_range(struct device_node *np, u64 *dma_addr, u64 *paddr, u64 *siz
dmaaddr = of_read_number(ranges, naddr);
*paddr = of_translate_dma_address(np, ranges);
if (*paddr == OF_BAD_ADDR) {
pr_err("%s: translation of DMA address(%pad) to CPU address failed node(%s)\n",
__func__, dma_addr, np->full_name);
pr_err("translation of DMA address(%pad) to CPU address failed node(%s)\n",
dma_addr, np->full_name);
ret = -EINVAL;
goto out;
}
......
......@@ -17,6 +17,9 @@
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#define pr_fmt(fmt) "OF: " fmt
#include <linux/console.h>
#include <linux/ctype.h>
#include <linux/cpu.h>
......@@ -112,6 +115,7 @@ static ssize_t of_node_property_read(struct file *filp, struct kobject *kobj,
return memory_read_from_buffer(buf, count, &offset, pp->value, pp->length);
}
/* always return newly allocated name, caller must free after use */
static const char *safe_name(struct kobject *kobj, const char *orig_name)
{
const char *name = orig_name;
......@@ -126,9 +130,12 @@ static const char *safe_name(struct kobject *kobj, const char *orig_name)
name = kasprintf(GFP_KERNEL, "%s#%i", orig_name, ++i);
}
if (name != orig_name)
pr_warn("device-tree: Duplicate name in %s, renamed to \"%s\"\n",
if (name == orig_name) {
name = kstrdup(orig_name, GFP_KERNEL);
} else {
pr_warn("Duplicate name in %s, renamed to \"%s\"\n",
kobject_name(kobj), name);
}
return name;
}
......@@ -159,6 +166,7 @@ int __of_add_property_sysfs(struct device_node *np, struct property *pp)
int __of_attach_node_sysfs(struct device_node *np)
{
const char *name;
struct kobject *parent;
struct property *pp;
int rc;
......@@ -171,15 +179,16 @@ int __of_attach_node_sysfs(struct device_node *np)
np->kobj.kset = of_kset;
if (!np->parent) {
/* Nodes without parents are new top level trees */
rc = kobject_add(&np->kobj, NULL, "%s",
safe_name(&of_kset->kobj, "base"));
name = safe_name(&of_kset->kobj, "base");
parent = NULL;
} else {
name = safe_name(&np->parent->kobj, kbasename(np->full_name));
if (!name || !name[0])
return -EINVAL;
rc = kobject_add(&np->kobj, &np->parent->kobj, "%s", name);
parent = &np->parent->kobj;
}
if (!name)
return -ENOMEM;
rc = kobject_add(&np->kobj, parent, "%s", name);
kfree(name);
if (rc)
return rc;
......@@ -198,7 +207,7 @@ void __init of_core_init(void)
of_kset = kset_create_and_add("devicetree", NULL, firmware_kobj);
if (!of_kset) {
mutex_unlock(&of_mutex);
pr_err("devicetree: failed to register existing nodes\n");
pr_err("failed to register existing nodes\n");
return;
}
for_each_of_allnodes(np)
......@@ -1815,6 +1824,12 @@ int __of_remove_property(struct device_node *np, struct property *prop)
return 0;
}
void __of_sysfs_remove_bin_file(struct device_node *np, struct property *prop)
{
sysfs_remove_bin_file(&np->kobj, &prop->attr);
kfree(prop->attr.attr.name);
}
void __of_remove_property_sysfs(struct device_node *np, struct property *prop)
{
if (!IS_ENABLED(CONFIG_SYSFS))
......@@ -1822,7 +1837,7 @@ void __of_remove_property_sysfs(struct device_node *np, struct property *prop)
/* at early boot, bail here and defer setup to of_init() */
if (of_kset && of_node_is_attached(np))
sysfs_remove_bin_file(&np->kobj, &prop->attr);
__of_sysfs_remove_bin_file(np, prop);
}
/**
......@@ -1895,7 +1910,7 @@ void __of_update_property_sysfs(struct device_node *np, struct property *newprop
return;
if (oldprop)
sysfs_remove_bin_file(&np->kobj, &oldprop->attr);
__of_sysfs_remove_bin_file(np, oldprop);
__of_add_property_sysfs(np, newprop);
}
......@@ -2257,8 +2272,8 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,
of_node_put(node);
if (!port) {
pr_err("%s(): no port node found in %s\n",
__func__, parent->full_name);
pr_err("graph: no port node found in %s\n",
parent->full_name);
return NULL;
}
} else {
......
......@@ -6,6 +6,8 @@
* device tree nodes.
*/
#define pr_fmt(fmt) "OF: " fmt
#include <linux/of.h>
#include <linux/spinlock.h>
#include <linux/slab.h>
......@@ -55,7 +57,7 @@ void __of_detach_node_sysfs(struct device_node *np)
/* only remove properties if on sysfs */
if (of_node_is_attached(np)) {
for_each_property_of_node(np, pp)
sysfs_remove_bin_file(&np->kobj, &pp->attr);
__of_sysfs_remove_bin_file(np, pp);
kobject_del(&np->kobj);
}
......@@ -96,13 +98,13 @@ int of_reconfig_notify(unsigned long action, struct of_reconfig_data *p)
switch (action) {
case OF_RECONFIG_ATTACH_NODE:
case OF_RECONFIG_DETACH_NODE:
pr_debug("of/notify %-15s %s\n", action_names[action],
pr_debug("notify %-15s %s\n", action_names[action],
pr->dn->full_name);
break;
case OF_RECONFIG_ADD_PROPERTY:
case OF_RECONFIG_REMOVE_PROPERTY:
case OF_RECONFIG_UPDATE_PROPERTY:
pr_debug("of/notify %-15s %s:%s\n", action_names[action],
pr_debug("notify %-15s %s:%s\n", action_names[action],
pr->dn->full_name, pr->prop->name);
break;
......@@ -460,12 +462,12 @@ static void __of_changeset_entry_dump(struct of_changeset_entry *ce)
case OF_RECONFIG_ADD_PROPERTY:
case OF_RECONFIG_REMOVE_PROPERTY:
case OF_RECONFIG_UPDATE_PROPERTY:
pr_debug("of/cset<%p> %-15s %s/%s\n", ce, action_names[ce->action],
pr_debug("cset<%p> %-15s %s/%s\n", ce, action_names[ce->action],
ce->np->full_name, ce->prop->name);
break;
case OF_RECONFIG_ATTACH_NODE:
case OF_RECONFIG_DETACH_NODE:
pr_debug("of/cset<%p> %-15s %s\n", ce, action_names[ce->action],
pr_debug("cset<%p> %-15s %s\n", ce, action_names[ce->action],
ce->np->full_name);
break;
}
......@@ -531,13 +533,13 @@ static void __of_changeset_entry_notify(struct of_changeset_entry *ce, bool reve
ret = of_property_notify(ce->action, ce->np, ce->prop, ce->old_prop);
break;
default:
pr_err("%s: invalid devicetree changeset action: %i\n", __func__,
pr_err("invalid devicetree changeset action: %i\n",
(int)ce->action);
return;
}
if (ret)
pr_err("%s: notifier error @%s\n", __func__, ce->np->full_name);
pr_err("changeset notifier error @%s\n", ce->np->full_name);
}
static int __of_changeset_entry_apply(struct of_changeset_entry *ce)
......@@ -568,8 +570,8 @@ static int __of_changeset_entry_apply(struct of_changeset_entry *ce)
ret = __of_add_property(ce->np, ce->prop);
if (ret) {
pr_err("%s: add_property failed @%s/%s\n",
__func__, ce->np->full_name,
pr_err("changeset: add_property failed @%s/%s\n",
ce->np->full_name,
ce->prop->name);
break;
}
......@@ -577,8 +579,8 @@ static int __of_changeset_entry_apply(struct of_changeset_entry *ce)
case OF_RECONFIG_REMOVE_PROPERTY:
ret = __of_remove_property(ce->np, ce->prop);
if (ret) {
pr_err("%s: remove_property failed @%s/%s\n",
__func__, ce->np->full_name,
pr_err("changeset: remove_property failed @%s/%s\n",
ce->np->full_name,
ce->prop->name);
break;
}
......@@ -596,8 +598,8 @@ static int __of_changeset_entry_apply(struct of_changeset_entry *ce)
ret = __of_update_property(ce->np, ce->prop, &old_prop);
if (ret) {
pr_err("%s: update_property failed @%s/%s\n",
__func__, ce->np->full_name,
pr_err("changeset: update_property failed @%s/%s\n",
ce->np->full_name,
ce->prop->name);
break;
}
......@@ -677,24 +679,24 @@ int __of_changeset_apply(struct of_changeset *ocs)
int ret;
/* perform the rest of the work */
pr_debug("of_changeset: applying...\n");
pr_debug("changeset: applying...\n");
list_for_each_entry(ce, &ocs->entries, node) {
ret = __of_changeset_entry_apply(ce);
if (ret) {
pr_err("%s: Error applying changeset (%d)\n", __func__, ret);
pr_err("Error applying changeset (%d)\n", ret);
list_for_each_entry_continue_reverse(ce, &ocs->entries, node)
__of_changeset_entry_revert(ce);
return ret;
}
}
pr_debug("of_changeset: applied, emitting notifiers.\n");
pr_debug("changeset: applied, emitting notifiers.\n");
/* drop the global lock while emitting notifiers */
mutex_unlock(&of_mutex);
list_for_each_entry(ce, &ocs->entries, node)
__of_changeset_entry_notify(ce, 0);
mutex_lock(&of_mutex);
pr_debug("of_changeset: notifiers sent.\n");
pr_debug("changeset: notifiers sent.\n");
return 0;
}
......@@ -728,24 +730,24 @@ int __of_changeset_revert(struct of_changeset *ocs)
struct of_changeset_entry *ce;
int ret;
pr_debug("of_changeset: reverting...\n");
pr_debug("changeset: reverting...\n");
list_for_each_entry_reverse(ce, &ocs->entries, node) {
ret = __of_changeset_entry_revert(ce);
if (ret) {
pr_err("%s: Error reverting changeset (%d)\n", __func__, ret);
pr_err("Error reverting changeset (%d)\n", ret);
list_for_each_entry_continue(ce, &ocs->entries, node)
__of_changeset_entry_apply(ce);
return ret;
}
}
pr_debug("of_changeset: reverted, emitting notifiers.\n");
pr_debug("changeset: reverted, emitting notifiers.\n");
/* drop the global lock while emitting notifiers */
mutex_unlock(&of_mutex);
list_for_each_entry_reverse(ce, &ocs->entries, node)
__of_changeset_entry_notify(ce, 1);
mutex_lock(&of_mutex);
pr_debug("of_changeset: notifiers sent.\n");
pr_debug("changeset: notifiers sent.\n");
return 0;
}
......@@ -795,10 +797,9 @@ int of_changeset_action(struct of_changeset *ocs, unsigned long action,
struct of_changeset_entry *ce;
ce = kzalloc(sizeof(*ce), GFP_KERNEL);
if (!ce) {
pr_err("%s: Failed to allocate\n", __func__);
if (!ce)
return -ENOMEM;
}
/* get a reference to the node */
ce->action = action;
ce->np = of_node_get(np);
......
......@@ -9,6 +9,8 @@
* version 2 as published by the Free Software Foundation.
*/
#define pr_fmt(fmt) "OF: fdt:" fmt
#include <linux/crc32.h>
#include <linux/kernel.h>
#include <linux/initrd.h>
......@@ -182,14 +184,12 @@ static void populate_properties(const void *blob,
val = fdt_getprop_by_offset(blob, cur, &pname, &sz);
if (!val) {
pr_warn("%s: Cannot locate property at 0x%x\n",
__func__, cur);
pr_warn("Cannot locate property at 0x%x\n", cur);
continue;
}
if (!pname) {
pr_warn("%s: Cannot find property name at 0x%x\n",
__func__, cur);
pr_warn("Cannot find property name at 0x%x\n", cur);
continue;
}
......@@ -439,7 +439,7 @@ static int unflatten_dt_nodes(const void *blob,
}
if (offset < 0 && offset != -FDT_ERR_NOTFOUND) {
pr_err("%s: Error %d processing FDT\n", __func__, offset);
pr_err("Error %d processing FDT\n", offset);
return -EINVAL;
}
......@@ -472,7 +472,8 @@ static int unflatten_dt_nodes(const void *blob,
static void *__unflatten_device_tree(const void *blob,
struct device_node *dad,
struct device_node **mynodes,
void *(*dt_alloc)(u64 size, u64 align))
void *(*dt_alloc)(u64 size, u64 align),
bool detached)
{
int size;
void *mem;
......@@ -516,6 +517,11 @@ static void *__unflatten_device_tree(const void *blob,
pr_warning("End of tree marker overwritten: %08x\n",
be32_to_cpup(mem + size));
if (detached) {
of_node_set_flag(*mynodes, OF_DETACHED);
pr_debug("unflattened tree is detached\n");
}
pr_debug(" <- unflatten_device_tree()\n");
return mem;
}
......@@ -548,7 +554,8 @@ void *of_fdt_unflatten_tree(const unsigned long *blob,
void *mem;
mutex_lock(&of_fdt_unflatten_mutex);
mem = __unflatten_device_tree(blob, dad, mynodes, &kernel_tree_alloc);
mem = __unflatten_device_tree(blob, dad, mynodes, &kernel_tree_alloc,
true);
mutex_unlock(&of_fdt_unflatten_mutex);
return mem;
......@@ -1237,7 +1244,7 @@ bool __init early_init_dt_scan(void *params)
void __init unflatten_device_tree(void)
{
__unflatten_device_tree(initial_boot_params, NULL, &of_root,
early_init_dt_alloc_memory_arch);
early_init_dt_alloc_memory_arch, false);
/* Get pointer to "/chosen" and "/aliases" nodes for use everywhere */
of_alias_scan(early_init_dt_alloc_memory_arch);
......@@ -1294,7 +1301,7 @@ static int __init of_fdt_raw_init(void)
if (of_fdt_crc32 != crc32_be(~0, initial_boot_params,
fdt_totalsize(initial_boot_params))) {
pr_warn("fdt: not creating '/sys/firmware/fdt': CRC check failed\n");
pr_warn("not creating '/sys/firmware/fdt': CRC check failed\n");
return 0;
}
of_fdt_raw_attr.size = fdt_totalsize(initial_boot_params);
......
......@@ -12,6 +12,9 @@
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*/
#define pr_fmt(fmt) "OF: fdt: " fmt
#include <linux/kernel.h>
#include <linux/libfdt.h>
#include <linux/of.h>
......@@ -30,7 +33,7 @@ static void __init of_dump_addr(const char *s, const __be32 *addr, int na)
pr_debug("%s", s);
while(na--)
pr_cont(" %08x", *(addr++));
pr_debug("\n");
pr_cont("\n");
}
#else
static void __init of_dump_addr(const char *s, const __be32 *addr, int na) { }
......@@ -77,7 +80,7 @@ static u64 __init fdt_bus_default_map(__be32 *addr, const __be32 *range,
s = of_read_number(range + na + pna, ns);
da = of_read_number(addr, na);
pr_debug("FDT: default map, cp=%llx, s=%llx, da=%llx\n",
pr_debug("default map, cp=%llx, s=%llx, da=%llx\n",
cp, s, da);
if (da < cp || da >= (cp + s))
......@@ -123,11 +126,11 @@ static int __init fdt_translate_one(const void *blob, int parent,
if (rlen == 0) {
offset = of_read_number(addr, na);
memset(addr, 0, pna * 4);
pr_debug("FDT: empty ranges, 1:1 translation\n");
pr_debug("empty ranges, 1:1 translation\n");
goto finish;
}
pr_debug("FDT: walking ranges...\n");
pr_debug("walking ranges...\n");
/* Now walk through the ranges */
rlen /= 4;
......@@ -138,14 +141,14 @@ static int __init fdt_translate_one(const void *blob, int parent,
break;
}
if (offset == OF_BAD_ADDR) {
pr_debug("FDT: not found !\n");
pr_debug("not found !\n");
return 1;
}
memcpy(addr, ranges + na, 4 * pna);
finish:
of_dump_addr("FDT: parent translation for:", addr, pna);
pr_debug("FDT: with offset: %llx\n", offset);
of_dump_addr("parent translation for:", addr, pna);
pr_debug("with offset: %llx\n", offset);
/* Translate it into parent bus space */
return pbus->translate(addr, offset, pna);
......@@ -170,12 +173,12 @@ static u64 __init fdt_translate_address(const void *blob, int node_offset)
int na, ns, pna, pns;
u64 result = OF_BAD_ADDR;
pr_debug("FDT: ** translation for device %s **\n",
pr_debug("** translation for device %s **\n",
fdt_get_name(blob, node_offset, NULL));
reg = fdt_getprop(blob, node_offset, "reg", &len);
if (!reg) {
pr_err("FDT: warning: device tree node '%s' has no address.\n",
pr_err("warning: device tree node '%s' has no address.\n",
fdt_get_name(blob, node_offset, NULL));
goto bail;
}
......@@ -189,15 +192,15 @@ static u64 __init fdt_translate_address(const void *blob, int node_offset)
/* Cound address cells & copy address locally */
bus->count_cells(blob, parent, &na, &ns);
if (!OF_CHECK_COUNTS(na, ns)) {
pr_err("FDT: Bad cell count for %s\n",
pr_err("Bad cell count for %s\n",
fdt_get_name(blob, node_offset, NULL));
goto bail;
}
memcpy(addr, reg, na * 4);
pr_debug("FDT: bus (na=%d, ns=%d) on %s\n",
pr_debug("bus (na=%d, ns=%d) on %s\n",
na, ns, fdt_get_name(blob, parent, NULL));
of_dump_addr("OF: translating address:", addr, na);
of_dump_addr("translating address:", addr, na);
/* Translate */
for (;;) {
......@@ -207,7 +210,7 @@ static u64 __init fdt_translate_address(const void *blob, int node_offset)
/* If root, we have finished */
if (parent < 0) {
pr_debug("FDT: reached root node\n");
pr_debug("reached root node\n");
result = of_read_number(addr, na);
break;
}
......@@ -216,12 +219,12 @@ static u64 __init fdt_translate_address(const void *blob, int node_offset)
pbus = &of_busses[0];
pbus->count_cells(blob, parent, &pna, &pns);
if (!OF_CHECK_COUNTS(pna, pns)) {
pr_err("FDT: Bad cell count for %s\n",
pr_err("Bad cell count for %s\n",
fdt_get_name(blob, node_offset, NULL));
break;
}
pr_debug("FDT: parent bus (na=%d, ns=%d) on %s\n",
pr_debug("parent bus (na=%d, ns=%d) on %s\n",
pna, pns, fdt_get_name(blob, parent, NULL));
/* Apply bus translation */
......@@ -234,7 +237,7 @@ static u64 __init fdt_translate_address(const void *blob, int node_offset)
ns = pns;
bus = pbus;
of_dump_addr("FDT: one level translation:", addr, na);
of_dump_addr("one level translation:", addr, na);
}
bail:
return result;
......
......@@ -18,6 +18,8 @@
* driver.
*/
#define pr_fmt(fmt) "OF: " fmt
#include <linux/device.h>
#include <linux/errno.h>
#include <linux/list.h>
......@@ -557,6 +559,8 @@ void __init of_irq_init(const struct of_device_id *matches)
* its children can get processed in a subsequent pass.
*/
list_add_tail(&desc->list, &intc_parent_list);
of_node_set_flag(desc->dev, OF_POPULATED);
}
/* Get the next pending parent that might have children */
......
#define pr_fmt(fmt) "OF: PCI: " fmt
#include <linux/kernel.h>
#include <linux/export.h>
#include <linux/of.h>
......@@ -138,7 +140,7 @@ void of_pci_check_probe_only(void)
else
pci_clear_flags(PCI_PROBE_ONLY);
pr_info("PCI: PROBE_ONLY %sabled\n", val ? "en" : "dis");
pr_info("PROBE_ONLY %sabled\n", val ? "en" : "dis");
}
EXPORT_SYMBOL_GPL(of_pci_check_probe_only);
......@@ -181,7 +183,7 @@ int of_pci_get_host_bridge_resources(struct device_node *dev,
if (!bus_range)
return -ENOMEM;
pr_info("PCI host bridge %s ranges:\n", dev->full_name);
pr_info("host bridge %s ranges:\n", dev->full_name);
err = of_pci_parse_bus_range(dev, bus_range);
if (err) {
......
......@@ -83,6 +83,9 @@ extern int __of_attach_node_sysfs(struct device_node *np);
extern void __of_detach_node(struct device_node *np);
extern void __of_detach_node_sysfs(struct device_node *np);
extern void __of_sysfs_remove_bin_file(struct device_node *np,
struct property *prop);
/* iterators for transactions, used for overlays */
/* forward iterator */
#define for_each_transaction_entry(_oft, _te) \
......
......@@ -13,6 +13,8 @@
* License or (at your optional) any later version of the license.
*/
#define pr_fmt(fmt) "OF: reserved mem: " fmt
#include <linux/err.h>
#include <linux/of.h>
#include <linux/of_fdt.h>
......@@ -76,7 +78,7 @@ void __init fdt_reserved_mem_save_node(unsigned long node, const char *uname,
struct reserved_mem *rmem = &reserved_mem[reserved_mem_count];
if (reserved_mem_count == ARRAY_SIZE(reserved_mem)) {
pr_err("Reserved memory: not enough space all defined regions.\n");
pr_err("not enough space all defined regions.\n");
return;
}
......@@ -109,8 +111,7 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
return -EINVAL;
if (len != dt_root_size_cells * sizeof(__be32)) {
pr_err("Reserved memory: invalid size property in '%s' node.\n",
uname);
pr_err("invalid size property in '%s' node.\n", uname);
return -EINVAL;
}
size = dt_mem_next_cell(dt_root_size_cells, &prop);
......@@ -120,7 +121,7 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
prop = of_get_flat_dt_prop(node, "alignment", &len);
if (prop) {
if (len != dt_root_addr_cells * sizeof(__be32)) {
pr_err("Reserved memory: invalid alignment property in '%s' node.\n",
pr_err("invalid alignment property in '%s' node.\n",
uname);
return -EINVAL;
}
......@@ -142,7 +143,7 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
if (prop) {
if (len % t_len != 0) {
pr_err("Reserved memory: invalid alloc-ranges property in '%s', skipping node.\n",
pr_err("invalid alloc-ranges property in '%s', skipping node.\n",
uname);
return -EINVAL;
}
......@@ -157,7 +158,7 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
ret = early_init_dt_alloc_reserved_memory_arch(size,
align, start, end, nomap, &base);
if (ret == 0) {
pr_debug("Reserved memory: allocated memory for '%s' node: base %pa, size %ld MiB\n",
pr_debug("allocated memory for '%s' node: base %pa, size %ld MiB\n",
uname, &base,
(unsigned long)size / SZ_1M);
break;
......@@ -169,13 +170,12 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
ret = early_init_dt_alloc_reserved_memory_arch(size, align,
0, 0, nomap, &base);
if (ret == 0)
pr_debug("Reserved memory: allocated memory for '%s' node: base %pa, size %ld MiB\n",
pr_debug("allocated memory for '%s' node: base %pa, size %ld MiB\n",
uname, &base, (unsigned long)size / SZ_1M);
}
if (base == 0) {
pr_info("Reserved memory: failed to allocate memory for node '%s'\n",
uname);
pr_info("failed to allocate memory for node '%s'\n", uname);
return -ENOMEM;
}
......@@ -204,7 +204,7 @@ static int __init __reserved_mem_init_node(struct reserved_mem *rmem)
continue;
if (initfn(rmem) == 0) {
pr_info("Reserved memory: initialized node %s, compatible id %s\n",
pr_info("initialized node %s, compatible id %s\n",
rmem->name, compat);
return 0;
}
......@@ -246,7 +246,7 @@ static void __init __rmem_check_for_overlap(void)
this_end = this->base + this->size;
next_end = next->base + next->size;
pr_err("Reserved memory: OVERLAP DETECTED!\n%s (%pa--%pa) overlaps with %s (%pa--%pa)\n",
pr_err("OVERLAP DETECTED!\n%s (%pa--%pa) overlaps with %s (%pa--%pa)\n",
this->name, &this->base, &this_end,
next->name, &next->base, &next_end);
}
......
......@@ -8,7 +8,9 @@
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*/
#undef DEBUG
#define pr_fmt(fmt) "OF: overlay: " fmt
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
......@@ -137,8 +139,8 @@ static int of_overlay_apply_one(struct of_overlay *ov,
for_each_property_of_node(overlay, prop) {
ret = of_overlay_apply_single_property(ov, target, prop);
if (ret) {
pr_err("%s: Failed to apply prop @%s/%s\n",
__func__, target->full_name, prop->name);
pr_err("Failed to apply prop @%s/%s\n",
target->full_name, prop->name);
return ret;
}
}
......@@ -146,9 +148,8 @@ static int of_overlay_apply_one(struct of_overlay *ov,
for_each_child_of_node(overlay, child) {
ret = of_overlay_apply_single_device_node(ov, target, child);
if (ret != 0) {
pr_err("%s: Failed to apply single node @%s/%s\n",
__func__, target->full_name,
child->name);
pr_err("Failed to apply single node @%s/%s\n",
target->full_name, child->name);
of_node_put(child);
return ret;
}
......@@ -176,8 +177,7 @@ static int of_overlay_apply(struct of_overlay *ov)
err = of_overlay_apply_one(ov, ovinfo->target, ovinfo->overlay);
if (err != 0) {
pr_err("%s: overlay failed '%s'\n",
__func__, ovinfo->target->full_name);
pr_err("apply failed '%s'\n", ovinfo->target->full_name);
return err;
}
}
......@@ -208,7 +208,7 @@ static struct device_node *find_target_node(struct device_node *info_node)
if (ret == 0)
return of_find_node_by_path(path);
pr_err("%s: Failed to find target for node %p (%s)\n", __func__,
pr_err("Failed to find target for node %p (%s)\n",
info_node, info_node->name);
return NULL;
......@@ -355,8 +355,6 @@ int of_overlay_create(struct device_node *tree)
id = idr_alloc(&ov_idr, ov, 0, 0, GFP_KERNEL);
if (id < 0) {
pr_err("%s: idr_alloc() failed for tree@%s\n",
__func__, tree->full_name);
err = id;
goto err_destroy_trans;
}
......@@ -365,26 +363,21 @@ int of_overlay_create(struct device_node *tree)
/* build the overlay info structures */
err = of_build_overlay_info(ov, tree);
if (err) {
pr_err("%s: of_build_overlay_info() failed for tree@%s\n",
__func__, tree->full_name);
pr_err("of_build_overlay_info() failed for tree@%s\n",
tree->full_name);
goto err_free_idr;
}
/* apply the overlay */
err = of_overlay_apply(ov);
if (err) {
pr_err("%s: of_overlay_apply() failed for tree@%s\n",
__func__, tree->full_name);
if (err)
goto err_abort_trans;
}
/* apply the changeset */
err = __of_changeset_apply(&ov->cset);
if (err) {
pr_err("%s: __of_changeset_apply() failed for tree@%s\n",
__func__, tree->full_name);
if (err)
goto err_revert_overlay;
}
/* add to the tail of the overlay list */
list_add_tail(&ov->node, &ov_list);
......@@ -469,8 +462,7 @@ static int overlay_removal_is_ok(struct of_overlay *ov)
list_for_each_entry(ce, &ov->cset.entries, node) {
if (!overlay_is_topmost(ov, ce->np)) {
pr_err("%s: overlay #%d is not topmost\n",
__func__, ov->id);
pr_err("overlay #%d is not topmost\n", ov->id);
return 0;
}
}
......@@ -496,16 +488,13 @@ int of_overlay_destroy(int id)
ov = idr_find(&ov_idr, id);
if (ov == NULL) {
err = -ENODEV;
pr_err("%s: Could not find overlay #%d\n",
__func__, id);
pr_err("destroy: Could not find overlay #%d\n", id);
goto out;
}
/* check whether the overlay is safe to remove */
if (!overlay_removal_is_ok(ov)) {
err = -EBUSY;
pr_err("%s: removal check failed for overlay #%d\n",
__func__, id);
goto out;
}
......
......@@ -11,6 +11,9 @@
* 2 of the License, or (at your option) any later version.
*
*/
#define pr_fmt(fmt) "OF: " fmt
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/amba/bus.h>
......@@ -31,7 +34,6 @@ const struct of_device_id of_default_bus_match_table[] = {
#endif /* CONFIG_ARM_AMBA */
{} /* Empty terminated list */
};
EXPORT_SYMBOL(of_default_bus_match_table);
static int of_dev_node_match(struct device *dev, void *data)
{
......@@ -234,11 +236,8 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
return NULL;
dev = amba_device_alloc(NULL, 0, 0);
if (!dev) {
pr_err("%s(): amba_device_alloc() failed for %s\n",
__func__, node->full_name);
if (!dev)
goto err_clear_flag;
}
/* setup generic device info */
dev->dev.of_node = of_node_get(node);
......@@ -261,15 +260,15 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
ret = of_address_to_resource(node, 0, &dev->res);
if (ret) {
pr_err("%s(): of_address_to_resource() failed (%d) for %s\n",
__func__, ret, node->full_name);
pr_err("amba: of_address_to_resource() failed (%d) for %s\n",
ret, node->full_name);
goto err_free;
}
ret = amba_device_add(dev, &iomem_resource);
if (ret) {
pr_err("%s(): amba_device_add() failed (%d) for %s\n",
__func__, ret, node->full_name);
pr_err("amba_device_add() failed (%d) for %s\n",
ret, node->full_name);
goto err_free;
}
......@@ -363,6 +362,12 @@ static int of_platform_bus_create(struct device_node *bus,
return 0;
}
if (of_node_check_flag(bus, OF_POPULATED_BUS)) {
pr_debug("%s() - skipping %s, already populated\n",
__func__, bus->full_name);
return 0;
}
auxdata = of_dev_lookup(lookup, bus);
if (auxdata) {
bus_id = auxdata->name;
......@@ -414,7 +419,7 @@ int of_platform_bus_probe(struct device_node *root,
if (!root)
return -EINVAL;
pr_debug("of_platform_bus_probe()\n");
pr_debug("%s()\n", __func__);
pr_debug(" starting at: %s\n", root->full_name);
/* Do a self check of bus type, if there's a match, create children */
......@@ -466,6 +471,9 @@ int of_platform_populate(struct device_node *root,
if (!root)
return -EINVAL;
pr_debug("%s()\n", __func__);
pr_debug(" starting at: %s\n", root->full_name);
for_each_child_of_node(root, child) {
rc = of_platform_bus_create(child, matches, lookup, parent, true);
if (rc) {
......@@ -489,6 +497,15 @@ int of_platform_default_populate(struct device_node *root,
}
EXPORT_SYMBOL_GPL(of_platform_default_populate);
static int __init of_platform_default_populate_init(void)
{
if (of_have_populated_dt())
of_platform_default_populate(NULL, NULL, NULL);
return 0;
}
arch_initcall_sync(of_platform_default_populate_init);
static int of_platform_device_destroy(struct device *dev, void *data)
{
/* Do not touch devices not populated from the device tree */
......
......@@ -9,6 +9,8 @@
* version 2 as published by the Free Software Foundation.
*/
#define pr_fmt(fmt) "OF: resolver: " fmt
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
......@@ -313,6 +315,11 @@ int of_resolve_phandles(struct device_node *resolve)
phandle phandle, phandle_delta;
int err;
if (!resolve)
pr_err("%s: null node\n", __func__);
if (resolve && !of_node_check_flag(resolve, OF_DETACHED))
pr_err("%s: node %s not detached\n", __func__,
resolve->full_name);
/* the resolve node must exist, and be detached */
if (!resolve || !of_node_check_flag(resolve, OF_DETACHED))
return -EINVAL;
......@@ -369,6 +376,7 @@ int of_resolve_phandles(struct device_node *resolve)
/* we need to fixup, but no root symbols... */
if (!root_sym) {
pr_err("%s: no symbols in root of device tree.\n", __func__);
err = -EINVAL;
goto out;
}
......
......@@ -771,7 +771,7 @@ static void __init of_unittest_platform_populate(void)
};
np = of_find_node_by_path("/testcase-data");
of_platform_populate(np, of_default_bus_match_table, NULL, NULL);
of_platform_default_populate(np, NULL, NULL);
/* Test that a missing irq domain returns -EPROBE_DEFER */
np = of_find_node_by_path("/testcase-data/testcase-device1");
......@@ -1871,8 +1871,7 @@ static void __init of_unittest_overlay(void)
goto out;
}
ret = of_platform_populate(bus_np, of_default_bus_match_table,
NULL, NULL);
ret = of_platform_default_populate(bus_np, NULL, NULL);
if (ret != 0) {
unittest(0, "could not populate bus @ \"%s\"\n", bus_path);
goto out;
......
......@@ -11,7 +11,6 @@ extern int of_get_dma_window(struct device_node *dn, const char *prefix,
int index, unsigned long *busno, dma_addr_t *addr,
size_t *size);
extern void of_iommu_init(void);
extern const struct iommu_ops *of_iommu_configure(struct device *dev,
struct device_node *master_np);
......@@ -24,7 +23,6 @@ static inline int of_get_dma_window(struct device_node *dn, const char *prefix,
return -EINVAL;
}
static inline void of_iommu_init(void) { }
static inline const struct iommu_ops *of_iommu_configure(struct device *dev,
struct device_node *master_np)
{
......
#!/usr/bin/perl
# Copyright 2016 by Frank Rowand
# Copyright 2016 by Gaurav Minocha
#
# This file is subject to the terms and conditions of the GNU General Public
# License v2.
use strict 'refs';
use strict subs;
use Getopt::Long;
$VUFX = "160610a";
$script_name = $0;
$script_name =~ s|^.*/||;
# ----- constants for print_flags()
# Position in string $pr_flags. Range of 0..($num_pr_flags - 1).
$pr_flag_pos_mcompatible = 0;
$pr_flag_pos_driver = 1;
$pr_flag_pos_mdriver = 2;
$pr_flag_pos_config = 3;
$pr_flag_pos_mconfig = 4;
$pr_flag_pos_node_not_enabled = 5;
$pr_flag_pos_white_list = 6;
$pr_flag_pos_hard_coded = 7;
$pr_flag_pos_config_hard_coded = 8;
$pr_flag_pos_config_none = 9;
$pr_flag_pos_config_m = 10;
$pr_flag_pos_config_y = 11;
$pr_flag_pos_config_test_fail = 12;
$num_pr_flags = $pr_flag_pos_config_test_fail + 1;
# flags in @pr_flag_value must be unique values to allow simple regular
# expessions to work for --include_flags and --exclude_flags.
# Convention: use upper case letters for potential issues or problems.
@pr_flag_value = ('M', 'd', 'D', 'c', 'C', 'E', 'W', 'H', 'x', 'n', 'm', 'y', 'F');
@pr_flag_help = (
"multiple compatibles found for this node",
"driver found for this compatible",
"multiple drivers found for this compatible",
"kernel config found for this driver",
"multiple config options found for this driver",
"node is not enabled",
"compatible is white listed",
"matching driver and/or kernel config is hard coded",
"kernel config hard coded in Makefile",
"one or more kernel config file options is not set",
"one or more kernel config file options is set to 'm'",
"one or more kernel config file options is set to 'y'",
"one of more kernel config file options fails to have correct value"
);
# -----
%driver_config = (); # driver config array, indexed by driver source file
%driver_count = (); # driver_cnt, indexed by compatible
%compat_driver = (); # compatible driver array, indexed by compatible
%existing_config = (); # existing config symbols present in given config file
# expected values are: "y", "m", a decimal number, a
# hex number, or a string
# ----- magic compatibles, do not have a driver
#
# Will not search for drivers for these compatibles.
%compat_white_list = (
'none' => '1',
'pci' => '1',
'simple-bus' => '1',
);
# Will not search for drivers for these compatibles.
#
# These compatibles have a very large number of false positives.
#
# 'hardcoded_no_driver' is a magic value. Other code knows this
# magic value. Do not use 'no_driver' here!
#
# Revisit each 'hardcoded_no_driver' to see how the compatible
# is used. Are there drivers that can be provided?
%driver_hard_code_list = (
'cache' => ['hardcoded_no_driver'],
'eeprom' => ['hardcoded_no_driver'],
'gpio' => ['hardcoded_no_driver'],
'gpio-keys' => ['drivers/input/keyboard/gpio_keys.c'],
'i2c-gpio' => ['drivers/i2c/busses/i2c-gpio.c'],
'isa' => ['arch/mips/mti-malta/malta-dt.c',
'arch/x86/kernel/devicetree.c'],
'led' => ['hardcoded_no_driver'],
'm25p32' => ['hardcoded_no_driver'],
'm25p64' => ['hardcoded_no_driver'],
'm25p80' => ['hardcoded_no_driver'],
'mtd-ram' => ['drivers/mtd/maps/physmap_of.c'],
'pwm-backlight' => ['drivers/video/backlight/pwm_bl.c'],
'spidev' => ['hardcoded_no_driver'],
'syscon' => ['drivers/mfd/syscon.c'],
'tlv320aic23' => ['hardcoded_no_driver'],
'wm8731' => ['hardcoded_no_driver'],
);
# Use these config options instead of searching makefiles
%driver_config_hard_code_list = (
# this one needed even if %driver_hard_code_list is empty
'no_driver' => ['no_config'],
'hardcoded_no_driver' => ['no_config'],
# drivers/usb/host/ehci-ppc-of.c
# drivers/usb/host/ehci-xilinx-of.c
# are included from:
# drivers/usb/host/ehci-hcd.c
# thus the search of Makefile for the included .c files is incorrect
# ehci-hcd.c wraps the includes with ifdef CONFIG_USB_EHCI_HCD_..._OF
#
# similar model for ohci-hcd.c (but no ohci-xilinx-of.c)
#
# similarly, uhci-hcd.c includes uhci-platform.c
'drivers/usb/host/ehci-ppc-of.c' => ['CONFIG_USB_EHCI_HCD',
'CONFIG_USB_EHCI_HCD_PPC_OF'],
'drivers/usb/host/ohci-ppc-of.c' => ['CONFIG_USB_OHCI_HCD',
'CONFIG_USB_OHCI_HCD_PPC_OF'],
'drivers/usb/host/ehci-xilinx-of.c' => ['CONFIG_USB_EHCI_HCD',
'CONFIG_USB_EHCI_HCD_XILINX'],
'drivers/usb/host/uhci-platform.c' => ['CONFIG_USB_UHCI_HCD',
'CONFIG_USB_UHCI_PLATFORM'],
# scan_makefile will find only one of these config options:
# ifneq ($(CONFIG_SOC_IMX6)$(CONFIG_SOC_LS1021A),)
'arch/arm/mach-imx/platsmp.c' => ['CONFIG_SOC_IMX6 && CONFIG_SMP',
'CONFIG_SOC_LS1021A && CONFIG_SMP'],
);
# 'virt/kvm/arm/.*' are controlled by makefiles in other directories,
# using relative paths, such as 'KVM := ../../../virt/kvm'. Do not
# add complexity to find_kconfig() to deal with this. There is a long
# term intent to change the kvm related makefiles to the normal kernel
# style. After that is done, this entry can be removed from the
# black_list_driver.
@black_list_driver = (
# kvm no longer a problem after commit 503a62862e8f in 4.7-rc1
# 'virt/kvm/arm/.*',
);
sub usage()
{
print
"
Usage: $script_name [options] device-tree...
device_tree is: dts_file | dtb_file | proc_device-tree
Valid options:
-c FILE Read kernel config options from FILE
--config FILE synonym for 'c'
--config-format config file friendly output format
--exclude-flag FLAG exclude entries with a matching flag
-h Display this message and exit
--help synonym for 'h'
--black-list-driver use driver black list
--white-list-config use config white list
--white-list-driver use driver white list
--include-flag FLAG include only entries with a matching flag
--include-suspect include only entries with an uppercase flag
--short-name do not show the path portion of the node name
--show-lists report of white and black lists
--version Display program version and exit
Report driver source files that match the compatibles in the device
tree file and the kernel config options that enable the driver source
files.
This program must be run in the root directory of a Linux kernel
source tree.
The default format is a report that is intended to be easily human
scannable.
An alternate format can be selected by --config-format. This will
create output that can easily be edited to create a fragment that can
be appended to the existing kernel config file. Each entry consists of
multiple lines. The first line reports flags, the node path, compatible
value, driver file matching the compatible, configuration options, and
current values of the configuration options. For each configuration
option, the following lines report the current value and the value that
is required for the driver file to be included in the kernel.
If a large number of drivers or config options is listed for a node,
and the '$pr_flag_value[$pr_flag_pos_hard_coded]' flag is set consider using --white-list-config and/or
--white-list-driver. If the white list option suppresses the correct
entry please report that as a bug.
CAUTION:
This program uses heuristics to guess which driver(s) support each
compatible string and which config option(s) enables the driver(s).
Do not believe that the reported information is fully correct.
This program is intended to aid the process of determining the
proper kernel configuration for a device tree, but this is not
a fully automated process -- human involvement may still be
required!
The driver match heuristic used is to search for source files
containing the compatible string enclosed in quotes.
This program might not be able to find all drivers matching a
compatible string.
Some makefiles are overly clever. This program was not made
complex enough to handle them. If no config option is listed
for a driver, look at the makefile for the driver source file.
Even if a config option is listed for a driver, some other
available config options may not be listed.
FLAG values:
";
for ($k = 0; $k < $num_pr_flags; $k++) {
printf " %s %s\n", $pr_flag_value[$k], $pr_flag_help[$k];
}
print
"
Upper case letters indicate potential issues or problems.
The flag:
";
$k = $pr_flag_pos_hard_coded;
printf " %s %s\n", $pr_flag_value[$k], $pr_flag_help[$k];
print
"
will be set if the config or driver is in the white lists, even if
--white-list-config and --white-list-driver are not specified.
This is a hint that 1) many of these reported lines are likely to
be incorrect, and 2) using those options will reduce the number of
drivers and/or config options reported.
--white-list-config and --white-list-driver may not be accurate if this
program is not well maintained. Use them with appropriate skepticism.
Use the --show-lists option to report the values in the list.
Return value:
0 if no error
1 error processing command line
2 unable to open or read kernel config file
3 unable to open or process input device tree file(s)
EXAMPLES:
dt_to_config arch/arm/boot/dts/my_dts_file.dts
Basic report.
dt_to_config \\
--config \${KBUILD_OUTPUT}/.config \\
arch/\${ARCH}/boot/dts/my_dts_file.dts
Full report, with config file issues noted.
dt_to_config --include-suspect \\
--config \${KBUILD_OUTPUT}/.config \\
arch/\${ARCH}/boot/dts/my_dts_file.dts
Report of node / compatible string / driver tuples that should
be further investigated. A node may have multiple compatible
strings. A compatible string may be matched by multiple drivers.
A driver may have config file issues noted. The compatible string
and/or driver may be in the white lists.
dt_to_config --include-suspect --config-format \\
--config ${KBUILD_OUTPUT}/.config \\
arch/\${ARCH}/boot/dts/my_dts_file.dts
Report of node / compatible string / driver tuples that should
be further investigated. The report can be edited to uncomment
the config options to select the desired tuple for a given node.
A node may have multiple compatible strings. A compatible string
may be matched by multiple drivers. A driver may have config file
issues noted. The compatible string and/or driver may be in the
white lists.
";
}
sub set_flag()
{
# pr_flags_ref is a reference to $pr_flags
my $pr_flags_ref = shift;
my $pos = shift;
substr $$pr_flags_ref, $pos, 1, $pr_flag_value[$pos];
return $pr_flags;
}
sub print_flags()
{
# return 1 if anything printed, else 0
# some fields of pn_arg_ref might not be used in this function, but
# extract all of them anyway.
my $pn_arg_ref = shift;
my $compat = $pn_arg_ref->{compat};
my $compatible_cnt = $pn_arg_ref->{compatible_cnt};
my $config = $pn_arg_ref->{config};
my $config_cnt = $pn_arg_ref->{config_cnt};
my $driver = $pn_arg_ref->{driver};
my $driver_cnt = $pn_arg_ref->{driver_cnt};
my $full_node = $pn_arg_ref->{full_node};
my $node = $pn_arg_ref->{node};
my $node_enabled = $pn_arg_ref->{node_enabled};
my $white_list = $pn_arg_ref->{white_list};
my $pr_flags = '-' x $num_pr_flags;
# ----- set flags in $pr_flags
if ($compatible_cnt > 1) {
&set_flag(\$pr_flags, $pr_flag_pos_mcompatible);
}
if ($config_cnt > 1) {
&set_flag(\$pr_flags, $pr_flag_pos_mconfig);
}
if ($driver_cnt >= 1) {
&set_flag(\$pr_flags, $pr_flag_pos_driver);
}
if ($driver_cnt > 1) {
&set_flag(\$pr_flags, $pr_flag_pos_mdriver);
}
# These strings are the same way the linux kernel tests.
# The ePapr lists of values is slightly different.
if (!(
($node_enabled eq "") ||
($node_enabled eq "ok") ||
($node_enabled eq "okay")
)) {
&set_flag(\$pr_flags, $pr_flag_pos_node_not_enabled);
}
if ($white_list) {
&set_flag(\$pr_flags, $pr_flag_pos_white_list);
}
if (exists($driver_hard_code_list{$compat}) ||
(exists($driver_config_hard_code_list{$driver}) &&
($driver ne "no_driver"))) {
&set_flag(\$pr_flags, $pr_flag_pos_hard_coded);
}
my @configs = split(' && ', $config);
for $configs (@configs) {
$not = $configs =~ /^!/;
$configs =~ s/^!//;
if (($configs ne "no_config") && ($configs ne "no_makefile")) {
&set_flag(\$pr_flags, $pr_flag_pos_config);
}
if (($config_cnt >= 1) &&
($configs !~ /CONFIG_/) &&
(($configs ne "no_config") && ($configs ne "no_makefile"))) {
&set_flag(\$pr_flags, $pr_flag_pos_config_hard_coded);
}
my $existing_config = $existing_config{$configs};
if ($existing_config eq "m") {
&set_flag(\$pr_flags, $pr_flag_pos_config_m);
# Possible fail, depends on whether built in or
# module is desired.
&set_flag(\$pr_flags, $pr_flag_pos_config_test_fail);
} elsif ($existing_config eq "y") {
&set_flag(\$pr_flags, $pr_flag_pos_config_y);
if ($not) {
&set_flag(\$pr_flags, $pr_flag_pos_config_test_fail);
}
} elsif (($config_file) && ($configs =~ /CONFIG_/)) {
&set_flag(\$pr_flags, $pr_flag_pos_config_none);
if (!$not) {
&set_flag(\$pr_flags, $pr_flag_pos_config_test_fail);
}
}
}
# ----- include / exclude filters
if ($include_flag_pattern && ($pr_flags !~ m/$include_flag_pattern/)) {
return 0;
}
if ($exclude_flag_pattern && ($pr_flags =~ m/$exclude_flag_pattern/)) {
return 0;
}
if ($config_format) {
print "# ";
}
print "$pr_flags : ";
return 1;
}
sub print_node()
{
# return number of lines printed
# some fields of pn_arg_ref might not be used in this function, but
# extract all of them anyway.
my $pn_arg_ref = shift;
my $compat = $pn_arg_ref->{compat};
my $compatible_cnt = $pn_arg_ref->{compatible_cnt};
my $config = $pn_arg_ref->{config};
my $config_cnt = $pn_arg_ref->{config_cnt};
my $driver = $pn_arg_ref->{driver};
my $driver_cnt = $pn_arg_ref->{driver_cnt};
my $full_node = $pn_arg_ref->{full_node};
my $node = $pn_arg_ref->{node};
my $node_enabled = $pn_arg_ref->{node_enabled};
my $white_list = $pn_arg_ref->{white_list};
my $separator;
if (! &print_flags($pn_arg_ref)) {
return 0;
}
if ($short_name) {
print "$node";
} else {
print "$full_node";
}
print " : $compat : $driver : $config : ";
my @configs = split(' && ', $config);
if ($config_file) {
for $configs (@configs) {
$configs =~ s/^!//;
my $existing_config = $existing_config{$configs};
if (!$existing_config) {
# check for /-m/, /-y/, or /-objs/
if ($configs !~ /CONFIG_/) {
$existing_config = "x";
};
};
if ($existing_config) {
print "$separator", "$existing_config";
$separator = ", ";
} else {
print "$separator", "n";
$separator = ", ";
}
}
} else {
print "none";
}
print "\n";
if ($config_format) {
for $configs (@configs) {
$not = $configs =~ /^!/;
$configs =~ s/^!//;
my $existing_config = $existing_config{$configs};
if ($not) {
if ($configs !~ /CONFIG_/) {
print "# $configs\n";
} elsif ($existing_config eq "m") {
print "# $configs is m\n";
print "# $configs=n\n";
} elsif ($existing_config eq "y") {
print "# $configs is set\n";
print "# $configs=n\n";
} else {
print "# $configs is not set\n";
print "# $configs=n\n";
}
} else {
if ($configs !~ /CONFIG_/) {
print "# $configs\n";
} elsif ($existing_config eq "m") {
print "# $configs is m\n";
print "# $configs=y\n";
} elsif ($existing_config eq "y") {
print "# $configs is set\n";
print "# $configs=y\n";
} else {
print "# $configs is not set\n";
print "# $configs=y\n";
}
}
}
}
return 1;
}
sub scan_makefile
{
my $pn_arg_ref = shift;
my $driver = shift;
# ----- Find Kconfig symbols that enable driver
my ($dir, $base) = $driver =~ m{(.*)/(.*).c};
my $makefile = $dir . "/Makefile";
if (! -r $makefile) {
$makefile = $dir . "/Kbuild";
}
if (! -r $makefile) {
my $config;
$config = 'no_makefile';
push @{ $driver_config{$driver} }, $config;
return;
}
if (!open(MAKEFILE_FILE, "<", "$makefile")) {
return;
}
my $line;
my @config;
my @if_config;
my @make_var;
NEXT_LINE:
while ($next_line = <MAKEFILE_FILE>) {
my $config;
my $if_config;
my $ifdef;
my $ifeq;
my $ifndef;
my $ifneq;
my $ifdef_config;
my $ifeq_config;
my $ifndef_config;
my $ifneq_config;
chomp($next_line);
$line = $line . $next_line;
if ($next_line =~ /\\$/) {
$line =~ s/\\$/ /;
next NEXT_LINE;
}
if ($line =~ /^\s*#/) {
$line = "";
next NEXT_LINE;
}
# ----- condition ... else ... endif
if ($line =~ /^([ ]\s*|)else\b/) {
$if_config = "!" . pop @if_config;
$if_config =~ s/^!!//;
push @if_config, $if_config;
$line =~ s/^([ ]\s*|)else\b//;
}
($null, $ifeq_config, $ifeq_config_val ) = $line =~ /^([ ]\s*|)ifeq\b.*\b(CONFIG_[A-Za-z0-9_]*)(.*)/;
($null, $ifneq_config, $ifneq_config_val) = $line =~ /^([ ]\s*|)ifneq\b.*\b(CONFIG_[A-Za-z0-9_]*)(.*)/;
($null, $ifdef_config) = $line =~ /^([ ]\s*|)ifdef\b.*\b(CONFIG_[A-Za-z0-9_]*)/;
($null, $ifndef_config) = $line =~ /^([ ]\s*|)ifndef\b.*\b(CONFIG_[A-Za-z0-9_]*)/;
($null, $ifeq) = $line =~ /^([ ]\s*|)ifeq\b\s*(.*)/;
($null, $ifneq) = $line =~ /^([ ]\s*|)ifneq\b\s*(.*)/;
($null, $ifdef) = $line =~ /^([ ]\s*|)ifdef\b\s*(.*)/;
($null, $ifndef) = $line =~ /^([ ]\s*|)ifndef\b\s*(.*)/;
# Order of tests is important. Prefer "CONFIG_*" regex match over
# less specific regex match.
if ($ifdef_config) {
$if_config = $ifdef_config;
} elsif ($ifeq_config) {
if ($ifeq_config_val =~ /y/) {
$if_config = $ifeq_config;
} else {
$if_config = "!" . $ifeq_config;
}
} elsif ($ifndef_config) {
$if_config = "!" . $ifndef_config;
} elsif ($ifneq_config) {
if ($ifneq_config_val =~ /y/) {
$if_config = "!" . $ifneq_config;
} else {
$if_config = $ifneq_config;
}
} elsif ($ifdef) {
$if_config = $ifdef;
} elsif ($ifeq) {
$if_config = $ifeq;
} elsif ($ifndef) {
$if_config = "!" . $ifndef;
} elsif ($ifneq) {
$if_config = "!" . $ifneq;
} else {
$if_config = "";
}
$if_config =~ s/^!!//;
if ($if_config) {
push @if_config, $if_config;
$line = "";
next NEXT_LINE;
}
if ($line =~ /^([ ]\s*|)endif\b/) {
pop @if_config;
$line = "";
next NEXT_LINE;
}
# ----- simple CONFIG_* = *.[co] or xxx [+:?]*= *.[co]
# Most makefiles select on *.o, but
# arch/powerpc/boot/Makefile selects on *.c
($config) = $line =~ /(CONFIG_[A-Za-z0-9_]+).*\b$base.[co]\b/;
# ----- match a make variable instead of *.[co]
# Recursively expanded variables are not handled.
if (!$config) {
my $make_var;
($make_var) = $line =~ /\s*(\S+?)\s*[+:\?]*=.*\b$base.[co]\b/;
if ($make_var) {
if ($make_var =~ /[a-zA-Z0-9]+-[ym]/) {
$config = $make_var;
} elsif ($make_var =~ /[a-zA-Z0-9]+-objs/) {
$config = $make_var;
} else {
push @make_var, $make_var;
}
}
}
if (!$config) {
for $make_var (@make_var) {
($config) = $line =~ /(CONFIG_[A-Za-z0-9_]+).*\b$make_var\b/;
last if ($config);
}
}
if (!$config) {
for $make_var (@make_var) {
($config) = $line =~ /\s*(\S+?)\s*[+:\?]*=.*\b$make_var\b/;
last if ($config);
}
}
# ----- next if no config found
if (!$config) {
$line = "";
next NEXT_LINE;
}
for $if_config (@if_config) {
$config = $if_config . " && " . $config;
}
push @{ $driver_config{$driver} }, $config;
$line = "";
}
close(MAKEFILE_FILE);
}
sub find_kconfig
{
my $pn_arg_ref = shift;
my $driver = shift;
my $lines_printed = 0;
my @configs;
if (!@{ $driver_config{$driver} }) {
&scan_makefile($pn_arg_ref, $driver);
if (!@{ $driver_config{$driver} }) {
push @{ $driver_config{$driver} }, "no_config";
}
}
@configs = @{ $driver_config{$driver} };
$$pn_arg_ref{config_cnt} = $#configs + 1;
for my $config (@configs) {
$$pn_arg_ref{config} = $config;
$lines_printed += &print_node($pn_arg_ref);
}
return $lines_printed;
}
sub handle_compatible()
{
my $full_node = shift;
my $node = shift;
my $compatible = shift;
my $node_enabled = shift;
my $compat;
my $lines_printed = 0;
my %pn_arg = ();
return if (!$node or !$compatible);
# Do not process compatible property of root node,
# it is used to match board, not to bind a driver.
return if ($node eq "/");
$pn_arg{full_node} = $full_node;
$pn_arg{node} = $node;
$pn_arg{node_enabled} = $node_enabled;
my @compatibles = split('", "', $compatible);
$compatibles[0] =~ s/^"//;
$compatibles[$#compatibles] =~ s/"$//;
$pn_arg{compatible_cnt} = $#compatibles + 1;
COMPAT:
for $compat (@compatibles) {
$pn_arg{compat} = $compat;
$pn_arg{driver_cnt} = 0;
$pn_arg{white_list} = 0;
if (exists($compat_white_list{$compat})) {
$pn_arg{white_list} = 1;
$pn_arg{driver} = "no_driver";
$pn_arg{config_cnt} = 1;
$pn_arg{config} = "no_config";
$lines_printed += &print_node(\%pn_arg);
next COMPAT;
}
# ----- if compat previously seen, use cached info
if (exists($compat_driver{$compat})) {
for my $driver (@{ $compat_driver{$compat} }) {
$pn_arg{driver} = $driver;
$pn_arg{driver_cnt} = $driver_count{$compat};
$pn_arg{config_cnt} = $#{ $driver_config{$driver}} + 1;
for my $config (@{ $driver_config{$driver} }) {
$pn_arg{config} = $config;
$lines_printed += &print_node(\%pn_arg);
}
if (!@{ $driver_config{$driver} }) {
# no config cached yet
# $driver in %driver_hard_code_list
# but not %driver_config_hard_code_list
$lines_printed += &find_kconfig(\%pn_arg, $driver);
}
}
next COMPAT;
}
# ----- Find drivers (source files that contain compatible)
# this will miss arch/sparc/include/asm/parport.h
# It is better to move the compatible out of the .h
# than to add *.h. to the files list, because *.h generates
# a lot of false negatives.
my $files = '"*.c"';
my $drivers = `git grep -l '"$compat"' -- $files`;
chomp($drivers);
if ($drivers eq "") {
$pn_arg{driver} = "no_driver";
$pn_arg{config_cnt} = 1;
$pn_arg{config} = "no_config";
push @{ $compat_driver{$compat} }, "no_driver";
$lines_printed += &print_node(\%pn_arg);
next COMPAT;
}
my @drivers = split("\n", $drivers);
$driver_count{$compat} = $#drivers + 1;
$pn_arg{driver_cnt} = $#drivers + 1;
DRIVER:
for my $driver (@drivers) {
push @{ $compat_driver{$compat} }, $driver;
$pn_arg{driver} = $driver;
# ----- if driver previously seen, use cached info
$pn_arg{config_cnt} = $#{ $driver_config{$driver} } + 1;
for my $config (@{ $driver_config{$driver} }) {
$pn_arg{config} = $config;
$lines_printed += &print_node(\%pn_arg);
}
if (@{ $driver_config{$driver} }) {
next DRIVER;
}
if ($black_list_driver) {
for $black (@black_list_driver) {
next DRIVER if ($driver =~ /^$black$/);
}
}
# ----- Find Kconfig symbols that enable driver
$lines_printed += &find_kconfig(\%pn_arg, $driver);
}
}
# White space (line) between nodes for readability.
# Each node may report several compatibles.
# For each compatible, multiple drivers may be reported.
# For each driver, multiple CONFIG_ options may be reported.
if ($lines_printed) {
print "\n";
}
}
sub read_dts()
{
my $file = shift;
my $compatible = "";
my $line;
my $node = "";
my $node_enabled = "";
if (! -r $file) {
print STDERR "file '$file' is not readable or does not exist\n";
exit 3;
}
if (!open(DT_FILE, "-|", "$dtx_diff $file")) {
print STDERR "\n";
print STDERR "shell command failed:\n";
print STDERR " $dtx_diff $file\n";
print STDERR "\n";
exit 3;
}
FILE:
while ($line = <DT_FILE>) {
chomp($line);
if ($line =~ /{/) {
&handle_compatible($full_node, $node, $compatible,
$node_enabled);
while ($end_node_count-- > 0) {
pop @full_node;
};
$end_node_count = 0;
$full_node = @full_node[-1];
$node = $line;
$node =~ s/^\s*(.*)\s+\{.*/$1/;
$node =~ s/.*: //;
if ($node eq '/' ) {
$full_node = '/';
} elsif ($full_node ne '/') {
$full_node = $full_node . '/' . $node;
} else {
$full_node = '/' . $node;
}
push @full_node, $full_node;
$compatible = "";
$node_enabled = "";
next FILE;
}
if ($line =~ /}/) {
$end_node_count++;
}
if ($line =~ /(\s+|^)status =/) {
$node_enabled = $line;
$node_enabled =~ s/^\t*//;
$node_enabled =~ s/^status = "//;
$node_enabled =~ s/";$//;
next FILE;
}
if ($line =~ /(\s+|^)compatible =/) {
# Extract all compatible entries for this device
# White space matching here and in handle_compatible() is
# precise, because input format is the output of dtc,
# which is invoked by dtx_diff.
$compatible = $line;
$compatible =~ s/^\t*//;
$compatible =~ s/^compatible = //;
$compatible =~ s/;$//;
}
}
&handle_compatible($full_node, $node, $compatible, $node_enabled);
close(DT_FILE);
}
sub read_config_file()
{
if (! -r $config_file) {
print STDERR "file '$config_file' is not readable or does not exist\n";
exit 2;
}
if (!open(CONFIG_FILE, "<", "$config_file")) {
print STDERR "open $config_file failed\n";
exit 2;
}
my @line;
LINE:
while ($line = <CONFIG_FILE>) {
chomp($line);
next LINE if ($line =~ /^\s*#/);
next LINE if ($line =~ /^\s*$/);
@line = split /=/, $line;
$existing_config{@line[0]} = @line[1];
}
close(CONFIG_FILE);
}
sub cmd_line_err()
{
my $msg = shift;
print STDERR "\n";
print STDERR " ERROR processing command line options\n";
print STDERR " $msg\n" if ($msg ne "");
print STDERR "\n";
print STDERR " For help, type '$script_name --help'\n";
print STDERR "\n";
}
# -----------------------------------------------------------------------------
# program entry point
Getopt::Long::Configure("no_ignore_case", "bundling");
if (!GetOptions(
"c=s" => \$config_file,
"config=s" => \$config_file,
"config-format" => \$config_format,
"exclude-flag=s" => \@exclude_flag,
"h" => \$help,
"help" => \$help,
"black-list-driver" => \$black_list_driver,
"white-list-config" => \$white_list_config,
"white-list-driver" => \$white_list_driver,
"include-flag=s" => \@include_flag,
"include-suspect" => \$include_suspect,
"short-name" => \$short_name,
"show-lists" => \$show_lists,
"version" => \$version,
)) {
&cmd_line_err();
exit 1;
}
my $exit_after_messages = 0;
if ($version) {
print STDERR "\n$script_name $VUFX\n\n";
$exit_after_messages = 1;
}
if ($help) {
&usage;
$exit_after_messages = 1;
}
if ($show_lists) {
print "\n";
print "These compatibles are hard coded to have no driver.\n";
print "\n";
for my $compat (sort keys %compat_white_list) {
print " $compat\n";
}
print "\n\n";
print "The driver for these compatibles is hard coded (white list).\n";
print "\n";
my $max_compat_len = 0;
for my $compat (sort keys %driver_hard_code_list) {
if (length $compat > $max_compat_len) {
$max_compat_len = length $compat;
}
}
for my $compat (sort keys %driver_hard_code_list) {
if (($driver ne "hardcoded_no_driver") && ($driver ne "no_driver")) {
my $first = 1;
for my $driver (@{ $driver_hard_code_list{$compat} }) {
if ($first) {
print " $compat";
print " " x ($max_compat_len - length $compat);
$first = 0;
} else {
print " ", " " x $max_compat_len;
}
print " $driver\n";
}
}
}
print "\n\n";
print "The configuration option for these drivers is hard coded (white list).\n";
print "\n";
my $max_driver_len = 0;
for my $driver (sort keys %driver_config_hard_code_list) {
if (length $driver > $max_driver_len) {
$max_driver_len = length $driver;
}
}
for my $driver (sort keys %driver_config_hard_code_list) {
if (($driver ne "hardcoded_no_driver") && ($driver ne "no_driver")) {
my $first = 1;
for my $config (@{ $driver_config_hard_code_list{$driver} }) {
if ($first) {
print " $driver";
print " " x ($max_driver_len - length $driver);
$first = 0;
} else {
print " ", " " x $max_driver_len;
}
print " $config\n";
}
}
}
print "\n\n";
print "These drivers are black listed.\n";
print "\n";
for my $driver (@black_list_driver) {
print " $driver\n";
}
print "\n";
$exit_after_messages = 1;
}
if ($exit_after_messages) {
exit 0;
}
$exclude_flag_pattern = "[";
for my $exclude_flag (@exclude_flag) {
$exclude_flag_pattern = $exclude_flag_pattern . $exclude_flag;
}
$exclude_flag_pattern = $exclude_flag_pattern . "]";
# clean up if empty
$exclude_flag_pattern =~ s/^\[\]$//;
$include_flag_pattern = "[";
for my $include_flag (@include_flag) {
$include_flag_pattern = $include_flag_pattern . $include_flag;
}
$include_flag_pattern = $include_flag_pattern . "]";
# clean up if empty
$include_flag_pattern =~ s/^\[\]$//;
if ($exclude_flag_pattern) {
my $found = 0;
for $pr_flag_value (@pr_flag_value) {
if ($exclude_flag_pattern =~ m/$pr_flag_value/) {
$found = 1;
}
}
if (!$found) {
&cmd_line_err("invalid value for FLAG in --exclude-flag\n");
exit 1
}
}
if ($include_flag_pattern) {
my $found = 0;
for $pr_flag_value (@pr_flag_value) {
if ($include_flag_pattern =~ m/$pr_flag_value/) {
$found = 1;
}
}
if (!$found) {
&cmd_line_err("invalid value for FLAG in --include-flag\n");
exit 1
}
}
if ($include_suspect) {
$include_flag_pattern =~ s/\[//;
$include_flag_pattern =~ s/\]//;
$include_flag_pattern = "[" . $include_flag_pattern . "A-Z]";
}
if ($exclude_flag_pattern =~ m/$include_flag_pattern/) {
&cmd_line_err("the same flag appears in both --exclude-flag and --include-flag or --include-suspect\n");
exit 1
}
# ($#ARGV < 0) is valid for --help, --version
if ($#ARGV < 0) {
&cmd_line_err("device-tree... is required");
exit 1
}
if ($config_file) {
&read_config_file();
}
# avoid pushing duplicates for this value
$driver = "hardcoded_no_driver";
for $config ( @{ $driver_config_hard_code_list{$driver} } ) {
push @{ $driver_config{$driver} }, $config;
}
if ($white_list_driver) {
for my $compat (keys %driver_hard_code_list) {
for my $driver (@{ $driver_hard_code_list{$compat} }) {
push @{ $compat_driver{$compat} }, $driver;
if ($driver ne "hardcoded_no_driver") {
$driver_count{$compat} = scalar @{ $compat_driver{$compat} };
}
}
}
}
if ($white_list_config) {
for my $driver (keys %driver_config_hard_code_list) {
if ($driver ne "hardcoded_no_driver") {
for $config ( @{ $driver_config_hard_code_list{$driver} } ) {
push @{ $driver_config{$driver} }, $config;
}
}
}
}
if (-x "scripts/dtc/dtx_diff") {
$dtx_diff = "scripts/dtc/dtx_diff";
} else {
print STDERR "\n";
print STDERR "$script_name must be run from the root directory of a Linux kernel tree\n";
print STDERR "\n";
exit 3;
}
for $file (@ARGV) {
&read_dts($file);
}
......@@ -266,7 +266,7 @@ DTC="${__KBUILD_OUTPUT}/scripts/dtc/dtc"
if [ ! -x ${DTC} ] ; then
__DTC="dtc"
if grep -q "^CONFIG_DTC=y" ${__KBUILD_OUTPUT}/.config ; then
if grep -q "^CONFIG_DTC=y" ${__KBUILD_OUTPUT}/.config 2>/dev/null; then
make_command='
make scripts'
else
......
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