Skip to contentSkip to conversation

clk: s2mps11: Add support for S2MPS14 clocks

PATCH Applied Krzysztof Kozlowski 4 participants 17 messages Mar 17, 2014 – Mar 20, 2014

Subsystems (5)

v3 of 4 Applied Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover clk: s2mps11: Add support for S2MPS14 clocks

Hi,

This is third version of patchset adding support for the S2MPS14 device to the s2mps11 clock driver.

The patchset *depends on*:
==========================
1. Work done by Tushar Behera:
[PATCH V2 0/2] Add support for clocks in S5M8767
http://thread.gmane.org/gmane.linux.kernel.samsung-soc/27264
2. Support for S2MPS14 in main sec-core MFD driver (already in linux-next and Lee's tree).

Changes since v2:
=================
1. Patch 2/3: Remove MFD cells of_compatible which aren't used by child drivers and are not documented.
2. Added Tomasz's Review-by.

Changes since v1:
=================
1. Patch 1/3: Update driver description in Kconfig.
2. Patch 2/3: Add of_compatible to all MFD cells.
3. Add Yadwinder's Review-by.

Best regards,
Krzysztof

Krzysztof Kozlowski (3):
clk: s2mps11: Add support for S2MPS14 clocks
mfd: sec-core: Add of_compatible strings for clock MFD cells
Documentation: mfd: s2mps11: Describe S5M8767 and S2MPS14 clocks

 Documentation/devicetree/bindings/mfd/s2mps11.txt |   24 +++++---
 drivers/clk/Kconfig                               |    8 +--
 drivers/clk/clk-s2mps11.c                         |   61 ++++++++++++++++-----
 drivers/mfd/sec-core.c                            |    3 +
 4 files changed, 68 insertions(+), 28 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v3 1/3 clk: s2mps11: Add support for S2MPS14 clocks

This patch adds support for S2MPS14 PMIC clocks (BT and AP) to the s2mps11 clock driver.

---
 drivers/clk/Kconfig       |    8 +++---
 drivers/clk/clk-s2mps11.c |   61 ++++++++++++++++++++++++++++++++++-----------
 2 files changed, 50 insertions(+), 19 deletions(-)
drivers/clk/Kconfig +4 -4
index 6f56d3a4f010..8f9ce8ba036d 100644
@@ -65,12 +65,12 @@ config COMMON_CLK_SI570
 	  clock generators.
 
 config COMMON_CLK_S2MPS11
-	tristate "Clock driver for S2MPS11/S5M8767 MFD"
+	tristate "Clock driver for S2MPS1X/S5M8767 MFD"
 	depends on MFD_SEC_CORE
 	---help---
-	  This driver supports S2MPS11/S5M8767 crystal oscillator clock. These
-	  multi-function devices have 3 fixed-rate oscillators, clocked at
-	  32KHz each.
+	  This driver supports S2MPS11/S2MPS14/S5M8767 crystal oscillator
+	  clock. These multi-function devices have two (S2MPS14) or three
+	  (S2MPS11, S5M8767) fixed-rate oscillators, clocked at 32KHz each.
 
 config CLK_TWL6040
 	tristate "External McPDM functional clock from twl6040"
drivers/clk/clk-s2mps11.c +46 -15

138 lines not on this page · raw message

Signature · 1 line
1.7.9.5
Acked-by on v3 1/3
#2 lore raw

Quoting Krzysztof Kozlowski (2014-03-17 02:19:16)

Quoted 6 lines

This patch adds support for S2MPS14 PMIC clocks (BT and AP) to the s2mps11 clock driver.

This does not apply cleanly to to clk tree trip, nor does it compile after manually merging due to changes introducing linux/mfd/samsung/s2mps14.h.

The changes look OK to me so maybe Lee can take it with my Ack?

Regards,
Mike

Quoted 180 lines
---
 drivers/clk/Kconfig       |    8 +++---
 drivers/clk/clk-s2mps11.c |   61 ++++++++++++++++++++++++++++++++++-----------
 2 files changed, 50 insertions(+), 19 deletions(-)
drivers/clk/Kconfig +4 -4
index 6f56d3a4f010..8f9ce8ba036d 100644
@@ -65,12 +65,12 @@ config COMMON_CLK_SI570
          clock generators.
 
 config COMMON_CLK_S2MPS11
-       tristate "Clock driver for S2MPS11/S5M8767 MFD"
+       tristate "Clock driver for S2MPS1X/S5M8767 MFD"
        depends on MFD_SEC_CORE
        ---help---
-         This driver supports S2MPS11/S5M8767 crystal oscillator clock. These
-         multi-function devices have 3 fixed-rate oscillators, clocked at
-         32KHz each.
+         This driver supports S2MPS11/S2MPS14/S5M8767 crystal oscillator
+         clock. These multi-function devices have two (S2MPS14) or three
+         (S2MPS11, S5M8767) fixed-rate oscillators, clocked at 32KHz each.
 
 config CLK_TWL6040
        tristate "External McPDM functional clock from twl6040"
drivers/clk/clk-s2mps11.c +46 -15
index 508875535e1e..8dafb552274f 100644
@@ -1,7 +1,7 @@
 /*
  * clk-s2mps11.c - Clock driver for S2MPS11.
  *
- * Copyright (C) 2013 Samsung Electornics
+ * Copyright (C) 2013,2014 Samsung Electornics
  *
  * This program is free software; you can redistribute  it and/or modify it
  * under  the terms of  the GNU General  Public License as published by the
@@ -13,10 +13,6 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
  */
 
 #include <linux/module.h>
@@ -27,6 +23,7 @@
 #include <linux/clk-provider.h>
 #include <linux/platform_device.h>
 #include <linux/mfd/samsung/s2mps11.h>
+#include <linux/mfd/samsung/s2mps14.h>
 #include <linux/mfd/samsung/s5m8767.h>
 #include <linux/mfd/samsung/core.h>
 
@@ -125,7 +122,21 @@ static struct clk_init_data s2mps11_clks_init[S2MPS11_CLKS_NUM] = {
        },
 };
 
