Skip to contentSkip to conversation

Renesas ARM based r8a7778 SoC updates for v3.11

GIT PULL New Simon Horman 3 participants 14 messages May 27, 2013 – May 30, 2013

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

Hi Arnd, Hi Olof,

The following changes since commit c7788792a5e7b0d5d7f96d0766b4cb6112d47d75:

Linux 3.10-rc2 (2013-05-20 14:37:38 -0700)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git tags/renesas-soc-r8a7778-for-v3.11

for you to fetch changes up to 35019d7f4aba4c4ccece584b872a8ebcdd62e6fa:

ARM: shmobile: r8a7778: correct model name in Kconfig (2013-05-27 18:22:42 +0900)

----------------------------------------------------------------
Renesas ARM based sh7778 SoC updates for v3.11

* Correction of model name in Kconfig by Sergei Shtylyov
* Registration of SDHI and PFC devices by Kuninori Morimoto
* Extended clock coverage by Kuninori Morimoto
* Correction of ethernet device's platform driver name by Sergei Shtylyov

----------------------------------------------------------------
Kuninori Morimoto (7):
ARM: shmobile: use do{ }while() on SH_CLK_SET_RATIO()
ARM: shmobile: add GPIO IRQ macro
ARM: shmobile: r8a7778: fixup Ether setup code position
ARM: shmobile: r8a7778: use fixed ratio clock
ARM: shmobile: r8a7778: Register PFC device
ARM: shmobile: r8a7778: add SDHI clock support
ARM: shmobile: r8a7778: Register SDHI device

Sergei Shtylyov (2):
ARM: shmobile: r8a7778: fix Ether device name
ARM: shmobile: r8a7778: correct model name in Kconfig

 arch/arm/mach-shmobile/Kconfig                |    3 +-
 arch/arm/mach-shmobile/clock-r8a7778.c        |  156 ++++++++++++++++++++++---
 arch/arm/mach-shmobile/include/mach/clock.h   |    4 +-
 arch/arm/mach-shmobile/include/mach/irqs.h    |    5 +
 arch/arm/mach-shmobile/include/mach/r8a7778.h |    3 +
 arch/arm/mach-shmobile/setup-r8a7778.c        |   65 ++++++++---
 6 files changed, 206 insertions(+), 30 deletions(-)
#1 lore raw

PATCH 1/9 ARM: shmobile: use do{ }while() on SH_CLK_SET_RATIO()

From: Kuninori Morimoto <[email protected]>

SH_CLK_SET_RATIO() will be trouble without this patch

---
 arch/arm/mach-shmobile/include/mach/clock.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-shmobile/include/mach/clock.h +2 -2
index 76ac612..ce29720 100644
@@ -31,9 +31,9 @@ static SH_FIXED_RATIO_CLKg(name, p, r);
 	SH_FIXED_RATIO_CLK(name, p, name);
 
 #define SH_CLK_SET_RATIO(p, m, d)	\
-{			\
+do {			\
 	(p)->mul = m;	\
 	(p)->div = d;	\
-}
+} while (0)
 
 #endif
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 2/9 ARM: shmobile: add GPIO IRQ macro

In reply to Simon Horman

From: Kuninori Morimoto <[email protected]>

R-Car series gpio_rcar driver can control GPIO IRQ today. It needs base IRQ number for gpio_rcar_config :: .irq_base This patch adds macro for GPIO IRQ.
This patch was tested on Bock-W board

---
 arch/arm/mach-shmobile/include/mach/irqs.h |    5 +++++
 1 file changed, 5 insertions(+)
arch/arm/mach-shmobile/include/mach/irqs.h +5 -0
index b2074e2..d241bfd 100644
@@ -16,4 +16,9 @@
 #define IRQPIN_BASE		2000
 #define irq_pin(nr)		((nr) + IRQPIN_BASE)
 
+/* GPIO IRQ */
+#define _GPIO_IRQ_BASE		2500
+#define GPIO_IRQ_BASE(x)	(_GPIO_IRQ_BASE + (32 * x))
+#define GPIO_IRQ(x, y)		(_GPIO_IRQ_BASE + (32 * x) + y)
+
 #endif /* __ASM_MACH_IRQS_H */
Signature · 1 line
1.7.10.4
#3 lore raw

PATCH 2/9 ARM: shmobile: add GPIO IRQ macro

