nxeb500hmi.c 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. /*
  2. * arch/arm/mach-netx/nxeb500hmi.c
  3. *
  4. * Copyright (c) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2
  8. * as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. */
  19. #include <linux/dma-mapping.h>
  20. #include <linux/init.h>
  21. #include <linux/interrupt.h>
  22. #include <linux/mtd/plat-ram.h>
  23. #include <linux/platform_device.h>
  24. #include <linux/amba/bus.h>
  25. #include <linux/amba/clcd.h>
  26. #include <asm/hardware.h>
  27. #include <asm/mach-types.h>
  28. #include <asm/mach/arch.h>
  29. #include <asm/arch/netx-regs.h>
  30. #include <asm/arch/eth.h>
  31. #include "generic.h"
  32. #include "fb.h"
  33. static struct clcd_panel qvga = {
  34. .mode = {
  35. .name = "QVGA",
  36. .refresh = 60,
  37. .xres = 240,
  38. .yres = 320,
  39. .pixclock = 187617,
  40. .left_margin = 6,
  41. .right_margin = 26,
  42. .upper_margin = 0,
  43. .lower_margin = 6,
  44. .hsync_len = 6,
  45. .vsync_len = 1,
  46. .sync = 0,
  47. .vmode = FB_VMODE_NONINTERLACED,
  48. },
  49. .width = -1,
  50. .height = -1,
  51. .tim2 = 16,
  52. .cntl = CNTL_LCDTFT | CNTL_BGR,
  53. .bpp = 16,
  54. .grayscale = 0,
  55. };
  56. static inline int nxeb500hmi_check(struct clcd_fb *fb, struct fb_var_screeninfo *var)
  57. {
  58. var->green.length = 5;
  59. var->green.msb_right = 0;
  60. return clcdfb_check(fb, var);
  61. }
  62. static int nxeb500hmi_clcd_setup(struct clcd_fb *fb)
  63. {
  64. unsigned int val;
  65. fb->fb.var.green.length = 5;
  66. fb->fb.var.green.msb_right = 0;
  67. /* enable asic control */
  68. val = readl(NETX_SYSTEM_IOC_ACCESS_KEY);
  69. writel(val, NETX_SYSTEM_IOC_ACCESS_KEY);
  70. writel(3, NETX_SYSTEM_IOC_CR);
  71. /* GPIO 14 is used for display enable on newer boards */
  72. writel(9, NETX_GPIO_CFG(14));
  73. val = readl(NETX_PIO_OUTPIO);
  74. writel(val | 1, NETX_PIO_OUTPIO);
  75. val = readl(NETX_PIO_OEPIO);
  76. writel(val | 1, NETX_PIO_OEPIO);
  77. return netx_clcd_setup(fb);
  78. }
  79. static struct clcd_board clcd_data = {
  80. .name = "netX",
  81. .check = nxeb500hmi_check,
  82. .decode = clcdfb_decode,
  83. .enable = netx_clcd_enable,
  84. .setup = nxeb500hmi_clcd_setup,
  85. .mmap = netx_clcd_mmap,
  86. .remove = netx_clcd_remove,
  87. };
  88. static struct netxeth_platform_data eth0_platform_data = {
  89. .xcno = 0,
  90. };
  91. static struct platform_device netx_eth0_device = {
  92. .name = "netx-eth",
  93. .id = 0,
  94. .num_resources = 0,
  95. .resource = NULL,
  96. .dev = {
  97. .platform_data = &eth0_platform_data,
  98. }
  99. };
  100. static struct netxeth_platform_data eth1_platform_data = {
  101. .xcno = 1,
  102. };
  103. static struct platform_device netx_eth1_device = {
  104. .name = "netx-eth",
  105. .id = 1,
  106. .num_resources = 0,
  107. .resource = NULL,
  108. .dev = {
  109. .platform_data = &eth1_platform_data,
  110. }
  111. };
  112. static struct resource netx_cf_resources[] = {
  113. [0] = {
  114. .start = 0x20000000,
  115. .end = 0x25ffffff,
  116. .flags = IORESOURCE_MEM | IORESOURCE_MEM_8AND16BIT,
  117. },
  118. };
  119. static struct platform_device netx_cf_device = {
  120. .name = "netx-cf",
  121. .id = 0,
  122. .resource = netx_cf_resources,
  123. .num_resources = ARRAY_SIZE(netx_cf_resources),
  124. };
  125. static struct resource netx_uart0_resources[] = {
  126. [0] = {
  127. .start = 0x00100A00,
  128. .end = 0x00100A3F,
  129. .flags = IORESOURCE_MEM,
  130. },
  131. [1] = {
  132. .start = (NETX_IRQ_UART0),
  133. .end = (NETX_IRQ_UART0),
  134. .flags = IORESOURCE_IRQ,
  135. },
  136. };
  137. static struct platform_device netx_uart0_device = {
  138. .name = "netx-uart",
  139. .id = 0,
  140. .num_resources = ARRAY_SIZE(netx_uart0_resources),
  141. .resource = netx_uart0_resources,
  142. };
  143. static struct platform_device *devices[] __initdata = {
  144. &netx_eth0_device,
  145. &netx_eth1_device,
  146. &netx_cf_device,
  147. &netx_uart0_device,
  148. };
  149. static void __init nxeb500hmi_init(void)
  150. {
  151. netx_fb_init(&clcd_data, &qvga);
  152. platform_add_devices(devices, ARRAY_SIZE(devices));
  153. }
  154. MACHINE_START(NXEB500HMI, "Hilscher nxeb500hmi")
  155. .phys_io = 0x00100000,
  156. .io_pg_offst = (io_p2v(0x00100000) >> 18) & 0xfffc,
  157. .boot_params = 0x80000100,
  158. .map_io = netx_map_io,
  159. .init_irq = netx_init_irq,
  160. .timer = &netx_timer,
  161. .init_machine = nxeb500hmi_init,
  162. MACHINE_END