linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] clk: oxnas: Rework driver to add support for OX820
@ 2016-10-05 15:07 Neil Armstrong
  2016-10-05 15:07 ` [PATCH 1/6] clk: oxnas: Add dt-bindings include file for OX810SE Neil Armstrong
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Neil Armstrong @ 2016-10-05 15:07 UTC (permalink / raw)
  To: sboyd
  Cc: Neil Armstrong, linux-kernel, linux-arm-kernel, linux-clk, linux-oxnas

In order to to support the Oxford Semiconductor OX820 Soc clock gates,
rework the original driver with a structure inspired from the Qcom or Meson
drivers and using the new devm_clk_hw_register() call.

The first patches add dt-bindings include file to clarify the clock indices.

In future work, OX820 PLLs should also be handled by this driver.

Neil Armstrong (6):
  clk: oxnas: Add dt-bindings include file for OX810SE
  clk: oxnas: Add dt-bindings include file for OX820
  clk: oxnas: Rename to clk_oxnas_gate
  clk: oxnas: Refactor to make use of devm_clk_hw_register()
  clk: oxnas: Add OX820 Gate clocks
  dt-bindings: clk: oxnas,stdclk: Add OX820 bindings

 .../devicetree/bindings/clock/oxnas,stdclk.txt     |  19 +-
 drivers/clk/clk-oxnas.c                            | 232 ++++++++++++++-------
 include/dt-bindings/clock/oxsemi,ox810se.h         |  30 +++
 include/dt-bindings/clock/oxsemi,ox820.h           |  40 ++++
 4 files changed, 231 insertions(+), 90 deletions(-)
 create mode 100644 include/dt-bindings/clock/oxsemi,ox810se.h
 create mode 100644 include/dt-bindings/clock/oxsemi,ox820.h

-- 
2.7.0

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/6] clk: oxnas: Add dt-bindings include file for OX810SE
  2016-10-05 15:07 [PATCH 0/6] clk: oxnas: Rework driver to add support for OX820 Neil Armstrong
@ 2016-10-05 15:07 ` Neil Armstrong
  2016-10-05 15:07 ` [PATCH 2/6] clk: oxnas: Add dt-bindings include file for OX820 Neil Armstrong
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Neil Armstrong @ 2016-10-05 15:07 UTC (permalink / raw)
  To: sboyd
  Cc: Neil Armstrong, linux-kernel, linux-arm-kernel, linux-clk,
	linux-oxnas, devicetree

In order to prepare support for the Oxford Semiconductor OX820, add
a dt-bindings include file used by the ox810se dtsi.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 include/dt-bindings/clock/oxsemi,ox810se.h | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 include/dt-bindings/clock/oxsemi,ox810se.h

diff --git a/include/dt-bindings/clock/oxsemi,ox810se.h b/include/dt-bindings/clock/oxsemi,ox810se.h
new file mode 100644
index 0000000..d5facb5
--- /dev/null
+++ b/include/dt-bindings/clock/oxsemi,ox810se.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2016 Neil Armstrong <narmstrong@baylibre.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef DT_CLOCK_OXSEMI_OX810SE_H
+#define DT_CLOCK_OXSEMI_OX810SE_H
+
+#define CLK_810_LEON		0
+#define CLK_810_DMA_SGDMA	1
+#define CLK_810_CIPHER		2
+#define CLK_810_SATA		3
+#define CLK_810_AUDIO		4
+#define CLK_810_USBMPH		5
+#define CLK_810_ETHA		6
+#define CLK_810_PCIEA		7
+#define CLK_810_NAND		8
+
+#endif /* DT_CLOCK_OXSEMI_OX810SE_H */
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/6] clk: oxnas: Add dt-bindings include file for OX820
  2016-10-05 15:07 [PATCH 0/6] clk: oxnas: Rework driver to add support for OX820 Neil Armstrong
  2016-10-05 15:07 ` [PATCH 1/6] clk: oxnas: Add dt-bindings include file for OX810SE Neil Armstrong
@ 2016-10-05 15:07 ` Neil Armstrong
  2016-10-05 15:07 ` [PATCH 3/6] clk: oxnas: Rename to clk_oxnas_gate Neil Armstrong
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Neil Armstrong @ 2016-10-05 15:07 UTC (permalink / raw)
  To: sboyd
  Cc: Neil Armstrong, linux-kernel, linux-arm-kernel, linux-clk,
	linux-oxnas, devicetree

In order to support the Oxford Semiconductor Gate clocks, add a
dedicated dt-binding include file for gate indexes.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 include/dt-bindings/clock/oxsemi,ox820.h | 40 ++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 include/dt-bindings/clock/oxsemi,ox820.h

