* [PATCH 0/2] phy: add basic support for NXPs TJA1145 CAN transceiver
@ 2025-07-28 15:39 ` Dimitri Fedrau via B4 Relay
0 siblings, 0 replies; 15+ messages in thread
From: Dimitri Fedrau @ 2025-07-28 15:39 UTC (permalink / raw)
To: Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-phy, devicetree, linux-kernel, Dimitri Fedrau,
Dimitri Fedrau
Add basic driver support for NXPs TJA1145 CAN transceiver which brings the
PHY up/down by switching to normal/standby mode using SPI commands.
Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
---
Dimitri Fedrau (2):
dt-bindings: phy: add support for NXPs TJA1145 CAN transceiver
phy: add basic support for NXPs TJA1145 CAN transceiver
.../devicetree/bindings/phy/nxp,tja1145-can.yaml | 79 +++++++++
drivers/phy/Kconfig | 10 ++
drivers/phy/Makefile | 1 +
drivers/phy/phy-nxp-tja1145.c | 185 +++++++++++++++++++++
4 files changed, 275 insertions(+)
---
base-commit: 4a3556b81b99f0c8c0358f7cc6801a62b4538fe2
change-id: 20250726-tja1145-support-d6ccdc4d2da3
Best regards,
--
Dimitri Fedrau <dimitri.fedrau@liebherr.com>
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 0/2] phy: add basic support for NXPs TJA1145 CAN transceiver
@ 2025-07-28 15:39 ` Dimitri Fedrau via B4 Relay
0 siblings, 0 replies; 15+ messages in thread
From: Dimitri Fedrau via B4 Relay @ 2025-07-28 15:39 UTC (permalink / raw)
To: Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-phy, devicetree, linux-kernel, Dimitri Fedrau,
Dimitri Fedrau
Add basic driver support for NXPs TJA1145 CAN transceiver which brings the
PHY up/down by switching to normal/standby mode using SPI commands.
Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
---
Dimitri Fedrau (2):
dt-bindings: phy: add support for NXPs TJA1145 CAN transceiver
phy: add basic support for NXPs TJA1145 CAN transceiver
.../devicetree/bindings/phy/nxp,tja1145-can.yaml | 79 +++++++++
drivers/phy/Kconfig | 10 ++
drivers/phy/Makefile | 1 +
drivers/phy/phy-nxp-tja1145.c | 185 +++++++++++++++++++++
4 files changed, 275 insertions(+)
---
base-commit: 4a3556b81b99f0c8c0358f7cc6801a62b4538fe2
change-id: 20250726-tja1145-support-d6ccdc4d2da3
Best regards,
--
Dimitri Fedrau <dimitri.fedrau@liebherr.com>
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 0/2] phy: add basic support for NXPs TJA1145 CAN transceiver
@ 2025-07-28 15:39 ` Dimitri Fedrau via B4 Relay
0 siblings, 0 replies; 15+ messages in thread
From: Dimitri Fedrau via B4 Relay @ 2025-07-28 15:39 UTC (permalink / raw)
To: Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-phy, devicetree, linux-kernel, Dimitri Fedrau,
Dimitri Fedrau
Add basic driver support for NXPs TJA1145 CAN transceiver which brings the
PHY up/down by switching to normal/standby mode using SPI commands.
Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
---
Dimitri Fedrau (2):
dt-bindings: phy: add support for NXPs TJA1145 CAN transceiver
phy: add basic support for NXPs TJA1145 CAN transceiver
.../devicetree/bindings/phy/nxp,tja1145-can.yaml | 79 +++++++++
drivers/phy/Kconfig | 10 ++
drivers/phy/Makefile | 1 +
drivers/phy/phy-nxp-tja1145.c | 185 +++++++++++++++++++++
4 files changed, 275 insertions(+)
---
base-commit: 4a3556b81b99f0c8c0358f7cc6801a62b4538fe2
change-id: 20250726-tja1145-support-d6ccdc4d2da3
Best regards,
--
Dimitri Fedrau <dimitri.fedrau@liebherr.com>
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 1/2] dt-bindings: phy: add support for NXPs TJA1145 CAN transceiver
2025-07-28 15:39 ` Dimitri Fedrau via B4 Relay
(?)
@ 2025-07-28 15:39 ` Dimitri Fedrau via B4 Relay
-1 siblings, 0 replies; 15+ messages in thread
From: Dimitri Fedrau @ 2025-07-28 15:39 UTC (permalink / raw)
To: Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-phy, devicetree, linux-kernel, Dimitri Fedrau,
Dimitri Fedrau
Adding documentation for NXPs TJA1145 CAN transceiver.
Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
---
.../devicetree/bindings/phy/nxp,tja1145-can.yaml | 79 ++++++++++++++++++++++
1 file changed, 79 insertions(+)
diff --git a/Documentation/devicetree/bindings/phy/nxp,tja1145-can.yaml b/Documentation/devicetree/bindings/phy/nxp,tja1145-can.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..10bf2bce1b35788b3284c42e544a56eda6d79947
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/nxp,tja1145-can.yaml
@@ -0,0 +1,79 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/nxp,tja1145-can.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TJA1145 CAN transceiver
+
+maintainers:
+ - Dimitri Fedrau <dimitri.fedrau@liebherr.com>
+
+allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+properties:
+ compatible:
+ const: nxp,tja1145
+
+ "#phy-cells":
+ const: 0
+
+ reg:
+ maxItems: 1
+
+ spi-max-frequency:
+ maximum: 4000000
+
+ spi-cpha: true
+
+ spi-cs-setup-delay-ns:
+ minimum: 50
+ default: 50
+
+ spi-cs-hold-delay-ns:
+ minimum: 50
+ default: 50
+
+ spi-cs-inactive-delay-ns:
+ minimum: 250
+ default: 250
+
+ vcc-supply:
+ description:
+ CAN transceiver supply voltage
+
+ vio-supply:
+ description:
+ Supply voltage for I/O level adaptor
+
+ vbat-supply:
+ description:
+ Battery supply voltage
+
+required:
+ - compatible
+ - "#phy-cells"
+ - reg
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ spi {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ canphy@0 {
+ compatible = "nxp,tja1145";
+ #phy-cells = <0>;
+ reg = <0>;
+ spi-max-frequency = <4000000>;
+ spi-cpha;
+ spi-cs-setup-delay-ns = <50>;
+ spi-cs-hold-delay-ns = <50>;
+ spi-cs-inactive-delay-ns = <250>;
+ vcc-supply = <®_5v0>;
+ vio-supply = <®_3v3>;
+ vbat-supply = <®_24v0>;
+ };
+ };
--
2.39.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 1/2] dt-bindings: phy: add support for NXPs TJA1145 CAN transceiver
@ 2025-07-28 15:39 ` Dimitri Fedrau via B4 Relay
0 siblings, 0 replies; 15+ messages in thread
From: Dimitri Fedrau via B4 Relay @ 2025-07-28 15:39 UTC (permalink / raw)
To: Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-phy, devicetree, linux-kernel, Dimitri Fedrau,
Dimitri Fedrau
From: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
Adding documentation for NXPs TJA1145 CAN transceiver.
Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
---
.../devicetree/bindings/phy/nxp,tja1145-can.yaml | 79 ++++++++++++++++++++++
1 file changed, 79 insertions(+)
diff --git a/Documentation/devicetree/bindings/phy/nxp,tja1145-can.yaml b/Documentation/devicetree/bindings/phy/nxp,tja1145-can.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..10bf2bce1b35788b3284c42e544a56eda6d79947
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/nxp,tja1145-can.yaml
@@ -0,0 +1,79 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/nxp,tja1145-can.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TJA1145 CAN transceiver
+
+maintainers:
+ - Dimitri Fedrau <dimitri.fedrau@liebherr.com>
+
+allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+properties:
+ compatible:
+ const: nxp,tja1145
+
+ "#phy-cells":
+ const: 0
+
+ reg:
+ maxItems: 1
+
+ spi-max-frequency:
+ maximum: 4000000
+
+ spi-cpha: true
+
+ spi-cs-setup-delay-ns:
+ minimum: 50
+ default: 50
+
+ spi-cs-hold-delay-ns:
+ minimum: 50
+ default: 50
+
+ spi-cs-inactive-delay-ns:
+ minimum: 250
+ default: 250
+
+ vcc-supply:
+ description:
+ CAN transceiver supply voltage
+
+ vio-supply:
+ description:
+ Supply voltage for I/O level adaptor
+
+ vbat-supply:
+ description:
+ Battery supply voltage
+
+required:
+ - compatible
+ - "#phy-cells"
+ - reg
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ spi {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ canphy@0 {
+ compatible = "nxp,tja1145";
+ #phy-cells = <0>;
+ reg = <0>;
+ spi-max-frequency = <4000000>;
+ spi-cpha;
+ spi-cs-setup-delay-ns = <50>;
+ spi-cs-hold-delay-ns = <50>;
+ spi-cs-inactive-delay-ns = <250>;
+ vcc-supply = <®_5v0>;
+ vio-supply = <®_3v3>;
+ vbat-supply = <®_24v0>;
+ };
+ };
--
2.39.5
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 1/2] dt-bindings: phy: add support for NXPs TJA1145 CAN transceiver
@ 2025-07-28 15:39 ` Dimitri Fedrau via B4 Relay
0 siblings, 0 replies; 15+ messages in thread
From: Dimitri Fedrau via B4 Relay @ 2025-07-28 15:39 UTC (permalink / raw)
To: Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-phy, devicetree, linux-kernel, Dimitri Fedrau,
Dimitri Fedrau
From: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
Adding documentation for NXPs TJA1145 CAN transceiver.
Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
---
.../devicetree/bindings/phy/nxp,tja1145-can.yaml | 79 ++++++++++++++++++++++
1 file changed, 79 insertions(+)
diff --git a/Documentation/devicetree/bindings/phy/nxp,tja1145-can.yaml b/Documentation/devicetree/bindings/phy/nxp,tja1145-can.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..10bf2bce1b35788b3284c42e544a56eda6d79947
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/nxp,tja1145-can.yaml
@@ -0,0 +1,79 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/nxp,tja1145-can.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TJA1145 CAN transceiver
+
+maintainers:
+ - Dimitri Fedrau <dimitri.fedrau@liebherr.com>
+
+allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+properties:
+ compatible:
+ const: nxp,tja1145
+
+ "#phy-cells":
+ const: 0
+
+ reg:
+ maxItems: 1
+
+ spi-max-frequency:
+ maximum: 4000000
+
+ spi-cpha: true
+
+ spi-cs-setup-delay-ns:
+ minimum: 50
+ default: 50
+
+ spi-cs-hold-delay-ns:
+ minimum: 50
+ default: 50
+
+ spi-cs-inactive-delay-ns:
+ minimum: 250
+ default: 250
+
+ vcc-supply:
+ description:
+ CAN transceiver supply voltage
+
+ vio-supply:
+ description:
+ Supply voltage for I/O level adaptor
+
+ vbat-supply:
+ description:
+ Battery supply voltage
+
+required:
+ - compatible
+ - "#phy-cells"
+ - reg
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ spi {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ canphy@0 {
+ compatible = "nxp,tja1145";
+ #phy-cells = <0>;
+ reg = <0>;
+ spi-max-frequency = <4000000>;
+ spi-cpha;
+ spi-cs-setup-delay-ns = <50>;
+ spi-cs-hold-delay-ns = <50>;
+ spi-cs-inactive-delay-ns = <250>;
+ vcc-supply = <®_5v0>;
+ vio-supply = <®_3v3>;
+ vbat-supply = <®_24v0>;
+ };
+ };
--
2.39.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 2/2] phy: add basic support for NXPs TJA1145 CAN transceiver
2025-07-28 15:39 ` Dimitri Fedrau via B4 Relay
(?)
@ 2025-07-28 15:39 ` Dimitri Fedrau via B4 Relay
-1 siblings, 0 replies; 15+ messages in thread
From: Dimitri Fedrau @ 2025-07-28 15:39 UTC (permalink / raw)
To: Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-phy, devicetree, linux-kernel, Dimitri Fedrau,
Dimitri Fedrau
Add basic driver support for NXPs TJA1145 CAN transceiver which brings the
PHY up/down by switching to normal/standby mode using SPI commands.
Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
---
drivers/phy/Kconfig | 10 +++
drivers/phy/Makefile | 1 +
drivers/phy/phy-nxp-tja1145.c | 185 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 196 insertions(+)
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 58c911e1b2d20a0398f02550e938ce62633230d4..c47e2b62fa6279ee610493b028d3c14f6499ca85 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -101,6 +101,16 @@ config PHY_NXP_PTN3222
schemes. It supports all three USB 2.0 data rates: Low Speed, Full
Speed and High Speed.
+config PHY_NXP_TJA1145
+ tristate "NXP TJA1145 CAN transceiver PHY"
+ select GENERIC_PHY
+ select REGMAP_SPI
+ depends on SPI
+ help
+ This option enables support for NXPs TJA1145 CAN transceiver as a PHY.
+ This driver provides function for putting the transceiver in various
+ functional modes using SPI commands.
+
source "drivers/phy/allwinner/Kconfig"
source "drivers/phy/amlogic/Kconfig"
source "drivers/phy/broadcom/Kconfig"
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index c670a8dac46807863c9ef990beb149082238ad16..16da564c74b0f14befb486366dcd10cd5fc67741 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -13,6 +13,7 @@ obj-$(CONFIG_PHY_SNPS_EUSB2) += phy-snps-eusb2.o
obj-$(CONFIG_USB_LGM_PHY) += phy-lgm-usb.o
obj-$(CONFIG_PHY_AIROHA_PCIE) += phy-airoha-pcie.o
obj-$(CONFIG_PHY_NXP_PTN3222) += phy-nxp-ptn3222.o
+obj-$(CONFIG_PHY_NXP_TJA1145) += phy-nxp-tja1145.o
obj-y += allwinner/ \
amlogic/ \
broadcom/ \
diff --git a/drivers/phy/phy-nxp-tja1145.c b/drivers/phy/phy-nxp-tja1145.c
new file mode 100644
index 0000000000000000000000000000000000000000..fa8f588f84913ec3d49533d7be540b3d61b6b304
--- /dev/null
+++ b/drivers/phy/phy-nxp-tja1145.c
@@ -0,0 +1,185 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2025 Liebherr-Electronics and Drives GmbH
+ */
+#include <linux/bitfield.h>
+#include <linux/module.h>
+#include <linux/regmap.h>
+
+#include <linux/phy/phy.h>
+#include <linux/spi/spi.h>
+
+#define TJA1145_MODE_CTRL 0x01
+#define TJA1145_MODE_CTRL_MC GENMASK(2, 0)
+#define TJA1145_MODE_CRTL_STBY BIT(2)
+#define TJA1145_MODE_CRTL_NORMAL TJA1145_MODE_CTRL_MC
+
+#define TJA1145_CAN_CTRL 0x20
+#define TJA1145_CAN_CTRL_CMC GENMASK(1, 0)
+#define TJA1145_CAN_CTRL_ACTIVE BIT(1)
+
+#define TJA1145_IDENT 0x7e
+#define TJA1145_IDENT_TJA1145T 0x70
+
+#define TJA1145_SPI_READ_BIT BIT(0)
+#define TJA1145T_MAX_BITRATE 1000000
+
+static int tja1145_phy_power_on(struct phy *phy)
+{
+ struct regmap *map = phy_get_drvdata(phy);
+ int ret;
+
+ /*
+ * Switch operating mode to normal which is the active operating mode.
+ * In this mode, the device is fully operational.
+ */
+ ret = regmap_update_bits(map, TJA1145_MODE_CTRL, TJA1145_MODE_CTRL_MC,
+ TJA1145_MODE_CRTL_NORMAL);
+ if (ret)
+ return ret;
+
+ /*
+ * Switch to CAN operating mode active where the PHY can transmit and
+ * receive data.
+ */
+ return regmap_update_bits(map, TJA1145_CAN_CTRL, TJA1145_CAN_CTRL_CMC,
+ TJA1145_CAN_CTRL_ACTIVE);
+}
+
+static int tja1145_phy_power_off(struct phy *phy)
+{
+ struct regmap *map = phy_get_drvdata(phy);
+
+ /*
+ * Switch to operating mode standby, the PHY is unable to transmit or
+ * receive data in standby mode.
+ */
+ return regmap_update_bits(map, TJA1145_MODE_CTRL, TJA1145_MODE_CTRL_MC,
+ TJA1145_MODE_CRTL_STBY);
+}
+
+static const struct phy_ops tja1145_phy_ops = {
+ .power_on = tja1145_phy_power_on,
+ .power_off = tja1145_phy_power_off,
+};
+
+static const struct regmap_range tja1145_wr_holes_ranges[] = {
+ regmap_reg_range(0x00, 0x00),
+ regmap_reg_range(0x02, 0x03),
+ regmap_reg_range(0x05, 0x05),
+ regmap_reg_range(0x0b, 0x1f),
+ regmap_reg_range(0x21, 0x22),
+ regmap_reg_range(0x24, 0x25),
+ regmap_reg_range(0x30, 0x4b),
+ regmap_reg_range(0x4d, 0x60),
+ regmap_reg_range(0x62, 0x62),
+ regmap_reg_range(0x65, 0x67),
+ regmap_reg_range(0x70, 0xff),
+};
+
+static const struct regmap_access_table tja1145_wr_table = {
+ .no_ranges = tja1145_wr_holes_ranges,
+ .n_no_ranges = ARRAY_SIZE(tja1145_wr_holes_ranges),
+};
+
+static const struct regmap_range tja1145_rd_holes_ranges[] = {
+ regmap_reg_range(0x00, 0x00),
+ regmap_reg_range(0x02, 0x02),
+ regmap_reg_range(0x05, 0x05),
+ regmap_reg_range(0x0b, 0x1f),
+ regmap_reg_range(0x21, 0x21),
+ regmap_reg_range(0x24, 0x25),
+ regmap_reg_range(0x30, 0x4a),
+ regmap_reg_range(0x4d, 0x5f),
+ regmap_reg_range(0x62, 0x62),
+ regmap_reg_range(0x65, 0x67),
+ regmap_reg_range(0x70, 0x7d),
+ regmap_reg_range(0x7f, 0xff),
+};
+
+static const struct regmap_access_table tja1145_rd_table = {
+ .no_ranges = tja1145_rd_holes_ranges,
+ .n_no_ranges = ARRAY_SIZE(tja1145_rd_holes_ranges),
+};
+
+
+static const struct regmap_config tja1145_regmap_config = {
+ .reg_bits = 8,
+ .reg_shift = -1,
+ .val_bits = 8,
+ .wr_table = &tja1145_wr_table,
+ .rd_table = &tja1145_rd_table,
+ .read_flag_mask = TJA1145_SPI_READ_BIT,
+ .max_register = TJA1145_IDENT,
+};
+
+static int tja1145_check_ident(struct device *dev, struct regmap *map)
+{
+ unsigned int val;
+ int ret;
+
+ ret = regmap_read(map, TJA1145_IDENT, &val);
+ if (ret)
+ return ret;
+
+ if (val != TJA1145_IDENT_TJA1145T) {
+ dev_err(dev, "Expected device id: 0x%02x, got: 0x%02x\n",
+ TJA1145_IDENT_TJA1145T, val);
+ return -ENODEV;
+ }
+
+ return 0;
+}
+
+static int tja1145_probe(struct spi_device *spi)
+{
+ struct phy_provider *phy_provider;
+ struct device *dev = &spi->dev;
+ struct regmap *map;
+ struct phy *phy;
+ int ret;
+
+ map = devm_regmap_init_spi(spi, &tja1145_regmap_config);
+ if (IS_ERR(map))
+ return dev_err_probe(dev, PTR_ERR(map), "failed to init regmap\n");
+
+ ret = tja1145_check_ident(dev, map);
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to identify device\n");
+
+ phy = devm_phy_create(dev, dev->of_node, &tja1145_phy_ops);
+ if (IS_ERR(phy))
+ return dev_err_probe(dev, PTR_ERR(phy), "failed to create PHY\n");
+
+ phy->attrs.max_link_rate = TJA1145T_MAX_BITRATE;
+ phy_set_drvdata(phy, map);
+ phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
+
+ return PTR_ERR_OR_ZERO(phy_provider);
+}
+
+static const struct spi_device_id tja1145_spi_id[] = {
+ { "tja1145" },
+ { }
+};
+MODULE_DEVICE_TABLE(spi, tja1145_spi_id);
+
+static const struct of_device_id tja1145_of_match[] = {
+ { .compatible = "nxp,tja1145" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, tja1145_of_match);
+
+static struct spi_driver tja1145_driver = {
+ .driver = {
+ .name = "tja1145",
+ .of_match_table = tja1145_of_match,
+ },
+ .probe = tja1145_probe,
+ .id_table = tja1145_spi_id,
+};
+module_spi_driver(tja1145_driver);
+
+MODULE_DESCRIPTION("NXP TJA1145 CAN transceiver PHY driver");
+MODULE_AUTHOR("Dimitri Fedrau <dimitri.fedrau@liebherr.com>");
+MODULE_LICENSE("GPL");
--
2.39.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 2/2] phy: add basic support for NXPs TJA1145 CAN transceiver
@ 2025-07-28 15:39 ` Dimitri Fedrau via B4 Relay
0 siblings, 0 replies; 15+ messages in thread
From: Dimitri Fedrau via B4 Relay @ 2025-07-28 15:39 UTC (permalink / raw)
To: Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-phy, devicetree, linux-kernel, Dimitri Fedrau,
Dimitri Fedrau
From: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
Add basic driver support for NXPs TJA1145 CAN transceiver which brings the
PHY up/down by switching to normal/standby mode using SPI commands.
Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
---
drivers/phy/Kconfig | 10 +++
drivers/phy/Makefile | 1 +
drivers/phy/phy-nxp-tja1145.c | 185 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 196 insertions(+)
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 58c911e1b2d20a0398f02550e938ce62633230d4..c47e2b62fa6279ee610493b028d3c14f6499ca85 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -101,6 +101,16 @@ config PHY_NXP_PTN3222
schemes. It supports all three USB 2.0 data rates: Low Speed, Full
Speed and High Speed.
+config PHY_NXP_TJA1145
+ tristate "NXP TJA1145 CAN transceiver PHY"
+ select GENERIC_PHY
+ select REGMAP_SPI
+ depends on SPI
+ help
+ This option enables support for NXPs TJA1145 CAN transceiver as a PHY.
+ This driver provides function for putting the transceiver in various
+ functional modes using SPI commands.
+
source "drivers/phy/allwinner/Kconfig"
source "drivers/phy/amlogic/Kconfig"
source "drivers/phy/broadcom/Kconfig"
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index c670a8dac46807863c9ef990beb149082238ad16..16da564c74b0f14befb486366dcd10cd5fc67741 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -13,6 +13,7 @@ obj-$(CONFIG_PHY_SNPS_EUSB2) += phy-snps-eusb2.o
obj-$(CONFIG_USB_LGM_PHY) += phy-lgm-usb.o
obj-$(CONFIG_PHY_AIROHA_PCIE) += phy-airoha-pcie.o
obj-$(CONFIG_PHY_NXP_PTN3222) += phy-nxp-ptn3222.o
+obj-$(CONFIG_PHY_NXP_TJA1145) += phy-nxp-tja1145.o
obj-y += allwinner/ \
amlogic/ \
broadcom/ \
diff --git a/drivers/phy/phy-nxp-tja1145.c b/drivers/phy/phy-nxp-tja1145.c
new file mode 100644
index 0000000000000000000000000000000000000000..fa8f588f84913ec3d49533d7be540b3d61b6b304
--- /dev/null
+++ b/drivers/phy/phy-nxp-tja1145.c
@@ -0,0 +1,185 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2025 Liebherr-Electronics and Drives GmbH
+ */
+#include <linux/bitfield.h>
+#include <linux/module.h>
+#include <linux/regmap.h>
+
+#include <linux/phy/phy.h>
+#include <linux/spi/spi.h>
+
+#define TJA1145_MODE_CTRL 0x01
+#define TJA1145_MODE_CTRL_MC GENMASK(2, 0)
+#define TJA1145_MODE_CRTL_STBY BIT(2)
+#define TJA1145_MODE_CRTL_NORMAL TJA1145_MODE_CTRL_MC
+
+#define TJA1145_CAN_CTRL 0x20
+#define TJA1145_CAN_CTRL_CMC GENMASK(1, 0)
+#define TJA1145_CAN_CTRL_ACTIVE BIT(1)
+
+#define TJA1145_IDENT 0x7e
+#define TJA1145_IDENT_TJA1145T 0x70
+
+#define TJA1145_SPI_READ_BIT BIT(0)
+#define TJA1145T_MAX_BITRATE 1000000
+
+static int tja1145_phy_power_on(struct phy *phy)
+{
+ struct regmap *map = phy_get_drvdata(phy);
+ int ret;
+
+ /*
+ * Switch operating mode to normal which is the active operating mode.
+ * In this mode, the device is fully operational.
+ */
+ ret = regmap_update_bits(map, TJA1145_MODE_CTRL, TJA1145_MODE_CTRL_MC,
+ TJA1145_MODE_CRTL_NORMAL);
+ if (ret)
+ return ret;
+
+ /*
+ * Switch to CAN operating mode active where the PHY can transmit and
+ * receive data.
+ */
+ return regmap_update_bits(map, TJA1145_CAN_CTRL, TJA1145_CAN_CTRL_CMC,
+ TJA1145_CAN_CTRL_ACTIVE);
+}
+
+static int tja1145_phy_power_off(struct phy *phy)
+{
+ struct regmap *map = phy_get_drvdata(phy);
+
+ /*
+ * Switch to operating mode standby, the PHY is unable to transmit or
+ * receive data in standby mode.
+ */
+ return regmap_update_bits(map, TJA1145_MODE_CTRL, TJA1145_MODE_CTRL_MC,
+ TJA1145_MODE_CRTL_STBY);
+}
+
+static const struct phy_ops tja1145_phy_ops = {
+ .power_on = tja1145_phy_power_on,
+ .power_off = tja1145_phy_power_off,
+};
+
+static const struct regmap_range tja1145_wr_holes_ranges[] = {
+ regmap_reg_range(0x00, 0x00),
+ regmap_reg_range(0x02, 0x03),
+ regmap_reg_range(0x05, 0x05),
+ regmap_reg_range(0x0b, 0x1f),
+ regmap_reg_range(0x21, 0x22),
+ regmap_reg_range(0x24, 0x25),
+ regmap_reg_range(0x30, 0x4b),
+ regmap_reg_range(0x4d, 0x60),
+ regmap_reg_range(0x62, 0x62),
+ regmap_reg_range(0x65, 0x67),
+ regmap_reg_range(0x70, 0xff),
+};
+
+static const struct regmap_access_table tja1145_wr_table = {
+ .no_ranges = tja1145_wr_holes_ranges,
+ .n_no_ranges = ARRAY_SIZE(tja1145_wr_holes_ranges),
+};
+
+static const struct regmap_range tja1145_rd_holes_ranges[] = {
+ regmap_reg_range(0x00, 0x00),
+ regmap_reg_range(0x02, 0x02),
+ regmap_reg_range(0x05, 0x05),
+ regmap_reg_range(0x0b, 0x1f),
+ regmap_reg_range(0x21, 0x21),
+ regmap_reg_range(0x24, 0x25),
+ regmap_reg_range(0x30, 0x4a),
+ regmap_reg_range(0x4d, 0x5f),
+ regmap_reg_range(0x62, 0x62),
+ regmap_reg_range(0x65, 0x67),
+ regmap_reg_range(0x70, 0x7d),
+ regmap_reg_range(0x7f, 0xff),
+};
+
+static const struct regmap_access_table tja1145_rd_table = {
+ .no_ranges = tja1145_rd_holes_ranges,
+ .n_no_ranges = ARRAY_SIZE(tja1145_rd_holes_ranges),
+};
+
+
+static const struct regmap_config tja1145_regmap_config = {
+ .reg_bits = 8,
+ .reg_shift = -1,
+ .val_bits = 8,
+ .wr_table = &tja1145_wr_table,
+ .rd_table = &tja1145_rd_table,
+ .read_flag_mask = TJA1145_SPI_READ_BIT,
+ .max_register = TJA1145_IDENT,
+};
+
+static int tja1145_check_ident(struct device *dev, struct regmap *map)
+{
+ unsigned int val;
+ int ret;
+
+ ret = regmap_read(map, TJA1145_IDENT, &val);
+ if (ret)
+ return ret;
+
+ if (val != TJA1145_IDENT_TJA1145T) {
+ dev_err(dev, "Expected device id: 0x%02x, got: 0x%02x\n",
+ TJA1145_IDENT_TJA1145T, val);
+ return -ENODEV;
+ }
+
+ return 0;
+}
+
+static int tja1145_probe(struct spi_device *spi)
+{
+ struct phy_provider *phy_provider;
+ struct device *dev = &spi->dev;
+ struct regmap *map;
+ struct phy *phy;
+ int ret;
+
+ map = devm_regmap_init_spi(spi, &tja1145_regmap_config);
+ if (IS_ERR(map))
+ return dev_err_probe(dev, PTR_ERR(map), "failed to init regmap\n");
+
+ ret = tja1145_check_ident(dev, map);
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to identify device\n");
+
+ phy = devm_phy_create(dev, dev->of_node, &tja1145_phy_ops);
+ if (IS_ERR(phy))
+ return dev_err_probe(dev, PTR_ERR(phy), "failed to create PHY\n");
+
+ phy->attrs.max_link_rate = TJA1145T_MAX_BITRATE;
+ phy_set_drvdata(phy, map);
+ phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
+
+ return PTR_ERR_OR_ZERO(phy_provider);
+}
+
+static const struct spi_device_id tja1145_spi_id[] = {
+ { "tja1145" },
+ { }
+};
+MODULE_DEVICE_TABLE(spi, tja1145_spi_id);
+
+static const struct of_device_id tja1145_of_match[] = {
+ { .compatible = "nxp,tja1145" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, tja1145_of_match);
+
+static struct spi_driver tja1145_driver = {
+ .driver = {
+ .name = "tja1145",
+ .of_match_table = tja1145_of_match,
+ },
+ .probe = tja1145_probe,
+ .id_table = tja1145_spi_id,
+};
+module_spi_driver(tja1145_driver);
+
+MODULE_DESCRIPTION("NXP TJA1145 CAN transceiver PHY driver");
+MODULE_AUTHOR("Dimitri Fedrau <dimitri.fedrau@liebherr.com>");
+MODULE_LICENSE("GPL");
--
2.39.5
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 2/2] phy: add basic support for NXPs TJA1145 CAN transceiver
@ 2025-07-28 15:39 ` Dimitri Fedrau via B4 Relay
0 siblings, 0 replies; 15+ messages in thread
From: Dimitri Fedrau via B4 Relay @ 2025-07-28 15:39 UTC (permalink / raw)
To: Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-phy, devicetree, linux-kernel, Dimitri Fedrau,
Dimitri Fedrau
From: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
Add basic driver support for NXPs TJA1145 CAN transceiver which brings the
PHY up/down by switching to normal/standby mode using SPI commands.
Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
---
drivers/phy/Kconfig | 10 +++
drivers/phy/Makefile | 1 +
drivers/phy/phy-nxp-tja1145.c | 185 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 196 insertions(+)
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 58c911e1b2d20a0398f02550e938ce62633230d4..c47e2b62fa6279ee610493b028d3c14f6499ca85 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -101,6 +101,16 @@ config PHY_NXP_PTN3222
schemes. It supports all three USB 2.0 data rates: Low Speed, Full
Speed and High Speed.
+config PHY_NXP_TJA1145
+ tristate "NXP TJA1145 CAN transceiver PHY"
+ select GENERIC_PHY
+ select REGMAP_SPI
+ depends on SPI
+ help
+ This option enables support for NXPs TJA1145 CAN transceiver as a PHY.
+ This driver provides function for putting the transceiver in various
+ functional modes using SPI commands.
+
source "drivers/phy/allwinner/Kconfig"
source "drivers/phy/amlogic/Kconfig"
source "drivers/phy/broadcom/Kconfig"
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index c670a8dac46807863c9ef990beb149082238ad16..16da564c74b0f14befb486366dcd10cd5fc67741 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -13,6 +13,7 @@ obj-$(CONFIG_PHY_SNPS_EUSB2) += phy-snps-eusb2.o
obj-$(CONFIG_USB_LGM_PHY) += phy-lgm-usb.o
obj-$(CONFIG_PHY_AIROHA_PCIE) += phy-airoha-pcie.o
obj-$(CONFIG_PHY_NXP_PTN3222) += phy-nxp-ptn3222.o
+obj-$(CONFIG_PHY_NXP_TJA1145) += phy-nxp-tja1145.o
obj-y += allwinner/ \
amlogic/ \
broadcom/ \
diff --git a/drivers/phy/phy-nxp-tja1145.c b/drivers/phy/phy-nxp-tja1145.c
new file mode 100644
index 0000000000000000000000000000000000000000..fa8f588f84913ec3d49533d7be540b3d61b6b304
--- /dev/null
+++ b/drivers/phy/phy-nxp-tja1145.c
@@ -0,0 +1,185 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2025 Liebherr-Electronics and Drives GmbH
+ */
+#include <linux/bitfield.h>
+#include <linux/module.h>
+#include <linux/regmap.h>
+
+#include <linux/phy/phy.h>
+#include <linux/spi/spi.h>
+
+#define TJA1145_MODE_CTRL 0x01
+#define TJA1145_MODE_CTRL_MC GENMASK(2, 0)
+#define TJA1145_MODE_CRTL_STBY BIT(2)
+#define TJA1145_MODE_CRTL_NORMAL TJA1145_MODE_CTRL_MC
+
+#define TJA1145_CAN_CTRL 0x20
+#define TJA1145_CAN_CTRL_CMC GENMASK(1, 0)
+#define TJA1145_CAN_CTRL_ACTIVE BIT(1)
+
+#define TJA1145_IDENT 0x7e
+#define TJA1145_IDENT_TJA1145T 0x70
+
+#define TJA1145_SPI_READ_BIT BIT(0)
+#define TJA1145T_MAX_BITRATE 1000000
+
+static int tja1145_phy_power_on(struct phy *phy)
+{
+ struct regmap *map = phy_get_drvdata(phy);
+ int ret;
+
+ /*
+ * Switch operating mode to normal which is the active operating mode.
+ * In this mode, the device is fully operational.
+ */
+ ret = regmap_update_bits(map, TJA1145_MODE_CTRL, TJA1145_MODE_CTRL_MC,
+ TJA1145_MODE_CRTL_NORMAL);
+ if (ret)
+ return ret;
+
+ /*
+ * Switch to CAN operating mode active where the PHY can transmit and
+ * receive data.
+ */
+ return regmap_update_bits(map, TJA1145_CAN_CTRL, TJA1145_CAN_CTRL_CMC,
+ TJA1145_CAN_CTRL_ACTIVE);
+}
+
+static int tja1145_phy_power_off(struct phy *phy)
+{
+ struct regmap *map = phy_get_drvdata(phy);
+
+ /*
+ * Switch to operating mode standby, the PHY is unable to transmit or
+ * receive data in standby mode.
+ */
+ return regmap_update_bits(map, TJA1145_MODE_CTRL, TJA1145_MODE_CTRL_MC,
+ TJA1145_MODE_CRTL_STBY);
+}
+
+static const struct phy_ops tja1145_phy_ops = {
+ .power_on = tja1145_phy_power_on,
+ .power_off = tja1145_phy_power_off,
+};
+
+static const struct regmap_range tja1145_wr_holes_ranges[] = {
+ regmap_reg_range(0x00, 0x00),
+ regmap_reg_range(0x02, 0x03),
+ regmap_reg_range(0x05, 0x05),
+ regmap_reg_range(0x0b, 0x1f),
+ regmap_reg_range(0x21, 0x22),
+ regmap_reg_range(0x24, 0x25),
+ regmap_reg_range(0x30, 0x4b),
+ regmap_reg_range(0x4d, 0x60),
+ regmap_reg_range(0x62, 0x62),
+ regmap_reg_range(0x65, 0x67),
+ regmap_reg_range(0x70, 0xff),
+};
+
+static const struct regmap_access_table tja1145_wr_table = {
+ .no_ranges = tja1145_wr_holes_ranges,
+ .n_no_ranges = ARRAY_SIZE(tja1145_wr_holes_ranges),
+};
+
+static const struct regmap_range tja1145_rd_holes_ranges[] = {
+ regmap_reg_range(0x00, 0x00),
+ regmap_reg_range(0x02, 0x02),
+ regmap_reg_range(0x05, 0x05),
+ regmap_reg_range(0x0b, 0x1f),
+ regmap_reg_range(0x21, 0x21),
+ regmap_reg_range(0x24, 0x25),
+ regmap_reg_range(0x30, 0x4a),
+ regmap_reg_range(0x4d, 0x5f),
+ regmap_reg_range(0x62, 0x62),
+ regmap_reg_range(0x65, 0x67),
+ regmap_reg_range(0x70, 0x7d),
+ regmap_reg_range(0x7f, 0xff),
+};
+
+static const struct regmap_access_table tja1145_rd_table = {
+ .no_ranges = tja1145_rd_holes_ranges,
+ .n_no_ranges = ARRAY_SIZE(tja1145_rd_holes_ranges),
+};
+
+
+static const struct regmap_config tja1145_regmap_config = {
+ .reg_bits = 8,
+ .reg_shift = -1,
+ .val_bits = 8,
+ .wr_table = &tja1145_wr_table,
+ .rd_table = &tja1145_rd_table,
+ .read_flag_mask = TJA1145_SPI_READ_BIT,
+ .max_register = TJA1145_IDENT,
+};
+
+static int tja1145_check_ident(struct device *dev, struct regmap *map)
+{
+ unsigned int val;
+ int ret;
+
+ ret = regmap_read(map, TJA1145_IDENT, &val);
+ if (ret)
+ return ret;
+
+ if (val != TJA1145_IDENT_TJA1145T) {
+ dev_err(dev, "Expected device id: 0x%02x, got: 0x%02x\n",
+ TJA1145_IDENT_TJA1145T, val);
+ return -ENODEV;
+ }
+
+ return 0;
+}
+
+static int tja1145_probe(struct spi_device *spi)
+{
+ struct phy_provider *phy_provider;
+ struct device *dev = &spi->dev;
+ struct regmap *map;
+ struct phy *phy;
+ int ret;
+
+ map = devm_regmap_init_spi(spi, &tja1145_regmap_config);
+ if (IS_ERR(map))
+ return dev_err_probe(dev, PTR_ERR(map), "failed to init regmap\n");
+
+ ret = tja1145_check_ident(dev, map);
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to identify device\n");
+
+ phy = devm_phy_create(dev, dev->of_node, &tja1145_phy_ops);
+ if (IS_ERR(phy))
+ return dev_err_probe(dev, PTR_ERR(phy), "failed to create PHY\n");
+
+ phy->attrs.max_link_rate = TJA1145T_MAX_BITRATE;
+ phy_set_drvdata(phy, map);
+ phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
+
+ return PTR_ERR_OR_ZERO(phy_provider);
+}
+
+static const struct spi_device_id tja1145_spi_id[] = {
+ { "tja1145" },
+ { }
+};
+MODULE_DEVICE_TABLE(spi, tja1145_spi_id);
+
+static const struct of_device_id tja1145_of_match[] = {
+ { .compatible = "nxp,tja1145" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, tja1145_of_match);
+
+static struct spi_driver tja1145_driver = {
+ .driver = {
+ .name = "tja1145",
+ .of_match_table = tja1145_of_match,
+ },
+ .probe = tja1145_probe,
+ .id_table = tja1145_spi_id,
+};
+module_spi_driver(tja1145_driver);
+
+MODULE_DESCRIPTION("NXP TJA1145 CAN transceiver PHY driver");
+MODULE_AUTHOR("Dimitri Fedrau <dimitri.fedrau@liebherr.com>");
+MODULE_LICENSE("GPL");
--
2.39.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] dt-bindings: phy: add support for NXPs TJA1145 CAN transceiver
2025-07-28 15:39 ` Dimitri Fedrau via B4 Relay
@ 2025-07-30 7:35 ` Krzysztof Kozlowski
-1 siblings, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2025-07-30 7:35 UTC (permalink / raw)
To: Dimitri Fedrau
Cc: Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-phy, devicetree,
linux-kernel, Dimitri Fedrau
On Mon, Jul 28, 2025 at 05:39:29PM +0200, Dimitri Fedrau wrote:
> Adding documentation for NXPs TJA1145 CAN transceiver.
>
> Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> ---
> .../devicetree/bindings/phy/nxp,tja1145-can.yaml | 79 ++++++++++++++++++++++
Why isn't this in can directory with rest of CAN bindings?
> 1 file changed, 79 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/phy/nxp,tja1145-can.yaml b/Documentation/devicetree/bindings/phy/nxp,tja1145-can.yaml
> new file mode 100644
> index 0000000000000000000000000000000000000000..10bf2bce1b35788b3284c42e544a56eda6d79947
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/phy/nxp,tja1145-can.yaml
Filename should match compatible.
> @@ -0,0 +1,79 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/phy/nxp,tja1145-can.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: TJA1145 CAN transceiver
> +
> +maintainers:
> + - Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> +
> +allOf:
> + - $ref: /schemas/spi/spi-peripheral-props.yaml#
Missing ref to transceiver properties. Look at other CAN bindings.
> +
> +properties:
> + compatible:
> + const: nxp,tja1145
> +
> + "#phy-cells":
> + const: 0
> +
> + reg:
> + maxItems: 1
reg is the second property, also in "required:" block.
> +
> + spi-max-frequency:
> + maximum: 4000000
> +
> + spi-cpha: true
> +
> + spi-cs-setup-delay-ns:
> + minimum: 50
> + default: 50
> +
> + spi-cs-hold-delay-ns:
> + minimum: 50
> + default: 50
> +
> + spi-cs-inactive-delay-ns:
> + minimum: 250
> + default: 250
> +
> + vcc-supply:
> + description:
> + CAN transceiver supply voltage
> +
> + vio-supply:
> + description:
> + Supply voltage for I/O level adaptor
> +
> + vbat-supply:
> + description:
> + Battery supply voltage
> +
> +required:
> + - compatible
> + - "#phy-cells"
> + - reg
> +
> +unevaluatedProperties: false
> +
> +examples:
> + - |
> + spi {
> + #address-cells = <1>;
> + #size-cells = <0>;
> + canphy@0 {
can-phy if something like this exist. If not, then probably can-transceiver
> + compatible = "nxp,tja1145";
> + #phy-cells = <0>;
> + reg = <0>;
Please follow DTS coding style.
Best regards,
Krzysztof
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] dt-bindings: phy: add support for NXPs TJA1145 CAN transceiver
@ 2025-07-30 7:35 ` Krzysztof Kozlowski
0 siblings, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2025-07-30 7:35 UTC (permalink / raw)
To: Dimitri Fedrau
Cc: Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-phy, devicetree,
linux-kernel, Dimitri Fedrau
On Mon, Jul 28, 2025 at 05:39:29PM +0200, Dimitri Fedrau wrote:
> Adding documentation for NXPs TJA1145 CAN transceiver.
>
> Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> ---
> .../devicetree/bindings/phy/nxp,tja1145-can.yaml | 79 ++++++++++++++++++++++
Why isn't this in can directory with rest of CAN bindings?
> 1 file changed, 79 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/phy/nxp,tja1145-can.yaml b/Documentation/devicetree/bindings/phy/nxp,tja1145-can.yaml
> new file mode 100644
> index 0000000000000000000000000000000000000000..10bf2bce1b35788b3284c42e544a56eda6d79947
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/phy/nxp,tja1145-can.yaml
Filename should match compatible.
> @@ -0,0 +1,79 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/phy/nxp,tja1145-can.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: TJA1145 CAN transceiver
> +
> +maintainers:
> + - Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> +
> +allOf:
> + - $ref: /schemas/spi/spi-peripheral-props.yaml#
Missing ref to transceiver properties. Look at other CAN bindings.
> +
> +properties:
> + compatible:
> + const: nxp,tja1145
> +
> + "#phy-cells":
> + const: 0
> +
> + reg:
> + maxItems: 1
reg is the second property, also in "required:" block.
> +
> + spi-max-frequency:
> + maximum: 4000000
> +
> + spi-cpha: true
> +
> + spi-cs-setup-delay-ns:
> + minimum: 50
> + default: 50
> +
> + spi-cs-hold-delay-ns:
> + minimum: 50
> + default: 50
> +
> + spi-cs-inactive-delay-ns:
> + minimum: 250
> + default: 250
> +
> + vcc-supply:
> + description:
> + CAN transceiver supply voltage
> +
> + vio-supply:
> + description:
> + Supply voltage for I/O level adaptor
> +
> + vbat-supply:
> + description:
> + Battery supply voltage
> +
> +required:
> + - compatible
> + - "#phy-cells"
> + - reg
> +
> +unevaluatedProperties: false
> +
> +examples:
> + - |
> + spi {
> + #address-cells = <1>;
> + #size-cells = <0>;
> + canphy@0 {
can-phy if something like this exist. If not, then probably can-transceiver
> + compatible = "nxp,tja1145";
> + #phy-cells = <0>;
> + reg = <0>;
Please follow DTS coding style.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] dt-bindings: phy: add support for NXPs TJA1145 CAN transceiver
2025-07-30 7:35 ` Krzysztof Kozlowski
@ 2025-07-31 4:48 ` Dimitri Fedrau
-1 siblings, 0 replies; 15+ messages in thread
From: Dimitri Fedrau @ 2025-07-31 4:48 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Dimitri Fedrau, Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-phy, devicetree,
linux-kernel
Hi Krzysztof,
Am Wed, Jul 30, 2025 at 09:35:12AM +0200 schrieb Krzysztof Kozlowski:
> On Mon, Jul 28, 2025 at 05:39:29PM +0200, Dimitri Fedrau wrote:
> > Adding documentation for NXPs TJA1145 CAN transceiver.
> >
> > Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> > ---
> > .../devicetree/bindings/phy/nxp,tja1145-can.yaml | 79 ++++++++++++++++++++++
>
> Why isn't this in can directory with rest of CAN bindings?
>
The directory contains CAN controller bindings. This is a CAN transceiver
binding. And the only CAN transceiver binding I could find so far is this:
https://elixir.bootlin.com/linux/v6.16/source/Documentation/devicetree/bindings/phy/ti,tcan104x-can.yaml
The driver uses the generic PHY framework as the driver for the tja1145
does.
> > 1 file changed, 79 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/phy/nxp,tja1145-can.yaml b/Documentation/devicetree/bindings/phy/nxp,tja1145-can.yaml
> > new file mode 100644
> > index 0000000000000000000000000000000000000000..10bf2bce1b35788b3284c42e544a56eda6d79947
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/phy/nxp,tja1145-can.yaml
>
> Filename should match compatible.
>
Ok, will fix this.
> > @@ -0,0 +1,79 @@
> > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/phy/nxp,tja1145-can.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: TJA1145 CAN transceiver
> > +
> > +maintainers:
> > + - Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> > +
> > +allOf:
> > + - $ref: /schemas/spi/spi-peripheral-props.yaml#
>
> Missing ref to transceiver properties. Look at other CAN bindings.
>
There is only one transceiver property(max-bitrate) which I don't need
because the max-bitrate is known for the device. So why should I add it
to the DT ?
I'm only aware of CAN controller bindings making use of the transceiver
property which I think is because the PHYs they are supporting with this
are very simple which need no or little configuration to operate and the
max-bitrate property is needed to limit the bitrate.
> > +
> > +properties:
> > + compatible:
> > + const: nxp,tja1145
> > +
> > + "#phy-cells":
> > + const: 0
> > +
> > + reg:
> > + maxItems: 1
>
> reg is the second property, also in "required:" block.
>
Will fix this.
> > +
> > + spi-max-frequency:
> > + maximum: 4000000
> > +
> > + spi-cpha: true
> > +
> > + spi-cs-setup-delay-ns:
> > + minimum: 50
> > + default: 50
> > +
> > + spi-cs-hold-delay-ns:
> > + minimum: 50
> > + default: 50
> > +
> > + spi-cs-inactive-delay-ns:
> > + minimum: 250
> > + default: 250
> > +
> > + vcc-supply:
> > + description:
> > + CAN transceiver supply voltage
> > +
> > + vio-supply:
> > + description:
> > + Supply voltage for I/O level adaptor
> > +
> > + vbat-supply:
> > + description:
> > + Battery supply voltage
> > +
> > +required:
> > + - compatible
> > + - "#phy-cells"
> > + - reg
> > +
> > +unevaluatedProperties: false
> > +
> > +examples:
> > + - |
> > + spi {
> > + #address-cells = <1>;
> > + #size-cells = <0>;
> > + canphy@0 {
>
> can-phy if something like this exist. If not, then probably can-transceiver
>
Will fix this.
> > + compatible = "nxp,tja1145";
> > + #phy-cells = <0>;
> > + reg = <0>;
>
> Please follow DTS coding style.
>
Ok.
Best regards,
Dimitri Fedrau
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] dt-bindings: phy: add support for NXPs TJA1145 CAN transceiver
@ 2025-07-31 4:48 ` Dimitri Fedrau
0 siblings, 0 replies; 15+ messages in thread
From: Dimitri Fedrau @ 2025-07-31 4:48 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Dimitri Fedrau, Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-phy, devicetree,
linux-kernel
Hi Krzysztof,
Am Wed, Jul 30, 2025 at 09:35:12AM +0200 schrieb Krzysztof Kozlowski:
> On Mon, Jul 28, 2025 at 05:39:29PM +0200, Dimitri Fedrau wrote:
> > Adding documentation for NXPs TJA1145 CAN transceiver.
> >
> > Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> > ---
> > .../devicetree/bindings/phy/nxp,tja1145-can.yaml | 79 ++++++++++++++++++++++
>
> Why isn't this in can directory with rest of CAN bindings?
>
The directory contains CAN controller bindings. This is a CAN transceiver
binding. And the only CAN transceiver binding I could find so far is this:
https://elixir.bootlin.com/linux/v6.16/source/Documentation/devicetree/bindings/phy/ti,tcan104x-can.yaml
The driver uses the generic PHY framework as the driver for the tja1145
does.
> > 1 file changed, 79 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/phy/nxp,tja1145-can.yaml b/Documentation/devicetree/bindings/phy/nxp,tja1145-can.yaml
> > new file mode 100644
> > index 0000000000000000000000000000000000000000..10bf2bce1b35788b3284c42e544a56eda6d79947
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/phy/nxp,tja1145-can.yaml
>
> Filename should match compatible.
>
Ok, will fix this.
> > @@ -0,0 +1,79 @@
> > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/phy/nxp,tja1145-can.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: TJA1145 CAN transceiver
> > +
> > +maintainers:
> > + - Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> > +
> > +allOf:
> > + - $ref: /schemas/spi/spi-peripheral-props.yaml#
>
> Missing ref to transceiver properties. Look at other CAN bindings.
>
There is only one transceiver property(max-bitrate) which I don't need
because the max-bitrate is known for the device. So why should I add it
to the DT ?
I'm only aware of CAN controller bindings making use of the transceiver
property which I think is because the PHYs they are supporting with this
are very simple which need no or little configuration to operate and the
max-bitrate property is needed to limit the bitrate.
> > +
> > +properties:
> > + compatible:
> > + const: nxp,tja1145
> > +
> > + "#phy-cells":
> > + const: 0
> > +
> > + reg:
> > + maxItems: 1
>
> reg is the second property, also in "required:" block.
>
Will fix this.
> > +
> > + spi-max-frequency:
> > + maximum: 4000000
> > +
> > + spi-cpha: true
> > +
> > + spi-cs-setup-delay-ns:
> > + minimum: 50
> > + default: 50
> > +
> > + spi-cs-hold-delay-ns:
> > + minimum: 50
> > + default: 50
> > +
> > + spi-cs-inactive-delay-ns:
> > + minimum: 250
> > + default: 250
> > +
> > + vcc-supply:
> > + description:
> > + CAN transceiver supply voltage
> > +
> > + vio-supply:
> > + description:
> > + Supply voltage for I/O level adaptor
> > +
> > + vbat-supply:
> > + description:
> > + Battery supply voltage
> > +
> > +required:
> > + - compatible
> > + - "#phy-cells"
> > + - reg
> > +
> > +unevaluatedProperties: false
> > +
> > +examples:
> > + - |
> > + spi {
> > + #address-cells = <1>;
> > + #size-cells = <0>;
> > + canphy@0 {
>
> can-phy if something like this exist. If not, then probably can-transceiver
>
Will fix this.
> > + compatible = "nxp,tja1145";
> > + #phy-cells = <0>;
> > + reg = <0>;
>
> Please follow DTS coding style.
>
Ok.
Best regards,
Dimitri Fedrau
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] dt-bindings: phy: add support for NXPs TJA1145 CAN transceiver
2025-07-31 4:48 ` Dimitri Fedrau
@ 2025-08-03 9:40 ` Krzysztof Kozlowski
-1 siblings, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2025-08-03 9:40 UTC (permalink / raw)
To: Dimitri Fedrau
Cc: Dimitri Fedrau, Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-phy, devicetree,
linux-kernel
On 31/07/2025 06:48, Dimitri Fedrau wrote:
>>> +allOf:
>>> + - $ref: /schemas/spi/spi-peripheral-props.yaml#
>>
>> Missing ref to transceiver properties. Look at other CAN bindings.
>>
> There is only one transceiver property(max-bitrate) which I don't need
> because the max-bitrate is known for the device. So why should I add it
> to the DT ?
> I'm only aware of CAN controller bindings making use of the transceiver
> property which I think is because the PHYs they are supporting with this
> are very simple which need no or little configuration to operate and the
> max-bitrate property is needed to limit the bitrate.
It's fine then, I guess.
Best regards,
Krzysztof
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] dt-bindings: phy: add support for NXPs TJA1145 CAN transceiver
@ 2025-08-03 9:40 ` Krzysztof Kozlowski
0 siblings, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2025-08-03 9:40 UTC (permalink / raw)
To: Dimitri Fedrau
Cc: Dimitri Fedrau, Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-phy, devicetree,
linux-kernel
On 31/07/2025 06:48, Dimitri Fedrau wrote:
>>> +allOf:
>>> + - $ref: /schemas/spi/spi-peripheral-props.yaml#
>>
>> Missing ref to transceiver properties. Look at other CAN bindings.
>>
> There is only one transceiver property(max-bitrate) which I don't need
> because the max-bitrate is known for the device. So why should I add it
> to the DT ?
> I'm only aware of CAN controller bindings making use of the transceiver
> property which I think is because the PHYs they are supporting with this
> are very simple which need no or little configuration to operate and the
> max-bitrate property is needed to limit the bitrate.
It's fine then, I guess.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2025-08-03 9:40 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-28 15:39 [PATCH 0/2] phy: add basic support for NXPs TJA1145 CAN transceiver Dimitri Fedrau
2025-07-28 15:39 ` Dimitri Fedrau via B4 Relay
2025-07-28 15:39 ` Dimitri Fedrau via B4 Relay
2025-07-28 15:39 ` [PATCH 1/2] dt-bindings: phy: add " Dimitri Fedrau
2025-07-28 15:39 ` Dimitri Fedrau via B4 Relay
2025-07-28 15:39 ` Dimitri Fedrau via B4 Relay
2025-07-30 7:35 ` Krzysztof Kozlowski
2025-07-30 7:35 ` Krzysztof Kozlowski
2025-07-31 4:48 ` Dimitri Fedrau
2025-07-31 4:48 ` Dimitri Fedrau
2025-08-03 9:40 ` Krzysztof Kozlowski
2025-08-03 9:40 ` Krzysztof Kozlowski
2025-07-28 15:39 ` [PATCH 2/2] phy: add basic " Dimitri Fedrau
2025-07-28 15:39 ` Dimitri Fedrau via B4 Relay
2025-07-28 15:39 ` Dimitri Fedrau via B4 Relay
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.