Quoted 18 lines · Simon Horman

From: Kuninori Morimoto <[email protected]>

R-Car series gpio_rcar driver can control GPIO IRQ today. It needs base IRQ number for gpio_rcar_config :: .irq_base This patch adds macro for GPIO IRQ.
This patch was tested on Bock-W board

---
 arch/arm/mach-shmobile/include/mach/irqs.h |    5 +++++
 1 file changed, 5 insertions(+)
arch/arm/mach-shmobile/include/mach/irqs.h +0 -0
index b2074e2..d241bfd 100644

arch/arm/mach-shmobile/include/mach/irqs.h line 24

Quoted 9 lines
arch/arm/mach-shmobile/include/mach/irqs.h +5 -0
@@ -16,4 +16,9 @@
 #define IRQPIN_BASE		2000
 #define irq_pin(nr)		((nr) + IRQPIN_BASE)
 
+/* GPIO IRQ */
+#define _GPIO_IRQ_BASE		2500
+#define GPIO_IRQ_BASE(x)	(_GPIO_IRQ_BASE + (32 * x))
+#define GPIO_IRQ(x, y)		(_GPIO_IRQ_BASE + (32 * x) + y)
+
 #endif /* __ASM_MACH_IRQS_H */

Hmm. It'd be real nice to see some effort on moving this over to sparse irq instead. That'll be needed for full device tree conversion anyway. And with that, the static irq bases will be gone, so drivers and some of the platform code will need to be adjusted accordingly.

-Olof

maintainer
#4 lore raw

PATCH 2/9 ARM: shmobile: add GPIO IRQ macro

Hi Olof,

Quoted 22 lines · Olof Johansson
Quoted 21 lines · Simon Horman

From: Kuninori Morimoto <[email protected]>

R-Car series gpio_rcar driver can control GPIO IRQ today. It needs base IRQ number for gpio_rcar_config :: .irq_base This patch adds macro for GPIO IRQ.
This patch was tested on Bock-W board

---
 arch/arm/mach-shmobile/include/mach/irqs.h |    5 +++++
 1 file changed, 5 insertions(+)
arch/arm/mach-shmobile/include/mach/irqs.h +0 -0
index b2074e2..d241bfd 100644
@@ -16,4 +16,9 @@
 #define IRQPIN_BASE          2000
 #define irq_pin(nr)          ((nr) + IRQPIN_BASE)
 
Quoted 11 lines

arch/arm/mach-shmobile/include/mach/irqs.h line 24

Quoted 6 lines
arch/arm/mach-shmobile/include/mach/irqs.h +5 -0
+/* GPIO IRQ */
+#define _GPIO_IRQ_BASE               2500
+#define GPIO_IRQ_BASE(x)     (_GPIO_IRQ_BASE + (32 * x))
+#define GPIO_IRQ(x, y)               (_GPIO_IRQ_BASE + (32 * x) + y)
+
 #endif /* __ASM_MACH_IRQS_H */

Hmm. It'd be real nice to see some effort on moving this over to sparse irq instead. That'll be needed for full device tree conversion anyway. And with that, the static irq bases will be gone, so drivers and some of the platform code will need to be adjusted accordingly.

I believe we've been doing sparse IRQ for ages, this is just to make non-DT stuff more readable.

Or was there some particular other interface you wanted us to use for non-DT board code?

Cheers,

/ magnus

#5 lore raw

PATCH 2/9 ARM: shmobile: add GPIO IRQ macro

Quoted 37 lines · Magnus Damm

Hi Olof,

Quoted 22 lines · Olof Johansson
Quoted 21 lines · Simon Horman

From: Kuninori Morimoto <[email protected]>

R-Car series gpio_rcar driver can control GPIO IRQ today. It needs base IRQ number for gpio_rcar_config :: .irq_base This patch adds macro for GPIO IRQ.
This patch was tested on Bock-W board

---
 arch/arm/mach-shmobile/include/mach/irqs.h |    5 +++++
 1 file changed, 5 insertions(+)
arch/arm/mach-shmobile/include/mach/irqs.h +0 -0
index b2074e2..d241bfd 100644
@@ -16,4 +16,9 @@
 #define IRQPIN_BASE          2000
 #define irq_pin(nr)          ((nr) + IRQPIN_BASE)
 
Quoted 11 lines

