board-p720t.c 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. /*
  2. * linux/arch/arm/mach-clps711x/p720t.c
  3. *
  4. * Copyright (C) 2000-2001 Deep Blue Solutions Ltd
  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 as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. */
  20. #include <linux/kernel.h>
  21. #include <linux/init.h>
  22. #include <linux/types.h>
  23. #include <linux/string.h>
  24. #include <linux/mm.h>
  25. #include <linux/io.h>
  26. #include <linux/slab.h>
  27. #include <linux/leds.h>
  28. #include <linux/sizes.h>
  29. #include <linux/backlight.h>
  30. #include <linux/platform_device.h>
  31. #include <linux/mtd/partitions.h>
  32. #include <linux/mtd/nand-gpio.h>
  33. #include <mach/hardware.h>
  34. #include <asm/pgtable.h>
  35. #include <asm/page.h>
  36. #include <asm/setup.h>
  37. #include <asm/mach-types.h>
  38. #include <asm/mach/arch.h>
  39. #include <asm/mach/map.h>
  40. #include <mach/syspld.h>
  41. #include <video/platform_lcd.h>
  42. #include "common.h"
  43. #define P720T_USERLED CLPS711X_GPIO(3, 0)
  44. #define P720T_NAND_CLE CLPS711X_GPIO(4, 0)
  45. #define P720T_NAND_ALE CLPS711X_GPIO(4, 1)
  46. #define P720T_NAND_NCE CLPS711X_GPIO(4, 2)
  47. #define P720T_NAND_BASE (CLPS711X_SDRAM1_BASE)
  48. static struct resource p720t_nand_resource[] __initdata = {
  49. DEFINE_RES_MEM(P720T_NAND_BASE, SZ_4),
  50. };
  51. static struct mtd_partition p720t_nand_parts[] __initdata = {
  52. {
  53. .name = "Flash partition 1",
  54. .offset = 0,
  55. .size = SZ_2M,
  56. },
  57. {
  58. .name = "Flash partition 2",
  59. .offset = MTDPART_OFS_APPEND,
  60. .size = MTDPART_SIZ_FULL,
  61. },
  62. };
  63. static struct gpio_nand_platdata p720t_nand_pdata __initdata = {
  64. .gpio_rdy = -1,
  65. .gpio_nce = P720T_NAND_NCE,
  66. .gpio_ale = P720T_NAND_ALE,
  67. .gpio_cle = P720T_NAND_CLE,
  68. .gpio_nwp = -1,
  69. .chip_delay = 15,
  70. .parts = p720t_nand_parts,
  71. .num_parts = ARRAY_SIZE(p720t_nand_parts),
  72. };
  73. static struct platform_device p720t_nand_pdev __initdata = {
  74. .name = "gpio-nand",
  75. .id = -1,
  76. .resource = p720t_nand_resource,
  77. .num_resources = ARRAY_SIZE(p720t_nand_resource),
  78. .dev = {
  79. .platform_data = &p720t_nand_pdata,
  80. },
  81. };
  82. static void p720t_lcd_power_set(struct plat_lcd_data *pd, unsigned int power)
  83. {
  84. if (power) {
  85. PLD_LCDEN = PLD_LCDEN_EN;
  86. PLD_PWR |= PLD_S4_ON | PLD_S2_ON | PLD_S1_ON;
  87. } else {
  88. PLD_PWR &= ~(PLD_S4_ON | PLD_S2_ON | PLD_S1_ON);
  89. PLD_LCDEN = 0;
  90. }
  91. }
  92. static struct plat_lcd_data p720t_lcd_power_pdata = {
  93. .set_power = p720t_lcd_power_set,
  94. };
  95. static void p720t_lcd_backlight_set_intensity(int intensity)
  96. {
  97. if (intensity)
  98. PLD_PWR |= PLD_S3_ON;
  99. else
  100. PLD_PWR = 0;
  101. }
  102. static struct generic_bl_info p720t_lcd_backlight_pdata = {
  103. .name = "lcd-backlight.0",
  104. .default_intensity = 0x01,
  105. .max_intensity = 0x01,
  106. .set_bl_intensity = p720t_lcd_backlight_set_intensity,
  107. };
  108. /*
  109. * Map the P720T system PLD. It occupies two address spaces:
  110. * 0x10000000 and 0x10400000. We map both regions as one.
  111. */
  112. static struct map_desc p720t_io_desc[] __initdata = {
  113. {
  114. .virtual = SYSPLD_VIRT_BASE,
  115. .pfn = __phys_to_pfn(SYSPLD_PHYS_BASE),
  116. .length = SZ_8M,
  117. .type = MT_DEVICE,
  118. },
  119. };
  120. static void __init
  121. fixup_p720t(struct tag *tag, char **cmdline, struct meminfo *mi)
  122. {
  123. /*
  124. * Our bootloader doesn't setup any tags (yet).
  125. */
  126. if (tag->hdr.tag != ATAG_CORE) {
  127. tag->hdr.tag = ATAG_CORE;
  128. tag->hdr.size = tag_size(tag_core);
  129. tag->u.core.flags = 0;
  130. tag->u.core.pagesize = PAGE_SIZE;
  131. tag->u.core.rootdev = 0x0100;
  132. tag = tag_next(tag);
  133. tag->hdr.tag = ATAG_MEM;
  134. tag->hdr.size = tag_size(tag_mem32);
  135. tag->u.mem.size = 4096;
  136. tag->u.mem.start = PHYS_OFFSET;
  137. tag = tag_next(tag);
  138. tag->hdr.tag = ATAG_NONE;
  139. tag->hdr.size = 0;
  140. }
  141. }
  142. static void __init p720t_map_io(void)
  143. {
  144. clps711x_map_io();
  145. iotable_init(p720t_io_desc, ARRAY_SIZE(p720t_io_desc));
  146. }
  147. static void __init p720t_init_early(void)
  148. {
  149. /*
  150. * Power down as much as possible in case we don't
  151. * have the drivers loaded.
  152. */
  153. PLD_LCDEN = 0;
  154. PLD_PWR &= ~(PLD_S4_ON|PLD_S3_ON|PLD_S2_ON|PLD_S1_ON);
  155. PLD_KBD = 0;
  156. PLD_IO = 0;
  157. PLD_IRDA = 0;
  158. PLD_CODEC = 0;
  159. PLD_TCH = 0;
  160. PLD_SPI = 0;
  161. if (!IS_ENABLED(CONFIG_DEBUG_LL)) {
  162. PLD_COM2 = 0;
  163. PLD_COM1 = 0;
  164. }
  165. }
  166. static struct gpio_led p720t_gpio_leds[] = {
  167. {
  168. .name = "User LED",
  169. .default_trigger = "heartbeat",
  170. .gpio = P720T_USERLED,
  171. },
  172. };
  173. static struct gpio_led_platform_data p720t_gpio_led_pdata __initdata = {
  174. .leds = p720t_gpio_leds,
  175. .num_leds = ARRAY_SIZE(p720t_gpio_leds),
  176. };
  177. static void __init p720t_init(void)
  178. {
  179. platform_device_register(&p720t_nand_pdev);
  180. platform_device_register_data(&platform_bus, "platform-lcd", 0,
  181. &p720t_lcd_power_pdata,
  182. sizeof(p720t_lcd_power_pdata));
  183. platform_device_register_data(&platform_bus, "generic-bl", 0,
  184. &p720t_lcd_backlight_pdata,
  185. sizeof(p720t_lcd_backlight_pdata));
  186. platform_device_register_simple("video-clps711x", 0, NULL, 0);
  187. }
  188. static void __init p720t_init_late(void)
  189. {
  190. platform_device_register_data(&platform_bus, "leds-gpio", 0,
  191. &p720t_gpio_led_pdata,
  192. sizeof(p720t_gpio_led_pdata));
  193. }
  194. MACHINE_START(P720T, "ARM-Prospector720T")
  195. /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
  196. .atag_offset = 0x100,
  197. .nr_irqs = CLPS711X_NR_IRQS,
  198. .fixup = fixup_p720t,
  199. .map_io = p720t_map_io,
  200. .init_early = p720t_init_early,
  201. .init_irq = clps711x_init_irq,
  202. .timer = &clps711x_timer,
  203. .init_machine = p720t_init,
  204. .init_late = p720t_init_late,
  205. .handle_irq = clps711x_handle_irq,
  206. .restart = clps711x_restart,
  207. MACHINE_END