Skip to contentSkip to conversation

ARM: shmobile: add function declarations for sh7372 DT helper functions

PATCH New Guennadi Liakhovetski 4 participants 7 messages Dec 31, 2012 – Feb 12, 2015

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

PATCH 1/2 ARM: shmobile: add function declarations for sh7372 DT helper functions

sh7372_add_early_devices_dt() and sh7372_add_standard_devices_dt() are defined as global functions in arch/arm/mach-shmobile/setup-sh7372.c, but their declarations are missing. Add them to common.h, where similar functions for this and other SoC types are already declared.

---
 arch/arm/mach-shmobile/include/mach/common.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/mach-shmobile/include/mach/common.h +2 -0
index 7e08fa5..abce184 100644
@@ -23,6 +23,8 @@ extern void sh7372_init_irq(void);
 extern void sh7372_map_io(void);
 extern void sh7372_add_early_devices(void);
 extern void sh7372_add_standard_devices(void);
+extern void sh7372_add_early_devices_dt(void);
+extern void sh7372_add_standard_devices_dt(void);
 extern void sh7372_clock_init(void);
 extern void sh7372_pinmux_init(void);
 extern void sh7372_pm_init(void);
Signature · 1 line
1.7.2.5
#1 lore raw

PATCH 2/2 ARM: shmobile: add a reference DT implementation for mackerel

Add a DT-only mackerel implementation. So far it only contains a limited set of devices, already implementing DT support. As more drivers are extended with DT initialisation option, respective devices shall be added to sh7372-mackerel-reference.dts.

---

Some notes:

1. since INTCS isn't currently supported, no peripherals, whose interrupts are routed to it, can be used, e.g. I2C0, TMU.

2. MMCIF and SDHI device nodes in .dts lack card-detect and write-protect GPIOs because of missing pinctrl support on sh7372.

3. on mackerel MMCIF and SDHI1 share one slot. A micro-switch is used to switch between the two interfaces and a jumper can be used to switch between 1.8 and 3.3V. This patch enables both interfaces simultaneously and sets voltage on both of them to 1.8V. If desired, this can be changed to specify 3.3V on the SDHI1 device and expect the used to switch the jumper.

4. patches are based on a recent (of 28.12) Linus' tree + shmobile patches from

http://git.kernel.org/?p=linux/kernel/git/horms/renesas.git;a=shortlog;h=refs/heads/devel/intc-of

plus my earlier patch to add DT-specific clock lookup entries to clock-sh7372.c, currently in -next:

http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git;a=commit;h=d5ffbe1dfdb7963d29cfbfa0f2d0e4becba32d5b

 arch/arm/boot/dts/Makefile                        |    3 +-
 arch/arm/boot/dts/sh7372-mackerel-reference.dts   |  131 +++++++++++++++++++++
 arch/arm/mach-shmobile/Kconfig                    |    8 ++
 arch/arm/mach-shmobile/Makefile                   |    1 +
 arch/arm/mach-shmobile/board-mackerel-reference.c |  122 +++++++++++++++++++
 5 files changed, 264 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/boot/dts/sh7372-mackerel-reference.dts
 create mode 100644 arch/arm/mach-shmobile/board-mackerel-reference.c
arch/arm/boot/dts/Makefile +2 -1
index e44da40..7fb4696 100644
@@ -123,7 +123,8 @@ dtb-$(CONFIG_ARCH_U8500) += snowball.dtb \
 dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \
 	r8a7740-armadillo800eva.dtb \
 	sh73a0-kzm9g.dtb \
-	sh7372-mackerel.dtb
+	sh7372-mackerel.dtb \
+	sh7372-mackerel-reference.dtb
 dtb-$(CONFIG_ARCH_SPEAR13XX) += spear1310-evb.dtb \
 	spear1340-evb.dtb
 dtb-$(CONFIG_ARCH_SPEAR3XX)+= spear300-evb.dtb \
arch/arm/boot/dts/sh7372-mackerel-reference.dts new file +131 -0

131 lines not on this page · raw message

arch/arm/mach-shmobile/Kconfig +8 -0
index 9255546..c25784b 100644
@@ -76,6 +76,14 @@ config MACH_MACKEREL
 	select SND_SOC_AK4642 if SND_SIMPLE_CARD
 	select USE_OF
 
+config MACH_MACKEREL_REFERENCE
+	bool "mackerel board - Reference Device Tree Implementation"
+	depends on ARCH_SH7372
+	select ARCH_REQUIRE_GPIOLIB
+	select REGULATOR_FIXED_VOLTAGE if REGULATOR
+	select SND_SOC_AK4642 if SND_SIMPLE_CARD
+	select USE_OF
+
 config MACH_KOTA2
 	bool "KOTA2 board"
 	depends on ARCH_SH73A0
