core.c 15 KB

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