-static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev)
+static struct clk_init_data s2mps14_clks_init[S2MPS11_CLKS_NUM] = {
+       [S2MPS11_CLK_AP] = {
+               .name = "s2mps14_ap",
+               .ops = &s2mps11_clk_ops,
+               .flags = CLK_IS_ROOT,
+       },
+       [S2MPS11_CLK_BT] = {
+               .name = "s2mps14_bt",
+               .ops = &s2mps11_clk_ops,
+               .flags = CLK_IS_ROOT,
+       },
+};
+
+static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev,
+               struct clk_init_data *clks_init)
 {
        struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
        struct device_node *clk_np;
@@ -145,9 +156,12 @@ static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev)
        if (!clk_table)
                return ERR_PTR(-ENOMEM);
 
-       for (i = 0; i < S2MPS11_CLKS_NUM; i++)
+       for (i = 0; i < S2MPS11_CLKS_NUM; i++) {
+               if (!clks_init[i].name)
+                       continue; /* Skip clocks not present in some devices */
                of_property_read_string_index(clk_np, "clock-output-names", i,
-                               &s2mps11_clks_init[i].name);
+                               &clks_init[i].name);
+       }
 
        return clk_np;
 }
@@ -158,6 +172,7 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
        struct s2mps11_clk *s2mps11_clks, *s2mps11_clk;
        struct device_node *clk_np = NULL;
        unsigned int s2mps11_reg;
+       struct clk_init_data *clks_init;
        int i, ret = 0;
        u32 val;
 
@@ -168,25 +183,33 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
 
        s2mps11_clk = s2mps11_clks;
 
-       clk_np = s2mps11_clk_parse_dt(pdev);
-       if (IS_ERR(clk_np))
-               return PTR_ERR(clk_np);
-
        switch (platform_get_device_id(pdev)->driver_data) {
        case S2MPS11X:
                s2mps11_reg = S2MPS11_REG_RTC_CTRL;
+               clks_init = s2mps11_clks_init;
+               break;
+       case S2MPS14X:
+               s2mps11_reg = S2MPS14_REG_RTCCTRL;
+               clks_init = s2mps14_clks_init;
                break;
        case S5M8767X:
                s2mps11_reg = S5M8767_REG_CTRL1;
+               clks_init = s2mps11_clks_init;
                break;
        default:
                dev_err(&pdev->dev, "Invalid device type\n");
                return -EINVAL;
        };
 
+       clk_np = s2mps11_clk_parse_dt(pdev, clks_init);
+       if (IS_ERR(clk_np))
+               return PTR_ERR(clk_np);
+
        for (i = 0; i < S2MPS11_CLKS_NUM; i++, s2mps11_clk++) {
+               if (!clks_init[i].name)
+                       continue; /* Skip clocks not present in some devices */
                s2mps11_clk->iodev = iodev;
-               s2mps11_clk->hw.init = &s2mps11_clks_init[i];
+               s2mps11_clk->hw.init = &clks_init[i];
                s2mps11_clk->mask = 1 << i;
                s2mps11_clk->reg = s2mps11_reg;
 
@@ -220,8 +243,12 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
        }
 
        if (clk_table) {
-               for (i = 0; i < S2MPS11_CLKS_NUM; i++)
+               for (i = 0; i < S2MPS11_CLKS_NUM; i++) {
+                       /* Skip clocks not present on S2MPS14 */
+                       if (!clks_init[i].name)
+                               continue;
                        clk_table[i] = s2mps11_clks[i].clk;
+               }
 
                clk_data.clks = clk_table;
                clk_data.clk_num = S2MPS11_CLKS_NUM;
@@ -250,14 +277,18 @@ static int s2mps11_clk_remove(struct platform_device *pdev)
        struct s2mps11_clk *s2mps11_clks = platform_get_drvdata(pdev);
        int i;
 
-       for (i = 0; i < S2MPS11_CLKS_NUM; i++)
+       for (i = 0; i < S2MPS11_CLKS_NUM; i++) {
+               if (!s2mps11_clks[i].lookup)
+                       continue; /* Skip clocks not present in some devices */
                clkdev_drop(s2mps11_clks[i].lookup);
+       }
 
        return 0;
 }
 
 static const struct platform_device_id s2mps11_clk_id[] = {
        { "s2mps11-clk", S2MPS11X},
+       { "s2mps14-clk", S2MPS14X},
        { "s5m8767-clk", S5M8767X},
        { },
 };
