dt-bindings: mailbox: Add Amlogic Meson MHU Bindings
[deliverable/linux.git] / arch / arm / mach-clps711x / board-edb7211.c
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
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>
21
22 #include <linux/mtd/physmap.h>
23 #include <linux/mtd/partitions.h>
24
25 #include <asm/setup.h>
26 #include <asm/mach/map.h>
27 #include <asm/mach/arch.h>
28 #include <asm/mach-types.h>
29
30 #include <video/platform_lcd.h>
31
32 #include <mach/hardware.h>
33
34 #include "common.h"
35 #include "devices.h"
36
37 #define VIDEORAM_SIZE SZ_128K
38
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)
42
43 #define EDB7211_I2C_SDA CLPS711X_GPIO(3, 4)
44 #define EDB7211_I2C_SCL CLPS711X_GPIO(3, 5)
45
46 #define EDB7211_FLASH0_BASE (CS0_PHYS_BASE)
47 #define EDB7211_FLASH1_BASE (CS1_PHYS_BASE)
48
49 #define EDB7211_CS8900_BASE (CS2_PHYS_BASE + 0x300)
50 #define EDB7211_CS8900_IRQ (IRQ_EINT3)
51
52 /* The extra 8 lines of the keyboard matrix */
53 #define EDB7211_EXTKBD_BASE (CS3_PHYS_BASE)
54
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,
59 };
60
61 static struct resource edb7211_cs8900_resource[] __initdata = {
62 DEFINE_RES_MEM(EDB7211_CS8900_BASE, SZ_1K),
63 DEFINE_RES_IRQ(EDB7211_CS8900_IRQ),
64 };
65
66 static struct mtd_partition edb7211_flash_partitions[] __initdata = {
67 {
68 .name = "Flash",
69 .offset = 0,
70 .size = MTDPART_SIZ_FULL,
71 },
72 };
73
74 static struct physmap_flash_data edb7211_flash_pdata __initdata = {
75 .width = 4,
76 .parts = edb7211_flash_partitions,
77 .nr_parts = ARRAY_SIZE(edb7211_flash_partitions),
78 };
79
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),
83 };
84
85 static struct platform_device edb7211_flash_pdev __initdata = {
86 .name = "physmap-flash",
87 .id = 0,
88 .resource = edb7211_flash_resources,
89 .num_resources = ARRAY_SIZE(edb7211_flash_resources),
90 .dev = {
91 .platform_data = &edb7211_flash_pdata,
92 },
93 };
94
95 static void edb7211_lcd_power_set(struct plat_lcd_data *pd, unsigned int power)
96 {
97 if (power) {
98 gpio_set_value(EDB7211_LCDEN, 1);
99 udelay(100);
100 gpio_set_value(EDB7211_LCD_DC_DC_EN, 1);
101 } else {
102 gpio_set_value(EDB7211_LCD_DC_DC_EN, 0);
103 udelay(100);
104 gpio_set_value(EDB7211_LCDEN, 0);
105 }
106 }
107
108 static struct plat_lcd_data edb7211_lcd_power_pdata = {
109 .set_power = edb7211_lcd_power_set,
110 };
111
112 static struct pwm_lookup edb7211_pwm_lookup[] = {
113 PWM_LOOKUP("clps711x-pwm", 0, "pwm-backlight.0", NULL,
114 0, PWM_POLARITY_NORMAL),
115 };
116
117 static struct platform_pwm_backlight_data pwm_bl_pdata = {
118 .dft_brightness = 0x01,
119 .max_brightness = 0x0f,
120 .enable_gpio = EDB7211_LCDBL,
121 };
122
123 static struct resource clps711x_pwm_res =
124 DEFINE_RES_MEM(CLPS711X_PHYS_BASE + PMPCON, SZ_4);
125
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" },
129 };
130
131 /* Reserve screen memory region at the start of main system memory. */
132 static void __init edb7211_reserve(void)
133 {
134 memblock_reserve(PHYS_OFFSET, VIDEORAM_SIZE);
135 }
136
137 static void __init
138 fixup_edb7211(struct tag *tags, char **cmdline)
139 {
140 /*
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.
144 *
145 * Banks sizes _are_ present in the param block, but we're
146 * not using that information yet.
147 */
148 memblock_add(0xc0000000, SZ_8M);
149 memblock_add(0xc1000000, SZ_8M);
150 }
151
152 static void __init edb7211_init_late(void)
153 {
154 gpio_request_array(edb7211_gpios, ARRAY_SIZE(edb7211_gpios));
155
156 platform_device_register(&edb7211_flash_pdev);
157
158 platform_device_register_data(NULL, "platform-lcd", 0,
159 &edb7211_lcd_power_pdata,
160 sizeof(edb7211_lcd_power_pdata));
161
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));
165
166 platform_device_register_data(&platform_bus, "pwm-backlight", 0,
167 &pwm_bl_pdata, sizeof(pwm_bl_pdata));
168
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,
173 &edb7211_i2c_pdata,
174 sizeof(edb7211_i2c_pdata));
175 }
176
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,
188 MACHINE_END
This page took 0.043091 seconds and 5 git commands to generate.