Merge tag 'armsoc-late' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 25 Aug 2018 21:12:36 +0000 (14:12 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 25 Aug 2018 21:12:36 +0000 (14:12 -0700)
Pull ARM SoC late updates from Olof Johansson:
 "A couple of late-merged changes that would be useful to get in this
  merge window:

   - Driver support for reset of audio complex on Meson platforms. The
     audio driver went in this merge window, and these changes have been
     in -next for a while (just not in our tree).

   - Power management fixes for IOMMU on Rockchip platforms, getting
     closer to kexec working on them, including Chromebooks.

   - Another pass updating "arm,psci" -> "psci" for some properties that
     have snuck in since last time it was done"

* tag 'armsoc-late' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc:
  iommu/rockchip: Move irq request past pm_runtime_enable
  iommu/rockchip: Handle errors returned from PM framework
  arm64: rockchip: Force CONFIG_PM on Rockchip systems
  ARM: rockchip: Force CONFIG_PM on Rockchip systems
  arm64: dts: Fix various entry-method properties to reflect documentation
  reset: imx7: Fix always writing bits as 0
  reset: meson: add meson audio arb driver
  reset: meson: add dt-bindings for meson-axg audio arb

20 files changed:
Documentation/devicetree/bindings/arm/cpu-capacity.txt
Documentation/devicetree/bindings/arm/idle-states.txt
Documentation/devicetree/bindings/reset/amlogic,meson-axg-audio-arb.txt [new file with mode: 0644]
arch/arm/mach-rockchip/Kconfig
arch/arm64/Kconfig.platforms
arch/arm64/boot/dts/arm/juno-r1.dts
arch/arm64/boot/dts/arm/juno-r2.dts
arch/arm64/boot/dts/arm/juno.dts
arch/arm64/boot/dts/freescale/fsl-ls1012a.dtsi
arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi
arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi
arch/arm64/boot/dts/mediatek/mt2712e.dtsi
arch/arm64/boot/dts/sprd/sc9860.dtsi
arch/arm64/boot/dts/xilinx/zynqmp.dtsi
drivers/iommu/rockchip-iommu.c
drivers/reset/Kconfig
drivers/reset/Makefile
drivers/reset/reset-imx7.c
drivers/reset/reset-meson-audio-arb.c [new file with mode: 0644]
include/dt-bindings/reset/amlogic,meson-axg-audio-arb.h [new file with mode: 0644]

index 7809fbe0cdb7d65e71640e605068eba9f151234f..9b5685a1d15d9821efb9dd6d34a29ae1f788e31f 100644 (file)
@@ -94,7 +94,7 @@ cpus {
        };
 
        idle-states {
-               entry-method = "arm,psci";
+               entry-method = "psci";
 
                CPU_SLEEP_0: cpu-sleep-0 {
                        compatible = "arm,idle-state";
index 7a591333f2b199d8b9faf92f606bdf0d13060495..2c73847499abc8d73cfdd64c987d6896f804b5c7 100644 (file)
@@ -237,8 +237,8 @@ processor idle states, defined as device tree nodes, are listed.
                Value type: <stringlist>
                Usage and definition depend on ARM architecture version.
                        # On ARM v8 64-bit this property is required and must
-                         be one of:
-                          - "psci" (see bindings in [2])
+                         be:
+                          - "psci"
                        # On ARM 32-bit systems this property is optional
 
 The nodes describing the idle states (state) can only be defined within the
diff --git a/Documentation/devicetree/bindings/reset/amlogic,meson-axg-audio-arb.txt b/Documentation/devicetree/bindings/reset/amlogic,meson-axg-audio-arb.txt
new file mode 100644 (file)
index 0000000..26e542e
--- /dev/null
@@ -0,0 +1,21 @@
+* Amlogic audio memory arbiter controller
+
+The Amlogic Audio ARB is a simple device which enables or
+disables the access of Audio FIFOs to DDR on AXG based SoC.
+
+Required properties:
+- compatible: 'amlogic,meson-axg-audio-arb'
+- reg: physical base address of the controller and length of memory
+       mapped region.
+- clocks: phandle to the fifo peripheral clock provided by the audio
+         clock controller.
+- #reset-cells: must be 1.
+
+Example on the A113 SoC:
+
+arb: reset-controller@280 {
+       compatible = "amlogic,meson-axg-audio-arb";
+       reg = <0x0 0x280 0x0 0x4>;
+       #reset-cells = <1>;
+       clocks = <&clkc_audio AUD_CLKID_DDR_ARB>;
+};
index fafd3d7f9f8c4b6ff1576c756e65b06666c51c2c..8ca9265220269e4d66517a028485be7d947ebee9 100644 (file)
@@ -17,6 +17,7 @@ config ARCH_ROCKCHIP
        select ARM_GLOBAL_TIMER
        select CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK
        select ZONE_DMA if ARM_LPAE
+       select PM
        help
          Support for Rockchip's Cortex-A9 Single-to-Quad-Core-SoCs
          containing the RK2928, RK30xx and RK31xx series.
index 35f2e6e1be23f29dbbe8b511ce224be565bbb672..393d2b524284e79ab4a344779089432eb4ef31bd 100644 (file)
@@ -158,6 +158,7 @@ config ARCH_ROCKCHIP
        select GPIOLIB
        select PINCTRL
        select PINCTRL_ROCKCHIP
+       select PM
        select ROCKCHIP_TIMER
        help
          This enables support for the ARMv8 based Rockchip chipsets,
index 2c5db03f226c60b595dad62e136e32ca4d769702..b2b7ced633cf6cc6ed5b52332ed8ef31e2eae0be 100644 (file)
@@ -63,7 +63,7 @@
                };
 
                idle-states {
-                       entry-method = "arm,psci";
+                       entry-method = "psci";
 
                        CPU_SLEEP_0: cpu-sleep-0 {
                                compatible = "arm,idle-state";
index c51950f4a1b66b4088331a8741edf38bfd6eec22..ab77adb4f3c20d46902bda9d96d2c77651a02b3a 100644 (file)
@@ -63,7 +63,7 @@
                };
 
                idle-states {
-                       entry-method = "arm,psci";
+                       entry-method = "psci";
 
                        CPU_SLEEP_0: cpu-sleep-0 {
                                compatible = "arm,idle-state";
index 2b2bf39c30ef68c1347f01457bb0818516fe2d43..1fb5c5a0f32e38876e25561d39548dfe700dde34 100644 (file)
@@ -62,7 +62,7 @@
                };
 
                idle-states {
-                       entry-method = "arm,psci";
+                       entry-method = "psci";
 
                        CPU_SLEEP_0: cpu-sleep-0 {
                                compatible = "arm,idle-state";
index 4c558a2133e252fd325df23725cc9a83a267f32c..68ac78c4564dc74cdfd0f40697c1b599bee72add 100644 (file)
@@ -43,7 +43,7 @@
                 * PSCI node is not added default, U-boot will add missing
                 * parts if it determines to use PSCI.
                 */
-               entry-method = "arm,psci";
+               entry-method = "psci";
 
                CPU_PH20: cpu-ph20 {
                        compatible = "arm,idle-state";
index b9f5d2ff4ff2934c0f7dcd6037312b6fe2dda4b6..7881e3d81a9aba6134fc66a7d35e6d02daa4009a 100644 (file)
@@ -87,7 +87,7 @@
                 * PSCI node is not added default, U-boot will add missing
                 * parts if it determines to use PSCI.
                 */
-               entry-method = "arm,psci";
+               entry-method = "psci";
 
                CPU_PH20: cpu-ph20 {
                        compatible = "arm,idle-state";
index 65ce1c3cb5684f22698f153df5e212b652ba1eb8..ef83786b8b905d57852ad6637bd2d4dfb5683c43 100644 (file)
@@ -83,7 +83,7 @@
                 * PSCI node is not added default, U-boot will add missing
                 * parts if it determines to use PSCI.
                 */
-               entry-method = "arm,psci";
+               entry-method = "psci";
 
                CPU_PH20: cpu-ph20 {
                        compatible = "arm,idle-state";
index 6d8532af834688d96e1bdb7394c3d2821da393e4..75cc0f7cc088869f219d66da2fad2592acd5153e 100644 (file)
                };
 
                idle-states {
-                       entry-method = "arm,psci";
+                       entry-method = "psci";
 
                        CPU_SLEEP_0: cpu-sleep-0 {
                                compatible = "arm,idle-state";
index 3f5160d2f1307b0db5076d3dc2844fffc544489f..48f5928ed45c5d68cb179a89e01f6e793116ad76 100644 (file)
        };
 
        idle-states{
-               entry-method = "arm,psci";
+               entry-method = "psci";
 
                CORE_PD: core_pd {
                        compatible = "arm,idle-state";
index a091e6f030145fc09622270c00bd6a43391656ab..29ce23422acf221e0725e93949b99c79f975ccf7 100644 (file)
@@ -58,7 +58,7 @@
                };
 
                idle-states {
-                       entry-method = "arm,psci";
+                       entry-method = "psci";
 
                        CPU_SLEEP_0: cpu-sleep-0 {
                                compatible = "arm,idle-state";
index d393160e3e384a454e01c70c5e41e49508d13745..258115b10fa9e448129d84a0663ab99d51c64ee5 100644 (file)
@@ -521,10 +521,11 @@ static irqreturn_t rk_iommu_irq(int irq, void *dev_id)
        u32 int_status;
        dma_addr_t iova;
        irqreturn_t ret = IRQ_NONE;
-       int i;
+       int i, err;
 
-       if (WARN_ON(!pm_runtime_get_if_in_use(iommu->dev)))
-               return 0;
+       err = pm_runtime_get_if_in_use(iommu->dev);
+       if (WARN_ON_ONCE(err <= 0))
+               return ret;
 
        if (WARN_ON(clk_bulk_enable(iommu->num_clocks, iommu->clocks)))
                goto out;
@@ -620,11 +621,15 @@ static void rk_iommu_zap_iova(struct rk_iommu_domain *rk_domain,
        spin_lock_irqsave(&rk_domain->iommus_lock, flags);
        list_for_each(pos, &rk_domain->iommus) {
                struct rk_iommu *iommu;
+               int ret;
 
                iommu = list_entry(pos, struct rk_iommu, node);
 
                /* Only zap TLBs of IOMMUs that are powered on. */
-               if (pm_runtime_get_if_in_use(iommu->dev)) {
+               ret = pm_runtime_get_if_in_use(iommu->dev);
+               if (WARN_ON_ONCE(ret < 0))
+                       continue;
+               if (ret) {
                        WARN_ON(clk_bulk_enable(iommu->num_clocks,
                                                iommu->clocks));
                        rk_iommu_zap_lines(iommu, iova, size);
@@ -891,6 +896,7 @@ static void rk_iommu_detach_device(struct iommu_domain *domain,
        struct rk_iommu *iommu;
        struct rk_iommu_domain *rk_domain = to_rk_domain(domain);
        unsigned long flags;
+       int ret;
 
        /* Allow 'virtual devices' (eg drm) to detach from domain */
        iommu = rk_iommu_from_dev(dev);
@@ -909,7 +915,9 @@ static void rk_iommu_detach_device(struct iommu_domain *domain,
        list_del_init(&iommu->node);
        spin_unlock_irqrestore(&rk_domain->iommus_lock, flags);
 
-       if (pm_runtime_get_if_in_use(iommu->dev)) {
+       ret = pm_runtime_get_if_in_use(iommu->dev);
+       WARN_ON_ONCE(ret < 0);
+       if (ret > 0) {
                rk_iommu_disable(iommu);
                pm_runtime_put(iommu->dev);
        }
@@ -946,7 +954,8 @@ static int rk_iommu_attach_device(struct iommu_domain *domain,
        list_add_tail(&iommu->node, &rk_domain->iommus);
        spin_unlock_irqrestore(&rk_domain->iommus_lock, flags);
 
-       if (!pm_runtime_get_if_in_use(iommu->dev))
+       ret = pm_runtime_get_if_in_use(iommu->dev);
+       if (!ret || WARN_ON_ONCE(ret < 0))
                return 0;
 
        ret = rk_iommu_enable(iommu);
@@ -1151,17 +1160,6 @@ static int rk_iommu_probe(struct platform_device *pdev)
        if (iommu->num_mmu == 0)
                return PTR_ERR(iommu->bases[0]);
 
-       i = 0;
-       while ((irq = platform_get_irq(pdev, i++)) != -ENXIO) {
-               if (irq < 0)
-                       return irq;
-
-               err = devm_request_irq(iommu->dev, irq, rk_iommu_irq,
-                                      IRQF_SHARED, dev_name(dev), iommu);
-               if (err)
-                       return err;
-       }
-
        iommu->reset_disabled = device_property_read_bool(dev,
                                        "rockchip,disable-mmu-reset");
 
@@ -1218,6 +1216,19 @@ static int rk_iommu_probe(struct platform_device *pdev)
 
        pm_runtime_enable(dev);
 
+       i = 0;
+       while ((irq = platform_get_irq(pdev, i++)) != -ENXIO) {
+               if (irq < 0)
+                       return irq;
+
+               err = devm_request_irq(iommu->dev, irq, rk_iommu_irq,
+                                      IRQF_SHARED, dev_name(dev), iommu);
+               if (err) {
+                       pm_runtime_disable(dev);
+                       goto err_remove_sysfs;
+               }
+       }
+
        return 0;
 err_remove_sysfs:
        iommu_device_sysfs_remove(&iommu->iommu);
index a70262cb7e569dc5c47874bd286bd3afd58a1f2e..13d28fdbdbb535cdf665b39c8b52ad5127d0b9b9 100644 (file)
@@ -73,6 +73,13 @@ config RESET_MESON
        help
          This enables the reset driver for Amlogic Meson SoCs.
 
+config RESET_MESON_AUDIO_ARB
+       tristate "Meson Audio Memory Arbiter Reset Driver"
+       depends on ARCH_MESON || COMPILE_TEST
+       help
+         This enables the reset driver for Audio Memory Arbiter of
+         Amlogic's A113 based SoCs
+
 config RESET_OXNAS
        bool
 
index 0676b6b1976f2e5c02c2e136ddf0d03c4c5aace5..4243c38228e284478048c42cfbf0f900b7d7aed4 100644 (file)
@@ -12,6 +12,7 @@ obj-$(CONFIG_RESET_IMX7) += reset-imx7.o
 obj-$(CONFIG_RESET_LANTIQ) += reset-lantiq.o
 obj-$(CONFIG_RESET_LPC18XX) += reset-lpc18xx.o
 obj-$(CONFIG_RESET_MESON) += reset-meson.o
+obj-$(CONFIG_RESET_MESON_AUDIO_ARB) += reset-meson-audio-arb.o
 obj-$(CONFIG_RESET_OXNAS) += reset-oxnas.o
 obj-$(CONFIG_RESET_PISTACHIO) += reset-pistachio.o
 obj-$(CONFIG_RESET_QCOM_AOSS) += reset-qcom-aoss.o
index 14bc78d287074330d0c7b531fcd8c1f1417e21f2..97d9f08271c5b3756386d398f009d2c90ec6a6d8 100644 (file)
@@ -81,7 +81,7 @@ static int imx7_reset_set(struct reset_controller_dev *rcdev,
 {
        struct imx7_src *imx7src = to_imx7_src(rcdev);
        const struct imx7_src_signal *signal = &imx7_src_signals[id];
-       unsigned int value = 0;
+       unsigned int value = assert ? signal->bit : 0;
 
        switch (id) {
        case IMX7_RESET_PCIEPHY:
diff --git a/drivers/reset/reset-meson-audio-arb.c b/drivers/reset/reset-meson-audio-arb.c
new file mode 100644 (file)
index 0000000..9175161
--- /dev/null
@@ -0,0 +1,168 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+// Copyright (c) 2018 BayLibre, SAS.
+// Author: Jerome Brunet <jbrunet@baylibre.com>
+
+#include <linux/clk.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/of_platform.h>
+#include <linux/reset-controller.h>
+#include <linux/spinlock.h>
+
+#include <dt-bindings/reset/amlogic,meson-axg-audio-arb.h>
+
+struct meson_audio_arb_data {
+       struct reset_controller_dev rstc;
+       void __iomem *regs;
+       struct clk *clk;
+       const unsigned int *reset_bits;
+       spinlock_t lock;
+};
+
+#define ARB_GENERAL_BIT        31
+
+static const unsigned int axg_audio_arb_reset_bits[] = {
+       [AXG_ARB_TODDR_A]       = 0,
+       [AXG_ARB_TODDR_B]       = 1,
+       [AXG_ARB_TODDR_C]       = 2,
+       [AXG_ARB_FRDDR_A]       = 4,
+       [AXG_ARB_FRDDR_B]       = 5,
+       [AXG_ARB_FRDDR_C]       = 6,
+};
+
+static int meson_audio_arb_update(struct reset_controller_dev *rcdev,
+                                 unsigned long id, bool assert)
+{
+       u32 val;
+       struct meson_audio_arb_data *arb =
+               container_of(rcdev, struct meson_audio_arb_data, rstc);
+
+       spin_lock(&arb->lock);
+       val = readl(arb->regs);
+
+       if (assert)
+               val &= ~BIT(arb->reset_bits[id]);
+       else
+               val |= BIT(arb->reset_bits[id]);
+
+       writel(val, arb->regs);
+       spin_unlock(&arb->lock);
+
+       return 0;
+}
+
+static int meson_audio_arb_status(struct reset_controller_dev *rcdev,
+                                 unsigned long id)
+{
+       u32 val;
+       struct meson_audio_arb_data *arb =
+               container_of(rcdev, struct meson_audio_arb_data, rstc);
+
+       val = readl(arb->regs);
+
+       return !(val & BIT(arb->reset_bits[id]));
+}
+
+static int meson_audio_arb_assert(struct reset_controller_dev *rcdev,
+                                 unsigned long id)
+{
+       return meson_audio_arb_update(rcdev, id, true);
+}
+
+static int meson_audio_arb_deassert(struct reset_controller_dev *rcdev,
+                                   unsigned long id)
+{
+       return meson_audio_arb_update(rcdev, id, false);
+}
+
+static const struct reset_control_ops meson_audio_arb_rstc_ops = {
+       .assert = meson_audio_arb_assert,
+       .deassert = meson_audio_arb_deassert,
+       .status = meson_audio_arb_status,
+};
+
+static const struct of_device_id meson_audio_arb_of_match[] = {
+       { .compatible = "amlogic,meson-axg-audio-arb", },
+       {}
+};
+MODULE_DEVICE_TABLE(of, meson_audio_arb_of_match);
+
+static int meson_audio_arb_remove(struct platform_device *pdev)
+{
+       struct meson_audio_arb_data *arb = platform_get_drvdata(pdev);
+
+       /* Disable all access */
+       spin_lock(&arb->lock);
+       writel(0, arb->regs);
+       spin_unlock(&arb->lock);
+
+       clk_disable_unprepare(arb->clk);
+
+       return 0;
+}
+
+static int meson_audio_arb_probe(struct platform_device *pdev)
+{
+       struct device *dev = &pdev->dev;
+       struct meson_audio_arb_data *arb;
+       struct resource *res;
+       int ret;
+
+       arb = devm_kzalloc(dev, sizeof(*arb), GFP_KERNEL);
+       if (!arb)
+               return -ENOMEM;
+       platform_set_drvdata(pdev, arb);
+
+       arb->clk = devm_clk_get(dev, NULL);
+       if (IS_ERR(arb->clk)) {
+               if (PTR_ERR(arb->clk) != -EPROBE_DEFER)
+                       dev_err(dev, "failed to get clock\n");
+               return PTR_ERR(arb->clk);
+       }
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       arb->regs = devm_ioremap_resource(dev, res);
+       if (IS_ERR(arb->regs))
+               return PTR_ERR(arb->regs);
+
+       spin_lock_init(&arb->lock);
+       arb->reset_bits = axg_audio_arb_reset_bits;
+       arb->rstc.nr_resets = ARRAY_SIZE(axg_audio_arb_reset_bits);
+       arb->rstc.ops = &meson_audio_arb_rstc_ops;
+       arb->rstc.of_node = dev->of_node;
+
+       /*
+        * Enable general :
+        * In the initial state, all memory interfaces are disabled
+        * and the general bit is on
+        */
+       ret = clk_prepare_enable(arb->clk);
+       if (ret) {
+               dev_err(dev, "failed to enable arb clock\n");
+               return ret;
+       }
+       writel(BIT(ARB_GENERAL_BIT), arb->regs);
+
+       /* Register reset controller */
+       ret = devm_reset_controller_register(dev, &arb->rstc);
+       if (ret) {
+               dev_err(dev, "failed to register arb reset controller\n");
+               meson_audio_arb_remove(pdev);
+       }
+
+       return ret;
+}
+
+static struct platform_driver meson_audio_arb_pdrv = {
+       .probe = meson_audio_arb_probe,
+       .remove = meson_audio_arb_remove,
+       .driver = {
+               .name = "meson-audio-arb-reset",
+               .of_match_table = meson_audio_arb_of_match,
+       },
+};
+module_platform_driver(meson_audio_arb_pdrv);
+
+MODULE_DESCRIPTION("Amlogic A113 Audio Memory Arbiter");
+MODULE_AUTHOR("Jerome Brunet <jbrunet@baylibre.com>");
+MODULE_LICENSE("GPL v2");
diff --git a/include/dt-bindings/reset/amlogic,meson-axg-audio-arb.h b/include/dt-bindings/reset/amlogic,meson-axg-audio-arb.h
new file mode 100644 (file)
index 0000000..05c3636
--- /dev/null
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: (GPL-2.0 OR MIT)
+ *
+ * Copyright (c) 2018 Baylibre SAS.
+ * Author: Jerome Brunet <jbrunet@baylibre.com>
+ */
+
+#ifndef _DT_BINDINGS_AMLOGIC_MESON_AXG_AUDIO_ARB_H
+#define _DT_BINDINGS_AMLOGIC_MESON_AXG_AUDIO_ARB_H
+
+#define AXG_ARB_TODDR_A        0
+#define AXG_ARB_TODDR_B        1
+#define AXG_ARB_TODDR_C        2
+#define AXG_ARB_FRDDR_A        3
+#define AXG_ARB_FRDDR_B        4
+#define AXG_ARB_FRDDR_C        5
+
+#endif /* _DT_BINDINGS_AMLOGIC_MESON_AXG_AUDIO_ARB_H */