Merge tag 'drivers_soc_for_5.15' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorArnd Bergmann <arnd@arndb.de>
Thu, 12 Aug 2021 20:37:50 +0000 (22:37 +0200)
committerArnd Bergmann <arnd@arndb.de>
Thu, 12 Aug 2021 20:37:51 +0000 (22:37 +0200)
soc: Keystone SOC drivers for v5.15

The pull request contains:
 - ICSSG subsystem support for Keystone3 AM64x SOCs
 - Removes smartrefelx PM dependency for deeper low power states

* tag 'drivers_soc_for_5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/ssantosh/linux-keystone:
  dt-bindings: soc: ti: pruss: Add dma-coherent property
  soc: ti: Remove pm_runtime_irq_safe() usage for smartreflex
  soc: ti: pruss: Enable support for ICSSG subsystems on K3 AM64x SoCs
  dt-bindings: soc: ti: pruss: Update bindings for K3 AM64x SoCs

Link: https://lore.kernel.org/r/0A637A41-2353-4900-962C-DBE50BBDE75A@oracle.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Documentation/devicetree/bindings/soc/ti/ti,pruss.yaml
drivers/bus/ti-sysc.c
drivers/soc/ti/pruss.c
drivers/soc/ti/smartreflex.c
include/linux/power/smartreflex.h

index 9790617..9d128b9 100644 (file)
@@ -68,6 +68,7 @@ properties:
       - ti,k2g-pruss     # for 66AK2G SoC family
       - ti,am654-icssg   # for K3 AM65x SoC family
       - ti,j721e-icssg   # for K3 J721E SoC family
+      - ti,am642-icssg   # for K3 AM64x SoC family
 
   reg:
     maxItems: 1
@@ -84,6 +85,8 @@ properties:
   dma-ranges:
     maxItems: 1
 
+  dma-coherent: true
+
   power-domains:
     description: |
       This property is as per sci-pm-domain.txt.
@@ -231,8 +234,8 @@ patternProperties:
     description: |
       Industrial Ethernet Peripheral to manage/generate Industrial Ethernet
       functions such as time stamping. Each PRUSS has either 1 IEP (on AM335x,
-      AM437x, AM57xx & 66AK2G SoCs) or 2 IEPs (on K3 AM65x & J721E SoCs ). IEP
-      is used for creating PTP clocks and generating PPS signals.
+      AM437x, AM57xx & 66AK2G SoCs) or 2 IEPs (on K3 AM65x, J721E & AM64x SoCs).
+      IEP is used for creating PTP clocks and generating PPS signals.
 
     type: object
 
@@ -323,17 +326,29 @@ additionalProperties: false
 # - interrupt-controller
 # - pru
 
-if:
-  properties:
-    compatible:
-      contains:
-        enum:
-          - ti,k2g-pruss
-          - ti,am654-icssg
-          - ti,j721e-icssg
-then:
-  required:
-    - power-domains
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - ti,k2g-pruss
+              - ti,am654-icssg
+              - ti,j721e-icssg
+              - ti,am642-icssg
+    then:
+      required:
+        - power-domains
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - ti,k2g-pruss
+    then:
+      required:
+        - dma-coherent
 
 examples:
   - |
index 9faae11..8b718e5 100644 (file)
@@ -1446,10 +1446,6 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = {
                   SYSC_QUIRK_LEGACY_IDLE | SYSC_QUIRK_OPT_CLKS_IN_RESET),
        SYSC_QUIRK("sham", 0, 0x100, 0x110, 0x114, 0x40000c03, 0xffffffff,
                   SYSC_QUIRK_LEGACY_IDLE),
-       SYSC_QUIRK("smartreflex", 0, -ENODEV, 0x24, -ENODEV, 0x00000000, 0xffffffff,
-                  SYSC_QUIRK_LEGACY_IDLE),
-       SYSC_QUIRK("smartreflex", 0, -ENODEV, 0x38, -ENODEV, 0x00000000, 0xffffffff,
-                  SYSC_QUIRK_LEGACY_IDLE),
        SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x00000046, 0xffffffff,
                   SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE),
        SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x00000052, 0xffffffff,
