Skip to contentSkip to conversation

socfpga: clk: trivial fixes and cleanup

PATCH New Steffen Trumtrar 2 participants 6 messages Dec 18, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover socfpga: clk: trivial fixes and cleanup

Hi!

This series includes two trivial fixes to the code (1/4 and 2/4), and a fixes a compile error in 3/4 introduced by the patch

clk: socfpga: Look for the GPIO_DB_CLK by its offset

from

[GIT PULL] clk: socfpga: Clean-ups for 3.14

The series is rebased onto

git://git.rocketboards.org/linux-socfpga-next.git socfpga-clk-for-3.14

and the patch

clk: socfpga: Add a clk-phase property to the "altr, socfpga-gate-clk"

from the series

socfpga: Enable SD/MMC support

Regards,
Steffen

Steffen Trumtrar (4):
ARM: socfpga: clk: remove unused field
ARM: socfpga: clk: fix define typo
ARM: socfpga: clk: fix compile error
ARM: socfpga: clk: split clk code

 drivers/clk/socfpga/Makefile     |   3 +
 drivers/clk/socfpga/clk-gate.c   | 223 +++++++++++++++++++++++++
 drivers/clk/socfpga/clk-periph.c |  94 +++++++++++
 drivers/clk/socfpga/clk-pll.c    | 111 +++++++++++++
 drivers/clk/socfpga/clk.c        | 347 +--------------------------------------
 drivers/clk/socfpga/clk.h        |  57 +++++++
 6 files changed, 490 insertions(+), 345 deletions(-)
 create mode 100644 drivers/clk/socfpga/clk-gate.c
 create mode 100644 drivers/clk/socfpga/clk-periph.c
 create mode 100644 drivers/clk/socfpga/clk-pll.c
 create mode 100644 drivers/clk/socfpga/clk.h
Signature · 1 line
1.8.5.1
#1 lore raw

PATCH v2 1/4 ARM: socfpga: clk: remove unused field

The clk_name field from the socfpga_clk struct is unused. Remove it.

---
 drivers/clk/socfpga/clk.c | 1 -
 1 file changed, 1 deletion(-)
