blob: 34c8ee9ebb5e5741cf3d6a243d0996c0bd93968c [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/arch/arm/mach-clps711x/p720t.c
3 *
4 * Copyright (C) 2000-2001 Deep Blue Solutions Ltd
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070020#include <linux/kernel.h>
21#include <linux/init.h>
22#include <linux/types.h>
23#include <linux/string.h>
24#include <linux/mm.h>
Russell Kingfced80c2008-09-06 12:10:45 +010025#include <linux/io.h>
Bryan Wu8ee8ef22012-03-14 01:55:26 +080026#include <linux/slab.h>
27#include <linux/leds.h>
Alexander Shiyanb3a076d2012-11-17 17:57:08 +040028#include <linux/platform_device.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070029
Russell Kinga09e64f2008-08-05 16:14:15 +010030#include <mach/hardware.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070031#include <asm/pgtable.h>
32#include <asm/page.h>
33#include <asm/setup.h>
Deepak Saxenaf10083f2005-10-28 15:19:05 +010034#include <asm/sizes.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070035#include <asm/mach-types.h>
36#include <asm/mach/arch.h>
37#include <asm/mach/map.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010038#include <mach/syspld.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070039
Alexander Shiyan87c37b52012-11-17 17:57:18 +040040#include <video/platform_lcd.h>
41
Linus Torvalds1da177e2005-04-16 15:20:36 -070042#include "common.h"
43
Alexander Shiyanb3a076d2012-11-17 17:57:08 +040044#define GPIO_USERLED CLPS711X_GPIO(3, 0)
45
Alexander Shiyan87c37b52012-11-17 17:57:18 +040046static void p720t_lcd_power_set(struct plat_lcd_data *pd, unsigned int power)
47{
48 if (power) {
49 PLD_LCDEN = PLD_LCDEN_EN;
50 PLD_PWR |= PLD_S4_ON | PLD_S2_ON | PLD_S1_ON;
51 } else {
52 PLD_PWR &= ~(PLD_S4_ON | PLD_S2_ON | PLD_S1_ON);
53 PLD_LCDEN = 0;
54 }
55}
56
57static struct plat_lcd_data p720t_lcd_power_pdata = {
58 .set_power = p720t_lcd_power_set,
59};
60
Linus Torvalds1da177e2005-04-16 15:20:36 -070061/*
Alexander Shiyan6cb1b142012-10-10 19:45:31 +040062 * Map the P720T system PLD. It occupies two address spaces:
63 * 0x10000000 and 0x10400000. We map both regions as one.
Linus Torvalds1da177e2005-04-16 15:20:36 -070064 */
65static struct map_desc p720t_io_desc[] __initdata = {
Deepak Saxenaf10083f2005-10-28 15:19:05 +010066 {
67 .virtual = SYSPLD_VIRT_BASE,
68 .pfn = __phys_to_pfn(SYSPLD_PHYS_BASE),
Alexander Shiyan6cb1b142012-10-10 19:45:31 +040069 .length = SZ_8M,
70 .type = MT_DEVICE,
71 },
Linus Torvalds1da177e2005-04-16 15:20:36 -070072};
73
74static void __init
Russell King0744a3e2010-12-20 10:37:50 +000075fixup_p720t(struct tag *tag, char **cmdline, struct meminfo *mi)
Linus Torvalds1da177e2005-04-16 15:20:36 -070076{
77 /*
78 * Our bootloader doesn't setup any tags (yet).
79 */
80 if (tag->hdr.tag != ATAG_CORE) {
81 tag->hdr.tag = ATAG_CORE;
82 tag->hdr.size = tag_size(tag_core);
83 tag->u.core.flags = 0;
84 tag->u.core.pagesize = PAGE_SIZE;
85 tag->u.core.rootdev = 0x0100;
86
87 tag = tag_next(tag);
88 tag->hdr.tag = ATAG_MEM;
89 tag->hdr.size = tag_size(tag_mem32);
90 tag->u.mem.size = 4096;
91 tag->u.mem.start = PHYS_OFFSET;
92
93 tag = tag_next(tag);
94 tag->hdr.tag = ATAG_NONE;
95 tag->hdr.size = 0;
96 }
97}
98
99static void __init p720t_map_io(void)
100{
101 clps711x_map_io();
102 iotable_init(p720t_io_desc, ARRAY_SIZE(p720t_io_desc));
103}
104
Alexander Shiyan02d7d6d2012-07-16 22:21:45 +0400105static void __init p720t_init_early(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106{
107 /*
108 * Power down as much as possible in case we don't
109 * have the drivers loaded.
110 */
111 PLD_LCDEN = 0;
112 PLD_PWR &= ~(PLD_S4_ON|PLD_S3_ON|PLD_S2_ON|PLD_S1_ON);
113
114 PLD_KBD = 0;
115 PLD_IO = 0;
116 PLD_IRDA = 0;
117 PLD_CODEC = 0;
118 PLD_TCH = 0;
119 PLD_SPI = 0;
Alexander Shiyan02d7d6d2012-07-16 22:21:45 +0400120 if (!IS_ENABLED(CONFIG_DEBUG_LL)) {
121 PLD_COM2 = 0;
122 PLD_COM1 = 0;
123 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124}
125
Alexander Shiyanb3a076d2012-11-17 17:57:08 +0400126static struct gpio_led p720t_gpio_leds[] = {
127 {
128 .name = "User LED",
129 .default_trigger = "heartbeat",
130 .gpio = GPIO_USERLED,
131 },
132};
133
134static struct gpio_led_platform_data p720t_gpio_led_pdata __initdata = {
135 .leds = p720t_gpio_leds,
136 .num_leds = ARRAY_SIZE(p720t_gpio_leds),
137};
138
Alexander Shiyandd850f12012-11-17 17:57:09 +0400139static void __init p720t_init(void)
140{
Alexander Shiyan87c37b52012-11-17 17:57:18 +0400141 platform_device_register_data(&platform_bus, "platform-lcd", 0,
142 &p720t_lcd_power_pdata,
143 sizeof(p720t_lcd_power_pdata));
Alexander Shiyandd850f12012-11-17 17:57:09 +0400144 platform_device_register_simple("video-clps711x", 0, NULL, 0);
145}
146
Alexander Shiyanb3a076d2012-11-17 17:57:08 +0400147static void __init p720t_init_late(void)
Bryan Wu8ee8ef22012-03-14 01:55:26 +0800148{
Alexander Shiyanb3a076d2012-11-17 17:57:08 +0400149 platform_device_register_data(&platform_bus, "leds-gpio", 0,
150 &p720t_gpio_led_pdata,
151 sizeof(p720t_gpio_led_pdata));
Bryan Wu8ee8ef22012-03-14 01:55:26 +0800152}
153
Alexander Shiyan02d7d6d2012-07-16 22:21:45 +0400154MACHINE_START(P720T, "ARM-Prospector720T")
155 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
156 .atag_offset = 0x100,
Alexander Shiyan0d8be812012-11-17 17:57:13 +0400157 .nr_irqs = CLPS711X_NR_IRQS,
Alexander Shiyan02d7d6d2012-07-16 22:21:45 +0400158 .fixup = fixup_p720t,
Alexander Shiyan02d7d6d2012-07-16 22:21:45 +0400159 .map_io = p720t_map_io,
Alexander Shiyanb3a076d2012-11-17 17:57:08 +0400160 .init_early = p720t_init_early,
Alexander Shiyan02d7d6d2012-07-16 22:21:45 +0400161 .init_irq = clps711x_init_irq,
162 .timer = &clps711x_timer,
Alexander Shiyandd850f12012-11-17 17:57:09 +0400163 .init_machine = p720t_init,
Alexander Shiyanb3a076d2012-11-17 17:57:08 +0400164 .init_late = p720t_init_late,
Alexander Shiyan99f04c82012-11-17 17:57:14 +0400165 .handle_irq = clps711x_handle_irq,
Alexander Shiyan02d7d6d2012-07-16 22:21:45 +0400166 .restart = clps711x_restart,
167MACHINE_END