@@ -1586,6 +1582,8 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = {
        SYSC_QUIRK("sdma", 0, 0, 0x2c, 0x28, 0x00010900, 0xffffffff, 0),
        SYSC_QUIRK("slimbus", 0, 0, 0x10, -ENODEV, 0x40000902, 0xffffffff, 0),
        SYSC_QUIRK("slimbus", 0, 0, 0x10, -ENODEV, 0x40002903, 0xffffffff, 0),
+       SYSC_QUIRK("smartreflex", 0, -ENODEV, 0x24, -ENODEV, 0x00000000, 0xffffffff, 0),
+       SYSC_QUIRK("smartreflex", 0, -ENODEV, 0x38, -ENODEV, 0x00000000, 0xffffffff, 0),
        SYSC_QUIRK("spinlock", 0, 0, 0x10, -ENODEV, 0x50020000, 0xffffffff, 0),
        SYSC_QUIRK("rng", 0, 0x1fe0, 0x1fe4, -ENODEV, 0x00000020, 0xffffffff, 0),
        SYSC_QUIRK("timer", 0, 0, 0x10, 0x14, 0x00000013, 0xffffffff, 0),
index f22ac1e..49da387 100644 (file)
@@ -338,6 +338,7 @@ static const struct of_device_id pruss_of_match[] = {
        { .compatible = "ti,k2g-pruss" },
        { .compatible = "ti,am654-icssg", .data = &am65x_j721e_pruss_data, },
        { .compatible = "ti,j721e-icssg", .data = &am65x_j721e_pruss_data, },
+       { .compatible = "ti,am642-icssg", .data = &am65x_j721e_pruss_data, },
        {},
 };
 MODULE_DEVICE_TABLE(of, pruss_of_match);
index 06cbee5..b5b2fa5 100644 (file)
@@ -126,23 +126,13 @@ static irqreturn_t sr_interrupt(int irq, void *data)
 
 static void sr_set_clk_length(struct omap_sr *sr)
 {
-       struct clk *fck;
        u32 fclk_speed;
 
        /* Try interconnect target module fck first if it already exists */
-       fck = clk_get(sr->pdev->dev.parent, "fck");
-       if (IS_ERR(fck)) {
-               fck = clk_get(&sr->pdev->dev, "fck");
-               if (IS_ERR(fck)) {
-                       dev_err(&sr->pdev->dev,
-                               "%s: unable to get fck for device %s\n",
-                               __func__, dev_name(&sr->pdev->dev));
-                       return;
-               }
-       }
+       if (IS_ERR(sr->fck))
+               return;
 
-       fclk_speed = clk_get_rate(fck);
-       clk_put(fck);
+       fclk_speed = clk_get_rate(sr->fck);
 
        switch (fclk_speed) {
        case 12000000:
@@ -587,21 +577,25 @@ int sr_enable(struct omap_sr *sr, unsigned long volt)
        /* errminlimit is opp dependent and hence linked to voltage */
        sr->err_minlimit = nvalue_row->errminlimit;
 
-       pm_runtime_get_sync(&sr->pdev->dev);
+       clk_enable(sr->fck);
 
        /* Check if SR is already enabled. If yes do nothing */
        if (sr_read_reg(sr, SRCONFIG) & SRCONFIG_SRENABLE)
-               return 0;
+               goto out_enabled;
 
        /* Configure SR */
        ret = sr_class->configure(sr);
        if (ret)
-               return ret;
+               goto out_enabled;
 
        sr_write_reg(sr, NVALUERECIPROCAL, nvalue_row->nvalue);
 
        /* SRCONFIG - enable SR */
        sr_modify_reg(sr, SRCONFIG, SRCONFIG_SRENABLE, SRCONFIG_SRENABLE);
+
+out_enabled:
+       sr->enabled = 1;
+
        return 0;
 }
 
@@ -621,7 +615,7 @@ void sr_disable(struct omap_sr *sr)
        }
 
        /* Check if SR clocks are already disabled. If yes do nothing */
-       if (pm_runtime_suspended(&sr->pdev->dev))
+       if (!sr->enabled)
                return;
 
        /*
@@ -642,7 +636,8 @@ void sr_disable(struct omap_sr *sr)
                }
        }
 
-       pm_runtime_put_sync_suspend(&sr->pdev->dev);
+       clk_disable(sr->fck);
+       sr->enabled = 0;
 }
 
 /**
@@ -851,8 +846,12 @@ static int omap_sr_probe(struct platform_device *pdev)
 
        irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 
+       sr_info->fck = devm_clk_get(pdev->dev.parent, "fck");
+       if (IS_ERR(sr_info->fck))
+               return PTR_ERR(sr_info->fck);
+       clk_prepare(sr_info->fck);
+
        pm_runtime_enable(&pdev->dev);
-       pm_runtime_irq_safe(&pdev->dev);
 
        snprintf(sr_info->name, SMARTREFLEX_NAME_LEN, "%s", pdata->name);
 
@@ -878,12 +877,6 @@ static int omap_sr_probe(struct platform_device *pdev)
 
        list_add(&sr_info->node, &sr_list);
 
-       ret = pm_runtime_get_sync(&pdev->dev);
-       if (ret < 0) {
-               pm_runtime_put_noidle(&pdev->dev);
-               goto err_list_del;
-       }
-
        /*
         * Call into late init to do initializations that require
         * both sr driver and sr class driver to be initiallized.
@@ -933,16 +926,13 @@ static int omap_sr_probe(struct platform_device *pdev)
 
        }
 
-       pm_runtime_put_sync(&pdev->dev);
-
        return ret;
 
 err_debugfs:
        debugfs_remove_recursive(sr_info->dbg_dir);
 err_list_del:
        list_del(&sr_info->node);
-
-       pm_runtime_put_sync(&pdev->dev);
+       clk_unprepare(sr_info->fck);
 
        return ret;
 }
@@ -950,6 +940,7 @@ err_list_del:
 static int omap_sr_remove(struct platform_device *pdev)
 {
        struct omap_sr_data *pdata = pdev->dev.platform_data;
+       struct device *dev = &pdev->dev;
        struct omap_sr *sr_info;
 
        if (!pdata) {
@@ -968,7 +959,8 @@ static int omap_sr_remove(struct platform_device *pdev)
                sr_stop_vddautocomp(sr_info);
        debugfs_remove_recursive(sr_info->dbg_dir);
 
-       pm_runtime_disable(&pdev->dev);
+       pm_runtime_disable(dev);
+       clk_unprepare(sr_info->fck);
        list_del(&sr_info->node);
        return 0;
 }
index 971c926..167b9b0 100644 (file)
@@ -155,6 +155,7 @@ struct omap_sr {
        struct voltagedomain            *voltdm;
        struct dentry                   *dbg_dir;
        unsigned int                    irq;
+       struct clk                      *fck;
        int                             srid;
        int                             ip_type;
        int                             nvalue_count;
@@ -169,6 +170,7 @@ struct omap_sr {
        u32                             senp_mod;
        u32                             senn_mod;
        void __iomem                    *base;
+       unsigned long                   enabled:1;
 };
 
 /**