From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] OneNAND: Fix compiler warnings and add weak attribute to memcpy_16()
Date: Fri, 7 Nov 2008 16:09:12 +0100 [thread overview]
Message-ID: <1226070552-30144-1-git-send-email-sr@denx.de> (raw)
This patch adds memcpy_16_from_onenand() and memcpy_16_to_onenand()
functions and defaults them to the already available memcpy_16()
function. They are defined weak so that they can be overwritten by
a board/platform specific version.
This is needed for the vcth board support (still to come) which needs
custom access routines here.
It also removes some compiler warnings by adding the onenand_get_2x_blockpage()
function and removing the onenand_lock()/onenand_unlock() functions.
Signed-off-by: Stefan Roese <sr@denx.de>
---
This patch has to be applied on top of the patch submitted by Kyungmin Park
on 2008-11-04:
[PATCH] [OneNAND] Sync with 2.6.27
drivers/mtd/onenand/onenand_base.c | 38 ++++++++++++++++++++++++++++++++---
1 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 66214e8..5c752ca 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -24,7 +24,7 @@
#include <malloc.h>
/* It should access 16-bit instead of 8-bit */
-static inline void *memcpy_16(void *dst, const void *src, unsigned int len)
+void *__memcpy_16(void *dst, const void *src, unsigned int len)
{
void *ret = dst;
short *d = dst;
@@ -35,6 +35,10 @@ static inline void *memcpy_16(void *dst, const void *src, unsigned int len)
*d++ = *s++;
return ret;
}
+void *memcpy_16_from_onenand(void *dst, const void *src, unsigned int len)
+ __attribute__((weak, alias("__memcpy_16")));
+void *memcpy_16_to_onenand(void *dst, const void *src, unsigned int len)
+ __attribute__((weak, alias("__memcpy_16")));
static const unsigned char ffchars[] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
@@ -349,7 +353,7 @@ static int onenand_read_bufferram(struct mtd_info *mtd, loff_t addr, int area,
bufferram = this->base + area;
bufferram += onenand_bufferram_offset(mtd, area);
- memcpy_16(buffer, bufferram + offset, count);
+ memcpy_16_from_onenand(buffer, bufferram + offset, count);
return 0;
}
@@ -376,7 +380,7 @@ static int onenand_sync_read_bufferram(struct mtd_info *mtd, loff_t addr, int ar
this->mmcontrol(mtd, ONENAND_SYS_CFG1_SYNC_READ);
- memcpy_16(buffer, bufferram + offset, count);
+ memcpy_16_from_onenand(buffer, bufferram + offset, count);
this->mmcontrol(mtd, 0);
@@ -403,12 +407,36 @@ static int onenand_write_bufferram(struct mtd_info *mtd, loff_t addr, int area,
bufferram = this->base + area;
bufferram += onenand_bufferram_offset(mtd, area);
- memcpy_16(bufferram + offset, buffer, count);
+ memcpy_16_to_onenand(bufferram + offset, buffer, count);
return 0;
}
/**
+ * onenand_get_2x_blockpage - [GENERIC] Get blockpage at 2x program mode
+ * @param mtd MTD data structure
+ * @param addr address to check
+ * @return blockpage address
+ *
+ * Get blockpage address at 2x program mode
+ */
+static int onenand_get_2x_blockpage(struct mtd_info *mtd, loff_t addr)
+{
+ struct onenand_chip *this = mtd->priv;
+ int blockpage, block, page;
+
+ /* Calculate the even block number */
+ block = (int) (addr >> this->erase_shift) & ~1;
+ /* Is it the odd plane? */
+ if (addr & this->writesize)
+ block++;
+ page = (int) (addr >> (this->page_shift + 1)) & this->page_mask;
+ blockpage = (block << 7) | page;
+
+ return blockpage;
+}
+
+/**
* onenand_check_bufferram - [GENERIC] Check BufferRAM information
* @param mtd MTD data structure
* @param addr address to check
@@ -1666,6 +1694,7 @@ static int onenand_do_lock_cmd(struct mtd_info *mtd, loff_t ofs, size_t len, int
return 0;
}
+#ifdef ONENAND_LINUX
/**
* onenand_lock - [MTD Interface] Lock block(s)
* @param mtd MTD device structure
@@ -1701,6 +1730,7 @@ static int onenand_unlock(struct mtd_info *mtd, loff_t ofs, size_t len)
onenand_release_device(mtd);
return ret;
}
+#endif
/**
* onenand_check_lock_status - [OneNAND Interface] Check lock status
--
1.6.0.3
next reply other threads:[~2008-11-07 15:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-07 15:09 Stefan Roese [this message]
2008-11-07 22:25 ` [U-Boot] [PATCH] OneNAND: Fix compiler warnings and add weak attribute to memcpy_16() Scott Wood
2008-11-08 5:36 ` Stefan Roese
2008-11-10 16:27 ` Scott Wood
2008-11-10 16:46 ` Stefan Roese
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=1226070552-30144-1-git-send-email-sr@denx.de \
--to=sr@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.