Skip to contentSkip to conversation

serial: sh-sci: Add OF support

PATCH Applied Bastian Hecht 5 participants 22 messages Feb 26, 2013 – Mar 5, 2013

Subsystems (6)

v3 of 6 Applied Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/3 serial: sh-sci: Add OF support

We add the capabilty to probe Renesas SCI devices using Device Tree setup.

---
v3:
- add remaining register layouts to bindings
- remove register set mapping sci_regtype_modes[]
- adapt renesas,regtype probing

- add enums SCBRR_ALGO_INVALID and SCBRR_NR_ALGOS
- check renesas,scbrr-algo-id boundaries using new enums

 .../bindings/tty/serial/renesas,sci-serial.txt     |   53 ++++++++
 drivers/tty/serial/sh-sci.c                        |  126 +++++++++++++++++++-
 include/linux/serial_sci.h                         |    4 +
 3 files changed, 179 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/tty/serial/renesas,sci-serial.txt
Documentation/devicetree/bindings/tty/serial/renesas,sci-serial.txt new file +53 -0
new file mode 100644
index 0000000..6ad1adf
@@ -0,0 +1,53 @@
+* Renesas SH-Mobile Serial Communication Interface
+
+Required properties:
+- compatible : Should be "renesas,sci-<port type>-uart", where <port type> may be
+  SCI, SCIF, IRDA, SCIFA or SCIFB.
+- reg : Address and length of the register set for the device
+- interrupts : Should contain the following IRQs: ERI, RXI, TXI and BRI.
+- cell-index : The device id.
+- renesas,scscr : Should contain a bitfield used by the Serial Control Register.
+  b7 = SCSCR_TIE
+  b6 = SCSCR_RIE
+  b5 = SCSCR_TE
+  b4 = SCSCR_RE
+  b3 = SCSCR_REIE
+  b2 = SCSCR_TOIE
+  b1 = SCSCR_CKE1
+  b0 = SCSCR_CKE0
+- renesas,scbrr-algo-id : Algorithm ID for the Bit Rate Register
+  1 = SCBRR_ALGO_1 ((clk + 16 * bps) / (16 * bps) - 1)
+  2 = SCBRR_ALGO_2 ((clk + 16 * bps) / (32 * bps) - 1)
+  3 = SCBRR_ALGO_3 (((clk * 2) + 16 * bps) / (16 * bps) - 1)
+  4 = SCBRR_ALGO_4 (((clk * 2) + 16 * bps) / (32 * bps) - 1)
+  5 = SCBRR_ALGO_5 (((clk * 1000 / 32) / bps) - 1)
+
+Optional properties:
+- renesas,autoconf : Set if device is capable of auto configuration
+- renesas,regtype : Overwrite the register layout. In most cases you can rely
+  on auto-probing (omit this property or set to 0) but some legacy devices
+  use a non-default register layout. Possible layouts are
+  0 = SCIx_PROBE_REGTYPE (default)
+  1 = SCIx_SCI_REGTYPE
+  2 = SCIx_IRDA_REGTYPE
+  3 = SCIx_SCIFA_REGTYPE
+  4 = SCIx_SCIFB_REGTYPE
+  5 = SCIx_SH2_SCIF_FIFODATA_REGTYPE
+  6 = SCIx_SH3_SCIF_REGTYPE
+  7 = SCIx_SH4_SCIF_REGTYPE
+  8 = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE
+  9 = SCIx_SH4_SCIF_FIFODATA_REGTYPE
+ 10 = SCIx_SH7705_SCIF_REGTYPE
+
+
+Example:
+	sci@0xe6c50000 {
+		compatible = "renesas,sci-SCIFA-uart";
+		interrupt-parent = <&intca>;
+		reg = <0xe6c50000 0x100>;
+		interrupts = <0x0c20>, <0x0c20>, <0x0c20>, <0x0c20>;
+		cell-index = <1>;
+		renesas,scscr = <0x30>;
+		renesas,scbrr-algo-id = <4>;
+		renesas,autoconf;
+	};
drivers/tty/serial/sh-sci.c +122 -4

152 lines not on this page · raw message

include/linux/serial_sci.h +4 -0
index eb763ad..857eec4 100644
@@ -11,11 +11,15 @@
 #define SCIx_NOT_SUPPORTED	(-1)
 
 enum {
+	SCBRR_ALGO_INVALID,
+
 	SCBRR_ALGO_1,		/* ((clk + 16 * bps) / (16 * bps) - 1) */
 	SCBRR_ALGO_2,		/* ((clk + 16 * bps) / (32 * bps) - 1) */
 	SCBRR_ALGO_3,		/* (((clk * 2) + 16 * bps) / (16 * bps) - 1) */
 	SCBRR_ALGO_4,		/* (((clk * 2) + 16 * bps) / (32 * bps) - 1) */
 	SCBRR_ALGO_5,		/* (((clk * 1000 / 32) / bps) - 1) */
+
+	SCBRR_NR_ALGOS,
 };
 
 #define SCSCR_TIE	(1 << 7)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v3 2/3 ARM: mach-shmobile: r8a7740: Add DT names to clock list

This adds temporarily the alternative device names to the clock list that are used when booting via Device Tree setup.

---
v3:
no changes

 arch/arm/mach-shmobile/clock-r8a7740.c |    9 +++++++++
 1 file changed, 9 insertions(+)