arch/arm/mach-shmobile/Makefile +1 -0
index 0b71479..8035165 100644
@@ -42,6 +42,7 @@ obj-$(CONFIG_ARCH_R8A7779)	+= pm-r8a7779.o
 obj-$(CONFIG_MACH_AP4EVB)	+= board-ap4evb.o
 obj-$(CONFIG_MACH_AG5EVM)	+= board-ag5evm.o
 obj-$(CONFIG_MACH_MACKEREL)	+= board-mackerel.o
+obj-$(CONFIG_MACH_MACKEREL_REFERENCE)	+= board-mackerel-reference.o
 obj-$(CONFIG_MACH_KOTA2)	+= board-kota2.o
 obj-$(CONFIG_MACH_BONITO)	+= board-bonito.o
 obj-$(CONFIG_MACH_MARZEN)	+= board-marzen.o
arch/arm/mach-shmobile/board-mackerel-reference.c new file +122 -0

122 lines not on this page · raw message

Signature · 1 line
1.7.2.5
#2 lore raw

PATCH 2/2 ARM: shmobile: add a reference DT implementation for mackerel

Quoted 6 lines · Guennadi Liakhovetski

Add a DT-only mackerel implementation. So far it only contains a limited set of devices, already implementing DT support. As more drivers are extended with DT initialisation option, respective devices shall be added to sh7372-mackerel-reference.dts.

Hi Guennadi,

thanks. This looks good to me.
I will apply it once I have applied the INTC and pinmux changes.

Applied
#3 lore raw

PATCH 1/2 ARM: shmobile: add function declarations for sh7372 DT helper functions

In reply to Guennadi Liakhovetski
Quoted 4 lines · Guennadi Liakhovetski

sh7372_add_early_devices_dt() and sh7372_add_standard_devices_dt() are defined as global functions in arch/arm/mach-shmobile/setup-sh7372.c, but their declarations are missing. Add them to common.h, where similar functions for this and other SoC types are already declared.

Thanks, applied to the soc branch.

#4 lore raw

PATCH 1/2 ARM: shmobile: Add function to get SoCs revision data for R-Car Gen2

SoCs of R-Car Gen2 have some revision. This adds function to get SoCs revision data, and change so that user can confirm from /proc/cpuinfo.

---
 arch/arm/mach-shmobile/rcar-gen2.h       |  1 +
 arch/arm/mach-shmobile/setup-r8a7790.c   |  1 +
 arch/arm/mach-shmobile/setup-r8a7791.c   |  1 +
 arch/arm/mach-shmobile/setup-r8a7794.c   |  1 +
 arch/arm/mach-shmobile/setup-rcar-gen2.c | 21 +++++++++++++++++++++
 5 files changed, 25 insertions(+)
arch/arm/mach-shmobile/rcar-gen2.h +1 -0
index ce53cb5..b232956 100644
@@ -5,5 +5,6 @@ void rcar_gen2_timer_init(void);
 #define MD(nr) BIT(nr)
 u32 rcar_gen2_read_mode_pins(void);
 void rcar_gen2_reserve(void);
+void __init rcar_gen2_init_machine(void);
 
 #endif /* __ASM_RCAR_GEN2_H__ */
