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: 13909297 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (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 2F7B21BA86C for ; Mon, 16 Dec 2024 07:20:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734333610; cv=none; b=GiJNjZrhQTbxE3VrmKeHiUuc8PUQtMP9F5jRs/DLW5iPbUYCpieO8NRqm1Q61JsYf+PJS0zQI6PRYlT+bvn8ERSAv/6ZsAPVPXrzqsNwC7/z6PRxxoJ01AcZe5a/p45a9FRmNjpMY1EuzAUm3CHsq2r1bsxM5YONio6fo2dDh1c= 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.52 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-f52.google.com with SMTP id 2adb3069b0e04-53f22fd6832so4000932e87.1 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=ZRyWF1rCrQfNVNQ/BQXGFls/N0yLvyeo+Eays6YN7hLIESWpsc/S9TxYwrcllY8+d9 NJjXsHeORUWOQ27hDESME2xD9roMJFxE161CpBZkY1Sut87xAz40wLP6JDGWjCMONBjW RmbE/NXdhTwu2//gcYaBBSO0syTJ3FUxjYDNhlGC91KZf6pvEYbAJVvpmeTkMjOQc025 FqkPkDO58uf65Orib6Fy7A7VVPsgWHPsRw1PtvbAiZhKzwavJ38ZnoHze4hee/whATq6 eB6WlDq7bcC8FqbPKk47sPvz/mdm3gcEdC3ixLbJHCq+nhpBmF9Spi3B2d8Ng0h20HtH mRLA== X-Gm-Message-State: AOJu0Ywi3Ft7AG+p9CC3Vy0+FM/CSlJJyA8NgQzsJFk2C7cgv7trLXE0 MiJKstIdoUhLvPBjcke2fVxkiv3lEt6hXr1NWLTdXZd5Wim8gb0p9wbWzjnw4r8= X-Gm-Gg: ASbGncslSEc/o1bAxxHU0ODdOGlhHSg3nQRZ64o/fk5ShGKv6bYA8RRxjLPO9dOchUb RJtNK9fcVWxWRbCQdeli9T2RffcIgPP5j35qZuqlbdy4Zqki6eePCkST4vBxV65xSRfYkr413oQ R+5WeAREnVFeHKEElL6Cx3F4vY7+uYoSD1l6YpiBFnPSDBu7yQZU2d47PFAgTxQpUtYQmY52ZSM t7XPMU+GaBpVmkhoxX/uJLv/yd3Tgp3us1TeEqcby0QM1p07iFxZf/QND2JOZJyqGwXmto= 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: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org 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: 13909298 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (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 49C271D364C for ; Mon, 16 Dec 2024 07:20:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734333614; cv=none; b=S4BolUtHhY4iHPj48b9AypdYWEnb3RwZPGGx3J3vFxZn+4MZoUSgkInfCEwrOZ8rKkEbWQrLmHHMZ3zxQXeZS1UysmSwOt3UI4wRmUxaqnAT0Y8UoGlS6F/l0LHMUrNe8W9yyfeFzkoyiHHgxLgr2js15Xq1RjQ0ZOFshZIUTU0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734333614; c=relaxed/simple; bh=2tnr8Bwh6X/FYoBAuSdjBG6lvqx9CRulw85LcMBiY9E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uujCwrmW78zL71JlGmdHjhkE8G5kpVorlD+fgHQbJpaovy0PMR/lf8C82aPDCi8hnSf8Mk/gL+F2RQ0u3c2aRCkbS9QDgQNppvEwzwmqLO9Wq31WXzOo12kYpyMcRYyaaq1WU2d/Ps/WPHg+Zu5JM5Z9YvVbTC1HSKbhyjvGB7U= 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.49 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-f49.google.com with SMTP id 2adb3069b0e04-53e3a227b82so3664251e87.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=ZlReCJp9/vAePAVstWdk/w5OF5miso/l7+Js9kHMHyDphh6xaj/3Al7Kmn+siEh2Ya 6lASi77eu3GN9FvvI2y09ri0G3o7lwSdWoH+17vQ+neOsO6U4cWs/z3/4Cgek4hWOmvD nIIda21R8vztVcg50sVliXyZB4uxrwrZaeIPYNF5iMHPTkHH4yO7brywBVm1R5zC+Jta CnNOabKbPyMN6NxYjL2ap7EDzKWjWNw1JHV1TW6142KzR0EWxGtjIl1gIKFKRE6Ig3is /zYdJBIgsmJWjm0/muqVcCakb+f0dX5vLsyNg8uxFtCzo4fqPK1nASxxiNJHngH33t4M UMWA== X-Gm-Message-State: AOJu0YwByqnEFJ6azrfNlwkVcOHHEjdqqtrMu6mzoU0zho4DS2ZD26m2 oXlM2MhYR3v4WlQuIOraYgxe9tVDMsU2xqQ6FnqiJZdemtTQUDdE8zxHxEeul0k= X-Gm-Gg: ASbGnctIfm7OauEL4j04jnPEsvuKVcR8at+PuWILXfowI4STnckBJqskFst397Vy76Z xlT0WcNhD0yiDuz2H9+krgL2czX7XsmVV2iuUFSgGt6uMT9ucYclpRqgo3PlYSr/5U6Bd5zPqoN 5N7APxdUkf32oTUdKShkAT+0RRSq7S1Gf09pcsAS2HTQmUEfkwobPRZueInkxSsDBcynGfxSDa/ IAuh073jw/UnUz34l9lnbXPpBB0PjOsbSc+WMEuEHLCpzINUuu2G97s/NsOTCxEcC1O90k= 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: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org 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: 13909299 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (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 ADD2F1D4612 for ; Mon, 16 Dec 2024 07:20:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734333616; cv=none; b=oXlrFCvo/DNe2gzzFhDAFajzx/fFnZ9jDKiF9J2DNg/o+Mzp8aTtNgZtn2XUlJHiOLUlfkkgkvFLDaIAHJZcjvn01S7XxHFs4LizX2RpL7SdOoVrAGcHMh0arE5QEw9aSMPLtncEufsu1dxR7TBR4bydwbr66T7wh9zZT1p3kG4= 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.53 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-f53.google.com with SMTP id 2adb3069b0e04-54024aa9febso3757749e87.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=J5BuWI5ICjdgpbliUKCgCVw81m0a7yyWVNNigdde591hYmMmrYCkZP87heMHGvUnVX w38nrh/VXqWhL5xOE1/rn7U/FULN3QUTW8qA6u2ErpDwfYVmUV2hzIjvpLDg/ZkUv0d5 oLkXWdaTxaPQ80yPcTtNgXjSQtJaxG+sVOBMqVhWbKiyGyl0fcHBe+e78xKBYOvHnkdv yVrb7NX+5/ka6mCTVvJH5T8bUPfOK/evkOK+Js7fu9dvNnaJ7xK73QuiQGGoYEgPScu9 Yf13TP/e9JmoOkDpg7Pt/ENjQcHLBG9EO7s+o5IJN1KrDQ/sifRlk66NvVwRC8LDReRI qhig== X-Gm-Message-State: AOJu0YyOrqnTQcLiBnRX0pZw5PFBhJwgaFIDCu/k5BcYkR5ysqPOa/gt AwNRzxh6hPppva49Ru8ot78aBAFHM+dOq4J78on6ihqV7BzG934zAJ4ZeHTC0VnMsSCs5GaJfeL Qv4A= X-Gm-Gg: ASbGncsigXgsem/27FIasX8+kucPE8Pu84XzVgR50GamF8J1avHeKOtgAVS8sWCOnoW 2KwCe71qOSndiNfGgbSqQJYWyBIv/Uxbp/ooxMQopm+4Tdopue52tublvqO2q/imhx9aMSJezTa V8b/jwFUfRpFiDJbNUCANEPk+AhCK5ey1h6fQO+liR9ZG4O2IuTD7HkC9SimnzRxrQJSgV9CV0u FY2CsG1990YSQZ0QY+SWr4uIdssx44iImvftItoTRLlaRNH5KdmBbnG/qhCcyCbNndFb7Q= 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: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org 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: 13909300 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (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 CD9EF1D5176 for ; Mon, 16 Dec 2024 07:20:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734333620; cv=none; b=qHb/BXnp086/z5uKLk0zsEdvRp8My4zqt9zX25tWGAxRXK5JljfpdqU0VBxWN2WazNfp6QnW/DehGBQbXb5wWYoOSZSaN7ksoc2H4PXJpWPIQnmApy6ceHzoFDCsthux4BHHBDC6e3WLD3fdevg2EzKGKMLm5KLRisdP4cwpYe4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734333620; c=relaxed/simple; bh=/e66GSylh66fjrDoof3R9JK40ytReFSDT/2ZT0m0crc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PuNeBj605dngOM7u9LFBoK5kEzIIkkK0qvf34TdzweLutyNws5YPKf5c2xR7e/IiQi61yl9BKtM9mUTljdaLUG/NY4a9B/gqWbZRoK87db32Xmy5vCNJVSE8cE1f5/xP4spReoTemXut93sRklJ6r1XNZu7g7U+K9FB+lEkh/HA= 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.208.172 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-lj1-f172.google.com with SMTP id 38308e7fff4ca-3035046d4bfso8752111fa.0 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=N0y0BmlVxR3iqot/Xj9qIxgExC379C5zhd4wABmwUzCKG8yOqKfS5Fofl4g594YsaK TkyxFQsJMk4vEESrIHHWGzLvD2b+hs5LH3r0piggd1uqxcuDN3fPyKgg8rxiPr0AfAqT vh+NYVdC8XkITJ7f5V/56oufDsKGm8RhkGyFrycc1fT/quxqfeDLOmB713hfehpihByK 5Y9S7eqlEBNYvK9gz3UP3RWjPXObIIGCmrr2NYSHnqFxUsXmsS+H/VcCWxT0eMcRx4kh tR2gyIuJqEqA3GgraPrJb3JFny4lK9WI6Z7Y2YTA7YBNRHbpjRAQmaYMja7WIrVbMbNP WVHg== X-Gm-Message-State: AOJu0Yy0zCVNLBn3rVLxK87ppd1oxZG9NolKL497E+kVd/21vu5ebrn2 FuqVbr0zNUDSKhKVArhzFRJDbfDNCmm97V00fJOgehjHKnDzvzAQXuIVkfMYgtc= X-Gm-Gg: ASbGncshGaE2ISdtb+ryaCh70TRVvT/nLU6FhvWEmdqSdhHn9PYmoseTlrGd78B7nyM x5bxyx79yaTlezDfGUWsRi2JRD42lzBNmPHsrHhMAUV+fR1zhJ5ZcLX/IQaMohxW0Za5VDUhx85 r0mK2lYPnhLGZRs2HOYOQIvW7k0jXdRSrKpYrzmLoB/AfhUUT9zmL7Y+DGWtv1x3rVQq981e3pO SuumWGN7bQF5NGNEX7jUI/uEG8Yl2QG2inX+W2nqEOYgmnhNG5CmcVmqSbIYVKuCFSu+kw= 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: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org 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: 13909301 X-Patchwork-Delegate: kuba@kernel.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 1E0C51B87EF for ; Mon, 16 Dec 2024 07:20:20 +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=1734333622; cv=none; b=fs3T5tHp+UoooIbHMcsEo5UzxE8U0bXXt0CRlEumltzTchFo6Z4vkqam0W7GdQCSzypfP2AzDTR91x8psAXxkRk1+UIT0u71HKN73zodmIIq88gqIDPWug17BqfgDh37K5pn04RL39c8XJxAOgOBYk8MxqwbwZES1CdgP/vsMNY= 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.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="lp2QMC9C" Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-540201cfedbso3874635e87.3 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=SGBjVOSdbKhTJqAhG/haPs+cOtNt1aqIW7hC1AgMnpHVXLNeNvDhzfZzLCh2QTQBkZ d/vTZQ0fDJrCy1bbZ5CMQpXiYlJaCZkTMtFRvRL2KD1FS3s6yZ037ZsVh/6mSV0Gz/hm gQX39RxaDb3YqGzHEeoTvPNFrP7xdeMQLnonpy6jVOeCeLr/dEH2hdSndj4pkoi/VgTs idKMkZuMw5unmWDgHJAxu4sshG806AdiSWZgshITI8XiJE5YgyO1Tn1uj16Y7cQ42ylW c0qLQsRULwMapbBv4oTiqeJrk2Jfpd/gxRjPOTFQAnoZV9dsobMSY/VcjObfT3JX/T2s T5Ig== X-Gm-Message-State: AOJu0YzAOMe41BOPgWnKgLrf3aUwrAKz01plOYVITANywWw1TlW6v3T4 cR1bvSqEHKPBLUcpuz0YlwDzkmouZ1013wnAZuy4umttKW5+IjY+zIiOgsg8H3c= X-Gm-Gg: ASbGncuSLucQk1VAwdLh/DtE3hb+xrDwZt3daNr+Qbz2zRLUIX3iLn+AX/0E+nxiZ9y q0VmjgGnYBXQ1AZzsNareXVGq09Cg5riQ02DgsV2/ZtIZwaZnnkLJy2830QjBcRMKY/v3TTFtvg gNKKo2FtEWwtGngmUeSkvmQq+mbfG61eQHfACFJiwfPdavhqjyLFSlR++HDBP43WUqGRmh5hFGZ m0XMErSaTbXMCVmTSkNkXzNUJmgv+jt8qgcdPnLAuliwAKnnokPID1IfU8BA4BxnDXykFs= 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: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org 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");