From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [U-Boot, v2, 6/7] mtd/st_smi: Use page sizes respective to flash
Date: Mon, 14 Dec 2015 10:15:09 +0100 [thread overview]
Message-ID: <566E889D.2030303@denx.de> (raw)
In-Reply-To: <f78aac32ab4f2b63069293d7c338dd17b585a7f2.1354783388.git.vipin.kumar@st.com>
Hello Vipin,
Am 06.12.2012 um 09:47 schrieb Vipin Kumar:
> The page size is a flash dependent property and the driver was using a macro in
> place of page size. This patch uses the proper page size wrt the flash device
> connected on board
>
> Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
> Acked-by: Stefan Roese <sr@denx.de>
> ---
> drivers/mtd/st_smi.c | 41 +++++++++++++++++++++++++++++++++--------
> include/linux/mtd/st_smi.h | 1 -
> 2 files changed, 33 insertions(+), 9 deletions(-)
I just stumbled over this old patch, it is in your patchserie:
[U-Boot] [PATCH resend 0/7] mtd/st_smi: Add fixes for smi driver
http://lists.denx.de/pipermail/u-boot/2012-December/141796.html
I just tried to apply this serie, but this patch fails. Is
the problem it fixes still existing? If so, could you please
rebase it and resend it?
Thanks! And sorry for the looong delay ...
bye,
Heiko
>
> diff --git a/drivers/mtd/st_smi.c b/drivers/mtd/st_smi.c
> index 5f67807..0ed6c0d 100644
> --- a/drivers/mtd/st_smi.c
> +++ b/drivers/mtd/st_smi.c
> @@ -96,6 +96,25 @@ static struct flash_device flash_devices[] = {
> };
>
> /*
> + * get_flash_device - Return flash_device pointer for a particular device id
> + * @id: Device id
> + *
> + * Return flash_device pointer for a particular device id
> + */
> +static struct flash_device *get_flash_device(u32 id)
> +{
> + struct flash_device *flash_dev_p = &flash_devices[0];
> + int i;
> +
> + for (i = 0; i < ARRAY_SIZE(flash_devices); i++, flash_dev_p++) {
> + if (flash_dev_p->device_id == id)
> + return flash_dev_p;
> + }
> +
> + return NULL;
> +}
> +
> +/*
> * smi_wait_xfer_finish - Wait until TFF is set in status register
> * @timeout: timeout in milliseconds
> *
> @@ -361,20 +380,27 @@ static int smi_sector_erase(flash_info_t *info, unsigned int sector)
>
> /*
> * smi_write - Write to SMI flash
> + * @info: flash info structure
> * @src_addr: source buffer
> * @dst_addr: destination buffer
> * @length: length to write in bytes
> - * @bank: bank base address
> *
> * Write to SMI flash
> */
> -static int smi_write(unsigned char *src_addr, unsigned char *dst_addr,
> - unsigned int length, ulong bank_addr)
> +static int smi_write(flash_info_t *info, unsigned char *src_addr,
> + unsigned char *dst_addr, unsigned int length)
> {
> + struct flash_device *flash_device_p = get_flash_device(info->flash_id);
> + u32 page_size;
> int banknum;
> int issue_we;
>
> - switch (bank_addr) {
> + if (!flash_device_p)
> + return -EIO;
> +
> + page_size = flash_device_p->pagesize;
> +
> + switch (info->start[0]) {
> case SMIBANK0_BASE:
> banknum = BANK0;
> break;
> @@ -400,9 +426,9 @@ static int smi_write(unsigned char *src_addr, unsigned char *dst_addr,
> /* Perform the write command */
> while (length) {
> int k;
> - unsigned int wlen = min(SFLASH_PAGE_SIZE, length);
> + unsigned int wlen = min(page_size, length);
>
> - if (issue_we || (((ulong)(dst_addr) % SFLASH_PAGE_SIZE) == 0)) {
> + if (issue_we || (((ulong)(dst_addr) % page_size) == 0)) {
> issue_we = 0;
>
> if (smi_wait_till_ready(banknum,
> @@ -444,8 +470,7 @@ static int smi_write(unsigned char *src_addr, unsigned char *dst_addr,
> */
> int write_buff(flash_info_t *info, uchar *src, ulong dest_addr, ulong length)
> {
> - return smi_write(src, (unsigned char *)dest_addr, length,
> - info->start[0]);
> + return smi_write(info, src, (unsigned char *)dest_addr, length);
> }
>
> /*
> diff --git a/include/linux/mtd/st_smi.h b/include/linux/mtd/st_smi.h
> index 04f81ea..5837493 100644
> --- a/include/linux/mtd/st_smi.h
> +++ b/include/linux/mtd/st_smi.h
> @@ -108,7 +108,6 @@ struct flash_dev {
> ushort sector_count;
> };
>
> -#define SFLASH_PAGE_SIZE 0x100 /* flash page size */
> #define XFER_FINISH_TOUT 15 /* xfer finish timeout(in ms) */
> #define WMODE_TOUT 15 /* write enable timeout(in ms) */
>
>
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
next prev parent reply other threads:[~2015-12-14 9:15 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-06 8:47 [U-Boot] [PATCH v2 0/7] mtd/st_smi: Add fixes for smi driver Vipin Kumar
2012-12-06 8:47 ` [U-Boot] [PATCH v2 1/7] mtd/st_smi: Clear error flags while initiating a fresh write Vipin Kumar
2012-12-06 11:39 ` Stefan Roese
2012-12-06 8:47 ` [U-Boot] [PATCH v2 2/7] mtd/st_smi: Rearrange the supported devices in alphabetical order Vipin Kumar
2012-12-06 8:47 ` [U-Boot] [PATCH v2 3/7] mtd/st_smi: Add support for Micron N25Q128 Flash Vipin Kumar
2012-12-06 8:47 ` [U-Boot] [PATCH v2 4/7] mtd/st_smi: Avoid issuing multiple WE commands Vipin Kumar
2012-12-06 8:47 ` [U-Boot] [PATCH v2 5/7] mtd/st_smi: Write to flash in a tight loop Vipin Kumar
2012-12-06 11:40 ` Stefan Roese
2012-12-06 8:47 ` [U-Boot] [PATCH v2 6/7] mtd/st_smi: Use page sizes respective to flash Vipin Kumar
2015-12-14 9:15 ` Heiko Schocher [this message]
2012-12-06 8:47 ` [U-Boot] [PATCH v2 7/7] mtd/st_smi: Add mtd support for smi Vipin Kumar
2012-12-06 11:41 ` Stefan Roese
2012-12-06 9:05 ` [U-Boot] [PATCH v2 0/7] mtd/st_smi: Add fixes for smi driver Vipin Kumar
2012-12-06 11:42 ` Stefan Roese
2012-12-07 4:43 ` Vipin Kumar
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=566E889D.2030303@denx.de \
--to=hs@denx.de \
--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.