aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2013-04-09 08:45:09 -0400
committerArnd Bergmann <arnd@arndb.de>2013-04-09 08:45:09 -0400
commitafa3a13da7c18f08b9c636fc25a67d40144c5e9b (patch)
tree3137c7f2eb9add7d1d2ec6456f6f5cf16d5beeae
parentf12d9f9c9b875aec513ffe31623e46deb862b63c (diff)
parent446ee9b2d813a9378e304008fc433ce543ca68a1 (diff)
Merge tag 'renesas-boards-bockw-for-v3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas into next/boards2
From Simon Horman <horms+renesas@verge.net.au>: Renesas ARM-based SoC bockw board updates for v3.10 Add SMSC ethernet support to the bockw board. This pull request is based on a merge of: git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git renesas-soc-r8a7778-for-v3.10 git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git renesas-boards3-for-v3.10 The reason for merging with renesas-soc-r8a7778-for-v3.10 is to provide pre-requisite SoC code to configure IRQ pins for the SMSC ethernet. * tag 'renesas-boards-bockw-for-v3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas: ARM: shmobile: bockw: enable network settings on bootargs ARM: shmobile: bockw: add SMSC ethernet support Signed-off-by: Arnd Bergmann <arnd@arndb.de>
-rw-r--r--arch/arm/boot/dts/r8a7778-bockw.dts2
-rw-r--r--arch/arm/mach-shmobile/Kconfig1
-rw-r--r--arch/arm/mach-shmobile/board-bockw.c38
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7778.c3
-rw-r--r--arch/arm/mach-shmobile/include/mach/r8a7778.h4
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7778.c83
6 files changed, 114 insertions, 17 deletions
diff --git a/arch/arm/boot/dts/r8a7778-bockw.dts b/arch/arm/boot/dts/r8a7778-bockw.dts
index 735c964920f9..0076b1e8a0fb 100644
--- a/arch/arm/boot/dts/r8a7778-bockw.dts
+++ b/arch/arm/boot/dts/r8a7778-bockw.dts
@@ -22,7 +22,7 @@
22 compatible = "renesas,bockw", "renesas,r8a7778"; 22 compatible = "renesas,bockw", "renesas,r8a7778";
23 23
24 chosen { 24 chosen {
25 bootargs = "console=ttySC0,115200 ignore_loglevel"; 25 bootargs = "console=ttySC0,115200 ignore_loglevel ip=dhcp root=/dev/nfs";
26 }; 26 };
27 27
28 memory { 28 memory {
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 549e05985745..1a517e2fe449 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -133,6 +133,7 @@ config MACH_BOCKW
133 bool "BOCK-W platform" 133 bool "BOCK-W platform"
134 depends on ARCH_R8A7778 134 depends on ARCH_R8A7778
135 select ARCH_REQUIRE_GPIOLIB 135 select ARCH_REQUIRE_GPIOLIB
136 select RENESAS_INTC_IRQPIN
136 select USE_OF 137 select USE_OF
137 138
138config MACH_MARZEN 139config MACH_MARZEN
diff --git a/arch/arm/mach-shmobile/board-bockw.c b/arch/arm/mach-shmobile/board-bockw.c
index 56ab56ed5f59..38e5e50fb318 100644
--- a/arch/arm/mach-shmobile/board-bockw.c
+++ b/arch/arm/mach-shmobile/board-bockw.c
@@ -19,14 +19,52 @@
19 */ 19 */
20 20
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/smsc911x.h>
22#include <mach/common.h> 23#include <mach/common.h>
24#include <mach/irqs.h>
23#include <mach/r8a7778.h> 25#include <mach/r8a7778.h>
24#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
25 27
28static struct smsc911x_platform_config smsc911x_data = {
29 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
30 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
31 .flags = SMSC911X_USE_32BIT,
32 .phy_interface = PHY_INTERFACE_MODE_MII,
33};
34
35static struct resource smsc911x_resources[] = {
36 DEFINE_RES_MEM(0x18300000, 0x1000),
37 DEFINE_RES_IRQ(irq_pin(0)), /* IRQ 0 */
38};
39
40#define IRQ0MR 0x30
26static void __init bockw_init(void) 41static void __init bockw_init(void)
27{ 42{
43 void __iomem *fpga;
44
28 r8a7778_clock_init(); 45 r8a7778_clock_init();
46 r8a7778_init_irq_extpin(1);
29 r8a7778_add_standard_devices(); 47 r8a7778_add_standard_devices();
48
49 fpga = ioremap_nocache(0x18200000, SZ_1M);
50 if (fpga) {
51 /*
52 * CAUTION
53 *
54 * IRQ0/1 is cascaded interrupt from FPGA.
55 * it should be cared in the future
56 * Now, it is assuming IRQ0 was used only from SMSC.
57 */
58 u16 val = ioread16(fpga + IRQ0MR);
59 val &= ~(1 << 4); /* enable SMSC911x */
60 iowrite16(val, fpga + IRQ0MR);
61 iounmap(fpga);
62
63 platform_device_register_resndata(
64 &platform_bus, "smsc911x", -1,
65 smsc911x_resources, ARRAY_SIZE(smsc911x_resources),
66 &smsc911x_data, sizeof(smsc911x_data));
67 }
30} 68}
31 69
32static const char *bockw_boards_compat_dt[] __initdata = { 70static const char *bockw_boards_compat_dt[] __initdata = {
diff --git a/arch/arm/mach-shmobile/clock-r8a7778.c b/arch/arm/mach-shmobile/clock-r8a7778.c
index f1277f45381e..cd6855290b1f 100644
--- a/arch/arm/mach-shmobile/clock-r8a7778.c
+++ b/arch/arm/mach-shmobile/clock-r8a7778.c
@@ -58,11 +58,13 @@ static struct clk *main_clks[] = {
58}; 58};
59 59
60enum { 60enum {
61 MSTP114,
61 MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021, 62 MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021,
62 MSTP016, MSTP015, 63 MSTP016, MSTP015,
63 MSTP_NR }; 64 MSTP_NR };
64 65
65static struct clk mstp_clks[MSTP_NR] = { 66static struct clk mstp_clks[MSTP_NR] = {
67 [MSTP114] = SH_CLK_MSTP32(&clkp, MSTPCR1, 14, 0), /* Ether */
66 [MSTP026] = SH_CLK_MSTP32(&clkp, MSTPCR0, 26, 0), /* SCIF0 */ 68 [MSTP026] = SH_CLK_MSTP32(&clkp, MSTPCR0, 26, 0), /* SCIF0 */
67 [MSTP025] = SH_CLK_MSTP32(&clkp, MSTPCR0, 25, 0), /* SCIF1 */ 69 [MSTP025] = SH_CLK_MSTP32(&clkp, MSTPCR0, 25, 0), /* SCIF1 */
68 [MSTP024] = SH_CLK_MSTP32(&clkp, MSTPCR0, 24, 0), /* SCIF2 */ 70 [MSTP024] = SH_CLK_MSTP32(&clkp, MSTPCR0, 24, 0), /* SCIF2 */
@@ -75,6 +77,7 @@ static struct clk mstp_clks[MSTP_NR] = {
75 77
76static struct clk_lookup lookups[] = { 78static struct clk_lookup lookups[] = {
77 /* MSTP32 clocks */ 79 /* MSTP32 clocks */
80 CLKDEV_DEV_ID("sh-eth", &mstp_clks[MSTP114]), /* Ether */
78 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP026]), /* SCIF0 */ 81 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP026]), /* SCIF0 */
79 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP025]), /* SCIF1 */ 82 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP025]), /* SCIF1 */
80 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP024]), /* SCIF2 */ 83 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP024]), /* SCIF2 */
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7778.h b/arch/arm/mach-shmobile/include/mach/r8a7778.h
index a755dcafef4d..951149e6bcca 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7778.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a7778.h
@@ -18,11 +18,15 @@
18#ifndef __ASM_R8A7778_H__ 18#ifndef __ASM_R8A7778_H__
19#define __ASM_R8A7778_H__ 19#define __ASM_R8A7778_H__
20 20
21#include <linux/sh_eth.h>
22
21extern void r8a7778_add_standard_devices(void); 23extern void r8a7778_add_standard_devices(void);
22extern void r8a7778_add_standard_devices_dt(void); 24extern void r8a7778_add_standard_devices_dt(void);
25extern void r8a7778_add_ether_device(struct sh_eth_plat_data *pdata);
23extern void r8a7778_init_delay(void); 26extern void r8a7778_init_delay(void);
24extern void r8a7778_init_irq(void); 27extern void r8a7778_init_irq(void);
25extern void r8a7778_init_irq_dt(void); 28extern void r8a7778_init_irq_dt(void);
26extern void r8a7778_clock_init(void); 29extern void r8a7778_clock_init(void);
30extern void r8a7778_init_irq_extpin(int irlm);
27 31
28#endif /* __ASM_R8A7778_H__ */ 32#endif /* __ASM_R8A7778_H__ */
diff --git a/arch/arm/mach-shmobile/setup-r8a7778.c b/arch/arm/mach-shmobile/setup-r8a7778.c
index 01c62bedf9cf..30b4a336308f 100644
--- a/arch/arm/mach-shmobile/setup-r8a7778.c
+++ b/arch/arm/mach-shmobile/setup-r8a7778.c
@@ -3,6 +3,7 @@
3 * 3 *
4 * Copyright (C) 2013 Renesas Solutions Corp. 4 * Copyright (C) 2013 Renesas Solutions Corp.
5 * Copyright (C) 2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> 5 * Copyright (C) 2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
6 * Copyright (C) 2013 Cogent Embedded, Inc.
6 * 7 *
7 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
@@ -23,6 +24,7 @@
23#include <linux/irqchip/arm-gic.h> 24#include <linux/irqchip/arm-gic.h>
24#include <linux/of.h> 25#include <linux/of.h>
25#include <linux/of_platform.h> 26#include <linux/of_platform.h>
27#include <linux/platform_data/irq-renesas-intc-irqpin.h>
26#include <linux/platform_device.h> 28#include <linux/platform_device.h>
27#include <linux/irqchip.h> 29#include <linux/irqchip.h>
28#include <linux/serial_sci.h> 30#include <linux/serial_sci.h>
@@ -78,22 +80,20 @@ static struct sh_timer_config sh_tmu1_platform_data = {
78 .clocksource_rating = 200, 80 .clocksource_rating = 200,
79}; 81};
80 82
81#define PLATFORM_INFO(n, i) \ 83/* Ether */
82{ \ 84static struct resource ether_resources[] = {
83 .parent = &platform_bus, \ 85 DEFINE_RES_MEM(0xfde00000, 0x400),
84 .name = #n, \ 86 DEFINE_RES_IRQ(gic_iid(0x89)),
85 .id = i, \
86 .res = n ## i ## _resources, \
87 .num_res = ARRAY_SIZE(n ## i ##_resources), \
88 .data = &n ## i ##_platform_data, \
89 .size_data = sizeof(n ## i ## _platform_data), \
90}
91
92struct platform_device_info platform_devinfo[] = {
93 PLATFORM_INFO(sh_tmu, 0),
94 PLATFORM_INFO(sh_tmu, 1),
95}; 87};
96 88
89#define r8a7778_register_tmu(idx) \
90 platform_device_register_resndata( \
91 &platform_bus, "sh_tmu", idx, \
92 sh_tmu##idx##_resources, \
93 ARRAY_SIZE(sh_tmu##idx##_resources), \
94 &sh_tmu##idx##_platform_data, \
95 sizeof(sh_tmu##idx##_platform_data))
96
97void __init r8a7778_add_standard_devices(void) 97void __init r8a7778_add_standard_devices(void)
98{ 98{
99 int i; 99 int i;
@@ -114,8 +114,59 @@ void __init r8a7778_add_standard_devices(void)
114 &scif_platform_data[i], 114 &scif_platform_data[i],
115 sizeof(struct plat_sci_port)); 115 sizeof(struct plat_sci_port));
116 116
117 for (i = 0; i < ARRAY_SIZE(platform_devinfo); i++) 117 r8a7778_register_tmu(0);
118 platform_device_register_full(&platform_devinfo[i]); 118 r8a7778_register_tmu(1);
119}
120
121void __init r8a7778_add_ether_device(struct sh_eth_plat_data *pdata)
122{
123 platform_device_register_resndata(&platform_bus, "sh_eth", -1,
124 ether_resources,
125 ARRAY_SIZE(ether_resources),
126 pdata, sizeof(*pdata));
127}
128
129static struct renesas_intc_irqpin_config irqpin_platform_data = {
130 .irq_base = irq_pin(0), /* IRQ0 -> IRQ3 */
131 .sense_bitfield_width = 2,
132};
133
134static struct resource irqpin_resources[] = {
135 DEFINE_RES_MEM(0xfe78001c, 4), /* ICR1 */
136 DEFINE_RES_MEM(0xfe780010, 4), /* INTPRI */
137 DEFINE_RES_MEM(0xfe780024, 4), /* INTREQ */
138 DEFINE_RES_MEM(0xfe780044, 4), /* INTMSK0 */
139 DEFINE_RES_MEM(0xfe780064, 4), /* INTMSKCLR0 */
140 DEFINE_RES_IRQ(gic_iid(0x3b)), /* IRQ0 */
141 DEFINE_RES_IRQ(gic_iid(0x3c)), /* IRQ1 */
142 DEFINE_RES_IRQ(gic_iid(0x3d)), /* IRQ2 */
143 DEFINE_RES_IRQ(gic_iid(0x3e)), /* IRQ3 */
144};
145
146void __init r8a7778_init_irq_extpin(int irlm)
147{
148 void __iomem *icr0 = ioremap_nocache(0xfe780000, PAGE_SIZE);
149 unsigned long tmp;
150
151 if (!icr0) {
152 pr_warn("r8a7778: unable to setup external irq pin mode\n");
153 return;
154 }
155
156 tmp = ioread32(icr0);
157 if (irlm)
158 tmp |= 1 << 23; /* IRQ0 -> IRQ3 as individual pins */
159 else
160 tmp &= ~(1 << 23); /* IRL mode - not supported */
161 tmp |= (1 << 21); /* LVLMODE = 1 */
162 iowrite32(tmp, icr0);
163 iounmap(icr0);
164
165 if (irlm)
166 platform_device_register_resndata(
167 &platform_bus, "renesas_intc_irqpin", -1,
168 irqpin_resources, ARRAY_SIZE(irqpin_resources),
169 &irqpin_platform_data, sizeof(irqpin_platform_data));
119} 170}
120 171
121#define INT2SMSKCR0 0x82288 /* 0xfe782288 */ 172#define INT2SMSKCR0 0x82288 /* 0xfe782288 */