From nobody Thu Oct 2 19:05:36 2025 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0F1D26B756 for ; Fri, 12 Sep 2025 09:16:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757668594; cv=none; b=NFsty60Yj85svflM+qq6WBVW/MEQqg+9PUvHNXm41Yb0lh2FOduL+eMu134vjpol01RlLBVlUzNjUfz4LvBkqs6KcVElpAD7ZqK1J1xqgxw7ZEJtqdC+ed1uu0+CyNYaeiI6/pOYhf1WnXhZCchK+HdS2zoxL9pJ/HNOQeNUXeI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757668594; c=relaxed/simple; bh=Pjqo9rLefJi52wvlDOawMLf6tQJ/V8fM9H1T1oYxCE4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BqO2lSimy4LU/8YKbZZujmDMRCl1YfcADscTjbONOtnduE2xotAWYJSZKwEWpKUsagcpjfjHDrHkPWJU8J74asUaQYBDfKMEm6LZJx7E8D56L/vgPfA40CTWnrVmemGJ3leaJeYXo7S/BSzfsVviokXKL+7nuEcI/MDfikdcmE4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=WYNquoqo; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="WYNquoqo" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 354F94E40C9B; Fri, 12 Sep 2025 09:16:30 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 0BD2760638; Fri, 12 Sep 2025 09:16:30 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 964CD102F29D9; Fri, 12 Sep 2025 11:16:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1757668588; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=gjuk0D0MlQ1y3SzWONMFViMKrN2S9Sz2wj3JG7/59tk=; b=WYNquoqo0AOE5Auy+ddJN0oBOO65dLYoDP88C+UCU6b84S8W+PDEmdW1f/wlLbB68gTP0G Mv9hf2nenK2hMSHWCtJyw21KwJZjz6PbgHm6BxC+4f9GolpXu7fgXV0UsARrVNubf7HCL7 Pn/MHHy/ghA78VLzeIqZcpbuWo6EimXvPM6H14OZL7046RHm6AuXrSOPcER1U5s7uhSH1L Cn4J5n2omeEViDPKzSbMlkvlmWsuUs4sGqDk3pJGVHmBtBx7SY+2gn/0vIIajTCND8Z/vx +FK39bhM81MnEtf+gncxMhJH053BPWaoc+mhs8TYe1+WVU/NALETivkCt4wQ6Q== From: "Bastien Curutchet (Schneider Electric)" Date: Fri, 12 Sep 2025 11:09:12 +0200 Subject: [PATCH net-next v2 1/3] dt-bindings: net: dsa: microchip: Group if clause under allOf tag 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 Message-Id: <20250912-ksz-strap-pins-v2-1-6d97270c6926@bootlin.com> References: <20250912-ksz-strap-pins-v2-0-6d97270c6926@bootlin.com> In-Reply-To: <20250912-ksz-strap-pins-v2-0-6d97270c6926@bootlin.com> To: Woojung Huh , UNGLinuxDriver@microchip.com, Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Marek Vasut Cc: Thomas Petazzoni , =?utf-8?q?Miqu=C3=A8l_Raynal?= , Pascal Eberhard , Woojung Huh , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, "Bastien Curutchet (Schneider Electric)" X-Mailer: b4 0.14.2 X-Last-TLS-Session-Version: TLSv1.3 Upcoming patch adds a new if/then clause. It requires to be grouped with the already existing if/then clause under an 'allOf:' tag. Move the if/then clause under the already existing 'allOf:' tag to prepare next patch. Signed-off-by: Bastien Curutchet (Schneider Electric) Acked-by: Rob Herring (Arm) --- .../devicetree/bindings/net/dsa/microchip,ksz.yaml | 68 +++++++++++-------= ---- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml b= /Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml index eb4607460db7f32a4dffd416e44b61c2674f731e..db8175b4ced6d136ba97c371b68= ba993637e444a 100644 --- a/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml +++ b/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml @@ -10,9 +10,6 @@ maintainers: - Marek Vasut - Woojung Huh =20 -allOf: - - $ref: /schemas/spi/spi-peripheral-props.yaml# - properties: # See Documentation/devicetree/bindings/net/dsa/dsa.yaml for a list of a= dditional # required and optional properties. @@ -107,38 +104,41 @@ required: - compatible - reg =20 -if: - not: - properties: - compatible: - enum: - - microchip,ksz8863 - - microchip,ksz8873 -then: - $ref: dsa.yaml#/$defs/ethernet-ports -else: - patternProperties: - "^(ethernet-)?ports$": +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + + - if: + not: + properties: + compatible: + enum: + - microchip,ksz8863 + - microchip,ksz8873 + then: + $ref: dsa.yaml#/$defs/ethernet-ports + else: patternProperties: - "^(ethernet-)?port@[0-2]$": - $ref: dsa-port.yaml# - unevaluatedProperties: false - properties: - microchip,rmii-clk-internal: - $ref: /schemas/types.yaml#/definitions/flag - description: - When ksz88x3 is acting as clock provier (via REFCLKO) it - can select between internal and external RMII reference - clock. Internal reference clock means that the clock for - the RMII of ksz88x3 is provided by the ksz88x3 internally - and the REFCLKI pin is unconnected. For the external - reference clock, the clock needs to be fed back to ksz88x3 - via REFCLKI. - If microchip,rmii-clk-internal is set, ksz88x3 will provide - rmii reference clock internally, otherwise reference clock - should be provided externally. - dependencies: - microchip,rmii-clk-internal: [ethernet] + "^(ethernet-)?ports$": + patternProperties: + "^(ethernet-)?port@[0-2]$": + $ref: dsa-port.yaml# + unevaluatedProperties: false + properties: + microchip,rmii-clk-internal: + $ref: /schemas/types.yaml#/definitions/flag + description: + When ksz88x3 is acting as clock provier (via REFCLKO) = it + can select between internal and external RMII reference + clock. Internal reference clock means that the clock f= or + the RMII of ksz88x3 is provided by the ksz88x3 interna= lly + and the REFCLKI pin is unconnected. For the external + reference clock, the clock needs to be fed back to ksz= 88x3 + via REFCLKI. + If microchip,rmii-clk-internal is set, ksz88x3 will pr= ovide + rmii reference clock internally, otherwise reference c= lock + should be provided externally. + dependencies: + microchip,rmii-clk-internal: [ethernet] =20 unevaluatedProperties: false =20 --=20 2.51.0 From nobody Thu Oct 2 19:05:36 2025 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30F8927E1AC for ; Fri, 12 Sep 2025 09:16:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757668595; cv=none; b=jEJQalrw5E3wgkLTMpHSGP7utetQxcVqL1HdHyJG63GK3FNEQuwR3HAPzj4XIZXCWV/lw+cC4uQyRK3xRVmnIrp/RJBO3ZRAvuhuFGecpukgVeJUBrDf88+Wk5XgcvBc2/kpFW5ibsI3uJ1izkGtfQJJI+RmrOe/wXsu4ib/0pY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757668595; c=relaxed/simple; bh=7xjaN++yI6KEPxU35tjofli5LkxLgcT962mH3BRyDXg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ndxk/9crnOY4HyURO7X7EGNYFfxNJy1dUvFbJW49FeJ81xjkoH9vv4Tf9NGp0sLXrV0oG4AwJCVVZPjht/xT9dkd4McQZrU0VrJNURoDjeHchqU7r4mvzbLOVo4+UQCPMHkMVVo8DgJZL4352C03OD2qZBCmgqqD8bbhCvqUD88= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=TBVpNSul; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="TBVpNSul" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id A0CE91A0DD4; Fri, 12 Sep 2025 09:16:32 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 755A260638; Fri, 12 Sep 2025 09:16:32 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 525F1102F29DD; Fri, 12 Sep 2025 11:16:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1757668591; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=L+6jrk72fwMKzwzZOHzEZKdBpoCdacRGXLcgPacqMIc=; b=TBVpNSulOChQdlcmYi2dQcLYtqA+Q+FarGn42UjJOXftDgtEDTZPRWGyii2m/rP80+EzVK ATqwx/Nwpw5P1madWnjfWjsm0qZvOT5BnZyVlCxDCWXXl/fz0dPv5gVwfrNMDrqod0aPmK 9KR7P3qkezmyJz6bf5REKk+cMr3LtOSYZOXb1FBOefrCPEO93qpOfeZlpLoPuqeIPrX1Pz rU00wb7SQmT0fo+dbZTyEVqDNQulVyBBdMmJN+X13xg3xvkyQFDoqFSlx6cGOMhgANp3e+ dw+BVWGo2jVFdBbO8xOztibiJk0bSMJlA1k8GunUczgq8ul8Z9C7PZiKvzfFLg== From: "Bastien Curutchet (Schneider Electric)" Date: Fri, 12 Sep 2025 11:09:13 +0200 Subject: [PATCH net-next v2 2/3] dt-bindings: net: dsa: microchip: Add strap description to set SPI mode 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 Message-Id: <20250912-ksz-strap-pins-v2-2-6d97270c6926@bootlin.com> References: <20250912-ksz-strap-pins-v2-0-6d97270c6926@bootlin.com> In-Reply-To: <20250912-ksz-strap-pins-v2-0-6d97270c6926@bootlin.com> To: Woojung Huh , UNGLinuxDriver@microchip.com, Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Marek Vasut Cc: Thomas Petazzoni , =?utf-8?q?Miqu=C3=A8l_Raynal?= , Pascal Eberhard , Woojung Huh , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, "Bastien Curutchet (Schneider Electric)" X-Mailer: b4 0.14.2 X-Last-TLS-Session-Version: TLSv1.3 At reset, KSZ8463 uses a strap-based configuration to set SPI as interface bus. If the required pull-ups/pull-downs are missing (by mistake or by design to save power) the pins may float and the configuration can go wrong preventing any communication with the switch. Add a 'reset' pinmux state Add a KSZ8463 specific strap description that can be used by the driver to drive the strap pins during reset. Two GPIOs are used. Users must describe either both of them or none of them. Signed-off-by: Bastien Curutchet (Schneider Electric) --- .../devicetree/bindings/net/dsa/microchip,ksz.yaml | 24 ++++++++++++++++++= ++++ 1 file changed, 24 insertions(+) diff --git a/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml b= /Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml index db8175b4ced6d136ba97c371b68ba993637e444a..099c6b373704427755c3d8cad4b= 1cd930219f2f2 100644 --- a/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml +++ b/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml @@ -34,6 +34,13 @@ properties: - microchip,ksz8567 - microchip,lan9646 =20 + pinctrl-names: + items: + - const: default + - const: reset + description: + Used during reset for strap configuration. + reset-gpios: description: Should be a gpio specifier for a reset line. @@ -139,6 +146,23 @@ allOf: should be provided externally. dependencies: microchip,rmii-clk-internal: [ethernet] + - if: + properties: + compatible: + contains: + const: microchip,ksz8463 + then: + properties: + strap-rxd0-gpios: + description: + RXD0 pin, used to select SPI as bus interface. + strap-rxd1-gpios: + description: + RXD1 pin, used to select SPI as bus interface. + +dependencies: + strap-rxd0-gpios: [ strap-rxd1-gpios ] + strap-rxd1-gpios: [ strap-rxd0-gpios ] =20 unevaluatedProperties: false =20 --=20 2.51.0 From nobody Thu Oct 2 19:05:36 2025 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 729DD27EC7C; Fri, 12 Sep 2025 09:16:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757668598; cv=none; b=mrCLIJH831I1sapUmx//QckvAhcNrjLzIVan/dFcrIEqWfew7a6PgYxWrjE4nadFpoNGzEkOK6Oju7B9p/GnTfrdZ3XEY2R4JX7bihyHhqaSTdSheU0q/t4srk2skZuGi+klz5Cpj3v2ZqKS1GRsMVXsrjZpUI7B1DpVrNiLqZQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757668598; c=relaxed/simple; bh=M6H4vuC1kEo4E+gLt9fSDpwP8uZAqmIgNGYQto3FN6w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UYbDug5gjKOQqKZf4TEN2MMGauDq1lHoE7/p2sG2P7fKIQFUecOb0C3pJS+ny1htebMU0C0AoP1+IXvvrfOVOiBgygXtzvzLgjvS5fg+2ScL+fI9taen0IJc5GhaDEzZ1antvwI9/J8KviC/qF9If+2W6zfNxhPbQTIo3XnmZ2s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=v1TaEspG; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="v1TaEspG" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id BE04E4E40CA2; Fri, 12 Sep 2025 09:16:34 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 92B5660638; Fri, 12 Sep 2025 09:16:34 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 9C311102F29F0; Fri, 12 Sep 2025 11:16:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1757668593; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=WrEpjzQG6DNyDJzeGBdcuqSqyOJS2DKBX8gv90YD2t4=; b=v1TaEspGpxrRVy9CAufNd7nysVTGp7WzDeWJbuYbWq3jSgdOAofV8kjtAU0R+M9hk98xCH Vgo0qNsz2WFp5siWvHSRuxqjYl1sAFXUhgeClNLb01j7ZKDjU8BNX2FEXos1iO24Ih/HkH gFpN82nVW/ut3i4opQ2pu5rlkuMyYwHSjXsU8YthPAVVfrU9P9kqmTHadi9oc+gHQ1ty3+ fHLoQHu/2BoYKFRFWmgBoA/A4xxCvXTUsIPyRLhS0OZ1I5esjbpDPqZ4JsM9zzrIJEHPCW evYSdH77Ge6oA9BQ909yIKT3TTDwNuB69pI+BuwXOFdjvHRJsPXrw5TUoM1hvg== From: Bastien Curutchet Date: Fri, 12 Sep 2025 11:09:14 +0200 Subject: [PATCH net-next v2 3/3] net: dsa: microchip: Set SPI as bus interface during reset for KSZ8463 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 Message-Id: <20250912-ksz-strap-pins-v2-3-6d97270c6926@bootlin.com> References: <20250912-ksz-strap-pins-v2-0-6d97270c6926@bootlin.com> In-Reply-To: <20250912-ksz-strap-pins-v2-0-6d97270c6926@bootlin.com> To: Woojung Huh , UNGLinuxDriver@microchip.com, Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Marek Vasut Cc: Thomas Petazzoni , =?utf-8?q?Miqu=C3=A8l_Raynal?= , Pascal Eberhard , Woojung Huh , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, "Bastien Curutchet (Schneider Electric)" X-Mailer: b4 0.14.2 X-Last-TLS-Session-Version: TLSv1.3 At reset, the KSZ8463 uses a strap-based configuration to set SPI as bus interface. SPI is the only bus supported by the driver. If the required pull-ups/pull-downs are missing (by mistake or by design to save power) the pins may float and the configuration can go wrong preventing any communication with the switch. Introduce a ksz8463_configure_straps_spi() function called during the device reset. It relies on the 'strap-rxd*-gpios' OF properties and the 'reset' pinmux configuration to enforce SPI as bus interface. Signed-off-by: Bastien Curutchet (Schneider Electric) Reviewed-by: Andrew Lunn --- drivers/net/dsa/microchip/ksz_common.c | 45 ++++++++++++++++++++++++++++++= ++++ 1 file changed, 45 insertions(+) diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/micro= chip/ksz_common.c index 7292bfe2f7cac3a0d88bb51339cc287f56ca1d1f..ac05dd25b4863a61b15ac113158= 7b2b4df11ec41 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -5338,6 +5339,38 @@ static int ksz_parse_drive_strength(struct ksz_devic= e *dev) return 0; } =20 +static int ksz8463_configure_straps_spi(struct ksz_device *dev) +{ + struct pinctrl *pinctrl; + struct gpio_desc *rxd0; + struct gpio_desc *rxd1; + + rxd0 =3D devm_gpiod_get_optional(dev->dev, "strap-rxd0", GPIOD_OUT_LOW); + if (IS_ERR(rxd0)) + return PTR_ERR(rxd0); + + rxd1 =3D devm_gpiod_get_optional(dev->dev, "strap-rxd1", GPIOD_OUT_HIGH); + if (IS_ERR(rxd1)) + return PTR_ERR(rxd1); + + if (!rxd0 && !rxd1) + return 0; + + if ((rxd0 && !rxd1) || (rxd1 && !rxd0)) + return -EINVAL; + + pinctrl =3D devm_pinctrl_get_select(dev->dev, "reset"); + if (IS_ERR(pinctrl)) + return PTR_ERR(pinctrl); + + return 0; +} + +static int ksz8463_release_straps_spi(struct ksz_device *dev) +{ + return pinctrl_select_default_state(dev->dev); +} + int ksz_switch_register(struct ksz_device *dev) { const struct ksz_chip_data *info; @@ -5353,10 +5386,22 @@ int ksz_switch_register(struct ksz_device *dev) return PTR_ERR(dev->reset_gpio); =20 if (dev->reset_gpio) { + if (of_device_is_compatible(dev->dev->of_node, "microchip,ksz8463")) { + ret =3D ksz8463_configure_straps_spi(dev); + if (ret) + return ret; + } + gpiod_set_value_cansleep(dev->reset_gpio, 1); usleep_range(10000, 12000); gpiod_set_value_cansleep(dev->reset_gpio, 0); msleep(100); + + if (of_device_is_compatible(dev->dev->of_node, "microchip,ksz8463")) { + ret =3D ksz8463_release_straps_spi(dev); + if (ret) + return ret; + } } =20 mutex_init(&dev->dev_mutex); --=20 2.51.0