i2c: tegra: clean up macros
PATCH 1/6 i2c: tegra: clean up macros
Clean up macros by:
1) removing unused macros
2) replace constants by macro BIT()
--- drivers/i2c/busses/i2c-tegra.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-)
drivers/i2c/busses/i2c-tegra.c +3 -14
@@ -54,20 +54,15 @@#define I2C_INT_STATUS 0x068#define I2C_INT_BUS_CLR_DONE BIT(11)#define I2C_INT_PACKET_XFER_COMPLETE BIT(7) -#define I2C_INT_ALL_PACKETS_XFER_COMPLETE BIT(6) -#define I2C_INT_TX_FIFO_OVERFLOW BIT(5) -#define I2C_INT_RX_FIFO_UNDERFLOW BIT(4)#define I2C_INT_NO_ACK BIT(3)#define I2C_INT_ARBITRATION_LOST BIT(2)#define I2C_INT_TX_FIFO_DATA_REQ BIT(1)#define I2C_INT_RX_FIFO_DATA_REQ BIT(0)#define I2C_CLK_DIVISOR 0x06c#define I2C_CLK_DIVISOR_STD_FAST_MODE_SHIFT 16 -#define I2C_CLK_MULTIPLIER_STD_FAST_MODE 8#define DVC_CTRL_REG1 0x000#define DVC_CTRL_REG1_INTR_EN BIT(10) -#define DVC_CTRL_REG2 0x004#define DVC_CTRL_REG3 0x008#define DVC_CTRL_REG3_SW_PROG BIT(26)#define DVC_CTRL_REG3_I2C_DONE_INTR_EN BIT(30)
@@ -75,24 +70,21 @@#define DVC_STATUS_I2C_DONE_INTR BIT(30)#define I2C_ERR_NONE 0x00 -#define I2C_ERR_NO_ACK 0x01 -#define I2C_ERR_ARBITRATION_LOST 0x02 -#define I2C_ERR_UNKNOWN_INTERRUPT 0x04 +#define I2C_ERR_NO_ACK BIT(0) +#define I2C_ERR_ARBITRATION_LOST BIT(1) +#define I2C_ERR_UNKNOWN_INTERRUPT BIT(2)#define PACKET_HEADER0_HEADER_SIZE_SHIFT 28#define PACKET_HEADER0_PACKET_ID_SHIFT 16#define PACKET_HEADER0_CONT_ID_SHIFT 12#define PACKET_HEADER0_PROTOCOL_I2C BIT(4) -#define I2C_HEADER_HIGHSPEED_MODE BIT(22)#define I2C_HEADER_CONT_ON_NAK BIT(21) -#define I2C_HEADER_SEND_START_BYTE BIT(20)#define I2C_HEADER_READ BIT(19)#define I2C_HEADER_10BIT_ADDR BIT(18)#define I2C_HEADER_IE_ENABLE BIT(17)#define I2C_HEADER_REPEAT_START BIT(16)#define I2C_HEADER_CONTINUE_XFER BIT(15) -#define I2C_HEADER_MASTER_ADDR_SHIFT 12#define I2C_HEADER_SLAVE_ADDR_SHIFT 1#define I2C_BUS_CLEAR_CNFG 0x084
@@ -106,8 +98,6 @@#define I2C_CONFIG_LOAD 0x08C#define I2C_MSTR_CONFIG_LOAD BIT(0) -#define I2C_SLV_CONFIG_LOAD BIT(1) -#define I2C_TIMEOUT_CONFIG_LOAD BIT(2)#define I2C_CLKEN_OVERRIDE 0x090#define I2C_MST_CORE_CLKEN_OVR BIT(0)
@@ -133,7 +123,6 @@#define I2C_STANDARD_MODE 100000#define I2C_FAST_MODE 400000#define I2C_FAST_PLUS_MODE 1000000 -#define I2C_HS_MODE 3500000/* Packet header size in bytes */ #define I2C_PACKET_HEADER_SIZE 12
Signature · 1 line
2.7.4
PATCH 2/6 i2c: tegra: remove unnecessary variable init
Remove variable initializations in functions that
are followed by assignments before use
--- drivers/i2c/busses/i2c-tegra.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/i2c/busses/i2c-tegra.c +3 -3
@@ -689,7 +689,7 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev, bool clk_reinit)u32 val;int err;u32 clk_divisor, clk_multiplier; -u32 tsu_thd =0 ; +u32 tsu_thd;u8 tlow, thigh; err =pm_runtime_get_sync (i2c_dev->dev);
@@ -1218,7 +1218,7 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], {struct tegra_i2c_dev *i2c_dev =i2c_get_adapdata (adap);int i; -int ret =0 ; +int ret; ret =pm_runtime_get_sync (i2c_dev->dev);if (ret <0 ) {
@@ -1489,7 +1489,7 @@ static int tegra_i2c_probe(struct platform_device *pdev)void __iomem *base;phys_addr_t base_phys;int irq; -int ret =0 ; +int ret; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); base_phys = res->start;
Signature · 1 line
2.7.4
Re: [PATCH V1 2/6] i2c: tegra: remove unnecessary variable init
07.06.2019 14:55, Bitan Biswas пишет:
Quoted 32 lines
Remove variable initializations in functions that
are followed by assignments before useSigned-off-by Bitan Biswas <[email protected]>--- drivers/i2c/busses/i2c-tegra.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/i2c/busses/i2c-tegra.c +2
-2@@ -689,7 +689,7 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev, bool clk_reinit)u32 val;int err;u32 clk_divisor, clk_multiplier; -u32 tsu_thd =0 ; +u32 tsu_thd;u8 tlow, thigh; err =pm_runtime_get_sync (i2c_dev->dev);@@ -1218,7 +1218,7 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], {struct tegra_i2c_dev *i2c_dev =i2c_get_adapdata (adap);int i; -int ret =0 ; +int ret; ret =pm_runtime_get_sync (i2c_dev->dev);if (ret <0 ) {
drivers/i2c/busses/i2c-tegra.c static int tegra_i2c_probe(struct platform_device *pdev) · line 1495
Quoted 8 lines
drivers/i2c/busses/i2c-tegra.c +1
-1@@ -1489,7 +1489,7 @@ static int tegra_i2c_probe(struct platform_device *pdev)void __iomem *base;phys_addr_t base_phys;int irq; -int ret =0 ; +int ret; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); base_phys = res->start;
Thanks!
PATCH 3/6 i2c: tegra: fix alignment and spacing violations
In reply to Bitan BiswasFix checkpatch.pl alignment and blank line check(s) in i2c-tegra.c
--- drivers/i2c/busses/i2c-tegra.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-)
drivers/i2c/busses/i2c-tegra.c +19 -16
@@ -295,7 +295,7 @@ static u32 dvc_readl(struct tegra_i2c_dev *i2c_dev, unsigned long reg)* to the I2C block inside the DVC block */ static unsigned long tegra_i2c_reg_addr (struct tegra_i2c_dev *i2c_dev, -unsigned long reg) +unsigned long reg) {if (i2c_dev->is_dvc) reg += (reg >=I2C_TX_FIFO ) ?0x10 :0x40 ;
@@ -303,7 +303,7 @@ static unsigned long tegra_i2c_reg_addr(struct tegra_i2c_dev *i2c_dev, }static void i2c_writel (struct tegra_i2c_dev *i2c_dev,u32 val, -unsigned long reg) +unsigned long reg) {writel (val, i2c_dev->base +tegra_i2c_reg_addr (i2c_dev, reg));
@@ -318,13 +318,13 @@ static u32 i2c_readl(struct tegra_i2c_dev *i2c_dev, unsigned long reg) }static void i2c_writesl (struct tegra_i2c_dev *i2c_dev,void *data, -unsigned long reg,int len) +unsigned long reg,int len) {writesl (i2c_dev->base +tegra_i2c_reg_addr (i2c_dev, reg), data, len); }static void i2c_readsl (struct tegra_i2c_dev *i2c_dev,void *data, -unsigned long reg,int len) +unsigned long reg,int len) {readsl (i2c_dev->base +tegra_i2c_reg_addr (i2c_dev, reg), data, len); }
@@ -669,10 +669,11 @@ static int tegra_i2c_wait_for_config_load(struct tegra_i2c_dev *i2c_dev)i2c_writel (i2c_dev,I2C_MSTR_CONFIG_LOAD ,I2C_CONFIG_LOAD );if (in_interrupt ()) err =readl_poll_timeout_atomic (addr, val, val ==0 , -1000 ,I2C_CONFIG_LOAD_TIMEOUT ); +1000 , +I2C_CONFIG_LOAD_TIMEOUT );else - err =readl_poll_timeout (addr, val, val ==0 , -1000 ,I2C_CONFIG_LOAD_TIMEOUT ); + err =readl_poll_timeout (addr, val, val ==0 ,1000 , +I2C_CONFIG_LOAD_TIMEOUT );if (err) { dev_warn(i2c_dev->dev,
@@ -1013,7 +1014,8 @@ static int tegra_i2c_issue_bus_clear(struct i2c_adapter *adap) }static int tegra_i2c_xfer_msg (struct tegra_i2c_dev *i2c_dev, -struct i2c_msg *msg,enum msg_end_type end_state) +struct i2c_msg *msg, +enum msg_end_type end_state) {u32 packet_header;u32 int_mask;
@@ -1150,9 +1152,8 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,if (err)return err; - time_left =wait_for_completion_timeout ( - &i2c_dev->dma_complete, -msecs_to_jiffies (xfer_time)); + time_left =wait_for_completion_timeout (&i2c_dev->dma_complete, +msecs_to_jiffies (xfer_time));if (time_left ==0 ) {dev_err (i2c_dev->dev,"DMA transfer timeout\n" ); dmaengine_terminate_sync(i2c_dev->msg_read ?
@@ -1214,7 +1215,7 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev, }static int tegra_i2c_xfer (struct i2c_adapter *adap,struct i2c_msg msgs[], -int num) +int num) {struct tegra_i2c_dev *i2c_dev =i2c_get_adapdata (adap);int i;
@@ -1260,14 +1261,15 @@ static void tegra_i2c_parse_dt(struct tegra_i2c_dev *i2c_dev) {struct device_node *np = i2c_dev->dev->of_node;int ret; +bool multi_mode; ret =of_property_read_u32 (np,"clock-frequency" , - &i2c_dev->bus_clk_rate); + &i2c_dev->bus_clk_rate);if (ret) i2c_dev->bus_clk_rate =100000 ;/* default clock rate */ - i2c_dev->is_multimaster_mode =of_property_read_bool (np, -"multi-master" ); + multi_mode =of_property_read_bool (np,"multi-master" ); + i2c_dev->is_multimaster_mode = multi_mode; }static const struct i2c_algorithm tegra_i2c_algo = {
@@ -1611,7 +1613,7 @@ static int tegra_i2c_probe(struct platform_device *pdev) } ret =devm_request_irq (&pdev->dev, i2c_dev->irq, - tegra_i2c_isr,0 ,dev_name (&pdev->dev), i2c_dev); + tegra_i2c_isr,0 ,dev_name (&pdev->dev), i2c_dev);if (ret) {dev_err (&pdev->dev,"Failed to request irq %i\n" , i2c_dev->irq); goto release_dma;
@@ -1704,6 +1706,7 @@ static const struct dev_pm_ops tegra_i2c_pm = {SET_RUNTIME_PM_OPS (tegra_i2c_runtime_suspend, tegra_i2c_runtime_resume,NULL ) }; +#define TEGRA_I2C_PM (&tegra_i2c_pm)#else #define TEGRA_I2C_PM NULL
Signature · 1 line
2.7.4
Re: [PATCH V1 3/6] i2c: tegra: fix alignment and spacing violations
07.06.2019 14:55, Bitan Biswas пишет:
Quoted 121 lines
Fix checkpatch.pl alignment and blank line check(s) in
i2c-tegra.cSigned-off-by Bitan Biswas <[email protected]>--- drivers/i2c/busses/i2c-tegra.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-)drivers/i2c/busses/i2c-tegra.c +18
-16@@ -295,7 +295,7 @@ static u32 dvc_readl(struct tegra_i2c_dev *i2c_dev, unsigned long reg)* to the I2C block inside the DVC block */ static unsigned long tegra_i2c_reg_addr (struct tegra_i2c_dev *i2c_dev, -unsigned long reg) +unsigned long reg) {if (i2c_dev->is_dvc) reg += (reg >=I2C_TX_FIFO ) ?0x10 :0x40 ;@@ -303,7 +303,7 @@ static unsigned long tegra_i2c_reg_addr(struct tegra_i2c_dev *i2c_dev, }static void i2c_writel (struct tegra_i2c_dev *i2c_dev,u32 val, -unsigned long reg) +unsigned long reg) {writel (val, i2c_dev->base +tegra_i2c_reg_addr (i2c_dev, reg));@@ -318,13 +318,13 @@ static u32 i2c_readl(struct tegra_i2c_dev *i2c_dev, unsigned long reg) }static void i2c_writesl (struct tegra_i2c_dev *i2c_dev,void *data, -unsigned long reg,int len) +unsigned long reg,int len) {writesl (i2c_dev->base +tegra_i2c_reg_addr (i2c_dev, reg), data, len); }static void i2c_readsl (struct tegra_i2c_dev *i2c_dev,void *data, -unsigned long reg,int len) +unsigned long reg,int len) {readsl (i2c_dev->base +tegra_i2c_reg_addr (i2c_dev, reg), data, len); }@@ -669,10 +669,11 @@ static int tegra_i2c_wait_for_config_load(struct tegra_i2c_dev *i2c_dev)i2c_writel (i2c_dev,I2C_MSTR_CONFIG_LOAD ,I2C_CONFIG_LOAD );if (in_interrupt ()) err =readl_poll_timeout_atomic (addr, val, val ==0 , -1000 ,I2C_CONFIG_LOAD_TIMEOUT ); +1000 , +I2C_CONFIG_LOAD_TIMEOUT );else - err =readl_poll_timeout (addr, val, val ==0 , -1000 ,I2C_CONFIG_LOAD_TIMEOUT ); + err =readl_poll_timeout (addr, val, val ==0 ,1000 , +I2C_CONFIG_LOAD_TIMEOUT );if (err) { dev_warn(i2c_dev->dev,@@ -1013,7 +1014,8 @@ static int tegra_i2c_issue_bus_clear(struct i2c_adapter *adap) }static int tegra_i2c_xfer_msg (struct tegra_i2c_dev *i2c_dev, -struct i2c_msg *msg,enum msg_end_type end_state) +struct i2c_msg *msg, +enum msg_end_type end_state) {u32 packet_header;u32 int_mask;@@ -1150,9 +1152,8 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,if (err)return err; - time_left =wait_for_completion_timeout ( - &i2c_dev->dma_complete, -msecs_to_jiffies (xfer_time)); + time_left =wait_for_completion_timeout (&i2c_dev->dma_complete, +msecs_to_jiffies (xfer_time));if (time_left ==0 ) {dev_err (i2c_dev->dev,"DMA transfer timeout\n" ); dmaengine_terminate_sync(i2c_dev->msg_read ?@@ -1214,7 +1215,7 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev, }static int tegra_i2c_xfer (struct i2c_adapter *adap,struct i2c_msg msgs[], -int num) +int num) {struct tegra_i2c_dev *i2c_dev =i2c_get_adapdata (adap);int i;@@ -1260,14 +1261,15 @@ static void tegra_i2c_parse_dt(struct tegra_i2c_dev *i2c_dev) {struct device_node *np = i2c_dev->dev->of_node;int ret; +bool multi_mode; ret =of_property_read_u32 (np,"clock-frequency" , - &i2c_dev->bus_clk_rate); + &i2c_dev->bus_clk_rate);if (ret) i2c_dev->bus_clk_rate =100000 ;/* default clock rate */ - i2c_dev->is_multimaster_mode =of_property_read_bool (np, -"multi-master" ); + multi_mode =of_property_read_bool (np,"multi-master" ); + i2c_dev->is_multimaster_mode = multi_mode; }static const struct i2c_algorithm tegra_i2c_algo = {@@ -1611,7 +1613,7 @@ static int tegra_i2c_probe(struct platform_device *pdev) } ret =devm_request_irq (&pdev->dev, i2c_dev->irq, - tegra_i2c_isr,0 ,dev_name (&pdev->dev), i2c_dev); + tegra_i2c_isr,0 ,dev_name (&pdev->dev), i2c_dev);if (ret) {dev_err (&pdev->dev,"Failed to request irq %i\n" , i2c_dev->irq); goto release_dma;
drivers/i2c/busses/i2c-tegra.c static const struct dev_pm_ops tegra_i2c_pm = { · line 1712
Quoted 7 lines
drivers/i2c/busses/i2c-tegra.c +1
-0@@ -1704,6 +1706,7 @@ static const struct dev_pm_ops tegra_i2c_pm = {SET_RUNTIME_PM_OPS (tegra_i2c_runtime_suspend, tegra_i2c_runtime_resume,NULL ) }; +#define TEGRA_I2C_PM (&tegra_i2c_pm)#else #define TEGRA_I2C_PM NULL
Very nice!
PATCH 4/6 i2c: tegra: add spinlock definition comment
In reply to Bitan BiswasFix checkpatch.pl CHECK as follows:
CHECK: spinlock_t definition without comment
+ spinlock_t xfer_lock;
--- drivers/i2c/busses/i2c-tegra.c | 1 + 1 file changed, 1 insertion(+)
drivers/i2c/busses/i2c-tegra.c +1 -0
@@ -269,6 +269,7 @@ struct tegra_i2c_dev {u32 bus_clk_rate;u16 clk_divisor_non_hs_mode;bool is_multimaster_mode; +/* xfer_lock: lock to serialize transfer submission and processing */ spinlock_t xfer_lock;struct dma_chan *tx_dma_chan;struct dma_chan *rx_dma_chan;
Signature · 1 line
2.7.4
Re: [PATCH V1 4/6] i2c: tegra: add spinlock definition comment
07.06.2019 14:55, Bitan Biswas пишет:
Quoted 15 lines
Fix checkpatch.pl CHECK as follows:
CHECK:spinlock_tdefinition without comment
+spinlock_txfer_lock;Signed-off-by Bitan Biswas <[email protected]>--- drivers/i2c/busses/i2c-tegra.c | 1 + 1 file changed, 1 insertion(+)drivers/i2c/busses/i2c-tegra.c +0
-0
drivers/i2c/busses/i2c-tegra.c struct tegra_i2c_dev { · line 275
Quoted 7 lines
drivers/i2c/busses/i2c-tegra.c +1
-0@@ -269,6 +269,7 @@ struct tegra_i2c_dev {u32 bus_clk_rate;u16 clk_divisor_non_hs_mode;bool is_multimaster_mode; +/* xfer_lock: lock to serialize transfer submission and processing */ spinlock_t xfer_lock;struct dma_chan *tx_dma_chan;struct dma_chan *rx_dma_chan;
Thanks!
PATCH 5/6 i2c: tegra: fix msleep warning
In reply to Bitan BiswasFix checkpatch.pl WARNING for delay of approximately 1msec in flush i2c FIFO polling loop by using usleep_range(1000, 2000):
WARNING: msleep < 20ms can sleep for up to 20ms; see ... Documentation/timers/timers-howto.txt
+ msleep(1);
--- drivers/i2c/busses/i2c-tegra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-tegra.c +1 -1
@@ -476,7 +476,7 @@ static int tegra_i2c_flush_fifos(struct tegra_i2c_dev *i2c_dev)dev_warn (i2c_dev->dev,"timeout waiting for fifo flush\n" );return -ETIMEDOUT ; } -msleep (1 ); +usleep_range (1000 ,2000 ); }return 0 ; }
Signature · 1 line
2.7.4
Re: [PATCH V1 5/6] i2c: tegra: fix msleep warning
07.06.2019 14:55, Bitan Biswas пишет:
Quoted 17 lines
Fix checkpatch.pl WARNING for delay of approximately 1msec in flush i2c FIFO polling loop by using
usleep_range(1000, 2000):
WARNING: msleep < 20ms can sleep for up to 20ms; see ...Documentation/timers/timers-howto.txt
+ msleep(1);Signed-off-by Bitan Biswas <[email protected]>--- drivers/i2c/busses/i2c-tegra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/i2c/busses/i2c-tegra.c +0
-0
drivers/i2c/busses/i2c-tegra.c static int tegra_i2c_flush_fifos(struct tegra_i2c_dev *i2c_dev) · line 482
Quoted 8 lines
drivers/i2c/busses/i2c-tegra.c +1
-1@@ -476,7 +476,7 @@ static int tegra_i2c_flush_fifos(struct tegra_i2c_dev *i2c_dev)dev_warn (i2c_dev->dev,"timeout waiting for fifo flush\n" );return -ETIMEDOUT ; } -msleep (1 ); +usleep_range (1000 ,2000 ); }return 0 ; }
Awesome!
PATCH 6/6 i2c: tegra: remove BUG, BUG_ON
In reply to Bitan BiswasRemove redundant BUG_ON calls or replace with WARN_ON_ONCE as needed. Replace BUG() with error handling code. Define I2C_ERR_UNEXPECTED_STATUS for error handling.
--- drivers/i2c/busses/i2c-tegra.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/i2c/busses/i2c-tegra.c +8 -7
@@ -73,6 +73,7 @@#define I2C_ERR_NO_ACK BIT(0)#define I2C_ERR_ARBITRATION_LOST BIT(1)#define I2C_ERR_UNKNOWN_INTERRUPT BIT(2) +#define I2C_ERR_UNEXPECTED_STATUS BIT(3)#define PACKET_HEADER0_HEADER_SIZE_SHIFT 28#define PACKET_HEADER0_PACKET_ID_SHIFT 16
@@ -515,7 +516,6 @@ static int tegra_i2c_empty_rx_fifo(struct tegra_i2c_dev *i2c_dev)* prevent overwriting past the end of buf */ if (rx_fifo_avail >0 && buf_remaining >0 ) { -BUG_ON (buf_remaining >3 ); val =i2c_readl (i2c_dev,I2C_RX_FIFO ); val =cpu_to_le32 (val);memcpy (buf, &val, buf_remaining);
@@ -523,7 +523,6 @@ static int tegra_i2c_empty_rx_fifo(struct tegra_i2c_dev *i2c_dev) rx_fifo_avail--; } -BUG_ON (rx_fifo_avail >0 && buf_remaining >0 ); i2c_dev->msg_buf_remaining = buf_remaining; i2c_dev->msg_buf = buf;
@@ -581,7 +580,6 @@ static int tegra_i2c_fill_tx_fifo(struct tegra_i2c_dev *i2c_dev)* boundary and fault. */ if (tx_fifo_avail >0 && buf_remaining >0 ) { -BUG_ON (buf_remaining >3 );memcpy (&val, buf, buf_remaining); val =le32_to_cpu (val);
@@ -847,10 +845,13 @@ static irqreturn_t tegra_i2c_isr(int irq, void *dev_id)if (!i2c_dev->is_curr_dma_xfer) {if (i2c_dev->msg_read && (status &I2C_INT_RX_FIFO_DATA_REQ )) { -if (i2c_dev->msg_buf_remaining) +if (i2c_dev->msg_buf_remaining) {tegra_i2c_empty_rx_fifo (i2c_dev); -else -BUG (); + }else { +dev_err (i2c_dev->dev,"unexpected rx data request\n" ); + i2c_dev->msg_err |=I2C_ERR_UNEXPECTED_STATUS ; + goto err; + } }if (!i2c_dev->msg_read && (status &I2C_INT_TX_FIFO_DATA_REQ )) {
@@ -876,7 +877,7 @@ static irqreturn_t tegra_i2c_isr(int irq, void *dev_id)if (status &I2C_INT_PACKET_XFER_COMPLETE ) {if (i2c_dev->is_curr_dma_xfer) i2c_dev->msg_buf_remaining =0 ; -BUG_ON (i2c_dev->msg_buf_remaining); +WARN_ON_ONCE (i2c_dev->msg_buf_remaining);complete (&i2c_dev->msg_complete); } goto done;
Signature · 1 line
2.7.4
Re: [PATCH V1 6/6] i2c: tegra: remove BUG, BUG_ON
07.06.2019 14:55, Bitan Biswas пишет:
Quoted 64 lines
Remove redundant
BUG_ONcalls or replace withWARN_ON_ONCEas needed. ReplaceBUG()with error handling code. DefineI2C_ERR_UNEXPECTED_STATUSfor error handling.Signed-off-by Bitan Biswas <[email protected]>--- drivers/i2c/busses/i2c-tegra.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)drivers/i2c/busses/i2c-tegra.c +7
-6@@ -73,6 +73,7 @@#define I2C_ERR_NO_ACK BIT(0)#define I2C_ERR_ARBITRATION_LOST BIT(1)#define I2C_ERR_UNKNOWN_INTERRUPT BIT(2) +#define I2C_ERR_UNEXPECTED_STATUS BIT(3)#define PACKET_HEADER0_HEADER_SIZE_SHIFT 28#define PACKET_HEADER0_PACKET_ID_SHIFT 16@@ -515,7 +516,6 @@ static int tegra_i2c_empty_rx_fifo(struct tegra_i2c_dev *i2c_dev)* prevent overwriting past the end of buf */ if (rx_fifo_avail >0 && buf_remaining >0 ) { -BUG_ON (buf_remaining >3 ); val =i2c_readl (i2c_dev,I2C_RX_FIFO ); val =cpu_to_le32 (val);memcpy (buf, &val, buf_remaining);@@ -523,7 +523,6 @@ static int tegra_i2c_empty_rx_fifo(struct tegra_i2c_dev *i2c_dev) rx_fifo_avail--; } -BUG_ON (rx_fifo_avail >0 && buf_remaining >0 ); i2c_dev->msg_buf_remaining = buf_remaining; i2c_dev->msg_buf = buf;@@ -581,7 +580,6 @@ static int tegra_i2c_fill_tx_fifo(struct tegra_i2c_dev *i2c_dev)* boundary and fault. */ if (tx_fifo_avail >0 && buf_remaining >0 ) { -BUG_ON (buf_remaining >3 );memcpy (&val, buf, buf_remaining); val =le32_to_cpu (val);@@ -847,10 +845,13 @@ static irqreturn_t tegra_i2c_isr(int irq, void *dev_id)if (!i2c_dev->is_curr_dma_xfer) {if (i2c_dev->msg_read && (status &I2C_INT_RX_FIFO_DATA_REQ )) { -if (i2c_dev->msg_buf_remaining) +if (i2c_dev->msg_buf_remaining) {tegra_i2c_empty_rx_fifo (i2c_dev); -else -BUG (); + }else { +dev_err (i2c_dev->dev,"unexpected rx data request\n" ); + i2c_dev->msg_err |=I2C_ERR_UNEXPECTED_STATUS ; + goto err; + } }if (!i2c_dev->msg_read && (status &I2C_INT_TX_FIFO_DATA_REQ )) {
drivers/i2c/busses/i2c-tegra.c static irqreturn_t tegra_i2c_isr(int irq, void *dev_id) · line 883
Quoted 8 lines
drivers/i2c/busses/i2c-tegra.c +1
-1@@ -876,7 +877,7 @@ static irqreturn_t tegra_i2c_isr(int irq, void *dev_id)if (status &I2C_INT_PACKET_XFER_COMPLETE ) {if (i2c_dev->is_curr_dma_xfer) i2c_dev->msg_buf_remaining =0 ; -BUG_ON (i2c_dev->msg_buf_remaining); +WARN_ON_ONCE (i2c_dev->msg_buf_remaining);complete (&i2c_dev->msg_complete); } goto done;
Very nice, thank you very much! BTW, I think it may worth to add another patch that will reset hardware state in a case of the warning since we know that something gone wrong.
Dmitry Osipenko
reviewerRe: [PATCH V1 6/6] i2c: tegra: remove BUG, BUG_ON
07.06.2019 15:08, Dmitry Osipenko пишет:
Quoted 78 lines
07.06.2019 14:55, Bitan Biswas пишет:
Quoted 64 lines
Remove redundant
BUG_ONcalls or replace withWARN_ON_ONCEas needed. ReplaceBUG()with error handling code. DefineI2C_ERR_UNEXPECTED_STATUSfor error handling.Signed-off-by Bitan Biswas <[email protected]>--- drivers/i2c/busses/i2c-tegra.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)drivers/i2c/busses/i2c-tegra.c +7
-6@@ -73,6 +73,7 @@#define I2C_ERR_NO_ACK BIT(0)#define I2C_ERR_ARBITRATION_LOST BIT(1)#define I2C_ERR_UNKNOWN_INTERRUPT BIT(2) +#define I2C_ERR_UNEXPECTED_STATUS BIT(3)#define PACKET_HEADER0_HEADER_SIZE_SHIFT 28#define PACKET_HEADER0_PACKET_ID_SHIFT 16@@ -515,7 +516,6 @@ static int tegra_i2c_empty_rx_fifo(struct tegra_i2c_dev *i2c_dev)* prevent overwriting past the end of buf */ if (rx_fifo_avail >0 && buf_remaining >0 ) { -BUG_ON (buf_remaining >3 ); val =i2c_readl (i2c_dev,I2C_RX_FIFO ); val =cpu_to_le32 (val);memcpy (buf, &val, buf_remaining);@@ -523,7 +523,6 @@ static int tegra_i2c_empty_rx_fifo(struct tegra_i2c_dev *i2c_dev) rx_fifo_avail--; } -BUG_ON (rx_fifo_avail >0 && buf_remaining >0 ); i2c_dev->msg_buf_remaining = buf_remaining; i2c_dev->msg_buf = buf;@@ -581,7 +580,6 @@ static int tegra_i2c_fill_tx_fifo(struct tegra_i2c_dev *i2c_dev)* boundary and fault. */ if (tx_fifo_avail >0 && buf_remaining >0 ) { -BUG_ON (buf_remaining >3 );memcpy (&val, buf, buf_remaining); val =le32_to_cpu (val);@@ -847,10 +845,13 @@ static irqreturn_t tegra_i2c_isr(int irq, void *dev_id)if (!i2c_dev->is_curr_dma_xfer) {if (i2c_dev->msg_read && (status &I2C_INT_RX_FIFO_DATA_REQ )) { -if (i2c_dev->msg_buf_remaining) +if (i2c_dev->msg_buf_remaining) {tegra_i2c_empty_rx_fifo (i2c_dev); -else -BUG (); + }else { +dev_err (i2c_dev->dev,"unexpected rx data request\n" ); + i2c_dev->msg_err |=I2C_ERR_UNEXPECTED_STATUS ; + goto err; + } }if (!i2c_dev->msg_read && (status &I2C_INT_TX_FIFO_DATA_REQ )) {drivers/i2c/busses/i2c-tegra.c static irqreturn_t tegra_i2c_isr(int irq, void *dev_id) · line 883
Quoted 8 lines
drivers/i2c/busses/i2c-tegra.c +1
-1@@ -876,7 +877,7 @@ static irqreturn_t tegra_i2c_isr(int irq, void *dev_id)if (status &I2C_INT_PACKET_XFER_COMPLETE ) {if (i2c_dev->is_curr_dma_xfer) i2c_dev->msg_buf_remaining =0 ; -BUG_ON (i2c_dev->msg_buf_remaining); +WARN_ON_ONCE (i2c_dev->msg_buf_remaining);complete (&i2c_dev->msg_complete); } goto done;Very nice, thank you very much! BTW, I think it may worth to add another patch that will reset hardware state in a case of the warning since we know that something gone wrong.
Quoted 2 lines
Reviewed-by Dmitry Osipenko <[email protected]>
Something like that:
complete(&i2c_dev->msg_complete);
if (WARN_ON_ONCE(i2c_dev->msg_buf_remaining)) goto err;
Dmitry Osipenko
reviewerRe: [PATCH V1 6/6] i2c: tegra: remove BUG, BUG_ON
07.06.2019 15:12, Dmitry Osipenko пишет:
Quoted 82 lines
07.06.2019 15:08, Dmitry Osipenko пишет:
Quoted 78 lines
07.06.2019 14:55, Bitan Biswas пишет:
Quoted 64 lines
Remove redundant
BUG_ONcalls or replace withWARN_ON_ONCEas needed. ReplaceBUG()with error handling code. DefineI2C_ERR_UNEXPECTED_STATUSfor error handling.Signed-off-by Bitan Biswas <[email protected]>--- drivers/i2c/busses/i2c-tegra.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)drivers/i2c/busses/i2c-tegra.c +7
-6@@ -73,6 +73,7 @@#define I2C_ERR_NO_ACK BIT(0)#define I2C_ERR_ARBITRATION_LOST BIT(1)#define I2C_ERR_UNKNOWN_INTERRUPT BIT(2) +#define I2C_ERR_UNEXPECTED_STATUS BIT(3)#define PACKET_HEADER0_HEADER_SIZE_SHIFT 28#define PACKET_HEADER0_PACKET_ID_SHIFT 16@@ -515,7 +516,6 @@ static int tegra_i2c_empty_rx_fifo(struct tegra_i2c_dev *i2c_dev)* prevent overwriting past the end of buf */ if (rx_fifo_avail >0 && buf_remaining >0 ) { -BUG_ON (buf_remaining >3 ); val =i2c_readl (i2c_dev,I2C_RX_FIFO ); val =cpu_to_le32 (val);memcpy (buf, &val, buf_remaining);@@ -523,7 +523,6 @@ static int tegra_i2c_empty_rx_fifo(struct tegra_i2c_dev *i2c_dev) rx_fifo_avail--; } -BUG_ON (rx_fifo_avail >0 && buf_remaining >0 ); i2c_dev->msg_buf_remaining = buf_remaining; i2c_dev->msg_buf = buf;@@ -581,7 +580,6 @@ static int tegra_i2c_fill_tx_fifo(struct tegra_i2c_dev *i2c_dev)* boundary and fault. */ if (tx_fifo_avail >0 && buf_remaining >0 ) { -BUG_ON (buf_remaining >3 );memcpy (&val, buf, buf_remaining); val =le32_to_cpu (val);@@ -847,10 +845,13 @@ static irqreturn_t tegra_i2c_isr(int irq, void *dev_id)if (!i2c_dev->is_curr_dma_xfer) {if (i2c_dev->msg_read && (status &I2C_INT_RX_FIFO_DATA_REQ )) { -if (i2c_dev->msg_buf_remaining) +if (i2c_dev->msg_buf_remaining) {tegra_i2c_empty_rx_fifo (i2c_dev); -else -BUG (); + }else { +dev_err (i2c_dev->dev,"unexpected rx data request\n" ); + i2c_dev->msg_err |=I2C_ERR_UNEXPECTED_STATUS ; + goto err; + } }if (!i2c_dev->msg_read && (status &I2C_INT_TX_FIFO_DATA_REQ )) {drivers/i2c/busses/i2c-tegra.c static irqreturn_t tegra_i2c_isr(int irq, void *dev_id) · line 883
Quoted 8 lines
drivers/i2c/busses/i2c-tegra.c +1
-1@@ -876,7 +877,7 @@ static irqreturn_t tegra_i2c_isr(int irq, void *dev_id)if (status &I2C_INT_PACKET_XFER_COMPLETE ) {if (i2c_dev->is_curr_dma_xfer) i2c_dev->msg_buf_remaining =0 ; -BUG_ON (i2c_dev->msg_buf_remaining); +WARN_ON_ONCE (i2c_dev->msg_buf_remaining);complete (&i2c_dev->msg_complete); } goto done;Very nice, thank you very much! BTW, I think it may worth to add another patch that will reset hardware state in a case of the warning since we know that something gone wrong.
Quoted 2 lines
Reviewed-by Dmitry Osipenko <[email protected]>
Quoted 7 lines
Something like that:
complete(&i2c_dev->msg_complete);if (WARN_ON_ONCE(i2c_dev->msg_buf_remaining)) goto err;
Ah, that's inside the ISR, so maybe will make sense to just not complete the transfer and let it timeout:
if (!WARN_ON_ONCE(i2c_dev->msg_buf_remaining)) complete(&i2c_dev->msg_complete);
Re: [PATCH V1 6/6] i2c: tegra: remove BUG, BUG_ON
Quoted 91 lines · Dmitry Osipenko
07.06.2019 15:12, Dmitry Osipenko пишет:
Quoted 82 lines
07.06.2019 15:08, Dmitry Osipenko пишет:
Quoted 78 lines
07.06.2019 14:55, Bitan Biswas пишет:
Quoted 64 lines
Remove redundant
BUG_ONcalls or replace withWARN_ON_ONCEas needed. ReplaceBUG()with error handling code. DefineI2C_ERR_UNEXPECTED_STATUSfor error handling.Signed-off-by Bitan Biswas <[email protected]>--- drivers/i2c/busses/i2c-tegra.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)drivers/i2c/busses/i2c-tegra.c +7
-6@@ -73,6 +73,7 @@#define I2C_ERR_NO_ACK BIT(0)#define I2C_ERR_ARBITRATION_LOST BIT(1)#define I2C_ERR_UNKNOWN_INTERRUPT BIT(2) +#define I2C_ERR_UNEXPECTED_STATUS BIT(3)#define PACKET_HEADER0_HEADER_SIZE_SHIFT 28#define PACKET_HEADER0_PACKET_ID_SHIFT 16@@ -515,7 +516,6 @@ static int tegra_i2c_empty_rx_fifo(struct tegra_i2c_dev *i2c_dev)* prevent overwriting past the end of buf */ if (rx_fifo_avail >0 && buf_remaining >0 ) { -BUG_ON (buf_remaining >3 ); val =i2c_readl (i2c_dev,I2C_RX_FIFO ); val =cpu_to_le32 (val);memcpy (buf, &val, buf_remaining);@@ -523,7 +523,6 @@ static int tegra_i2c_empty_rx_fifo(struct tegra_i2c_dev *i2c_dev) rx_fifo_avail--; } -BUG_ON (rx_fifo_avail >0 && buf_remaining >0 ); i2c_dev->msg_buf_remaining = buf_remaining; i2c_dev->msg_buf = buf;@@ -581,7 +580,6 @@ static int tegra_i2c_fill_tx_fifo(struct tegra_i2c_dev *i2c_dev)* boundary and fault. */ if (tx_fifo_avail >0 && buf_remaining >0 ) { -BUG_ON (buf_remaining >3 );memcpy (&val, buf, buf_remaining); val =le32_to_cpu (val);@@ -847,10 +845,13 @@ static irqreturn_t tegra_i2c_isr(int irq, void *dev_id)if (!i2c_dev->is_curr_dma_xfer) {if (i2c_dev->msg_read && (status &I2C_INT_RX_FIFO_DATA_REQ )) { -if (i2c_dev->msg_buf_remaining) +if (i2c_dev->msg_buf_remaining) {tegra_i2c_empty_rx_fifo (i2c_dev); -else -BUG (); + }else { +dev_err (i2c_dev->dev,"unexpected rx data request\n" ); + i2c_dev->msg_err |=I2C_ERR_UNEXPECTED_STATUS ; + goto err; + } }if (!i2c_dev->msg_read && (status &I2C_INT_TX_FIFO_DATA_REQ )) {drivers/i2c/busses/i2c-tegra.c static irqreturn_t tegra_i2c_isr(int irq, void *dev_id) · line 883
Quoted 8 lines
drivers/i2c/busses/i2c-tegra.c +1
-1@@ -876,7 +877,7 @@ static irqreturn_t tegra_i2c_isr(int irq, void *dev_id)if (status &I2C_INT_PACKET_XFER_COMPLETE ) {if (i2c_dev->is_curr_dma_xfer) i2c_dev->msg_buf_remaining =0 ; -BUG_ON (i2c_dev->msg_buf_remaining); +WARN_ON_ONCE (i2c_dev->msg_buf_remaining);complete (&i2c_dev->msg_complete); } goto done;Very nice, thank you very much! BTW, I think it may worth to add another patch that will reset hardware state in a case of the warning since we know that something gone wrong.
Quoted 2 lines
Reviewed-by Dmitry Osipenko <[email protected]>Quoted 7 lines
Something like that:
complete(&i2c_dev->msg_complete);if (WARN_ON_ONCE(i2c_dev->msg_buf_remaining)) goto err;
Quoted 5 lines
Ah, that's inside the ISR, so maybe will make sense to just not complete the transfer and let it timeout:
if (!WARN_ON_ONCE(i2c_dev->msg_buf_remaining)) complete(&i2c_dev->msg_complete);
OK. I shall send the updated patch.
-Thanks,
Bitan
Re: [PATCH V1 6/6] i2c: tegra: remove BUG, BUG_ON
Quoted 94 lines · Bitan Biswas
Quoted 91 lines · Dmitry Osipenko
07.06.2019 15:12, Dmitry Osipenko пишет:
Quoted 89 lines
07.06.2019 15:08, Dmitry Osipenko пишет:
Quoted 78 lines
07.06.2019 14:55, Bitan Biswas пишет:
Quoted 70 lines
Remove redundant
BUG_ONcalls or replace withWARN_ON_ONCEas needed. ReplaceBUG()with error handling code. DefineI2C_ERR_UNEXPECTED_STATUSfor error handling.Signed-off-by Bitan Biswas <[email protected]>---
drivers/i2c/busses/i2c-tegra.c| 15 ++++++++-------1 file changed, 8 insertions(+), 7 deletions(-)drivers/i2c/busses/i2c-tegra.c +1
-1@@ -73,6 +73,7 @@ #define I2C_ERR_NO_ACK BIT(0) #define I2C_ERR_ARBITRATION_LOST BIT(1) #define I2C_ERR_UNKNOWN_INTERRUPT BIT(2) +#define I2C_ERR_UNEXPECTED_STATUS BIT(3) #define PACKET_HEADER0_HEADER_SIZE_SHIFT 28 #define PACKET_HEADER0_PACKET_ID_SHIFT 16@@ -515,7 +516,6 @@ static int tegra_i2c_empty_rx_fifo(structtegra_i2c_dev *i2c_dev) * prevent overwriting past the end of buf */ if (rx_fifo_avail > 0 && buf_remaining > 0) { - BUG_ON(buf_remaining > 3); val = i2c_readl(i2c_dev, I2C_RX_FIFO); val = cpu_to_le32(val);
memcpy(buf, &val, buf_remaining);drivers/i2c/busses/i2c-tegra.c +7
-6@@ -523,7 +523,6 @@ static int tegra_i2c_empty_rx_fifo(struct tegra_i2c_dev *i2c_dev) rx_fifo_avail--; } - BUG_ON(rx_fifo_avail > 0 && buf_remaining > 0); i2c_dev->msg_buf_remaining = buf_remaining; i2c_dev->msg_buf = buf;@@ -581,7 +580,6 @@ static int tegra_i2c_fill_tx_fifo(structtegra_i2c_dev *i2c_dev) * boundary and fault. */ if (tx_fifo_avail > 0 && buf_remaining > 0) { - BUG_ON(buf_remaining > 3); memcpy(&val, buf, buf_remaining); val = le32_to_cpu(val);@@ -847,10 +845,13 @@ static irqreturn_t tegra_i2c_isr(int irq, void *dev_id) if (!i2c_dev->is_curr_dma_xfer) { if (i2c_dev->msg_read && (status & I2C_INT_RX_FIFO_DATA_REQ)) { - if (i2c_dev->msg_buf_remaining) + if (i2c_dev->msg_buf_remaining) { tegra_i2c_empty_rx_fifo(i2c_dev); - else - BUG(); + } else { + dev_err(i2c_dev->dev, "unexpected rx data request\n"); + i2c_dev->msg_err |= I2C_ERR_UNEXPECTED_STATUS; + goto err; + } } if (!i2c_dev->msg_read && (status & I2C_INT_TX_FIFO_DATA_REQ)) {@@ -876,7 +877,7 @@ static irqreturn_t tegra_i2c_isr(int irq, void *dev_id) if (status & I2C_INT_PACKET_XFER_COMPLETE) { if (i2c_dev->is_curr_dma_xfer) i2c_dev->msg_buf_remaining = 0; - BUG_ON(i2c_dev->msg_buf_remaining); + WARN_ON_ONCE(i2c_dev->msg_buf_remaining); complete(&i2c_dev->msg_complete); }Quoted 2 lines
goto done;
Very nice, thank you very much! BTW, I think it may worth to add another patch that will reset hardware state in a case of the warning since we know that something gone wrong.
Quoted 2 lines
Reviewed-by Dmitry Osipenko <[email protected]>Something like that:
complete(&i2c_dev->msg_complete);if (
WARN_ON_ONCE(i2c_dev->msg_buf_remaining))
goto err;
Quoted 6 lines
Quoted 5 lines
Ah, that's inside the ISR, so maybe will make sense to just not complete the transfer and let it timeout:
if (!WARN_ON_ONCE(i2c_dev->msg_buf_remaining))
complete(&i2c_dev->msg_complete);OK. I shall send the updated patch.
I see that there is already err label in the ISR that could be jumped into. Hence, planning to share updated patch with the error handling.
-regards,
Bitan
07.06.2019 14:55, Bitan Biswas пишет:
Quoted 73 lines
Clean up macros by:
1) removing unused macros
2) replace constants by macroBIT()Signed-off-by Bitan Biswas <[email protected]>--- drivers/i2c/busses/i2c-tegra.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-)drivers/i2c/busses/i2c-tegra.c +3
-13@@ -54,20 +54,15 @@#define I2C_INT_STATUS 0x068#define I2C_INT_BUS_CLR_DONE BIT(11)#define I2C_INT_PACKET_XFER_COMPLETE BIT(7) -#define I2C_INT_ALL_PACKETS_XFER_COMPLETE BIT(6) -#define I2C_INT_TX_FIFO_OVERFLOW BIT(5) -#define I2C_INT_RX_FIFO_UNDERFLOW BIT(4)#define I2C_INT_NO_ACK BIT(3)#define I2C_INT_ARBITRATION_LOST BIT(2)#define I2C_INT_TX_FIFO_DATA_REQ BIT(1)#define I2C_INT_RX_FIFO_DATA_REQ BIT(0)#define I2C_CLK_DIVISOR 0x06c#define I2C_CLK_DIVISOR_STD_FAST_MODE_SHIFT 16 -#define I2C_CLK_MULTIPLIER_STD_FAST_MODE 8#define DVC_CTRL_REG1 0x000#define DVC_CTRL_REG1_INTR_EN BIT(10) -#define DVC_CTRL_REG2 0x004#define DVC_CTRL_REG3 0x008#define DVC_CTRL_REG3_SW_PROG BIT(26)#define DVC_CTRL_REG3_I2C_DONE_INTR_EN BIT(30)@@ -75,24 +70,21 @@#define DVC_STATUS_I2C_DONE_INTR BIT(30)#define I2C_ERR_NONE 0x00 -#define I2C_ERR_NO_ACK 0x01 -#define I2C_ERR_ARBITRATION_LOST 0x02 -#define I2C_ERR_UNKNOWN_INTERRUPT 0x04 +#define I2C_ERR_NO_ACK BIT(0) +#define I2C_ERR_ARBITRATION_LOST BIT(1) +#define I2C_ERR_UNKNOWN_INTERRUPT BIT(2)#define PACKET_HEADER0_HEADER_SIZE_SHIFT 28#define PACKET_HEADER0_PACKET_ID_SHIFT 16#define PACKET_HEADER0_CONT_ID_SHIFT 12#define PACKET_HEADER0_PROTOCOL_I2C BIT(4) -#define I2C_HEADER_HIGHSPEED_MODE BIT(22)#define I2C_HEADER_CONT_ON_NAK BIT(21) -#define I2C_HEADER_SEND_START_BYTE BIT(20)#define I2C_HEADER_READ BIT(19)#define I2C_HEADER_10BIT_ADDR BIT(18)#define I2C_HEADER_IE_ENABLE BIT(17)#define I2C_HEADER_REPEAT_START BIT(16)#define I2C_HEADER_CONTINUE_XFER BIT(15) -#define I2C_HEADER_MASTER_ADDR_SHIFT 12#define I2C_HEADER_SLAVE_ADDR_SHIFT 1#define I2C_BUS_CLEAR_CNFG 0x084@@ -106,8 +98,6 @@#define I2C_CONFIG_LOAD 0x08C#define I2C_MSTR_CONFIG_LOAD BIT(0) -#define I2C_SLV_CONFIG_LOAD BIT(1) -#define I2C_TIMEOUT_CONFIG_LOAD BIT(2)#define I2C_CLKEN_OVERRIDE 0x090#define I2C_MST_CORE_CLKEN_OVR BIT(0)
drivers/i2c/busses/i2c-tegra.c line 128
Quoted 7 lines
drivers/i2c/busses/i2c-tegra.c +0
-1@@ -133,7 +123,6 @@#define I2C_STANDARD_MODE 100000#define I2C_FAST_MODE 400000#define I2C_FAST_PLUS_MODE 1000000 -#define I2C_HS_MODE 3500000/* Packet header size in bytes */ #define I2C_PACKET_HEADER_SIZE 12
Looks good!