arch/arm/mach-shmobile/include/mach/irqs.h line 24

Quoted 6 lines
arch/arm/mach-shmobile/include/mach/irqs.h +5 -0
+/* GPIO IRQ */
+#define _GPIO_IRQ_BASE               2500
+#define GPIO_IRQ_BASE(x)     (_GPIO_IRQ_BASE + (32 * x))
+#define GPIO_IRQ(x, y)               (_GPIO_IRQ_BASE + (32 * x) + y)
+
 #endif /* __ASM_MACH_IRQS_H */

Hmm. It'd be real nice to see some effort on moving this over to sparse irq instead. That'll be needed for full device tree conversion anyway. And with that, the static irq bases will be gone, so drivers and some of the platform code will need to be adjusted accordingly.

Quoted 5 lines

I believe we've been doing sparse IRQ for ages, this is just to make non-DT stuff more readable.

Or was there some particular other interface you wanted us to use for non-DT board code?

Sorry, terminology confusion on my side. Most other platforms sorted this out when they moved to sparse irq, removing most hardcoded interrupt numbers at the same time and handling it through DT. But since shmobile still has a ways to go on DT conversion things are a bit different.

Either way, once things have been converted fully to DT, most of these static numberings can/should be possible to remove.

-Olof

maintainer
#6 lore raw

PATCH 2/9 ARM: shmobile: add GPIO IRQ macro

Hey Olof,

Quoted 44 lines · Olof Johansson
Quoted 37 lines · Magnus Damm

Hi Olof,

Quoted 22 lines · Olof Johansson
Quoted 21 lines · Simon Horman

From: Kuninori Morimoto <[email protected]>

R-Car series gpio_rcar driver can control GPIO IRQ today. It needs base IRQ number for gpio_rcar_config :: .irq_base This patch adds macro for GPIO IRQ.
This patch was tested on Bock-W board

---
 arch/arm/mach-shmobile/include/mach/irqs.h |    5 +++++
 1 file changed, 5 insertions(+)
arch/arm/mach-shmobile/include/mach/irqs.h +0 -0
index b2074e2..d241bfd 100644
@@ -16,4 +16,9 @@
 #define IRQPIN_BASE          2000
 #define irq_pin(nr)          ((nr) + IRQPIN_BASE)
 
Quoted 11 lines

arch/arm/mach-shmobile/include/mach/irqs.h line 24

Quoted 6 lines
arch/arm/mach-shmobile/include/mach/irqs.h +5 -0
+/* GPIO IRQ */
+#define _GPIO_IRQ_BASE               2500
+#define GPIO_IRQ_BASE(x)     (_GPIO_IRQ_BASE + (32 * x))
+#define GPIO_IRQ(x, y)               (_GPIO_IRQ_BASE + (32 * x) + y)
+
 #endif /* __ASM_MACH_IRQS_H */

Hmm. It'd be real nice to see some effort on moving this over to sparse irq instead. That'll be needed for full device tree conversion anyway. And with that, the static irq bases will be gone, so drivers and some of the platform code will need to be adjusted accordingly.

Quoted 5 lines

I believe we've been doing sparse IRQ for ages, this is just to make non-DT stuff more readable.

Or was there some particular other interface you wanted us to use for non-DT board code?

Quoted 7 lines

Sorry, terminology confusion on my side. Most other platforms sorted this out when they moved to sparse irq, removing most hardcoded interrupt numbers at the same time and handling it through DT. But since shmobile still has a ways to go on DT conversion things are a bit different.

Either way, once things have been converted fully to DT, most of these static numberings can/should be possible to remove.

Yes, exactly! Please note that the current drivers are written to be DT aware and the IRQ code makes use of IRQ domains, so like you say the DT -reference board code does not need to make use of these kind of macros.

However, we are still not able to swith to DT fully due to lack of DT support for PINMUX/GPIO. One even larger road block is the common clock framework. And then we have the I/O power domains used with Runtime PM on sh7372.

Thanks for your help,

/ magnus

#7 lore raw

PATCH 3/9 ARM: shmobile: r8a7778: fixup Ether setup code position

In reply to Simon Horman

From: Kuninori Morimoto <[email protected]>

Ether setup code position was scattering.
This patch fixes it up

---
 arch/arm/mach-shmobile/setup-r8a7778.c |   28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
