Merge tag 'tags/bcm2835-drivers-next-2019-03-12' into soc/fixes
authorFlorian Fainelli <f.fainelli@gmail.com>
Mon, 18 Mar 2019 17:31:24 +0000 (10:31 -0700)
committerFlorian Fainelli <f.fainelli@gmail.com>
Mon, 18 Mar 2019 17:31:24 +0000 (10:31 -0700)
This pull request brings in a build fix for arm64 with bcm2835
enabled, and fixes the driver in the presence of -EPROBE_DEFER.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
1  2 
arch/arm64/Kconfig.platforms
drivers/soc/bcm/bcm2835-power.c

index 70498a033cf57408ccdefe374c5fa8e1d22e785d,50f9fb56205969aa479437a4bd210dd8f656eaad..b5ca9c50876d9a23947dde5d7fe553104c9c0805
@@@ -27,6 -27,7 +27,7 @@@ config ARCH_BCM283
        bool "Broadcom BCM2835 family"
        select TIMER_OF
        select GPIOLIB
+       select MFD_CORE
        select PINCTRL
        select PINCTRL_BCM2835
        select ARM_AMBA
@@@ -52,11 -53,6 +53,11 @@@ config ARCH_BERLI
        help
          This enables support for Marvell Berlin SoC Family
  
 +config ARCH_BITMAIN
 +      bool "Bitmain SoC Platforms"
 +      help
 +        This enables support for the Bitmain SoC Family.
 +
  config ARCH_BRCMSTB
        bool "Broadcom Set-Top-Box SoCs"
        select BRCMSTB_L2_IRQ
@@@ -117,13 -113,12 +118,13 @@@ config ARCH_MESO
        bool "Amlogic Platforms"
        select PINCTRL
        select PINCTRL_MESON
 -      select COMMON_CLK_AMLOGIC
        select COMMON_CLK_GXBB
        select COMMON_CLK_AXG
 +      select COMMON_CLK_G12A
        select MESON_IRQ_GPIO
        help
 -        This enables support for the Amlogic S905 SoCs.
 +        This enables support for the arm64 based Amlogic SoCs
 +        such as the s905, S905X/D, S912, A113X/D or S905X/D2
  
  config ARCH_MVEBU
        bool "Marvell EBU SoC Family"
  config ARCH_MXC
        bool "ARMv8 based NXP i.MX SoC family"
        select ARM64_ERRATUM_843419
 -      select ARM64_ERRATUM_845719
 +      select ARM64_ERRATUM_845719 if COMPAT
 +      select IMX_GPCV2
 +      select IMX_GPCV2_PM_DOMAINS
 +      select PM
 +      select PM_GENERIC_DOMAINS
        help
          This enables support for the ARMv8 based SoCs in the
          NXP i.MX family.
index 9351349cf0a930cd5c25dedd6bb747970e455e96,241c4ed808992026a37d9ed200f2c76d5cb71b45..1e0041ec813238cbfa7ab52c3fdc9799961169d1
@@@ -150,7 -150,12 +150,12 @@@ struct bcm2835_power 
  
  static int bcm2835_asb_enable(struct bcm2835_power *power, u32 reg)
  {
-       u64 start = ktime_get_ns();
+       u64 start;
+       if (!reg)
+               return 0;
+       start = ktime_get_ns();
  
        /* Enable the module's async AXI bridges. */
        ASB_WRITE(reg, ASB_READ(reg) & ~ASB_REQ_STOP);
  
  static int bcm2835_asb_disable(struct bcm2835_power *power, u32 reg)
  {
-       u64 start = ktime_get_ns();
+       u64 start;
+       if (!reg)
+               return 0;
+       start = ktime_get_ns();
  
        /* Enable the module's async AXI bridges. */
        ASB_WRITE(reg, ASB_READ(reg) | ASB_REQ_STOP);
@@@ -475,7 -485,7 +485,7 @@@ static int bcm2835_power_pd_power_off(s
        }
  }
  
- static void
+ static int
  bcm2835_init_power_domain(struct bcm2835_power *power,
                          int pd_xlate_index, const char *name)
  {
        struct bcm2835_power_domain *dom = &power->domains[pd_xlate_index];
  
        dom->clk = devm_clk_get(dev->parent, name);
+       if (IS_ERR(dom->clk)) {
+               int ret = PTR_ERR(dom->clk);
+               if (ret == -EPROBE_DEFER)
+                       return ret;
+               /* Some domains don't have a clk, so make sure that we
+                * don't deref an error pointer later.
+                */
+               dom->clk = NULL;
+       }
  
        dom->base.name = name;
        dom->base.power_on = bcm2835_power_pd_power_on;
        pm_genpd_init(&dom->base, NULL, true);
  
        power->pd_xlate.domains[pd_xlate_index] = &dom->base;
+       return 0;
  }
  
  /** bcm2835_reset_reset - Resets a block that has a reset line in the
@@@ -553,7 -576,7 +576,7 @@@ static int bcm2835_reset_status(struct 
        }
  }
  
 -const struct reset_control_ops bcm2835_reset_ops = {
 +static const struct reset_control_ops bcm2835_reset_ops = {
        .reset = bcm2835_reset_reset,
        .status = bcm2835_reset_status,
  };
@@@ -592,7 -615,7 +615,7 @@@ static int bcm2835_power_probe(struct p
                { BCM2835_POWER_DOMAIN_IMAGE_PERI, BCM2835_POWER_DOMAIN_CAM0 },
                { BCM2835_POWER_DOMAIN_IMAGE_PERI, BCM2835_POWER_DOMAIN_CAM1 },
        };
-       int ret, i;
+       int ret = 0, i;
        u32 id;
  
        power = devm_kzalloc(dev, sizeof(*power), GFP_KERNEL);
  
        power->pd_xlate.num_domains = ARRAY_SIZE(power_domain_names);
  
-       for (i = 0; i < ARRAY_SIZE(power_domain_names); i++)
-               bcm2835_init_power_domain(power, i, power_domain_names[i]);
+       for (i = 0; i < ARRAY_SIZE(power_domain_names); i++) {
+               ret = bcm2835_init_power_domain(power, i, power_domain_names[i]);
+               if (ret)
+                       goto fail;
+       }
  
        for (i = 0; i < ARRAY_SIZE(domain_deps); i++) {
                pm_genpd_add_subdomain(&power->domains[domain_deps[i].parent].base,
  
        ret = devm_reset_controller_register(dev, &power->reset);
        if (ret)
-               return ret;
+               goto fail;
  
        of_genpd_add_provider_onecell(dev->parent->of_node, &power->pd_xlate);
  
        dev_info(dev, "Broadcom BCM2835 power domains driver");
        return 0;
+ fail:
+       for (i = 0; i < ARRAY_SIZE(power_domain_names); i++) {
+               struct generic_pm_domain *dom = &power->domains[i].base;
+               if (dom->name)
+                       pm_genpd_remove(dom);
+       }
+       return ret;
  }
  
  static int bcm2835_power_remove(struct platform_device *pdev)