Skip to contentSkip to conversation

Renesas ARM-based SoC board updates for v3.11

GIT PULL In review Simon Horman 4 participants 16 messages Jun 7, 2013 – Jan 22, 2015

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

Hi Olof, Hi Arnd,

Please note that this pull request is based on a merge of the renesas-pinmux-for-v3.11 and renesas-soc-for-v3.11 tags in the renesas tree in order to provide dependencies.

I have sent pull requests for each of those tags as:
[GIT PULL 000/130] Renesas ARM based SoC pinmux and GPIO update for [GIT PULL v2 00/27] Renesas ARM-based SoC updates for v3.11

The following changes since commit a961ee1c95cb7309f619e9e68fe8c4fb73bedf6f:

Merge branches 'pinmux' and 'soc' into boards-base (2013-06-07 14:26:22 +0900)

are available in the git repository at:

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

for you to fetch changes up to f3031ff3f2e14f0ced4d45150316df2607b70a27:

ARM: shmobile: marzen: keep local function as static (2013-06-07 14:26:35 +0900)

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

Highlights:
bockw: add SDHI0 support
bockw: add dummy regulators for SMSC
bockw: Document CN9 SCIF/RCAN dipswitch selection
lager: support GPIO switches and LEDs
kzm9g: add AS3711 PMIC platform data
marzen: Use INTC External IRQ pin driver for SMSC
ape6evm: Update MP clock parent become EXTAL2 in line with changes
to r8a73a4 SoC code

----------------------------------------------------------------
Guennadi Liakhovetski (1):
ARM: shmobile: kzm9g: add AS3711 PMIC platform data

Kuninori Morimoto (6):
ARM: shmobile: ape6evm: MP clock parent become EXTAL2
ARM: shmobile: bockw: define FPGA address and rename iomem variable
ARM: shmobile: bockw: add CN9 SCIF/RCAN selection dipswitch explanation
ARM: shmobile: bockw: add dummy regulators for SMSC
ARM: shmobile: bockw: add SDHI0 support
ARM: shmobile: marzen: keep local function as static

Simon Horman (4):
ARM: shmobile: kzm9d: resigser smsc911x platform device with id -1
ARM: shmobile: lager: Add GPIO LEDs
ARM: shmobile: lager: support GPIO switches
ARM: shmobile: marzen: Use INTC External IRQ pin driver for SMSC

 arch/arm/mach-shmobile/board-ape6evm.c |  15 +++
 arch/arm/mach-shmobile/board-bockw.c   |  61 ++++++++++-
 arch/arm/mach-shmobile/board-kzm9d.c   |   2 +-
 arch/arm/mach-shmobile/board-kzm9g.c   | 193 ++++++++++++++++++++++++---------
 arch/arm/mach-shmobile/board-lager.c   |  49 +++++++++
 arch/arm/mach-shmobile/board-marzen.c  |   5 +-
 6 files changed, 263 insertions(+), 62 deletions(-)
Signature · 1 line
1.8.2.1
#1 lore raw

PATCH 1/11 ARM: shmobile: ape6evm: MP clock parent become EXTAL2

From: Kuninori Morimoto <[email protected]>

The orignal commit 3263e09d287fbaa8a9424b5e69396599a3bbd518 (ARM: shmobile: Initial r8a73a4 SoC support V3) put MP clock parent as EXTAL2, but its code was removed on DIV6 clock support commit.
This patch makes it consistent.

---
 arch/arm/mach-shmobile/board-ape6evm.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm/mach-shmobile/board-ape6evm.c +15 -0
index 55b8c9f..5eb0caa 100644
@@ -26,6 +26,7 @@
 #include <linux/platform_device.h>
 #include <linux/regulator/fixed.h>
 #include <linux/regulator/machine.h>
+#include <linux/sh_clk.h>
 #include <linux/smsc911x.h>
 #include <mach/common.h>
 #include <mach/irqs.h>
