From patchwork Fri Nov 17 16:43:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 13459142 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7730FC5AD4C for ; Fri, 17 Nov 2023 16:44:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231793AbjKQQpB (ORCPT ); Fri, 17 Nov 2023 11:45:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231473AbjKQQo7 (ORCPT ); Fri, 17 Nov 2023 11:44:59 -0500 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81D3010D5 for ; Fri, 17 Nov 2023 08:44:55 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-3316d3d11e1so377188f8f.0 for ; Fri, 17 Nov 2023 08:44:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech-se.20230601.gappssmtp.com; s=20230601; t=1700239494; x=1700844294; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ViJzBZRjaGwQoSegbb0M2YrA8tvFsmfs+BtclsFM6Iw=; b=yc59Asu5dsxUDXwsCNPO2feuNhlmEkKtQFV3Nkyf/5dAVjlyTb2Y9dIfbHwdRQvQ3B 6Ei0ynY4CLUt9d5N83otKNQKmyxe8HIVgOI9EHS+tjOikFI0rDCc1vG2e9hlVsOw286b 48Su5hOIOlVAxMNdyVYrUCRbSUK49vKAfDM5SMdk4EJzdTDNxxEbcltwsTA4RhzJnp2p miWF32rG/3wXRmUkNJu9umD9aS3+i7tRchkcjudCixljYMMvgH/hvnRbYD3ktjcQ89tw 6d6z5xige0DaExYmSwy5djDSUFQr++l3euX3LD/j8e/D2MWIW5O2EMZOV+O6vSh2lYaE 6vwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700239494; x=1700844294; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ViJzBZRjaGwQoSegbb0M2YrA8tvFsmfs+BtclsFM6Iw=; b=Sfh6HIILm9RKE2OYWCshlaa506GWwWAANZR99ISR8O2bP331YJLjF/PzxJ+1DpB1QW JZSVbwWk+bWI/e+qJhm/Nw31/09Y2ow4aHolx+u+aJsZncgTFVunOhR113K2kw1DdHMZ PCWQSmlDoofcR7kRYwAzU8OYIPSFVd8feU/zJJG1YP+61y/A7essk3I2iVFMrT04ugL5 y76ASmqA4T64xUg9tXdPFpHnsSC4m0L6CX9LYtTSuQB2YNEeF72ZqC3Xoc3ie8/lFAEm S+gposIjbF30O3fHsflUkkE6m9R6Jw8Xg4BT0YXF6F6q38PgUgLviFyHsnf656vWD8OY zmbQ== X-Gm-Message-State: AOJu0YwIFf8FAoLYTvcp3Nswg3C4ioMRqvGqquu81bDtDShoZy3v79vK okKc5bKOXwp/2BWr43I9sB6chA== X-Google-Smtp-Source: AGHT+IELqDZJhNF3w4cCSF7Pe3KNy3G2/C2ag2xOQm2boFEouK1cJqrXmqQKscXXkk/+QTrSuuJpjA== X-Received: by 2002:a5d:47ab:0:b0:31d:caae:982d with SMTP id 11-20020a5d47ab000000b0031dcaae982dmr5929283wrb.12.1700239494093; Fri, 17 Nov 2023 08:44:54 -0800 (PST) Received: from sleipner.berto.se (p4fcc8a96.dip0.t-ipconnect.de. [79.204.138.150]) by smtp.googlemail.com with ESMTPSA id y10-20020adfee0a000000b0032dcb08bf94sm2791947wrn.60.2023.11.17.08.44.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 08:44:53 -0800 (PST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran , netdev@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, =?utf-8?q?Niklas_S=C3=B6derlund?= Subject: [net-next 1/5] net: ethernet: renesas: rcar_gen4_ptp: Remove incorrect comment Date: Fri, 17 Nov 2023 17:43:28 +0100 Message-ID: <20231117164332.354443-2-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20231117164332.354443-1-niklas.soderlund+renesas@ragnatech.se> References: <20231117164332.354443-1-niklas.soderlund+renesas@ragnatech.se> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org The comments intent was to indicates which function uses the enum. While upstreaming rcar_gen4_ptp the function was renamed but this comment was left with the old function name. Instead of correcting the comment remove it, it adds little value. Signed-off-by: Niklas Söderlund Reviewed-by: Wolfram Sang --- drivers/net/ethernet/renesas/rcar_gen4_ptp.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/ethernet/renesas/rcar_gen4_ptp.h b/drivers/net/ethernet/renesas/rcar_gen4_ptp.h index b1bbea8d3a52..9f148110df66 100644 --- a/drivers/net/ethernet/renesas/rcar_gen4_ptp.h +++ b/drivers/net/ethernet/renesas/rcar_gen4_ptp.h @@ -13,7 +13,6 @@ #define RCAR_GEN4_PTP_CLOCK_S4 PTPTIVC_INIT #define RCAR_GEN4_GPTP_OFFSET_S4 0x00018000 -/* for rcar_gen4_ptp_init */ enum rcar_gen4_ptp_reg_layout { RCAR_GEN4_PTP_REG_LAYOUT_S4 }; From patchwork Fri Nov 17 16:43:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 13459140 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B71EBC47071 for ; Fri, 17 Nov 2023 16:44:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235091AbjKQQpA (ORCPT ); Fri, 17 Nov 2023 11:45:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234707AbjKQQo7 (ORCPT ); Fri, 17 Nov 2023 11:44:59 -0500 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B9A8194 for ; Fri, 17 Nov 2023 08:44:56 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-32d895584f1so1543903f8f.1 for ; Fri, 17 Nov 2023 08:44:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech-se.20230601.gappssmtp.com; s=20230601; t=1700239495; x=1700844295; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1ctuwvPDSa9uZCOLTfAErk4+6RVQpToW66kimL2TEOU=; b=f37EjEfkE2wE5wUT9b42TZ3b4S5lw9tQqiI9n/Qdsq4nkhdUGrZ8+GZLO75m/prkvb 2GOOFipeStAbRuqyTH3opTZZw4UXkuLhCYdDApddyeOofgYiA9k/p7S6b8caHxv2SH1N yXBff1U+AOcNsLF0K0bCHtUHBDe+3FJfxh9DjoB1LzZeQqRkuh8o3pu6lJEAcRGbBPgM pg48sJISzmAHtNO2orwmrb4MyHUREvv3fdtEQ/rjr5YzeH9c41rtzrUrocOB/VHif53H akOB79NDJaS2Wwg/xNLwte6xYBYcwsMayReT0G4ZxlU+wqA6rAw49t/9sJc42KafWlF6 WDbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700239495; x=1700844295; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1ctuwvPDSa9uZCOLTfAErk4+6RVQpToW66kimL2TEOU=; b=qVQ3UwZZQa0FiKJTBT4csQGZuXgrTYK2DTD07EXT4tCIbBwRbIpj3T3lvkp/5xgIOt yLieAGzDRCiY/SAAXCoXKbawP7J2kzGd3PUGOCP5PWZpSiLip8EwOlLnumNw1b0kPWS0 XSmPiJp2Mt2m6zClf3jEvJBQjZaMNa6aD0YxQnGEyegkc1C5hYCQ9vNsUHIJbjzdCbae NtTuYL/Fs/xJ1zsF+gQ2qQAddStMFF+k8WNhmlJzNbyHI//f3OEbATozEXq+wu031wlz L10+ljL2qFqyXKR2Tv3zDRdb2qomdmwagyzfAzLwvpXhAkybfDU6G+KtKb9VrVW+nRMk oSwg== X-Gm-Message-State: AOJu0Yz1NuopHqBtoqTmA/e53Xc0dyDtwJa63moml3ImjRGmqkhEhacE I4EiDHrtL6T5aRZm18irbWQqEg== X-Google-Smtp-Source: AGHT+IEki3Odc/z/NMe7thygFDWVaCnOECdby64FFzQDj/s/3i2E+SLxm5CPlx0cuO47pXuLEZtQgw== X-Received: by 2002:a5d:548f:0:b0:32f:88e8:b8d1 with SMTP id h15-20020a5d548f000000b0032f88e8b8d1mr12969140wrv.13.1700239494955; Fri, 17 Nov 2023 08:44:54 -0800 (PST) Received: from sleipner.berto.se (p4fcc8a96.dip0.t-ipconnect.de. [79.204.138.150]) by smtp.googlemail.com with ESMTPSA id y10-20020adfee0a000000b0032dcb08bf94sm2791947wrn.60.2023.11.17.08.44.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 08:44:54 -0800 (PST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran , netdev@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, =?utf-8?q?Niklas_S=C3=B6derlund?= Subject: [net-next 2/5] net: ethernet: renesas: rcar_gen4_ptp: Fail on unknown register layout Date: Fri, 17 Nov 2023 17:43:29 +0100 Message-ID: <20231117164332.354443-3-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20231117164332.354443-1-niklas.soderlund+renesas@ragnatech.se> References: <20231117164332.354443-1-niklas.soderlund+renesas@ragnatech.se> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Instead of printing a warning and proceeding with an unknown register layout return an error. The only call site is already prepared to propagate the error. Signed-off-by: Niklas Söderlund Reviewed-by: Wolfram Sang --- drivers/net/ethernet/renesas/rcar_gen4_ptp.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/renesas/rcar_gen4_ptp.c b/drivers/net/ethernet/renesas/rcar_gen4_ptp.c index c007e33c47e1..443ca5a18703 100644 --- a/drivers/net/ethernet/renesas/rcar_gen4_ptp.c +++ b/drivers/net/ethernet/renesas/rcar_gen4_ptp.c @@ -130,23 +130,30 @@ static struct ptp_clock_info rcar_gen4_ptp_info = { .enable = rcar_gen4_ptp_enable, }; -static void rcar_gen4_ptp_set_offs(struct rcar_gen4_ptp_private *ptp_priv, - enum rcar_gen4_ptp_reg_layout layout) +static int rcar_gen4_ptp_set_offs(struct rcar_gen4_ptp_private *ptp_priv, + enum rcar_gen4_ptp_reg_layout layout) { - WARN_ON(layout != RCAR_GEN4_PTP_REG_LAYOUT_S4); + if (layout != RCAR_GEN4_PTP_REG_LAYOUT_S4) + return -EINVAL; ptp_priv->offs = &s4_offs; + + return 0; } int rcar_gen4_ptp_register(struct rcar_gen4_ptp_private *ptp_priv, enum rcar_gen4_ptp_reg_layout layout, u32 clock) { + int ret; + if (ptp_priv->initialized) return 0; spin_lock_init(&ptp_priv->lock); - rcar_gen4_ptp_set_offs(ptp_priv, layout); + ret = rcar_gen4_ptp_set_offs(ptp_priv, layout); + if (ret) + return ret; ptp_priv->default_addend = clock; iowrite32(ptp_priv->default_addend, ptp_priv->addr + ptp_priv->offs->increment); From patchwork Fri Nov 17 16:43:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 13459141 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A17FEC5AE4A for ; Fri, 17 Nov 2023 16:45:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235563AbjKQQpB (ORCPT ); Fri, 17 Nov 2023 11:45:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235340AbjKQQpB (ORCPT ); Fri, 17 Nov 2023 11:45:01 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89D251AD for ; Fri, 17 Nov 2023 08:44:57 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4084e49a5e5so19122425e9.3 for ; Fri, 17 Nov 2023 08:44:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech-se.20230601.gappssmtp.com; s=20230601; t=1700239496; x=1700844296; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OhPeJT65e+HlTL4GEJcknvOqJIOmP+OVNMnytUlHsfE=; b=ozSvtk17xBLXkMfBwC2qyJJk0GVjTJmr0wWomvIaoviYcwg8IlJ11FZOX6ZtP10K7q gXOC34Y62Y88RPBuNhazpUNJ2EVKID9Q/Y2gt1bs7eV2vzNtlzW0/ngh9IhSq+KtoOCj +2w92g0vDdbTwvy+8hSU1YB1WXHO8X9BX87+h7rb93swmBHeRvTfQmh/x2077IfT+OWs 6c9GMyqOokObymXWRF+aBAgFEPROMRm3mlvq3OOiufeWnuxRzhvLR+5nqai3pXwZEbpH xI9sWaDU91kccDDKaHN98rUdxWCiTiCSz0TLDds+DsAOKQir/iW1eS5ZwB6Xo1aMnpd7 TmyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700239496; x=1700844296; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OhPeJT65e+HlTL4GEJcknvOqJIOmP+OVNMnytUlHsfE=; b=Ejo/AZAcTN62IK5gBfIjz29E77Y1yeDFJa/oXNbjKNMjtOpPPesBSDQ/wdpzm7rNXh 2T8KcAIr1Dr1zHWgL32P0YX+on0JiscGtpYlvOAPYSW42XoFokCaUvfVn3BwY+tLguKG cy6FFcgAjJIqYTNVVe9hckvZhfYFTvq0aDYbk7vpCogBnBZJ2yiLFchbz2fWFg/c6QaV r+Nbt8lSx2MKAg+b5MFkxmU7pyeyR7QgBGFlMr0pA2cg3jOB9f88imc48x01a9FU+sJx KzTw/RrHU2sS96r3di3dwb1p7EZyBxjdGP+hLsKGyi9j3NIGm7M89QX8oXD2EcD4wweS tWUw== X-Gm-Message-State: AOJu0Yxjw7nINUxPG/koU9acm3DuE8UuuLrLRitzO1JY5ByM+47Q2cMX CJOzK78YOXwvgKpsFYBw+LlawA== X-Google-Smtp-Source: AGHT+IG4Fo+rQkLIhotw1LTO6yBVUGA+K8V4fgVejBF7yALbeqscuO6QEm4badwj2b9vcfPRno2sDQ== X-Received: by 2002:a05:6000:1a8f:b0:319:8a66:f695 with SMTP id f15-20020a0560001a8f00b003198a66f695mr18194190wry.55.1700239495876; Fri, 17 Nov 2023 08:44:55 -0800 (PST) Received: from sleipner.berto.se (p4fcc8a96.dip0.t-ipconnect.de. [79.204.138.150]) by smtp.googlemail.com with ESMTPSA id y10-20020adfee0a000000b0032dcb08bf94sm2791947wrn.60.2023.11.17.08.44.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 08:44:55 -0800 (PST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran , netdev@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, =?utf-8?q?Niklas_S=C3=B6derlund?= Subject: [net-next 3/5] net: ethernet: renesas: rcar_gen4_ptp: Prepare for shared register layout Date: Fri, 17 Nov 2023 17:43:30 +0100 Message-ID: <20231117164332.354443-4-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20231117164332.354443-1-niklas.soderlund+renesas@ragnatech.se> References: <20231117164332.354443-1-niklas.soderlund+renesas@ragnatech.se> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org All know R-Car Gen4 SoC share the same register layout, rename the R-Car S4 specific identifiers so they can be shared with the upcoming R-Car V4H support. Signed-off-by: Niklas Söderlund Reviewed-by: Wolfram Sang --- drivers/net/ethernet/renesas/rcar_gen4_ptp.c | 6 +++--- drivers/net/ethernet/renesas/rcar_gen4_ptp.h | 4 ++-- drivers/net/ethernet/renesas/rswitch.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/renesas/rcar_gen4_ptp.c b/drivers/net/ethernet/renesas/rcar_gen4_ptp.c index 443ca5a18703..59f6351e9ae9 100644 --- a/drivers/net/ethernet/renesas/rcar_gen4_ptp.c +++ b/drivers/net/ethernet/renesas/rcar_gen4_ptp.c @@ -14,7 +14,7 @@ #include "rcar_gen4_ptp.h" #define ptp_to_priv(ptp) container_of(ptp, struct rcar_gen4_ptp_private, info) -static const struct rcar_gen4_ptp_reg_offset s4_offs = { +static const struct rcar_gen4_ptp_reg_offset gen4_offs = { .enable = PTPTMEC, .disable = PTPTMDC, .increment = PTPTIVC0, @@ -133,10 +133,10 @@ static struct ptp_clock_info rcar_gen4_ptp_info = { static int rcar_gen4_ptp_set_offs(struct rcar_gen4_ptp_private *ptp_priv, enum rcar_gen4_ptp_reg_layout layout) { - if (layout != RCAR_GEN4_PTP_REG_LAYOUT_S4) + if (layout != RCAR_GEN4_PTP_REG_LAYOUT) return -EINVAL; - ptp_priv->offs = &s4_offs; + ptp_priv->offs = &gen4_offs; return 0; } diff --git a/drivers/net/ethernet/renesas/rcar_gen4_ptp.h b/drivers/net/ethernet/renesas/rcar_gen4_ptp.h index 9f148110df66..35664d1dc472 100644 --- a/drivers/net/ethernet/renesas/rcar_gen4_ptp.h +++ b/drivers/net/ethernet/renesas/rcar_gen4_ptp.h @@ -14,7 +14,7 @@ #define RCAR_GEN4_GPTP_OFFSET_S4 0x00018000 enum rcar_gen4_ptp_reg_layout { - RCAR_GEN4_PTP_REG_LAYOUT_S4 + RCAR_GEN4_PTP_REG_LAYOUT }; /* driver's definitions */ @@ -27,7 +27,7 @@ enum rcar_gen4_ptp_reg_layout { #define PTPRO 0 -enum rcar_gen4_ptp_reg_s4 { +enum rcar_gen4_ptp_reg { PTPTMEC = PTPRO + 0x0010, PTPTMDC = PTPRO + 0x0014, PTPTIVC0 = PTPRO + 0x0020, diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c index 43a7795d6591..e1e29a2caf22 100644 --- a/drivers/net/ethernet/renesas/rswitch.c +++ b/drivers/net/ethernet/renesas/rswitch.c @@ -1828,7 +1828,7 @@ static int rswitch_init(struct rswitch_private *priv) rswitch_fwd_init(priv); - err = rcar_gen4_ptp_register(priv->ptp_priv, RCAR_GEN4_PTP_REG_LAYOUT_S4, + err = rcar_gen4_ptp_register(priv->ptp_priv, RCAR_GEN4_PTP_REG_LAYOUT, RCAR_GEN4_PTP_CLOCK_S4); if (err < 0) goto err_ptp_register; From patchwork Fri Nov 17 16:43:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 13459143 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6604C072A2 for ; Fri, 17 Nov 2023 16:45:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231473AbjKQQpE (ORCPT ); Fri, 17 Nov 2023 11:45:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235707AbjKQQpC (ORCPT ); Fri, 17 Nov 2023 11:45:02 -0500 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C920EA4 for ; Fri, 17 Nov 2023 08:44:58 -0800 (PST) Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-5094cb3a036so3267645e87.2 for ; Fri, 17 Nov 2023 08:44:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech-se.20230601.gappssmtp.com; s=20230601; t=1700239497; x=1700844297; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XdcFTkjJJKdk2tWc8kj9ugAu+k+ZjoJk+1mRNKldi1E=; b=aSgYT9J5L7HzzuU/AEnOMWA1dxngjgQZBZjqEk8QZr9YVQsZahtX1h/xhYmlCSIb0z uhDupq+nnQaLTVQ/FSaWJwBW+zFoVGb2QDQMsx0Mb4XyqNZmJ5ggW0hy4NF9cxidZdi3 3iodB/uDpVriWXQWVPgylIpjNou+c/+kCnazVXtRuo/vnHbFslVdk/6yEarpGPJSkJSt DYcM7IdqhKAI3znLiUF4JWBPpFX8gquHS4AGeVzLo3QfmFJ0L7NqUfoHQo7GZTCIEpDP p6rp0pGxGxVLeMbjjLTfsFeh8kVO8fCA80l7BTlMaKPsPA75Kl0BJWiEb2+k9aRQy6t3 KA7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700239497; x=1700844297; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XdcFTkjJJKdk2tWc8kj9ugAu+k+ZjoJk+1mRNKldi1E=; b=OcWnoNwkzHWTDz7gcbk3R3xj5JkhHCop8puRgxPtmcatSfYMwyRnP8XURFDv0mYWgc lj96f/Wx0MKhViLlPmJbwgkElCu8Z2QzcpGhm9xusMEN4Cwj5WjzsaTVcjfyK7WGJ+Ee 7VlFM7BcgXBcKCEBOMLfYCwMZWXD/byE8+LnQADZuk5je7C9djPiVwp8eua/NGqk6oPd plRon+WyI9QtKfwlP4Ul4cY3QrjteSL6k9sQEPTvC6g1v/GGR/SJrTNv2msRQJ/zqu5n UzeEphPTv8AUOPgIg2VZ0G6x7RmIpzZGIanXUNGppMIAx43lXR2TeFNx+daS0eBoAeMW Oe7g== X-Gm-Message-State: AOJu0YwimQ0wM6zvFhnciTFs9tqXSnOl4INvWXw/FpKyVw1q8NmSzx7K O6P+PShTZw7Zn7NQ0o3VnhfCbA== X-Google-Smtp-Source: AGHT+IElGFJq6FDin3q1ZNiLN21lTleD22/7v7lYF9GaOGz9+SBbC/qO6c8vYYQwfr8nmi5zNRCp4g== X-Received: by 2002:a05:6512:358f:b0:502:a4f4:ced9 with SMTP id m15-20020a056512358f00b00502a4f4ced9mr52784lfr.62.1700239496893; Fri, 17 Nov 2023 08:44:56 -0800 (PST) Received: from sleipner.berto.se (p4fcc8a96.dip0.t-ipconnect.de. [79.204.138.150]) by smtp.googlemail.com with ESMTPSA id y10-20020adfee0a000000b0032dcb08bf94sm2791947wrn.60.2023.11.17.08.44.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 08:44:56 -0800 (PST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran , netdev@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, =?utf-8?q?Niklas_S=C3=B6derlund?= Subject: [net-next 4/5] net: ethernet: renesas: rcar_gen4_ptp: Add V4H clock setting Date: Fri, 17 Nov 2023 17:43:31 +0100 Message-ID: <20231117164332.354443-5-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20231117164332.354443-1-niklas.soderlund+renesas@ragnatech.se> References: <20231117164332.354443-1-niklas.soderlund+renesas@ragnatech.se> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org The gPTP clock is different between R-Car S4 and R-Car V4H. In preparation of adding R-Car V4H support define the clock setting. Signed-off-by: Niklas Söderlund --- drivers/net/ethernet/renesas/rcar_gen4_ptp.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/renesas/rcar_gen4_ptp.h b/drivers/net/ethernet/renesas/rcar_gen4_ptp.h index 35664d1dc472..b83a209e9845 100644 --- a/drivers/net/ethernet/renesas/rcar_gen4_ptp.h +++ b/drivers/net/ethernet/renesas/rcar_gen4_ptp.h @@ -9,8 +9,12 @@ #include -#define PTPTIVC_INIT 0x19000000 /* 320MHz */ -#define RCAR_GEN4_PTP_CLOCK_S4 PTPTIVC_INIT +#define PTPTIVC_INIT_200MHZ 0x28000000 /* 200MHz */ +#define PTPTIVC_INIT_320MHZ 0x19000000 /* 320MHz */ + +#define RCAR_GEN4_PTP_CLOCK_S4 PTPTIVC_INIT_320MHZ +#define RCAR_GEN4_PTP_CLOCK_V4H PTPTIVC_INIT_200MHZ + #define RCAR_GEN4_GPTP_OFFSET_S4 0x00018000 enum rcar_gen4_ptp_reg_layout { From patchwork Fri Nov 17 16:43:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 13459144 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CCF8C197A0 for ; Fri, 17 Nov 2023 16:45:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231803AbjKQQpE (ORCPT ); Fri, 17 Nov 2023 11:45:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235722AbjKQQpC (ORCPT ); Fri, 17 Nov 2023 11:45:02 -0500 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DDA7D5C for ; Fri, 17 Nov 2023 08:44:59 -0800 (PST) Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-32f7abbb8b4so1432324f8f.0 for ; Fri, 17 Nov 2023 08:44:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech-se.20230601.gappssmtp.com; s=20230601; t=1700239497; x=1700844297; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tqhIDcxNEg81oFdPwx3lGmpDRXkd6s3pq6VAhH62Gxk=; b=fIHBhpor5yQBD4C3m5U//ND7jXmoWAORkbHKdDfgRq8qyNg9Mj5z3CcL8phF54xrnC lts/P8SqsrcQgKTjOHKDHuL2chKKfs0TWsLREca12lLDZgPuwurLxMRKiIyhkZGaUvxA /3l3NZYeiP74RFye8qi4iy9z0rxE+y0noNFG8qCKTqojXnfqknz2HvGzRMllnAlygq++ oyD8J7IuemIN1ZIfPh5YhrIUNHHCbEQnO8nvBrbXI/5Etxxtgzp3Fm0LzAZg5eHOP2lU kzVwS7YCFtQ33FFogYUmKrZp6Ef0JnVzRS+TJVR1RRMM1raau4Ratd5ehZdnQ7o9SUGj 7vvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700239497; x=1700844297; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tqhIDcxNEg81oFdPwx3lGmpDRXkd6s3pq6VAhH62Gxk=; b=re7qGZXVr58X/wEIHdVVcDsbeEZOTnx789RNriQUqq7hH6heLf3MJ+N+QGSqaBTctL jQqp/D4n5w5drzLY0DS+W0D6YN1HjkrqxLLedKx5QL2F+uJtGN8UbS3PekuDD9KSil50 lnOcVNGysAjzdL4ZuB3D0ZMRkg/yBN680IAfKSrTazLDjtjrYnGGMKQpjFhpnKs55CUK T/gEtjls6g18wmLLon/oPfw0KoFXWP1Y5N92W02d8tapVlZ/J20mF4PKfgAEwmRX6BW2 AVqGS0BmoTW4Wpv0umS2NKaV9ivJuWy3h4UY7YeuHks35oSLWKQcRuL+7pkV3/rsK9xp xrAw== X-Gm-Message-State: AOJu0YylgrNzY58O5XCZILTUTdHRaezQgbCF7JI8C9uPJqIvEMdWvN3w 5txpvsXSLKMJW+2B9vbon8huJA== X-Google-Smtp-Source: AGHT+IG4p40+Ydg5HZ9PFgPm5Au1XiB/mFDgarAZ1T4T0SCPDn/lpNR+oL99K9Mf7CfiWoCzlKqsFQ== X-Received: by 2002:a5d:4085:0:b0:32f:b1ab:ee87 with SMTP id o5-20020a5d4085000000b0032fb1abee87mr12739258wrp.25.1700239497774; Fri, 17 Nov 2023 08:44:57 -0800 (PST) Received: from sleipner.berto.se (p4fcc8a96.dip0.t-ipconnect.de. [79.204.138.150]) by smtp.googlemail.com with ESMTPSA id y10-20020adfee0a000000b0032dcb08bf94sm2791947wrn.60.2023.11.17.08.44.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 08:44:57 -0800 (PST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran , netdev@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, =?utf-8?q?Niklas_S=C3=B6derlund?= Subject: [net-next 5/5] net: ethernet: renesas: rcar_gen4_ptp: Break out to module Date: Fri, 17 Nov 2023 17:43:32 +0100 Message-ID: <20231117164332.354443-6-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20231117164332.354443-1-niklas.soderlund+renesas@ragnatech.se> References: <20231117164332.354443-1-niklas.soderlund+renesas@ragnatech.se> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org The Gen3 gPTP support will be shared between the existing Renesas Ethernet Switch driver and the upcoming Renesas Ethernet-TSN driver. In preparation for this break out the gPTP support to its own module. Signed-off-by: Niklas Söderlund --- drivers/net/ethernet/renesas/Kconfig | 10 ++++++++++ drivers/net/ethernet/renesas/Makefile | 5 +++-- drivers/net/ethernet/renesas/rcar_gen4_ptp.c | 5 +++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/renesas/Kconfig b/drivers/net/ethernet/renesas/Kconfig index 8ef5b0241e64..4e7d8546abe2 100644 --- a/drivers/net/ethernet/renesas/Kconfig +++ b/drivers/net/ethernet/renesas/Kconfig @@ -44,7 +44,17 @@ config RENESAS_ETHER_SWITCH select CRC32 select MII select PHYLINK + select RENESAS_GEN4_PTP help Renesas Ethernet Switch device driver. +config RENESAS_GEN4_PTP + tristate "Renesas R-Car Gen4 gPTP support" + depends on ARCH_RENESAS || COMPILE_TEST + select CRC32 + select MII + select PHYLIB + help + Renesas R-Car Gen4 gPTP device driver. + endif # NET_VENDOR_RENESAS diff --git a/drivers/net/ethernet/renesas/Makefile b/drivers/net/ethernet/renesas/Makefile index e8fd85b5fe8f..9070acfd6aaf 100644 --- a/drivers/net/ethernet/renesas/Makefile +++ b/drivers/net/ethernet/renesas/Makefile @@ -8,5 +8,6 @@ obj-$(CONFIG_SH_ETH) += sh_eth.o ravb-objs := ravb_main.o ravb_ptp.o obj-$(CONFIG_RAVB) += ravb.o -rswitch_drv-objs := rswitch.o rcar_gen4_ptp.o -obj-$(CONFIG_RENESAS_ETHER_SWITCH) += rswitch_drv.o +obj-$(CONFIG_RENESAS_ETHER_SWITCH) += rswitch.o + +obj-$(CONFIG_RENESAS_GEN4_PTP) += rcar_gen4_ptp.o diff --git a/drivers/net/ethernet/renesas/rcar_gen4_ptp.c b/drivers/net/ethernet/renesas/rcar_gen4_ptp.c index 59f6351e9ae9..22552a8f5430 100644 --- a/drivers/net/ethernet/renesas/rcar_gen4_ptp.c +++ b/drivers/net/ethernet/renesas/rcar_gen4_ptp.c @@ -166,6 +166,7 @@ int rcar_gen4_ptp_register(struct rcar_gen4_ptp_private *ptp_priv, return 0; } +EXPORT_SYMBOL_GPL(rcar_gen4_ptp_register); int rcar_gen4_ptp_unregister(struct rcar_gen4_ptp_private *ptp_priv) { @@ -173,6 +174,7 @@ int rcar_gen4_ptp_unregister(struct rcar_gen4_ptp_private *ptp_priv) return ptp_clock_unregister(ptp_priv->clock); } +EXPORT_SYMBOL_GPL(rcar_gen4_ptp_unregister); struct rcar_gen4_ptp_private *rcar_gen4_ptp_alloc(struct platform_device *pdev) { @@ -186,3 +188,6 @@ struct rcar_gen4_ptp_private *rcar_gen4_ptp_alloc(struct platform_device *pdev) return ptp; } +EXPORT_SYMBOL_GPL(rcar_gen4_ptp_alloc); + +MODULE_LICENSE("GPL");