Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | #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 King | fced80c | 2008-09-06 12:10:45 +0100 | [diff] [blame] | 25 | #include <linux/io.h> |
Bryan Wu | 8ee8ef2 | 2012-03-14 01:55:26 +0800 | [diff] [blame] | 26 | #include <linux/slab.h> |
| 27 | #include <linux/leds.h> |
Alexander Shiyan | b3a076d | 2012-11-17 17:57:08 +0400 | [diff] [blame] | 28 | #include <linux/platform_device.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 30 | #include <mach/hardware.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | #include <asm/pgtable.h> |
| 32 | #include <asm/page.h> |
| 33 | #include <asm/setup.h> |
Deepak Saxena | f10083f | 2005-10-28 15:19:05 +0100 | [diff] [blame] | 34 | #include <asm/sizes.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | #include <asm/mach-types.h> |
| 36 | #include <asm/mach/arch.h> |
| 37 | #include <asm/mach/map.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 38 | #include <mach/syspld.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
| 40 | #include "common.h" |
| 41 | |
Alexander Shiyan | b3a076d | 2012-11-17 17:57:08 +0400 | [diff] [blame] | 42 | #define GPIO_USERLED CLPS711X_GPIO(3, 0) |
| 43 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | /* |
Alexander Shiyan | 6cb1b14 | 2012-10-10 19:45:31 +0400 | [diff] [blame] | 45 | * Map the P720T system PLD. It occupies two address spaces: |
| 46 | * 0x10000000 and 0x10400000. We map both regions as one. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | */ |
| 48 | static struct map_desc p720t_io_desc[] __initdata = { |
Deepak Saxena | f10083f | 2005-10-28 15:19:05 +0100 | [diff] [blame] | 49 | { |
| 50 | .virtual = SYSPLD_VIRT_BASE, |
| 51 | .pfn = __phys_to_pfn(SYSPLD_PHYS_BASE), |
Alexander Shiyan | 6cb1b14 | 2012-10-10 19:45:31 +0400 | [diff] [blame] | 52 | .length = SZ_8M, |
| 53 | .type = MT_DEVICE, |
| 54 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | }; |
| 56 | |
| 57 | static void __init |
Russell King | 0744a3e | 2010-12-20 10:37:50 +0000 | [diff] [blame] | 58 | fixup_p720t(struct tag *tag, char **cmdline, struct meminfo *mi) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | { |
| 60 | /* |
| 61 | * Our bootloader doesn't setup any tags (yet). |
| 62 | */ |
| 63 | if (tag->hdr.tag != ATAG_CORE) { |
| 64 | tag->hdr.tag = ATAG_CORE; |
| 65 | tag->hdr.size = tag_size(tag_core); |
| 66 | tag->u.core.flags = 0; |
| 67 | tag->u.core.pagesize = PAGE_SIZE; |
| 68 | tag->u.core.rootdev = 0x0100; |
| 69 | |
| 70 | tag = tag_next(tag); |
| 71 | tag->hdr.tag = ATAG_MEM; |
| 72 | tag->hdr.size = tag_size(tag_mem32); |
| 73 | tag->u.mem.size = 4096; |
| 74 | tag->u.mem.start = PHYS_OFFSET; |
| 75 | |
| 76 | tag = tag_next(tag); |
| 77 | tag->hdr.tag = ATAG_NONE; |
| 78 | tag->hdr.size = 0; |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | static void __init p720t_map_io(void) |
| 83 | { |
| 84 | clps711x_map_io(); |
| 85 | iotable_init(p720t_io_desc, ARRAY_SIZE(p720t_io_desc)); |
| 86 | } |
| 87 | |
Alexander Shiyan | 02d7d6d | 2012-07-16 22:21:45 +0400 | [diff] [blame] | 88 | static void __init p720t_init_early(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | { |
| 90 | /* |
| 91 | * Power down as much as possible in case we don't |
| 92 | * have the drivers loaded. |
| 93 | */ |
| 94 | PLD_LCDEN = 0; |
| 95 | PLD_PWR &= ~(PLD_S4_ON|PLD_S3_ON|PLD_S2_ON|PLD_S1_ON); |
| 96 | |
| 97 | PLD_KBD = 0; |
| 98 | PLD_IO = 0; |
| 99 | PLD_IRDA = 0; |
| 100 | PLD_CODEC = 0; |
| 101 | PLD_TCH = 0; |
| 102 | PLD_SPI = 0; |
Alexander Shiyan | 02d7d6d | 2012-07-16 22:21:45 +0400 | [diff] [blame] | 103 | if (!IS_ENABLED(CONFIG_DEBUG_LL)) { |
| 104 | PLD_COM2 = 0; |
| 105 | PLD_COM1 = 0; |
| 106 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 107 | } |
| 108 | |
Alexander Shiyan | b3a076d | 2012-11-17 17:57:08 +0400 | [diff] [blame] | 109 | static struct gpio_led p720t_gpio_leds[] = { |
| 110 | { |
| 111 | .name = "User LED", |
| 112 | .default_trigger = "heartbeat", |
| 113 | .gpio = GPIO_USERLED, |
| 114 | }, |
| 115 | }; |
| 116 | |
| 117 | static struct gpio_led_platform_data p720t_gpio_led_pdata __initdata = { |
| 118 | .leds = p720t_gpio_leds, |
| 119 | .num_leds = ARRAY_SIZE(p720t_gpio_leds), |
| 120 | }; |
| 121 | |
Alexander Shiyan | dd850f1 | 2012-11-17 17:57:09 +0400 | [diff] [blame] | 122 | static void __init p720t_init(void) |
| 123 | { |
| 124 | platform_device_register_simple("video-clps711x", 0, NULL, 0); |
| 125 | } |
| 126 | |
Alexander Shiyan | b3a076d | 2012-11-17 17:57:08 +0400 | [diff] [blame] | 127 | static void __init p720t_init_late(void) |
Bryan Wu | 8ee8ef2 | 2012-03-14 01:55:26 +0800 | [diff] [blame] | 128 | { |
Alexander Shiyan | b3a076d | 2012-11-17 17:57:08 +0400 | [diff] [blame] | 129 | platform_device_register_data(&platform_bus, "leds-gpio", 0, |
| 130 | &p720t_gpio_led_pdata, |
| 131 | sizeof(p720t_gpio_led_pdata)); |
Bryan Wu | 8ee8ef2 | 2012-03-14 01:55:26 +0800 | [diff] [blame] | 132 | } |
| 133 | |
Alexander Shiyan | 02d7d6d | 2012-07-16 22:21:45 +0400 | [diff] [blame] | 134 | MACHINE_START(P720T, "ARM-Prospector720T") |
| 135 | /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ |
| 136 | .atag_offset = 0x100, |
Alexander Shiyan | 0d8be81 | 2012-11-17 17:57:13 +0400 | [diff] [blame] | 137 | .nr_irqs = CLPS711X_NR_IRQS, |
Alexander Shiyan | 02d7d6d | 2012-07-16 22:21:45 +0400 | [diff] [blame] | 138 | .fixup = fixup_p720t, |
Alexander Shiyan | 02d7d6d | 2012-07-16 22:21:45 +0400 | [diff] [blame] | 139 | .map_io = p720t_map_io, |
Alexander Shiyan | b3a076d | 2012-11-17 17:57:08 +0400 | [diff] [blame] | 140 | .init_early = p720t_init_early, |
Alexander Shiyan | 02d7d6d | 2012-07-16 22:21:45 +0400 | [diff] [blame] | 141 | .init_irq = clps711x_init_irq, |
| 142 | .timer = &clps711x_timer, |
Alexander Shiyan | dd850f1 | 2012-11-17 17:57:09 +0400 | [diff] [blame] | 143 | .init_machine = p720t_init, |
Alexander Shiyan | b3a076d | 2012-11-17 17:57:08 +0400 | [diff] [blame] | 144 | .init_late = p720t_init_late, |
Alexander Shiyan | 99f04c8 | 2012-11-17 17:57:14 +0400 | [diff] [blame^] | 145 | .handle_irq = clps711x_handle_irq, |
Alexander Shiyan | 02d7d6d | 2012-07-16 22:21:45 +0400 | [diff] [blame] | 146 | .restart = clps711x_restart, |
| 147 | MACHINE_END |