board-rsk7203.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /*
  2. * Renesas Technology Europe RSK+ 7203 Support.
  3. *
  4. * Copyright (C) 2008 Paul Mundt
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file "COPYING" in the main directory of this archive
  8. * for more details.
  9. */
  10. #include <linux/init.h>
  11. #include <linux/types.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/interrupt.h>
  14. #include <linux/mtd/mtd.h>
  15. #include <linux/mtd/partitions.h>
  16. #include <linux/mtd/physmap.h>
  17. #include <linux/mtd/map.h>
  18. #include <linux/smc911x.h>
  19. #include <linux/gpio.h>
  20. #include <asm/machvec.h>
  21. #include <asm/io.h>
  22. #include <asm/sh7203.h>
  23. static struct smc911x_platdata smc911x_info = {
  24. .flags = SMC911X_USE_16BIT,
  25. .irq_flags = IRQF_TRIGGER_LOW,
  26. };
  27. static struct resource smc911x_resources[] = {
  28. [0] = {
  29. .start = 0x24000000,
  30. .end = 0x24000000 + 0x100,
  31. .flags = IORESOURCE_MEM,
  32. },
  33. [1] = {
  34. .start = 64,
  35. .end = 64,
  36. .flags = IORESOURCE_IRQ,
  37. },
  38. };
  39. static struct platform_device smc911x_device = {
  40. .name = "smc911x",
  41. .id = -1,
  42. .num_resources = ARRAY_SIZE(smc911x_resources),
  43. .resource = smc911x_resources,
  44. .dev = {
  45. .platform_data = &smc911x_info,
  46. },
  47. };
  48. static const char *probes[] = { "cmdlinepart", NULL };
  49. static struct mtd_partition *parsed_partitions;
  50. static struct mtd_partition rsk7203_partitions[] = {
  51. {
  52. .name = "Bootloader",
  53. .offset = 0x00000000,
  54. .size = 0x00040000,
  55. .mask_flags = MTD_WRITEABLE,
  56. }, {
  57. .name = "Kernel",
  58. .offset = MTDPART_OFS_NXTBLK,
  59. .size = 0x001c0000,
  60. }, {
  61. .name = "Flash_FS",
  62. .offset = MTDPART_OFS_NXTBLK,
  63. .size = MTDPART_SIZ_FULL,
  64. }
  65. };
  66. static struct physmap_flash_data flash_data = {
  67. .width = 2,
  68. };
  69. static struct resource flash_resource = {
  70. .start = 0x20000000,
  71. .end = 0x20400000,
  72. .flags = IORESOURCE_MEM,
  73. };
  74. static struct platform_device flash_device = {
  75. .name = "physmap-flash",
  76. .id = -1,
  77. .resource = &flash_resource,
  78. .num_resources = 1,
  79. .dev = {
  80. .platform_data = &flash_data,
  81. },
  82. };
  83. static struct mtd_info *flash_mtd;
  84. static struct map_info rsk7203_flash_map = {
  85. .name = "RSK+ Flash",
  86. .size = 0x400000,
  87. .bankwidth = 2,
  88. };
  89. static void __init set_mtd_partitions(void)
  90. {
  91. int nr_parts = 0;
  92. simple_map_init(&rsk7203_flash_map);
  93. flash_mtd = do_map_probe("cfi_probe", &rsk7203_flash_map);
  94. nr_parts = parse_mtd_partitions(flash_mtd, probes,
  95. &parsed_partitions, 0);
  96. /* If there is no partition table, used the hard coded table */
  97. if (nr_parts <= 0) {
  98. flash_data.parts = rsk7203_partitions;
  99. flash_data.nr_parts = ARRAY_SIZE(rsk7203_partitions);
  100. } else {
  101. flash_data.nr_parts = nr_parts;
  102. flash_data.parts = parsed_partitions;
  103. }
  104. }
  105. static struct platform_device *rsk7203_devices[] __initdata = {
  106. &smc911x_device,
  107. &flash_device,
  108. };
  109. static int __init rsk7203_devices_setup(void)
  110. {
  111. /* Select pins for SCIF0 */
  112. gpio_request(GPIO_FN_TXD0, NULL);
  113. gpio_request(GPIO_FN_RXD0, NULL);
  114. /* Lit LED0 */
  115. gpio_request(GPIO_PE10, NULL);
  116. gpio_direction_output(GPIO_PE10, 0);
  117. gpio_export(GPIO_PE10, 0);
  118. set_mtd_partitions();
  119. return platform_add_devices(rsk7203_devices,
  120. ARRAY_SIZE(rsk7203_devices));
  121. }
  122. device_initcall(rsk7203_devices_setup);
  123. /*
  124. * The Machine Vector
  125. */
  126. static struct sh_machine_vector mv_rsk7203 __initmv = {
  127. .mv_name = "RSK+7203",
  128. };