board-edb7211.c 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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/i2c-gpio.h>
  15. #include <linux/interrupt.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/pwm.h>
  18. #include <linux/pwm_backlight.h>
  19. #include <linux/memblock.h>
  20. #include <linux/mtd/physmap.h>
  21. #include <linux/mtd/partitions.h>
  22. #include <asm/setup.h>
  23. #include <asm/mach/map.h>
  24. #include <asm/mach/arch.h>
  25. #include <asm/mach-types.h>
  26. #include <video/platform_lcd.h>
  27. #include <mach/hardware.h>
  28. #include "common.h"
  29. #include "devices.h"
  30. #define VIDEORAM_SIZE SZ_128K
  31. #define EDB7211_LCD_DC_DC_EN CLPS711X_GPIO(3, 1)
  32. #define EDB7211_LCDEN CLPS711X_GPIO(3, 2)
  33. #define EDB7211_LCDBL CLPS711X_GPIO(3, 3)
  34. #define EDB7211_I2C_SDA CLPS711X_GPIO(3, 4)
  35. #define EDB7211_I2C_SCL CLPS711X_GPIO(3, 5)
  36. #define EDB7211_FLASH0_BASE (CS0_PHYS_BASE)
  37. #define EDB7211_FLASH1_BASE (CS1_PHYS_BASE)
  38. #define EDB7211_CS8900_BASE (CS2_PHYS_BASE + 0x300)
  39. #define EDB7211_CS8900_IRQ (IRQ_EINT3)
  40. /* The extra 8 lines of the keyboard matrix */
  41. #define EDB7211_EXTKBD_BASE (CS3_PHYS_BASE)
  42. static struct i2c_gpio_platform_data edb7211_i2c_pdata __initdata = {
  43. .sda_pin = EDB7211_I2C_SDA,
  44. .scl_pin = EDB7211_I2C_SCL,
  45. .scl_is_output_only = 1,
  46. };
  47. static struct resource edb7211_cs8900_resource[] __initdata = {
  48. DEFINE_RES_MEM(EDB7211_CS8900_BASE, SZ_1K),
  49. DEFINE_RES_IRQ(EDB7211_CS8900_IRQ),
  50. };
  51. static struct mtd_partition edb7211_flash_partitions[] __initdata = {
  52. {
  53. .name = "Flash",
  54. .offset = 0,
  55. .size = MTDPART_SIZ_FULL,
  56. },
  57. };
  58. static struct physmap_flash_data edb7211_flash_pdata __initdata = {
  59. .width = 4,
  60. .parts = edb7211_flash_partitions,
  61. .nr_parts = ARRAY_SIZE(edb7211_flash_partitions),
  62. };
  63. static struct resource edb7211_flash_resources[] __initdata = {
  64. DEFINE_RES_MEM(EDB7211_FLASH0_BASE, SZ_8M),
  65. DEFINE_RES_MEM(EDB7211_FLASH1_BASE, SZ_8M),
  66. };
  67. static struct platform_device edb7211_flash_pdev __initdata = {
  68. .name = "physmap-flash",
  69. .id = 0,
  70. .resource = edb7211_flash_resources,
  71. .num_resources = ARRAY_SIZE(edb7211_flash_resources),
  72. .dev = {
  73. .platform_data = &edb7211_flash_pdata,
  74. },
  75. };
  76. static void edb7211_lcd_power_set(struct plat_lcd_data *pd, unsigned int power)
  77. {
  78. if (power) {
  79. gpio_set_value(EDB7211_LCDEN, 1);
  80. udelay(100);
  81. gpio_set_value(EDB7211_LCD_DC_DC_EN, 1);
  82. } else {
  83. gpio_set_value(EDB7211_LCD_DC_DC_EN, 0);
  84. udelay(100);
  85. gpio_set_value(EDB7211_LCDEN, 0);
  86. }
  87. }
  88. static struct plat_lcd_data edb7211_lcd_power_pdata = {
  89. .set_power = edb7211_lcd_power_set,
  90. };
  91. static struct pwm_lookup edb7211_pwm_lookup[] = {
  92. PWM_LOOKUP("clps711x-pwm", 0, "pwm-backlight.0", NULL,
  93. 0, PWM_POLARITY_NORMAL),
  94. };
  95. static struct platform_pwm_backlight_data pwm_bl_pdata = {
  96. .dft_brightness = 0x01,
  97. .max_brightness = 0x0f,
  98. .enable_gpio = EDB7211_LCDBL,
  99. };
  100. static struct resource clps711x_pwm_res =
  101. DEFINE_RES_MEM(CLPS711X_PHYS_BASE + PMPCON, SZ_4);
  102. static struct gpio edb7211_gpios[] __initconst = {
  103. { EDB7211_LCD_DC_DC_EN, GPIOF_OUT_INIT_LOW, "LCD DC-DC" },
  104. { EDB7211_LCDEN, GPIOF_OUT_INIT_LOW, "LCD POWER" },
  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)
  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. memblock_add(0xc0000000, SZ_8M);
  123. memblock_add(0xc1000000, SZ_8M);
  124. }
  125. static void __init edb7211_init_late(void)
  126. {
  127. gpio_request_array(edb7211_gpios, ARRAY_SIZE(edb7211_gpios));
  128. platform_device_register(&edb7211_flash_pdev);
  129. platform_device_register_data(NULL, "platform-lcd", 0,
  130. &edb7211_lcd_power_pdata,
  131. sizeof(edb7211_lcd_power_pdata));
  132. platform_device_register_simple("clps711x-pwm", PLATFORM_DEVID_NONE,
  133. &clps711x_pwm_res, 1);
  134. pwm_add_table(edb7211_pwm_lookup, ARRAY_SIZE(edb7211_pwm_lookup));
  135. platform_device_register_data(&platform_bus, "pwm-backlight", 0,
  136. &pwm_bl_pdata, sizeof(pwm_bl_pdata));
  137. platform_device_register_simple("video-clps711x", 0, NULL, 0);
  138. platform_device_register_simple("cs89x0", 0, edb7211_cs8900_resource,
  139. ARRAY_SIZE(edb7211_cs8900_resource));
  140. platform_device_register_data(NULL, "i2c-gpio", 0,
  141. &edb7211_i2c_pdata,
  142. sizeof(edb7211_i2c_pdata));
  143. }
  144. MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)")
  145. /* Maintainer: Jon McClintock */
  146. .atag_offset = VIDEORAM_SIZE + 0x100,
  147. .fixup = fixup_edb7211,
  148. .reserve = edb7211_reserve,
  149. .map_io = clps711x_map_io,
  150. .init_irq = clps711x_init_irq,
  151. .init_time = clps711x_timer_init,
  152. .init_machine = clps711x_devices_init,
  153. .init_late = edb7211_init_late,
  154. .restart = clps711x_restart,
  155. MACHINE_END