diff mbox series

[v5,01/10] spi: mtk-snfi: Change default page format to setup default setting

Message ID 20221219024019.31974-2-xiangsheng.hou@mediatek.com (mailing list archive)
State New, archived
Headers show
Series Add MediaTek MT7986 SPI NAND and ECC support | expand

Commit Message

Xiangsheng Hou Dec. 19, 2022, 2:40 a.m. UTC
Change default page format to setup default setting since the sector
size 1024 on MT7986 will lead to probe fail.

Signed-off-by: Xiangsheng Hou <xiangsheng.hou@mediatek.com>
---
 drivers/spi/spi-mtk-snfi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Matthias Brugger Dec. 19, 2022, 3:30 p.m. UTC | #1
Thanks for your patch! There is something to improve please see below.

On 19/12/2022 03:40, Xiangsheng Hou wrote:
> Change default page format to setup default setting since the sector
> size 1024 on MT7986 will lead to probe fail.
> 
> Signed-off-by: Xiangsheng Hou <xiangsheng.hou@mediatek.com>
> ---
>   drivers/spi/spi-mtk-snfi.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/spi/spi-mtk-snfi.c b/drivers/spi/spi-mtk-snfi.c
> index fa8412ba20e2..719fc6f53ab1 100644
> --- a/drivers/spi/spi-mtk-snfi.c
> +++ b/drivers/spi/spi-mtk-snfi.c
> @@ -1430,8 +1430,7 @@ static int mtk_snand_probe(struct platform_device *pdev)
>   
>   	// setup an initial page format for ops matching page_cache_op template
>   	// before ECC is called.
> -	ret = mtk_snand_setup_pagefmt(ms, ms->caps->sector_size,
> -				      ms->caps->spare_sizes[0]);
> +	ret = mtk_snand_setup_pagefmt(ms, SZ_2K, SZ_64);

Couldn't you just set sector_size in mt7986_snand_caps?

Regards,
Matthias


>   	if (ret) {
>   		dev_err(ms->dev, "failed to set initial page format\n");
>   		goto disable_clk;
Xiangsheng Hou Dec. 20, 2022, 2:15 a.m. UTC | #2
Hi Matthias,

On Mon, 2022-12-19 at 16:30 +0100, Matthias Brugger wrote:
> Thanks for your patch! There is something to improve please see
> below.
> 
> On 19/12/2022 03:40, Xiangsheng Hou wrote:
> > Change default page format to setup default setting since the
> > sector
> > size 1024 on MT7986 will lead to probe fail.
> > 
> > Signed-off-by: Xiangsheng Hou <xiangsheng.hou@mediatek.com>
> > ---
> >   drivers/spi/spi-mtk-snfi.c | 3 +--
> >   1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/drivers/spi/spi-mtk-snfi.c b/drivers/spi/spi-mtk-
> > snfi.c
> > index fa8412ba20e2..719fc6f53ab1 100644
> > --- a/drivers/spi/spi-mtk-snfi.c
> > +++ b/drivers/spi/spi-mtk-snfi.c
> > @@ -1430,8 +1430,7 @@ static int mtk_snand_probe(struct
> > platform_device *pdev)
> >   
> >   	// setup an initial page format for ops matching page_cache_op
> > template
> >   	// before ECC is called.
> > -	ret = mtk_snand_setup_pagefmt(ms, ms->caps->sector_size,
> > -				      ms->caps->spare_sizes[0]);
> > +	ret = mtk_snand_setup_pagefmt(ms, SZ_2K, SZ_64);
> 
> Couldn't you just set sector_size in mt7986_snand_caps?

The function mtk_snand_setup_pagefmt need use page and OOB size of NAND
device to setup pagefmt.
The controller page size can support 512/1k/2k/4k..., the sector size
1k have been set in mt7986_snand_caps. However this will also lead to
fail in this function since the 1k page size will not be supported.
Just use page size 2k and OOB size 64 as default parameter since this
can be supported by all ICs with this controller.

Thanks
Xiangsheng Hou
Xiangsheng Hou Jan. 5, 2023, 11:42 a.m. UTC | #3
On Tue, 2022-12-20 at 10:15 +0800, xiangsheng.hou wrote:
Hi Matthias, Angelo
> 
> On Mon, 2022-12-19 at 16:30 +0100, Matthias Brugger wrote:
> > Thanks for your patch! There is something to improve please see
> > below.
> > 
> > On 19/12/2022 03:40, Xiangsheng Hou wrote:
> > > Change default page format to setup default setting since the
> > > sector
> > > size 1024 on MT7986 will lead to probe fail.
> > > 
> > > Signed-off-by: Xiangsheng Hou <xiangsheng.hou@mediatek.com>
> > > ---
> > >   drivers/spi/spi-mtk-snfi.c | 3 +--
> > >   1 file changed, 1 insertion(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/spi/spi-mtk-snfi.c b/drivers/spi/spi-mtk-
> > > snfi.c
> > > index fa8412ba20e2..719fc6f53ab1 100644
> > > --- a/drivers/spi/spi-mtk-snfi.c
> > > +++ b/drivers/spi/spi-mtk-snfi.c
> > > @@ -1430,8 +1430,7 @@ static int mtk_snand_probe(struct
> > > platform_device *pdev)
> > >   
> > >   	// setup an initial page format for ops matching
> > > page_cache_op
> > > template
> > >   	// before ECC is called.
> > > -	ret = mtk_snand_setup_pagefmt(ms, ms->caps->sector_size,
> > > -				      ms->caps->spare_sizes[0]);
> > > +	ret = mtk_snand_setup_pagefmt(ms, SZ_2K, SZ_64);
> > 
> > Couldn't you just set sector_size in mt7986_snand_caps?
> 
> The function mtk_snand_setup_pagefmt need use page and OOB size of
> NAND
> device to setup pagefmt.
> The controller page size can support 512/1k/2k/4k..., the sector size
> 1k have been set in mt7986_snand_caps. However this will also lead to
> fail in this function since the 1k page size will not be supported.
> Just use page size 2k and OOB size 64 as default parameter since this
> can be supported by all ICs with this controller.

Could you please help to review this patch.

Best Regards,
Xiangsheng Hou
diff mbox series

Patch

diff --git a/drivers/spi/spi-mtk-snfi.c b/drivers/spi/spi-mtk-snfi.c
index fa8412ba20e2..719fc6f53ab1 100644
--- a/drivers/spi/spi-mtk-snfi.c
+++ b/drivers/spi/spi-mtk-snfi.c
@@ -1430,8 +1430,7 @@  static int mtk_snand_probe(struct platform_device *pdev)
 
 	// setup an initial page format for ops matching page_cache_op template
 	// before ECC is called.
-	ret = mtk_snand_setup_pagefmt(ms, ms->caps->sector_size,
-				      ms->caps->spare_sizes[0]);
+	ret = mtk_snand_setup_pagefmt(ms, SZ_2K, SZ_64);
 	if (ret) {
 		dev_err(ms->dev, "failed to set initial page format\n");
 		goto disable_clk;