Matej Kenda | 51238bf | 2009-09-07 14:08:34 +0800 | [diff] [blame] | 1 | /* linux/arch/arm/mach-pxa/xcep.c |
| 2 | * |
| 3 | * Support for the Iskratel Electronics XCEP platform as used in |
| 4 | * the Libera instruments from Instrumentation Technologies. |
| 5 | * |
| 6 | * Author: Ales Bardorfer <ales@i-tech.si> |
| 7 | * Contributions by: Abbott, MG (Michael) <michael.abbott@diamond.ac.uk> |
| 8 | * Contributions by: Matej Kenda <matej.kenda@i-tech.si> |
| 9 | * Created: June 2006 |
| 10 | * Copyright: (C) 2006-2009 Instrumentation Technologies |
| 11 | * |
| 12 | * This program is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License version 2 as |
| 14 | * published by the Free Software Foundation. |
| 15 | */ |
| 16 | |
| 17 | #include <linux/platform_device.h> |
| 18 | #include <linux/i2c.h> |
Sebastian Andrzej Siewior | b459396 | 2011-02-23 12:38:16 +0100 | [diff] [blame] | 19 | #include <linux/i2c/pxa-i2c.h> |
Matej Kenda | 51238bf | 2009-09-07 14:08:34 +0800 | [diff] [blame] | 20 | #include <linux/smc91x.h> |
| 21 | #include <linux/mtd/mtd.h> |
| 22 | #include <linux/mtd/partitions.h> |
| 23 | #include <linux/mtd/physmap.h> |
| 24 | |
| 25 | #include <asm/mach-types.h> |
| 26 | #include <asm/mach/arch.h> |
| 27 | #include <asm/mach/irq.h> |
| 28 | #include <asm/mach/map.h> |
| 29 | |
Matej Kenda | 51238bf | 2009-09-07 14:08:34 +0800 | [diff] [blame] | 30 | #include <mach/hardware.h> |
Arnd Bergmann | 4c25c5d | 2015-01-30 10:45:33 +0100 | [diff] [blame] | 31 | #include "pxa25x.h" |
Marek Vasut | ad68bb9 | 2010-11-03 16:29:35 +0100 | [diff] [blame] | 32 | #include <mach/smemc.h> |
Matej Kenda | 51238bf | 2009-09-07 14:08:34 +0800 | [diff] [blame] | 33 | |
| 34 | #include "generic.h" |
| 35 | |
| 36 | #define XCEP_ETH_PHYS (PXA_CS3_PHYS + 0x00000300) |
| 37 | #define XCEP_ETH_PHYS_END (PXA_CS3_PHYS + 0x000fffff) |
| 38 | #define XCEP_ETH_ATTR (PXA_CS3_PHYS + 0x02000000) |
| 39 | #define XCEP_ETH_ATTR_END (PXA_CS3_PHYS + 0x020fffff) |
| 40 | #define XCEP_ETH_IRQ IRQ_GPIO0 |
| 41 | |
| 42 | /* XCEP CPLD base */ |
| 43 | #define XCEP_CPLD_BASE 0xf0000000 |
| 44 | |
| 45 | |
| 46 | /* Flash partitions. */ |
| 47 | |
| 48 | static struct mtd_partition xcep_partitions[] = { |
| 49 | { |
| 50 | .name = "Bootloader", |
| 51 | .size = 0x00040000, |
| 52 | .offset = 0, |
| 53 | .mask_flags = MTD_WRITEABLE |
| 54 | }, { |
| 55 | .name = "Bootloader ENV", |
| 56 | .size = 0x00040000, |
| 57 | .offset = 0x00040000, |
| 58 | .mask_flags = MTD_WRITEABLE |
| 59 | }, { |
| 60 | .name = "Kernel", |
| 61 | .size = 0x00100000, |
| 62 | .offset = 0x00080000, |
| 63 | }, { |
| 64 | .name = "Rescue fs", |
| 65 | .size = 0x00280000, |
| 66 | .offset = 0x00180000, |
| 67 | }, { |
| 68 | .name = "Filesystem", |
| 69 | .size = MTDPART_SIZ_FULL, |
| 70 | .offset = 0x00400000 |
| 71 | } |
| 72 | }; |
| 73 | |
| 74 | static struct physmap_flash_data xcep_flash_data[] = { |
| 75 | { |
| 76 | .width = 4, /* bankwidth in bytes */ |
| 77 | .parts = xcep_partitions, |
| 78 | .nr_parts = ARRAY_SIZE(xcep_partitions) |
| 79 | } |
| 80 | }; |
| 81 | |
| 82 | static struct resource flash_resource = { |
| 83 | .start = PXA_CS0_PHYS, |
| 84 | .end = PXA_CS0_PHYS + SZ_32M - 1, |
| 85 | .flags = IORESOURCE_MEM, |
| 86 | }; |
| 87 | |
| 88 | static struct platform_device flash_device = { |
| 89 | .name = "physmap-flash", |
| 90 | .id = 0, |
| 91 | .dev = { |
| 92 | .platform_data = xcep_flash_data, |
| 93 | }, |
| 94 | .resource = &flash_resource, |
| 95 | .num_resources = 1, |
| 96 | }; |
| 97 | |
| 98 | |
| 99 | |
| 100 | /* SMC LAN91C111 network controller. */ |
| 101 | |
| 102 | static struct resource smc91x_resources[] = { |
| 103 | [0] = { |
| 104 | .name = "smc91x-regs", |
| 105 | .start = XCEP_ETH_PHYS, |
| 106 | .end = XCEP_ETH_PHYS_END, |
| 107 | .flags = IORESOURCE_MEM, |
| 108 | }, |
| 109 | [1] = { |
| 110 | .start = XCEP_ETH_IRQ, |
| 111 | .end = XCEP_ETH_IRQ, |
| 112 | .flags = IORESOURCE_IRQ, |
| 113 | }, |
| 114 | [2] = { |
| 115 | .name = "smc91x-attrib", |
| 116 | .start = XCEP_ETH_ATTR, |
| 117 | .end = XCEP_ETH_ATTR_END, |
| 118 | .flags = IORESOURCE_MEM, |
| 119 | }, |
| 120 | }; |
| 121 | |
| 122 | static struct smc91x_platdata xcep_smc91x_info = { |
| 123 | .flags = SMC91X_USE_32BIT | SMC91X_NOWAIT | SMC91X_USE_DMA, |
| 124 | }; |
| 125 | |
| 126 | static struct platform_device smc91x_device = { |
| 127 | .name = "smc91x", |
| 128 | .id = -1, |
| 129 | .num_resources = ARRAY_SIZE(smc91x_resources), |
| 130 | .resource = smc91x_resources, |
| 131 | .dev = { |
| 132 | .platform_data = &xcep_smc91x_info, |
| 133 | }, |
| 134 | }; |
| 135 | |
| 136 | |
| 137 | static struct platform_device *devices[] __initdata = { |
| 138 | &flash_device, |
| 139 | &smc91x_device, |
| 140 | }; |
| 141 | |
| 142 | |
| 143 | /* We have to state that there are HWMON devices on the I2C bus on XCEP. |
| 144 | * Drivers for HWMON verify capabilities of the adapter when loading and |
Paul Bolle | 395cf96 | 2011-08-15 02:02:26 +0200 | [diff] [blame] | 145 | * refuse to attach if the adapter doesn't support HWMON class of devices. */ |
Matej Kenda | 51238bf | 2009-09-07 14:08:34 +0800 | [diff] [blame] | 146 | static struct i2c_pxa_platform_data xcep_i2c_platform_data = { |
| 147 | .class = I2C_CLASS_HWMON |
| 148 | }; |
| 149 | |
| 150 | |
| 151 | static mfp_cfg_t xcep_pin_config[] __initdata = { |
| 152 | GPIO79_nCS_3, /* SMC 91C111 chip select. */ |
| 153 | GPIO80_nCS_4, /* CPLD chip select. */ |
| 154 | /* SSP communication to MSP430 */ |
| 155 | GPIO23_SSP1_SCLK, |
| 156 | GPIO24_SSP1_SFRM, |
| 157 | GPIO25_SSP1_TXD, |
| 158 | GPIO26_SSP1_RXD, |
| 159 | GPIO27_SSP1_EXTCLK |
| 160 | }; |
| 161 | |
| 162 | static void __init xcep_init(void) |
| 163 | { |
| 164 | pxa2xx_mfp_config(ARRAY_AND_SIZE(xcep_pin_config)); |
| 165 | |
Russell King | cc155c6 | 2009-11-09 13:34:08 +0800 | [diff] [blame] | 166 | pxa_set_ffuart_info(NULL); |
| 167 | pxa_set_btuart_info(NULL); |
| 168 | pxa_set_stuart_info(NULL); |
| 169 | pxa_set_hwuart_info(NULL); |
| 170 | |
Matej Kenda | 51238bf | 2009-09-07 14:08:34 +0800 | [diff] [blame] | 171 | /* See Intel XScale Developer's Guide for details */ |
| 172 | /* Set RDF and RDN to appropriate values (chip select 3 (smc91x)) */ |
Marek Vasut | ad68bb9 | 2010-11-03 16:29:35 +0100 | [diff] [blame] | 173 | __raw_writel((__raw_readl(MSC1) & 0xffff) | 0xD5540000, MSC1); |
Matej Kenda | 51238bf | 2009-09-07 14:08:34 +0800 | [diff] [blame] | 174 | /* Set RDF and RDN to appropriate values (chip select 5 (fpga)) */ |
Marek Vasut | ad68bb9 | 2010-11-03 16:29:35 +0100 | [diff] [blame] | 175 | __raw_writel((__raw_readl(MSC2) & 0xffff) | 0x72A00000, MSC2); |
Matej Kenda | 51238bf | 2009-09-07 14:08:34 +0800 | [diff] [blame] | 176 | |
| 177 | platform_add_devices(ARRAY_AND_SIZE(devices)); |
| 178 | pxa_set_i2c_info(&xcep_i2c_platform_data); |
| 179 | } |
| 180 | |
| 181 | MACHINE_START(XCEP, "Iskratel XCEP") |
Nicolas Pitre | 7375aba | 2011-07-05 22:38:15 -0400 | [diff] [blame] | 182 | .atag_offset = 0x100, |
Matej Kenda | 51238bf | 2009-09-07 14:08:34 +0800 | [diff] [blame] | 183 | .init_machine = xcep_init, |
Marek Vasut | 851982c | 2010-10-11 02:20:19 +0200 | [diff] [blame] | 184 | .map_io = pxa25x_map_io, |
Rob Herring | 4e61109 | 2012-01-03 16:53:48 -0600 | [diff] [blame] | 185 | .nr_irqs = PXA_NR_IRQS, |
Matej Kenda | 51238bf | 2009-09-07 14:08:34 +0800 | [diff] [blame] | 186 | .init_irq = pxa25x_init_irq, |
Eric Miao | 8a97ae2 | 2011-05-18 21:30:04 +0800 | [diff] [blame] | 187 | .handle_irq = pxa25x_handle_irq, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 188 | .init_time = pxa_timer_init, |
Russell King | 271a74f | 2011-11-04 14:15:53 +0000 | [diff] [blame] | 189 | .restart = pxa_restart, |
Matej Kenda | 51238bf | 2009-09-07 14:08:34 +0800 | [diff] [blame] | 190 | MACHINE_END |
| 191 | |