lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 7 Jul 2022 10:43:58 +0200
From:   AngeloGioacchino Del Regno 
        <angelogioacchino.delregno@...labora.com>
To:     Kewei Xu <kewei.xu@...iatek.com>, wsa@...-dreams.de
Cc:     matthias.bgg@...il.com, robh+dt@...nel.org,
        linux-i2c@...r.kernel.org, devicetree@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        linux-mediatek@...ts.infradead.org, srv_heupstream@...iatek.com,
        leilk.liu@...iatek.com, qii.wang@...iatek.com,
        liguo.zhang@...iatek.com, caiyu.chen@...iatek.com,
        housong.zhang@...iatek.com, yuhan.wei@...iatek.com,
        david-yh.chiu@...iatek.com, liju-clr.chen@...iatek.com
Subject: Re: [PATCH 2/2] i2c: mediatek: Add i2c compatible for Mediatek MT8188

Il 07/07/22 07:46, Kewei Xu ha scritto:
> Add i2c compatible for MT8188. Compare to MT8192 i2c controller,
> The MT8188 i2c OFFSET_SLAVE_ADDR register changed from 0x04 to 0x94.
> 
> Signed-off-by: Kewei Xu <kewei.xu@...iatek.com>
> ---
>   drivers/i2c/busses/i2c-mt65xx.c | 41 +++++++++++++++++++++++++++++++--
>   1 file changed, 39 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c
> index 8e6985354fd5..aa2e1cb87420 100644
> --- a/drivers/i2c/busses/i2c-mt65xx.c
> +++ b/drivers/i2c/busses/i2c-mt65xx.c
> @@ -135,6 +135,7 @@ enum mtk_trans_op {
>   enum I2C_REGS_OFFSET {
>   	OFFSET_DATA_PORT,
>   	OFFSET_SLAVE_ADDR,
> +	OFFSET_SLAVE_ADDR1,
>   	OFFSET_INTR_MASK,
>   	OFFSET_INTR_STAT,
>   	OFFSET_CONTROL,
> @@ -203,6 +204,7 @@ static const u16 mt_i2c_regs_v1[] = {
>   static const u16 mt_i2c_regs_v2[] = {
>   	[OFFSET_DATA_PORT] = 0x0,
>   	[OFFSET_SLAVE_ADDR] = 0x4,
> +	[OFFSET_SLAVE_ADDR1] = 0x94,

Instead of adding a "slave addr version" entry... you can as well just define
a new array here with an appropriate name.

static const u16 mt_i2c_regs_v3[] = {

.......

}

This way, you don't have to change all of the platform data entries and you
also won't have to add checks in the do_transfer function, as that's one of
the actual points of having these arrays of register offsets in here.

Regards,
Angelo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