diff mbox

[3/3] ARM: shmobile: bockw: add SMSC support on DT

Message ID 87txh0yzbj.wl%kuninori.morimoto.gx@renesas.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

Kuninori Morimoto Oct. 2, 2013, 6:14 a.m. UTC
This patch enables SMSC on BockW board via DT.
SMSC interrupt is connected to FPGA, and is connected
to IRQ0 on BockW.
This patch enabled INTC IRQ too

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/arm/boot/dts/r8a7778-bockw-reference.dts  |   27 +++++++++++++++++++++++-
 arch/arm/mach-shmobile/board-bockw-reference.c |   20 ++++++++++++++++++
 2 files changed, 46 insertions(+), 1 deletion(-)

Comments

Simon Horman Oct. 2, 2013, 8:04 a.m. UTC | #1
On Tue, Oct 01, 2013 at 11:14:12PM -0700, Kuninori Morimoto wrote:
> This patch enables SMSC on BockW board via DT.
> SMSC interrupt is connected to FPGA, and is connected
> to IRQ0 on BockW.
> This patch enabled INTC IRQ too
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  arch/arm/boot/dts/r8a7778-bockw-reference.dts  |   27 +++++++++++++++++++++++-
>  arch/arm/mach-shmobile/board-bockw-reference.c |   20 ++++++++++++++++++
>  2 files changed, 46 insertions(+), 1 deletion(-)

Please split this into two patches.

1. A DT patch that modifies r8a7778-bockw-reference.dts
2. A board patch that modifies board-bockw-reference.c

> 
> diff --git a/arch/arm/boot/dts/r8a7778-bockw-reference.dts b/arch/arm/boot/dts/r8a7778-bockw-reference.dts
> index 9bb903a..4425fd2 100644
> --- a/arch/arm/boot/dts/r8a7778-bockw-reference.dts
> +++ b/arch/arm/boot/dts/r8a7778-bockw-reference.dts
> @@ -22,11 +22,36 @@
>  	compatible = "renesas,bockw-reference", "renesas,r8a7778";
>  
>  	chosen {
> -		bootargs = "console=ttySC0,115200 ignore_loglevel rw";
> +		bootargs = "console=ttySC0,115200 ignore_loglevel root=/dev/nfs ip=dhcp rw";
>  	};
>  
>  	memory {
>  		device_type = "memory";
>  		reg = <0x60000000 0x10000000>;
>  	};
> +
> +	fixedregulator3v3: fixedregulator@0 {
> +		compatible = "regulator-fixed";
> +		regulator-name = "fixed-3.3V";
> +		regulator-min-microvolt = <3300000>;
> +		regulator-max-microvolt = <3300000>;
> +		regulator-boot-on;
> +		regulator-always-on;
> +	};
> +
> +	lan0@18300000 {
> +		compatible = "smsc,lan9220", "smsc,lan9115";
> +		reg = <0x18300000 0x1000>;
> +
> +		phy-mode = "mii";
> +		interrupt-parent = <&irqpin>;
> +		interrupts = <0 0>; /* IRQ0: hwirq 0 on irqpin */
> +		reg-io-width = <4>;
> +		vddvario-supply = <&fixedregulator3v3>;
> +		vdd33a-supply = <&fixedregulator3v3>;
> +	};
> +};
> +
> +&irqpin {
> +	status = "okay";
>  };
> diff --git a/arch/arm/mach-shmobile/board-bockw-reference.c b/arch/arm/mach-shmobile/board-bockw-reference.c
> index 1a7c893..ae88fda 100644
> --- a/arch/arm/mach-shmobile/board-bockw-reference.c
> +++ b/arch/arm/mach-shmobile/board-bockw-reference.c
> @@ -36,15 +36,35 @@ static const struct pinctrl_map bockw_pinctrl_map[] = {
>  				  "scif0_ctrl", "scif0"),
>  };
>  
> +#define FPGA	0x18200000
> +#define IRQ0MR	0x30
> +#define COMCTLR	0x101c
>  static void __init bockw_init(void)
>  {
> +	static void __iomem *fpga;
> +
>  	r8a7778_clock_init();
> +	r8a7778_init_irq_extpin_dt(1);
>  
>  	pinctrl_register_mappings(bockw_pinctrl_map,
>  				  ARRAY_SIZE(bockw_pinctrl_map));
>  	r8a7778_pinmux_init();
>  	r8a7778_add_dt_devices();
>  
> +	fpga = ioremap_nocache(FPGA, SZ_1M);
> +	if (fpga) {
> +		/*
> +		 * CAUTION
> +		 *
> +		 * IRQ0/1 is cascaded interrupt from FPGA.
> +		 * it should be cared in the future
> +		 * Now, it is assuming IRQ0 was used only from SMSC.
> +		 */
> +		u16 val = ioread16(fpga + IRQ0MR);
> +		val &= ~(1 << 4); /* enable SMSC911x */
> +		iowrite16(val, fpga + IRQ0MR);
> +	}
> +
>  	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
>  }
>  
> -- 
> 1.7.9.5
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kuninori Morimoto Oct. 2, 2013, 8:06 a.m. UTC | #2
Hi Simon

