Lennert Buytenhek | 777f9be | 2008-06-22 22:45:02 +0200 | [diff] [blame] | 1 | /* |
| 2 | * arch/arm/mach-loki/common.c |
| 3 | * |
| 4 | * Core functions for Marvell Loki (88RC8480) SoCs |
| 5 | * |
| 6 | * This file is licensed under the terms of the GNU General Public |
| 7 | * License version 2. This program is licensed "as is" without any |
| 8 | * warranty of any kind, whether express or implied. |
| 9 | */ |
| 10 | |
| 11 | #include <linux/kernel.h> |
| 12 | #include <linux/init.h> |
| 13 | #include <linux/platform_device.h> |
| 14 | #include <linux/serial_8250.h> |
| 15 | #include <linux/mbus.h> |
Andrew Lunn | 5c60255 | 2011-05-15 13:32:40 +0200 | [diff] [blame] | 16 | #include <linux/dma-mapping.h> |
Lennert Buytenhek | 777f9be | 2008-06-22 22:45:02 +0200 | [diff] [blame] | 17 | #include <asm/page.h> |
| 18 | #include <asm/timex.h> |
| 19 | #include <asm/mach/map.h> |
| 20 | #include <asm/mach/time.h> |
Lennert Buytenhek | 4ee1f6b | 2010-10-15 16:50:26 +0200 | [diff] [blame] | 21 | #include <mach/bridge-regs.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 22 | #include <mach/loki.h> |
Lennert Buytenhek | 6f088f1 | 2008-08-09 13:44:58 +0200 | [diff] [blame] | 23 | #include <plat/orion_nand.h> |
| 24 | #include <plat/time.h> |
Andrew Lunn | 28a2b45 | 2011-05-15 13:32:41 +0200 | [diff] [blame] | 25 | #include <plat/common.h> |
Lennert Buytenhek | 777f9be | 2008-06-22 22:45:02 +0200 | [diff] [blame] | 26 | #include "common.h" |
| 27 | |
| 28 | /***************************************************************************** |
| 29 | * I/O Address Mapping |
| 30 | ****************************************************************************/ |
| 31 | static struct map_desc loki_io_desc[] __initdata = { |
| 32 | { |
| 33 | .virtual = LOKI_REGS_VIRT_BASE, |
| 34 | .pfn = __phys_to_pfn(LOKI_REGS_PHYS_BASE), |
| 35 | .length = LOKI_REGS_SIZE, |
| 36 | .type = MT_DEVICE, |
| 37 | }, |
| 38 | }; |
| 39 | |
| 40 | void __init loki_map_io(void) |
| 41 | { |
| 42 | iotable_init(loki_io_desc, ARRAY_SIZE(loki_io_desc)); |
| 43 | } |
| 44 | |
| 45 | |
| 46 | /***************************************************************************** |
Andrew Lunn | 7e3819d | 2011-05-15 13:32:44 +0200 | [diff] [blame^] | 47 | * GE00 |
Lennert Buytenhek | 777f9be | 2008-06-22 22:45:02 +0200 | [diff] [blame] | 48 | ****************************************************************************/ |
Lennert Buytenhek | 777f9be | 2008-06-22 22:45:02 +0200 | [diff] [blame] | 49 | void __init loki_ge0_init(struct mv643xx_eth_platform_data *eth_data) |
| 50 | { |
Lennert Buytenhek | 777f9be | 2008-06-22 22:45:02 +0200 | [diff] [blame] | 51 | writel(0x00079220, GE0_VIRT_BASE + 0x20b0); |
Andrew Lunn | 7e3819d | 2011-05-15 13:32:44 +0200 | [diff] [blame^] | 52 | |
| 53 | orion_ge00_init(eth_data, &loki_mbus_dram_info, |
| 54 | GE0_PHYS_BASE, IRQ_LOKI_GBE_A_INT, |
| 55 | 0, LOKI_TCLK); |
Lennert Buytenhek | 777f9be | 2008-06-22 22:45:02 +0200 | [diff] [blame] | 56 | } |
| 57 | |
| 58 | |
| 59 | /***************************************************************************** |
Andrew Lunn | 7e3819d | 2011-05-15 13:32:44 +0200 | [diff] [blame^] | 60 | * GE01 |
Lennert Buytenhek | 777f9be | 2008-06-22 22:45:02 +0200 | [diff] [blame] | 61 | ****************************************************************************/ |
Lennert Buytenhek | 777f9be | 2008-06-22 22:45:02 +0200 | [diff] [blame] | 62 | void __init loki_ge1_init(struct mv643xx_eth_platform_data *eth_data) |
| 63 | { |
Lennert Buytenhek | 777f9be | 2008-06-22 22:45:02 +0200 | [diff] [blame] | 64 | writel(0x00079220, GE1_VIRT_BASE + 0x20b0); |
Andrew Lunn | 7e3819d | 2011-05-15 13:32:44 +0200 | [diff] [blame^] | 65 | |
| 66 | orion_ge01_init(eth_data, &loki_mbus_dram_info, |
| 67 | GE1_PHYS_BASE, IRQ_LOKI_GBE_B_INT, |
| 68 | 0, LOKI_TCLK); |
Lennert Buytenhek | 777f9be | 2008-06-22 22:45:02 +0200 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | |
| 72 | /***************************************************************************** |
| 73 | * SAS/SATA |
| 74 | ****************************************************************************/ |
| 75 | static struct resource loki_sas_resources[] = { |
| 76 | { |
| 77 | .name = "mvsas0 mem", |
| 78 | .start = SAS0_PHYS_BASE, |
| 79 | .end = SAS0_PHYS_BASE + 0x01ff, |
| 80 | .flags = IORESOURCE_MEM, |
| 81 | }, { |
| 82 | .name = "mvsas0 irq", |
| 83 | .start = IRQ_LOKI_SAS_A, |
| 84 | .end = IRQ_LOKI_SAS_A, |
| 85 | .flags = IORESOURCE_IRQ, |
| 86 | }, { |
| 87 | .name = "mvsas1 mem", |
| 88 | .start = SAS1_PHYS_BASE, |
| 89 | .end = SAS1_PHYS_BASE + 0x01ff, |
| 90 | .flags = IORESOURCE_MEM, |
| 91 | }, { |
| 92 | .name = "mvsas1 irq", |
| 93 | .start = IRQ_LOKI_SAS_B, |
| 94 | .end = IRQ_LOKI_SAS_B, |
| 95 | .flags = IORESOURCE_IRQ, |
| 96 | }, |
| 97 | }; |
| 98 | |
| 99 | static struct platform_device loki_sas = { |
| 100 | .name = "mvsas", |
| 101 | .id = 0, |
| 102 | .dev = { |
Andrew Lunn | 5c60255 | 2011-05-15 13:32:40 +0200 | [diff] [blame] | 103 | .coherent_dma_mask = DMA_BIT_MASK(32), |
Lennert Buytenhek | 777f9be | 2008-06-22 22:45:02 +0200 | [diff] [blame] | 104 | }, |
| 105 | .num_resources = ARRAY_SIZE(loki_sas_resources), |
| 106 | .resource = loki_sas_resources, |
| 107 | }; |
| 108 | |
| 109 | void __init loki_sas_init(void) |
| 110 | { |
| 111 | writel(0x8300f707, DDR_REG(0x1424)); |
| 112 | platform_device_register(&loki_sas); |
| 113 | } |
| 114 | |
| 115 | |
| 116 | /***************************************************************************** |
| 117 | * UART0 |
| 118 | ****************************************************************************/ |
Lennert Buytenhek | 777f9be | 2008-06-22 22:45:02 +0200 | [diff] [blame] | 119 | void __init loki_uart0_init(void) |
| 120 | { |
Andrew Lunn | 28a2b45 | 2011-05-15 13:32:41 +0200 | [diff] [blame] | 121 | orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE, |
| 122 | IRQ_LOKI_UART0, LOKI_TCLK); |
Lennert Buytenhek | 777f9be | 2008-06-22 22:45:02 +0200 | [diff] [blame] | 123 | } |
| 124 | |
Lennert Buytenhek | 777f9be | 2008-06-22 22:45:02 +0200 | [diff] [blame] | 125 | /***************************************************************************** |
| 126 | * UART1 |
| 127 | ****************************************************************************/ |
Lennert Buytenhek | 777f9be | 2008-06-22 22:45:02 +0200 | [diff] [blame] | 128 | void __init loki_uart1_init(void) |
| 129 | { |
Andrew Lunn | 28a2b45 | 2011-05-15 13:32:41 +0200 | [diff] [blame] | 130 | orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE, |
| 131 | IRQ_LOKI_UART1, LOKI_TCLK); |
Lennert Buytenhek | 777f9be | 2008-06-22 22:45:02 +0200 | [diff] [blame] | 132 | } |
| 133 | |
| 134 | |
| 135 | /***************************************************************************** |
| 136 | * Time handling |
| 137 | ****************************************************************************/ |
Lennert Buytenhek | 4ee1f6b | 2010-10-15 16:50:26 +0200 | [diff] [blame] | 138 | void __init loki_init_early(void) |
| 139 | { |
| 140 | orion_time_set_base(TIMER_VIRT_BASE); |
| 141 | } |
| 142 | |
Lennert Buytenhek | 777f9be | 2008-06-22 22:45:02 +0200 | [diff] [blame] | 143 | static void loki_timer_init(void) |
| 144 | { |
Lennert Buytenhek | 4ee1f6b | 2010-10-15 16:50:26 +0200 | [diff] [blame] | 145 | orion_time_init(BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR, |
| 146 | IRQ_LOKI_BRIDGE, LOKI_TCLK); |
Lennert Buytenhek | 777f9be | 2008-06-22 22:45:02 +0200 | [diff] [blame] | 147 | } |
| 148 | |
| 149 | struct sys_timer loki_timer = { |
| 150 | .init = loki_timer_init, |
| 151 | }; |
| 152 | |
| 153 | |
| 154 | /***************************************************************************** |
| 155 | * General |
| 156 | ****************************************************************************/ |
| 157 | void __init loki_init(void) |
| 158 | { |
| 159 | printk(KERN_INFO "Loki ID: 88RC8480. TCLK=%d.\n", LOKI_TCLK); |
| 160 | |
| 161 | loki_setup_cpu_mbus(); |
| 162 | } |