Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * arch/ppc/platforms/83xx/mpc83xx_devices.c |
| 3 | * |
| 4 | * MPC83xx Device descriptions |
| 5 | * |
| 6 | * Maintainer: Kumar Gala <kumar.gala@freescale.com> |
| 7 | * |
| 8 | * Copyright 2005 Freescale Semiconductor Inc. |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify it |
| 11 | * under the terms of the GNU General Public License as published by the |
| 12 | * Free Software Foundation; either version 2 of the License, or (at your |
| 13 | * option) any later version. |
| 14 | */ |
| 15 | |
| 16 | #include <linux/init.h> |
| 17 | #include <linux/module.h> |
| 18 | #include <linux/device.h> |
| 19 | #include <linux/serial_8250.h> |
| 20 | #include <linux/fsl_devices.h> |
| 21 | #include <asm/mpc83xx.h> |
| 22 | #include <asm/irq.h> |
| 23 | #include <asm/ppc_sys.h> |
| 24 | |
| 25 | /* We use offsets for IORESOURCE_MEM since we do not know at compile time |
| 26 | * what IMMRBAR is, will get fixed up by mach_mpc83xx_fixup |
| 27 | */ |
| 28 | |
| 29 | static struct gianfar_platform_data mpc83xx_tsec1_pdata = { |
| 30 | .device_flags = FSL_GIANFAR_DEV_HAS_GIGABIT | |
| 31 | FSL_GIANFAR_DEV_HAS_COALESCE | FSL_GIANFAR_DEV_HAS_RMON | |
| 32 | FSL_GIANFAR_DEV_HAS_MULTI_INTR, |
| 33 | .phy_reg_addr = 0x24000, |
| 34 | }; |
| 35 | |
| 36 | static struct gianfar_platform_data mpc83xx_tsec2_pdata = { |
| 37 | .device_flags = FSL_GIANFAR_DEV_HAS_GIGABIT | |
| 38 | FSL_GIANFAR_DEV_HAS_COALESCE | FSL_GIANFAR_DEV_HAS_RMON | |
| 39 | FSL_GIANFAR_DEV_HAS_MULTI_INTR, |
| 40 | .phy_reg_addr = 0x24000, |
| 41 | }; |
| 42 | |
| 43 | static struct fsl_i2c_platform_data mpc83xx_fsl_i2c1_pdata = { |
| 44 | .device_flags = FSL_I2C_DEV_SEPARATE_DFSRR, |
| 45 | }; |
| 46 | |
| 47 | static struct fsl_i2c_platform_data mpc83xx_fsl_i2c2_pdata = { |
| 48 | .device_flags = FSL_I2C_DEV_SEPARATE_DFSRR, |
| 49 | }; |
| 50 | |
| 51 | static struct plat_serial8250_port serial_platform_data[] = { |
| 52 | [0] = { |
| 53 | .mapbase = 0x4500, |
| 54 | .irq = MPC83xx_IRQ_UART1, |
| 55 | .iotype = UPIO_MEM, |
| 56 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, |
| 57 | }, |
| 58 | [1] = { |
| 59 | .mapbase = 0x4600, |
| 60 | .irq = MPC83xx_IRQ_UART2, |
| 61 | .iotype = UPIO_MEM, |
| 62 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, |
| 63 | }, |
| 64 | }; |
| 65 | |
| 66 | struct platform_device ppc_sys_platform_devices[] = { |
| 67 | [MPC83xx_TSEC1] = { |
| 68 | .name = "fsl-gianfar", |
| 69 | .id = 1, |
| 70 | .dev.platform_data = &mpc83xx_tsec1_pdata, |
| 71 | .num_resources = 4, |
| 72 | .resource = (struct resource[]) { |
| 73 | { |
| 74 | .start = 0x24000, |
| 75 | .end = 0x24fff, |
| 76 | .flags = IORESOURCE_MEM, |
| 77 | }, |
| 78 | { |
| 79 | .name = "tx", |
| 80 | .start = MPC83xx_IRQ_TSEC1_TX, |
| 81 | .end = MPC83xx_IRQ_TSEC1_TX, |
| 82 | .flags = IORESOURCE_IRQ, |
| 83 | }, |
| 84 | { |
| 85 | .name = "rx", |
| 86 | .start = MPC83xx_IRQ_TSEC1_RX, |
| 87 | .end = MPC83xx_IRQ_TSEC1_RX, |
| 88 | .flags = IORESOURCE_IRQ, |
| 89 | }, |
| 90 | { |
| 91 | .name = "error", |
| 92 | .start = MPC83xx_IRQ_TSEC1_ERROR, |
| 93 | .end = MPC83xx_IRQ_TSEC1_ERROR, |
| 94 | .flags = IORESOURCE_IRQ, |
| 95 | }, |
| 96 | }, |
| 97 | }, |
| 98 | [MPC83xx_TSEC2] = { |
| 99 | .name = "fsl-gianfar", |
| 100 | .id = 2, |
| 101 | .dev.platform_data = &mpc83xx_tsec2_pdata, |
| 102 | .num_resources = 4, |
| 103 | .resource = (struct resource[]) { |
| 104 | { |
| 105 | .start = 0x25000, |
| 106 | .end = 0x25fff, |
| 107 | .flags = IORESOURCE_MEM, |
| 108 | }, |
| 109 | { |
| 110 | .name = "tx", |
| 111 | .start = MPC83xx_IRQ_TSEC2_TX, |
| 112 | .end = MPC83xx_IRQ_TSEC2_TX, |
| 113 | .flags = IORESOURCE_IRQ, |
| 114 | }, |
| 115 | { |
| 116 | .name = "rx", |
| 117 | .start = MPC83xx_IRQ_TSEC2_RX, |
| 118 | .end = MPC83xx_IRQ_TSEC2_RX, |
| 119 | .flags = IORESOURCE_IRQ, |
| 120 | }, |
| 121 | { |
| 122 | .name = "error", |
| 123 | .start = MPC83xx_IRQ_TSEC2_ERROR, |
| 124 | .end = MPC83xx_IRQ_TSEC2_ERROR, |
| 125 | .flags = IORESOURCE_IRQ, |
| 126 | }, |
| 127 | }, |
| 128 | }, |
| 129 | [MPC83xx_IIC1] = { |
| 130 | .name = "fsl-i2c", |
| 131 | .id = 1, |
| 132 | .dev.platform_data = &mpc83xx_fsl_i2c1_pdata, |
| 133 | .num_resources = 2, |
| 134 | .resource = (struct resource[]) { |
| 135 | { |
| 136 | .start = 0x3000, |
| 137 | .end = 0x30ff, |
| 138 | .flags = IORESOURCE_MEM, |
| 139 | }, |
| 140 | { |
| 141 | .start = MPC83xx_IRQ_IIC1, |
| 142 | .end = MPC83xx_IRQ_IIC1, |
| 143 | .flags = IORESOURCE_IRQ, |
| 144 | }, |
| 145 | }, |
| 146 | }, |
| 147 | [MPC83xx_IIC2] = { |
| 148 | .name = "fsl-i2c", |
| 149 | .id = 2, |
| 150 | .dev.platform_data = &mpc83xx_fsl_i2c2_pdata, |
| 151 | .num_resources = 2, |
| 152 | .resource = (struct resource[]) { |
| 153 | { |
| 154 | .start = 0x3100, |
| 155 | .end = 0x31ff, |
| 156 | .flags = IORESOURCE_MEM, |
| 157 | }, |
| 158 | { |
| 159 | .start = MPC83xx_IRQ_IIC2, |
| 160 | .end = MPC83xx_IRQ_IIC2, |
| 161 | .flags = IORESOURCE_IRQ, |
| 162 | }, |
| 163 | }, |
| 164 | }, |
| 165 | [MPC83xx_DUART] = { |
| 166 | .name = "serial8250", |
| 167 | .id = 0, |
| 168 | .dev.platform_data = serial_platform_data, |
| 169 | }, |
| 170 | [MPC83xx_SEC2] = { |
| 171 | .name = "fsl-sec2", |
| 172 | .id = 1, |
| 173 | .num_resources = 2, |
| 174 | .resource = (struct resource[]) { |
| 175 | { |
| 176 | .start = 0x30000, |
| 177 | .end = 0x3ffff, |
| 178 | .flags = IORESOURCE_MEM, |
| 179 | }, |
| 180 | { |
| 181 | .start = MPC83xx_IRQ_SEC2, |
| 182 | .end = MPC83xx_IRQ_SEC2, |
| 183 | .flags = IORESOURCE_IRQ, |
| 184 | }, |
| 185 | }, |
| 186 | }, |
| 187 | [MPC83xx_USB2_DR] = { |
| 188 | .name = "fsl-usb2-dr", |
| 189 | .id = 1, |
| 190 | .num_resources = 2, |
| 191 | .resource = (struct resource[]) { |
| 192 | { |
| 193 | .start = 0x22000, |
| 194 | .end = 0x22fff, |
| 195 | .flags = IORESOURCE_MEM, |
| 196 | }, |
| 197 | { |
| 198 | .start = MPC83xx_IRQ_USB2_DR, |
| 199 | .end = MPC83xx_IRQ_USB2_DR, |
| 200 | .flags = IORESOURCE_IRQ, |
| 201 | }, |
| 202 | }, |
| 203 | }, |
| 204 | [MPC83xx_USB2_MPH] = { |
| 205 | .name = "fsl-usb2-mph", |
| 206 | .id = 1, |
| 207 | .num_resources = 2, |
| 208 | .resource = (struct resource[]) { |
| 209 | { |
| 210 | .start = 0x23000, |
| 211 | .end = 0x23fff, |
| 212 | .flags = IORESOURCE_MEM, |
| 213 | }, |
| 214 | { |
| 215 | .start = MPC83xx_IRQ_USB2_MPH, |
| 216 | .end = MPC83xx_IRQ_USB2_MPH, |
| 217 | .flags = IORESOURCE_IRQ, |
| 218 | }, |
| 219 | }, |
| 220 | }, |
| 221 | }; |
| 222 | |
| 223 | static int __init mach_mpc83xx_fixup(struct platform_device *pdev) |
| 224 | { |
| 225 | ppc_sys_fixup_mem_resource(pdev, immrbar); |
| 226 | return 0; |
| 227 | } |
| 228 | |
| 229 | static int __init mach_mpc83xx_init(void) |
| 230 | { |
| 231 | if (ppc_md.progress) |
| 232 | ppc_md.progress("mach_mpc83xx_init:enter", 0); |
| 233 | ppc_sys_device_fixup = mach_mpc83xx_fixup; |
| 234 | return 0; |
| 235 | } |
| 236 | |
| 237 | postcore_initcall(mach_mpc83xx_init); |