2010-04-01 13:30:58 +02:00
|
|
|
/*
|
|
|
|
* arch/arm/mach-spear3xx/spear3xx.c
|
|
|
|
*
|
|
|
|
* SPEAr3XX machines common source file
|
|
|
|
*
|
2012-03-22 19:47:43 +01:00
|
|
|
* Copyright (C) 2009-2012 ST Microelectronics
|
|
|
|
* Viresh Kumar <viresh.kumar@st.com>
|
2010-04-01 13:30:58 +02:00
|
|
|
*
|
|
|
|
* This file is licensed under the terms of the GNU General Public
|
|
|
|
* License version 2. This program is licensed "as is" without any
|
|
|
|
* warranty of any kind, whether express or implied.
|
|
|
|
*/
|
|
|
|
|
2012-03-26 07:09:43 +02:00
|
|
|
#define pr_fmt(fmt) "SPEAr3xx: " fmt
|
|
|
|
|
2012-03-22 19:47:43 +01:00
|
|
|
#include <linux/amba/pl022.h>
|
|
|
|
#include <linux/amba/pl08x.h>
|
|
|
|
#include <linux/of_irq.h>
|
2010-04-01 13:30:58 +02:00
|
|
|
#include <linux/io.h>
|
2012-03-26 06:59:23 +02:00
|
|
|
#include <asm/hardware/pl080.h>
|
2010-04-01 13:30:58 +02:00
|
|
|
#include <asm/hardware/vic.h>
|
2012-03-26 06:59:23 +02:00
|
|
|
#include <plat/pl080.h>
|
2010-04-01 13:30:58 +02:00
|
|
|
#include <mach/generic.h>
|
2012-04-11 19:30:11 +02:00
|
|
|
#include <mach/spear.h>
|
2010-04-01 13:30:58 +02:00
|
|
|
|
2012-03-22 19:47:43 +01:00
|
|
|
/* ssp device registration */
|
|
|
|
struct pl022_ssp_controller pl022_plat_data = {
|
|
|
|
.bus_id = 0,
|
|
|
|
.enable_dma = 1,
|
|
|
|
.dma_filter = pl08x_filter_id,
|
|
|
|
.dma_tx_param = "ssp0_tx",
|
|
|
|
.dma_rx_param = "ssp0_rx",
|
|
|
|
/*
|
|
|
|
* This is number of spi devices that can be connected to spi. There are
|
|
|
|
* two type of chipselects on which slave devices can work. One is chip
|
|
|
|
* select provided by spi masters other is controlled through external
|
|
|
|
* gpio's. We can't use chipselect provided from spi master (because as
|
|
|
|
* soon as FIFO becomes empty, CS is disabled and transfer ends). So
|
|
|
|
* this number now depends on number of gpios available for spi. each
|
|
|
|
* slave on each master requires a separate gpio pin.
|
|
|
|
*/
|
|
|
|
.num_chipselect = 2,
|
|
|
|
};
|
|
|
|
|
2012-03-26 06:59:23 +02:00
|
|
|
/* dmac device registration */
|
|
|
|
struct pl08x_platform_data pl080_plat_data = {
|
|
|
|
.memcpy_channel = {
|
|
|
|
.bus_id = "memcpy",
|
|
|
|
.cctl = (PL080_BSIZE_16 << PL080_CONTROL_SB_SIZE_SHIFT | \
|
|
|
|
PL080_BSIZE_16 << PL080_CONTROL_DB_SIZE_SHIFT | \
|
|
|
|
PL080_WIDTH_32BIT << PL080_CONTROL_SWIDTH_SHIFT | \
|
|
|
|
PL080_WIDTH_32BIT << PL080_CONTROL_DWIDTH_SHIFT | \
|
|
|
|
PL080_CONTROL_PROT_BUFF | PL080_CONTROL_PROT_CACHE | \
|
|
|
|
PL080_CONTROL_PROT_SYS),
|
|
|
|
},
|
|
|
|
.lli_buses = PL08X_AHB1,
|
|
|
|
.mem_buses = PL08X_AHB1,
|
|
|
|
.get_signal = pl080_get_signal,
|
|
|
|
.put_signal = pl080_put_signal,
|
2010-04-01 13:30:58 +02:00
|
|
|
};
|
|
|
|
|
2012-03-22 19:47:43 +01:00
|
|
|
/*
|
|
|
|
* Following will create 16MB static virtual/physical mappings
|
|
|
|
* PHYSICAL VIRTUAL
|
|
|
|
* 0xD0000000 0xFD000000
|
|
|
|
* 0xFC000000 0xFC000000
|
|
|
|
*/
|
2010-04-01 13:30:58 +02:00
|
|
|
struct map_desc spear3xx_io_desc[] __initdata = {
|
|
|
|
{
|
2012-03-22 19:47:43 +01:00
|
|
|
.virtual = VA_SPEAR3XX_ICM1_2_BASE,
|
|
|
|
.pfn = __phys_to_pfn(SPEAR3XX_ICM1_2_BASE),
|
|
|
|
.length = SZ_16M,
|
2010-04-01 13:30:58 +02:00
|
|
|
.type = MT_DEVICE
|
|
|
|
}, {
|
2012-03-22 19:47:43 +01:00
|
|
|
.virtual = VA_SPEAR3XX_ICM3_SMI_CTRL_BASE,
|
|
|
|
.pfn = __phys_to_pfn(SPEAR3XX_ICM3_SMI_CTRL_BASE),
|
|
|
|
.length = SZ_16M,
|
2010-04-01 13:30:58 +02:00
|
|
|
.type = MT_DEVICE
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
/* This will create static memory mapping for selected devices */
|
|
|
|
void __init spear3xx_map_io(void)
|
|
|
|
{
|
|
|
|
iotable_init(spear3xx_io_desc, ARRAY_SIZE(spear3xx_io_desc));
|
|
|
|
}
|
2010-04-01 13:31:29 +02:00
|
|
|
|
2011-02-16 07:40:32 +01:00
|
|
|
static void __init spear3xx_timer_init(void)
|
|
|
|
{
|
|
|
|
char pclk_name[] = "pll3_48m_clk";
|
|
|
|
struct clk *gpt_clk, *pclk;
|
|
|
|
|
2012-04-10 05:32:35 +02:00
|
|
|
spear3xx_clk_init();
|
|
|
|
|
2011-02-16 07:40:32 +01:00
|
|
|
/* get the system timer clock */
|
|
|
|
gpt_clk = clk_get_sys("gpt0", NULL);
|
|
|
|
if (IS_ERR(gpt_clk)) {
|
|
|
|
pr_err("%s:couldn't get clk for gpt\n", __func__);
|
|
|
|
BUG();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get the suitable parent clock for timer*/
|
|
|
|
pclk = clk_get(NULL, pclk_name);
|
|
|
|
if (IS_ERR(pclk)) {
|
|
|
|
pr_err("%s:couldn't get %s as parent for gpt\n",
|
|
|
|
__func__, pclk_name);
|
|
|
|
BUG();
|
|
|
|
}
|
|
|
|
|
|
|
|
clk_set_parent(gpt_clk, pclk);
|
|
|
|
clk_put(gpt_clk);
|
|
|
|
clk_put(pclk);
|
|
|
|
|
2012-04-21 09:45:37 +02:00
|
|
|
spear_setup_of_timer();
|
2011-02-16 07:40:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
struct sys_timer spear3xx_timer = {
|
|
|
|
.init = spear3xx_timer_init,
|
|
|
|
};
|
2012-03-22 19:47:43 +01:00
|
|
|
|
|
|
|
static const struct of_device_id vic_of_match[] __initconst = {
|
|
|
|
{ .compatible = "arm,pl190-vic", .data = vic_of_init, },
|
|
|
|
{ /* Sentinel */ }
|
|
|
|
};
|
|
|
|
|
|
|
|
void __init spear3xx_dt_init_irq(void)
|
|
|
|
{
|
|
|
|
of_irq_init(vic_of_match);
|
|
|
|
}
|