Skip to content

Commit 8b4da3e

Browse files
svenpeter42Andi Shyti
authored andcommitted
i2c: pasemi: Add registers bits and switch to BIT()
Add the missing register bits to the defines and also switch those to use the BIT macro which is much more readable than using hardcoded masks Co-developed-by: Hector Martin <[email protected]> Signed-off-by: Hector Martin <[email protected]> Signed-off-by: Sven Peter <[email protected]> Reviewed-by: Neal Gompa <[email protected]> Reviewed-by: Alyssa Rosenzweig <[email protected]> Signed-off-by: Andi Shyti <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 088b1ca commit 8b4da3e

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

drivers/i2c/busses/i2c-pasemi-core.c

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* SMBus host driver for PA Semi PWRficient
66
*/
77

8+
#include <linux/bitfield.h>
89
#include <linux/module.h>
910
#include <linux/pci.h>
1011
#include <linux/kernel.h>
@@ -26,21 +27,30 @@
2627
#define REG_REV 0x28
2728

2829
/* Register defs */
29-
#define MTXFIFO_READ 0x00000400
30-
#define MTXFIFO_STOP 0x00000200
31-
#define MTXFIFO_START 0x00000100
32-
#define MTXFIFO_DATA_M 0x000000ff
33-
34-
#define MRXFIFO_EMPTY 0x00000100
35-
#define MRXFIFO_DATA_M 0x000000ff
36-
37-
#define SMSTA_XEN 0x08000000
38-
#define SMSTA_MTN 0x00200000
39-
40-
#define CTL_MRR 0x00000400
41-
#define CTL_MTR 0x00000200
42-
#define CTL_EN 0x00000800
43-
#define CTL_CLK_M 0x000000ff
30+
#define MTXFIFO_READ BIT(10)
31+
#define MTXFIFO_STOP BIT(9)
32+
#define MTXFIFO_START BIT(8)
33+
#define MTXFIFO_DATA_M GENMASK(7, 0)
34+
35+
#define MRXFIFO_EMPTY BIT(8)
36+
#define MRXFIFO_DATA_M GENMASK(7, 0)
37+
38+
#define SMSTA_XIP BIT(28)
39+
#define SMSTA_XEN BIT(27)
40+
#define SMSTA_JMD BIT(25)
41+
#define SMSTA_JAM BIT(24)
42+
#define SMSTA_MTO BIT(23)
43+
#define SMSTA_MTA BIT(22)
44+
#define SMSTA_MTN BIT(21)
45+
#define SMSTA_MRNE BIT(19)
46+
#define SMSTA_MTE BIT(16)
47+
#define SMSTA_TOM BIT(6)
48+
49+
#define CTL_EN BIT(11)
50+
#define CTL_MRR BIT(10)
51+
#define CTL_MTR BIT(9)
52+
#define CTL_UJM BIT(8)
53+
#define CTL_CLK_M GENMASK(7, 0)
4454

4555
static inline void reg_write(struct pasemi_smbus *smbus, int reg, int val)
4656
{

0 commit comments

Comments
 (0)