Merge branch 'mxs/for-arnd' of git://git.linaro.org/people/shawnguo/linux-2.6 into...
[pandora-kernel.git] / arch / arm / mach-omap2 / omap_l3_noc.c
index 8f18357..6a66aa5 100644 (file)
@@ -20,6 +20,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  * USA
  */
+#include <linux/module.h>
 #include <linux/init.h>
 #include <linux/io.h>
 #include <linux/platform_device.h>
@@ -56,11 +57,11 @@ static irqreturn_t l3_interrupt_handler(int irq, void *_l3)
 {
 
        struct omap4_l3 *l3 = _l3;
-       int inttype, i;
+       int inttype, i, k;
        int err_src = 0;
-       u32 std_err_main, err_reg, clear;
+       u32 std_err_main, err_reg, clear, masterid;
        void __iomem *base, *l3_targ_base;
-       char *source_name;
+       char *target_name, *master_name = "UN IDENTIFIED";
 
        /* Get the Type of interrupt */
        inttype = irq == l3->app_irq ? L3_APPLICATION_ERROR : L3_DEBUG_ERROR;
@@ -83,13 +84,15 @@ static irqreturn_t l3_interrupt_handler(int irq, void *_l3)
                        l3_targ_base = base + *(l3_targ[i] + err_src);
                        std_err_main =  __raw_readl(l3_targ_base +
                                        L3_TARG_STDERRLOG_MAIN);
+                       masterid = __raw_readl(l3_targ_base +
+                                       L3_TARG_STDERRLOG_MSTADDR);
 
                        switch (std_err_main & CUSTOM_ERROR) {
                        case STANDARD_ERROR:
-                               source_name =
+                               target_name =
                                        l3_targ_inst_name[i][err_src];
-                               WARN(true, "L3 standard error: SOURCE:%s at address 0x%x\n",
-                                       source_name,
+                               WARN(true, "L3 standard error: TARGET:%s at address 0x%x\n",
+                                       target_name,
                                        __raw_readl(l3_targ_base +
                                                L3_TARG_STDERRLOG_SLVOFSLSB));
                                /* clear the std error log*/
@@ -99,11 +102,15 @@ static irqreturn_t l3_interrupt_handler(int irq, void *_l3)
                                break;
 
                        case CUSTOM_ERROR:
-                               source_name =
+                               target_name =
                                        l3_targ_inst_name[i][err_src];
-
-                               WARN(true, "L3 custom error: SOURCE:%s\n",
-                                       source_name);
+                               for (k = 0; k < NUM_OF_L3_MASTERS; k++) {
+                                       if (masterid == l3_masters[k].id)
+                                               master_name =
+                                                       l3_masters[k].name;
+                               }
+                               WARN(true, "L3 custom error: MASTER:%s TARGET:%s\n",
+                                       master_name, target_name);
                                /* clear the std error log*/
                                clear = std_err_main | CLEAR_STDERR_LOG;
                                writel(clear, l3_targ_base +
@@ -121,7 +128,7 @@ static irqreturn_t l3_interrupt_handler(int irq, void *_l3)
        return IRQ_HANDLED;
 }
 
-static int __init omap4_l3_probe(struct platform_device *pdev)
+static int __devinit omap4_l3_probe(struct platform_device *pdev)
 {
        static struct omap4_l3 *l3;
        struct resource *res;
@@ -212,7 +219,7 @@ err0:
        return ret;
 }
 
-static int __exit omap4_l3_remove(struct platform_device *pdev)
+static int __devexit omap4_l3_remove(struct platform_device *pdev)
 {
        struct omap4_l3 *l3 = platform_get_drvdata(pdev);
 
@@ -226,16 +233,29 @@ static int __exit omap4_l3_remove(struct platform_device *pdev)
        return 0;
 }
 
+#if defined(CONFIG_OF)
+static const struct of_device_id l3_noc_match[] = {
+       {.compatible = "ti,omap4-l3-noc", },
+       {},
+}
+MODULE_DEVICE_TABLE(of, l3_noc_match);
+#else
+#define l3_noc_match NULL
+#endif
+
 static struct platform_driver omap4_l3_driver = {
-       .remove = __exit_p(omap4_l3_remove),
-       .driver = {
-       .name = "omap_l3_noc",
+       .probe          = omap4_l3_probe,
+       .remove         = __devexit_p(omap4_l3_remove),
+       .driver         = {
+               .name           = "omap_l3_noc",
+               .owner          = THIS_MODULE,
+               .of_match_table = l3_noc_match,
        },
 };
 
 static int __init omap4_l3_init(void)
 {
-       return platform_driver_probe(&omap4_l3_driver, omap4_l3_probe);
+       return platform_driver_register(&omap4_l3_driver);
 }
 postcore_initcall_sync(omap4_l3_init);