From nobody Fri Oct 3 06:35:31 2025 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (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 10C09242D6B; Thu, 4 Sep 2025 11:42:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756986135; cv=none; b=Poc8APRUVXJOPwSXkXzhPXx8AuptXTE9ybBsEbMLWPXKV8mOR+nfnH+S1eqqg5ziI1zAePfjDU2NBiKpF+2ljlawcBCLFFHZsqgyh/8yYuSABkSLIcwQNUQxkS1clH7pV7l69PWrIiav7ksL8YbPD8IQlFQQkSvPq+p3ZsRn9M0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756986135; c=relaxed/simple; bh=UWSMqpNHoZkkI/DKUp8cVw1/LsOuzKeqMsYOOyPmSlQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hlfB0v/XcgQoNQXo08xmgHVOE1R6ny/+BrKDhzycgvDpj1jt8s3azuRz8doQ0t+oadSpwoHK6pISLH3dkWpZkd/hi5PmKQcyqmXfcX1G2MBD90sHPdsrlY0oyObRsJDroFqc/RZ0QgV9riIaedlHhu5uU2pp+kUjACfpvFxct2I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=bXzKF9c5; arc=none smtp.client-ip=209.85.221.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bXzKF9c5" Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-3c6abcfd142so463533f8f.2; Thu, 04 Sep 2025 04:42:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756986131; x=1757590931; 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=wiHzNFj0sXhbbNytaeP0q9gONxcOf/J1oGe69aPoJ/c=; b=bXzKF9c5lfdXcWLi2tCqRFzAYcsHH9ZJluP3xLorm12FkB2louEs4QtWKGNRFLgIXH mOY+9OCBUR8myKWNx/jvI9CD+vy8fpnNUsaet6x9rTmuraONlT0VmjltmuyI4sxHlNYa zX6NxzyvjzJmyOWhOtlSd7J4Hr1Kkt67Yj8+croXprF7F6Z4WgYXTEea+jI42MbG98Tb 2hnWDyNaj0+kUEmpH68NVB4JGyXf0V0EPTWNEwO5fjHTFFEb6ua9qAD44D+ahzmCA98D YhdUkjT6c4oVY90IebmC/2CRqkqaPTLQhmi0IeZLw2YO2LAGmW+x7gXz/eex2RaWp470 +rHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756986131; x=1757590931; 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=wiHzNFj0sXhbbNytaeP0q9gONxcOf/J1oGe69aPoJ/c=; b=lanba0syZyutEogNPn96ftyLyzeHrd9k6gXxeWGMEHCWtPEjcspbHiGiIJDNz73Vkk jtazJZ4qo7SW4XhdxR/QWlD8xxlzvN5Q2aGRSXlz/jV5c5Zk8mZ+7a3S4yI7FpF4+sQD fnBA/8LCYEKRZcONTVNkw3KNXFZPjlgC+1qC9i07ZjSIbUoGnjk4sl8ldKq33I3HrQAc zWDaMdwagV/d/zIejkWuPXEv9DSKYyKa2CN9dYz8m7S6xI3BnD3MFbEe9Fm9IyDKrMRu k5uF8G34kkHM3SCpcTrtsahu/lc2TwzLoVwLjJM/P4eVbHykxB1BxuXHVeGXTwzP0dwI Z4vQ== X-Forwarded-Encrypted: i=1; AJvYcCU2GBGxxS60s2OL1DLazucVRoAufjW3aHBNTuHGOhhV57fmqGHxm8tbVe2QO7uxqOQZQYdzJI8ZYRO1eru2@vger.kernel.org, AJvYcCUYPO5vqF4AQU9GrZIcPmTFscrES6xwir9BJoIwey745/sAK6Cd5AaWCmr440o3xQomAJIxPmy/@vger.kernel.org, AJvYcCWWMIcYpEv+94C9WHajW37ccXw1l5+T8JOnyLHEEAR0nExy9lz/bP+9NA612mR+vJaSarx44dYCMvxM@vger.kernel.org X-Gm-Message-State: AOJu0YxnDEwBGFSzfdILwyo/+UDlNyDT3jTW0yVqE69WRQLZakQlOUFP 7UiR0fdOYywQ+NNQe7hNEAZyyettjHjw5hIQ777vBWqgmjjxGql2bxuk X-Gm-Gg: ASbGncvsDW8S5TXQTG7iUJrkKO3wxwINohtPbnSYZOGReuheb37G+ACYUCIcX5x6UhB 2NOlzflyPnSuRY3GybXH5qtoD89DhtjdYJDCJQdBJ1ZBqBR0XF7R4SNIRF5yiqabohM1yOuAYCZ FhOc1xPMkZAJ2WXb2PvRSlL2izonIzK6MO2UtxdbZwMMf1Ncw2r+7wVyqyRPJgnfObIXDE4bEfe Pcwr0/mM6qe3ORUsF/jAh4DBEifoE06sfcKRn2huDHXAu1ktKENJJL3P8n23HwzO2MGariP0ouo HqQpH5v5Chtg2dcIOI4MZu5eNE8Ym1vjNgPn+J8x2MP7I/LSD1xjoRFfQkIBDa5xNXjeoFUq6TK gMMvzsDvcjb5Zn7Ng/wrZ4XfnWSKowbCi02l5Nr3TfyQ1yESTQBiA/ZxNhYroUGfZV/Di X-Google-Smtp-Source: AGHT+IEMbYG8SVdojrwjIaHjYFEs8Zk2B3DIF87gp8205a+WHqyrZ0rpqJsgOWyr0e3EAwuXxrCtzQ== X-Received: by 2002:a05:6000:2d0b:b0:3d3:b30:4cf0 with SMTP id ffacd0b85a97d-3d30b305300mr8211238f8f.15.1756986131103; Thu, 04 Sep 2025 04:42:11 -0700 (PDT) Received: from iku.Home ([2a06:5906:61b:2d00:904e:70c8:edf3:59a4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45dd0aec70dsm14658475e9.0.2025.09.04.04.42.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Sep 2025 04:42:10 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiner Kallweit , Russell King , Philipp Zabel , Geert Uytterhoeven , Magnus Damm , Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH net-next v2 1/9] dt-bindings: net: pcs: renesas,rzn1-miic: Add RZ/T2H and RZ/N2H support Date: Thu, 4 Sep 2025 12:41:55 +0100 Message-ID: <20250904114204.4148520-2-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250904114204.4148520-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20250904114204.4148520-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Lad Prabhakar Add device tree binding support for RZ/T2H and RZ/N2H SoCs to the existing RZ/N1 MIIC converter binding. These SoCs share similar MIIC functionality but have architectural differences that require schema updates. Add new compatible strings "renesas,r9a09g077-miic" for RZ/T2H and "renesas,r9a09g087-miic" for RZ/N2H, with the latter falling back to the RZ/T2H variant. The new SoCs require reset support with two reset lines for converter register reset and converter reset, which are not present on RZ/N1. Update port configurations to accommodate the different architectures. RZ/N1 supports 5 ports numbered 1-5 with complex input mappings covering indices 0-13, while RZ/T2H and RZ/N2H support 4 ports numbered 0-3 with simplified input mappings covering indices 0-8. Extend the switch port configuration property to support value 0 for the new SoCs. Add a new dt-bindings header file with media interface connection matrix constants that map GMAC, ESC, and ETHSW ports to numeric identifiers for use with RZ/T2H and RZ/N2H device trees. Update DT schema validation to ensure proper port numbering and input mappings per SoC variant. Signed-off-by: Lad Prabhakar Tested-by: Wolfram Sang --- v1->v2: - Dropped regx in title and description. - As done for other IPs used T2H compatible as a fallback for N2H. - Renamed pcs-rzt2h-miic.h -> renesas,r9a09g077-pcs-miic.h - Added matrix table in the new header file. - Corrected the resets check for RZ/N1. - Updated the commit message. --- .../bindings/net/pcs/renesas,rzn1-miic.yaml | 177 +++++++++++++----- .../net/renesas,r9a09g077-pcs-miic.h | 36 ++++ 2 files changed, 165 insertions(+), 48 deletions(-) create mode 100644 include/dt-bindings/net/renesas,r9a09g077-pcs-miic.h diff --git a/Documentation/devicetree/bindings/net/pcs/renesas,rzn1-miic.ya= ml b/Documentation/devicetree/bindings/net/pcs/renesas,rzn1-miic.yaml index 2d33bbab7163..3adbcf56d2be 100644 --- a/Documentation/devicetree/bindings/net/pcs/renesas,rzn1-miic.yaml +++ b/Documentation/devicetree/bindings/net/pcs/renesas,rzn1-miic.yaml @@ -4,14 +4,15 @@ $id: http://devicetree.org/schemas/net/pcs/renesas,rzn1-miic.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# =20 -title: Renesas RZ/N1 MII converter +title: Renesas RZ/N1, RZ/N2H and RZ/T2H MII converter =20 maintainers: - Cl=C3=A9ment L=C3=A9ger + - Lad Prabhakar =20 description: | - This MII converter is present on the Renesas RZ/N1 SoC family. It is - responsible to do MII passthrough or convert it to RMII/RGMII. + This MII converter is present on the Renesas RZ/N1, RZ/N2H and RZ/T2H SoC + families. It is responsible to do MII passthrough or convert it to RMII/= RGMII. =20 properties: '#address-cells': @@ -21,10 +22,16 @@ properties: const: 0 =20 compatible: - items: - - enum: - - renesas,r9a06g032-miic - - const: renesas,rzn1-miic + oneOf: + - items: + - enum: + - renesas,r9a06g032-miic + - const: renesas,rzn1-miic + - items: + - const: renesas,r9a09g077-miic # RZ/T2H + - items: + - const: renesas,r9a09g087-miic # RZ/N2H + - const: renesas,r9a09g077-miic =20 reg: maxItems: 1 @@ -43,11 +50,22 @@ properties: - const: rmii_ref - const: hclk =20 + resets: + items: + - description: Converter register reset + - description: Converter reset + + reset-names: + items: + - const: rst + - const: crst + renesas,miic-switch-portin: description: MII Switch PORTIN configuration. This value should use on= e of - the values defined in dt-bindings/net/pcs-rzn1-miic.h. + the values defined in dt-bindings/net/pcs-rzn1-miic.h for RZ/N1 SoC = and + include/dt-bindings/net/renesas,r9a09g077-pcs-miic.h for RZ/N2H, RZ/= T2H SoCs. $ref: /schemas/types.yaml#/definitions/uint32 - enum: [1, 2] + enum: [0, 1, 2] =20 power-domains: maxItems: 1 @@ -60,11 +78,12 @@ patternProperties: properties: reg: description: MII Converter port number. - enum: [1, 2, 3, 4, 5] + enum: [0, 1, 2, 3, 4, 5] =20 renesas,miic-input: description: Converter input port configuration. This value should= use - one of the values defined in dt-bindings/net/pcs-rzn1-miic.h. + one of the values defined in dt-bindings/net/pcs-rzn1-miic.h for= RZ/N1 SoC + and include/dt-bindings/net/renesas,r9a09g077-pcs-miic.h for RZ/= N2H, RZ/T2H SoCs. $ref: /schemas/types.yaml#/definitions/uint32 =20 required: @@ -73,47 +92,109 @@ patternProperties: =20 additionalProperties: false =20 - allOf: - - if: - properties: - reg: - const: 1 - then: - properties: - renesas,miic-input: - const: 0 - - if: +allOf: + - if: + properties: + compatible: + contains: + const: renesas,rzn1-miic + then: + properties: + renesas,miic-switch-portin: + enum: [1, 2] + resets: false + reset-names: false + patternProperties: + "^mii-conv@[0-5]$": properties: reg: - const: 2 - then: - properties: - renesas,miic-input: - enum: [1, 11] - - if: - properties: - reg: - const: 3 - then: - properties: - renesas,miic-input: - enum: [7, 10] - - if: + enum: [1, 2, 3, 4, 5] + allOf: + - if: + properties: + reg: + const: 1 + then: + properties: + renesas,miic-input: + const: 0 + - if: + properties: + reg: + const: 2 + then: + properties: + renesas,miic-input: + enum: [1, 11] + - if: + properties: + reg: + const: 3 + then: + properties: + renesas,miic-input: + enum: [7, 10] + - if: + properties: + reg: + const: 4 + then: + properties: + renesas,miic-input: + enum: [4, 6, 9, 13] + - if: + properties: + reg: + const: 5 + then: + properties: + renesas,miic-input: + enum: [3, 5, 8, 12] + else: + properties: + renesas,miic-switch-portin: + const: 0 + required: + - resets + - reset-names + patternProperties: + "^mii-conv@[0-5]$": properties: reg: - const: 4 - then: - properties: - renesas,miic-input: - enum: [4, 6, 9, 13] - - if: - properties: - reg: - const: 5 - then: - properties: - renesas,miic-input: - enum: [3, 5, 8, 12] + enum: [0, 1, 2, 3] + allOf: + - if: + properties: + reg: + const: 0 + then: + properties: + renesas,miic-input: + enum: [0, 3, 6] + - if: + properties: + reg: + const: 1 + then: + properties: + renesas,miic-input: + enum: [1, 4, 7] + - if: + properties: + reg: + const: 2 + then: + properties: + renesas,miic-input: + enum: [2, 5, 8] + - if: + properties: + reg: + const: 3 + then: + properties: + renesas,miic-input: + const: 1 =20 required: - '#address-cells' diff --git a/include/dt-bindings/net/renesas,r9a09g077-pcs-miic.h b/include= /dt-bindings/net/renesas,r9a09g077-pcs-miic.h new file mode 100644 index 000000000000..43a2b5743a63 --- /dev/null +++ b/include/dt-bindings/net/renesas,r9a09g077-pcs-miic.h @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +/* + * Copyright (C) 2025 Renesas Electronics Corporation. + */ + +#ifndef _DT_BINDINGS_RENASAS_R9A09G077_PCS_MIIC_H +#define _DT_BINDINGS_RENASAS_R9A09G077_PCS_MIIC_H + +/* + * Media Interface Connection Matrix + * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + * + * Selects the function of the Media interface of the MAC to be used + * + * SW_MODE[2:0] | Port 0 | Port 1 | Port 2 | Port 3 + * -------------|-------------|-------------|-------------|------------- + * 000b | ETHSW Port0 | ETHSW Port1 | ETHSW Port2 | GMAC1 + * 001b | ESC Port0 | ESC Port1 | GMAC2 | GMAC1 + * 010b | ESC Port0 | ESC Port1 | ETHSW Port2 | GMAC1 + * 011b | ESC Port0 | ESC Port1 | ESC Port2 | GMAC1 + * 100b | ETHSW Port0 | ESC Port1 | ESC Port2 | GMAC1 + * 101b | ETHSW Port0 | ESC Port1 | ETHSW Port2 | GMAC1 + * 110b | ETHSW Port0 | ETHSW Port1 | GMAC2 | GMAC1 + * 111b | GMAC0 | GMAC1 | GMAC2 | - + */ +#define ETHSS_GMAC0_PORT 0 +#define ETHSS_GMAC1_PORT 1 +#define ETHSS_GMAC2_PORT 2 +#define ETHSS_ESC_PORT0 3 +#define ETHSS_ESC_PORT1 4 +#define ETHSS_ESC_PORT2 5 +#define ETHSS_ETHSW_PORT0 6 +#define ETHSS_ETHSW_PORT1 7 +#define ETHSS_ETHSW_PORT2 8 + +#endif --=20 2.51.0 From nobody Fri Oct 3 06:35:31 2025 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.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 6088D2ED170; Thu, 4 Sep 2025 11:42:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756986136; cv=none; b=uvn/mN8ajaRIpmaFQrBoiJ/OPuOrYrZoP+/MEUTM0zWkBK7eeEXeGx/YzhwWRyHwxPtyS6RkLKesks+Fu9lvthu5E9e8L1n2MvFAaqL7npUxdpRHsMxqMib4G2dycnaqF/0XrVLEYYx4n9PGDd8KpRkOk7Y7xPC2cxYmB0xM95M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756986136; c=relaxed/simple; bh=CwhmBlyC0qvVqF/G7epb4UCN6X0UNZty021S+ki7K84=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QVewqmzB8WXOmwDftr/UvkeRjMBTH80B5hEP1euBW27qOydcrQjA1Sb3lQ/7bEwFOGD3J5Accs8jMzDCDz6pdi9m48kzYoHz34ltWWT+gjKRU30zFf1TVQwEWfTkgDgg6FW+jQgBXpGMKAyr+sX8AVTA1xfmIoVZ9fv3w9ebWJI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=cyxgi1T2; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cyxgi1T2" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-45dd513f4ecso11435e9.3; Thu, 04 Sep 2025 04:42:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756986133; x=1757590933; 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=EiskG7ip+Sn5uNaRuk7x96d3D95CuuIRPhQ43cdE01k=; b=cyxgi1T2XVb+KaP4Y7WyEql6ET7x5enTcRNh/Tj6iFUu5GGs2bcdNgAMDUcLm2w7i2 ZoXPhJc0FIpuawkvzUjhSaxwZm+nOJJT8mxgl9fKwGAo2CdKpMDQaSX81cFIhTsIyoU2 7zLQT7z8V+2Ju7ja6cwcLMrw2hBkrT7j13Qj77nf5uUFgmLx1WDI6MlSLkE6CAeTzcG1 vnfKsrbRZekSVUmjNzUSXS+jriEGZfRPki01LvHMNDU9FeVz3giJbKTO5ccbBxxUNdUW Tdqyy4VbsairO7aW55sjj3gmDv7xDI8uJcxVVA2SFof+FNVIEGpu20F3FLD198umQC3O 7OzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756986133; x=1757590933; 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=EiskG7ip+Sn5uNaRuk7x96d3D95CuuIRPhQ43cdE01k=; b=M5AXKIc7nmXHFXyIzL1LVuxqwsFkfP1fIRDDdrmyHezXEFLOFoaHEl+AUhaXHJbROx XgYK4ClFgOPGndtoNBlQnH8abByub7LCwZ074ZYfmMUnA8EyRJwrvUpEE5mbVT9boGzT 0K3MlH44UqsSjw9eKbC7+IGXIZ2XWTOLzNDzIe6mh9rbmpPTCqdYIyuurS26Ae9ZcF76 3amVKMn/HHSp9yxaIYNFk3Q5fqA1lRnlNMcGEd/hYjWnNSdE6rvlZ9R3SKYWkoTkhPcN oeptF/tZiOQeZBuyZ5fuJjKdL/Rzu/ggzFFh1AQzYeRftd06iSM5Le+qiJPNcjV8uDwK Ci7g== X-Forwarded-Encrypted: i=1; AJvYcCWI+kfzYalFoXLBeg+Rg7PxHi1IPDEHIzv9htkw57zwAG0eJmtkow8rAStd7+CCGw8KTexvl5YC@vger.kernel.org, AJvYcCXJ4p8sq1XhE0hWXSwNjzUX/+YPkj0rUAGeYUmHPOsaMZ0zuuIojW78m/qVrJ9Lewz2XUmMuaZWkh8Fepbi@vger.kernel.org, AJvYcCXJwMeRz0aFJfepK7vXeOT6U8sA0Wwn08Ggx20kmJLPTbaEr148nAPXLd6pNBanSRTGz/IRhPXqa2Kc@vger.kernel.org X-Gm-Message-State: AOJu0YxIZSbD8K7Iha1vsFmiHntmXtxRt64+19ixfvsQLvcji82EPWH8 qkNioRejykvJtF8mmWrcGCkvpWdunfiCOzxHC5GD5RYK7jhnUK61bNvT X-Gm-Gg: ASbGnctfbaYvFXkd/pTtNtmwEJmRv2MOXNiTYXSkxpXIwzO3UWLhtIRWJD3z8jNjplu dai3gzsM/jbV8x/AIdFUTCxpGdhMi4uUgwNxbm1KAx1rWVgIBL8PV1Pe9wCleC6f+vGjsxFwiWe 4w0VHqwiC9d0wecVU8UgarxUrd+DVEwhiKD43sLSM+4/OIQ/YdXl931ZDnsWgts6T0nLuHeZzEk 1376uB23Es1Fsvy8yteLvSpkBvIwFuW/d2PB6IBlLW76jYHsJrtDqaHfJF0zN4Tff9LuJtLI/HI 1NLm2Ts60eGMaNnxO0m9Dwg1ONHzbmYJ6oO9YyUqODewLe1K5GwYzyFf2ETwOKBeLlRbrPeH/Ml ZFydgPPGQnIDBIxCcFsiGbbKuY8a9O9yPdjP39D8bPPwNDGBBzDrFTz5g0A== X-Google-Smtp-Source: AGHT+IEF5HJ2Q9ZVNS1dBnaOZLbbNcKoC8c7OnyJoiBxlGKSFwR3uBoDPwbyW+SLHuN3Rfra460D3Q== X-Received: by 2002:a05:6000:4210:b0:3d6:4596:8a2c with SMTP id ffacd0b85a97d-3d645968ca5mr10643219f8f.50.1756986132361; Thu, 04 Sep 2025 04:42:12 -0700 (PDT) Received: from iku.Home ([2a06:5906:61b:2d00:904e:70c8:edf3:59a4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45dd0aec70dsm14658475e9.0.2025.09.04.04.42.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Sep 2025 04:42:11 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiner Kallweit , Russell King , Philipp Zabel , Geert Uytterhoeven , Magnus Damm , Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH net-next v2 2/9] net: pcs: rzn1-miic: Drop trailing comma from of_device_id table Date: Thu, 4 Sep 2025 12:41:56 +0100 Message-ID: <20250904114204.4148520-3-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250904114204.4148520-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20250904114204.4148520-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Lad Prabhakar Remove the trailing comma after the sentinel entry in the of_device_id match table. Signed-off-by: Lad Prabhakar Reviewed-by: Andrew Lunn Tested-by: Wolfram Sang --- v1->v2: - No change. --- drivers/net/pcs/pcs-rzn1-miic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/pcs/pcs-rzn1-miic.c b/drivers/net/pcs/pcs-rzn1-mii= c.c index ce73d9474d5b..c1bd7cd58478 100644 --- a/drivers/net/pcs/pcs-rzn1-miic.c +++ b/drivers/net/pcs/pcs-rzn1-miic.c @@ -529,7 +529,7 @@ static void miic_remove(struct platform_device *pdev) =20 static const struct of_device_id miic_of_mtable[] =3D { { .compatible =3D "renesas,rzn1-miic" }, - { /* sentinel */ }, + { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, miic_of_mtable); =20 --=20 2.51.0 From nobody Fri Oct 3 06:35:31 2025 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.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 BF5902FC886; Thu, 4 Sep 2025 11:42:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756986137; cv=none; b=QDvbn7R/Mh/G2an9MC3DbMqMoFw8WVfk7BpkG00KTYoUW/9I/68n2ZG9r8HRH6l0z6fNYd+YEfphNP7raaL8B8LvLBel4f4fb35vDWlDE0G+M6vJQcx44euKCUCv/iJsYPtPGGnsd7vti5/9V5TSZ+3uVV++c2Ie2S8n+szziLQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756986137; c=relaxed/simple; bh=S88QBspoEo5uOdJkQcgMZha6EcNj57qrblWItO8/pu0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NzwRPMZhWF6+HQdEgTiVdjh+scUk5u6r8mLAcnTOt792rOCPnjKYZctQwtWtUbrindlDkb3nf4mQOMVKvTYT1OfMXVJdCK6Ez2wcXif5AsrA2j0uzl7mJpUyt/PomXY1xlrqvxIAzoAgYBDbLJhj1jurPttLWIqrmZDIU6wkPdM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZArgeO0r; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZArgeO0r" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-45dcff2f313so4868635e9.0; Thu, 04 Sep 2025 04:42:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756986134; x=1757590934; 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=7VOFVWnlVOI1qQJy5viif80H4uziET0ECBfXBUJywU4=; b=ZArgeO0rHW8sfx0D2jrLWQPgvnIdb5u4brKIMNAV1hUc6kN0ZY4ucFmmYBgaJGfxPW H3MA1Wk6JcbGXF0LtMXpanZ9q1XMMiwNhaP2FmmhxS570QZMA9dRLH2fZvLgNTtJ6ShQ dp/+VFbGfmAU03rK0t/vW5ud9hHFVq4AdOlAoYc1w9g/UhBA0/xSKtIRBoiXaKRma+0l g0ORR5bvpsUqUABb07LJzpdT/v6Oj+2Cd3/U+lp4Jdz9GALwz8+jAfJun9CAPtqQvkHM V9BP7lxZ83dT5sKd/WdbhQTTgbh5HA2wnTR6fSbnuHVJLhd/h0Raj3JayFqbPCQlLYbX xDhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756986134; x=1757590934; 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=7VOFVWnlVOI1qQJy5viif80H4uziET0ECBfXBUJywU4=; b=CgpLu0RDlVCkpEThBMb/GFWtFrG22igriUBHjZTMJ5nlCVnIn0+kRin2JrB1proloS NG4j610PXvBkElre1pATnRho7i/2MGdrAnkdZzTNbJMGmzCfBsHRxY7tUTFGuP2pgC9n DrxQQY1aJqtYeMdYtTyr0Gt/LhFlpFkgRU1Yxxd9ybHUMiYPZ/6lEjTPzOsN+J0N6Uhq TlMIXYb42jYGdOhw8gbgrbE4+2xNd0Wi59DXSqjg1VQ0wm5wcT3Zo8Bx3g9OhpBcF9C+ MMlkw2+VxV1HhNh7j3FTcoHwnYzF3kB09PLRvi7OIDMY5I8QNDIGhzLKZuS2WGPA8ee7 mf2A== X-Forwarded-Encrypted: i=1; AJvYcCV0JtrCZ7KaVula386qw1lCnD+noLkFKVPcdlh4DI5t07r+nIqay6i1UvjJLPl4WxAIdGk40uwbZzVQ@vger.kernel.org, AJvYcCVfd3M8ljJaHJrNC3piwY4b+nurpGYSZWeju7MUItZztZkxNhWxK764GX++nJU7oj11HnqiF2ywWkDCj0v+@vger.kernel.org, AJvYcCWIkwJvX5Sn2a806PEwGUfxyPpjYzt2BPbFJZHJd5iNK4QoSFixpNz/aJJllSO4z8RV6Ubs5Bok@vger.kernel.org X-Gm-Message-State: AOJu0YzqpXm0souZQv9cJ8sZxpT/9+LMIGhGgrKBiaTv5oFHcfhY2J4Q xe4z9LbLyThAGW5V1zYbdCNCg2filNHDeiRRNV6VmEHY1yjdxjH94KD+ X-Gm-Gg: ASbGncuqAdeFeI0GJu7H597tD8HDBSj9mreW8lUwlYY5VK2PDhb5n0s65tlu2f8qJ4Q CMrAQ5pSnT2igfbDfWyxZwM01gafFFQsbGEzxKv2IWzfBGQT4CO+m2kN7LEGMzsIT8I1eMBAPPK tJi2K+AGaXXE4WYASAY2pLisRiK6dDdMByGs9UTZTgOTxqngW7V/uvewwYULjngYAESevFp2Mt3 XhCaLFBxHYDPwhCEMsOKNYb3f+D99syed4ExM2ttc9a4O26LUi7Kyahfh6EPll2hgTK8BvVxUK4 tn6dWL2xqW2YgdutMsQHEKF+7xIbHs/zyJ/nCwEtovxqVvpZrME3iYCzsSzXO9muBWMA310Mbru aod7e5zAfYTy/VcrdxMp29h54K0RhxFIt1XhMNH2V8YyJVlS3lqlGt2cNQw== X-Google-Smtp-Source: AGHT+IF10FgK2Y8orbR1gTsDr/K88YrLeVYHAAvWCwrXq4W0gDetumZ4U48zYDxPkziG5RUR/8z/mg== X-Received: by 2002:a05:600c:1c8b:b0:45d:98be:ee95 with SMTP id 5b1f17b1804b1-45d98beefd5mr30608975e9.3.1756986133914; Thu, 04 Sep 2025 04:42:13 -0700 (PDT) Received: from iku.Home ([2a06:5906:61b:2d00:904e:70c8:edf3:59a4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45dd0aec70dsm14658475e9.0.2025.09.04.04.42.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Sep 2025 04:42:12 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiner Kallweit , Russell King , Philipp Zabel , Geert Uytterhoeven , Magnus Damm , Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH net-next v2 3/9] net: pcs: rzn1-miic: Add missing include files Date: Thu, 4 Sep 2025 12:41:57 +0100 Message-ID: <20250904114204.4148520-4-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250904114204.4148520-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20250904114204.4148520-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Lad Prabhakar The pcs-rzn1-miic driver makes use of ARRAY_SIZE(), BIT() and GENMASK() macros but does not explicitly include the headers where they are defined. Add the missing and includes. Signed-off-by: Lad Prabhakar Reviewed-by: Andrew Lunn Tested-by: Wolfram Sang --- v1->v2: - No change. --- drivers/net/pcs/pcs-rzn1-miic.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/pcs/pcs-rzn1-miic.c b/drivers/net/pcs/pcs-rzn1-mii= c.c index c1bd7cd58478..adf4b5e4741c 100644 --- a/drivers/net/pcs/pcs-rzn1-miic.c +++ b/drivers/net/pcs/pcs-rzn1-miic.c @@ -5,6 +5,8 @@ * Cl=C3=A9ment L=C3=A9ger */ =20 +#include +#include #include #include #include --=20 2.51.0 From nobody Fri Oct 3 06:35:31 2025 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (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 2BAE12FF64B; Thu, 4 Sep 2025 11:42:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756986140; cv=none; b=Lfwrd/xUV16f2CKBH0cUAtBkZEOKUKcVVP/PBdTmFE+bNfliTDFNfKCVT8SGKcRKtPeO2k8Yz8Api8ecNoTvaz2sneWdfr/0F1Do2lguAcIMW1XJyFrAasY1ATsgLObuYpdER/zuoF0pnkCDoIm2oz5KSlt5PRmLrGtpfVj/5jg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756986140; c=relaxed/simple; bh=hyWYSvFa6tpF4Y2BAIs+YgMyeqZXTqaGk0/0nvLMFAQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jCnUOUVD+kjs5Jdu/6v52BXZbk92QzdezYOa/j5WAaOJdnN1db2zZmSoY/kZiEF8VwpFP3yh/NQSqPZICvuN6AJuH9Ygk7y4reG4JHGo71zu9MjB97n3wv17MAh2x26QRi0qIJsi+9p/M1p7uyv9p3ij2kIkMMNiCl4s9LBQ1M4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=LTRx7BmR; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LTRx7BmR" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-45b7c56a987so4381295e9.1; Thu, 04 Sep 2025 04:42:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756986135; x=1757590935; 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=u8FKmtGi1QakWxx1ut7+vq4SNtntAlPKBe+ilmYSz5c=; b=LTRx7BmRwk9BH6rsnE4CpkvTwPXknAXLJpYqp+7kO6//AWHJY0hu/yPZOj79TSpioH BeI3wvWJ1LhT7Di9KAFySXZ52nGaYM30Vglz1G4wAKFJ25G5xKm9W5U7UTAJwQ9POraX IcFe3jEbaZrtbplFid6YRg1kz/4xvL9+LC85xvttQw/wHBaa3qjrt/Es4d7SRTaksEL5 nFFiHYlt/e8/Db/VYEkEtqi6IABz51p4UjnXN6bAskTpXAb3eKy4pRshiOAx7tJ7Q8U6 UW89OodmUp+52v3CKHwCywJ5zzKvclzOXyN8pO9ImRvF+piWaRfTB/Uwl4tAea3UUQnL aEsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756986135; x=1757590935; 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=u8FKmtGi1QakWxx1ut7+vq4SNtntAlPKBe+ilmYSz5c=; b=Kdfvc+1k85IZ67FNukUN2gYoAiZR/kF3FEw7DBuslV12epoliBGbhuGGGPcIbeL53N RFB0LPmCbRdVb0R5tQrtoAE6FJLWIBpK3udqz51ZmfVkV1Z/6V4PZlmZkjSMy4Iy2XT+ L3wGieEOytNw1+q/2gbNZYXH4gfGZTVOu92uxFyLon2v2n2r5oXq5gjTMzNnuSv58yh5 wlpmI7wBoRCB+k5xXwQsBYyzDfXhlzOJ9kpIhcggYkvoP3F3ThEfO1zIUT+P1T+y6+YU 2YB6b5OBSHwlVIpuQprCDZCa/6ihSRioaMQQBDPOz4Ycd2r3qET7G//bNC/O1QEq64JY UDuQ== X-Forwarded-Encrypted: i=1; AJvYcCVIUmAkDGfwYW/ciiEuqEREbfjjEADo3CSNEtqSUWeQ3dwbp3VSJWWQ0+Xh1VVsWqCcy5SjYYG52Wik9Mfo@vger.kernel.org, AJvYcCWSiE7x+/4qmMZtaQw5uBsH5Gk1X6djJHpGQGWJZv2MmCanOisky7Bsl0RWEjbsmmska6+EB+hSgn/b@vger.kernel.org, AJvYcCXALPJxUKtYW0NMLGoFSsYkMsx9q77D8y7Xj54EhyEMQvqbvRXcSTBH6S3gnOEbBDxd9IS+3KEg@vger.kernel.org X-Gm-Message-State: AOJu0Yz7y5MI2NJBXxcMeYTL+KT/GwYfS+qCl+OTbLq+M3iWlEYNMpHX IMRxLeqYlPUGir1b/Gm9UI6P4X31qVO8005GNABfqYzo4SP2szO9NpHE X-Gm-Gg: ASbGncvLi4xnzXBI68muH/AGSwEgHldTKhQkRRI0yg3zIQa244g9qJZZ4bmrRPPJ4fI 6+CYx8+i49gPsE5n7qUMd1aCx9I3s9ZLkVfV4DI4H2HmzGP+kj9fbqk1VTTedCN5yeCFnHgJvt1 /uIJqaQ+Y7CCNFuEKzD/s21wDcqMWbYOXUCMvrh+AqGQMy952mT6Eayp+3wod4/cJ9rACKY381V Wspxk5DMBbg2Bj83+kxhcdWJrvY8IT+1G7/mBjkwO8/rVshnf0EmBSUrorBX3q9JK+fWmM+IJw+ 0xPQ1BSRHRcrNH6VOkL3oc6hVAG6fv41DAvk7W8Bpyu9YgO2MBfo8O4ShLj+4MBUMXmiA3UseRq v8DdAcmmCTSncd2i2m9p02SQUfm0ZtLAyC+AkmFlEav6dxDKM9kjAdld1Fw== X-Google-Smtp-Source: AGHT+IFO0DQ943JtXSsqZ/NUdlqcpZocW4XYSmFqUsbitkGA04CB8I7rPFOl1bpQsVtrZXMXehkpmA== X-Received: by 2002:a05:600c:1e8b:b0:45b:8324:d2fc with SMTP id 5b1f17b1804b1-45b8549c384mr162884685e9.0.1756986135347; Thu, 04 Sep 2025 04:42:15 -0700 (PDT) Received: from iku.Home ([2a06:5906:61b:2d00:904e:70c8:edf3:59a4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45dd0aec70dsm14658475e9.0.2025.09.04.04.42.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Sep 2025 04:42:14 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiner Kallweit , Russell King , Philipp Zabel , Geert Uytterhoeven , Magnus Damm , Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH net-next v2 4/9] net: pcs: rzn1-miic: Move configuration data to SoC-specific struct Date: Thu, 4 Sep 2025 12:41:58 +0100 Message-ID: <20250904114204.4148520-5-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250904114204.4148520-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20250904114204.4148520-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Lad Prabhakar Move configuration data such as the modctrl matching table, converter count, and string lookup tables into the SoC-specific miic_of_data structure. Update the helper functions to use the per-SoC configuration instead of relying on fixed-size arrays or global tables, and allocate DT configuration memory dynamically. This refactoring keeps the existing RZ/N1 support intact while preparing the driver to handle the different configuration requirements of the RZ/T2H SoC. Signed-off-by: Lad Prabhakar Tested-by: Wolfram Sang --- v1->v2: - No change. --- drivers/net/pcs/pcs-rzn1-miic.c | 107 ++++++++++++++++++++++---------- 1 file changed, 75 insertions(+), 32 deletions(-) diff --git a/drivers/net/pcs/pcs-rzn1-miic.c b/drivers/net/pcs/pcs-rzn1-mii= c.c index adf4b5e4741c..724bac86cf8c 100644 --- a/drivers/net/pcs/pcs-rzn1-miic.c +++ b/drivers/net/pcs/pcs-rzn1-miic.c @@ -16,6 +16,7 @@ #include #include #include +#include #include =20 #define MIIC_PRCMD 0x0 @@ -50,7 +51,7 @@ =20 #define MIIC_MAX_NR_PORTS 5 =20 -#define MIIC_MODCTRL_CONF_CONV_NUM 6 +#define MIIC_MODCTRL_CONF_CONV_MAX 6 #define MIIC_MODCTRL_CONF_NONE -1 =20 /** @@ -58,11 +59,13 @@ * See section 8.2.1 of manual. * @mode_cfg: Configuration value for convctrl * @conv: Configuration of ethernet port muxes. First index is SWITCH_PORT= IN, - * then index 1 - 5 are CONV1 - CONV5. + * then index 1 - 5 are CONV1 - CONV5 for RZ/N1 SoCs. In case + * of RZ/T2H and RZ/N2H SoCs, the first index is SWITCH_PORTIN then + * index 0 - 3 are CONV0 - CONV3. */ struct modctrl_match { u32 mode_cfg; - u8 conv[MIIC_MODCTRL_CONF_CONV_NUM]; + u8 conv[MIIC_MODCTRL_CONF_CONV_MAX]; }; =20 static struct modctrl_match modctrl_match_table[] =3D { @@ -111,7 +114,7 @@ static const char * const conf_to_string[] =3D { [MIIC_HSR_PORTB] =3D "HSR_PORTB", }; =20 -static const char *index_to_string[MIIC_MODCTRL_CONF_CONV_NUM] =3D { +static const char * const index_to_string[] =3D { "SWITCH_PORTIN", "CONV1", "CONV2", @@ -125,11 +128,33 @@ static const char *index_to_string[MIIC_MODCTRL_CONF_= CONV_NUM] =3D { * @base: base address of the MII converter * @dev: Device associated to the MII converter * @lock: Lock used for read-modify-write access + * @of_data: Pointer to OF data */ struct miic { void __iomem *base; struct device *dev; spinlock_t lock; + const struct miic_of_data *of_data; +}; + +/** + * struct miic_of_data - OF data for MII converter + * @match_table: Matching table for convctrl configuration + * @match_table_count: Number of entries in the matching table + * @conf_conv_count: Number of entries in the conf_conv array + * @conf_to_string: String representations of the configuration values + * @conf_to_string_count: Number of entries in the conf_to_string array + * @index_to_string: String representations of the index values + * @index_to_string_count: Number of entries in the index_to_string array + */ +struct miic_of_data { + struct modctrl_match *match_table; + u8 match_table_count; + u8 conf_conv_count; + const char * const *conf_to_string; + u8 conf_to_string_count; + const char * const *index_to_string; + u8 index_to_string_count; }; =20 /** @@ -398,12 +423,11 @@ static int miic_init_hw(struct miic *miic, u32 cfg_mo= de) return 0; } =20 -static bool miic_modctrl_match(s8 table_val[MIIC_MODCTRL_CONF_CONV_NUM], - s8 dt_val[MIIC_MODCTRL_CONF_CONV_NUM]) +static bool miic_modctrl_match(s8 *table_val, s8 *dt_val, u8 count) { int i; =20 - for (i =3D 0; i < MIIC_MODCTRL_CONF_CONV_NUM; i++) { + for (i =3D 0; i < count; i++) { if (dt_val[i] =3D=3D MIIC_MODCTRL_CONF_NONE) continue; =20 @@ -414,53 +438,57 @@ static bool miic_modctrl_match(s8 table_val[MIIC_MODC= TRL_CONF_CONV_NUM], return true; } =20 -static void miic_dump_conf(struct device *dev, - s8 conf[MIIC_MODCTRL_CONF_CONV_NUM]) +static void miic_dump_conf(struct miic *miic, s8 *conf) { + const struct miic_of_data *of_data =3D miic->of_data; const char *conf_name; int i; =20 - for (i =3D 0; i < MIIC_MODCTRL_CONF_CONV_NUM; i++) { + for (i =3D 0; i < of_data->conf_conv_count; i++) { if (conf[i] !=3D MIIC_MODCTRL_CONF_NONE) - conf_name =3D conf_to_string[conf[i]]; + conf_name =3D of_data->conf_to_string[conf[i]]; else conf_name =3D "NONE"; =20 - dev_err(dev, "%s: %s\n", index_to_string[i], conf_name); + dev_err(miic->dev, "%s: %s\n", of_data->index_to_string[i], conf_name); } } =20 -static int miic_match_dt_conf(struct device *dev, - s8 dt_val[MIIC_MODCTRL_CONF_CONV_NUM], - u32 *mode_cfg) +static int miic_match_dt_conf(struct miic *miic, s8 *dt_val, u32 *mode_cfg) { + const struct miic_of_data *of_data =3D miic->of_data; struct modctrl_match *table_entry; int i; =20 - for (i =3D 0; i < ARRAY_SIZE(modctrl_match_table); i++) { - table_entry =3D &modctrl_match_table[i]; + for (i =3D 0; i < of_data->match_table_count; i++) { + table_entry =3D &of_data->match_table[i]; =20 - if (miic_modctrl_match(table_entry->conv, dt_val)) { + if (miic_modctrl_match(table_entry->conv, dt_val, + miic->of_data->conf_conv_count)) { *mode_cfg =3D table_entry->mode_cfg; return 0; } } =20 - dev_err(dev, "Failed to apply requested configuration\n"); - miic_dump_conf(dev, dt_val); + dev_err(miic->dev, "Failed to apply requested configuration\n"); + miic_dump_conf(miic, dt_val); =20 return -EINVAL; } =20 -static int miic_parse_dt(struct device *dev, u32 *mode_cfg) +static int miic_parse_dt(struct miic *miic, u32 *mode_cfg) { - s8 dt_val[MIIC_MODCTRL_CONF_CONV_NUM]; - struct device_node *np =3D dev->of_node; + struct device_node *np =3D miic->dev->of_node; struct device_node *conv; + int port, ret; + s8 *dt_val; u32 conf; - int port; =20 - memset(dt_val, MIIC_MODCTRL_CONF_NONE, sizeof(dt_val)); + dt_val =3D kmalloc_array(miic->of_data->conf_conv_count, sizeof(*dt_val),= GFP_KERNEL); + if (!dt_val) + return -ENOMEM; + + memset(dt_val, MIIC_MODCTRL_CONF_NONE, sizeof(*dt_val)); =20 if (of_property_read_u32(np, "renesas,miic-switch-portin", &conf) =3D=3D = 0) dt_val[0] =3D conf; @@ -473,7 +501,10 @@ static int miic_parse_dt(struct device *dev, u32 *mode= _cfg) dt_val[port] =3D conf; } =20 - return miic_match_dt_conf(dev, dt_val, mode_cfg); + ret =3D miic_match_dt_conf(miic, dt_val, mode_cfg); + kfree(dt_val); + + return ret; } =20 static int miic_probe(struct platform_device *pdev) @@ -483,16 +514,18 @@ static int miic_probe(struct platform_device *pdev) u32 mode_cfg; int ret; =20 - ret =3D miic_parse_dt(dev, &mode_cfg); - if (ret < 0) - return ret; - miic =3D devm_kzalloc(dev, sizeof(*miic), GFP_KERNEL); if (!miic) return -ENOMEM; =20 - spin_lock_init(&miic->lock); + miic->of_data =3D of_device_get_match_data(dev); miic->dev =3D dev; + + ret =3D miic_parse_dt(miic, &mode_cfg); + if (ret < 0) + return ret; + + spin_lock_init(&miic->lock); miic->base =3D devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(miic->base)) return PTR_ERR(miic->base); @@ -529,8 +562,18 @@ static void miic_remove(struct platform_device *pdev) pm_runtime_put(&pdev->dev); } =20 +static struct miic_of_data rzn1_miic_of_data =3D { + .match_table =3D modctrl_match_table, + .match_table_count =3D ARRAY_SIZE(modctrl_match_table), + .conf_conv_count =3D MIIC_MODCTRL_CONF_CONV_MAX, + .conf_to_string =3D conf_to_string, + .conf_to_string_count =3D ARRAY_SIZE(conf_to_string), + .index_to_string =3D index_to_string, + .index_to_string_count =3D ARRAY_SIZE(index_to_string), +}; + static const struct of_device_id miic_of_mtable[] =3D { - { .compatible =3D "renesas,rzn1-miic" }, + { .compatible =3D "renesas,rzn1-miic", .data =3D &rzn1_miic_of_data }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, miic_of_mtable); --=20 2.51.0 From nobody Fri Oct 3 06:35:31 2025 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 1EE182FFDE0; Thu, 4 Sep 2025 11:42:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756986140; cv=none; b=lERsMsrUBhtacfJn4WDGgJXe4SOHukWo1JZeqv/utqAzdnQ3/v0fkCFbZTdyMPTpSqoEo1GmQ3WplbBKed8gIKCZGbRsMbnmfxX0PB/FVz+obk3G36NtXbf1sh19zfZQAP/zLuBy8iIDfZBdCELdBmycPSFFTwzKsMCe3t6nPBM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756986140; c=relaxed/simple; bh=B84gwqS6nv0EEYGOs4F76lmNItDiKC98HhRJtXhquTQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OiprvlfvMA4pOA8EAR/mW+9iySP6F+F9LUKG36eAIuWxBHg4rLKkGAxlzKCHioNK26h0THTyrrUJwGK0nLHKlXvmBLeVF0MvFMqPZCm2c6h9EcdHgezhTuMo3xck68H+7b6AIBebg3lgp3vDjYydnOIZ0k0QgLy2FEzMx0SJbWQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OIePWQ5V; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OIePWQ5V" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-45b9853e630so8409345e9.0; Thu, 04 Sep 2025 04:42:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756986137; x=1757590937; 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=kfzdh/iENN/JZiCLP2w1ErIldr+h6FYbADs6+tNjxpM=; b=OIePWQ5VpgaqAr+pVj/HQ8WsXYWHjuVyIKFNcbcWKuCaIqZ9Ev4FeNfbVx4KS100pg CcQStajZAhOdwiItGxF/v4J7BWC+IukSKEjvpKu9CNk7m2B1JwtgJ193XUIFix6pmaGu IXqLVvp7z8kgcjb9+utI9jo+SY18W4FIkVKoG6XSHd6tUQgVXybh5huuH1EJ2NdkXH+y jVG2WHqSf3+zdyxUh9BdXxVy/R/ARNekIzsC8ACr3PNpmIMviXkqH4yUpwjS4UVTE7aI gTuLlYsH7s2gepIdaffofZb5C+r8OHXkVHwQwQL9AMq+PW5dtyeIxho6byMulyaBtWoN S9Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756986137; x=1757590937; 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=kfzdh/iENN/JZiCLP2w1ErIldr+h6FYbADs6+tNjxpM=; b=RGnvL9BQsylZ956vJvMGuXflTfcMohnKLAn2OndvPtwee2uhf6o319Njl0nzTgHo+D e4thwAIBn7NBqMkIV+WWI5XWEu/VQokdbxosKYrORAV/K1Hs3vyIhFyr9OEF4YRj3tMn OPQ/qb32dYaDH+/4leJq3OoFbG3sbEvmKJSY6hpH1DWs00W+f8asXy9pSNDcmRJYXmq5 xs1bI/WqrzMM4/7NkwQhwNOofkHIvFID9QEfk/oHXjkOHM70h2BOUS2mYt5ZFFaalwRr wdzcimrveZqHcDMvrnteUnuxyR4sFdxZ6cExvlF9Xa0VPGrglGKn2LyQl6nrVwMy6Cob LqRg== X-Forwarded-Encrypted: i=1; AJvYcCUsvly94xBI2qmk+OFi5zGTM9Vgffa30Vg4bfzs7liKE/L7tgtkHmi+mQrQsWvJC9uNHYqKQo5Q23pw/uXC@vger.kernel.org, AJvYcCVZGAXJSnGkBX4GIXxXNW68fO0zXPeT05GmzShHEKknaAOHEmYjNPOLSzxln5VispKBKOMF846a@vger.kernel.org, AJvYcCXbc9O/Nmhr+IED7hkfTzvLnnYjXfQ7tPVhbUZ2U2WUPz+8g9zFICiLNoSvot5J8CrBhrkehaal+3QE@vger.kernel.org X-Gm-Message-State: AOJu0YxO1xS+96G8lQQp7ZcVlNeL4KcVeEm2Nv0IkJPDR8gn9mnOauOJ RRxJS8N080w4lYT96Vtv14EINKUrjeVC3j6oqRRwRAPb2hzazEkmf2NS X-Gm-Gg: ASbGnctTgHtj6fW9kr3R3uo5bFxYqT+BoK/RNiJN4kfY3VkviKAAcYg4FawnkdOJJ2b 3pGvqndU5IQGkC/bfzorm5kwI+tJYJZxNMm+/ceJT6yCnhSqUmGyz7XiVfDcvdQDb9cs99s5/8O 1aDoHqCyPBBdaCf0+gpt19L7ckn1LTcwEr905Ew3iDDGL5kU6eUhA7UNWyieRuyexMAOa2ijm0J iySJl5CrV3918hwllpCMXniIfOwqwwi/HBGh1xsChuMO6EBy+rfcFjhn207WKYVTDDLx3RY5loT dNmGQXWi6eSjhaDlBRxw9m65pDv+R2bd4Uf0OfNH2zhiByWXNmHUCXlgAG0IpgQ0NySlSPABgKC 4ZmyeSa6zocAJSxDb6j3yroDBbbYz4VarUV2ri3B4J9KSxfR2HyrhWCP97w== X-Google-Smtp-Source: AGHT+IExZLYquo9V8QgbEOqAX4vqRnoYJm/bUWT4F0/I6KdGxqxxH03/rGPk5qQvI7Qp5Vm/8OjeJg== X-Received: by 2002:a05:600c:3115:b0:45b:81b4:1917 with SMTP id 5b1f17b1804b1-45b8555c359mr165608615e9.10.1756986136933; Thu, 04 Sep 2025 04:42:16 -0700 (PDT) Received: from iku.Home ([2a06:5906:61b:2d00:904e:70c8:edf3:59a4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45dd0aec70dsm14658475e9.0.2025.09.04.04.42.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Sep 2025 04:42:15 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiner Kallweit , Russell King , Philipp Zabel , Geert Uytterhoeven , Magnus Damm , Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH net-next v2 5/9] net: pcs: rzn1-miic: move port range handling into SoC data Date: Thu, 4 Sep 2025 12:41:59 +0100 Message-ID: <20250904114204.4148520-6-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250904114204.4148520-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20250904114204.4148520-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Lad Prabhakar Define per-SoC miic_port_start and miic_port_max fields in struct miic_of_data and use them to validate the device-tree "reg" port number and to compute the driver's internal zero-based port index as (port - miic_port_start). Replace uses of the hard-coded MIIC_MAX_NR_PORTS with the SoC-provided miic_port_max when iterating over ports. On RZ/N1 the MIIC ports are numbered 1..5, whereas RZ/T2H numbers its MIIC ports 0..3. By making the port base and range part of the OF data the driver no longer assumes a fixed numbering scheme and can support SoCs that enumerate ports from either zero or one and that expose different numbers of ports. This change is preparatory work for adding RZ/T2H support. Signed-off-by: Lad Prabhakar Reviewed-by: Andrew Lunn Tested-by: Wolfram Sang --- v1->v2: - No change. --- drivers/net/pcs/pcs-rzn1-miic.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/net/pcs/pcs-rzn1-miic.c b/drivers/net/pcs/pcs-rzn1-mii= c.c index 724bac86cf8c..c119ec66fe95 100644 --- a/drivers/net/pcs/pcs-rzn1-miic.c +++ b/drivers/net/pcs/pcs-rzn1-miic.c @@ -49,8 +49,6 @@ #define MIIC_SWCTRL 0x304 #define MIIC_SWDUPC 0x308 =20 -#define MIIC_MAX_NR_PORTS 5 - #define MIIC_MODCTRL_CONF_CONV_MAX 6 #define MIIC_MODCTRL_CONF_NONE -1 =20 @@ -146,6 +144,8 @@ struct miic { * @conf_to_string_count: Number of entries in the conf_to_string array * @index_to_string: String representations of the index values * @index_to_string_count: Number of entries in the index_to_string array + * @miic_port_start: MIIC port start number + * @miic_port_max: Maximum MIIC supported */ struct miic_of_data { struct modctrl_match *match_table; @@ -155,6 +155,8 @@ struct miic_of_data { u8 conf_to_string_count; const char * const *index_to_string; u8 index_to_string_count; + u8 miic_port_start; + u8 miic_port_max; }; =20 /** @@ -330,6 +332,7 @@ static const struct phylink_pcs_ops miic_phylink_ops = =3D { =20 struct phylink_pcs *miic_create(struct device *dev, struct device_node *np) { + const struct miic_of_data *of_data; struct platform_device *pdev; struct miic_port *miic_port; struct device_node *pcs_np; @@ -342,9 +345,6 @@ struct phylink_pcs *miic_create(struct device *dev, str= uct device_node *np) if (of_property_read_u32(np, "reg", &port)) return ERR_PTR(-EINVAL); =20 - if (port > MIIC_MAX_NR_PORTS || port < 1) - return ERR_PTR(-EINVAL); - /* The PCS pdev is attached to the parent node */ pcs_np =3D of_get_parent(np); if (!pcs_np) @@ -363,18 +363,24 @@ struct phylink_pcs *miic_create(struct device *dev, s= truct device_node *np) return ERR_PTR(-EPROBE_DEFER); } =20 + miic =3D platform_get_drvdata(pdev); + of_data =3D miic->of_data; + if (port > of_data->miic_port_max || port < of_data->miic_port_start) { + put_device(&pdev->dev); + return ERR_PTR(-EINVAL); + } + miic_port =3D kzalloc(sizeof(*miic_port), GFP_KERNEL); if (!miic_port) { put_device(&pdev->dev); return ERR_PTR(-ENOMEM); } =20 - miic =3D platform_get_drvdata(pdev); device_link_add(dev, miic->dev, DL_FLAG_AUTOREMOVE_CONSUMER); put_device(&pdev->dev); =20 miic_port->miic =3D miic; - miic_port->port =3D port - 1; + miic_port->port =3D port - of_data->miic_port_start; miic_port->pcs.ops =3D &miic_phylink_ops; =20 phy_interface_set_rgmii(miic_port->pcs.supported_interfaces); @@ -410,7 +416,7 @@ static int miic_init_hw(struct miic *miic, u32 cfg_mode) miic_reg_writel(miic, MIIC_MODCTRL, FIELD_PREP(MIIC_MODCTRL_SW_MODE, cfg_mode)); =20 - for (port =3D 0; port < MIIC_MAX_NR_PORTS; port++) { + for (port =3D 0; port < miic->of_data->miic_port_max; port++) { miic_converter_enable(miic, port, 0); /* Disable speed/duplex control from these registers, datasheet * says switch registers should be used to setup switch port @@ -497,6 +503,8 @@ static int miic_parse_dt(struct miic *miic, u32 *mode_c= fg) if (of_property_read_u32(conv, "reg", &port)) continue; =20 + /* Adjust for 0 based index */ + port +=3D !miic->of_data->miic_port_start; if (of_property_read_u32(conv, "renesas,miic-input", &conf) =3D=3D 0) dt_val[port] =3D conf; } @@ -570,6 +578,8 @@ static struct miic_of_data rzn1_miic_of_data =3D { .conf_to_string_count =3D ARRAY_SIZE(conf_to_string), .index_to_string =3D index_to_string, .index_to_string_count =3D ARRAY_SIZE(index_to_string), + .miic_port_start =3D 1, + .miic_port_max =3D 5, }; =20 static const struct of_device_id miic_of_mtable[] =3D { --=20 2.51.0 From nobody Fri Oct 3 06:35:31 2025 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (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 935EE242D6B; Thu, 4 Sep 2025 11:42:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756986142; cv=none; b=Jr2K0kWw5JOOWeoflbFsagy4DptRxtvcS+jlTNz4CyPBFYHUYVMqNSLIR1dlGs0OOni9MxYl8f6krdkU/d3dKYl/mC/snS+Vv4ua2nQfDqk4n6qecaVneL6cTBnygD8sNvE1S9s4E0tstOdcY7QNCbHi1lNajGOeIwMRQTkpvtc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756986142; c=relaxed/simple; bh=aq0+ztHTlBLLd49MSNXqUVQfJPnrZ4nWwuUmzsAWEvg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SvmBItK7jsn2xyJAGXfWECjK8eFg4GDHQvheBzs/BQSWyLi3eQSoUKPepurEPvlISjebFTfEfWYoOBhVh7Z4BmYNA5pfowWNqSINMXsUBEaPCjfTz/21o3Pr5+qgRydx2hpPZURHIOOg2Sb4DaTRpfG7Z+LsbyOwsKU/YJT3zGw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Rgh/Q/bZ; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Rgh/Q/bZ" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-45b4d89217aso7024695e9.2; Thu, 04 Sep 2025 04:42:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756986139; x=1757590939; 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=ztvT559LRcamadz1R2KUwiDzV+z6hKtayjXRAQFMkM4=; b=Rgh/Q/bZ6sAAfL3zS0SOhT4xp+bITKgyL83aZfVcSGsEC75pi9ee5GI+o31dnSNv4h fa2iO9n1Od+C1M5Z/0JrgDUNZJLQa3ok0mDRQcDtwfJZf0fVtiw9U5obAEBvaUJ/OXDu 9I9DCkekgcMTIvNyird470XQjjHfB4OGWMWZmimWR1HntWJVfladedjX6Z7sDzZuNac2 xR3cKpsaqmiSG6o9527+CFsynQeTCe0B5SfC8YDXag/HL2MFu4ncsSQ6SM4zyTv/pZXo gqecdnWaqPj+7s1Jbz51nhblrJtHibClGCjL1QgrvNQfzeM22YavgulZdbEIMkSJ+nqn iHng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756986139; x=1757590939; 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=ztvT559LRcamadz1R2KUwiDzV+z6hKtayjXRAQFMkM4=; b=mC2VDU+x0gaI2OLk7zVBVLuAzBQBEI2OJfv295VSv0LF9KX1x3vQjh2y7I4CMcU/JT iHNQqG4+cNa3DV6dzFd/cDDE9aw+tRev1ZlxGxRcx3OMLesuhqbF1wo/X3SK9FycHwso jywrL3JcYUD8MDpQ0cosEOJbQO3OSBaCKLu6GlE5Nk1er3V9CHggYV2NqBjVIOntNNnR yUve6Vr4Zdu0rawpC0KO88WiFn8du1dEb3pOKLlNX/WAA92RlGbxIDMG9za0u2KK/O7h CI4/0gGxj4+cgxkPT1HbwCawlISDs0KEds7LMn7ZO8pwwQ0CMQur/CB5IqM1aQWOAIOU 2Rdw== X-Forwarded-Encrypted: i=1; AJvYcCUzOZzep5aCxTlkFyenYv90VQCzMEIaL/ThFXv3ntq2edciNWJBeO8Nwz9X3NBWOxvJspSt1ZcvzPIo@vger.kernel.org, AJvYcCVHwo1avNd9Q+sYf2hs+83aA4bdkgUvAd1eTxC7aDcy1xnJhNCDYtvZgjlANBn2S0wW8HPqkicgoRJX9/Kn@vger.kernel.org, AJvYcCVnTZ5tMeSEa9iLEbqooss+ApG8+UAtM4YTWw2BQh491PhMWnBvZdXwdqCLvZaf3eZ1EFca0cpN@vger.kernel.org X-Gm-Message-State: AOJu0YwC80lkdd2ZmF25MJNZfPu2ImJUON3RYeGGZ0WhAg7vQvvdL7sn 4U6THUTW5S9vrkfyLll72fgHMID/aBGUQUmyLlC6oYyBJCQ7JK/xPjzYa3exkbxs X-Gm-Gg: ASbGncvtDvt5CV4ySdLHRsnksdkDozQHDL1eLOkcABK09ZC464doJ6uJgq/4A4gEkjX CEGe2eilG7UNdpWMJqo78v2Xg2u4KnDvPVqeb3rQbpl+OhTcukxDtMNhBzieArN4xhzab+ungwe sGWkHwyqNa2pqc/tLrl145pUcMOirb+liQVGh0j8ULy0IXbdPGBH5Nv/NyBf2HLv0HNtRl4y/1i w7XYVRrlhfu32utjQX7QJNQObxAv5j+Tur2HeFYgBAQLxkeXiA9N4+b4rT6vV8JgeiLFydEsn5Q DYl2zQ46rr9+R8aRtK2Uc+A7MupnC78QANgzyLgEQ9qViafjfxAsyf6BwIT720Eld/2X1uNOHvq 9Wjv0ks6ylGO7Ns0YuYsBcdZMOi4QwjW/Xa17aT3zGFLR6ig= X-Google-Smtp-Source: AGHT+IFqIW5Qxmz4+L9VjmjZnkvdqrW1zZMD+CQYAIHN+SrgBcPW0mh2tlXGhC/mCNUpBB/LVLQo4g== X-Received: by 2002:a05:600c:3b0a:b0:45c:b5bb:7b49 with SMTP id 5b1f17b1804b1-45cb5bb7d79mr59578945e9.17.1756986138801; Thu, 04 Sep 2025 04:42:18 -0700 (PDT) Received: from iku.Home ([2a06:5906:61b:2d00:904e:70c8:edf3:59a4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45dd0aec70dsm14658475e9.0.2025.09.04.04.42.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Sep 2025 04:42:17 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiner Kallweit , Russell King , Philipp Zabel , Geert Uytterhoeven , Magnus Damm , Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH net-next v2 6/9] net: pcs: rzn1-miic: Make switch mode mask SoC-specific Date: Thu, 4 Sep 2025 12:42:00 +0100 Message-ID: <20250904114204.4148520-7-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250904114204.4148520-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20250904114204.4148520-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Lad Prabhakar Move the hardcoded switch mode mask definition into the SoC-specific miic_of_data structure. This allows each SoC to define its own mask value rather than relying on a single fixed constant. For RZ/N1 the mask remains GENMASK(4, 0). This is in preparation for adding support for RZ/T2H, where the switch mode mask is GENMASK(2, 0). Signed-off-by: Lad Prabhakar Tested-by: Wolfram Sang --- v1->v2: - No change. --- drivers/net/pcs/pcs-rzn1-miic.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/pcs/pcs-rzn1-miic.c b/drivers/net/pcs/pcs-rzn1-mii= c.c index c119ec66fe95..c0aa93fd7274 100644 --- a/drivers/net/pcs/pcs-rzn1-miic.c +++ b/drivers/net/pcs/pcs-rzn1-miic.c @@ -7,6 +7,7 @@ =20 #include #include +#include #include #include #include @@ -23,7 +24,6 @@ #define MIIC_ESID_CODE 0x4 =20 #define MIIC_MODCTRL 0x8 -#define MIIC_MODCTRL_SW_MODE GENMASK(4, 0) =20 #define MIIC_CONVCTRL(port) (0x100 + (port) * 4) =20 @@ -146,6 +146,7 @@ struct miic { * @index_to_string_count: Number of entries in the index_to_string array * @miic_port_start: MIIC port start number * @miic_port_max: Maximum MIIC supported + * @sw_mode_mask: Switch mode mask */ struct miic_of_data { struct modctrl_match *match_table; @@ -157,6 +158,7 @@ struct miic_of_data { u8 index_to_string_count; u8 miic_port_start; u8 miic_port_max; + u8 sw_mode_mask; }; =20 /** @@ -402,6 +404,7 @@ EXPORT_SYMBOL(miic_destroy); =20 static int miic_init_hw(struct miic *miic, u32 cfg_mode) { + u8 sw_mode_mask =3D miic->of_data->sw_mode_mask; int port; =20 /* Unlock write access to accessory registers (cf datasheet). If this @@ -414,7 +417,7 @@ static int miic_init_hw(struct miic *miic, u32 cfg_mode) miic_reg_writel(miic, MIIC_PRCMD, 0x0001); =20 miic_reg_writel(miic, MIIC_MODCTRL, - FIELD_PREP(MIIC_MODCTRL_SW_MODE, cfg_mode)); + ((cfg_mode << __ffs(sw_mode_mask)) & sw_mode_mask)); =20 for (port =3D 0; port < miic->of_data->miic_port_max; port++) { miic_converter_enable(miic, port, 0); @@ -580,6 +583,7 @@ static struct miic_of_data rzn1_miic_of_data =3D { .index_to_string_count =3D ARRAY_SIZE(index_to_string), .miic_port_start =3D 1, .miic_port_max =3D 5, + .sw_mode_mask =3D GENMASK(4, 0), }; =20 static const struct of_device_id miic_of_mtable[] =3D { --=20 2.51.0 From nobody Fri Oct 3 06:35:31 2025 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.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 D89423019CD; Thu, 4 Sep 2025 11:42:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756986144; cv=none; b=iLxGWoQzgnHgCaHX2kYbS5IEZwTXkZeO+eR+3vGnd/ifxcXujEFnzT7RSXA4FV5p0bRGX85Q+JK1qpC0if47IFXWbiFIlaAyS2Vbr+frg2nH58AGNul6JL22K0PopFVp/Swo8ahzC2lG4w6kzdIMpVPVvZWT/1YkiKaP+znaAPU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756986144; c=relaxed/simple; bh=y6DApRFj47DjUh7Xkyy2CalS5c0f9uL2mRhHLPlL8PA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JlcCMXvBOXz02DVVGYAH6fSjjzcq4QxysnSk68qNlElsbxQ63nfVSAzZqgFf+rwqYeyxkfEr+sVBfvEghIE+DQvYUb9DSmxgmrqZkmcbHmNsAxH4ay/kZ0A78oZ7gsLscQeJv6aw7SQKD1vsjAVVk33IV96hd/5Ivz/yAvB36j8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gabkHIIT; arc=none smtp.client-ip=209.85.128.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gabkHIIT" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-45b79ec2fbeso6527495e9.3; Thu, 04 Sep 2025 04:42:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756986141; x=1757590941; 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=A4CH3/iWgc9FpGVwdcciZa3ZioBnVSrSHTqchBQK2fI=; b=gabkHIITcdmLMRxLSWPq8F72QczUlCp5tlOb0dDmN/RuUIYzTnTZn7ylgZZ7LCakmv l7YKS/unRpTzkr+8iE5qEzxO367M6womipIYi5GYkJStwjggvv56LEfnSWL5iemYMjCQ cy8hCKQaSCbkxgzwig4v1Qnf/RQvTTooV9jawQ/lyqlDmsQFpZEi4lvB6KW77vL4rtJn /CMxoyVkeKlcpkxsdvyFJlB0yLYx6tUfKvnoyvvL/euFU+I2StyPi36II3mnGi8cl4so gfiF0RYJ4OMgAr5V0vsoE30rC6PGpT9P0niMk7HcTo07qW0A+qg/4kYroJe1US9BZZZo G0jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756986141; x=1757590941; 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=A4CH3/iWgc9FpGVwdcciZa3ZioBnVSrSHTqchBQK2fI=; b=f2H1YKuVm37p18T2KW9mDK7ffsbPXtejzybv4pODHa5TTU148X9KBjp4GtuoeXgw3h Ar/F4IDU0tlkj8AurDWy597l2+zTkPwWfiDQNW2teG9NPAkCXxv51vDOexP2DxT0EdcF VtXTvtjAxfHnQk7m0Yb90BU7VzyHlUooIAskm6XED0dTv/C3rpp02LlvLZYFpeauyy+c 3mbZuyw7e1/1EwXyM1EZIohVgsmsyXyP5RfyUMunTCSJRXp69fnuqheJb1P94ChmQf1C JxiwT3U6mwwId9JtIJaYnHEcJPndMxuXLBZYuGan417Y317QiKP1iUBeO5q6bk1U+9yX Ub8A== X-Forwarded-Encrypted: i=1; AJvYcCUfzHhhadosbeQToo/m9wVtSFydYqm9wMuN02HDJO8oyD01nBYUTMsRfXoH1nV6y3rYJFgc0mhZ@vger.kernel.org, AJvYcCV8g/ccmIak9kYmhvIa5GV0MsMm3ijG8U80woVmL8QAjtqnlddlD6I0pkO/Z1sNUZSR26Xltc10Bfuv1dc/@vger.kernel.org, AJvYcCW1DyTUcHH2Hr9VCWUg2KzKIOongqQgMJtbIgeOVsKXSqtB+71cJcUwOWU0TRc7MctxoeOCBDmRwgfS@vger.kernel.org X-Gm-Message-State: AOJu0YyjMf1/BSDGEg3T4KP8MsZ4cPkk+z74KftWUW/oQII1L3ybTb1v 3N17F8L1kOCH5G9Gf7lMD0769uahHaoTTg0jtrGDoDE+Lfxk0fU3+r0R X-Gm-Gg: ASbGncvJRxcZ9jXNLwtPAXbw4Sq9QOIvqn4Vo3lM4tVll9DT9pyDunsrlleXnDurjZx TLP0vU3q0W0MRgF6MXI+sb/lnGHgm0bOvwWdNoIwBVBGOBjiM7Yfu/p5SseRvnt88bgd3KblDoa sm5h8nd30iTTsyt02PS0OU74ITZnNfeTuyRZlIu7ANoXpNrS18zw/Hek/63mTUEkV7BtjaDokVj 0q8uIgqgvU+2b6Wh/IznaeSkOwDJtRWKF4VvzJipbWr+X7Ikdnyw4jGRhAvhGIdHkE/S4OeLhcy /NbPr2sSHwjQf+TbAMzePkLuM9jd7dEdpW7/u/KIvd119ceEg6L6pCZZhCnIxsXkln2efWiEtFk DfXW1GCj1skwCjUVFPEzpfLMEQV30i0WakSPSrDmNcOHgguU= X-Google-Smtp-Source: AGHT+IGkTD9UmS6np1gg0rMm++OskYYU24xj5k750rxiRVQOMjPVxFqK65v2EzPiU7mHufKOXlH8yA== X-Received: by 2002:a05:600c:4e8e:b0:45c:b601:660a with SMTP id 5b1f17b1804b1-45cb6016789mr44973285e9.23.1756986140983; Thu, 04 Sep 2025 04:42:20 -0700 (PDT) Received: from iku.Home ([2a06:5906:61b:2d00:904e:70c8:edf3:59a4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45dd0aec70dsm14658475e9.0.2025.09.04.04.42.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Sep 2025 04:42:19 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiner Kallweit , Russell King , Philipp Zabel , Geert Uytterhoeven , Magnus Damm , Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH net-next v2 7/9] net: pcs: rzn1-miic: Add support to handle resets Date: Thu, 4 Sep 2025 12:42:01 +0100 Message-ID: <20250904114204.4148520-8-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250904114204.4148520-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20250904114204.4148520-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Lad Prabhakar Add reset-line handling to the RZN1 MIIC driver and move reset configuration into the SoC/OF data. Introduce MIIC_MAX_NUM_RSTS (=3D 2), add storage for reset_control_bulk_data in struct miic and add reset_ids and reset_count fields to miic_of_data. When reset_ids are present in the OF data, the driver obtains the reset lines with devm_reset_control_bulk_get_exclusive(), deasserts them during probe and registers a devres action to assert them on remove or on error. This change is preparatory work to support the RZ/T2H SoC, which exposes two reset lines for the ETHSS IP. The driver remains backward compatible for platforms that do not provide reset lines. Signed-off-by: Lad Prabhakar Reviewed-by: Andrew Lunn Tested-by: Wolfram Sang --- v1->v2: - No change. --- drivers/net/pcs/pcs-rzn1-miic.c | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/drivers/net/pcs/pcs-rzn1-miic.c b/drivers/net/pcs/pcs-rzn1-mii= c.c index c0aa93fd7274..d97554e203f0 100644 --- a/drivers/net/pcs/pcs-rzn1-miic.c +++ b/drivers/net/pcs/pcs-rzn1-miic.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -17,6 +18,7 @@ #include #include #include +#include #include #include =20 @@ -52,6 +54,8 @@ #define MIIC_MODCTRL_CONF_CONV_MAX 6 #define MIIC_MODCTRL_CONF_NONE -1 =20 +#define MIIC_MAX_NUM_RSTS 2 + /** * struct modctrl_match - Matching table entry for convctrl configuration * See section 8.2.1 of manual. @@ -126,12 +130,14 @@ static const char * const index_to_string[] =3D { * @base: base address of the MII converter * @dev: Device associated to the MII converter * @lock: Lock used for read-modify-write access + * @rsts: Reset controls for the MII converter * @of_data: Pointer to OF data */ struct miic { void __iomem *base; struct device *dev; spinlock_t lock; + struct reset_control_bulk_data rsts[MIIC_MAX_NUM_RSTS]; const struct miic_of_data *of_data; }; =20 @@ -147,6 +153,8 @@ struct miic { * @miic_port_start: MIIC port start number * @miic_port_max: Maximum MIIC supported * @sw_mode_mask: Switch mode mask + * @reset_ids: Reset names array + * @reset_count: Number of entries in the reset_ids array */ struct miic_of_data { struct modctrl_match *match_table; @@ -159,6 +167,8 @@ struct miic_of_data { u8 miic_port_start; u8 miic_port_max; u8 sw_mode_mask; + const char * const *reset_ids; + u8 reset_count; }; =20 /** @@ -518,6 +528,16 @@ static int miic_parse_dt(struct miic *miic, u32 *mode_= cfg) return ret; } =20 +static void miic_reset_control_bulk_assert(void *data) +{ + struct miic *miic =3D data; + int ret; + + ret =3D reset_control_bulk_assert(miic->of_data->reset_count, miic->rsts); + if (ret) + dev_err(miic->dev, "failed to assert reset lines\n"); +} + static int miic_probe(struct platform_device *pdev) { struct device *dev =3D &pdev->dev; @@ -541,6 +561,27 @@ static int miic_probe(struct platform_device *pdev) if (IS_ERR(miic->base)) return PTR_ERR(miic->base); =20 + if (miic->of_data->reset_count) { + u8 i; + + for (i =3D 0; i < miic->of_data->reset_count; i++) + miic->rsts[i].id =3D miic->of_data->reset_ids[i]; + + ret =3D devm_reset_control_bulk_get_exclusive(miic->dev, + miic->of_data->reset_count, + miic->rsts); + if (ret) + return dev_err_probe(miic->dev, ret, "failed to get bulk reset lines\n"= ); + + ret =3D reset_control_bulk_deassert(miic->of_data->reset_count, miic->rs= ts); + if (ret) + return dev_err_probe(miic->dev, ret, "failed to deassert reset lines\n"= ); + + ret =3D devm_add_action_or_reset(dev, miic_reset_control_bulk_assert, mi= ic); + if (ret) + return dev_err_probe(miic->dev, ret, "failed to add reset action\n"); + } + ret =3D devm_pm_runtime_enable(dev); if (ret < 0) return ret; --=20 2.51.0 From nobody Fri Oct 3 06:35:31 2025 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (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 4353C302CA5; Thu, 4 Sep 2025 11:42:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756986146; cv=none; b=P63XQ7yR14uJeXjPSQH7xjG5JRhVrkVsEI+2Uupmzq5AiTphQ6kyrUWrYlNNfhqnbXORWKFkG9R2zQCbX/67wMPR5yGEBxbw/lzvdWdtyyWmyyqIEaDvfQ+SLsctd4/IH9L+Lr9i22/j9TjmIhR4GyuVdjn+IOVuNsLRY4GcBmQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756986146; c=relaxed/simple; bh=eFODHS41jGkqjrhxq56OXpjb15eDwVOmG/RZDKiylZo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FTjFyhYZJuoeIIdSJDpHh7wvTxDeWDj8ubxTcPYRerT+fbyCFCcmb7wKyZu+gx+nvnEAkQRaEDyv2iYbIMEBh0cXoVz+ljSb818/TmE9fgmWIMs3GXkn8y9HUMILG1xNmulbev1ietFLGMb9aGxqVkGvgIJetq6PQA6LDD7JRDk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=eICCTkSX; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eICCTkSX" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-45b87bc67a4so6812055e9.3; Thu, 04 Sep 2025 04:42:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756986142; x=1757590942; 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=br/GeUSBxQ4fkBRlP6Rmc7sRyHBnT6q4apu3DwR+X1M=; b=eICCTkSXkvoSgi8xr8q2DAAtqtpTi4rl5Q45Vba+SLdVhEYq/cd2tl4M23YeaPzPAi 7T0i/3+WcdONKIc3jx+3E7jeKkLlUmJ2XMEoLg0Pm8Ukf6ExHIts9Y/bL2lGOgHI6Xko I2fLKZDjMce6exsoLexUVC6rUjRRa17sIotkauOhLTdF+Q+yJ7FacmIV9Gvf0CZ2CQ44 iIJnybMGZIFsKO5+H4ZZ8DBI+0+BvOrgZWiyCvzarXUQDlyZtyo/8jDCZxgWtxIubxpL 1CEDm5P4hJgLWNEAMm4nuurBB9RQ7p7aTGc8BoOI6fLHrucFE9jFuHeCFfQtHmEsr/Lu xUdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756986142; x=1757590942; 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=br/GeUSBxQ4fkBRlP6Rmc7sRyHBnT6q4apu3DwR+X1M=; b=TffMIlOlRYH3i4Zk4XY82YtxqOgCYtzWA2L/rTRbP6xhgkqXbU5Y/KwxNfxjoNEdbN 50BGWKMLZmvMHay3IQa5/CWRO2eNz2+Zu6hS53DDzau2CK6/cy9UwFAKsWIvPJLsWGc7 5ODGwc1GWTaV1NzooiCS+FvC8rTDj1xruXGBEutEOdfh/vVNZIcAk+iIAgPPrXlVG/JS pvvCqcJdq7ZyyWqbYosuY1YvtKPucY9MMwldbJV+3jv3xNNu/stNilavhqhpc05gXcCF ENSVdYEjTDMVOACqPBpQuTsdmGPDXlJALmxepXSwCfCSgTW1jH52esjHjPP4X0pWoe47 SPmg== X-Forwarded-Encrypted: i=1; AJvYcCV51T8dFBsuMieTpbkKZur+neDlfZJyLfjSka5zwgJjAGh9ffO75784sitPjK51lJKnS7gnm39BzF2u@vger.kernel.org, AJvYcCVeC+w2i8wgV5IAGqVIXrdkA8g4y4T5euWM+zvwu7kjXGfxAYFUADvE6I1QWrMW7RbryxAv6P5OhnZBWxnc@vger.kernel.org, AJvYcCWRdG0NNmc/6flyJMoiBXpZp3TMrBKvTgUdWyIxD2A6BTi42GGtQPfadW9S28yD6oNBgr2+CzTo@vger.kernel.org X-Gm-Message-State: AOJu0YzLvNNn85BZM0AllIZKYjQ6d8eesI9qSXUw3qtm+7fUBv72OYvH nL8kckcw25uvW5Yc7xDmt9bPo1AcmOdW/BSLkL0OKlu0NgxLrrmmQh2d X-Gm-Gg: ASbGncsI6T8p//Aa99kgt2ejLsr7t9gHmZjMR/zk21YxBPSaNTsBqbvPE9Vxm+6NvBN FaLek/7Qq16dXVTJoUIGoz5RMeUNKxl4FH3531r2PqKvfZa30DA6lT4ZJy4Oo3RtzWUZOGskFTg oBQDdgpm1iEcI3gK5dIg/l6tJaTGQq6DYk1mjptnoM57xnHzIN2Tpp7eP+w4VtOvnukEWaaHmW4 l38jMooRfjl8fq4g+YqEhaQdbN8F/bEiVSh/y4sA5krc66PX6XLdqMUfzOA/jTvpH9mGqu7LNbU dboOvs52BMJYXWV0cklrNVPPQKmTwUlxBjBQWEPZOFHM7c5uMmSJ5NiapvnRapkw6vLoEUulwEm S0GUJL0si8VJ/e3cVhZqDX+UdtzpdE4TAyEFikiB+0ZPNkHe0sSHQW2eqIw== X-Google-Smtp-Source: AGHT+IH1Rhds8wPr7vv+vRh/ADNHbNFcCaz6Q3slnA0Pgm5E/DJb5tc8jwVNErxClGjf1vFCWql8mg== X-Received: by 2002:a05:600c:1ca8:b0:45d:d2d2:f095 with SMTP id 5b1f17b1804b1-45dd2d2f316mr9984675e9.19.1756986142386; Thu, 04 Sep 2025 04:42:22 -0700 (PDT) Received: from iku.Home ([2a06:5906:61b:2d00:904e:70c8:edf3:59a4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45dd0aec70dsm14658475e9.0.2025.09.04.04.42.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Sep 2025 04:42:21 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiner Kallweit , Russell King , Philipp Zabel , Geert Uytterhoeven , Magnus Damm , Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH net-next v2 8/9] net: pcs: rzn1-miic: Add per-SoC control for MIIC register unlock/lock Date: Thu, 4 Sep 2025 12:42:02 +0100 Message-ID: <20250904114204.4148520-9-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250904114204.4148520-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20250904114204.4148520-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Lad Prabhakar Make MIIC accessory register unlock/lock behaviour selectable via SoC/OF data. Add init_unlock_lock_regs and miic_write to struct miic_of_data so the driver can either perform the traditional global unlock sequence (as used on RZ/N1) or use a different policy for other SoCs (for example RZ/T2H, which does not require leaving registers unlocked). miic_reg_writel() now calls the per-SoC miic_write callback to perform register writes. Provide miic_reg_writel_unlocked() as the default writer and set it for the RZ/N1 OF data so existing platforms keep the same behaviour. Add a miic_unlock_regs() helper that implements the accessory register unlock sequence so the unlock/lock sequence can be reused where needed (for example when a SoC requires explicit unlock/lock around individual accesses). This change is preparatory work for supporting RZ/T2H. Signed-off-by: Lad Prabhakar Tested-by: Wolfram Sang --- v1->v2: - No change. --- drivers/net/pcs/pcs-rzn1-miic.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/drivers/net/pcs/pcs-rzn1-miic.c b/drivers/net/pcs/pcs-rzn1-mii= c.c index d97554e203f0..86d4dccd694e 100644 --- a/drivers/net/pcs/pcs-rzn1-miic.c +++ b/drivers/net/pcs/pcs-rzn1-miic.c @@ -155,6 +155,8 @@ struct miic { * @sw_mode_mask: Switch mode mask * @reset_ids: Reset names array * @reset_count: Number of entries in the reset_ids array + * @init_unlock_lock_regs: Flag to indicate if registers need to be unlock= ed before access + * @miic_write: Function pointer to write a value to a MIIC register */ struct miic_of_data { struct modctrl_match *match_table; @@ -169,6 +171,8 @@ struct miic_of_data { u8 sw_mode_mask; const char * const *reset_ids; u8 reset_count; + bool init_unlock_lock_regs; + void (*miic_write)(struct miic *miic, int offset, u32 value); }; =20 /** @@ -190,11 +194,25 @@ static struct miic_port *phylink_pcs_to_miic_port(str= uct phylink_pcs *pcs) return container_of(pcs, struct miic_port, pcs); } =20 -static void miic_reg_writel(struct miic *miic, int offset, u32 value) +static inline void miic_unlock_regs(struct miic *miic) +{ + /* Unprotect register writes */ + writel(0x00A5, miic->base + MIIC_PRCMD); + writel(0x0001, miic->base + MIIC_PRCMD); + writel(0xFFFE, miic->base + MIIC_PRCMD); + writel(0x0001, miic->base + MIIC_PRCMD); +} + +static void miic_reg_writel_unlocked(struct miic *miic, int offset, u32 va= lue) { writel(value, miic->base + offset); } =20 +static void miic_reg_writel(struct miic *miic, int offset, u32 value) +{ + miic->of_data->miic_write(miic, offset, value); +} + static u32 miic_reg_readl(struct miic *miic, int offset) { return readl(miic->base + offset); @@ -421,10 +439,8 @@ static int miic_init_hw(struct miic *miic, u32 cfg_mod= e) * is going to be used in conjunction with the Cortex-M3, this sequence * will have to be moved in register write */ - miic_reg_writel(miic, MIIC_PRCMD, 0x00A5); - miic_reg_writel(miic, MIIC_PRCMD, 0x0001); - miic_reg_writel(miic, MIIC_PRCMD, 0xFFFE); - miic_reg_writel(miic, MIIC_PRCMD, 0x0001); + if (miic->of_data->init_unlock_lock_regs) + miic_unlock_regs(miic); =20 miic_reg_writel(miic, MIIC_MODCTRL, ((cfg_mode << __ffs(sw_mode_mask)) & sw_mode_mask)); @@ -625,6 +641,8 @@ static struct miic_of_data rzn1_miic_of_data =3D { .miic_port_start =3D 1, .miic_port_max =3D 5, .sw_mode_mask =3D GENMASK(4, 0), + .init_unlock_lock_regs =3D true, + .miic_write =3D miic_reg_writel_unlocked, }; =20 static const struct of_device_id miic_of_mtable[] =3D { --=20 2.51.0 From nobody Fri Oct 3 06:35:31 2025 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (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 B5334303CB4; Thu, 4 Sep 2025 11:42:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756986147; cv=none; b=sDInKg8n/e3A27YqZkEQpMprb3OJIbtguozpJGlA3sWxcIcY0CzO9ohvRk128nPbKSf2VC5lBTR8Fo/PgC9m1p34gd6wSDCCBSY2eTmGFzVKfO5s3NuyYfYAHfdVWkhiAVI3JHcRzKjAkAGnh5pKtByKf5SniO8k5ez3fTIUYqU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756986147; c=relaxed/simple; bh=ZhCxxRYlLpjU3mfnFvdogAg17FTMIg+ObYHYliDT8Eo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=E1bCTqvRF+XwPHe/rCcKXGRNLRqVQshQbQGGCVWnp/+HWWxD9YZ/uIEbHywl4uk2hxZEmHL8lF+l6ZJ9t2TY+5zsl2vk/bb+BJ2cPVYECYuLZMIg1rqd6EEP7eQOpjIqz+k3mavVXzIWSohRLqGAlAYmA68SH8NHqwQhypnBjXs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MS+60N/U; arc=none smtp.client-ip=209.85.221.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MS+60N/U" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-3df726ecff3so390025f8f.3; Thu, 04 Sep 2025 04:42:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756986144; x=1757590944; 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=hkSLStQfOHLAL4atpN/+86grIcI5ZXdinr9UKNViLgk=; b=MS+60N/UvN5VtdSbtbp48SZy1xtrpAH6/ScJC++fLaSJeDWylbS+4QgpIANbvygTqy +qHbp5yKd3d5y0xsIY3fE3Xhj3NNJl7rnyTUFtfDV82VhOoWZ3hqMXTeGyjX2968A0TF zsaWVtbqJgtqGpjUmJQz/EBA7NflmhmatxoUjBjyvOC26R8kRwGt6rrahqWC5EeRwOyE NgYplD0PUoe2s2jq04+G6mjOEYW9YVkNk5NFt0Um3uGU14NaTG6qlqwYcoaKu5oXISiY AyUGqZp0wGgUKdapQq2K2qLk8qv4UI8o0I1VHFR/tWMPepnabqn+9SXH/l1nzqIPkN3O eYYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756986144; x=1757590944; 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=hkSLStQfOHLAL4atpN/+86grIcI5ZXdinr9UKNViLgk=; b=P8uRD4P+uQXhcG71n/w5IlmXgpHWrSae15tcHbLijHvUcy4cEzGMTVG3AbDxniqJTB z0VCaesaqIBX1flZlWH95x/99lGWZMRp9fbpENqFX4WY73H2mjbTaXRmYgHBwgLccsdN IRnaTuwZXFAYYiYlKGUoqIt/WjyEhQS9sTPOMy2ZyhproARHGgTyA+pVnzBr4WUFM3eB xCkHVKbDaKDzxGZHuFIniO7lZpUhGYJXdTWP6h2x7arcUPq/ZvpCwHMba5XWGm1nx6aY +IxDHrPuPeWyD+jN/ys5WE8F6LgJRGMefnqgZiNlyDu9gybRwRpJGp75p5olRWtQT6cp z4dw== X-Forwarded-Encrypted: i=1; AJvYcCUYSlKxSpgNrBDg32M8tRjsQI82xP9NS9T7vuSIeJ5yMDj6JH2yFZYHXC92MsqTFAr1y8FGZN0dy5z5lwgx@vger.kernel.org, AJvYcCVv/cpYbbAXwK2ZYaWwtCQHQbAf/uAZqFN+Rw0Odc+cQ0G6mxKhqKZIQlIRKfQPN7ioxWZlkjbh@vger.kernel.org, AJvYcCXERpVLqSdMi9vfeLKVz2e8Don29Lv+vTuWGWLrs62l5cQjs8g/bLazz3dulmfN2RHPDiuyKoHOjtrb@vger.kernel.org X-Gm-Message-State: AOJu0YxZr6Q8Y4rDzDLzuIJW3QcCCrS7j10Lbg2oIsmaGYsTbPJ0qHRW PQmXGsYnXaDVeTVuXgmA18HzCVUBod2VUbULZqFlOlImHdPYBX9U0bNH X-Gm-Gg: ASbGncszC725Y4KHODgHSlvc3+1DABnPYub7Mouc5itITGw+ef1YmTKAnCBtGmwp8dz AZrZ8p1y3lJCSJWShlX49sAkxvQYT/0S1fKPoo2CdHFmZgI4qsjvKt7GtTDgI/gcN7vnuNxXeA6 +PoBgon1BFKFi+UuT0+sR7tfcSj45N1mttwEHIGTG0NMYqqlHC2JBUlCC8NNZhv2wZguHqEo+EZ 00wWg1xBoh2SRIcSIMLFJdBT1noP6AT37zqAB4BtUsvG694szvxx1phhvhEjakRidzQ031X5ylp I3MS5ivk0KlJRj7IPG0mQqe41MrL0UHgtC7v3lSSQvcHc+TAhWXJN+voN6Dj9oDqFlWkeeMWZYa RV2eCZsnV2l+hxlxsaQbi9xK7dZxQ4pPKEXcJr8NDC1byLGL11QGszKDo3w== X-Google-Smtp-Source: AGHT+IEFMz4IXO1OgHZd1PaB01r0haZ1V/WHAlrm7HnQMPU3/qt75Sgmr83WL/Dg1xKkARcBxT8d+A== X-Received: by 2002:a05:6000:26c5:b0:3c8:29eb:732e with SMTP id ffacd0b85a97d-3d1df539ea3mr14494080f8f.59.1756986143767; Thu, 04 Sep 2025 04:42:23 -0700 (PDT) Received: from iku.Home ([2a06:5906:61b:2d00:904e:70c8:edf3:59a4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45dd0aec70dsm14658475e9.0.2025.09.04.04.42.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Sep 2025 04:42:22 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiner Kallweit , Russell King , Philipp Zabel , Geert Uytterhoeven , Magnus Damm , Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH net-next v2 9/9] net: pcs: rzn1-miic: Add RZ/T2H MIIC support Date: Thu, 4 Sep 2025 12:42:03 +0100 Message-ID: <20250904114204.4148520-10-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250904114204.4148520-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20250904114204.4148520-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Lad Prabhakar Add support for the Renesas RZ/T2H MIIC by defining SoC-specific modctrl match tables, register map, and string representations for converters and ports. Signed-off-by: Lad Prabhakar Tested-by: Wolfram Sang --- v1->v2: - Dropped regx in config description. - Used "renesas,r9a09g077-miic" as compatible for RZ/T2H. --- drivers/net/pcs/Kconfig | 11 +++-- drivers/net/pcs/pcs-rzn1-miic.c | 82 +++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+), 5 deletions(-) diff --git a/drivers/net/pcs/Kconfig b/drivers/net/pcs/Kconfig index f6aa437473de..76dbc11d9575 100644 --- a/drivers/net/pcs/Kconfig +++ b/drivers/net/pcs/Kconfig @@ -26,11 +26,12 @@ config PCS_MTK_LYNXI which is part of MediaTek's SoC and Ethernet switch ICs. =20 config PCS_RZN1_MIIC - tristate "Renesas RZ/N1 MII converter" - depends on OF && (ARCH_RZN1 || COMPILE_TEST) + tristate "Renesas RZ/N1, RZ/N2H, RZ/T2H MII converter" + depends on OF + depends on ARCH_RZN1 || ARCH_R9A09G077 || ARCH_R9A09G087 || COMPILE_TEST help - This module provides a driver for the MII converter that is available - on RZ/N1 SoCs. This PCS converts MII to RMII/RGMII or can be set in - pass-through mode for MII. + This module provides a driver for the MII converter available on + Renesas RZ/N1, RZ/N2H, and RZ/T2H SoCs. This PCS converts MII to + RMII/RGMII, or can be set in pass-through mode for MII. =20 endmenu diff --git a/drivers/net/pcs/pcs-rzn1-miic.c b/drivers/net/pcs/pcs-rzn1-mii= c.c index 86d4dccd694e..5ec36bf042cd 100644 --- a/drivers/net/pcs/pcs-rzn1-miic.c +++ b/drivers/net/pcs/pcs-rzn1-miic.c @@ -21,6 +21,7 @@ #include #include #include +#include =20 #define MIIC_PRCMD 0x0 #define MIIC_ESID_CODE 0x4 @@ -125,6 +126,57 @@ static const char * const index_to_string[] =3D { "CONV5", }; =20 +static struct modctrl_match rzt2h_modctrl_match_table[] =3D { + {0x0, {ETHSS_GMAC0_PORT, ETHSS_ETHSW_PORT0, ETHSS_ETHSW_PORT1, + ETHSS_ETHSW_PORT2, ETHSS_GMAC1_PORT}}, + + {0x1, {MIIC_MODCTRL_CONF_NONE, ETHSS_ESC_PORT0, ETHSS_ESC_PORT1, + ETHSS_GMAC2_PORT, ETHSS_GMAC1_PORT}}, + + {0x2, {ETHSS_GMAC0_PORT, ETHSS_ESC_PORT0, ETHSS_ESC_PORT1, + ETHSS_ETHSW_PORT2, ETHSS_GMAC1_PORT}}, + + {0x3, {MIIC_MODCTRL_CONF_NONE, ETHSS_ESC_PORT0, ETHSS_ESC_PORT1, + ETHSS_ESC_PORT2, ETHSS_GMAC1_PORT}}, + + {0x4, {ETHSS_GMAC0_PORT, ETHSS_ETHSW_PORT0, ETHSS_ESC_PORT1, + ETHSS_ESC_PORT2, ETHSS_GMAC1_PORT}}, + + {0x5, {ETHSS_GMAC0_PORT, ETHSS_ETHSW_PORT0, ETHSS_ESC_PORT1, + ETHSS_ETHSW_PORT2, ETHSS_GMAC1_PORT}}, + + {0x6, {ETHSS_GMAC0_PORT, ETHSS_ETHSW_PORT0, ETHSS_ETHSW_PORT1, + ETHSS_GMAC2_PORT, ETHSS_GMAC1_PORT}}, + + {0x7, {MIIC_MODCTRL_CONF_NONE, ETHSS_GMAC0_PORT, ETHSS_GMAC1_PORT, + ETHSS_GMAC2_PORT, MIIC_MODCTRL_CONF_NONE}} +}; + +static const char * const rzt2h_conf_to_string[] =3D { + [ETHSS_GMAC0_PORT] =3D "GMAC0_PORT", + [ETHSS_GMAC1_PORT] =3D "GMAC1_PORT", + [ETHSS_GMAC2_PORT] =3D "GMAC2_PORT", + [ETHSS_ESC_PORT0] =3D "ETHERCAT_PORT0", + [ETHSS_ESC_PORT1] =3D "ETHERCAT_PORT1", + [ETHSS_ESC_PORT2] =3D "ETHERCAT_PORT2", + [ETHSS_ETHSW_PORT0] =3D "SWITCH_PORT0", + [ETHSS_ETHSW_PORT1] =3D "SWITCH_PORT1", + [ETHSS_ETHSW_PORT2] =3D "SWITCH_PORT2", +}; + +static const char * const rzt2h_index_to_string[] =3D { + "SWITCH_PORTIN", + "CONV0", + "CONV1", + "CONV2", + "CONV3", +}; + +static const char * const rzt2h_reset_ids[] =3D { + "rst", + "crst", +}; + /** * struct miic - MII converter structure * @base: base address of the MII converter @@ -203,11 +255,24 @@ static inline void miic_unlock_regs(struct miic *miic) writel(0x0001, miic->base + MIIC_PRCMD); } =20 +static inline void miic_lock_regs(struct miic *miic) +{ + /* Protect register writes */ + writel(0x0000, miic->base + MIIC_PRCMD); +} + static void miic_reg_writel_unlocked(struct miic *miic, int offset, u32 va= lue) { writel(value, miic->base + offset); } =20 +static void miic_reg_writel_locked(struct miic *miic, int offset, u32 valu= e) +{ + miic_unlock_regs(miic); + writel(value, miic->base + offset); + miic_lock_regs(miic); +} + static void miic_reg_writel(struct miic *miic, int offset, u32 value) { miic->of_data->miic_write(miic, offset, value); @@ -645,7 +710,24 @@ static struct miic_of_data rzn1_miic_of_data =3D { .miic_write =3D miic_reg_writel_unlocked, }; =20 +static struct miic_of_data rzt2h_miic_of_data =3D { + .match_table =3D rzt2h_modctrl_match_table, + .match_table_count =3D ARRAY_SIZE(rzt2h_modctrl_match_table), + .conf_conv_count =3D 5, + .conf_to_string =3D rzt2h_conf_to_string, + .conf_to_string_count =3D ARRAY_SIZE(rzt2h_conf_to_string), + .index_to_string =3D rzt2h_index_to_string, + .index_to_string_count =3D ARRAY_SIZE(rzt2h_index_to_string), + .miic_port_start =3D 0, + .miic_port_max =3D 4, + .sw_mode_mask =3D GENMASK(2, 0), + .reset_ids =3D rzt2h_reset_ids, + .reset_count =3D ARRAY_SIZE(rzt2h_reset_ids), + .miic_write =3D miic_reg_writel_locked, +}; + static const struct of_device_id miic_of_mtable[] =3D { + { .compatible =3D "renesas,r9a09g077-miic", .data =3D &rzt2h_miic_of_data= }, { .compatible =3D "renesas,rzn1-miic", .data =3D &rzn1_miic_of_data }, { /* sentinel */ } }; --=20 2.51.0