Signature · 1 line
1.7.9.5
#3 lore raw
Quoted 8 lines · Mike Turquette

Quoting Krzysztof Kozlowski (2014-03-17 02:19:16)

Quoted 6 lines

This patch adds support for S2MPS14 PMIC clocks (BT and AP) to the s2mps11 clock driver.

Quoted 8 lines

This does not apply cleanly to to clk tree trip, nor does it compile after manually merging due to changes introducing linux/mfd/samsung/s2mps14.h.

The changes look OK to me so maybe Lee can take it with my Ack?

Hi,

Thanks for the Ack. The patch depends on Tushar Behera's patches:
- [PATCH V2 0/2] Add support for clocks in S5M8767
http://thread.gmane.org/gmane.linux.kernel.samsung-soc/27264
which are waiting for some time. Both patchsets should be pulled together.

Best regards,
Krzysztof

#4 lore raw

PATCH v3 1/3 clk: s2mps11: Add support for S2MPS14 clocks

Quoting Krzysztof Kozlowski (2014-03-19 00:50:08)

Quoted 18 lines · Mike Turquette
Quoted 8 lines

Quoting Krzysztof Kozlowski (2014-03-17 02:19:16)

Quoted 6 lines

This patch adds support for S2MPS14 PMIC clocks (BT and AP) to the s2mps11 clock driver.

Quoted 8 lines

This does not apply cleanly to to clk tree trip, nor does it compile after manually merging due to changes introducing linux/mfd/samsung/s2mps14.h.

The changes look OK to me so maybe Lee can take it with my Ack?

Quoted 7 lines

Hi,

Thanks for the Ack. The patch depends on Tushar Behera's patches:
- [PATCH V2 0/2] Add support for clocks in S5M8767
http://thread.gmane.org/gmane.linux.kernel.samsung-soc/27264
which are waiting for some time. Both patchsets should be pulled together.

I took those patches in yesterday. So we have three options:

1) MFD tree can pull a stable commit from the clk tree. I'm happy to make a topic branch for this. Then these patches can be applied.

2) clk tree can pull a stable commit from the mfd tree if the mfd folks can provide one.

3) Wait until after the merge window to apply this one to the clk tree. I don't currently plan to send 2 PRs during the merge window, so this could either go in 3.16 or maybe into 3.15 if a split PR is sent.

Regards,
Mike

Quoted 4 lines

Best regards,
Krzysztof

#5 lore raw
Quoted 21 lines · Mike Turquette

Quoting Krzysztof Kozlowski (2014-03-19 00:50:08)

Quoted 20 lines · Mike Turquette
Quoted 8 lines

Quoting Krzysztof Kozlowski (2014-03-17 02:19:16)

Quoted 6 lines

This patch adds support for S2MPS14 PMIC clocks (BT and AP) to the s2mps11 clock driver.

Quoted 8 lines

This does not apply cleanly to to clk tree trip, nor does it compile after manually merging due to changes introducing linux/mfd/samsung/s2mps14.h.

The changes look OK to me so maybe Lee can take it with my Ack?

Hi,

Quoted 7 lines
Quoted 5 lines

Thanks for the Ack. The patch depends on Tushar Behera's patches:
- [PATCH V2 0/2] Add support for clocks in S5M8767
http://thread.gmane.org/gmane.linux.kernel.samsung-soc/27264
which are waiting for some time. Both patchsets should be pulled together.

I took those patches in yesterday. So we have three options:

Great! Thanks.

Quoted 10 lines

1) MFD tree can pull a stable commit from the clk tree. I'm happy to make a topic branch for this. Then these patches can be applied.

2) clk tree can pull a stable commit from the mfd tree if the mfd folks can provide one.

3) Wait until after the merge window to apply this one to the clk tree. I don't currently plan to send 2 PRs during the merge window, so this could either go in 3.16 or maybe into 3.15 if a split PR is sent.

Dear Lee,

How do you wish to proceed? The patchset depends on changes in sec-core MFD driver.

Best regards,
Krzysztof

#6 lore raw
Quoted 35 lines
Quoted 18 lines
Quoted 18 lines
Quoted 7 lines
Quoted 6 lines

