From patchwork Sat Aug 28 17:15:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 503771 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp259752jai; Sat, 28 Aug 2021 10:18:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOWfClnozy+IYyUi/reopCMLB+L9NDeQwJjHEs8rnswd/ItDIbimS+cMfBc3WaVx6pZIbE X-Received: by 2002:a05:6e02:1888:: with SMTP id o8mr10601286ilu.124.1630171088440; Sat, 28 Aug 2021 10:18:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630171088; cv=none; d=google.com; s=arc-20160816; b=DyaMKedPWz2qYE3g/R9MxLva0JHmVKNAq/I9wyWVcoIJadn0b7QXdumyu+RY3MD7xK G90ZfB9nJYUHQY4KkwFjro4EC8yFqCX1H+WIU+s3j+upzhupCWDKtIK4EpyCjICXwx7i ij/a3imncrBDQ9sC1+5FBIDbqJkVeg8Q9c5SBPjAe4Cpl7Am5cj+ODN5+w1oX3Pn/+hr ADFPV9g78yyLiyr9gFOY/7/TxmWgQiV2Ks91Ophm2QXZPSQI0qTVSYeuKS+nGZ74sx42 8M75DM7HhjTeH21WqUUL75x26T+Xi25aNvT+ZBNtB08m7qeZeIeu1xDs1YFuH0vhOsPD AKUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HJYaIJiWLIhMl/1yez9NfO52hMkbZOCzfqOKurRdjQ4=; b=lXmZ20Tn1YdgdhjMisCspetQ4Y/fo82yvz4AGH0t5CGVIoCP4OLxUpQSorMScg6D5u oLCtRrMbzTbGqWS9KRGK3cjYVfJg/zsLSN5xXlElY6N/BrVlJACDFUI5U2ITyB+QKISL nh/r10bZlw5JlgB7Y+iYj/i6HogAq20QhfZdeVaTg+x0MBsXy2fxS7YST7++s30j6hff d9rvsPbY9yJ7jcYx9tzhQv28NE8qBjdTPwayc+iQz+ubfg7SE5ACIq2cQanrkOf71YeE 57ll7Lbons+Bj9PHlqanu10lqnHSGOzk4sXhH+nLQ3W9ZUtNwAljh3HSUyGV+DFk0dRk jqvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GZZzsG1R; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id i126si4695650iof.61.2021.08.28.10.18.08; Sat, 28 Aug 2021 10:18:08 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GZZzsG1R; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 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 S234357AbhH1RS6 (ORCPT + 8 others); Sat, 28 Aug 2021 13:18:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229574AbhH1RS4 (ORCPT ); Sat, 28 Aug 2021 13:18:56 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86996C061756 for ; Sat, 28 Aug 2021 10:18:05 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id k5so21508407lfu.4 for ; Sat, 28 Aug 2021 10:18:05 -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=HJYaIJiWLIhMl/1yez9NfO52hMkbZOCzfqOKurRdjQ4=; b=GZZzsG1RLqUDzy45SxK0y+lKa4x3831v2MpcgSFCMYTrfFGxn2OrzDUYsasWqEUo0z SpdAtsEe+C7FO6K2U0m/WSsGV2NkCy0TMczLT5b0q8sllqx4cPgPzgYMtZ/VMU7hTwSH O4RWcVnrj5VDvxv1cYSSrCGi/OYoTExn2k2kDaZxLudDNnOMkQtOi5LUR6qq+svhkarg nMrtdQUVu725OIV276oqM8eRjZ1a1ke9OcV+QCosKiVmLqj8ENqR2/c9Ij+qEuYpMb4K k2DWTWl4zA2kDDEKCsJYbR8mIt8uyXsQXQNZYbLA4VYmSXYOYR9HgJ+f+k2BXPhlakoZ hwmw== 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=HJYaIJiWLIhMl/1yez9NfO52hMkbZOCzfqOKurRdjQ4=; b=AHVH91dp9gP/SvheuaQzOmd7w7kX3cSpP4q4CNIl7jRY86n7nubsLnXlRfO2DsEQx6 YY7xuf7GPhpnKT1C65hcepV6CBx+k3bkwXhGt3En6fMQuyew4FBTDQzzJfJ7vQqN/w7o nDB2GhYe2AAgsXXFkjguQQB1M7Ws4spheb0hr4Sv9ns0n46DwlcEsYqZARXwYZOxJFJZ 6bLBUeDi85oFe11SGxVx0ySyi+M5jsQ73WhyFnWICjnBt7m+/8hx6jDLvESegRjosQeJ mkLEd9LulW+72aiBlYUbh4ru+5/VRdm+02pK/Rn85GyO/67hhpMNpsjqVdxQqyKfyJb5 DRnQ== X-Gm-Message-State: AOAM531EmNUP3vgIiSuD1dUVhPlyEQ/ZU1QNqBxUmwD9hmSblLZHcmS/ yCpN0WGEoJMzbkEfg0Y8tXkpsl2fxLNm+A== X-Received: by 2002:a19:6d01:: with SMTP id i1mr10690935lfc.414.1630171083645; Sat, 28 Aug 2021 10:18:03 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id p1sm202195lfo.255.2021.08.28.10.18.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Aug 2021 10:18:03 -0700 (PDT) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" , Jakub Kicinski Cc: Imre Kaloz , Krzysztof Halasa , Arnd Bergmann , Linus Walleij Subject: [PATCH net-next 1/5 v3] ixp4xx_eth: make ptp support a platform driver Date: Sat, 28 Aug 2021 19:15:44 +0200 Message-Id: <20210828171548.143057-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210828171548.143057-1-linus.walleij@linaro.org> References: <20210828171548.143057-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Arnd Bergmann After the recent ixp4xx cleanups, the ptp driver has gained a build failure in some configurations: drivers/net/ethernet/xscale/ptp_ixp46x.c: In function 'ptp_ixp_init': drivers/net/ethernet/xscale/ptp_ixp46x.c:290:51: error: 'IXP4XX_TIMESYNC_BASE_VIRT' undeclared (first use in this function) Avoid the last bit of hardcoded constants from platform headers by turning the ptp driver bit into a platform driver and passing the IRQ and MMIO address as resources. This is a bit tricky: - The interface between the two drivers is now the new ixp46x_ptp_find() function, replacing the global ixp46x_phc_index variable. The call is done as late as possible, in hwtstamp_set(), to ensure that the ptp device is fully probed. - As the ptp driver is now called by the network driver, the link dependency is reversed, which in turn requires a small Makefile hack - The GPIO number is still left hardcoded. This is clearly not great, but it can be addressed later. Note that commit 98ac0cc270b7 ("ARM: ixp4xx: Convert to MULTI_IRQ_HANDLER") changed the IRQ number to something meaningless. Passing the correct IRQ in a resource fixes this. - When the PTP driver is disabled, ethtool .get_ts_info() now correctly lists only software timestamping regardless of the hardware. Signed-off-by: Arnd Bergmann [Fix a missing include] Signed-off-by: Linus Walleij --- arch/arm/mach-ixp4xx/common.c | 14 ++++++ drivers/net/ethernet/xscale/Kconfig | 4 +- drivers/net/ethernet/xscale/Makefile | 6 ++- drivers/net/ethernet/xscale/ixp46x_ts.h | 13 ++++- drivers/net/ethernet/xscale/ixp4xx_eth.c | 28 +++++++---- drivers/net/ethernet/xscale/ptp_ixp46x.c | 61 ++++++++++++++++-------- 6 files changed, 92 insertions(+), 34 deletions(-) -- 2.31.1 diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c index b5eadd70d903..cdc720f54daa 100644 --- a/arch/arm/mach-ixp4xx/common.c +++ b/arch/arm/mach-ixp4xx/common.c @@ -268,9 +268,23 @@ static struct platform_device ixp46x_i2c_controller = { .resource = ixp46x_i2c_resources }; +static struct resource ixp46x_ptp_resources[] = { + DEFINE_RES_MEM(IXP4XX_TIMESYNC_BASE_PHYS, SZ_4K), + DEFINE_RES_IRQ_NAMED(IRQ_IXP4XX_GPIO8, "master"), + DEFINE_RES_IRQ_NAMED(IRQ_IXP4XX_GPIO7, "slave"), +}; + +static struct platform_device ixp46x_ptp = { + .name = "ptp-ixp46x", + .id = -1, + .resource = ixp46x_ptp_resources, + .num_resources = ARRAY_SIZE(ixp46x_ptp_resources), +}; + static struct platform_device *ixp46x_devices[] __initdata = { &ixp46x_hwrandom_device, &ixp46x_i2c_controller, + &ixp46x_ptp, }; unsigned long ixp4xx_exp_bus_size; diff --git a/drivers/net/ethernet/xscale/Kconfig b/drivers/net/ethernet/xscale/Kconfig index 468ffe3d1707..0e878fa6e322 100644 --- a/drivers/net/ethernet/xscale/Kconfig +++ b/drivers/net/ethernet/xscale/Kconfig @@ -29,9 +29,9 @@ config IXP4XX_ETH on IXP4xx processor. config PTP_1588_CLOCK_IXP46X - tristate "Intel IXP46x as PTP clock" + bool "Intel IXP46x as PTP clock" depends on IXP4XX_ETH - depends on PTP_1588_CLOCK + depends on PTP_1588_CLOCK=y || PTP_1588_CLOCK=IXP4XX_ETH default y help This driver adds support for using the IXP46X as a PTP diff --git a/drivers/net/ethernet/xscale/Makefile b/drivers/net/ethernet/xscale/Makefile index 607f91b1e878..e935f2a2979f 100644 --- a/drivers/net/ethernet/xscale/Makefile +++ b/drivers/net/ethernet/xscale/Makefile @@ -3,5 +3,9 @@ # Makefile for the Intel XScale IXP device drivers. # +# Keep this link order to avoid deferred probing +ifdef CONFIG_PTP_1588_CLOCK_IXP46X +obj-$(CONFIG_IXP4XX_ETH) += ptp_ixp46x.o +endif + obj-$(CONFIG_IXP4XX_ETH) += ixp4xx_eth.o -obj-$(CONFIG_PTP_1588_CLOCK_IXP46X) += ptp_ixp46x.o diff --git a/drivers/net/ethernet/xscale/ixp46x_ts.h b/drivers/net/ethernet/xscale/ixp46x_ts.h index d792130e27b0..ee9b93ded20a 100644 --- a/drivers/net/ethernet/xscale/ixp46x_ts.h +++ b/drivers/net/ethernet/xscale/ixp46x_ts.h @@ -62,7 +62,16 @@ struct ixp46x_ts_regs { #define TX_SNAPSHOT_LOCKED (1<<0) #define RX_SNAPSHOT_LOCKED (1<<1) -/* The ptp_ixp46x module will set this variable */ -extern int ixp46x_phc_index; +#if IS_ENABLED(CONFIG_PTP_1588_CLOCK_IXP46X) +int ixp46x_ptp_find(struct ixp46x_ts_regs *__iomem *regs, int *phc_index); +#else +static inline int ixp46x_ptp_find(struct ixp46x_ts_regs *__iomem *regs, int *phc_index) +{ + *regs = NULL; + *phc_index = -1; + + return -ENODEV; +} +#endif #endif diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index ff50305d6e13..0bd22beb83ed 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c @@ -169,6 +169,8 @@ struct eth_regs { struct port { struct eth_regs __iomem *regs; + struct ixp46x_ts_regs __iomem *timesync_regs; + int phc_index; struct npe *npe; struct net_device *netdev; struct napi_struct napi; @@ -295,7 +297,7 @@ static void ixp_rx_timestamp(struct port *port, struct sk_buff *skb) ch = PORT2CHANNEL(port); - regs = (struct ixp46x_ts_regs __iomem *) IXP4XX_TIMESYNC_BASE_VIRT; + regs = port->timesync_regs; val = __raw_readl(®s->channel[ch].ch_event); @@ -340,7 +342,7 @@ static void ixp_tx_timestamp(struct port *port, struct sk_buff *skb) ch = PORT2CHANNEL(port); - regs = (struct ixp46x_ts_regs __iomem *) IXP4XX_TIMESYNC_BASE_VIRT; + regs = port->timesync_regs; /* * This really stinks, but we have to poll for the Tx time stamp. @@ -375,6 +377,7 @@ static int hwtstamp_set(struct net_device *netdev, struct ifreq *ifr) struct hwtstamp_config cfg; struct ixp46x_ts_regs *regs; struct port *port = netdev_priv(netdev); + int ret; int ch; if (copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg))) @@ -383,8 +386,12 @@ static int hwtstamp_set(struct net_device *netdev, struct ifreq *ifr) if (cfg.flags) /* reserved for future extensions */ return -EINVAL; + ret = ixp46x_ptp_find(&port->timesync_regs, &port->phc_index); + if (ret) + return ret; + ch = PORT2CHANNEL(port); - regs = (struct ixp46x_ts_regs __iomem *) IXP4XX_TIMESYNC_BASE_VIRT; + regs = port->timesync_regs; if (cfg.tx_type != HWTSTAMP_TX_OFF && cfg.tx_type != HWTSTAMP_TX_ON) return -ERANGE; @@ -988,25 +995,27 @@ static void ixp4xx_get_drvinfo(struct net_device *dev, strlcpy(info->bus_info, "internal", sizeof(info->bus_info)); } -int ixp46x_phc_index = -1; -EXPORT_SYMBOL_GPL(ixp46x_phc_index); - static int ixp4xx_get_ts_info(struct net_device *dev, struct ethtool_ts_info *info) { - if (!cpu_is_ixp46x()) { + struct port *port = netdev_priv(dev); + + if (port->phc_index < 0) + ixp46x_ptp_find(&port->timesync_regs, &port->phc_index); + + info->phc_index = port->phc_index; + + if (info->phc_index < 0) { info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE | SOF_TIMESTAMPING_RX_SOFTWARE | SOF_TIMESTAMPING_SOFTWARE; - info->phc_index = -1; return 0; } info->so_timestamping = SOF_TIMESTAMPING_TX_HARDWARE | SOF_TIMESTAMPING_RX_HARDWARE | SOF_TIMESTAMPING_RAW_HARDWARE; - info->phc_index = ixp46x_phc_index; info->tx_types = (1 << HWTSTAMP_TX_OFF) | (1 << HWTSTAMP_TX_ON); @@ -1481,6 +1490,7 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) port = netdev_priv(ndev); port->netdev = ndev; port->id = plat->npe; + port->phc_index = -1; /* Get the port resource and remap */ port->regs = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); diff --git a/drivers/net/ethernet/xscale/ptp_ixp46x.c b/drivers/net/ethernet/xscale/ptp_ixp46x.c index a6fb88fd42f7..466f233edd21 100644 --- a/drivers/net/ethernet/xscale/ptp_ixp46x.c +++ b/drivers/net/ethernet/xscale/ptp_ixp46x.c @@ -5,6 +5,7 @@ * Copyright (C) 2010 OMICRON electronics GmbH */ #include +#include #include #include #include @@ -13,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -22,9 +24,7 @@ #define DRIVER "ptp_ixp46x" #define N_EXT_TS 2 #define MASTER_GPIO 8 -#define MASTER_IRQ 25 #define SLAVE_GPIO 7 -#define SLAVE_IRQ 24 struct ixp_clock { struct ixp46x_ts_regs *regs; @@ -32,9 +32,11 @@ struct ixp_clock { struct ptp_clock_info caps; int exts0_enabled; int exts1_enabled; + int slave_irq; + int master_irq; }; -DEFINE_SPINLOCK(register_lock); +static DEFINE_SPINLOCK(register_lock); /* * Register access functions @@ -275,21 +277,36 @@ static int setup_interrupt(int gpio) return irq; } -static void __exit ptp_ixp_exit(void) +int ixp46x_ptp_find(struct ixp46x_ts_regs *__iomem *regs, int *phc_index) { - free_irq(MASTER_IRQ, &ixp_clock); - free_irq(SLAVE_IRQ, &ixp_clock); - ixp46x_phc_index = -1; - ptp_clock_unregister(ixp_clock.ptp_clock); + *regs = ixp_clock.regs; + *phc_index = ptp_clock_index(ixp_clock.ptp_clock); + + if (!ixp_clock.ptp_clock) + return -EPROBE_DEFER; + + return 0; } +EXPORT_SYMBOL_GPL(ixp46x_ptp_find); -static int __init ptp_ixp_init(void) +static int ptp_ixp_remove(struct platform_device *pdev) { - if (!cpu_is_ixp46x()) - return -ENODEV; + free_irq(ixp_clock.master_irq, &ixp_clock); + free_irq(ixp_clock.slave_irq, &ixp_clock); + ptp_clock_unregister(ixp_clock.ptp_clock); + ixp_clock.ptp_clock = NULL; - ixp_clock.regs = - (struct ixp46x_ts_regs __iomem *) IXP4XX_TIMESYNC_BASE_VIRT; + return 0; +} + +static int ptp_ixp_probe(struct platform_device *pdev) +{ + ixp_clock.regs = devm_platform_ioremap_resource(pdev, 0); + ixp_clock.master_irq = platform_get_irq(pdev, 0); + ixp_clock.slave_irq = platform_get_irq(pdev, 1); + if (IS_ERR(ixp_clock.regs) || + !ixp_clock.master_irq || !ixp_clock.slave_irq) + return -ENXIO; ixp_clock.caps = ptp_ixp_caps; @@ -298,32 +315,36 @@ static int __init ptp_ixp_init(void) if (IS_ERR(ixp_clock.ptp_clock)) return PTR_ERR(ixp_clock.ptp_clock); - ixp46x_phc_index = ptp_clock_index(ixp_clock.ptp_clock); - __raw_writel(DEFAULT_ADDEND, &ixp_clock.regs->addend); __raw_writel(1, &ixp_clock.regs->trgt_lo); __raw_writel(0, &ixp_clock.regs->trgt_hi); __raw_writel(TTIPEND, &ixp_clock.regs->event); - if (MASTER_IRQ != setup_interrupt(MASTER_GPIO)) { + if (ixp_clock.master_irq != setup_interrupt(MASTER_GPIO)) { pr_err("failed to setup gpio %d as irq\n", MASTER_GPIO); goto no_master; } - if (SLAVE_IRQ != setup_interrupt(SLAVE_GPIO)) { + if (ixp_clock.slave_irq != setup_interrupt(SLAVE_GPIO)) { pr_err("failed to setup gpio %d as irq\n", SLAVE_GPIO); goto no_slave; } return 0; no_slave: - free_irq(MASTER_IRQ, &ixp_clock); + free_irq(ixp_clock.master_irq, &ixp_clock); no_master: ptp_clock_unregister(ixp_clock.ptp_clock); + ixp_clock.ptp_clock = NULL; return -ENODEV; } -module_init(ptp_ixp_init); -module_exit(ptp_ixp_exit); +static struct platform_driver ptp_ixp_driver = { + .driver.name = "ptp-ixp46x", + .driver.suppress_bind_attrs = true, + .probe = ptp_ixp_probe, + .remove = ptp_ixp_remove, +}; +module_platform_driver(ptp_ixp_driver); MODULE_AUTHOR("Richard Cochran "); MODULE_DESCRIPTION("PTP clock using the IXP46X timer"); From patchwork Sat Aug 28 17:15:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 503772 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp259813jai; Sat, 28 Aug 2021 10:18:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylayBlrl48odFokGZipeG6Qhkzjz6IrBffFT1vXmr8y+PhB8flBrRecliWWSQpxA6nDv7V X-Received: by 2002:a02:ab87:: with SMTP id t7mr13197269jan.127.1630171093301; Sat, 28 Aug 2021 10:18:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630171093; cv=none; d=google.com; s=arc-20160816; b=dZWGKPdvQ/W3KSnDUx3f5IHv7ruHCneRRoeRj/y61dWCHcfNif9nKD7sJlCrB3af9I RyvVRQ2SAKHOXiY083OXPG3DLCI4Jcwah0JVmY5U3R9X7lMRV6/Vne27oRMvF81rvmDM FufFTKXks+TRwak1qiMRdKWCwXFsVbsu2kpxky67dndVgOUZkGITRQ1gEJWBHFnc8Of0 tgGFZbeUZzeYPb5hH/g9/IIfjUiSA/UufxVlZiXKrS8UyOWhawhgyNLpwkuKY+o73IAh kNYzARkGdB/uG8o4+t7qmgI+D3UaeVnpPW+L7b7BydLqYsocFQO8jQTsrLBoe0nDwDWg 8bQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=D7ibt3Lae3RXcE7WOmyu3z09/xMR6Le2PSBAAAdLFdU=; b=CK8PlhiTayehwAnBIN44ImRAqCj1fyc9zco4SEWDrqYFgjkhhLlpKpixdeJwSPf7sO jwp2EWTrYGxd4lOSHOPIUfJZgEhEJsmf74PbKPX/xf3cwF/enaZ8Gsa0qrOaUYM7JxXm smDRfJeElwEcimzlqh0i5nDktR+fxqEmi9pwamcICQS++BySdge2vC+vFJcycpd925K2 leIUMPZD+mumWMnyG6wW9xRsLcJgZeFnCdeZjyQ7FwFRoxNo1Z+D1B2zVFBaEdw6gC4j AsUyLPozPC8lgWa7FqH7+bTesceKCkV0Ebxs03LA76BRmLjbz6qTBFyGl8DOsqLuMxLT h7Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Xy3dcuzb; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id i126si4695650iof.61.2021.08.28.10.18.13; Sat, 28 Aug 2021 10:18:13 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Xy3dcuzb; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 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 S234605AbhH1RTA (ORCPT + 8 others); Sat, 28 Aug 2021 13:19:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234399AbhH1RS6 (ORCPT ); Sat, 28 Aug 2021 13:18:58 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F006C061756 for ; Sat, 28 Aug 2021 10:18:07 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id b4so21395107lfo.13 for ; Sat, 28 Aug 2021 10:18:07 -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=D7ibt3Lae3RXcE7WOmyu3z09/xMR6Le2PSBAAAdLFdU=; b=Xy3dcuzbdiBOLN5ietr0FsbbNMLw2Qtg/Fck+UX9W4lNQ/TiYz4ttJCIvYuOBgRmxc 45i953isJt7pjmCJssrOQNeEpyTqI/5Y8VcYT32nGrUiVmKRwXdNxor7k2LQvKRlUK8m 4En5oqbmt1qDarXvQJ/4JIu8/yoJhA6Vz3DHJmuCLf8wwStgTdTbcci7O/BXKQorgcy2 ukPdex/7hWM1bmJDuY5M6BBPb63RdRwqTSCjG811LDk+a0mZNLBYBqHXaSQgUgf4pWXw R/NAoXwLSxJM6cDnGrReAMfPo25JKzr/KpVrDpDY2Afrxpm+5I8brr/Fuf3YXRDH+AnZ JKrg== 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=D7ibt3Lae3RXcE7WOmyu3z09/xMR6Le2PSBAAAdLFdU=; b=UJ0uCK1dbr0jX76uhklXIFFhOTgARqZmVradOBnHz7afNSbNyOx4a/mMwgj1JcCf74 grTfSkgaETo87ey7K+2Nlz2fXfwenPW1ZG8p5oPI93uEBIV4tjpcOc8WR+0bllGUlKtd D6dX2vm3TSLU4AYhfIq1OgjG7WWTMe+q4K6v4lupabagkaRs/FV8ylWyaozumcVrW9Lb Cj8OgJhgF0lb8iANosX1+S2C5/K2hsKWdKoX/8spCwg5YwaTGUeXJTvc3GUrcRe46msr tIAJ8GxSB0wka4tS8W7qvl01bwGxDnNtKEsn2aN0nxpkcIpSUUVnudxBWCPZyUgui2o8 NSXQ== X-Gm-Message-State: AOAM5303OLXCsaW482ZzpNRno/id09s28AI9LeBDV2oZDxo/V1rhl2CH n7G+YVv5UMos/N54emko2Zy5ERUpNKY7/A== X-Received: by 2002:ac2:5f99:: with SMTP id r25mr11038202lfe.119.1630171084963; Sat, 28 Aug 2021 10:18:04 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id p1sm202195lfo.255.2021.08.28.10.18.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Aug 2021 10:18:04 -0700 (PDT) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" , Jakub Kicinski Cc: Imre Kaloz , Krzysztof Halasa , Arnd Bergmann , Linus Walleij Subject: [PATCH net-next 2/5 v3] ixp4xx_eth: fix compile-testing Date: Sat, 28 Aug 2021 19:15:45 +0200 Message-Id: <20210828171548.143057-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210828171548.143057-1-linus.walleij@linaro.org> References: <20210828171548.143057-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Arnd Bergmann Change the driver to use portable integer types to avoid warnings during compile testing, including: drivers/net/ethernet/xscale/ixp4xx_eth.c:721:21: error: cast to 'u32 *' (aka 'unsigned int *') from smaller integer type 'int' [-Werror,-Wint-to-pointer-cast] memcpy_swab32(mem, (u32 *)((int)skb->data & ~3), bytes / 4); ^ drivers/net/ethernet/xscale/ixp4xx_eth.c:963:12: error: incompatible pointer types passing 'u32 *' (aka 'unsigned int *') to parameter of type 'dma_addr_t *' (aka 'unsigned long long *') [-Werror,-Wincompatible-pointer-types] &port->desc_tab_phys))) ^~~~~~~~~~~~~~~~~~~~ include/linux/dmapool.h:27:20: note: passing argument to parameter 'handle' here dma_addr_t *handle); ^ Signed-off-by: Arnd Bergmann Signed-off-by: Linus Walleij --- drivers/net/ethernet/xscale/ixp4xx_eth.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) -- 2.31.1 diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index 0bd22beb83ed..931494cc1c39 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c @@ -37,7 +37,6 @@ #include #include #include -#include #include #include "ixp46x_ts.h" @@ -177,7 +176,7 @@ struct port { struct eth_plat_info *plat; buffer_t *rx_buff_tab[RX_DESCS], *tx_buff_tab[TX_DESCS]; struct desc *desc_tab; /* coherent */ - u32 desc_tab_phys; + dma_addr_t desc_tab_phys; int id; /* logical port ID */ int speed, duplex; u8 firmware[4]; @@ -857,14 +856,14 @@ static int eth_xmit(struct sk_buff *skb, struct net_device *dev) bytes = len; mem = skb->data; #else - offset = (int)skb->data & 3; /* keep 32-bit alignment */ + offset = (uintptr_t)skb->data & 3; /* keep 32-bit alignment */ bytes = ALIGN(offset + len, 4); if (!(mem = kmalloc(bytes, GFP_ATOMIC))) { dev_kfree_skb(skb); dev->stats.tx_dropped++; return NETDEV_TX_OK; } - memcpy_swab32(mem, (u32 *)((int)skb->data & ~3), bytes / 4); + memcpy_swab32(mem, (u32 *)((uintptr_t)skb->data & ~3), bytes / 4); #endif phys = dma_map_single(&dev->dev, mem, bytes, DMA_TO_DEVICE); From patchwork Sat Aug 28 17:15:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 503774 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp259852jai; Sat, 28 Aug 2021 10:18:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvH+wNwiiKBCd4L3TKA/yKvB8yZk3Wqb0lQ68Q7wrJxI+jDjP/XzRlR/+i/ufpjAafSCg1 X-Received: by 2002:a05:6e02:dcc:: with SMTP id l12mr10634430ilj.20.1630171097015; Sat, 28 Aug 2021 10:18:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630171097; cv=none; d=google.com; s=arc-20160816; b=kU/ordASEG/2/kbdPEb6MI2X/twDni9GB7hbYu11ASAZ6wm79BIGW7EmMEq3aw5o6q HYWq6Fz3QMAK2vaOLUjffqdF651Ssukno1feRWek5Qsmui80Z7Lgh1hOcYWNnNoYhbWT UwbXth7PHnctbxS+ddddIBlkjZPWJzWGN+x/UQ6bIofE+8+7OOHVf9htFfADoqhd2ToE 9JPuCPbeJknhc99N0QAzwpAhKs0WWwrDO5NbTecUjX90VqADI8OKaEBGpMW7YbqTBNg2 gkfdJ2WUKBuCJYLngB1ZhrYcVsDC/WqJq6/JpkeMYS8+3Q/TWglK4AEvVqAtmEaepCxk BgEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZXI2en2FpO56VmbTeLm1+JipCE8ULCAYjbhwip5qLZ0=; b=K5UUls/6Nj9dOcWXuNJvmpuQJ4l5g9W4K6gOo79ot24zY6o5GW4Bm63TyJO6ZYJsuk F9sR/h662lpMYLW9g5vPcFTpZnbQOCPVp7up7NEjbVVvDgZtCIbAh9wxWILA00MLZDdL n1bQimcXunO5rcTSQboAgbLnS8DfzxQfj+xE+a1bti5fw3T1bHJeWEoRv7Rgkur7vOGD pjLBC9Wzh3o+uZfdb6PpYEg23iyNluxskkzskrsbkRseKnrcKkQ/+Zn49GvzrAYGuhte ZFfGmf9cfm3sTY3g2vCys883X8nGUZyA+1rih1Yh3QRqOs4lscZzP2BgOONYZNmj9NHh 9SSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hvWE2eXE; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id i126si4695650iof.61.2021.08.28.10.18.16; Sat, 28 Aug 2021 10:18:17 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hvWE2eXE; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 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 S234647AbhH1RTG (ORCPT + 8 others); Sat, 28 Aug 2021 13:19:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229574AbhH1RS6 (ORCPT ); Sat, 28 Aug 2021 13:18:58 -0400 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4E20C0613D9 for ; Sat, 28 Aug 2021 10:18:07 -0700 (PDT) Received: by mail-lj1-x22e.google.com with SMTP id h1so17442226ljl.9 for ; Sat, 28 Aug 2021 10:18:07 -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=ZXI2en2FpO56VmbTeLm1+JipCE8ULCAYjbhwip5qLZ0=; b=hvWE2eXExRvPfs7okKuf18YhH/yeTHDrP0yKn3lNm/w+5+sUDpMVoKON2Gd4Nl9dzt antEJyF5qB2Pj/Jmu9wQbHIAgVt/NDfs7dTHY7ghZ5mvUbi5uSjvPIRk3trNrxoozfhF GjiXm0oc+1lRyaXCfVOX/enoCNponcZVRRCErDJcnyAJ+gYQaA+AQ3DiHarg1gFcVUab oK3IaWBqjrJ8UKT7MfmTMYlTnVX5AA36MZPXRi5atQYKHoXwFoTEOpUq3nhBSkNW+75b bMGdW8pn5N3p+fT6iOHLA/w8PUSMGbN9kWUzRf3hQdvlC4apy5TPL6ib0wCm9o6f/TxP yGYw== 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=ZXI2en2FpO56VmbTeLm1+JipCE8ULCAYjbhwip5qLZ0=; b=ZZ3EAAQ66WnqVhHfpRU7VHXhzTxuETkMBpLBBuLzX8lnaaxQACKWUnY2vWo/kp9rV/ iItwLsCx8DrooiISKPCaqMKH2GH50oA3B+XQNs7Z8XFQ3cThdxrn5JgQPO5weHByTgYv 0iWDfIiGZTCslzbDo9j837l8C9YQXEs/TjGIlYp9PS1BqGmY/KC4tGPQys9bzxXzvxbU oDvOg8TtsfdkkO9MGSvlIfcpDrDEwlp4WeXw1fAUIEgnUoRYrSWvcn/oMCyNAghSqsIt FFRi6PtdUNNzYFEkh7zckBunkDjdtzHmutcBhJKLsIt7fN8pMKhfQK4DWooHsCkdB/EQ KYUg== X-Gm-Message-State: AOAM532+ZThwNfhXF88qkFSm4BiFDaekrgYTJf5vhHLQUqJnRi4g+jgU DBjLB9f7pSAF4ZS7UW7O0nXCWHJYVGhQ4g== X-Received: by 2002:a2e:99c8:: with SMTP id l8mr13133242ljj.178.1630171086161; Sat, 28 Aug 2021 10:18:06 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id p1sm202195lfo.255.2021.08.28.10.18.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Aug 2021 10:18:05 -0700 (PDT) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" , Jakub Kicinski Cc: Imre Kaloz , Krzysztof Halasa , Linus Walleij , Arnd Bergmann Subject: [PATCH net-next 3/5 v3] ixp4xx_eth: Stop referring to GPIOs Date: Sat, 28 Aug 2021 19:15:46 +0200 Message-Id: <20210828171548.143057-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210828171548.143057-1-linus.walleij@linaro.org> References: <20210828171548.143057-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The driver is being passed interrupts, then looking up the same interrupts as GPIOs a second time to convert them into interrupts and set properties on them. This is pointless: the GPIO and irqchip APIs of a GPIO chip are orthogonal. Just request the interrupts and be done with it, drop reliance on any GPIO functions or definitions. Use devres-managed functions and add a small devress quirk to unregister the clock as well and we can rely on devres to handle all the resources and cut down a bunch of boilerplate in the process. Cc: Arnd Bergmann Signed-off-by: Linus Walleij --- drivers/net/ethernet/xscale/ptp_ixp46x.c | 84 ++++++++---------------- 1 file changed, 28 insertions(+), 56 deletions(-) -- 2.31.1 diff --git a/drivers/net/ethernet/xscale/ptp_ixp46x.c b/drivers/net/ethernet/xscale/ptp_ixp46x.c index 466f233edd21..c7ff150bf23f 100644 --- a/drivers/net/ethernet/xscale/ptp_ixp46x.c +++ b/drivers/net/ethernet/xscale/ptp_ixp46x.c @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include @@ -23,8 +22,6 @@ #define DRIVER "ptp_ixp46x" #define N_EXT_TS 2 -#define MASTER_GPIO 8 -#define SLAVE_GPIO 7 struct ixp_clock { struct ixp46x_ts_regs *regs; @@ -245,38 +242,6 @@ static const struct ptp_clock_info ptp_ixp_caps = { static struct ixp_clock ixp_clock; -static int setup_interrupt(int gpio) -{ - int irq; - int err; - - err = gpio_request(gpio, "ixp4-ptp"); - if (err) - return err; - - err = gpio_direction_input(gpio); - if (err) - return err; - - irq = gpio_to_irq(gpio); - if (irq < 0) - return irq; - - err = irq_set_irq_type(irq, IRQF_TRIGGER_FALLING); - if (err) { - pr_err("cannot set trigger type for irq %d\n", irq); - return err; - } - - err = request_irq(irq, isr, 0, DRIVER, &ixp_clock); - if (err) { - pr_err("request_irq failed for irq %d\n", irq); - return err; - } - - return irq; -} - int ixp46x_ptp_find(struct ixp46x_ts_regs *__iomem *regs, int *phc_index) { *regs = ixp_clock.regs; @@ -289,18 +254,20 @@ int ixp46x_ptp_find(struct ixp46x_ts_regs *__iomem *regs, int *phc_index) } EXPORT_SYMBOL_GPL(ixp46x_ptp_find); -static int ptp_ixp_remove(struct platform_device *pdev) +/* Called from the registered devm action */ +static void ptp_ixp_unregister_action(void *d) { - free_irq(ixp_clock.master_irq, &ixp_clock); - free_irq(ixp_clock.slave_irq, &ixp_clock); - ptp_clock_unregister(ixp_clock.ptp_clock); - ixp_clock.ptp_clock = NULL; + struct ptp_clock *ptp_clock = d; - return 0; + ptp_clock_unregister(ptp_clock); + ixp_clock.ptp_clock = NULL; } static int ptp_ixp_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; + int ret; + ixp_clock.regs = devm_platform_ioremap_resource(pdev, 0); ixp_clock.master_irq = platform_get_irq(pdev, 0); ixp_clock.slave_irq = platform_get_irq(pdev, 1); @@ -315,34 +282,39 @@ static int ptp_ixp_probe(struct platform_device *pdev) if (IS_ERR(ixp_clock.ptp_clock)) return PTR_ERR(ixp_clock.ptp_clock); + ret = devm_add_action_or_reset(dev, ptp_ixp_unregister_action, + ixp_clock.ptp_clock); + if (ret) { + dev_err(dev, "failed to install clock removal handler\n"); + return ret; + } + __raw_writel(DEFAULT_ADDEND, &ixp_clock.regs->addend); __raw_writel(1, &ixp_clock.regs->trgt_lo); __raw_writel(0, &ixp_clock.regs->trgt_hi); __raw_writel(TTIPEND, &ixp_clock.regs->event); - if (ixp_clock.master_irq != setup_interrupt(MASTER_GPIO)) { - pr_err("failed to setup gpio %d as irq\n", MASTER_GPIO); - goto no_master; - } - if (ixp_clock.slave_irq != setup_interrupt(SLAVE_GPIO)) { - pr_err("failed to setup gpio %d as irq\n", SLAVE_GPIO); - goto no_slave; - } + ret = devm_request_irq(dev, ixp_clock.master_irq, isr, + 0, DRIVER, &ixp_clock); + if (ret) + return dev_err_probe(dev, ret, + "request_irq failed for irq %d\n", + ixp_clock.master_irq); + + ret = devm_request_irq(dev, ixp_clock.slave_irq, isr, + 0, DRIVER, &ixp_clock); + if (ret) + return dev_err_probe(dev, ret, + "request_irq failed for irq %d\n", + ixp_clock.slave_irq); return 0; -no_slave: - free_irq(ixp_clock.master_irq, &ixp_clock); -no_master: - ptp_clock_unregister(ixp_clock.ptp_clock); - ixp_clock.ptp_clock = NULL; - return -ENODEV; } static struct platform_driver ptp_ixp_driver = { .driver.name = "ptp-ixp46x", .driver.suppress_bind_attrs = true, .probe = ptp_ixp_probe, - .remove = ptp_ixp_remove, }; module_platform_driver(ptp_ixp_driver); From patchwork Sat Aug 28 17:15:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 503954 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE3A7C4320E for ; Sat, 28 Aug 2021 17:18:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ABEDC60C41 for ; Sat, 28 Aug 2021 17:18:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234627AbhH1RTH (ORCPT ); Sat, 28 Aug 2021 13:19:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234594AbhH1RTA (ORCPT ); Sat, 28 Aug 2021 13:19:00 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D018C061796 for ; Sat, 28 Aug 2021 10:18:09 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id o10so21399907lfr.11 for ; Sat, 28 Aug 2021 10:18: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=zdoJvRdg/wiFMUqCvkYyo5RNQaUscCsPcncLCMhtPj8=; b=JSEd6UfO+vckTGqHUqtIEvPBomvRc6nCbTo4zk2ouC7F/YKKp/qPS7VOn8O8sebeeO GGN17QJXDeDnJvs3IjsJuXo26NXZT1Nk97gsRaVoRrZBRif9RdZ9LhDLQvm+cABCLJfE oIUltUDBXLln3VICQCnc+hnAssGQWX/CLkgb1OZNThkeE+KqvhNNdbEei4f6bDxFUrRh kldxERcHEqvAyNtx/koMXyuw8vVbcSlOQz72Dy9HQY4AR8iiTFRhJtH+Y0TaTKf2Xt0e zgWk8qA1qnruNe3G3Jr1Jk3SUOe4CT9dkc0CmHN7ofK4YYNKnZ5/x1aEviRHpwE/tktM ycKQ== 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=zdoJvRdg/wiFMUqCvkYyo5RNQaUscCsPcncLCMhtPj8=; b=mMBHX0s/b81nJH0egZFBtkNs+mUIQ3GQg7KZDeaQKlwDXhn8wgR7mNDQtCgAt469E6 b1AoQN/rZPvp5+wHiuZqL1SkS4KyTeA8KXUgS3JuGh6NBHzoU9NUEEKIMn+KVYKOVvye XjboZkyNgrsEcjN4oPJBdJtpPxNN2Iah/gFuiWOKaO8YgMHzqYXjuSzUGSb7wiHNoLFw 7WFyp/2GQBZVSgxyeeswDvYIOfknvsUEul7d358q8/nlEpBasSR1nfZqzsVKsPDh61kq 2ArUnwXacdiLGGvkmMppWy9B19JPEbQ5kQnM0OpG2fTrN7ojLMHlZVvUvMSdKOPbSppc shLw== X-Gm-Message-State: AOAM532ppj+9DUyj22W/+iJu/SFzws2j5t7w4d9Uft1qy/j2HkyRxG+3 3mSAd0cRl/aIxiITDjAJVf4YHC7hf7JsgQ== X-Google-Smtp-Source: ABdhPJxU7ZeJD04vrPBWlbTprBhBkerweqY61V+AAWnPoF1k35K3D/1j/tBi2rZ/H5GJ0WMXccN3bg== X-Received: by 2002:a05:6512:230b:: with SMTP id o11mr3209151lfu.377.1630171087650; Sat, 28 Aug 2021 10:18:07 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id p1sm202195lfo.255.2021.08.28.10.18.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Aug 2021 10:18:07 -0700 (PDT) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" , Jakub Kicinski Cc: Imre Kaloz , Krzysztof Halasa , Linus Walleij , devicetree@vger.kernel.org, Arnd Bergmann , Rob Herring Subject: [PATCH net-next 4/5 v3] ixp4xx_eth: Add devicetree bindings Date: Sat, 28 Aug 2021 19:15:47 +0200 Message-Id: <20210828171548.143057-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210828171548.143057-1-linus.walleij@linaro.org> References: <20210828171548.143057-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This adds device tree bindings for the IXP46x PTP Timer, a companion to the IXP4xx ethernet in newer platforms. Cc: devicetree@vger.kernel.org Cc: Arnd Bergmann Reviewed-by: Rob Herring Signed-off-by: Linus Walleij --- .../bindings/net/intel,ixp46x-ptp-timer.yaml | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/intel,ixp46x-ptp-timer.yaml diff --git a/Documentation/devicetree/bindings/net/intel,ixp46x-ptp-timer.yaml b/Documentation/devicetree/bindings/net/intel,ixp46x-ptp-timer.yaml new file mode 100644 index 000000000000..8b9b3f915d92 --- /dev/null +++ b/Documentation/devicetree/bindings/net/intel,ixp46x-ptp-timer.yaml @@ -0,0 +1,54 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +# Copyright 2018 Linaro Ltd. +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/net/intel,ixp46x-ptp-timer.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Intel IXP46x PTP Timer (TSYNC) + +maintainers: + - Linus Walleij + +description: | + The Intel IXP46x PTP timer is known in the manual as IEEE1588 Hardware + Assist and Time Synchronization Hardware Assist TSYNC provides a PTP + timer. It exists in the Intel IXP45x and IXP46x XScale SoCs. + +properties: + compatible: + const: intel,ixp46x-ptp-timer + + reg: + maxItems: 1 + + interrupts: + items: + - description: Interrupt to trigger master mode snapshot from the + PRP timer, usually a GPIO interrupt. + - description: Interrupt to trigger slave mode snapshot from the + PRP timer, usually a GPIO interrupt. + + interrupt-names: + items: + - const: master + - const: slave + +required: + - compatible + - reg + - interrupts + - interrupt-names + +additionalProperties: false + +examples: + - | + #include + ptp-timer@c8010000 { + compatible = "intel,ixp46x-ptp-timer"; + reg = <0xc8010000 0x1000>; + interrupt-parent = <&gpio0>; + interrupts = <8 IRQ_TYPE_EDGE_FALLING>, <7 IRQ_TYPE_EDGE_FALLING>; + interrupt-names = "master", "slave"; + }; From patchwork Sat Aug 28 17:15:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 503775 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp259891jai; Sat, 28 Aug 2021 10:18:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCRalPbP9cqmYraB7WFthCn18n339RJUd+QDbkJdmMunQraCOq7boUG656bfzSTVEdXVRZ X-Received: by 2002:a05:6638:304a:: with SMTP id u10mr13547822jak.62.1630171100007; Sat, 28 Aug 2021 10:18:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630171100; cv=none; d=google.com; s=arc-20160816; b=E/is7r5lppf9bO/4zXOxvh10Opov5lgaROVHCDVM4B6p9ql1iTnippiFmoZAJHmHb9 S+GZeVj0xMMX5KFh6zwYL1t5HPAic4WXsC4u+bV4b/lylcZuZ/dWjozWHvB6JmJqeklP 5ybQi+ydW+NNzgh5yfjP+hzqCadMXevcUbe2d+Ma5RHNUVBjA8jSBLAZZdFyeAD/Equt j35aAIRCUWtCBTH133Rgau6R1aTkn57HBB1UOv436PclFQ0Lw8kDS22FKO/E3YfLYYgU fQ+YPZ2LUZpymaiABd/loC0EFhTY7Z+9thrES6jrHs0I4lxiXuXS29OLAE40IS6tTicm 58OQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Nj5RTF35gQsW0AqxyNE0lXSMA9c7c05/wwrJgBCDQ4U=; b=GB/V6tWEFsxGwdfQefyrkGx1mO473lnbO840lUvUs0zlfozTHBy0sJQKPPESpaBnZ7 a5Pxj0uSOcJis80F4KHH1Nmj2X8HGrbiEqf1CsHQj/g2MNWe2wlTGvpXGuHSr29SkKZu POlYIL2IE+tKJ8652MvYompYN/jquY2NDJAx2WzKhFU7CumwdFDKXW66huwZNdPMGIYY qJYNPA4ZVBbXRAQF7cEZVxlenw8AZTfdXVL84wcQXHBzLKLMtsMjkukdx6LsHSMa94pj v6ugo5RkwsBsMcBoKlbQkFr0MborA2n0UMYHjniBwyhSaXfNW5j+h5RjdlsNV1/gobc2 WjrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IfXR0FKM; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id i126si4695650iof.61.2021.08.28.10.18.19; Sat, 28 Aug 2021 10:18:19 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IfXR0FKM; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 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 S234648AbhH1RTI (ORCPT + 8 others); Sat, 28 Aug 2021 13:19:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234629AbhH1RTF (ORCPT ); Sat, 28 Aug 2021 13:19:05 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC82DC0617AD for ; Sat, 28 Aug 2021 10:18:10 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id b4so21395392lfo.13 for ; Sat, 28 Aug 2021 10:18:10 -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=Nj5RTF35gQsW0AqxyNE0lXSMA9c7c05/wwrJgBCDQ4U=; b=IfXR0FKMeE+Lt8UhIHMyKqhJoWd2hmRNFgP+lqpFRp8FIE4OuVVBbH4UcxZE5jNcOI WCipCy3BCDT13kpCqJEv2Oq73F0yPNwT5lI+SvyH6AO7gxZjYD4pEnCg2ly2qVsfiP8Q z+bXgihCFQXRelsCxwa5mjzkuiBCFKZXJ30f872qE4xq8S/8PWKpegkltDcup6UW7Zde yhFNLQUNE0gWDhIj5Dix4LmguPYLGQhlSa3tbjWJHKsbwRneR/UnJCiPLTRXjopfqvOZ aHr1dhtMhF9DITddZxeHRqAamx5cIP6p81kV8jpY9fAh/UAc4AJtyZNruv1qIFT6Q8+8 ic6w== 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=Nj5RTF35gQsW0AqxyNE0lXSMA9c7c05/wwrJgBCDQ4U=; b=cBz1P91TF77iGcMh/qK0SIFZgsLMZ9JFKLf1PYalUh4B0OLArCcz4FTQ74Ly2T0w1q KTdlMhlc1QM23idKfX8vhloYLwKhxyK4w6T+CS/0ZyelNp9vWdOH+a5LvEVhtDqdxHWQ /SpSgFiD2mvhKxsNMMewyNR5YqAyON4MoI36fIPOCi4VCAn1sSakD0OTRZBi3nHQ169T aihobc+LbWuBHba+Xk80mUaGkrw6U4bhfuVYA8okpBwYpz5d4arg2OdJQxEtubi5CAED mexMEdm+ROEHJ+pYEnbJp72VEokoS06xIJ8NlIXypA4zcz3IsGggO0zc8OE1lR+9+E80 nG5Q== X-Gm-Message-State: AOAM532MR7Lj79nBdJjLg+npMNhRbZMsZyG3iTBIobAPVwa62w78rlKf v5Wi8zUOzdSbSK4qv3XqplCx3LHCu0ocLA== X-Received: by 2002:a05:6512:b9e:: with SMTP id b30mr10915963lfv.428.1630171089042; Sat, 28 Aug 2021 10:18:09 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id p1sm202195lfo.255.2021.08.28.10.18.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Aug 2021 10:18:08 -0700 (PDT) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" , Jakub Kicinski Cc: Imre Kaloz , Krzysztof Halasa , Linus Walleij , Arnd Bergmann Subject: [PATCH net-next 5/5 v3] ixp4xx_eth: Probe the PTP module from the device tree Date: Sat, 28 Aug 2021 19:15:48 +0200 Message-Id: <20210828171548.143057-6-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210828171548.143057-1-linus.walleij@linaro.org> References: <20210828171548.143057-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This adds device tree probing support for the PTP module adjacent to the ethernet module. It is pretty straight forward, all resources are in the device tree as they come to the platform device. Cc: Arnd Bergmann Signed-off-by: Linus Walleij --- drivers/net/ethernet/xscale/ptp_ixp46x.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) -- 2.31.1 diff --git a/drivers/net/ethernet/xscale/ptp_ixp46x.c b/drivers/net/ethernet/xscale/ptp_ixp46x.c index c7ff150bf23f..ecece21315c3 100644 --- a/drivers/net/ethernet/xscale/ptp_ixp46x.c +++ b/drivers/net/ethernet/xscale/ptp_ixp46x.c @@ -6,6 +6,7 @@ */ #include #include +#include #include #include #include @@ -311,9 +312,19 @@ static int ptp_ixp_probe(struct platform_device *pdev) return 0; } +static const struct of_device_id ptp_ixp_match[] = { + { + .compatible = "intel,ixp46x-ptp-timer", + }, + { }, +}; + static struct platform_driver ptp_ixp_driver = { - .driver.name = "ptp-ixp46x", - .driver.suppress_bind_attrs = true, + .driver = { + .name = "ptp-ixp46x", + .of_match_table = ptp_ixp_match, + .suppress_bind_attrs = true, + }, .probe = ptp_ixp_probe, }; module_platform_driver(ptp_ixp_driver);