blob: f9d754f90c5991e6bce11371fa5702f9a8d81c16 [file] [log] [blame]
viresh kumarbc4e8142010-04-01 12:30:58 +01001/*
2 * arch/arm/mach-spear3xx/spear3xx.c
3 *
4 * SPEAr3XX machines common source file
5 *
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +05306 * Copyright (C) 2009-2012 ST Microelectronics
Viresh Kumar10d89352012-06-20 12:53:02 -07007 * Viresh Kumar <viresh.linux@gmail.com>
viresh kumarbc4e8142010-04-01 12:30:58 +01008 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
Viresh Kumar5fb00f92012-03-26 10:39:43 +053014#define pr_fmt(fmt) "SPEAr3xx: " fmt
15
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +053016#include <linux/amba/pl022.h>
17#include <linux/amba/pl08x.h>
viresh kumarbc4e8142010-04-01 12:30:58 +010018#include <linux/io.h>
Viresh Kumar0b7ee712012-03-26 10:29:23 +053019#include <plat/pl080.h>
viresh kumarbc4e8142010-04-01 12:30:58 +010020#include <mach/generic.h>
Arnd Bergmann5019f0b2012-04-11 17:30:11 +000021#include <mach/spear.h>
viresh kumarbc4e8142010-04-01 12:30:58 +010022
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +053023/* ssp device registration */
24struct pl022_ssp_controller pl022_plat_data = {
25 .bus_id = 0,
26 .enable_dma = 1,
27 .dma_filter = pl08x_filter_id,
28 .dma_tx_param = "ssp0_tx",
29 .dma_rx_param = "ssp0_rx",
30 /*
31 * This is number of spi devices that can be connected to spi. There are
32 * two type of chipselects on which slave devices can work. One is chip
33 * select provided by spi masters other is controlled through external
34 * gpio's. We can't use chipselect provided from spi master (because as
35 * soon as FIFO becomes empty, CS is disabled and transfer ends). So
36 * this number now depends on number of gpios available for spi. each
37 * slave on each master requires a separate gpio pin.
38 */
39 .num_chipselect = 2,
viresh kumarbc4e8142010-04-01 12:30:58 +010040};
41
Viresh Kumar0b7ee712012-03-26 10:29:23 +053042/* dmac device registration */
43struct pl08x_platform_data pl080_plat_data = {
44 .memcpy_channel = {
45 .bus_id = "memcpy",
Russell Kingdc8d5f82012-05-16 12:20:55 +010046 .cctl_memcpy =
47 (PL080_BSIZE_16 << PL080_CONTROL_SB_SIZE_SHIFT | \
Viresh Kumar0b7ee712012-03-26 10:29:23 +053048 PL080_BSIZE_16 << PL080_CONTROL_DB_SIZE_SHIFT | \
49 PL080_WIDTH_32BIT << PL080_CONTROL_SWIDTH_SHIFT | \
50 PL080_WIDTH_32BIT << PL080_CONTROL_DWIDTH_SHIFT | \
51 PL080_CONTROL_PROT_BUFF | PL080_CONTROL_PROT_CACHE | \
52 PL080_CONTROL_PROT_SYS),
53 },
54 .lli_buses = PL08X_AHB1,
55 .mem_buses = PL08X_AHB1,
56 .get_signal = pl080_get_signal,
57 .put_signal = pl080_put_signal,
58};
viresh kumarbc4e8142010-04-01 12:30:58 +010059
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +053060/*
61 * Following will create 16MB static virtual/physical mappings
62 * PHYSICAL VIRTUAL
63 * 0xD0000000 0xFD000000
64 * 0xFC000000 0xFC000000
65 */
viresh kumarbc4e8142010-04-01 12:30:58 +010066struct map_desc spear3xx_io_desc[] __initdata = {
67 {
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +053068 .virtual = VA_SPEAR3XX_ICM1_2_BASE,
69 .pfn = __phys_to_pfn(SPEAR3XX_ICM1_2_BASE),
70 .length = SZ_16M,
viresh kumarbc4e8142010-04-01 12:30:58 +010071 .type = MT_DEVICE
72 }, {
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +053073 .virtual = VA_SPEAR3XX_ICM3_SMI_CTRL_BASE,
74 .pfn = __phys_to_pfn(SPEAR3XX_ICM3_SMI_CTRL_BASE),
75 .length = SZ_16M,
viresh kumarbc4e8142010-04-01 12:30:58 +010076 .type = MT_DEVICE
77 },
78};
79
80/* This will create static memory mapping for selected devices */
81void __init spear3xx_map_io(void)
82{
83 iotable_init(spear3xx_io_desc, ARRAY_SIZE(spear3xx_io_desc));
viresh kumarbc4e8142010-04-01 12:30:58 +010084}
viresh kumar70f4c0b2010-04-01 12:31:29 +010085
Stephen Warren6bb27d72012-11-08 12:40:59 -070086void __init spear3xx_timer_init(void)
Shiraz Hashim5c881d92011-02-16 07:40:32 +010087{
Vipul Kumar Samar5cfc5452012-07-10 17:12:45 +053088 char pclk_name[] = "pll3_clk";
Shiraz Hashim5c881d92011-02-16 07:40:32 +010089 struct clk *gpt_clk, *pclk;
90
Viresh Kumar5df33a62012-04-10 09:02:35 +053091 spear3xx_clk_init();
92
Shiraz Hashim5c881d92011-02-16 07:40:32 +010093 /* get the system timer clock */
94 gpt_clk = clk_get_sys("gpt0", NULL);
95 if (IS_ERR(gpt_clk)) {
96 pr_err("%s:couldn't get clk for gpt\n", __func__);
97 BUG();
98 }
99
100 /* get the suitable parent clock for timer*/
101 pclk = clk_get(NULL, pclk_name);
102 if (IS_ERR(pclk)) {
103 pr_err("%s:couldn't get %s as parent for gpt\n",
104 __func__, pclk_name);
105 BUG();
106 }
107
108 clk_set_parent(gpt_clk, pclk);
109 clk_put(gpt_clk);
110 clk_put(pclk);
111
Viresh Kumar30551c02012-04-21 13:15:37 +0530112 spear_setup_of_timer();
Shiraz Hashim5c881d92011-02-16 07:40:32 +0100113}