This patch adds support for S2MPS14 PMIC clocks (BT and AP) to the s2mps11 clock driver.

Quoted 8 lines

This does not apply cleanly to to clk tree trip, nor does it compile after manually merging due to changes introducing linux/mfd/samsung/s2mps14.h.

The changes look OK to me so maybe Lee can take it with my Ack?

Hi,

Quoted 7 lines
Quoted 5 lines

Thanks for the Ack. The patch depends on Tushar Behera's patches:
- [PATCH V2 0/2] Add support for clocks in S5M8767
http://thread.gmane.org/gmane.linux.kernel.samsung-soc/27264
which are waiting for some time. Both patchsets should be pulled together.

I took those patches in yesterday. So we have three options:

Great! Thanks.

Quoted 7 lines

1) MFD tree can pull a stable commit from the clk tree. I'm happy to make a topic branch for this. Then these patches can be applied.

2) clk tree can pull a stable commit from the mfd tree if the mfd folks can provide one.

Quoted 8 lines
Quoted 3 lines

3) Wait until after the merge window to apply this one to the clk tree. I don't currently plan to send 2 PRs during the merge window, so this could either go in 3.16 or maybe into 3.15 if a split PR is sent.

Dear Lee,

How do you wish to proceed? The patchset depends on changes in sec-core MFD driver.

The MFD tree is betting pretty complicated with sec-core stuff at the minuite. Can I vote for option 3?

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#7 lore raw

Quoting Lee Jones (2014-03-20 06:42:19)

Quoted 39 lines
Quoted 39 lines
Quoted 18 lines
Quoted 18 lines
Quoted 7 lines
Quoted 6 lines

This patch adds support for S2MPS14 PMIC clocks (BT and AP) to the s2mps11 clock driver.

Quoted 8 lines

This does not apply cleanly to to clk tree trip, nor does it compile after manually merging due to changes introducing linux/mfd/samsung/s2mps14.h.

The changes look OK to me so maybe Lee can take it with my Ack?

Hi,

Quoted 7 lines
Quoted 5 lines

Thanks for the Ack. The patch depends on Tushar Behera's patches:
- [PATCH V2 0/2] Add support for clocks in S5M8767
http://thread.gmane.org/gmane.linux.kernel.samsung-soc/27264
which are waiting for some time. Both patchsets should be pulled together.

I took those patches in yesterday. So we have three options:

Great! Thanks.

Quoted 10 lines

1) MFD tree can pull a stable commit from the clk tree. I'm happy to make a topic branch for this. Then these patches can be applied.

2) clk tree can pull a stable commit from the mfd tree if the mfd folks can provide one.

3) Wait until after the merge window to apply this one to the clk tree. I don't currently plan to send 2 PRs during the merge window, so this could either go in 3.16 or maybe into 3.15 if a split PR is sent.

Quoted 7 lines
Quoted 4 lines

Dear Lee,

How do you wish to proceed? The patchset depends on changes in sec-core MFD driver.

The MFD tree is betting pretty complicated with sec-core stuff at the minuite. Can I vote for option 3?

Sure. clock tree feels the same way. ;-)

Regards,
Mike

Quoted 6 lines
Signature · 5 lines
-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#8 lore raw
In reply to Krzysztof Kozlowski

Quoting Krzysztof Kozlowski (2014-03-17 02:19:16)

Quoted 6 lines

This patch adds support for S2MPS14 PMIC clocks (BT and AP) to the s2mps11 clock driver.

Taken into clk-next.

Regards,
Mike

Quoted 180 lines
---
 drivers/clk/Kconfig       |    8 +++---
 drivers/clk/clk-s2mps11.c |   61 ++++++++++++++++++++++++++++++++++-----------
 2 files changed, 50 insertions(+), 19 deletions(-)
drivers/clk/Kconfig +4 -4
index 6f56d3a4f010..8f9ce8ba036d 100644
@@ -65,12 +65,12 @@ config COMMON_CLK_SI570
          clock generators.
 
 config COMMON_CLK_S2MPS11
-       tristate "Clock driver for S2MPS11/S5M8767 MFD"
+       tristate "Clock driver for S2MPS1X/S5M8767 MFD"
        depends on MFD_SEC_CORE
        ---help---
-         This driver supports S2MPS11/S5M8767 crystal oscillator clock. These
-         multi-function devices have 3 fixed-rate oscillators, clocked at
-         32KHz each.
+         This driver supports S2MPS11/S2MPS14/S5M8767 crystal oscillator
+         clock. These multi-function devices have two (S2MPS14) or three
+         (S2MPS11, S5M8767) fixed-rate oscillators, clocked at 32KHz each.
 
 config CLK_TWL6040
        tristate "External McPDM functional clock from twl6040"
