Blame view
arch/arm/mach-realview/core.c
12.7 KB
8ad68bbf7 [ARM] Add support... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
/* * linux/arch/arm/mach-realview/core.c * * Copyright (C) 1999 - 2003 ARM Limited * Copyright (C) 2000 Deep Blue Solutions Ltd * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ |
8ad68bbf7 [ARM] Add support... |
21 |
#include <linux/init.h> |
1be7228da [ARM] Fixup platf... |
22 |
#include <linux/platform_device.h> |
8ad68bbf7 [ARM] Add support... |
23 |
#include <linux/dma-mapping.h> |
edbaa603e driver-core: remo... |
24 |
#include <linux/device.h> |
8ad68bbf7 [ARM] Add support... |
25 |
#include <linux/interrupt.h> |
a62c80e55 [ARM] Move AMBA i... |
26 27 |
#include <linux/amba/bus.h> #include <linux/amba/clcd.h> |
fced80c73 [ARM] Convert asm... |
28 |
#include <linux/io.h> |
c5142e84f arm: convert real... |
29 |
#include <linux/smsc911x.h> |
6be62ba21 [ARM] 5396/1: Rea... |
30 |
#include <linux/ata_platform.h> |
6ef297f86 ARM: 5720/1: Move... |
31 |
#include <linux/amba/mmci.h> |
5a0e3ad6a include cleanup: ... |
32 |
#include <linux/gfp.h> |
6d803ba73 ARM: 6483/1: arm ... |
33 |
#include <linux/clkdev.h> |
b8b87aefe ARM: 6903/1: Real... |
34 |
#include <linux/mtd/physmap.h> |
8ad68bbf7 [ARM] Add support... |
35 36 |
#include <asm/system.h> |
a09e64fbc [ARM] Move includ... |
37 |
#include <mach/hardware.h> |
8ad68bbf7 [ARM] Add support... |
38 39 |
#include <asm/irq.h> #include <asm/leds.h> |
68c3d9358 RealView: Use the... |
40 |
#include <asm/mach-types.h> |
8ad68bbf7 [ARM] Add support... |
41 |
#include <asm/hardware/arm_timer.h> |
c5a0adb51 ARM: ICST: kill d... |
42 |
#include <asm/hardware/icst.h> |
8ad68bbf7 [ARM] Add support... |
43 44 |
#include <asm/mach/arch.h> |
8ad68bbf7 [ARM] Add support... |
45 |
#include <asm/mach/irq.h> |
8ad68bbf7 [ARM] Add support... |
46 |
#include <asm/mach/map.h> |
8ad68bbf7 [ARM] Add support... |
47 48 |
#include <asm/hardware/gic.h> |
ee8c95711 RealView: Move th... |
49 50 |
#include <mach/platform.h> #include <mach/irqs.h> |
8a9618f5d ARM: 6432/1: move... |
51 |
#include <asm/hardware/timer-sp.h> |
ee8c95711 RealView: Move th... |
52 |
|
3cb5ee496 ARM: realview: sw... |
53 |
#include <plat/clcd.h> |
1da0c89c6 ARM: versatile: c... |
54 |
#include <plat/sched_clock.h> |
8ad68bbf7 [ARM] Add support... |
55 |
#include "core.h" |
8ad68bbf7 [ARM] Add support... |
56 |
|
8ad68bbf7 [ARM] Add support... |
57 |
#define REALVIEW_FLASHCTRL (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_FLASH_OFFSET) |
667f390be ARM: 6910/1: MTD:... |
58 |
static void realview_flash_set_vpp(struct platform_device *pdev, int on) |
8ad68bbf7 [ARM] Add support... |
59 60 61 62 63 64 65 66 67 68 |
{ u32 val; val = __raw_readl(REALVIEW_FLASHCTRL); if (on) val |= REALVIEW_FLASHPROG_FLVPPEN; else val &= ~REALVIEW_FLASHPROG_FLVPPEN; __raw_writel(val, REALVIEW_FLASHCTRL); } |
b8b87aefe ARM: 6903/1: Real... |
69 |
static struct physmap_flash_data realview_flash_data = { |
8ad68bbf7 [ARM] Add support... |
70 |
.width = 4, |
8ad68bbf7 [ARM] Add support... |
71 72 |
.set_vpp = realview_flash_set_vpp, }; |
8ad68bbf7 [ARM] Add support... |
73 |
struct platform_device realview_flash_device = { |
b8b87aefe ARM: 6903/1: Real... |
74 |
.name = "physmap-flash", |
8ad68bbf7 [ARM] Add support... |
75 76 77 78 |
.id = 0, .dev = { .platform_data = &realview_flash_data, }, |
8ad68bbf7 [ARM] Add support... |
79 |
}; |
a44ddfd5b RealView: Move th... |
80 81 82 83 84 85 |
int realview_flash_register(struct resource *res, u32 num) { realview_flash_device.resource = res; realview_flash_device.num_resources = num; return platform_device_register(&realview_flash_device); } |
c5142e84f arm: convert real... |
86 87 88 89 90 |
static struct smsc911x_platform_config smsc911x_config = { .flags = SMSC911X_USE_32BIT, .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH, .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, .phy_interface = PHY_INTERFACE_MODE_MII, |
0a5b2f6be RealView: Allow t... |
91 |
}; |
0a3813306 RealView: Refacto... |
92 |
static struct platform_device realview_eth_device = { |
c5142e84f arm: convert real... |
93 |
.name = "smsc911x", |
0a3813306 RealView: Refacto... |
94 95 96 97 98 99 100 101 102 |
.id = 0, .num_resources = 2, }; int realview_eth_register(const char *name, struct resource *res) { if (name) realview_eth_device.name = name; realview_eth_device.resource = res; |
c5142e84f arm: convert real... |
103 104 |
if (strcmp(realview_eth_device.name, "smsc911x") == 0) realview_eth_device.dev.platform_data = &smsc911x_config; |
0a3813306 RealView: Refacto... |
105 106 |
return platform_device_register(&realview_eth_device); |
7db21712a [ARM] 5397/1: Rea... |
107 108 109 110 111 112 113 114 115 116 117 |
} struct platform_device realview_usb_device = { .name = "isp1760", .num_resources = 2, }; int realview_usb_register(struct resource *res) { realview_usb_device.resource = res; return platform_device_register(&realview_usb_device); |
0a3813306 RealView: Refacto... |
118 |
} |
6be62ba21 [ARM] 5396/1: Rea... |
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
static struct pata_platform_info pata_platform_data = { .ioport_shift = 1, }; static struct resource pata_resources[] = { [0] = { .start = REALVIEW_CF_BASE, .end = REALVIEW_CF_BASE + 0xff, .flags = IORESOURCE_MEM, }, [1] = { .start = REALVIEW_CF_BASE + 0x100, .end = REALVIEW_CF_BASE + SZ_4K - 1, .flags = IORESOURCE_MEM, }, }; struct platform_device realview_cf_device = { .name = "pata_platform", .id = -1, .num_resources = ARRAY_SIZE(pata_resources), .resource = pata_resources, .dev = { .platform_data = &pata_platform_data, }, }; |
6b65cd742 i2c: New ARM Vers... |
145 146 147 148 149 150 151 152 |
static struct resource realview_i2c_resource = { .start = REALVIEW_I2C_BASE, .end = REALVIEW_I2C_BASE + SZ_4K - 1, .flags = IORESOURCE_MEM, }; struct platform_device realview_i2c_device = { .name = "versatile-i2c", |
533ad5e60 [ARM] 5395/1: Rea... |
153 |
.id = 0, |
6b65cd742 i2c: New ARM Vers... |
154 155 156 |
.num_resources = 1, .resource = &realview_i2c_resource, }; |
533ad5e60 [ARM] 5395/1: Rea... |
157 158 |
static struct i2c_board_info realview_i2c_board_info[] = { { |
64e8be6eb ARM: Realview & V... |
159 |
I2C_BOARD_INFO("ds1338", 0xd0 >> 1), |
533ad5e60 [ARM] 5395/1: Rea... |
160 161 162 163 164 165 166 167 168 |
}, }; static int __init realview_i2c_init(void) { return i2c_register_board_info(0, realview_i2c_board_info, ARRAY_SIZE(realview_i2c_board_info)); } arch_initcall(realview_i2c_init); |
8ad68bbf7 [ARM] Add support... |
169 |
#define REALVIEW_SYSMCI (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_MCI_OFFSET) |
98b0979f0 MMC: MMCI: conver... |
170 171 172 |
/* * This is only used if GPIOLIB support is disabled */ |
8ad68bbf7 [ARM] Add support... |
173 174 175 176 |
static unsigned int realview_mmc_status(struct device *dev) { struct amba_device *adev = container_of(dev, struct amba_device, dev); u32 mask; |
48f1d5a3c ARM: 6204/1: Fixu... |
177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
if (machine_is_realview_pb1176()) { static bool inserted = false; /* * The PB1176 does not have the status register, * assume it is inserted at startup, then invert * for each call so card insertion/removal will * be detected anyway. This will not be called if * GPIO on PL061 is active, which is the proper * way to do this on the PB1176. */ inserted = !inserted; return inserted ? 0 : 1; } |
8ad68bbf7 [ARM] Add support... |
191 192 193 194 |
if (adev->res.start == REALVIEW_MMCI0_BASE) mask = 1; else mask = 2; |
74bc80931 ARM: Fix Versatil... |
195 |
return readl(REALVIEW_SYSMCI) & mask; |
8ad68bbf7 [ARM] Add support... |
196 |
} |
6ef297f86 ARM: 5720/1: Move... |
197 |
struct mmci_platform_data realview_mmc0_plat_data = { |
8ad68bbf7 [ARM] Add support... |
198 199 |
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, .status = realview_mmc_status, |
98b0979f0 MMC: MMCI: conver... |
200 201 |
.gpio_wp = 17, .gpio_cd = 16, |
297194458 ARM: 6307/1: mmci... |
202 |
.cd_invert = true, |
8ad68bbf7 [ARM] Add support... |
203 |
}; |
6ef297f86 ARM: 5720/1: Move... |
204 |
struct mmci_platform_data realview_mmc1_plat_data = { |
8ad68bbf7 [ARM] Add support... |
205 206 |
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, .status = realview_mmc_status, |
98b0979f0 MMC: MMCI: conver... |
207 208 |
.gpio_wp = 19, .gpio_cd = 18, |
297194458 ARM: 6307/1: mmci... |
209 |
.cd_invert = true, |
8ad68bbf7 [ARM] Add support... |
210 211 212 213 214 |
}; /* * Clock handling */ |
39c0cb02d ARM: ICST: merge ... |
215 |
static const struct icst_params realview_oscvco_params = { |
64fceb1dc ARM: ICST: use Hz... |
216 |
.ref = 24000000, |
4de2edbd1 ARM: ICST: provid... |
217 |
.vco_max = ICST307_VCO_MAX, |
e73a46a3d ARM: ICST: move m... |
218 |
.vco_min = ICST307_VCO_MIN, |
8ad68bbf7 [ARM] Add support... |
219 220 221 222 |
.vd_min = 4 + 8, .vd_max = 511 + 8, .rd_min = 1 + 2, .rd_max = 127 + 2, |
232eaf7f2 ARM: ICST: indire... |
223 224 |
.s2div = icst307_s2div, .idx2s = icst307_idx2s, |
8ad68bbf7 [ARM] Add support... |
225 |
}; |
39c0cb02d ARM: ICST: merge ... |
226 |
static void realview_oscvco_set(struct clk *clk, struct icst_vco vco) |
8ad68bbf7 [ARM] Add support... |
227 228 |
{ void __iomem *sys_lock = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_LOCK_OFFSET; |
8ad68bbf7 [ARM] Add support... |
229 |
u32 val; |
d1914c7e7 ARM: Make Integra... |
230 |
val = readl(clk->vcoreg) & ~0x7ffff; |
8ad68bbf7 [ARM] Add support... |
231 232 233 |
val |= vco.v | (vco.r << 9) | (vco.s << 16); writel(0xa05f, sys_lock); |
d1914c7e7 ARM: Make Integra... |
234 |
writel(val, clk->vcoreg); |
8ad68bbf7 [ARM] Add support... |
235 236 |
writel(0, sys_lock); } |
9bf5b2ef6 ARM: Indirect rou... |
237 238 239 240 241 |
static const struct clk_ops oscvco_clk_ops = { .round = icst_clk_round, .set = icst_clk_set, .setvco = realview_oscvco_set, }; |
cf30fb4a4 [ARM] realview: c... |
242 |
static struct clk oscvco_clk = { |
9bf5b2ef6 ARM: Indirect rou... |
243 |
.ops = &oscvco_clk_ops, |
8ad68bbf7 [ARM] Add support... |
244 |
.params = &realview_oscvco_params, |
8ad68bbf7 [ARM] Add support... |
245 246 247 |
}; /* |
cf30fb4a4 [ARM] realview: c... |
248 249 250 251 252 |
* These are fixed clocks. */ static struct clk ref24_clk = { .rate = 24000000, }; |
7ff550de9 clocksource: ARM ... |
253 254 255 |
static struct clk sp804_clk = { .rate = 1000000, }; |
3126c7bc4 ARM: AMBA: Add pc... |
256 |
static struct clk dummy_apb_pclk; |
cf30fb4a4 [ARM] realview: c... |
257 |
static struct clk_lookup lookups[] = { |
3126c7bc4 ARM: AMBA: Add pc... |
258 259 260 261 |
{ /* Bus clock */ .con_id = "apb_pclk", .clk = &dummy_apb_pclk, }, { /* UART0 */ |
4321532ce ARM: 5718/1: Sane... |
262 |
.dev_id = "dev:uart0", |
cf30fb4a4 [ARM] realview: c... |
263 264 |
.clk = &ref24_clk, }, { /* UART1 */ |
4321532ce ARM: 5718/1: Sane... |
265 |
.dev_id = "dev:uart1", |
cf30fb4a4 [ARM] realview: c... |
266 267 |
.clk = &ref24_clk, }, { /* UART2 */ |
4321532ce ARM: 5718/1: Sane... |
268 |
.dev_id = "dev:uart2", |
cf30fb4a4 [ARM] realview: c... |
269 270 |
.clk = &ref24_clk, }, { /* UART3 */ |
4321532ce ARM: 5718/1: Sane... |
271 |
.dev_id = "fpga:uart3", |
cf30fb4a4 [ARM] realview: c... |
272 |
.clk = &ref24_clk, |
48f1d5a3c ARM: 6204/1: Fixu... |
273 274 275 276 277 278 |
}, { /* UART3 is on the dev chip in PB1176 */ .dev_id = "dev:uart3", .clk = &ref24_clk, }, { /* UART4 only exists in PB1176 */ .dev_id = "fpga:uart4", .clk = &ref24_clk, |
cf30fb4a4 [ARM] realview: c... |
279 |
}, { /* KMI0 */ |
4321532ce ARM: 5718/1: Sane... |
280 |
.dev_id = "fpga:kmi0", |
cf30fb4a4 [ARM] realview: c... |
281 282 |
.clk = &ref24_clk, }, { /* KMI1 */ |
4321532ce ARM: 5718/1: Sane... |
283 |
.dev_id = "fpga:kmi1", |
cf30fb4a4 [ARM] realview: c... |
284 285 |
.clk = &ref24_clk, }, { /* MMC0 */ |
4321532ce ARM: 5718/1: Sane... |
286 |
.dev_id = "fpga:mmc0", |
cf30fb4a4 [ARM] realview: c... |
287 |
.clk = &ref24_clk, |
48f1d5a3c ARM: 6204/1: Fixu... |
288 |
}, { /* CLCD is in the PB1176 and EB DevChip */ |
4321532ce ARM: 5718/1: Sane... |
289 |
.dev_id = "dev:clcd", |
cf30fb4a4 [ARM] realview: c... |
290 291 |
.clk = &oscvco_clk, }, { /* PB:CLCD */ |
4321532ce ARM: 5718/1: Sane... |
292 |
.dev_id = "issp:clcd", |
cf30fb4a4 [ARM] realview: c... |
293 |
.clk = &oscvco_clk, |
d6ada8609 ARM: 6227/1: PL02... |
294 295 296 |
}, { /* SSP */ .dev_id = "dev:ssp0", .clk = &ref24_clk, |
7ff550de9 clocksource: ARM ... |
297 298 299 300 |
}, { /* SP804 timers */ .dev_id = "sp804", .clk = &sp804_clk, }, |
cf30fb4a4 [ARM] realview: c... |
301 |
}; |
631e55f96 ARM: realview: us... |
302 |
void __init realview_init_early(void) |
cf30fb4a4 [ARM] realview: c... |
303 |
{ |
631e55f96 ARM: realview: us... |
304 |
void __iomem *sys = __io_address(REALVIEW_SYS_BASE); |
d1914c7e7 ARM: Make Integra... |
305 |
if (machine_is_realview_pb1176()) |
631e55f96 ARM: realview: us... |
306 |
oscvco_clk.vcoreg = sys + REALVIEW_SYS_OSC0_OFFSET; |
d1914c7e7 ARM: Make Integra... |
307 |
else |
631e55f96 ARM: realview: us... |
308 |
oscvco_clk.vcoreg = sys + REALVIEW_SYS_OSC4_OFFSET; |
d1914c7e7 ARM: Make Integra... |
309 |
|
0a0300dc8 ARM: Consolidate ... |
310 |
clkdev_add_table(lookups, ARRAY_SIZE(lookups)); |
d1914c7e7 ARM: Make Integra... |
311 |
|
631e55f96 ARM: realview: us... |
312 |
versatile_sched_clock_init(sys + REALVIEW_SYS_24MHz_OFFSET, 24000000); |
cf30fb4a4 [ARM] realview: c... |
313 |
} |
cf30fb4a4 [ARM] realview: c... |
314 315 |
/* |
8ad68bbf7 [ARM] Add support... |
316 317 |
* CLCD support. */ |
8ad68bbf7 [ARM] Add support... |
318 319 320 321 322 323 324 325 326 |
#define SYS_CLCD_NLCDIOON (1 << 2) #define SYS_CLCD_VDDPOSSWITCH (1 << 3) #define SYS_CLCD_PWR3V5SWITCH (1 << 4) #define SYS_CLCD_ID_MASK (0x1f << 8) #define SYS_CLCD_ID_SANYO_3_8 (0x00 << 8) #define SYS_CLCD_ID_UNKNOWN_8_4 (0x01 << 8) #define SYS_CLCD_ID_EPSON_2_2 (0x02 << 8) #define SYS_CLCD_ID_SANYO_2_5 (0x07 << 8) #define SYS_CLCD_ID_VGA (0x1f << 8) |
8ad68bbf7 [ARM] Add support... |
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 |
/* * Disable all display connectors on the interface module. */ static void realview_clcd_disable(struct clcd_fb *fb) { void __iomem *sys_clcd = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_CLCD_OFFSET; u32 val; val = readl(sys_clcd); val &= ~SYS_CLCD_NLCDIOON | SYS_CLCD_PWR3V5SWITCH; writel(val, sys_clcd); } /* * Enable the relevant connector on the interface module. */ static void realview_clcd_enable(struct clcd_fb *fb) { void __iomem *sys_clcd = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_CLCD_OFFSET; u32 val; |
8ad68bbf7 [ARM] Add support... |
347 |
/* |
9e7714d08 [ARM] 3367/1: CLC... |
348 |
* Enable the PSUs |
8ad68bbf7 [ARM] Add support... |
349 |
*/ |
9e7714d08 [ARM] 3367/1: CLC... |
350 |
val = readl(sys_clcd); |
8ad68bbf7 [ARM] Add support... |
351 352 353 |
val |= SYS_CLCD_NLCDIOON | SYS_CLCD_PWR3V5SWITCH; writel(val, sys_clcd); } |
3cb5ee496 ARM: realview: sw... |
354 355 356 357 358 359 |
/* * Detect which LCD panel is connected, and return the appropriate * clcd_panel structure. Note: we do not have any information on * the required timings for the 8.4in panel, so we presently assume * VGA timings. */ |
8ad68bbf7 [ARM] Add support... |
360 361 |
static int realview_clcd_setup(struct clcd_fb *fb) { |
3cb5ee496 ARM: realview: sw... |
362 363 |
void __iomem *sys_clcd = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_CLCD_OFFSET; const char *panel_name, *vga_panel_name; |
c34a10255 RealView: Allow X... |
364 |
unsigned long framesize; |
3cb5ee496 ARM: realview: sw... |
365 |
u32 val; |
8ad68bbf7 [ARM] Add support... |
366 |
|
3cb5ee496 ARM: realview: sw... |
367 |
if (machine_is_realview_eb()) { |
c34a10255 RealView: Allow X... |
368 369 |
/* VGA, 16bpp */ framesize = 640 * 480 * 2; |
3cb5ee496 ARM: realview: sw... |
370 371 |
vga_panel_name = "VGA"; } else { |
c34a10255 RealView: Allow X... |
372 373 |
/* XVGA, 16bpp */ framesize = 1024 * 768 * 2; |
3cb5ee496 ARM: realview: sw... |
374 |
vga_panel_name = "XVGA"; |
8ad68bbf7 [ARM] Add support... |
375 |
} |
3cb5ee496 ARM: realview: sw... |
376 377 378 379 380 381 382 383 384 385 386 387 388 389 |
val = readl(sys_clcd) & SYS_CLCD_ID_MASK; if (val == SYS_CLCD_ID_SANYO_3_8) panel_name = "Sanyo TM38QV67A02A"; else if (val == SYS_CLCD_ID_SANYO_2_5) panel_name = "Sanyo QVGA Portrait"; else if (val == SYS_CLCD_ID_EPSON_2_2) panel_name = "Epson L2F50113T00"; else if (val == SYS_CLCD_ID_VGA) panel_name = vga_panel_name; else { pr_err("CLCD: unknown LCD panel ID 0x%08x, using VGA ", val); panel_name = vga_panel_name; } |
8ad68bbf7 [ARM] Add support... |
390 |
|
3cb5ee496 ARM: realview: sw... |
391 392 393 |
fb->panel = versatile_clcd_get_panel(panel_name); if (!fb->panel) return -EINVAL; |
8ad68bbf7 [ARM] Add support... |
394 |
|
3cb5ee496 ARM: realview: sw... |
395 |
return versatile_clcd_setup_dma(fb, framesize); |
8ad68bbf7 [ARM] Add support... |
396 397 398 399 |
} struct clcd_board clcd_plat_data = { .name = "RealView", |
3cb5ee496 ARM: realview: sw... |
400 |
.caps = CLCD_CAP_ALL, |
8ad68bbf7 [ARM] Add support... |
401 402 403 404 405 |
.check = clcdfb_check, .decode = clcdfb_decode, .disable = realview_clcd_disable, .enable = realview_clcd_enable, .setup = realview_clcd_setup, |
3cb5ee496 ARM: realview: sw... |
406 407 |
.mmap = versatile_clcd_mmap_dma, .remove = versatile_clcd_remove_dma, |
8ad68bbf7 [ARM] Add support... |
408 409 410 411 412 413 414 415 416 |
}; #ifdef CONFIG_LEDS #define VA_LEDS_BASE (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_LED_OFFSET) void realview_leds_event(led_event_t ledevt) { unsigned long flags; u32 val; |
da055eb52 RealView: Toggle ... |
417 |
u32 led = 1 << smp_processor_id(); |
8ad68bbf7 [ARM] Add support... |
418 419 420 421 422 423 |
local_irq_save(flags); val = readl(VA_LEDS_BASE); switch (ledevt) { case led_idle_start: |
da055eb52 RealView: Toggle ... |
424 |
val = val & ~led; |
8ad68bbf7 [ARM] Add support... |
425 426 427 |
break; case led_idle_end: |
da055eb52 RealView: Toggle ... |
428 |
val = val | led; |
8ad68bbf7 [ARM] Add support... |
429 430 431 |
break; case led_timer: |
da055eb52 RealView: Toggle ... |
432 |
val = val ^ REALVIEW_SYS_LED7; |
8ad68bbf7 [ARM] Add support... |
433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 |
break; case led_halted: val = 0; break; default: break; } writel(val, VA_LEDS_BASE); local_irq_restore(flags); } #endif /* CONFIG_LEDS */ /* * Where is the timer (VA)? */ |
80192735e RealView: Move th... |
451 452 453 454 |
void __iomem *timer0_va_base; void __iomem *timer1_va_base; void __iomem *timer2_va_base; void __iomem *timer3_va_base; |
8ad68bbf7 [ARM] Add support... |
455 456 |
/* |
a8655e83f [ARM] 4814/1: Rea... |
457 |
* Set up the clock source and clock events devices |
8ad68bbf7 [ARM] Add support... |
458 |
*/ |
8cc4c5488 [ARM] 4820/1: Rea... |
459 |
void __init realview_timer_init(unsigned int timer_irq) |
8ad68bbf7 [ARM] Add support... |
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 |
{ u32 val; /* * set clock frequency: * REALVIEW_REFCLK is 32KHz * REALVIEW_TIMCLK is 1MHz */ val = readl(__io_address(REALVIEW_SCTL_BASE)); writel((REALVIEW_TIMCLK << REALVIEW_TIMER1_EnSel) | (REALVIEW_TIMCLK << REALVIEW_TIMER2_EnSel) | (REALVIEW_TIMCLK << REALVIEW_TIMER3_EnSel) | (REALVIEW_TIMCLK << REALVIEW_TIMER4_EnSel) | val, __io_address(REALVIEW_SCTL_BASE)); /* * Initialise to a known state (all timers off) */ |
80192735e RealView: Move th... |
478 479 480 481 |
writel(0, timer0_va_base + TIMER_CTRL); writel(0, timer1_va_base + TIMER_CTRL); writel(0, timer2_va_base + TIMER_CTRL); writel(0, timer3_va_base + TIMER_CTRL); |
8ad68bbf7 [ARM] Add support... |
482 |
|
fb593cf38 clocksource: ARM ... |
483 |
sp804_clocksource_init(timer3_va_base, "timer3"); |
57cc4f7de clockevents: ARM ... |
484 |
sp804_clockevents_init(timer0_va_base, timer_irq, "timer0"); |
8ad68bbf7 [ARM] Add support... |
485 |
} |
5b39d1548 RealView: Add def... |
486 487 488 489 |
/* * Setup the memory banks. */ |
0744a3ee3 ARM: platform fix... |
490 |
void realview_fixup(struct tag *tags, char **from, struct meminfo *meminfo) |
5b39d1548 RealView: Add def... |
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 |
{ /* * Most RealView platforms have 512MB contiguous RAM at 0x70000000. * Half of this is mirrored at 0. */ #ifdef CONFIG_REALVIEW_HIGH_PHYS_OFFSET meminfo->bank[0].start = 0x70000000; meminfo->bank[0].size = SZ_512M; meminfo->nr_banks = 1; #else meminfo->bank[0].start = 0; meminfo->bank[0].size = SZ_256M; meminfo->nr_banks = 1; #endif } |