aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-integrator/core.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2012-11-17 13:24:23 -0500
committerLinus Walleij <linus.walleij@linaro.org>2012-11-17 13:38:27 -0500
commit379df2793efdca18e91cb8570f844ad1f83eb609 (patch)
tree6f61e172528c1fdade27517301787e4c0b174243 /arch/arm/mach-integrator/core.c
parent328ba305e3871d4256398a80f45517ec9c814999 (diff)
ARM: integrator: push down SC dependencies
This pushes the dependencies on the Integrator/AP system controller (SC) down into the PCI V3 driver and the AP-specific board file. First, the platform data for the PL010 UART is moved into the integrator_ap.c board file, and the Integrator/CP is assigned with NULL pdata. This way the callback functions can reference the dynamically remapped AP syscon address in both the ATAG and DT boot path, and this remapping is localized to the board file. Second the PCIv3 driver is making its own dynamic remapping of the SC for the few registers it is using. When we convert the PCIv3 driver over to using device tree having a dynamically assigned base address will be useful, but we will have to use the definition from <mach/platform.h> for now, the only improvement is that it's done dynamically. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'arch/arm/mach-integrator/core.c')
-rw-r--r--arch/arm/mach-integrator/core.c50
1 files changed, 4 insertions, 46 deletions
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index 161fbf8596bd..39c060f75e47 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -18,7 +18,6 @@
18#include <linux/memblock.h> 18#include <linux/memblock.h>
19#include <linux/sched.h> 19#include <linux/sched.h>
20#include <linux/smp.h> 20#include <linux/smp.h>
21#include <linux/termios.h>
22#include <linux/amba/bus.h> 21#include <linux/amba/bus.h>
23#include <linux/amba/serial.h> 22#include <linux/amba/serial.h>
24#include <linux/io.h> 23#include <linux/io.h>
@@ -47,10 +46,10 @@ static AMBA_APB_DEVICE(rtc, "rtc", 0,
47 INTEGRATOR_RTC_BASE, INTEGRATOR_RTC_IRQ, NULL); 46 INTEGRATOR_RTC_BASE, INTEGRATOR_RTC_IRQ, NULL);
48 47
49static AMBA_APB_DEVICE(uart0, "uart0", 0, 48static AMBA_APB_DEVICE(uart0, "uart0", 0,
50 INTEGRATOR_UART0_BASE, INTEGRATOR_UART0_IRQ, &integrator_uart_data); 49 INTEGRATOR_UART0_BASE, INTEGRATOR_UART0_IRQ, NULL);
51 50
52static AMBA_APB_DEVICE(uart1, "uart1", 0, 51static AMBA_APB_DEVICE(uart1, "uart1", 0,
53 INTEGRATOR_UART1_BASE, INTEGRATOR_UART1_IRQ, &integrator_uart_data); 52 INTEGRATOR_UART1_BASE, INTEGRATOR_UART1_IRQ, NULL);
54 53
55static AMBA_APB_DEVICE(kmi0, "kmi0", 0, KMI0_BASE, KMI0_IRQ, NULL); 54static AMBA_APB_DEVICE(kmi0, "kmi0", 0, KMI0_BASE, KMI0_IRQ, NULL);
56static AMBA_APB_DEVICE(kmi1, "kmi1", 0, KMI1_BASE, KMI1_IRQ, NULL); 55static AMBA_APB_DEVICE(kmi1, "kmi1", 0, KMI1_BASE, KMI1_IRQ, NULL);
@@ -78,6 +77,8 @@ int __init integrator_init(bool is_cp)
78 uart1_device.periphid = 0x00041010; 77 uart1_device.periphid = 0x00041010;
79 kmi0_device.periphid = 0x00041050; 78 kmi0_device.periphid = 0x00041050;
80 kmi1_device.periphid = 0x00041050; 79 kmi1_device.periphid = 0x00041050;
80 uart0_device.dev.platform_data = &ap_uart_data;
81 uart1_device.dev.platform_data = &ap_uart_data;
81 } 82 }
82 83
83 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 84 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
@@ -90,49 +91,6 @@ int __init integrator_init(bool is_cp)
90 91
91#endif 92#endif
92 93
93/*
94 * On the Integrator platform, the port RTS and DTR are provided by
95 * bits in the following SC_CTRLS register bits:
96 * RTS DTR
97 * UART0 7 6
98 * UART1 5 4
99 */
100#define SC_CTRLC __io_address(INTEGRATOR_SC_CTRLC)
101#define SC_CTRLS __io_address(INTEGRATOR_SC_CTRLS)
102
103static void integrator_uart_set_mctrl(struct amba_device *dev, void __iomem *base, unsigned int mctrl)
104{
105 unsigned int ctrls = 0, ctrlc = 0, rts_mask, dtr_mask;
106 u32 phybase = dev->res.start;
107
108 if (phybase == INTEGRATOR_UART0_BASE) {
109 /* UART0 */
110 rts_mask = 1 << 4;
111 dtr_mask = 1 << 5;
112 } else {
113 /* UART1 */
114 rts_mask = 1 << 6;
115 dtr_mask = 1 << 7;
116 }
117
118 if (mctrl & TIOCM_RTS)
119 ctrlc |= rts_mask;
120 else
121 ctrls |= rts_mask;
122
123 if (mctrl & TIOCM_DTR)
124 ctrlc |= dtr_mask;
125 else
126 ctrls |= dtr_mask;
127
128 __raw_writel(ctrls, SC_CTRLS);
129 __raw_writel(ctrlc, SC_CTRLC);
130}
131
132struct amba_pl010_data integrator_uart_data = {
133 .set_mctrl = integrator_uart_set_mctrl,
134};
135
136static DEFINE_RAW_SPINLOCK(cm_lock); 94static DEFINE_RAW_SPINLOCK(cm_lock);
137 95
138/** 96/**