> > This patch enables SMSC on BockW board via DT.
> > SMSC interrupt is connected to FPGA, and is connected
> > to IRQ0 on BockW.
> > This patch enabled INTC IRQ too
> > 
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > ---
> >  arch/arm/boot/dts/r8a7778-bockw-reference.dts  |   27 +++++++++++++++++++++++-
> >  arch/arm/mach-shmobile/board-bockw-reference.c |   20 ++++++++++++++++++
> >  2 files changed, 46 insertions(+), 1 deletion(-)
> 
> Please split this into two patches.
> 
> 1. A DT patch that modifies r8a7778-bockw-reference.dts
> 2. A board patch that modifies board-bockw-reference.c

OK, will do

Best regards
---
Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov Oct. 3, 2013, 10:21 p.m. UTC | #3
Hello.

On 02-10-2013 8:14, Kuninori Morimoto wrote:

> This patch enables SMSC on BockW board via DT.
> SMSC interrupt is connected to FPGA, and is connected
> to IRQ0 on BockW.
> This patch enabled INTC IRQ too

> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>   arch/arm/boot/dts/r8a7778-bockw-reference.dts  |   27 +++++++++++++++++++++++-
>   arch/arm/mach-shmobile/board-bockw-reference.c |   20 ++++++++++++++++++
>   2 files changed, 46 insertions(+), 1 deletion(-)

