From patchwork Mon Dec 16 07:19:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Yushchenko X-Patchwork-Id: 13909291 X-Patchwork-Delegate: geert@linux-m68k.org Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 276521B87F6 for ; Mon, 16 Dec 2024 07:20:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734333610; cv=none; b=bvqypPBKZhrpNlVjE1L2xCodFn2h6TFcoqC/BJBzrmNKuk4aVmHR+9V2+LQ3yvArqdjfg0ZW4wA6YB1oTthFuIN44W+K6OxCwH1FLbtkiTQ/DOQPk8HtBZMrUSm18I9VhvjQ32AdMbGEl5zS3Csx7IL0dUthR15mRfs/5Fyrz0U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734333610; c=relaxed/simple; bh=7H+b53eqi9DiOlmG0r4AJgg7nxrSVI5qv94MdpvGEik=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kHAGWVFoeZjTsSvB5vcdA6nEOyguehkuYh8bYNCmWQrYG4eRdNqeiyQsQYem9YhmHxedBL2ERo+ixpPUcTB+uYbD/K0yP2nt/OT5dRJEPFTisujmZvBBr0fVV4qtpQwzWxguHrit3unwoNseQdt2iLOKFdyz5dfLhRngUQpqyFM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=cogentembedded.com; spf=pass smtp.mailfrom=cogentembedded.com; dkim=pass (2048-bit key) header.d=cogentembedded-com.20230601.gappssmtp.com header.i=@cogentembedded-com.20230601.gappssmtp.com header.b=YpEKWB77; arc=none smtp.client-ip=209.85.167.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=cogentembedded.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cogentembedded.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cogentembedded-com.20230601.gappssmtp.com header.i=@cogentembedded-com.20230601.gappssmtp.com header.b="YpEKWB77" Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-53e3a90336eso4243659e87.3 for ; Sun, 15 Dec 2024 23:20:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20230601.gappssmtp.com; s=20230601; t=1734333607; x=1734938407; 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=A37fHc27Oue7tYt3kSCSnf+lK1Jrrg8n8kixoTW3puQ=; b=YpEKWB77gdtab48SF5Al3qjMsTEvgHwzYWUbj9SnB6h1TyqQKIxd+mcUPG6lVc1PIK OSh8ivpuIz3ae9rHDRzGy1Qjg3le4lx3x+fyVmaNZLsdN8GtI0/zcgzBYjAwDuKVebkB y/lu8Zulb/tpSz/+K4lc8oAfMrB6lTD3S0qiFj+68BnAGkgkuXcTeYS33lXGoRJGwm8Z T8rhgIuAYfBhe/F/7iUC4Qur5tFIRIJM49DmEF6goUDX0T2AFXJmWmHHuW4Wlreihqc9 xKqq3rWfZqzRGlwFewhMKbfwh3u00urxAXLqnQ4kc19C1EgkI3z5vnrHo3KPmAwdoN8G yK5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734333607; x=1734938407; 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=A37fHc27Oue7tYt3kSCSnf+lK1Jrrg8n8kixoTW3puQ=; b=j55Y0d8RMZoB/SrrjeJlYvXIlxK3VGqZXhAVaH4Cg2v0N7HQNWExUVh9tKnDQf6Aux +wtOFkTOiXk16/GbJQ/jKGOb+7Amdal6vzFisTQVCgGsTba7pcNhH5m8AF0KcItQ50jW BnIYY8yIHoe6R29jE1me/+Xdd+qXQ/zLKTQoEzCuGlD+WRwcRXA0N2yrcEU3vLNj2IfO ofrqqsEfnBG9QI5C/ZSbGlBN3WGP7U0/R2/1EPs5+r8zBJDDax0yH9y6SeM2wL0jRI0h 1rCVlZYH/r4QXvTLHXqP/Q1Yvqo0QCVxh81OvMU3QK6+uvXwImjf29v8DdnwuOW5k/NM SuCw== X-Forwarded-Encrypted: i=1; AJvYcCX/ivpg1RVvvbtxl4Nz3lJhhbqBXFfPSDcXUkeDR0NMcky/IcLFsF02GPjmpDUNlswmLRYiwL3VWCfFc0bOgAazBg==@vger.kernel.org X-Gm-Message-State: AOJu0YzghR7lvq+I59/UCNSVn0hyWkNChjWnKPorRMq6G72ntnVX84NN nDPPGWhrNpltX5uXjx0vrdZbeejbDCeSSvPJJVhrobKJ8f5g2GklY+II1Uv3cZo= X-Gm-Gg: ASbGncuIZNvOmQNoDkmf7CUq+UMAOnwTWI5xAi36MM8Wx5hwpWuT+HWJ62gc8+tCBM9 T6l/er2rARvZdZU51ubgXbdRZCIh01g2Ppt/nNfcEQwCdgipoqZoB3oEbmdrmovjKl1JA0qkSOK 5w68rK+ZMrAV4mC1AQDLDp1zkycwG+bOsi+2+W0HV6NgdatPV6HJGtJDNXh2tcnS0pgCoZnKF+/ tF3Nhuk2LrxAVLrbyuAwGjNYUUnuXs76qWJaYET+7+4avCCiomYMxucDXh8cv1ev6mFKIA= X-Google-Smtp-Source: AGHT+IFZevgraoAzerxr2hEHYj5Vn6YWN6RGjMC+XJAc2rFLiXryY0wNygBr6mROD0KIKhDpCjOFXA== X-Received: by 2002:a05:6512:33d6:b0:540:1c18:4e23 with SMTP id 2adb3069b0e04-54099b6d6f9mr3446396e87.47.1734333607243; Sun, 15 Dec 2024 23:20:07 -0800 (PST) Received: from cobook.home ([91.198.101.25]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-54120ba9b2bsm748930e87.94.2024.12.15.23.20.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Dec 2024 23:20:07 -0800 (PST) From: Nikita Yushchenko To: Yoshihiro Shimoda , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Geert Uytterhoeven Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Dege , Christian Mardmoeller , Dennis Ostermann , Nikita Yushchenko Subject: [PATCH net-next v2 1/5] net: renesas: rswitch: do not write to MPSM register at init time Date: Mon, 16 Dec 2024 12:19:53 +0500 Message-Id: <20241216071957.2587354-2-nikita.yoush@cogentembedded.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241216071957.2587354-1-nikita.yoush@cogentembedded.com> References: <20241216071957.2587354-1-nikita.yoush@cogentembedded.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 MPSM register is used to execute mdio bus transactions. There is no need to initialize it early. Signed-off-by: Nikita Yushchenko --- drivers/net/ethernet/renesas/rswitch.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c index 5fc8c94d1e4b..12efee9f75d8 100644 --- a/drivers/net/ethernet/renesas/rswitch.c +++ b/drivers/net/ethernet/renesas/rswitch.c @@ -1166,7 +1166,6 @@ static void rswitch_etha_enable_mii(struct rswitch_etha *etha) { rswitch_modify(etha->addr, MPIC, MPIC_PSMCS_MASK | MPIC_PSMHT_MASK, MPIC_PSMCS(etha->psmcs) | MPIC_PSMHT(0x06)); - rswitch_modify(etha->addr, MPSM, 0, MPSM_MFF_C45); } static int rswitch_etha_hw_init(struct rswitch_etha *etha, const u8 *mac) From patchwork Mon Dec 16 07:19:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Yushchenko X-Patchwork-Id: 13909292 X-Patchwork-Delegate: geert@linux-m68k.org Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 470A21D358B for ; Mon, 16 Dec 2024 07:20:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734333613; cv=none; b=VhmXLQxiHayJ2zJP8YenUn/Xycg/U0tsclOfjDLwo19L0O5PtzIW2PrndGssMU+Zto0AXPKY3lSly+0qlG92pWOERp4JtG41ePm4eK/LF4Mmn9rmTaJ951YFZBh21cBPKYjShk9Gldpk12jgxOnLKZDPtNk4Mv6++p5N5PlYhw8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734333613; c=relaxed/simple; bh=2tnr8Bwh6X/FYoBAuSdjBG6lvqx9CRulw85LcMBiY9E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=W9UMJUIwHYnHbi/bXvajX9z0gmF7UQFbd2gtYiC4hrwcUz3ugFNYhyyyT2aGwoVeKWXuz1Rf7PVRhm/eUbMsgmSSgGZYzXXqQuM8oYSapNJMtQTmekC0STUymh+KRUOngjK7RPfLffsPPh6xZOlQHHpAx+J5X2eYiOl0OM1HH44= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=cogentembedded.com; spf=pass smtp.mailfrom=cogentembedded.com; dkim=pass (2048-bit key) header.d=cogentembedded-com.20230601.gappssmtp.com header.i=@cogentembedded-com.20230601.gappssmtp.com header.b=RoRWDaW8; arc=none smtp.client-ip=209.85.167.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=cogentembedded.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cogentembedded.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cogentembedded-com.20230601.gappssmtp.com header.i=@cogentembedded-com.20230601.gappssmtp.com header.b="RoRWDaW8" Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-53e3a227b82so3664250e87.0 for ; Sun, 15 Dec 2024 23:20:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20230601.gappssmtp.com; s=20230601; t=1734333610; x=1734938410; 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=FDorma76GwDfrQOXtmRW3Vi/QHYCkRM+JtP0H9DhWBY=; b=RoRWDaW8BhoHbU7XzolTUw8JLg7TxIbssoSsv0Ren3JnFgVrvuq2OxVCeRgaZGzkq1 sTK9b3HdmP6nAP95n+UUOlwip8obpCJYGm7ZhovExFNBhxsxWTXzR+DkF385T8hZimyD H3y1xHEj7N6lLXD8rTgQpcmFruroFny3jb8HsOf0m8rSBhejyFWhdT9zqMEAfHZcst96 RYzk2bfGLK1c0s2S8T+CmaCJ7nsfnkPvsTrmcr5cTkCWbmY1ieSuepVbO/ozxEYHu7/q CD1r/4+lISBwQJNAZaVU6zDJOGgL43s0TBSP1zvkkBvCsaqFN3vyqDwjZUIzyl9C3QEv CBCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734333610; x=1734938410; 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=FDorma76GwDfrQOXtmRW3Vi/QHYCkRM+JtP0H9DhWBY=; b=Q0IRno6CZ2G81a29ZIOIoPTJwut0m59urN1L5+m9nE0idQGiEsLat9CgHWn7KMVy3/ sGAblszmhPZQk2Y05hR7nrMJTmzLDUQObfgTfi9WAk52HI9IDlJ3zmfhdZsYtUINcmtg a29CvMY/k5z6BtiYl9BmUM86gQ6aMfQqlYVHhW/Bbg5ad3j+zPwzNvJrszJ01HEbHGMo xZyDWN4mZ3986bSyLR0//r7hSOG91mO8gU2mVdoNsJyiy5al2xC/0yj+81fVllPf4tjA gvzBFnLnJhSYw5uNYwNLP1mbNW9HVJn86xVH28jygkQ4tZCWl8Br9opyBNeGjSW16/C2 15qA== X-Forwarded-Encrypted: i=1; AJvYcCU7UXbZ9XgzHFv6hLyXfcuXOwnjXznhrLTSmCY1kYwiU0GlRuIi9iwIkKPKIuGzkIgSn/SwZlm4JgzKbCLnuKyz4Q==@vger.kernel.org X-Gm-Message-State: AOJu0YxP3wNz+PVANrzsOSKuMZxJiBps0izEIJSSTFssJY3AfUlY+kI6 1lo7wiA0ru3bSrGvuAnlF0qQ3xQDrP/giVFlmyEQLSaKuhzFFpzvIeM0Azy/lL0= X-Gm-Gg: ASbGnctRuq2pBDqZwX3Ci/pHivINX5wXHhsGSHghccYm9xbQadiLa0OSWI48fdNWvE4 KLGCnID1Rj8qjp5xsh6T+LASsTWW7X5ayoQCijfSdTXb4T5lsloc9Zkj54vACoBZNRIA1PsNXmv KErel8/JIUgwHuMktOUwUom6ddQ6ts9QYASebyNlyOhfo0r1tO768IgdF4btI5yK9Ivk+gNJuyE ff1OfChIr3+nuYwBIwjKoip71kPgho8BJ4lc9Xz0LugaOmq73b5QvMU01LWOxlx9TayziA= X-Google-Smtp-Source: AGHT+IHopqkpGhBw9gHzXw4RFZJ8eHI7vJAH0G9GOleXtOF0VwnbcXx/A2P2rJLeqHcvXE4tjhMdyA== X-Received: by 2002:a05:6512:2813:b0:53e:37df:6637 with SMTP id 2adb3069b0e04-540905618d0mr3129724e87.32.1734333610495; Sun, 15 Dec 2024 23:20:10 -0800 (PST) Received: from cobook.home ([91.198.101.25]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-54120ba9b2bsm748930e87.94.2024.12.15.23.20.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Dec 2024 23:20:10 -0800 (PST) From: Nikita Yushchenko To: Yoshihiro Shimoda , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Geert Uytterhoeven Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Dege , Christian Mardmoeller , Dennis Ostermann , Nikita Yushchenko Subject: [PATCH net-next v2 2/5] net: renesas: rswitch: use FIELD_PREP for remaining MPIC register fields Date: Mon, 16 Dec 2024 12:19:54 +0500 Message-Id: <20241216071957.2587354-3-nikita.yoush@cogentembedded.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241216071957.2587354-1-nikita.yoush@cogentembedded.com> References: <20241216071957.2587354-1-nikita.yoush@cogentembedded.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Commit fb9e6039c325 ("net: renesas: rswitch: fix initial MPIC register setting") converted setting some MPIC fields to FIELD_PREP. To keep common style, do the same with mii bus related fields of the same register. Signed-off-by: Nikita Yushchenko --- drivers/net/ethernet/renesas/rswitch.c | 5 +++-- drivers/net/ethernet/renesas/rswitch.h | 10 ++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c index 12efee9f75d8..e1541a206687 100644 --- a/drivers/net/ethernet/renesas/rswitch.c +++ b/drivers/net/ethernet/renesas/rswitch.c @@ -1164,8 +1164,9 @@ static void rswitch_rmac_setting(struct rswitch_etha *etha, const u8 *mac) static void rswitch_etha_enable_mii(struct rswitch_etha *etha) { - rswitch_modify(etha->addr, MPIC, MPIC_PSMCS_MASK | MPIC_PSMHT_MASK, - MPIC_PSMCS(etha->psmcs) | MPIC_PSMHT(0x06)); + rswitch_modify(etha->addr, MPIC, MPIC_PSMCS | MPIC_PSMHT, + FIELD_PREP(MPIC_PSMCS, etha->psmcs) | + FIELD_PREP(MPIC_PSMHT, 0x06)); } static int rswitch_etha_hw_init(struct rswitch_etha *etha, const u8 *mac) diff --git a/drivers/net/ethernet/renesas/rswitch.h b/drivers/net/ethernet/renesas/rswitch.h index 4b1489100330..78c0325cdf30 100644 --- a/drivers/net/ethernet/renesas/rswitch.h +++ b/drivers/net/ethernet/renesas/rswitch.h @@ -732,6 +732,8 @@ enum rswitch_etha_mode { #define MPIC_LSC_100M 1 #define MPIC_LSC_1G 2 #define MPIC_LSC_2_5G 3 +#define MPIC_PSMCS GENMASK(22, 16) +#define MPIC_PSMHT GENMASK(26, 24) #define MDIO_READ_C45 0x03 #define MDIO_WRITE_C45 0x01 @@ -747,14 +749,6 @@ enum rswitch_etha_mode { #define MMIS1_PRACS BIT(0) /* Read */ #define MMIS1_CLEAR_FLAGS 0xf -#define MPIC_PSMCS_SHIFT 16 -#define MPIC_PSMCS_MASK GENMASK(22, MPIC_PSMCS_SHIFT) -#define MPIC_PSMCS(val) ((val) << MPIC_PSMCS_SHIFT) - -#define MPIC_PSMHT_SHIFT 24 -#define MPIC_PSMHT_MASK GENMASK(26, MPIC_PSMHT_SHIFT) -#define MPIC_PSMHT(val) ((val) << MPIC_PSMHT_SHIFT) - #define MLVC_PLV BIT(16) /* GWCA */ From patchwork Mon Dec 16 07:19:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Yushchenko X-Patchwork-Id: 13909293 X-Patchwork-Delegate: geert@linux-m68k.org Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E82731D47AE for ; Mon, 16 Dec 2024 07:20:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734333616; cv=none; b=cUwL5XgE50j64rCO+ezz6hGFVPQV3yHIivD1iRKh1cGwU4UHNW2qtAL1oM13bGfGuVTvyT4APYDv0WSiv1JKe8aYuqSvKcV6g6y+HM3AbYYkpOAWNSTH8obLCVVAtVR6ChsuCRolfw1fRU96oYij7YODd5yBweSrtskgkOLCRYw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734333616; c=relaxed/simple; bh=UlHsVBY2+5OwtS51cm0ukD6vGIqcaS4QJZtIio5czj8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=clG1pRL26G4WHN7rbPDLAoirBGsi/foSB6MHQb/2CdYCTIb6hEFctBdIn50GOpkgb3fP1CRxQbre8Mole51aCUrsUetACX8/zDmCQBLeXw6865OmMguIOTzJo9UOdr8UrpL+HR3CQobqK0hPOLqC6NkEcZ2FIn6hbiFm2DKG1AU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=cogentembedded.com; spf=pass smtp.mailfrom=cogentembedded.com; dkim=pass (2048-bit key) header.d=cogentembedded-com.20230601.gappssmtp.com header.i=@cogentembedded-com.20230601.gappssmtp.com header.b=iEVBDoLx; arc=none smtp.client-ip=209.85.167.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=cogentembedded.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cogentembedded.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cogentembedded-com.20230601.gappssmtp.com header.i=@cogentembedded-com.20230601.gappssmtp.com header.b="iEVBDoLx" Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-54024aa9febso3757747e87.1 for ; Sun, 15 Dec 2024 23:20:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20230601.gappssmtp.com; s=20230601; t=1734333613; x=1734938413; 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=O3lnZaher8bDGwGr+xGMpx7jXGopkkIbw5+lGNp1zoU=; b=iEVBDoLx8hevq8+eKfYH+Jrv876CkWEMz76oueIVs+LW7BWBDTLah6nzOJOAZ8Jh44 fBAOb3l0c+vKSKTSfoKvcQd2dZHrfrNFzfWMLDO0t5gg+9St3aReV4Dc0VHQZKo/0cMJ ekLduMAckf/2H/tnN2o9ZyMEGioNvGshPY/hP39iYMfdMLAFujnoQvKYV1N6g4ZnH6HC zgc4WmShfDKvAGrKkYnwREWeiZXnOdfih9rsHQ8+sJ6jZIRBS605nduRfTvauMnymZo9 qQenTfwPv3VCYl61+syp+SgdxR0HhyxxdMCzRxOMILj20ORpx16ECHutt2t3KwRZtemO tW2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734333613; x=1734938413; 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=O3lnZaher8bDGwGr+xGMpx7jXGopkkIbw5+lGNp1zoU=; b=CfsdiYK5hofCz/5p6Rz2nrW3QX73FhePa1MEWyglNyErWW2puteDvmmy6jFwUVJEWV O/xT/LF7BL7trM5XlJ/Yt5ZdQyNL1cTHL7u3WAZZC8DDjAVYhiBlDsx3GGD6wJF+kEVD pOm89AoF2k3OZsb5V3zEvSTV9Vh+yUa2dFB4NnBOF2uf5Z/2SMH6n48VtVOBU7xPHuwN p6o+MV/jMtfYx/FT08HJnHX2Bn0OJhEmhw3T8YEhFL+kaeOjPXDJ70y8CvAxmlA1Zx0m KP5ohdMUVhK8H736kFD5t0BHRH/oY5AWRGgCU1GDEsudbQGLBACEOoqKY973HJcaBqqB F5VA== X-Forwarded-Encrypted: i=1; AJvYcCVhN7LWMZ0ZCqDQtGbAOfkQZw0A09wIx7ZAmIfqyJDdkVSxRJM88GsyPjETVVka5hYsaSgoPge9wj3DUtvlivgjow==@vger.kernel.org X-Gm-Message-State: AOJu0Yyj3GFbef2+qJVETKG2OBOBOuX9nRcc66SQDIwR7s+ULZJOHtKc 24LepQ8acVUc9hM2MqFmpKlvIi3HdzlbUGJsDPOEO6FpiXg4YYT8F9LcekoImZk= X-Gm-Gg: ASbGncvsp89+jSQtpYIGBh10YamD2czvwqQOTMrg3wtUIkxachJ5zaKVxsBy8HCNLIG YQrO2d6ydcc6uqaCKLUT4NdjAQ7ij4CV0Iu4jKd2/0TOBA8w0FAKcoGBaJj8cNguinykc90jzl1 yfwmgbTJDwxL/gOSmLdSV0TwFce2DThLfWiD60ZvDS7+prPj7clkDRRjSop1FGTLrDkhYdhgco+ G4E/ndLzo9S40pcGaE9ths2w+SLlGETRddv3k0blrvvKnkTOP1W64UkfmJnMR397NW+uOE= X-Google-Smtp-Source: AGHT+IHGvvy7ocT/yLWz+20NQrkjy9SXMAlu4TryyrSG9B3M6ZvfiDNezXzU5CTqzAb6oEJrphXPtQ== X-Received: by 2002:a05:6512:b18:b0:540:1dac:c03d with SMTP id 2adb3069b0e04-5409a2297e1mr3485716e87.57.1734333613069; Sun, 15 Dec 2024 23:20:13 -0800 (PST) Received: from cobook.home ([91.198.101.25]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-54120ba9b2bsm748930e87.94.2024.12.15.23.20.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Dec 2024 23:20:12 -0800 (PST) From: Nikita Yushchenko To: Yoshihiro Shimoda , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Geert Uytterhoeven Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Dege , Christian Mardmoeller , Dennis Ostermann , Nikita Yushchenko Subject: [PATCH net-next v2 3/5] net: renesas: rswitch: align mdio C45 operations with datasheet Date: Mon, 16 Dec 2024 12:19:55 +0500 Message-Id: <20241216071957.2587354-4-nikita.yoush@cogentembedded.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241216071957.2587354-1-nikita.yoush@cogentembedded.com> References: <20241216071957.2587354-1-nikita.yoush@cogentembedded.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Per rswitch datasheet, software can know that mdio operation completed either by polling MPSM.PSME bit, or via interrupt. Instead, the driver currently polls for interrupt status bit. Although this still provides correct result, it requires additional register operations to clean the interrupt status bits, and generally looks wrong. Fix it to poll MPSM.PSME bit, as the datasheet suggests. Signed-off-by: Nikita Yushchenko --- drivers/net/ethernet/renesas/rswitch.c | 12 +++--------- drivers/net/ethernet/renesas/rswitch.h | 6 ------ 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c index e1541a206687..6e3f162ae3b3 100644 --- a/drivers/net/ethernet/renesas/rswitch.c +++ b/drivers/net/ethernet/renesas/rswitch.c @@ -1205,32 +1205,26 @@ static int rswitch_etha_set_access(struct rswitch_etha *etha, bool read, if (devad == 0xffffffff) return -ENODEV; - writel(MMIS1_CLEAR_FLAGS, etha->addr + MMIS1); - val = MPSM_PSME | MPSM_MFF_C45; iowrite32((regad << 16) | (devad << 8) | (phyad << 3) | val, etha->addr + MPSM); - ret = rswitch_reg_wait(etha->addr, MMIS1, MMIS1_PAACS, MMIS1_PAACS); + ret = rswitch_reg_wait(etha->addr, MPSM, MPSM_PSME, 0); if (ret) return ret; - rswitch_modify(etha->addr, MMIS1, MMIS1_PAACS, MMIS1_PAACS); - if (read) { writel((pop << 13) | (devad << 8) | (phyad << 3) | val, etha->addr + MPSM); - ret = rswitch_reg_wait(etha->addr, MMIS1, MMIS1_PRACS, MMIS1_PRACS); + ret = rswitch_reg_wait(etha->addr, MPSM, MPSM_PSME, 0); if (ret) return ret; ret = (ioread32(etha->addr + MPSM) & MPSM_PRD_MASK) >> 16; - - rswitch_modify(etha->addr, MMIS1, MMIS1_PRACS, MMIS1_PRACS); } else { iowrite32((data << 16) | (pop << 13) | (devad << 8) | (phyad << 3) | val, etha->addr + MPSM); - ret = rswitch_reg_wait(etha->addr, MMIS1, MMIS1_PWACS, MMIS1_PWACS); + ret = rswitch_reg_wait(etha->addr, MPSM, MPSM_PSME, 0); } return ret; diff --git a/drivers/net/ethernet/renesas/rswitch.h b/drivers/net/ethernet/renesas/rswitch.h index 78c0325cdf30..2cb66f3f4716 100644 --- a/drivers/net/ethernet/renesas/rswitch.h +++ b/drivers/net/ethernet/renesas/rswitch.h @@ -743,12 +743,6 @@ enum rswitch_etha_mode { #define MPSM_PRD_SHIFT 16 #define MPSM_PRD_MASK GENMASK(31, MPSM_PRD_SHIFT) -/* Completion flags */ -#define MMIS1_PAACS BIT(2) /* Address */ -#define MMIS1_PWACS BIT(1) /* Write */ -#define MMIS1_PRACS BIT(0) /* Read */ -#define MMIS1_CLEAR_FLAGS 0xf - #define MLVC_PLV BIT(16) /* GWCA */ From patchwork Mon Dec 16 07:19:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Yushchenko X-Patchwork-Id: 13909294 X-Patchwork-Delegate: geert@linux-m68k.org Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D3B681D54CF for ; Mon, 16 Dec 2024 07:20:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734333621; cv=none; b=cdk2KV9s9jF9rxkn9uYiE3/aejy4tzzsENl+dBABhJ89DVSnw7g+luI85pcXO4+97BF9mWgJ/wsgkrtnIWfzR/9r6+jWIg1IOCo59E5OImSG6e7/hjiEHVRVi3TeYFA18J5iS/cyPfWLAm3M5dCfnjWQrJgZf8fQt7LSyUEkWQ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734333621; c=relaxed/simple; bh=/e66GSylh66fjrDoof3R9JK40ytReFSDT/2ZT0m0crc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=D+ZYo/KvwJD8Eq7xET7+EV6SpnhNnZzF0ozbjCY4C3zQyXttHcKtWaxmdaRDX61ZedMsKwyZI6M++s8yrgp5SOgdTmuJOnZv7TWDbxBPKL+edIYx5bM5krvhtgxfRKdQRyYLintQ/zN3rVtvXkTgncCRJJqtxTHL9EG9azWBMo0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=cogentembedded.com; spf=pass smtp.mailfrom=cogentembedded.com; dkim=pass (2048-bit key) header.d=cogentembedded-com.20230601.gappssmtp.com header.i=@cogentembedded-com.20230601.gappssmtp.com header.b=YrMIBCaI; arc=none smtp.client-ip=209.85.167.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=cogentembedded.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cogentembedded.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cogentembedded-com.20230601.gappssmtp.com header.i=@cogentembedded-com.20230601.gappssmtp.com header.b="YrMIBCaI" Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-5401e6efffcso4428114e87.3 for ; Sun, 15 Dec 2024 23:20:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20230601.gappssmtp.com; s=20230601; t=1734333616; x=1734938416; 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=Sy6PRdyvTJmt4nLi/KLtgN81vqndB8nEbZyDRKOmQYI=; b=YrMIBCaINhbLE1bcM91uB41cb03Sp6FHW8uD+BDZtli4MbkULihiELpZVEFTeabbXP zv9u8QwteplQwMwAuxwAHM8AAD/Ze4Kru0FZfnBW1O/J2wi6K2cRJ5hxxMQQtBqYH+mH 6MG9TODuS4xAo3Z477z7q+E/vBDr8Te+puPHmAKCr7IeH7seadVufnjuQBZYVDLubzZw fYvQVYiLqC6NI5LcJFd0j4D1sREE3Njz8O96CeOIsA0l1R6nL18xBoMsYX56gLLMHZna 0BMAOCs3R8OH6EhJO1W+DmeZ21XS/QRkf+VkVZtA/0OzMRBOI6+sZrau5thzt+BHovCx +/Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734333616; x=1734938416; 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=Sy6PRdyvTJmt4nLi/KLtgN81vqndB8nEbZyDRKOmQYI=; b=uK6mhO4HCK2Vc7fB9T0fEFjEQfYg0aO0vnt01BLb2go6RuW3UqTLxmh6MEXlmOTw/S 95OFM80wj0kCvYxGkN14RsoleVK2GU+YfWMU+Tp9r9DTc27HwuzNPUBj6SBP50RBr+Ei wWW8LhWFFBlnRRltFTXWmYiGKH9cK2Vi+Smz6dOIyh7jHe1EyxBTJlGzpk//es4dNLXL qWO038B7sTbJaBMzOcGKhq3wWG00M0DT63TgpN3r51NHEvDPnUfBHheS8m0DnXRMakZF KV4kj99XB4p+L1FYdnnKpp4TtLbzvxUnAFiYqk683xF97UXm0pUb18AkMw7z7+jNMZiG pGxQ== X-Forwarded-Encrypted: i=1; AJvYcCXs6JfjMHtAIm4hy0EBYjdTury8mWg4yaBGmC3mo008wWAt/iqg5KQ+ONrgZhN0zU3Lec3S7VHGq5pT0Bkq1/2ykQ==@vger.kernel.org X-Gm-Message-State: AOJu0YyGIP6HwZ3QZoTvXfT04hX+JtbHkru3IjuHbl8T7PfTI3JXWjls TZ3xj+DyK53E9vYkmoLa8krC+jfgeFO6+0S09JE+Djq4+bJjya6Gs2IxkqxumWU= X-Gm-Gg: ASbGncssMyYbOXzIsfbaRJ5WDfw73SliaSRFEsP6fL+dFaHpcO8iQPB729QKOfi12NG hyBiME6dWk7N/Tg8TojWYG79m7XKlMbJaccHx7qScxYvX7+qiWo/Uw/k5MNhfdYILO3qKwTN5gG I3BowHBjkyNSSay/y2Y3aIbURPWPaIIx8LzvUcMfUmUEX7LXSq8sgbXPm3+I5nZSgUYqDvHZ2q0 NFely7j3q+twLNbmNmoU3KGN6SnDanP/WzXiU6vY3QGHTuWHdx+XLRsUytqpXR7SLNjY6Q= X-Google-Smtp-Source: AGHT+IH9reL5lhWoFaKGj2Yh05YQwmvxJkqzpPUY5yPuPlhytzfhLRIBepAdoB6afrfzAgPi3F0HPA== X-Received: by 2002:a05:6512:3d27:b0:53e:1c3e:34 with SMTP id 2adb3069b0e04-540905974b1mr3654998e87.38.1734333616046; Sun, 15 Dec 2024 23:20:16 -0800 (PST) Received: from cobook.home ([91.198.101.25]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-54120ba9b2bsm748930e87.94.2024.12.15.23.20.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Dec 2024 23:20:15 -0800 (PST) From: Nikita Yushchenko To: Yoshihiro Shimoda , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Geert Uytterhoeven Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Dege , Christian Mardmoeller , Dennis Ostermann , Nikita Yushchenko Subject: [PATCH net-next v2 4/5] net: renesas: rswitch: use generic MPSM operation for mdio C45 Date: Mon, 16 Dec 2024 12:19:56 +0500 Message-Id: <20241216071957.2587354-5-nikita.yoush@cogentembedded.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241216071957.2587354-1-nikita.yoush@cogentembedded.com> References: <20241216071957.2587354-1-nikita.yoush@cogentembedded.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Introduce rswitch_etha_mpsm_op() that accepts values for MPSM register fields and executes the transaction. This avoids some code duptication, and can be used both for C45 and C22. Convert C45 read and write operations to use that. Signed-off-by: Nikita Yushchenko --- drivers/net/ethernet/renesas/rswitch.c | 51 +++++++++++++++----------- drivers/net/ethernet/renesas/rswitch.h | 17 ++++++--- 2 files changed, 40 insertions(+), 28 deletions(-) diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c index 6e3f162ae3b3..a3ba2a91c0ab 100644 --- a/drivers/net/ethernet/renesas/rswitch.c +++ b/drivers/net/ethernet/renesas/rswitch.c @@ -1195,36 +1195,29 @@ static int rswitch_etha_hw_init(struct rswitch_etha *etha, const u8 *mac) return rswitch_etha_change_mode(etha, EAMC_OPC_OPERATION); } -static int rswitch_etha_set_access(struct rswitch_etha *etha, bool read, - int phyad, int devad, int regad, int data) +static int rswitch_etha_mpsm_op(struct rswitch_etha *etha, bool read, + unsigned int mmf, unsigned int pda, + unsigned int pra, unsigned int pop, + unsigned int prd) { - int pop = read ? MDIO_READ_C45 : MDIO_WRITE_C45; u32 val; int ret; - if (devad == 0xffffffff) - return -ENODEV; - - val = MPSM_PSME | MPSM_MFF_C45; - iowrite32((regad << 16) | (devad << 8) | (phyad << 3) | val, etha->addr + MPSM); + val = MPSM_PSME | + FIELD_PREP(MPSM_MFF, mmf) | + FIELD_PREP(MPSM_PDA, pda) | + FIELD_PREP(MPSM_PRA, pra) | + FIELD_PREP(MPSM_POP, pop) | + FIELD_PREP(MPSM_PRD, prd); + iowrite32(val, etha->addr + MPSM); ret = rswitch_reg_wait(etha->addr, MPSM, MPSM_PSME, 0); if (ret) return ret; if (read) { - writel((pop << 13) | (devad << 8) | (phyad << 3) | val, etha->addr + MPSM); - - ret = rswitch_reg_wait(etha->addr, MPSM, MPSM_PSME, 0); - if (ret) - return ret; - - ret = (ioread32(etha->addr + MPSM) & MPSM_PRD_MASK) >> 16; - } else { - iowrite32((data << 16) | (pop << 13) | (devad << 8) | (phyad << 3) | val, - etha->addr + MPSM); - - ret = rswitch_reg_wait(etha->addr, MPSM, MPSM_PSME, 0); + val = ioread32(etha->addr + MPSM); + ret = FIELD_GET(MPSM_PRD, val); } return ret; @@ -1234,16 +1227,30 @@ static int rswitch_etha_mii_read_c45(struct mii_bus *bus, int addr, int devad, int regad) { struct rswitch_etha *etha = bus->priv; + int ret; - return rswitch_etha_set_access(etha, true, addr, devad, regad, 0); + ret = rswitch_etha_mpsm_op(etha, false, MPSM_MMF_C45, addr, devad, + MPSM_POP_ADDRESS, regad); + if (ret) + return ret; + + return rswitch_etha_mpsm_op(etha, true, MPSM_MMF_C45, addr, devad, + MPSM_POP_READ_C45, 0); } static int rswitch_etha_mii_write_c45(struct mii_bus *bus, int addr, int devad, int regad, u16 val) { struct rswitch_etha *etha = bus->priv; + int ret; + + ret = rswitch_etha_mpsm_op(etha, false, MPSM_MMF_C45, addr, devad, + MPSM_POP_ADDRESS, regad); + if (ret) + return ret; - return rswitch_etha_set_access(etha, false, addr, devad, regad, val); + return rswitch_etha_mpsm_op(etha, false, MPSM_MMF_C45, addr, devad, + MPSM_POP_WRITE, val); } /* Call of_node_put(port) after done */ diff --git a/drivers/net/ethernet/renesas/rswitch.h b/drivers/net/ethernet/renesas/rswitch.h index 2cb66f3f4716..35ee73766396 100644 --- a/drivers/net/ethernet/renesas/rswitch.h +++ b/drivers/net/ethernet/renesas/rswitch.h @@ -735,13 +735,18 @@ enum rswitch_etha_mode { #define MPIC_PSMCS GENMASK(22, 16) #define MPIC_PSMHT GENMASK(26, 24) -#define MDIO_READ_C45 0x03 -#define MDIO_WRITE_C45 0x01 - #define MPSM_PSME BIT(0) -#define MPSM_MFF_C45 BIT(2) -#define MPSM_PRD_SHIFT 16 -#define MPSM_PRD_MASK GENMASK(31, MPSM_PRD_SHIFT) +#define MPSM_MFF BIT(2) +#define MPSM_MMF_C22 0 +#define MPSM_MMF_C45 1 +#define MPSM_PDA GENMASK(7, 3) +#define MPSM_PRA GENMASK(12, 8) +#define MPSM_POP GENMASK(14, 13) +#define MPSM_POP_ADDRESS 0 +#define MPSM_POP_WRITE 1 +#define MPSM_POP_READ_C22 2 +#define MPSM_POP_READ_C45 3 +#define MPSM_PRD GENMASK(31, 16) #define MLVC_PLV BIT(16) From patchwork Mon Dec 16 07:19:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Yushchenko X-Patchwork-Id: 13909295 X-Patchwork-Delegate: geert@linux-m68k.org Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 371B91D54EF for ; Mon, 16 Dec 2024 07:20:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734333622; cv=none; b=d6ucmeMoGht+QEoT7QPEKDAeHKHs7r6R+jXkuxJe97urI4YvnbTlzxU5D8WGajhXV1yzHfn5oHr6fNwzrld9Nu1B69oNDdd7IUCNJ/mGrOMCJ1OlM1s7jOdhVc6lGQDd+xNzDoodkT92PjWF5SJhouGvSScXgEgAPGhBan9sSIs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734333622; c=relaxed/simple; bh=PPu77jqSXBAgupPgYnoSOAHUAmL6TvEmfGQvFsLGMGU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tzG4JafMBHl1B6IHQIpyBvPqGdkZsiDrWD10ckK87g9XepAs8qtjAMlDDguPTC0gpR8xcRJqsZQlQooNDDOzSYhVDBAdM+Uw4W6r3zm2oJ6nDDxecVbGOLkvNWkciYJIcarthpL8qZT+U8rgWBI7ZQkTYPvfZHumCqAI3Q/lCfI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=cogentembedded.com; spf=pass smtp.mailfrom=cogentembedded.com; dkim=pass (2048-bit key) header.d=cogentembedded-com.20230601.gappssmtp.com header.i=@cogentembedded-com.20230601.gappssmtp.com header.b=lp2QMC9C; arc=none smtp.client-ip=209.85.167.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=cogentembedded.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cogentembedded.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cogentembedded-com.20230601.gappssmtp.com header.i=@cogentembedded-com.20230601.gappssmtp.com header.b="lp2QMC9C" Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-540254357c8so3427512e87.1 for ; Sun, 15 Dec 2024 23:20:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20230601.gappssmtp.com; s=20230601; t=1734333619; x=1734938419; 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=2bRm8i06V7UAQJx4SsgcbkPUCzwQb13lEnvW91v/XN8=; b=lp2QMC9CI3ikyuAy2Tt9MtnsgHTh/Weq/TNHrCzoGhFjpSqj4i8hVoFa/H4ntMR3zd AG/vIuyn2m4gJyTClbQnI480tmeJt4eOsthR0NBvtXbBYSALivYD/k3wk1iH28mRcmv1 58AZAMhi1F1qBENhYGKpkveJZYs/1KOwDyCAp1CuTff/TH/+Jt3HY4nCYJcebVH2V4AK 99anuJvKzysRb7SK6WXSxlIaGRfnH2fl85X1lFdSi/M+MzMoqovJmfSWhaeBlStPuXMj V+JUzYSqRbwbHLMe65qZb4zYO9vpvynX7r3AYZKm0mNNr/vh7A7nxMcC0mM36mh4BKav DpMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734333619; x=1734938419; 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=2bRm8i06V7UAQJx4SsgcbkPUCzwQb13lEnvW91v/XN8=; b=GUSbUVIdawVBw9IZTsffFSd+Ckdct27EqSXcH+7W4Uy2MkxbGTRfi0ASkt4wDM20ts lR88x3+Yk7WaiQlRekic7oMJo9JqOL9JMfJb/mESzIkgWoamXGYz3wWJGV2+B8wUsbCc TwueRD7xEQPbxf7iR3oUOZWRMLRmuf7lwZJ9dkcpB5/hQQ2eo2KdhhBmucTnOY0+zlcK SrwzydLkLSYt3uP/dkfFP2LHB2l3EjNnLGuQHmjhCqIcfz8U/VauuzgiwCOb34tDWjbr ak0XLM3f2kTSGyardAaYwXhzSwrrqrEQ3EMUgv0E4x1RIz7nYURA6JiiRK1otqNMZNsT sWsA== X-Forwarded-Encrypted: i=1; AJvYcCWZrKdItzZzMSkIwkp3k6tD1tucNpEjA79M6zr8OYd0t+XrYXZt1+I4eKG9enkBfrCpMNq1iHkMKYC76Kmm+HOXBw==@vger.kernel.org X-Gm-Message-State: AOJu0YyN52DZTmTTojz/yyhmeLPmLYOp3a5MLOxTOPGxfPHID+9VHTGQ +GyF0qw+qIr7YCVExkqA9yemSYtn8yV37cRfv50a/StLHCi6a7epHnuOwh76/ZM= X-Gm-Gg: ASbGncu6MHgsF6Nu3ZFxQxTPH2eEi7uO9vIvysIaMEjH4w6INGCzPTWcy9+1+3NHXC8 XHNMPVD9UWkQ5B0YaTm0jgOj6FPkMVlANiVcYy36yuq38D8rsLnsipSA/NUIKoSpAfkNaO0hsQo JW8BIZWq4YPjEafAhNhEqSmOpD1xXdyAPHeOeWdvOSrfknBC/cJjcMYZiQqcMl5kfaFaqCgsoeU kroLpXmlzcg9oYruLcx9VpkN35t2xk2Y5xuLKTnMss43UvJYpP6vFktT8cP8GsDG3vRe9w= X-Google-Smtp-Source: AGHT+IFowAXgGjOedfuT8nJJtjG23yp3KyVX22HWiWvy1vf9kaEvbhBVhV1xHsfmSOlU8xeDwiDt1Q== X-Received: by 2002:a05:6512:401b:b0:540:c349:a81b with SMTP id 2adb3069b0e04-540c349a962mr3449085e87.48.1734333619267; Sun, 15 Dec 2024 23:20:19 -0800 (PST) Received: from cobook.home ([91.198.101.25]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-54120ba9b2bsm748930e87.94.2024.12.15.23.20.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Dec 2024 23:20:19 -0800 (PST) From: Nikita Yushchenko To: Yoshihiro Shimoda , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Geert Uytterhoeven Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Dege , Christian Mardmoeller , Dennis Ostermann , Nikita Yushchenko Subject: [PATCH net-next v2 5/5] net: renesas: rswitch: add mdio C22 support Date: Mon, 16 Dec 2024 12:19:57 +0500 Message-Id: <20241216071957.2587354-6-nikita.yoush@cogentembedded.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241216071957.2587354-1-nikita.yoush@cogentembedded.com> References: <20241216071957.2587354-1-nikita.yoush@cogentembedded.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The generic MPSM operation added by the previous patch can be used both for C45 and C22. Add handlers for C22 operations. Signed-off-by: Nikita Yushchenko --- drivers/net/ethernet/renesas/rswitch.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c index a3ba2a91c0ab..aae26098bc0c 100644 --- a/drivers/net/ethernet/renesas/rswitch.c +++ b/drivers/net/ethernet/renesas/rswitch.c @@ -1253,6 +1253,23 @@ static int rswitch_etha_mii_write_c45(struct mii_bus *bus, int addr, int devad, MPSM_POP_WRITE, val); } +static int rswitch_etha_mii_read_c22(struct mii_bus *bus, int phyad, int regad) +{ + struct rswitch_etha *etha = bus->priv; + + return rswitch_etha_mpsm_op(etha, true, MPSM_MMF_C22, phyad, regad, + MPSM_POP_READ_C22, 0); +} + +static int rswitch_etha_mii_write_c22(struct mii_bus *bus, int phyad, + int regad, u16 val) +{ + struct rswitch_etha *etha = bus->priv; + + return rswitch_etha_mpsm_op(etha, false, MPSM_MMF_C22, phyad, regad, + MPSM_POP_WRITE, val); +} + /* Call of_node_put(port) after done */ static struct device_node *rswitch_get_port_node(struct rswitch_device *rdev) { @@ -1335,6 +1352,8 @@ static int rswitch_mii_register(struct rswitch_device *rdev) mii_bus->priv = rdev->etha; mii_bus->read_c45 = rswitch_etha_mii_read_c45; mii_bus->write_c45 = rswitch_etha_mii_write_c45; + mii_bus->read = rswitch_etha_mii_read_c22; + mii_bus->write = rswitch_etha_mii_write_c22; mii_bus->parent = &rdev->priv->pdev->dev; mdio_np = of_get_child_by_name(rdev->np_port, "mdio");