core.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  1. /*
  2. * linux/arch/arm/mach-realview/core.c
  3. *
  4. * Copyright (C) 1999 - 2003 ARM Limited
  5. * Copyright (C) 2000 Deep Blue Solutions Ltd
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. */
  21. #include <linux/init.h>
  22. #include <linux/platform_device.h>
  23. #include <linux/dma-mapping.h>
  24. #include <linux/sysdev.h>
  25. #include <linux/interrupt.h>
  26. #include <linux/amba/bus.h>
  27. #include <linux/amba/clcd.h>
  28. #include <linux/io.h>
  29. #include <linux/smsc911x.h>
  30. #include <linux/ata_platform.h>
  31. #include <linux/amba/mmci.h>
  32. #include <asm/clkdev.h>
  33. #include <asm/system.h>
  34. #include <mach/hardware.h>
  35. #include <asm/irq.h>
  36. #include <asm/leds.h>
  37. #include <asm/mach-types.h>
  38. #include <asm/hardware/arm_timer.h>
  39. #include <asm/hardware/icst.h>
  40. #include <asm/mach/arch.h>
  41. #include <asm/mach/flash.h>
  42. #include <asm/mach/irq.h>
  43. #include <asm/mach/map.h>
  44. #include <asm/hardware/gic.h>
  45. #include <mach/clkdev.h>
  46. #include <mach/platform.h>
  47. #include <mach/irqs.h>
  48. #include <plat/timer-sp.h>
  49. #include "core.h"
  50. /* used by entry-macro.S and platsmp.c */
  51. void __iomem *gic_cpu_base_addr;
  52. #ifdef CONFIG_ZONE_DMA
  53. /*
  54. * Adjust the zones if there are restrictions for DMA access.
  55. */
  56. void __init realview_adjust_zones(int node, unsigned long *size,
  57. unsigned long *hole)
  58. {
  59. unsigned long dma_size = SZ_256M >> PAGE_SHIFT;
  60. if (!machine_is_realview_pbx() || node || (size[0] <= dma_size))
  61. return;
  62. size[ZONE_NORMAL] = size[0] - dma_size;
  63. size[ZONE_DMA] = dma_size;
  64. hole[ZONE_NORMAL] = hole[0];
  65. hole[ZONE_DMA] = 0;
  66. }
  67. #endif
  68. #define REALVIEW_FLASHCTRL (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_FLASH_OFFSET)
  69. static int realview_flash_init(void)
  70. {
  71. u32 val;
  72. val = __raw_readl(REALVIEW_FLASHCTRL);
  73. val &= ~REALVIEW_FLASHPROG_FLVPPEN;
  74. __raw_writel(val, REALVIEW_FLASHCTRL);
  75. return 0;
  76. }
  77. static void realview_flash_exit(void)
  78. {
  79. u32 val;
  80. val = __raw_readl(REALVIEW_FLASHCTRL);
  81. val &= ~REALVIEW_FLASHPROG_FLVPPEN;
  82. __raw_writel(val, REALVIEW_FLASHCTRL);
  83. }
  84. static void realview_flash_set_vpp(int on)
  85. {
  86. u32 val;
  87. val = __raw_readl(REALVIEW_FLASHCTRL);
  88. if (on)
  89. val |= REALVIEW_FLASHPROG_FLVPPEN;
  90. else
  91. val &= ~REALVIEW_FLASHPROG_FLVPPEN;
  92. __raw_writel(val, REALVIEW_FLASHCTRL);
  93. }
  94. static struct flash_platform_data realview_flash_data = {
  95. .map_name = "cfi_probe",
  96. .width = 4,
  97. .init = realview_flash_init,
  98. .exit = realview_flash_exit,
  99. .set_vpp = realview_flash_set_vpp,
  100. };
  101. struct platform_device realview_flash_device = {
  102. .name = "armflash",
  103. .id = 0,
  104. .dev = {
  105. .platform_data = &realview_flash_data,
  106. },
  107. };
  108. int realview_flash_register(struct resource *res, u32 num)
  109. {
  110. realview_flash_device.resource = res;
  111. realview_flash_device.num_resources = num;
  112. return platform_device_register(&realview_flash_device);
  113. }
  114. static struct smsc911x_platform_config smsc911x_config = {
  115. .flags = SMSC911X_USE_32BIT,
  116. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
  117. .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
  118. .phy_interface = PHY_INTERFACE_MODE_MII,
  119. };
  120. static struct platform_device realview_eth_device = {
  121. .name = "smsc911x",
  122. .id = 0,
  123. .num_resources = 2,
  124. };
  125. int realview_eth_register(const char *name, struct resource *res)
  126. {
  127. if (name)
  128. realview_eth_device.name = name;
  129. realview_eth_device.resource = res;
  130. if (strcmp(realview_eth_device.name, "smsc911x") == 0)
  131. realview_eth_device.dev.platform_data = &smsc911x_config;
  132. return platform_device_register(&realview_eth_device);
  133. }
  134. struct platform_device realview_usb_device = {
  135. .name = "isp1760",
  136. .num_resources = 2,
  137. };
  138. int realview_usb_register(struct resource *res)
  139. {
  140. realview_usb_device.resource = res;
  141. return platform_device_register(&realview_usb_device);
  142. }
  143. static struct pata_platform_info pata_platform_data = {
  144. .ioport_shift = 1,
  145. };
  146. static struct resource pata_resources[] = {
  147. [0] = {
  148. .start = REALVIEW_CF_BASE,
  149. .end = REALVIEW_CF_BASE + 0xff,
  150. .flags = IORESOURCE_MEM,
  151. },
  152. [1] = {
  153. .start = REALVIEW_CF_BASE + 0x100,
  154. .end = REALVIEW_CF_BASE + SZ_4K - 1,
  155. .flags = IORESOURCE_MEM,
  156. },
  157. };
  158. struct platform_device realview_cf_device = {
  159. .name = "pata_platform",
  160. .id = -1,
  161. .num_resources = ARRAY_SIZE(pata_resources),
  162. .resource = pata_resources,
  163. .dev = {
  164. .platform_data = &pata_platform_data,
  165. },
  166. };
  167. static struct resource realview_i2c_resource = {
  168. .start = REALVIEW_I2C_BASE,
  169. .end = REALVIEW_I2C_BASE + SZ_4K - 1,
  170. .flags = IORESOURCE_MEM,
  171. };
  172. struct platform_device realview_i2c_device = {
  173. .name = "versatile-i2c",
  174. .id = 0,
  175. .num_resources = 1,
  176. .resource = &realview_i2c_resource,
  177. };
  178. static struct i2c_board_info realview_i2c_board_info[] = {
  179. {
  180. I2C_BOARD_INFO("ds1338", 0xd0 >> 1),
  181. },
  182. };
  183. static int __init realview_i2c_init(void)
  184. {
  185. return i2c_register_board_info(0, realview_i2c_board_info,
  186. ARRAY_SIZE(realview_i2c_board_info));
  187. }
  188. arch_initcall(realview_i2c_init);
  189. #define REALVIEW_SYSMCI (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_MCI_OFFSET)
  190. /*
  191. * This is only used if GPIOLIB support is disabled
  192. */
  193. static unsigned int realview_mmc_status(struct device *dev)
  194. {
  195. struct amba_device *adev = container_of(dev, struct amba_device, dev);
  196. u32 mask;
  197. if (adev->res.start == REALVIEW_MMCI0_BASE)
  198. mask = 1;
  199. else
  200. mask = 2;
  201. return readl(REALVIEW_SYSMCI) & mask;
  202. }
  203. struct mmci_platform_data realview_mmc0_plat_data = {
  204. .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
  205. .status = realview_mmc_status,
  206. .gpio_wp = 17,
  207. .gpio_cd = 16,
  208. };
  209. struct mmci_platform_data realview_mmc1_plat_data = {
  210. .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
  211. .status = realview_mmc_status,
  212. .gpio_wp = 19,
  213. .gpio_cd = 18,
  214. };
  215. /*
  216. * Clock handling
  217. */
  218. static const struct icst_params realview_oscvco_params = {
  219. .ref = 24000000,
  220. .vco_max = ICST307_VCO_MAX,
  221. .vco_min = ICST307_VCO_MIN,
  222. .vd_min = 4 + 8,
  223. .vd_max = 511 + 8,
  224. .rd_min = 1 + 2,
  225. .rd_max = 127 + 2,
  226. .s2div = icst307_s2div,
  227. .idx2s = icst307_idx2s,
  228. };
  229. static void realview_oscvco_set(struct clk *clk, struct icst_vco vco)
  230. {
  231. void __iomem *sys_lock = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_LOCK_OFFSET;
  232. u32 val;
  233. val = readl(clk->vcoreg) & ~0x7ffff;
  234. val |= vco.v | (vco.r << 9) | (vco.s << 16);
  235. writel(0xa05f, sys_lock);
  236. writel(val, clk->vcoreg);
  237. writel(0, sys_lock);
  238. }
  239. static const struct clk_ops oscvco_clk_ops = {
  240. .round = icst_clk_round,
  241. .set = icst_clk_set,
  242. .setvco = realview_oscvco_set,
  243. };
  244. static struct clk oscvco_clk = {
  245. .ops = &oscvco_clk_ops,
  246. .params = &realview_oscvco_params,
  247. };
  248. /*
  249. * These are fixed clocks.
  250. */
  251. static struct clk ref24_clk = {
  252. .rate = 24000000,
  253. };
  254. static struct clk_lookup lookups[] = {
  255. { /* UART0 */
  256. .dev_id = "dev:uart0",
  257. .clk = &ref24_clk,
  258. }, { /* UART1 */
  259. .dev_id = "dev:uart1",
  260. .clk = &ref24_clk,
  261. }, { /* UART2 */
  262. .dev_id = "dev:uart2",
  263. .clk = &ref24_clk,
  264. }, { /* UART3 */
  265. .dev_id = "fpga:uart3",
  266. .clk = &ref24_clk,
  267. }, { /* KMI0 */
  268. .dev_id = "fpga:kmi0",
  269. .clk = &ref24_clk,
  270. }, { /* KMI1 */
  271. .dev_id = "fpga:kmi1",
  272. .clk = &ref24_clk,
  273. }, { /* MMC0 */
  274. .dev_id = "fpga:mmc0",
  275. .clk = &ref24_clk,
  276. }, { /* EB:CLCD */
  277. .dev_id = "dev:clcd",
  278. .clk = &oscvco_clk,
  279. }, { /* PB:CLCD */
  280. .dev_id = "issp:clcd",
  281. .clk = &oscvco_clk,
  282. }
  283. };
  284. static int __init clk_init(void)
  285. {
  286. if (machine_is_realview_pb1176())
  287. oscvco_clk.vcoreg = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_OSC0_OFFSET;
  288. else
  289. oscvco_clk.vcoreg = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_OSC4_OFFSET;
  290. clkdev_add_table(lookups, ARRAY_SIZE(lookups));
  291. return 0;
  292. }
  293. arch_initcall(clk_init);
  294. /*
  295. * CLCD support.
  296. */
  297. #define SYS_CLCD_NLCDIOON (1 << 2)
  298. #define SYS_CLCD_VDDPOSSWITCH (1 << 3)
  299. #define SYS_CLCD_PWR3V5SWITCH (1 << 4)
  300. #define SYS_CLCD_ID_MASK (0x1f << 8)
  301. #define SYS_CLCD_ID_SANYO_3_8 (0x00 << 8)
  302. #define SYS_CLCD_ID_UNKNOWN_8_4 (0x01 << 8)
  303. #define SYS_CLCD_ID_EPSON_2_2 (0x02 << 8)
  304. #define SYS_CLCD_ID_SANYO_2_5 (0x07 << 8)
  305. #define SYS_CLCD_ID_VGA (0x1f << 8)
  306. static struct clcd_panel vga = {
  307. .mode = {
  308. .name = "VGA",
  309. .refresh = 60,
  310. .xres = 640,
  311. .yres = 480,
  312. .pixclock = 39721,
  313. .left_margin = 40,
  314. .right_margin = 24,
  315. .upper_margin = 32,
  316. .lower_margin = 11,
  317. .hsync_len = 96,
  318. .vsync_len = 2,
  319. .sync = 0,
  320. .vmode = FB_VMODE_NONINTERLACED,
  321. },
  322. .width = -1,
  323. .height = -1,
  324. .tim2 = TIM2_BCD | TIM2_IPC,
  325. .cntl = CNTL_LCDTFT | CNTL_BGR | CNTL_LCDVCOMP(1),
  326. .bpp = 16,
  327. };
  328. static struct clcd_panel xvga = {
  329. .mode = {
  330. .name = "XVGA",
  331. .refresh = 60,
  332. .xres = 1024,
  333. .yres = 768,
  334. .pixclock = 15748,
  335. .left_margin = 152,
  336. .right_margin = 48,
  337. .upper_margin = 23,
  338. .lower_margin = 3,
  339. .hsync_len = 104,
  340. .vsync_len = 4,
  341. .sync = 0,
  342. .vmode = FB_VMODE_NONINTERLACED,
  343. },
  344. .width = -1,
  345. .height = -1,
  346. .tim2 = TIM2_BCD | TIM2_IPC,
  347. .cntl = CNTL_LCDTFT | CNTL_BGR | CNTL_LCDVCOMP(1),
  348. .bpp = 16,
  349. };
  350. static struct clcd_panel sanyo_3_8_in = {
  351. .mode = {
  352. .name = "Sanyo QVGA",
  353. .refresh = 116,
  354. .xres = 320,
  355. .yres = 240,
  356. .pixclock = 100000,
  357. .left_margin = 6,
  358. .right_margin = 6,
  359. .upper_margin = 5,
  360. .lower_margin = 5,
  361. .hsync_len = 6,
  362. .vsync_len = 6,
  363. .sync = 0,
  364. .vmode = FB_VMODE_NONINTERLACED,
  365. },
  366. .width = -1,
  367. .height = -1,
  368. .tim2 = TIM2_BCD,
  369. .cntl = CNTL_LCDTFT | CNTL_BGR | CNTL_LCDVCOMP(1),
  370. .bpp = 16,
  371. };
  372. static struct clcd_panel sanyo_2_5_in = {
  373. .mode = {
  374. .name = "Sanyo QVGA Portrait",
  375. .refresh = 116,
  376. .xres = 240,
  377. .yres = 320,
  378. .pixclock = 100000,
  379. .left_margin = 20,
  380. .right_margin = 10,
  381. .upper_margin = 2,
  382. .lower_margin = 2,
  383. .hsync_len = 10,
  384. .vsync_len = 2,
  385. .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
  386. .vmode = FB_VMODE_NONINTERLACED,
  387. },
  388. .width = -1,
  389. .height = -1,
  390. .tim2 = TIM2_IVS | TIM2_IHS | TIM2_IPC,
  391. .cntl = CNTL_LCDTFT | CNTL_BGR | CNTL_LCDVCOMP(1),
  392. .bpp = 16,
  393. };
  394. static struct clcd_panel epson_2_2_in = {
  395. .mode = {
  396. .name = "Epson QCIF",
  397. .refresh = 390,
  398. .xres = 176,
  399. .yres = 220,
  400. .pixclock = 62500,
  401. .left_margin = 3,
  402. .right_margin = 2,
  403. .upper_margin = 1,
  404. .lower_margin = 0,
  405. .hsync_len = 3,
  406. .vsync_len = 2,
  407. .sync = 0,
  408. .vmode = FB_VMODE_NONINTERLACED,
  409. },
  410. .width = -1,
  411. .height = -1,
  412. .tim2 = TIM2_BCD | TIM2_IPC,
  413. .cntl = CNTL_LCDTFT | CNTL_BGR | CNTL_LCDVCOMP(1),
  414. .bpp = 16,
  415. };
  416. /*
  417. * Detect which LCD panel is connected, and return the appropriate
  418. * clcd_panel structure. Note: we do not have any information on
  419. * the required timings for the 8.4in panel, so we presently assume
  420. * VGA timings.
  421. */
  422. static struct clcd_panel *realview_clcd_panel(void)
  423. {
  424. void __iomem *sys_clcd = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_CLCD_OFFSET;
  425. struct clcd_panel *vga_panel;
  426. struct clcd_panel *panel;
  427. u32 val;
  428. if (machine_is_realview_eb())
  429. vga_panel = &vga;
  430. else
  431. vga_panel = &xvga;
  432. val = readl(sys_clcd) & SYS_CLCD_ID_MASK;
  433. if (val == SYS_CLCD_ID_SANYO_3_8)
  434. panel = &sanyo_3_8_in;
  435. else if (val == SYS_CLCD_ID_SANYO_2_5)
  436. panel = &sanyo_2_5_in;
  437. else if (val == SYS_CLCD_ID_EPSON_2_2)
  438. panel = &epson_2_2_in;
  439. else if (val == SYS_CLCD_ID_VGA)
  440. panel = vga_panel;
  441. else {
  442. printk(KERN_ERR "CLCD: unknown LCD panel ID 0x%08x, using VGA\n",
  443. val);
  444. panel = vga_panel;
  445. }
  446. return panel;
  447. }
  448. /*
  449. * Disable all display connectors on the interface module.
  450. */
  451. static void realview_clcd_disable(struct clcd_fb *fb)
  452. {
  453. void __iomem *sys_clcd = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_CLCD_OFFSET;
  454. u32 val;
  455. val = readl(sys_clcd);
  456. val &= ~SYS_CLCD_NLCDIOON | SYS_CLCD_PWR3V5SWITCH;
  457. writel(val, sys_clcd);
  458. }
  459. /*
  460. * Enable the relevant connector on the interface module.
  461. */
  462. static void realview_clcd_enable(struct clcd_fb *fb)
  463. {
  464. void __iomem *sys_clcd = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_CLCD_OFFSET;
  465. u32 val;
  466. /*
  467. * Enable the PSUs
  468. */
  469. val = readl(sys_clcd);
  470. val |= SYS_CLCD_NLCDIOON | SYS_CLCD_PWR3V5SWITCH;
  471. writel(val, sys_clcd);
  472. }
  473. static int realview_clcd_setup(struct clcd_fb *fb)
  474. {
  475. unsigned long framesize;
  476. dma_addr_t dma;
  477. if (machine_is_realview_eb())
  478. /* VGA, 16bpp */
  479. framesize = 640 * 480 * 2;
  480. else
  481. /* XVGA, 16bpp */
  482. framesize = 1024 * 768 * 2;
  483. fb->panel = realview_clcd_panel();
  484. fb->fb.screen_base = dma_alloc_writecombine(&fb->dev->dev, framesize,
  485. &dma, GFP_KERNEL | GFP_DMA);
  486. if (!fb->fb.screen_base) {
  487. printk(KERN_ERR "CLCD: unable to map framebuffer\n");
  488. return -ENOMEM;
  489. }
  490. fb->fb.fix.smem_start = dma;
  491. fb->fb.fix.smem_len = framesize;
  492. return 0;
  493. }
  494. static int realview_clcd_mmap(struct clcd_fb *fb, struct vm_area_struct *vma)
  495. {
  496. return dma_mmap_writecombine(&fb->dev->dev, vma,
  497. fb->fb.screen_base,
  498. fb->fb.fix.smem_start,
  499. fb->fb.fix.smem_len);
  500. }
  501. static void realview_clcd_remove(struct clcd_fb *fb)
  502. {
  503. dma_free_writecombine(&fb->dev->dev, fb->fb.fix.smem_len,
  504. fb->fb.screen_base, fb->fb.fix.smem_start);
  505. }
  506. struct clcd_board clcd_plat_data = {
  507. .name = "RealView",
  508. .check = clcdfb_check,
  509. .decode = clcdfb_decode,
  510. .disable = realview_clcd_disable,
  511. .enable = realview_clcd_enable,
  512. .setup = realview_clcd_setup,
  513. .mmap = realview_clcd_mmap,
  514. .remove = realview_clcd_remove,
  515. };
  516. #ifdef CONFIG_LEDS
  517. #define VA_LEDS_BASE (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_LED_OFFSET)
  518. void realview_leds_event(led_event_t ledevt)
  519. {
  520. unsigned long flags;
  521. u32 val;
  522. u32 led = 1 << smp_processor_id();
  523. local_irq_save(flags);
  524. val = readl(VA_LEDS_BASE);
  525. switch (ledevt) {
  526. case led_idle_start:
  527. val = val & ~led;
  528. break;
  529. case led_idle_end:
  530. val = val | led;
  531. break;
  532. case led_timer:
  533. val = val ^ REALVIEW_SYS_LED7;
  534. break;
  535. case led_halted:
  536. val = 0;
  537. break;
  538. default:
  539. break;
  540. }
  541. writel(val, VA_LEDS_BASE);
  542. local_irq_restore(flags);
  543. }
  544. #endif /* CONFIG_LEDS */
  545. /*
  546. * Where is the timer (VA)?
  547. */
  548. void __iomem *timer0_va_base;
  549. void __iomem *timer1_va_base;
  550. void __iomem *timer2_va_base;
  551. void __iomem *timer3_va_base;
  552. /*
  553. * Set up the clock source and clock events devices
  554. */
  555. void __init realview_timer_init(unsigned int timer_irq)
  556. {
  557. u32 val;
  558. /*
  559. * set clock frequency:
  560. * REALVIEW_REFCLK is 32KHz
  561. * REALVIEW_TIMCLK is 1MHz
  562. */
  563. val = readl(__io_address(REALVIEW_SCTL_BASE));
  564. writel((REALVIEW_TIMCLK << REALVIEW_TIMER1_EnSel) |
  565. (REALVIEW_TIMCLK << REALVIEW_TIMER2_EnSel) |
  566. (REALVIEW_TIMCLK << REALVIEW_TIMER3_EnSel) |
  567. (REALVIEW_TIMCLK << REALVIEW_TIMER4_EnSel) | val,
  568. __io_address(REALVIEW_SCTL_BASE));
  569. /*
  570. * Initialise to a known state (all timers off)
  571. */
  572. writel(0, timer0_va_base + TIMER_CTRL);
  573. writel(0, timer1_va_base + TIMER_CTRL);
  574. writel(0, timer2_va_base + TIMER_CTRL);
  575. writel(0, timer3_va_base + TIMER_CTRL);
  576. sp804_clocksource_init(timer3_va_base);
  577. sp804_clockevents_init(timer0_va_base, timer_irq);
  578. }
  579. /*
  580. * Setup the memory banks.
  581. */
  582. void realview_fixup(struct machine_desc *mdesc, struct tag *tags, char **from,
  583. struct meminfo *meminfo)
  584. {
  585. /*
  586. * Most RealView platforms have 512MB contiguous RAM at 0x70000000.
  587. * Half of this is mirrored at 0.
  588. */
  589. #ifdef CONFIG_REALVIEW_HIGH_PHYS_OFFSET
  590. meminfo->bank[0].start = 0x70000000;
  591. meminfo->bank[0].size = SZ_512M;
  592. meminfo->nr_banks = 1;
  593. #else
  594. meminfo->bank[0].start = 0;
  595. meminfo->bank[0].size = SZ_256M;
  596. meminfo->nr_banks = 1;
  597. #endif
  598. }