diff options
author | Sergey Matyukevich <geomatsi@gmail.com> | 2009-07-30 17:23:24 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-08-01 11:24:59 -0400 |
commit | fb85205ada3fef98122a40b700ecb71efb33ae71 (patch) | |
tree | a982b9e9a43587dd602fad08a37d8e8e1108019c /arch | |
parent | 10233a939812450e4fe07cf529585bab5b4d99ec (diff) |
ARM: 5631/1: Platform data for CF/IDE support in AT91SAM9260
This patch adds platform data for CF/IDE support
and SMC init code for AT91SAM9260 SoC.
Tested-by: Sergey Matyukevich <geomatsi@gmail.com>
Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>
Acked-by: Andrew Victor <linux@maxim.org.za>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-at91/at91sam9260_devices.c | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c index d74c9ac007e7..ee4ea0e720cf 100644 --- a/arch/arm/mach-at91/at91sam9260_devices.c +++ b/arch/arm/mach-at91/at91sam9260_devices.c | |||
@@ -1113,6 +1113,122 @@ void __init at91_set_serial_console(unsigned portnr) {} | |||
1113 | void __init at91_add_device_serial(void) {} | 1113 | void __init at91_add_device_serial(void) {} |
1114 | #endif | 1114 | #endif |
1115 | 1115 | ||
1116 | /* -------------------------------------------------------------------- | ||
1117 | * CF/IDE | ||
1118 | * -------------------------------------------------------------------- */ | ||
1119 | |||
1120 | #if defined(CONFIG_BLK_DEV_IDE_AT91) || defined(CONFIG_BLK_DEV_IDE_AT91_MODULE) || \ | ||
1121 | defined(CONFIG_PATA_AT91) || defined(CONFIG_PATA_AT91_MODULE) || \ | ||
1122 | defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE) | ||
1123 | |||
1124 | static struct at91_cf_data cf0_data; | ||
1125 | |||
1126 | static struct resource cf0_resources[] = { | ||
1127 | [0] = { | ||
1128 | .start = AT91_CHIPSELECT_4, | ||
1129 | .end = AT91_CHIPSELECT_4 + SZ_256M - 1, | ||
1130 | .flags = IORESOURCE_MEM, | ||
1131 | } | ||
1132 | }; | ||
1133 | |||
1134 | static struct platform_device cf0_device = { | ||
1135 | .id = 0, | ||
1136 | .dev = { | ||
1137 | .platform_data = &cf0_data, | ||
1138 | }, | ||
1139 | .resource = cf0_resources, | ||
1140 | .num_resources = ARRAY_SIZE(cf0_resources), | ||
1141 | }; | ||
1142 | |||
1143 | static struct at91_cf_data cf1_data; | ||
1144 | |||
1145 | static struct resource cf1_resources[] = { | ||
1146 | [0] = { | ||
1147 | .start = AT91_CHIPSELECT_5, | ||
1148 | .end = AT91_CHIPSELECT_5 + SZ_256M - 1, | ||
1149 | .flags = IORESOURCE_MEM, | ||
1150 | } | ||
1151 | }; | ||
1152 | |||
1153 | static struct platform_device cf1_device = { | ||
1154 | .id = 1, | ||
1155 | .dev = { | ||
1156 | .platform_data = &cf1_data, | ||
1157 | }, | ||
1158 | .resource = cf1_resources, | ||
1159 | .num_resources = ARRAY_SIZE(cf1_resources), | ||
1160 | }; | ||
1161 | |||
1162 | void __init at91_add_device_cf(struct at91_cf_data *data) | ||
1163 | { | ||
1164 | struct platform_device *pdev; | ||
1165 | unsigned long csa; | ||
1166 | |||
1167 | if (!data) | ||
1168 | return; | ||
1169 | |||
1170 | csa = at91_sys_read(AT91_MATRIX_EBICSA); | ||
1171 | |||
1172 | switch (data->chipselect) { | ||
1173 | case 4: | ||
1174 | at91_set_multi_drive(AT91_PIN_PC8, 0); | ||
1175 | at91_set_A_periph(AT91_PIN_PC8, 0); | ||
1176 | csa |= AT91_MATRIX_CS4A_SMC_CF1; | ||
1177 | cf0_data = *data; | ||
1178 | pdev = &cf0_device; | ||
1179 | break; | ||
1180 | case 5: | ||
1181 | at91_set_multi_drive(AT91_PIN_PC9, 0); | ||
1182 | at91_set_A_periph(AT91_PIN_PC9, 0); | ||
1183 | csa |= AT91_MATRIX_CS5A_SMC_CF2; | ||
1184 | cf1_data = *data; | ||
1185 | pdev = &cf1_device; | ||
1186 | break; | ||
1187 | default: | ||
1188 | printk(KERN_ERR "AT91 CF: bad chip-select requested (%u)\n", | ||
1189 | data->chipselect); | ||
1190 | return; | ||
1191 | } | ||
1192 | |||
1193 | at91_sys_write(AT91_MATRIX_EBICSA, csa); | ||
1194 | |||
1195 | if (data->rst_pin) { | ||
1196 | at91_set_multi_drive(data->rst_pin, 0); | ||
1197 | at91_set_gpio_output(data->rst_pin, 1); | ||
1198 | } | ||
1199 | |||
1200 | if (data->irq_pin) { | ||
1201 | at91_set_gpio_input(data->irq_pin, 0); | ||
1202 | at91_set_deglitch(data->irq_pin, 1); | ||
1203 | } | ||
1204 | |||
1205 | if (data->det_pin) { | ||
1206 | at91_set_gpio_input(data->det_pin, 0); | ||
1207 | at91_set_deglitch(data->det_pin, 1); | ||
1208 | } | ||
1209 | |||
1210 | at91_set_B_periph(AT91_PIN_PC6, 0); /* CFCE1 */ | ||
1211 | at91_set_B_periph(AT91_PIN_PC7, 0); /* CFCE2 */ | ||
1212 | at91_set_A_periph(AT91_PIN_PC10, 0); /* CFRNW */ | ||
1213 | at91_set_A_periph(AT91_PIN_PC15, 1); /* NWAIT */ | ||
1214 | |||
1215 | if (data->flags & AT91_CF_TRUE_IDE) | ||
1216 | #if defined(CONFIG_PATA_AT91) || defined(CONFIG_PATA_AT91_MODULE) | ||
1217 | pdev->name = "pata_at91"; | ||
1218 | #elif defined(CONFIG_BLK_DEV_IDE_AT91) || defined(CONFIG_BLK_DEV_IDE_AT91_MODULE) | ||
1219 | pdev->name = "at91_ide"; | ||
1220 | #else | ||
1221 | #warning "board requires AT91_CF_TRUE_IDE: enable either at91_ide or pata_at91" | ||
1222 | #endif | ||
1223 | else | ||
1224 | pdev->name = "at91_cf"; | ||
1225 | |||
1226 | platform_device_register(pdev); | ||
1227 | } | ||
1228 | |||
1229 | #else | ||
1230 | void __init at91_add_device_cf(struct at91_cf_data * data) {} | ||
1231 | #endif | ||
1116 | 1232 | ||
1117 | /* -------------------------------------------------------------------- */ | 1233 | /* -------------------------------------------------------------------- */ |
1118 | /* | 1234 | /* |