Alexander Shiyan | 2a55289 | 2012-10-10 19:45:33 +0400 | [diff] [blame] | 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> |
Alexander Shiyan | 87c37b5 | 2012-11-17 17:57:18 +0400 | [diff] [blame^] | 11 | #include <linux/gpio.h> |
| 12 | #include <linux/delay.h> |
Alexander Shiyan | 2a55289 | 2012-10-10 19:45:33 +0400 | [diff] [blame] | 13 | #include <linux/memblock.h> |
| 14 | #include <linux/types.h> |
Alexander Shiyan | 200daa3 | 2012-11-17 17:57:07 +0400 | [diff] [blame] | 15 | #include <linux/interrupt.h> |
| 16 | #include <linux/platform_device.h> |
Alexander Shiyan | 2a55289 | 2012-10-10 19:45:33 +0400 | [diff] [blame] | 17 | |
| 18 | #include <asm/setup.h> |
| 19 | #include <asm/mach/map.h> |
| 20 | #include <asm/mach/arch.h> |
| 21 | #include <asm/mach-types.h> |
| 22 | |
Alexander Shiyan | 87c37b5 | 2012-11-17 17:57:18 +0400 | [diff] [blame^] | 23 | #include <video/platform_lcd.h> |
| 24 | |
Alexander Shiyan | 2a55289 | 2012-10-10 19:45:33 +0400 | [diff] [blame] | 25 | #include <mach/hardware.h> |
| 26 | |
| 27 | #include "common.h" |
| 28 | |
Alexander Shiyan | 200daa3 | 2012-11-17 17:57:07 +0400 | [diff] [blame] | 29 | #define VIDEORAM_SIZE SZ_128K |
| 30 | |
Alexander Shiyan | 87c37b5 | 2012-11-17 17:57:18 +0400 | [diff] [blame^] | 31 | #define EDB7211_LCD_DC_DC_EN CLPS711X_GPIO(3, 1) |
| 32 | #define EDB7211_LCDEN CLPS711X_GPIO(3, 2) |
| 33 | |
Alexander Shiyan | 200daa3 | 2012-11-17 17:57:07 +0400 | [diff] [blame] | 34 | #define EDB7211_CS8900_BASE (CS2_PHYS_BASE + 0x300) |
| 35 | #define EDB7211_CS8900_IRQ (IRQ_EINT3) |
| 36 | |
| 37 | static struct resource edb7211_cs8900_resource[] __initdata = { |
| 38 | DEFINE_RES_MEM(EDB7211_CS8900_BASE, SZ_1K), |
| 39 | DEFINE_RES_IRQ(EDB7211_CS8900_IRQ), |
| 40 | }; |
Alexander Shiyan | 2a55289 | 2012-10-10 19:45:33 +0400 | [diff] [blame] | 41 | |
Alexander Shiyan | 87c37b5 | 2012-11-17 17:57:18 +0400 | [diff] [blame^] | 42 | static void edb7211_lcd_power_set(struct plat_lcd_data *pd, unsigned int power) |
| 43 | { |
| 44 | if (power) { |
| 45 | gpio_set_value(EDB7211_LCDEN, 1); |
| 46 | udelay(100); |
| 47 | gpio_set_value(EDB7211_LCD_DC_DC_EN, 1); |
| 48 | } else { |
| 49 | gpio_set_value(EDB7211_LCD_DC_DC_EN, 0); |
| 50 | udelay(100); |
| 51 | gpio_set_value(EDB7211_LCDEN, 0); |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | static struct plat_lcd_data edb7211_lcd_power_pdata = { |
| 56 | .set_power = edb7211_lcd_power_set, |
| 57 | }; |
| 58 | |
| 59 | static struct gpio edb7211_gpios[] __initconst = { |
| 60 | { EDB7211_LCD_DC_DC_EN, GPIOF_OUT_INIT_LOW, "LCD DC-DC" }, |
| 61 | { EDB7211_LCDEN, GPIOF_OUT_INIT_LOW, "LCD POWER" }, |
| 62 | }; |
| 63 | |
Alexander Shiyan | 2a55289 | 2012-10-10 19:45:33 +0400 | [diff] [blame] | 64 | static struct map_desc edb7211_io_desc[] __initdata = { |
| 65 | { /* Memory-mapped extra keyboard row */ |
| 66 | .virtual = IO_ADDRESS(EP7211_PHYS_EXTKBD), |
| 67 | .pfn = __phys_to_pfn(EP7211_PHYS_EXTKBD), |
| 68 | .length = SZ_1M, |
| 69 | .type = MT_DEVICE, |
Alexander Shiyan | 2a55289 | 2012-10-10 19:45:33 +0400 | [diff] [blame] | 70 | }, { /* Flash bank 0 */ |
| 71 | .virtual = IO_ADDRESS(EP7211_PHYS_FLASH1), |
| 72 | .pfn = __phys_to_pfn(EP7211_PHYS_FLASH1), |
| 73 | .length = SZ_8M, |
| 74 | .type = MT_DEVICE, |
| 75 | }, { /* Flash bank 1 */ |
| 76 | .virtual = IO_ADDRESS(EP7211_PHYS_FLASH2), |
| 77 | .pfn = __phys_to_pfn(EP7211_PHYS_FLASH2), |
| 78 | .length = SZ_8M, |
| 79 | .type = MT_DEVICE, |
| 80 | }, |
| 81 | }; |
| 82 | |
| 83 | void __init edb7211_map_io(void) |
| 84 | { |
| 85 | clps711x_map_io(); |
| 86 | iotable_init(edb7211_io_desc, ARRAY_SIZE(edb7211_io_desc)); |
| 87 | } |
| 88 | |
| 89 | /* Reserve screen memory region at the start of main system memory. */ |
| 90 | static void __init edb7211_reserve(void) |
| 91 | { |
| 92 | memblock_reserve(PHYS_OFFSET, VIDEORAM_SIZE); |
| 93 | } |
| 94 | |
| 95 | static void __init |
| 96 | fixup_edb7211(struct tag *tags, char **cmdline, struct meminfo *mi) |
| 97 | { |
| 98 | /* |
| 99 | * Bank start addresses are not present in the information |
| 100 | * passed in from the boot loader. We could potentially |
| 101 | * detect them, but instead we hard-code them. |
| 102 | * |
| 103 | * Banks sizes _are_ present in the param block, but we're |
| 104 | * not using that information yet. |
| 105 | */ |
| 106 | mi->bank[0].start = 0xc0000000; |
| 107 | mi->bank[0].size = SZ_8M; |
| 108 | mi->bank[1].start = 0xc1000000; |
| 109 | mi->bank[1].size = SZ_8M; |
| 110 | mi->nr_banks = 2; |
| 111 | } |
| 112 | |
Alexander Shiyan | 200daa3 | 2012-11-17 17:57:07 +0400 | [diff] [blame] | 113 | static void __init edb7211_init(void) |
| 114 | { |
Alexander Shiyan | 87c37b5 | 2012-11-17 17:57:18 +0400 | [diff] [blame^] | 115 | gpio_request_array(edb7211_gpios, ARRAY_SIZE(edb7211_gpios)); |
| 116 | |
| 117 | platform_device_register_data(&platform_bus, "platform-lcd", 0, |
| 118 | &edb7211_lcd_power_pdata, |
| 119 | sizeof(edb7211_lcd_power_pdata)); |
Alexander Shiyan | dd850f1 | 2012-11-17 17:57:09 +0400 | [diff] [blame] | 120 | platform_device_register_simple("video-clps711x", 0, NULL, 0); |
Alexander Shiyan | 200daa3 | 2012-11-17 17:57:07 +0400 | [diff] [blame] | 121 | platform_device_register_simple("cs89x0", 0, edb7211_cs8900_resource, |
| 122 | ARRAY_SIZE(edb7211_cs8900_resource)); |
| 123 | } |
| 124 | |
Alexander Shiyan | 2a55289 | 2012-10-10 19:45:33 +0400 | [diff] [blame] | 125 | MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)") |
| 126 | /* Maintainer: Jon McClintock */ |
| 127 | .atag_offset = VIDEORAM_SIZE + 0x100, |
Alexander Shiyan | 0d8be81 | 2012-11-17 17:57:13 +0400 | [diff] [blame] | 128 | .nr_irqs = CLPS711X_NR_IRQS, |
Alexander Shiyan | 2a55289 | 2012-10-10 19:45:33 +0400 | [diff] [blame] | 129 | .fixup = fixup_edb7211, |
Alexander Shiyan | 2a55289 | 2012-10-10 19:45:33 +0400 | [diff] [blame] | 130 | .reserve = edb7211_reserve, |
Alexander Shiyan | 200daa3 | 2012-11-17 17:57:07 +0400 | [diff] [blame] | 131 | .map_io = edb7211_map_io, |
Alexander Shiyan | 2a55289 | 2012-10-10 19:45:33 +0400 | [diff] [blame] | 132 | .init_irq = clps711x_init_irq, |
| 133 | .timer = &clps711x_timer, |
Alexander Shiyan | 200daa3 | 2012-11-17 17:57:07 +0400 | [diff] [blame] | 134 | .init_machine = edb7211_init, |
Alexander Shiyan | 99f04c8 | 2012-11-17 17:57:14 +0400 | [diff] [blame] | 135 | .handle_irq = clps711x_handle_irq, |
Alexander Shiyan | 2a55289 | 2012-10-10 19:45:33 +0400 | [diff] [blame] | 136 | .restart = clps711x_restart, |
| 137 | MACHINE_END |