From: Marcel Ziswiler <marcel@ziswiler.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 10/13] mtd/nand/tegra: alignment workaround
Date: Mon, 6 Jul 2015 10:20:36 +0200 [thread overview]
Message-ID: <9eb86ec4ab40540b2fbb76df9e8203803a5d7e77.1436170106.git.marcel.ziswiler@toradex.com> (raw)
In-Reply-To: <cover.1436170106.git.marcel.ziswiler@toradex.com>
From: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Introduce cache alignment bounce buffer to workaround issues as follows:
Loading file '/boot/zImage' to addr 0x01000000 with size 4499152 (0x0044a6d0)...
ERROR: v7_dcache_inval_range - start address is not aligned - 0x1f7f0108
ERROR: v7_dcache_inval_range - stop address is not aligned - 0x1f7f1108
Done
Kernel image @ 0x1000000 [ 0x000000 - 0x44a6d0 ]
Starting kernel ...
undefined instruction
pc : [<005ff03c>] lr : [<0000800c>]
sp : 0144b6e8 ip : 01000188 fp : 0144a6c8
r10: 00000000 r9 : 411fc090 r8 : 00000100
r7 : 00000cfb r6 : 0144a6d0 r5 : 00000000 r4 : 00008000
r3 : 0000000c r2 : 00000100 r1 : 00000cfb r0 : 00000000
Flags: nZCv IRQs off FIQs off Mode SVC_32
Resetting CPU ...
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
---
drivers/mtd/nand/tegra_nand.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/mtd/nand/tegra_nand.c b/drivers/mtd/nand/tegra_nand.c
index 9c90634..a7ab415 100644
--- a/drivers/mtd/nand/tegra_nand.c
+++ b/drivers/mtd/nand/tegra_nand.c
@@ -87,6 +87,7 @@ struct fdt_nand {
struct nand_drv {
struct nand_ctlr *reg;
struct fdt_nand config;
+ uint8_t *data_buf; /* cache alignment bounce buffer */
};
static struct nand_drv nand_ctrl;
@@ -534,6 +535,7 @@ static int nand_rw_page(struct mtd_info *mtd, struct nand_chip *chip,
char *tag_ptr;
struct nand_drv *info;
struct fdt_nand *config;
+ uint8_t *temp_buf = NULL;
if ((uintptr_t)buf & 0x03) {
printf("buf %p has to be 4-byte aligned\n", buf);
@@ -545,6 +547,12 @@ static int nand_rw_page(struct mtd_info *mtd, struct nand_chip *chip,
if (set_bus_width_page_size(config, ®_val))
return -EINVAL;
+ /* cache alignment */
+ if ((!is_writing) && ((uintptr_t)buf & (ARCH_DMA_MINALIGN - 1))) {
+ temp_buf = buf;
+ buf = info->data_buf;
+ }
+
/* Need to be 4-byte aligned */
tag_ptr = (char *)tag_buf;
@@ -638,6 +646,11 @@ static int nand_rw_page(struct mtd_info *mtd, struct nand_chip *chip,
return -EIO;
}
+ /* cache alignment */
+ if (temp_buf) {
+ memcpy(temp_buf, buf, 1 << chip->page_shift);
+ }
+
if (with_ecc && !is_writing) {
memcpy(chip->oob_poi, tag_ptr,
SKIPPED_SPARE_BYTES);
@@ -999,6 +1012,11 @@ int tegra_nand_init(struct nand_chip *nand, int devnum)
nand->ecc.size = our_mtd->writesize;
nand->ecc.bytes = our_mtd->oobsize;
+ /* cache alignment */
+ info->data_buf = memalign(ARCH_DMA_MINALIGN, our_mtd->writesize);
+ if (!info->data_buf)
+ return -ENOMEM;
+
ret = nand_scan_tail(our_mtd);
if (ret)
return ret;
--
1.9.3
next prev parent reply other threads:[~2015-07-06 8:20 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-06 8:20 [U-Boot] [PATCH 00/13] assortment of tegra fixes/enhancements Marcel Ziswiler
2015-07-06 8:20 ` [U-Boot] [PATCH 01/13] ARM: tegra: allow custom usb manufacturer/product/vendor ids/strings Marcel Ziswiler
2015-07-06 16:39 ` Simon Glass
2015-07-06 8:20 ` [U-Boot] [PATCH 02/13] ARM: tegra: allow reading recovery mode boot type Marcel Ziswiler
2015-07-06 16:38 ` Simon Glass
2015-07-06 8:20 ` [U-Boot] [PATCH 03/13] apalis/colibri_t20/t30: integrate recovery mode detection Marcel Ziswiler
2015-07-06 16:38 ` Simon Glass
2015-07-07 6:04 ` Marcel Ziswiler
2015-07-08 20:57 ` Stephen Warren
2015-07-09 13:02 ` Marcel Ziswiler
2015-07-09 15:02 ` Stefan Agner
2015-07-09 15:51 ` Stephen Warren
2015-07-06 8:20 ` [U-Boot] [PATCH 04/13] colibri_t20: fix device-tree compatible node Marcel Ziswiler
2015-07-06 16:38 ` Simon Glass
2015-07-06 8:20 ` [U-Boot] [PATCH 05/13] colibri_t20: add LCD display support Marcel Ziswiler
2015-07-06 16:38 ` Simon Glass
2015-07-07 8:54 ` Marcel Ziswiler
2015-07-06 8:20 ` [U-Boot] [PATCH 06/13] colibri_t20: add i2c support Marcel Ziswiler
2015-07-06 16:38 ` Simon Glass
2015-07-06 8:20 ` [U-Boot] [PATCH 07/13] colibri_t20: disable PMIC sleep mode on low supply voltage Marcel Ziswiler
2015-07-06 16:38 ` Simon Glass
2015-07-06 8:20 ` [U-Boot] [PATCH 08/13] tegra: nand: fix read_byte required for proper onfi detection Marcel Ziswiler
2015-07-06 8:20 ` [U-Boot] [PATCH 09/13] colibri_t20: enable nand " Marcel Ziswiler
2015-07-06 16:38 ` Simon Glass
2015-07-06 8:20 ` Marcel Ziswiler [this message]
2015-07-06 16:38 ` [U-Boot] [PATCH 10/13] mtd/nand/tegra: alignment workaround Simon Glass
2015-07-06 8:20 ` [U-Boot] [PATCH 11/13] colibri_t20: enable mtdparts support Marcel Ziswiler
2015-07-06 16:38 ` Simon Glass
2015-07-06 8:20 ` [U-Boot] [PATCH 12/13] apalis/colibri_t20/t30: enable raw initrd support Marcel Ziswiler
2015-07-06 16:39 ` Simon Glass
2015-07-06 8:20 ` [U-Boot] [PATCH 13/13] apalis/colibri_t20/t30: increase tftp blocksize Marcel Ziswiler
2015-07-06 16:38 ` Simon Glass
2015-07-08 21:03 ` Stephen Warren
2015-07-09 13:26 ` Marcel Ziswiler
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=9eb86ec4ab40540b2fbb76df9e8203803a5d7e77.1436170106.git.marcel.ziswiler@toradex.com \
--to=marcel@ziswiler.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.