From nobody Sat May 18 20:15:14 2024 Received: from out-188.mta0.migadu.com (out-188.mta0.migadu.com [91.218.175.188]) (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 6593A60279 for ; Tue, 23 Apr 2024 11:35:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713872153; cv=none; b=aPdxCdU8lc+eyZ8kLjwqiOv2qNKJMz+p8pZyfSuUWzvY2BCgK2B4tArM/ojl1kx+Rx0hSNL1QwbmsLUAvTJHTpYiraq73PJwXzivEMF7L2g3pID88D6L7Dw+3FtclFeGUf5uB28XI/dygQFXEuKG4NnQ8SNactRAj+HPm7bXdRs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713872153; c=relaxed/simple; bh=ki//Tt205CP3YcLxLRsMRa+b8m19nQ1T9y6zr7KpK04=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LR65Hxq4tcVVpSkpq+vJFiKT1jcjfa9SBv+EtdyOG56OA3c+sVYJHkWZo7Mb86fitQjv8RYQYBma/qxuDdgaDOf51H+jout3YCtikrXASg/3LJO1ryUMtu4gJbPDhiyLVB2ihLf1NFYw3zErnLYnhPFSf2lfIPfaDV5SqabpJJI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pqrs.dk; spf=pass smtp.mailfrom=pqrs.dk; dkim=pass (2048-bit key) header.d=pqrs.dk header.i=@pqrs.dk header.b=AUxcy6v1; arc=none smtp.client-ip=91.218.175.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pqrs.dk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pqrs.dk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pqrs.dk header.i=@pqrs.dk header.b="AUxcy6v1" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqrs.dk; s=key1; t=1713872147; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rBFOR6K3nryIYvB1WHqkFDTsIb/yzyHQ+hBKBc86J5I=; b=AUxcy6v1mcV8Q23klVD/k0SYtmUfCbYAlb5Fi/g2laDbaZ3/UcLrrAaZnglqLU8vsboOpY Oz+TyFsDctq2V6EKfVQ2lYN5KtIEuexFtgGGWuKs61V4S4lkgeuyDptZwOC7gWB/hOo5PW P7IvedaOTyuRnL/HxxrjKqActog+hmeIE/r1qciUiyCwHIjpPwcjZ4EajYXD2wwQda/uQI z3O143bsl9prKdVvkxJ7P4Bc/dLt7750X0dbLCPHMhNeHVbcjOUT2sCxw0N3y9LAbvAiUv gWk3m5GPPeEsfMiKxZTmC89CdRxw1RccWRNww0RL6DBco7l/InhCkxHx2GzglQ== From: =?utf-8?q?Alvin_=C5=A0ipraga?= Date: Tue, 23 Apr 2024 13:35:30 +0200 Subject: [PATCH 1/3] spi: dt-bindings: nxp,sc18is602: convert binding to YAML 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: <20240423-sc18is606-v1-1-094ef37d5a59@bang-olufsen.dk> References: <20240423-sc18is606-v1-0-094ef37d5a59@bang-olufsen.dk> In-Reply-To: <20240423-sc18is606-v1-0-094ef37d5a59@bang-olufsen.dk> To: Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-spi@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Alvin_=C5=A0ipraga?= X-Migadu-Flow: FLOW_OUT From: Alvin =C5=A0ipraga Convert the txt binding to YAML. In the example, the node name was changed from sc18is603@28 to spi@28 to conform with the standard $nodename property in the spi-controller.yaml schema. Make myself maintainer of this binding, since nobody else has volunteered themselves. Signed-off-by: Alvin =C5=A0ipraga Reviewed-by: Rob Herring (Arm) --- .../devicetree/bindings/spi/nxp,sc18is602.yaml | 59 ++++++++++++++++++= ++++ .../devicetree/bindings/spi/spi-sc18is602.txt | 23 --------- 2 files changed, 59 insertions(+), 23 deletions(-) diff --git a/Documentation/devicetree/bindings/spi/nxp,sc18is602.yaml b/Doc= umentation/devicetree/bindings/spi/nxp,sc18is602.yaml new file mode 100644 index 000000000000..5b34fdf6148a --- /dev/null +++ b/Documentation/devicetree/bindings/spi/nxp,sc18is602.yaml @@ -0,0 +1,59 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/spi/nxp,sc18is602.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP SC18IS602/602B/603 I2C to SPI bridge + +maintainers: + - Alvin =C5=A0ipraga + +properties: + compatible: + enum: + - nxp,sc18is602 + - nxp,sc18is602b + - nxp,sc18is603 + + reg: + maxItems: 1 + + clock-frequency: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + External oscillator clock frequency. Only relevant if the chip has an + external oscillator (SC18IS603). + default: 7372000 + +required: + - compatible + - reg + +allOf: + - $ref: spi-controller.yaml# + - if: + not: + properties: + comptaible: + contains: + enum: + - nxp,sc18is603 + then: + properties: + clock-frequency: false + +unevaluatedProperties: false + +examples: + - | + i2c { + #address-cells =3D <1>; + #size-cells =3D <0>; + + spi@28 { + compatible =3D "nxp,sc18is603"; + reg =3D <0x28>; + clock-frequency =3D <14744000>; + }; + }; diff --git a/Documentation/devicetree/bindings/spi/spi-sc18is602.txt b/Docu= mentation/devicetree/bindings/spi/spi-sc18is602.txt deleted file mode 100644 index 02f9033270a2..000000000000 --- a/Documentation/devicetree/bindings/spi/spi-sc18is602.txt +++ /dev/null @@ -1,23 +0,0 @@ -NXP SC18IS602/SCIS603 - -Required properties: - - compatible : Should be one of - "nxp,sc18is602" - "nxp,sc18is602b" - "nxp,sc18is603" - - reg: I2C bus address - -Optional properties: - - clock-frequency : external oscillator clock frequency. If not - specified, the SC18IS602 default frequency (7372000) will be used. - -The clock-frequency property is relevant and needed only if the chip has an -external oscillator (SC18IS603). - -Example: - - sc18is603@28 { - compatible =3D "nxp,sc18is603"; - reg =3D <0x28>; - clock-frequency =3D <14744000>; - } --=20 2.44.0 From nobody Sat May 18 20:15:14 2024 Received: from out-180.mta0.migadu.com (out-180.mta0.migadu.com [91.218.175.180]) (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 C953B7E58E for ; Tue, 23 Apr 2024 11:35:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713872152; cv=none; b=bs16OXPo8HcxAgvPTT11WpOUX+v/AWEYVrwvc6d9Po2digot2jGojwlX5P5GfV3iOu8PrTk8+sf7vMbLFG7QRcgi6kS/kY818soWfBzDodhjjs/8UzNKh9hgBy0NJdzkk9G7M5d9lB5or5U/vB0BFR5zFQNY9mcEkPml5Lge58Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713872152; c=relaxed/simple; bh=9vP4mBM6tkos6CoZHwx0vDDQJ//HL3Wf+tFRftdDnPs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Z/3Svlm+g+DEPOJZJj6tmsIe1wnEiGcmw7+8gxcOzLiH9KNBxDz6fs8DMISO2LLB8Bd9puT/PlUBPahtvd9BwxRBbt6yJAQqZuCYcK/hEY/45BoH2PtalbdBLRpJHuhasu8AXPw9a4oGggWVykFTat3veQ0gtoCSlAMj5qdixPs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pqrs.dk; spf=pass smtp.mailfrom=pqrs.dk; dkim=pass (2048-bit key) header.d=pqrs.dk header.i=@pqrs.dk header.b=ihznQ1EJ; arc=none smtp.client-ip=91.218.175.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pqrs.dk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pqrs.dk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pqrs.dk header.i=@pqrs.dk header.b="ihznQ1EJ" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqrs.dk; s=key1; t=1713872148; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ScAzNfep4eEm1vY7gR4iZr889YiTgmobWqSLElHBrnQ=; b=ihznQ1EJpwJlGH9l73N+J6VA9xAPP4Qdh1bBkiIpzQvBa52c9oC3HNrG7ivZiL5+BSR51V bR0d6C8k/xuXQs3OW/JENlG1ZthT18iccUP7oUlx8dKQtdYLLazsd3nVTOuGihF38H/4/h CyrNzOgPuKwGY5yDd3yCGoAc37Ji+Lf8JhbRWFy2gywtVq6VgEIHoE+mPdjLG4P2ciTIyc AdhtJY0jPunrinNQrtAZeVjB+gHNMJ3M18pdT6rwbm3atT2Y6h1BPmMzqjXIEeTprfmQ8H tCyoLyV+ypYx2cH2xrGslHONHgl/wSOcJth93kuAqw8HjGSfpfld4homQqSc4Q== From: =?utf-8?q?Alvin_=C5=A0ipraga?= Date: Tue, 23 Apr 2024 13:35:31 +0200 Subject: [PATCH 2/3] spi: dt-bindings: nxp,sc18is602: add compatible for SC18IS606 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: <20240423-sc18is606-v1-2-094ef37d5a59@bang-olufsen.dk> References: <20240423-sc18is606-v1-0-094ef37d5a59@bang-olufsen.dk> In-Reply-To: <20240423-sc18is606-v1-0-094ef37d5a59@bang-olufsen.dk> To: Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-spi@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Alvin_=C5=A0ipraga?= X-Migadu-Flow: FLOW_OUT From: Alvin =C5=A0ipraga The compatible string is nxp,sc18is606. It is a functional replacement for the SC18IS602B with a larger data buffer, three (rather than four) chip selects, and lacks support for quasi-directional GPIO. Signed-off-by: Alvin =C5=A0ipraga Acked-by: Rob Herring (Arm) --- Documentation/devicetree/bindings/spi/nxp,sc18is602.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/spi/nxp,sc18is602.yaml b/Doc= umentation/devicetree/bindings/spi/nxp,sc18is602.yaml index 5b34fdf6148a..8fbf74b95708 100644 --- a/Documentation/devicetree/bindings/spi/nxp,sc18is602.yaml +++ b/Documentation/devicetree/bindings/spi/nxp,sc18is602.yaml @@ -4,7 +4,7 @@ $id: http://devicetree.org/schemas/spi/nxp,sc18is602.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# =20 -title: NXP SC18IS602/602B/603 I2C to SPI bridge +title: NXP SC18IS602/602B/603/606 I2C to SPI bridge =20 maintainers: - Alvin =C5=A0ipraga @@ -15,6 +15,7 @@ properties: - nxp,sc18is602 - nxp,sc18is602b - nxp,sc18is603 + - nxp,sc18is606 =20 reg: maxItems: 1 --=20 2.44.0 From nobody Sat May 18 20:15:14 2024 Received: from out-181.mta0.migadu.com (out-181.mta0.migadu.com [91.218.175.181]) (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 54A887FBA2 for ; Tue, 23 Apr 2024 11:35:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713872152; cv=none; b=Av19mw/ByLkLtmH982KXYmmXuqK+LEF4vTtmySImSqhln55lll6+qoQhRAMJcUWswpWYXH3tw6EN8A70GKQfvNNfG09s866YH0MRJYe6qr+5kx+7PQyWPJo4AKT4hdaiGl78fR+SJw2vV4jyqutMkXcaV4hUvAmme3xstRXj1no= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713872152; c=relaxed/simple; bh=ovcMslS2omGsY1EULRFd77UxhiulmHebYLq+iKzHxI0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=A3AacmDJC8bBR1Od2zKH55015sUPrUl55RJdwJg1B0R/Kf/hPSHNaUfP6+HJBCMIzccu3nld/AhqgNGMJbfoSCI5xutU52jufFko2rrrgx73/d3dxPklTCPOkEyCKKR5G5b9IX5VaocS603L1uOAwuII+JIa9nz2Ni8thyVgrNw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pqrs.dk; spf=pass smtp.mailfrom=pqrs.dk; dkim=pass (2048-bit key) header.d=pqrs.dk header.i=@pqrs.dk header.b=ZJNJt5Eb; arc=none smtp.client-ip=91.218.175.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pqrs.dk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pqrs.dk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pqrs.dk header.i=@pqrs.dk header.b="ZJNJt5Eb" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqrs.dk; s=key1; t=1713872148; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0PyQJiiXfGl3oN3CM544FYnY5XXcnoGO8H5B1VBN/i8=; b=ZJNJt5EbaEVMM/q98cMyLcBHCIDIF4y65dav7PnKGqCoaZqF10zEdRu20JW8lc4PF71CW0 Ms+HhvssjeIyzO289SHY+vuieiPvLsmSF3+1XkpXC6l/h17pL278e2EFcASL9NZIH32E9C r3lhxkB14RQvY8lViMUV0ccEnCZMXKlkH4ah5G4LJmENZUwq8adu9W2nybjIDarPiUn5m6 gpGilZzzLLVybiAGs++6YRsk8dDjv8Mx6F1BUkJK0IJxdg2Cg7OanB8Ga9xNbDiMNXx9X1 h7xIbIEdw2PEBW3ZewbmEaJ0UmPBkV0nNcD8hSmo5r7RIWhY1hJYKVLGLr5Svg== From: =?utf-8?q?Alvin_=C5=A0ipraga?= Date: Tue, 23 Apr 2024 13:35:32 +0200 Subject: [PATCH 3/3] spi: sc18is602: add support for SC18IS606 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: <20240423-sc18is606-v1-3-094ef37d5a59@bang-olufsen.dk> References: <20240423-sc18is606-v1-0-094ef37d5a59@bang-olufsen.dk> In-Reply-To: <20240423-sc18is606-v1-0-094ef37d5a59@bang-olufsen.dk> To: Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-spi@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Alvin_=C5=A0ipraga?= X-Migadu-Flow: FLOW_OUT From: Alvin =C5=A0ipraga Per its datasheet, the SC18IS606 is a functional replacement of the currently supported SC18IS602B, with the only relevant exceptions to this driver being an increased data buffer size (1024 vs 200 bytes) and three (rather than four) chip selects. It also lacks support for quasi-directional GPIO, but the driver does not use this feature anyway, so this is not reflected in the changes. To that end, update the driver to support variable data buffer sizes and add populate the relevant driver private data fields for this new chip. Signed-off-by: Alvin =C5=A0ipraga --- drivers/spi/spi-sc18is602.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/drivers/spi/spi-sc18is602.c b/drivers/spi/spi-sc18is602.c index eecf9ea95ae3..c4adfd4af804 100644 --- a/drivers/spi/spi-sc18is602.c +++ b/drivers/spi/spi-sc18is602.c @@ -16,9 +16,9 @@ #include #include =20 -enum chips { sc18is602, sc18is602b, sc18is603 }; +enum chips { sc18is602, sc18is602b, sc18is603, sc18is606 }; =20 -#define SC18IS602_BUFSIZ 200 +#define SC18IS602_MAX_BUFSIZ 1024 #define SC18IS602_CLOCK 7372000 =20 #define SC18IS602_MODE_CPHA BIT(2) @@ -35,11 +35,12 @@ struct sc18is602 { u8 ctrl; u32 freq; u32 speed; + size_t bufsiz; /* Data buffer size */ =20 /* I2C data */ struct i2c_client *client; enum chips id; - u8 buffer[SC18IS602_BUFSIZ + 1]; + u8 buffer[SC18IS602_MAX_BUFSIZ + 1]; int tlen; /* Data queued for tx in buffer */ int rindex; /* Receive data index in buffer */ =20 @@ -99,7 +100,7 @@ static int sc18is602_txrx(struct sc18is602 *hw, struct s= pi_message *msg, } =20 if (do_transfer && hw->tlen > 1) { - ret =3D sc18is602_wait_ready(hw, SC18IS602_BUFSIZ); + ret =3D sc18is602_wait_ready(hw, hw->bufsiz); if (ret < 0) return ret; ret =3D i2c_master_send(hw->client, hw->buffer, hw->tlen); @@ -173,7 +174,9 @@ static int sc18is602_setup_transfer(struct sc18is602 *h= w, u32 hz, u8 mode) static int sc18is602_check_transfer(struct spi_device *spi, struct spi_transfer *t, int tlen) { - if (t && t->len + tlen > SC18IS602_BUFSIZ + 1) + struct sc18is602 *hw =3D spi_controller_get_devdata(spi->controller); + + if (t && t->len + tlen > hw->bufsiz + 1) return -EINVAL; =20 return 0; @@ -220,7 +223,9 @@ static int sc18is602_transfer_one(struct spi_controller= *host, =20 static size_t sc18is602_max_transfer_size(struct spi_device *spi) { - return SC18IS602_BUFSIZ; + struct sc18is602 *hw =3D spi_controller_get_devdata(spi->controller); + + return hw->bufsiz; } =20 static int sc18is602_setup(struct spi_device *spi) @@ -274,10 +279,12 @@ static int sc18is602_probe(struct i2c_client *client) case sc18is602: case sc18is602b: host->num_chipselect =3D 4; + hw->bufsiz =3D 200; hw->freq =3D SC18IS602_CLOCK; break; case sc18is603: host->num_chipselect =3D 2; + hw->bufsiz =3D 200; if (pdata) { hw->freq =3D pdata->clock_frequency; } else { @@ -291,6 +298,11 @@ static int sc18is602_probe(struct i2c_client *client) if (!hw->freq) hw->freq =3D SC18IS602_CLOCK; break; + case sc18is606: + host->num_chipselect =3D 3; + hw->bufsiz =3D 1024; + hw->freq =3D SC18IS602_CLOCK; + break; } host->bus_num =3D np ? -1 : client->adapter->nr; host->mode_bits =3D SPI_CPHA | SPI_CPOL | SPI_LSB_FIRST; @@ -310,6 +322,7 @@ static const struct i2c_device_id sc18is602_id[] =3D { { "sc18is602", sc18is602 }, { "sc18is602b", sc18is602b }, { "sc18is603", sc18is603 }, + { "sc18is606", sc18is606 }, { } }; MODULE_DEVICE_TABLE(i2c, sc18is602_id); @@ -327,6 +340,10 @@ static const struct of_device_id sc18is602_of_match[] = __maybe_unused =3D { .compatible =3D "nxp,sc18is603", .data =3D (void *)sc18is603 }, + { + .compatible =3D "nxp,sc18is606", + .data =3D (void *)sc18is606 + }, { }, }; MODULE_DEVICE_TABLE(of, sc18is602_of_match); --=20 2.44.0