From patchwork Thu Apr 17 20:49:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Menon X-Patchwork-Id: 4010801 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EE375BFF02 for ; Thu, 17 Apr 2014 20:51:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 226F7202AE for ; Thu, 17 Apr 2014 20:51:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 22219202EB for ; Thu, 17 Apr 2014 20:51:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752263AbaDQUvE (ORCPT ); Thu, 17 Apr 2014 16:51:04 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:40711 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751446AbaDQUuK (ORCPT ); Thu, 17 Apr 2014 16:50:10 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s3HKnbRI019884; Thu, 17 Apr 2014 15:49:37 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s3HKnbht029821; Thu, 17 Apr 2014 15:49:37 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Thu, 17 Apr 2014 15:49:36 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s3HKnb3J014503; Thu, 17 Apr 2014 15:49:37 -0500 From: Nishanth Menon To: Tony Lindgren , Santosh Shilimkar , Sricharan R CC: Sekhar Nori , Rajendra Nayak , Nishanth Menon , Peter Ujfalusi , , , , Subject: [PATCH V2 13/19] bus: omap_l3_noc: make error reporting and handling common Date: Thu, 17 Apr 2014 15:49:29 -0500 Message-ID: <1397767775-10965-14-git-send-email-nm@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1397767775-10965-1-git-send-email-nm@ti.com> References: <1397492726-17203-1-git-send-email-nm@ti.com> <1397767775-10965-1-git-send-email-nm@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The logic between handling CUSTOM_ERROR and STANDARD_ERROR is just the reporting style. So make it generic, simplify and standardize the reporting with both master and target information printed to log. Handle the register address difference for master code for standard error and custom error as well. While at it, fix a minor indentation error. Signed-off-by: Nishanth Menon --- V2: reordering only V1: https://patchwork.kernel.org/patch/3983991/ drivers/bus/omap_l3_noc.c | 76 ++++++++++++++++++++++++++++----------------- drivers/bus/omap_l3_noc.h | 3 +- 2 files changed, 50 insertions(+), 29 deletions(-) diff --git a/drivers/bus/omap_l3_noc.c b/drivers/bus/omap_l3_noc.c index 29d6206..b03c415 100644 --- a/drivers/bus/omap_l3_noc.c +++ b/drivers/bus/omap_l3_noc.c @@ -62,6 +62,8 @@ static irqreturn_t l3_interrupt_handler(int irq, void *_l3) struct l3_target_data *l3_targ_inst; struct l3_flagmux_data *flag_mux; struct l3_masters_data *master; + char *err_description; + char err_string[30] = { 0 }; /* Get the Type of interrupt */ inttype = irq == l3->app_irq ? L3_APPLICATION_ERROR : L3_DEBUG_ERROR; @@ -78,6 +80,8 @@ static irqreturn_t l3_interrupt_handler(int irq, void *_l3) /* Get the corresponding error and analyse */ if (err_reg) { + bool std_err = true; + /* Identify the source from control status register */ err_src = __ffs(err_reg); @@ -123,48 +127,64 @@ static irqreturn_t l3_interrupt_handler(int irq, void *_l3) l3_targ_stderr = l3_targ_base + L3_TARG_STDERRLOG_MAIN; l3_targ_slvofslsb = l3_targ_base + L3_TARG_STDERRLOG_SLVOFSLSB; - l3_targ_mstaddr = l3_targ_base + - L3_TARG_STDERRLOG_MSTADDR; std_err_main = readl_relaxed(l3_targ_stderr); - /* - * STDERRLOG_MSTADDR Stores the NTTP master address. - * The 6 MSBs are used to distinguish the different - * initiators - */ - masterid = (readl_relaxed(l3_targ_mstaddr) & 0xFF) >> 2; switch (std_err_main & CUSTOM_ERROR) { case STANDARD_ERROR: - WARN(true, "L3 standard error: TARGET:%s at address 0x%x\n", - target_name, - readl_relaxed(l3_targ_slvofslsb)); - /* clear the std error log*/ - clear = std_err_main | CLEAR_STDERR_LOG; - writel_relaxed(clear, l3_targ_stderr); + err_description = "Standard"; + snprintf(err_string, sizeof(err_string), + ": At Address: 0x%08X ", + readl_relaxed(l3_targ_slvofslsb)); + + l3_targ_mstaddr = l3_targ_base + + L3_TARG_STDERRLOG_MSTADDR; break; case CUSTOM_ERROR: - for (k = 0, master = l3->l3_masters; - k < l3->num_masters; k++, master++) { - if (masterid == master->id) { - master_name = master->name; - break; - } - } - 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_relaxed(clear, l3_targ_stderr); + err_description = "Custom"; + + l3_targ_mstaddr = l3_targ_base + + L3_TARG_STDERRLOG_CINFO_MSTADDR; break; default: + std_err = false; /* Nothing to be handled here as of now */ break; } - /* Error found so break the for loop */ - break; + + if (!std_err) + break; + + /* + * STDERRLOG_MSTADDR Stores the NTTP master + * address. The 6 MSBs are used to distinguish + * the different initiators + */ + masterid = (readl_relaxed(l3_targ_mstaddr) & + 0xFF) >> 2; + + for (k = 0, master = l3->l3_masters; + k < l3->num_masters; k++, master++) { + if (masterid == master->id) { + master_name = master->name; + break; + } + } + + WARN(true, + "%s:L3 %s Error: MASTER %s TARGET %s%s\n", + dev_name(l3->dev), + err_description, + master_name, target_name, + err_string); + /* clear the std error log*/ + clear = std_err_main | CLEAR_STDERR_LOG; + writel_relaxed(clear, l3_targ_stderr); + + /* Error found so break the for loop */ + break; } } return IRQ_HANDLED; diff --git a/drivers/bus/omap_l3_noc.h b/drivers/bus/omap_l3_noc.h index 64869fe..18cdc25 100644 --- a/drivers/bus/omap_l3_noc.h +++ b/drivers/bus/omap_l3_noc.h @@ -29,8 +29,9 @@ /* L3 TARG register offsets */ #define L3_TARG_STDERRLOG_MAIN 0x48 +#define L3_TARG_STDERRLOG_MSTADDR 0x50 #define L3_TARG_STDERRLOG_SLVOFSLSB 0x5c -#define L3_TARG_STDERRLOG_MSTADDR 0x68 +#define L3_TARG_STDERRLOG_CINFO_MSTADDR 0x68 #define L3_FLAGMUX_REGERR0 0xc #define L3_FLAGMUX_MASK0 0x8