arch/arm/mach-shmobile/setup-r8a7790.c +1 -0
index 3a18af4..8d26ab0 100644
@@ -30,6 +30,7 @@ static const char * const r8a7790_boards_compat_dt[] __initconst = {
 DT_MACHINE_START(R8A7790_DT, "Generic R8A7790 (Flattened Device Tree)")
 	.smp		= smp_ops(r8a7790_smp_ops),
 	.init_early	= shmobile_init_delay,
+	.init_machine	= rcar_gen2_init_machine,
 	.init_time	= rcar_gen2_timer_init,
 	.init_late	= shmobile_init_late,
 	.reserve	= rcar_gen2_reserve,
arch/arm/mach-shmobile/setup-r8a7791.c +1 -0
index ef8eb3a..c528b0f 100644
@@ -33,6 +33,7 @@ DT_MACHINE_START(R8A7791_DT, "Generic R8A7791 (Flattened Device Tree)")
 	.init_early	= shmobile_init_delay,
 	.init_time	= rcar_gen2_timer_init,
 	.init_late	= shmobile_init_late,
+	.init_machine   = rcar_gen2_init_machine,
 	.reserve	= rcar_gen2_reserve,
 	.dt_compat	= r8a7791_boards_compat_dt,
 MACHINE_END
arch/arm/mach-shmobile/setup-r8a7794.c +1 -0
index d2b0930..eb86656 100644
@@ -27,6 +27,7 @@ static const char * const r8a7794_boards_compat_dt[] __initconst = {
 DT_MACHINE_START(R8A7794_DT, "Generic R8A7794 (Flattened Device Tree)")
 	.init_early	= shmobile_init_delay,
 	.init_late	= shmobile_init_late,
+	.init_machine	= rcar_gen2_init_machine,
 	.init_time	= rcar_gen2_timer_init,
 	.reserve	= rcar_gen2_reserve,
 	.dt_compat	= r8a7794_boards_compat_dt,
arch/arm/mach-shmobile/setup-rcar-gen2.c +21 -0
index aa33392..2230948 100644
@@ -4,6 +4,7 @@
  * Copyright (C) 2013  Renesas Solutions Corp.
  * Copyright (C) 2013  Magnus Damm
  * Copyright (C) 2014  Ulrich Hecht
+ * Copyright (C) 2015  Nobuhiro Iwamatsu
  *
  * 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
@@ -24,6 +25,8 @@
 #include <linux/memblock.h>
 #include <linux/of.h>
 #include <linux/of_fdt.h>
+#include <linux/of_platform.h>
+#include <asm/system_info.h>
 #include <asm/mach/arch.h>
 #include "common.h"
 #include "rcar-gen2.h"
@@ -199,3 +202,21 @@ void __init rcar_gen2_reserve(void)
 					    &rcar_gen2_dma_contiguous, true);
 #endif
 }
+
+#define PRR 0xFF000044
+static unsigned int __init rcar_gen2_get_revision(void)
+{
+	void __iomem *addr = ioremap_nocache(PRR, 4);
+	u32 data = ioread32(addr);
+
+	iounmap(addr);
+
+	return ((data & 0xF0) >> 4) + 1;
+}
+
+void __init rcar_gen2_init_machine(void)
+{
+	system_rev = rcar_gen2_get_revision();
+
+	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+}
Signature · 1 line
2.1.3
#5 lore raw

Re: [PATCH 1/2] ARM: shmobile: Add function to get SoCs revision data for R-Car Gen2

In reply to Simon Horman

Hi Iwamatsu-san,

Quoted 2 lines · Nobuhiro Iwamatsu

SoCs of R-Car Gen2 have some revision. This adds function to get SoCs revision data, and change so that user can confirm from /proc/cpuinfo.

Thanks for your patch.

arch/arm/mach-shmobile/setup-rcar-gen2.c

Quoted 12 lines
arch/arm/mach-shmobile/setup-rcar-gen2.c +9 -0
 
+#define PRR 0xFF000044
+static unsigned int __init rcar_gen2_get_revision(void)
+{
+       void __iomem *addr = ioremap_nocache(PRR, 4);
+       u32 data = ioread32(addr);
+
+       iounmap(addr);
+
+       return ((data & 0xF0) >> 4) + 1;

Is there any specific reason why you're not returning the fractional part (lowest 4 bits) of the ESx.y revision number?
I.e. why not return "(data & 0xf0) + 0x10"?

Quoted 1 line

+}

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#6 lore raw

Re: [PATCH 1/2] ARM: shmobile: Add function to get SoCs revision data for R-Car Gen2

In reply to Simon Horman

Hi,

Thanks for your review.

Quoted 12 lines · Geert Uytterhoeven

Hi Iwamatsu-san,

Quoted 2 lines · Nobuhiro Iwamatsu

SoCs of R-Car Gen2 have some revision. This adds function to get SoCs revision data, and change so that user can confirm from /proc/cpuinfo.

Thanks for your patch.

Quoted 2 lines
arch/arm/mach-shmobile/setup-rcar-gen2.c +0 -0
Quoted 15 lines

arch/arm/mach-shmobile/setup-rcar-gen2.c

Quoted 9 lines
arch/arm/mach-shmobile/setup-rcar-gen2.c +9 -0
+#define PRR 0xFF000044
+static unsigned int __init rcar_gen2_get_revision(void)
+{
+       void __iomem *addr = ioremap_nocache(PRR, 4);
+       u32 data = ioread32(addr);
+
+       iounmap(addr);
+
+       return ((data&  0xF0)>>  4) + 1;

Is there any specific reason why you're not returning the fractional part (lowest 4 bits) of the ESx.y revision number?
I.e. why not return "(data& 0xf0) + 0x10"?

Quoted 1 line

+}

Because this version notation accommodate to the U-Boot. However, if the notation that does not shift is preferred, I will change it.

I will update this patch.

Quoted 5 lines

Gr{oetje,eeting}s,

Geert

Best regards,
Nobuhiro