* [PATCH 1/2] ARM: shmobile: add function declarations for sh7372 DT helper functions
@ 2012-12-31 11:23 Guennadi Liakhovetski
2012-12-31 11:23 ` [PATCH 2/2] ARM: shmobile: add a reference DT implementation for mackerel Guennadi Liakhovetski
2013-01-07 2:31 ` [PATCH 1/2] ARM: shmobile: add function declarations for sh7372 DT helper functions Simon Horman
0 siblings, 2 replies; 7+ messages in thread
From: Guennadi Liakhovetski @ 2012-12-31 11:23 UTC (permalink / raw)
To: linux-arm-kernel
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.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
arch/arm/mach-shmobile/include/mach/common.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index 7e08fa5..abce184 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -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);
--
1.7.2.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] ARM: shmobile: add a reference DT implementation for mackerel
2012-12-31 11:23 [PATCH 1/2] ARM: shmobile: add function declarations for sh7372 DT helper functions Guennadi Liakhovetski
@ 2012-12-31 11:23 ` Guennadi Liakhovetski
2013-01-09 1:51 ` Simon Horman
2013-01-07 2:31 ` [PATCH 1/2] ARM: shmobile: add function declarations for sh7372 DT helper functions Simon Horman
1 sibling, 1 reply; 7+ messages in thread
From: Guennadi Liakhovetski @ 2012-12-31 11:23 UTC (permalink / raw)
To: linux-arm-kernel
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.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
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Õffbe1dfdb7963d29cfbfa0f2d0e4becba32d5b
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
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index e44da40..7fb4696 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -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 \
diff --git a/arch/arm/boot/dts/sh7372-mackerel-reference.dts b/arch/arm/boot/dts/sh7372-mackerel-reference.dts
new file mode 100644
index 0000000..2fd1eff
--- /dev/null
+++ b/arch/arm/boot/dts/sh7372-mackerel-reference.dts
@@ -0,0 +1,131 @@
+/*
+ * Device Tree Source for the mackerel board
+ *
+ * Copyright (C) 2012 Renesas Solutions Corp.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2. This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+/dts-v1/;
+/include/ "sh7372.dtsi"
+
+/ {
+ model = "Mackerel (AP4 EVM 2nd)";
+ compatible = "renesas,mackerel-reference";
+
+ memory {
+ device_type = "memory";
+ reg = <0x40000000 0x10000000>;
+ };
+
+ reg_1p8v: regulator@0 {
+ compatible = "regulator-fixed";
+ regulator-name = "1P8V";
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+ regulator-boot-on;
+ regulator-always-on;
+ };
+
+ reg_3p3v: regulator@1 {
+ compatible = "regulator-fixed";
+ regulator-name = "3P3V";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ regulator-boot-on;
+ regulator-always-on;
+ };
+
+ lan9220@14000000 {
+ compatible = "smsc,lan9220", "smsc,lan9115";
+ reg = <0x14000000 0x2000000>;
+ phy-mode = "mii";
+ interrupt-parent = <&intca_irq_pins_lo>;
+ interrupts = <0x2c0>;
+ reg-io-width = <4>;
+ smsc,irq-push-pull;
+ smsc,save-mac-address;
+ vddvario-supply = <®_1p8v>;
+ vdd33a-supply = <®_3p3v>;
+ };
+
+ i2c1: i2c@e6c20000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "renesas,rmobile-iic";
+ reg = <0xe6c20000 0x1000>;
+ interrupt-parent = <&intca>;
+ interrupts = <0x780 0x7a0 0x7c0 0x7e0>;
+
+ clock-frequency = <100000>;
+
+ accelerometer@53 {
+ compatible = "analog-devices,adxl34x";
+ reg = <0x53>;
+ interrupt-parent = <&intca_irq_pins_hi>;
+ interrupts = <0x32a0>;
+ };
+ };
+
+ mmcif0: mmcif@0xe6bd0000 {
+ compatible = "renesas,sh-mmcif", "renesas,sh7372-mmcif";
+ reg = <0xe6bd0000 0x100>;
+ interrupt-parent = <&intca>;
+ interrupts = <0x1ac0 0x1ae0>;
+ vmmc-supply = <®_1p8v>;
+ };
+
+ sdhi0: sdhi@0xe6850000 {
+ compatible = "renesas,shmobile-sdhi";
+ reg = <0xe6850000 0x100>;
+ interrupt-parent = <&intca>;
+ interrupts = <0x0e00 0x0e20 0x0e40>;
+ vmmc-supply = <®_3p3v>;
+ };
+
+ sdhi1: sdhi@0xe6860000 {
+ compatible = "renesas,shmobile-sdhi";
+ reg = <0xe6860000 0x100>;
+ interrupt-parent = <&intca>;
+ interrupts = <0x0e80 0x0ea0 0x0ec0>;
+ vmmc-supply = <®_1p8v>;
+ };
+
+ sdhi2: sdhi@0xe6870000 {
+ compatible = "renesas,shmobile-sdhi";
+ reg = <0xe6870000 0x100>;
+ interrupt-parent = <&intca>;
+ interrupts = <0x1200 0x1220 0x1240>;
+ vmmc-supply = <®_3p3v>;
+ };
+
+ flash@2000000 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "cfi-flash";
+ reg = <0x20000000 0x8000000>;
+ bank-width = <2>;
+ partition@0 {
+ label = "loader";
+ reg = <0 0x80000>;
+ };
+ partition@1 {
+ label = "bootenv";
+ reg = <0x80000 0x80000>;
+ };
+ partition@2 {
+ label = "kernel_ro";
+ reg = <0x100000 0x800000>;
+ };
+ partition@3 {
+ label = "kernel";
+ reg = <0x900000 0x800000>;
+ };
+ partition@4 {
+ label = "data";
+ reg = <0x1100000 0x6f00000>;
+ };
+ };
+};
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 9255546..c25784b 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -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
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index 0b71479..8035165 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -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
diff --git a/arch/arm/mach-shmobile/board-mackerel-reference.c b/arch/arm/mach-shmobile/board-mackerel-reference.c
new file mode 100644
index 0000000..1d83653
--- /dev/null
+++ b/arch/arm/mach-shmobile/board-mackerel-reference.c
@@ -0,0 +1,122 @@
+/*
+ * mackerel board support - Reference Device Tree Implementation
+ *
+ * Copyright (C) 2012 Renesas Solutions Corp.
+ *
+ * Copyright (C) 2010 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+ *
+ * based on ap4evb
+ * Copyright (C) 2010 Magnus Damm
+ * Copyright (C) 2008 Yoshihiro Shimoda
+ *
+ * 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 Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#include <linux/init.h>
+#include <linux/irq.h>
+#include <linux/gpio.h>
+
+#include <mach/common.h>
+#include <mach/irqs.h>
+#include <mach/sh7372.h>
+
+#include <asm/mach/arch.h>
+
+#define IRQ7 evt2irq(0x02e0)
+#define IRQ21 evt2irq(0x32a0)
+
+static void __init mackerel_init(void)
+{
+ sh7372_add_standard_devices_dt();
+
+ /* External clock source */
+ clk_set_rate(&sh7372_dv_clki_clk, 27000000);
+
+ sh7372_pinmux_init();
+
+ /* enable SCIFA0 */
+ gpio_request(GPIO_FN_SCIFA0_TXD, NULL);
+ gpio_request(GPIO_FN_SCIFA0_RXD, NULL);
+
+ /* enable SMSC911X */
+ gpio_request(GPIO_FN_CS5A, NULL);
+ gpio_request(GPIO_FN_IRQ6_39, NULL);
+
+ /* enable Touchscreen */
+ gpio_request(GPIO_FN_IRQ7_40, NULL);
+ irq_set_irq_type(IRQ7, IRQ_TYPE_LEVEL_LOW);
+
+ /* enable Accelerometer */
+ gpio_request(GPIO_FN_IRQ21, NULL);
+ irq_set_irq_type(IRQ21, IRQ_TYPE_LEVEL_HIGH);
+
+ /* enable SDHI0 */
+ gpio_request(GPIO_FN_SDHIWP0, NULL);
+ gpio_request(GPIO_FN_SDHICMD0, NULL);
+ gpio_request(GPIO_FN_SDHICLK0, NULL);
+ gpio_request(GPIO_FN_SDHID0_3, NULL);
+ gpio_request(GPIO_FN_SDHID0_2, NULL);
+ gpio_request(GPIO_FN_SDHID0_1, NULL);
+ gpio_request(GPIO_FN_SDHID0_0, NULL);
+
+ /* SDHI0 PORT172 card-detect IRQ26 */
+ gpio_request(GPIO_FN_IRQ26_172, NULL);
+
+ /* enable SDHI1 */
+ gpio_request(GPIO_FN_SDHICMD1, NULL);
+ gpio_request(GPIO_FN_SDHICLK1, NULL);
+ gpio_request(GPIO_FN_SDHID1_3, NULL);
+ gpio_request(GPIO_FN_SDHID1_2, NULL);
+ gpio_request(GPIO_FN_SDHID1_1, NULL);
+ gpio_request(GPIO_FN_SDHID1_0, NULL);
+
+ /* enable SDHI2 */
+ gpio_request(GPIO_FN_SDHICMD2, NULL);
+ gpio_request(GPIO_FN_SDHICLK2, NULL);
+ gpio_request(GPIO_FN_SDHID2_3, NULL);
+ gpio_request(GPIO_FN_SDHID2_2, NULL);
+ gpio_request(GPIO_FN_SDHID2_1, NULL);
+ gpio_request(GPIO_FN_SDHID2_0, NULL);
+
+ /* card detect pin for microSD slot (CN23) */
+ gpio_request(GPIO_PORT162, NULL);
+ gpio_direction_input(GPIO_PORT162);
+
+ /* MMCIF */
+ gpio_request(GPIO_FN_MMCD0_0, NULL);
+ gpio_request(GPIO_FN_MMCD0_1, NULL);
+ gpio_request(GPIO_FN_MMCD0_2, NULL);
+ gpio_request(GPIO_FN_MMCD0_3, NULL);
+ gpio_request(GPIO_FN_MMCD0_4, NULL);
+ gpio_request(GPIO_FN_MMCD0_5, NULL);
+ gpio_request(GPIO_FN_MMCD0_6, NULL);
+ gpio_request(GPIO_FN_MMCD0_7, NULL);
+ gpio_request(GPIO_FN_MMCCMD0, NULL);
+ gpio_request(GPIO_FN_MMCCLK0, NULL);
+}
+
+static const char *mackerel_compat_dt[] __initdata = {
+ "renesas,mackerel-reference",
+ NULL,
+};
+
+DT_MACHINE_START(MACKEREL, "mackerel-reference")
+ .map_io = sh7372_map_io,
+ .init_early = sh7372_add_early_devices_dt,
+ .init_irq = sh7372_init_irq_of,
+ .handle_irq = shmobile_handle_irq_intc,
+ .init_machine = mackerel_init,
+ .init_late = sh7372_pm_init_late,
+ .timer = &shmobile_timer,
+ .dt_compat = mackerel_compat_dt,
+MACHINE_END
--
1.7.2.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] ARM: shmobile: add function declarations for sh7372 DT helper functions
2012-12-31 11:23 [PATCH 1/2] ARM: shmobile: add function declarations for sh7372 DT helper functions Guennadi Liakhovetski
2012-12-31 11:23 ` [PATCH 2/2] ARM: shmobile: add a reference DT implementation for mackerel Guennadi Liakhovetski
@ 2013-01-07 2:31 ` Simon Horman
2015-02-06 1:33 ` [PATCH 1/2] ARM: shmobile: Add function to get SoCs revision data for R-Car Gen2 Nobuhiro Iwamatsu
` (2 more replies)
1 sibling, 3 replies; 7+ messages in thread
From: Simon Horman @ 2013-01-07 2:31 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Dec 31, 2012 at 12:23:50PM +0100, Guennadi Liakhovetski wrote:
> 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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] ARM: shmobile: add a reference DT implementation for mackerel
2012-12-31 11:23 ` [PATCH 2/2] ARM: shmobile: add a reference DT implementation for mackerel Guennadi Liakhovetski
@ 2013-01-09 1:51 ` Simon Horman
0 siblings, 0 replies; 7+ messages in thread
From: Simon Horman @ 2013-01-09 1:51 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Dec 31, 2012 at 12:23:54PM +0100, Guennadi Liakhovetski wrote:
> 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.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Hi Guennadi,
thanks. This looks good to me.
I will apply it once I have applied the INTC and pinmux changes.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] ARM: shmobile: Add function to get SoCs revision data for R-Car Gen2
2013-01-07 2:31 ` [PATCH 1/2] ARM: shmobile: add function declarations for sh7372 DT helper functions Simon Horman
@ 2015-02-06 1:33 ` Nobuhiro Iwamatsu
2015-02-10 8:41 ` Geert Uytterhoeven
2015-02-12 7:11 ` Nobuhiro Iwamatsu
2 siblings, 0 replies; 7+ messages in thread
From: Nobuhiro Iwamatsu @ 2015-02-06 1:33 UTC (permalink / raw)
To: linux-sh
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.
Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
---
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(+)
diff --git a/arch/arm/mach-shmobile/rcar-gen2.h b/arch/arm/mach-shmobile/rcar-gen2.h
index ce53cb5..b232956 100644
--- a/arch/arm/mach-shmobile/rcar-gen2.h
+++ b/arch/arm/mach-shmobile/rcar-gen2.h
@@ -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__ */
diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c
index 3a18af4..8d26ab0 100644
--- a/arch/arm/mach-shmobile/setup-r8a7790.c
+++ b/arch/arm/mach-shmobile/setup-r8a7790.c
@@ -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,
diff --git a/arch/arm/mach-shmobile/setup-r8a7791.c b/arch/arm/mach-shmobile/setup-r8a7791.c
index ef8eb3a..c528b0f 100644
--- a/arch/arm/mach-shmobile/setup-r8a7791.c
+++ b/arch/arm/mach-shmobile/setup-r8a7791.c
@@ -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
diff --git a/arch/arm/mach-shmobile/setup-r8a7794.c b/arch/arm/mach-shmobile/setup-r8a7794.c
index d2b0930..eb86656 100644
--- a/arch/arm/mach-shmobile/setup-r8a7794.c
+++ b/arch/arm/mach-shmobile/setup-r8a7794.c
@@ -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,
diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c
index aa33392..2230948 100644
--- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
+++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
@@ -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);
+}
--
2.1.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] ARM: shmobile: Add function to get SoCs revision data for R-Car Gen2
2013-01-07 2:31 ` [PATCH 1/2] ARM: shmobile: add function declarations for sh7372 DT helper functions Simon Horman
2015-02-06 1:33 ` [PATCH 1/2] ARM: shmobile: Add function to get SoCs revision data for R-Car Gen2 Nobuhiro Iwamatsu
@ 2015-02-10 8:41 ` Geert Uytterhoeven
2015-02-12 7:11 ` Nobuhiro Iwamatsu
2 siblings, 0 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2015-02-10 8:41 UTC (permalink / raw)
To: linux-sh
Hi Iwamatsu-san,
On Fri, Feb 6, 2015 at 2:33 AM, Nobuhiro Iwamatsu
<nobuhiro.iwamatsu.yj@renesas.com> wrote:
> 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.
> --- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
> +++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
> +#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"?
> +}
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] ARM: shmobile: Add function to get SoCs revision data for R-Car Gen2
2013-01-07 2:31 ` [PATCH 1/2] ARM: shmobile: add function declarations for sh7372 DT helper functions Simon Horman
2015-02-06 1:33 ` [PATCH 1/2] ARM: shmobile: Add function to get SoCs revision data for R-Car Gen2 Nobuhiro Iwamatsu
2015-02-10 8:41 ` Geert Uytterhoeven
@ 2015-02-12 7:11 ` Nobuhiro Iwamatsu
2 siblings, 0 replies; 7+ messages in thread
From: Nobuhiro Iwamatsu @ 2015-02-12 7:11 UTC (permalink / raw)
To: linux-sh
Hi,
Thanks for your review.
(2015/02/10 17:41), Geert Uytterhoeven wrote:
> Hi Iwamatsu-san,
>
> On Fri, Feb 6, 2015 at 2:33 AM, Nobuhiro Iwamatsu
> <nobuhiro.iwamatsu.yj@renesas.com> wrote:
>> 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.
>
>> --- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
>> +++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
>
>> +#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"?
>
>> +}
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.
>
> Gr{oetje,eeting}s,
>
> Geert
>
Best regards,
Nobuhiro
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-02-12 7:11 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-31 11:23 [PATCH 1/2] ARM: shmobile: add function declarations for sh7372 DT helper functions Guennadi Liakhovetski
2012-12-31 11:23 ` [PATCH 2/2] ARM: shmobile: add a reference DT implementation for mackerel Guennadi Liakhovetski
2013-01-09 1:51 ` Simon Horman
2013-01-07 2:31 ` [PATCH 1/2] ARM: shmobile: add function declarations for sh7372 DT helper functions Simon Horman
2015-02-06 1:33 ` [PATCH 1/2] ARM: shmobile: Add function to get SoCs revision data for R-Car Gen2 Nobuhiro Iwamatsu
2015-02-10 8:41 ` Geert Uytterhoeven
2015-02-12 7:11 ` Nobuhiro Iwamatsu
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).