Blame view
arch/arm/mach-spear6xx/spear6xx.c
4.15 KB
8f590d454 ARM: 6015/1: ST S... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
/* * arch/arm/mach-spear6xx/spear6xx.c * * SPEAr6XX machines common source file * * Copyright (C) 2009 ST Microelectronics * Rajeev Kumar<rajeev-dlh.kumar@st.com> * * 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. */ #include <linux/types.h> #include <linux/amba/pl061.h> |
8f590d454 ARM: 6015/1: ST S... |
16 17 18 19 20 |
#include <linux/ptrace.h> #include <linux/io.h> #include <asm/hardware/vic.h> #include <asm/irq.h> #include <asm/mach/arch.h> |
8f590d454 ARM: 6015/1: ST S... |
21 |
#include <mach/generic.h> |
02aa06bc4 ARM: 6788/1: SPEA... |
22 |
#include <mach/hardware.h> |
410782beb ARM: 6787/1: SPEA... |
23 |
#include <mach/irqs.h> |
8f590d454 ARM: 6015/1: ST S... |
24 25 |
/* Add spear6xx machines common devices here */ |
b595076a1 tree-wide: fix co... |
26 |
/* uart device registration */ |
8f590d454 ARM: 6015/1: ST S... |
27 28 29 30 31 32 33 |
struct amba_device uart_device[] = { { .dev = { .init_name = "uart0", }, .res = { .start = SPEAR6XX_ICM1_UART0_BASE, |
53821162f ARM: 6792/1: SPEA... |
34 |
.end = SPEAR6XX_ICM1_UART0_BASE + SZ_4K - 1, |
8f590d454 ARM: 6015/1: ST S... |
35 36 37 38 39 40 41 42 43 |
.flags = IORESOURCE_MEM, }, .irq = {IRQ_UART_0, NO_IRQ}, }, { .dev = { .init_name = "uart1", }, .res = { .start = SPEAR6XX_ICM1_UART1_BASE, |
53821162f ARM: 6792/1: SPEA... |
44 |
.end = SPEAR6XX_ICM1_UART1_BASE + SZ_4K - 1, |
8f590d454 ARM: 6015/1: ST S... |
45 46 47 48 49 |
.flags = IORESOURCE_MEM, }, .irq = {IRQ_UART_1, NO_IRQ}, } }; |
b595076a1 tree-wide: fix co... |
50 |
/* gpio device registration */ |
8f590d454 ARM: 6015/1: ST S... |
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
static struct pl061_platform_data gpio_plat_data[] = { { .gpio_base = 0, .irq_base = SPEAR_GPIO0_INT_BASE, }, { .gpio_base = 8, .irq_base = SPEAR_GPIO1_INT_BASE, }, { .gpio_base = 16, .irq_base = SPEAR_GPIO2_INT_BASE, }, }; struct amba_device gpio_device[] = { { .dev = { .init_name = "gpio0", .platform_data = &gpio_plat_data[0], }, .res = { .start = SPEAR6XX_CPU_GPIO_BASE, |
53821162f ARM: 6792/1: SPEA... |
72 |
.end = SPEAR6XX_CPU_GPIO_BASE + SZ_4K - 1, |
8f590d454 ARM: 6015/1: ST S... |
73 74 75 76 77 78 79 80 81 82 |
.flags = IORESOURCE_MEM, }, .irq = {IRQ_LOCAL_GPIO, NO_IRQ}, }, { .dev = { .init_name = "gpio1", .platform_data = &gpio_plat_data[1], }, .res = { .start = SPEAR6XX_ICM3_GPIO_BASE, |
53821162f ARM: 6792/1: SPEA... |
83 |
.end = SPEAR6XX_ICM3_GPIO_BASE + SZ_4K - 1, |
8f590d454 ARM: 6015/1: ST S... |
84 85 86 87 88 89 90 91 92 93 |
.flags = IORESOURCE_MEM, }, .irq = {IRQ_BASIC_GPIO, NO_IRQ}, }, { .dev = { .init_name = "gpio2", .platform_data = &gpio_plat_data[2], }, .res = { .start = SPEAR6XX_ICM2_GPIO_BASE, |
53821162f ARM: 6792/1: SPEA... |
94 |
.end = SPEAR6XX_ICM2_GPIO_BASE + SZ_4K - 1, |
8f590d454 ARM: 6015/1: ST S... |
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
.flags = IORESOURCE_MEM, }, .irq = {IRQ_APPL_GPIO, NO_IRQ}, } }; /* This will add devices, and do machine specific tasks */ void __init spear6xx_init(void) { /* nothing to do for now */ } /* This will initialize vic */ void __init spear6xx_init_irq(void) { vic_init((void __iomem *)VA_SPEAR6XX_CPU_VIC_PRI_BASE, 0, ~0, 0); vic_init((void __iomem *)VA_SPEAR6XX_CPU_VIC_SEC_BASE, 32, ~0, 0); } /* Following will create static virtual/physical mappings */ static struct map_desc spear6xx_io_desc[] __initdata = { { .virtual = VA_SPEAR6XX_ICM1_UART0_BASE, .pfn = __phys_to_pfn(SPEAR6XX_ICM1_UART0_BASE), |
53821162f ARM: 6792/1: SPEA... |
119 |
.length = SZ_4K, |
8f590d454 ARM: 6015/1: ST S... |
120 121 122 123 |
.type = MT_DEVICE }, { .virtual = VA_SPEAR6XX_CPU_VIC_PRI_BASE, .pfn = __phys_to_pfn(SPEAR6XX_CPU_VIC_PRI_BASE), |
53821162f ARM: 6792/1: SPEA... |
124 |
.length = SZ_4K, |
8f590d454 ARM: 6015/1: ST S... |
125 126 127 128 |
.type = MT_DEVICE }, { .virtual = VA_SPEAR6XX_CPU_VIC_SEC_BASE, .pfn = __phys_to_pfn(SPEAR6XX_CPU_VIC_SEC_BASE), |
53821162f ARM: 6792/1: SPEA... |
129 |
.length = SZ_4K, |
8f590d454 ARM: 6015/1: ST S... |
130 131 132 133 |
.type = MT_DEVICE }, { .virtual = VA_SPEAR6XX_ICM3_SYS_CTRL_BASE, .pfn = __phys_to_pfn(SPEAR6XX_ICM3_SYS_CTRL_BASE), |
53821162f ARM: 6792/1: SPEA... |
134 |
.length = SZ_4K, |
8f590d454 ARM: 6015/1: ST S... |
135 136 137 138 |
.type = MT_DEVICE }, { .virtual = VA_SPEAR6XX_ICM3_MISC_REG_BASE, .pfn = __phys_to_pfn(SPEAR6XX_ICM3_MISC_REG_BASE), |
53821162f ARM: 6792/1: SPEA... |
139 |
.length = SZ_4K, |
8f590d454 ARM: 6015/1: ST S... |
140 141 142 143 144 145 146 147 148 149 |
.type = MT_DEVICE }, }; /* This will create static memory mapping for selected devices */ void __init spear6xx_map_io(void) { iotable_init(spear6xx_io_desc, ARRAY_SIZE(spear6xx_io_desc)); /* This will initialize clock framework */ |
b997f6e2c ARM: 6926/1: SPEA... |
150 |
spear6xx_clk_init(); |
8f590d454 ARM: 6015/1: ST S... |
151 |
} |
5c881d9ae ARM: 6737/1: SPEA... |
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
static void __init spear6xx_timer_init(void) { char pclk_name[] = "pll3_48m_clk"; struct clk *gpt_clk, *pclk; /* 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 ", __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 ", __func__, pclk_name); BUG(); } clk_set_parent(gpt_clk, pclk); clk_put(gpt_clk); clk_put(pclk); spear_setup_timer(); } struct sys_timer spear6xx_timer = { .init = spear6xx_timer_init, }; |