Skip to contentSkip to conversation

net: c_can: Add support for DCAN Module RAM Init

PATCH Superseded [email protected] 2 participants 4 messages Apr 16, 2014 – Apr 17, 2014

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: c_can: Add support for DCAN Module RAM Init

This patch adds support for the general DCAN module which has the RAM Init bit in the CFR register [offset 0x18]. The existing D_CAN implementation was written for TI which uses a separate register (outside the D_CAN module) for CAN RAM initialization. I do not have access to the TI D_CAN implementation so if someone can test on that platform, it would be appreciated.

[PATCH] net: c_can: Add support for D_CAN RAM Init bit in D_CAN

#1 lore raw

PATCH 1/1 net: c_can: Add support for D_CAN module RAM Init.

From: Thor Thayer <[email protected]>

The D_CAN driver was written to support the TI D_CAN implementation which placed the D_CAN RAM reset in a separate register. In the standard D_CAN module the RAM Init is in the D_CAN module so handle the RAM Init differently.

To: linux-can <[email protected]>
To: Wolfgang Grandegger <[email protected]>
To: Marc Kleine-Budde <[email protected]>
Cc: Oliver Hartkopp <[email protected]>
Cc: AnilKumar Ch <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: netdev <[email protected]>

---
 drivers/net/can/c_can/c_can.h          |    3 ++
 drivers/net/can/c_can/c_can_platform.c |   49 +++++++++++++++++++++++++-------
 2 files changed, 42 insertions(+), 10 deletions(-)
drivers/net/can/c_can/c_can.h +3 -0
index faa8404..64ff936 100644
@@ -88,6 +88,7 @@ enum reg {
 	C_CAN_INTPND2_REG,
 	C_CAN_MSGVAL1_REG,
 	C_CAN_MSGVAL2_REG,
+	C_CAN_FUNCTION_REG,
 };
 
 static const u16 reg_map_c_can[] = {
@@ -139,6 +140,7 @@ static const u16 reg_map_d_can[] = {
 	[C_CAN_BRPEXT_REG]	= 0x0E,
 	[C_CAN_INT_REG]		= 0x10,
 	[C_CAN_TEST_REG]	= 0x14,
+	[C_CAN_FUNCTION_REG]	= 0x18,
 	[C_CAN_TXRQST1_REG]	= 0x88,
 	[C_CAN_TXRQST2_REG]	= 0x8A,
 	[C_CAN_NEWDAT1_REG]	= 0x9C,
@@ -201,6 +203,7 @@ struct c_can_priv {
 	unsigned int instance;
 	void (*raminit) (const struct c_can_priv *priv, bool enable);
 	u32 dlc[C_CAN_MSG_OBJ_TX_NUM];
+	u32 raminit_type_flag;
 };
 
 struct net_device *alloc_c_can_dev(void);
drivers/net/can/c_can/c_can_platform.c +39 -10

83 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH] net: c_can: Add support for D_CAN module RAM Init.

drivers/net/can/c_can/c_can_platform.c static int c_can_plat_probe(struct platform_device *pdev) · line 246

Quoted 9 lines · On Wed, 16 Apr 2014, [email protected] wrote:

From: Thor Thayer <[email protected]>

The D_CAN driver was written to support the TI D_CAN implementation which placed the D_CAN RAM reset in a separate register. In the standard D_CAN module the RAM Init is in the D_CAN module so handle the RAM Init differently.

drivers/net/can/c_can/c_can_platform.c +3 -0
+		if (!res) {
+			priv->raminit = c_can_hw_raminit;
+			priv->raminit_type_flag = 0;

Can we please make that raminit_type and use proper constants?

Thanks,

tglx

#3 lore raw

Re: [PATCH] net: c_can: Add support for D_CAN module RAM Init.

Quoted 15 lines · Thomas Gleixner

drivers/net/can/c_can/c_can_platform.c static int c_can_plat_probe(struct platform_device *pdev) · line 246

Quoted 9 lines · On Wed, 16 Apr 2014, [email protected] wrote:

From: Thor Thayer <[email protected]>

The D_CAN driver was written to support the TI D_CAN implementation which placed the D_CAN RAM reset in a separate register. In the standard D_CAN module the RAM Init is in the D_CAN module so handle the RAM Init differently.

drivers/net/can/c_can/c_can_platform.c +3 -0
+		if (!res) {
+			priv->raminit = c_can_hw_raminit;
+			priv->raminit_type_flag = 0;

Can we please make that raminit_type and use proper constants?

Quoted 3 lines

Thanks,

tglx

Yes. I will make these changes. Thanks for reviewing.