Skip to content

Commit 7ce98a5

Browse files
Wolfram SangWolfram Sang
authored andcommitted
i2c: rcar: explain the lockless design
To make sure people can understand the lockless design of this driver without the need to dive into git history, add a comment giving an overview of the situation. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
1 parent a35ba2f commit 7ce98a5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/i2c/busses/i2c-rcar.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,15 @@ static bool rcar_i2c_slave_irq(struct rcar_i2c_priv *priv)
611611
return true;
612612
}
613613

614+
/*
615+
* This driver has a lock-free design because there are IP cores (at least
616+
* R-Car Gen2) which have an inherent race condition in their hardware design.
617+
* There, we need to clear RCAR_BUS_MASK_DATA bits as soon as possible after
618+
* the interrupt was generated, otherwise an unwanted repeated message gets
619+
* generated. It turned out that taking a spinlock at the beginning of the ISR
620+
* was already causing repeated messages. Thus, this driver was converted to
621+
* the now lockless behaviour. Please keep this in mind when hacking the driver.
622+
*/
614623
static irqreturn_t rcar_i2c_irq(int irq, void *ptr)
615624
{
616625
struct rcar_i2c_priv *priv = ptr;

0 commit comments

Comments
 (0)