arch/arm/mach-shmobile/clock-r8a7740.c +9 -0
index 71fc400..0f77823 100644
@@ -593,18 +593,27 @@ static struct clk_lookup lookups[] = {
 	CLKDEV_DEV_ID("sh_mobile_ceu.1",	&mstp_clks[MSTP128]),
 
 	CLKDEV_DEV_ID("sh-sci.4",		&mstp_clks[MSTP200]),
+	CLKDEV_DEV_ID("e6c80000.sci",		&mstp_clks[MSTP200]),
 	CLKDEV_DEV_ID("sh-sci.3",		&mstp_clks[MSTP201]),
+	CLKDEV_DEV_ID("e6c70000.sci",		&mstp_clks[MSTP201]),
 	CLKDEV_DEV_ID("sh-sci.2",		&mstp_clks[MSTP202]),
+	CLKDEV_DEV_ID("e6c60000.sci",		&mstp_clks[MSTP202]),
 	CLKDEV_DEV_ID("sh-sci.1",		&mstp_clks[MSTP203]),
+	CLKDEV_DEV_ID("e6c50000.sci",		&mstp_clks[MSTP203]),
 	CLKDEV_DEV_ID("sh-sci.0",		&mstp_clks[MSTP204]),
+	CLKDEV_DEV_ID("e6c40000.sci",		&mstp_clks[MSTP204]),
 	CLKDEV_DEV_ID("sh-sci.8",		&mstp_clks[MSTP206]),
+	CLKDEV_DEV_ID("e6c30000.sci",		&mstp_clks[MSTP206]),
 	CLKDEV_DEV_ID("sh-sci.5",		&mstp_clks[MSTP207]),
+	CLKDEV_DEV_ID("e6cb0000.sci",		&mstp_clks[MSTP207]),
 	CLKDEV_DEV_ID("sh-dma-engine.3",	&mstp_clks[MSTP214]),
 	CLKDEV_DEV_ID("sh-dma-engine.2",	&mstp_clks[MSTP216]),
 	CLKDEV_DEV_ID("sh-dma-engine.1",	&mstp_clks[MSTP217]),
 	CLKDEV_DEV_ID("sh-dma-engine.0",	&mstp_clks[MSTP218]),
 	CLKDEV_DEV_ID("sh-sci.7",		&mstp_clks[MSTP222]),
+	CLKDEV_DEV_ID("e6cd0000.sci",		&mstp_clks[MSTP222]),
 	CLKDEV_DEV_ID("sh-sci.6",		&mstp_clks[MSTP230]),
+	CLKDEV_DEV_ID("e6cc0000.sci",		&mstp_clks[MSTP230]),
 
 	CLKDEV_DEV_ID("sh_cmt.10",		&mstp_clks[MSTP329]),
 	CLKDEV_DEV_ID("sh_fsi2",		&mstp_clks[MSTP328]),
Signature · 1 line
1.7.9.5
Applied
#2 lore raw

Re: [PATCH v3 2/3] ARM: mach-shmobile: r8a7740: Add DT names to clock list

Quoted 2 lines · Bastian Hecht

This adds temporarily the alternative device names to the clock list that are used when booting via Device Tree setup.

Thanks, applied to the soc5 branch of the renesas tree and thus included in its next branch and queued up for v3.10.

Quoted 48 lines

---
v3:
no changes

 arch/arm/mach-shmobile/clock-r8a7740.c |    9 +++++++++
 1 file changed, 9 insertions(+)
arch/arm/mach-shmobile/clock-r8a7740.c +9 -0
index 71fc400..0f77823 100644
@@ -593,18 +593,27 @@ static struct clk_lookup lookups[] = {
 	CLKDEV_DEV_ID("sh_mobile_ceu.1",	&mstp_clks[MSTP128]),
 
 	CLKDEV_DEV_ID("sh-sci.4",		&mstp_clks[MSTP200]),
+	CLKDEV_DEV_ID("e6c80000.sci",		&mstp_clks[MSTP200]),
 	CLKDEV_DEV_ID("sh-sci.3",		&mstp_clks[MSTP201]),
+	CLKDEV_DEV_ID("e6c70000.sci",		&mstp_clks[MSTP201]),
 	CLKDEV_DEV_ID("sh-sci.2",		&mstp_clks[MSTP202]),
+	CLKDEV_DEV_ID("e6c60000.sci",		&mstp_clks[MSTP202]),
 	CLKDEV_DEV_ID("sh-sci.1",		&mstp_clks[MSTP203]),
+	CLKDEV_DEV_ID("e6c50000.sci",		&mstp_clks[MSTP203]),
 	CLKDEV_DEV_ID("sh-sci.0",		&mstp_clks[MSTP204]),
+	CLKDEV_DEV_ID("e6c40000.sci",		&mstp_clks[MSTP204]),
 	CLKDEV_DEV_ID("sh-sci.8",		&mstp_clks[MSTP206]),
+	CLKDEV_DEV_ID("e6c30000.sci",		&mstp_clks[MSTP206]),
 	CLKDEV_DEV_ID("sh-sci.5",		&mstp_clks[MSTP207]),
+	CLKDEV_DEV_ID("e6cb0000.sci",		&mstp_clks[MSTP207]),
 	CLKDEV_DEV_ID("sh-dma-engine.3",	&mstp_clks[MSTP214]),
 	CLKDEV_DEV_ID("sh-dma-engine.2",	&mstp_clks[MSTP216]),
 	CLKDEV_DEV_ID("sh-dma-engine.1",	&mstp_clks[MSTP217]),
 	CLKDEV_DEV_ID("sh-dma-engine.0",	&mstp_clks[MSTP218]),
 	CLKDEV_DEV_ID("sh-sci.7",		&mstp_clks[MSTP222]),
+	CLKDEV_DEV_ID("e6cd0000.sci",		&mstp_clks[MSTP222]),
 	CLKDEV_DEV_ID("sh-sci.6",		&mstp_clks[MSTP230]),
+	CLKDEV_DEV_ID("e6cc0000.sci",		&mstp_clks[MSTP230]),
 
 	CLKDEV_DEV_ID("sh_cmt.10",		&mstp_clks[MSTP329]),
 	CLKDEV_DEV_ID("sh_fsi2",		&mstp_clks[MSTP328]),
Signature · 6 lines
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw

PATCH v3 3/3 ARM: mach-shmobile: r8a7740: Setup the serial devices using DT

In reply to Bastian Hecht

We can now use the Device Tree for bringing up our serial devices. We need to add an alternative early_devices list in setup-r8a7740 without the serial devices and move them into the Armadillo-reference .dts config file.

---
v3:
no changes

 .../boot/dts/r8a7740-armadillo800eva-reference.dts |   94 ++++++++++++++++++++
 arch/arm/mach-shmobile/setup-r8a7740.c             |   15 +++-
 2 files changed, 105 insertions(+), 4 deletions(-)
arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts +94 -0
index 1e339cd..52645b6 100644
@@ -134,6 +134,100 @@
 		renesas,pins = "eth_base";
 		renesas,function = "eth";
 	};
+
+	sci@0xe6c40000 {
+		compatible = "renesas,sci-SCIFA-uart";
+		interrupt-parent = <&intca>;
+		reg = <0xe6c40000 0x100>;
+		interrupts = <0x0c00>, <0x0c00>, <0x0c00>, <0x0c00>;
+		cell-index = <0>;
+		renesas,scscr = <0x30>;
+		renesas,scbrr-algo-id = <4>;
+		renesas,autoconf;
+	};
+
+	sci@0xe6c50000 {
+		compatible = "renesas,sci-SCIFA-uart";
+		interrupt-parent = <&intca>;
+		reg = <0xe6c50000 0x100>;
+		interrupts = <0x0c20>, <0x0c20>, <0x0c20>, <0x0c20>;
+		cell-index = <1>;
+		renesas,scscr = <0x30>;
+		renesas,scbrr-algo-id = <4>;
+		renesas,autoconf;
+	};
+
+	sci@0xe6c60000 {
+		compatible = "renesas,sci-SCIFA-uart";
+		interrupt-parent = <&intca>;
+		reg = <0xe6c60000 0x100>;
+		interrupts = <0x0c40>, <0x0c40>, <0x0c40>, <0x0c40>;
+		cell-index = <2>;
+		renesas,scscr = <0x30>;
+		renesas,scbrr-algo-id = <4>;
+		renesas,autoconf;
+	};
+
+	sci@0xe6c70000 {
+		compatible = "renesas,sci-SCIFA-uart";
+		interrupt-parent = <&intca>;
+		reg = <0xe6c70000 0x100>;
+		interrupts = <0x0c60>, <0x0c60>, <0x0c60>, <0x0c60>;
+		cell-index = <3>;
+		renesas,scscr = <0x30>;
+		renesas,scbrr-algo-id = <4>;
+		renesas,autoconf;
+	};
+	sci@0xe6c80000 {
+		compatible = "renesas,sci-SCIFA-uart";
+		interrupt-parent = <&intca>;
+		reg = <0xe6c80000 0x100>;
+		interrupts = <0x0d20>, <0x0d20>, <0x0d20>, <0x0d20>;
+		cell-index = <4>;
+		renesas,scscr = <0x30>;
+		renesas,scbrr-algo-id = <4>;
+		renesas,autoconf;
+	};
+	sci@0xe6cb0000 {
+		compatible = "renesas,sci-SCIFA-uart";
+		interrupt-parent = <&intca>;
+		reg = <0xe6cb0000 0x100>;
+		interrupts = <0x0d40>, <0x0d40>, <0x0d40>, <0x0d40>;
+		cell-index = <5>;
+		renesas,scscr = <0x30>;
+		renesas,scbrr-algo-id = <4>;
+		renesas,autoconf;
+	};
+	sci@0xe6cc0000 {
+		compatible = "renesas,sci-SCIFA-uart";
+		interrupt-parent = <&intca>;
+		reg = <0xe6cc0000 0x100>;
+		interrupts = <0x04c0>, <0x04c0>, <0x04c0>, <0x04c0>;
+		cell-index = <6>;
+		renesas,scscr = <0x30>;
+		renesas,scbrr-algo-id = <4>;
+		renesas,autoconf;
+	};
+	sci@0xe6cd0000 {
+		compatible = "renesas,sci-SCIFA-uart";
+		interrupt-parent = <&intca>;
+		reg = <0xe6cd0000 0x100>;
+		interrupts = <0x04e0>, <0x04e0>, <0x04e0>, <0x04e0>;
+		cell-index = <7>;
+		renesas,scscr = <0x30>;
+		renesas,scbrr-algo-id = <4>;
+		renesas,autoconf;
+	};
+	sci@0xe6c30000 {
+		compatible = "renesas,sci-SCIFB-uart";
+		interrupt-parent = <&intca>;
+		reg = <0xe6c30000 0x100>;
+		interrupts = <0x0d60>, <0x0d60>, <0x0d60>, <0x0d60>;
+		cell-index = <8>;
+		renesas,scscr = <0x30>;
+		renesas,scbrr-algo-id = <4>;
+		renesas,autoconf;
+	};
 };
 
 &gpio {
arch/arm/mach-shmobile/setup-r8a7740.c +11 -4
index 5312aad..5f7597a 100644
@@ -394,6 +394,13 @@ static struct platform_device *r8a7740_early_devices[] __initdata = {
 	&tmu02_device,
 };
 
+static struct platform_device *r8a7740_early_devices_dt[] __initdata = {
+	&cmt10_device,
+	&tmu00_device,
+	&tmu01_device,
+	&tmu02_device,
+};
+
 /* DMA */
 static const struct sh_dmae_slave_config r8a7740_dmae_slaves[] = {
 	{
@@ -839,8 +846,8 @@ void __init r8a7740_add_early_devices_dt(void)
 {
 	shmobile_setup_delay(800, 1, 3); /* Cortex-A9 @ 800MHz */
 
-	early_platform_add_devices(r8a7740_early_devices,
-				   ARRAY_SIZE(r8a7740_early_devices));
+	early_platform_add_devices(r8a7740_early_devices_dt,
+				   ARRAY_SIZE(r8a7740_early_devices_dt));
 
 	/* setup early console here as well */
 	shmobile_setup_console();
@@ -852,8 +859,8 @@ static const struct of_dev_auxdata r8a7740_auxdata_lookup[] __initconst = {
 
 void __init r8a7740_add_standard_devices_dt(void)
 {
-	platform_add_devices(r8a7740_early_devices,
-			    ARRAY_SIZE(r8a7740_early_devices));
+	platform_add_devices(r8a7740_early_devices_dt,
+			    ARRAY_SIZE(r8a7740_early_devices_dt));
 
 	of_platform_populate(NULL, of_default_bus_match_table,
 			     r8a7740_auxdata_lookup, NULL);
Signature · 1 line
1.7.9.5
#4 lore raw

Re: [PATCH v3 3/3] ARM: mach-shmobile: r8a7740: Setup the serial devices using DT

Quoted 3 lines · Bastian Hecht

We can now use the Device Tree for bringing up our serial devices. We need to add an alternative early_devices list in setup-r8a7740 without the serial devices and move them into the Armadillo-reference .dts config file.

Hi Bastian,

could you please refresh this patch on top of the current topic/intc-of. In particular, it conflicts with changes made by:

ARM: shmobile: r8a7740: Do not use early devices with DT reference

#5 lore raw

Re: [PATCH v3 3/3] ARM: mach-shmobile: r8a7740: Setup the serial devices using DT

2013/3/1 Simon Horman <[email protected]>:

Quoted 11 lines · Bastian Hecht
Quoted 3 lines

We can now use the Device Tree for bringing up our serial devices. We need to add an alternative early_devices list in setup-r8a7740 without the serial devices and move them into the Armadillo-reference .dts config file.

Hi Bastian,

could you please refresh this patch on top of the current topic/intc-of. In particular, it conflicts with changes made by:

ARM: shmobile: r8a7740: Do not use early devices with DT reference

Sure.

I've prepared the patch - but I start to wonder if the DT specification for the SCIF devices should go into r8a7740.dtsi rather than r8a7740-armadillo-reference.dts. So far it's included in setup-r8a7740.c and not in the board code - that's a strong indication for it, no?
I want to post a patchset for the CMT timer soon. There it's the same.

Cheers,

Bastian

#6 lore raw

Re: [PATCH v3 3/3] ARM: mach-shmobile: r8a7740: Setup the serial devices using DT

Quoted 13 lines · Bastian Hecht

2013/3/1 Simon Horman <[email protected]>:

Quoted 11 lines · Bastian Hecht
Quoted 3 lines

We can now use the Device Tree for bringing up our serial devices. We need to add an alternative early_devices list in setup-r8a7740 without the serial devices and move them into the Armadillo-reference .dts config file.

Hi Bastian,

could you please refresh this patch on top of the current topic/intc-of. In particular, it conflicts with changes made by:

ARM: shmobile: r8a7740: Do not use early devices with DT reference

Quoted 7 lines

Sure.

I've prepared the patch - but I start to wonder if the DT specification for the SCIF devices should go into r8a7740.dtsi rather than r8a7740-armadillo-reference.dts. So far it's included in setup-r8a7740.c and not in the board code - that's a strong indication for it, no?

I forget exactly how the discussion went, but for the kzm9g the SDHI has ended up in the dts file for the board not the sh73a0 SoC.

So I assume that r8a7740-armadillo-reference.dts is the correct place for SDHI on the armadillo.

Magnus, can you confirm that SDHI belongs to the board not the SoC?

Quoted 1 line

I want to post a patchset for the CMT timer soon. There it's the same.

Magnus, could you also let us know if CMT should go in the board or SoC dts?

maintainer
#7 lore raw

Re: [PATCH v3 3/3] ARM: mach-shmobile: r8a7740: Setup the serial devices using DT

Hi Simon,

[Added Guennadi to CC]

Quoted 22 lines · Simon Horman
Quoted 13 lines · Bastian Hecht

2013/3/1 Simon Horman <[email protected]>:

Quoted 11 lines · Bastian Hecht
Quoted 3 lines

We can now use the Device Tree for bringing up our serial devices. We need to add an alternative early_devices list in setup-r8a7740 without the serial devices and move them into the Armadillo-reference .dts config file.

Hi Bastian,

could you please refresh this patch on top of the current topic/intc-of. In particular, it conflicts with changes made by:

ARM: shmobile: r8a7740: Do not use early devices with DT reference

Quoted 7 lines

Sure.

I've prepared the patch - but I start to wonder if the DT specification for the SCIF devices should go into r8a7740.dtsi rather than r8a7740-armadillo-reference.dts. So far it's included in setup-r8a7740.c and not in the board code - that's a strong indication for it, no?

Quoted 7 lines

I forget exactly how the discussion went, but for the kzm9g the SDHI has ended up in the dts file for the board not the sh73a0 SoC.

So I assume that r8a7740-armadillo-reference.dts is the correct place for SDHI on the armadillo.

Magnus, can you confirm that SDHI belongs to the board not the SoC?

What does the data sheet say?

The SDHI hardware block is included in the SoC. It may however need some board specific configuration. I believe the correct way is to define the common parts in the SoC-specific dtsi file and add board-specific configuration in the board-specific dts file. Perhaps you can consult Guennadi about this, he has been tasked with SDHI and MMCIF.

Quoted 3 lines
Quoted 1 line

I want to post a patchset for the CMT timer soon. There it's the same.

Magnus, could you also let us know if CMT should go in the board or SoC dts?

In the SoC. As a general rule, if there is a platform device in setup-nnnn.c then the device does not need any board specific configuration. Such devices should be put in the SoC-specific dtsi file.

Thanks,

/ magnus

#8 lore raw

Re: [PATCH v3 3/3] ARM: mach-shmobile: r8a7740: Setup the serial devices using DT

Hi

Quoted 35 lines · Magnus Damm

Hi Simon,

[Added Guennadi to CC]

Quoted 22 lines · Simon Horman
Quoted 13 lines · Bastian Hecht

2013/3/1 Simon Horman <[email protected]>:

Quoted 11 lines · Bastian Hecht
Quoted 3 lines

We can now use the Device Tree for bringing up our serial devices. We need to add an alternative early_devices list in setup-r8a7740 without the serial devices and move them into the Armadillo-reference .dts config file.

Hi Bastian,

could you please refresh this patch on top of the current topic/intc-of. In particular, it conflicts with changes made by:

ARM: shmobile: r8a7740: Do not use early devices with DT reference

Quoted 7 lines

Sure.

I've prepared the patch - but I start to wonder if the DT specification for the SCIF devices should go into r8a7740.dtsi rather than r8a7740-armadillo-reference.dts. So far it's included in setup-r8a7740.c and not in the board code - that's a strong indication for it, no?

Quoted 7 lines

I forget exactly how the discussion went, but for the kzm9g the SDHI has ended up in the dts file for the board not the sh73a0 SoC.

So I assume that r8a7740-armadillo-reference.dts is the correct place for SDHI on the armadillo.

Magnus, can you confirm that SDHI belongs to the board not the SoC?

Quoted 8 lines

What does the data sheet say?

The SDHI hardware block is included in the SoC. It may however need some board specific configuration. I believe the correct way is to define the common parts in the SoC-specific dtsi file and add board-specific configuration in the board-specific dts file. Perhaps you can consult Guennadi about this, he has been tasked with SDHI and MMCIF.

That would be the best, I agree. However, we discussed this already on the example of mmcif, you might remember. I asked what's the difference between extending a DT node (from .dtsi) with additional properties (in a board-specific .dts) using an "&phandle" syntax and a full path? Or are they equivalent? There was no reply, so, for such nodes (MMC/SD) I so far settled with complete nodes in .dts. We do use the "&phandle" syntax for pinctrl function groups, for I2C devices. I used a complete path for CPUFreq... Mostly because other platforms did that too.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#9 lore raw

Re: [PATCH v3 3/3] ARM: mach-shmobile: r8a7740: Setup the serial devices using DT

Quoted 48 lines · Guennadi Liakhovetski

Hi

Quoted 35 lines · Magnus Damm

Hi Simon,

[Added Guennadi to CC]

Quoted 22 lines · Simon Horman
Quoted 13 lines · Bastian Hecht

2013/3/1 Simon Horman <[email protected]>:

Quoted 11 lines · Bastian Hecht
Quoted 3 lines

We can now use the Device Tree for bringing up our serial devices. We need to add an alternative early_devices list in setup-r8a7740 without the serial devices and move them into the Armadillo-reference .dts config file.

Hi Bastian,

could you please refresh this patch on top of the current topic/intc-of. In particular, it conflicts with changes made by:

ARM: shmobile: r8a7740: Do not use early devices with DT reference

Quoted 7 lines

Sure.

I've prepared the patch - but I start to wonder if the DT specification for the SCIF devices should go into r8a7740.dtsi rather than r8a7740-armadillo-reference.dts. So far it's included in setup-r8a7740.c and not in the board code - that's a strong indication for it, no?

Quoted 7 lines

I forget exactly how the discussion went, but for the kzm9g the SDHI has ended up in the dts file for the board not the sh73a0 SoC.

So I assume that r8a7740-armadillo-reference.dts is the correct place for SDHI on the armadillo.

Magnus, can you confirm that SDHI belongs to the board not the SoC?

Quoted 8 lines

What does the data sheet say?

The SDHI hardware block is included in the SoC. It may however need some board specific configuration. I believe the correct way is to define the common parts in the SoC-specific dtsi file and add board-specific configuration in the board-specific dts file. Perhaps you can consult Guennadi about this, he has been tasked with SDHI and MMCIF.

Quoted 8 lines

That would be the best, I agree. However, we discussed this already on the example of mmcif, you might remember. I asked what's the difference between extending a DT node (from .dtsi) with additional properties (in a board-specific .dts) using an "&phandle" syntax and a full path? Or are they equivalent? There was no reply, so, for such nodes (MMC/SD) I so far settled with complete nodes in .dts. We do use the "&phandle" syntax for pinctrl function groups, for I2C devices. I used a complete path for CPUFreq... Mostly because other platforms did that too.

I am confused.

Using phandle syntax we can add a device to an soc's dtsi file and then add extra properties in the board file. This seems to be match the HW well.

What is your alternate suggestion?

#10 lore raw

Re: [PATCH v3 3/3] ARM: mach-shmobile: r8a7740: Setup the serial devices using DT

Hi Simon

Quoted 1 line · Simon Horman

On Mon, Mar 04, 2013 at 02:33:40PM +0100, Guennadi Liakhovetski wrote:

[snip]

Quoted 9 lines
Quoted 8 lines

That would be the best, I agree. However, we discussed this already on the example of mmcif, you might remember. I asked what's the difference between extending a DT node (from .dtsi) with additional properties (in a board-specific .dts) using an "&phandle" syntax and a full path? Or are they equivalent? There was no reply, so, for such nodes (MMC/SD) I so far settled with complete nodes in .dts. We do use the "&phandle" syntax for pinctrl function groups, for I2C devices. I used a complete path for CPUFreq... Mostly because other platforms did that too.

Quoted 6 lines

I am confused.

Using phandle syntax we can add a device to an soc's dtsi file and then add extra properties in the board file. This seems to be match the HW well.

What is your alternate suggestion?

Let me give you examples. In sh73a0-reference.dtsi we define an I2C device #0:

	i2c0: i2c@0xe6820000 {
		#address-cells = <1>;
		#size-cells = <0>;
		compatible = "renesas,rmobile-iic";
		reg = <0xe6820000 0x425>;
		...
	};

Then in sh73a0-kzm9g-reference.dts I can use the phandle syntax to put devices on that I2C bus:

&i2c0 {
	as3711@40 {
		compatible = "ams,as3711";
		reg = <0x40>;
		...
	};
	...
};

This is one possibility. In sh73a0.dtsi we've got

	cpus {
		#address-cells = <1>;
		#size-cells = <0>;

		cpu@0 {
			device_type = "cpu";
			compatible = "arm,cortex-a9";
			reg = <0>;
		};
		...
	};

Now, I can also extend this in sh73a0-kzm9g-reference.dts to add CPUFreq support to CPU0:

	cpus {
		cpu@0 {
			cpu0-supply = <&vdd_dvfs>;
			operating-points = <
				/* kHz  uV */
				1196000 1315000
				 598000 1175000
				 398667 1065000
			>;
			voltage-tolerance = <1>; /* 1% */
		};
	};

Which AFAICS does a similar thing (adds more properties to an existing DT node) but uses a different syntax. Maybe they are completely equivalent, the only difference being, that the former example uses a phandle and the latter a complete path, maybe there are differences, I don't know.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#11 lore raw

Re: [PATCH v3 3/3] ARM: mach-shmobile: r8a7740: Setup the serial devices using DT

Quoted 77 lines · Guennadi Liakhovetski

Hi Simon

Quoted 1 line · Simon Horman

On Mon, Mar 04, 2013 at 02:33:40PM +0100, Guennadi Liakhovetski wrote:

[snip]

Quoted 9 lines
Quoted 8 lines

That would be the best, I agree. However, we discussed this already on the example of mmcif, you might remember. I asked what's the difference between extending a DT node (from .dtsi) with additional properties (in a board-specific .dts) using an "&phandle" syntax and a full path? Or are they equivalent? There was no reply, so, for such nodes (MMC/SD) I so far settled with complete nodes in .dts. We do use the "&phandle" syntax for pinctrl function groups, for I2C devices. I used a complete path for CPUFreq... Mostly because other platforms did that too.

Quoted 6 lines

I am confused.

Using phandle syntax we can add a device to an soc's dtsi file and then add extra properties in the board file. This seems to be match the HW well.

What is your alternate suggestion?

Let me give you examples. In sh73a0-reference.dtsi we define an I2C device #0:

	i2c0: i2c@0xe6820000 {
		#address-cells = <1>;
		#size-cells = <0>;
		compatible = "renesas,rmobile-iic";
		reg = <0xe6820000 0x425>;
		...
	};

Then in sh73a0-kzm9g-reference.dts I can use the phandle syntax to put devices on that I2C bus:

&i2c0 {
	as3711@40 {
		compatible = "ams,as3711";
		reg = <0x40>;
		...
	};
	...
};

This is one possibility. In sh73a0.dtsi we've got

	cpus {
		#address-cells = <1>;
		#size-cells = <0>;

		cpu@0 {
			device_type = "cpu";
			compatible = "arm,cortex-a9";
			reg = <0>;
		};
		...
	};

Now, I can also extend this in sh73a0-kzm9g-reference.dts to add CPUFreq support to CPU0:

	cpus {
		cpu@0 {
			cpu0-supply = <&vdd_dvfs>;
			operating-points = <
				/* kHz  uV */
				1196000 1315000
				 598000 1175000
				 398667 1065000
			>;
			voltage-tolerance = <1>; /* 1% */
		};
	};
Quoted 4 lines

Which AFAICS does a similar thing (adds more properties to an existing DT node) but uses a different syntax. Maybe they are completely equivalent, the only difference being, that the former example uses a phandle and the latter a complete path, maybe there are differences, I don't know.

Interesting. Thanks for the example, I now understand.

To be honest I'm not sure what the answer is.
But if they are both working then I'm not particularly fussed either way.

#12 lore raw

Re: [PATCH v3 3/3] ARM: mach-shmobile: r8a7740: Setup the serial devices using DT

In reply to Magnus Damm

Hi Simon!

2013/3/4 Magnus Damm <[email protected]>:

Quoted 44 lines

Hi Simon,

[Added Guennadi to CC]

Quoted 22 lines · Simon Horman
Quoted 13 lines · Bastian Hecht

2013/3/1 Simon Horman <[email protected]>:

Quoted 11 lines · Bastian Hecht
Quoted 3 lines

We can now use the Device Tree for bringing up our serial devices. We need to add an alternative early_devices list in setup-r8a7740 without the serial devices and move them into the Armadillo-reference .dts config file.

Hi Bastian,

could you please refresh this patch on top of the current topic/intc-of. In particular, it conflicts with changes made by:

ARM: shmobile: r8a7740: Do not use early devices with DT reference

Quoted 7 lines

Sure.

I've prepared the patch - but I start to wonder if the DT specification for the SCIF devices should go into r8a7740.dtsi rather than r8a7740-armadillo-reference.dts. So far it's included in setup-r8a7740.c and not in the board code - that's a strong indication for it, no?

Quoted 7 lines

I forget exactly how the discussion went, but for the kzm9g the SDHI has ended up in the dts file for the board not the sh73a0 SoC.

So I assume that r8a7740-armadillo-reference.dts is the correct place for SDHI on the armadillo.

Magnus, can you confirm that SDHI belongs to the board not the SoC?

What does the data sheet say?

The SDHI hardware block is included in the SoC. It may however need some board specific configuration. I believe the correct way is to define the common parts in the SoC-specific dtsi file and add board-specific configuration in the board-specific dts file. Perhaps you can consult Guennadi about this, he has been tasked with SDHI and MMCIF.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

I want to post a patchset for the CMT timer soon. There it's the same.

Magnus, could you also let us know if CMT should go in the board or SoC dts?

In the SoC. As a general rule, if there is a platform device in setup-nnnn.c then the device does not need any board specific configuration. Such devices should be put in the SoC-specific dtsi file.

Ok I posted a v4 SCIF DT patchset putting the SCIF devices into r8a7740.dtsi.

Simon, are you aware about this in topic/intc-of? It shows up booting the non-DT version.

Unable to handle kernel NULL pointer dereference at virtual address 00000040
pgd = c0004000
[00000040] *pgd=00000000
Internal error: Oops: 5 [#1] ARM
CPU: 0    Not tainted  (3.8.0-rc3-00205-gfb2696a #298)
PC is at __gpio_get_value+0x18/0x5c
LR is at eva_init+0x190/0x544

We should add standard bootargs in the r8a7740-armadillo800eva.dts as well. Shall I post a small patch?

Thanks,

Bastian

Quoted 3 lines

Thanks,

/ magnus

#13 lore raw

Re: [PATCH v3 3/3] ARM: mach-shmobile: r8a7740: Setup the serial devices using DT

Quoted 61 lines · Bastian Hecht

Hi Simon!

2013/3/4 Magnus Damm <[email protected]>:

Quoted 44 lines

Hi Simon,

[Added Guennadi to CC]

Quoted 22 lines · Simon Horman
Quoted 13 lines · Bastian Hecht

2013/3/1 Simon Horman <[email protected]>:

Quoted 11 lines · Bastian Hecht
Quoted 3 lines

We can now use the Device Tree for bringing up our serial devices. We need to add an alternative early_devices list in setup-r8a7740 without the serial devices and move them into the Armadillo-reference .dts config file.

Hi Bastian,

could you please refresh this patch on top of the current topic/intc-of. In particular, it conflicts with changes made by:

ARM: shmobile: r8a7740: Do not use early devices with DT reference

Quoted 7 lines

Sure.

I've prepared the patch - but I start to wonder if the DT specification for the SCIF devices should go into r8a7740.dtsi rather than r8a7740-armadillo-reference.dts. So far it's included in setup-r8a7740.c and not in the board code - that's a strong indication for it, no?

Quoted 7 lines

I forget exactly how the discussion went, but for the kzm9g the SDHI has ended up in the dts file for the board not the sh73a0 SoC.

So I assume that r8a7740-armadillo-reference.dts is the correct place for SDHI on the armadillo.

Magnus, can you confirm that SDHI belongs to the board not the SoC?

What does the data sheet say?

The SDHI hardware block is included in the SoC. It may however need some board specific configuration. I believe the correct way is to define the common parts in the SoC-specific dtsi file and add board-specific configuration in the board-specific dts file. Perhaps you can consult Guennadi about this, he has been tasked with SDHI and MMCIF.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

I want to post a patchset for the CMT timer soon. There it's the same.

Magnus, could you also let us know if CMT should go in the board or SoC dts?

In the SoC. As a general rule, if there is a platform device in setup-nnnn.c then the device does not need any board specific configuration. Such devices should be put in the SoC-specific dtsi file.

Ok I posted a v4 SCIF DT patchset putting the SCIF devices into r8a7740.dtsi.

Simon, are you aware about this in topic/intc-of? It shows up booting the non-DT version.

Quoted 7 lines
Unable to handle kernel NULL pointer dereference at virtual address 00000040
pgd = c0004000
[00000040] *pgd000000
Internal error: Oops: 5 [#1] ARM
CPU: 0    Not tainted  (3.8.0-rc3-00205-gfb2696a #298)
PC is at __gpio_get_value+0x18/0x5c
LR is at eva_init+0x190/0x544

Yes, I am aware of it, it is the reason that topic/intc-of is not included in topic/all+next at the moment.

I believe it is caused by SH pinctl DT support.

http://permalink.gmane.org/gmane.linux.ports.sh.devel/19649

Quoted 2 lines

We should add standard bootargs in the r8a7740-armadillo800eva.dts as well. Shall I post a small patch?

I have applied a patch to do that which should be present in v3.9-rc1.

Now that v3.9-rc1 has been released I will see about rebasing my branches on top of it.

Reviewed-by on v3 1/3
#14 lore raw
In reply to Bastian Hecht
Quoted 9 lines · Bastian Hecht

We add the capabilty to probe Renesas SCI devices using Device Tree setup.

---
v3:
- add remaining register layouts to bindings
- remove register set mapping sci_regtype_modes[]
- adapt renesas,regtype probing

Quoted 9 lines

- add enums SCBRR_ALGO_INVALID and SCBRR_NR_ALGOS
- check renesas,scbrr-algo-id boundaries using new enums

 .../bindings/tty/serial/renesas,sci-serial.txt     |   53 ++++++++
 drivers/tty/serial/sh-sci.c                        |  126 +++++++++++++++++++-
 include/linux/serial_sci.h                         |    4 +
 3 files changed, 179 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/tty/serial/renesas,sci-serial.txt

Looks good to me.

maintainer
#15 lore raw
Quoted 19 lines · Paul Mundt
Quoted 9 lines · Bastian Hecht

We add the capabilty to probe Renesas SCI devices using Device Tree setup.

---
v3:
- add remaining register layouts to bindings
- remove register set mapping sci_regtype_modes[]
- adapt renesas,regtype probing

Quoted 9 lines

- add enums SCBRR_ALGO_INVALID and SCBRR_NR_ALGOS
- check renesas,scbrr-algo-id boundaries using new enums

 .../bindings/tty/serial/renesas,sci-serial.txt     |   53 ++++++++
 drivers/tty/serial/sh-sci.c                        |  126 +++++++++++++++++++-
 include/linux/serial_sci.h                         |    4 +
 3 files changed, 179 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/tty/serial/renesas,sci-serial.txt
Quoted 3 lines

Looks good to me.

Thanks. Do you intend to merge this yourself at some point, or do you have some other preferred way to deal with this?

Cheers,

/ magnus

#16 lore raw
Quoted 20 lines · Magnus Damm
Quoted 19 lines · Paul Mundt
Quoted 18 lines · Bastian Hecht

We add the capabilty to probe Renesas SCI devices using Device Tree setup.

---
v3:
- add remaining register layouts to bindings
- remove register set mapping sci_regtype_modes[]
- adapt renesas,regtype probing

- add enums SCBRR_ALGO_INVALID and SCBRR_NR_ALGOS
- check renesas,scbrr-algo-id boundaries using new enums

 .../bindings/tty/serial/renesas,sci-serial.txt     |   53 ++++++++
 drivers/tty/serial/sh-sci.c                        |  126 +++++++++++++++++++-
 include/linux/serial_sci.h                         |    4 +
 3 files changed, 179 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/tty/serial/renesas,sci-serial.txt
Quoted 7 lines
Quoted 3 lines

Looks good to me.

Thanks. Do you intend to merge this yourself at some point, or do you have some other preferred way to deal with this?

I can merge it if you like, but then obviously the ARM patches will have to wait until that part is upstream. I assumed you would want them all grouped together, at which point I don't mind if it goes through some other tree.

maintainer
#17 lore raw
Quoted 25 lines · Paul Mundt
Quoted 24 lines · Magnus Damm
Quoted 22 lines · Paul Mundt
Quoted 9 lines · Bastian Hecht

We add the capabilty to probe Renesas SCI devices using Device Tree setup.

---
v3:
- add remaining register layouts to bindings
- remove register set mapping sci_regtype_modes[]
- adapt renesas,regtype probing

Quoted 9 lines

- add enums SCBRR_ALGO_INVALID and SCBRR_NR_ALGOS
- check renesas,scbrr-algo-id boundaries using new enums

 .../bindings/tty/serial/renesas,sci-serial.txt     |   53 ++++++++
 drivers/tty/serial/sh-sci.c                        |  126 +++++++++++++++++++-
 include/linux/serial_sci.h                         |    4 +
 3 files changed, 179 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/tty/serial/renesas,sci-serial.txt

Looks good to me.

Quoted 7 lines
Quoted 3 lines

Thanks. Do you intend to merge this yourself at some point, or do you have some other preferred way to deal with this?

I can merge it if you like, but then obviously the ARM patches will have to wait until that part is upstream. I assumed you would want them all grouped together, at which point I don't mind if it goes through some other tree.

[Added Simon as CC]

My personal preference would be that you (Paul) merge this patch by yourself:
[PATCH v3 1/3] serial: sh-sci: Add OF support

I believe we can deal with the SoC bits easily afterwards. Simon may however prefer to deal with it differently.

Simon, how do you prefer to handle merge of DT support for the SCIF driver?

Thanks,

/ magnus

#18 lore raw
Quoted 36 lines · Magnus Damm
Quoted 25 lines · Paul Mundt
Quoted 24 lines · Magnus Damm
Quoted 22 lines · Paul Mundt
Quoted 9 lines · Bastian Hecht

We add the capabilty to probe Renesas SCI devices using Device Tree setup.

---
v3:
- add remaining register layouts to bindings
- remove register set mapping sci_regtype_modes[]
- adapt renesas,regtype probing

Quoted 9 lines

- add enums SCBRR_ALGO_INVALID and SCBRR_NR_ALGOS
- check renesas,scbrr-algo-id boundaries using new enums

 .../bindings/tty/serial/renesas,sci-serial.txt     |   53 ++++++++
 drivers/tty/serial/sh-sci.c                        |  126 +++++++++++++++++++-
 include/linux/serial_sci.h                         |    4 +
 3 files changed, 179 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/tty/serial/renesas,sci-serial.txt

Looks good to me.

Quoted 7 lines
Quoted 3 lines

Thanks. Do you intend to merge this yourself at some point, or do you have some other preferred way to deal with this?

I can merge it if you like, but then obviously the ARM patches will have to wait until that part is upstream. I assumed you would want them all grouped together, at which point I don't mind if it goes through some other tree.

[Added Simon as CC]

Quoted 7 lines

My personal preference would be that you (Paul) merge this patch by yourself:
[PATCH v3 1/3] serial: sh-sci: Add OF support

I believe we can deal with the SoC bits easily afterwards. Simon may however prefer to deal with it differently.

Simon, how do you prefer to handle merge of DT support for the SCIF driver?

I am fairly ambivalent.

If Paul could merge this patch upstream in the v3.9-rc1~rc3 time frame then I can queue up the SoC portions for v3.10.

Or alternatively I can queue up all three patches for v3.10. Either way the outcome should be much the same.

#19 lore raw
Quoted 9 lines · Simon Horman
Quoted 7 lines · Magnus Damm

My personal preference would be that you (Paul) merge this patch by yourself:
[PATCH v3 1/3] serial: sh-sci: Add OF support

I believe we can deal with the SoC bits easily afterwards. Simon may however prefer to deal with it differently.

Simon, how do you prefer to handle merge of DT support for the SCIF driver?

Quoted 7 lines

I am fairly ambivalent.

If Paul could merge this patch upstream in the v3.9-rc1~rc3 time frame then I can queue up the SoC portions for v3.10.

Or alternatively I can queue up all three patches for v3.10. Either way the outcome should be much the same.

Waiting an entire kernel version to throw some arbitrary dts file updates in seems a bit absurd, but I'll let you handle it however you like. I haven't sent out my SH updates to Linus yet, but plan to do so by -rc2 (there isn't really that much to begin with, most of it has gone through other trees), so in light of this I will throw the sh-sci OF patch in to my queue directly then.

#20 lore raw

2013/2/27 Paul Mundt <[email protected]>:

Quoted 18 lines · Simon Horman
Quoted 9 lines · Magnus Damm
Quoted 7 lines

My personal preference would be that you (Paul) merge this patch by yourself:
[PATCH v3 1/3] serial: sh-sci: Add OF support

I believe we can deal with the SoC bits easily afterwards. Simon may however prefer to deal with it differently.

Simon, how do you prefer to handle merge of DT support for the SCIF driver?

Quoted 7 lines

I am fairly ambivalent.

If Paul could merge this patch upstream in the v3.9-rc1~rc3 time frame then I can queue up the SoC portions for v3.10.

Or alternatively I can queue up all three patches for v3.10. Either way the outcome should be much the same.

Quoted 6 lines

Waiting an entire kernel version to throw some arbitrary dts file updates in seems a bit absurd, but I'll let you handle it however you like. I haven't sent out my SH updates to Linus yet, but plan to do so by -rc2 (there isn't really that much to begin with, most of it has gone through other trees), so in light of this I will throw the sh-sci OF patch in to my queue directly then.

Thanks to all involved getting this patch into the mainline.

#21 lore raw
In reply to Paul Mundt
Quoted 18 lines · Paul Mundt
Quoted 9 lines · Simon Horman
Quoted 7 lines · Magnus Damm

My personal preference would be that you (Paul) merge this patch by yourself:
[PATCH v3 1/3] serial: sh-sci: Add OF support

I believe we can deal with the SoC bits easily afterwards. Simon may however prefer to deal with it differently.

Simon, how do you prefer to handle merge of DT support for the SCIF driver?

Quoted 7 lines

I am fairly ambivalent.

If Paul could merge this patch upstream in the v3.9-rc1~rc3 time frame then I can queue up the SoC portions for v3.10.

Or alternatively I can queue up all three patches for v3.10. Either way the outcome should be much the same.

Quoted 6 lines

Waiting an entire kernel version to throw some arbitrary dts file updates in seems a bit absurd, but I'll let you handle it however you like. I haven't sent out my SH updates to Linus yet, but plan to do so by -rc2 (there isn't really that much to begin with, most of it has gone through other trees), so in light of this I will throw the sh-sci OF patch in to my queue directly then.

Thanks, much appreciated.

I entirely agree that my tree has longer lead-times than are desirable.