arch/arm/mach-shmobile/setup-r8a7778.c +14 -14
index 30b4a33..d6ee521 100644
@@ -80,12 +80,6 @@ static struct sh_timer_config sh_tmu1_platform_data = {
 	.clocksource_rating	= 200,
 };
 
-/* Ether */
-static struct resource ether_resources[] = {
-	DEFINE_RES_MEM(0xfde00000, 0x400),
-	DEFINE_RES_IRQ(gic_iid(0x89)),
-};
-
 #define r8a7778_register_tmu(idx)			\
 	platform_device_register_resndata(		\
 		&platform_bus, "sh_tmu", idx,		\
@@ -94,6 +88,20 @@ static struct resource ether_resources[] = {
 		&sh_tmu##idx##_platform_data,		\
 		sizeof(sh_tmu##idx##_platform_data))
 
+/* Ether */
+static struct resource ether_resources[] = {
+	DEFINE_RES_MEM(0xfde00000, 0x400),
+	DEFINE_RES_IRQ(gic_iid(0x89)),
+};
+
+void __init r8a7778_add_ether_device(struct sh_eth_plat_data *pdata)
+{
+	platform_device_register_resndata(&platform_bus, "sh_eth", -1,
+					  ether_resources,
+					  ARRAY_SIZE(ether_resources),
+					  pdata, sizeof(*pdata));
+}
+
 void __init r8a7778_add_standard_devices(void)
 {
 	int i;
@@ -118,14 +126,6 @@ void __init r8a7778_add_standard_devices(void)
 	r8a7778_register_tmu(1);
 }
 
-void __init r8a7778_add_ether_device(struct sh_eth_plat_data *pdata)
-{
-	platform_device_register_resndata(&platform_bus, "sh_eth", -1,
-					  ether_resources,
-					  ARRAY_SIZE(ether_resources),
-					  pdata, sizeof(*pdata));
-}
-
 static struct renesas_intc_irqpin_config irqpin_platform_data = {
 	.irq_base = irq_pin(0), /* IRQ0 -> IRQ3 */
 	.sense_bitfield_width = 2,
Signature · 1 line
1.7.10.4
#8 lore raw

PATCH 4/9 ARM: shmobile: r8a7778: fix Ether device name

In reply to Simon Horman

From: Sergei Shtylyov <[email protected]>

While recasting the commit "ARM: shmobile: R8A7778: add Ether support", I made a typo in the platform device's name: used underscore instead of hyphen.

---
 arch/arm/mach-shmobile/setup-r8a7778.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-shmobile/setup-r8a7778.c +1 -1
index d6ee521..45f0e45 100644
@@ -96,7 +96,7 @@ static struct resource ether_resources[] = {
 
 void __init r8a7778_add_ether_device(struct sh_eth_plat_data *pdata)
 {
-	platform_device_register_resndata(&platform_bus, "sh_eth", -1,
+	platform_device_register_resndata(&platform_bus, "sh-eth", -1,
 					  ether_resources,
 					  ARRAY_SIZE(ether_resources),
 					  pdata, sizeof(*pdata));
Signature · 1 line
1.7.10.4
#9 lore raw

PATCH 5/9 ARM: shmobile: r8a7778: use fixed ratio clock

In reply to Simon Horman

From: Kuninori Morimoto <[email protected]>

R-Car M1 has many clocks, and it is possible to
read/use clock ratio of these clocks from FRQMRx.
But, these ratio are fixed value and
these are decided by MD pin status.

This patch reads MD pin status,
and used fixed ratio clock for other clocks.
It was tesed on bock-w board.

---
 arch/arm/mach-shmobile/clock-r8a7778.c |  149 +++++++++++++++++++++++++++++---
 1 file changed, 136 insertions(+), 13 deletions(-)
arch/arm/mach-shmobile/clock-r8a7778.c +136 -13
index cd68552..5cc271e 100644
@@ -23,9 +23,23 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+/*
+ *     MD      MD      MD      MD       PLLA   PLLB    EXTAL   clki    clkz
+ *     19      18      12      11                      (HMz)   (MHz)   (MHz)
+ *----------------------------------------------------------------------------
+ *     1       0       0       0       x21     x21     38.00   800     800
+ *     1       0       0       1       x24     x24     33.33   800     800
+ *     1       0       1       0       x28     x28     28.50   800     800
+ *     1       0       1       1       x32     x32     25.00   800     800
+ *     1       1       0       1       x24     x21     33.33   800     700
+ *     1       1       1       0       x28     x21     28.50   800     600
+ *     1       1       1       1       x32     x24     25.00   800     600
+ */
+
 #include <linux/io.h>
 #include <linux/sh_clk.h>
 #include <linux/clkdev.h>
+#include <mach/clock.h>
 #include <mach/common.h>
 
 #define MSTPCR0		IOMEM(0xffc80030)
@@ -37,6 +51,9 @@
 #define MSTPCR4		IOMEM(0xffc80050)
 #define MSTPCR5		IOMEM(0xffc80054)
 #define MSTPCR6		IOMEM(0xffc80058)
+#define MODEMR		0xFFCC0020
+
+#define MD(nr)	BIT(nr)
 
 /* ioremap() through clock mapping mandatory to avoid
  * collision with ARM coherent DMA virtual memory range.
@@ -47,14 +64,42 @@ static struct clk_mapping cpg_mapping = {
 	.len	= 0x80,
 };
 
-static struct clk clkp = {
-	.rate   = 62500000, /* FIXME: shortcut */
-	.flags  = CLK_ENABLE_ON_INIT,
+static struct clk extal_clk = {
+	/* .rate will be updated on r8a7778_clock_init() */
 	.mapping = &cpg_mapping,
 };
 
+/*
+ * clock ratio of these clock will be updated
+ * on r8a7778_clock_init()
+ */
+SH_FIXED_RATIO_CLK_SET(plla_clk,	extal_clk, 1, 1);
+SH_FIXED_RATIO_CLK_SET(pllb_clk,	extal_clk, 1, 1);
+SH_FIXED_RATIO_CLK_SET(i_clk,		plla_clk,  1, 1);
+SH_FIXED_RATIO_CLK_SET(s_clk,		plla_clk,  1, 1);
+SH_FIXED_RATIO_CLK_SET(s1_clk,		plla_clk,  1, 1);
+SH_FIXED_RATIO_CLK_SET(s3_clk,		plla_clk,  1, 1);
+SH_FIXED_RATIO_CLK_SET(s4_clk,		plla_clk,  1, 1);
+SH_FIXED_RATIO_CLK_SET(b_clk,		plla_clk,  1, 1);
+SH_FIXED_RATIO_CLK_SET(out_clk,		plla_clk,  1, 1);
+SH_FIXED_RATIO_CLK_SET(p_clk,		plla_clk,  1, 1);
+SH_FIXED_RATIO_CLK_SET(g_clk,		plla_clk,  1, 1);
+SH_FIXED_RATIO_CLK_SET(z_clk,		pllb_clk,  1, 1);
+
 static struct clk *main_clks[] = {
-	&clkp,
+	&extal_clk,
+	&plla_clk,
+	&pllb_clk,
+	&i_clk,
+	&s_clk,
+	&s1_clk,
+	&s3_clk,
+	&s4_clk,
+	&b_clk,
+	&out_clk,
+	&p_clk,
+	&g_clk,
+	&z_clk,
 };
 
 enum {
@@ -64,15 +109,15 @@ enum {
 	MSTP_NR };
 
 static struct clk mstp_clks[MSTP_NR] = {
-	[MSTP114] = SH_CLK_MSTP32(&clkp, MSTPCR1, 14, 0), /* Ether */
-	[MSTP026] = SH_CLK_MSTP32(&clkp, MSTPCR0, 26, 0), /* SCIF0 */
-	[MSTP025] = SH_CLK_MSTP32(&clkp, MSTPCR0, 25, 0), /* SCIF1 */
-	[MSTP024] = SH_CLK_MSTP32(&clkp, MSTPCR0, 24, 0), /* SCIF2 */
-	[MSTP023] = SH_CLK_MSTP32(&clkp, MSTPCR0, 23, 0), /* SCIF3 */
-	[MSTP022] = SH_CLK_MSTP32(&clkp, MSTPCR0, 22, 0), /* SCIF4 */
-	[MSTP021] = SH_CLK_MSTP32(&clkp, MSTPCR0, 21, 0), /* SCIF5 */
-	[MSTP016] = SH_CLK_MSTP32(&clkp, MSTPCR0, 16, 0), /* TMU0 */
-	[MSTP015] = SH_CLK_MSTP32(&clkp, MSTPCR0, 15, 0), /* TMU1 */
+	[MSTP114] = SH_CLK_MSTP32(&p_clk, MSTPCR1, 14, 0), /* Ether */
+	[MSTP026] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 26, 0), /* SCIF0 */
+	[MSTP025] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 25, 0), /* SCIF1 */
+	[MSTP024] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 24, 0), /* SCIF2 */
+	[MSTP023] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 23, 0), /* SCIF3 */
+	[MSTP022] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 22, 0), /* SCIF4 */
+	[MSTP021] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 21, 0), /* SCIF5 */
+	[MSTP016] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 16, 0), /* TMU0 */
+	[MSTP015] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 15, 0), /* TMU1 */
 };
 
 static struct clk_lookup lookups[] = {
@@ -90,8 +135,86 @@ static struct clk_lookup lookups[] = {
 
 void __init r8a7778_clock_init(void)
 {
+	void __iomem *modemr = ioremap_nocache(MODEMR, PAGE_SIZE);
+	u32 mode;
 	int k, ret = 0;
 
+	BUG_ON(!modemr);
+	mode = ioread32(modemr);
+	iounmap(modemr);
+
+	switch (mode & (MD(19) | MD(18) | MD(12) | MD(11))) {
+	case MD(19):
+		extal_clk.rate = 38000000;
+		SH_CLK_SET_RATIO(&plla_clk_ratio,	21, 1);
+		SH_CLK_SET_RATIO(&pllb_clk_ratio,	21, 1);
+		break;
+	case MD(19) | MD(11):
+		extal_clk.rate = 33333333;
+		SH_CLK_SET_RATIO(&plla_clk_ratio,	24, 1);
+		SH_CLK_SET_RATIO(&pllb_clk_ratio,	24, 1);
+		break;
+	case MD(19) | MD(12):
+		extal_clk.rate = 28500000;
+		SH_CLK_SET_RATIO(&plla_clk_ratio,	28, 1);
+		SH_CLK_SET_RATIO(&pllb_clk_ratio,	28, 1);
+		break;
+	case MD(19) | MD(12) | MD(11):
+		extal_clk.rate = 25000000;
+		SH_CLK_SET_RATIO(&plla_clk_ratio,	32, 1);
+		SH_CLK_SET_RATIO(&pllb_clk_ratio,	32, 1);
+		break;
+	case MD(19) | MD(18) | MD(11):
+		extal_clk.rate = 33333333;
+		SH_CLK_SET_RATIO(&plla_clk_ratio,	24, 1);
+		SH_CLK_SET_RATIO(&pllb_clk_ratio,	21, 1);
+		break;
+	case MD(19) | MD(18) | MD(12):
+		extal_clk.rate = 28500000;
+		SH_CLK_SET_RATIO(&plla_clk_ratio,	28, 1);
+		SH_CLK_SET_RATIO(&pllb_clk_ratio,	21, 1);
+		break;
+	case MD(19) | MD(18) | MD(12) | MD(11):
+		extal_clk.rate = 25000000;
+		SH_CLK_SET_RATIO(&plla_clk_ratio,	32, 1);
+		SH_CLK_SET_RATIO(&pllb_clk_ratio,	24, 1);
+		break;
+	default:
+		BUG();
+	}
+
+	if (mode & MD(1)) {
+		SH_CLK_SET_RATIO(&i_clk_ratio,	1, 1);
+		SH_CLK_SET_RATIO(&s_clk_ratio,	1, 3);
+		SH_CLK_SET_RATIO(&s1_clk_ratio,	1, 6);
+		SH_CLK_SET_RATIO(&s3_clk_ratio,	1, 4);
+		SH_CLK_SET_RATIO(&s4_clk_ratio,	1, 8);
+		SH_CLK_SET_RATIO(&p_clk_ratio,	1, 12);
+		SH_CLK_SET_RATIO(&g_clk_ratio,	1, 12);
+		if (mode & MD(2)) {
+			SH_CLK_SET_RATIO(&b_clk_ratio,		1, 18);
+			SH_CLK_SET_RATIO(&out_clk_ratio,	1, 18);
+		} else {
+			SH_CLK_SET_RATIO(&b_clk_ratio,		1, 12);
+			SH_CLK_SET_RATIO(&out_clk_ratio,	1, 12);
+		}
+	} else {
+		SH_CLK_SET_RATIO(&i_clk_ratio,	1, 1);
+		SH_CLK_SET_RATIO(&s_clk_ratio,	1, 4);
+		SH_CLK_SET_RATIO(&s1_clk_ratio,	1, 8);
+		SH_CLK_SET_RATIO(&s3_clk_ratio,	1, 4);
+		SH_CLK_SET_RATIO(&s4_clk_ratio,	1, 8);
+		SH_CLK_SET_RATIO(&p_clk_ratio,	1, 16);
+		SH_CLK_SET_RATIO(&g_clk_ratio,	1, 12);
+		if (mode & MD(2)) {
+			SH_CLK_SET_RATIO(&b_clk_ratio,		1, 16);
+			SH_CLK_SET_RATIO(&out_clk_ratio,	1, 16);
+		} else {
+			SH_CLK_SET_RATIO(&b_clk_ratio,		1, 12);
+			SH_CLK_SET_RATIO(&out_clk_ratio,	1, 12);
+		}
+	}
+
 	for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
 		ret = clk_register(main_clks[k]);
 
Signature · 1 line
1.7.10.4
#10 lore raw

PATCH 6/9 ARM: shmobile: r8a7778: Register PFC device

In reply to Simon Horman

From: Kuninori Morimoto <[email protected]>

---
 arch/arm/mach-shmobile/Kconfig                |    1 +
 arch/arm/mach-shmobile/include/mach/r8a7778.h |    1 +
 arch/arm/mach-shmobile/setup-r8a7778.c        |   13 +++++++++++++
 3 files changed, 15 insertions(+)
arch/arm/mach-shmobile/Kconfig +1 -0
index 1a517e2..06da4d3 100644
@@ -37,6 +37,7 @@ config ARCH_R8A7740
 
 config ARCH_R8A7778
 	bool "R-Car M1 (R8A77780)"
+	select ARCH_WANT_OPTIONAL_GPIOLIB
 	select CPU_V7
 	select SH_CLK_CPG
 	select ARM_GIC
arch/arm/mach-shmobile/include/mach/r8a7778.h +1 -0
index 951149e..68053fc 100644
@@ -28,5 +28,6 @@ extern void r8a7778_init_irq(void);
 extern void r8a7778_init_irq_dt(void);
 extern void r8a7778_clock_init(void);
 extern void r8a7778_init_irq_extpin(int irlm);
+extern void r8a7778_pinmux_init(void);
 
 #endif /* __ASM_R8A7778_H__ */
arch/arm/mach-shmobile/setup-r8a7778.c +13 -0
index 45f0e45..d82954b 100644
@@ -102,6 +102,19 @@ void __init r8a7778_add_ether_device(struct sh_eth_plat_data *pdata)
 					  pdata, sizeof(*pdata));
 }
 
+/* PFC */
+static struct resource pfc_resources[] = {
+	DEFINE_RES_MEM(0xfffc0000, 0x118),
+};
+
+void __init r8a7778_pinmux_init(void)
+{
+	platform_device_register_simple(
+		"pfc-r8a7778", -1,
+		pfc_resources,
+		ARRAY_SIZE(pfc_resources));
+}
+
 void __init r8a7778_add_standard_devices(void)
 {
 	int i;
Signature · 1 line
1.7.10.4
#11 lore raw

PATCH 7/9 ARM: shmobile: r8a7778: add SDHI clock support

In reply to Simon Horman

From: Kuninori Morimoto <[email protected]>

---
 arch/arm/mach-shmobile/clock-r8a7778.c |    7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/mach-shmobile/clock-r8a7778.c +7 -0
index 5cc271e..b251e4d 100644
@@ -103,12 +103,16 @@ static struct clk *main_clks[] = {
 };
 
 enum {
+	MSTP323, MSTP322, MSTP321,
 	MSTP114,
 	MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021,
 	MSTP016, MSTP015,
 	MSTP_NR };
 
 static struct clk mstp_clks[MSTP_NR] = {
+	[MSTP323] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 23, 0), /* SDHI0 */
+	[MSTP322] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 22, 0), /* SDHI1 */
+	[MSTP321] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 21, 0), /* SDHI2 */
 	[MSTP114] = SH_CLK_MSTP32(&p_clk, MSTPCR1, 14, 0), /* Ether */
 	[MSTP026] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 26, 0), /* SCIF0 */
 	[MSTP025] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 25, 0), /* SCIF1 */