drivers/clk/socfpga/clk.c +0 -1
index 46911748..4503863 100644
@@ -68,7 +68,6 @@ static void __iomem *clk_mgr_base_addr;
 struct socfpga_clk {
 	struct clk_gate hw;
 	char *parent_name;
-	char *clk_name;
 	u32 fixed_div;
 	void __iomem *div_reg;
 	u32 width;	/* only valid if div_reg != 0 */
Signature · 1 line
1.8.5.1
#2 lore raw

PATCH v2 2/4 ARM: socfpga: clk: fix define typo

In reply to Steffen Trumtrar

It should be SOCFPGA instead of SOCFGPA.

---
 drivers/clk/socfpga/clk.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clk/socfpga/clk.c +3 -3
index 4503863..f140ece 100644
@@ -46,7 +46,7 @@
 #define SOCFPGA_PLL_DIVF_SHIFT	3
 #define SOCFPGA_PLL_DIVQ_MASK		0x003F0000
 #define SOCFPGA_PLL_DIVQ_SHIFT	16
-#define SOCFGPA_MAX_PARENTS	3
+#define SOCFPGA_MAX_PARENTS	3
 
 #define SOCFPGA_L4_MP_CLK		"l4_mp_clk"
 #define SOCFPGA_L4_SP_CLK		"l4_sp_clk"
@@ -290,7 +290,7 @@ static void __init socfpga_gate_clk_init(struct device_node *node,
 	struct clk *clk;
 	struct socfpga_clk *socfpga_clk;
 	const char *clk_name = node->name;
-	const char *parent_name[SOCFGPA_MAX_PARENTS];
+	const char *parent_name[SOCFPGA_MAX_PARENTS];
 	struct clk_init_data init;
 	int rc;
 	int i = 0;
@@ -337,7 +337,7 @@ static void __init socfpga_gate_clk_init(struct device_node *node,
 	init.name = clk_name;
 	init.ops = ops;
 	init.flags = 0;
-	while (i < SOCFGPA_MAX_PARENTS && (parent_name[i] =
+	while (i < SOCFPGA_MAX_PARENTS && (parent_name[i] =
 			of_clk_get_parent_name(node, i)) != NULL)
 		i++;
 
Signature · 1 line
1.8.5.1
#3 lore raw

PATCH v2 3/4 ARM: socfpga: clk: fix compile error

In reply to Steffen Trumtrar

Fix the following compile error:

drivers/clk/socfpga/clk-gate.c:118:27: error: invalid operands to binary & (have 'void *' and 'int')

introduced by:

clk: socfpga: Look for the GPIO_DB_CLK by its offset

---
 drivers/clk/socfpga/clk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/socfpga/clk.c +1 -1
index f140ece..e1284fb 100644
@@ -244,7 +244,7 @@ static unsigned long socfpga_clk_recalc_rate(struct clk_hw *hwclk,
 		val = readl(socfpgaclk->div_reg) >> socfpgaclk->shift;
 		val &= div_mask(socfpgaclk->width);
 		/* Check for GPIO_DB_CLK by its offset */
-		if (socfpgaclk->div_reg & SOCFPGA_GPIO_DB_CLK_OFFSET)
+		if ((int) socfpgaclk->div_reg & SOCFPGA_GPIO_DB_CLK_OFFSET)
 			div = val + 1;
 		else
 			div = (1 << val);
Signature · 1 line
1.8.5.1
#4 lore raw

PATCH v2 4/4 ARM: socfpga: clk: split clk code

In reply to Steffen Trumtrar

Move the different kinds of clocks into their own files. The reason is to aid readability of the code. This also goes along with the other SoC-specific clock drivers.

The split introduces new structs for the three types of clocks and uses them. Other changes are not done to the code.

---
 drivers/clk/socfpga/Makefile     |   3 +
 drivers/clk/socfpga/clk-gate.c   | 223 +++++++++++++++++++++++++
 drivers/clk/socfpga/clk-periph.c |  94 +++++++++++
 drivers/clk/socfpga/clk-pll.c    | 111 +++++++++++++
 drivers/clk/socfpga/clk.c        | 346 +--------------------------------------
 drivers/clk/socfpga/clk.h        |  57 +++++++
 6 files changed, 490 insertions(+), 344 deletions(-)
 create mode 100644 drivers/clk/socfpga/clk-gate.c
 create mode 100644 drivers/clk/socfpga/clk-periph.c
 create mode 100644 drivers/clk/socfpga/clk-pll.c
 create mode 100644 drivers/clk/socfpga/clk.h
drivers/clk/socfpga/Makefile +3 -0
index 0303c0b..7e2d15a 100644
@@ -1 +1,4 @@
 obj-y += clk.o
+obj-y += clk-gate.o
+obj-y += clk-pll.o
+obj-y += clk-periph.o
drivers/clk/socfpga/clk-gate.c new file +223 -0

223 lines not on this page · raw message

drivers/clk/socfpga/clk-periph.c new file +94 -0

94 lines not on this page · raw message

drivers/clk/socfpga/clk-pll.c new file +111 -0

111 lines not on this page · raw message

drivers/clk/socfpga/clk.c +2 -344

356 lines not on this page · raw message

drivers/clk/socfpga/clk.h new file +57 -0

57 lines not on this page · raw message

Signature · 1 line
1.8.5.1
#5 lore raw

v2 cover socfpga: clk: trivial fixes and cleanup

In reply to Steffen Trumtrar

Quoting Steffen Trumtrar (2013-12-18 09:02:58)

Quoted 15 lines

Hi!

This series includes two trivial fixes to the code (1/4 and 2/4), and a fixes a compile error in 3/4 introduced by the patch

clk: socfpga: Look for the GPIO_DB_CLK by its offset

from

[GIT PULL] clk: socfpga: Clean-ups for 3.14

The series is rebased onto

git://git.rocketboards.org/linux-socfpga-next.git socfpga-clk-for-3.14

Quoted 7 lines

and the patch

clk: socfpga: Add a clk-phase property to the "altr, socfpga-gate-clk"

from the series

socfpga: Enable SD/MMC support

Stephen & Dinh,

I've gone through the socfpga patches on the list (this series, the 3 patches in socfpga-clk-for-3.14 and the clock patch from "[RESEND LIST PATCHv7 0/4] socfpga: Enable SD/MMC support"). Everything looks pretty good.

When the issue with the clock-phase property is resolved can you coordinate a pull request with all of the socfpga patches in it based on the latest clk-next?

Thanks,
Mike

Quoted 25 lines

Regards,
Steffen

Steffen Trumtrar (4):
ARM: socfpga: clk: remove unused field
ARM: socfpga: clk: fix define typo
ARM: socfpga: clk: fix compile error
ARM: socfpga: clk: split clk code

 drivers/clk/socfpga/Makefile     |   3 +
 drivers/clk/socfpga/clk-gate.c   | 223 +++++++++++++++++++++++++
 drivers/clk/socfpga/clk-periph.c |  94 +++++++++++
 drivers/clk/socfpga/clk-pll.c    | 111 +++++++++++++
 drivers/clk/socfpga/clk.c        | 347 +--------------------------------------
 drivers/clk/socfpga/clk.h        |  57 +++++++
 6 files changed, 490 insertions(+), 345 deletions(-)
 create mode 100644 drivers/clk/socfpga/clk-gate.c
 create mode 100644 drivers/clk/socfpga/clk-periph.c
 create mode 100644 drivers/clk/socfpga/clk-pll.c
 create mode 100644 drivers/clk/socfpga/clk.h
Signature · 1 line
1.8.5.1