From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Bastian Hecht <hechtb@googlemail.com>
Cc: Magnus Damm <magnus.damm@gmail.com>,
linux-mtd@lists.infradead.org, linux-sh@vger.kernel.org
Subject: Re: [PATCH v2 5/7] mtd: sh_flctl: Use cached register value for FLCMNCR
Date: Sat, 18 Feb 2012 02:18:29 +0000 [thread overview]
Message-ID: <2837466.z8bW9OK9D4@avalon> (raw)
In-Reply-To: <1328960705-18699-6-git-send-email-hechtb@gmail.com>
Hi Bastian,
Thanks for the patch.
On Saturday 11 February 2012 12:45:03 Bastian Hecht wrote:
> Instead of reading out the register, use a cached value. This will
> make way for a proper runtime power management implementation.
>
> Signed-off-by: Bastian Hecht <hechtb@gmail.com>
> ---
> changelog: I delayed the rtpm patch until the clock code is fixed for
> board mackerel, so that no "udelay(1);" is needed. Instead I cleaned
> up the code to use a cached register value. The rtpm code will benefit
> from it.
>
> drivers/mtd/nand/sh_flctl.c | 15 +++------------
> include/linux/mtd/sh_flctl.h | 1 +
> 2 files changed, 4 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c
> index 5c3e71f..1af41fd 100644
> --- a/drivers/mtd/nand/sh_flctl.c
> +++ b/drivers/mtd/nand/sh_flctl.c
> @@ -681,16 +681,13 @@ read_normal_exit:
> static void flctl_select_chip(struct mtd_info *mtd, int chipnr)
> {
> struct sh_flctl *flctl = mtd_to_flctl(mtd);
> - uint32_t flcmncr_val = readl(FLCMNCR(flctl));
>
> switch (chipnr) {
> case -1:
> - flcmncr_val &= ~CE0_ENABLE;
> - writel(flcmncr_val, FLCMNCR(flctl));
> + writel(flctl->flcmncr_val, FLCMNCR(flctl));
> break;
> case 0:
> - flcmncr_val |= CE0_ENABLE;
> - writel(flcmncr_val, FLCMNCR(flctl));
> + writel(flctl->flcmncr_val | CE0_ENABLE, FLCMNCR(flctl));
> break;
> default:
> BUG();
Shouldn't you use the cached value in set_cmd_regs() as well ?
> @@ -748,11 +745,6 @@ static int flctl_verify_buf(struct mtd_info *mtd, const
> u_char *buf, int len) return 0;
> }
>
> -static void flctl_register_init(struct sh_flctl *flctl, unsigned long val)
> -{
> - writel(val, FLCMNCR(flctl));
> -}
> -
> static int flctl_chip_init_tail(struct mtd_info *mtd)
> {
> struct sh_flctl *flctl = mtd_to_flctl(mtd);
> @@ -851,10 +843,9 @@ static int __devinit flctl_probe(struct platform_device
> *pdev) nand = &flctl->chip;
> flctl_mtd->priv = nand;
> flctl->pdev = pdev;
> + flctl->flcmncr_val = pdata->flcmncr_val;
> flctl->hwecc = pdata->has_hwecc;
>
> - flctl_register_init(flctl, pdata->flcmncr_val);
> -
> nand->options = NAND_NO_AUTOINCR;
>
> /* Set address of hardware control function */
> diff --git a/include/linux/mtd/sh_flctl.h b/include/linux/mtd/sh_flctl.h
> index e66c393..107fd8a 100644
> --- a/include/linux/mtd/sh_flctl.h
> +++ b/include/linux/mtd/sh_flctl.h
> @@ -132,6 +132,7 @@ struct sh_flctl {
> int erase1_page_addr; /* page_addr in ERASE1 cmd */
> uint32_t erase_ADRCNT; /* bits of FLCMDCR in ERASE1 cmd */
> uint32_t rw_ADRCNT; /* bits of FLCMDCR in READ WRITE cmd */
> + uint32_t flcmncr_val; /* base value of FLCMNCR */
>
> int hwecc_cant_correct[4];
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2012-02-18 2:18 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-11 11:44 [PATCH v2 0/7] SH Mobile sh_flctl driver brush up Bastian Hecht
2012-02-11 11:44 ` [PATCH v2 1/7] mtd: sh_flctl: Expand FLCMNCR register bit field Bastian Hecht
2012-02-18 2:22 ` Laurent Pinchart
2012-02-19 10:34 ` Bastian Hecht
2012-02-11 11:45 ` [PATCH v2 2/7] mtd: sh_flctl: Reorder empty_fifo() calls Bastian Hecht
2012-02-18 2:21 ` Laurent Pinchart
2012-02-11 11:45 ` [PATCH v2 3/7] mtd: sh_flctl: Expand the READID command to 8 bytes Bastian Hecht
2012-02-18 2:20 ` Laurent Pinchart
2012-02-19 10:46 ` Bastian Hecht
2012-02-11 11:45 ` [PATCH v2 4/7] mtd: sh_flctl: Implement NAND_CMD_RNDOUT command Bastian Hecht
2012-02-11 11:45 ` [PATCH v2 5/7] mtd: sh_flctl: Use cached register value for FLCMNCR Bastian Hecht
2012-02-18 2:18 ` Laurent Pinchart [this message]
2012-02-19 10:48 ` Bastian Hecht
2012-02-11 11:45 ` [PATCH v2 6/7] mtd: sh_flctl: Add FLHOLDCR register Bastian Hecht
2012-02-18 0:25 ` Laurent Pinchart
2012-02-19 11:04 ` Bastian Hecht
2012-02-11 11:45 ` [PATCH v2 7/7] ARM: mach-shmobile: mackerel: Add the flash controller flctl Bastian Hecht
2012-02-13 13:41 ` [PATCH v2 0/7] SH Mobile sh_flctl driver brush up Artem Bityutskiy
2012-02-14 3:38 ` Simon Horman
2012-02-14 10:58 ` Bastian Hecht
2012-03-09 12:11 ` Artem Bityutskiy
2012-03-09 12:14 ` Laurent Pinchart
2012-03-09 12:37 ` Artem Bityutskiy
2012-03-09 12:42 ` Laurent Pinchart
2012-03-09 13:22 ` Magnus Damm
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=2837466.z8bW9OK9D4@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=hechtb@googlemail.com \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-sh@vger.kernel.org \
--cc=magnus.damm@gmail.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;
as well as URLs for NNTP newsgroup(s).