aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJayachandran C <jchandra@broadcom.com>2014-05-09 07:05:34 -0400
committerRalf Baechle <ralf@linux-mips.org>2014-05-30 10:48:42 -0400
commit0d57eba02d6f0685e61763502962fcf00fd4e4cc (patch)
tree4e60a010e7a774c0abe987f64c9fb0cf13ba4744
parente9126418dd7a86bee32d2dae37df403f7f1e2a13 (diff)
MIPS: Netlogic: IRQ mapping for some more SoC blocks
Add IRQ to IRT (PIC interupt table index) mapping for SATA, GPIO, NAND and SPI interfaces on the XLP SoC. Fix offsets for few blocks and add device IDs for a few blocks. Signed-off-by: Jayachandran C <jchandra@broadcom.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/6911/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--arch/mips/include/asm/netlogic/xlp-hal/iomap.h16
-rw-r--r--arch/mips/include/asm/netlogic/xlp-hal/xlp.h4
-rw-r--r--arch/mips/netlogic/xlp/nlm_hal.c84
3 files changed, 69 insertions, 35 deletions
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/iomap.h b/arch/mips/include/asm/netlogic/xlp-hal/iomap.h
index 1f23dfaa7167..14b2f5142c6e 100644
--- a/arch/mips/include/asm/netlogic/xlp-hal/iomap.h
+++ b/arch/mips/include/asm/netlogic/xlp-hal/iomap.h
@@ -74,6 +74,8 @@
74#define XLP_IO_USB_OHCI2_OFFSET(node) XLP_HDR_OFFSET(node, 0, 2, 4) 74#define XLP_IO_USB_OHCI2_OFFSET(node) XLP_HDR_OFFSET(node, 0, 2, 4)
75#define XLP_IO_USB_OHCI3_OFFSET(node) XLP_HDR_OFFSET(node, 0, 2, 5) 75#define XLP_IO_USB_OHCI3_OFFSET(node) XLP_HDR_OFFSET(node, 0, 2, 5)
76 76
77#define XLP_IO_SATA_OFFSET(node) XLP_HDR_OFFSET(node, 0, 3, 2)
78
77/* XLP2xx has an updated USB block */ 79/* XLP2xx has an updated USB block */
78#define XLP2XX_IO_USB_OFFSET(node, i) XLP_HDR_OFFSET(node, 0, 4, i) 80#define XLP2XX_IO_USB_OFFSET(node, i) XLP_HDR_OFFSET(node, 0, 4, i)
79#define XLP2XX_IO_USB_XHCI0_OFFSET(node) XLP_HDR_OFFSET(node, 0, 4, 1) 81#define XLP2XX_IO_USB_XHCI0_OFFSET(node) XLP_HDR_OFFSET(node, 0, 4, 1)
@@ -103,13 +105,11 @@
103#define XLP_IO_SYS_OFFSET(node) XLP_HDR_OFFSET(node, 0, 6, 5) 105#define XLP_IO_SYS_OFFSET(node) XLP_HDR_OFFSET(node, 0, 6, 5)
104#define XLP_IO_JTAG_OFFSET(node) XLP_HDR_OFFSET(node, 0, 6, 6) 106#define XLP_IO_JTAG_OFFSET(node) XLP_HDR_OFFSET(node, 0, 6, 6)
105 107
108/* Flash */
106#define XLP_IO_NOR_OFFSET(node) XLP_HDR_OFFSET(node, 0, 7, 0) 109#define XLP_IO_NOR_OFFSET(node) XLP_HDR_OFFSET(node, 0, 7, 0)
107#define XLP_IO_NAND_OFFSET(node) XLP_HDR_OFFSET(node, 0, 7, 1) 110#define XLP_IO_NAND_OFFSET(node) XLP_HDR_OFFSET(node, 0, 7, 1)
108#define XLP_IO_SPI_OFFSET(node) XLP_HDR_OFFSET(node, 0, 7, 2) 111#define XLP_IO_SPI_OFFSET(node) XLP_HDR_OFFSET(node, 0, 7, 2)
109/* SD flash */ 112#define XLP_IO_MMC_OFFSET(node) XLP_HDR_OFFSET(node, 0, 7, 3)
110#define XLP_IO_SD_OFFSET(node) XLP_HDR_OFFSET(node, 0, 7, 3)
111#define XLP_IO_MMC_OFFSET(node, slot) \
112 ((XLP_IO_SD_OFFSET(node))+(slot*0x100)+XLP_IO_PCI_HDRSZ)
113 113
114/* Things have changed drastically in XLP 9XX */ 114/* Things have changed drastically in XLP 9XX */
115#define XLP9XX_HDR_OFFSET(n, d, f) \ 115#define XLP9XX_HDR_OFFSET(n, d, f) \
@@ -135,11 +135,11 @@
135/* XLP9XX on-chip SATA controller */ 135/* XLP9XX on-chip SATA controller */
136#define XLP9XX_IO_SATA_OFFSET(node) XLP9XX_HDR_OFFSET(node, 3, 2) 136#define XLP9XX_IO_SATA_OFFSET(node) XLP9XX_HDR_OFFSET(node, 3, 2)
137 137
138/* Flash */
138#define XLP9XX_IO_NOR_OFFSET(node) XLP9XX_HDR_OFFSET(node, 7, 0) 139#define XLP9XX_IO_NOR_OFFSET(node) XLP9XX_HDR_OFFSET(node, 7, 0)
139#define XLP9XX_IO_NAND_OFFSET(node) XLP9XX_HDR_OFFSET(node, 7, 1) 140#define XLP9XX_IO_NAND_OFFSET(node) XLP9XX_HDR_OFFSET(node, 7, 1)
140#define XLP9XX_IO_SPI_OFFSET(node) XLP9XX_HDR_OFFSET(node, 7, 2) 141#define XLP9XX_IO_SPI_OFFSET(node) XLP9XX_HDR_OFFSET(node, 7, 2)
141/* SD flash */ 142#define XLP9XX_IO_MMC_OFFSET(node) XLP9XX_HDR_OFFSET(node, 7, 3)
142#define XLP9XX_IO_MMCSD_OFFSET(node) XLP9XX_HDR_OFFSET(node, 7, 3)
143 143
144/* PCI config header register id's */ 144/* PCI config header register id's */
145#define XLP_PCI_CFGREG0 0x00 145#define XLP_PCI_CFGREG0 0x00
@@ -186,8 +186,10 @@
186#define PCI_DEVICE_ID_NLM_NOR 0x1015 186#define PCI_DEVICE_ID_NLM_NOR 0x1015
187#define PCI_DEVICE_ID_NLM_NAND 0x1016 187#define PCI_DEVICE_ID_NLM_NAND 0x1016
188#define PCI_DEVICE_ID_NLM_MMC 0x1018 188#define PCI_DEVICE_ID_NLM_MMC 0x1018
189#define PCI_DEVICE_ID_NLM_XHCI 0x101d 189#define PCI_DEVICE_ID_NLM_SATA 0x101A
190#define PCI_DEVICE_ID_NLM_XHCI 0x101D
190 191
192#define PCI_DEVICE_ID_XLP9XX_MMC 0x9018
191#define PCI_DEVICE_ID_XLP9XX_SATA 0x901A 193#define PCI_DEVICE_ID_XLP9XX_SATA 0x901A
192#define PCI_DEVICE_ID_XLP9XX_XHCI 0x901D 194#define PCI_DEVICE_ID_XLP9XX_XHCI 0x901D
193 195
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/xlp.h b/arch/mips/include/asm/netlogic/xlp-hal/xlp.h
index 2b0c9599ebe5..bd7dda096506 100644
--- a/arch/mips/include/asm/netlogic/xlp-hal/xlp.h
+++ b/arch/mips/include/asm/netlogic/xlp-hal/xlp.h
@@ -58,6 +58,10 @@
58#define PIC_I2C_1_IRQ 31 58#define PIC_I2C_1_IRQ 31
59#define PIC_I2C_2_IRQ 32 59#define PIC_I2C_2_IRQ 32
60#define PIC_I2C_3_IRQ 33 60#define PIC_I2C_3_IRQ 33
61#define PIC_SPI_IRQ 34
62#define PIC_NAND_IRQ 37
63#define PIC_SATA_IRQ 38
64#define PIC_GPIO_IRQ 39
61 65
62#define PIC_PCIE_LINK_MSI_IRQ_BASE 44 /* 44 - 47 MSI IRQ */ 66#define PIC_PCIE_LINK_MSI_IRQ_BASE 44 /* 44 - 47 MSI IRQ */
63#define PIC_PCIE_LINK_MSI_IRQ(i) (44 + (i)) 67#define PIC_PCIE_LINK_MSI_IRQ(i) (44 + (i))
diff --git a/arch/mips/netlogic/xlp/nlm_hal.c b/arch/mips/netlogic/xlp/nlm_hal.c
index 7b277cda31f3..9f9814d646a9 100644
--- a/arch/mips/netlogic/xlp/nlm_hal.c
+++ b/arch/mips/netlogic/xlp/nlm_hal.c
@@ -66,31 +66,39 @@ void nlm_node_init(int node)
66 spin_lock_init(&nodep->piclock); 66 spin_lock_init(&nodep->piclock);
67} 67}
68 68
69int nlm_irq_to_irt(int irq) 69static int xlp9xx_irq_to_irt(int irq)
70{
71 switch (irq) {
72 case PIC_GPIO_IRQ:
73 return 12;
74 case PIC_9XX_XHCI_0_IRQ:
75 return 114;
76 case PIC_9XX_XHCI_1_IRQ:
77 return 115;
78 case PIC_UART_0_IRQ:
79 return 133;
80 case PIC_UART_1_IRQ:
81 return 134;
82 case PIC_SATA_IRQ:
83 return 143;
84 case PIC_SPI_IRQ:
85 return 152;
86 case PIC_MMC_IRQ:
87 return 153;
88 case PIC_PCIE_LINK_LEGACY_IRQ(0):
89 case PIC_PCIE_LINK_LEGACY_IRQ(1):
90 case PIC_PCIE_LINK_LEGACY_IRQ(2):
91 case PIC_PCIE_LINK_LEGACY_IRQ(3):
92 return 191 + irq - PIC_PCIE_LINK_LEGACY_IRQ_BASE;
93 }
94 return -1;
95}
96
97static int xlp_irq_to_irt(int irq)
70{ 98{
71 uint64_t pcibase; 99 uint64_t pcibase;
72 int devoff, irt; 100 int devoff, irt;
73 101
74 /* bypass for 9xx */
75 if (cpu_is_xlp9xx()) {
76 switch (irq) {
77 case PIC_9XX_XHCI_0_IRQ:
78 return 114;
79 case PIC_9XX_XHCI_1_IRQ:
80 return 115;
81 case PIC_UART_0_IRQ:
82 return 133;
83 case PIC_UART_1_IRQ:
84 return 134;
85 case PIC_PCIE_LINK_LEGACY_IRQ(0):
86 case PIC_PCIE_LINK_LEGACY_IRQ(1):
87 case PIC_PCIE_LINK_LEGACY_IRQ(2):
88 case PIC_PCIE_LINK_LEGACY_IRQ(3):
89 return 191 + irq - PIC_PCIE_LINK_LEGACY_IRQ_BASE;
90 }
91 return -1;
92 }
93
94 devoff = 0; 102 devoff = 0;
95 switch (irq) { 103 switch (irq) {
96 case PIC_UART_0_IRQ: 104 case PIC_UART_0_IRQ:
@@ -100,7 +108,7 @@ int nlm_irq_to_irt(int irq)
100 devoff = XLP_IO_UART1_OFFSET(0); 108 devoff = XLP_IO_UART1_OFFSET(0);
101 break; 109 break;
102 case PIC_MMC_IRQ: 110 case PIC_MMC_IRQ:
103 devoff = XLP_IO_SD_OFFSET(0); 111 devoff = XLP_IO_MMC_OFFSET(0);
104 break; 112 break;
105 case PIC_I2C_0_IRQ: /* I2C will be fixed up */ 113 case PIC_I2C_0_IRQ: /* I2C will be fixed up */
106 case PIC_I2C_1_IRQ: 114 case PIC_I2C_1_IRQ:
@@ -111,6 +119,18 @@ int nlm_irq_to_irt(int irq)
111 else 119 else
112 devoff = XLP_IO_I2C0_OFFSET(0); 120 devoff = XLP_IO_I2C0_OFFSET(0);
113 break; 121 break;
122 case PIC_SATA_IRQ:
123 devoff = XLP_IO_SATA_OFFSET(0);
124 break;
125 case PIC_GPIO_IRQ:
126 devoff = XLP_IO_GPIO_OFFSET(0);
127 break;
128 case PIC_NAND_IRQ:
129 devoff = XLP_IO_NAND_OFFSET(0);
130 break;
131 case PIC_SPI_IRQ:
132 devoff = XLP_IO_SPI_OFFSET(0);
133 break;
114 default: 134 default:
115 if (cpu_is_xlpii()) { 135 if (cpu_is_xlpii()) {
116 switch (irq) { 136 switch (irq) {
@@ -166,18 +186,26 @@ int nlm_irq_to_irt(int irq)
166 /* HW bug, PCI IRT entries are bad on early silicon, fix */ 186 /* HW bug, PCI IRT entries are bad on early silicon, fix */
167 irt = PIC_IRT_PCIE_LINK_INDEX(irq - 187 irt = PIC_IRT_PCIE_LINK_INDEX(irq -
168 PIC_PCIE_LINK_LEGACY_IRQ_BASE); 188 PIC_PCIE_LINK_LEGACY_IRQ_BASE);
169 } else if (irq >= PIC_PCIE_LINK_MSI_IRQ(0) &&
170 irq <= PIC_PCIE_LINK_MSI_IRQ(3)) {
171 irt = -2;
172 } else if (irq >= PIC_PCIE_MSIX_IRQ(0) &&
173 irq <= PIC_PCIE_MSIX_IRQ(3)) {
174 irt = -2;
175 } else { 189 } else {
176 irt = -1; 190 irt = -1;
177 } 191 }
178 return irt; 192 return irt;
179} 193}
180 194
195int nlm_irq_to_irt(int irq)
196{
197 /* return -2 for irqs without 1-1 mapping */
198 if (irq >= PIC_PCIE_LINK_MSI_IRQ(0) && irq <= PIC_PCIE_LINK_MSI_IRQ(3))
199 return -2;
200 if (irq >= PIC_PCIE_MSIX_IRQ(0) && irq <= PIC_PCIE_MSIX_IRQ(3))
201 return -2;
202
203 if (cpu_is_xlp9xx())
204 return xlp9xx_irq_to_irt(irq);
205 else
206 return xlp_irq_to_irt(irq);
207}
208
181unsigned int nlm_get_core_frequency(int node, int core) 209unsigned int nlm_get_core_frequency(int node, int core)
182{ 210{
183 unsigned int pll_divf, pll_divr, dfs_div, ext_div; 211 unsigned int pll_divf, pll_divr, dfs_div, ext_div;