Merge remote-tracking branches 'regulator/fix/anatop', 'regulator/fix/gpio', 'regulat...
authorMark Brown <broonie@kernel.org>
Mon, 21 Sep 2015 21:16:09 +0000 (14:16 -0700)
committerMark Brown <broonie@kernel.org>
Mon, 21 Sep 2015 21:16:09 +0000 (14:16 -0700)
1  2  3  4  5  6 
drivers/regulator/pbias-regulator.c

      struct pbias_reg_info {
        u32 enable;
        u32 enable_mask;
   +    u32 disable_val;
        u32 vmode;
        unsigned int enable_time;
        char *name;
@@@@@@@ -45,6 -45,6 -45,6 -44,10 -45,6 -45,6 +45,10 @@@@@@@ struct pbias_regulator_data 
        int voltage;
      };
      
+++ ++struct pbias_of_data {
+++ ++  unsigned int offset;
+++ ++};
+++ ++
      static const unsigned int pbias_volt_table[] = {
        1800000,
        3000000
@@@@@@@ -63,7 -63,7 -63,7 -66,6 -63,7 -63,7 +67,7 @@@@@@@ static const struct pbias_reg_info pbia
        .enable = BIT(1),
        .enable_mask = BIT(1),
        .vmode = BIT(0),
   +    .disable_val = 0,
        .enable_time = 100,
        .name = "pbias_mmc_omap2430"
      };
@@@@@@@ -79,7 -79,7 -79,7 -81,6 -79,7 -79,7 +83,7 @@@@@@@ static const struct pbias_reg_info pbia
      static const struct pbias_reg_info pbias_mmc_omap4 = {
        .enable = BIT(26) | BIT(22),
        .enable_mask = BIT(26) | BIT(25) | BIT(22),
   +    .disable_val = BIT(25),
        .vmode = BIT(21),
        .enable_time = 100,
        .name = "pbias_mmc_omap4"
      static const struct pbias_reg_info pbias_mmc_omap5 = {
        .enable = BIT(27) | BIT(26),
        .enable_mask = BIT(27) | BIT(25) | BIT(26),
   +    .disable_val = BIT(25),
        .vmode = BIT(21),
        .enable_time = 100,
        .name = "pbias_mmc_omap5"
@@@@@@@ -102,8 -102,8 -102,8 -102,35 -102,8 -102,8 +106,35 @@@@@@@ static struct of_regulator_match pbias_
      };
      #define PBIAS_NUM_REGS    ARRAY_SIZE(pbias_matches)
      
+++ ++/* Offset from SCM general area (and syscon) base */
+++ ++
+++ ++static const struct pbias_of_data pbias_of_data_omap2 = {
+++ ++  .offset = 0x230,
+++ ++};
+++ ++
+++ ++static const struct pbias_of_data pbias_of_data_omap3 = {
+++ ++  .offset = 0x2b0,
+++ ++};
+++ ++
+++ ++static const struct pbias_of_data pbias_of_data_omap4 = {
+++ ++  .offset = 0x60,
+++ ++};
+++ ++
+++ ++static const struct pbias_of_data pbias_of_data_omap5 = {
+++ ++  .offset = 0x60,
+++ ++};
+++ ++
+++ ++static const struct pbias_of_data pbias_of_data_dra7 = {
+++ ++  .offset = 0xe00,
+++ ++};
+++ ++
      static const struct of_device_id pbias_of_match[] = {
        { .compatible = "ti,pbias-omap", },
+++ ++  { .compatible = "ti,pbias-omap2", .data = &pbias_of_data_omap2, },
+++ ++  { .compatible = "ti,pbias-omap3", .data = &pbias_of_data_omap3, },
+++ ++  { .compatible = "ti,pbias-omap4", .data = &pbias_of_data_omap4, },
+++ ++  { .compatible = "ti,pbias-omap5", .data = &pbias_of_data_omap5, },
+++ ++  { .compatible = "ti,pbias-dra7", .data = &pbias_of_data_dra7, },
        {},
      };
      MODULE_DEVICE_TABLE(of, pbias_of_match);
@@@@@@@ -118,6 -118,6 -118,6 -145,9 -118,6 -118,6 +149,9 @@@@@@@ static int pbias_regulator_probe(struc
        const struct pbias_reg_info *info;
        int ret = 0;
        int count, idx, data_idx = 0;
+++ ++  const struct of_device_id *match;
+++ ++  const struct pbias_of_data *data;
+++ ++  unsigned int offset;
      
        count = of_regulator_match(&pdev->dev, np, pbias_matches,
                                                PBIAS_NUM_REGS);
        if (IS_ERR(syscon))
                return PTR_ERR(syscon);
      
+++ ++  match = of_match_device(of_match_ptr(pbias_of_match), &pdev->dev);
+++ ++  if (match && match->data) {
+++ ++          data = match->data;
+++ ++          offset = data->offset;
+++ ++  } else {
+++ ++          res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+++ ++          if (!res)
+++ ++                  return -EINVAL;
+++ ++
+++ ++          offset = res->start;
+++ ++          dev_WARN(&pdev->dev,
+++ ++                   "using legacy dt data for pbias offset\n");
+++ ++  }
+++ ++
        cfg.regmap = syscon;
        cfg.dev = &pdev->dev;
      
                if (!info)
                        return -ENODEV;
      
--- --          res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
--- --          if (!res)
--- --                  return -EINVAL;
--- --
                drvdata[data_idx].syscon = syscon;
                drvdata[data_idx].info = info;
                drvdata[data_idx].desc.name = info->name;
                drvdata[data_idx].desc.volt_table = pbias_volt_table;
                drvdata[data_idx].desc.n_voltages = 2;
                drvdata[data_idx].desc.enable_time = info->enable_time;
--- --          drvdata[data_idx].desc.vsel_reg = res->start;
+++ ++          drvdata[data_idx].desc.vsel_reg = offset;
                drvdata[data_idx].desc.vsel_mask = info->vmode;
--- --          drvdata[data_idx].desc.enable_reg = res->start;
+++ ++          drvdata[data_idx].desc.enable_reg = offset;
                drvdata[data_idx].desc.enable_mask = info->enable_mask;
                drvdata[data_idx].desc.enable_val = info->enable;
   +            drvdata[data_idx].desc.disable_val = info->disable_val;
      
                cfg.init_data = pbias_matches[idx].init_data;
                cfg.driver_data = &drvdata[data_idx];