drivers/clk/clk-s2mps11.c +46 -15
index 508875535e1e..8dafb552274f 100644
@@ -1,7 +1,7 @@
 /*
  * clk-s2mps11.c - Clock driver for S2MPS11.
  *
- * Copyright (C) 2013 Samsung Electornics
+ * Copyright (C) 2013,2014 Samsung Electornics
  *
  * This program is free software; you can redistribute  it and/or modify it
  * under  the terms of  the GNU General  Public License as published by the
@@ -13,10 +13,6 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
  */
 
 #include <linux/module.h>
@@ -27,6 +23,7 @@
 #include <linux/clk-provider.h>
 #include <linux/platform_device.h>
 #include <linux/mfd/samsung/s2mps11.h>
+#include <linux/mfd/samsung/s2mps14.h>
 #include <linux/mfd/samsung/s5m8767.h>
 #include <linux/mfd/samsung/core.h>
 
@@ -125,7 +122,21 @@ static struct clk_init_data s2mps11_clks_init[S2MPS11_CLKS_NUM] = {
        },
 };
 
-static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev)
+static struct clk_init_data s2mps14_clks_init[S2MPS11_CLKS_NUM] = {
+       [S2MPS11_CLK_AP] = {
+               .name = "s2mps14_ap",
+               .ops = &s2mps11_clk_ops,
+               .flags = CLK_IS_ROOT,
+       },
+       [S2MPS11_CLK_BT] = {
+               .name = "s2mps14_bt",
+               .ops = &s2mps11_clk_ops,
+               .flags = CLK_IS_ROOT,
+       },
+};
+
+static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev,
+               struct clk_init_data *clks_init)
 {
        struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
        struct device_node *clk_np;
@@ -145,9 +156,12 @@ static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev)
        if (!clk_table)
                return ERR_PTR(-ENOMEM);
 
-       for (i = 0; i < S2MPS11_CLKS_NUM; i++)
+       for (i = 0; i < S2MPS11_CLKS_NUM; i++) {
+               if (!clks_init[i].name)
+                       continue; /* Skip clocks not present in some devices */
                of_property_read_string_index(clk_np, "clock-output-names", i,
-                               &s2mps11_clks_init[i].name);
+                               &clks_init[i].name);
+       }
 
        return clk_np;
 }
@@ -158,6 +172,7 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
        struct s2mps11_clk *s2mps11_clks, *s2mps11_clk;
        struct device_node *clk_np = NULL;
        unsigned int s2mps11_reg;
+       struct clk_init_data *clks_init;
        int i, ret = 0;
        u32 val;
 
@@ -168,25 +183,33 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
 
        s2mps11_clk = s2mps11_clks;
 
-       clk_np = s2mps11_clk_parse_dt(pdev);
-       if (IS_ERR(clk_np))
-               return PTR_ERR(clk_np);
-
        switch (platform_get_device_id(pdev)->driver_data) {
        case S2MPS11X:
                s2mps11_reg = S2MPS11_REG_RTC_CTRL;
+               clks_init = s2mps11_clks_init;
+               break;
+       case S2MPS14X:
+               s2mps11_reg = S2MPS14_REG_RTCCTRL;
+               clks_init = s2mps14_clks_init;
                break;
        case S5M8767X:
                s2mps11_reg = S5M8767_REG_CTRL1;
+               clks_init = s2mps11_clks_init;
                break;
        default:
                dev_err(&pdev->dev, "Invalid device type\n");
                return -EINVAL;
        };
 
+       clk_np = s2mps11_clk_parse_dt(pdev, clks_init);
+       if (IS_ERR(clk_np))
+               return PTR_ERR(clk_np);
+
        for (i = 0; i < S2MPS11_CLKS_NUM; i++, s2mps11_clk++) {
+               if (!clks_init[i].name)
+                       continue; /* Skip clocks not present in some devices */
                s2mps11_clk->iodev = iodev;
-               s2mps11_clk->hw.init = &s2mps11_clks_init[i];
+               s2mps11_clk->hw.init = &clks_init[i];
                s2mps11_clk->mask = 1 << i;
                s2mps11_clk->reg = s2mps11_reg;
 
@@ -220,8 +243,12 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
        }
 
        if (clk_table) {
-               for (i = 0; i < S2MPS11_CLKS_NUM; i++)
+               for (i = 0; i < S2MPS11_CLKS_NUM; i++) {
+                       /* Skip clocks not present on S2MPS14 */
+                       if (!clks_init[i].name)
+                               continue;
                        clk_table[i] = s2mps11_clks[i].clk;
+               }
 
                clk_data.clks = clk_table;
                clk_data.clk_num = S2MPS11_CLKS_NUM;
@@ -250,14 +277,18 @@ static int s2mps11_clk_remove(struct platform_device *pdev)
        struct s2mps11_clk *s2mps11_clks = platform_get_drvdata(pdev);
        int i;
 
-       for (i = 0; i < S2MPS11_CLKS_NUM; i++)
+       for (i = 0; i < S2MPS11_CLKS_NUM; i++) {
+               if (!s2mps11_clks[i].lookup)
+                       continue; /* Skip clocks not present in some devices */
                clkdev_drop(s2mps11_clks[i].lookup);
+       }
 
        return 0;
 }
 
 static const struct platform_device_id s2mps11_clk_id[] = {
        { "s2mps11-clk", S2MPS11X},
+       { "s2mps14-clk", S2MPS14X},
        { "s5m8767-clk", S5M8767X},
        { },
 };
