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