Message ID | 1502506672-7620-3-git-send-email-jun.gao@mediatek.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
> +static const struct i2c_adapter_quirks mt7622_i2c_quirks = { > + .max_num_msgs = 255, > + .max_write_len = 65535, > + .max_read_len = 65535, > + .max_comb_1st_msg_len = 65535, > + .max_comb_2nd_msg_len = 65535, > +}; That looks like no quirks? Then just leave the quirks pointer below empty.
On Sat, 2017-08-12 at 16:44 +0200, Wolfram Sang wrote: > > +static const struct i2c_adapter_quirks mt7622_i2c_quirks = { > > + .max_num_msgs = 255, > > + .max_write_len = 65535, > > + .max_read_len = 65535, > > + .max_comb_1st_msg_len = 65535, > > + .max_comb_2nd_msg_len = 65535, > > +}; > > That looks like no quirks? Then just leave the quirks pointer below > empty. > Compare to MT8173 i2c controller, MT7622 limits message numbers to 255. Jun
On Mon, Aug 14, 2017 at 09:36:56AM +0800, Jun Gao wrote: > On Sat, 2017-08-12 at 16:44 +0200, Wolfram Sang wrote: > > > +static const struct i2c_adapter_quirks mt7622_i2c_quirks = { > > > + .max_num_msgs = 255, > > > + .max_write_len = 65535, > > > + .max_read_len = 65535, > > > + .max_comb_1st_msg_len = 65535, > > > + .max_comb_2nd_msg_len = 65535, > > > +}; > > > > That looks like no quirks? Then just leave the quirks pointer below > > empty. > > > Compare to MT8173 i2c controller, MT7622 limits message numbers to 255. I see. But you can safely drop all the length settings. The i2c core has this comment in quirk handling: /* Check if val is exceeding the quirk IFF quirk is non 0 */ IFF means "if and only if".
diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c index 9bedf0b..2c7f847 100644 --- a/drivers/i2c/busses/i2c-mt65xx.c +++ b/drivers/i2c/busses/i2c-mt65xx.c @@ -172,6 +172,14 @@ struct mtk_i2c { .max_comb_2nd_msg_len = 31, }; +static const struct i2c_adapter_quirks mt7622_i2c_quirks = { + .max_num_msgs = 255, + .max_write_len = 65535, + .max_read_len = 65535, + .max_comb_1st_msg_len = 65535, + .max_comb_2nd_msg_len = 65535, +}; + static const struct mtk_i2c_compatible mt6577_compat = { .quirks = &mt6577_i2c_quirks, .pmic_i2c = 0, @@ -190,6 +198,15 @@ struct mtk_i2c { .support_33bits = 0, }; +static const struct mtk_i2c_compatible mt7622_compat = { + .quirks = &mt7622_i2c_quirks, + .pmic_i2c = 0, + .dcm = 1, + .auto_restart = 1, + .aux_len_reg = 1, + .support_33bits = 0, +}; + static const struct mtk_i2c_compatible mt8173_compat = { .pmic_i2c = 0, .dcm = 1, @@ -201,6 +218,7 @@ struct mtk_i2c { static const struct of_device_id mtk_i2c_of_match[] = { { .compatible = "mediatek,mt6577-i2c", .data = &mt6577_compat }, { .compatible = "mediatek,mt6589-i2c", .data = &mt6589_compat }, + { .compatible = "mediatek,mt7622-i2c", .data = &mt7622_compat }, { .compatible = "mediatek,mt8173-i2c", .data = &mt8173_compat }, {} };