board-rsk7203.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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 <asm/machvec.h>
  20. #include <asm/io.h>
  21. static struct smc911x_platdata smc911x_info = {
  22. .flags = SMC911X_USE_16BIT,
  23. .irq_flags = IRQF_TRIGGER_LOW,
  24. };
  25. static struct resource smc911x_resources[] = {
  26. [0] = {
  27. .start = 0x24000000,
  28. .end = 0x24000000 + 0x100,
  29. .flags = IORESOURCE_MEM,
  30. },
  31. [1] = {
  32. .start = 64,
  33. .end = 64,
  34. .flags = IORESOURCE_IRQ,
  35. },
  36. };
  37. static struct platform_device smc911x_device = {
  38. .name = "smc911x",
  39. .id = -1,
  40. .num_resources = ARRAY_SIZE(smc911x_resources),
  41. .resource = smc911x_resources,
  42. .dev = {
  43. .platform_data = &smc911x_info,
  44. },
  45. };
  46. static const char *probes[] = { "cmdlinepart", NULL };
  47. static struct mtd_partition *parsed_partitions;
  48. static struct mtd_partition rsk7203_partitions[] = {
  49. {
  50. .name = "Bootloader",
  51. .offset = 0x00000000,
  52. .size = 0x00040000,
  53. .mask_flags = MTD_WRITEABLE,
  54. }, {
  55. .name = "Kernel",
  56. .offset = MTDPART_OFS_NXTBLK,
  57. .size = 0x001c0000,
  58. }, {
  59. .name = "Flash_FS",
  60. .offset = MTDPART_OFS_NXTBLK,
  61. .size = MTDPART_SIZ_FULL,
  62. }
  63. };
  64. static struct physmap_flash_data flash_data = {
  65. .width = 2,
  66. };
  67. static struct resource flash_resource = {
  68. .start = 0x20000000,
  69. .end = 0x20400000,
  70. .flags = IORESOURCE_MEM,
  71. };
  72. static struct platform_device flash_device = {
  73. .name = "physmap-flash",
  74. .id = -1,
  75. .resource = &flash_resource,
  76. .num_resources = 1,
  77. .dev = {
  78. .platform_data = &flash_data,
  79. },
  80. };
  81. static struct mtd_info *flash_mtd;
  82. static struct map_info rsk7203_flash_map = {
  83. .name = "RSK+ Flash",
  84. .size = 0x400000,
  85. .bankwidth = 2,
  86. };
  87. static void __init set_mtd_partitions(void)
  88. {
  89. int nr_parts = 0;
  90. simple_map_init(&rsk7203_flash_map);
  91. flash_mtd = do_map_probe("cfi_probe", &rsk7203_flash_map);
  92. nr_parts = parse_mtd_partitions(flash_mtd, probes,
  93. &parsed_partitions, 0);
  94. /* If there is no partition table, used the hard coded table */
  95. if (nr_parts <= 0) {
  96. flash_data.parts = rsk7203_partitions;
  97. flash_data.nr_parts = ARRAY_SIZE(rsk7203_partitions);
  98. } else {
  99. flash_data.nr_parts = nr_parts;
  100. flash_data.parts = parsed_partitions;
  101. }
  102. }
  103. static struct platform_device *rsk7203_devices[] __initdata = {
  104. &smc911x_device,
  105. &flash_device,
  106. };
  107. static int __init rsk7203_devices_setup(void)
  108. {
  109. set_mtd_partitions();
  110. return platform_add_devices(rsk7203_devices,
  111. ARRAY_SIZE(rsk7203_devices));
  112. }
  113. device_initcall(rsk7203_devices_setup);
  114. /*
  115. * The Machine Vector
  116. */
  117. static struct sh_machine_vector mv_rsk7203 __initmv = {
  118. .mv_name = "RSK+7203",
  119. };