diff options
Diffstat (limited to 'arch/mips/netlogic/xlr/platform.c')
-rw-r--r-- | arch/mips/netlogic/xlr/platform.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/arch/mips/netlogic/xlr/platform.c b/arch/mips/netlogic/xlr/platform.c index 609ec2534642..eab64b45dffd 100644 --- a/arch/mips/netlogic/xlr/platform.c +++ b/arch/mips/netlogic/xlr/platform.c | |||
@@ -15,18 +15,19 @@ | |||
15 | #include <linux/serial_8250.h> | 15 | #include <linux/serial_8250.h> |
16 | #include <linux/serial_reg.h> | 16 | #include <linux/serial_reg.h> |
17 | 17 | ||
18 | #include <asm/netlogic/haldefs.h> | ||
18 | #include <asm/netlogic/xlr/iomap.h> | 19 | #include <asm/netlogic/xlr/iomap.h> |
19 | #include <asm/netlogic/xlr/pic.h> | 20 | #include <asm/netlogic/xlr/pic.h> |
20 | #include <asm/netlogic/xlr/xlr.h> | 21 | #include <asm/netlogic/xlr/xlr.h> |
21 | 22 | ||
22 | unsigned int nlm_xlr_uart_in(struct uart_port *p, int offset) | 23 | unsigned int nlm_xlr_uart_in(struct uart_port *p, int offset) |
23 | { | 24 | { |
24 | nlm_reg_t *mmio; | 25 | uint64_t uartbase; |
25 | unsigned int value; | 26 | unsigned int value; |
26 | 27 | ||
27 | /* XLR uart does not need any mapping of regs */ | 28 | /* sign extend to 64 bits, if needed */ |
28 | mmio = (nlm_reg_t *)(p->membase + (offset << p->regshift)); | 29 | uartbase = (uint64_t)(long)p->membase; |
29 | value = netlogic_read_reg(mmio, 0); | 30 | value = nlm_read_reg(uartbase, offset); |
30 | 31 | ||
31 | /* See XLR/XLS errata */ | 32 | /* See XLR/XLS errata */ |
32 | if (offset == UART_MSR) | 33 | if (offset == UART_MSR) |
@@ -39,10 +40,10 @@ unsigned int nlm_xlr_uart_in(struct uart_port *p, int offset) | |||
39 | 40 | ||
40 | void nlm_xlr_uart_out(struct uart_port *p, int offset, int value) | 41 | void nlm_xlr_uart_out(struct uart_port *p, int offset, int value) |
41 | { | 42 | { |
42 | nlm_reg_t *mmio; | 43 | uint64_t uartbase; |
43 | 44 | ||
44 | /* XLR uart does not need any mapping of regs */ | 45 | /* sign extend to 64 bits, if needed */ |
45 | mmio = (nlm_reg_t *)(p->membase + (offset << p->regshift)); | 46 | uartbase = (uint64_t)(long)p->membase; |
46 | 47 | ||
47 | /* See XLR/XLS errata */ | 48 | /* See XLR/XLS errata */ |
48 | if (offset == UART_MSR) | 49 | if (offset == UART_MSR) |
@@ -50,7 +51,7 @@ void nlm_xlr_uart_out(struct uart_port *p, int offset, int value) | |||
50 | else if (offset == UART_MCR) | 51 | else if (offset == UART_MCR) |
51 | value ^= 0x3; | 52 | value ^= 0x3; |
52 | 53 | ||
53 | netlogic_write_reg(mmio, 0, value); | 54 | nlm_write_reg(uartbase, offset, value); |
54 | } | 55 | } |
55 | 56 | ||
56 | #define PORT(_irq) \ | 57 | #define PORT(_irq) \ |
@@ -82,15 +83,15 @@ static struct platform_device uart_device = { | |||
82 | 83 | ||
83 | static int __init nlm_uart_init(void) | 84 | static int __init nlm_uart_init(void) |
84 | { | 85 | { |
85 | nlm_reg_t *mmio; | 86 | unsigned long uartbase; |
86 | 87 | ||
87 | mmio = netlogic_io_mmio(NETLOGIC_IO_UART_0_OFFSET); | 88 | uartbase = (unsigned long)nlm_mmio_base(NETLOGIC_IO_UART_0_OFFSET); |
88 | xlr_uart_data[0].membase = (void __iomem *)mmio; | 89 | xlr_uart_data[0].membase = (void __iomem *)uartbase; |
89 | xlr_uart_data[0].mapbase = CPHYSADDR((unsigned long)mmio); | 90 | xlr_uart_data[0].mapbase = CPHYSADDR(uartbase); |
90 | 91 | ||
91 | mmio = netlogic_io_mmio(NETLOGIC_IO_UART_1_OFFSET); | 92 | uartbase = (unsigned long)nlm_mmio_base(NETLOGIC_IO_UART_1_OFFSET); |
92 | xlr_uart_data[1].membase = (void __iomem *)mmio; | 93 | xlr_uart_data[1].membase = (void __iomem *)uartbase; |
93 | xlr_uart_data[1].mapbase = CPHYSADDR((unsigned long)mmio); | 94 | xlr_uart_data[1].mapbase = CPHYSADDR(uartbase); |
94 | 95 | ||
95 | return platform_device_register(&uart_device); | 96 | return platform_device_register(&uart_device); |
96 | } | 97 | } |