board-evm.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * TI DaVinci EVM board support
  3. *
  4. * Author: Kevin Hilman, MontaVista Software, Inc. <source@mvista.com>
  5. *
  6. * 2007 (c) MontaVista Software, Inc. This file is licensed under
  7. * the terms of the GNU General Public License version 2. This program
  8. * is licensed "as is" without any warranty of any kind, whether express
  9. * or implied.
  10. */
  11. #include <linux/kernel.h>
  12. #include <linux/module.h>
  13. #include <linux/init.h>
  14. #include <linux/dma-mapping.h>
  15. #include <linux/platform_device.h>
  16. #include <linux/mtd/mtd.h>
  17. #include <linux/mtd/partitions.h>
  18. #include <linux/mtd/physmap.h>
  19. #include <asm/setup.h>
  20. #include <asm/io.h>
  21. #include <asm/mach-types.h>
  22. #include <asm/hardware.h>
  23. #include <asm/mach/arch.h>
  24. #include <asm/mach/map.h>
  25. #include <asm/mach/flash.h>
  26. #include <asm/arch/common.h>
  27. /* other misc. init functions */
  28. void __init davinci_psc_init(void);
  29. void __init davinci_irq_init(void);
  30. void __init davinci_map_common_io(void);
  31. /* NOR Flash base address set to CS0 by default */
  32. #define NOR_FLASH_PHYS 0x02000000
  33. static struct mtd_partition davinci_evm_partitions[] = {
  34. /* bootloader (U-Boot, etc) in first 4 sectors */
  35. {
  36. .name = "bootloader",
  37. .offset = 0,
  38. .size = 4 * SZ_64K,
  39. .mask_flags = MTD_WRITEABLE, /* force read-only */
  40. },
  41. /* bootloader params in the next 1 sectors */
  42. {
  43. .name = "params",
  44. .offset = MTDPART_OFS_APPEND,
  45. .size = SZ_64K,
  46. .mask_flags = 0,
  47. },
  48. /* kernel */
  49. {
  50. .name = "kernel",
  51. .offset = MTDPART_OFS_APPEND,
  52. .size = SZ_2M,
  53. .mask_flags = 0
  54. },
  55. /* file system */
  56. {
  57. .name = "filesystem",
  58. .offset = MTDPART_OFS_APPEND,
  59. .size = MTDPART_SIZ_FULL,
  60. .mask_flags = 0
  61. }
  62. };
  63. static struct physmap_flash_data davinci_evm_flash_data = {
  64. .width = 2,
  65. .parts = davinci_evm_partitions,
  66. .nr_parts = ARRAY_SIZE(davinci_evm_partitions),
  67. };
  68. /* NOTE: CFI probe will correctly detect flash part as 32M, but EMIF
  69. * limits addresses to 16M, so using addresses past 16M will wrap */
  70. static struct resource davinci_evm_flash_resource = {
  71. .start = NOR_FLASH_PHYS,
  72. .end = NOR_FLASH_PHYS + SZ_16M - 1,
  73. .flags = IORESOURCE_MEM,
  74. };
  75. static struct platform_device davinci_evm_flash_device = {
  76. .name = "physmap-flash",
  77. .id = 0,
  78. .dev = {
  79. .platform_data = &davinci_evm_flash_data,
  80. },
  81. .num_resources = 1,
  82. .resource = &davinci_evm_flash_resource,
  83. };
  84. static struct platform_device *davinci_evm_devices[] __initdata = {
  85. &davinci_evm_flash_device,
  86. };
  87. static void __init
  88. davinci_evm_map_io(void)
  89. {
  90. davinci_map_common_io();
  91. }
  92. static __init void davinci_evm_init(void)
  93. {
  94. davinci_psc_init();
  95. #if defined(CONFIG_BLK_DEV_DAVINCI) || defined(CONFIG_BLK_DEV_DAVINCI_MODULE)
  96. printk(KERN_WARNING "WARNING: both IDE and NOR flash are enabled, "
  97. "but share pins.\n\t Disable IDE for NOR support.\n");
  98. #endif
  99. platform_add_devices(davinci_evm_devices,
  100. ARRAY_SIZE(davinci_evm_devices));
  101. }
  102. static __init void davinci_evm_irq_init(void)
  103. {
  104. davinci_irq_init();
  105. }
  106. MACHINE_START(DAVINCI_EVM, "DaVinci EVM")
  107. /* Maintainer: MontaVista Software <source@mvista.com> */
  108. .phys_io = IO_PHYS,
  109. .io_pg_offst = (io_p2v(IO_PHYS) >> 18) & 0xfffc,
  110. .boot_params = (DAVINCI_DDR_BASE + 0x100),
  111. .map_io = davinci_evm_map_io,
  112. .init_irq = davinci_evm_irq_init,
  113. .timer = &davinci_timer,
  114. .init_machine = davinci_evm_init,
  115. MACHINE_END