[PATCH 2/2] soc: mediatek: devapc: Add support for MT8186

Rex-BC Chen rex-bc.chen at mediatek.com
Wed May 4 03:51:55 PDT 2022


On Wed, 2022-05-04 at 11:34 +0200, AngeloGioacchino Del Regno wrote:
> Il 29/04/22 08:54, Rex-BC Chen ha scritto:
> > Add devapc data and compatible to support MT8186 devapc.
> > 
> > Signed-off-by: Runyang Chen <runyang.chen at mediatek.com>
> > Signed-off-by: Rex-BC Chen <rex-bc.chen at mediatek.com>
> > ---
> >   drivers/soc/mediatek/mtk-devapc.c | 15 +++++++++++++++
> >   1 file changed, 15 insertions(+)
> > 
> > diff --git a/drivers/soc/mediatek/mtk-devapc.c
> > b/drivers/soc/mediatek/mtk-devapc.c
> > index 7c65ad3d1f8a..762e0e4d967d 100644
> > --- a/drivers/soc/mediatek/mtk-devapc.c
> > +++ b/drivers/soc/mediatek/mtk-devapc.c
> > @@ -227,10 +227,25 @@ static const struct mtk_devapc_data
> > devapc_mt6779 = {
> >   	.vio_shift_con_offset = 0xF20,
> >   };
> >   
> > +static const struct mtk_devapc_data devapc_mt8186 = {
> > +	.vio_idx_num = 519,
> > +	.vio_mask_offset = 0x0,
> > +	.vio_sta_offset = 0x400,
> > +	.vio_dbg0_offset = 0x900,
> > +	.vio_dbg1_offset = 0x904,
> > +	.apc_con_offset = 0xF00,
> > +	.vio_shift_sta_offset = 0xF10,
> > +	.vio_shift_sel_offset = 0xF14,
> > +	.vio_shift_con_offset = 0xF20,
> > +};
> 
> Hello Rex,
> since the register layout is common across a lot of MediaTek SoCs and
> basically
> only the vio_idx_num wildly varies between them, can you separate
> this parameter
> from the mtk_devapc_data struct?
> 
> I propose the following:
> 
> struct mtk_devapc_regs {
> 	/* reg offset */
> 	u32 vio_mask_offset;
> 	u32 ... etc
> };
> 
> struct mtk_devapc_data {
> 	u32 vio_idx_num;
> 	const struct mtk_devapc_regs *regs;
> };
> 
> static const struct mtk_devapc_regs devapc_regs_mt6779 = {
> 	.vio_mask_offset = 0x0,
> 	.vio...etc
> };
> 
> static const struct mtk_devapc_data devapc_mt6779 = {
> 	.vio_idx_num = 511,
> 	.regs = devapc_regs_mt6779,
> };
> 
> static const struct mtk_devapc_data devapc_mt8186 = {
> 	.vio_idx_num = 519,
> 	.regs = devapc_regs_mt6779,
> };
> 
> Regards,
> Angelo
> 

Hello Angelo,

Thanks for your advise.
I will separate vio_idx_num and register offsets in next version.

BRs,
Rex




More information about the Linux-mediatek mailing list