diff --git a/include/dt-bindings/clock/oxsemi,ox820.h b/include/dt-bindings/clock/oxsemi,ox820.h
new file mode 100644
index 0000000..f661ecc
--- /dev/null
+++ b/include/dt-bindings/clock/oxsemi,ox820.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2016 Neil Armstrong <narmstrong@baylibre.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef DT_CLOCK_OXSEMI_OX820_H
+#define DT_CLOCK_OXSEMI_OX820_H
+
+/* PLLs */
+#define CLK_820_PLLA		0
+#define CLK_820_PLLB		1
+
+/* Gate Clocks */
+#define CLK_820_LEON		2
+#define CLK_820_DMA_SGDMA	3
+#define CLK_820_CIPHER		4
+#define CLK_820_SD		5
+#define CLK_820_SATA		6
+#define CLK_820_AUDIO		7
+#define CLK_820_USBMPH		8
+#define CLK_820_ETHA		9
+#define CLK_820_PCIEA		10
+#define CLK_820_NAND		11
+#define CLK_820_PCIEB		12
+#define CLK_820_ETHB		13
+#define CLK_820_REF600		14
+#define CLK_820_USBDEV		15
+
+#endif /* DT_CLOCK_OXSEMI_OX820_H */
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/6] clk: oxnas: Rename to clk_oxnas_gate
  2016-10-05 15:07 [PATCH 0/6] clk: oxnas: Rework driver to add support for OX820 Neil Armstrong
  2016-10-05 15:07 ` [PATCH 1/6] clk: oxnas: Add dt-bindings include file for OX810SE Neil Armstrong
  2016-10-05 15:07 ` [PATCH 2/6] clk: oxnas: Add dt-bindings include file for OX820 Neil Armstrong
@ 2016-10-05 15:07 ` Neil Armstrong
  2016-10-05 15:07 ` [PATCH 4/6] clk: oxnas: Refactor to make use of devm_clk_hw_register() Neil Armstrong
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Neil Armstrong @ 2016-10-05 15:07 UTC (permalink / raw)
  To: sboyd
  Cc: Neil Armstrong, linux-kernel, linux-arm-kernel, linux-clk, linux-oxnas

Rename clock ops to clk_oxnas_gate in ops and structures.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 drivers/clk/clk-oxnas.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/clk/clk-oxnas.c b/drivers/clk/clk-oxnas.c
index 47649ac..a76c7fb 100644
--- a/drivers/clk/clk-oxnas.c
+++ b/drivers/clk/clk-oxnas.c
@@ -26,7 +26,7 @@
 #include <linux/mfd/syscon.h>
 
 /* Standard regmap gate clocks */