@@ -122,6 +126,9 @@ static struct clk mstp_clks[MSTP_NR] = {
 
 static struct clk_lookup lookups[] = {
 	/* MSTP32 clocks */
+	CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP323]), /* SDHI0 */
+	CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP322]), /* SDHI1 */
+	CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP321]), /* SDHI2 */
 	CLKDEV_DEV_ID("sh-eth",	&mstp_clks[MSTP114]), /* Ether */
 	CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP026]), /* SCIF0 */
 	CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP025]), /* SCIF1 */
Signature · 1 line
1.7.10.4
#12 lore raw

PATCH 8/9 ARM: shmobile: r8a7778: Register SDHI device

In reply to Simon Horman

From: Kuninori Morimoto <[email protected]>

This patch adds SDHI register function which needs id number (= 0/1/2)

---
 arch/arm/mach-shmobile/include/mach/r8a7778.h |    2 ++
 arch/arm/mach-shmobile/setup-r8a7778.c        |   24 ++++++++++++++++++++++++
 2 files changed, 26 insertions(+)
arch/arm/mach-shmobile/include/mach/r8a7778.h +2 -0
index 68053fc..ae65b45 100644
@@ -18,6 +18,7 @@
 #ifndef __ASM_R8A7778_H__
 #define __ASM_R8A7778_H__
 