@@ -65,7 +66,21 @@ static const struct pinctrl_map ape6evm_pinctrl_map[] = {
 
 static void __init ape6evm_add_standard_devices(void)
 {
+
+	struct clk *parent;
+	struct clk *mp;
+
 	r8a73a4_clock_init();
+
+	/* MP clock parent = extal2 */
+	parent      = clk_get(NULL, "extal2");
+	mp          = clk_get(NULL, "mp");
+	BUG_ON(IS_ERR(parent) || IS_ERR(mp));
+
+	clk_set_parent(mp, parent);
+	clk_put(parent);
+	clk_put(mp);
+
 	pinctrl_register_mappings(ape6evm_pinctrl_map,
 				  ARRAY_SIZE(ape6evm_pinctrl_map));
 	r8a73a4_pinmux_init();
Signature · 1 line
1.8.2.1
#2 lore raw

PATCH 2/11 ARM: shmobile: bockw: define FPGA address and rename iomem variable

In reply to Simon Horman

From: Kuninori Morimoto <[email protected]>

Bock-W board will needs more board specific ioremap() method. This patch tidyup current FPGA specific settings

---
 arch/arm/mach-shmobile/board-bockw.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
arch/arm/mach-shmobile/board-bockw.c +7 -6
index dac4365..badde08 100644
@@ -46,10 +46,11 @@ static const struct pinctrl_map bockw_pinctrl_map[] = {
 				  "scif0_ctrl", "scif0"),
 };
 
+#define FPGA	0x18200000
 #define IRQ0MR	0x30
 static void __init bockw_init(void)
 {
-	void __iomem *fpga;
+	void __iomem *base;
 
 	r8a7778_clock_init();
 	r8a7778_init_irq_extpin(1);
@@ -59,8 +60,8 @@ static void __init bockw_init(void)
 				  ARRAY_SIZE(bockw_pinctrl_map));
 	r8a7778_pinmux_init();
 
-	fpga = ioremap_nocache(0x18200000, SZ_1M);
-	if (fpga) {
+	base = ioremap_nocache(FPGA, SZ_1M);
+	if (base) {
 		/*
 		 * CAUTION
 		 *
@@ -68,10 +69,10 @@ static void __init bockw_init(void)
 		 * it should be cared in the future
 		 * Now, it is assuming IRQ0 was used only from SMSC.
 		 */
-		u16 val = ioread16(fpga + IRQ0MR);
+		u16 val = ioread16(base + IRQ0MR);
 		val &= ~(1 << 4); /* enable SMSC911x */
-		iowrite16(val, fpga + IRQ0MR);
-		iounmap(fpga);
+		iowrite16(val, base + IRQ0MR);
+		iounmap(base);
 
 		platform_device_register_resndata(
 			&platform_bus, "smsc911x", -1,
Signature · 1 line
1.8.2.1
#3 lore raw

PATCH 3/11 ARM: shmobile: kzm9d: resigser smsc911x platform device with id -1

In reply to Simon Horman

As the kzm9d only has one smsc911x device it may be registered as a platform device with id -1.

This allows the kzm9d board to access the smsc911x device when CONFIG_REGULATOR (and CONFIG_REGULATOR_FIXED_VOLTAGE) are set. The motivation for which is twofold: using regulators seems to be generally a good thing; it will move the kzm9d defconfig one step closer to being able to be consolidated with other shmobile defconfigs.

An alternate but so far untested approach would be to update the definition of dummy_supplies in board-kzm9d.c to use "smsc911x.0" instead of "smsc911x".

---
 arch/arm/mach-shmobile/board-kzm9d.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-shmobile/board-kzm9d.c +1 -1
index c016ccd..4368000 100644
@@ -56,7 +56,7 @@ static struct smsc911x_platform_config smsc911x_platdata = {
 
 static struct platform_device smsc91x_device = {
 	.name	= "smsc911x",
-	.id	= 0,
+	.id	= -1,
 	.dev	= {
 		  .platform_data = &smsc911x_platdata,
 		},
Signature · 1 line
1.8.2.1
#4 lore raw

PATCH 4/11 ARM: shmobile: kzm9g: add AS3711 PMIC platform data

In reply to Simon Horman

From: Guennadi Liakhovetski <[email protected]>

KZM9G uses an AS3711 PMIC to supply power to the CPU and the LCD backlight. The PMIC on the board is pre-programmed to supply correct voltages to the CPU, power supply to the backlight has to be turned on at run-time. The latter is currently performed by a hard-coded I2C command sequence in the board file. This patch removes the backlight hack and instead adds an I2C device to instantiate the AS3711 MFD driver, which will add a regulator device to dynamically adjust CPU voltages and a backlight device.

---
 arch/arm/mach-shmobile/board-kzm9g.c | 193 +++++++++++++++++++++++++----------
 1 file changed, 140 insertions(+), 53 deletions(-)
arch/arm/mach-shmobile/board-kzm9g.c +140 -53
index 1fdf05c..165483c 100644
@@ -29,6 +29,7 @@
 #include <linux/mmc/host.h>
 #include <linux/mmc/sh_mmcif.h>
 #include <linux/mmc/sh_mobile_sdhi.h>
+#include <linux/mfd/as3711.h>
 #include <linux/mfd/tmio.h>
 #include <linux/pinctrl/machine.h>
 #include <linux/pinctrl/pinconf-generic.h>
@@ -606,6 +607,140 @@ static struct platform_device fsi_ak4648_device = {
 };
 
 /* I2C */
+
+/* StepDown1 is used to supply 1.315V to the CPU */
+static struct regulator_init_data as3711_sd1 = {
+	.constraints = {
+		.name = "1.315V CPU",
+		.boot_on = 1,
+		.always_on = 1,
+		.min_uV = 1315000,
+		.max_uV = 1335000,
+	},
+};
+
+/* StepDown2 is used to supply 1.8V to the CPU and to the board */
+static struct regulator_init_data as3711_sd2 = {
+	.constraints = {
+		.name = "1.8V",
+		.boot_on = 1,
+		.always_on = 1,
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+	},
+};
+
+/*
+ * StepDown3 is switched in parallel with StepDown2, seems to be off,
+ * according to read-back pre-set register values
+ */
+
+/* StepDown4 is used to supply 1.215V to the CPU and to the board */
+static struct regulator_init_data as3711_sd4 = {
+	.constraints = {
+		.name = "1.215V",
+		.boot_on = 1,
+		.always_on = 1,
+		.min_uV = 1215000,
+		.max_uV = 1235000,
+	},
+};
+
+/* LDO1 is unused and unconnected */
+
+/* LDO2 is used to supply 2.8V to the CPU */
+static struct regulator_init_data as3711_ldo2 = {
+	.constraints = {
+		.name = "2.8V CPU",
+		.boot_on = 1,
+		.always_on = 1,
+		.min_uV = 2800000,
+		.max_uV = 2800000,
+	},
+};
+
+/* LDO3 is used to supply 3.0V to the CPU */
+static struct regulator_init_data as3711_ldo3 = {
+	.constraints = {
+		.name = "3.0V CPU",
+		.boot_on = 1,
+		.always_on = 1,
+		.min_uV = 3000000,
+		.max_uV = 3000000,
+	},
+};
+
+/* LDO4 is used to supply 2.8V to the board */
+static struct regulator_init_data as3711_ldo4 = {
+	.constraints = {
+		.name = "2.8V",
+		.boot_on = 1,
+		.always_on = 1,
+		.min_uV = 2800000,
+		.max_uV = 2800000,
+	},
+};
+
+/* LDO5 is switched parallel to LDO4, also set to 2.8V */
+static struct regulator_init_data as3711_ldo5 = {
+	.constraints = {
+		.name = "2.8V #2",
+		.boot_on = 1,
+		.always_on = 1,
+		.min_uV = 2800000,
+		.max_uV = 2800000,
+	},
+};
+
+/* LDO6 is unused and unconnected */
+
+/* LDO7 is used to supply 1.15V to the CPU */
+static struct regulator_init_data as3711_ldo7 = {
+	.constraints = {
+		.name = "1.15V CPU",
+		.boot_on = 1,
+		.always_on = 1,
+		.min_uV = 1150000,
+		.max_uV = 1150000,
+	},
+};
+
+/* LDO8 is switched parallel to LDO7, also set to 1.15V */
+static struct regulator_init_data as3711_ldo8 = {
+	.constraints = {
+		.name = "1.15V CPU #2",
+		.boot_on = 1,
+		.always_on = 1,
+		.min_uV = 1150000,
+		.max_uV = 1150000,
+	},
+};
+
+static struct as3711_platform_data as3711_pdata = {
+	.regulator	= {
+		.init_data	= {
+			[AS3711_REGULATOR_SD_1] = &as3711_sd1,
+			[AS3711_REGULATOR_SD_2] = &as3711_sd2,
+			[AS3711_REGULATOR_SD_4] = &as3711_sd4,
+			[AS3711_REGULATOR_LDO_2] = &as3711_ldo2,
+			[AS3711_REGULATOR_LDO_3] = &as3711_ldo3,
+			[AS3711_REGULATOR_LDO_4] = &as3711_ldo4,
+			[AS3711_REGULATOR_LDO_5] = &as3711_ldo5,
+			[AS3711_REGULATOR_LDO_7] = &as3711_ldo7,
+			[AS3711_REGULATOR_LDO_8] = &as3711_ldo8,
+		},
+	},
+	.backlight	= {
+		.su2_fb = "sh_mobile_lcdc_fb.0",
+		.su2_max_uA = 36000,
+		.su2_feedback = AS3711_SU2_CURR_AUTO,
+		.su2_fbprot = AS3711_SU2_GPIO4,
+		.su2_auto_curr1 = true,
+		.su2_auto_curr2 = true,
+		.su2_auto_curr3 = true,
+	},
+};
+
 static struct pcf857x_platform_data pcf8575_pdata = {
 	.gpio_base	= GPIO_PCF8575_BASE,
 };
@@ -625,6 +760,11 @@ static struct i2c_board_info i2c0_devices[] = {
 		I2C_BOARD_INFO("adxl34x", 0x1d),
 		.irq = irq_pin(26), /* IRQ26 */
 	},
+	{
+		I2C_BOARD_INFO("as3711", 0x40),
+		.irq = intcs_evt2irq(0x3300), /* IRQ24 */
+		.platform_data = &as3711_pdata,
+	},
 };
 
 static struct i2c_board_info i2c1_devices[] = {
@@ -715,59 +855,6 @@ static const struct pinctrl_map kzm_pinctrl_map[] = {
 				  "usb_vbus", "usb"),
 };
 
-/*
- * FIXME
- *
- * This is quick hack for enabling LCDC backlight
- */
-static int __init as3711_enable_lcdc_backlight(void)
-{
-	struct i2c_adapter *a = i2c_get_adapter(0);
-	struct i2c_msg msg;
-	int i, ret;
-	__u8 magic[] = {
-		0x40, 0x2a,
-		0x43, 0x3c,
-		0x44, 0x3c,
-		0x45, 0x3c,
-		0x54, 0x03,
-		0x51, 0x00,
-		0x51, 0x01,
-		0xff, 0x00, /* wait */
-		0x43, 0xf0,
-		0x44, 0xf0,
-		0x45, 0xf0,
-	};
-
-	if (!of_machine_is_compatible("renesas,kzm9g"))
-		return 0;
-
-	if (!a)
-		return 0;
-
-	msg.addr	= 0x40;
-	msg.len		= 2;
-	msg.flags	= 0;
-
-	for (i = 0; i < ARRAY_SIZE(magic); i += 2) {
-		msg.buf = magic + i;
-
-		if (0xff == msg.buf[0]) {
-			udelay(500);
-			continue;
-		}
-
-		ret = i2c_transfer(a, &msg, 1);
-		if (ret < 0) {
-			pr_err("i2c transfer fail\n");
-			break;
-		}
-	}
-
-	return 0;
-}
-device_initcall(as3711_enable_lcdc_backlight);
-
 static void __init kzm_init(void)
 {
 	regulator_register_always_on(2, "fixed-1.8V", fixed1v8_power_consumers,
Signature · 1 line
1.8.2.1
#5 lore raw

PATCH 5/11 ARM: shmobile: bockw: add CN9 SCIF/RCAN selection dipswitch explanation

In reply to Simon Horman

From: Kuninori Morimoto <[email protected]>

Debug serial (= SCIF0) is connected to CN9 upper side, and it is shared by RCAN.
This patch adds SCIF/RCAN dipswitch explanation on comment area for developers.

---
 arch/arm/mach-shmobile/board-bockw.c | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm/mach-shmobile/board-bockw.c +8 -0
index badde08..3ce020a 100644
@@ -26,6 +26,14 @@
 #include <mach/r8a7778.h>
 #include <asm/mach/arch.h>
 
+/*
+ *	CN9(Upper side) SCIF/RCAN selection
+ *
+ *		1,4	3,6
+ * SW40		SCIF	RCAN
+ * SW41		SCIF	RCAN
+ */
+
 static struct smsc911x_platform_config smsc911x_data = {
 	.irq_polarity	= SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
 	.irq_type	= SMSC911X_IRQ_TYPE_PUSH_PULL,
Signature · 1 line
1.8.2.1
#6 lore raw

PATCH 6/11 ARM: shmobile: bockw: add dummy regulators for SMSC

In reply to Simon Horman

From: Kuninori Morimoto <[email protected]>

SMSC driver will try to get regulator if .config had CONFIG_REGULATOR, and, shmobile_defconfig has it.
SMSC driver on Bock-W board will be failed if it doens't have dummy regulator settings.

---
 arch/arm/mach-shmobile/board-bockw.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/mach-shmobile/board-bockw.c +11 -0
index 3ce020a..4d65715 100644
@@ -20,6 +20,8 @@
 
 #include <linux/pinctrl/machine.h>
 #include <linux/platform_device.h>
+#include <linux/regulator/fixed.h>
+#include <linux/regulator/machine.h>
 #include <linux/smsc911x.h>
 #include <mach/common.h>
 #include <mach/irqs.h>
@@ -34,6 +36,12 @@
  * SW41		SCIF	RCAN
  */
 
+/* Dummy supplies, where voltage doesn't matter */
+static struct regulator_consumer_supply dummy_supplies[] = {
+	REGULATOR_SUPPLY("vddvario", "smsc911x"),
+	REGULATOR_SUPPLY("vdd33a", "smsc911x"),
+};
+
 static struct smsc911x_platform_config smsc911x_data = {
 	.irq_polarity	= SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
 	.irq_type	= SMSC911X_IRQ_TYPE_PUSH_PULL,
@@ -82,6 +90,9 @@ static void __init bockw_init(void)
 		iowrite16(val, base + IRQ0MR);
 		iounmap(base);
 
+		regulator_register_fixed(0, dummy_supplies,
+					 ARRAY_SIZE(dummy_supplies));
+
 		platform_device_register_resndata(
 			&platform_bus, "smsc911x", -1,
 			smsc911x_resources, ARRAY_SIZE(smsc911x_resources),
Signature · 1 line
1.8.2.1
#7 lore raw

PATCH 6/11 ARM: shmobile: bockw: add devices hooked up to i2c0 to DT

Cameras, RTC, and ak4643 sound codec.

---
 arch/arm/boot/dts/r8a7778-bockw.dts | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
arch/arm/boot/dts/r8a7778-bockw.dts +25 -0
index 7347223..280a922 100644
@@ -59,6 +59,31 @@
 	};
 };
 
+&i2c0 {
+	status = "okay";
+
+	ak4643: sound-codec@12 {
+		compatible = "asahi-kasei,ak4643";
+		#sound-dai-cells = <0>;
+		reg = <0x12>;
+	};
+
+	camera@41 {
+		compatible = "oki,ml86v7667";
+		reg = <0x41>;
+	};
+
+	camera@43 {
+		compatible = "oki,ml86v7667";
+		reg = <0x43>;
+	};
+
+	rx8581: rtc@51 {
+		compatible = "epson,rx8581";
+		reg = <0x51>;
+	};
+};
+
 &mmcif {
 	pinctrl-0 = <&mmc_pins>;
 	pinctrl-names = "default";
Signature · 1 line
2.2.2
#8 lore raw

Re: [PATCH 06/11] ARM: shmobile: bockw: add devices hooked up to i2c0 to DT

In reply to Simon Horman
Quoted 16 lines · Ulrich Hecht

Cameras, RTC, and ak4643 sound codec.

---
 arch/arm/boot/dts/r8a7778-bockw.dts | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
arch/arm/boot/dts/r8a7778-bockw.dts +1 -0
index 7347223..280a922 100644
@@ -59,6 +59,31 @@
        };
 };
 
+&i2c0 {

arch/arm/boot/dts/r8a7778-bockw.dts line 72

Quoted 10 lines
arch/arm/boot/dts/r8a7778-bockw.dts +10 -0
+       status = "okay";
+
+       ak4643: sound-codec@12 {
+               compatible = "asahi-kasei,ak4643";
+               #sound-dai-cells = <0>;
+               reg = <0x12>;
+       };
+
+       camera@41 {
+               compatible = "oki,ml86v7667";

JFYI, "ml86v7667" should be added to Documentation/devicetree/bindings/i2c/trivial-devices.txt

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

Acked-by on v1 6/11
#9 lore raw

Re: [PATCH 06/11] ARM: shmobile: bockw: add devices hooked up to i2c0 to DT

In reply to Simon Horman
Quoted 3 lines · Ulrich Hecht

Cameras, RTC, and ak4643 sound codec.

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

#10 lore raw

PATCH 7/11 ARM: shmobile: lager: Add GPIO LEDs

In reply to Simon Horman

The board has 3 LEDs connected to GPIOs. Add a led-gpio device to support them.

Based on "ARM: shmobile: marzen: Add GPIO LEDs" by Laurent Pinchart.

Cc Laurent Pinchart <[email protected]>
---
 arch/arm/mach-shmobile/board-lager.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
arch/arm/mach-shmobile/board-lager.c +27 -0
index 6114edd..6a1ba38 100644
@@ -21,13 +21,37 @@
 #include <linux/interrupt.h>
 #include <linux/irqchip.h>
 #include <linux/kernel.h>
+#include <linux/leds.h>
 #include <linux/pinctrl/machine.h>
+#include <linux/platform_data/gpio-rcar.h>
 #include <linux/platform_device.h>
 #include <mach/common.h>
 #include <mach/r8a7790.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 
+/* LEDS */
+static struct gpio_led lager_leds[] = {
+	{
+		.name		= "led8",
+		.gpio		= RCAR_GP_PIN(5, 17),
+		.default_state	= LEDS_GPIO_DEFSTATE_ON,
+	}, {
+		.name		= "led7",
+		.gpio		= RCAR_GP_PIN(4, 23),
+		.default_state	= LEDS_GPIO_DEFSTATE_ON,
+	}, {
+		.name		= "led6",
+		.gpio		= RCAR_GP_PIN(4, 22),
+		.default_state	= LEDS_GPIO_DEFSTATE_ON,
+	},
+};
+
+static struct gpio_led_platform_data lager_leds_pdata = {
+	.leds		= lager_leds,
+	.num_leds	= ARRAY_SIZE(lager_leds),
+};
+
 static const struct pinctrl_map lager_pinctrl_map[] = {
 	/* SCIF0 (CN19: DEBUG SERIAL0) */
 	PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.6", "pfc-r8a7790",
@@ -46,6 +70,9 @@ static void __init lager_add_standard_devices(void)
 	r8a7790_pinmux_init();
 
 	r8a7790_add_standard_devices();
+	platform_device_register_data(&platform_bus, "leds-gpio", -1,
+				      &lager_leds_pdata,
+				      sizeof(lager_leds_pdata));
 }
 
 static const char *lager_boards_compat_dt[] __initdata = {
Signature · 1 line
1.8.2.1
#11 lore raw

PATCH 7/11 ARM: shmobile: lager: Add GPIO LEDs

Hello.

Quoted 16 lines · Simon Horman

The board has 3 LEDs connected to GPIOs. Add a led-gpio device to support them.

Based on "ARM: shmobile: marzen: Add GPIO LEDs" by Laurent Pinchart.

Cc Laurent Pinchart <[email protected]>
---
  arch/arm/mach-shmobile/board-lager.c | 27 +++++++++++++++++++++++++++
  1 file changed, 27 insertions(+)
arch/arm/mach-shmobile/board-lager.c +0 -0
index 6114edd..6a1ba38 100644
@@ -21,13 +21,37 @@

[...]

Quoted 1 line

+static struct gpio_led_platform_data lager_leds_pdata = {

Misses __initdata. Too late now, need another patch...

Quoted 8 lines
arch/arm/mach-shmobile/board-lager.c +4 -0
+	.leds		= lager_leds,
+	.num_leds	= ARRAY_SIZE(lager_leds),
+};
+
  static const struct pinctrl_map lager_pinctrl_map[] = {
  	/* SCIF0 (CN19: DEBUG SERIAL0) */
  	PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.6", "pfc-r8a7790",

arch/arm/mach-shmobile/board-lager.c static void __init lager_add_standard_devices(void) · line 78

Quoted 9 lines
arch/arm/mach-shmobile/board-lager.c +3 -0
@@ -46,6 +70,9 @@ static void __init lager_add_standard_devices(void)
  	r8a7790_pinmux_init();
 
  	r8a7790_add_standard_devices();
+	platform_device_register_data(&platform_bus, "leds-gpio", -1,
+				      &lager_leds_pdata,
+				      sizeof(lager_leds_pdata));
  }
 
  static const char *lager_boards_compat_dt[] __initdata = {

WBR, Sergei

#12 lore raw

PATCH 8/11 ARM: shmobile: lager: support GPIO switches

In reply to Simon Horman

The lager board has pins 1 - 4 of SW2 wired up to GPIO pins. This patch allows access to those pins as KEYS 1 - 4 using gpio-keys.

---
 arch/arm/mach-shmobile/board-lager.c | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)
arch/arm/mach-shmobile/board-lager.c +23 -1
index 6a1ba38..d73e21d 100644
@@ -18,6 +18,9 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <linux/gpio.h>
+#include <linux/gpio_keys.h>
+#include <linux/input.h>
 #include <linux/interrupt.h>
 #include <linux/irqchip.h>
 #include <linux/kernel.h>
@@ -47,11 +50,27 @@ static struct gpio_led lager_leds[] = {
 	},
 };
 
-static struct gpio_led_platform_data lager_leds_pdata = {
+static __initdata struct gpio_led_platform_data lager_leds_pdata = {
 	.leds		= lager_leds,
 	.num_leds	= ARRAY_SIZE(lager_leds),
 };
 
+/* GPIO KEY */
+#define GPIO_KEY(c, g, d, ...) \
+	{ .code = c, .gpio = g, .desc = d, .active_low = 1 }
+
+static __initdata struct gpio_keys_button gpio_buttons[] = {
+	GPIO_KEY(KEY_4,		RCAR_GP_PIN(1, 28),	"SW2-pin4"),
+	GPIO_KEY(KEY_3,		RCAR_GP_PIN(1, 26),	"SW2-pin3"),
+	GPIO_KEY(KEY_2,		RCAR_GP_PIN(1, 24),	"SW2-pin2"),
+	GPIO_KEY(KEY_1,		RCAR_GP_PIN(1, 14),	"SW2-pin1"),
+};
+
+static __initdata struct gpio_keys_platform_data lager_keys_pdata = {
+	.buttons	= gpio_buttons,
+	.nbuttons	= ARRAY_SIZE(gpio_buttons),
+};
+
 static const struct pinctrl_map lager_pinctrl_map[] = {
 	/* SCIF0 (CN19: DEBUG SERIAL0) */
 	PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.6", "pfc-r8a7790",
@@ -73,6 +92,9 @@ static void __init lager_add_standard_devices(void)
 	platform_device_register_data(&platform_bus, "leds-gpio", -1,
 				      &lager_leds_pdata,
 				      sizeof(lager_leds_pdata));
+	platform_device_register_data(&platform_bus, "gpio-keys", -1,
+				      &lager_keys_pdata,
+				      sizeof(lager_keys_pdata));
 }
 
 static const char *lager_boards_compat_dt[] __initdata = {
Signature · 1 line
1.8.2.1
#13 lore raw

PATCH 9/11 ARM: shmobile: marzen: Use INTC External IRQ pin driver for SMSC

In reply to Simon Horman

Update the marzen board to use the INTC External IRQ pin driver for SMSC.

This code was originally posted by Magnus Damm as part of "ARM: shmobile: INTC External IRQ pin driver on r8a7779" but somehow omitted when I applied that patch.

---
 arch/arm/mach-shmobile/board-marzen.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/mach-shmobile/board-marzen.c +2 -1
index fac9e0f..71f174e 100644
@@ -69,7 +69,7 @@ static struct resource smsc911x_resources[] = {
 		.flags		= IORESOURCE_MEM,
 	},
 	[1] = {
-		.start		= gic_iid(0x3c), /* IRQ 1 */
+		.start		= irq_pin(1), /* IRQ 1 */
 		.flags		= IORESOURCE_IRQ,
 	},
 };
@@ -405,6 +405,7 @@ static void __init marzen_init(void)
 	pinctrl_register_mappings(marzen_pinctrl_map,
 				  ARRAY_SIZE(marzen_pinctrl_map));
 	r8a7779_pinmux_init();
+	r8a7779_init_irq_extpin(1); /* IRQ1 as individual interrupt */
 
 	r8a7779_add_standard_devices();
 	platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices));
Signature · 1 line
1.8.2.1
#14 lore raw

PATCH 10/11 ARM: shmobile: bockw: add SDHI0 support

In reply to Simon Horman

From: Kuninori Morimoto <[email protected]>

This patch is directly accessing to PUPR4 register which can control SDHI0 CD/WP pin pull-up setting.
It should be replaced in the future.

---
 arch/arm/mach-shmobile/board-bockw.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
arch/arm/mach-shmobile/board-bockw.c +29 -0
index 4d65715..2b6103e 100644
@@ -18,6 +18,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <linux/mfd/tmio.h>
+#include <linux/mmc/host.h>
 #include <linux/pinctrl/machine.h>
 #include <linux/platform_device.h>
 #include <linux/regulator/fixed.h>
@@ -54,16 +56,28 @@ static struct resource smsc911x_resources[] = {
 	DEFINE_RES_IRQ(irq_pin(0)), /* IRQ 0 */
 };
 
+/* SDHI */
+static struct sh_mobile_sdhi_info sdhi0_info = {
+	.tmio_caps	= MMC_CAP_SD_HIGHSPEED,
+	.tmio_ocr_mask	= MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
+	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT,
+};
+
 static const struct pinctrl_map bockw_pinctrl_map[] = {
 	/* SCIF0 */
 	PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.0", "pfc-r8a7778",
 				  "scif0_data_a", "scif0"),
 	PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.0", "pfc-r8a7778",
 				  "scif0_ctrl", "scif0"),
+	/* SDHI0 */
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778",
+				  "sdhi0", "sdhi0"),
 };
 
 #define FPGA	0x18200000
 #define IRQ0MR	0x30
+#define PFC	0xfffc0000
+#define PUPR4	0x110
 static void __init bockw_init(void)
 {
 	void __iomem *base;
@@ -76,6 +90,7 @@ static void __init bockw_init(void)
 				  ARRAY_SIZE(bockw_pinctrl_map));
 	r8a7778_pinmux_init();
 
+	/* for SMSC */
 	base = ioremap_nocache(FPGA, SZ_1M);
 	if (base) {
 		/*
@@ -98,6 +113,20 @@ static void __init bockw_init(void)
 			smsc911x_resources, ARRAY_SIZE(smsc911x_resources),
 			&smsc911x_data, sizeof(smsc911x_data));
 	}
+
+	/* for SDHI */
+	base = ioremap_nocache(PFC, 0x200);
+	if (base) {
+		/*
+		 * FIXME
+		 *
+		 * SDHI CD/WP pin needs pull-up
+		 */
+		iowrite32(ioread32(base + PUPR4) | (3 << 26), base + PUPR4);
+		iounmap(base);
+
+		r8a7778_sdhi_init(0, &sdhi0_info);
+	}
 }
 
 static const char *bockw_boards_compat_dt[] __initdata = {
Signature · 1 line
1.8.2.1
#15 lore raw

PATCH 11/11 ARM: shmobile: marzen: keep local function as static

In reply to Simon Horman

From: Kuninori Morimoto <[email protected]>

marzen_init_late() should be static

---
 arch/arm/mach-shmobile/board-marzen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-shmobile/board-marzen.c +1 -1
index 71f174e..9b5ed7e 100644
@@ -350,7 +350,7 @@ static struct platform_device *marzen_late_devices[] __initdata = {
 	&ohci1_device,
 };
 
-void __init marzen_init_late(void)
+static void __init marzen_init_late(void)
 {
 	/* get usb phy */
 	phy = usb_get_phy(USB_PHY_TYPE_USB2);
Signature · 1 line
1.8.2.1