Magnus Damm | 2b7eda6 | 2010-02-05 11:14:58 +0000 | [diff] [blame] | 1 | /* |
| 2 | * sh7372 processor support |
| 3 | * |
| 4 | * Copyright (C) 2010 Magnus Damm |
| 5 | * Copyright (C) 2008 Yoshihiro Shimoda |
| 6 | * |
| 7 | * 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 | * the Free Software Foundation; version 2 of the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | */ |
| 20 | #include <linux/kernel.h> |
| 21 | #include <linux/init.h> |
| 22 | #include <linux/interrupt.h> |
| 23 | #include <linux/irq.h> |
| 24 | #include <linux/platform_device.h> |
Magnus Damm | 3b7b705 | 2012-03-28 15:53:40 +0900 | [diff] [blame] | 25 | #include <linux/of_platform.h> |
Magnus Damm | 6822471 | 2011-04-28 03:21:00 +0000 | [diff] [blame] | 26 | #include <linux/uio_driver.h> |
Magnus Damm | 2b7eda6 | 2010-02-05 11:14:58 +0000 | [diff] [blame] | 27 | #include <linux/delay.h> |
| 28 | #include <linux/input.h> |
| 29 | #include <linux/io.h> |
| 30 | #include <linux/serial_sci.h> |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 31 | #include <linux/sh_dma.h> |
Magnus Damm | 2b7eda6 | 2010-02-05 11:14:58 +0000 | [diff] [blame] | 32 | #include <linux/sh_intc.h> |
| 33 | #include <linux/sh_timer.h> |
Rafael J. Wysocki | 111058c | 2011-08-14 13:35:39 +0200 | [diff] [blame] | 34 | #include <linux/pm_domain.h> |
Arnd Bergmann | 426f1af | 2012-03-22 22:02:16 +0000 | [diff] [blame] | 35 | #include <linux/dma-mapping.h> |
Hideki EIRAKU | 3cfb843 | 2013-01-21 19:54:27 +0900 | [diff] [blame] | 36 | #include <linux/platform_data/sh_ipmmu.h> |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 37 | #include <mach/dma-register.h> |
Rob Herring | 250a272 | 2012-01-03 16:57:33 -0600 | [diff] [blame] | 38 | #include <mach/irqs.h> |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 39 | #include <mach/sh7372.h> |
Magnus Damm | 5d7220ec | 2012-02-29 21:37:19 +0900 | [diff] [blame] | 40 | #include <mach/common.h> |
| 41 | #include <asm/mach/map.h> |
Magnus Damm | 2b7eda6 | 2010-02-05 11:14:58 +0000 | [diff] [blame] | 42 | #include <asm/mach-types.h> |
| 43 | #include <asm/mach/arch.h> |
Magnus Damm | 17254bf | 2012-03-06 17:36:37 +0900 | [diff] [blame] | 44 | #include <asm/mach/time.h> |
Magnus Damm | 2b7eda6 | 2010-02-05 11:14:58 +0000 | [diff] [blame] | 45 | |
Magnus Damm | 5d7220ec | 2012-02-29 21:37:19 +0900 | [diff] [blame] | 46 | static struct map_desc sh7372_io_desc[] __initdata = { |
| 47 | /* create a 1:1 entity map for 0xe6xxxxxx |
| 48 | * used by CPGA, INTC and PFC. |
| 49 | */ |
| 50 | { |
| 51 | .virtual = 0xe6000000, |
| 52 | .pfn = __phys_to_pfn(0xe6000000), |
| 53 | .length = 256 << 20, |
| 54 | .type = MT_DEVICE_NONSHARED |
| 55 | }, |
| 56 | }; |
| 57 | |
| 58 | void __init sh7372_map_io(void) |
| 59 | { |
| 60 | iotable_init(sh7372_io_desc, ARRAY_SIZE(sh7372_io_desc)); |
| 61 | } |
Magnus Damm | 2b7eda6 | 2010-02-05 11:14:58 +0000 | [diff] [blame] | 62 | |
Laurent Pinchart | 5967fe0 | 2012-12-15 23:51:27 +0100 | [diff] [blame] | 63 | /* PFC */ |
| 64 | static struct resource sh7372_pfc_resources[] = { |
| 65 | [0] = { |
| 66 | .start = 0xe6050000, |
| 67 | .end = 0xe6057fff, |
| 68 | .flags = IORESOURCE_MEM, |
| 69 | }, |
| 70 | [1] = { |
| 71 | .start = 0xe605800c, |
| 72 | .end = 0xe6058027, |
| 73 | .flags = IORESOURCE_MEM, |
| 74 | } |
| 75 | }; |
| 76 | |
| 77 | static struct platform_device sh7372_pfc_device = { |
| 78 | .name = "pfc-sh7372", |
| 79 | .id = -1, |
| 80 | .resource = sh7372_pfc_resources, |
| 81 | .num_resources = ARRAY_SIZE(sh7372_pfc_resources), |
| 82 | }; |
| 83 | |
| 84 | void __init sh7372_pinmux_init(void) |
| 85 | { |
| 86 | platform_device_register(&sh7372_pfc_device); |
| 87 | } |
| 88 | |
Laurent Pinchart | c6a0d86 | 2013-12-06 10:59:21 +0100 | [diff] [blame] | 89 | /* SCIF */ |
| 90 | #define SH7372_SCIF(scif_type, index, baseaddr, irq) \ |
| 91 | static struct plat_sci_port scif##index##_platform_data = { \ |
| 92 | .type = scif_type, \ |
Laurent Pinchart | c6a0d86 | 2013-12-06 10:59:21 +0100 | [diff] [blame] | 93 | .flags = UPF_BOOT_AUTOCONF, \ |
Laurent Pinchart | c6a0d86 | 2013-12-06 10:59:21 +0100 | [diff] [blame] | 94 | .scscr = SCSCR_RE | SCSCR_TE, \ |
| 95 | }; \ |
| 96 | \ |
Laurent Pinchart | d39f98b | 2013-12-06 10:59:30 +0100 | [diff] [blame] | 97 | static struct resource scif##index##_resources[] = { \ |
| 98 | DEFINE_RES_MEM(baseaddr, 0x100), \ |
| 99 | DEFINE_RES_IRQ(irq), \ |
| 100 | }; \ |
| 101 | \ |
Laurent Pinchart | c6a0d86 | 2013-12-06 10:59:21 +0100 | [diff] [blame] | 102 | static struct platform_device scif##index##_device = { \ |
| 103 | .name = "sh-sci", \ |
| 104 | .id = index, \ |
Laurent Pinchart | d39f98b | 2013-12-06 10:59:30 +0100 | [diff] [blame] | 105 | .resource = scif##index##_resources, \ |
| 106 | .num_resources = ARRAY_SIZE(scif##index##_resources), \ |
Laurent Pinchart | c6a0d86 | 2013-12-06 10:59:21 +0100 | [diff] [blame] | 107 | .dev = { \ |
| 108 | .platform_data = &scif##index##_platform_data, \ |
| 109 | }, \ |
| 110 | } |
Magnus Damm | 2b7eda6 | 2010-02-05 11:14:58 +0000 | [diff] [blame] | 111 | |
Laurent Pinchart | c6a0d86 | 2013-12-06 10:59:21 +0100 | [diff] [blame] | 112 | SH7372_SCIF(PORT_SCIFA, 0, 0xe6c40000, evt2irq(0x0c00)); |
| 113 | SH7372_SCIF(PORT_SCIFA, 1, 0xe6c50000, evt2irq(0x0c20)); |
| 114 | SH7372_SCIF(PORT_SCIFA, 2, 0xe6c60000, evt2irq(0x0c40)); |
| 115 | SH7372_SCIF(PORT_SCIFA, 3, 0xe6c70000, evt2irq(0x0c60)); |
| 116 | SH7372_SCIF(PORT_SCIFA, 4, 0xe6c80000, evt2irq(0x0d20)); |
| 117 | SH7372_SCIF(PORT_SCIFA, 5, 0xe6cb0000, evt2irq(0x0d40)); |
| 118 | SH7372_SCIF(PORT_SCIFB, 6, 0xe6c30000, evt2irq(0x0d60)); |
Magnus Damm | 2b7eda6 | 2010-02-05 11:14:58 +0000 | [diff] [blame] | 119 | |
Kuninori Morimoto | c1909cc | 2010-03-11 10:42:47 +0000 | [diff] [blame] | 120 | /* CMT */ |
Magnus Damm | 0ed61fc | 2011-06-30 09:22:50 +0000 | [diff] [blame] | 121 | static struct sh_timer_config cmt2_platform_data = { |
Laurent Pinchart | 386f60a | 2014-04-23 13:15:09 +0200 | [diff] [blame^] | 122 | .channels_mask = 0x20, |
Magnus Damm | 2b7eda6 | 2010-02-05 11:14:58 +0000 | [diff] [blame] | 123 | }; |
| 124 | |
Magnus Damm | 0ed61fc | 2011-06-30 09:22:50 +0000 | [diff] [blame] | 125 | static struct resource cmt2_resources[] = { |
Laurent Pinchart | 386f60a | 2014-04-23 13:15:09 +0200 | [diff] [blame^] | 126 | DEFINE_RES_MEM(0xe6130000, 0x50), |
| 127 | DEFINE_RES_IRQ(evt2irq(0x0b80)), |
Magnus Damm | 2b7eda6 | 2010-02-05 11:14:58 +0000 | [diff] [blame] | 128 | }; |
| 129 | |
Magnus Damm | 0ed61fc | 2011-06-30 09:22:50 +0000 | [diff] [blame] | 130 | static struct platform_device cmt2_device = { |
Laurent Pinchart | 386f60a | 2014-04-23 13:15:09 +0200 | [diff] [blame^] | 131 | .name = "sh-cmt-32-fast", |
Magnus Damm | 0ed61fc | 2011-06-30 09:22:50 +0000 | [diff] [blame] | 132 | .id = 2, |
Magnus Damm | 2b7eda6 | 2010-02-05 11:14:58 +0000 | [diff] [blame] | 133 | .dev = { |
Magnus Damm | 0ed61fc | 2011-06-30 09:22:50 +0000 | [diff] [blame] | 134 | .platform_data = &cmt2_platform_data, |
Magnus Damm | 2b7eda6 | 2010-02-05 11:14:58 +0000 | [diff] [blame] | 135 | }, |
Magnus Damm | 0ed61fc | 2011-06-30 09:22:50 +0000 | [diff] [blame] | 136 | .resource = cmt2_resources, |
| 137 | .num_resources = ARRAY_SIZE(cmt2_resources), |
Magnus Damm | 2b7eda6 | 2010-02-05 11:14:58 +0000 | [diff] [blame] | 138 | }; |
| 139 | |
Magnus Damm | c6c049e | 2010-10-14 06:57:25 +0000 | [diff] [blame] | 140 | /* TMU */ |
| 141 | static struct sh_timer_config tmu00_platform_data = { |
| 142 | .name = "TMU00", |
| 143 | .channel_offset = 0x4, |
| 144 | .timer_bit = 0, |
| 145 | .clockevent_rating = 200, |
| 146 | }; |
| 147 | |
| 148 | static struct resource tmu00_resources[] = { |
| 149 | [0] = { |
| 150 | .name = "TMU00", |
| 151 | .start = 0xfff60008, |
| 152 | .end = 0xfff60013, |
| 153 | .flags = IORESOURCE_MEM, |
| 154 | }, |
| 155 | [1] = { |
| 156 | .start = intcs_evt2irq(0xe80), /* TMU_TUNI0 */ |
| 157 | .flags = IORESOURCE_IRQ, |
| 158 | }, |
| 159 | }; |
| 160 | |
| 161 | static struct platform_device tmu00_device = { |
| 162 | .name = "sh_tmu", |
| 163 | .id = 0, |
| 164 | .dev = { |
| 165 | .platform_data = &tmu00_platform_data, |
| 166 | }, |
| 167 | .resource = tmu00_resources, |
| 168 | .num_resources = ARRAY_SIZE(tmu00_resources), |
| 169 | }; |
| 170 | |
| 171 | static struct sh_timer_config tmu01_platform_data = { |
| 172 | .name = "TMU01", |
| 173 | .channel_offset = 0x10, |
| 174 | .timer_bit = 1, |
| 175 | .clocksource_rating = 200, |
| 176 | }; |
| 177 | |
| 178 | static struct resource tmu01_resources[] = { |
| 179 | [0] = { |
| 180 | .name = "TMU01", |
| 181 | .start = 0xfff60014, |
| 182 | .end = 0xfff6001f, |
| 183 | .flags = IORESOURCE_MEM, |
| 184 | }, |
| 185 | [1] = { |
| 186 | .start = intcs_evt2irq(0xea0), /* TMU_TUNI1 */ |
| 187 | .flags = IORESOURCE_IRQ, |
| 188 | }, |
| 189 | }; |
| 190 | |
| 191 | static struct platform_device tmu01_device = { |
| 192 | .name = "sh_tmu", |
| 193 | .id = 1, |
| 194 | .dev = { |
| 195 | .platform_data = &tmu01_platform_data, |
| 196 | }, |
| 197 | .resource = tmu01_resources, |
| 198 | .num_resources = ARRAY_SIZE(tmu01_resources), |
| 199 | }; |
| 200 | |
Kuninori Morimoto | c1909cc | 2010-03-11 10:42:47 +0000 | [diff] [blame] | 201 | /* I2C */ |
| 202 | static struct resource iic0_resources[] = { |
| 203 | [0] = { |
| 204 | .name = "IIC0", |
| 205 | .start = 0xFFF20000, |
| 206 | .end = 0xFFF20425 - 1, |
| 207 | .flags = IORESOURCE_MEM, |
| 208 | }, |
| 209 | [1] = { |
Magnus Damm | 33c9607 | 2010-05-20 14:41:00 +0000 | [diff] [blame] | 210 | .start = intcs_evt2irq(0xe00), /* IIC0_ALI0 */ |
| 211 | .end = intcs_evt2irq(0xe60), /* IIC0_DTEI0 */ |
Kuninori Morimoto | c1909cc | 2010-03-11 10:42:47 +0000 | [diff] [blame] | 212 | .flags = IORESOURCE_IRQ, |
| 213 | }, |
| 214 | }; |
| 215 | |
| 216 | static struct platform_device iic0_device = { |
| 217 | .name = "i2c-sh_mobile", |
| 218 | .id = 0, /* "i2c0" clock */ |
| 219 | .num_resources = ARRAY_SIZE(iic0_resources), |
| 220 | .resource = iic0_resources, |
| 221 | }; |
| 222 | |
| 223 | static struct resource iic1_resources[] = { |
| 224 | [0] = { |
| 225 | .name = "IIC1", |
| 226 | .start = 0xE6C20000, |
| 227 | .end = 0xE6C20425 - 1, |
| 228 | .flags = IORESOURCE_MEM, |
| 229 | }, |
| 230 | [1] = { |
Magnus Damm | 33c9607 | 2010-05-20 14:41:00 +0000 | [diff] [blame] | 231 | .start = evt2irq(0x780), /* IIC1_ALI1 */ |
| 232 | .end = evt2irq(0x7e0), /* IIC1_DTEI1 */ |
Kuninori Morimoto | c1909cc | 2010-03-11 10:42:47 +0000 | [diff] [blame] | 233 | .flags = IORESOURCE_IRQ, |
| 234 | }, |
| 235 | }; |
| 236 | |
| 237 | static struct platform_device iic1_device = { |
| 238 | .name = "i2c-sh_mobile", |
| 239 | .id = 1, /* "i2c1" clock */ |
| 240 | .num_resources = ARRAY_SIZE(iic1_resources), |
| 241 | .resource = iic1_resources, |
| 242 | }; |
| 243 | |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 244 | /* DMA */ |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 245 | static const struct sh_dmae_slave_config sh7372_dmae_slaves[] = { |
| 246 | { |
Guennadi Liakhovetski | 8d3e17b | 2010-05-23 16:39:24 +0000 | [diff] [blame] | 247 | .slave_id = SHDMA_SLAVE_SCIF0_TX, |
| 248 | .addr = 0xe6c40020, |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 249 | .chcr = CHCR_TX(XMIT_SZ_8BIT), |
Guennadi Liakhovetski | 8d3e17b | 2010-05-23 16:39:24 +0000 | [diff] [blame] | 250 | .mid_rid = 0x21, |
| 251 | }, { |
| 252 | .slave_id = SHDMA_SLAVE_SCIF0_RX, |
| 253 | .addr = 0xe6c40024, |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 254 | .chcr = CHCR_RX(XMIT_SZ_8BIT), |
Guennadi Liakhovetski | 8d3e17b | 2010-05-23 16:39:24 +0000 | [diff] [blame] | 255 | .mid_rid = 0x22, |
| 256 | }, { |
| 257 | .slave_id = SHDMA_SLAVE_SCIF1_TX, |
| 258 | .addr = 0xe6c50020, |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 259 | .chcr = CHCR_TX(XMIT_SZ_8BIT), |
Guennadi Liakhovetski | 8d3e17b | 2010-05-23 16:39:24 +0000 | [diff] [blame] | 260 | .mid_rid = 0x25, |
| 261 | }, { |
| 262 | .slave_id = SHDMA_SLAVE_SCIF1_RX, |
| 263 | .addr = 0xe6c50024, |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 264 | .chcr = CHCR_RX(XMIT_SZ_8BIT), |
Guennadi Liakhovetski | 8d3e17b | 2010-05-23 16:39:24 +0000 | [diff] [blame] | 265 | .mid_rid = 0x26, |
| 266 | }, { |
| 267 | .slave_id = SHDMA_SLAVE_SCIF2_TX, |
| 268 | .addr = 0xe6c60020, |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 269 | .chcr = CHCR_TX(XMIT_SZ_8BIT), |
Guennadi Liakhovetski | 8d3e17b | 2010-05-23 16:39:24 +0000 | [diff] [blame] | 270 | .mid_rid = 0x29, |
| 271 | }, { |
| 272 | .slave_id = SHDMA_SLAVE_SCIF2_RX, |
| 273 | .addr = 0xe6c60024, |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 274 | .chcr = CHCR_RX(XMIT_SZ_8BIT), |
Guennadi Liakhovetski | 8d3e17b | 2010-05-23 16:39:24 +0000 | [diff] [blame] | 275 | .mid_rid = 0x2a, |
| 276 | }, { |
| 277 | .slave_id = SHDMA_SLAVE_SCIF3_TX, |
| 278 | .addr = 0xe6c70020, |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 279 | .chcr = CHCR_TX(XMIT_SZ_8BIT), |
Guennadi Liakhovetski | 8d3e17b | 2010-05-23 16:39:24 +0000 | [diff] [blame] | 280 | .mid_rid = 0x2d, |
| 281 | }, { |
| 282 | .slave_id = SHDMA_SLAVE_SCIF3_RX, |
| 283 | .addr = 0xe6c70024, |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 284 | .chcr = CHCR_RX(XMIT_SZ_8BIT), |
Guennadi Liakhovetski | 8d3e17b | 2010-05-23 16:39:24 +0000 | [diff] [blame] | 285 | .mid_rid = 0x2e, |
| 286 | }, { |
| 287 | .slave_id = SHDMA_SLAVE_SCIF4_TX, |
| 288 | .addr = 0xe6c80020, |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 289 | .chcr = CHCR_TX(XMIT_SZ_8BIT), |
Guennadi Liakhovetski | 8d3e17b | 2010-05-23 16:39:24 +0000 | [diff] [blame] | 290 | .mid_rid = 0x39, |
| 291 | }, { |
| 292 | .slave_id = SHDMA_SLAVE_SCIF4_RX, |
| 293 | .addr = 0xe6c80024, |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 294 | .chcr = CHCR_RX(XMIT_SZ_8BIT), |
Guennadi Liakhovetski | 8d3e17b | 2010-05-23 16:39:24 +0000 | [diff] [blame] | 295 | .mid_rid = 0x3a, |
| 296 | }, { |
| 297 | .slave_id = SHDMA_SLAVE_SCIF5_TX, |
| 298 | .addr = 0xe6cb0020, |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 299 | .chcr = CHCR_TX(XMIT_SZ_8BIT), |
Guennadi Liakhovetski | 8d3e17b | 2010-05-23 16:39:24 +0000 | [diff] [blame] | 300 | .mid_rid = 0x35, |
| 301 | }, { |
| 302 | .slave_id = SHDMA_SLAVE_SCIF5_RX, |
| 303 | .addr = 0xe6cb0024, |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 304 | .chcr = CHCR_RX(XMIT_SZ_8BIT), |
Guennadi Liakhovetski | 8d3e17b | 2010-05-23 16:39:24 +0000 | [diff] [blame] | 305 | .mid_rid = 0x36, |
| 306 | }, { |
| 307 | .slave_id = SHDMA_SLAVE_SCIF6_TX, |
| 308 | .addr = 0xe6c30040, |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 309 | .chcr = CHCR_TX(XMIT_SZ_8BIT), |
Guennadi Liakhovetski | 8d3e17b | 2010-05-23 16:39:24 +0000 | [diff] [blame] | 310 | .mid_rid = 0x3d, |
| 311 | }, { |
| 312 | .slave_id = SHDMA_SLAVE_SCIF6_RX, |
| 313 | .addr = 0xe6c30060, |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 314 | .chcr = CHCR_RX(XMIT_SZ_8BIT), |
Guennadi Liakhovetski | 8d3e17b | 2010-05-23 16:39:24 +0000 | [diff] [blame] | 315 | .mid_rid = 0x3e, |
| 316 | }, { |
Bastian Hecht | 40eaed7 | 2012-09-22 14:06:38 +0200 | [diff] [blame] | 317 | .slave_id = SHDMA_SLAVE_FLCTL0_TX, |
| 318 | .addr = 0xe6a30050, |
| 319 | .chcr = CHCR_TX(XMIT_SZ_32BIT), |
| 320 | .mid_rid = 0x83, |
| 321 | }, { |
| 322 | .slave_id = SHDMA_SLAVE_FLCTL0_RX, |
| 323 | .addr = 0xe6a30050, |
| 324 | .chcr = CHCR_RX(XMIT_SZ_32BIT), |
| 325 | .mid_rid = 0x83, |
| 326 | }, { |
| 327 | .slave_id = SHDMA_SLAVE_FLCTL1_TX, |
| 328 | .addr = 0xe6a30060, |
| 329 | .chcr = CHCR_TX(XMIT_SZ_32BIT), |
| 330 | .mid_rid = 0x87, |
| 331 | }, { |
| 332 | .slave_id = SHDMA_SLAVE_FLCTL1_RX, |
| 333 | .addr = 0xe6a30060, |
| 334 | .chcr = CHCR_RX(XMIT_SZ_32BIT), |
| 335 | .mid_rid = 0x87, |
| 336 | }, { |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 337 | .slave_id = SHDMA_SLAVE_SDHI0_TX, |
| 338 | .addr = 0xe6850030, |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 339 | .chcr = CHCR_TX(XMIT_SZ_16BIT), |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 340 | .mid_rid = 0xc1, |
| 341 | }, { |
| 342 | .slave_id = SHDMA_SLAVE_SDHI0_RX, |
| 343 | .addr = 0xe6850030, |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 344 | .chcr = CHCR_RX(XMIT_SZ_16BIT), |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 345 | .mid_rid = 0xc2, |
| 346 | }, { |
| 347 | .slave_id = SHDMA_SLAVE_SDHI1_TX, |
| 348 | .addr = 0xe6860030, |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 349 | .chcr = CHCR_TX(XMIT_SZ_16BIT), |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 350 | .mid_rid = 0xc9, |
| 351 | }, { |
| 352 | .slave_id = SHDMA_SLAVE_SDHI1_RX, |
| 353 | .addr = 0xe6860030, |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 354 | .chcr = CHCR_RX(XMIT_SZ_16BIT), |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 355 | .mid_rid = 0xca, |
| 356 | }, { |
| 357 | .slave_id = SHDMA_SLAVE_SDHI2_TX, |
| 358 | .addr = 0xe6870030, |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 359 | .chcr = CHCR_TX(XMIT_SZ_16BIT), |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 360 | .mid_rid = 0xcd, |
| 361 | }, { |
| 362 | .slave_id = SHDMA_SLAVE_SDHI2_RX, |
| 363 | .addr = 0xe6870030, |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 364 | .chcr = CHCR_RX(XMIT_SZ_16BIT), |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 365 | .mid_rid = 0xce, |
Guennadi Liakhovetski | 6d11dc1 | 2010-11-24 10:05:15 +0000 | [diff] [blame] | 366 | }, { |
Kuninori Morimoto | 880452b | 2012-04-01 18:40:01 -0700 | [diff] [blame] | 367 | .slave_id = SHDMA_SLAVE_FSIA_TX, |
| 368 | .addr = 0xfe1f0024, |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 369 | .chcr = CHCR_TX(XMIT_SZ_32BIT), |
Kuninori Morimoto | 880452b | 2012-04-01 18:40:01 -0700 | [diff] [blame] | 370 | .mid_rid = 0xb1, |
| 371 | }, { |
| 372 | .slave_id = SHDMA_SLAVE_FSIA_RX, |
| 373 | .addr = 0xfe1f0020, |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 374 | .chcr = CHCR_RX(XMIT_SZ_32BIT), |
Kuninori Morimoto | 880452b | 2012-04-01 18:40:01 -0700 | [diff] [blame] | 375 | .mid_rid = 0xb2, |
| 376 | }, { |
Guennadi Liakhovetski | 6d11dc1 | 2010-11-24 10:05:15 +0000 | [diff] [blame] | 377 | .slave_id = SHDMA_SLAVE_MMCIF_TX, |
| 378 | .addr = 0xe6bd0034, |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 379 | .chcr = CHCR_TX(XMIT_SZ_32BIT), |
Guennadi Liakhovetski | 6d11dc1 | 2010-11-24 10:05:15 +0000 | [diff] [blame] | 380 | .mid_rid = 0xd1, |
| 381 | }, { |
| 382 | .slave_id = SHDMA_SLAVE_MMCIF_RX, |
| 383 | .addr = 0xe6bd0034, |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 384 | .chcr = CHCR_RX(XMIT_SZ_32BIT), |
Guennadi Liakhovetski | 6d11dc1 | 2010-11-24 10:05:15 +0000 | [diff] [blame] | 385 | .mid_rid = 0xd2, |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 386 | }, |
| 387 | }; |
| 388 | |
Kuninori Morimoto | 4d6344f | 2012-06-20 11:30:32 +0200 | [diff] [blame] | 389 | #define SH7372_CHCLR (0x220 - 0x20) |
Guennadi Liakhovetski | e08b881 | 2012-01-04 15:34:21 +0100 | [diff] [blame] | 390 | |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 391 | static const struct sh_dmae_channel sh7372_dmae_channels[] = { |
| 392 | { |
| 393 | .offset = 0, |
| 394 | .dmars = 0, |
| 395 | .dmars_bit = 0, |
Guennadi Liakhovetski | e08b881 | 2012-01-04 15:34:21 +0100 | [diff] [blame] | 396 | .chclr_offset = SH7372_CHCLR + 0, |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 397 | }, { |
| 398 | .offset = 0x10, |
| 399 | .dmars = 0, |
| 400 | .dmars_bit = 8, |
Guennadi Liakhovetski | e08b881 | 2012-01-04 15:34:21 +0100 | [diff] [blame] | 401 | .chclr_offset = SH7372_CHCLR + 0x10, |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 402 | }, { |
| 403 | .offset = 0x20, |
| 404 | .dmars = 4, |
| 405 | .dmars_bit = 0, |
Guennadi Liakhovetski | e08b881 | 2012-01-04 15:34:21 +0100 | [diff] [blame] | 406 | .chclr_offset = SH7372_CHCLR + 0x20, |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 407 | }, { |
| 408 | .offset = 0x30, |
| 409 | .dmars = 4, |
| 410 | .dmars_bit = 8, |
Guennadi Liakhovetski | e08b881 | 2012-01-04 15:34:21 +0100 | [diff] [blame] | 411 | .chclr_offset = SH7372_CHCLR + 0x30, |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 412 | }, { |
| 413 | .offset = 0x50, |
| 414 | .dmars = 8, |
| 415 | .dmars_bit = 0, |
Guennadi Liakhovetski | e08b881 | 2012-01-04 15:34:21 +0100 | [diff] [blame] | 416 | .chclr_offset = SH7372_CHCLR + 0x50, |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 417 | }, { |
| 418 | .offset = 0x60, |
| 419 | .dmars = 8, |
| 420 | .dmars_bit = 8, |
Guennadi Liakhovetski | e08b881 | 2012-01-04 15:34:21 +0100 | [diff] [blame] | 421 | .chclr_offset = SH7372_CHCLR + 0x60, |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 422 | } |
| 423 | }; |
| 424 | |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 425 | static struct sh_dmae_pdata dma_platform_data = { |
| 426 | .slave = sh7372_dmae_slaves, |
| 427 | .slave_num = ARRAY_SIZE(sh7372_dmae_slaves), |
| 428 | .channel = sh7372_dmae_channels, |
| 429 | .channel_num = ARRAY_SIZE(sh7372_dmae_channels), |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 430 | .ts_low_shift = TS_LOW_SHIFT, |
| 431 | .ts_low_mask = TS_LOW_BIT << TS_LOW_SHIFT, |
| 432 | .ts_high_shift = TS_HI_SHIFT, |
| 433 | .ts_high_mask = TS_HI_BIT << TS_HI_SHIFT, |
| 434 | .ts_shift = dma_ts_shift, |
| 435 | .ts_shift_num = ARRAY_SIZE(dma_ts_shift), |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 436 | .dmaor_init = DMAOR_DME, |
Guennadi Liakhovetski | e08b881 | 2012-01-04 15:34:21 +0100 | [diff] [blame] | 437 | .chclr_present = 1, |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 438 | }; |
| 439 | |
| 440 | /* Resource order important! */ |
| 441 | static struct resource sh7372_dmae0_resources[] = { |
| 442 | { |
| 443 | /* Channel registers and DMAOR */ |
| 444 | .start = 0xfe008020, |
Guennadi Liakhovetski | e08b881 | 2012-01-04 15:34:21 +0100 | [diff] [blame] | 445 | .end = 0xfe00828f, |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 446 | .flags = IORESOURCE_MEM, |
| 447 | }, |
| 448 | { |
| 449 | /* DMARSx */ |
| 450 | .start = 0xfe009000, |
| 451 | .end = 0xfe00900b, |
| 452 | .flags = IORESOURCE_MEM, |
| 453 | }, |
| 454 | { |
Shimoda, Yoshihiro | 2005246 | 2012-01-10 14:21:31 +0900 | [diff] [blame] | 455 | .name = "error_irq", |
Magnus Damm | f989ae5 | 2010-08-31 09:27:53 +0000 | [diff] [blame] | 456 | .start = evt2irq(0x20c0), |
| 457 | .end = evt2irq(0x20c0), |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 458 | .flags = IORESOURCE_IRQ, |
| 459 | }, |
| 460 | { |
| 461 | /* IRQ for channels 0-5 */ |
Magnus Damm | f989ae5 | 2010-08-31 09:27:53 +0000 | [diff] [blame] | 462 | .start = evt2irq(0x2000), |
| 463 | .end = evt2irq(0x20a0), |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 464 | .flags = IORESOURCE_IRQ, |
| 465 | }, |
| 466 | }; |
| 467 | |
| 468 | /* Resource order important! */ |
| 469 | static struct resource sh7372_dmae1_resources[] = { |
| 470 | { |
| 471 | /* Channel registers and DMAOR */ |
| 472 | .start = 0xfe018020, |
Guennadi Liakhovetski | e08b881 | 2012-01-04 15:34:21 +0100 | [diff] [blame] | 473 | .end = 0xfe01828f, |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 474 | .flags = IORESOURCE_MEM, |
| 475 | }, |
| 476 | { |
| 477 | /* DMARSx */ |
| 478 | .start = 0xfe019000, |
| 479 | .end = 0xfe01900b, |
| 480 | .flags = IORESOURCE_MEM, |
| 481 | }, |
| 482 | { |
Shimoda, Yoshihiro | 2005246 | 2012-01-10 14:21:31 +0900 | [diff] [blame] | 483 | .name = "error_irq", |
Magnus Damm | f989ae5 | 2010-08-31 09:27:53 +0000 | [diff] [blame] | 484 | .start = evt2irq(0x21c0), |
| 485 | .end = evt2irq(0x21c0), |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 486 | .flags = IORESOURCE_IRQ, |
| 487 | }, |
| 488 | { |
| 489 | /* IRQ for channels 0-5 */ |
Magnus Damm | f989ae5 | 2010-08-31 09:27:53 +0000 | [diff] [blame] | 490 | .start = evt2irq(0x2100), |
| 491 | .end = evt2irq(0x21a0), |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 492 | .flags = IORESOURCE_IRQ, |
| 493 | }, |
| 494 | }; |
| 495 | |
| 496 | /* Resource order important! */ |
| 497 | static struct resource sh7372_dmae2_resources[] = { |
| 498 | { |
| 499 | /* Channel registers and DMAOR */ |
| 500 | .start = 0xfe028020, |
Guennadi Liakhovetski | e08b881 | 2012-01-04 15:34:21 +0100 | [diff] [blame] | 501 | .end = 0xfe02828f, |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 502 | .flags = IORESOURCE_MEM, |
| 503 | }, |
| 504 | { |
| 505 | /* DMARSx */ |
| 506 | .start = 0xfe029000, |
| 507 | .end = 0xfe02900b, |
| 508 | .flags = IORESOURCE_MEM, |
| 509 | }, |
| 510 | { |
Shimoda, Yoshihiro | 2005246 | 2012-01-10 14:21:31 +0900 | [diff] [blame] | 511 | .name = "error_irq", |
Magnus Damm | f989ae5 | 2010-08-31 09:27:53 +0000 | [diff] [blame] | 512 | .start = evt2irq(0x22c0), |
| 513 | .end = evt2irq(0x22c0), |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 514 | .flags = IORESOURCE_IRQ, |
| 515 | }, |
| 516 | { |
| 517 | /* IRQ for channels 0-5 */ |
Magnus Damm | f989ae5 | 2010-08-31 09:27:53 +0000 | [diff] [blame] | 518 | .start = evt2irq(0x2200), |
| 519 | .end = evt2irq(0x22a0), |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 520 | .flags = IORESOURCE_IRQ, |
| 521 | }, |
| 522 | }; |
| 523 | |
| 524 | static struct platform_device dma0_device = { |
| 525 | .name = "sh-dma-engine", |
| 526 | .id = 0, |
| 527 | .resource = sh7372_dmae0_resources, |
| 528 | .num_resources = ARRAY_SIZE(sh7372_dmae0_resources), |
| 529 | .dev = { |
| 530 | .platform_data = &dma_platform_data, |
| 531 | }, |
| 532 | }; |
| 533 | |
| 534 | static struct platform_device dma1_device = { |
| 535 | .name = "sh-dma-engine", |
| 536 | .id = 1, |
| 537 | .resource = sh7372_dmae1_resources, |
| 538 | .num_resources = ARRAY_SIZE(sh7372_dmae1_resources), |
| 539 | .dev = { |
| 540 | .platform_data = &dma_platform_data, |
| 541 | }, |
| 542 | }; |
| 543 | |
| 544 | static struct platform_device dma2_device = { |
| 545 | .name = "sh-dma-engine", |
| 546 | .id = 2, |
| 547 | .resource = sh7372_dmae2_resources, |
| 548 | .num_resources = ARRAY_SIZE(sh7372_dmae2_resources), |
| 549 | .dev = { |
| 550 | .platform_data = &dma_platform_data, |
| 551 | }, |
| 552 | }; |
| 553 | |
Kuninori Morimoto | afe4804 | 2011-06-17 08:21:10 +0000 | [diff] [blame] | 554 | /* |
| 555 | * USB-DMAC |
| 556 | */ |
Kuninori Morimoto | afe4804 | 2011-06-17 08:21:10 +0000 | [diff] [blame] | 557 | static const struct sh_dmae_channel sh7372_usb_dmae_channels[] = { |
| 558 | { |
| 559 | .offset = 0, |
| 560 | }, { |
| 561 | .offset = 0x20, |
| 562 | }, |
| 563 | }; |
| 564 | |
| 565 | /* USB DMAC0 */ |
| 566 | static const struct sh_dmae_slave_config sh7372_usb_dmae0_slaves[] = { |
| 567 | { |
| 568 | .slave_id = SHDMA_SLAVE_USB0_TX, |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 569 | .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_8BYTE), |
Kuninori Morimoto | afe4804 | 2011-06-17 08:21:10 +0000 | [diff] [blame] | 570 | }, { |
| 571 | .slave_id = SHDMA_SLAVE_USB0_RX, |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 572 | .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_8BYTE), |
Kuninori Morimoto | afe4804 | 2011-06-17 08:21:10 +0000 | [diff] [blame] | 573 | }, |
| 574 | }; |
| 575 | |
| 576 | static struct sh_dmae_pdata usb_dma0_platform_data = { |
| 577 | .slave = sh7372_usb_dmae0_slaves, |
| 578 | .slave_num = ARRAY_SIZE(sh7372_usb_dmae0_slaves), |
| 579 | .channel = sh7372_usb_dmae_channels, |
| 580 | .channel_num = ARRAY_SIZE(sh7372_usb_dmae_channels), |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 581 | .ts_low_shift = USBTS_LOW_SHIFT, |
| 582 | .ts_low_mask = USBTS_LOW_BIT << USBTS_LOW_SHIFT, |
| 583 | .ts_high_shift = USBTS_HI_SHIFT, |
| 584 | .ts_high_mask = USBTS_HI_BIT << USBTS_HI_SHIFT, |
| 585 | .ts_shift = dma_usbts_shift, |
| 586 | .ts_shift_num = ARRAY_SIZE(dma_usbts_shift), |
Kuninori Morimoto | afe4804 | 2011-06-17 08:21:10 +0000 | [diff] [blame] | 587 | .dmaor_init = DMAOR_DME, |
| 588 | .chcr_offset = 0x14, |
| 589 | .chcr_ie_bit = 1 << 5, |
| 590 | .dmaor_is_32bit = 1, |
| 591 | .needs_tend_set = 1, |
| 592 | .no_dmars = 1, |
Guennadi Liakhovetski | c8ddf03 | 2012-01-18 10:14:29 +0100 | [diff] [blame] | 593 | .slave_only = 1, |
Kuninori Morimoto | afe4804 | 2011-06-17 08:21:10 +0000 | [diff] [blame] | 594 | }; |
| 595 | |
| 596 | static struct resource sh7372_usb_dmae0_resources[] = { |
| 597 | { |
| 598 | /* Channel registers and DMAOR */ |
| 599 | .start = 0xe68a0020, |
| 600 | .end = 0xe68a0064 - 1, |
| 601 | .flags = IORESOURCE_MEM, |
| 602 | }, |
| 603 | { |
| 604 | /* VCR/SWR/DMICR */ |
| 605 | .start = 0xe68a0000, |
| 606 | .end = 0xe68a0014 - 1, |
| 607 | .flags = IORESOURCE_MEM, |
| 608 | }, |
| 609 | { |
| 610 | /* IRQ for channels */ |
| 611 | .start = evt2irq(0x0a00), |
| 612 | .end = evt2irq(0x0a00), |
| 613 | .flags = IORESOURCE_IRQ, |
| 614 | }, |
| 615 | }; |
| 616 | |
| 617 | static struct platform_device usb_dma0_device = { |
| 618 | .name = "sh-dma-engine", |
| 619 | .id = 3, |
| 620 | .resource = sh7372_usb_dmae0_resources, |
| 621 | .num_resources = ARRAY_SIZE(sh7372_usb_dmae0_resources), |
| 622 | .dev = { |
| 623 | .platform_data = &usb_dma0_platform_data, |
| 624 | }, |
| 625 | }; |
| 626 | |
| 627 | /* USB DMAC1 */ |
| 628 | static const struct sh_dmae_slave_config sh7372_usb_dmae1_slaves[] = { |
| 629 | { |
| 630 | .slave_id = SHDMA_SLAVE_USB1_TX, |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 631 | .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_8BYTE), |
Kuninori Morimoto | afe4804 | 2011-06-17 08:21:10 +0000 | [diff] [blame] | 632 | }, { |
| 633 | .slave_id = SHDMA_SLAVE_USB1_RX, |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 634 | .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_8BYTE), |
Kuninori Morimoto | afe4804 | 2011-06-17 08:21:10 +0000 | [diff] [blame] | 635 | }, |
| 636 | }; |
| 637 | |
| 638 | static struct sh_dmae_pdata usb_dma1_platform_data = { |
| 639 | .slave = sh7372_usb_dmae1_slaves, |
| 640 | .slave_num = ARRAY_SIZE(sh7372_usb_dmae1_slaves), |
| 641 | .channel = sh7372_usb_dmae_channels, |
| 642 | .channel_num = ARRAY_SIZE(sh7372_usb_dmae_channels), |
Kuninori Morimoto | c317fc5 | 2012-06-25 03:43:19 -0700 | [diff] [blame] | 643 | .ts_low_shift = USBTS_LOW_SHIFT, |
| 644 | .ts_low_mask = USBTS_LOW_BIT << USBTS_LOW_SHIFT, |
| 645 | .ts_high_shift = USBTS_HI_SHIFT, |
| 646 | .ts_high_mask = USBTS_HI_BIT << USBTS_HI_SHIFT, |
| 647 | .ts_shift = dma_usbts_shift, |
| 648 | .ts_shift_num = ARRAY_SIZE(dma_usbts_shift), |
Kuninori Morimoto | afe4804 | 2011-06-17 08:21:10 +0000 | [diff] [blame] | 649 | .dmaor_init = DMAOR_DME, |
| 650 | .chcr_offset = 0x14, |
| 651 | .chcr_ie_bit = 1 << 5, |
| 652 | .dmaor_is_32bit = 1, |
| 653 | .needs_tend_set = 1, |
| 654 | .no_dmars = 1, |
Guennadi Liakhovetski | c8ddf03 | 2012-01-18 10:14:29 +0100 | [diff] [blame] | 655 | .slave_only = 1, |
Kuninori Morimoto | afe4804 | 2011-06-17 08:21:10 +0000 | [diff] [blame] | 656 | }; |
| 657 | |
| 658 | static struct resource sh7372_usb_dmae1_resources[] = { |
| 659 | { |
| 660 | /* Channel registers and DMAOR */ |
| 661 | .start = 0xe68c0020, |
| 662 | .end = 0xe68c0064 - 1, |
| 663 | .flags = IORESOURCE_MEM, |
| 664 | }, |
| 665 | { |
| 666 | /* VCR/SWR/DMICR */ |
| 667 | .start = 0xe68c0000, |
| 668 | .end = 0xe68c0014 - 1, |
| 669 | .flags = IORESOURCE_MEM, |
| 670 | }, |
| 671 | { |
| 672 | /* IRQ for channels */ |
| 673 | .start = evt2irq(0x1d00), |
| 674 | .end = evt2irq(0x1d00), |
| 675 | .flags = IORESOURCE_IRQ, |
| 676 | }, |
| 677 | }; |
| 678 | |
| 679 | static struct platform_device usb_dma1_device = { |
| 680 | .name = "sh-dma-engine", |
| 681 | .id = 4, |
| 682 | .resource = sh7372_usb_dmae1_resources, |
| 683 | .num_resources = ARRAY_SIZE(sh7372_usb_dmae1_resources), |
| 684 | .dev = { |
| 685 | .platform_data = &usb_dma1_platform_data, |
| 686 | }, |
| 687 | }; |
| 688 | |
Magnus Damm | 6822471 | 2011-04-28 03:21:00 +0000 | [diff] [blame] | 689 | /* VPU */ |
| 690 | static struct uio_info vpu_platform_data = { |
| 691 | .name = "VPU5HG", |
| 692 | .version = "0", |
| 693 | .irq = intcs_evt2irq(0x980), |
| 694 | }; |
| 695 | |
| 696 | static struct resource vpu_resources[] = { |
| 697 | [0] = { |
| 698 | .name = "VPU", |
| 699 | .start = 0xfe900000, |
| 700 | .end = 0xfe900157, |
| 701 | .flags = IORESOURCE_MEM, |
| 702 | }, |
| 703 | }; |
| 704 | |
| 705 | static struct platform_device vpu_device = { |
| 706 | .name = "uio_pdrv_genirq", |
| 707 | .id = 0, |
| 708 | .dev = { |
| 709 | .platform_data = &vpu_platform_data, |
| 710 | }, |
| 711 | .resource = vpu_resources, |
| 712 | .num_resources = ARRAY_SIZE(vpu_resources), |
| 713 | }; |
| 714 | |
| 715 | /* VEU0 */ |
| 716 | static struct uio_info veu0_platform_data = { |
| 717 | .name = "VEU0", |
| 718 | .version = "0", |
| 719 | .irq = intcs_evt2irq(0x700), |
| 720 | }; |
| 721 | |
| 722 | static struct resource veu0_resources[] = { |
| 723 | [0] = { |
| 724 | .name = "VEU0", |
| 725 | .start = 0xfe920000, |
| 726 | .end = 0xfe9200cb, |
| 727 | .flags = IORESOURCE_MEM, |
| 728 | }, |
| 729 | }; |
| 730 | |
| 731 | static struct platform_device veu0_device = { |
| 732 | .name = "uio_pdrv_genirq", |
| 733 | .id = 1, |
| 734 | .dev = { |
| 735 | .platform_data = &veu0_platform_data, |
| 736 | }, |
| 737 | .resource = veu0_resources, |
| 738 | .num_resources = ARRAY_SIZE(veu0_resources), |
| 739 | }; |
| 740 | |
| 741 | /* VEU1 */ |
| 742 | static struct uio_info veu1_platform_data = { |
| 743 | .name = "VEU1", |
| 744 | .version = "0", |
| 745 | .irq = intcs_evt2irq(0x720), |
| 746 | }; |
| 747 | |
| 748 | static struct resource veu1_resources[] = { |
| 749 | [0] = { |
| 750 | .name = "VEU1", |
| 751 | .start = 0xfe924000, |
| 752 | .end = 0xfe9240cb, |
| 753 | .flags = IORESOURCE_MEM, |
| 754 | }, |
| 755 | }; |
| 756 | |
| 757 | static struct platform_device veu1_device = { |
| 758 | .name = "uio_pdrv_genirq", |
| 759 | .id = 2, |
| 760 | .dev = { |
| 761 | .platform_data = &veu1_platform_data, |
| 762 | }, |
| 763 | .resource = veu1_resources, |
| 764 | .num_resources = ARRAY_SIZE(veu1_resources), |
| 765 | }; |
| 766 | |
| 767 | /* VEU2 */ |
| 768 | static struct uio_info veu2_platform_data = { |
| 769 | .name = "VEU2", |
| 770 | .version = "0", |
| 771 | .irq = intcs_evt2irq(0x740), |
| 772 | }; |
| 773 | |
| 774 | static struct resource veu2_resources[] = { |
| 775 | [0] = { |
| 776 | .name = "VEU2", |
| 777 | .start = 0xfe928000, |
| 778 | .end = 0xfe928307, |
| 779 | .flags = IORESOURCE_MEM, |
| 780 | }, |
| 781 | }; |
| 782 | |
| 783 | static struct platform_device veu2_device = { |
| 784 | .name = "uio_pdrv_genirq", |
| 785 | .id = 3, |
| 786 | .dev = { |
| 787 | .platform_data = &veu2_platform_data, |
| 788 | }, |
| 789 | .resource = veu2_resources, |
| 790 | .num_resources = ARRAY_SIZE(veu2_resources), |
| 791 | }; |
| 792 | |
| 793 | /* VEU3 */ |
| 794 | static struct uio_info veu3_platform_data = { |
| 795 | .name = "VEU3", |
| 796 | .version = "0", |
| 797 | .irq = intcs_evt2irq(0x760), |
| 798 | }; |
| 799 | |
| 800 | static struct resource veu3_resources[] = { |
| 801 | [0] = { |
| 802 | .name = "VEU3", |
| 803 | .start = 0xfe92c000, |
| 804 | .end = 0xfe92c307, |
| 805 | .flags = IORESOURCE_MEM, |
| 806 | }, |
| 807 | }; |
| 808 | |
| 809 | static struct platform_device veu3_device = { |
| 810 | .name = "uio_pdrv_genirq", |
| 811 | .id = 4, |
| 812 | .dev = { |
| 813 | .platform_data = &veu3_platform_data, |
| 814 | }, |
| 815 | .resource = veu3_resources, |
| 816 | .num_resources = ARRAY_SIZE(veu3_resources), |
| 817 | }; |
| 818 | |
| 819 | /* JPU */ |
| 820 | static struct uio_info jpu_platform_data = { |
| 821 | .name = "JPU", |
| 822 | .version = "0", |
| 823 | .irq = intcs_evt2irq(0x560), |
| 824 | }; |
| 825 | |
| 826 | static struct resource jpu_resources[] = { |
| 827 | [0] = { |
| 828 | .name = "JPU", |
| 829 | .start = 0xfe980000, |
| 830 | .end = 0xfe9902d3, |
| 831 | .flags = IORESOURCE_MEM, |
| 832 | }, |
| 833 | }; |
| 834 | |
| 835 | static struct platform_device jpu_device = { |
| 836 | .name = "uio_pdrv_genirq", |
| 837 | .id = 5, |
| 838 | .dev = { |
| 839 | .platform_data = &jpu_platform_data, |
| 840 | }, |
| 841 | .resource = jpu_resources, |
| 842 | .num_resources = ARRAY_SIZE(jpu_resources), |
| 843 | }; |
| 844 | |
| 845 | /* SPU2DSP0 */ |
| 846 | static struct uio_info spu0_platform_data = { |
| 847 | .name = "SPU2DSP0", |
| 848 | .version = "0", |
| 849 | .irq = evt2irq(0x1800), |
| 850 | }; |
| 851 | |
| 852 | static struct resource spu0_resources[] = { |
| 853 | [0] = { |
| 854 | .name = "SPU2DSP0", |
| 855 | .start = 0xfe200000, |
| 856 | .end = 0xfe2fffff, |
| 857 | .flags = IORESOURCE_MEM, |
| 858 | }, |
| 859 | }; |
| 860 | |
| 861 | static struct platform_device spu0_device = { |
| 862 | .name = "uio_pdrv_genirq", |
| 863 | .id = 6, |
| 864 | .dev = { |
| 865 | .platform_data = &spu0_platform_data, |
| 866 | }, |
| 867 | .resource = spu0_resources, |
| 868 | .num_resources = ARRAY_SIZE(spu0_resources), |
| 869 | }; |
| 870 | |
| 871 | /* SPU2DSP1 */ |
| 872 | static struct uio_info spu1_platform_data = { |
| 873 | .name = "SPU2DSP1", |
| 874 | .version = "0", |
| 875 | .irq = evt2irq(0x1820), |
| 876 | }; |
| 877 | |
| 878 | static struct resource spu1_resources[] = { |
| 879 | [0] = { |
| 880 | .name = "SPU2DSP1", |
| 881 | .start = 0xfe300000, |
| 882 | .end = 0xfe3fffff, |
| 883 | .flags = IORESOURCE_MEM, |
| 884 | }, |
| 885 | }; |
| 886 | |
| 887 | static struct platform_device spu1_device = { |
| 888 | .name = "uio_pdrv_genirq", |
| 889 | .id = 7, |
| 890 | .dev = { |
| 891 | .platform_data = &spu1_platform_data, |
| 892 | }, |
| 893 | .resource = spu1_resources, |
| 894 | .num_resources = ARRAY_SIZE(spu1_resources), |
| 895 | }; |
| 896 | |
Hideki EIRAKU | 3cfb843 | 2013-01-21 19:54:27 +0900 | [diff] [blame] | 897 | /* IPMMUI (an IPMMU module for ICB/LMB) */ |
| 898 | static struct resource ipmmu_resources[] = { |
| 899 | [0] = { |
| 900 | .name = "IPMMUI", |
| 901 | .start = 0xfe951000, |
| 902 | .end = 0xfe9510ff, |
| 903 | .flags = IORESOURCE_MEM, |
| 904 | }, |
| 905 | }; |
| 906 | |
| 907 | static const char * const ipmmu_dev_names[] = { |
| 908 | "sh_mobile_lcdc_fb.0", |
| 909 | "sh_mobile_lcdc_fb.1", |
| 910 | "sh_mobile_ceu.0", |
| 911 | "uio_pdrv_genirq.0", |
| 912 | "uio_pdrv_genirq.1", |
| 913 | "uio_pdrv_genirq.2", |
| 914 | "uio_pdrv_genirq.3", |
| 915 | "uio_pdrv_genirq.4", |
| 916 | "uio_pdrv_genirq.5", |
| 917 | }; |
| 918 | |
| 919 | static struct shmobile_ipmmu_platform_data ipmmu_platform_data = { |
| 920 | .dev_names = ipmmu_dev_names, |
| 921 | .num_dev_names = ARRAY_SIZE(ipmmu_dev_names), |
| 922 | }; |
| 923 | |
| 924 | static struct platform_device ipmmu_device = { |
| 925 | .name = "ipmmu", |
| 926 | .id = -1, |
| 927 | .dev = { |
| 928 | .platform_data = &ipmmu_platform_data, |
| 929 | }, |
| 930 | .resource = ipmmu_resources, |
| 931 | .num_resources = ARRAY_SIZE(ipmmu_resources), |
| 932 | }; |
| 933 | |
Magnus Damm | 2b7eda6 | 2010-02-05 11:14:58 +0000 | [diff] [blame] | 934 | static struct platform_device *sh7372_early_devices[] __initdata = { |
| 935 | &scif0_device, |
| 936 | &scif1_device, |
| 937 | &scif2_device, |
| 938 | &scif3_device, |
| 939 | &scif4_device, |
| 940 | &scif5_device, |
| 941 | &scif6_device, |
Magnus Damm | 0ed61fc | 2011-06-30 09:22:50 +0000 | [diff] [blame] | 942 | &cmt2_device, |
Magnus Damm | c6c049e | 2010-10-14 06:57:25 +0000 | [diff] [blame] | 943 | &tmu00_device, |
| 944 | &tmu01_device, |
Hideki EIRAKU | 3cfb843 | 2013-01-21 19:54:27 +0900 | [diff] [blame] | 945 | &ipmmu_device, |
Magnus Damm | 934e407 | 2010-10-13 07:22:11 +0000 | [diff] [blame] | 946 | }; |
| 947 | |
| 948 | static struct platform_device *sh7372_late_devices[] __initdata = { |
Kuninori Morimoto | c1909cc | 2010-03-11 10:42:47 +0000 | [diff] [blame] | 949 | &iic0_device, |
| 950 | &iic1_device, |
Guennadi Liakhovetski | 69bf6f4 | 2010-05-04 14:07:15 +0000 | [diff] [blame] | 951 | &dma0_device, |
| 952 | &dma1_device, |
| 953 | &dma2_device, |
Kuninori Morimoto | afe4804 | 2011-06-17 08:21:10 +0000 | [diff] [blame] | 954 | &usb_dma0_device, |
| 955 | &usb_dma1_device, |
Magnus Damm | 6822471 | 2011-04-28 03:21:00 +0000 | [diff] [blame] | 956 | &vpu_device, |
| 957 | &veu0_device, |
| 958 | &veu1_device, |
| 959 | &veu2_device, |
| 960 | &veu3_device, |
| 961 | &jpu_device, |
| 962 | &spu0_device, |
| 963 | &spu1_device, |
Magnus Damm | 2b7eda6 | 2010-02-05 11:14:58 +0000 | [diff] [blame] | 964 | }; |
| 965 | |
| 966 | void __init sh7372_add_standard_devices(void) |
| 967 | { |
Rafael J. Wysocki | ac18e02 | 2012-08-15 20:56:26 +0200 | [diff] [blame] | 968 | struct pm_domain_device domain_devices[] = { |
| 969 | { "A3RV", &vpu_device, }, |
| 970 | { "A4MP", &spu0_device, }, |
| 971 | { "A4MP", &spu1_device, }, |
| 972 | { "A3SP", &scif0_device, }, |
| 973 | { "A3SP", &scif1_device, }, |
| 974 | { "A3SP", &scif2_device, }, |
| 975 | { "A3SP", &scif3_device, }, |
| 976 | { "A3SP", &scif4_device, }, |
| 977 | { "A3SP", &scif5_device, }, |
| 978 | { "A3SP", &scif6_device, }, |
| 979 | { "A3SP", &iic1_device, }, |
| 980 | { "A3SP", &dma0_device, }, |
| 981 | { "A3SP", &dma1_device, }, |
| 982 | { "A3SP", &dma2_device, }, |
| 983 | { "A3SP", &usb_dma0_device, }, |
| 984 | { "A3SP", &usb_dma1_device, }, |
| 985 | { "A4R", &iic0_device, }, |
| 986 | { "A4R", &veu0_device, }, |
| 987 | { "A4R", &veu1_device, }, |
| 988 | { "A4R", &veu2_device, }, |
| 989 | { "A4R", &veu3_device, }, |
| 990 | { "A4R", &jpu_device, }, |
| 991 | { "A4R", &tmu00_device, }, |
| 992 | { "A4R", &tmu01_device, }, |
Rafael J. Wysocki | c37b7a7 | 2012-08-08 00:28:36 +0200 | [diff] [blame] | 993 | }; |
| 994 | |
Rafael J. Wysocki | e7e59a4 | 2012-08-07 01:12:56 +0200 | [diff] [blame] | 995 | sh7372_init_pm_domains(); |
Magnus Damm | f7dadb3 | 2011-12-23 01:23:07 +0100 | [diff] [blame] | 996 | |
Magnus Damm | 2b7eda6 | 2010-02-05 11:14:58 +0000 | [diff] [blame] | 997 | platform_add_devices(sh7372_early_devices, |
| 998 | ARRAY_SIZE(sh7372_early_devices)); |
Magnus Damm | 934e407 | 2010-10-13 07:22:11 +0000 | [diff] [blame] | 999 | |
| 1000 | platform_add_devices(sh7372_late_devices, |
| 1001 | ARRAY_SIZE(sh7372_late_devices)); |
Magnus Damm | 33afebf | 2011-07-01 22:14:45 +0200 | [diff] [blame] | 1002 | |
Rafael J. Wysocki | ac18e02 | 2012-08-15 20:56:26 +0200 | [diff] [blame] | 1003 | rmobile_add_devices_to_domains(domain_devices, |
| 1004 | ARRAY_SIZE(domain_devices)); |
Magnus Damm | 2b7eda6 | 2010-02-05 11:14:58 +0000 | [diff] [blame] | 1005 | } |
| 1006 | |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 1007 | void __init sh7372_earlytimer_init(void) |
Magnus Damm | 17254bf | 2012-03-06 17:36:37 +0900 | [diff] [blame] | 1008 | { |
| 1009 | sh7372_clock_init(); |
| 1010 | shmobile_earlytimer_init(); |
| 1011 | } |
| 1012 | |
Magnus Damm | 2b7eda6 | 2010-02-05 11:14:58 +0000 | [diff] [blame] | 1013 | void __init sh7372_add_early_devices(void) |
| 1014 | { |
Magnus Damm | 2b7eda6 | 2010-02-05 11:14:58 +0000 | [diff] [blame] | 1015 | early_platform_add_devices(sh7372_early_devices, |
| 1016 | ARRAY_SIZE(sh7372_early_devices)); |
Magnus Damm | 5d7220ec | 2012-02-29 21:37:19 +0900 | [diff] [blame] | 1017 | |
| 1018 | /* setup early console here as well */ |
| 1019 | shmobile_setup_console(); |
Magnus Damm | 2b7eda6 | 2010-02-05 11:14:58 +0000 | [diff] [blame] | 1020 | } |
Magnus Damm | 3b7b705 | 2012-03-28 15:53:40 +0900 | [diff] [blame] | 1021 | |
| 1022 | #ifdef CONFIG_USE_OF |
| 1023 | |
| 1024 | void __init sh7372_add_early_devices_dt(void) |
| 1025 | { |
| 1026 | shmobile_setup_delay(800, 1, 3); /* Cortex-A8 @ 800MHz */ |
| 1027 | |
| 1028 | early_platform_add_devices(sh7372_early_devices, |
| 1029 | ARRAY_SIZE(sh7372_early_devices)); |
| 1030 | |
| 1031 | /* setup early console here as well */ |
| 1032 | shmobile_setup_console(); |
| 1033 | } |
| 1034 | |
Magnus Damm | 3b7b705 | 2012-03-28 15:53:40 +0900 | [diff] [blame] | 1035 | void __init sh7372_add_standard_devices_dt(void) |
| 1036 | { |
| 1037 | /* clocks are setup late during boot in the case of DT */ |
| 1038 | sh7372_clock_init(); |
| 1039 | |
| 1040 | platform_add_devices(sh7372_early_devices, |
| 1041 | ARRAY_SIZE(sh7372_early_devices)); |
| 1042 | |
Magnus Damm | 975e5af | 2013-07-01 14:41:55 +0900 | [diff] [blame] | 1043 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
Magnus Damm | 3b7b705 | 2012-03-28 15:53:40 +0900 | [diff] [blame] | 1044 | } |
| 1045 | |
| 1046 | static const char *sh7372_boards_compat_dt[] __initdata = { |
| 1047 | "renesas,sh7372", |
| 1048 | NULL, |
| 1049 | }; |
| 1050 | |
| 1051 | DT_MACHINE_START(SH7372_DT, "Generic SH7372 (Flattened Device Tree)") |
| 1052 | .map_io = sh7372_map_io, |
| 1053 | .init_early = sh7372_add_early_devices_dt, |
| 1054 | .nr_irqs = NR_IRQS_LEGACY, |
| 1055 | .init_irq = sh7372_init_irq, |
| 1056 | .handle_irq = shmobile_handle_irq_intc, |
| 1057 | .init_machine = sh7372_add_standard_devices_dt, |
Magnus Damm | 3b7b705 | 2012-03-28 15:53:40 +0900 | [diff] [blame] | 1058 | .dt_compat = sh7372_boards_compat_dt, |
| 1059 | MACHINE_END |
| 1060 | |
| 1061 | #endif /* CONFIG_USE_OF */ |