+#include <linux/mmc/sh_mobile_sdhi.h>
 #include <linux/sh_eth.h>
 
 extern void r8a7778_add_standard_devices(void);
@@ -29,5 +30,6 @@ extern void r8a7778_init_irq_dt(void);
 extern void r8a7778_clock_init(void);
 extern void r8a7778_init_irq_extpin(int irlm);
 extern void r8a7778_pinmux_init(void);
+extern void r8a7778_sdhi_init(int id, struct sh_mobile_sdhi_info *info);
 
 #endif /* __ASM_R8A7778_H__ */
arch/arm/mach-shmobile/setup-r8a7778.c +24 -0
index d82954b..4c32784 100644
@@ -115,6 +115,30 @@ void __init r8a7778_pinmux_init(void)
 		ARRAY_SIZE(pfc_resources));
 }
 
+/* SDHI */
+static struct resource sdhi_resources[] = {
+	/* SDHI0 */
+	DEFINE_RES_MEM(0xFFE4C000, 0x100),
+	DEFINE_RES_IRQ(gic_iid(0x77)),
+	/* SDHI1 */
+	DEFINE_RES_MEM(0xFFE4D000, 0x100),
+	DEFINE_RES_IRQ(gic_iid(0x78)),
+	/* SDHI2 */
+	DEFINE_RES_MEM(0xFFE4F000, 0x100),
+	DEFINE_RES_IRQ(gic_iid(0x76)),
+};
+
+void __init r8a7778_sdhi_init(int id,
+			      struct sh_mobile_sdhi_info *info)
+{
+	BUG_ON(id < 0 || id > 2);
+
+	platform_device_register_resndata(
+		&platform_bus, "sh_mobile_sdhi", id,
+		sdhi_resources + (2 * id), 2,
+		info, sizeof(*info));
+}
+
 void __init r8a7778_add_standard_devices(void)
 {
 	int i;
Signature · 1 line
1.7.10.4
#13 lore raw

PATCH 9/9 ARM: shmobile: r8a7778: correct model name in Kconfig

In reply to Simon Horman

From: Sergei Shtylyov <[email protected]>

The correct model name is R-Car M1A or R8A77781; R8A77780 corresponds to R-Car M1S which is a SH based SoC.

[horms+renesas at verge.net.au: manually applied to soc-r8a7778 branch]
---
 arch/arm/mach-shmobile/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-shmobile/Kconfig +1 -1
index 06da4d3..58eb689 100644
@@ -36,7 +36,7 @@ config ARCH_R8A7740
 	select RENESAS_INTC_IRQPIN
 
 config ARCH_R8A7778
-	bool "R-Car M1 (R8A77780)"
+	bool "R-Car M1A (R8A77781)"
 	select ARCH_WANT_OPTIONAL_GPIOLIB
 	select CPU_V7
 	select SH_CLK_CPG
Signature · 1 line
1.7.10.4