viresh kumar | bc4e814 | 2010-04-01 12:30:58 +0100 | [diff] [blame] | 1 | /* |
| 2 | * arch/arm/mach-spear3xx/spear300.c |
| 3 | * |
| 4 | * SPEAr300 machine source file |
| 5 | * |
Viresh Kumar | c5fa4fd | 2012-03-23 00:17:43 +0530 | [diff] [blame] | 6 | * Copyright (C) 2009-2012 ST Microelectronics |
Viresh Kumar | 10d8935 | 2012-06-20 12:53:02 -0700 | [diff] [blame] | 7 | * Viresh Kumar <viresh.linux@gmail.com> |
viresh kumar | bc4e814 | 2010-04-01 12:30:58 +0100 | [diff] [blame] | 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 | |
Viresh Kumar | 5fb00f9 | 2012-03-26 10:39:43 +0530 | [diff] [blame] | 14 | #define pr_fmt(fmt) "SPEAr300: " fmt |
| 15 | |
Viresh Kumar | 0b7ee71 | 2012-03-26 10:29:23 +0530 | [diff] [blame] | 16 | #include <linux/amba/pl08x.h> |
Rob Herring | e9c5155 | 2013-01-02 09:37:56 -0600 | [diff] [blame] | 17 | #include <linux/irqchip.h> |
Viresh Kumar | c5fa4fd | 2012-03-23 00:17:43 +0530 | [diff] [blame] | 18 | #include <linux/of_platform.h> |
Viresh Kumar | c5fa4fd | 2012-03-23 00:17:43 +0530 | [diff] [blame] | 19 | #include <asm/mach/arch.h> |
viresh kumar | bc4e814 | 2010-04-01 12:30:58 +0100 | [diff] [blame] | 20 | #include <mach/generic.h> |
Arnd Bergmann | 5019f0b | 2012-04-11 17:30:11 +0000 | [diff] [blame] | 21 | #include <mach/spear.h> |
| 22 | |
Viresh Kumar | 0b7ee71 | 2012-03-26 10:29:23 +0530 | [diff] [blame] | 23 | /* DMAC platform data's slave info */ |
| 24 | struct pl08x_channel_data spear300_dma_info[] = { |
| 25 | { |
| 26 | .bus_id = "uart0_rx", |
| 27 | .min_signal = 2, |
| 28 | .max_signal = 2, |
| 29 | .muxval = 0, |
Viresh Kumar | 0b7ee71 | 2012-03-26 10:29:23 +0530 | [diff] [blame] | 30 | .periph_buses = PL08X_AHB1, |
| 31 | }, { |
| 32 | .bus_id = "uart0_tx", |
| 33 | .min_signal = 3, |
| 34 | .max_signal = 3, |
| 35 | .muxval = 0, |
Viresh Kumar | 0b7ee71 | 2012-03-26 10:29:23 +0530 | [diff] [blame] | 36 | .periph_buses = PL08X_AHB1, |
| 37 | }, { |
| 38 | .bus_id = "ssp0_rx", |
| 39 | .min_signal = 8, |
| 40 | .max_signal = 8, |
| 41 | .muxval = 0, |
Viresh Kumar | 0b7ee71 | 2012-03-26 10:29:23 +0530 | [diff] [blame] | 42 | .periph_buses = PL08X_AHB1, |
| 43 | }, { |
| 44 | .bus_id = "ssp0_tx", |
| 45 | .min_signal = 9, |
| 46 | .max_signal = 9, |
| 47 | .muxval = 0, |
Viresh Kumar | 0b7ee71 | 2012-03-26 10:29:23 +0530 | [diff] [blame] | 48 | .periph_buses = PL08X_AHB1, |
| 49 | }, { |
| 50 | .bus_id = "i2c_rx", |
| 51 | .min_signal = 10, |
| 52 | .max_signal = 10, |
| 53 | .muxval = 0, |
Viresh Kumar | 0b7ee71 | 2012-03-26 10:29:23 +0530 | [diff] [blame] | 54 | .periph_buses = PL08X_AHB1, |
| 55 | }, { |
| 56 | .bus_id = "i2c_tx", |
| 57 | .min_signal = 11, |
| 58 | .max_signal = 11, |
| 59 | .muxval = 0, |
Viresh Kumar | 0b7ee71 | 2012-03-26 10:29:23 +0530 | [diff] [blame] | 60 | .periph_buses = PL08X_AHB1, |
| 61 | }, { |
| 62 | .bus_id = "irda", |
| 63 | .min_signal = 12, |
| 64 | .max_signal = 12, |
| 65 | .muxval = 0, |
Viresh Kumar | 0b7ee71 | 2012-03-26 10:29:23 +0530 | [diff] [blame] | 66 | .periph_buses = PL08X_AHB1, |
| 67 | }, { |
| 68 | .bus_id = "adc", |
| 69 | .min_signal = 13, |
| 70 | .max_signal = 13, |
| 71 | .muxval = 0, |
Viresh Kumar | 0b7ee71 | 2012-03-26 10:29:23 +0530 | [diff] [blame] | 72 | .periph_buses = PL08X_AHB1, |
| 73 | }, { |
| 74 | .bus_id = "to_jpeg", |
| 75 | .min_signal = 14, |
| 76 | .max_signal = 14, |
| 77 | .muxval = 0, |
Viresh Kumar | 0b7ee71 | 2012-03-26 10:29:23 +0530 | [diff] [blame] | 78 | .periph_buses = PL08X_AHB1, |
| 79 | }, { |
| 80 | .bus_id = "from_jpeg", |
| 81 | .min_signal = 15, |
| 82 | .max_signal = 15, |
| 83 | .muxval = 0, |
Viresh Kumar | 0b7ee71 | 2012-03-26 10:29:23 +0530 | [diff] [blame] | 84 | .periph_buses = PL08X_AHB1, |
| 85 | }, { |
| 86 | .bus_id = "ras0_rx", |
| 87 | .min_signal = 0, |
| 88 | .max_signal = 0, |
| 89 | .muxval = 1, |
Viresh Kumar | 0b7ee71 | 2012-03-26 10:29:23 +0530 | [diff] [blame] | 90 | .periph_buses = PL08X_AHB1, |
| 91 | }, { |
| 92 | .bus_id = "ras0_tx", |
| 93 | .min_signal = 1, |
| 94 | .max_signal = 1, |
| 95 | .muxval = 1, |
Viresh Kumar | 0b7ee71 | 2012-03-26 10:29:23 +0530 | [diff] [blame] | 96 | .periph_buses = PL08X_AHB1, |
| 97 | }, { |
| 98 | .bus_id = "ras1_rx", |
| 99 | .min_signal = 2, |
| 100 | .max_signal = 2, |
| 101 | .muxval = 1, |
Viresh Kumar | 0b7ee71 | 2012-03-26 10:29:23 +0530 | [diff] [blame] | 102 | .periph_buses = PL08X_AHB1, |
| 103 | }, { |
| 104 | .bus_id = "ras1_tx", |
| 105 | .min_signal = 3, |
| 106 | .max_signal = 3, |
| 107 | .muxval = 1, |
Viresh Kumar | 0b7ee71 | 2012-03-26 10:29:23 +0530 | [diff] [blame] | 108 | .periph_buses = PL08X_AHB1, |
| 109 | }, { |
| 110 | .bus_id = "ras2_rx", |
| 111 | .min_signal = 4, |
| 112 | .max_signal = 4, |
| 113 | .muxval = 1, |
Viresh Kumar | 0b7ee71 | 2012-03-26 10:29:23 +0530 | [diff] [blame] | 114 | .periph_buses = PL08X_AHB1, |
| 115 | }, { |
| 116 | .bus_id = "ras2_tx", |
| 117 | .min_signal = 5, |
| 118 | .max_signal = 5, |
| 119 | .muxval = 1, |
Viresh Kumar | 0b7ee71 | 2012-03-26 10:29:23 +0530 | [diff] [blame] | 120 | .periph_buses = PL08X_AHB1, |
| 121 | }, { |
| 122 | .bus_id = "ras3_rx", |
| 123 | .min_signal = 6, |
| 124 | .max_signal = 6, |
| 125 | .muxval = 1, |
Viresh Kumar | 0b7ee71 | 2012-03-26 10:29:23 +0530 | [diff] [blame] | 126 | .periph_buses = PL08X_AHB1, |
| 127 | }, { |
| 128 | .bus_id = "ras3_tx", |
| 129 | .min_signal = 7, |
| 130 | .max_signal = 7, |
| 131 | .muxval = 1, |
Viresh Kumar | 0b7ee71 | 2012-03-26 10:29:23 +0530 | [diff] [blame] | 132 | .periph_buses = PL08X_AHB1, |
| 133 | }, { |
| 134 | .bus_id = "ras4_rx", |
| 135 | .min_signal = 8, |
| 136 | .max_signal = 8, |
| 137 | .muxval = 1, |
Viresh Kumar | 0b7ee71 | 2012-03-26 10:29:23 +0530 | [diff] [blame] | 138 | .periph_buses = PL08X_AHB1, |
| 139 | }, { |
| 140 | .bus_id = "ras4_tx", |
| 141 | .min_signal = 9, |
| 142 | .max_signal = 9, |
| 143 | .muxval = 1, |
Viresh Kumar | 0b7ee71 | 2012-03-26 10:29:23 +0530 | [diff] [blame] | 144 | .periph_buses = PL08X_AHB1, |
| 145 | }, { |
| 146 | .bus_id = "ras5_rx", |
| 147 | .min_signal = 10, |
| 148 | .max_signal = 10, |
| 149 | .muxval = 1, |
Viresh Kumar | 0b7ee71 | 2012-03-26 10:29:23 +0530 | [diff] [blame] | 150 | .periph_buses = PL08X_AHB1, |
| 151 | }, { |
| 152 | .bus_id = "ras5_tx", |
| 153 | .min_signal = 11, |
| 154 | .max_signal = 11, |
| 155 | .muxval = 1, |
Viresh Kumar | 0b7ee71 | 2012-03-26 10:29:23 +0530 | [diff] [blame] | 156 | .periph_buses = PL08X_AHB1, |
| 157 | }, { |
| 158 | .bus_id = "ras6_rx", |
| 159 | .min_signal = 12, |
| 160 | .max_signal = 12, |
| 161 | .muxval = 1, |
Viresh Kumar | 0b7ee71 | 2012-03-26 10:29:23 +0530 | [diff] [blame] | 162 | .periph_buses = PL08X_AHB1, |
| 163 | }, { |
| 164 | .bus_id = "ras6_tx", |
| 165 | .min_signal = 13, |
| 166 | .max_signal = 13, |
| 167 | .muxval = 1, |
Viresh Kumar | 0b7ee71 | 2012-03-26 10:29:23 +0530 | [diff] [blame] | 168 | .periph_buses = PL08X_AHB1, |
| 169 | }, { |
| 170 | .bus_id = "ras7_rx", |
| 171 | .min_signal = 14, |
| 172 | .max_signal = 14, |
| 173 | .muxval = 1, |
Viresh Kumar | 0b7ee71 | 2012-03-26 10:29:23 +0530 | [diff] [blame] | 174 | .periph_buses = PL08X_AHB1, |
| 175 | }, { |
| 176 | .bus_id = "ras7_tx", |
| 177 | .min_signal = 15, |
| 178 | .max_signal = 15, |
| 179 | .muxval = 1, |
Viresh Kumar | 0b7ee71 | 2012-03-26 10:29:23 +0530 | [diff] [blame] | 180 | .periph_buses = PL08X_AHB1, |
| 181 | }, |
| 182 | }; |
| 183 | |
Viresh Kumar | c5fa4fd | 2012-03-23 00:17:43 +0530 | [diff] [blame] | 184 | /* Add SPEAr300 auxdata to pass platform data */ |
| 185 | static struct of_dev_auxdata spear300_auxdata_lookup[] __initdata = { |
| 186 | OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL, |
| 187 | &pl022_plat_data), |
Arnd Bergmann | d42799b | 2012-12-02 14:45:27 +0100 | [diff] [blame^] | 188 | OF_DEV_AUXDATA("arm,pl080", SPEAR_ICM3_DMA_BASE, NULL, |
Viresh Kumar | 0b7ee71 | 2012-03-26 10:29:23 +0530 | [diff] [blame] | 189 | &pl080_plat_data), |
Viresh Kumar | c5fa4fd | 2012-03-23 00:17:43 +0530 | [diff] [blame] | 190 | {} |
| 191 | }; |
viresh kumar | c2c0783 | 2011-03-07 05:57:05 +0100 | [diff] [blame] | 192 | |
Viresh Kumar | c5fa4fd | 2012-03-23 00:17:43 +0530 | [diff] [blame] | 193 | static void __init spear300_dt_init(void) |
viresh kumar | bc4e814 | 2010-04-01 12:30:58 +0100 | [diff] [blame] | 194 | { |
Viresh Kumar | 0b7ee71 | 2012-03-26 10:29:23 +0530 | [diff] [blame] | 195 | pl080_plat_data.slave_channels = spear300_dma_info; |
| 196 | pl080_plat_data.num_slave_channels = ARRAY_SIZE(spear300_dma_info); |
| 197 | |
Viresh Kumar | c5fa4fd | 2012-03-23 00:17:43 +0530 | [diff] [blame] | 198 | of_platform_populate(NULL, of_default_bus_match_table, |
| 199 | spear300_auxdata_lookup, NULL); |
viresh kumar | 70f4c0b | 2010-04-01 12:31:29 +0100 | [diff] [blame] | 200 | } |
Viresh Kumar | c5fa4fd | 2012-03-23 00:17:43 +0530 | [diff] [blame] | 201 | |
| 202 | static const char * const spear300_dt_board_compat[] = { |
| 203 | "st,spear300", |
| 204 | "st,spear300-evb", |
| 205 | NULL, |
| 206 | }; |
| 207 | |
| 208 | static void __init spear300_map_io(void) |
| 209 | { |
| 210 | spear3xx_map_io(); |
Viresh Kumar | c5fa4fd | 2012-03-23 00:17:43 +0530 | [diff] [blame] | 211 | } |
| 212 | |
| 213 | DT_MACHINE_START(SPEAR300_DT, "ST SPEAr300 SoC with Flattened Device Tree") |
| 214 | .map_io = spear300_map_io, |
Rob Herring | e9c5155 | 2013-01-02 09:37:56 -0600 | [diff] [blame] | 215 | .init_irq = irqchip_init, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 216 | .init_time = spear3xx_timer_init, |
Viresh Kumar | c5fa4fd | 2012-03-23 00:17:43 +0530 | [diff] [blame] | 217 | .init_machine = spear300_dt_init, |
| 218 | .restart = spear_restart, |
| 219 | .dt_compat = spear300_dt_board_compat, |
| 220 | MACHINE_END |