Skip to contentSkip to conversation

ARM: shmobile: Add SMSC support on Bock-W

PATCH Superseded Kuninori Morimoto 4 participants 26 messages Mar 22, 2013 – Apr 10, 2013

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

cover ARM: shmobile: Add SMSC support on Bock-W

Hi Arnd, Simon, Magnus

These patch set add extpin support on r8a7778,
and enable SMSC ether on Bock-W board

This patch set is based on simon/next + my previous Bock-W patch set

Kuninori Morimoto (3):
ARM: shmobile: define PLATFORM_xxx_INFO()
ARM: shmobile: r8a7778: add r8a7778_init_irq_extpin()
ARM: shmobile: bockw: add SMSC ethernet support

 arch/arm/boot/dts/r8a7778-bockw.dts           |    2 +-
 arch/arm/configs/bockw_defconfig              |   34 ++++++++-
 arch/arm/mach-shmobile/Kconfig                |    1 +
 arch/arm/mach-shmobile/board-bockw.c          |   37 ++++++++++
 arch/arm/mach-shmobile/include/mach/common.h  |   20 ++++++
 arch/arm/mach-shmobile/include/mach/r8a7778.h |    1 +
 arch/arm/mach-shmobile/setup-r8a7778.c        |   92 +++++++++++++++++--------
 7 files changed, 156 insertions(+), 31 deletions(-)

Best regards
---
Kuninori Morimoto

#1 lore raw

RFC PATCH 1/3 ARM: shmobile: define PLATFORM_xxx_INFO()

platform_device_register_xxx() are needed until DT supports of all drivers are completed. This PLATFORM_xxx_INFO() macro is useful for it and is possible to reduce code.
This patch put it ot common.h

---
 arch/arm/mach-shmobile/include/mach/common.h |   20 +++++++++++
 arch/arm/mach-shmobile/setup-r8a7778.c       |   48 +++++++++++---------------
 2 files changed, 41 insertions(+), 27 deletions(-)
arch/arm/mach-shmobile/include/mach/common.h +20 -0
index 03f73de..6a066a3 100644
@@ -94,4 +94,24 @@ static inline void __init shmobile_init_late(void)
 	shmobile_cpuidle_init();
 }
 
