2 * OMAP4XXX L3 Interconnect error handling driver
4 * Copyright (C) 2011 Texas Corporation
5 * Santosh Shilimkar <santosh.shilimkar@ti.com>
6 * Sricharan <r.sricharan@ti.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 #include <linux/init.h>
25 #include <linux/platform_device.h>
26 #include <linux/interrupt.h>
27 #include <linux/kernel.h>
28 #include <linux/slab.h>
30 #include "omap_l3_noc.h"
33 * Interrupt Handler for L3 error detection.
34 * 1) Identify the L3 clockdomain partition to which the error belongs to.
35 * 2) Identify the slave where the error information is logged
36 * 3) Print the logged information.
37 * 4) Add dump stack to provide kernel trace.
39 * Two Types of errors :
40 * 1) Custom errors in L3 :
41 * Target like DMM/FW/EMIF generates SRESP=ERR error
42 * 2) Standard L3 error:
44 * L3 tries to access target while it is idle
46 * - Address hole error:
47 * If DSS/ISS/FDIF/USBHOSTFS access a target where they
48 * do not have connectivity, the error is logged in
49 * their default target which is DMM2.
51 * On High Secure devices, firewall errors are possible and those
52 * can be trapped as well. But the trapping is implemented as part
53 * secure software and hence need not be implemented here.
55 static irqreturn_t
l3_interrupt_handler(int irq
, void *_l3
)
58 struct omap4_l3
*l3
= _l3
;
61 u32 std_err_main_addr
, std_err_main
, err_reg
;
62 u32 base
, slave_addr
, clear
;
65 /* Get the Type of interrupt */
66 if (irq
== l3
->app_irq
)
67 inttype
= L3_APPLICATION_ERROR
;
69 inttype
= L3_DEBUG_ERROR
;
71 for (i
= 0; i
< L3_MODULES
; i
++) {
73 * Read the regerr register of the clock domain
74 * to determine the source
76 base
= (u32
)l3
->l3_base
[i
];
77 err_reg
= readl(base
+ l3_flagmux
[i
] + (inttype
<< 3));
79 /* Get the corresponding error and analyse */
81 /* Identify the source from control status register */
82 for (j
= 0; !(err_reg
& (1 << j
)); j
++)
86 /* Read the stderrlog_main_source from clk domain */
87 std_err_main_addr
= base
+ (*(l3_targ
[i
] + err_src
));
88 std_err_main
= readl(std_err_main_addr
);
90 switch ((std_err_main
& CUSTOM_ERROR
)) {
93 l3_targ_stderrlog_main_name
[i
][err_src
];
95 slave_addr
= std_err_main_addr
+
96 L3_SLAVE_ADDRESS_OFFSET
;
97 WARN(true, "L3 standard error: SOURCE:%s at address 0x%x\n",
98 source_name
, readl(slave_addr
));
99 /* clear the std error log*/
100 clear
= std_err_main
| CLEAR_STDERR_LOG
;
101 writel(clear
, std_err_main_addr
);
106 l3_targ_stderrlog_main_name
[i
][err_src
];
108 WARN(true, "CUSTOM SRESP error with SOURCE:%s\n",
110 /* clear the std error log*/
111 clear
= std_err_main
| CLEAR_STDERR_LOG
;
112 writel(clear
, std_err_main_addr
);
116 /* Nothing to be handled here as of now */
119 /* Error found so break the for loop */
126 static int __init
omap4_l3_probe(struct platform_device
*pdev
)
128 static struct omap4_l3
*l3
;
129 struct resource
*res
;
133 l3
= kzalloc(sizeof(*l3
), GFP_KERNEL
);
137 platform_set_drvdata(pdev
, l3
);
138 res
= platform_get_resource(pdev
, IORESOURCE_MEM
, 0);
140 dev_err(&pdev
->dev
, "couldn't find resource 0\n");
145 l3
->l3_base
[0] = ioremap(res
->start
, resource_size(res
));
146 if (!(l3
->l3_base
[0])) {
147 dev_err(&pdev
->dev
, "ioremap failed\n");
152 res
= platform_get_resource(pdev
, IORESOURCE_MEM
, 1);
154 dev_err(&pdev
->dev
, "couldn't find resource 1\n");
159 l3
->l3_base
[1] = ioremap(res
->start
, resource_size(res
));
160 if (!(l3
->l3_base
[1])) {
161 dev_err(&pdev
->dev
, "ioremap failed\n");
166 res
= platform_get_resource(pdev
, IORESOURCE_MEM
, 2);
168 dev_err(&pdev
->dev
, "couldn't find resource 2\n");
173 l3
->l3_base
[2] = ioremap(res
->start
, resource_size(res
));
174 if (!(l3
->l3_base
[2])) {
175 dev_err(&pdev
->dev
, "ioremap failed\n");
181 * Setup interrupt Handlers
183 irq
= platform_get_irq(pdev
, 0);
184 ret
= request_irq(irq
,
185 l3_interrupt_handler
,
186 IRQF_DISABLED
, "l3-dbg-irq", l3
);
188 pr_crit("L3: request_irq failed to register for 0x%x\n",
189 OMAP44XX_IRQ_L3_DBG
);
194 irq
= platform_get_irq(pdev
, 1);
195 ret
= request_irq(irq
,
196 l3_interrupt_handler
,
197 IRQF_DISABLED
, "l3-app-irq", l3
);
199 pr_crit("L3: request_irq failed to register for 0x%x\n",
200 OMAP44XX_IRQ_L3_APP
);
208 free_irq(l3
->debug_irq
, l3
);
210 iounmap(l3
->l3_base
[2]);
212 iounmap(l3
->l3_base
[1]);
214 iounmap(l3
->l3_base
[0]);
220 static int __exit
omap4_l3_remove(struct platform_device
*pdev
)
222 struct omap4_l3
*l3
= platform_get_drvdata(pdev
);
224 free_irq(l3
->app_irq
, l3
);
225 free_irq(l3
->debug_irq
, l3
);
226 iounmap(l3
->l3_base
[0]);
227 iounmap(l3
->l3_base
[1]);
228 iounmap(l3
->l3_base
[2]);
234 static struct platform_driver omap4_l3_driver
= {
235 .remove
= __exit_p(omap4_l3_remove
),
237 .name
= "omap_l3_noc",
241 static int __init
omap4_l3_init(void)
243 return platform_driver_probe(&omap4_l3_driver
, omap4_l3_probe
);
245 postcore_initcall_sync(omap4_l3_init
);
247 static void __exit
omap4_l3_exit(void)
249 platform_driver_unregister(&omap4_l3_driver
);
251 module_exit(omap4_l3_exit
);