From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Xiaolei Li <xiaolei.li@mediatek.com>
Cc: <richard@nod.at>, <linux-mtd@lists.infradead.org>,
<linux-mediatek@lists.infradead.org>,
<srv_heupstream@mediatek.com>
Subject: Re: [PATCH v2 3/4] mtd: rawnand: mtk: Replace max_sector_size with sector size array
Date: Fri, 20 Apr 2018 22:18:43 +0200 [thread overview]
Message-ID: <20180420221843.45f9d006@bbrezillon> (raw)
In-Reply-To: <1523864464-41059-4-git-send-email-xiaolei.li@mediatek.com>
On Mon, 16 Apr 2018 15:41:03 +0800
Xiaolei Li <xiaolei.li@mediatek.com> wrote:
> Remove max_sector_size from struct mtk_nfc_caps, and use sector size
> array and number of sector size to show sector sizes that controller
> supports.
>
> Signed-off-by: Xiaolei Li <xiaolei.li@mediatek.com>
I don't see the point of this patch. I was seeing a clear benefit when
you were moving to the generic ECC selection code, but since you've
dropped this part from the patch series, this patch becomes useless.
Am I missing something?
> ---
> drivers/mtd/nand/raw/mtk_nand.c | 32 +++++++++++++++++++++++++++-----
> 1 file changed, 27 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/mtk_nand.c b/drivers/mtd/nand/raw/mtk_nand.c
> index 6977da3..03a4df2 100644
> --- a/drivers/mtd/nand/raw/mtk_nand.c
> +++ b/drivers/mtd/nand/raw/mtk_nand.c
> @@ -106,10 +106,11 @@
> struct mtk_nfc_caps {
> const u8 *spare_size;
> u8 num_spare_size;
> + const int *sector_size;
> + int num_sector_size;
> u8 pageformat_spare_shift;
> u8 nfi_clk_div;
> u8 max_sector;
> - u32 max_sector_size;
> };
>
> struct mtk_nfc_bad_mark_ctl {
> @@ -178,6 +179,14 @@ struct mtk_nfc {
> 16, 26, 27, 28
> };
>
> +static const int sector_size_max_1k[] = {
> + 1024, 512
> +};
> +
> +static const int sector_size_max_512[] = {
> + 512
> +};
> +
> static inline struct mtk_nfc_nand_chip *to_mtk_nand(struct nand_chip *nand)
> {
> return container_of(nand, struct mtk_nfc_nand_chip, nand);
> @@ -258,6 +267,16 @@ static inline u8 nfi_readb(struct mtk_nfc *nfc, u32 reg)
> return readb_relaxed(nfc->regs + reg);
> }
>
> +static int mtk_nfc_max_sector_size(struct mtk_nfc *nfc)
> +{
> + int i, sector_size = 0;
> +
> + for (i = 0; i < nfc->caps->num_sector_size; i++)
> + sector_size = max(sector_size, nfc->caps->sector_size[i]);
> +
> + return sector_size;
> +}
> +
> static void mtk_nfc_hw_reset(struct mtk_nfc *nfc)
> {
> struct device *dev = nfc->dev;
> @@ -1207,7 +1226,7 @@ static int mtk_nfc_ecc_init(struct device *dev, struct mtd_info *mtd)
> */
> if (nand->ecc.size < 1024) {
> if (mtd->writesize > 512 &&
> - nfc->caps->max_sector_size > 512) {
> + mtk_nfc_max_sector_size(nfc) > 512) {
> nand->ecc.size = 1024;
> nand->ecc.strength <<= 1;
> } else {
> @@ -1389,28 +1408,31 @@ static int mtk_nfc_nand_chips_init(struct device *dev, struct mtk_nfc *nfc)
> static const struct mtk_nfc_caps mtk_nfc_caps_mt2701 = {
> .spare_size = spare_size_mt2701,
> .num_spare_size = 16,
> + .sector_size = sector_size_max_1k,
> + .num_sector_size = 2,
> .pageformat_spare_shift = 4,
> .nfi_clk_div = 1,
> .max_sector = 16,
> - .max_sector_size = 1024,
> };
>
> static const struct mtk_nfc_caps mtk_nfc_caps_mt2712 = {
> .spare_size = spare_size_mt2712,
> .num_spare_size = 19,
> + .sector_size = sector_size_max_1k,
> + .num_sector_size = 2,
> .pageformat_spare_shift = 16,
> .nfi_clk_div = 2,
> .max_sector = 16,
> - .max_sector_size = 1024,
> };
>
> static const struct mtk_nfc_caps mtk_nfc_caps_mt7622 = {
> .spare_size = spare_size_mt7622,
> .num_spare_size = 4,
> + .sector_size = sector_size_max_512,
> + .num_sector_size = 1,
> .pageformat_spare_shift = 4,
> .nfi_clk_div = 1,
> .max_sector = 8,
> - .max_sector_size = 512,
> };
>
> static const struct of_device_id mtk_nfc_id_table[] = {
next prev parent reply other threads:[~2018-04-20 20:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-16 7:41 [PATCH v2 0/4] Improve MTK NAND driver Xiaolei Li
2018-04-16 7:41 ` [PATCH v2 1/4] dt-bindings: mtd: mtk-nand: Update properties description Xiaolei Li
2018-04-20 20:15 ` Boris Brezillon
2018-04-23 1:43 ` xiaolei li
2018-04-16 7:41 ` [PATCH v2 2/4] MAINTAINERS: Add entry for Mediatek NAND controller driver Xiaolei Li
2018-04-20 20:24 ` Boris Brezillon
2018-04-22 17:28 ` Boris Brezillon
2018-04-23 1:44 ` xiaolei li
2018-04-16 7:41 ` [PATCH v2 3/4] mtd: rawnand: mtk: Replace max_sector_size with sector size array Xiaolei Li
2018-04-20 20:18 ` Boris Brezillon [this message]
2018-04-23 1:49 ` xiaolei li
2018-04-16 7:41 ` [PATCH v2 4/4] mtd: rawnand: mtk: Add new nfc capability maximize_fdm_ecc Xiaolei Li
2018-04-20 20:23 ` Boris Brezillon
2018-04-23 2:04 ` xiaolei li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180420221843.45f9d006@bbrezillon \
--to=boris.brezillon@bootlin.com \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
--cc=srv_heupstream@mediatek.com \
--cc=xiaolei.li@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox