From: Marek Vasut <marek.vasut@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/4] onenand:samsung Target dependent OneNAND chip probe function
Date: Sun, 20 Nov 2011 01:06:09 +0100 [thread overview]
Message-ID: <201111200106.10197.marek.vasut@gmail.com> (raw)
In-Reply-To: <1320914477-27885-2-git-send-email-l.majewski@samsung.com>
> Separate callback for probing OneNAND memory chip.
> If no special function is defined, default implementation will be used.
>
> This approach gives more flexibility for OneNAND device probing.
>
> Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
> ./tools/checkpatch.pl -
> total: 0 errors, 0 warnings, 108 lines checked
>
> NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO MINMAX
> MULTISTATEMENT_MACRO_USE_DO_WHILE
>
> ---
> drivers/mtd/onenand/onenand_base.c | 43
> +++++++++++++++++++++++++++++----- drivers/mtd/onenand/samsung.c |
> 10 ++++++++
> include/linux/mtd/onenand.h | 1 +
> include/linux/mtd/samsung_onenand.h | 2 +
> 4 files changed, 49 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/mtd/onenand/onenand_base.c
> b/drivers/mtd/onenand/onenand_base.c index 24e02c2..a557d48 100644
> --- a/drivers/mtd/onenand/onenand_base.c
> +++ b/drivers/mtd/onenand/onenand_base.c
> @@ -2505,23 +2505,24 @@ out:
> }
>
> /**
> - * onenand_probe - [OneNAND Interface] Probe the OneNAND device
> + * onenand_chip_probe - [OneNAND Interface] Probe the OneNAND chip
> * @param mtd MTD device structure
> *
> * OneNAND detection method:
> * Compare the the values from command with ones from register
> */
> -static int onenand_probe(struct mtd_info *mtd)
> +static int onenand_chip_probe(struct mtd_info *mtd)
> {
> struct onenand_chip *this = mtd->priv;
> - int bram_maf_id, bram_dev_id, maf_id, dev_id, ver_id;
> - int density;
> + int bram_maf_id, bram_dev_id, maf_id, dev_id;
> int syscfg;
>
> /* Save system configuration 1 */
> syscfg = this->read_word(this->base + ONENAND_REG_SYS_CFG1);
> +
> /* Clear Sync. Burst Read mode to read BootRAM */
> - this->write_word((syscfg & ~ONENAND_SYS_CFG1_SYNC_READ), this->base +
> ONENAND_REG_SYS_CFG1); + this->write_word((syscfg &
> ~ONENAND_SYS_CFG1_SYNC_READ),
> + this->base + ONENAND_REG_SYS_CFG1);
>
> /* Send the command for reading device ID from BootRAM */
> this->write_word(ONENAND_CMD_READID, this->base + ONENAND_BOOTRAM);
> @@ -2546,13 +2547,38 @@ static int onenand_probe(struct mtd_info *mtd)
> /* Read manufacturer and device IDs from Register */
> maf_id = this->read_word(this->base + ONENAND_REG_MANUFACTURER_ID);
> dev_id = this->read_word(this->base + ONENAND_REG_DEVICE_ID);
> - ver_id = this->read_word(this->base + ONENAND_REG_VERSION_ID);
> - this->technology = this->read_word(this->base + ONENAND_REG_TECHNOLOGY);
>
> /* Check OneNAND device */
> if (maf_id != bram_maf_id || dev_id != bram_dev_id)
> return -ENXIO;
>
> + return 0;
> +}
> +
> +/**
> + * onenand_probe - [OneNAND Interface] Probe the OneNAND device
> + * @param mtd MTD device structure
> + *
> + * OneNAND detection method:
> + * Compare the the values from command with ones from register
> + */
> +int onenand_probe(struct mtd_info *mtd)
> +{
> + struct onenand_chip *this = mtd->priv;
> + int maf_id, dev_id, ver_id;
> + int density;
> + int ret;
> +
> + ret = this->chip_probe(mtd);
> + if (ret)
> + return ret;
> +
> + /* Read manufacturer and device IDs from Register */
> + maf_id = this->read_word(this->base + ONENAND_REG_MANUFACTURER_ID);
> + dev_id = this->read_word(this->base + ONENAND_REG_DEVICE_ID);
> + ver_id = this->read_word(this->base + ONENAND_REG_VERSION_ID);
> + this->technology = this->read_word(this->base + ONENAND_REG_TECHNOLOGY);
> +
> /* Flash device information */
> mtd->name = onenand_print_device_info(dev_id, ver_id);
> this->device_id = dev_id;
> @@ -2659,6 +2685,9 @@ int onenand_scan(struct mtd_info *mtd, int maxchips)
> if (!this->write_bufferram)
> this->write_bufferram = onenand_write_bufferram;
>
> + if (!this->chip_probe)
> + this->chip_probe = onenand_chip_probe;
> +
> if (!this->block_markbad)
> this->block_markbad = onenand_default_block_markbad;
> if (!this->scan_bbt)
> diff --git a/drivers/mtd/onenand/samsung.c b/drivers/mtd/onenand/samsung.c
> index 20b4912..1f4bd81 100644
> --- a/drivers/mtd/onenand/samsung.c
> +++ b/drivers/mtd/onenand/samsung.c
> @@ -590,6 +590,16 @@ static void s3c_set_width_regs(struct onenand_chip
> *this) }
> #endif
>
> +int s5pc110_chip_probe(struct mtd_info *mtd)
> +{
> + return 0;
> +}
> +
> +int s5pc210_chip_probe(struct mtd_info *mtd)
> +{
> + return 0;
> +}
> +
Will there be a problem if you used the default chip_probe() method from the
driver ?
> void s3c_onenand_init(struct mtd_info *mtd)
> {
> struct onenand_chip *this = mtd->priv;
> diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
> index 5465562..dea42f4 100644
> --- a/include/linux/mtd/onenand.h
> +++ b/include/linux/mtd/onenand.h
> @@ -101,6 +101,7 @@ struct onenand_chip {
> size_t count);
> unsigned short (*read_word) (void __iomem *addr);
> void (*write_word) (unsigned short value, void __iomem *addr);
> + int (*chip_probe)(struct mtd_info *mtd);
> void (*mmcontrol) (struct mtd_info *mtd, int sync_read);
> int (*block_markbad)(struct mtd_info *mtd, loff_t ofs);
> int (*scan_bbt)(struct mtd_info *mtd);
> diff --git a/include/linux/mtd/samsung_onenand.h
> b/include/linux/mtd/samsung_onenand.h index 021fa27..ddb29bb 100644
> --- a/include/linux/mtd/samsung_onenand.h
> +++ b/include/linux/mtd/samsung_onenand.h
> @@ -127,5 +127,7 @@ struct samsung_onenand {
>
> /* common initialize function */
> extern void s3c_onenand_init(struct mtd_info *);
> +extern int s5pc110_chip_probe(struct mtd_info *);
> +extern int s5pc210_chip_probe(struct mtd_info *);
>
> #endif
next prev parent reply other threads:[~2011-11-20 0:06 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-10 8:41 [U-Boot] [PATCH 0/4] onenand: OneNAND board dependent probe and Samsung targets fixes Lukasz Majewski
2011-11-10 8:41 ` [U-Boot] [PATCH 1/4] onenand:samsung Target dependent OneNAND chip probe function Lukasz Majewski
2011-11-20 0:06 ` Marek Vasut [this message]
2011-11-20 23:29 ` Kyungmin Park
2011-11-10 8:41 ` [U-Boot] [PATCH 2/4] onenand:samsung OneNAND chip probe functions added for GONI and C210_Universal Lukasz Majewski
2011-11-10 8:41 ` [U-Boot] [PATCH 3/4] onenand: Replace ONENAND_IS_MLC() test with ONENAND_HAS_4KB() Lukasz Majewski
2011-11-10 8:41 ` [U-Boot] [PATCH 4/4] onenand: samsung: Enable support OneNAND support at Samsung's S5PC210_Universal Lukasz Majewski
2012-03-05 16:41 ` [RESEND 0/4] onenand: OneNAND board dependent probe and fixes for Samsung targets Lukasz Majewski
2012-03-05 16:41 ` [RESEND 1/4] onenand:samsung Target dependent OneNAND chip probe function Lukasz Majewski
2012-03-05 16:41 ` [RESEND 2/4] onenand:samsung OneNAND chip probe functions added for GONI and Exynos4210 Lukasz Majewski
2012-03-05 16:41 ` [RESEND 3/4] onenand: Replace ONENAND_IS_MLC() test with ONENAND_HAS_4KB() Lukasz Majewski
2012-03-05 16:41 ` [RESEND 4/4] onenand: samsung: Enable support OneNAND support at Samsung's Exynos4210 Lukasz Majewski
2012-03-06 6:48 ` [RESEND 0/4] onenand: OneNAND board dependent probe and fixes for Samsung targets Lukasz Majewski
2012-03-06 6:54 ` [U-Boot] " Lukasz Majewski
2012-03-06 6:54 ` [U-Boot] [RESEND 1/4] onenand:samsung Target dependent OneNAND chip probe function Lukasz Majewski
2012-03-06 6:54 ` [U-Boot] [RESEND 2/4] onenand:samsung OneNAND chip probe functions added for GONI and Exynos4210 Lukasz Majewski
2012-03-06 6:54 ` [U-Boot] [RESEND 3/4] onenand: Replace ONENAND_IS_MLC() test with ONENAND_HAS_4KB() Lukasz Majewski
2012-03-06 6:54 ` [U-Boot] [RESEND 4/4] onenand: samsung: Enable support OneNAND support at Samsung's Exynos4210 Lukasz Majewski
2012-03-06 18:53 ` [U-Boot] OneNAND custodian (was: Re: [RESEND 0/4] onenand: OneNAND board dependent probe and fixes for Samsung targets) Scott Wood
2012-03-07 0:04 ` Kyungmin Park
2012-03-07 9:02 ` Lukasz Majewski
2012-03-07 20:13 ` [U-Boot] OneNAND custodian Scott Wood
2012-03-07 22:15 ` Wolfgang Denk
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=201111200106.10197.marek.vasut@gmail.com \
--to=marek.vasut@gmail.com \
--cc=u-boot@lists.denx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.