setup.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. * linux/arch/sh/boards/renesas/sh7763rdp/setup.c
  3. *
  4. * Renesas Solutions sh7763rdp board
  5. *
  6. * Copyright (C) 2008 Renesas Solutions Corp.
  7. * Copyright (C) 2008 Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
  8. *
  9. * This file is subject to the terms and conditions of the GNU General Public
  10. * License. See the file "COPYING" in the main directory of this archive
  11. * for more details.
  12. */
  13. #include <linux/init.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/interrupt.h>
  16. #include <linux/input.h>
  17. #include <linux/mtd/physmap.h>
  18. #include <asm/io.h>
  19. #include <asm/sh7763rdp.h>
  20. /* NOR Flash */
  21. static struct mtd_partition sh7763rdp_nor_flash_partitions[] = {
  22. {
  23. .name = "U-Boot",
  24. .offset = 0,
  25. .size = (2 * 128 * 1024),
  26. .mask_flags = MTD_WRITEABLE, /* Read-only */
  27. }, {
  28. .name = "Linux-Kernel",
  29. .offset = MTDPART_OFS_APPEND,
  30. .size = (20 * 128 * 1024),
  31. }, {
  32. .name = "Root Filesystem",
  33. .offset = MTDPART_OFS_APPEND,
  34. .size = MTDPART_SIZ_FULL,
  35. },
  36. };
  37. static struct physmap_flash_data sh7763rdp_nor_flash_data = {
  38. .width = 2,
  39. .parts = sh7763rdp_nor_flash_partitions,
  40. .nr_parts = ARRAY_SIZE(sh7763rdp_nor_flash_partitions),
  41. };
  42. static struct resource sh7763rdp_nor_flash_resources[] = {
  43. [0] = {
  44. .name = "NOR Flash",
  45. .start = 0,
  46. .end = (64 * 1024 * 1024),
  47. .flags = IORESOURCE_MEM,
  48. },
  49. };
  50. static struct platform_device sh7763rdp_nor_flash_device = {
  51. .name = "physmap-flash",
  52. .resource = sh7763rdp_nor_flash_resources,
  53. .num_resources = ARRAY_SIZE(sh7763rdp_nor_flash_resources),
  54. .dev = {
  55. .platform_data = &sh7763rdp_nor_flash_data,
  56. },
  57. };
  58. static struct platform_device *sh7763rdp_devices[] __initdata = {
  59. &sh7763rdp_nor_flash_device,
  60. };
  61. static int __init sh7763rdp_devices_setup(void)
  62. {
  63. return platform_add_devices(sh7763rdp_devices,
  64. ARRAY_SIZE(sh7763rdp_devices));
  65. }
  66. __initcall(sh7763rdp_devices_setup);
  67. static void __init sh7763rdp_setup(char **cmdline_p)
  68. {
  69. /* Board version check */
  70. if (ctrl_inw(CPLD_BOARD_ID_ERV_REG) == 0xECB1)
  71. printk(KERN_INFO "RTE Standard Configuration\n");
  72. else
  73. printk(KERN_INFO "RTA Standard Configuration\n");
  74. /* USB pin select bits (clear bit 5-2 to 0) */
  75. ctrl_outw((ctrl_inw(PORT_PSEL2) & 0xFFC3), PORT_PSEL2);
  76. /* USBH setup port I controls to other (clear bits 4-9 to 0) */
  77. ctrl_outw(ctrl_inw(PORT_PICR) & 0xFC0F, PORT_PICR);
  78. /* Select USB Host controller */
  79. ctrl_outw(0x00, USB_USBHSC);
  80. /* For LCD */
  81. /* set PTJ7-1, bits 15-2 of PJCR to 0 */
  82. ctrl_outw(ctrl_inw(PORT_PJCR) & 0x0003, PORT_PJCR);
  83. /* set PTI5, bits 11-10 of PICR to 0 */
  84. ctrl_outw(ctrl_inw(PORT_PICR) & 0xF3FF, PORT_PICR);
  85. ctrl_outw(0, PORT_PKCR);
  86. ctrl_outw(0, PORT_PLCR);
  87. /* set PSEL2 bits 14-8, 5-4, of PSEL2 to 0 */
  88. ctrl_outw((ctrl_inw(PORT_PSEL2) & 0x00C0), PORT_PSEL2);
  89. /* set PSEL3 bits 14-12, 6-4, 2-0 of PSEL3 to 0 */
  90. ctrl_outw((ctrl_inw(PORT_PSEL3) & 0x0700), PORT_PSEL3);
  91. /* For HAC */
  92. /* bit3-0 0100:HAC & SSI1 enable */
  93. ctrl_outw((ctrl_inw(PORT_PSEL1) & 0xFFF0) | 0x0004, PORT_PSEL1);
  94. /* bit14 1:SSI_HAC_CLK enable */
  95. ctrl_outw(ctrl_inw(PORT_PSEL4) | 0x4000, PORT_PSEL4);
  96. /* SH-Ether */
  97. ctrl_outw((ctrl_inw(PORT_PSEL1) & ~0xff00) | 0x2400, PORT_PSEL1);
  98. ctrl_outw(0x0, PORT_PFCR);
  99. ctrl_outw(0x0, PORT_PFCR);
  100. ctrl_outw(0x0, PORT_PFCR);
  101. /* MMC */
  102. /*selects SCIF and MMC other functions */
  103. ctrl_outw(0x0001, PORT_PSEL0);
  104. /* MMC clock operates */
  105. ctrl_outl(ctrl_inl(MSTPCR1) & ~0x8, MSTPCR1);
  106. ctrl_outw(ctrl_inw(PORT_PACR) & ~0x3000, PORT_PACR);
  107. ctrl_outw(ctrl_inw(PORT_PCCR) & ~0xCFC3, PORT_PCCR);
  108. }
  109. static struct sh_machine_vector mv_sh7763rdp __initmv = {
  110. .mv_name = "sh7763drp",
  111. .mv_setup = sh7763rdp_setup,
  112. .mv_nr_irqs = 112,
  113. .mv_init_irq = init_sh7763rdp_IRQ,
  114. };