board-edb7211.c 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /*
  2. * Copyright (C) 2000, 2001 Blue Mug, Inc. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. */
  9. #include <linux/init.h>
  10. #include <linux/gpio.h>
  11. #include <linux/delay.h>
  12. #include <linux/memblock.h>
  13. #include <linux/types.h>
  14. #include <linux/interrupt.h>
  15. #include <linux/backlight.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/mtd/physmap.h>
  18. #include <linux/mtd/partitions.h>
  19. #include <asm/setup.h>
  20. #include <asm/mach/map.h>
  21. #include <asm/mach/arch.h>
  22. #include <asm/mach-types.h>
  23. #include <video/platform_lcd.h>
  24. #include <mach/hardware.h>
  25. #include "common.h"
  26. #define VIDEORAM_SIZE SZ_128K
  27. #define EDB7211_LCD_DC_DC_EN CLPS711X_GPIO(3, 1)
  28. #define EDB7211_LCDEN CLPS711X_GPIO(3, 2)
  29. #define EDB7211_LCDBL CLPS711X_GPIO(3, 3)
  30. #define EDB7211_FLASH0_BASE (CS0_PHYS_BASE)
  31. #define EDB7211_FLASH1_BASE (CS1_PHYS_BASE)
  32. #define EDB7211_CS8900_BASE (CS2_PHYS_BASE + 0x300)
  33. #define EDB7211_CS8900_IRQ (IRQ_EINT3)
  34. static struct resource edb7211_cs8900_resource[] __initdata = {
  35. DEFINE_RES_MEM(EDB7211_CS8900_BASE, SZ_1K),
  36. DEFINE_RES_IRQ(EDB7211_CS8900_IRQ),
  37. };
  38. static struct mtd_partition edb7211_flash_partitions[] __initdata = {
  39. {
  40. .name = "Flash",
  41. .offset = 0,
  42. .size = MTDPART_SIZ_FULL,
  43. },
  44. };
  45. static struct physmap_flash_data edb7211_flash_pdata __initdata = {
  46. .width = 4,
  47. .parts = edb7211_flash_partitions,
  48. .nr_parts = ARRAY_SIZE(edb7211_flash_partitions),
  49. };
  50. static struct resource edb7211_flash_resources[] __initdata = {
  51. DEFINE_RES_MEM(EDB7211_FLASH0_BASE, SZ_8M),
  52. DEFINE_RES_MEM(EDB7211_FLASH1_BASE, SZ_8M),
  53. };
  54. static struct platform_device edb7211_flash_pdev __initdata = {
  55. .name = "physmap-flash",
  56. .id = 0,
  57. .resource = edb7211_flash_resources,
  58. .num_resources = ARRAY_SIZE(edb7211_flash_resources),
  59. .dev = {
  60. .platform_data = &edb7211_flash_pdata,
  61. },
  62. };
  63. static void edb7211_lcd_power_set(struct plat_lcd_data *pd, unsigned int power)
  64. {
  65. if (power) {
  66. gpio_set_value(EDB7211_LCDEN, 1);
  67. udelay(100);
  68. gpio_set_value(EDB7211_LCD_DC_DC_EN, 1);
  69. } else {
  70. gpio_set_value(EDB7211_LCD_DC_DC_EN, 0);
  71. udelay(100);
  72. gpio_set_value(EDB7211_LCDEN, 0);
  73. }
  74. }
  75. static struct plat_lcd_data edb7211_lcd_power_pdata = {
  76. .set_power = edb7211_lcd_power_set,
  77. };
  78. static void edb7211_lcd_backlight_set_intensity(int intensity)
  79. {
  80. gpio_set_value(EDB7211_LCDBL, intensity);
  81. }
  82. static struct generic_bl_info edb7211_lcd_backlight_pdata = {
  83. .name = "lcd-backlight.0",
  84. .default_intensity = 0x01,
  85. .max_intensity = 0x01,
  86. .set_bl_intensity = edb7211_lcd_backlight_set_intensity,
  87. };
  88. static struct gpio edb7211_gpios[] __initconst = {
  89. { EDB7211_LCD_DC_DC_EN, GPIOF_OUT_INIT_LOW, "LCD DC-DC" },
  90. { EDB7211_LCDEN, GPIOF_OUT_INIT_LOW, "LCD POWER" },
  91. { EDB7211_LCDBL, GPIOF_OUT_INIT_LOW, "LCD BACKLIGHT" },
  92. };
  93. static struct map_desc edb7211_io_desc[] __initdata = {
  94. { /* Memory-mapped extra keyboard row */
  95. .virtual = IO_ADDRESS(EP7211_PHYS_EXTKBD),
  96. .pfn = __phys_to_pfn(EP7211_PHYS_EXTKBD),
  97. .length = SZ_1M,
  98. .type = MT_DEVICE,
  99. },
  100. };
  101. void __init edb7211_map_io(void)
  102. {
  103. clps711x_map_io();
  104. iotable_init(edb7211_io_desc, ARRAY_SIZE(edb7211_io_desc));
  105. }
  106. /* Reserve screen memory region at the start of main system memory. */
  107. static void __init edb7211_reserve(void)
  108. {
  109. memblock_reserve(PHYS_OFFSET, VIDEORAM_SIZE);
  110. }
  111. static void __init
  112. fixup_edb7211(struct tag *tags, char **cmdline, struct meminfo *mi)
  113. {
  114. /*
  115. * Bank start addresses are not present in the information
  116. * passed in from the boot loader. We could potentially
  117. * detect them, but instead we hard-code them.
  118. *
  119. * Banks sizes _are_ present in the param block, but we're
  120. * not using that information yet.
  121. */
  122. mi->bank[0].start = 0xc0000000;
  123. mi->bank[0].size = SZ_8M;
  124. mi->bank[1].start = 0xc1000000;
  125. mi->bank[1].size = SZ_8M;
  126. mi->nr_banks = 2;
  127. }
  128. static void __init edb7211_init(void)
  129. {
  130. gpio_request_array(edb7211_gpios, ARRAY_SIZE(edb7211_gpios));
  131. platform_device_register(&edb7211_flash_pdev);
  132. platform_device_register_data(&platform_bus, "platform-lcd", 0,
  133. &edb7211_lcd_power_pdata,
  134. sizeof(edb7211_lcd_power_pdata));
  135. platform_device_register_data(&platform_bus, "generic-bl", 0,
  136. &edb7211_lcd_backlight_pdata,
  137. sizeof(edb7211_lcd_backlight_pdata));
  138. platform_device_register_simple("video-clps711x", 0, NULL, 0);
  139. platform_device_register_simple("cs89x0", 0, edb7211_cs8900_resource,
  140. ARRAY_SIZE(edb7211_cs8900_resource));
  141. }
  142. MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)")
  143. /* Maintainer: Jon McClintock */
  144. .atag_offset = VIDEORAM_SIZE + 0x100,
  145. .nr_irqs = CLPS711X_NR_IRQS,
  146. .fixup = fixup_edb7211,
  147. .reserve = edb7211_reserve,
  148. .map_io = edb7211_map_io,
  149. .init_irq = clps711x_init_irq,
  150. .timer = &clps711x_timer,
  151. .init_machine = edb7211_init,
  152. .handle_irq = clps711x_handle_irq,
  153. .restart = clps711x_restart,
  154. MACHINE_END