From patchwork Mon Oct 21 00:08:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 177004 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp2665511ill; Sun, 20 Oct 2019 17:10:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqzz2tPfvHZMS52jNboJF5Se7IStaw2Jd9wyqvwfr/vBsRgdKguysGfBgvR7NFTc/PDlu8iz X-Received: by 2002:a17:906:edb7:: with SMTP id sa23mr19696571ejb.263.1571616646506; Sun, 20 Oct 2019 17:10:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571616646; cv=none; d=google.com; s=arc-20160816; b=PeiaEBDnBz0EUUlvAaLldiUbAR2181pr0lw3UNIDx3y6RehQC+fkF/wR0/hHL/ABOx e7cctLB+LKPuj4PiSbGw4lnCYBRIlejjq/rkwLCsX9SsMc9pBJC4J0qiiF2C+ndZcu+8 IPe06j9cY4MagqzY1sD9sdtfHblQbn4UfwY1+miRDze12JAIUDeO2StImXxPY0X+IfTj +4wIftRC/o6EVn6qK2sy8mg0dsc50aYgRXoplRn32RJx1sW7EGGZNenXKQwkINnthagU HsWHdRUzItALJhBhHAvv2knWKnYlEfgUE14n1FyAauu0lfJGSw6iOgmPUM6hvDXFA1WN PyXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=q+ctxv8RRYH9UHhPygjo4LsS0z8/6tCihoymd1vpL+Y=; b=BCmggL0YB4z04HNZ7UapMR3ex6wO+eUv7OsXWN/CM08SUKBnx5eH7DJ/iOS/3wama/ l3+U1pQAb0z3tI5mkwlTosLA9U9A5QIGqlFmKXnIS8cgw8twE5D5IfN9/7DfiMiHa8Eo r8Cdzgv88JB7UQHcfKlQOk4YIcfqHtwBRnG4p6MbwnSTP+ga9rcNYrVWNfk7+Gm4jdti mrSj4yFWucaxbEmgm3iW01YGIm0tefIyFTb/gRUO2JuqGJAOyaa4x2nIbX8Gx8OQukqF AxmdUf7jwpqrA+HazEqK/2gUxuOuLelGIl/fmRnkDygZJrMLd9e796aW7Vr60zEKgL5b fAGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dpl+avsM; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h49si574683edh.2.2019.10.20.17.10.45; Sun, 20 Oct 2019 17:10:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dpl+avsM; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726875AbfJUAKp (ORCPT + 8 others); Sun, 20 Oct 2019 20:10:45 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:44914 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726576AbfJUAKo (ORCPT ); Sun, 20 Oct 2019 20:10:44 -0400 Received: by mail-lj1-f195.google.com with SMTP id m13so11318407ljj.11 for ; Sun, 20 Oct 2019 17:10:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=q+ctxv8RRYH9UHhPygjo4LsS0z8/6tCihoymd1vpL+Y=; b=dpl+avsMBk2oF+F75HFzsHb+4ohPfWZKw4xzpnz2r0q+0K87kvkG0vHZ4XO6X118tj qsvuUDXzHIW5opt31kjQ0sbujyzdc32SMzjyv8GBHQb6v0eQnKCWlcVefPFUnni/Lf2B R6BVKCa/g6OnnZRQU3CSQijSxUMPVe/8Hakc2MiWUBlTeeykEJtlpnzgejSWKh/Mxu/w 1GtpVHwmTyUi5gM3+XdKwyw6uAbMh5VThtzPVl8BjLrRAFwdngvNzXmMZsNoZCh0Q4BO fz018bf+HNQnlUH3pgilKnRAeFWm1xroMGu10FDTvZHcha8QuvcUuQe3XSuBbpmd9iqR 2YCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=q+ctxv8RRYH9UHhPygjo4LsS0z8/6tCihoymd1vpL+Y=; b=rrPNvFe5oV+tvwLwCXolp3mEpQ7fF6Ja93arD2+iv92we+U6n9w+hQlDX+NifGJCPG vOav51XEwnFGWDh7K/2Y2ER/8w9u3hzJJkjhevqTNcfYc14gaognKzlYZuvkqqb2VtUa 2A9x8EIp9n44Ndlx8yalPEgQYfw7wGnf9HeAtPnH8VNj//Vd8xurwfoI+lk20x6XNQvV R/43gBA3cuPY0YPCQ1EczStSuVegpcOmrGnUk/6DI4zkq6WQAY/Vkj6FNHOjUuLNEUE/ h4RPUy9VzjvrWP5GvzYCcrTdPzZo49MApHChBFMXDh+P41yCvJ8+4/dfA5kB1iyp98EO 5jNA== X-Gm-Message-State: APjAAAVUjYtI4pShRBksq2uN0Fscs48pdkIkNQAmIPaPtW26YkaD5MA4 Ub4raCDzM2AU8P6NJ4ZwRQLvC8wwRDc= X-Received: by 2002:a2e:2901:: with SMTP id u1mr12964731lje.78.1571616640059; Sun, 20 Oct 2019 17:10:40 -0700 (PDT) Received: from localhost.bredbandsbolaget (c-79c8225c.014-348-6c756e10.bbcust.telenor.se. [92.34.200.121]) by smtp.gmail.com with ESMTPSA id a18sm2723081lfi.15.2019.10.20.17.10.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Oct 2019 17:10:38 -0700 (PDT) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" Cc: Arnd Bergmann , Linus Walleij Subject: [PATCH 09/10] net: ethernet: ixp4xx: Get port ID from base address Date: Mon, 21 Oct 2019 02:08:23 +0200 Message-Id: <20191021000824.531-10-linus.walleij@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191021000824.531-1-linus.walleij@linaro.org> References: <20191021000824.531-1-linus.walleij@linaro.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The port->id was picked from the platform device .id field, but this is not supposed to be used for passing around random numbers in hardware. Identify the port ID number from the base address instead. Signed-off-by: Linus Walleij --- drivers/net/ethernet/xscale/ixp4xx_eth.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) -- 2.21.0 diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index 60cff1bce113..0996046bd046 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c @@ -1385,7 +1385,6 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) SET_NETDEV_DEV(ndev, dev); port = netdev_priv(ndev); port->netdev = ndev; - port->id = pdev->id; /* Get the port resource and remap */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -1394,13 +1393,15 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) regs_phys = res->start; port->regs = devm_ioremap_resource(dev, res); - switch (port->id) { - case IXP4XX_ETH_NPEA: + switch (res->start) { + case 0xc800c000: + port->id = IXP4XX_ETH_NPEA; /* If the MDIO bus is not up yet, defer probe */ if (!mdio_bus) return -EPROBE_DEFER; break; - case IXP4XX_ETH_NPEB: + case 0xc8009000: + port->id = IXP4XX_ETH_NPEB; /* * On all except IXP43x, NPE-B is used for the MDIO bus. * If there is no NPE-B in the feature set, bail out, else @@ -1417,7 +1418,8 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) if (!mdio_bus) return -EPROBE_DEFER; break; - case IXP4XX_ETH_NPEC: + case 0xc800a000: + port->id = IXP4XX_ETH_NPEC; /* * IXP43x lacks NPE-B and uses NPE-C for the MDIO bus access, * of there is no NPE-C, no bus, nothing works, so bail out.