diff mbox

[4/5] i2c: sirfsoc: support reverse direction of address

Message ID 1376385091-30597-5-git-send-email-Baohua.Song@csr.com
State Accepted
Headers show

Commit Message

Barry Song Aug. 13, 2013, 9:11 a.m. UTC
From: Zhiwu Song <Zhiwu.Song@csr.com>

if users set I2C_M_REV_DIR_ADDR, revert the direction of address.

Signed-off-by: Zhiwu Song <Zhiwu.Song@csr.com>
Signed-off-by: Rongjun Ying <rongjun.ying@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
---
 drivers/i2c/busses/i2c-sirf.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Wolfram Sang Aug. 19, 2013, 6:06 p.m. UTC | #1
On Tue, Aug 13, 2013 at 05:11:30PM +0800, Barry Song wrote:
> From: Zhiwu Song <Zhiwu.Song@csr.com>
> 
> if users set I2C_M_REV_DIR_ADDR, revert the direction of address.
> 
> Signed-off-by: Zhiwu Song <Zhiwu.Song@csr.com>
> Signed-off-by: Rongjun Ying <rongjun.ying@csr.com>
> Signed-off-by: Barry Song <Baohua.Song@csr.com>

Hmm, you are not advertising I2C_FUNC_PROTOCOL_MANGLING so users should
not use it. Does the master allow to implement the rest of mangling,
too?
Barry Song Aug. 20, 2013, 2:30 a.m. UTC | #2
2013/8/20 Wolfram Sang <wsa@the-dreams.de>:
> On Tue, Aug 13, 2013 at 05:11:30PM +0800, Barry Song wrote:
>> From: Zhiwu Song <Zhiwu.Song@csr.com>
>>
>> if users set I2C_M_REV_DIR_ADDR, revert the direction of address.
>>
>> Signed-off-by: Zhiwu Song <Zhiwu.Song@csr.com>
>> Signed-off-by: Rongjun Ying <rongjun.ying@csr.com>
>> Signed-off-by: Barry Song <Baohua.Song@csr.com>
>
> Hmm, you are not advertising I2C_FUNC_PROTOCOL_MANGLING so users should
> not use it.

Wolfram, good comments. the old codes did miss
I2C_FUNC_PROTOCOL_MANGLING which i will fix in v2.

> Does the master allow to implement the rest of mangling,
> too?
>

i think only I2C_M_REV_DIR_ADDR. i didn't hear I2C_M_NOSTART,
I2C_M_IGNORE_NAK from hardware guys.

-barry
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Wolfram Sang Aug. 28, 2013, 9:41 a.m. UTC | #3
> > Hmm, you are not advertising I2C_FUNC_PROTOCOL_MANGLING so users should
> > not use it.
> 
> Wolfram, good comments. the old codes did miss
> I2C_FUNC_PROTOCOL_MANGLING which i will fix in v2.
> 
> > Does the master allow to implement the rest of mangling,
> > too?
> >
> 
> i think only I2C_M_REV_DIR_ADDR. i didn't hear I2C_M_NOSTART,
> I2C_M_IGNORE_NAK from hardware guys.

Hmm, since the driver can't support all of MANGLING, it might be wise to
not advertise it. I am undecided how to handle this generally. Until
then, I'll accept this patch (and the series) as is.
Barry Song Aug. 28, 2013, noon UTC | #4
2013/8/28 Wolfram Sang <wsa@the-dreams.de>:
>
>> > Hmm, you are not advertising I2C_FUNC_PROTOCOL_MANGLING so users should
>> > not use it.
>>
>> Wolfram, good comments. the old codes did miss
>> I2C_FUNC_PROTOCOL_MANGLING which i will fix in v2.
>>
>> > Does the master allow to implement the rest of mangling,
>> > too?
>> >
>>
>> i think only I2C_M_REV_DIR_ADDR. i didn't hear I2C_M_NOSTART,
>> I2C_M_IGNORE_NAK from hardware guys.
>
> Hmm, since the driver can't support all of MANGLING, it might be wise to
> not advertise it. I am undecided how to handle this generally. Until
> then, I'll accept this patch (and the series) as is.

ok, thanks Wolfram. then i will not have v2.
>

-barry
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/i2c/busses/i2c-sirf.c b/drivers/i2c/busses/i2c-sirf.c
index 746388f..d2b7913 100644
--- a/drivers/i2c/busses/i2c-sirf.c
+++ b/drivers/i2c/busses/i2c-sirf.c
@@ -195,6 +195,10 @@  static void i2c_sirfsoc_set_address(struct sirfsoc_i2c *siic,
 	if (msg->flags & I2C_M_RD)
 		addr |= 1;
 
+	/* Reverse direction bit */
+	if (msg->flags & I2C_M_REV_DIR_ADDR)
+		addr ^= 1;
+
 	writel(addr, siic->base + SIRFSOC_I2C_CMD(siic->cmd_ptr++));
 }