aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2013-11-03 07:50:31 -0500
committerSimon Horman <horms+renesas@verge.net.au>2013-12-24 07:09:10 -0500
commit302d8898ade1ad5f84cfedc7e8d43ff7720f3f25 (patch)
treee03e55ba440c0462d4d83fd3e9c3bda90349abc6 /arch
parent135d0e602a2f2700bcbde8315000e21cbdc4208e (diff)
ARM: shmobile: r8a7790: Don't define SCIF platform data in an array
The SCIF driver is transitioning to platform resources. Board code will thus need to define an array of resources for each SCIF device. This is incompatible with the macro-based SCIF platform data definition as an array. Rework the macro to define platform data as individual structures. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7790.c112
1 files changed, 49 insertions, 63 deletions
diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c
index 1a11e26a9431..b6deb196bea3 100644
--- a/arch/arm/mach-shmobile/setup-r8a7790.c
+++ b/arch/arm/mach-shmobile/setup-r8a7790.c
@@ -100,61 +100,47 @@ void __init r8a7790_pinmux_init(void)
100 r8a7790_register_i2c(3); 100 r8a7790_register_i2c(3);
101} 101}
102 102
103#define SCIF_COMMON(scif_type, baseaddr, irq) \ 103#define __R8A7790_SCIF(scif_type, _scscr, algo, index, baseaddr, irq) \
104 .type = scif_type, \ 104static struct plat_sci_port scif##index##_platform_data = { \
105 .mapbase = baseaddr, \ 105 .type = scif_type, \
106 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, \ 106 .mapbase = baseaddr, \
107 .irqs = SCIx_IRQ_MUXED(irq) 107 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, \
108 108 .scbrr_algo_id = algo, \
109#define SCIFA_DATA(index, baseaddr, irq) \ 109 .scscr = _scscr, \
110[index] = { \ 110 .irqs = SCIx_IRQ_MUXED(irq), \
111 SCIF_COMMON(PORT_SCIFA, baseaddr, irq), \
112 .scbrr_algo_id = SCBRR_ALGO_4, \
113 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE0, \
114} 111}
115 112
116#define SCIFB_DATA(index, baseaddr, irq) \ 113#define R8A7790_SCIF(index, baseaddr, irq) \
117[index] = { \ 114 __R8A7790_SCIF(PORT_SCIF, SCSCR_RE | SCSCR_TE, \
118 SCIF_COMMON(PORT_SCIFB, baseaddr, irq), \ 115 SCBRR_ALGO_2, index, baseaddr, irq)
119 .scbrr_algo_id = SCBRR_ALGO_4, \ 116
120 .scscr = SCSCR_RE | SCSCR_TE, \ 117#define R8A7790_SCIFA(index, baseaddr, irq) \
121} 118 __R8A7790_SCIF(PORT_SCIFA, SCSCR_RE | SCSCR_TE | SCSCR_CKE0, \
122 119 SCBRR_ALGO_4, index, baseaddr, irq)
123#define SCIF_DATA(index, baseaddr, irq) \ 120
124[index] = { \ 121#define R8A7790_SCIFB(index, baseaddr, irq) \
125 SCIF_COMMON(PORT_SCIF, baseaddr, irq), \ 122 __R8A7790_SCIF(PORT_SCIFB, SCSCR_RE | SCSCR_TE, \
126 .scbrr_algo_id = SCBRR_ALGO_2, \ 123 SCBRR_ALGO_4, index, baseaddr, irq)
127 .scscr = SCSCR_RE | SCSCR_TE, \ 124
128} 125#define R8A7790_HSCIF(index, baseaddr, irq) \
129 126 __R8A7790_SCIF(PORT_HSCIF, SCSCR_RE | SCSCR_TE, \
130#define HSCIF_DATA(index, baseaddr, irq) \ 127 SCBRR_ALGO_6, index, baseaddr, irq)
131[index] = { \ 128
132 SCIF_COMMON(PORT_HSCIF, baseaddr, irq), \ 129R8A7790_SCIFA(0, 0xe6c40000, gic_spi(144)); /* SCIFA0 */
133 .scbrr_algo_id = SCBRR_ALGO_6, \ 130R8A7790_SCIFA(1, 0xe6c50000, gic_spi(145)); /* SCIFA1 */
134 .scscr = SCSCR_RE | SCSCR_TE, \ 131R8A7790_SCIFB(2, 0xe6c20000, gic_spi(148)); /* SCIFB0 */
135} 132R8A7790_SCIFB(3, 0xe6c30000, gic_spi(149)); /* SCIFB1 */
136 133R8A7790_SCIFB(4, 0xe6ce0000, gic_spi(150)); /* SCIFB2 */
137enum { SCIFA0, SCIFA1, SCIFB0, SCIFB1, SCIFB2, SCIFA2, SCIF0, SCIF1, 134R8A7790_SCIFA(5, 0xe6c60000, gic_spi(151)); /* SCIFA2 */
138 HSCIF0, HSCIF1 }; 135R8A7790_SCIF(6, 0xe6e60000, gic_spi(152)); /* SCIF0 */
139 136R8A7790_SCIF(7, 0xe6e68000, gic_spi(153)); /* SCIF1 */
140static const struct plat_sci_port scif[] __initconst = { 137R8A7790_HSCIF(8, 0xe62c0000, gic_spi(154)); /* HSCIF0 */
141 SCIFA_DATA(SCIFA0, 0xe6c40000, gic_spi(144)), /* SCIFA0 */ 138R8A7790_HSCIF(9, 0xe62c8000, gic_spi(155)); /* HSCIF1 */
142 SCIFA_DATA(SCIFA1, 0xe6c50000, gic_spi(145)), /* SCIFA1 */ 139
143 SCIFB_DATA(SCIFB0, 0xe6c20000, gic_spi(148)), /* SCIFB0 */ 140#define r8a7790_register_scif(index) \
144 SCIFB_DATA(SCIFB1, 0xe6c30000, gic_spi(149)), /* SCIFB1 */ 141 platform_device_register_data(&platform_bus, "sh-sci", index, \
145 SCIFB_DATA(SCIFB2, 0xe6ce0000, gic_spi(150)), /* SCIFB2 */ 142 &scif##index##_platform_data, \
146 SCIFA_DATA(SCIFA2, 0xe6c60000, gic_spi(151)), /* SCIFA2 */ 143 sizeof(scif##index##_platform_data))
147 SCIF_DATA(SCIF0, 0xe6e60000, gic_spi(152)), /* SCIF0 */
148 SCIF_DATA(SCIF1, 0xe6e68000, gic_spi(153)), /* SCIF1 */
149 HSCIF_DATA(HSCIF0, 0xe62c0000, gic_spi(154)), /* HSCIF0 */
150 HSCIF_DATA(HSCIF1, 0xe62c8000, gic_spi(155)), /* HSCIF1 */
151};
152
153static inline void r8a7790_register_scif(int idx)
154{
155 platform_device_register_data(&platform_bus, "sh-sci", idx, &scif[idx],
156 sizeof(struct plat_sci_port));
157}
158 144
159static const struct renesas_irqc_config irqc0_data __initconst = { 145static const struct renesas_irqc_config irqc0_data __initconst = {
160 .irq_base = irq_pin(0), /* IRQ0 -> IRQ3 */ 146 .irq_base = irq_pin(0), /* IRQ0 -> IRQ3 */
@@ -207,16 +193,16 @@ static const struct resource cmt00_resources[] __initconst = {
207 193
208void __init r8a7790_add_dt_devices(void) 194void __init r8a7790_add_dt_devices(void)
209{ 195{
210 r8a7790_register_scif(SCIFA0); 196 r8a7790_register_scif(0);
211 r8a7790_register_scif(SCIFA1); 197 r8a7790_register_scif(1);
212 r8a7790_register_scif(SCIFB0); 198 r8a7790_register_scif(2);
213 r8a7790_register_scif(SCIFB1); 199 r8a7790_register_scif(3);
214 r8a7790_register_scif(SCIFB2); 200 r8a7790_register_scif(4);
215 r8a7790_register_scif(SCIFA2); 201 r8a7790_register_scif(5);
216 r8a7790_register_scif(SCIF0); 202 r8a7790_register_scif(6);
217 r8a7790_register_scif(SCIF1); 203 r8a7790_register_scif(7);
218 r8a7790_register_scif(HSCIF0); 204 r8a7790_register_scif(8);
219 r8a7790_register_scif(HSCIF1); 205 r8a7790_register_scif(9);
220 r8a7790_register_cmt(00); 206 r8a7790_register_cmt(00);
221} 207}
222 208