xcep.c 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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. #include <linux/platform_device.h>
  17. #include <linux/i2c.h>
  18. #include <linux/i2c/pxa-i2c.h>
  19. #include <linux/smc91x.h>
  20. #include <linux/mtd/mtd.h>
  21. #include <linux/mtd/partitions.h>
  22. #include <linux/mtd/physmap.h>
  23. #include <asm/mach-types.h>
  24. #include <asm/mach/arch.h>
  25. #include <asm/mach/irq.h>
  26. #include <asm/mach/map.h>
  27. #include <mach/hardware.h>
  28. #include <mach/pxa2xx-regs.h>
  29. #include <mach/mfp-pxa25x.h>
  30. #include <mach/smemc.h>
  31. #include "generic.h"
  32. #define XCEP_ETH_PHYS (PXA_CS3_PHYS + 0x00000300)
  33. #define XCEP_ETH_PHYS_END (PXA_CS3_PHYS + 0x000fffff)
  34. #define XCEP_ETH_ATTR (PXA_CS3_PHYS + 0x02000000)
  35. #define XCEP_ETH_ATTR_END (PXA_CS3_PHYS + 0x020fffff)
  36. #define XCEP_ETH_IRQ IRQ_GPIO0
  37. /* XCEP CPLD base */
  38. #define XCEP_CPLD_BASE 0xf0000000
  39. /* Flash partitions. */
  40. static struct mtd_partition xcep_partitions[] = {
  41. {
  42. .name = "Bootloader",
  43. .size = 0x00040000,
  44. .offset = 0,
  45. .mask_flags = MTD_WRITEABLE
  46. }, {
  47. .name = "Bootloader ENV",
  48. .size = 0x00040000,
  49. .offset = 0x00040000,
  50. .mask_flags = MTD_WRITEABLE
  51. }, {
  52. .name = "Kernel",
  53. .size = 0x00100000,
  54. .offset = 0x00080000,
  55. }, {
  56. .name = "Rescue fs",
  57. .size = 0x00280000,
  58. .offset = 0x00180000,
  59. }, {
  60. .name = "Filesystem",
  61. .size = MTDPART_SIZ_FULL,
  62. .offset = 0x00400000
  63. }
  64. };
  65. static struct physmap_flash_data xcep_flash_data[] = {
  66. {
  67. .width = 4, /* bankwidth in bytes */
  68. .parts = xcep_partitions,
  69. .nr_parts = ARRAY_SIZE(xcep_partitions)
  70. }
  71. };
  72. static struct resource flash_resource = {
  73. .start = PXA_CS0_PHYS,
  74. .end = PXA_CS0_PHYS + SZ_32M - 1,
  75. .flags = IORESOURCE_MEM,
  76. };
  77. static struct platform_device flash_device = {
  78. .name = "physmap-flash",
  79. .id = 0,
  80. .dev = {
  81. .platform_data = xcep_flash_data,
  82. },
  83. .resource = &flash_resource,
  84. .num_resources = 1,
  85. };
  86. /* SMC LAN91C111 network controller. */
  87. static struct resource smc91x_resources[] = {
  88. [0] = {
  89. .name = "smc91x-regs",
  90. .start = XCEP_ETH_PHYS,
  91. .end = XCEP_ETH_PHYS_END,
  92. .flags = IORESOURCE_MEM,
  93. },
  94. [1] = {
  95. .start = XCEP_ETH_IRQ,
  96. .end = XCEP_ETH_IRQ,
  97. .flags = IORESOURCE_IRQ,
  98. },
  99. [2] = {
  100. .name = "smc91x-attrib",
  101. .start = XCEP_ETH_ATTR,
  102. .end = XCEP_ETH_ATTR_END,
  103. .flags = IORESOURCE_MEM,
  104. },
  105. };
  106. static struct smc91x_platdata xcep_smc91x_info = {
  107. .flags = SMC91X_USE_32BIT | SMC91X_NOWAIT | SMC91X_USE_DMA,
  108. };
  109. static struct platform_device smc91x_device = {
  110. .name = "smc91x",
  111. .id = -1,
  112. .num_resources = ARRAY_SIZE(smc91x_resources),
  113. .resource = smc91x_resources,
  114. .dev = {
  115. .platform_data = &xcep_smc91x_info,
  116. },
  117. };
  118. static struct platform_device *devices[] __initdata = {
  119. &flash_device,
  120. &smc91x_device,
  121. };
  122. /* We have to state that there are HWMON devices on the I2C bus on XCEP.
  123. * Drivers for HWMON verify capabilities of the adapter when loading and
  124. * refuse to attach if the adapter doesn't support HWMON class of devices.
  125. * See also Documentation/i2c/porting-clients. */
  126. static struct i2c_pxa_platform_data xcep_i2c_platform_data = {
  127. .class = I2C_CLASS_HWMON
  128. };
  129. static mfp_cfg_t xcep_pin_config[] __initdata = {
  130. GPIO79_nCS_3, /* SMC 91C111 chip select. */
  131. GPIO80_nCS_4, /* CPLD chip select. */
  132. /* SSP communication to MSP430 */
  133. GPIO23_SSP1_SCLK,
  134. GPIO24_SSP1_SFRM,
  135. GPIO25_SSP1_TXD,
  136. GPIO26_SSP1_RXD,
  137. GPIO27_SSP1_EXTCLK
  138. };
  139. static void __init xcep_init(void)
  140. {
  141. pxa2xx_mfp_config(ARRAY_AND_SIZE(xcep_pin_config));
  142. pxa_set_ffuart_info(NULL);
  143. pxa_set_btuart_info(NULL);
  144. pxa_set_stuart_info(NULL);
  145. pxa_set_hwuart_info(NULL);
  146. /* See Intel XScale Developer's Guide for details */
  147. /* Set RDF and RDN to appropriate values (chip select 3 (smc91x)) */
  148. __raw_writel((__raw_readl(MSC1) & 0xffff) | 0xD5540000, MSC1);
  149. /* Set RDF and RDN to appropriate values (chip select 5 (fpga)) */
  150. __raw_writel((__raw_readl(MSC2) & 0xffff) | 0x72A00000, MSC2);
  151. platform_add_devices(ARRAY_AND_SIZE(devices));
  152. pxa_set_i2c_info(&xcep_i2c_platform_data);
  153. }
  154. MACHINE_START(XCEP, "Iskratel XCEP")
  155. .boot_params = 0xa0000100,
  156. .init_machine = xcep_init,
  157. .map_io = pxa25x_map_io,
  158. .init_irq = pxa25x_init_irq,
  159. .timer = &pxa_timer,
  160. MACHINE_END