Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2070077pxb; Sat, 14 Nov 2020 12:05:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJwWldyYVEYOpWx9Su5CvhR5dr9QjWrfO1XlhHUU2aacRSEjMYDXPpjZLkJgpnWpfJXGE+0u X-Received: by 2002:a17:906:c1ce:: with SMTP id bw14mr7781548ejb.302.1605384327410; Sat, 14 Nov 2020 12:05:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605384327; cv=none; d=google.com; s=arc-20160816; b=Osl9Bfrk6RcCkvpDkjIIXWoxAm31k6s4NUMXACNN9J0LzRdVy5K+GHeXvfpWQK0SOA bNAPyENXqlAb+4Wa1FdGn1qwVZFpUASQlxeP7xwxVBOFXEPsgs4UuLrQBeWy+RWiWfuV obn4ypK8RRj1y2CcGxIpu25ZQvYJDiaB8L1nvVY3JUkAl1uolqMhmXbKSj/TifMycmPg jXjDmoLDmatUT+R3ZpAL8QkUTHZ02AFgM5t50euqOK7tnXWG//0DaPPVuuA760bMVZzU /ZhihRXjdtCc4aUR4wMEpdh6ah0+7vfisrkdP/9itZLKvafxFzn1IkqyfJWIBjjAuluL yH3A== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=CO7SJxq4xCCXF7MiAurxIxONv6JAjuDmnI0VaDmeaSY=; b=qgsIgBQZoYdPTTW9poDEzsX/DFhvsFRLhNlCgOM2k0HBDNiMNbQK5/+yC0M/WnxaOr HZAAlB/rUryqvJ/7Ht8gJIpLMTi7HR/asBcjD+N4lvl65y2OtwujYZbOPATPi6Evtj+c 0j3xPOUjoTYIQs2FlFIhvcXSB1LKMQC4KX94q/RTVBbXkRpJ5sqd8r1LxJdJKcbYiAaS b6q+GSUFdp1f9DWjT4KXjbJF3Je2oZ5y9UpynJUvZCMkjo/iZhGmOVB0tye+vqol8NKQ upbbx7NDDi3m5jYEBuaPWbO2smps9OnBrcaQiwdJJdl44xvylY/2pYHB4EvxekSzyFqY 93fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b="mZ208ne/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o3si8425637ejn.637.2020.11.14.12.05.04; Sat, 14 Nov 2020 12:05:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=@googlemail.com header.s=20161025 header.b="mZ208ne/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726362AbgKNUBu (ORCPT + 99 others); Sat, 14 Nov 2020 15:01:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726239AbgKNUBt (ORCPT ); Sat, 14 Nov 2020 15:01:49 -0500 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48A85C0613D1; Sat, 14 Nov 2020 12:01:49 -0800 (PST) Received: by mail-wr1-x444.google.com with SMTP id r17so14131211wrw.1; Sat, 14 Nov 2020 12:01:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=CO7SJxq4xCCXF7MiAurxIxONv6JAjuDmnI0VaDmeaSY=; b=mZ208ne/cgkgeirQzC1ZM3yDSeRFywmIefOYEVimaDcj0icBErG9hI84KCC40tIT4Z F0iKXDOcEuONGchiq6+JUaunec2BlPzJgSfgojQhxoS8yv4vt7pRUli+iJjlAufEh1e6 di/XUU+8/Fj3tVQbh15CSsyHNYlxS/l+mqiEGOXHxigWFqz37nYF2n2YvbRTQHJStQhx pflIJzyuDY8t9mlCT6AOW8mXoXECdihNcqoeY0LJ0Jioc82een+jt0BNnnBlygtQ6gSl Lt0DFG9e7FZSA+VzPkaI2XWRLl70aCwNLAnyaaccfeL++iq5dX6C0y+nWb38i+U3U6LB wlyA== 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:mime-version :content-transfer-encoding; bh=CO7SJxq4xCCXF7MiAurxIxONv6JAjuDmnI0VaDmeaSY=; b=qXw03xn0099GsiXKU+KqXuiex6yvGGa2gTn+3yP6/awKtlFxwKrHLb5n2QgBCVaT8B qeLSLRtEsNUXYX93HSCBp4mrdIkyZyuwk+0M/fxOr8PteTIPleeagkwatO3S8Zqp9KQ5 J3+k6lQzazmfssfT72o7XIp6otbWqRPLQEd8I9MZEjDcr9B7NZVqZHFr/iSjnlvc62+s aQnlzfDVIQUdxQk24jc2f9OTnmMFV1qN4In4v2EfNQ3kPr8MUpbpd99Lfg5FLWm71JeF Op5jG48QT24SLWVP9oKGkEkjuyPqTGPW56Sl0UI/pFNCUUQq4MKDAXG701p5fh02naMC 0cuQ== X-Gm-Message-State: AOAM530EhLSY087egUHQ07BL87Qo44aI4egV5sXOMPz2n/0qZs56FjqG hty3rHWAT2PrKFPixtN7UZxOiMBBCc0nWA== X-Received: by 2002:a5d:66d2:: with SMTP id k18mr10458016wrw.327.1605384107969; Sat, 14 Nov 2020 12:01:47 -0800 (PST) Received: from localhost.localdomain (p4fc3ea77.dip0.t-ipconnect.de. [79.195.234.119]) by smtp.googlemail.com with ESMTPSA id g138sm14342953wme.39.2020.11.14.12.01.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Nov 2020 12:01:47 -0800 (PST) From: Martin Blumenstingl To: davem@davemloft.net, kuba@kernel.org, linux-amlogic@lists.infradead.org, devicetree@vger.kernel.org, robh+dt@kernel.org Cc: jianxin.pan@amlogic.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, khilman@baylibre.com, narmstrong@baylibre.com, jbrunet@baylibre.com, andrew@lunn.ch, Martin Blumenstingl Subject: [PATCH RFC v1 0/4] dwmac-meson8b: picosecond precision RX delay support Date: Sat, 14 Nov 2020 21:01:00 +0100 Message-Id: <20201114200104.4148283-1-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, with the help of Jianxin Pan (many thanks!) the meaning of the "new" PRG_ETH1[19:16] register bits on Amlogic Meson G12A, G12B and SM1 SoCs are finally known. These SoCs allow fine-tuning the RGMII RX delay in 200ps steps (contrary to what I have thought in the past [0] these are not some "calibration" values). The vendor u-boot has code to automatically detect the best RX/TX delay settings. For now we keep it simple and add a device-tree property with 200ps precision to select the "right" RX delay for each board. While here, deprecate the "amlogic,rx-delay-ns" property as it's not used on any upstream .dts (yet). The driver is backwards compatible. I have tested this on an X96 Air 4GB board (not upstream yet). Testing with iperf3 gives 938 Mbits/sec in both directions (RX and TX). The following network settings were used in the .dts (2ns TX delay generated by the PHY, 800ps RX delay generated by the MAC as the PHY only supports 0ns or 2ns RX delays): &ext_mdio { external_phy: ethernet-phy@0 { /* Realtek RTL8211F (0x001cc916) */ reg = <0>; eee-broken-1000t; reset-assert-us = <10000>; reset-deassert-us = <30000>; reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>; interrupt-parent = <&gpio_intc>; /* MAC_INTR on GPIOZ_14 */ interrupts = <26 IRQ_TYPE_LEVEL_LOW>; }; }; ðmac { status = "okay"; pinctrl-0 = <ð_pins>, <ð_rgmii_pins>; pinctrl-names = "default"; phy-mode = "rgmii-txid"; phy-handle = <&external_phy>; amlogic,rgmii-rx-delay-ps = <800>; }; [0] https://lore.kernel.org/netdev/CAFBinCATt4Hi9rigj52nMf3oygyFbnopZcsakGL=KyWnsjY3JA@mail.gmail.com/ Martin Blumenstingl (4): dt-bindings: net: dwmac-meson: use picoseconds for the RGMII RX delay net: stmmac: dwmac-meson8b: use picoseconds for the RGMII RX delay net: stmmac: dwmac-meson8b: move RGMII delays into a separate function net: stmmac: dwmac-meson8b: add support for the RGMII RX delay on G12A .../bindings/net/amlogic,meson-dwmac.yaml | 52 ++++++++++- .../ethernet/stmicro/stmmac/dwmac-meson8b.c | 92 +++++++++++++++---- 2 files changed, 123 insertions(+), 21 deletions(-) -- 2.29.2