setup.c 5.6 KB

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