-struct clk_oxnas {
+struct clk_oxnas_gate {
 	struct clk_hw hw;
 	signed char bit;
 	struct regmap *regmap;
@@ -37,14 +37,14 @@ struct clk_oxnas {
 #define CLK_SET_REGOFFSET	0x2c
 #define CLK_CLR_REGOFFSET	0x30
 
-static inline struct clk_oxnas *to_clk_oxnas(struct clk_hw *hw)
+static inline struct clk_oxnas_gate *to_clk_oxnas_gate(struct clk_hw *hw)
 {
-	return container_of(hw, struct clk_oxnas, hw);
+	return container_of(hw, struct clk_oxnas_gate, hw);
 }
 
-static int oxnas_clk_is_enabled(struct clk_hw *hw)
+static int oxnas_clk_gate_is_enabled(struct clk_hw *hw)
 {
-	struct clk_oxnas *std = to_clk_oxnas(hw);
+	struct clk_oxnas_gate *std = to_clk_oxnas_gate(hw);
 	int ret;
 	unsigned int val;
 
@@ -55,26 +55,26 @@ static int oxnas_clk_is_enabled(struct clk_hw *hw)
 	return val & BIT(std->bit);
 }
 
-static int oxnas_clk_enable(struct clk_hw *hw)
+static int oxnas_clk_gate_enable(struct clk_hw *hw)
 {
-	struct clk_oxnas *std = to_clk_oxnas(hw);
+	struct clk_oxnas_gate *std = to_clk_oxnas_gate(hw);
 
 	regmap_write(std->regmap, CLK_SET_REGOFFSET, BIT(std->bit));
 
 	return 0;
 }
 
-static void oxnas_clk_disable(struct clk_hw *hw)
+static void oxnas_clk_gate_disable(struct clk_hw *hw)
 {
-	struct clk_oxnas *std = to_clk_oxnas(hw);
+	struct clk_oxnas_gate *std = to_clk_oxnas_gate(hw);
 
 	regmap_write(std->regmap, CLK_CLR_REGOFFSET, BIT(std->bit));
 }
 
-static const struct clk_ops oxnas_clk_ops = {
-	.enable = oxnas_clk_enable,
-	.disable = oxnas_clk_disable,
-	.is_enabled = oxnas_clk_is_enabled,
+static const struct clk_ops oxnas_clk_gate_ops = {
+	.enable = oxnas_clk_gate_enable,
+	.disable = oxnas_clk_gate_disable,
+	.is_enabled = oxnas_clk_gate_is_enabled,
 };
 
 static const char *const oxnas_clk_parents[] = {
@@ -88,7 +88,7 @@ static const char *const eth_parents[] = {
 #define DECLARE_STD_CLKP(__clk, __parent)			\
 static const struct clk_init_data clk_##__clk##_init = {	\
 	.name = __stringify(__clk),				\
-	.ops = &oxnas_clk_ops,					\
+	.ops = &oxnas_clk_gate_ops,					\
 	.parent_names = __parent,				\
 	.num_parents = ARRAY_SIZE(__parent),			\
 }
@@ -127,7 +127,7 @@ static const struct clk_oxnas_init_data clk_oxnas_init[] = {
 };
 
 struct clk_oxnas_data {
-	struct clk_oxnas clk_oxnas[ARRAY_SIZE(clk_oxnas_init)];
+	struct clk_oxnas_gate clk_oxnas[ARRAY_SIZE(clk_oxnas_init)];
 	struct clk_onecell_data onecell_data[ARRAY_SIZE(clk_oxnas_init)];
 	struct clk *clks[ARRAY_SIZE(clk_oxnas_init)];
 };
@@ -150,7 +150,7 @@ static int oxnas_stdclk_probe(struct platform_device *pdev)
 	}
 
 	for (i = 0; i < ARRAY_SIZE(clk_oxnas_init); i++) {
-		struct clk_oxnas *_clk;
+		struct clk_oxnas_gate *_clk;
 
 		_clk = &clk_oxnas->clk_oxnas[i];
 		_clk->bit = clk_oxnas_init[i].bit;
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/6] clk: oxnas: Refactor to make use of devm_clk_hw_register()
  2016-10-05 15:07 [PATCH 0/6] clk: oxnas: Rework driver to add support for OX820 Neil Armstrong
                   ` (2 preceding siblings ...)
  2016-10-05 15:07 ` [PATCH 3/6] clk: oxnas: Rename to clk_oxnas_gate Neil Armstrong
@ 2016-10-05 15:07 ` Neil Armstrong
  2016-10-05 15:07 ` [PATCH 5/6] clk: oxnas: Add OX820 Gate clocks Neil Armstrong
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Neil Armstrong @ 2016-10-05 15:07 UTC (permalink / raw)
  To: sboyd
  Cc: Neil Armstrong, linux-kernel, linux-arm-kernel, linux-clk, linux-oxnas

Make usage of static tables identified by the OF match table to
feed devm_clk_hw_register() and use of_clk_add_hw_provider().

This structure is cleaner and simplifies adding new SoC support while
having common probe and gate ops code.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 drivers/clk/clk-oxnas.c | 148 +++++++++++++++++++++++++++---------------------
 1 file changed, 84 insertions(+), 64 deletions(-)

diff --git a/drivers/clk/clk-oxnas.c b/drivers/clk/clk-oxnas.c
index a76c7fb..b1ef3ea9 100644
--- a/drivers/clk/clk-oxnas.c
+++ b/drivers/clk/clk-oxnas.c
@@ -20,18 +20,29 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/of.h>
+#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/stringify.h>
 #include <linux/regmap.h>
 #include <linux/mfd/syscon.h>
 
+#include <dt-bindings/clock/oxsemi,ox810se.h>
+
 /* Standard regmap gate clocks */
 struct clk_oxnas_gate {
 	struct clk_hw hw;
-	signed char bit;
+	unsigned int bit;
 	struct regmap *regmap;
 };
 
+struct oxnas_stdclk_data {
+	struct clk_hw_onecell_data *onecell_data;
+	struct clk_oxnas_gate **gates;
+	unsigned int ngates;
+	struct clk_oxnas_pll **plls;
+	unsigned int nplls;
+};
+
 /* Regmap offsets */
 #define CLK_STAT_REGOFFSET	0x24
 #define CLK_SET_REGOFFSET	0x2c
@@ -77,7 +88,7 @@ static const struct clk_ops oxnas_clk_gate_ops = {
 	.is_enabled = oxnas_clk_gate_is_enabled,
 };
 
-static const char *const oxnas_clk_parents[] = {
+static const char *const osc_parents[] = {
 	"oscillator",
 };
 
@@ -85,63 +96,81 @@ static const char *const eth_parents[] = {
 	"gmacclk",
 };
 
-#define DECLARE_STD_CLKP(__clk, __parent)			\
-static const struct clk_init_data clk_##__clk##_init = {	\
-	.name = __stringify(__clk),				\
-	.ops = &oxnas_clk_gate_ops,					\
-	.parent_names = __parent,				\
-	.num_parents = ARRAY_SIZE(__parent),			\
+#define OXNAS_GATE(_name, _bit, _parents)				\
+struct clk_oxnas_gate _name = {						\
+	.bit = (_bit),							\
+	.hw.init = &(struct clk_init_data) {				\
+		.name = #_name,						\
+		.ops = &oxnas_clk_gate_ops,				\
+		.parent_names = _parents,				\
+		.num_parents = ARRAY_SIZE(_parents),			\
+		.flags = (CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED),	\
+	},								\
 }
 
-#define DECLARE_STD_CLK(__clk) DECLARE_STD_CLKP(__clk, oxnas_clk_parents)
+static OXNAS_GATE(ox810se_leon, 0, osc_parents);
+static OXNAS_GATE(ox810se_dma_sgdma, 1, osc_parents);
+static OXNAS_GATE(ox810se_cipher, 2, osc_parents);
+static OXNAS_GATE(ox810se_sata, 4, osc_parents);
+static OXNAS_GATE(ox810se_audio, 5, osc_parents);
+static OXNAS_GATE(ox810se_usbmph, 6, osc_parents);
+static OXNAS_GATE(ox810se_etha, 7, eth_parents);
+static OXNAS_GATE(ox810se_pciea, 8, osc_parents);
+static OXNAS_GATE(ox810se_nand, 9, osc_parents);
+
+static struct clk_oxnas_gate *ox810se_gates[] = {
+	&ox810se_leon,
+	&ox810se_dma_sgdma,
+	&ox810se_cipher,
+	&ox810se_sata,
+	&ox810se_audio,
+	&ox810se_usbmph,
+	&ox810se_etha,
+	&ox810se_pciea,
+	&ox810se_nand,
+};
 
-/* Hardware Bit - Clock association */
-struct clk_oxnas_init_data {
-	unsigned long bit;
-	const struct clk_init_data *clk_init;
+static struct clk_hw_onecell_data ox810se_hw_onecell_data = {
+	.hws = {
+		[CLK_810_LEON]	= &ox810se_leon.hw,
+		[CLK_810_DMA_SGDMA]	= &ox810se_dma_sgdma.hw,
+		[CLK_810_CIPHER]	= &ox810se_cipher.hw,
+		[CLK_810_SATA]	= &ox810se_sata.hw,
+		[CLK_810_AUDIO]	= &ox810se_audio.hw,
+		[CLK_810_USBMPH]	= &ox810se_usbmph.hw,
+		[CLK_810_ETHA]	= &ox810se_etha.hw,
+		[CLK_810_PCIEA]	= &ox810se_pciea.hw,
+		[CLK_810_NAND]	= &ox810se_nand.hw,
+	},
+	.num = ARRAY_SIZE(ox810se_gates),
 };
 
-/* Clk init data declaration */
-DECLARE_STD_CLK(leon);
-DECLARE_STD_CLK(dma_sgdma);
-DECLARE_STD_CLK(cipher);
-DECLARE_STD_CLK(sata);
-DECLARE_STD_CLK(audio);
-DECLARE_STD_CLK(usbmph);
-DECLARE_STD_CLKP(etha, eth_parents);
-DECLARE_STD_CLK(pciea);
-DECLARE_STD_CLK(nand);
-
-/* Table index is clock indice */
-static const struct clk_oxnas_init_data clk_oxnas_init[] = {
-	[0] = {0, &clk_leon_init},
-	[1] = {1, &clk_dma_sgdma_init},
-	[2] = {2, &clk_cipher_init},
-	/* Skip & Do not touch to DDR clock */
-	[3] = {4, &clk_sata_init},
-	[4] = {5, &clk_audio_init},
-	[5] = {6, &clk_usbmph_init},
-	[6] = {7, &clk_etha_init},
-	[7] = {8, &clk_pciea_init},
-	[8] = {9, &clk_nand_init},
+
+static struct oxnas_stdclk_data ox810se_stdclk_data = {
+	.onecell_data = &ox810se_hw_onecell_data,
+	.gates = ox810se_gates,
+	.ngates = ARRAY_SIZE(ox810se_gates),
 };
 
-struct clk_oxnas_data {
-	struct clk_oxnas_gate clk_oxnas[ARRAY_SIZE(clk_oxnas_init)];
-	struct clk_onecell_data onecell_data[ARRAY_SIZE(clk_oxnas_init)];
-	struct clk *clks[ARRAY_SIZE(clk_oxnas_init)];
+
+static const struct of_device_id oxnas_stdclk_dt_ids[] = {
+	{ .compatible = "oxsemi,ox810se-stdclk", &ox810se_stdclk_data },
+	{ }
 };
 
 static int oxnas_stdclk_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
-	struct clk_oxnas_data *clk_oxnas;
+	const struct oxnas_stdclk_data *data;
+	const struct of_device_id *id;
 	struct regmap *regmap;
+	int ret;
 	int i;
 
-	clk_oxnas = devm_kzalloc(&pdev->dev, sizeof(*clk_oxnas), GFP_KERNEL);
-	if (!clk_oxnas)
-		return -ENOMEM;
+	id = of_match_device(oxnas_stdclk_dt_ids, &pdev->dev);
+	if (!id)
+		return -ENODEV;
+	data = id->data;
 
 	regmap = syscon_node_to_regmap(of_get_parent(np));
 	if (IS_ERR(regmap)) {
@@ -149,32 +178,23 @@ static int oxnas_stdclk_probe(struct platform_device *pdev)
 		return PTR_ERR(regmap);
 	}
 
-	for (i = 0; i < ARRAY_SIZE(clk_oxnas_init); i++) {
-		struct clk_oxnas_gate *_clk;
+	for (i = 0 ; i < data->ngates ; ++i)
+		data->gates[i]->regmap = regmap;
 
-		_clk = &clk_oxnas->clk_oxnas[i];
-		_clk->bit = clk_oxnas_init[i].bit;
-		_clk->hw.init = clk_oxnas_init[i].clk_init;
-		_clk->regmap = regmap;
+	for (i = 0; i < data->onecell_data->num; i++) {
+		if (!data->onecell_data->hws[i])
+			continue;
 
-		clk_oxnas->clks[i] =
-			devm_clk_register(&pdev->dev, &_clk->hw);
-		if (WARN_ON(IS_ERR(clk_oxnas->clks[i])))
-			return PTR_ERR(clk_oxnas->clks[i]);
+		ret = devm_clk_hw_register(&pdev->dev,
+					   data->onecell_data->hws[i]);
+		if (ret)
+			return ret;
 	}
 
-	clk_oxnas->onecell_data->clks = clk_oxnas->clks;
-	clk_oxnas->onecell_data->clk_num = ARRAY_SIZE(clk_oxnas_init);
-
-	return of_clk_add_provider(np, of_clk_src_onecell_get,
-				   clk_oxnas->onecell_data);
+	return of_clk_add_hw_provider(np, of_clk_hw_onecell_get,
+				      data->onecell_data);
 }
 
-static const struct of_device_id oxnas_stdclk_dt_ids[] = {
-	{ .compatible = "oxsemi,ox810se-stdclk" },
-	{ }
-};
-
 static struct platform_driver oxnas_stdclk_driver = {
 	.probe = oxnas_stdclk_probe,
 	.driver	= {
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 5/6] clk: oxnas: Add OX820 Gate clocks
  2016-10-05 15:07 [PATCH 0/6] clk: oxnas: Rework driver to add support for OX820 Neil Armstrong
                   ` (3 preceding siblings ...)
  2016-10-05 15:07 ` [PATCH 4/6] clk: oxnas: Refactor to make use of devm_clk_hw_register() Neil Armstrong
@ 2016-10-05 15:07 ` Neil Armstrong
  2016-10-05 15:07 ` [PATCH 6/6] dt-bindings: clk: oxnas,stdclk: Add OX820 bindings Neil Armstrong
  2016-10-11  7:59 ` [PATCH 0/6] clk: oxnas: Rework driver to add support for OX820 Michael Turquette
  6 siblings, 0 replies; 10+ messages in thread
From: Neil Armstrong @ 2016-10-05 15:07 UTC (permalink / raw)
  To: sboyd
  Cc: Neil Armstrong, linux-kernel, linux-arm-kernel, linux-clk, linux-oxnas

Add support for the Oxford Semiconductor OX820 SoC gate clocks
along the OX810SE SoC support.
This rework on concerns the gate clocks since they are different.
Future PLL handling code will be added for OX820.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 drivers/clk/clk-oxnas.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/drivers/clk/clk-oxnas.c b/drivers/clk/clk-oxnas.c
index b1ef3ea9..e51e002 100644
--- a/drivers/clk/clk-oxnas.c
+++ b/drivers/clk/clk-oxnas.c
@@ -27,6 +27,7 @@
 #include <linux/mfd/syscon.h>
 
 #include <dt-bindings/clock/oxsemi,ox810se.h>
+#include <dt-bindings/clock/oxsemi,ox820.h>
 
 /* Standard regmap gate clocks */
 struct clk_oxnas_gate {
@@ -130,6 +131,38 @@ static struct clk_oxnas_gate *ox810se_gates[] = {
 	&ox810se_nand,
 };
 
+static OXNAS_GATE(ox820_leon, 0, osc_parents);
+static OXNAS_GATE(ox820_dma_sgdma, 1, osc_parents);
+static OXNAS_GATE(ox820_cipher, 2, osc_parents);
+static OXNAS_GATE(ox820_sd, 3, osc_parents);
+static OXNAS_GATE(ox820_sata, 4, osc_parents);
+static OXNAS_GATE(ox820_audio, 5, osc_parents);
+static OXNAS_GATE(ox820_usbmph, 6, osc_parents);
+static OXNAS_GATE(ox820_etha, 7, eth_parents);
+static OXNAS_GATE(ox820_pciea, 8, osc_parents);
+static OXNAS_GATE(ox820_nand, 9, osc_parents);
+static OXNAS_GATE(ox820_ethb, 10, eth_parents);
+static OXNAS_GATE(ox820_pcieb, 11, osc_parents);
+static OXNAS_GATE(ox820_ref600, 12, osc_parents);
+static OXNAS_GATE(ox820_usbdev, 13, osc_parents);
+
+static struct clk_oxnas_gate *ox820_gates[] = {
+	&ox820_leon,
+	&ox820_dma_sgdma,
+	&ox820_cipher,
+	&ox820_sd,
+	&ox820_sata,
+	&ox820_audio,
+	&ox820_usbmph,
+	&ox820_etha,
+	&ox820_pciea,
+	&ox820_nand,
+	&ox820_etha,
+	&ox820_pciea,
+	&ox820_ref600,
+	&ox820_usbdev,
+};
+
 static struct clk_hw_onecell_data ox810se_hw_onecell_data = {
 	.hws = {
 		[CLK_810_LEON]	= &ox810se_leon.hw,
@@ -145,6 +178,25 @@ static struct clk_hw_onecell_data ox810se_hw_onecell_data = {
 	.num = ARRAY_SIZE(ox810se_gates),
 };
 
+static struct clk_hw_onecell_data ox820_hw_onecell_data = {
+	.hws = {
+		[CLK_820_LEON]	= &ox820_leon.hw,
+		[CLK_820_DMA_SGDMA]	= &ox820_dma_sgdma.hw,
+		[CLK_820_CIPHER]	= &ox820_cipher.hw,
+		[CLK_820_SD]	= &ox820_sd.hw,
+		[CLK_820_SATA]	= &ox820_sata.hw,
+		[CLK_820_AUDIO]	= &ox820_audio.hw,
+		[CLK_820_USBMPH]	= &ox820_usbmph.hw,
+		[CLK_820_ETHA]	= &ox820_etha.hw,
+		[CLK_820_PCIEA]	= &ox820_pciea.hw,
+		[CLK_820_NAND]	= &ox820_nand.hw,
+		[CLK_820_ETHB]	= &ox820_ethb.hw,
+		[CLK_820_PCIEB]	= &ox820_pcieb.hw,
+		[CLK_820_REF600]	= &ox820_ref600.hw,
+		[CLK_820_USBDEV]	= &ox820_usbdev.hw,
+	},
+	.num = ARRAY_SIZE(ox820_gates),
+};
 
 static struct oxnas_stdclk_data ox810se_stdclk_data = {
 	.onecell_data = &ox810se_hw_onecell_data,
@@ -152,9 +204,15 @@ static struct oxnas_stdclk_data ox810se_stdclk_data = {
 	.ngates = ARRAY_SIZE(ox810se_gates),
 };
 
+static struct oxnas_stdclk_data ox820_stdclk_data = {
+	.onecell_data = &ox820_hw_onecell_data,
+	.gates = ox820_gates,
+	.ngates = ARRAY_SIZE(ox820_gates),
+};
 
 static const struct of_device_id oxnas_stdclk_dt_ids[] = {
 	{ .compatible = "oxsemi,ox810se-stdclk", &ox810se_stdclk_data },
+	{ .compatible = "oxsemi,ox820-stdclk", &ox820_stdclk_data },
 	{ }
 };
 
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 6/6] dt-bindings: clk: oxnas,stdclk: Add OX820 bindings
  2016-10-05 15:07 [PATCH 0/6] clk: oxnas: Rework driver to add support for OX820 Neil Armstrong
                   ` (4 preceding siblings ...)
  2016-10-05 15:07 ` [PATCH 5/6] clk: oxnas: Add OX820 Gate clocks Neil Armstrong
@ 2016-10-05 15:07 ` Neil Armstrong
  2016-10-10 12:59   ` Rob Herring
  2016-10-11  7:59 ` [PATCH 0/6] clk: oxnas: Rework driver to add support for OX820 Michael Turquette
  6 siblings, 1 reply; 10+ messages in thread
From: Neil Armstrong @ 2016-10-05 15:07 UTC (permalink / raw)
  To: sboyd
  Cc: Neil Armstrong, linux-kernel, linux-arm-kernel, linux-clk,
	linux-oxnas, devicetree

Add OX820 bindings and remove clock indices from bindings since they are present
in the dt-bindings headers files.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 .../devicetree/bindings/clock/oxnas,stdclk.txt        | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/Documentation/devicetree/bindings/clock/oxnas,stdclk.txt b/Documentation/devicetree/bindings/clock/oxnas,stdclk.txt
index 208cca6..b652f3f 100644
--- a/Documentation/devicetree/bindings/clock/oxnas,stdclk.txt
+++ b/Documentation/devicetree/bindings/clock/oxnas,stdclk.txt
@@ -5,22 +5,15 @@ Please also refer to clock-bindings.txt in this directory for common clock
 bindings usage.
 
 Required properties:
-- compatible: Should be "oxsemi,ox810se-stdclk"
+- compatible: For OX810SE, should be "oxsemi,ox810se-stdclk"
+	      For OX820, should be "oxsemi,ox820-stdclk"
 - #clock-cells: 1, see below
 
 Parent node should have the following properties :
-- compatible: Should be "oxsemi,ox810se-sys-ctrl", "syscon", "simple-mfd"
-
-For OX810SE, the clock indices are :
- - 0: LEON
- - 1: DMA_SGDMA
- - 2: CIPHER
- - 3: SATA
- - 4: AUDIO
- - 5: USBMPH
- - 6: ETHA
- - 7: PCIA
- - 8: NAND
+- compatible: For OX810SE, should be
+		"oxsemi,ox810se-sys-ctrl", "syscon", "simple-mfd"
+	      For OX820, should be
+		"oxsemi,ox820-sys-ctrl", "syscon", "simple-mfd"
 
 example:
 
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 6/6] dt-bindings: clk: oxnas,stdclk: Add OX820 bindings
  2016-10-05 15:07 ` [PATCH 6/6] dt-bindings: clk: oxnas,stdclk: Add OX820 bindings Neil Armstrong
@ 2016-10-10 12:59   ` Rob Herring
  0 siblings, 0 replies; 10+ messages in thread
From: Rob Herring @ 2016-10-10 12:59 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: sboyd, linux-kernel, linux-arm-kernel, linux-clk, linux-oxnas,
	devicetree

On Wed, Oct 05, 2016 at 05:07:52PM +0200, Neil Armstrong wrote:
> Add OX820 bindings and remove clock indices from bindings since they are present
> in the dt-bindings headers files.
> 
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> ---
>  .../devicetree/bindings/clock/oxnas,stdclk.txt        | 19 ++++++-------------
>  1 file changed, 6 insertions(+), 13 deletions(-)

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/6] clk: oxnas: Rework driver to add support for OX820
  2016-10-05 15:07 [PATCH 0/6] clk: oxnas: Rework driver to add support for OX820 Neil Armstrong
                   ` (5 preceding siblings ...)
  2016-10-05 15:07 ` [PATCH 6/6] dt-bindings: clk: oxnas,stdclk: Add OX820 bindings Neil Armstrong
@ 2016-10-11  7:59 ` Michael Turquette
  2016-10-23 17:20   ` Michael Turquette
  6 siblings, 1 reply; 10+ messages in thread
From: Michael Turquette @ 2016-10-11  7:59 UTC (permalink / raw)
  To: Neil Armstrong, sboyd
  Cc: Neil Armstrong, linux-kernel, linux-arm-kernel, linux-clk, linux-oxnas

Quoting Neil Armstrong (2016-10-05 17:07:46)
> In order to to support the Oxford Semiconductor OX820 Soc clock gates,
> rework the original driver with a structure inspired from the Qcom or Meson
> drivers and using the new devm_clk_hw_register() call.
> 
> The first patches add dt-bindings include file to clarify the clock indices.
> 
> In future work, OX820 PLLs should also be handled by this driver.

Series looks good to me. Will apply after -rc1 drops.

Regards,
Mike

> 
> Neil Armstrong (6):
>   clk: oxnas: Add dt-bindings include file for OX810SE
>   clk: oxnas: Add dt-bindings include file for OX820
>   clk: oxnas: Rename to clk_oxnas_gate
>   clk: oxnas: Refactor to make use of devm_clk_hw_register()
>   clk: oxnas: Add OX820 Gate clocks
>   dt-bindings: clk: oxnas,stdclk: Add OX820 bindings
> 
>  .../devicetree/bindings/clock/oxnas,stdclk.txt     |  19 +-
>  drivers/clk/clk-oxnas.c                            | 232 ++++++++++++++-------
>  include/dt-bindings/clock/oxsemi,ox810se.h         |  30 +++
>  include/dt-bindings/clock/oxsemi,ox820.h           |  40 ++++
>  4 files changed, 231 insertions(+), 90 deletions(-)
>  create mode 100644 include/dt-bindings/clock/oxsemi,ox810se.h
>  create mode 100644 include/dt-bindings/clock/oxsemi,ox820.h
> 
> -- 
> 2.7.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-clk" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/6] clk: oxnas: Rework driver to add support for OX820
  2016-10-11  7:59 ` [PATCH 0/6] clk: oxnas: Rework driver to add support for OX820 Michael Turquette
@ 2016-10-23 17:20   ` Michael Turquette
  0 siblings, 0 replies; 10+ messages in thread
From: Michael Turquette @ 2016-10-23 17:20 UTC (permalink / raw)
  To: Neil Armstrong, sboyd
  Cc: Neil Armstrong, linux-kernel, linux-arm-kernel, linux-clk, linux-oxnas

Quoting Michael Turquette (2016-10-11 00:59:00)
> Quoting Neil Armstrong (2016-10-05 17:07:46)
> > In order to to support the Oxford Semiconductor OX820 Soc clock gates,
> > rework the original driver with a structure inspired from the Qcom or Meson
> > drivers and using the new devm_clk_hw_register() call.
> > 
> > The first patches add dt-bindings include file to clarify the clock indices.
> > 
> > In future work, OX820 PLLs should also be handled by this driver.
> 
> Series looks good to me. Will apply after -rc1 drops.

Applied.

Regards,
Mike

> 
> Regards,
> Mike
> 
> > 
> > Neil Armstrong (6):
> >   clk: oxnas: Add dt-bindings include file for OX810SE
> >   clk: oxnas: Add dt-bindings include file for OX820
> >   clk: oxnas: Rename to clk_oxnas_gate
> >   clk: oxnas: Refactor to make use of devm_clk_hw_register()
> >   clk: oxnas: Add OX820 Gate clocks
> >   dt-bindings: clk: oxnas,stdclk: Add OX820 bindings
> > 
> >  .../devicetree/bindings/clock/oxnas,stdclk.txt     |  19 +-
> >  drivers/clk/clk-oxnas.c                            | 232 ++++++++++++++-------
> >  include/dt-bindings/clock/oxsemi,ox810se.h         |  30 +++
> >  include/dt-bindings/clock/oxsemi,ox820.h           |  40 ++++
> >  4 files changed, 231 insertions(+), 90 deletions(-)
> >  create mode 100644 include/dt-bindings/clock/oxsemi,ox810se.h
> >  create mode 100644 include/dt-bindings/clock/oxsemi,ox820.h
> > 
> > -- 
> > 2.7.0
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-clk" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-10-23 17:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-05 15:07 [PATCH 0/6] clk: oxnas: Rework driver to add support for OX820 Neil Armstrong
2016-10-05 15:07 ` [PATCH 1/6] clk: oxnas: Add dt-bindings include file for OX810SE Neil Armstrong
2016-10-05 15:07 ` [PATCH 2/6] clk: oxnas: Add dt-bindings include file for OX820 Neil Armstrong
2016-10-05 15:07 ` [PATCH 3/6] clk: oxnas: Rename to clk_oxnas_gate Neil Armstrong
2016-10-05 15:07 ` [PATCH 4/6] clk: oxnas: Refactor to make use of devm_clk_hw_register() Neil Armstrong
2016-10-05 15:07 ` [PATCH 5/6] clk: oxnas: Add OX820 Gate clocks Neil Armstrong
2016-10-05 15:07 ` [PATCH 6/6] dt-bindings: clk: oxnas,stdclk: Add OX820 bindings Neil Armstrong
2016-10-10 12:59   ` Rob Herring
2016-10-11  7:59 ` [PATCH 0/6] clk: oxnas: Rework driver to add support for OX820 Michael Turquette
2016-10-23 17:20   ` Michael Turquette

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).