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