Re: [PATCH v6 3/9] phy: phy-can-transceiver: Add dual channel support for TJA1048

Marc Kleine-Budde
2025-09-19T19:11:19Z

[-- Attachment #1: Type: text/plain, Size: 1755 bytes --]

On 09.09.2025 13:40:13, Peng Fan wrote:
> - Introduce new flag CAN_TRANSCEIVER_DUAL_CH to indicate the phy has two
> channels.
> - Alloc a phy for each channel
> - Support TJA1048 which is a dual high-speed CAN transceiver with sleep
> mode supported.
> - Add can_transceiver_phy_xlate for parsing phy
>
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
> drivers/phy/phy-can-transceiver.c | 91 ++++++++++++++++++++++++++++-----------
> 1 file changed, 65 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/phy/phy-can-transceiver.c b/drivers/phy/phy-can-transceiver.c
> index 6415c6af0e8414a6cc8d15958a17ee749a3f28e9..f06b1df76ada023f432dce892c3346f45397ab54 100644
> --- a/drivers/phy/phy-can-transceiver.c
> +++ b/drivers/phy/phy-can-transceiver.c
> @@ -17,6 +17,7 @@ struct can_transceiver_data {
> u32 flags;
> #define CAN_TRANSCEIVER_STB_PRESENT BIT(0)
> #define CAN_TRANSCEIVER_EN_PRESENT BIT(1)
> +#define CAN_TRANSCEIVER_DUAL_CH BIT(2)
> };
>
> struct can_transceiver_phy {
> @@ -29,6 +30,7 @@ struct can_transceiver_phy {
> struct can_transceiver_priv {
> struct can_transceiver_phy *can_transceiver_phy;
> struct mux_state *mux_state;
> + int num_ch;

As a flexible array this looks like:

struct can_transceiver_priv {
struct can_transceiver_phy *can_transceiver_phy;
int num_ch;
struct mux_state mux_state[] __counted_by(num_ch);
}

Marc

--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]