| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
 | 2 |  * arch/ppc/syslib/mpc52xx_devices.c | 
 | 3 |  * | 
 | 4 |  * Freescale MPC52xx device descriptions | 
 | 5 |  * | 
 | 6 |  * | 
 | 7 |  * Maintainer : Sylvain Munaut <tnt@246tNt.com> | 
 | 8 |  * | 
 | 9 |  * Copyright (C) 2005 Sylvain Munaut <tnt@246tNt.com> | 
 | 10 |  * | 
 | 11 |  * This file is licensed under the terms of the GNU General Public License | 
 | 12 |  * version 2. This program is licensed "as is" without any warranty of any | 
 | 13 |  * kind, whether express or implied. | 
 | 14 |  */ | 
 | 15 |  | 
 | 16 | #include <linux/fsl_devices.h> | 
 | 17 | #include <linux/resource.h> | 
 | 18 | #include <asm/mpc52xx.h> | 
 | 19 | #include <asm/ppc_sys.h> | 
 | 20 |  | 
 | 21 |  | 
 | 22 | static u64 mpc52xx_dma_mask = 0xffffffffULL; | 
 | 23 |  | 
 | 24 | static struct fsl_i2c_platform_data mpc52xx_fsl_i2c_pdata = { | 
 | 25 | 	.device_flags = FSL_I2C_DEV_CLOCK_5200, | 
 | 26 | }; | 
 | 27 |  | 
 | 28 |  | 
 | 29 | /* We use relative offsets for IORESOURCE_MEM to be independent from the | 
 | 30 |  * MBAR location at compile time | 
 | 31 |  */ | 
 | 32 |  | 
 | 33 | /* TODO Add the BestComm initiator channel to the device definitions, | 
 | 34 |    possibly using IORESOURCE_DMA. But that's when BestComm is ready ... */ | 
 | 35 |  | 
 | 36 | struct platform_device ppc_sys_platform_devices[] = { | 
 | 37 | 	[MPC52xx_MSCAN1] = { | 
 | 38 | 		.name		= "mpc52xx-mscan", | 
 | 39 | 		.id		= 0, | 
 | 40 | 		.num_resources	= 2, | 
 | 41 | 		.resource = (struct resource[]) { | 
 | 42 | 			{ | 
 | 43 | 				.start	= 0x0900, | 
 | 44 | 				.end	= 0x097f, | 
 | 45 | 				.flags	= IORESOURCE_MEM, | 
 | 46 | 			}, | 
 | 47 | 			{ | 
 | 48 | 				.start	= MPC52xx_MSCAN1_IRQ, | 
 | 49 | 				.end	= MPC52xx_MSCAN1_IRQ, | 
 | 50 | 				.flags	= IORESOURCE_IRQ, | 
 | 51 | 			}, | 
 | 52 | 		}, | 
 | 53 | 	}, | 
 | 54 | 	[MPC52xx_MSCAN2] = { | 
 | 55 | 		.name		= "mpc52xx-mscan", | 
 | 56 | 		.id		= 1, | 
 | 57 | 		.num_resources	= 2, | 
 | 58 | 		.resource = (struct resource[]) { | 
 | 59 | 			{ | 
 | 60 | 				.start	= 0x0980, | 
 | 61 | 				.end	= 0x09ff, | 
 | 62 | 				.flags	= IORESOURCE_MEM, | 
 | 63 | 			}, | 
 | 64 | 			{ | 
 | 65 | 				.start	= MPC52xx_MSCAN2_IRQ, | 
 | 66 | 				.end	= MPC52xx_MSCAN2_IRQ, | 
 | 67 | 				.flags	= IORESOURCE_IRQ, | 
 | 68 | 			}, | 
 | 69 | 		}, | 
 | 70 | 	}, | 
 | 71 | 	[MPC52xx_SPI] = { | 
 | 72 | 		.name		= "mpc52xx-spi", | 
 | 73 | 		.id		= -1, | 
 | 74 | 		.num_resources	= 3, | 
 | 75 | 		.resource	= (struct resource[]) { | 
 | 76 | 			{ | 
 | 77 | 				.start	= 0x0f00, | 
 | 78 | 				.end	= 0x0f1f, | 
 | 79 | 				.flags	= IORESOURCE_MEM, | 
 | 80 | 			}, | 
 | 81 | 			{ | 
 | 82 | 				.name	= "modf", | 
 | 83 | 				.start	= MPC52xx_SPI_MODF_IRQ, | 
 | 84 | 				.end	= MPC52xx_SPI_MODF_IRQ, | 
 | 85 | 				.flags	= IORESOURCE_IRQ, | 
 | 86 | 			}, | 
 | 87 | 			{ | 
 | 88 | 				.name	= "spif", | 
 | 89 | 				.start	= MPC52xx_SPI_SPIF_IRQ, | 
 | 90 | 				.end	= MPC52xx_SPI_SPIF_IRQ, | 
 | 91 | 				.flags	= IORESOURCE_IRQ, | 
 | 92 | 			}, | 
 | 93 | 		}, | 
 | 94 | 	}, | 
 | 95 | 	[MPC52xx_USB] = { | 
 | 96 | 		.name		= "ppc-soc-ohci", | 
 | 97 | 		.id		= -1, | 
 | 98 | 		.num_resources	= 2, | 
 | 99 | 		.dev.dma_mask	= &mpc52xx_dma_mask, | 
 | 100 | 		.dev.coherent_dma_mask = 0xffffffffULL, | 
 | 101 | 		.resource	= (struct resource[]) { | 
 | 102 | 			{ | 
 | 103 | 				.start	= 0x1000, | 
 | 104 | 				.end	= 0x10ff, | 
 | 105 | 				.flags	= IORESOURCE_MEM, | 
 | 106 | 			}, | 
 | 107 | 			{ | 
 | 108 | 				.start	= MPC52xx_USB_IRQ, | 
 | 109 | 				.end	= MPC52xx_USB_IRQ, | 
 | 110 | 				.flags	= IORESOURCE_IRQ, | 
 | 111 | 			}, | 
 | 112 | 		}, | 
 | 113 | 	}, | 
 | 114 | 	[MPC52xx_BDLC] = { | 
 | 115 | 		.name		= "mpc52xx-bdlc", | 
 | 116 | 		.id		= -1, | 
 | 117 | 		.num_resources	= 2, | 
 | 118 | 		.resource	= (struct resource[]) { | 
 | 119 | 			{ | 
 | 120 | 				.start	= 0x1300, | 
 | 121 | 				.end	= 0x130f, | 
 | 122 | 				.flags	= IORESOURCE_MEM, | 
 | 123 | 			}, | 
 | 124 | 			{ | 
 | 125 | 				.start	= MPC52xx_BDLC_IRQ, | 
 | 126 | 				.end	= MPC52xx_BDLC_IRQ, | 
 | 127 | 				.flags	= IORESOURCE_IRQ, | 
 | 128 | 			}, | 
 | 129 | 		}, | 
 | 130 | 	}, | 
 | 131 | 	[MPC52xx_PSC1] = { | 
 | 132 | 		.name		= "mpc52xx-psc", | 
 | 133 | 		.id		= 0, | 
 | 134 | 		.num_resources	= 2, | 
 | 135 | 		.resource	= (struct resource[]) { | 
 | 136 | 			{ | 
 | 137 | 				.start	= 0x2000, | 
 | 138 | 				.end	= 0x209f, | 
 | 139 | 				.flags	= IORESOURCE_MEM, | 
 | 140 | 			}, | 
 | 141 | 			{ | 
 | 142 | 				.start	= MPC52xx_PSC1_IRQ, | 
 | 143 | 				.end	= MPC52xx_PSC1_IRQ, | 
 | 144 | 				.flags	= IORESOURCE_IRQ, | 
 | 145 | 			}, | 
 | 146 | 		}, | 
 | 147 | 	}, | 
 | 148 | 	[MPC52xx_PSC2] = { | 
 | 149 | 		.name		= "mpc52xx-psc", | 
 | 150 | 		.id		= 1, | 
 | 151 | 		.num_resources	= 2, | 
 | 152 | 		.resource	= (struct resource[]) { | 
 | 153 | 			{ | 
 | 154 | 				.start	= 0x2200, | 
 | 155 | 				.end	= 0x229f, | 
 | 156 | 				.flags	= IORESOURCE_MEM, | 
 | 157 | 			}, | 
 | 158 | 			{ | 
 | 159 | 				.start	= MPC52xx_PSC2_IRQ, | 
 | 160 | 				.end	= MPC52xx_PSC2_IRQ, | 
 | 161 | 				.flags	= IORESOURCE_IRQ, | 
 | 162 | 			}, | 
 | 163 | 		}, | 
 | 164 | 	}, | 
 | 165 | 	[MPC52xx_PSC3] = { | 
 | 166 | 		.name		= "mpc52xx-psc", | 
 | 167 | 		.id		= 2, | 
 | 168 | 		.num_resources	= 2, | 
 | 169 | 		.resource	= (struct resource[]) { | 
 | 170 | 			{ | 
 | 171 | 				.start	= 0x2400, | 
 | 172 | 				.end	= 0x249f, | 
 | 173 | 				.flags	= IORESOURCE_MEM, | 
 | 174 | 			}, | 
 | 175 | 			{ | 
 | 176 | 				.start	= MPC52xx_PSC3_IRQ, | 
 | 177 | 				.end	= MPC52xx_PSC3_IRQ, | 
 | 178 | 				.flags	= IORESOURCE_IRQ, | 
 | 179 | 			}, | 
 | 180 | 		}, | 
 | 181 | 	}, | 
 | 182 | 	[MPC52xx_PSC4] = { | 
 | 183 | 		.name		= "mpc52xx-psc", | 
 | 184 | 		.id		= 3, | 
 | 185 | 		.num_resources	= 2, | 
 | 186 | 		.resource	= (struct resource[]) { | 
 | 187 | 			{ | 
 | 188 | 				.start	= 0x2600, | 
 | 189 | 				.end	= 0x269f, | 
 | 190 | 				.flags	= IORESOURCE_MEM, | 
 | 191 | 			}, | 
 | 192 | 			{ | 
 | 193 | 				.start	= MPC52xx_PSC4_IRQ, | 
 | 194 | 				.end	= MPC52xx_PSC4_IRQ, | 
 | 195 | 				.flags	= IORESOURCE_IRQ, | 
 | 196 | 			}, | 
 | 197 | 		}, | 
 | 198 | 	}, | 
 | 199 | 	[MPC52xx_PSC5] = { | 
 | 200 | 		.name		= "mpc52xx-psc", | 
 | 201 | 		.id		= 4, | 
 | 202 | 		.num_resources	= 2, | 
 | 203 | 		.resource	= (struct resource[]) { | 
 | 204 | 			{ | 
 | 205 | 				.start	= 0x2800, | 
 | 206 | 				.end	= 0x289f, | 
 | 207 | 				.flags	= IORESOURCE_MEM, | 
 | 208 | 			}, | 
 | 209 | 			{ | 
 | 210 | 				.start	= MPC52xx_PSC5_IRQ, | 
 | 211 | 				.end	= MPC52xx_PSC5_IRQ, | 
 | 212 | 				.flags	= IORESOURCE_IRQ, | 
 | 213 | 			}, | 
 | 214 | 		}, | 
 | 215 | 	}, | 
 | 216 | 	[MPC52xx_PSC6] = { | 
 | 217 | 		.name		= "mpc52xx-psc", | 
 | 218 | 		.id		= 5, | 
 | 219 | 		.num_resources	= 2, | 
 | 220 | 		.resource	= (struct resource[]) { | 
 | 221 | 			{ | 
 | 222 | 				.start	= 0x2c00, | 
 | 223 | 				.end	= 0x2c9f, | 
 | 224 | 				.flags	= IORESOURCE_MEM, | 
 | 225 | 			}, | 
 | 226 | 			{ | 
 | 227 | 				.start	= MPC52xx_PSC6_IRQ, | 
 | 228 | 				.end	= MPC52xx_PSC6_IRQ, | 
 | 229 | 				.flags	= IORESOURCE_IRQ, | 
 | 230 | 			}, | 
 | 231 | 		}, | 
 | 232 | 	}, | 
 | 233 | 	[MPC52xx_FEC] = { | 
 | 234 | 		.name		= "mpc52xx-fec", | 
 | 235 | 		.id		= -1, | 
 | 236 | 		.num_resources	= 2, | 
 | 237 | 		.resource	= (struct resource[]) { | 
 | 238 | 			{ | 
 | 239 | 				.start	= 0x3000, | 
 | 240 | 				.end	= 0x33ff, | 
 | 241 | 				.flags	= IORESOURCE_MEM, | 
 | 242 | 			}, | 
 | 243 | 			{ | 
 | 244 | 				.start	= MPC52xx_FEC_IRQ, | 
 | 245 | 				.end	= MPC52xx_FEC_IRQ, | 
 | 246 | 				.flags	= IORESOURCE_IRQ, | 
 | 247 | 			}, | 
 | 248 | 		}, | 
 | 249 | 	}, | 
 | 250 | 	[MPC52xx_ATA] = { | 
 | 251 | 		.name		= "mpc52xx-ata", | 
 | 252 | 		.id		= -1, | 
 | 253 | 		.num_resources	= 2, | 
 | 254 | 		.resource	= (struct resource[]) { | 
 | 255 | 			{ | 
 | 256 | 				.start	= 0x3a00, | 
 | 257 | 				.end	= 0x3aff, | 
 | 258 | 				.flags	= IORESOURCE_MEM, | 
 | 259 | 			}, | 
 | 260 | 			{ | 
 | 261 | 				.start	= MPC52xx_ATA_IRQ, | 
 | 262 | 				.end	= MPC52xx_ATA_IRQ, | 
 | 263 | 				.flags	= IORESOURCE_IRQ, | 
 | 264 | 			}, | 
 | 265 | 		}, | 
 | 266 | 	}, | 
 | 267 | 	[MPC52xx_I2C1] = { | 
 | 268 | 		.name		= "fsl-i2c", | 
 | 269 | 		.id		= 0, | 
 | 270 | 		.dev.platform_data = &mpc52xx_fsl_i2c_pdata, | 
 | 271 | 		.num_resources	= 2, | 
 | 272 | 		.resource	= (struct resource[]) { | 
 | 273 | 			{ | 
 | 274 | 				.start	= 0x3d00, | 
 | 275 | 				.end	= 0x3d1f, | 
 | 276 | 				.flags	= IORESOURCE_MEM, | 
 | 277 | 			}, | 
 | 278 | 			{ | 
 | 279 | 				.start	= MPC52xx_I2C1_IRQ, | 
 | 280 | 				.end	= MPC52xx_I2C1_IRQ, | 
 | 281 | 				.flags	= IORESOURCE_IRQ, | 
 | 282 | 			}, | 
 | 283 | 		}, | 
 | 284 | 	}, | 
 | 285 | 	[MPC52xx_I2C2] = { | 
 | 286 | 		.name		= "fsl-i2c", | 
 | 287 | 		.id		= 1, | 
 | 288 | 		.dev.platform_data = &mpc52xx_fsl_i2c_pdata, | 
 | 289 | 		.num_resources	= 2, | 
 | 290 | 		.resource	= (struct resource[]) { | 
 | 291 | 			{ | 
 | 292 | 				.start	= 0x3d40, | 
 | 293 | 				.end	= 0x3d5f, | 
 | 294 | 				.flags	= IORESOURCE_MEM, | 
 | 295 | 			}, | 
 | 296 | 			{ | 
 | 297 | 				.start	= MPC52xx_I2C2_IRQ, | 
 | 298 | 				.end	= MPC52xx_I2C2_IRQ, | 
 | 299 | 				.flags	= IORESOURCE_IRQ, | 
 | 300 | 			}, | 
 | 301 | 		}, | 
 | 302 | 	}, | 
 | 303 | }; | 
 | 304 |  | 
 | 305 |  | 
 | 306 | static int __init mach_mpc52xx_fixup(struct platform_device *pdev) | 
 | 307 | { | 
 | 308 | 	ppc_sys_fixup_mem_resource(pdev, MPC52xx_MBAR); | 
 | 309 | 	return 0; | 
 | 310 | } | 
 | 311 |  | 
 | 312 | static int __init mach_mpc52xx_init(void) | 
 | 313 | { | 
 | 314 | 	ppc_sys_device_fixup = mach_mpc52xx_fixup; | 
 | 315 | 	return 0; | 
 | 316 | } | 
 | 317 |  | 
 | 318 | postcore_initcall(mach_mpc52xx_init); |