> diff --git a/arch/arm/boot/dts/r8a7778-bockw-reference.dts b/arch/arm/boot/dts/r8a7778-bockw-reference.dts
> index 9bb903a..4425fd2 100644
> --- a/arch/arm/boot/dts/r8a7778-bockw-reference.dts
> +++ b/arch/arm/boot/dts/r8a7778-bockw-reference.dts
> @@ -22,11 +22,36 @@
[...]
> +	lan0@18300000 {

    According to the ePAPR spec, the node name should be "ethernet", not "lan0".

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Simon Horman Oct. 3, 2013, 11:56 p.m. UTC | #4
On Fri, Oct 04, 2013 at 12:21:08AM +0200, Sergei Shtylyov wrote:
> Hello.
> 
> On 02-10-2013 8:14, Kuninori Morimoto wrote:
> 
> >This patch enables SMSC on BockW board via DT.
> >SMSC interrupt is connected to FPGA, and is connected
> >to IRQ0 on BockW.
> >This patch enabled INTC IRQ too
> 
> >Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> >---
> >  arch/arm/boot/dts/r8a7778-bockw-reference.dts  |   27 +++++++++++++++++++++++-
> >  arch/arm/mach-shmobile/board-bockw-reference.c |   20 ++++++++++++++++++
> >  2 files changed, 46 insertions(+), 1 deletion(-)
> 
> >diff --git a/arch/arm/boot/dts/r8a7778-bockw-reference.dts b/arch/arm/boot/dts/r8a7778-bockw-reference.dts
> >index 9bb903a..4425fd2 100644
> >--- a/arch/arm/boot/dts/r8a7778-bockw-reference.dts
> >+++ b/arch/arm/boot/dts/r8a7778-bockw-reference.dts
> >@@ -22,11 +22,36 @@
> [...]
> >+	lan0@18300000 {
> 
>    According to the ePAPR spec, the node name should be "ethernet", not "lan0".
> 
> WBR, Sergei

Morimoto-san, Sergei,

could one of you send a follow-up patch to fix this?
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/arm/boot/dts/r8a7778-bockw-reference.dts b/arch/arm/boot/dts/r8a7778-bockw-reference.dts
index 9bb903a..4425fd2 100644
--- a/arch/arm/boot/dts/r8a7778-bockw-reference.dts
+++ b/arch/arm/boot/dts/r8a7778-bockw-reference.dts
@@ -22,11 +22,36 @@ 
 	compatible = "renesas,bockw-reference", "renesas,r8a7778";
 
 	chosen {
-		bootargs = "console=ttySC0,115200 ignore_loglevel rw";
+		bootargs = "console=ttySC0,115200 ignore_loglevel root=/dev/nfs ip=dhcp rw";
 	};
 
 	memory {
 		device_type = "memory";
 		reg = <0x60000000 0x10000000>;
 	};
+
+	fixedregulator3v3: fixedregulator@0 {
+		compatible = "regulator-fixed";
+		regulator-name = "fixed-3.3V";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-boot-on;
+		regulator-always-on;
+	};
+
+	lan0@18300000 {
+		compatible = "smsc,lan9220", "smsc,lan9115";
+		reg = <0x18300000 0x1000>;
+
+		phy-mode = "mii";
+		interrupt-parent = <&irqpin>;
+		interrupts = <0 0>; /* IRQ0: hwirq 0 on irqpin */
+		reg-io-width = <4>;
+		vddvario-supply = <&fixedregulator3v3>;
+		vdd33a-supply = <&fixedregulator3v3>;
+	};
+};
+
+&irqpin {
+	status = "okay";
 };
diff --git a/arch/arm/mach-shmobile/board-bockw-reference.c b/arch/arm/mach-shmobile/board-bockw-reference.c
index 1a7c893..ae88fda 100644
--- a/arch/arm/mach-shmobile/board-bockw-reference.c
+++ b/arch/arm/mach-shmobile/board-bockw-reference.c
@@ -36,15 +36,35 @@  static const struct pinctrl_map bockw_pinctrl_map[] = {
 				  "scif0_ctrl", "scif0"),
 };
 
+#define FPGA	0x18200000
+#define IRQ0MR	0x30
+#define COMCTLR	0x101c
 static void __init bockw_init(void)
 {
+	static void __iomem *fpga;
+
 	r8a7778_clock_init();
+	r8a7778_init_irq_extpin_dt(1);
 
 	pinctrl_register_mappings(bockw_pinctrl_map,
 				  ARRAY_SIZE(bockw_pinctrl_map));
 	r8a7778_pinmux_init();
 	r8a7778_add_dt_devices();
 
+	fpga = ioremap_nocache(FPGA, SZ_1M);
+	if (fpga) {
+		/*
+		 * CAUTION
+		 *
+		 * IRQ0/1 is cascaded interrupt from FPGA.
+		 * it should be cared in the future
+		 * Now, it is assuming IRQ0 was used only from SMSC.
+		 */
+		u16 val = ioread16(fpga + IRQ0MR);
+		val &= ~(1 << 4); /* enable SMSC911x */
+		iowrite16(val, fpga + IRQ0MR);
+	}
+
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }