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/interrupt.h>
16 #include <linux/backlight.h>
17 #include <linux/platform_device.h>
19 #include <linux/mtd/physmap.h>
20 #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>
27 #include <video/platform_lcd.h>
29 #include <mach/hardware.h>
34 #define VIDEORAM_SIZE SZ_128K
36 #define EDB7211_LCD_DC_DC_EN CLPS711X_GPIO(3, 1)
37 #define EDB7211_LCDEN CLPS711X_GPIO(3, 2)
38 #define EDB7211_LCDBL CLPS711X_GPIO(3, 3)
40 #define EDB7211_FLASH0_BASE (CS0_PHYS_BASE)
41 #define EDB7211_FLASH1_BASE (CS1_PHYS_BASE)
42 #define EDB7211_CS8900_BASE (CS2_PHYS_BASE + 0x300)
43 #define EDB7211_CS8900_IRQ (IRQ_EINT3)
45 static struct resource edb7211_cs8900_resource[] __initdata = {
46 DEFINE_RES_MEM(EDB7211_CS8900_BASE, SZ_1K),
47 DEFINE_RES_IRQ(EDB7211_CS8900_IRQ),
50 static struct mtd_partition edb7211_flash_partitions[] __initdata = {
54 .size = MTDPART_SIZ_FULL,
58 static struct physmap_flash_data edb7211_flash_pdata __initdata = {
60 .parts = edb7211_flash_partitions,
61 .nr_parts = ARRAY_SIZE(edb7211_flash_partitions),
64 static struct resource edb7211_flash_resources[] __initdata = {
65 DEFINE_RES_MEM(EDB7211_FLASH0_BASE, SZ_8M),
66 DEFINE_RES_MEM(EDB7211_FLASH1_BASE, SZ_8M),
69 static struct platform_device edb7211_flash_pdev __initdata = {
70 .name = "physmap-flash",
72 .resource = edb7211_flash_resources,
73 .num_resources = ARRAY_SIZE(edb7211_flash_resources),
75 .platform_data = &edb7211_flash_pdata,
79 static void edb7211_lcd_power_set(struct plat_lcd_data *pd, unsigned int power)
82 gpio_set_value(EDB7211_LCDEN, 1);
84 gpio_set_value(EDB7211_LCD_DC_DC_EN, 1);
86 gpio_set_value(EDB7211_LCD_DC_DC_EN, 0);
88 gpio_set_value(EDB7211_LCDEN, 0);
92 static struct plat_lcd_data edb7211_lcd_power_pdata = {
93 .set_power = edb7211_lcd_power_set,
96 static void edb7211_lcd_backlight_set_intensity(int intensity)
98 gpio_set_value(EDB7211_LCDBL, intensity);
101 static struct generic_bl_info edb7211_lcd_backlight_pdata = {
102 .name = "lcd-backlight.0",
103 .default_intensity = 0x01,
104 .max_intensity = 0x01,
105 .set_bl_intensity = edb7211_lcd_backlight_set_intensity,
108 static struct gpio edb7211_gpios[] __initconst = {
109 { EDB7211_LCD_DC_DC_EN, GPIOF_OUT_INIT_LOW, "LCD DC-DC" },
110 { EDB7211_LCDEN, GPIOF_OUT_INIT_LOW, "LCD POWER" },
111 { EDB7211_LCDBL, GPIOF_OUT_INIT_LOW, "LCD BACKLIGHT" },
114 static struct map_desc edb7211_io_desc[] __initdata = {
115 { /* Memory-mapped extra keyboard row */
116 .virtual = IO_ADDRESS(EP7211_PHYS_EXTKBD),
117 .pfn = __phys_to_pfn(EP7211_PHYS_EXTKBD),
123 void __init edb7211_map_io(void)
126 iotable_init(edb7211_io_desc, ARRAY_SIZE(edb7211_io_desc));
129 /* Reserve screen memory region at the start of main system memory. */
130 static void __init edb7211_reserve(void)
132 memblock_reserve(PHYS_OFFSET, VIDEORAM_SIZE);
136 fixup_edb7211(struct tag *tags, char **cmdline, struct meminfo *mi)
139 * Bank start addresses are not present in the information
140 * passed in from the boot loader. We could potentially
141 * detect them, but instead we hard-code them.
143 * Banks sizes _are_ present in the param block, but we're
144 * not using that information yet.
146 mi->bank[0].start = 0xc0000000;
147 mi->bank[0].size = SZ_8M;
148 mi->bank[1].start = 0xc1000000;
149 mi->bank[1].size = SZ_8M;
153 static void __init edb7211_init(void)
155 clps711x_devices_init();
158 static void __init edb7211_init_late(void)
160 gpio_request_array(edb7211_gpios, ARRAY_SIZE(edb7211_gpios));
162 platform_device_register(&edb7211_flash_pdev);
163 platform_device_register_data(&platform_bus, "platform-lcd", 0,
164 &edb7211_lcd_power_pdata,
165 sizeof(edb7211_lcd_power_pdata));
166 platform_device_register_data(&platform_bus, "generic-bl", 0,
167 &edb7211_lcd_backlight_pdata,
168 sizeof(edb7211_lcd_backlight_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));
174 MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)")
175 /* Maintainer: Jon McClintock */
176 .atag_offset = VIDEORAM_SIZE + 0x100,
177 .nr_irqs = CLPS711X_NR_IRQS,
178 .fixup = fixup_edb7211,
179 .reserve = edb7211_reserve,
180 .map_io = edb7211_map_io,
181 .init_irq = clps711x_init_irq,
182 .init_time = clps711x_timer_init,
183 .init_machine = edb7211_init,
184 .init_late = edb7211_init_late,
185 .handle_irq = clps711x_handle_irq,
186 .restart = clps711x_restart,