aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorGanesan Ramalingam <ganesanr@broadcom.com>2013-08-11 05:13:58 -0400
committerRalf Baechle <ralf@linux-mips.org>2013-09-03 17:22:20 -0400
commite5be1fd007e4fcbab3dd6e2b0993a7ee305c6628 (patch)
treee98e4e2d287949241f0fa8dab022db661f7398f6 /arch
parentc49e42aba8e8471e30e0ee4d29f9871a4ba67ae9 (diff)
MIPS: Netlogic: XLP2xx update for I2C controller
XLP2xx has a new I2C controller which has 4 buses connected to it. Update the IO offset and IRQ mapping code to reflect this. Signed-off-by: Ganesan Ramalingam <ganesanr@broadcom.com> Signed-off-by: Jayachandran C <jchandra@broadcom.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/5707/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/include/asm/netlogic/xlp-hal/iomap.h3
-rw-r--r--arch/mips/include/asm/netlogic/xlp-hal/xlp.h2
-rw-r--r--arch/mips/netlogic/xlp/nlm_hal.c23
3 files changed, 21 insertions, 7 deletions
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/iomap.h b/arch/mips/include/asm/netlogic/xlp-hal/iomap.h
index 9fac46fb7913..61c84de0ed4f 100644
--- a/arch/mips/include/asm/netlogic/xlp-hal/iomap.h
+++ b/arch/mips/include/asm/netlogic/xlp-hal/iomap.h
@@ -88,6 +88,9 @@
88#define XLP_IO_I2C0_OFFSET(node) XLP_HDR_OFFSET(node, 0, 6, 2) 88#define XLP_IO_I2C0_OFFSET(node) XLP_HDR_OFFSET(node, 0, 6, 2)
89#define XLP_IO_I2C1_OFFSET(node) XLP_HDR_OFFSET(node, 0, 6, 3) 89#define XLP_IO_I2C1_OFFSET(node) XLP_HDR_OFFSET(node, 0, 6, 3)
90#define XLP_IO_GPIO_OFFSET(node) XLP_HDR_OFFSET(node, 0, 6, 4) 90#define XLP_IO_GPIO_OFFSET(node) XLP_HDR_OFFSET(node, 0, 6, 4)
91/* on 2XX, all I2C busses are on the same block */
92#define XLP2XX_IO_I2C_OFFSET(node) XLP_HDR_OFFSET(node, 0, 6, 7)
93
91/* system management */ 94/* system management */
92#define XLP_IO_SYS_OFFSET(node) XLP_HDR_OFFSET(node, 0, 6, 5) 95#define XLP_IO_SYS_OFFSET(node) XLP_HDR_OFFSET(node, 0, 6, 5)
93#define XLP_IO_JTAG_OFFSET(node) XLP_HDR_OFFSET(node, 0, 6, 6) 96#define XLP_IO_JTAG_OFFSET(node) XLP_HDR_OFFSET(node, 0, 6, 6)
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/xlp.h b/arch/mips/include/asm/netlogic/xlp-hal/xlp.h
index 7a4a5142bbc5..4950ea502398 100644
--- a/arch/mips/include/asm/netlogic/xlp-hal/xlp.h
+++ b/arch/mips/include/asm/netlogic/xlp-hal/xlp.h
@@ -50,6 +50,8 @@
50#define PIC_MMC_IRQ 29 50#define PIC_MMC_IRQ 29
51#define PIC_I2C_0_IRQ 30 51#define PIC_I2C_0_IRQ 30
52#define PIC_I2C_1_IRQ 31 52#define PIC_I2C_1_IRQ 31
53#define PIC_I2C_2_IRQ 32
54#define PIC_I2C_3_IRQ 33
53 55
54#ifndef __ASSEMBLY__ 56#ifndef __ASSEMBLY__
55 57
diff --git a/arch/mips/netlogic/xlp/nlm_hal.c b/arch/mips/netlogic/xlp/nlm_hal.c
index 22e2e028fbe4..04adb75850f8 100644
--- a/arch/mips/netlogic/xlp/nlm_hal.c
+++ b/arch/mips/netlogic/xlp/nlm_hal.c
@@ -93,11 +93,14 @@ int nlm_irq_to_irt(int irq)
93 case PIC_MMC_IRQ: 93 case PIC_MMC_IRQ:
94 devoff = XLP_IO_SD_OFFSET(0); 94 devoff = XLP_IO_SD_OFFSET(0);
95 break; 95 break;
96 case PIC_I2C_0_IRQ: 96 case PIC_I2C_0_IRQ: /* I2C will be fixed up */
97 devoff = XLP_IO_I2C0_OFFSET(0);
98 break;
99 case PIC_I2C_1_IRQ: 97 case PIC_I2C_1_IRQ:
100 devoff = XLP_IO_I2C1_OFFSET(0); 98 case PIC_I2C_2_IRQ:
99 case PIC_I2C_3_IRQ:
100 if (cpu_is_xlpii())
101 devoff = XLP2XX_IO_I2C_OFFSET(0);
102 else
103 devoff = XLP_IO_I2C0_OFFSET(0);
101 break; 104 break;
102 default: 105 default:
103 devoff = 0; 106 devoff = 0;
@@ -107,9 +110,15 @@ int nlm_irq_to_irt(int irq)
107 if (devoff != 0) { 110 if (devoff != 0) {
108 pcibase = nlm_pcicfg_base(devoff); 111 pcibase = nlm_pcicfg_base(devoff);
109 irt = nlm_read_reg(pcibase, XLP_PCI_IRTINFO_REG) & 0xffff; 112 irt = nlm_read_reg(pcibase, XLP_PCI_IRTINFO_REG) & 0xffff;
110 /* HW bug, I2C 1 irt entry is off by one */ 113 /* HW weirdness, I2C IRT entry has to be fixed up */
111 if (irq == PIC_I2C_1_IRQ) 114 switch (irq) {
112 irt = irt + 1; 115 case PIC_I2C_1_IRQ:
116 irt = irt + 1; break;
117 case PIC_I2C_2_IRQ:
118 irt = irt + 2; break;
119 case PIC_I2C_3_IRQ:
120 irt = irt + 3; break;
121 }
113 } else if (irq >= PIC_PCIE_LINK_0_IRQ && irq <= PIC_PCIE_LINK_3_IRQ) { 122 } else if (irq >= PIC_PCIE_LINK_0_IRQ && irq <= PIC_PCIE_LINK_3_IRQ) {
114 /* HW bug, PCI IRT entries are bad on early silicon, fix */ 123 /* HW bug, PCI IRT entries are bad on early silicon, fix */
115 irt = PIC_IRT_PCIE_LINK_INDEX(irq - PIC_PCIE_LINK_0_IRQ); 124 irt = PIC_IRT_PCIE_LINK_INDEX(irq - PIC_PCIE_LINK_0_IRQ);