From: Jheng-Jhong Wu <goodwater.wu@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: goodwater.wu@gmail.com,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Boris Brezillon <boris.brezillon@bootlin.com>,
Masahiro Yamada <yamada.masahiro@socionext.com>,
Arun Nagendran <arunrasppi@gmail.com>,
Miquel Raynal <miquel.raynal@bootlin.com>,
Palle Christensen <palle.christensen@microsemi.com>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH] staging:mt29f_spinand: MT29F2G failing as only 16-bit arguments and variables used for addressing.
Date: Wed, 1 Aug 2018 11:24:19 +0800 [thread overview]
Message-ID: <1533093861-9761-1-git-send-email-goodwater.wu@gmail.com> (raw)
For NAND flash chips with more than 1Gbit (e.g. MT29F2G) more than 16 bits
are necessary to address the correct page. The driver sets the address for
more than 16 bits, but it uses 16-bit arguments and variables (these are
page_id, block_id, row) to do address operations. Obviously, these
arguments and variables cannot deal with more than 16-bit address.
Signed-off-by: Jheng-Jhong Wu <goodwater.wu@gmail.com>
---
drivers/staging/mt29f_spinand/mt29f_spinand.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/mt29f_spinand/mt29f_spinand.c b/drivers/staging/mt29f_spinand/mt29f_spinand.c
index 4484784..a0f4cbcb 100644
--- a/drivers/staging/mt29f_spinand/mt29f_spinand.c
+++ b/drivers/staging/mt29f_spinand/mt29f_spinand.c
@@ -308,10 +308,10 @@ static int spinand_write_enable(struct spi_device *spi_nand)
return spinand_cmd(spi_nand, &cmd);
}
-static int spinand_read_page_to_cache(struct spi_device *spi_nand, u16 page_id)
+static int spinand_read_page_to_cache(struct spi_device *spi_nand, u32 page_id)
{
struct spinand_cmd cmd = {0};
- u16 row;
+ u32 row;
row = page_id;
cmd.cmd = CMD_READ;
@@ -331,7 +331,7 @@ static int spinand_read_page_to_cache(struct spi_device *spi_nand, u16 page_id)
* locations.
* No tRd delay.
*/
-static int spinand_read_from_cache(struct spi_device *spi_nand, u16 page_id,
+static int spinand_read_from_cache(struct spi_device *spi_nand, u32 page_id,
u16 byte_id, u16 len, u8 *rbuf)
{
struct spinand_cmd cmd = {0};
@@ -362,7 +362,7 @@ static int spinand_read_from_cache(struct spi_device *spi_nand, u16 page_id,
* The read includes two commands to the Nand - 0x13 and 0x03 commands
* Poll to read status to wait for tRD time.
*/
-static int spinand_read_page(struct spi_device *spi_nand, u16 page_id,
+static int spinand_read_page(struct spi_device *spi_nand, u32 page_id,
u16 offset, u16 len, u8 *rbuf)
{
int ret;
@@ -430,7 +430,7 @@ static int spinand_read_page(struct spi_device *spi_nand, u16 page_id,
* Since it is writing the data to cache, there is no tPROG time.
*/
static int spinand_program_data_to_cache(struct spi_device *spi_nand,
- u16 page_id, u16 byte_id,
+ u32 page_id, u16 byte_id,
u16 len, u8 *wbuf)
{
struct spinand_cmd cmd = {0};
@@ -457,10 +457,10 @@ static int spinand_program_data_to_cache(struct spi_device *spi_nand,
* the Nand array.
* Need to wait for tPROG time to finish the transaction.
*/
-static int spinand_program_execute(struct spi_device *spi_nand, u16 page_id)
+static int spinand_program_execute(struct spi_device *spi_nand, u32 page_id)
{
struct spinand_cmd cmd = {0};
- u16 row;
+ u32 row;
row = page_id;
cmd.cmd = CMD_PROG_PAGE_EXC;
@@ -486,7 +486,7 @@ static int spinand_program_execute(struct spi_device *spi_nand, u16 page_id)
* Poll to wait for the tPROG time to finish the transaction.
*/
static int spinand_program_page(struct spi_device *spi_nand,
- u16 page_id, u16 offset, u16 len, u8 *buf)
+ u32 page_id, u16 offset, u16 len, u8 *buf)
{
int retval;
u8 status = 0;
@@ -573,10 +573,10 @@ static int spinand_program_page(struct spi_device *spi_nand,
* one block--64 pages
* Need to wait for tERS.
*/
-static int spinand_erase_block_erase(struct spi_device *spi_nand, u16 block_id)
+static int spinand_erase_block_erase(struct spi_device *spi_nand, u32 block_id)
{
struct spinand_cmd cmd = {0};
- u16 row;
+ u32 row;
row = block_id;
cmd.cmd = CMD_ERASE_BLK;
@@ -599,7 +599,7 @@ static int spinand_erase_block_erase(struct spi_device *spi_nand, u16 block_id)
* and then send the 0xd8 erase command
* Poll to wait for the tERS time to complete the tranaction.
*/
-static int spinand_erase_block(struct spi_device *spi_nand, u16 block_id)
+static int spinand_erase_block(struct spi_device *spi_nand, u32 block_id)
{
int retval;
u8 status = 0;
--
2.7.4
next reply other threads:[~2018-08-01 3:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-01 3:24 Jheng-Jhong Wu [this message]
2018-08-01 6:01 ` [PATCH] staging:mt29f_spinand: MT29F2G failing as only 16-bit arguments and variables used for addressing Boris Brezillon
2018-08-01 12:05 ` Dan Carpenter
2018-08-01 13:55 ` Miquel Raynal
2018-08-01 14:04 ` Dan Carpenter
2018-08-06 1:49 ` Jheng-Jhong Wu
2018-08-06 8:59 ` Dan Carpenter
2018-08-06 11:46 ` Boris Brezillon
2018-08-06 12:01 ` Dan Carpenter
2018-08-06 12:18 ` Boris Brezillon
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=1533093861-9761-1-git-send-email-goodwater.wu@gmail.com \
--to=goodwater.wu@gmail.com \
--cc=arunrasppi@gmail.com \
--cc=boris.brezillon@bootlin.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miquel.raynal@bootlin.com \
--cc=palle.christensen@microsemi.com \
--cc=yamada.masahiro@socionext.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