Signature · 1 line
1.7.9.5
#9 lore raw
Quoted 9 lines · Mike Turquette

Quoting Krzysztof Kozlowski (2014-03-17 02:19:16)

Quoted 6 lines

This patch adds support for S2MPS14 PMIC clocks (BT and AP) to the s2mps11 clock driver.

Taken into clk-next.

Oops. Please disregard. My auto patch application script sent his by accident. I have not applied this patches, as indicated in my previous mail were I gave out an Ack.

Regards,
Mike

Quoted 184 lines

Regards,
Mike

Quoted 180 lines
---
 drivers/clk/Kconfig       |    8 +++---
 drivers/clk/clk-s2mps11.c |   61 ++++++++++++++++++++++++++++++++++-----------
 2 files changed, 50 insertions(+), 19 deletions(-)
drivers/clk/Kconfig +4 -4
index 6f56d3a4f010..8f9ce8ba036d 100644
@@ -65,12 +65,12 @@ config COMMON_CLK_SI570
          clock generators.
 
 config COMMON_CLK_S2MPS11
-       tristate "Clock driver for S2MPS11/S5M8767 MFD"
+       tristate "Clock driver for S2MPS1X/S5M8767 MFD"
        depends on MFD_SEC_CORE
        ---help---
-         This driver supports S2MPS11/S5M8767 crystal oscillator clock. These
-         multi-function devices have 3 fixed-rate oscillators, clocked at
-         32KHz each.
+         This driver supports S2MPS11/S2MPS14/S5M8767 crystal oscillator
+         clock. These multi-function devices have two (S2MPS14) or three
+         (S2MPS11, S5M8767) fixed-rate oscillators, clocked at 32KHz each.
 
 config CLK_TWL6040
        tristate "External McPDM functional clock from twl6040"
drivers/clk/clk-s2mps11.c +46 -16
index 508875535e1e..8dafb552274f 100644
@@ -1,7 +1,7 @@
 /*
  * clk-s2mps11.c - Clock driver for S2MPS11.
  *
- * Copyright (C) 2013 Samsung Electornics
+ * Copyright (C) 2013,2014 Samsung Electornics
  *
  * This program is free software; you can redistribute  it and/or modify it
  * under  the terms of  the GNU General  Public License as published by the
@@ -13,10 +13,6 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
  */
 
 #include <linux/module.h>
@@ -27,6 +23,7 @@
 #include <linux/clk-provider.h>
 #include <linux/platform_device.h>
 #include <linux/mfd/samsung/s2mps11.h>
+#include <linux/mfd/samsung/s2mps14.h>
 #include <linux/mfd/samsung/s5m8767.h>
 #include <linux/mfd/samsung/core.h>
 
@@ -125,7 +122,21 @@ static struct clk_init_data s2mps11_clks_init[S2MPS11_CLKS_NUM] = {
        },
 };
 
-static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev)
+static struct clk_init_data s2mps14_clks_init[S2MPS11_CLKS_NUM] = {
+       [S2MPS11_CLK_AP] = {
+               .name = "s2mps14_ap",
+               .ops = &s2mps11_clk_ops,
+               .flags = CLK_IS_ROOT,
+       },
+       [S2MPS11_CLK_BT] = {
+               .name = "s2mps14_bt",
+               .ops = &s2mps11_clk_ops,
+               .flags = CLK_IS_ROOT,
+       },
+};
+
+static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev,
+               struct clk_init_data *clks_init)
 {
        struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
        struct device_node *clk_np;
@@ -145,9 +156,12 @@ static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev)
        if (!clk_table)
                return ERR_PTR(-ENOMEM);
 
-       for (i = 0; i < S2MPS11_CLKS_NUM; i++)
+       for (i = 0; i < S2MPS11_CLKS_NUM; i++) {
+               if (!clks_init[i].name)
+                       continue; /* Skip clocks not present in some devices */
                of_property_read_string_index(clk_np, "clock-output-names", i,
-                               &s2mps11_clks_init[i].name);
+                               &clks_init[i].name);
+       }
 
        return clk_np;
 }
@@ -158,6 +172,7 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
        struct s2mps11_clk *s2mps11_clks, *s2mps11_clk;
        struct device_node *clk_np = NULL;
        unsigned int s2mps11_reg;
