Viresh Kumar | e3978dc | 2012-04-19 22:23:13 +0530 | [diff] [blame] | 1 | /* |
| 2 | * arch/arm/mach-spear13xx/spear1310.c |
| 3 | * |
| 4 | * SPEAr1310 machine source file |
| 5 | * |
| 6 | * Copyright (C) 2012 ST Microelectronics |
Viresh Kumar | 10d8935 | 2012-06-20 12:53:02 -0700 | [diff] [blame] | 7 | * Viresh Kumar <viresh.linux@gmail.com> |
Viresh Kumar | e3978dc | 2012-04-19 22:23:13 +0530 | [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 | |
| 14 | #define pr_fmt(fmt) "SPEAr1310: " fmt |
| 15 | |
| 16 | #include <linux/amba/pl022.h> |
Rob Herring | 0529e315 | 2012-11-05 16:18:28 -0600 | [diff] [blame] | 17 | #include <linux/irqchip.h> |
Viresh Kumar | e3978dc | 2012-04-19 22:23:13 +0530 | [diff] [blame] | 18 | #include <linux/of_platform.h> |
Vipul Kumar Samar | 300a685 | 2012-10-15 17:55:58 +0530 | [diff] [blame] | 19 | #include <linux/pata_arasan_cf_data.h> |
Viresh Kumar | e3978dc | 2012-04-19 22:23:13 +0530 | [diff] [blame] | 20 | #include <asm/mach/arch.h> |
| 21 | #include <asm/mach/map.h> |
| 22 | #include <mach/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 | |
Vipul Kumar Samar | 07e812a | 2012-10-17 12:08:26 +0530 | [diff] [blame] | 31 | #define SPEAR1310_RAS_GRP1_BASE UL(0xD8000000) |
| 32 | #define VA_SPEAR1310_RAS_GRP1_BASE UL(0xFA000000) |
| 33 | #define SPEAR1310_RAS_BASE UL(0xD8400000) |
| 34 | #define VA_SPEAR1310_RAS_BASE IOMEM(UL(0xFA400000)) |
| 35 | |
Vipul Kumar Samar | 300a685 | 2012-10-15 17:55:58 +0530 | [diff] [blame] | 36 | static struct arasan_cf_pdata cf_pdata = { |
| 37 | .cf_if_clk = CF_IF_CLK_166M, |
| 38 | .quirk = CF_BROKEN_UDMA, |
| 39 | .dma_priv = &cf_dma_priv, |
| 40 | }; |
| 41 | |
Viresh Kumar | e3978dc | 2012-04-19 22:23:13 +0530 | [diff] [blame] | 42 | /* ssp device registration */ |
| 43 | static struct pl022_ssp_controller ssp1_plat_data = { |
Viresh Kumar | e3978dc | 2012-04-19 22:23:13 +0530 | [diff] [blame] | 44 | .enable_dma = 0, |
Viresh Kumar | e3978dc | 2012-04-19 22:23:13 +0530 | [diff] [blame] | 45 | }; |
| 46 | |
| 47 | /* Add SPEAr1310 auxdata to pass platform data */ |
| 48 | static struct of_dev_auxdata spear1310_auxdata_lookup[] __initdata = { |
Vipul Kumar Samar | 300a685 | 2012-10-15 17:55:58 +0530 | [diff] [blame] | 49 | OF_DEV_AUXDATA("arasan,cf-spear1340", MCIF_CF_BASE, NULL, &cf_pdata), |
Viresh Kumar | e3978dc | 2012-04-19 22:23:13 +0530 | [diff] [blame] | 50 | OF_DEV_AUXDATA("snps,dma-spear1340", DMAC0_BASE, NULL, &dmac_plat_data), |
| 51 | OF_DEV_AUXDATA("snps,dma-spear1340", DMAC1_BASE, NULL, &dmac_plat_data), |
| 52 | OF_DEV_AUXDATA("arm,pl022", SSP_BASE, NULL, &pl022_plat_data), |
| 53 | |
| 54 | OF_DEV_AUXDATA("arm,pl022", SPEAR1310_SSP1_BASE, NULL, &ssp1_plat_data), |
| 55 | {} |
| 56 | }; |
| 57 | |
| 58 | static void __init spear1310_dt_init(void) |
| 59 | { |
| 60 | of_platform_populate(NULL, of_default_bus_match_table, |
| 61 | spear1310_auxdata_lookup, NULL); |
| 62 | } |
| 63 | |
| 64 | static const char * const spear1310_dt_board_compat[] = { |
| 65 | "st,spear1310", |
| 66 | "st,spear1310-evb", |
| 67 | NULL, |
| 68 | }; |
| 69 | |
| 70 | /* |
| 71 | * Following will create 16MB static virtual/physical mappings |
| 72 | * PHYSICAL VIRTUAL |
| 73 | * 0xD8000000 0xFA000000 |
| 74 | */ |
| 75 | struct map_desc spear1310_io_desc[] __initdata = { |
| 76 | { |
| 77 | .virtual = VA_SPEAR1310_RAS_GRP1_BASE, |
| 78 | .pfn = __phys_to_pfn(SPEAR1310_RAS_GRP1_BASE), |
| 79 | .length = SZ_16M, |
| 80 | .type = MT_DEVICE |
| 81 | }, |
| 82 | }; |
| 83 | |
| 84 | static void __init spear1310_map_io(void) |
| 85 | { |
| 86 | iotable_init(spear1310_io_desc, ARRAY_SIZE(spear1310_io_desc)); |
| 87 | spear13xx_map_io(); |
| 88 | } |
| 89 | |
| 90 | DT_MACHINE_START(SPEAR1310_DT, "ST SPEAr1310 SoC with Flattened Device Tree") |
Arnd Bergmann | 2d8b21d | 2011-09-08 13:15:22 +0100 | [diff] [blame] | 91 | .smp = smp_ops(spear13xx_smp_ops), |
Viresh Kumar | e3978dc | 2012-04-19 22:23:13 +0530 | [diff] [blame] | 92 | .map_io = spear1310_map_io, |
Rob Herring | 0529e315 | 2012-11-05 16:18:28 -0600 | [diff] [blame] | 93 | .init_irq = irqchip_init, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 94 | .init_time = spear13xx_timer_init, |
Viresh Kumar | e3978dc | 2012-04-19 22:23:13 +0530 | [diff] [blame] | 95 | .init_machine = spear1310_dt_init, |
| 96 | .restart = spear_restart, |
| 97 | .dt_compat = spear1310_dt_board_compat, |
| 98 | MACHINE_END |