xref: /openbmc/linux/arch/arm/mach-spear/spear1310.c (revision d9909ebe)
1 /*
2  * arch/arm/mach-spear13xx/spear1310.c
3  *
4  * SPEAr1310 machine source file
5  *
6  * Copyright (C) 2012 ST Microelectronics
7  * Viresh Kumar <viresh.linux@gmail.com>
8  *
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 
14 #define pr_fmt(fmt) "SPEAr1310: " fmt
15 
16 #include <linux/amba/pl022.h>
17 #include <linux/irqchip.h>
18 #include <linux/of_platform.h>
19 #include <linux/pata_arasan_cf_data.h>
20 #include <asm/mach/arch.h>
21 #include <asm/mach/map.h>
22 #include "generic.h"
23 #include <mach/spear.h>
24 
25 /* Base addresses */
26 #define SPEAR1310_SSP1_BASE			UL(0x5D400000)
27 #define SPEAR1310_SATA0_BASE			UL(0xB1000000)
28 #define SPEAR1310_SATA1_BASE			UL(0xB1800000)
29 #define SPEAR1310_SATA2_BASE			UL(0xB4000000)
30 
31 #define SPEAR1310_RAS_GRP1_BASE			UL(0xD8000000)
32 #define VA_SPEAR1310_RAS_GRP1_BASE		UL(0xFA000000)
33 
34 static struct arasan_cf_pdata cf_pdata = {
35 	.cf_if_clk = CF_IF_CLK_166M,
36 	.quirk = CF_BROKEN_UDMA,
37 	.dma_priv = &cf_dma_priv,
38 };
39 
40 /* ssp device registration */
41 static struct pl022_ssp_controller ssp1_plat_data = {
42 	.enable_dma = 0,
43 };
44 
45 /* Add SPEAr1310 auxdata to pass platform data */
46 static struct of_dev_auxdata spear1310_auxdata_lookup[] __initdata = {
47 	OF_DEV_AUXDATA("arasan,cf-spear1340", MCIF_CF_BASE, NULL, &cf_pdata),
48 	OF_DEV_AUXDATA("snps,dma-spear1340", DMAC0_BASE, NULL, &dmac_plat_data),
49 	OF_DEV_AUXDATA("snps,dma-spear1340", DMAC1_BASE, NULL, &dmac_plat_data),
50 	OF_DEV_AUXDATA("arm,pl022", SSP_BASE, NULL, &pl022_plat_data),
51 
52 	OF_DEV_AUXDATA("arm,pl022", SPEAR1310_SSP1_BASE, NULL, &ssp1_plat_data),
53 	{}
54 };
55 
56 static void __init spear1310_dt_init(void)
57 {
58 	of_platform_populate(NULL, of_default_bus_match_table,
59 			spear1310_auxdata_lookup, NULL);
60 }
61 
62 static const char * const spear1310_dt_board_compat[] = {
63 	"st,spear1310",
64 	"st,spear1310-evb",
65 	NULL,
66 };
67 
68 /*
69  * Following will create 16MB static virtual/physical mappings
70  * PHYSICAL		VIRTUAL
71  * 0xD8000000		0xFA000000
72  */
73 struct map_desc spear1310_io_desc[] __initdata = {
74 	{
75 		.virtual	= VA_SPEAR1310_RAS_GRP1_BASE,
76 		.pfn		= __phys_to_pfn(SPEAR1310_RAS_GRP1_BASE),
77 		.length		= SZ_16M,
78 		.type		= MT_DEVICE
79 	},
80 };
81 
82 static void __init spear1310_map_io(void)
83 {
84 	iotable_init(spear1310_io_desc, ARRAY_SIZE(spear1310_io_desc));
85 	spear13xx_map_io();
86 }
87 
88 DT_MACHINE_START(SPEAR1310_DT, "ST SPEAr1310 SoC with Flattened Device Tree")
89 	.smp		=	smp_ops(spear13xx_smp_ops),
90 	.map_io		=	spear1310_map_io,
91 	.init_irq	=	irqchip_init,
92 	.init_time	=	spear13xx_timer_init,
93 	.init_machine	=	spear1310_dt_init,
94 	.restart	=	spear_restart,
95 	.dt_compat	=	spear1310_dt_board_compat,
96 MACHINE_END
97