+       struct clk_init_data *clks_init;
        int i, ret = 0;
        u32 val;
 
@@ -168,25 +183,33 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
 
        s2mps11_clk = s2mps11_clks;
 
-       clk_np = s2mps11_clk_parse_dt(pdev);
-       if (IS_ERR(clk_np))
-               return PTR_ERR(clk_np);
-
        switch (platform_get_device_id(pdev)->driver_data) {
        case S2MPS11X:
                s2mps11_reg = S2MPS11_REG_RTC_CTRL;
+               clks_init = s2mps11_clks_init;
+               break;
+       case S2MPS14X:
+               s2mps11_reg = S2MPS14_REG_RTCCTRL;
+               clks_init = s2mps14_clks_init;
                break;
        case S5M8767X:
                s2mps11_reg = S5M8767_REG_CTRL1;
+               clks_init = s2mps11_clks_init;
                break;
        default:
                dev_err(&pdev->dev, "Invalid device type\n");
                return -EINVAL;
        };
 
+       clk_np = s2mps11_clk_parse_dt(pdev, clks_init);
+       if (IS_ERR(clk_np))
+               return PTR_ERR(clk_np);
+
        for (i = 0; i < S2MPS11_CLKS_NUM; i++, s2mps11_clk++) {
+               if (!clks_init[i].name)
+                       continue; /* Skip clocks not present in some devices */
                s2mps11_clk->iodev = iodev;
-               s2mps11_clk->hw.init = &s2mps11_clks_init[i];
+               s2mps11_clk->hw.init = &clks_init[i];
                s2mps11_clk->mask = 1 << i;
                s2mps11_clk->reg = s2mps11_reg;
 
@@ -220,8 +243,12 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
        }
 
        if (clk_table) {
-               for (i = 0; i < S2MPS11_CLKS_NUM; i++)
+               for (i = 0; i < S2MPS11_CLKS_NUM; i++) {
+                       /* Skip clocks not present on S2MPS14 */
+                       if (!clks_init[i].name)
+                               continue;
                        clk_table[i] = s2mps11_clks[i].clk;
+               }
 
                clk_data.clks = clk_table;
                clk_data.clk_num = S2MPS11_CLKS_NUM;
@@ -250,14 +277,18 @@ static int s2mps11_clk_remove(struct platform_device *pdev)
        struct s2mps11_clk *s2mps11_clks = platform_get_drvdata(pdev);
        int i;
 
-       for (i = 0; i < S2MPS11_CLKS_NUM; i++)
+       for (i = 0; i < S2MPS11_CLKS_NUM; i++) {
+               if (!s2mps11_clks[i].lookup)
+                       continue; /* Skip clocks not present in some devices */
                clkdev_drop(s2mps11_clks[i].lookup);
+       }
 
        return 0;
 }
 
 static const struct platform_device_id s2mps11_clk_id[] = {
        { "s2mps11-clk", S2MPS11X},
+       { "s2mps14-clk", S2MPS14X},
        { "s5m8767-clk", S5M8767X},
        { },
 };
--

1.7.9.5

#10 lore raw

PATCH v3 2/3 mfd: sec-core: Add of_compatible strings for clock MFD cells

In reply to Krzysztof Kozlowski

Add of_compatible strings for S5M8767 and S2MPS14 clock MFD cells.

---
 drivers/mfd/sec-core.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/mfd/sec-core.c +3 -0
index d163c66edebb..716606479235 100644
@@ -59,6 +59,7 @@ static const struct mfd_cell s5m8767_devs[] = {
 		.name = "s5m-rtc",
 	}, {
 		.name = "s5m8767-clk",
+		.of_compatible = "samsung,s5m8767-clk",
 	}
 };
 
@@ -67,6 +68,7 @@ static const struct mfd_cell s2mps11_devs[] = {
 		.name = "s2mps11-pmic",
 	}, {
 		.name = "s2mps11-clk",
+		.of_compatible = "samsung,s2mps11-clk",
 	}
 };
 
@@ -77,6 +79,7 @@ static const struct mfd_cell s2mps14_devs[] = {
 		.name = "s2mps14-rtc",
 	}, {
 		.name = "s2mps14-clk",
+		.of_compatible = "samsung,s2mps14-clk",
 	}
 };
 
Signature · 1 line
1.7.9.5
#12 lore raw

Re: [PATCH v3 2/3] mfd: sec-core: Add of_compatible strings for clock MFD cells

In reply to Krzysztof Kozlowski
Quoted 6 lines

Add of_compatible strings for S5M8767 and S2MPS14 clock MFD cells.

---
 drivers/mfd/sec-core.c |    3 +++
 1 file changed, 3 insertions(+)

Applied with Tomasz' Reviewed-by.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#13 lore raw

Re: [PATCH v3 2/3] mfd: sec-core: Add of_compatible strings for clock MFD cells

Quoted 8 lines · Lee Jones
Quoted 6 lines

