From patchwork Wed Sep 21 23:05:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 76724 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp2297309qgf; Wed, 21 Sep 2016 16:06:11 -0700 (PDT) X-Received: by 10.98.20.137 with SMTP id 131mr49643035pfu.11.1474499171547; Wed, 21 Sep 2016 16:06:11 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y68si555077pfk.180.2016.09.21.16.06.11; Wed, 21 Sep 2016 16:06:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933861AbcIUXFw (ORCPT + 27 others); Wed, 21 Sep 2016 19:05:52 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:34413 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933364AbcIUXFq (ORCPT ); Wed, 21 Sep 2016 19:05:46 -0400 Received: by mail-pf0-f195.google.com with SMTP id 21so2939816pfy.1; Wed, 21 Sep 2016 16:05:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=+FDcSegfUctawCUPyp1c0fp+9N5IvKh0whbN9nXgIT8=; b=quT9t5jPHcArAP6PiDIzskLjdGNGrdhyN2lcNgrHTrli9PPrNAh8y2hIE6mPysn0/G P3hbzTu0XIJhFLsjRsBYEQOFrHlp4J4Aj4Af5BEY90cf3Wg0gAeyy4SQ7+HPBo0YpKg9 Pa5Xrr/NynihghaLU/seYoAmY7XB6SYhVZnftTjao4Y0XcTaH5Gs01EcmaAe8vR/wGRc dixn8nq0bjYB1OD3UHexfIimyRwr+/dRsblDzOLW1THQFPZUOCdKlI08hvWNgEd6e13N brlRFrefupVXtD1Z5pp/163vDfWCxeFRlLZTdAWgqUhzzq1NhzrYmKvpFDE9iP7bYNGR Eyvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=+FDcSegfUctawCUPyp1c0fp+9N5IvKh0whbN9nXgIT8=; b=gtTT7+djGB4DuksTBuRzlj8f7I97Dg+IFjS1rUfFjNU4sx4BJwPvLpauCq/tIRmjar TeR+OUE6UuJtdDi/2voumnS6ewJIj72ZMEAex70cEUeoMSIjgXrfM5HaP/CERPY8D7Kc GrtAvm12XIMITm70MbtQS7ebQYcc20e1j2qslAsHbYGo9D3XLyK9ywc/VgOheCtewbbe POJH+3qB14GbWuJQNVphhuesgQDDUV84pzBiFoSPczBuMwblUkRhOQoSvCFXs0/u+4TM gM7mMwh3rHw4ygzdqUu+WNKIEXDk8sdDY93P/GCB9yw4ELINIYO+ZCJ+n1+WZK4iI0qD NsKg== X-Gm-Message-State: AE9vXwMVGN/gaJN2j7iMMReFnBpYCv1oc34+UdNBrnUXiG0s51KolBA7cO+hiIVxBQPHjg== X-Received: by 10.98.141.146 with SMTP id p18mr58523480pfk.17.1474499145378; Wed, 21 Sep 2016 16:05:45 -0700 (PDT) Received: from aurora.jms.id.au ([2403:480:11:8000:c0f3:c161:fe9a:f6bb]) by smtp.gmail.com with ESMTPSA id t21sm284069pfa.71.2016.09.21.16.05.40 (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 21 Sep 2016 16:05:44 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Thu, 22 Sep 2016 08:35:36 +0930 From: Joel Stanley To: davem@davemloft.net Cc: clg@kaod.org, gwshan@linux.vnet.ibm.com, andrew@lunn.ch, andrew@aj.id.au, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, benh@kernel.crashing.org Subject: [PATCH net-next v2 3/6] net/faraday: Adapt for Aspeed SoCs Date: Thu, 22 Sep 2016 08:35:00 +0930 Message-Id: <20160921230503.23309-4-joel@jms.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160921230503.23309-1-joel@jms.id.au> References: <20160921230503.23309-1-joel@jms.id.au> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The RXDES and TXDES registers bits in the ftgmac100 indicates EDO{R,T}R at bit position 15 for the Faraday Tech IP. However, the version of this IP present in the Aspeed SoCs has these bits at position 30 in the registers. It appers that ast2400 SoCs support both positions, with the 15th bit marked as reserved but still functional. In the ast2500 this bit is reused for another function, so we need a work around. This was confirmed with engineers from Aspeed that using bit 30 is correct for both the ast2400 and ast2500 SoCs. Signed-off-by: Joel Stanley --- drivers/net/ethernet/faraday/ftgmac100.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) -- 2.9.3 diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c index 62a88d1a1f99..47f512224b57 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1345,9 +1345,6 @@ static int ftgmac100_probe(struct platform_device *pdev) priv->netdev = netdev; priv->dev = &pdev->dev; - priv->rxdes0_edorr_mask = BIT(15); - priv->txdes0_edotr_mask = BIT(15); - spin_lock_init(&priv->tx_lock); /* initialize NAPI */ @@ -1381,6 +1378,16 @@ static int ftgmac100_probe(struct platform_device *pdev) FTGMAC100_INT_PHYSTS_CHG | FTGMAC100_INT_RPKT_BUF | FTGMAC100_INT_NO_RXBUF); + + if (of_machine_is_compatible("aspeed,ast2400") || + of_machine_is_compatible("aspeed,ast2500")) { + priv->rxdes0_edorr_mask = BIT(30); + priv->txdes0_edotr_mask = BIT(30); + } else { + priv->rxdes0_edorr_mask = BIT(15); + priv->txdes0_edotr_mask = BIT(15); + } + if (pdev->dev.of_node && of_get_property(pdev->dev.of_node, "use-ncsi", NULL)) { if (!IS_ENABLED(CONFIG_NET_NCSI)) {