+#define PLATFORM_FULL_INFO(n, i, m)			\
+{							\
+	.parent		= &platform_bus,		\
+	.name		= n,				\
+	.id		= i,				\
+	.res		= m ## _resources,		\
+	.num_res	= ARRAY_SIZE(m ##_resources),	\
+	.data		= &m ##_platform_data,		\
+	.size_data	= sizeof(m ## _platform_data),	\
+}
+
+#define PLATFORM_DATA_INFO(n, i, m)			\
+{							\
+	.parent		= &platform_bus,		\
+	.name		= n,				\
+	.id		= i,				\
+	.data		= &m ##_platform_data,		\
+	.size_data	= sizeof(m ## _platform_data),	\
+}
+
 #endif /* __ARCH_MACH_COMMON_H */
arch/arm/mach-shmobile/setup-r8a7778.c +21 -27

66 lines not on this page · raw message

Signature · 1 line
1.7.9.5
maintainer
#2 lore raw

RFC PATCH 1/3 ARM: shmobile: define PLATFORM_xxx_INFO()

Hi Morimoto-san,

Thanks for your patch. Good to see that you're adding support for external IRQs and the SMSC chip. I would like to merge the actual hardware support code right away, but it I have some comments on this patch and I believe you will have to rework patches and resend. Please see below for more information.

Quoted 11 lines · Kuninori Morimoto

platform_device_register_xxx() are needed until DT supports of all drivers are completed. This PLATFORM_xxx_INFO() macro is useful for it and is possible to reduce code.
This patch put it ot common.h

---
 arch/arm/mach-shmobile/include/mach/common.h |   20 +++++++++++
 arch/arm/mach-shmobile/setup-r8a7778.c       |   48 +++++++++++---------------
 2 files changed, 41 insertions(+), 27 deletions(-)

Uhm, there is a certain contradiction between your change log message and the diffstat. =)

This patch is actually adding lines of code instead of saving lines, no?

Quoted 17 lines
arch/arm/mach-shmobile/include/mach/common.h +9 -0
index 03f73de..6a066a3 100644
@@ -94,4 +94,24 @@ static inline void __init shmobile_init_late(void)
        shmobile_cpuidle_init();
 }
 
+#define PLATFORM_FULL_INFO(n, i, m)                    \
+{                                                      \
+       .parent         = &platform_bus,                \
+       .name           = n,                            \
+       .id             = i,                            \
+       .res            = m ## _resources,              \
+       .num_res        = ARRAY_SIZE(m ##_resources),   \
+       .data           = &m ##_platform_data,          \
+       .size_data      = sizeof(m ## _platform_data),  \

arch/arm/mach-shmobile/include/mach/common.h static inline void __init shmobile_init_late(void) · line 115

Quoted 10 lines
arch/arm/mach-shmobile/include/mach/common.h +10 -0
+}
+
+#define PLATFORM_DATA_INFO(n, i, m)                    \
+{                                                      \
+       .parent         = &platform_bus,                \
+       .name           = n,                            \
+       .id             = i,                            \
+       .data           = &m ##_platform_data,          \
+       .size_data      = sizeof(m ## _platform_data),  \
+}

Thanks for trying to improve the situation, but I must confess that I don't like this. Basically, if you want to improve something related to platform device registration then this must to happen on a higher level like for instance modifying the generic platform device registration code base. So making this optimization in mach-shmobile/include/mach/common.h will just lead to mach-shmobile including special non-standard code that becomes difficult to read for people. There is no point in being special.

Quoted 19 lines
arch/arm/mach-shmobile/include/mach/common.h +0 -0
 #endif /* __ARCH_MACH_COMMON_H */
arch/arm/mach-shmobile/setup-r8a7778.c +2 -8
index 01c62be..45a1a53 100644
@@ -44,14 +44,18 @@
        .irqs           = SCIx_IRQ_MUXED(irq),                  \
 }
 
-static struct plat_sci_port scif_platform_data[] = {
-       SCIF_INFO(0xffe40000, gic_iid(0x66)),
-       SCIF_INFO(0xffe41000, gic_iid(0x67)),
-       SCIF_INFO(0xffe42000, gic_iid(0x68)),
-       SCIF_INFO(0xffe43000, gic_iid(0x69)),
-       SCIF_INFO(0xffe44000, gic_iid(0x6a)),
-       SCIF_INFO(0xffe45000, gic_iid(0x6b)),
-};
+static struct plat_sci_port scif0_platform_data =
+       SCIF_INFO(0xffe40000, gic_iid(0x66));

arch/arm/mach-shmobile/setup-r8a7778.c line 58

Quoted 10 lines
arch/arm/mach-shmobile/setup-r8a7778.c +10 -0
+static struct plat_sci_port scif1_platform_data =
+       SCIF_INFO(0xffe41000, gic_iid(0x67));
+static struct plat_sci_port scif2_platform_data =
+       SCIF_INFO(0xffe42000, gic_iid(0x68));
+static struct plat_sci_port scif3_platform_data =
+       SCIF_INFO(0xffe43000, gic_iid(0x69));
+static struct plat_sci_port scif4_platform_data =
+       SCIF_INFO(0xffe44000, gic_iid(0x6a));
+static struct plat_sci_port scif5_platform_data =
+       SCIF_INFO(0xffe45000, gic_iid(0x6b));

As you notice, these lines above increase the number of lines of code in this file. I prefer first of all being standard, and after that going the other direction to asmaller code base. =)

arch/arm/mach-shmobile/setup-r8a7778.c void __init r8a7778_add_standard_devices(void) · line 112

Quoted 7 lines
arch/arm/mach-shmobile/setup-r8a7778.c +0 -5
-       for (i = 0; i < ARRAY_SIZE(scif_platform_data); i++)
-               platform_device_register_data(&platform_bus, "sh-sci", i,
-                                             &scif_platform_data[i],
-                                             sizeof(struct plat_sci_port));
-
        for (i = 0; i < ARRAY_SIZE(platform_devinfo); i++)
                platform_device_register_full(&platform_devinfo[i]);

Why do you want to use platform_device_register_full() for all cases when you instead can use different functions case-by-case?

For instance, you can use platform_device_register_simple() or platform_device_register_data() or platform_device_register_resndata() depending on what kind of device you are registering.

So please drop the special macros introduced by this patch.

Next time please consider submitting patches in a different order. I would prefer the following:
[PATCH 01/03] ARM: shmobile: r8a7778: add r8a7778_init_irq_extpin() [PATCH 02/03] ARM: shmobile: bockw: add SMSC ethernet support [PATCH 03/03] ARM: shmobile: define PLATFORM_xxx_INFO()

If you put the cleanup patch as final portion it is easy to compare saved number of lines. Also, if we disagree about your macro then it is easy to only merge 1 and 2.

So because of the existing patch order in this series I am afraid I will have to ask you to resend patch 2/3 and 3/3 without using special macros like PLATFORM_xxxx_INFO().

Thanks for your help!

/ magnus

#3 lore raw

RFC PATCH 1/3 ARM: shmobile: define PLATFORM_xxx_INFO()

Hi Magnus

Thank you for your review

Quoted 5 lines

Thanks for your patch. Good to see that you're adding support for external IRQs and the SMSC chip. I would like to merge the actual hardware support code right away, but it I have some comments on this patch and I believe you will have to rework patches and resend. Please see below for more information.

I see.
I re-send v2 patches

Best regards
---
Kuninori Morimoto

#4 lore raw

RFC PATCH 2/3 ARM: shmobile: r8a7778: add r8a7778_init_irq_extpin()

In reply to Kuninori Morimoto

This patch adds r8a7778_init_irq_extpin() for IRQ0 - IRQ3. But this patch doesn't enable DT settings on r8a7778.dts, because R8A7778 chip external IRQ depends on
IRQ0 - IRQ3 pin encoding which came from platform board implementation.

---
 arch/arm/mach-shmobile/include/mach/r8a7778.h |    1 +
 arch/arm/mach-shmobile/setup-r8a7778.c        |   44 +++++++++++++++++++++++++
 2 files changed, 45 insertions(+)
arch/arm/mach-shmobile/include/mach/r8a7778.h +1 -0
index a755dca..e0c6205 100644
@@ -24,5 +24,6 @@ extern void r8a7778_init_delay(void);
 extern void r8a7778_init_irq(void);
 extern void r8a7778_init_irq_dt(void);
 extern void r8a7778_clock_init(void);
+extern void r8a7778_init_irq_extpin(int irlm);
 
 #endif /* __ASM_R8A7778_H__ */
arch/arm/mach-shmobile/setup-r8a7778.c +44 -0

56 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#5 lore raw

RFC PATCH 3/3 ARM: shmobile: bockw: add SMSC ethernet support

In reply to Kuninori Morimoto

This patch adds SMSC ethernet support on Bock-W

Bock-W SMSC needs FPGA settings which enables interrupt. This patch does it on bockw_init() function.
As notes for future, this FPGA settings should be updated in the future, since this FPGA is using cascaded interrupt. Current code is assuming that this FPGA interrupt user is only SMSC Becouse of these background, this patch doesn't
have DT settings

---
 arch/arm/boot/dts/r8a7778-bockw.dts  |    2 +-
 arch/arm/configs/bockw_defconfig     |   34 ++++++++++++++++++++++++++++---
 arch/arm/mach-shmobile/Kconfig       |    1 +
 arch/arm/mach-shmobile/board-bockw.c |   37 ++++++++++++++++++++++++++++++++++
 4 files changed, 70 insertions(+), 4 deletions(-)
arch/arm/boot/dts/r8a7778-bockw.dts +1 -1
index 735c964..0076b1e 100644
@@ -22,7 +22,7 @@
 	compatible = "renesas,bockw", "renesas,r8a7778";
 
 	chosen {
-		bootargs = "console=ttySC0,115200 ignore_loglevel";
+		bootargs = "console=ttySC0,115200 ignore_loglevel ip=dhcp root=/dev/nfs";
 	};
 
 	memory {
arch/arm/configs/bockw_defconfig +31 -3
index 6037705..6524cdf 100644
@@ -27,16 +27,40 @@ CONFIG_HIGHMEM=y
 CONFIG_ZBOOT_ROM_TEXT=0x0
 CONFIG_ZBOOT_ROM_BSS=0x0
 CONFIG_ARM_APPENDED_DTB=y
-CONFIG_CMDLINE="console=ttySC0,115200 ignore_loglevel"
+CONFIG_CMDLINE="console=ttySC0,115200 ignore_loglevel root=/dev/nfs ip=dhcp"
 CONFIG_CMDLINE_FORCE=y
 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
 # CONFIG_SUSPEND is not set
+CONFIG_NET=y
+CONFIG_UNIX=y
+CONFIG_INET=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_INET_LRO is not set
+# CONFIG_INET_DIAG is not set
+# CONFIG_IPV6 is not set
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 CONFIG_DEVTMPFS=y
 CONFIG_DEVTMPFS_MOUNT=y
 # CONFIG_STANDALONE is not set
 # CONFIG_PREVENT_FIRMWARE_BUILD is not set
 # CONFIG_FW_LOADER is not set
+CONFIG_NETDEVICES=y
+# CONFIG_NET_CADENCE is not set
+# CONFIG_NET_VENDOR_BROADCOM is not set
+# CONFIG_NET_VENDOR_CIRRUS is not set
+# CONFIG_NET_VENDOR_FARADAY is not set
+# CONFIG_NET_VENDOR_INTEL is not set
+# CONFIG_NET_VENDOR_MARVELL is not set
+# CONFIG_NET_VENDOR_MICREL is not set
+# CONFIG_NET_VENDOR_NATSEMI is not set
+# CONFIG_NET_VENDOR_SEEQ is not set
+CONFIG_SMSC911X=y
+# CONFIG_NET_VENDOR_STMICRO is not set
+# CONFIG_NET_VENDOR_WIZNET is not set
 # CONFIG_INPUT is not set
 # CONFIG_SERIO is not set
 # CONFIG_VT is not set
@@ -55,12 +79,16 @@ CONFIG_UIO_PDRV_GENIRQ=y
 # CONFIG_INOTIFY_USER is not set
 CONFIG_TMPFS=y
 # CONFIG_MISC_FILESYSTEMS is not set
+CONFIG_NFS_FS=y
+CONFIG_NFS_V3_ACL=y
+CONFIG_NFS_V4=y
+CONFIG_NFS_SWAP=y
+CONFIG_NFS_V4_1=y
+CONFIG_ROOT_NFS=y
 # CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 # CONFIG_SCHED_DEBUG is not set
 # CONFIG_DEBUG_BUGVERBOSE is not set
 # CONFIG_FTRACE is not set
 # CONFIG_ARM_UNWIND is not set
-CONFIG_KEYS=y
-CONFIG_CRYPTO=y
 CONFIG_AVERAGE=y
arch/arm/mach-shmobile/Kconfig +1 -0
index e5cd4d8..bbf23bc 100644
@@ -108,6 +108,7 @@ config MACH_BOCKW
 	bool "BOCK-W platform"
 	depends on ARCH_R8A7778
 	select ARCH_REQUIRE_GPIOLIB
+	select RENESAS_INTC_IRQPIN
 	select USE_OF
 
 config MACH_MARZEN
arch/arm/mach-shmobile/board-bockw.c +37 -0
index 56ab56e..67a89af 100644
@@ -19,14 +19,51 @@
  */
 
 #include <linux/platform_device.h>
+#include <linux/smsc911x.h>
 #include <mach/common.h>
+#include <mach/irqs.h>
 #include <mach/r8a7778.h>
 #include <asm/mach/arch.h>
 
+static struct smsc911x_platform_config smsc911x_platform_data = {
+	.irq_polarity	= SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
+	.irq_type	= SMSC911X_IRQ_TYPE_PUSH_PULL,
+	.flags		= SMSC911X_USE_32BIT,
+	.phy_interface	= PHY_INTERFACE_MODE_MII,
+};
+
+static struct resource smsc911x_resources[] = {
+	DEFINE_RES_MEM(0x18300000, 0x1000),
+	DEFINE_RES_IRQ(irq_pin(0)), /* IRQ 0 */
+};
+
+static struct platform_device_info smsc911x_devinfo =
+	PLATFORM_FULL_INFO("smsc911x", -1, smsc911x);
+
+#define IRQ0MR	0x30
 static void __init bockw_init(void)
 {
+	void __iomem *fpga = ioremap_nocache(0x18200000, SZ_1M);
+
 	r8a7778_clock_init();
+	r8a7778_init_irq_extpin(1);
 	r8a7778_add_standard_devices();
+
+	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);
+
+		platform_device_register_full(&smsc911x_devinfo);
+		iounmap(fpga);
+	}
 }
 
 static const char *bockw_boards_compat_dt[] __initdata = {
Signature · 1 line
1.7.9.5
#6 lore raw

cover ARM: shmobile: Add SMSC support on Bock-W

In reply to Kuninori Morimoto
Quoted 7 lines · Kuninori Morimoto

Hi Arnd, Simon, Magnus

These patch set add extpin support on r8a7778,
and enable SMSC ether on Bock-W board

This patch set is based on simon/next + my previous Bock-W patch set

Which Magnus has Acked and I will queue up for v3.10.

Quoted 4 lines

Kuninori Morimoto (3):
ARM: shmobile: define PLATFORM_xxx_INFO()
ARM: shmobile: r8a7778: add r8a7778_init_irq_extpin()
ARM: shmobile: bockw: add SMSC ethernet support

Magnus, I think these are the only outstanding Bock-W patches that are awaiting your review.

I have looked over them and don't have any objections at this stage.

#7 lore raw

v2 cover ARM: shmobile: Add SMSC support on Bock-W

In reply to Kuninori Morimoto

Hi Arnd, Simon, Magnus

These patches are v2 of extpin support on r8a7778, and enable SMSC ether support on Bock-W board

This patch set is based latest simon/next

Kuninori Morimoto (3):
ARM: shmobile: r8a7778: remove pointless PLATFORM_INFO()
ARM: shmobile: r8a7778: add r8a7778_init_irq_extpin()
ARM: shmobile: bockw: add SMSC ethernet support

 arch/arm/boot/dts/r8a7778-bockw.dts           |    2 +-
 arch/arm/configs/bockw_defconfig              |   34 ++++++++++--
 arch/arm/mach-shmobile/Kconfig                |    1 +
 arch/arm/mach-shmobile/board-bockw.c          |   38 ++++++++++++++
 arch/arm/mach-shmobile/include/mach/r8a7778.h |    1 +
 arch/arm/mach-shmobile/setup-r8a7778.c        |   70 +++++++++++++++++++------
 6 files changed, 125 insertions(+), 21 deletions(-)

Best regards
---
Kuninori Morimoto

#8 lore raw

PATCH v2 1/3 ARM: shmobile: r8a7778: remove pointless PLATFORM_INFO()

remove pointless PLATFORM_INFO() macro from setup-r8a7778, and, used original platform_device_register_xxx()

---
v1 -> v2

- removed PLATFORM_INFO()

 arch/arm/mach-shmobile/setup-r8a7778.c |   26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)
arch/arm/mach-shmobile/setup-r8a7778.c +9 -17
index 01c62be..57d6b0e 100644
@@ -78,21 +78,13 @@ static struct sh_timer_config sh_tmu1_platform_data = {
 	.clocksource_rating	= 200,
 };
 
-#define PLATFORM_INFO(n, i)					\
-{								\
-	.parent		= &platform_bus,			\
-	.name		= #n,					\
-	.id		= i,					\
-	.res		= n ## i ## _resources,			\
-	.num_res	= ARRAY_SIZE(n ## i ##_resources),	\
-	.data		= &n ## i ##_platform_data,		\
-	.size_data	= sizeof(n ## i ## _platform_data),	\
-}
-
-struct platform_device_info platform_devinfo[] = {
-	PLATFORM_INFO(sh_tmu, 0),
-	PLATFORM_INFO(sh_tmu, 1),
-};
+#define r8a7778_register_tmu(idx)			\
+	platform_device_register_resndata(		\
+		&platform_bus, "sh_tmu", idx,		\
+		sh_tmu##idx##_resources,		\
+		ARRAY_SIZE(sh_tmu##idx##_resources),	\
+		&sh_tmu##idx##_platform_data,		\
+		sizeof(sh_tmu##idx##_platform_data))
 
 void __init r8a7778_add_standard_devices(void)
 {
@@ -114,8 +106,8 @@ void __init r8a7778_add_standard_devices(void)
 					      &scif_platform_data[i],
 					      sizeof(struct plat_sci_port));
 
-	for (i = 0; i < ARRAY_SIZE(platform_devinfo); i++)
-		platform_device_register_full(&platform_devinfo[i]);
+	r8a7778_register_tmu(0);
+	r8a7778_register_tmu(1);
 }
 
 #define INT2SMSKCR0	0x82288 /* 0xfe782288 */
Signature · 1 line
1.7.9.5
#9 lore raw

PATCH v2 2/3 ARM: shmobile: r8a7778: add r8a7778_init_irq_extpin()

In reply to Kuninori Morimoto

This patch adds r8a7778_init_irq_extpin() for IRQ0 - IRQ3. But this patch doesn't enable DT settings on r8a7778.dts, because R8A7778 chip external IRQ depends on
IRQ0 - IRQ3 pin encoding which came from platform board implementation.

---
v1 -> v2

- not based on PLATFORM_INFO()

 arch/arm/mach-shmobile/include/mach/r8a7778.h |    1 +
 arch/arm/mach-shmobile/setup-r8a7778.c        |   44 +++++++++++++++++++++++++
 2 files changed, 45 insertions(+)
arch/arm/mach-shmobile/include/mach/r8a7778.h +1 -0
index a755dca..e0c6205 100644
@@ -24,5 +24,6 @@ extern void r8a7778_init_delay(void);
 extern void r8a7778_init_irq(void);
 extern void r8a7778_init_irq_dt(void);
 extern void r8a7778_clock_init(void);
+extern void r8a7778_init_irq_extpin(int irlm);
 
 #endif /* __ASM_R8A7778_H__ */
arch/arm/mach-shmobile/setup-r8a7778.c +44 -0

56 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#10 lore raw

PATCH v2 2/3 ARM: shmobile: r8a7778: add r8a7778_init_irq_extpin()

Hello.

Quoted 7 lines · Kuninori Morimoto

This patch adds r8a7778_init_irq_extpin() for IRQ0 - IRQ3. But this patch doesn't enable DT settings on r8a7778.dts, because R8A7778 chip external IRQ depends on
IRQ0 - IRQ3 pin encoding which came from platform board implementation.

[...]

Quoted 4 lines
arch/arm/mach-shmobile/setup-r8a7778.c +0 -0
index 57d6b0e..2882305 100644

[...]

Quoted 5 lines
arch/arm/mach-shmobile/setup-r8a7778.c +1 -0
@@ -110,6 +111,49 @@ void __init r8a7778_add_standard_devices(void)
  	r8a7778_register_tmu(1);
  }
 
+static struct renesas_intc_irqpin_config irqpin_platform_data = {

arch/arm/mach-shmobile/setup-r8a7778.c void __init r8a7778_add_standard_devices(void) · line 124

Quoted 10 lines
arch/arm/mach-shmobile/setup-r8a7778.c +10 -0
+	.irq_base = irq_pin(0), /* IRQ0 -> IRQ3 */
+	.sense_bitfield_width = 2,
+};
+
+static struct resource irqpin_resources[] = {
+	DEFINE_RES_MEM(0xfe78001c, 4), /* ICR1 */
+	DEFINE_RES_MEM(0xfe780010, 4), /* INTPRI */
+	DEFINE_RES_MEM(0xfe780024, 4), /* INTREQ */
+	DEFINE_RES_MEM(0xfe780044, 4), /* INTMSK0 */
+	DEFINE_RES_MEM(0xfe780064, 4), /* INTMSKCLR0 */

Hm, why this can't be passed as a single large memory resource?

arch/arm/mach-shmobile/setup-r8a7778.c void __init r8a7778_add_standard_devices(void) · line 133

Quoted 9 lines
arch/arm/mach-shmobile/setup-r8a7778.c +9 -0
+	DEFINE_RES_IRQ(gic_iid(0x3b)), /* IRQ0 */
+	DEFINE_RES_IRQ(gic_iid(0x3c)), /* IRQ1 */
+	DEFINE_RES_IRQ(gic_iid(0x3d)), /* IRQ2 */
+	DEFINE_RES_IRQ(gic_iid(0x3e)), /* IRQ3 */
+};
+
+void __init r8a7778_init_irq_extpin(int irlm)
+{
+	void __iomem *icr0 = ioremap_nocache(0xfe780000, PAGE_SIZE);

4 bytes seems enough.

arch/arm/mach-shmobile/setup-r8a7778.c void __init r8a7778_add_standard_devices(void) · line 146

Quoted 13 lines
arch/arm/mach-shmobile/setup-r8a7778.c +13 -0
+	unsigned long tmp;
+
+	if (!icr0) {
+		pr_warn("r8a7778: unable to setup external irq pin mode\n");
+		return;
+	}
+
+	tmp = ioread32(icr0);
+	if (irlm)
+		tmp |= 1 << 23; /* IRQ0 -> IRQ3 as individual pins */
+	else
+		tmp &= ~(1 << 23); /* IRL mode - not supported */
+	tmp |= (1 << 21); /* LVLMODE = 1 */

() not needed here.

WBR, Sergei

#11 lore raw

PATCH v2 2/3 ARM: shmobile: r8a7778: add r8a7778_init_irq_extpin()

Hi Sergei

Quoted 8 lines

arch/arm/mach-shmobile/setup-r8a7778.c void __init r8a7778_add_standard_devices(void) · line 124

Quoted 6 lines
arch/arm/mach-shmobile/setup-r8a7778.c +6 -0
+static struct resource irqpin_resources[] = {
+	DEFINE_RES_MEM(0xfe78001c, 4), /* ICR1 */
+	DEFINE_RES_MEM(0xfe780010, 4), /* INTPRI */
+	DEFINE_RES_MEM(0xfe780024, 4), /* INTREQ */
+	DEFINE_RES_MEM(0xfe780044, 4), /* INTMSK0 */
+	DEFINE_RES_MEM(0xfe780064, 4), /* INTMSKCLR0 */

Hm, why this can't be passed as a single large memory resource?

see
${LINUX}/drivers/irqchip/irq-renesas-intc-irqpin.c :: intc_irqpin_probe()

Best regards
---
Kuninori Morimoto

#12 lore raw

PATCH v2 3/3 ARM: shmobile: bockw: add SMSC ethernet support

In reply to Kuninori Morimoto

This patch adds SMSC ethernet support on Bock-W

Bock-W SMSC needs FPGA settings which enables interrupt. This patch does it on bockw_init() function.
As notes for future, this FPGA settings should be updated, since this FPGA is using cascaded interrupt.
Current code is assuming that this FPGA interrupt user is only SMSC. Becouse of these background, this patch doesn't
have DT settings

---
v1 -> v2

- not based on PLATFORM_INFO()

 arch/arm/boot/dts/r8a7778-bockw.dts  |    2 +-
 arch/arm/configs/bockw_defconfig     |   34 +++++++++++++++++++++++++++---
 arch/arm/mach-shmobile/Kconfig       |    1 +
 arch/arm/mach-shmobile/board-bockw.c |   38 ++++++++++++++++++++++++++++++++++
 4 files changed, 71 insertions(+), 4 deletions(-)
arch/arm/boot/dts/r8a7778-bockw.dts +1 -1
index 735c964..0076b1e 100644
@@ -22,7 +22,7 @@
 	compatible = "renesas,bockw", "renesas,r8a7778";
 
 	chosen {
-		bootargs = "console=ttySC0,115200 ignore_loglevel";
+		bootargs = "console=ttySC0,115200 ignore_loglevel ip=dhcp root=/dev/nfs";
 	};
 
 	memory {
arch/arm/configs/bockw_defconfig +31 -3
index 6037705..6524cdf 100644
@@ -27,16 +27,40 @@ CONFIG_HIGHMEM=y
 CONFIG_ZBOOT_ROM_TEXT=0x0
 CONFIG_ZBOOT_ROM_BSS=0x0
 CONFIG_ARM_APPENDED_DTB=y
-CONFIG_CMDLINE="console=ttySC0,115200 ignore_loglevel"
+CONFIG_CMDLINE="console=ttySC0,115200 ignore_loglevel root=/dev/nfs ip=dhcp"
 CONFIG_CMDLINE_FORCE=y
 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
 # CONFIG_SUSPEND is not set
+CONFIG_NET=y
+CONFIG_UNIX=y
+CONFIG_INET=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_INET_LRO is not set
+# CONFIG_INET_DIAG is not set
+# CONFIG_IPV6 is not set
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 CONFIG_DEVTMPFS=y
 CONFIG_DEVTMPFS_MOUNT=y
 # CONFIG_STANDALONE is not set
 # CONFIG_PREVENT_FIRMWARE_BUILD is not set
 # CONFIG_FW_LOADER is not set
+CONFIG_NETDEVICES=y
+# CONFIG_NET_CADENCE is not set
+# CONFIG_NET_VENDOR_BROADCOM is not set
+# CONFIG_NET_VENDOR_CIRRUS is not set
+# CONFIG_NET_VENDOR_FARADAY is not set
+# CONFIG_NET_VENDOR_INTEL is not set
+# CONFIG_NET_VENDOR_MARVELL is not set
+# CONFIG_NET_VENDOR_MICREL is not set
+# CONFIG_NET_VENDOR_NATSEMI is not set
+# CONFIG_NET_VENDOR_SEEQ is not set
+CONFIG_SMSC911X=y
+# CONFIG_NET_VENDOR_STMICRO is not set
+# CONFIG_NET_VENDOR_WIZNET is not set
 # CONFIG_INPUT is not set
 # CONFIG_SERIO is not set
 # CONFIG_VT is not set
@@ -55,12 +79,16 @@ CONFIG_UIO_PDRV_GENIRQ=y
 # CONFIG_INOTIFY_USER is not set
 CONFIG_TMPFS=y
 # CONFIG_MISC_FILESYSTEMS is not set
+CONFIG_NFS_FS=y
+CONFIG_NFS_V3_ACL=y
+CONFIG_NFS_V4=y
+CONFIG_NFS_SWAP=y
+CONFIG_NFS_V4_1=y
+CONFIG_ROOT_NFS=y
 # CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 # CONFIG_SCHED_DEBUG is not set
 # CONFIG_DEBUG_BUGVERBOSE is not set
 # CONFIG_FTRACE is not set
 # CONFIG_ARM_UNWIND is not set
-CONFIG_KEYS=y
-CONFIG_CRYPTO=y
 CONFIG_AVERAGE=y
arch/arm/mach-shmobile/Kconfig +1 -0
index 9125e14..b2219bd 100644
@@ -119,6 +119,7 @@ config MACH_BOCKW
 	bool "BOCK-W platform"
 	depends on ARCH_R8A7778
 	select ARCH_REQUIRE_GPIOLIB
+	select RENESAS_INTC_IRQPIN
 	select USE_OF
 
 config MACH_MARZEN
arch/arm/mach-shmobile/board-bockw.c +38 -0
index 56ab56e..38e5e50 100644
@@ -19,14 +19,52 @@
  */
 
 #include <linux/platform_device.h>
+#include <linux/smsc911x.h>
 #include <mach/common.h>
+#include <mach/irqs.h>
 #include <mach/r8a7778.h>
 #include <asm/mach/arch.h>
 
+static struct smsc911x_platform_config smsc911x_data = {
+	.irq_polarity	= SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
+	.irq_type	= SMSC911X_IRQ_TYPE_PUSH_PULL,
+	.flags		= SMSC911X_USE_32BIT,
+	.phy_interface	= PHY_INTERFACE_MODE_MII,
+};
+
+static struct resource smsc911x_resources[] = {
+	DEFINE_RES_MEM(0x18300000, 0x1000),
+	DEFINE_RES_IRQ(irq_pin(0)), /* IRQ 0 */
+};
+
+#define IRQ0MR	0x30
 static void __init bockw_init(void)
 {
+	void __iomem *fpga;
+
 	r8a7778_clock_init();
+	r8a7778_init_irq_extpin(1);
 	r8a7778_add_standard_devices();
+
+	fpga = ioremap_nocache(0x18200000, 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);
+		iounmap(fpga);
+
+		platform_device_register_resndata(
+			&platform_bus, "smsc911x", -1,
+			smsc911x_resources, ARRAY_SIZE(smsc911x_resources),
+			&smsc911x_data, sizeof(smsc911x_data));
+	}
 }
 
 static const char *bockw_boards_compat_dt[] __initdata = {
Signature · 1 line
1.7.9.5
#13 lore raw

PATCH v2 3/3 ARM: shmobile: bockw: add SMSC ethernet support

Hello.

Quoted 27 lines · Kuninori Morimoto

This patch adds SMSC ethernet support on Bock-W

Bock-W SMSC needs FPGA settings which enables interrupt. This patch does it on bockw_init() function.
As notes for future, this FPGA settings should be updated, since this FPGA is using cascaded interrupt.
Current code is assuming that this FPGA interrupt user is only SMSC. Becouse of these background, this patch doesn't
have DT settings

---
v1 -> v2

- not based on PLATFORM_INFO()

  arch/arm/boot/dts/r8a7778-bockw.dts  |    2 +-
  arch/arm/configs/bockw_defconfig     |   34 +++++++++++++++++++++++++++---
  arch/arm/mach-shmobile/Kconfig       |    1 +
  arch/arm/mach-shmobile/board-bockw.c |   38 ++++++++++++++++++++++++++++++++++
  4 files changed, 71 insertions(+), 4 deletions(-)
arch/arm/boot/dts/r8a7778-bockw.dts +0 -0
index 735c964..0076b1e 100644

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

Quoted 8 lines
arch/arm/boot/dts/r8a7778-bockw.dts +1 -1
@@ -22,7 +22,7 @@
  	compatible = "renesas,bockw", "renesas,r8a7778";
 
  	chosen {
-		bootargs = "console=ttySC0,115200 ignore_loglevel";
+		bootargs = "console=ttySC0,115200 ignore_loglevel ip=dhcp root=/dev/nfs";
  	};
 
  	memory {

In my opinion, modifying .dts file should be done in a separate patch.

Quoted 55 lines
arch/arm/configs/bockw_defconfig +30 -1
index 6037705..6524cdf 100644
@@ -27,16 +27,40 @@ CONFIG_HIGHMEM=y
  CONFIG_ZBOOT_ROM_TEXT=0x0
  CONFIG_ZBOOT_ROM_BSS=0x0
  CONFIG_ARM_APPENDED_DTB=y
-CONFIG_CMDLINE="console=ttySC0,115200 ignore_loglevel"
+CONFIG_CMDLINE="console=ttySC0,115200 ignore_loglevel root=/dev/nfs ip=dhcp"
  CONFIG_CMDLINE_FORCE=y
  # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
  # CONFIG_SUSPEND is not set
+CONFIG_NET=y
+CONFIG_UNIX=y
+CONFIG_INET=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_INET_LRO is not set
+# CONFIG_INET_DIAG is not set
+# CONFIG_IPV6 is not set
  CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
  CONFIG_DEVTMPFS=y
  CONFIG_DEVTMPFS_MOUNT=y
  # CONFIG_STANDALONE is not set
  # CONFIG_PREVENT_FIRMWARE_BUILD is not set
  # CONFIG_FW_LOADER is not set
+CONFIG_NETDEVICES=y
+# CONFIG_NET_CADENCE is not set
+# CONFIG_NET_VENDOR_BROADCOM is not set
+# CONFIG_NET_VENDOR_CIRRUS is not set
+# CONFIG_NET_VENDOR_FARADAY is not set
+# CONFIG_NET_VENDOR_INTEL is not set
+# CONFIG_NET_VENDOR_MARVELL is not set
+# CONFIG_NET_VENDOR_MICREL is not set
+# CONFIG_NET_VENDOR_NATSEMI is not set
+# CONFIG_NET_VENDOR_SEEQ is not set
+CONFIG_SMSC911X=y
+# CONFIG_NET_VENDOR_STMICRO is not set
+# CONFIG_NET_VENDOR_WIZNET is not set
  # CONFIG_INPUT is not set
  # CONFIG_SERIO is not set
  # CONFIG_VT is not set
@@ -55,12 +79,16 @@ CONFIG_UIO_PDRV_GENIRQ=y
  # CONFIG_INOTIFY_USER is not set
  CONFIG_TMPFS=y
  # CONFIG_MISC_FILESYSTEMS is not set
+CONFIG_NFS_FS=y
+CONFIG_NFS_V3_ACL=y
+CONFIG_NFS_V4=y
+CONFIG_NFS_SWAP=y
+CONFIG_NFS_V4_1=y

arch/arm/configs/bockw_defconfig CONFIG_UIO_PDRV_GENIRQ=y · line 94

Quoted 10 lines
arch/arm/configs/bockw_defconfig +1 -2
+CONFIG_ROOT_NFS=y
  # CONFIG_ENABLE_WARN_DEPRECATED is not set
  # CONFIG_ENABLE_MUST_CHECK is not set
  # CONFIG_SCHED_DEBUG is not set
  # CONFIG_DEBUG_BUGVERBOSE is not set
  # CONFIG_FTRACE is not set
  # CONFIG_ARM_UNWIND is not set
-CONFIG_KEYS=y
-CONFIG_CRYPTO=y
  CONFIG_AVERAGE=y

In my opinion, modifying bockw_defconfig should be done in a separate
patch. Mixing everything up in a signle patch is a bad practice.

WBR, Sergei

#14 lore raw

PATCH v2 3/3 ARM: shmobile: bockw: add SMSC ethernet support

Hi Sergei, Simon

Quoted 8 lines

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

Quoted 6 lines
  	chosen {
arch/arm/boot/dts/r8a7778-bockw.dts +1 -1
-		bootargs = "console=ttySC0,115200 ignore_loglevel";
+		bootargs = "console=ttySC0,115200 ignore_loglevel ip=dhcp root=/dev/nfs";
  	};
 
  	memory {

In my opinion, modifying .dts file should be done in a separate patch.

(snip)

Quoted 10 lines

arch/arm/configs/bockw_defconfig CONFIG_UIO_PDRV_GENIRQ=y · line 94

Quoted 7 lines

# CONFIG_SCHED_DEBUG is not set
# CONFIG_DEBUG_BUGVERBOSE is not set
# CONFIG_FTRACE is not set
# CONFIG_ARM_UNWIND is not set

arch/arm/configs/bockw_defconfig +0 -2
-CONFIG_KEYS=y
-CONFIG_CRYPTO=y
  CONFIG_AVERAGE=y

In my opinion, modifying bockw_defconfig should be done in a separate
patch. Mixing everything up in a signle patch is a bad practice.

It depends on LTSI backport / upstreaming I believe. I need Simon's opinion

Best regards
---
Kuninori Morimoto

#15 lore raw

PATCH v2 3/3 ARM: shmobile: bockw: add SMSC ethernet support

Quoted 23 lines · Kuninori Morimoto

Hi Sergei, Simon

Quoted 8 lines

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

Quoted 6 lines
  	chosen {
arch/arm/boot/dts/r8a7778-bockw.dts +1 -1
-		bootargs = "console=ttySC0,115200 ignore_loglevel";
+		bootargs = "console=ttySC0,115200 ignore_loglevel ip=dhcp root=/dev/nfs";
  	};
 
  	memory {

In my opinion, modifying .dts file should be done in a separate patch.

(snip)

Quoted 10 lines

arch/arm/configs/bockw_defconfig CONFIG_UIO_PDRV_GENIRQ=y · line 94

Quoted 7 lines

# CONFIG_SCHED_DEBUG is not set
# CONFIG_DEBUG_BUGVERBOSE is not set
# CONFIG_FTRACE is not set
# CONFIG_ARM_UNWIND is not set

arch/arm/configs/bockw_defconfig +0 -2
-CONFIG_KEYS=y
-CONFIG_CRYPTO=y
  CONFIG_AVERAGE=y

In my opinion, modifying bockw_defconfig should be done in a separate
patch. Mixing everything up in a signle patch is a bad practice.

Quoted 2 lines

It depends on LTSI backport / upstreaming I believe. I need Simon's opinion

I have no strong opinions on this, but in general breaking up patches makes my life easier. So long as the individual patches don't are useful and don't break anything :^)

#16 lore raw

PATCH v2 3/3 ARM: shmobile: bockw: add SMSC ethernet support

Hi Simon

Quoted 6 lines
Quoted 2 lines

It depends on LTSI backport / upstreaming I believe. I need Simon's opinion

I have no strong opinions on this, but in general breaking up patches makes my life easier. So long as the individual patches don't are useful and don't break anything :^)

OK, I see
I can send v3 patch which are separateed
(= C code/DT/defconfig)

Best regards
---
Kuninori Morimoto

#17 lore raw

PATCH v2 3/3 ARM: shmobile: bockw: add pinctrl support

In reply to Kuninori Morimoto

SCIF0 support as 1st step

---
v1 -> v2

- no change

 arch/arm/mach-shmobile/board-bockw.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm/mach-shmobile/board-bockw.c +13 -0
index 3e0b641..88fcdb3 100644
@@ -18,6 +18,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <linux/pinctrl/machine.h>
 #include <linux/platform_device.h>
 #include <linux/regulator/fixed.h>
 #include <linux/regulator/machine.h>
@@ -53,6 +54,14 @@ static struct resource smsc911x_resources[] = {
 	DEFINE_RES_IRQ(irq_pin(0)), /* IRQ 0 */
 };
 
+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"),
+};
+
 #define IRQ0MR	0x30
 static void __init bockw_init(void)
 {
@@ -62,6 +71,10 @@ static void __init bockw_init(void)
 	r8a7778_init_irq_extpin(1);
 	r8a7778_add_standard_devices();
 
+	pinctrl_register_mappings(bockw_pinctrl_map,
+				  ARRAY_SIZE(bockw_pinctrl_map));
+	r8a7778_pinmux_init();
+
 	fpga = ioremap_nocache(0x18200000, SZ_1M);
 	if (fpga) {
 		/*
Signature · 1 line
1.7.9.5
#18 lore raw

v3 cover ARM: shmobile: Add SMSC support on Bock-W

In reply to Kuninori Morimoto

Hi Simon

These patches are v3 of extpin support on r8a7778, and enable SMSC ether support on Bock-W board

This patch set is based latest simon/next

Kuninori Morimoto (5):
ARM: shmobile: r8a7778: remove pointless PLATFORM_INFO()
ARM: shmobile: r8a7778: add r8a7778_init_irq_extpin()
ARM: shmobile: bockw: add SMSC ethernet support
ARM: shmobile: bockw: enable network settings on bootargs
ARM: shmobile: bockw: enable SMSC ethernet on defconfig

 arch/arm/boot/dts/r8a7778-bockw.dts           |    2 +-
 arch/arm/configs/bockw_defconfig              |   34 ++++++++++--
 arch/arm/mach-shmobile/Kconfig                |    1 +
 arch/arm/mach-shmobile/board-bockw.c          |   38 ++++++++++++++
 arch/arm/mach-shmobile/include/mach/r8a7778.h |    1 +
 arch/arm/mach-shmobile/setup-r8a7778.c        |   70 +++++++++++++++++++------
 6 files changed, 125 insertions(+), 21 deletions(-)
#19 lore raw

PATCH v3 1/5 ARM: shmobile: r8a7778: remove pointless PLATFORM_INFO()

remove pointless PLATFORM_INFO() macro from setup-r8a7778, and, used original platform_device_register_xxx()

---
v2 -> v3

- no change

 arch/arm/mach-shmobile/setup-r8a7778.c |   26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)
arch/arm/mach-shmobile/setup-r8a7778.c +9 -17
index 01c62be..57d6b0e 100644
@@ -78,21 +78,13 @@ static struct sh_timer_config sh_tmu1_platform_data = {
 	.clocksource_rating	= 200,
 };
 
-#define PLATFORM_INFO(n, i)					\
-{								\
-	.parent		= &platform_bus,			\
-	.name		= #n,					\
-	.id		= i,					\
-	.res		= n ## i ## _resources,			\
-	.num_res	= ARRAY_SIZE(n ## i ##_resources),	\
-	.data		= &n ## i ##_platform_data,		\
-	.size_data	= sizeof(n ## i ## _platform_data),	\
-}
-
-struct platform_device_info platform_devinfo[] = {
-	PLATFORM_INFO(sh_tmu, 0),
-	PLATFORM_INFO(sh_tmu, 1),
-};
+#define r8a7778_register_tmu(idx)			\
+	platform_device_register_resndata(		\
+		&platform_bus, "sh_tmu", idx,		\
+		sh_tmu##idx##_resources,		\
+		ARRAY_SIZE(sh_tmu##idx##_resources),	\
+		&sh_tmu##idx##_platform_data,		\
+		sizeof(sh_tmu##idx##_platform_data))
 
 void __init r8a7778_add_standard_devices(void)
 {
@@ -114,8 +106,8 @@ void __init r8a7778_add_standard_devices(void)
 					      &scif_platform_data[i],
 					      sizeof(struct plat_sci_port));
 
-	for (i = 0; i < ARRAY_SIZE(platform_devinfo); i++)
-		platform_device_register_full(&platform_devinfo[i]);
+	r8a7778_register_tmu(0);
+	r8a7778_register_tmu(1);
 }
 
 #define INT2SMSKCR0	0x82288 /* 0xfe782288 */
Signature · 1 line
1.7.9.5
#20 lore raw

PATCH v3 2/5 ARM: shmobile: r8a7778: add r8a7778_init_irq_extpin()

In reply to Kuninori Morimoto

This patch adds r8a7778_init_irq_extpin() for IRQ0 - IRQ3. But this patch doesn't enable DT settings on r8a7778.dts, because R8A7778 chip external IRQ depends on
IRQ0 - IRQ3 pin encoding which came from platform board implementation.

---
v2 -> v3

- no change

 arch/arm/mach-shmobile/include/mach/r8a7778.h |    1 +
 arch/arm/mach-shmobile/setup-r8a7778.c        |   44 +++++++++++++++++++++++++
 2 files changed, 45 insertions(+)
arch/arm/mach-shmobile/include/mach/r8a7778.h +1 -0
index a755dca..e0c6205 100644
@@ -24,5 +24,6 @@ extern void r8a7778_init_delay(void);
 extern void r8a7778_init_irq(void);
 extern void r8a7778_init_irq_dt(void);
 extern void r8a7778_clock_init(void);
+extern void r8a7778_init_irq_extpin(int irlm);
 
 #endif /* __ASM_R8A7778_H__ */
arch/arm/mach-shmobile/setup-r8a7778.c +44 -0

56 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#21 lore raw

PATCH v3 3/5 ARM: shmobile: bockw: add SMSC ethernet support

In reply to Kuninori Morimoto

This patch adds SMSC ethernet support on Bock-W

Bock-W SMSC needs FPGA settings which enables interrupt. This patch does it on bockw_init() function.
As notes for future, this FPGA settings should be updated, since this FPGA is using cascaded interrupt.
Current code is assuming that this FPGA interrupt user is only SMSC.

---
v2 -> v3

- C code only

 arch/arm/mach-shmobile/Kconfig       |    1 +
 arch/arm/mach-shmobile/board-bockw.c |   38 ++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)
arch/arm/mach-shmobile/Kconfig +1 -0
index 9125e14..b2219bd 100644
@@ -119,6 +119,7 @@ config MACH_BOCKW
 	bool "BOCK-W platform"
 	depends on ARCH_R8A7778
 	select ARCH_REQUIRE_GPIOLIB
+	select RENESAS_INTC_IRQPIN
 	select USE_OF
 
 config MACH_MARZEN
arch/arm/mach-shmobile/board-bockw.c +38 -0
index 56ab56e..38e5e50 100644
@@ -19,14 +19,52 @@
  */
 
 #include <linux/platform_device.h>
+#include <linux/smsc911x.h>
 #include <mach/common.h>
+#include <mach/irqs.h>
 #include <mach/r8a7778.h>
 #include <asm/mach/arch.h>
 
+static struct smsc911x_platform_config smsc911x_data = {
+	.irq_polarity	= SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
+	.irq_type	= SMSC911X_IRQ_TYPE_PUSH_PULL,
+	.flags		= SMSC911X_USE_32BIT,
+	.phy_interface	= PHY_INTERFACE_MODE_MII,
+};
+
+static struct resource smsc911x_resources[] = {
+	DEFINE_RES_MEM(0x18300000, 0x1000),
+	DEFINE_RES_IRQ(irq_pin(0)), /* IRQ 0 */
+};
+
+#define IRQ0MR	0x30
 static void __init bockw_init(void)
 {
+	void __iomem *fpga;
+
 	r8a7778_clock_init();
+	r8a7778_init_irq_extpin(1);
 	r8a7778_add_standard_devices();
+
+	fpga = ioremap_nocache(0x18200000, 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);
+		iounmap(fpga);
+
+		platform_device_register_resndata(
+			&platform_bus, "smsc911x", -1,
+			smsc911x_resources, ARRAY_SIZE(smsc911x_resources),
+			&smsc911x_data, sizeof(smsc911x_data));
+	}
 }
 
 static const char *bockw_boards_compat_dt[] __initdata = {
Signature · 1 line
1.7.9.5
#22 lore raw

PATCH v3 4/5 ARM: shmobile: bockw: enable network settings on bootargs

In reply to Kuninori Morimoto

"ip" and "root" settings are useful for development

---
v2 -> v3

- dts only

 arch/arm/boot/dts/r8a7778-bockw.dts |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/r8a7778-bockw.dts +1 -1
index 735c964..0076b1e 100644
@@ -22,7 +22,7 @@
 	compatible = "renesas,bockw", "renesas,r8a7778";
 
 	chosen {
-		bootargs = "console=ttySC0,115200 ignore_loglevel";
+		bootargs = "console=ttySC0,115200 ignore_loglevel ip=dhcp root=/dev/nfs";
 	};
 
 	memory {
Signature · 1 line
1.7.9.5
#23 lore raw

PATCH v3 5/5 ARM: shmobile: bockw: enable SMSC ethernet on defconfig

In reply to Kuninori Morimoto

This patch adds SMSC ethernet support on Bock-W defconfig

---
v2 -> v3

- defconfig only

 arch/arm/configs/bockw_defconfig |   34 +++++++++++++++++++++++++++++++---
 1 file changed, 31 insertions(+), 3 deletions(-)
arch/arm/configs/bockw_defconfig +31 -3
index 6037705..6524cdf 100644
@@ -27,16 +27,40 @@ CONFIG_HIGHMEM=y
 CONFIG_ZBOOT_ROM_TEXT=0x0
 CONFIG_ZBOOT_ROM_BSS=0x0
 CONFIG_ARM_APPENDED_DTB=y
-CONFIG_CMDLINE="console=ttySC0,115200 ignore_loglevel"
+CONFIG_CMDLINE="console=ttySC0,115200 ignore_loglevel root=/dev/nfs ip=dhcp"
 CONFIG_CMDLINE_FORCE=y
 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
 # CONFIG_SUSPEND is not set
+CONFIG_NET=y
+CONFIG_UNIX=y
+CONFIG_INET=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_INET_LRO is not set
+# CONFIG_INET_DIAG is not set
+# CONFIG_IPV6 is not set
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 CONFIG_DEVTMPFS=y
 CONFIG_DEVTMPFS_MOUNT=y
 # CONFIG_STANDALONE is not set
 # CONFIG_PREVENT_FIRMWARE_BUILD is not set
 # CONFIG_FW_LOADER is not set
+CONFIG_NETDEVICES=y
+# CONFIG_NET_CADENCE is not set
+# CONFIG_NET_VENDOR_BROADCOM is not set
+# CONFIG_NET_VENDOR_CIRRUS is not set
+# CONFIG_NET_VENDOR_FARADAY is not set
+# CONFIG_NET_VENDOR_INTEL is not set
+# CONFIG_NET_VENDOR_MARVELL is not set
+# CONFIG_NET_VENDOR_MICREL is not set
+# CONFIG_NET_VENDOR_NATSEMI is not set
+# CONFIG_NET_VENDOR_SEEQ is not set
+CONFIG_SMSC911X=y
+# CONFIG_NET_VENDOR_STMICRO is not set
+# CONFIG_NET_VENDOR_WIZNET is not set
 # CONFIG_INPUT is not set
 # CONFIG_SERIO is not set
 # CONFIG_VT is not set
@@ -55,12 +79,16 @@ CONFIG_UIO_PDRV_GENIRQ=y
 # CONFIG_INOTIFY_USER is not set
 CONFIG_TMPFS=y
 # CONFIG_MISC_FILESYSTEMS is not set
+CONFIG_NFS_FS=y
+CONFIG_NFS_V3_ACL=y
+CONFIG_NFS_V4=y
+CONFIG_NFS_SWAP=y
+CONFIG_NFS_V4_1=y
+CONFIG_ROOT_NFS=y
 # CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 # CONFIG_SCHED_DEBUG is not set
 # CONFIG_DEBUG_BUGVERBOSE is not set
 # CONFIG_FTRACE is not set
 # CONFIG_ARM_UNWIND is not set
-CONFIG_KEYS=y
-CONFIG_CRYPTO=y
 CONFIG_AVERAGE=y
Signature · 1 line
1.7.9.5
maintainer
#24 lore raw

v3 cover ARM: shmobile: Add SMSC support on Bock-W

In reply to Kuninori Morimoto

Hi Morimoto-san, Simon,

Quoted 6 lines · Kuninori Morimoto

Hi Simon

These patches are v3 of extpin support on r8a7778, and enable SMSC ether support on Bock-W board

Quoted 8 lines

This patch set is based latest simon/next

Kuninori Morimoto (5):
ARM: shmobile: r8a7778: remove pointless PLATFORM_INFO()
ARM: shmobile: r8a7778: add r8a7778_init_irq_extpin()
ARM: shmobile: bockw: add SMSC ethernet support
ARM: shmobile: bockw: enable network settings on bootargs
ARM: shmobile: bockw: enable SMSC ethernet on defconfig

Thanks, these are all fine with me.

Applied
#25 lore raw

v3 cover ARM: shmobile: Add SMSC support on Bock-W

Quoted 15 lines · Magnus Damm

Hi Morimoto-san, Simon,

Quoted 11 lines · Kuninori Morimoto

Hi Simon

These patches are v3 of extpin support on r8a7778, and enable SMSC ether support on Bock-W board

This patch set is based latest simon/next

Kuninori Morimoto (5):
ARM: shmobile: r8a7778: remove pointless PLATFORM_INFO()
ARM: shmobile: r8a7778: add r8a7778_init_irq_extpin()

Queued up in the soc-r8a7778 branch.

Quoted 2 lines
Quoted 2 lines

ARM: shmobile: bockw: add SMSC ethernet support
ARM: shmobile: bockw: enable network settings on bootargs

Queued up in the boards-bockw branch.

Quoted 1 line
Quoted 1 line

ARM: shmobile: bockw: enable SMSC ethernet on defconfig

Queued up in the defconfig-bockw branch.

Quoted 3 lines

Thanks, these are all fine with me.

I will endeavour to get this included in v3.10.