Add of_compatible strings for S5M8767 and S2MPS14 clock MFD cells.

---
 drivers/mfd/sec-core.c |    3 +++
 1 file changed, 3 insertions(+)

Applied with Tomasz' Reviewed-by.

Thanks! One minor thing - I see that Tomasz' Review-by got lost when the patch was applied to your tree:
https://git.kernel.org/cgit/linux/kernel/git/lee/mfd.git/commit/?h=for-mfd-next&id=09f8c0a07044bb8ac5085fcbcf82468173a1666d.

Best regards,
Krzysztof

#14 lore raw

Re: [PATCH v3 2/3] mfd: sec-core: Add of_compatible strings for clock MFD cells

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

Add of_compatible strings for S5M8767 and S2MPS14 clock MFD cells.

---
 drivers/mfd/sec-core.c |    3 +++
 1 file changed, 3 insertions(+)
Quoted 5 lines
Quoted 1 line

Applied with Tomasz' Reviewed-by.

Thanks! One minor thing - I see that Tomasz' Review-by got lost when the patch was applied to your tree:
https://git.kernel.org/cgit/linux/kernel/git/lee/mfd.git/commit/?h=for-mfd-next&id=09f8c0a07044bb8ac5085fcbcf82468173a1666d.

Thanks for the prod, but I do have it applied locally. I'll push the branch later today.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#15 lore raw

PATCH v3 3/3 Documentation: mfd: s2mps11: Describe S5M8767 and S2MPS14 clocks

In reply to Krzysztof Kozlowski

Add bindings documentation for clocks on S5M8767 and S2MPS14 devices.

Cc Tomasz Figa <[email protected]>
Cc devicetree at vger.kernel.org
Cc Rob Herring <[email protected]>
Cc Pawel Moll <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Kumar Gala <[email protected]>
---
 Documentation/devicetree/bindings/mfd/s2mps11.txt |   24 +++++++++++++--------
 1 file changed, 15 insertions(+), 9 deletions(-)
Documentation/devicetree/bindings/mfd/s2mps11.txt +15 -9
index 15ee89c3cc7b..67ea05ca8050 100644
@@ -16,20 +16,25 @@ Optional properties:
 - interrupts: Interrupt specifiers for interrupt sources.
 
 Optional nodes:
-- clocks: s2mps11 provides three(AP/CP/BT) buffered 32.768 KHz outputs, so to
-  register these as clocks with common clock framework instantiate a sub-node
-  named "clocks". It uses the common clock binding documented in :
+- clocks: s2mps11 and s5m8767 provide three(AP/CP/BT) buffered 32.768 KHz
+  outputs, so to register these as clocks with common clock framework
+  instantiate a sub-node named "clocks". It uses the common clock binding
+  documented in :
   [Documentation/devicetree/bindings/clock/clock-bindings.txt]
+  The s2mps14 provides two (AP/BT) buffered 32.768 KHz outputs.
   - #clock-cells: should be 1.
 
   - The following is the list of clocks generated by the controller. Each clock
     is assigned an identifier and client nodes use this identifier to specify
     the clock which they consume.
-    Clock               ID
-    ----------------------
-    32KhzAP		0
-    32KhzCP		1
-    32KhzBT		2
+    Clock               ID           Devices
+    ----------------------------------------------------------
+    32KhzAP		0            S2MPS11, S2MPS14, S5M8767
+    32KhzCP		1            S2MPS11, S5M8767
+    32KhzBT		2            S2MPS11, S2MPS14, S5M8767
+
+  - compatible: Should be one of: "samsung,s2mps11-clk", "samsung,s2mps14-clk",
+		"samsung,s5m8767-clk"
 
 - regulators: The regulators of s2mps11 that have to be instantiated should be
 included in a sub-node named 'regulators'. Regulator nodes included in this
@@ -71,7 +76,8 @@ Example:
 		compatible = "samsung,s2mps11-pmic";
 		reg = <0x66>;
 
-		s2m_osc: clocks{
+		s2m_osc: clocks {
+			compatible = "samsung,s2mps11-clk";
 			#clock-cells = 1;
 			clock-output-names = "xx", "yy", "zz";
 		};
Signature · 1 line
1.7.9.5
Applied
#16 lore raw

Re: [PATCH v3 3/3] Documentation: mfd: s2mps11: Describe S5M8767 and S2MPS14 clocks

Quoted 11 lines

Add bindings documentation for clocks on S5M8767 and S2MPS14 devices.

Cc Tomasz Figa <[email protected]>
Cc devicetree at vger.kernel.org
Cc Rob Herring <[email protected]>
Cc Pawel Moll <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Kumar Gala <[email protected]>
Quoted 3 lines
---
 Documentation/devicetree/bindings/mfd/s2mps11.txt |   24 +++++++++++++--------
 1 file changed, 15 insertions(+), 9 deletions(-)

Applied, thanks.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog