2 * Copyright (C) 2000, 2001 Blue Mug, Inc. All Rights Reserved.
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.
10 #include <linux/init.h>
11 #include <linux/gpio.h>
12 #include <linux/delay.h>
13 #include <linux/memblock.h>
14 #include <linux/types.h>
15 #include <linux/i2c-gpio.h>
16 #include <linux/interrupt.h>
17 #include <linux/platform_device.h>
18 #include <linux/pwm.h>
19 #include <linux/pwm_backlight.h>
20 #include <linux/memblock.h>
22 #include <linux/mtd/physmap.h>
23 #include <linux/mtd/partitions.h>
25 #include <asm/setup.h>
26 #include <asm/mach/map.h>
27 #include <asm/mach/arch.h>
28 #include <asm/mach-types.h>
30 #include <video/platform_lcd.h>
32 #include <mach/hardware.h>
37 #define VIDEORAM_SIZE SZ_128K
39 #define EDB7211_LCD_DC_DC_EN CLPS711X_GPIO(3, 1)
40 #define EDB7211_LCDEN CLPS711X_GPIO(3, 2)
41 #define EDB7211_LCDBL CLPS711X_GPIO(3, 3)
43 #define EDB7211_I2C_SDA CLPS711X_GPIO(3, 4)
44 #define EDB7211_I2C_SCL CLPS711X_GPIO(3, 5)
46 #define EDB7211_FLASH0_BASE (CS0_PHYS_BASE)
47 #define EDB7211_FLASH1_BASE (CS1_PHYS_BASE)
49 #define EDB7211_CS8900_BASE (CS2_PHYS_BASE + 0x300)
50 #define EDB7211_CS8900_IRQ (IRQ_EINT3)
52 /* The extra 8 lines of the keyboard matrix */
53 #define EDB7211_EXTKBD_BASE (CS3_PHYS_BASE)
55 static struct i2c_gpio_platform_data edb7211_i2c_pdata __initdata = {
56 .sda_pin = EDB7211_I2C_SDA,
57 .scl_pin = EDB7211_I2C_SCL,
58 .scl_is_output_only = 1,
61 static struct resource edb7211_cs8900_resource[] __initdata = {
62 DEFINE_RES_MEM(EDB7211_CS8900_BASE, SZ_1K),
63 DEFINE_RES_IRQ(EDB7211_CS8900_IRQ),
66 static struct mtd_partition edb7211_flash_partitions[] __initdata = {
70 .size = MTDPART_SIZ_FULL,
74 static struct physmap_flash_data edb7211_flash_pdata __initdata = {
76 .parts = edb7211_flash_partitions,
77 .nr_parts = ARRAY_SIZE(edb7211_flash_partitions),
80 static struct resource edb7211_flash_resources[] __initdata = {
81 DEFINE_RES_MEM(EDB7211_FLASH0_BASE, SZ_8M),
82 DEFINE_RES_MEM(EDB7211_FLASH1_BASE, SZ_8M),
85 static struct platform_device edb7211_flash_pdev __initdata = {
86 .name = "physmap-flash",
88 .resource = edb7211_flash_resources,
89 .num_resources = ARRAY_SIZE(edb7211_flash_resources),
91 .platform_data = &edb7211_flash_pdata,
95 static void edb7211_lcd_power_set(struct plat_lcd_data *pd, unsigned int power)
98 gpio_set_value(EDB7211_LCDEN, 1);
100 gpio_set_value(EDB7211_LCD_DC_DC_EN, 1);
102 gpio_set_value(EDB7211_LCD_DC_DC_EN, 0);
104 gpio_set_value(EDB7211_LCDEN, 0);
108 static struct plat_lcd_data edb7211_lcd_power_pdata = {
109 .set_power = edb7211_lcd_power_set,
112 static struct pwm_lookup edb7211_pwm_lookup[] = {
113 PWM_LOOKUP("clps711x-pwm", 0, "pwm-backlight.0", NULL,
114 0, PWM_POLARITY_NORMAL),
117 static struct platform_pwm_backlight_data pwm_bl_pdata = {
118 .dft_brightness = 0x01,
119 .max_brightness = 0x0f,
120 .enable_gpio = EDB7211_LCDBL,
123 static struct resource clps711x_pwm_res =
124 DEFINE_RES_MEM(CLPS711X_PHYS_BASE + PMPCON, SZ_4);
126 static struct gpio edb7211_gpios[] __initconst = {
127 { EDB7211_LCD_DC_DC_EN, GPIOF_OUT_INIT_LOW, "LCD DC-DC" },
128 { EDB7211_LCDEN, GPIOF_OUT_INIT_LOW, "LCD POWER" },
131 /* Reserve screen memory region at the start of main system memory. */
132 static void __init edb7211_reserve(void)
134 memblock_reserve(PHYS_OFFSET, VIDEORAM_SIZE);
138 fixup_edb7211(struct tag *tags, char **cmdline)
141 * Bank start addresses are not present in the information
142 * passed in from the boot loader. We could potentially
143 * detect them, but instead we hard-code them.
145 * Banks sizes _are_ present in the param block, but we're
146 * not using that information yet.
148 memblock_add(0xc0000000, SZ_8M);
149 memblock_add(0xc1000000, SZ_8M);
152 static void __init edb7211_init_late(void)
154 gpio_request_array(edb7211_gpios, ARRAY_SIZE(edb7211_gpios));
156 platform_device_register(&edb7211_flash_pdev);
158 platform_device_register_data(NULL, "platform-lcd", 0,
159 &edb7211_lcd_power_pdata,
160 sizeof(edb7211_lcd_power_pdata));
162 platform_device_register_simple("clps711x-pwm", PLATFORM_DEVID_NONE,
163 &clps711x_pwm_res, 1);
164 pwm_add_table(edb7211_pwm_lookup, ARRAY_SIZE(edb7211_pwm_lookup));
166 platform_device_register_data(&platform_bus, "pwm-backlight", 0,
167 &pwm_bl_pdata, sizeof(pwm_bl_pdata));
169 platform_device_register_simple("video-clps711x", 0, NULL, 0);
170 platform_device_register_simple("cs89x0", 0, edb7211_cs8900_resource,
171 ARRAY_SIZE(edb7211_cs8900_resource));
172 platform_device_register_data(NULL, "i2c-gpio", 0,
174 sizeof(edb7211_i2c_pdata));
177 MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)")
178 /* Maintainer: Jon McClintock */
179 .atag_offset = VIDEORAM_SIZE + 0x100,
180 .fixup = fixup_edb7211,
181 .reserve = edb7211_reserve,
182 .map_io = clps711x_map_io,
183 .init_irq = clps711x_init_irq,
184 .init_time = clps711x_timer_init,
185 .init_machine = clps711x_devices_init,
186 .init_late = edb7211_init_late,
187 .restart = clps711x_restart,