board-evm.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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. void __init davinci_init_common_hw(void);
  32. /* NOR Flash base address set to CS0 by default */
  33. #define NOR_FLASH_PHYS 0x02000000
  34. static struct mtd_partition davinci_evm_partitions[] = {
  35. /* bootloader (U-Boot, etc) in first 4 sectors */
  36. {
  37. .name = "bootloader",
  38. .offset = 0,
  39. .size = 4 * SZ_64K,
  40. .mask_flags = MTD_WRITEABLE, /* force read-only */
  41. },
  42. /* bootloader params in the next 1 sectors */
  43. {
  44. .name = "params",
  45. .offset = MTDPART_OFS_APPEND,
  46. .size = SZ_64K,
  47. .mask_flags = 0,
  48. },
  49. /* kernel */
  50. {
  51. .name = "kernel",
  52. .offset = MTDPART_OFS_APPEND,
  53. .size = SZ_2M,
  54. .mask_flags = 0
  55. },
  56. /* file system */
  57. {
  58. .name = "filesystem",
  59. .offset = MTDPART_OFS_APPEND,
  60. .size = MTDPART_SIZ_FULL,
  61. .mask_flags = 0
  62. }
  63. };
  64. static struct physmap_flash_data davinci_evm_flash_data = {
  65. .width = 2,
  66. .parts = davinci_evm_partitions,
  67. .nr_parts = ARRAY_SIZE(davinci_evm_partitions),
  68. };
  69. /* NOTE: CFI probe will correctly detect flash part as 32M, but EMIF
  70. * limits addresses to 16M, so using addresses past 16M will wrap */
  71. static struct resource davinci_evm_flash_resource = {
  72. .start = NOR_FLASH_PHYS,
  73. .end = NOR_FLASH_PHYS + SZ_16M - 1,
  74. .flags = IORESOURCE_MEM,
  75. };
  76. static struct platform_device davinci_evm_flash_device = {
  77. .name = "physmap-flash",
  78. .id = 0,
  79. .dev = {
  80. .platform_data = &davinci_evm_flash_data,
  81. },
  82. .num_resources = 1,
  83. .resource = &davinci_evm_flash_resource,
  84. };
  85. static struct platform_device *davinci_evm_devices[] __initdata = {
  86. &davinci_evm_flash_device,
  87. };
  88. static void __init
  89. davinci_evm_map_io(void)
  90. {
  91. davinci_map_common_io();
  92. }
  93. static __init void davinci_evm_init(void)
  94. {
  95. davinci_psc_init();
  96. #if defined(CONFIG_BLK_DEV_DAVINCI) || defined(CONFIG_BLK_DEV_DAVINCI_MODULE)
  97. printk(KERN_WARNING "WARNING: both IDE and NOR flash are enabled, "
  98. "but share pins.\n\t Disable IDE for NOR support.\n");
  99. #endif
  100. platform_add_devices(davinci_evm_devices,
  101. ARRAY_SIZE(davinci_evm_devices));
  102. }
  103. static __init void davinci_evm_irq_init(void)
  104. {
  105. davinci_init_common_hw();
  106. davinci_irq_init();
  107. }
  108. MACHINE_START(DAVINCI_EVM, "DaVinci EVM")
  109. /* Maintainer: MontaVista Software <source@mvista.com> */
  110. .phys_io = IO_PHYS,
  111. .io_pg_offst = (io_p2v(IO_PHYS) >> 18) & 0xfffc,
  112. .boot_params = (DAVINCI_DDR_BASE + 0x100),
  113. .map_io = davinci_evm_map_io,
  114. .init_irq = davinci_evm_irq_init,
  115. .timer = &davinci_timer,
  116. .init_machine = davinci_evm_init,
  117. MACHINE_END