Commit 1a62668c authored by Sven Peter's avatar Sven Peter Committed by Wolfram Sang

i2c: pasemi: Move common reset code to own function

Split out common reset call to its own function so that we
can later add support for selecting the clock frequency
and an additional enable bit found in newer revisions.
Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarSven Peter <sven@svenpeter.dev>
Acked-by: default avatarOlof Johansson <olof@lixom.net>
Tested-by: default avatarChristian Zigotzky <chzigotzky@xenosoft.de>
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
parent 9bc5f4f6
...@@ -61,6 +61,12 @@ static inline int reg_read(struct pasemi_smbus *smbus, int reg) ...@@ -61,6 +61,12 @@ static inline int reg_read(struct pasemi_smbus *smbus, int reg)
#define TXFIFO_WR(smbus, reg) reg_write((smbus), REG_MTXFIFO, (reg)) #define TXFIFO_WR(smbus, reg) reg_write((smbus), REG_MTXFIFO, (reg))
#define RXFIFO_RD(smbus) reg_read((smbus), REG_MRXFIFO) #define RXFIFO_RD(smbus) reg_read((smbus), REG_MRXFIFO)
static void pasemi_reset(struct pasemi_smbus *smbus)
{
reg_write(smbus, REG_CTL, (CTL_MTR | CTL_MRR |
(CLK_100K_DIV & CTL_CLK_M)));
}
static void pasemi_smb_clear(struct pasemi_smbus *smbus) static void pasemi_smb_clear(struct pasemi_smbus *smbus)
{ {
unsigned int status; unsigned int status;
...@@ -135,8 +141,7 @@ static int pasemi_i2c_xfer_msg(struct i2c_adapter *adapter, ...@@ -135,8 +141,7 @@ static int pasemi_i2c_xfer_msg(struct i2c_adapter *adapter,
return 0; return 0;
reset_out: reset_out:
reg_write(smbus, REG_CTL, (CTL_MTR | CTL_MRR | pasemi_reset(smbus);
(CLK_100K_DIV & CTL_CLK_M)));
return err; return err;
} }
...@@ -302,8 +307,7 @@ static int pasemi_smb_xfer(struct i2c_adapter *adapter, ...@@ -302,8 +307,7 @@ static int pasemi_smb_xfer(struct i2c_adapter *adapter,
return 0; return 0;
reset_out: reset_out:
reg_write(smbus, REG_CTL, (CTL_MTR | CTL_MRR | pasemi_reset(smbus);
(CLK_100K_DIV & CTL_CLK_M)));
return err; return err;
} }
...@@ -335,8 +339,7 @@ int pasemi_i2c_common_probe(struct pasemi_smbus *smbus) ...@@ -335,8 +339,7 @@ int pasemi_i2c_common_probe(struct pasemi_smbus *smbus)
/* set up the sysfs linkage to our parent device */ /* set up the sysfs linkage to our parent device */
smbus->adapter.dev.parent = smbus->dev; smbus->adapter.dev.parent = smbus->dev;
reg_write(smbus, REG_CTL, (CTL_MTR | CTL_MRR | pasemi_reset(smbus);
(CLK_100K_DIV & CTL_CLK_M)));
error = i2c_add_adapter(&smbus->adapter); error = i2c_add_adapter(&smbus->adapter);
if (error) if (error)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment