setup.c 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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 <linux/fb.h>
  19. #include <linux/io.h>
  20. #include <asm/sh7763rdp.h>
  21. #include <asm/sh_eth.h>
  22. #include <asm/sh7760fb.h>
  23. /* NOR Flash */
  24. static struct mtd_partition sh7763rdp_nor_flash_partitions[] = {
  25. {
  26. .name = "U-Boot",
  27. .offset = 0,
  28. .size = (2 * 128 * 1024),
  29. .mask_flags = MTD_WRITEABLE, /* Read-only */
  30. }, {
  31. .name = "Linux-Kernel",
  32. .offset = MTDPART_OFS_APPEND,
  33. .size = (20 * 128 * 1024),
  34. }, {
  35. .name = "Root Filesystem",
  36. .offset = MTDPART_OFS_APPEND,
  37. .size = MTDPART_SIZ_FULL,
  38. },
  39. };
  40. static struct physmap_flash_data sh7763rdp_nor_flash_data = {
  41. .width = 2,
  42. .parts = sh7763rdp_nor_flash_partitions,
  43. .nr_parts = ARRAY_SIZE(sh7763rdp_nor_flash_partitions),
  44. };
  45. static struct resource sh7763rdp_nor_flash_resources[] = {
  46. [0] = {
  47. .name = "NOR Flash",
  48. .start = 0,
  49. .end = (64 * 1024 * 1024),
  50. .flags = IORESOURCE_MEM,
  51. },
  52. };
  53. static struct platform_device sh7763rdp_nor_flash_device = {
  54. .name = "physmap-flash",
  55. .resource = sh7763rdp_nor_flash_resources,
  56. .num_resources = ARRAY_SIZE(sh7763rdp_nor_flash_resources),
  57. .dev = {
  58. .platform_data = &sh7763rdp_nor_flash_data,
  59. },
  60. };
  61. /* SH-Ether */
  62. static struct resource sh_eth_resources[] = {
  63. {
  64. .start = 0xFEE00800, /* use eth1 */
  65. .end = 0xFEE00F7C - 1,
  66. .flags = IORESOURCE_MEM,
  67. }, {
  68. .start = 58, /* irq number */
  69. .end = 58,
  70. .flags = IORESOURCE_IRQ,
  71. },
  72. };
  73. static struct sh_eth_plat_data sh7763_eth_pdata = {
  74. .phy = 1,
  75. .edmac_endian = EDMAC_LITTLE_ENDIAN,
  76. };
  77. static struct platform_device sh7763rdp_eth_device = {
  78. .name = "sh-eth",
  79. .resource = sh_eth_resources,
  80. .num_resources = ARRAY_SIZE(sh_eth_resources),
  81. .dev = {
  82. .platform_data = &sh7763_eth_pdata,
  83. },
  84. };
  85. /* SH7763 LCDC */
  86. static struct resource sh7763rdp_fb_resources[] = {
  87. {
  88. .start = 0xFFE80000,
  89. .end = 0xFFE80442 - 1,
  90. .flags = IORESOURCE_MEM,
  91. },
  92. };
  93. static struct fb_videomode sh7763fb_videomode = {
  94. .refresh = 60,
  95. .name = "VGA Monitor",
  96. .xres = 640,
  97. .yres = 480,
  98. .pixclock = 10000,
  99. .left_margin = 80,
  100. .right_margin = 24,
  101. .upper_margin = 30,
  102. .lower_margin = 1,
  103. .hsync_len = 96,
  104. .vsync_len = 1,
  105. .sync = 0,
  106. .vmode = FB_VMODE_NONINTERLACED,
  107. .flag = FBINFO_FLAG_DEFAULT,
  108. };
  109. static struct sh7760fb_platdata sh7763fb_def_pdata = {
  110. .def_mode = &sh7763fb_videomode,
  111. .ldmtr = (LDMTR_TFT_COLOR_16|LDMTR_MCNT),
  112. .lddfr = LDDFR_16BPP_RGB565,
  113. .ldpmmr = 0x0000,
  114. .ldpspr = 0xFFFF,
  115. .ldaclnr = 0x0001,
  116. .ldickr = 0x1102,
  117. .rotate = 0,
  118. .novsync = 0,
  119. .blank = NULL,
  120. };
  121. static struct platform_device sh7763rdp_fb_device = {
  122. .name = "sh7760-lcdc",
  123. .resource = sh7763rdp_fb_resources,
  124. .num_resources = ARRAY_SIZE(sh7763rdp_fb_resources),
  125. .dev = {
  126. .platform_data = &sh7763fb_def_pdata,
  127. },
  128. };
  129. static struct platform_device *sh7763rdp_devices[] __initdata = {
  130. &sh7763rdp_nor_flash_device,
  131. &sh7763rdp_eth_device,
  132. &sh7763rdp_fb_device,
  133. };
  134. static int __init sh7763rdp_devices_setup(void)
  135. {
  136. return platform_add_devices(sh7763rdp_devices,
  137. ARRAY_SIZE(sh7763rdp_devices));
  138. }
  139. device_initcall(sh7763rdp_devices_setup);
  140. static void __init sh7763rdp_setup(char **cmdline_p)
  141. {
  142. /* Board version check */
  143. if (ctrl_inw(CPLD_BOARD_ID_ERV_REG) == 0xECB1)
  144. printk(KERN_INFO "RTE Standard Configuration\n");
  145. else
  146. printk(KERN_INFO "RTA Standard Configuration\n");
  147. /* USB pin select bits (clear bit 5-2 to 0) */
  148. ctrl_outw((ctrl_inw(PORT_PSEL2) & 0xFFC3), PORT_PSEL2);
  149. /* USBH setup port I controls to other (clear bits 4-9 to 0) */
  150. ctrl_outw(ctrl_inw(PORT_PICR) & 0xFC0F, PORT_PICR);
  151. /* Select USB Host controller */
  152. ctrl_outw(0x00, USB_USBHSC);
  153. /* For LCD */
  154. /* set PTJ7-1, bits 15-2 of PJCR to 0 */
  155. ctrl_outw(ctrl_inw(PORT_PJCR) & 0x0003, PORT_PJCR);
  156. /* set PTI5, bits 11-10 of PICR to 0 */
  157. ctrl_outw(ctrl_inw(PORT_PICR) & 0xF3FF, PORT_PICR);
  158. ctrl_outw(0, PORT_PKCR);
  159. ctrl_outw(0, PORT_PLCR);
  160. /* set PSEL2 bits 14-8, 5-4, of PSEL2 to 0 */
  161. ctrl_outw((ctrl_inw(PORT_PSEL2) & 0x00C0), PORT_PSEL2);
  162. /* set PSEL3 bits 14-12, 6-4, 2-0 of PSEL3 to 0 */
  163. ctrl_outw((ctrl_inw(PORT_PSEL3) & 0x0700), PORT_PSEL3);
  164. /* For HAC */
  165. /* bit3-0 0100:HAC & SSI1 enable */
  166. ctrl_outw((ctrl_inw(PORT_PSEL1) & 0xFFF0) | 0x0004, PORT_PSEL1);
  167. /* bit14 1:SSI_HAC_CLK enable */
  168. ctrl_outw(ctrl_inw(PORT_PSEL4) | 0x4000, PORT_PSEL4);
  169. /* SH-Ether */
  170. ctrl_outw((ctrl_inw(PORT_PSEL1) & ~0xff00) | 0x2400, PORT_PSEL1);
  171. ctrl_outw(0x0, PORT_PFCR);
  172. ctrl_outw(0x0, PORT_PFCR);
  173. ctrl_outw(0x0, PORT_PFCR);
  174. /* MMC */
  175. /*selects SCIF and MMC other functions */
  176. ctrl_outw(0x0001, PORT_PSEL0);
  177. /* MMC clock operates */
  178. ctrl_outl(ctrl_inl(MSTPCR1) & ~0x8, MSTPCR1);
  179. ctrl_outw(ctrl_inw(PORT_PACR) & ~0x3000, PORT_PACR);
  180. ctrl_outw(ctrl_inw(PORT_PCCR) & ~0xCFC3, PORT_PCCR);
  181. }
  182. static struct sh_machine_vector mv_sh7763rdp __initmv = {
  183. .mv_name = "sh7763drp",
  184. .mv_setup = sh7763rdp_setup,
  185. .mv_nr_irqs = 112,
  186. .mv_init_irq = init_sh7763rdp_IRQ,
  187. };