From patchwork Fri May 24 16:20:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 165128 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp3806448ili; Fri, 24 May 2019 09:20:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqy64ybVtuQP5wypmTfy2i1NE0fKVHrZjte/4rhzKX1a8mfMNlwhPLMp4JXXKpgoqH0SBy3E X-Received: by 2002:a62:14d6:: with SMTP id 205mr114094432pfu.4.1558714842767; Fri, 24 May 2019 09:20:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558714842; cv=none; d=google.com; s=arc-20160816; b=fJr2zSnGzIaJLxuGxfCNAgLnD1Bmw/iuOk8HY0NJhr7UYQlbug0SvXKX+/3c+1zjE3 6mE/CXFw1zpLHFvIUxqL+RU+wk0pxP3xuwcr6iWKAPQCW4O4jx9kTmdv+TtQqSxC388v sDga7DyDtKZbu3oJUlZe9PD2EcfLQG/YazKHYGQuBiG8zn7pY/1G1vAYA25hyBA0RRMR 73BDiyg2bW5cDAJvH1ANT8PnYa4vuKSuMQST0JSJVaTi0C6su50GFAXiS6xSm7mx2dKd MgdpJv4WkNdQmO0dZ4wHnwdJMppt2W0VnllAS8zcYQLVKeVuf9v6sb29cCApmLETCbk3 z1Ww== 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=LoimZJhuiC3VDcIUaJDNR8VzM40c8PjtWlQoyk09Hqw=; b=wiGx+c892y7kArz6XWY1UAgrlvznmi61jYjYAhr/cwo7L8XhReSrlJCndm8QRAJQWY JE1MwhycGvaIZHAy2ISYjCFv/Ot1BJt2hjSYj3+OlmyG1JaxMcJ3jK5wGWyA2UPeozL4 Ont6B2MQnxxtxbriddphnf97JUlzHvInyTGzKJrLolH/2nVpgtfrhj3pIl0EhmDVvMwG cZPi+FuEvG4Og9uR4pLV6VstsJ55E02d3izSFlyI2KE/+SLh8syrwyzoRJBXBOj4bVEU yYELjHQ4vBKk6ent4vfad9kwjoxoZYFEMbfo90CY2lTpwmWWVgJBgYWv+hk1x2NxZYYG c1PA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=plEXrYIt; 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 m14si5204608pgj.377.2019.05.24.09.20.41; Fri, 24 May 2019 09:20:42 -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=plEXrYIt; 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 S2390834AbfEXQUl (ORCPT + 9 others); Fri, 24 May 2019 12:20:41 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:39049 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390662AbfEXQUk (ORCPT ); Fri, 24 May 2019 12:20:40 -0400 Received: by mail-lf1-f66.google.com with SMTP id f1so7571186lfl.6 for ; Fri, 24 May 2019 09:20:38 -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=LoimZJhuiC3VDcIUaJDNR8VzM40c8PjtWlQoyk09Hqw=; b=plEXrYItN9TO/ik5u5tUB8RWHButrQ51yNOT5f7KnUxjmK4Rxk3qM6qh8r8ax5tGfw NtoJjyC8BM1nwS92a0ziPMwQZ2TxaHNz4Mvsqd4z7Rw9rArHGR3URX6i8fcBPbE+8WtM EvNohZtlaCxuoqZv9P4KfU3TukeCctqASewL66ptLjY+s2fKTj3NSzo8dYfyLaxvHRpj GnFwVRLoHCaFNJjHyiMcLXV/F3En0TXHAWCx17AsD0pj9uKFASY15bfQJhtjrBYSZqrd mq+zYtJvUrNhN+dLh3UVkFiJOVLaNMbEPY0ELUUP6cDzqOZEVkul5QmIssxP/O/mGYl+ MxhA== 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=LoimZJhuiC3VDcIUaJDNR8VzM40c8PjtWlQoyk09Hqw=; b=G0mxvF3TU/QOzBxI0wDeUm4kJ1xe+XEPsqDHBD4Jd323gw9ujiPMH+wijzI0Q+Hidh +2ZRQwSnC9fIwbbGczgLy51FDf5NlhyztPe6jZmq4h0HAEJAJtSiBnp23bdm0pzyh4mZ ECiA7c6w8wTQRkJ18DBAIDExsTgEI44H11be4TOAW8036znopQXOtNnlJjhbYT6FE9pe sYelnw1X/en9Q6sH9r2B7tRKB0Z+OAiGyoV2GHwpkKRL7fl8EgYN5+jvNJoWTJ13bUPY IQsTzzoxc8LiHS6GlAJq0HbKdOyfRa8tfoyWjM8/3ifupGOjzcbfIGXM9k0Daa72DMaK JfKA== X-Gm-Message-State: APjAAAXYXPD8E6gpP0j8E1BylnO2iCpeHiF1DTWhduwe9r5Tbhkk2+bz bz39IfZo9V6c83t43iIZnxqaOSbELUQ= X-Received: by 2002:ac2:4312:: with SMTP id l18mr39444415lfh.139.1558714837493; Fri, 24 May 2019 09:20:37 -0700 (PDT) Received: from localhost.bredbandsbolaget (c-d2cd225c.014-348-6c756e10.bbcust.telenor.se. [92.34.205.210]) by smtp.gmail.com with ESMTPSA id y4sm618075lje.24.2019.05.24.09.20.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 May 2019 09:20:36 -0700 (PDT) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" Cc: Krzysztof Halasa , Linus Walleij Subject: [PATCH 1/8] net: ethernet: ixp4xx: Standard module init Date: Fri, 24 May 2019 18:20:16 +0200 Message-Id: <20190524162023.9115-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190524162023.9115-1-linus.walleij@linaro.org> References: <20190524162023.9115-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 IXP4xx driver was initializing the MDIO bus before even probing, in the callbacks supposed to be used for setting up the module itself, and with the side effect of trying to register the MDIO bus as soon as this module was loaded or compiled into the kernel whether the device was discovered or not. This does not work with multiplatform environments. To get rid of this: set up the MDIO bus from the probe() callback and remove it in the remove() callback. Rename the probe() and remove() calls to reflect the most common conventions. Since there is a bit of checking for the ethernet feature to be present in the MDIO registering function, making the whole module not even be registered if we can't find an MDIO bus, we need something similar: register the MDIO bus when the corresponding ethernet is probed, and return -EPROBE_DEFER on the other interfaces until this happens. If no MDIO bus is present on any of the registered interfaces we will eventually bail out. None of the platforms I've seen has e.g. MDIO on EthB and only uses EthC, there is always a Ethernet hardware on the NPE (B, C) that has the MDIO bus, we just might have to wait for it. Signed-off-by: Linus Walleij --- drivers/net/ethernet/xscale/ixp4xx_eth.c | 82 ++++++++++++------------ 1 file changed, 40 insertions(+), 42 deletions(-) -- 2.20.1 diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index 319db3ece263..ae69836d0080 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c @@ -521,25 +521,14 @@ static int ixp4xx_mdio_write(struct mii_bus *bus, int phy_id, int location, return ret; } -static int ixp4xx_mdio_register(void) +static int ixp4xx_mdio_register(struct eth_regs __iomem *regs) { int err; if (!(mdio_bus = mdiobus_alloc())) return -ENOMEM; - if (cpu_is_ixp43x()) { - /* IXP43x lacks NPE-B and uses NPE-C for MII PHY access */ - if (!(ixp4xx_read_feature_bits() & IXP4XX_FEATURE_NPEC_ETH)) - return -ENODEV; - mdio_regs = (struct eth_regs __iomem *)IXP4XX_EthC_BASE_VIRT; - } else { - /* All MII PHY accesses use NPE-B Ethernet registers */ - if (!(ixp4xx_read_feature_bits() & IXP4XX_FEATURE_NPEB_ETH0)) - return -ENODEV; - mdio_regs = (struct eth_regs __iomem *)IXP4XX_EthB_BASE_VIRT; - } - + mdio_regs = regs; __raw_writel(DEFAULT_CORE_CNTRL, &mdio_regs->core_control); spin_lock_init(&mdio_lock); mdio_bus->name = "IXP4xx MII Bus"; @@ -1378,7 +1367,7 @@ static const struct net_device_ops ixp4xx_netdev_ops = { .ndo_validate_addr = eth_validate_addr, }; -static int eth_init_one(struct platform_device *pdev) +static int ixp4xx_eth_probe(struct platform_device *pdev) { struct port *port; struct net_device *dev; @@ -1398,14 +1387,46 @@ static int eth_init_one(struct platform_device *pdev) switch (port->id) { case IXP4XX_ETH_NPEA: + /* If the MDIO bus is not up yet, defer probe */ + if (!mdio_bus) + return -EPROBE_DEFER; port->regs = (struct eth_regs __iomem *)IXP4XX_EthA_BASE_VIRT; regs_phys = IXP4XX_EthA_BASE_PHYS; break; case 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 + * register the MDIO bus. + */ + if (!cpu_is_ixp43x()) { + if (!(ixp4xx_read_feature_bits() & + IXP4XX_FEATURE_NPEB_ETH0)) + return -ENODEV; + /* Else register the MDIO bus on NPE-B */ + if ((err = ixp4xx_mdio_register(IXP4XX_EthC_BASE_VIRT))) + return err; + } + if (!mdio_bus) + return -EPROBE_DEFER; port->regs = (struct eth_regs __iomem *)IXP4XX_EthB_BASE_VIRT; regs_phys = IXP4XX_EthB_BASE_PHYS; break; case 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. + */ + if (cpu_is_ixp43x()) { + if (!(ixp4xx_read_feature_bits() & + IXP4XX_FEATURE_NPEC_ETH)) + return -ENODEV; + /* Else register the MDIO bus on NPE-C */ + if ((err = ixp4xx_mdio_register(IXP4XX_EthC_BASE_VIRT))) + return err; + } + if (!mdio_bus) + return -EPROBE_DEFER; port->regs = (struct eth_regs __iomem *)IXP4XX_EthC_BASE_VIRT; regs_phys = IXP4XX_EthC_BASE_PHYS; break; @@ -1474,7 +1495,7 @@ static int eth_init_one(struct platform_device *pdev) return err; } -static int eth_remove_one(struct platform_device *pdev) +static int ixp4xx_eth_remove(struct platform_device *pdev) { struct net_device *dev = platform_get_drvdata(pdev); struct phy_device *phydev = dev->phydev; @@ -1482,6 +1503,7 @@ static int eth_remove_one(struct platform_device *pdev) unregister_netdev(dev); phy_disconnect(phydev); + ixp4xx_mdio_remove(); npe_port_tab[NPE_ID(port->id)] = NULL; npe_release(port->npe); release_resource(port->mem_res); @@ -1491,36 +1513,12 @@ static int eth_remove_one(struct platform_device *pdev) static struct platform_driver ixp4xx_eth_driver = { .driver.name = DRV_NAME, - .probe = eth_init_one, - .remove = eth_remove_one, + .probe = ixp4xx_eth_probe, + .remove = ixp4xx_eth_remove, }; - -static int __init eth_init_module(void) -{ - int err; - - /* - * FIXME: we bail out on device tree boot but this really needs - * to be fixed in a nicer way: this registers the MDIO bus before - * even matching the driver infrastructure, we should only probe - * detected hardware. - */ - if (of_have_populated_dt()) - return -ENODEV; - if ((err = ixp4xx_mdio_register())) - return err; - return platform_driver_register(&ixp4xx_eth_driver); -} - -static void __exit eth_cleanup_module(void) -{ - platform_driver_unregister(&ixp4xx_eth_driver); - ixp4xx_mdio_remove(); -} +module_platform_driver(ixp4xx_eth_driver); MODULE_AUTHOR("Krzysztof Halasa"); MODULE_DESCRIPTION("Intel IXP4xx Ethernet driver"); MODULE_LICENSE("GPL v2"); MODULE_ALIAS("platform:ixp4xx_eth"); -module_init(eth_init_module); -module_exit(eth_cleanup_module); From patchwork Fri May 24 16:20:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 165129 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp3806573ili; Fri, 24 May 2019 09:20:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqw4TsZx5EXBC4hmQlM8HJHCwF9JqkTCVyPcUBZaA5sYVxrxNV7Qa+1UV+ymnIC+ZOgwaDro X-Received: by 2002:a63:6e86:: with SMTP id j128mr3496033pgc.161.1558714847246; Fri, 24 May 2019 09:20:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558714847; cv=none; d=google.com; s=arc-20160816; b=PSc2VSi7ZLjqQk/qVppBW5l/Mwa57gRIR2YvHTEd8zeDWLCl3rFr9gka+uYtYbir8h IAM8q37WE282GIrXtjikhO1Tgd0/AoR8cFP3SdJ4ovsyq/9AJuFY+SbvIYrlniM9szYh DUXlRJ115PzyDM11GE5B/iLt0IpCXPOeYrkMOul6hU/qVRQ+Bqzhe+qBuLB33PoxcEyJ F+wnPAQpAmw++DH8Ob8/Z3ANLzOikJYpb5QP3UWvtSZ/F+o0TnY6MAz48b0ft9ykBPKv I6JnsILL6L+M6XsLL0UMxm/xBCFGrHf8suoUtmFFOk6rre9TvF5RuWWqFM7fKFY4Xdix vJ3g== 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=+YTaRWfG9Yuoc1VN58/KFdiQHjekpSnoND3oo5X7AWA=; b=dQ2VnF9Xi+2lOTOR951kqvmUlpX8PApw2tGx/lyBbvDT5ZUO4hs4Acx+ktREw1xzOs +GXKqoAoedrO6jBUrbJL8esNamUPGSPmAvaHCdHx+pfAdWKOHPz+n4xTFiy614V4MY2c TOWFv7XwRtP7ODmGOv+gMLft0GIzUKprkdyUQEUUCmR0JC2IIE2le/YdB1STYVkcoepq yAc2NTpk+o9/kLZyk0x2xycuO5V8SJmN89Dxyk3EmZz5gcs6W0g48I5vrb50Xkp26V1i yIlZTrjJHDYsytzhYtwCXLVSIrOuOBTfy+ExSuQWdqA5mhSMCRuT6Z2MgqvA3IqSSHfe 2vcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NjZRAoLx; 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 m14si5204608pgj.377.2019.05.24.09.20.46; Fri, 24 May 2019 09:20:47 -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=NjZRAoLx; 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 S2390874AbfEXQUp (ORCPT + 9 others); Fri, 24 May 2019 12:20:45 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:37598 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390662AbfEXQUp (ORCPT ); Fri, 24 May 2019 12:20:45 -0400 Received: by mail-lf1-f67.google.com with SMTP id m15so6970605lfh.4 for ; Fri, 24 May 2019 09:20:43 -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=+YTaRWfG9Yuoc1VN58/KFdiQHjekpSnoND3oo5X7AWA=; b=NjZRAoLxo+Ip5dEbPdESYrjYCfaLVSmU05FgO/wDT0mwXn769CYCivZYZEUqwqYZ0r ud5tTPimwETjf05D9g8zyAXhWvzxQXH26CjXkKw22blyRIS1PMn2ZjWgJDn/Ga3a2xBf CC6Vo68JmkGQCDekb3KZvNQQ4cgW7C8bqJJevS/WoUM8wYlMg/hn2Arc78ny0rLmUduN PY4lV8VQNpXtPA+NZDtxNPsP/L61POrZ1OUmQs083KUiiYaKcxgumRVcHwMJ3raAhZ9O 6hji68iQWJeQNo/bD22kEw29OP2Bnh+OSlstU/mA/uPt+u+dRNkdHZb9JEch7wEZ7/4K r2rQ== 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=+YTaRWfG9Yuoc1VN58/KFdiQHjekpSnoND3oo5X7AWA=; b=l/ZHUnoAc9fY1yjY7SZrFLSkmmkC1krbzuL1ZaUWHD56aSPqvvkm8HjdqfWlae3JtB YnLBN3Z60K7iCRtohGpDxVu5Icx5oEB+U5NTSYuo/QQ4Lxs0mgGUWtdWKLn8LlxvaBek MjL/ZZQsv2KJ1DnXJr/Yb4mwHyBp/QsTxQYmc9LjHwTCehNI7cfEpJHoapOZfnFaSe2T pis0/mMPiOSEEKXXLPntPJBIlLUuD1OlCCQVs1IiivoQ1pSZlwaxale8F/O6h4t1sypS 1iyQY1RQyeTQJ+B30LykOGa6tOfYOVnYixB1BQMZ4pZ7DM2fDFe01CEjCLjkjgW3gHYN 7jUg== X-Gm-Message-State: APjAAAXk0zhdD++PERqoKoGCWnvXGtCyjdt2KzrFYoFMKrgrvefWjvNm Yb+L3IWuzms6P8wYxosyavLIEGqD+HE= X-Received: by 2002:ac2:528f:: with SMTP id q15mr33624519lfm.37.1558714842202; Fri, 24 May 2019 09:20:42 -0700 (PDT) Received: from localhost.bredbandsbolaget (c-d2cd225c.014-348-6c756e10.bbcust.telenor.se. [92.34.205.210]) by smtp.gmail.com with ESMTPSA id y4sm618075lje.24.2019.05.24.09.20.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 May 2019 09:20:41 -0700 (PDT) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" Cc: Krzysztof Halasa , Linus Walleij Subject: [PATCH 2/8] net: ethernet: ixp4xx: Use distinct local variable Date: Fri, 24 May 2019 18:20:17 +0200 Message-Id: <20190524162023.9115-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190524162023.9115-1-linus.walleij@linaro.org> References: <20190524162023.9115-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 Use "ndev" for the struct net_device and "dev" for the struct device in probe() and remove(). Add the local "dev" pointer for later use in refactoring. Take this opportunity to fix inverse christmas tree coding style. Signed-off-by: Linus Walleij --- drivers/net/ethernet/xscale/ixp4xx_eth.c | 51 +++++++++++++----------- 1 file changed, 27 insertions(+), 24 deletions(-) -- 2.20.1 diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index ae69836d0080..a0c02458f456 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c @@ -1369,20 +1369,23 @@ static const struct net_device_ops ixp4xx_netdev_ops = { static int ixp4xx_eth_probe(struct platform_device *pdev) { - struct port *port; - struct net_device *dev; - struct eth_plat_info *plat = dev_get_platdata(&pdev->dev); + char phy_id[MII_BUS_ID_SIZE + 3]; struct phy_device *phydev = NULL; + struct device *dev = &pdev->dev; + struct eth_plat_info *plat; + struct net_device *ndev; + struct port *port; u32 regs_phys; - char phy_id[MII_BUS_ID_SIZE + 3]; int err; - if (!(dev = alloc_etherdev(sizeof(struct port)))) + plat = dev_get_platdata(dev); + + if (!(ndev = alloc_etherdev(sizeof(struct port)))) return -ENOMEM; - SET_NETDEV_DEV(dev, &pdev->dev); - port = netdev_priv(dev); - port->netdev = dev; + SET_NETDEV_DEV(ndev, dev); + port = netdev_priv(ndev); + port->netdev = ndev; port->id = pdev->id; switch (port->id) { @@ -1435,18 +1438,18 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) goto err_free; } - dev->netdev_ops = &ixp4xx_netdev_ops; - dev->ethtool_ops = &ixp4xx_ethtool_ops; - dev->tx_queue_len = 100; + ndev->netdev_ops = &ixp4xx_netdev_ops; + ndev->ethtool_ops = &ixp4xx_ethtool_ops; + ndev->tx_queue_len = 100; - netif_napi_add(dev, &port->napi, eth_poll, NAPI_WEIGHT); + netif_napi_add(ndev, &port->napi, eth_poll, NAPI_WEIGHT); if (!(port->npe = npe_request(NPE_ID(port->id)))) { err = -EIO; goto err_free; } - port->mem_res = request_mem_region(regs_phys, REGS_SIZE, dev->name); + port->mem_res = request_mem_region(regs_phys, REGS_SIZE, ndev->name); if (!port->mem_res) { err = -EBUSY; goto err_npe_rel; @@ -1454,9 +1457,9 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) port->plat = plat; npe_port_tab[NPE_ID(port->id)] = port; - memcpy(dev->dev_addr, plat->hwaddr, ETH_ALEN); + memcpy(ndev->dev_addr, plat->hwaddr, ETH_ALEN); - platform_set_drvdata(pdev, dev); + platform_set_drvdata(pdev, ndev); __raw_writel(DEFAULT_CORE_CNTRL | CORE_RESET, &port->regs->core_control); @@ -1466,7 +1469,7 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, mdio_bus->id, plat->phy); - phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, + phydev = phy_connect(ndev, phy_id, &ixp4xx_adjust_link, PHY_INTERFACE_MODE_MII); if (IS_ERR(phydev)) { err = PTR_ERR(phydev); @@ -1475,10 +1478,10 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) phydev->irq = PHY_POLL; - if ((err = register_netdev(dev))) + if ((err = register_netdev(ndev))) goto err_phy_dis; - printk(KERN_INFO "%s: MII PHY %i on %s\n", dev->name, plat->phy, + printk(KERN_INFO "%s: MII PHY %i on %s\n", ndev->name, plat->phy, npe_name(port->npe)); return 0; @@ -1491,23 +1494,23 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) err_npe_rel: npe_release(port->npe); err_free: - free_netdev(dev); + free_netdev(ndev); return err; } static int ixp4xx_eth_remove(struct platform_device *pdev) { - struct net_device *dev = platform_get_drvdata(pdev); - struct phy_device *phydev = dev->phydev; - struct port *port = netdev_priv(dev); + struct net_device *ndev = platform_get_drvdata(pdev); + struct phy_device *phydev = ndev->phydev; + struct port *port = netdev_priv(ndev); - unregister_netdev(dev); + unregister_netdev(ndev); phy_disconnect(phydev); ixp4xx_mdio_remove(); npe_port_tab[NPE_ID(port->id)] = NULL; npe_release(port->npe); release_resource(port->mem_res); - free_netdev(dev); + free_netdev(ndev); return 0; } From patchwork Fri May 24 16:20:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 165130 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp3806616ili; Fri, 24 May 2019 09:20:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqzYm3xV22vvD9tLIHdo/raAtN11SzLVgpZCTGw4c6h5Yuzg3KB2BevZnXmwcvZWTCJ8xAnA X-Received: by 2002:aa7:804c:: with SMTP id y12mr39226001pfm.94.1558714850097; Fri, 24 May 2019 09:20:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558714850; cv=none; d=google.com; s=arc-20160816; b=VZatkNvHxFNMclUCmZZv93UdZ3c21XtIZy7uA/YQuYJJ9mqFxdTOD0to3wLLeISYNc gJoL3cFQy8JbqqZV2ydAlJvfsmIVhHj4g0+tsbqXE+zjUYFpzRJd7f++SqPUWpZ2sT9J aL7YrCSZOY3ShkC9I/+mQsDeqHf04vYtLAeAQDkG2zcRrj2Weeiy0Hm2jRhSmfzpsjiC FRweflK77kzAqc7tocCAGin2tpU07ljlS0cgFmsR1rvxL1jwjHZB5VMmNHoihkAnCf0M WKAmcqeQQfMTVMDHhwwPR0x6dQKXbxUDOhlsxqGBf8IGpCN3GezFTcgKZg9qTNdCYuge jhFw== 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=FHdSK5ctE9Fl6lcAriQFgB7IwJUTOwGKZw22HMzJTEE=; b=gtDNLhddwuUIyrbI7uuGGZU8Ag2YaFFYpiI1HhS2M1d9IhgjDwh8Gld5LE/YRuTSm7 x+dhf4yH9CErbORaDaz+aSrpRc0bq1e+9gmOQvoHV1bY/Y4o1ScktIaH2PZNrdV5KbnX ZKe6yXnWFjMgumq5B46c5nkACKk5BDwovl3LIlPqQJ48OWDC8UAm3obU3kxt6wHFaOR2 M8QK2yHiNYVgP0oGjKfg2daA/ldFpa4iIX5bSvr+h6z7nF7l8ULTkWkWWn+TSbAV8+G/ 32Iv981jga0T1Y6gVj1Kb73Z9lSOFeq9xvJTFpvKauXbl0qvrgIrZ8+teikohfKHL4XO alvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i6xELpGR; 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 m14si5204608pgj.377.2019.05.24.09.20.49; Fri, 24 May 2019 09:20:50 -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=i6xELpGR; 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 S2390885AbfEXQUs (ORCPT + 9 others); Fri, 24 May 2019 12:20:48 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:41972 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390662AbfEXQUs (ORCPT ); Fri, 24 May 2019 12:20:48 -0400 Received: by mail-lj1-f194.google.com with SMTP id q16so794534ljj.8 for ; Fri, 24 May 2019 09:20:46 -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=FHdSK5ctE9Fl6lcAriQFgB7IwJUTOwGKZw22HMzJTEE=; b=i6xELpGRMdbIkrAGCt9rzvt5XKPqayXijqBWHfJqxlTfim7PKZjNS8O8kxOS5PIfTq CAox9ya/TJ2LHsoA9iE/VSJMSmCWZXkm05DxoIYYKQT6FHkUD5MPEMW/ppRdycDXmVli 2Z3REwBfzxGS/NFADjflmVD5mITdtq3iYy8J0+3MT4E/T4MM9sYC6DMvnIEJJzi2XMTD ZSzSCVwYNVXl6jnoRubK7hK21GbyYJzXpKcpbsFjTXKoIy4Ooo10qjq+ZXvAkN+yEg2j vOp0v9f9kN9W3ROveoNLlUIQmvvYy1SMzvMM3lMZYFbmHrbr4Xl64Isr/v6JQvVP4pdM pAhg== 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=FHdSK5ctE9Fl6lcAriQFgB7IwJUTOwGKZw22HMzJTEE=; b=YZT9c/AHvBZJD63WA7olCwGL0DpuMib6FTElVRIiYb3n/t9y4u+kI5THPBJ2Tpv/cr i/UA8LkrhIZZWuwLmmcGtRjwUsDQc25ijLpad+8ga+qAk3B5NpZdWgmk7Vig1r6/CXEL AAcYIZj2i/vyPYnnF6z6aGXJTJY36oeiVvFEavAueBugjdVfLkr2cFZAr8BZq1ET/a1M rNuJc0ScEFUKStxhTIgPq+Iq2hBTJ++IhTieGJHseL8cXGRPFW4HtnTpYXJxvF2atrWA UFGSoAh0N4HUDtWReAcz8m/27qGQEF5mxRY4Cd6lCZZGzrrTQdOZuA6cZPzP8JUiwDpG i0uA== X-Gm-Message-State: APjAAAXce+Z1xKl9v4Gcimm15vEDaEe+PI6Cm4BP+KwYmNe3KGCT9m/s HAYYq5hkYMYlj3Rra3Yk5SrEMytD4hc= X-Received: by 2002:a2e:7d02:: with SMTP id y2mr26588406ljc.62.1558714845915; Fri, 24 May 2019 09:20:45 -0700 (PDT) Received: from localhost.bredbandsbolaget (c-d2cd225c.014-348-6c756e10.bbcust.telenor.se. [92.34.205.210]) by smtp.gmail.com with ESMTPSA id y4sm618075lje.24.2019.05.24.09.20.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 May 2019 09:20:45 -0700 (PDT) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" Cc: Krzysztof Halasa , Linus Walleij Subject: [PATCH 3/8] net: ehernet: ixp4xx: Use devm_alloc_etherdev() Date: Fri, 24 May 2019 18:20:18 +0200 Message-Id: <20190524162023.9115-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190524162023.9115-1-linus.walleij@linaro.org> References: <20190524162023.9115-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 Using the devm_alloc_etherdev() function simplifies the error path. I also patch the message to use dev_info(). Signed-off-by: Linus Walleij --- drivers/net/ethernet/xscale/ixp4xx_eth.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) -- 2.20.1 diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index a0c02458f456..064ff0886cc3 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c @@ -1380,7 +1380,7 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) plat = dev_get_platdata(dev); - if (!(ndev = alloc_etherdev(sizeof(struct port)))) + if (!(ndev = devm_alloc_etherdev(dev, sizeof(struct port)))) return -ENOMEM; SET_NETDEV_DEV(ndev, dev); @@ -1434,8 +1434,7 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) regs_phys = IXP4XX_EthC_BASE_PHYS; break; default: - err = -ENODEV; - goto err_free; + return -ENODEV; } ndev->netdev_ops = &ixp4xx_netdev_ops; @@ -1444,10 +1443,8 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) netif_napi_add(ndev, &port->napi, eth_poll, NAPI_WEIGHT); - if (!(port->npe = npe_request(NPE_ID(port->id)))) { - err = -EIO; - goto err_free; - } + if (!(port->npe = npe_request(NPE_ID(port->id)))) + return -EIO; port->mem_res = request_mem_region(regs_phys, REGS_SIZE, ndev->name); if (!port->mem_res) { @@ -1481,8 +1478,8 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) if ((err = register_netdev(ndev))) goto err_phy_dis; - printk(KERN_INFO "%s: MII PHY %i on %s\n", ndev->name, plat->phy, - npe_name(port->npe)); + dev_info(dev, "%s: MII PHY %i on %s\n", ndev->name, plat->phy, + npe_name(port->npe)); return 0; @@ -1493,8 +1490,6 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) release_resource(port->mem_res); err_npe_rel: npe_release(port->npe); -err_free: - free_netdev(ndev); return err; } @@ -1510,7 +1505,6 @@ static int ixp4xx_eth_remove(struct platform_device *pdev) npe_port_tab[NPE_ID(port->id)] = NULL; npe_release(port->npe); release_resource(port->mem_res); - free_netdev(ndev); return 0; } From patchwork Fri May 24 16:20:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 165131 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp3806723ili; Fri, 24 May 2019 09:20:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqy9wPM32O0Z5LA4K7mClc9wuU5sOBgfHaLhrfo0vPsgAseb6Jnf9xm9xRm6Y6/0TdrlWv9X X-Received: by 2002:a63:e616:: with SMTP id g22mr39918134pgh.61.1558714856338; Fri, 24 May 2019 09:20:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558714856; cv=none; d=google.com; s=arc-20160816; b=DQLaJlBwJfWjohdFOVGNvBibdbkompbv2G79vWY8Zqtl326jU18XVZb1Kso+mlVL50 VOVsc0lb/Vw6Ad56FOerg0HEtCANIW2nFBVrpqrtl14efKWH1sab/LhO1y2tDmB7MXQo UEKpnt0INcLcW0YYFiRuN4Wt/Nosb1bbT9Ske/HM+3Dos/iXi1vzouFqVbec+MMDMwpM dWATmcwcYjd/K30L3JMLYyjUXY+Zjp3LhkdW8f3bp8fb3ofkO3HWtkEvuMk0ARhIx7TQ 1TRbw+zCPqiv07EldYTk0TLiMGvveRujfR3have8hElQn37jqws523QQ+xJcj0I8mVDy cC8Q== 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=bBARK8vNqygviud0La4Tdob+SuFOP0uNrEGVX2JRO4E=; b=bSuTitqjIm6jabrX/kAkBUl0Cxx+0kI3EvL9gnB1KmjkCcMHkI47XlKwGkwSpUQRMq Ow9Bu6IYmANixM4T2omFIoakNDJr/JCCBboERCnb1e4n/fBnOj3gybD1Xc2XBlIi6gbt TJMn1biDCpFCizuC7eL3dJT5Ut57GAC5AIwWIi/yEoiFrm51WP/HAWi8zww4rJB+z3UN Bbtx5KBfh+TO0+7DPtqrZGDg2ed1+poEqU0tWd3t/fJ9GBj8jH+U6gHZuZhydR75LEW9 XhU+Aw7nyJ188r1E/+nqKFhcWVOvp4X25eUypBuZetJz7rq4P0leOdgwTlItrVim7jNb I1Vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dIOuYxlz; 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 m14si5204608pgj.377.2019.05.24.09.20.55; Fri, 24 May 2019 09:20:56 -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=dIOuYxlz; 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 S2390887AbfEXQUy (ORCPT + 9 others); Fri, 24 May 2019 12:20:54 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:37607 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390308AbfEXQUy (ORCPT ); Fri, 24 May 2019 12:20:54 -0400 Received: by mail-lf1-f67.google.com with SMTP id m15so6970932lfh.4 for ; Fri, 24 May 2019 09:20:51 -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=bBARK8vNqygviud0La4Tdob+SuFOP0uNrEGVX2JRO4E=; b=dIOuYxlzCPlrdhjwthLVuivPss5LuD4xVyueVHQ91FoB2wY0iWoO6xPgzPQOtyI8Xt ACv1EF/Yemp22Kjx9EN6iPAUh3k7+xqshCjkyOpsPoP7bG6LfBym6BgDlrpxfeo7ZhPa HJuwj++zt2nhZKLx1wPoDTnf2+Q8aqDlSkDRSpWjmzuthDv8EybGKbVdZ3v9hTZymwb/ CKiEu6unhmeqPl5sQcpbr96g9YBnRNg2LwPwsVbqzc402k5Ovjz0jdAYEhjUZaLckz/T lJn3cM9s0bLkHcunk4z6AqOxGkYdqCumfc9UJuC4FZhLAx4D8jZXBMelPewhgeyGWBZd WQUA== 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=bBARK8vNqygviud0La4Tdob+SuFOP0uNrEGVX2JRO4E=; b=n9oJOu0Znkfc5qLHmCiXhjKp17YbT2b4WDNzLeRQvDUT6/IVuK5S0ZVqAaXSs97TGZ lW8dwHASEcYRQRpIbQzEbfDX2993iwlpPxCQdDaOQBJ+K6J8O/2uTmplBpM6Zj87hegZ deIdg4jNSayuPwe5DQql9FRvltpxPiC6NB8XPebYABFavcCITg0PD71VvaT6opiTno6B gKc/X8U2jH4brqixmV8KNdG272VsEtohZusXdHO3L67bfcmLIRDzfNog7czc8A6yOxPd idkwe0M5TOm9FwlvQUeIXwq0gp5KE43OKRBeel4WF9ro9Tl2TXqOAGS32M6yVAFWGT93 BYkw== X-Gm-Message-State: APjAAAVWV6PVtq59TLhd1kkzTe647p1jFozAIcVY8Ea+I6SCgqmuAR/k qKGebbJg96PTEbAsoLFIpbvATPwrWz0= X-Received: by 2002:ac2:59c7:: with SMTP id x7mr13887342lfn.75.1558714848845; Fri, 24 May 2019 09:20:48 -0700 (PDT) Received: from localhost.bredbandsbolaget (c-d2cd225c.014-348-6c756e10.bbcust.telenor.se. [92.34.205.210]) by smtp.gmail.com with ESMTPSA id y4sm618075lje.24.2019.05.24.09.20.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 May 2019 09:20:48 -0700 (PDT) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" Cc: Krzysztof Halasa , Linus Walleij Subject: [PATCH 4/8] ARM/net: ixp4xx: Pass ethernet physical base as resource Date: Fri, 24 May 2019 18:20:19 +0200 Message-Id: <20190524162023.9115-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190524162023.9115-1-linus.walleij@linaro.org> References: <20190524162023.9115-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 In order to probe this ethernet interface from the device tree all physical MMIO regions must be passed as resources. Begin this rewrite by first passing the port base address as a resource for all platforms using this driver, remap it in the driver and avoid using any reference of the statically mapped virtual address in the driver. Signed-off-by: Linus Walleij --- arch/arm/mach-ixp4xx/fsg-setup.c | 20 ++++++++++++++++++++ arch/arm/mach-ixp4xx/goramo_mlr.c | 20 ++++++++++++++++++++ arch/arm/mach-ixp4xx/ixdp425-setup.c | 20 ++++++++++++++++++++ arch/arm/mach-ixp4xx/nas100d-setup.c | 10 ++++++++++ arch/arm/mach-ixp4xx/nslu2-setup.c | 10 ++++++++++ arch/arm/mach-ixp4xx/omixp-setup.c | 20 ++++++++++++++++++++ arch/arm/mach-ixp4xx/vulcan-setup.c | 20 ++++++++++++++++++++ drivers/net/ethernet/xscale/ixp4xx_eth.c | 20 +++++++++++--------- 8 files changed, 131 insertions(+), 9 deletions(-) -- 2.20.1 diff --git a/arch/arm/mach-ixp4xx/fsg-setup.c b/arch/arm/mach-ixp4xx/fsg-setup.c index 648932d8d7a8..507ee3878769 100644 --- a/arch/arm/mach-ixp4xx/fsg-setup.c +++ b/arch/arm/mach-ixp4xx/fsg-setup.c @@ -132,6 +132,22 @@ static struct platform_device fsg_leds = { }; /* Built-in 10/100 Ethernet MAC interfaces */ +static struct resource fsg_eth_npeb_resources[] = { + { + .start = IXP4XX_EthB_BASE_PHYS, + .end = IXP4XX_EthB_BASE_PHYS + 0x0fff, + .flags = IORESOURCE_MEM, + }, +}; + +static struct resource fsg_eth_npec_resources[] = { + { + .start = IXP4XX_EthC_BASE_PHYS, + .end = IXP4XX_EthC_BASE_PHYS + 0x0fff, + .flags = IORESOURCE_MEM, + }, +}; + static struct eth_plat_info fsg_plat_eth[] = { { .phy = 5, @@ -151,12 +167,16 @@ static struct platform_device fsg_eth[] = { .dev = { .platform_data = fsg_plat_eth, }, + .num_resources = ARRAY_SIZE(fsg_eth_npeb_resources), + .resource = fsg_eth_npeb_resources, }, { .name = "ixp4xx_eth", .id = IXP4XX_ETH_NPEC, .dev = { .platform_data = fsg_plat_eth + 1, }, + .num_resources = ARRAY_SIZE(fsg_eth_npec_resources), + .resource = fsg_eth_npec_resources, } }; diff --git a/arch/arm/mach-ixp4xx/goramo_mlr.c b/arch/arm/mach-ixp4xx/goramo_mlr.c index 4d805080020e..7db396cc4353 100644 --- a/arch/arm/mach-ixp4xx/goramo_mlr.c +++ b/arch/arm/mach-ixp4xx/goramo_mlr.c @@ -270,6 +270,22 @@ static struct platform_device device_uarts = { /* Built-in 10/100 Ethernet MAC interfaces */ +static struct resource eth_npeb_resources[] = { + { + .start = IXP4XX_EthB_BASE_PHYS, + .end = IXP4XX_EthB_BASE_PHYS + 0x0fff, + .flags = IORESOURCE_MEM, + }, +}; + +static struct resource eth_npec_resources[] = { + { + .start = IXP4XX_EthC_BASE_PHYS, + .end = IXP4XX_EthC_BASE_PHYS + 0x0fff, + .flags = IORESOURCE_MEM, + }, +}; + static struct eth_plat_info eth_plat[] = { { .phy = 0, @@ -287,10 +303,14 @@ static struct platform_device device_eth_tab[] = { .name = "ixp4xx_eth", .id = IXP4XX_ETH_NPEB, .dev.platform_data = eth_plat, + .num_resources = ARRAY_SIZE(eth_npeb_resources), + .resource = eth_npeb_resources, }, { .name = "ixp4xx_eth", .id = IXP4XX_ETH_NPEC, .dev.platform_data = eth_plat + 1, + .num_resources = ARRAY_SIZE(eth_npec_resources), + .resource = eth_npec_resources, } }; diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c index 6f0f7ed18ea8..45d5b720ded6 100644 --- a/arch/arm/mach-ixp4xx/ixdp425-setup.c +++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c @@ -187,6 +187,22 @@ static struct platform_device ixdp425_uart = { }; /* Built-in 10/100 Ethernet MAC interfaces */ +static struct resource ixp425_npeb_resources[] = { + { + .start = IXP4XX_EthB_BASE_PHYS, + .end = IXP4XX_EthB_BASE_PHYS + 0x0fff, + .flags = IORESOURCE_MEM, + }, +}; + +static struct resource ixp425_npec_resources[] = { + { + .start = IXP4XX_EthC_BASE_PHYS, + .end = IXP4XX_EthC_BASE_PHYS + 0x0fff, + .flags = IORESOURCE_MEM, + }, +}; + static struct eth_plat_info ixdp425_plat_eth[] = { { .phy = 0, @@ -204,10 +220,14 @@ static struct platform_device ixdp425_eth[] = { .name = "ixp4xx_eth", .id = IXP4XX_ETH_NPEB, .dev.platform_data = ixdp425_plat_eth, + .num_resources = ARRAY_SIZE(ixp425_npeb_resources), + .resource = ixp425_npeb_resources, }, { .name = "ixp4xx_eth", .id = IXP4XX_ETH_NPEC, .dev.platform_data = ixdp425_plat_eth + 1, + .num_resources = ARRAY_SIZE(ixp425_npec_resources), + .resource = ixp425_npec_resources, } }; diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c index c142cfa8c5d6..6959ad2e3aec 100644 --- a/arch/arm/mach-ixp4xx/nas100d-setup.c +++ b/arch/arm/mach-ixp4xx/nas100d-setup.c @@ -165,6 +165,14 @@ static struct platform_device nas100d_uart = { }; /* Built-in 10/100 Ethernet MAC interfaces */ +static struct resource nas100d_eth_resources[] = { + { + .start = IXP4XX_EthB_BASE_PHYS, + .end = IXP4XX_EthB_BASE_PHYS + 0x0fff, + .flags = IORESOURCE_MEM, + }, +}; + static struct eth_plat_info nas100d_plat_eth[] = { { .phy = 0, @@ -178,6 +186,8 @@ static struct platform_device nas100d_eth[] = { .name = "ixp4xx_eth", .id = IXP4XX_ETH_NPEB, .dev.platform_data = nas100d_plat_eth, + .num_resources = ARRAY_SIZE(nas100d_eth_resources), + .resource = nas100d_eth_resources, } }; diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c index ee1877fcfafe..a428bb918703 100644 --- a/arch/arm/mach-ixp4xx/nslu2-setup.c +++ b/arch/arm/mach-ixp4xx/nslu2-setup.c @@ -185,6 +185,14 @@ static struct platform_device nslu2_uart = { }; /* Built-in 10/100 Ethernet MAC interfaces */ +static struct resource nslu2_eth_resources[] = { + { + .start = IXP4XX_EthB_BASE_PHYS, + .end = IXP4XX_EthB_BASE_PHYS + 0x0fff, + .flags = IORESOURCE_MEM, + }, +}; + static struct eth_plat_info nslu2_plat_eth[] = { { .phy = 1, @@ -198,6 +206,8 @@ static struct platform_device nslu2_eth[] = { .name = "ixp4xx_eth", .id = IXP4XX_ETH_NPEB, .dev.platform_data = nslu2_plat_eth, + .num_resources = ARRAY_SIZE(nslu2_eth_resources), + .resource = nslu2_eth_resources, } }; diff --git a/arch/arm/mach-ixp4xx/omixp-setup.c b/arch/arm/mach-ixp4xx/omixp-setup.c index 2d494b454376..6f86c27b725e 100644 --- a/arch/arm/mach-ixp4xx/omixp-setup.c +++ b/arch/arm/mach-ixp4xx/omixp-setup.c @@ -171,6 +171,22 @@ static struct platform_device mic256_leds = { }; /* Built-in 10/100 Ethernet MAC interfaces */ +static struct resource ixp425_npeb_resources[] = { + { + .start = IXP4XX_EthB_BASE_PHYS, + .end = IXP4XX_EthB_BASE_PHYS + 0x0fff, + .flags = IORESOURCE_MEM, + }, +}; + +static struct resource ixp425_npec_resources[] = { + { + .start = IXP4XX_EthC_BASE_PHYS, + .end = IXP4XX_EthC_BASE_PHYS + 0x0fff, + .flags = IORESOURCE_MEM, + }, +}; + static struct eth_plat_info ixdp425_plat_eth[] = { { .phy = 0, @@ -188,10 +204,14 @@ static struct platform_device ixdp425_eth[] = { .name = "ixp4xx_eth", .id = IXP4XX_ETH_NPEB, .dev.platform_data = ixdp425_plat_eth, + .num_resources = ARRAY_SIZE(ixp425_npeb_resources), + .resource = ixp425_npeb_resources, }, { .name = "ixp4xx_eth", .id = IXP4XX_ETH_NPEC, .dev.platform_data = ixdp425_plat_eth + 1, + .num_resources = ARRAY_SIZE(ixp425_npec_resources), + .resource = ixp425_npec_resources, }, }; diff --git a/arch/arm/mach-ixp4xx/vulcan-setup.c b/arch/arm/mach-ixp4xx/vulcan-setup.c index 2c03d2f6b647..783c291f8f4c 100644 --- a/arch/arm/mach-ixp4xx/vulcan-setup.c +++ b/arch/arm/mach-ixp4xx/vulcan-setup.c @@ -122,6 +122,22 @@ static struct platform_device vulcan_uart = { .num_resources = ARRAY_SIZE(vulcan_uart_resources), }; +static struct resource vulcan_npeb_resources[] = { + { + .start = IXP4XX_EthB_BASE_PHYS, + .end = IXP4XX_EthB_BASE_PHYS + 0x0fff, + .flags = IORESOURCE_MEM, + }, +}; + +static struct resource vulcan_npec_resources[] = { + { + .start = IXP4XX_EthC_BASE_PHYS, + .end = IXP4XX_EthC_BASE_PHYS + 0x0fff, + .flags = IORESOURCE_MEM, + }, +}; + static struct eth_plat_info vulcan_plat_eth[] = { [0] = { .phy = 0, @@ -142,6 +158,8 @@ static struct platform_device vulcan_eth[] = { .dev = { .platform_data = &vulcan_plat_eth[0], }, + .num_resources = ARRAY_SIZE(vulcan_npeb_resources), + .resource = vulcan_npeb_resources, }, [1] = { .name = "ixp4xx_eth", @@ -149,6 +167,8 @@ static struct platform_device vulcan_eth[] = { .dev = { .platform_data = &vulcan_plat_eth[1], }, + .num_resources = ARRAY_SIZE(vulcan_npec_resources), + .resource = vulcan_npec_resources, }, }; diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index 064ff0886cc3..17d3291d79b4 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c @@ -1373,9 +1373,10 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) struct phy_device *phydev = NULL; struct device *dev = &pdev->dev; struct eth_plat_info *plat; + resource_size_t regs_phys; struct net_device *ndev; + struct resource *res; struct port *port; - u32 regs_phys; int err; plat = dev_get_platdata(dev); @@ -1388,13 +1389,18 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) port->netdev = ndev; port->id = pdev->id; + /* Get the port resource and remap */ + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -ENODEV; + regs_phys = res->start; + port->regs = devm_ioremap_resource(dev, res); + switch (port->id) { case IXP4XX_ETH_NPEA: /* If the MDIO bus is not up yet, defer probe */ if (!mdio_bus) return -EPROBE_DEFER; - port->regs = (struct eth_regs __iomem *)IXP4XX_EthA_BASE_VIRT; - regs_phys = IXP4XX_EthA_BASE_PHYS; break; case IXP4XX_ETH_NPEB: /* @@ -1407,13 +1413,11 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) IXP4XX_FEATURE_NPEB_ETH0)) return -ENODEV; /* Else register the MDIO bus on NPE-B */ - if ((err = ixp4xx_mdio_register(IXP4XX_EthC_BASE_VIRT))) + if ((err = ixp4xx_mdio_register(port->regs))) return err; } if (!mdio_bus) return -EPROBE_DEFER; - port->regs = (struct eth_regs __iomem *)IXP4XX_EthB_BASE_VIRT; - regs_phys = IXP4XX_EthB_BASE_PHYS; break; case IXP4XX_ETH_NPEC: /* @@ -1425,13 +1429,11 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) IXP4XX_FEATURE_NPEC_ETH)) return -ENODEV; /* Else register the MDIO bus on NPE-C */ - if ((err = ixp4xx_mdio_register(IXP4XX_EthC_BASE_VIRT))) + if ((err = ixp4xx_mdio_register(port->regs))) return err; } if (!mdio_bus) return -EPROBE_DEFER; - port->regs = (struct eth_regs __iomem *)IXP4XX_EthC_BASE_VIRT; - regs_phys = IXP4XX_EthC_BASE_PHYS; break; default: return -ENODEV; From patchwork Fri May 24 16:20:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 165132 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp3806773ili; Fri, 24 May 2019 09:20:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqzGjjsKQEKjgjybDEZTl24pTSxZR6EdmQN67dI+C63aPV3Bj9B0caTgtXIQ8MtigttXL6r8 X-Received: by 2002:a17:90a:2e87:: with SMTP id r7mr10505966pjd.121.1558714858737; Fri, 24 May 2019 09:20:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558714858; cv=none; d=google.com; s=arc-20160816; b=R280zQTOMSLx18nquYaIeOidJ/PtNfsoUFnp0jJar4GEmqwOFX+4pDdRt2h9NEvXo6 uoWibQWPA84p2kXbpCylzkXigb2azsGWxnmHtHbHqtBsgekYZkEcIztyKdcFf7fQ/h9b MMKsCJgkTcoLtL77P3I9KNGDnhkrFwBBuHvn/QGLK7rkrB4+aJ38jCM9lrrpW2onEplb Auep+Z8NKj1lcQgRc7YMUal0UzyUxXDF5paxkv6w6BdeKqWj5FVUNBX8lQx430Pq0dX4 M09pfo3eSHc42tTsAWOWtH3QCzegZ0x0L4yQBliII11IeGRpN8RIlkrQJveno2joG34Z H8XQ== 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=i7OSJeT4ISWaBZXsLc0uF5tUfx/CAFdEtfJjJMrSp3E=; b=qgrkguxsl4N0bXOTe4OP8lflZRu4JHpBtcrkswFDBB+CPo9gRnpYN4r7PYI1eTQ3Qy YsF581P68GxNQoXoGAu5ShFjt6XHpxnE8HJBo8F+ICbAL5xOgIRF/sL9wWugISRK2E6M jcput485S0H4ve7SKMLc/HXKIseaFJF6XX3cLxa3a7Uo8xyDeWEpBNsCZYWHO19IjRcH rmN+rKoDRRkYvPTL50ftc3JjLxNf0EMZf5Anlpz+ynxMZbumVms43dE0i7XKAfgz/kgE HrO6In06c+Vd9fVyq39PvH7DdmOiofkDq+pmnC7Hr5cGaFRQKhcMdSyJIt1fQN3ZTZuK zvaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YBQgvCjd; 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 m14si5204608pgj.377.2019.05.24.09.20.58; Fri, 24 May 2019 09:20:58 -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=YBQgvCjd; 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 S2390915AbfEXQU5 (ORCPT + 9 others); Fri, 24 May 2019 12:20:57 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:37339 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390308AbfEXQU4 (ORCPT ); Fri, 24 May 2019 12:20:56 -0400 Received: by mail-lj1-f193.google.com with SMTP id h19so779581ljj.4 for ; Fri, 24 May 2019 09:20:55 -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=i7OSJeT4ISWaBZXsLc0uF5tUfx/CAFdEtfJjJMrSp3E=; b=YBQgvCjdVW+kRQYH8du/SNwiklf/u0MF0ZIQi9It1XN362K8HTZjGwTiuIg/1wvgBa geyae65n+B9tORTMWcOkfj7CHSsMJZI2wPlE/lcE4K9Y/UJmXeg0w18p+HSfGBz+cZZK HnEyRzyQREt3LXf5zLbOcMjg0Wj6rHZPm10d4NB3wUP2W0UzAwdepr4xLt3vWujc4LS8 fODByJ30U+or+7v/j3JU/1AKIf7Eky/u08Yx5pyDKHa7sUj+eHRnHwfrG/4/QdRrSeXs Muy8XFcSxZPIEafec+gyYngI3e739I2YF8WD4/MKKN3bJOoBqoM4zwHB9Qq/jfY6mpP3 aL6A== 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=i7OSJeT4ISWaBZXsLc0uF5tUfx/CAFdEtfJjJMrSp3E=; b=Ifa6ck0Vx1cvOClJq6qldI9luuhunf+SMCb5SrYA43uEyDBRLQJiBuj4lEeFOWWJxE s8bwu9J4EX5PZfFmqubo63FnuWyS54+eOuDcCnGbgZTi3anhbwTSZ30tTse3VEREmSF0 0DZiNjT0dvHOvrQH3z3blEK0C/CIQERjeaEZaUl5A8JMWsUfAPjLMsZgIhYu7AieEaWN O2VkGjhB4VebNyvvZAKvpBqovZwYS51GVCa2a58FFNtj5X5AqHNYf02cIY6laBFhmanl zICq6/q/iIVAHzp4Ris/9Gv4iXoBpox/KwEubEGTEHGJjndSFhkG4lnxC4r2jZNvnYF2 QKXg== X-Gm-Message-State: APjAAAWxpVhGQU52MOc5yAUmFFOB/ecsIiFC8Gvynu4GYwU9OrWDfYzN 1DOoLzx8rM+Zc2Qehh6A2P27GXKsHa8= X-Received: by 2002:a2e:8985:: with SMTP id c5mr8690449lji.84.1558714854437; Fri, 24 May 2019 09:20:54 -0700 (PDT) Received: from localhost.bredbandsbolaget (c-d2cd225c.014-348-6c756e10.bbcust.telenor.se. [92.34.205.210]) by smtp.gmail.com with ESMTPSA id y4sm618075lje.24.2019.05.24.09.20.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 May 2019 09:20:53 -0700 (PDT) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" Cc: Krzysztof Halasa , Linus Walleij Subject: [PATCH 5/8] net: ethernet: ixp4xx: Get port ID from base address Date: Fri, 24 May 2019 18:20:20 +0200 Message-Id: <20190524162023.9115-6-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190524162023.9115-1-linus.walleij@linaro.org> References: <20190524162023.9115-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.20.1 diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index 17d3291d79b4..600f62e95fb0 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c @@ -1387,7 +1387,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); @@ -1396,13 +1395,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 @@ -1419,7 +1420,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. From patchwork Fri May 24 16:20:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 165133 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp3806862ili; Fri, 24 May 2019 09:21:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqy5famcaM0pdGSRuDVez2vCRWobmRJexMcRpzc7xmCvRpJj04IsU2R8ZwdB5/XHlfAUF63D X-Received: by 2002:a62:5581:: with SMTP id j123mr114835928pfb.102.1558714862775; Fri, 24 May 2019 09:21:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558714862; cv=none; d=google.com; s=arc-20160816; b=TAjXsq1kAMnL5M1Og0pOCsf99yGBG8n3V2jReEIvYBRXaPm/E4uAhQlgN6NFedXnmR a2L/gbU1L/ApaJnJ13K6f2KNxPqEmNC2a7sULxMxfjp7evQHGC0muO1rGFZxJagrOIa6 8nn4BKGRIpJQ8qm3+c69jFO0alV+hRbUs5h4GyKJcDl886C954vGxoePIn9HrBL34v/g PE20sHEcL9kcsdk8ZlNySkNbAEiEvVSlZLK/OdcPgjNnQEkxJy6rRDnz2iqAFMmB15s4 OY4y7LqXl5B1FyfXYrSjsQCC7nJkjaH808rtx5rGrpM4/b8bYYKmvO91TDJ0Q6KHRATo DkyA== 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=OUow8Idp71iR0dh6G9x5edE4axHg7RMQg95y9XAt+Qw=; b=QTTMW5dZ/mZuiE8ZCzt+atFJOw/9Mq7XaIWGjsH4xwlr0wXMaS+hr6oal2MgySVxKV gFdQW6Dxux/y5DFQppS2zyDzAd4CJkgynd/tnOC6AaLY+ibSqVsch7LTBc9IQOK6gK34 /sn1CT687KJGq+UY23PI4/n9M8UfCA4XMAs3uv+gp3XZqHRWSizoCB6uwhGx84L03NKG S90CgIhzGHRmAXV1b9qVGHq10QYovY9EzxNob8YgU0PAykchM1807ejeibvQsLZMus/h 2CVzRKKe/S7MRSbSkr39o1UOosyy+t7bFgaz42DBC175z+0dwiwciFskQZ0LL31/8x/G Yd3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uzUrotqJ; 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 m14si5204608pgj.377.2019.05.24.09.21.02; Fri, 24 May 2019 09:21:02 -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=uzUrotqJ; 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 S2390955AbfEXQVB (ORCPT + 9 others); Fri, 24 May 2019 12:21:01 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:40708 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390308AbfEXQVB (ORCPT ); Fri, 24 May 2019 12:21:01 -0400 Received: by mail-lj1-f195.google.com with SMTP id q62so9168361ljq.7 for ; Fri, 24 May 2019 09:20:59 -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=OUow8Idp71iR0dh6G9x5edE4axHg7RMQg95y9XAt+Qw=; b=uzUrotqJON7yaFM+63pGhO8BnKVC8rA4dQ1V6qpQcg/RxHN5VuTFGSNNknKMBm+y3N TO+f8PuACdU1PfzFIivAbYmEL5ec06Ko+Yf1HLj0GTXdrn+JTML7DTWqKG8cAN8BzKhQ PI8Jb9DLj0bmyHTLs48CvjYFeRrqGlGiidGvU8vBdM+qLslXTvqAsypukY/uFR/HX4O0 6TQXJsO6CbWF8rYtDV71mZYF7UncFr43bDt944mF2qmLPYl23sjBWr2vtWYgt2/IkMoG FsdoHKAtURbsf/sz2WqyP+riP+1RMZUUyBUUARRnMQqxMRay6jEF0u4iZwwjoPm/+8Ac FHAw== 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=OUow8Idp71iR0dh6G9x5edE4axHg7RMQg95y9XAt+Qw=; b=bNOd0DoGH6pB2zt2YDAcb29n6Ja9E2xdlpQ0YdaMFQ8YTMOPv95e0t217wANSF1+aw HEfqhYFlvrVhdsipBTWFuccsKooas1Fv6HQUsSe3av/YcSwpIN2OyInFtLkW2TJLpDlQ LdDjtvQat9DJjLUHJF/IuSxL3Y/HiwxsQ2XAujXGjtTMtKI5Oyh7UyE3bnF+JBZabpJU 0MxXvWHRHV4anICg2u+J3+1mq0kw/a1DR2HixgUhZHPIwKbHF/2Y09qaig2tTRqL5DOW Cr0uoU55kuDIvO7C3EapCeBnveRr+xy22tCc3SV+YhISts23lSt8WXeuCxyQ9R/maT/K ceDw== X-Gm-Message-State: APjAAAV/2ZUaQxoTh/B05VPJYy3s9q4yWpeTjP6QnvpPQmR9Rj9wzrwV +py3hGgoGM+1J0Z8CJvSnvNPIyR+Ju4= X-Received: by 2002:a2e:95d2:: with SMTP id y18mr30639520ljh.167.1558714858626; Fri, 24 May 2019 09:20:58 -0700 (PDT) Received: from localhost.bredbandsbolaget (c-d2cd225c.014-348-6c756e10.bbcust.telenor.se. [92.34.205.210]) by smtp.gmail.com with ESMTPSA id y4sm618075lje.24.2019.05.24.09.20.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 May 2019 09:20:57 -0700 (PDT) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" Cc: Krzysztof Halasa , Linus Walleij Subject: [PATCH 6/8] net: ethernet: ixp4xx: Use parent dev for DMA pool Date: Fri, 24 May 2019 18:20:21 +0200 Message-Id: <20190524162023.9115-7-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190524162023.9115-1-linus.walleij@linaro.org> References: <20190524162023.9115-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 Use the netdevice struct device .parent field when calling dma_pool_create(): the .dma_coherent_mask and .dma_mask pertains to the bus device on the hardware (platform) bus in this case, not the struct device inside the network device. This makes the pool allocation work. Signed-off-by: Linus Walleij --- drivers/net/ethernet/xscale/ixp4xx_eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.1 diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index 600f62e95fb0..8b883563a3d3 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c @@ -1092,7 +1092,7 @@ static int init_queues(struct port *port) int i; if (!ports_open) { - dma_pool = dma_pool_create(DRV_NAME, &port->netdev->dev, + dma_pool = dma_pool_create(DRV_NAME, port->netdev->dev.parent, POOL_ALLOC_SIZE, 32, 0); if (!dma_pool) return -ENOMEM; From patchwork Fri May 24 16:20:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 165134 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp3806926ili; Fri, 24 May 2019 09:21:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqyCYSEGPJ8vJU3NGX8+Dzr741ZRb2RVXzwhemmrZ364exgq4KfS9dFSfKQNxK4HcPr3A/7o X-Received: by 2002:a65:44c8:: with SMTP id g8mr107418630pgs.443.1558714865557; Fri, 24 May 2019 09:21:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558714865; cv=none; d=google.com; s=arc-20160816; b=gq9b7dPu3rpsK4qm2NNdHzdPw2P7HLrLRAfwpyYK6JhaOSv4OXL4reBsu6DAcKeUZ2 oltxAGxApdTx7PziSHBu6P8v5v5aqCg9yv+it/Jt/3Q6LaonozowMO0CN9v7L8ZjZTet jEwlhcXAvOc3LFgyj2EfyUeh0jOFPtqmakY7upcIZC0WOq5k4qlIA7VRb7mZjkbkWdmn eJ0Jp9MjtcGX71oMjEXoCeuvdMIfMvUCV3pQ25hbk7h3U55VDrIH4gJYtQTnQwqVs/Rn g22ECpO9L4PD3YDVSRaTEA2ASNf0XU3VOGaRDB2IteXBniDhp3GMJ7ZJYEYgpP/VLpp+ WMsA== 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=CAbrTVrDd+vquw7c4UOJK7pyKOUo+ZWe2OOzzUZ1h+M=; b=tpCq7i1YrUHtJmYIvovYjxlcdiF7qzJeOAa6FvrHtZAcwGxqXbXfsLSkH7/p78kHuN USmLo0SZjsP7vaZl+RixWFOna2q+oG7LhcNIo8QuOhmiOfQ5m4egYcx4XNWu+IMxrQHs j0y/Nh0/uPONps1c+jv5rvkz43wWb2OSUVzI5uInTPmpdmUe6/2TO2RxdsU4L02JzkCf ZAEG6Cpyyko0HvULRBMj7eND2kbspCOmutCvngR9zy0vLEskfm9zV6dzv0lCyrHCH1TM bwRCYLhoLFMnAS/un+krIAUfWeKJ5/7acD6eHtu34apuNCOANfFrp/m0viDJN50BZXlv RFPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jKHxlc1G; 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 m14si5204608pgj.377.2019.05.24.09.21.05; Fri, 24 May 2019 09:21:05 -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=jKHxlc1G; 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 S2390978AbfEXQVE (ORCPT + 9 others); Fri, 24 May 2019 12:21:04 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:46046 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390308AbfEXQVD (ORCPT ); Fri, 24 May 2019 12:21:03 -0400 Received: by mail-lf1-f67.google.com with SMTP id n22so7561242lfe.12 for ; Fri, 24 May 2019 09:21:02 -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=CAbrTVrDd+vquw7c4UOJK7pyKOUo+ZWe2OOzzUZ1h+M=; b=jKHxlc1G0LUY1Zxsau5zBjmYumkEqZpUDKPeKmrfDlfbyK4pY1ZLdr3f/jHIIvJJxW P1WUYhGmq+YaBWXbFOoGpwK1rDvhOcxQ0JZD8ISWhl0gYOpSjkrBVStaNgj7GfYQm2z7 NILG1Gg2kuQgzu41xJbHuJ1ADG1RAhsyqYNiJoa6YNmJ5q7SVQ4KhczK4cTHILv8U+Ih N13AGZhL9L4rlgHckHag7JCjgnbkUPuIU88pTsJaDUUUBPYvZKbynWOvPgDgD12xU3Lj LlI6JZuiK1FLBU7FkMpl1HworzXTzzqLqOvDc8rLWlA3P696jpy+xXOy3o3TZzie7L0G 60PQ== 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=CAbrTVrDd+vquw7c4UOJK7pyKOUo+ZWe2OOzzUZ1h+M=; b=sXJqA5tRMUNgLZc6VZJahnrLUbj8kwskbvKyk6lQ2asfkBxh/S5U49mFH/OXF1RiQX 6igwIqvWBnuJrr7cPRsTMEEPIdxQ3OofkenwsxFJwEvON9qzEQ6+JAjIk4MOFrwiADMb MUQ6GZgccJ/R/I7xmMFM+eLfv/T4i1lkAkPdBEsPvVk1z5Bq8/BdvAzcr6yOJZjHsUHF 3rJtlaaWUTBuwobHWB086aRKoVLxPGS8vQnnK/sBKKdzcOs4B6fkQM6qK2llg7/SqkxM wmL+W9xGyJUkA1BIDQlalOxWT/tryvIboR0OfkhFUQ93Bp4gBLpIuKD3av+y+lzs/M69 jrOw== X-Gm-Message-State: APjAAAWgIH8XFZm4wBSwpUkMY2PtXCj9W7IAa2PBYWW+5eSVnJKhZkT1 T6GMB8bIqPoYGjV091iC2WWLVliF2Kk= X-Received: by 2002:ac2:5546:: with SMTP id l6mr20486653lfk.50.1558714861395; Fri, 24 May 2019 09:21:01 -0700 (PDT) Received: from localhost.bredbandsbolaget (c-d2cd225c.014-348-6c756e10.bbcust.telenor.se. [92.34.205.210]) by smtp.gmail.com with ESMTPSA id y4sm618075lje.24.2019.05.24.09.21.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 May 2019 09:21:00 -0700 (PDT) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" Cc: Krzysztof Halasa , Linus Walleij Subject: [PATCH 7/8] net: ethernet: ixp4xx: Add DT bindings Date: Fri, 24 May 2019 18:20:22 +0200 Message-Id: <20190524162023.9115-8-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190524162023.9115-1-linus.walleij@linaro.org> References: <20190524162023.9115-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 This adds device tree bindings for the IXP4xx ethernet. Signed-off-by: Linus Walleij --- .../bindings/net/intel,ixp4xx-ethernet.yaml | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/intel,ixp4xx-ethernet.yaml -- 2.20.1 diff --git a/Documentation/devicetree/bindings/net/intel,ixp4xx-ethernet.yaml b/Documentation/devicetree/bindings/net/intel,ixp4xx-ethernet.yaml new file mode 100644 index 000000000000..4575a7e5aa4a --- /dev/null +++ b/Documentation/devicetree/bindings/net/intel,ixp4xx-ethernet.yaml @@ -0,0 +1,53 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +# Copyright 2018 Linaro Ltd. +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/net/intel-ixp4xx-ethernet.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Intel IXP4xx ethernet + +maintainers: + - Linus Walleij + +description: | + The Intel IXP4xx ethernet makes use of the IXP4xx NPE (Network + Processing Engine) and the IXP4xx Queue Mangager to process + the ethernet frames. It can optionally contain an MDIO bus to + talk to PHYs. + +properties: + compatible: + oneOf: + - items: + - const: intel,ixp4xx-ethernet + + reg: + maxItems: 1 + description: Ethernet MMIO address range + + queue-rx: + $ref: '/schemas/types.yaml#/definitions/phandle-array' + maxItems: 1 + description: phandle to the RX queue on the NPE + + queue-txready: + $ref: '/schemas/types.yaml#/definitions/phandle-array' + maxItems: 1 + description: phandle to the TX READY queue on the NPE + +required: + - compatible + - reg + - queue-rx + - queue-txready + +examples: + - | + ethernet@c8009000 { + compatible = "intel,ixp4xx-ethernet"; + reg = <0xc8009000 0x1000>; + status = "disabled"; + queue-rx = <&qmgr 3>; + queue-txready = <&qmgr 20>; + }; From patchwork Fri May 24 16:20: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: 165135 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp3807056ili; Fri, 24 May 2019 09:21:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqwEvcdLD9xbcokWwld4tX3u59RG00jyqDTiIdYd94ZuTsSaYsvfNMq7p9HQOVxQosEG4o5G X-Received: by 2002:a62:d286:: with SMTP id c128mr114277833pfg.159.1558714872787; Fri, 24 May 2019 09:21:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558714872; cv=none; d=google.com; s=arc-20160816; b=srVVhZJdVRNw3qC41XctgbiaETW5yA7Z91JD0tmocQuFZ4ol86OV4Jd6ocvscydlUx 4SdanYzMWLu8+U1BFASrdW/luReCKwuIwu1U0ZMGY55DjdIdB7AReqMS6nLK+RPPkZan xFMd8g/khKPirAP2CTwePNJI3AYgb1h9zhIWwLOeO9QRT9fAXYwulOrK5tfIdAY7zk3y IUmMQph8eByVlMhCJ96yPPyyiGpYbdil8n3twkCQw1xdMb0cHZAZALMxBe+gG2P8jjfF iffVfSoEQHF285BViDwZBCdPe+b+dVdIWHpGv5XL/nQQ3n8vm+8wqv0IQzpua1gar9tZ MIhg== 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=eTEsCb23TLeixRMcycF5JVraveYSjIoqfPZsqxuqIKU=; b=V8V9OhuJyk0pUn7kmJqonQnqPjYu2FwHEfOvjgNNbpXCIdZ2CPIi1eYV6PNjkuyF18 INRAte547qSuhyFvwuZqU+q0ZmplqH637VGbufkEM4nPsNuz6yMUwOqdvq+gZkf5KYgO x+bo7YOu4+z+jLsmkH2V7+I89OpsU4yKM6tarkawsd/qukPu6OBimv1Pf7I3rnqeaxCD Ovz60sqJyRHHe5FuB3qF8u8d51e5VUskL4rAZyw0hnDf3fe52H3o3ya+PZZu41zAJyqR 30A2sJIHYHEj0XTJp22IyKYKk6ACGmP4wywe6HEaTQWEmYEDb2RdnHn4vA3eD1q3W/c2 1now== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GLxaiBAd; 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 m14si5204608pgj.377.2019.05.24.09.21.12; Fri, 24 May 2019 09:21:12 -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=GLxaiBAd; 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 S2391014AbfEXQVL (ORCPT + 9 others); Fri, 24 May 2019 12:21:11 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:44513 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390308AbfEXQVL (ORCPT ); Fri, 24 May 2019 12:21:11 -0400 Received: by mail-lf1-f68.google.com with SMTP id n134so7566276lfn.11 for ; Fri, 24 May 2019 09:21:09 -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=eTEsCb23TLeixRMcycF5JVraveYSjIoqfPZsqxuqIKU=; b=GLxaiBAdC5vmdEh/Nwlo5dRur66uY3HBkEyNriBkuevfdORykw6ng1WzHXj0AggSi4 +LSbOuVLeEEw6BNJAR12M8viisLPxMt+Ma6wMRvQFrfq9YRxlMw+qVEJervS/4UZEZkn hB3PoG9kEcmbqnhR2v9v13DPveEqqUJK5UryNHxZeCxV0/dlFLe+DzIZ2Q0ljgFbkABF qP7x2iEjE67e5+LfTNw6jhxVaWGfx9qkxcCkWEBSnTB8uhgfoOpEFWSLoHc5VmoFELve qjjLxSyIfiAs9sz/fEinszjSiHIdRDxA7lsAITygdnYfeTghNQJdTX/iPbq6gIn4bHiK 982A== 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=eTEsCb23TLeixRMcycF5JVraveYSjIoqfPZsqxuqIKU=; b=Ydh2xqpOjpZhMPmq/4LIf87mfnf3Nt9ejai1objluutiSodaaWN9qJN+94X2MI+V8Z JJMrnxLW0BgyfBKrbA/XtOfIB/lIiX5oxB6e2NA6j+5wxSIIdL5w5qrJz9MtDjxd+/Bl wB5e3QO/XLlNihbiAUeaYkPeaHYFl7YP0IQLNKRAXmtvXfqYA3e3Bj5ukRn8nkd2TOmc aaAxe2jtiwFS4yLtCzSSNq6AonHODlcxGiKZNCSK+nyvdMiM1wJso02OKWAYhPlxzU4+ wX9VC/56QFAVgpa+LkO6GOWWldkpejmtWOZj1iIj1blFIZb/ye67AEE5qsse2anhhYDS XCpQ== X-Gm-Message-State: APjAAAWRuSj2/Q7x2KQteSkfH+mvFA/LtyMiXsgHYqrvFkeJWcoqCClC OVUXDbdTej+7J/Z8uA5TVq9OgYaz1pI= X-Received: by 2002:a19:521a:: with SMTP id m26mr4815219lfb.134.1558714868390; Fri, 24 May 2019 09:21:08 -0700 (PDT) Received: from localhost.bredbandsbolaget (c-d2cd225c.014-348-6c756e10.bbcust.telenor.se. [92.34.205.210]) by smtp.gmail.com with ESMTPSA id y4sm618075lje.24.2019.05.24.09.21.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 May 2019 09:21:07 -0700 (PDT) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" Cc: Krzysztof Halasa , Linus Walleij Subject: [PATCH 8/8] net: ethernet: ixp4xx: Support device tree probing Date: Fri, 24 May 2019 18:20:23 +0200 Message-Id: <20190524162023.9115-9-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190524162023.9115-1-linus.walleij@linaro.org> References: <20190524162023.9115-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 This adds device tree probing to the IXP4xx ethernet driver. We need to drop the memory region request as part of this since the OF core will request the memory for the device. Signed-off-by: Linus Walleij --- drivers/net/ethernet/xscale/ixp4xx_eth.c | 80 +++++++++++++++++++----- 1 file changed, 66 insertions(+), 14 deletions(-) -- 2.20.1 diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index 8b883563a3d3..65fdc82d45a4 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c @@ -167,7 +167,6 @@ struct eth_regs { }; struct port { - struct resource *mem_res; struct eth_regs __iomem *regs; struct npe *npe; struct net_device *netdev; @@ -1367,19 +1366,72 @@ static const struct net_device_ops ixp4xx_netdev_ops = { .ndo_validate_addr = eth_validate_addr, }; +#ifdef CONFIG_OF +static struct eth_plat_info *ixp4xx_of_get_platdata(struct device *dev) +{ + struct device_node *np = dev->of_node; + struct of_phandle_args queue_spec; + struct eth_plat_info *plat; + u32 val; + int ret; + + plat = devm_kzalloc(dev, sizeof(*plat), GFP_KERNEL); + if (!plat) + return NULL; + + /* FIXME: get from MDIO handle */ + ret = of_property_read_u32(np, "phy", &val); + if (ret) { + dev_err(dev, "no phy\n"); + return NULL; + } + plat->phy = val; + + /* Get the rx queue as a resource from queue manager */ + ret = of_parse_phandle_with_fixed_args(np, "queue-rx", 1, 0, + &queue_spec); + if (ret) { + dev_err(dev, "no rx queue phandle\n"); + return NULL; + } + plat->rxq = queue_spec.args[0]; + + /* Get the txready queue as resource from queue manager */ + ret = of_parse_phandle_with_fixed_args(np, "queue-txready", 1, 0, + &queue_spec); + if (ret) { + dev_err(dev, "no txready queue phandle\n"); + return NULL; + } + plat->txreadyq = queue_spec.args[0]; + + return plat; +} +#else +static struct eth_plat_info *ixp4xx_of_get_platdata(struct device *dev) +{ + return NULL; +} +#endif + static int ixp4xx_eth_probe(struct platform_device *pdev) { char phy_id[MII_BUS_ID_SIZE + 3]; struct phy_device *phydev = NULL; struct device *dev = &pdev->dev; struct eth_plat_info *plat; - resource_size_t regs_phys; struct net_device *ndev; struct resource *res; struct port *port; int err; - plat = dev_get_platdata(dev); + if (dev->of_node) + plat = ixp4xx_of_get_platdata(dev); + else + plat = dev_get_platdata(dev); + + if (!plat) + return -ENODEV; if (!(ndev = devm_alloc_etherdev(dev, sizeof(struct port)))) return -ENOMEM; @@ -1392,7 +1444,6 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) return -ENODEV; - regs_phys = res->start; port->regs = devm_ioremap_resource(dev, res); switch (res->start) { @@ -1450,12 +1501,6 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) if (!(port->npe = npe_request(NPE_ID(port->id)))) return -EIO; - port->mem_res = request_mem_region(regs_phys, REGS_SIZE, ndev->name); - if (!port->mem_res) { - err = -EBUSY; - goto err_npe_rel; - } - port->plat = plat; npe_port_tab[NPE_ID(port->id)] = port; memcpy(ndev->dev_addr, plat->hwaddr, ETH_ALEN); @@ -1491,8 +1536,6 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) phy_disconnect(phydev); err_free_mem: npe_port_tab[NPE_ID(port->id)] = NULL; - release_resource(port->mem_res); -err_npe_rel: npe_release(port->npe); return err; } @@ -1508,12 +1551,21 @@ static int ixp4xx_eth_remove(struct platform_device *pdev) ixp4xx_mdio_remove(); npe_port_tab[NPE_ID(port->id)] = NULL; npe_release(port->npe); - release_resource(port->mem_res); return 0; } +static const struct of_device_id ixp4xx_eth_of_match[] = { + { + .compatible = "intel,ixp4xx-ethernet", + }, + { }, +}; + static struct platform_driver ixp4xx_eth_driver = { - .driver.name = DRV_NAME, + .driver = { + .name = DRV_NAME, + .of_match_table = of_match_ptr(ixp4xx_eth_of_match), + }, .probe = ixp4xx_eth_probe, .remove = ixp4xx_eth_remove, };