From patchwork Wed Apr 2 10:20:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 14035748 X-Patchwork-Delegate: geert@linux-m68k.org Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A59F5235BE8; Wed, 2 Apr 2025 10:21:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743589297; cv=none; b=abzZOnb3EH4zfszwknin0TbjeEHbXIx05t3BJwivkbJSpudHZKHku2J7uZjIKKHy1MqHJAGZPRLKE4FSmJKohFqE5tRtwK2tTrXyOeO6vMIUcqUAayUWPb2tbFNyBro8SgnnkChOgkHqbLZXv80Sn6IOfM8JgFgHqAhS5bSNZak= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743589297; c=relaxed/simple; bh=p6DtY5MTZkDcvhqyxDKHFC5yXF2yHt4uN9GBknrU2x8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EPMDXbAf2Z8Y2djdTaioEBkN2B9PKAgmd1dEZsjNmWl2DJoNXEml2i36iDn7Es1oVS5Ay+Z1+rSEOiDg77dr3IXFVcEYdq4Faby7C9KcKOc/2OF9dZcL9IEjffhim/h/i6gh58htTg8fmtwY9e6DWmz4J3erMPHtZd15mYR3k+0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-CSE-ConnectionGUID: /9ickgV3SnmUWHCgxMgy2Q== X-CSE-MsgGUID: S74RqZeWTx+IYuE6m4c2hA== Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 02 Apr 2025 19:21:35 +0900 Received: from localhost.localdomain (unknown [10.226.93.220]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 89645401C759; Wed, 2 Apr 2025 19:21:32 +0900 (JST) From: Biju Das To: Marc Kleine-Budde , Vincent Mailhol Cc: Biju Das , Wolfram Sang , Geert Uytterhoeven , =?utf-8?q?Uwe_Kleine-K=C3=B6n?= =?utf-8?q?ig?= , linux-can@vger.kernel.org, Prabhakar Mahadev Lad , Biju Das , linux-renesas-soc@vger.kernel.org Subject: [PATCH v8 11/19] can: rcar_canfd: Add max_cftml variable to struct rcar_canfd_hw_info Date: Wed, 2 Apr 2025 11:20:31 +0100 Message-ID: <20250402102047.27943-12-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250402102047.27943-1-biju.das.jz@bp.renesas.com> References: <20250402102047.27943-1-biju.das.jz@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 R-Car Gen3 has CFTML max positional value is 15 whereas on R-Car Gen4 it is 31. Add a max_cftml variable to struct rcar_canfd_hw_info to handle this difference. While at it, rename the parameter x->cftml in RCANFD_CFCC_CFTML macro to make it clear. Reviewed-by: Geert Uytterhoeven Reviewed-by: Vincent Mailhol Signed-off-by: Biju Das --- v7->v8: * Renamed the parameter x->cftml in RCANFD_CFCC_CFTML macro to make it clear. * Collected tag. v6->v7: * Collected tag. v6: * New patch. --- drivers/net/can/rcar/rcar_canfd.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c index 16fbe4be6782..569ee5925b55 100644 --- a/drivers/net/can/rcar/rcar_canfd.c +++ b/drivers/net/can/rcar/rcar_canfd.c @@ -224,8 +224,11 @@ /* Common FIFO bits */ /* RSCFDnCFDCFCCk */ -#define RCANFD_CFCC_CFTML(gpriv, x) \ - (((x) & reg_gen4(gpriv, 0x1f, 0xf)) << reg_gen4(gpriv, 16, 20)) +#define RCANFD_CFCC_CFTML(gpriv, cftml) \ +({\ + typeof(gpriv) (_gpriv) = (gpriv); \ + (((cftml) & (_gpriv)->info->max_cftml) << reg_gen4(_gpriv, 16, 20)); \ +}) #define RCANFD_CFCC_CFM(gpriv, x) (((x) & 0x3) << reg_gen4(gpriv, 8, 16)) #define RCANFD_CFCC_CFIM BIT(12) #define RCANFD_CFCC_CFDC(gpriv, x) (((x) & 0x7) << reg_gen4(gpriv, 21, 8)) @@ -504,6 +507,7 @@ struct rcar_canfd_global; struct rcar_canfd_hw_info { u8 rnc_field_width; u8 max_aflpn; + u8 max_cftml; u8 max_channels; u8 postdiv; /* hardware features */ @@ -582,6 +586,7 @@ static const struct can_bittiming_const rcar_canfd_bittiming_const = { static const struct rcar_canfd_hw_info rcar_gen3_hw_info = { .rnc_field_width = 8, .max_aflpn = 31, + .max_cftml = 15, .max_channels = 2, .postdiv = 2, .shared_global_irqs = 1, @@ -590,6 +595,7 @@ static const struct rcar_canfd_hw_info rcar_gen3_hw_info = { static const struct rcar_canfd_hw_info rcar_gen4_hw_info = { .rnc_field_width = 16, .max_aflpn = 127, + .max_cftml = 31, .max_channels = 8, .postdiv = 2, .shared_global_irqs = 1, @@ -598,6 +604,7 @@ static const struct rcar_canfd_hw_info rcar_gen4_hw_info = { static const struct rcar_canfd_hw_info rzg2l_hw_info = { .rnc_field_width = 8, .max_aflpn = 31, + .max_cftml = 15, .max_channels = 2, .postdiv = 1, .multi_channel_irqs = 1,