From patchwork Tue Sep 20 06:30:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 76589 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp1323063qgf; Mon, 19 Sep 2016 23:31:22 -0700 (PDT) X-Received: by 10.98.78.72 with SMTP id c69mr11602326pfb.67.1474353082773; Mon, 19 Sep 2016 23:31:22 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e5si30458066paz.44.2016.09.19.23.31.22; Mon, 19 Sep 2016 23:31:22 -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 S1754142AbcITGbT (ORCPT + 27 others); Tue, 20 Sep 2016 02:31:19 -0400 Received: from mail-pa0-f68.google.com ([209.85.220.68]:36830 "EHLO mail-pa0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754020AbcITGbP (ORCPT ); Tue, 20 Sep 2016 02:31:15 -0400 Received: by mail-pa0-f68.google.com with SMTP id my20so454070pab.3; Mon, 19 Sep 2016 23:31:15 -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=EKcKU9uxiE+u5VCkzCE0ky8RjaNh3Y5W+tXIb5d+6Wo=; b=kfrOnKyIpfBYtFye/108egXgen9wZ6KuA2hnKQn59/LmIUogVuKshycxPeOBRkzFso R2SW1RysZ4JGNtIlIvrJVSdnRLQXkid9HmvL8Ci5V7VU8XvWyXy0rAVOj/Wbf0Z6fU0t wHrvVdnxMG4PIYl80fAFKmLvWOBU627FiE0/bP/Mw9XKeSe8btEF+9d2NSM9mSBQvO1i XpACQqMI74i1Pg4PsayvlAlvHxL0bhL+SwV79Nq4Dt9QzLMhk/uEqwyhHtt75IyV6Wz8 rnHuYwCL8yl0kBeHuz132IMFW7yu83mwZLatN6nWEH1aGFJ+XA7JrauMNzae7TtK9Ai4 vBfA== 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=EKcKU9uxiE+u5VCkzCE0ky8RjaNh3Y5W+tXIb5d+6Wo=; b=fCjbqHoAh1M+8jA6+e2Fv64zPgg8SOTOnrDoZ6ndJ31+oCCcw+J6HqEp82PXq0iQFR BsfRCcYup82sdGyq/FCpvuCseXWY9LfAXVanx0eHHUhEJzVO5JvSFtwVcjQ0+lvwtwnz 3dKh327osz6MkI4HEdh3vzU+ztd/cRXYQrYcVzaDql6sa3wf8+iqVAolfKZw/gCSGuwj th7Gtk7HJLhzvNkmzDVKp4KzsDa5oaODCsOJWjyJ0AZgmNoKoH1PSalz2bExdWY0xN3z M+ZLeoNmBqmF9XPkiZuSAajKq8Hl/O9erz7dwIG9AWAmGT9osIsAk+ViDg4elzFWMYZP Pwcg== X-Gm-Message-State: AE9vXwMc+fT96W/BQ8rPwSkGNpB2NXdLQBzZujeJOUpXZUGjmX77ukEDtgnD/tCwgUSWDw== X-Received: by 10.66.16.38 with SMTP id c6mr52329641pad.64.1474353074984; Mon, 19 Sep 2016 23:31:14 -0700 (PDT) Received: from aurora.jms.id.au ([203.0.153.9]) by smtp.gmail.com with ESMTPSA id 64sm27904557pfe.74.2016.09.19.23.31.10 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 19 Sep 2016 23:31:14 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Tue, 20 Sep 2016 16:01:07 +0930 From: Joel Stanley To: davem@davemloft.net Cc: 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 7/7] net/faraday: Configure old MDIO interface on Aspeed SoCs Date: Tue, 20 Sep 2016 16:00:07 +0930 Message-Id: <20160920063007.24291-8-joel@jms.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160920063007.24291-1-joel@jms.id.au> References: <20160920063007.24291-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 Aspeed SoCs have a new MDIO interface as an option in the G4 and G5 SoCs. The old one is still available, so select it in order to remain compatible with the ftgmac100 driver. Signed-off-by: Joel Stanley --- drivers/net/ethernet/faraday/ftgmac100.c | 9 +++++++++ drivers/net/ethernet/faraday/ftgmac100.h | 5 +++++ 2 files changed, 14 insertions(+) -- 2.9.3 diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c index 5466df028381..54c6ba3632a3 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1257,12 +1257,21 @@ static int ftgmac100_setup_mdio(struct net_device *netdev) struct ftgmac100 *priv = netdev_priv(netdev); struct platform_device *pdev = to_platform_device(priv->dev); int i, err = 0; + u32 reg; /* initialize mdio bus */ priv->mii_bus = mdiobus_alloc(); if (!priv->mii_bus) return -EIO; + if (of_machine_is_compatible("aspeed,ast2400") || + of_machine_is_compatible("aspeed,ast2500")) { + /* This driver supports the old MDIO interface */ + reg = ioread32(priv->base + FTGMAC100_OFFSET_REVR); + reg &= ~FTGMAC100_REVR_NEW_MDIO_INTERFACE; + iowrite32(reg, priv->base + FTGMAC100_OFFSET_REVR); + }; + priv->mii_bus->name = "ftgmac100_mdio"; snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s-%d", pdev->name, pdev->id); diff --git a/drivers/net/ethernet/faraday/ftgmac100.h b/drivers/net/ethernet/faraday/ftgmac100.h index d07b6ea5d1b5..a7ce0ac8858a 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.h +++ b/drivers/net/ethernet/faraday/ftgmac100.h @@ -134,6 +134,11 @@ #define FTGMAC100_DMAFIFOS_TXDMA_REQ (1 << 31) /* + * Feature Register + */ +#define FTGMAC100_REVR_NEW_MDIO_INTERFACE BIT(31) + +/* * Receive buffer size register */ #define FTGMAC100_RBSR_SIZE(x) ((x) & 0x3fff)