forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/net/can/c_can/c_can_platform.c
....@@ -40,10 +40,11 @@
4040
4141 #include "c_can.h"
4242
43
-#define DCAN_RAM_INIT_BIT (1 << 3)
43
+#define DCAN_RAM_INIT_BIT BIT(3)
44
+
4445 static DEFINE_SPINLOCK(raminit_lock);
45
-/*
46
- * 16-bit c_can registers can be arranged differently in the memory
46
+
47
+/* 16-bit c_can registers can be arranged differently in the memory
4748 * architecture of different implementations. For example: 16-bit
4849 * registers can be aligned to a 16-bit boundary or 32-bit boundary etc.
4950 * Handle the same by providing a common read/write interface.
....@@ -55,7 +56,7 @@
5556 }
5657
5758 static void c_can_plat_write_reg_aligned_to_16bit(const struct c_can_priv *priv,
58
- enum reg index, u16 val)
59
+ enum reg index, u16 val)
5960 {
6061 writew(val, priv->base + priv->regs[index]);
6162 }
....@@ -67,7 +68,7 @@
6768 }
6869
6970 static void c_can_plat_write_reg_aligned_to_32bit(const struct c_can_priv *priv,
70
- enum reg index, u16 val)
71
+ enum reg index, u16 val)
7172 {
7273 writew(val, priv->base + 2 * priv->regs[index]);
7374 }
....@@ -145,13 +146,13 @@
145146 u32 val;
146147
147148 val = priv->read_reg(priv, index);
148
- val |= ((u32) priv->read_reg(priv, index + 1)) << 16;
149
+ val |= ((u32)priv->read_reg(priv, index + 1)) << 16;
149150
150151 return val;
151152 }
152153
153
-static void c_can_plat_write_reg32(const struct c_can_priv *priv, enum reg index,
154
- u32 val)
154
+static void c_can_plat_write_reg32(const struct c_can_priv *priv,
155
+ enum reg index, u32 val)
155156 {
156157 priv->write_reg(priv, index + 1, val >> 16);
157158 priv->write_reg(priv, index, val);
....@@ -162,8 +163,8 @@
162163 return readl(priv->base + priv->regs[index]);
163164 }
164165
165
-static void d_can_plat_write_reg32(const struct c_can_priv *priv, enum reg index,
166
- u32 val)
166
+static void d_can_plat_write_reg32(const struct c_can_priv *priv,
167
+ enum reg index, u32 val)
167168 {
168169 writel(val, priv->base + priv->regs[index]);
169170 }