summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-04-17 14:09:02 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2026-04-17 14:09:02 -0700
commite2d10998e4293a27c0389870b5fdf736a71d61ef (patch)
tree9b2128006576e95d5a6542adf59f4242cd4bb797 /drivers
parent430cc9f42b44d174230f646767e1403699645ec5 (diff)
parenta74c2e55ab66519ffa2069ac9ae83cd937bff4c4 (diff)
Merge tag 'devicetree-for-7.1' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux
Pull devicetree updates from Rob Herring: "DT core: - Cleanup of the reserved memory code to keep CMA specifics in CMA code - Add and convert several users to new of_machine_get_match() helper - Validate nul termination in string properties - Update dtc to upstream v1.7.2-69-g53373d135579 - Limit matching reserved memory devices to /reserved-memory nodes - Fix some UAF in unittests - Remove Baikal SoC bus driver - Fix false DT_SPLIT_BINDING_PATCH checkpatch warning - Allow fw_devlink device-tree on x86 - Fix kerneldoc return description for of_property_count_elems_of_size() DT bindings: - Add fsl,imx25-aips, fsl,imx25-tcq, qcom,eliza-pdc, qcom,eliza-spmi-pmic-arb, qcom,hawi-imem, qcom,milos-imem, qcom,hawi-pdc, and lg,sw49410 bindings - Convert arm,vexpress-scc to DT schema - Deprecate Qualcomm generic CPU compatibles. Add Apple M3 CPU cores. - Move some dual-link display panels to the dual-link schema - Drop mux controller node name constraints - Remove Baikal SoC bus bindings - Fix a false warning in the thermal trip node binding" * tag 'devicetree-for-7.1' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (39 commits) dt-bindings: display: panel: panel-simple: Add lg,sw49410 compatible dt-bindings: display: ti, am65x-dss: Fix AM62L DSS reg and clock constraints dt-bindings: display: simple: Move Innolux G156HCE-L01 panel to dual-link dt-bindings: display: simple: Move AUO 21.5" FHD to dual-link dt-bindings: thermal: Fix false warning with 'phandle' in trips nodes of: unittest: fix use-after-free in testdrv_probe() of: unittest: fix use-after-free in of_unittest_changeset() dt-bindings: qcom,pdc: document the Hawi Power Domain Controller dt-bindings: ARM: arm,vexpress-scc: convert to DT schema drivers/of: fdt: validate flat DT string properties before string use drivers/of: fdt: validate stdout-path properties before parsing them dt-bindings: sram: Document qcom,hawi-imem compatible dt-bindings: sram: Allow multiple-word prefixes to sram subnode dt-bindings: sram: Document qcom,milos-imem scripts/dtc: Update to upstream version v1.7.2-69-g53373d135579 of: property: Allow fw_devlink device-tree on x86 dt-bindings: arm: cpus: Add Apple M3 CPU core compatibles dt-bindings: display: lt8912b: Drop redundant endpoint properties dt-bindings: opp-v2: Fix example 3 CPU reg value dt-bindings: connector: add pd-disable dependency ...
Diffstat (limited to 'drivers')
-rw-r--r--drivers/bus/Kconfig30
-rw-r--r--drivers/bus/Makefile2
-rw-r--r--drivers/bus/bt1-apb.c396
-rw-r--r--drivers/bus/bt1-axi.c292
-rw-r--r--drivers/cpufreq/airoha-cpufreq.c7
-rw-r--r--drivers/cpufreq/qcom-cpufreq-nvmem.c16
-rw-r--r--drivers/cpufreq/ti-cpufreq.c12
-rw-r--r--drivers/of/base.c20
-rw-r--r--drivers/of/fdt.c42
-rw-r--r--drivers/of/platform.c12
-rw-r--r--drivers/of/property.c28
-rw-r--r--drivers/of/unittest.c4
-rw-r--r--drivers/soc/qcom/qcom_pd_mapper.c2
13 files changed, 63 insertions, 800 deletions
diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig
index 7a1b04007efb..3181d8aa32a3 100644
--- a/drivers/bus/Kconfig
+++ b/drivers/bus/Kconfig
@@ -38,36 +38,6 @@ config BRCMSTB_GISB_ARB
arbiter. This driver provides timeout and target abort error handling
and internal bus master decoding.
-config BT1_APB
- bool "Baikal-T1 APB-bus driver"
- depends on MIPS_BAIKAL_T1 || COMPILE_TEST
- select REGMAP_MMIO
- help
- Baikal-T1 AXI-APB bridge is used to access the SoC subsystem CSRs.
- IO requests are routed to this bus by means of the DW AMBA 3 AXI
- Interconnect. In case of any APB protocol collisions, slave device
- not responding on timeout an IRQ is raised with an erroneous address
- reported to the APB terminator (APB Errors Handler Block). This
- driver provides the interrupt handler to detect the erroneous
- address, prints an error message about the address fault, updates an
- errors counter. The counter and the APB-bus operations timeout can be
- accessed via corresponding sysfs nodes.
-
-config BT1_AXI
- bool "Baikal-T1 AXI-bus driver"
- depends on MIPS_BAIKAL_T1 || COMPILE_TEST
- select MFD_SYSCON
- help
- AXI3-bus is the main communication bus connecting all high-speed
- peripheral IP-cores with RAM controller and with MIPS P5600 cores on
- Baikal-T1 SoC. Traffic arbitration is done by means of DW AMBA 3 AXI
- Interconnect (so called AXI Main Interconnect) routing IO requests
- from one SoC block to another. This driver provides a way to detect
- any bus protocol errors and device not responding situations by
- means of an embedded on top of the interconnect errors handler
- block (EHB). AXI Interconnect QoS arbitration tuning is currently
- unsupported.
-
config MOXTET
tristate "CZ.NIC Turris Mox module configuration bus"
depends on SPI_MASTER && OF
diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile
index 799724cfc2df..a01f97fef3e8 100644
--- a/drivers/bus/Makefile
+++ b/drivers/bus/Makefile
@@ -13,8 +13,6 @@ obj-$(CONFIG_MOXTET) += moxtet.o
# DPAA2 fsl-mc bus
obj-$(CONFIG_FSL_MC_BUS) += fsl-mc/
-obj-$(CONFIG_BT1_APB) += bt1-apb.o
-obj-$(CONFIG_BT1_AXI) += bt1-axi.o
obj-$(CONFIG_IMX_AIPSTZ) += imx-aipstz.o
obj-$(CONFIG_IMX_WEIM) += imx-weim.o
obj-$(CONFIG_INTEL_IXP4XX_EB) += intel-ixp4xx-eb.o
diff --git a/drivers/bus/bt1-apb.c b/drivers/bus/bt1-apb.c
deleted file mode 100644
index 7463124b6dd9..000000000000
--- a/drivers/bus/bt1-apb.c
+++ /dev/null
@@ -1,396 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2020 BAIKAL ELECTRONICS, JSC
- *
- * Authors:
- * Serge Semin <Sergey.Semin@baikalelectronics.ru>
- *
- * Baikal-T1 APB-bus driver
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/device.h>
-#include <linux/atomic.h>
-#include <linux/platform_device.h>
-#include <linux/interrupt.h>
-#include <linux/io.h>
-#include <linux/nmi.h>
-#include <linux/of.h>
-#include <linux/regmap.h>
-#include <linux/clk.h>
-#include <linux/reset.h>
-#include <linux/time64.h>
-#include <linux/sysfs.h>
-
-#define APB_EHB_ISR 0x00
-#define APB_EHB_ISR_PENDING BIT(0)
-#define APB_EHB_ISR_MASK BIT(1)
-#define APB_EHB_ADDR 0x04
-#define APB_EHB_TIMEOUT 0x08
-
-#define APB_EHB_TIMEOUT_MIN 0x000003FFU
-#define APB_EHB_TIMEOUT_MAX 0xFFFFFFFFU
-
-/*
- * struct bt1_apb - Baikal-T1 APB EHB private data
- * @dev: Pointer to the device structure.
- * @regs: APB EHB registers map.
- * @res: No-device error injection memory region.
- * @irq: Errors IRQ number.
- * @rate: APB-bus reference clock rate.
- * @pclk: APB-reference clock.
- * @prst: APB domain reset line.
- * @count: Number of errors detected.
- */
-struct bt1_apb {
- struct device *dev;
-
- struct regmap *regs;
- void __iomem *res;
- int irq;
-
- unsigned long rate;
- struct clk *pclk;
-
- struct reset_control *prst;
-
- atomic_t count;
-};
-
-static const struct regmap_config bt1_apb_regmap_cfg = {
- .reg_bits = 32,
- .val_bits = 32,
- .reg_stride = 4,
- .max_register = APB_EHB_TIMEOUT,
- .fast_io = true
-};
-
-static inline unsigned long bt1_apb_n_to_timeout_us(struct bt1_apb *apb, u32 n)
-{
- u64 timeout = (u64)n * USEC_PER_SEC;
-
- do_div(timeout, apb->rate);
-
- return timeout;
-
-}
-
-static inline unsigned long bt1_apb_timeout_to_n_us(struct bt1_apb *apb,
- unsigned long timeout)
-{
- u64 n = (u64)timeout * apb->rate;
-
- do_div(n, USEC_PER_SEC);
-
- return n;
-
-}
-
-static irqreturn_t bt1_apb_isr(int irq, void *data)
-{
- struct bt1_apb *apb = data;
- u32 addr = 0;
-
- regmap_read(apb->regs, APB_EHB_ADDR, &addr);
-
- dev_crit_ratelimited(apb->dev,
- "APB-bus fault %d: Slave access timeout at 0x%08x\n",
- atomic_inc_return(&apb->count),
- addr);
-
- /*
- * Print backtrace on each CPU. This might be pointless if the fault
- * has happened on the same CPU as the IRQ handler is executed or
- * the other core proceeded further execution despite the error.
- * But if it's not, by looking at the trace we would get straight to
- * the cause of the problem.
- */
- trigger_all_cpu_backtrace();
-
- regmap_update_bits(apb->regs, APB_EHB_ISR, APB_EHB_ISR_PENDING, 0);
-
- return IRQ_HANDLED;
-}
-
-static void bt1_apb_clear_data(void *data)
-{
- struct bt1_apb *apb = data;
- struct platform_device *pdev = to_platform_device(apb->dev);
-
- platform_set_drvdata(pdev, NULL);
-}
-
-static struct bt1_apb *bt1_apb_create_data(struct platform_device *pdev)
-{
- struct device *dev = &pdev->dev;
- struct bt1_apb *apb;
- int ret;
-
- apb = devm_kzalloc(dev, sizeof(*apb), GFP_KERNEL);
- if (!apb)
- return ERR_PTR(-ENOMEM);
-
- ret = devm_add_action(dev, bt1_apb_clear_data, apb);
- if (ret) {
- dev_err(dev, "Can't add APB EHB data clear action\n");
- return ERR_PTR(ret);
- }
-
- apb->dev = dev;
- atomic_set(&apb->count, 0);
- platform_set_drvdata(pdev, apb);
-
- return apb;
-}
-
-static int bt1_apb_request_regs(struct bt1_apb *apb)
-{
- struct platform_device *pdev = to_platform_device(apb->dev);
- void __iomem *regs;
-
- regs = devm_platform_ioremap_resource_byname(pdev, "ehb");
- if (IS_ERR(regs)) {
- dev_err(apb->dev, "Couldn't map APB EHB registers\n");
- return PTR_ERR(regs);
- }
-
- apb->regs = devm_regmap_init_mmio(apb->dev, regs, &bt1_apb_regmap_cfg);
- if (IS_ERR(apb->regs)) {
- dev_err(apb->dev, "Couldn't create APB EHB regmap\n");
- return PTR_ERR(apb->regs);
- }
-
- apb->res = devm_platform_ioremap_resource_byname(pdev, "nodev");
- if (IS_ERR(apb->res))
- dev_err(apb->dev, "Couldn't map reserved region\n");
-
- return PTR_ERR_OR_ZERO(apb->res);
-}
-
-static int bt1_apb_request_rst(struct bt1_apb *apb)
-{
- int ret;
-
- apb->prst = devm_reset_control_get_optional_exclusive(apb->dev, "prst");
- if (IS_ERR(apb->prst))
- return dev_err_probe(apb->dev, PTR_ERR(apb->prst),
- "Couldn't get reset control line\n");
-
- ret = reset_control_deassert(apb->prst);
- if (ret)
- dev_err(apb->dev, "Failed to deassert the reset line\n");
-
- return ret;
-}
-
-static int bt1_apb_request_clk(struct bt1_apb *apb)
-{
- apb->pclk = devm_clk_get_enabled(apb->dev, "pclk");
- if (IS_ERR(apb->pclk))
- return dev_err_probe(apb->dev, PTR_ERR(apb->pclk),
- "Couldn't get APB clock descriptor\n");
-
- apb->rate = clk_get_rate(apb->pclk);
- if (!apb->rate) {
- dev_err(apb->dev, "Invalid clock rate\n");
- return -EINVAL;
- }
-
- return 0;
-}
-
-static void bt1_apb_clear_irq(void *data)
-{
- struct bt1_apb *apb = data;
-
- regmap_update_bits(apb->regs, APB_EHB_ISR, APB_EHB_ISR_MASK, 0);
-}
-
-static int bt1_apb_request_irq(struct bt1_apb *apb)
-{
- struct platform_device *pdev = to_platform_device(apb->dev);
- int ret;
-
- apb->irq = platform_get_irq(pdev, 0);
- if (apb->irq < 0)
- return apb->irq;
-
- ret = devm_request_irq(apb->dev, apb->irq, bt1_apb_isr, IRQF_SHARED,
- "bt1-apb", apb);
- if (ret) {
- dev_err(apb->dev, "Couldn't request APB EHB IRQ\n");
- return ret;
- }
-
- ret = devm_add_action(apb->dev, bt1_apb_clear_irq, apb);
- if (ret) {
- dev_err(apb->dev, "Can't add APB EHB IRQs clear action\n");
- return ret;
- }
-
- /* Unmask IRQ and clear it' pending flag. */
- regmap_update_bits(apb->regs, APB_EHB_ISR,
- APB_EHB_ISR_PENDING | APB_EHB_ISR_MASK,
- APB_EHB_ISR_MASK);
-
- return 0;
-}
-
-static ssize_t count_show(struct device *dev, struct device_attribute *attr,
- char *buf)
-{
- struct bt1_apb *apb = dev_get_drvdata(dev);
-
- return scnprintf(buf, PAGE_SIZE, "%d\n", atomic_read(&apb->count));
-}
-static DEVICE_ATTR_RO(count);
-
-static ssize_t timeout_show(struct device *dev, struct device_attribute *attr,
- char *buf)
-{
- struct bt1_apb *apb = dev_get_drvdata(dev);
- unsigned long timeout;
- int ret;
- u32 n;
-
- ret = regmap_read(apb->regs, APB_EHB_TIMEOUT, &n);
- if (ret)
- return ret;
-
- timeout = bt1_apb_n_to_timeout_us(apb, n);
-
- return scnprintf(buf, PAGE_SIZE, "%lu\n", timeout);
-}
-
-static ssize_t timeout_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
-{
- struct bt1_apb *apb = dev_get_drvdata(dev);
- unsigned long timeout;
- int ret;
- u32 n;
-
- if (kstrtoul(buf, 0, &timeout) < 0)
- return -EINVAL;
-
- n = bt1_apb_timeout_to_n_us(apb, timeout);
- n = clamp(n, APB_EHB_TIMEOUT_MIN, APB_EHB_TIMEOUT_MAX);
-
- ret = regmap_write(apb->regs, APB_EHB_TIMEOUT, n);
-
- return ret ?: count;
-}
-static DEVICE_ATTR_RW(timeout);
-
-static ssize_t inject_error_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- return scnprintf(buf, PAGE_SIZE, "Error injection: nodev irq\n");
-}
-
-static ssize_t inject_error_store(struct device *dev,
- struct device_attribute *attr,
- const char *data, size_t count)
-{
- struct bt1_apb *apb = dev_get_drvdata(dev);
-
- /*
- * Either dummy read from the unmapped address in the APB IO area
- * or manually set the IRQ status.
- */
- if (sysfs_streq(data, "nodev"))
- readl(apb->res);
- else if (sysfs_streq(data, "irq"))
- regmap_update_bits(apb->regs, APB_EHB_ISR, APB_EHB_ISR_PENDING,
- APB_EHB_ISR_PENDING);
- else
- return -EINVAL;
-
- return count;
-}
-static DEVICE_ATTR_RW(inject_error);
-
-static struct attribute *bt1_apb_sysfs_attrs[] = {
- &dev_attr_count.attr,
- &dev_attr_timeout.attr,
- &dev_attr_inject_error.attr,
- NULL
-};
-ATTRIBUTE_GROUPS(bt1_apb_sysfs);
-
-static void bt1_apb_remove_sysfs(void *data)
-{
- struct bt1_apb *apb = data;
-
- device_remove_groups(apb->dev, bt1_apb_sysfs_groups);
-}
-
-static int bt1_apb_init_sysfs(struct bt1_apb *apb)
-{
- int ret;
-
- ret = device_add_groups(apb->dev, bt1_apb_sysfs_groups);
- if (ret) {
- dev_err(apb->dev, "Failed to create EHB APB sysfs nodes\n");
- return ret;
- }
-
- ret = devm_add_action_or_reset(apb->dev, bt1_apb_remove_sysfs, apb);
- if (ret)
- dev_err(apb->dev, "Can't add APB EHB sysfs remove action\n");
-
- return ret;
-}
-
-static int bt1_apb_probe(struct platform_device *pdev)
-{
- struct bt1_apb *apb;
- int ret;
-
- apb = bt1_apb_create_data(pdev);
- if (IS_ERR(apb))
- return PTR_ERR(apb);
-
- ret = bt1_apb_request_regs(apb);
- if (ret)
- return ret;
-
- ret = bt1_apb_request_rst(apb);
- if (ret)
- return ret;
-
- ret = bt1_apb_request_clk(apb);
- if (ret)
- return ret;
-
- ret = bt1_apb_request_irq(apb);
- if (ret)
- return ret;
-
- ret = bt1_apb_init_sysfs(apb);
- if (ret)
- return ret;
-
- return 0;
-}
-
-static const struct of_device_id bt1_apb_of_match[] = {
- { .compatible = "baikal,bt1-apb" },
- { }
-};
-MODULE_DEVICE_TABLE(of, bt1_apb_of_match);
-
-static struct platform_driver bt1_apb_driver = {
- .probe = bt1_apb_probe,
- .driver = {
- .name = "bt1-apb",
- .of_match_table = bt1_apb_of_match
- }
-};
-module_platform_driver(bt1_apb_driver);
-
-MODULE_AUTHOR("Serge Semin <Sergey.Semin@baikalelectronics.ru>");
-MODULE_DESCRIPTION("Baikal-T1 APB-bus driver");
diff --git a/drivers/bus/bt1-axi.c b/drivers/bus/bt1-axi.c
deleted file mode 100644
index a5254c73bf43..000000000000
--- a/drivers/bus/bt1-axi.c
+++ /dev/null
@@ -1,292 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2020 BAIKAL ELECTRONICS, JSC
- *
- * Authors:
- * Serge Semin <Sergey.Semin@baikalelectronics.ru>
- *
- * Baikal-T1 AXI-bus driver
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/bitfield.h>
-#include <linux/device.h>
-#include <linux/atomic.h>
-#include <linux/regmap.h>
-#include <linux/platform_device.h>
-#include <linux/mfd/syscon.h>
-#include <linux/interrupt.h>
-#include <linux/io.h>
-#include <linux/nmi.h>
-#include <linux/of.h>
-#include <linux/clk.h>
-#include <linux/reset.h>
-#include <linux/sysfs.h>
-
-#define BT1_AXI_WERRL 0x110
-#define BT1_AXI_WERRH 0x114
-#define BT1_AXI_WERRH_TYPE BIT(23)
-#define BT1_AXI_WERRH_ADDR_FLD 24
-#define BT1_AXI_WERRH_ADDR_MASK GENMASK(31, BT1_AXI_WERRH_ADDR_FLD)
-
-/*
- * struct bt1_axi - Baikal-T1 AXI-bus private data
- * @dev: Pointer to the device structure.
- * @qos_regs: AXI Interconnect QoS tuning registers.
- * @sys_regs: Baikal-T1 System Controller registers map.
- * @irq: Errors IRQ number.
- * @aclk: AXI reference clock.
- * @arst: AXI Interconnect reset line.
- * @count: Number of errors detected.
- */
-struct bt1_axi {
- struct device *dev;
-
- void __iomem *qos_regs;
- struct regmap *sys_regs;
- int irq;
-
- struct clk *aclk;
-
- struct reset_control *arst;
-
- atomic_t count;
-};
-
-static irqreturn_t bt1_axi_isr(int irq, void *data)
-{
- struct bt1_axi *axi = data;
- u32 low = 0, high = 0;
-
- regmap_read(axi->sys_regs, BT1_AXI_WERRL, &low);
- regmap_read(axi->sys_regs, BT1_AXI_WERRH, &high);
-
- dev_crit_ratelimited(axi->dev,
- "AXI-bus fault %d: %s at 0x%x%08x\n",
- atomic_inc_return(&axi->count),
- high & BT1_AXI_WERRH_TYPE ? "no slave" : "slave protocol error",
- high, low);
-
- /*
- * Print backtrace on each CPU. This might be pointless if the fault
- * has happened on the same CPU as the IRQ handler is executed or
- * the other core proceeded further execution despite the error.
- * But if it's not, by looking at the trace we would get straight to
- * the cause of the problem.
- */
- trigger_all_cpu_backtrace();
-
- return IRQ_HANDLED;
-}
-
-static void bt1_axi_clear_data(void *data)
-{
- struct bt1_axi *axi = data;
- struct platform_device *pdev = to_platform_device(axi->dev);
-
- platform_set_drvdata(pdev, NULL);
-}
-
-static struct bt1_axi *bt1_axi_create_data(struct platform_device *pdev)
-{
- struct device *dev = &pdev->dev;
- struct bt1_axi *axi;
- int ret;
-
- axi = devm_kzalloc(dev, sizeof(*axi), GFP_KERNEL);
- if (!axi)
- return ERR_PTR(-ENOMEM);
-
- ret = devm_add_action(dev, bt1_axi_clear_data, axi);
- if (ret) {
- dev_err(dev, "Can't add AXI EHB data clear action\n");
- return ERR_PTR(ret);
- }
-
- axi->dev = dev;
- atomic_set(&axi->count, 0);
- platform_set_drvdata(pdev, axi);
-
- return axi;
-}
-
-static int bt1_axi_request_regs(struct bt1_axi *axi)
-{
- struct platform_device *pdev = to_platform_device(axi->dev);
- struct device *dev = axi->dev;
-
- axi->sys_regs = syscon_regmap_lookup_by_phandle(dev->of_node, "syscon");
- if (IS_ERR(axi->sys_regs)) {
- dev_err(dev, "Couldn't find syscon registers\n");
- return PTR_ERR(axi->sys_regs);
- }
-
- axi->qos_regs = devm_platform_ioremap_resource_byname(pdev, "qos");
- if (IS_ERR(axi->qos_regs))
- dev_err(dev, "Couldn't map AXI-bus QoS registers\n");
-
- return PTR_ERR_OR_ZERO(axi->qos_regs);
-}
-
-static int bt1_axi_request_rst(struct bt1_axi *axi)
-{
- int ret;
-
- axi->arst = devm_reset_control_get_optional_exclusive(axi->dev, "arst");
- if (IS_ERR(axi->arst))
- return dev_err_probe(axi->dev, PTR_ERR(axi->arst),
- "Couldn't get reset control line\n");
-
- ret = reset_control_deassert(axi->arst);
- if (ret)
- dev_err(axi->dev, "Failed to deassert the reset line\n");
-
- return ret;
-}
-
-static int bt1_axi_request_clk(struct bt1_axi *axi)
-{
- axi->aclk = devm_clk_get_enabled(axi->dev, "aclk");
- if (IS_ERR(axi->aclk))
- return dev_err_probe(axi->dev, PTR_ERR(axi->aclk),
- "Couldn't get AXI Interconnect clock\n");
-
- return 0;
-}
-
-static int bt1_axi_request_irq(struct bt1_axi *axi)
-{
- struct platform_device *pdev = to_platform_device(axi->dev);
- int ret;
-
- axi->irq = platform_get_irq(pdev, 0);
- if (axi->irq < 0)
- return axi->irq;
-
- ret = devm_request_irq(axi->dev, axi->irq, bt1_axi_isr, IRQF_SHARED,
- "bt1-axi", axi);
- if (ret)
- dev_err(axi->dev, "Couldn't request AXI EHB IRQ\n");
-
- return ret;
-}
-
-static ssize_t count_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct bt1_axi *axi = dev_get_drvdata(dev);
-
- return scnprintf(buf, PAGE_SIZE, "%d\n", atomic_read(&axi->count));
-}
-static DEVICE_ATTR_RO(count);
-
-static ssize_t inject_error_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- return scnprintf(buf, PAGE_SIZE, "Error injection: bus unaligned\n");
-}
-
-static ssize_t inject_error_store(struct device *dev,
- struct device_attribute *attr,
- const char *data, size_t count)
-{
- struct bt1_axi *axi = dev_get_drvdata(dev);
-
- /*
- * Performing unaligned read from the memory will cause the CM2 bus
- * error while unaligned writing - the AXI bus write error handled
- * by this driver.
- */
- if (sysfs_streq(data, "bus"))
- readb(axi->qos_regs);
- else if (sysfs_streq(data, "unaligned"))
- writeb(0, axi->qos_regs);
- else
- return -EINVAL;
-
- return count;
-}
-static DEVICE_ATTR_RW(inject_error);
-
-static struct attribute *bt1_axi_sysfs_attrs[] = {
- &dev_attr_count.attr,
- &dev_attr_inject_error.attr,
- NULL
-};
-ATTRIBUTE_GROUPS(bt1_axi_sysfs);
-
-static void bt1_axi_remove_sysfs(void *data)
-{
- struct bt1_axi *axi = data;
-
- device_remove_groups(axi->dev, bt1_axi_sysfs_groups);
-}
-
-static int bt1_axi_init_sysfs(struct bt1_axi *axi)
-{
- int ret;
-
- ret = device_add_groups(axi->dev, bt1_axi_sysfs_groups);
- if (ret) {
- dev_err(axi->dev, "Failed to add sysfs files group\n");
- return ret;
- }
-
- ret = devm_add_action_or_reset(axi->dev, bt1_axi_remove_sysfs, axi);
- if (ret)
- dev_err(axi->dev, "Can't add AXI EHB sysfs remove action\n");
-
- return ret;
-}
-
-static int bt1_axi_probe(struct platform_device *pdev)
-{
- struct bt1_axi *axi;
- int ret;
-
- axi = bt1_axi_create_data(pdev);
- if (IS_ERR(axi))
- return PTR_ERR(axi);
-
- ret = bt1_axi_request_regs(axi);
- if (ret)
- return ret;
-
- ret = bt1_axi_request_rst(axi);
- if (ret)
- return ret;
-
- ret = bt1_axi_request_clk(axi);
- if (ret)
- return ret;
-
- ret = bt1_axi_request_irq(axi);
- if (ret)
- return ret;
-
- ret = bt1_axi_init_sysfs(axi);
- if (ret)
- return ret;
-
- return 0;
-}
-
-static const struct of_device_id bt1_axi_of_match[] = {
- { .compatible = "baikal,bt1-axi" },
- { }
-};
-MODULE_DEVICE_TABLE(of, bt1_axi_of_match);
-
-static struct platform_driver bt1_axi_driver = {
- .probe = bt1_axi_probe,
- .driver = {
- .name = "bt1-axi",
- .of_match_table = bt1_axi_of_match
- }
-};
-module_platform_driver(bt1_axi_driver);
-
-MODULE_AUTHOR("Serge Semin <Sergey.Semin@baikalelectronics.ru>");
-MODULE_DESCRIPTION("Baikal-T1 AXI-bus driver");
diff --git a/drivers/cpufreq/airoha-cpufreq.c b/drivers/cpufreq/airoha-cpufreq.c
index b6b1cdc4d11d..3e7770860d13 100644
--- a/drivers/cpufreq/airoha-cpufreq.c
+++ b/drivers/cpufreq/airoha-cpufreq.c
@@ -115,15 +115,10 @@ MODULE_DEVICE_TABLE(of, airoha_cpufreq_match_list);
static int __init airoha_cpufreq_init(void)
{
- struct device_node *np = of_find_node_by_path("/");
const struct of_device_id *match;
int ret;
- if (!np)
- return -ENODEV;
-
- match = of_match_node(airoha_cpufreq_match_list, np);
- of_node_put(np);
+ match = of_machine_get_match(airoha_cpufreq_match_list);
if (!match)
return -ENODEV;
diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c
index b8081acba928..e6d28d162442 100644
--- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
+++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
@@ -291,17 +291,9 @@ static int qcom_cpufreq_ipq8064_name_version(struct device *cpu_dev,
ret = qcom_smem_get_soc_id(&msm_id);
if (ret == -ENODEV) {
const struct of_device_id *match;
- struct device_node *root;
-
- root = of_find_node_by_path("/");
- if (!root) {
- ret = -ENODEV;
- goto exit;
- }
/* Fallback to compatible match with no SMEM initialized */
- match = of_match_node(qcom_cpufreq_ipq806x_match_list, root);
- of_node_put(root);
+ match = of_machine_get_match(qcom_cpufreq_ipq806x_match_list);
if (!match) {
ret = -ENODEV;
goto exit;
@@ -647,14 +639,10 @@ MODULE_DEVICE_TABLE(of, qcom_cpufreq_match_list);
*/
static int __init qcom_cpufreq_init(void)
{
- struct device_node *np __free(device_node) = of_find_node_by_path("/");
const struct of_device_id *match;
int ret;
- if (!np)
- return -ENODEV;
-
- match = of_match_node(qcom_cpufreq_match_list, np);
+ match = of_machine_get_match(qcom_cpufreq_match_list);
if (!match)
return -ENODEV;
diff --git a/drivers/cpufreq/ti-cpufreq.c b/drivers/cpufreq/ti-cpufreq.c
index 3d1129aeed02..a01abc1622eb 100644
--- a/drivers/cpufreq/ti-cpufreq.c
+++ b/drivers/cpufreq/ti-cpufreq.c
@@ -502,16 +502,6 @@ static const struct of_device_id ti_cpufreq_of_match[] __maybe_unused = {
{},
};
-static const struct of_device_id *ti_cpufreq_match_node(void)
-{
- struct device_node *np __free(device_node) = of_find_node_by_path("/");
- const struct of_device_id *match;
-
- match = of_match_node(ti_cpufreq_of_match, np);
-
- return match;
-}
-
static int ti_cpufreq_probe(struct platform_device *pdev)
{
u32 version[VERSION_COUNT];
@@ -596,7 +586,7 @@ static int __init ti_cpufreq_init(void)
const struct of_device_id *match;
/* Check to ensure we are on a compatible platform */
- match = ti_cpufreq_match_node();
+ match = of_machine_get_match(ti_cpufreq_of_match);
if (match)
platform_device_register_data(NULL, "ti-cpufreq", -1, match,
sizeof(*match));
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 180dbce65b98..a650c91897cc 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -463,13 +463,12 @@ int of_machine_read_model(const char **model)
EXPORT_SYMBOL_GPL(of_machine_read_model);
/**
- * of_machine_device_match - Test root of device tree against a of_device_id array
+ * of_machine_get_match - Test root of device tree against an of_device_id array
* @matches: NULL terminated array of of_device_id match structures to search in
*
- * Returns true if the root node has any of the given compatible values in its
- * compatible property.
+ * Returns matched entry or NULL
*/
-bool of_machine_device_match(const struct of_device_id *matches)
+const struct of_device_id *of_machine_get_match(const struct of_device_id *matches)
{
struct device_node *root;
const struct of_device_id *match = NULL;
@@ -480,9 +479,9 @@ bool of_machine_device_match(const struct of_device_id *matches)
of_node_put(root);
}
- return match != NULL;
+ return match;
}
-EXPORT_SYMBOL(of_machine_device_match);
+EXPORT_SYMBOL(of_machine_get_match);
/**
* of_machine_get_match_data - Tell if root of device tree has a matching of_match structure
@@ -493,15 +492,8 @@ EXPORT_SYMBOL(of_machine_device_match);
const void *of_machine_get_match_data(const struct of_device_id *matches)
{
const struct of_device_id *match;
- struct device_node *root;
-
- root = of_find_node_by_path("/");
- if (!root)
- return NULL;
-
- match = of_match_node(matches, root);
- of_node_put(root);
+ match = of_machine_get_match(matches);
if (!match)
return NULL;
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 104e697bee7b..82f7327c59ea 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -68,7 +68,7 @@ void __init of_fdt_limit_memory(int limit)
bool of_fdt_device_is_available(const void *blob, unsigned long node)
{
- const char *status = fdt_getprop(blob, node, "status", NULL);
+ const char *status = fdt_stringlist_get(blob, node, "status", 0, NULL);
if (!status)
return true;
@@ -677,22 +677,15 @@ void __init of_flat_dt_read_addr_size(const __be32 *prop, int entry_index,
* specific compatible values.
*/
static int of_fdt_is_compatible(const void *blob,
- unsigned long node, const char *compat)
+ unsigned long node, const char *compat)
{
const char *cp;
- int cplen;
- unsigned long l, score = 0;
+ int idx = 0, score = 0;
- cp = fdt_getprop(blob, node, "compatible", &cplen);
- if (cp == NULL)
- return 0;
- while (cplen > 0) {
+ while ((cp = fdt_stringlist_get(blob, node, "compatible", idx++, NULL))) {
score++;
if (of_compat_cmp(cp, compat, strlen(compat)) == 0)
return score;
- l = strlen(cp) + 1;
- cp += l;
- cplen -= l;
}
return 0;
@@ -741,9 +734,10 @@ const char * __init of_flat_dt_get_machine_name(void)
const char *name;
unsigned long dt_root = of_get_flat_dt_root();
- name = of_get_flat_dt_prop(dt_root, "model", NULL);
+ name = fdt_stringlist_get(initial_boot_params, dt_root, "model", 0, NULL);
if (!name)
- name = of_get_flat_dt_prop(dt_root, "compatible", NULL);
+ name = fdt_stringlist_get(initial_boot_params, dt_root,
+ "compatible", 0, NULL);
return name;
}
@@ -775,19 +769,14 @@ const void * __init of_flat_dt_match_machine(const void *default_match,
}
if (!best_data) {
const char *prop;
- int size;
+ int idx = 0, size;
pr_err("\n unrecognized device tree list:\n[ ");
- prop = of_get_flat_dt_prop(dt_root, "compatible", &size);
- if (prop) {
- while (size > 0) {
- printk("'%s' ", prop);
- size -= strlen(prop) + 1;
- prop += strlen(prop) + 1;
- }
- }
- printk("]\n\n");
+ while ((prop = fdt_stringlist_get(initial_boot_params, dt_root,
+ "compatible", idx++, &size)))
+ pr_err("'%s' ", prop);
+ pr_err("]\n\n");
return NULL;
}
@@ -974,9 +963,9 @@ int __init early_init_dt_scan_chosen_stdout(void)
if (offset < 0)
return -ENOENT;
- p = fdt_getprop(fdt, offset, "stdout-path", &l);
+ p = fdt_stringlist_get(fdt, offset, "stdout-path", 0, &l);
if (!p)
- p = fdt_getprop(fdt, offset, "linux,stdout-path", &l);
+ p = fdt_stringlist_get(fdt, offset, "linux,stdout-path", 0, &l);
if (!p || !l)
return -ENOENT;
@@ -1052,7 +1041,8 @@ int __init early_init_dt_scan_memory(void)
const void *fdt = initial_boot_params;
fdt_for_each_subnode(node, fdt, 0) {
- const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
+ const char *type = fdt_stringlist_get(fdt, node,
+ "device_type", 0, NULL);
const __be32 *reg;
int i, l;
bool hotpluggable;
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 7eeaf8e27b5b..a42224f9d1a8 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -500,7 +500,7 @@ static const struct of_device_id reserved_mem_matches[] = {
static int __init of_platform_default_populate_init(void)
{
- struct device_node *node;
+ struct device_node *node, *reserved;
device_links_supplier_sync_state_pause();
@@ -563,8 +563,14 @@ static int __init of_platform_default_populate_init(void)
* platform_devices for every node in /reserved-memory with a
* "compatible",
*/
- for_each_matching_node(node, reserved_mem_matches)
- of_platform_device_create(node, NULL, NULL);
+ reserved = of_find_node_by_path("/reserved-memory");
+ if (reserved) {
+ for_each_child_of_node(reserved, node) {
+ if (of_match_node(reserved_mem_matches, node))
+ of_platform_device_create(node, NULL, NULL);
+ }
+ of_node_put(reserved);
+ }
node = of_find_node_by_path("/firmware");
if (node) {
diff --git a/drivers/of/property.c b/drivers/of/property.c
index 50d95d512bf5..136946f8b746 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -88,7 +88,7 @@ EXPORT_SYMBOL(of_graph_is_present);
* Search for a property in a device node and count the number of elements of
* size elem_size in it.
*
- * Return: The number of elements on sucess, -EINVAL if the property does not
+ * Return: The number of elements on success, -EINVAL if the property does not
* exist or its length does not match a multiple of elem_size and -ENODATA if
* the property does not have a value.
*/
@@ -1620,12 +1620,36 @@ static int of_fwnode_irq_get(const struct fwnode_handle *fwnode,
return of_irq_get(to_of_node(fwnode), index);
}
+static int match_property_by_path(const char *node_path, const char *prop_name,
+ const char *value)
+{
+ struct device_node *np __free(device_node) = of_find_node_by_path(node_path);
+
+ return of_property_match_string(np, prop_name, value);
+}
+
+static bool of_is_fwnode_add_links_supported(void)
+{
+ static int is_supported = -1;
+
+ if (!IS_ENABLED(CONFIG_X86))
+ return true;
+
+ if (is_supported != -1)
+ return !!is_supported;
+
+ is_supported = !((match_property_by_path("/soc", "compatible", "intel,ce4100-cp") >= 0) ||
+ (match_property_by_path("/", "architecture", "OLPC") >= 0));
+
+ return !!is_supported;
+}
+
static int of_fwnode_add_links(struct fwnode_handle *fwnode)
{
const struct property *p;
struct device_node *con_np = to_of_node(fwnode);
- if (IS_ENABLED(CONFIG_X86))
+ if (!of_is_fwnode_add_links_supported())
return 0;
if (!con_np)
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index 2940295843e6..4078569a0f96 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -896,8 +896,6 @@ static void __init of_unittest_changeset(void)
unittest(!of_changeset_apply(&chgset), "apply failed\n");
- of_node_put(nchangeset);
-
/* Make sure node names are constructed correctly */
unittest((np = of_find_node_by_path("/testcase-data/changeset/n2/n21")),
"'%pOF' not added\n", n21);
@@ -919,6 +917,7 @@ static void __init of_unittest_changeset(void)
if (!ret)
unittest(strcmp(propstr, "hello") == 0, "original value not in updated property after revert");
+ of_node_put(nchangeset);
of_changeset_destroy(&chgset);
of_node_put(n1);
@@ -4318,7 +4317,6 @@ static int testdrv_probe(struct pci_dev *pdev, const struct pci_device_id *id)
size = info->dtbo_end - info->dtbo_begin;
ret = of_overlay_fdt_apply(info->dtbo_begin, size, &ovcs_id, dn);
- of_node_put(dn);
if (ret)
return ret;
diff --git a/drivers/soc/qcom/qcom_pd_mapper.c b/drivers/soc/qcom/qcom_pd_mapper.c
index bb99f003844b..7bb14c20ab5d 100644
--- a/drivers/soc/qcom/qcom_pd_mapper.c
+++ b/drivers/soc/qcom/qcom_pd_mapper.c
@@ -640,7 +640,7 @@ static struct qcom_pdm_data *qcom_pdm_start(void)
struct qcom_pdm_data *data;
int ret, i;
- match = of_match_node(qcom_pdm_domains, of_root);
+ match = of_machine_get_match(qcom_pdm_domains);
if (!match) {
pr_notice("PDM: no support for the platform, userspace daemon might be required.\n");
return ERR_PTR(-ENODEV);