From patchwork Thu Nov 24 09:18:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil Kovvuri X-Patchwork-Id: 9445019 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B0A3B606DB for ; Thu, 24 Nov 2016 09:21:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 91D28279E0 for ; Thu, 24 Nov 2016 09:21:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8254127CF5; Thu, 24 Nov 2016 09:21:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1966A279E0 for ; Thu, 24 Nov 2016 09:21:30 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1c9qBa-0006sO-G0; Thu, 24 Nov 2016 09:19:18 +0000 Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c9qBA-0006Xl-S3 for linux-arm-kernel@lists.infradead.org; Thu, 24 Nov 2016 09:18:54 +0000 Received: by mail-pg0-x243.google.com with SMTP id x23so2978776pgx.3 for ; Thu, 24 Nov 2016 01:18:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5U79Umk2e+nJWRLYUL30WfY0mF5WREE+odMOamujZJo=; b=nFOnGAmfkVNoAhLlSero4k8QF/A99eWrGdaXKoJ+82o+OBIN0szux5ISNYySzPyOSu lDCUgwT3zvDZT9laCwI2bwJiGd+8lKnw2Ya42I5k+68Fh0fRj71Y3EaIxWUk4uOwYzb0 +N4YnjDHPSe5DWPiXhV+9rvPq8ZkOypx4YJxdcIlRKNChVOSMmhMMatcRK3byEzQm6mF XMR2hUencV9kZDtZjnc8CL5DOqCgtvI0YoduUDjYaqrEp2Ys0Bw/3TqTRtX7ec84PegH ff1jt6440Iz+YKJZqsJQ6bTZLLagk7YE16DoiSgHEg4Al6e8HxJBwYe40MqS6ZZJLdFK LMNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5U79Umk2e+nJWRLYUL30WfY0mF5WREE+odMOamujZJo=; b=jP58tTq/c4g+Xesfy5GRdWia8xwLqeaCjJSdRPjOjk/UkMrSXAlBY/UmGxEPKG4XPn X7q3wvGXJia5GDRzsCyuEPEEBEod2pLbM1vC6NInn1cwaWPELQGgc6pguKuw8nbft5v8 bUa3oC3eQdDui96rEG6p/BA11cskVdBafl+xmTNzooyHZng/w0W6ojpCutJ1h4BUo/82 klf2uqeZ/p4/Dl1wK7nwnz9m7FvX665yTNOitJ3aI3de6rbhjWrlQyC4LP8eV/PkeQOY Wi0Dm/SZdJjunUtvjZHdmmi1WDCrpsUE9FCV80yzu4TN+FmduN8Acofts/J4Mg0u5oUt nOGQ== X-Gm-Message-State: AKaTC01g8IebKQugvGh85IW//+Yik4jXCN9dU9RmkBHt6V+/Jk0q6EOCfy9TnxKKUbuUPg== X-Received: by 10.84.173.195 with SMTP id p61mr3301020plb.68.1479979117075; Thu, 24 Nov 2016 01:18:37 -0800 (PST) Received: from machine421.in.caveonetworks.com ([14.140.2.178]) by smtp.googlemail.com with ESMTPSA id p64sm58609319pfi.88.2016.11.24.01.18.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 24 Nov 2016 01:18:36 -0800 (PST) From: sunil.kovvuri@gmail.com To: netdev@vger.kernel.org Subject: [PATCH 1/4] net: thunderx: 80xx BGX0 configuration changes Date: Thu, 24 Nov 2016 14:48:00 +0530 Message-Id: <1479979083-15963-2-git-send-email-sunil.kovvuri@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1479979083-15963-1-git-send-email-sunil.kovvuri@gmail.com> References: <1479979083-15963-1-git-send-email-sunil.kovvuri@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161124_011853_062491_E6895032 X-CRM114-Status: GOOD ( 14.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sunil Goutham , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sunil Goutham On 80xx only one lane of DLM0 and DLM1 (of BGX0) can be used , so even though lmac count may be 2 but LMAC1 should use serdes lane of DLM1. Since it's not possible to distinguish 80xx from 81xx as PCI devid are same, this patch adds this config support by replying on what firmware configures the lmacs with. Signed-off-by: Sunil Goutham --- drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c index 050e21f..1d6214b 100644 --- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c +++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c @@ -970,11 +970,25 @@ static void bgx_set_lmac_config(struct bgx *bgx, u8 idx) lmac_set_training(bgx, lmac, lmac->lmacid); lmac_set_lane2sds(bgx, lmac); - /* Set LMAC type of other lmac on same DLM i.e LMAC 1/3 */ olmac = &bgx->lmac[idx + 1]; - olmac->lmac_type = lmac->lmac_type; + /* Check if other LMAC on the same DLM is already configured by + * firmware, if so use the same config or else set as same, as + * that of LMAC 0/2. + * This check is needed as on 80xx only one lane of each of the + * DLM of BGX0 is used, so have to rely on firmware for + * distingushing 80xx from 81xx. + */ + cmr_cfg = bgx_reg_read(bgx, idx + 1, BGX_CMRX_CFG); + lmac_type = (u8)((cmr_cfg >> 8) & 0x07); + lane_to_sds = (u8)(cmr_cfg & 0xFF); + if ((lmac_type == 0) && (lane_to_sds == 0xE4)) { + olmac->lmac_type = lmac->lmac_type; + lmac_set_lane2sds(bgx, olmac); + } else { + olmac->lmac_type = lmac_type; + olmac->lane_to_sds = lane_to_sds; + } lmac_set_training(bgx, olmac, olmac->lmacid); - lmac_set_lane2sds(bgx, olmac); } }