@@ -296,6 +296,8 @@ struct tegra_i2c_dev {
296296 bool is_vi ;
297297};
298298
299+ #define IS_DVC (dev ) (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && (dev)->is_dvc)
300+
299301static void dvc_writel (struct tegra_i2c_dev * i2c_dev , u32 val ,
300302 unsigned int reg )
301303{
@@ -313,7 +315,7 @@ static u32 dvc_readl(struct tegra_i2c_dev *i2c_dev, unsigned int reg)
313315 */
314316static u32 tegra_i2c_reg_addr (struct tegra_i2c_dev * i2c_dev , unsigned int reg )
315317{
316- if (i2c_dev -> is_dvc )
318+ if (IS_DVC ( i2c_dev ) )
317319 reg += (reg >= I2C_TX_FIFO ) ? 0x10 : 0x40 ;
318320 else if (i2c_dev -> is_vi )
319321 reg = 0xc00 + (reg << 2 );
@@ -622,7 +624,7 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev)
622624
623625 WARN_ON_ONCE (err );
624626
625- if (i2c_dev -> is_dvc )
627+ if (IS_DVC ( i2c_dev ) )
626628 tegra_dvc_init (i2c_dev );
627629
628630 val = I2C_CNFG_NEW_MASTER_FSM | I2C_CNFG_PACKET_MODE_EN |
@@ -686,7 +688,7 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev)
686688 return err ;
687689 }
688690
689- if (!i2c_dev -> is_dvc && !i2c_dev -> is_vi ) {
691+ if (!IS_DVC ( i2c_dev ) && !i2c_dev -> is_vi ) {
690692 u32 sl_cfg = i2c_readl (i2c_dev , I2C_SL_CNFG );
691693
692694 sl_cfg |= I2C_SL_CNFG_NACK | I2C_SL_CNFG_NEWSL ;
@@ -916,7 +918,7 @@ static irqreturn_t tegra_i2c_isr(int irq, void *dev_id)
916918 }
917919
918920 i2c_writel (i2c_dev , status , I2C_INT_STATUS );
919- if (i2c_dev -> is_dvc )
921+ if (IS_DVC ( i2c_dev ) )
920922 dvc_writel (i2c_dev , DVC_STATUS_I2C_DONE_INTR , DVC_STATUS );
921923
922924 /*
@@ -955,7 +957,7 @@ static irqreturn_t tegra_i2c_isr(int irq, void *dev_id)
955957
956958 i2c_writel (i2c_dev , status , I2C_INT_STATUS );
957959
958- if (i2c_dev -> is_dvc )
960+ if (IS_DVC ( i2c_dev ) )
959961 dvc_writel (i2c_dev , DVC_STATUS_I2C_DONE_INTR , DVC_STATUS );
960962
961963 if (i2c_dev -> dma_mode ) {
@@ -1631,7 +1633,9 @@ static const struct of_device_id tegra_i2c_of_match[] = {
16311633 { .compatible = "nvidia,tegra114-i2c" , .data = & tegra114_i2c_hw , },
16321634 { .compatible = "nvidia,tegra30-i2c" , .data = & tegra30_i2c_hw , },
16331635 { .compatible = "nvidia,tegra20-i2c" , .data = & tegra20_i2c_hw , },
1636+ #if IS_ENABLED (CONFIG_ARCH_TEGRA_2x_SOC )
16341637 { .compatible = "nvidia,tegra20-i2c-dvc" , .data = & tegra20_i2c_hw , },
1638+ #endif
16351639 {},
16361640};
16371641MODULE_DEVICE_TABLE (of , tegra_i2c_of_match );
@@ -1646,7 +1650,8 @@ static void tegra_i2c_parse_dt(struct tegra_i2c_dev *i2c_dev)
16461650 multi_mode = device_property_read_bool (i2c_dev -> dev , "multi-master" );
16471651 i2c_dev -> multimaster_mode = multi_mode ;
16481652
1649- if (of_device_is_compatible (np , "nvidia,tegra20-i2c-dvc" ))
1653+ if (IS_ENABLED (CONFIG_ARCH_TEGRA_2x_SOC ) &&
1654+ of_device_is_compatible (np , "nvidia,tegra20-i2c-dvc" ))
16501655 i2c_dev -> is_dvc = true;
16511656
16521657 if (of_device_is_compatible (np , "nvidia,tegra210-i2c-vi" ))
0 commit comments