From: John Ogness <john.ogness@linutronix.de> To: Sascha Hauer <s.hauer@pengutronix.de> Cc: Baruch Siach <baruch@tkos.co.il>, linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Ivo Clarysse <ivo.clarysse@gmail.com> Subject: [PATCH 1/3] mxc_nand: set spare size and pages per block Date: Tue, 10 Aug 2010 13:34:07 +0200 [thread overview] Message-ID: <80r5i63dn4.fsf@merkur.tec.linutronix.de> (raw) This patch sets the NFC registers for spare size and pages per block. This patch is against the latest patches from Sascha Hauer. Signed-off-by: John Ogness <john.ogness@linutronix.de> --- drivers/mtd/nand/mxc_nand.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) Index: linux-2.6-454a740/drivers/mtd/nand/mxc_nand.c =================================================================== --- linux-2.6-454a740.orig/drivers/mtd/nand/mxc_nand.c +++ linux-2.6-454a740/drivers/mtd/nand/mxc_nand.c @@ -68,6 +68,8 @@ #define NFC_V1_V2_CONFIG1_RST (1 << 6) #define NFC_V1_V2_CONFIG1_CE (1 << 7) #define NFC_V1_V2_CONFIG1_ONE_CYCLE (1 << 8) +#define NFC_V1_V2_CONFIG1_PPB_SHIFT 9 +#define NFC_V1_V2_CONFIG1_PPB_MASK 0x3 #define NFC_V1_V2_CONFIG2_INT (1 << 15) @@ -749,7 +751,37 @@ static void preset_v1_v2(struct mtd_info host->eccsize = 1; } + if (nfc_is_v21() && mtd->writesize) { + /* setup pages per block */ + tmp &= ~(NFC_V1_V2_CONFIG1_PPB_MASK << + NFC_V1_V2_CONFIG1_PPB_SHIFT); + switch (mtd->erasesize / mtd->writesize) { + case 32: + /* PPB set to 0 */ + break; + case 64: + tmp |= 1 << NFC_V1_V2_CONFIG1_PPB_SHIFT; + break; + case 256: + tmp |= 3 << NFC_V1_V2_CONFIG1_PPB_SHIFT; + break; + default: + /* 128 (reset value) */ + tmp |= 2 << NFC_V1_V2_CONFIG1_PPB_SHIFT; + break; + } + } + writew(tmp, NFC_V1_V2_CONFIG1); + + if (nfc_is_v21()) { + /* configure spare size (in 16-bit units) */ + tmp = readw(NFC_V1_V2_RSLTSPARE_AREA); + tmp &= ~0xff; + tmp |= host->spare_len >> 1; + writew(tmp, NFC_V1_V2_RSLTSPARE_AREA); + } + /* preset operation */ /* Unlock the internal RAM Buffer */
WARNING: multiple messages have this Message-ID (diff)
From: john.ogness@linutronix.de (John Ogness) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/3] mxc_nand: set spare size and pages per block Date: Tue, 10 Aug 2010 13:34:07 +0200 [thread overview] Message-ID: <80r5i63dn4.fsf@merkur.tec.linutronix.de> (raw) This patch sets the NFC registers for spare size and pages per block. This patch is against the latest patches from Sascha Hauer. Signed-off-by: John Ogness <john.ogness@linutronix.de> --- drivers/mtd/nand/mxc_nand.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) Index: linux-2.6-454a740/drivers/mtd/nand/mxc_nand.c =================================================================== --- linux-2.6-454a740.orig/drivers/mtd/nand/mxc_nand.c +++ linux-2.6-454a740/drivers/mtd/nand/mxc_nand.c @@ -68,6 +68,8 @@ #define NFC_V1_V2_CONFIG1_RST (1 << 6) #define NFC_V1_V2_CONFIG1_CE (1 << 7) #define NFC_V1_V2_CONFIG1_ONE_CYCLE (1 << 8) +#define NFC_V1_V2_CONFIG1_PPB_SHIFT 9 +#define NFC_V1_V2_CONFIG1_PPB_MASK 0x3 #define NFC_V1_V2_CONFIG2_INT (1 << 15) @@ -749,7 +751,37 @@ static void preset_v1_v2(struct mtd_info host->eccsize = 1; } + if (nfc_is_v21() && mtd->writesize) { + /* setup pages per block */ + tmp &= ~(NFC_V1_V2_CONFIG1_PPB_MASK << + NFC_V1_V2_CONFIG1_PPB_SHIFT); + switch (mtd->erasesize / mtd->writesize) { + case 32: + /* PPB set to 0 */ + break; + case 64: + tmp |= 1 << NFC_V1_V2_CONFIG1_PPB_SHIFT; + break; + case 256: + tmp |= 3 << NFC_V1_V2_CONFIG1_PPB_SHIFT; + break; + default: + /* 128 (reset value) */ + tmp |= 2 << NFC_V1_V2_CONFIG1_PPB_SHIFT; + break; + } + } + writew(tmp, NFC_V1_V2_CONFIG1); + + if (nfc_is_v21()) { + /* configure spare size (in 16-bit units) */ + tmp = readw(NFC_V1_V2_RSLTSPARE_AREA); + tmp &= ~0xff; + tmp |= host->spare_len >> 1; + writew(tmp, NFC_V1_V2_RSLTSPARE_AREA); + } + /* preset operation */ /* Unlock the internal RAM Buffer */
next reply other threads:[~2010-08-10 11:34 UTC|newest] Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-08-10 11:34 John Ogness [this message] 2010-08-10 11:34 ` [PATCH 1/3] mxc_nand: set spare size and pages per block John Ogness 2010-08-10 11:35 ` [PATCH 2/3] mxc_nand: remove unused variables John Ogness 2010-08-10 11:35 ` John Ogness 2010-08-10 11:36 ` [PATCH 3/3] mxc_nand: mask instead of disabling (i.MX21 as exception) John Ogness 2010-08-10 11:36 ` John Ogness 2010-08-10 12:19 ` [PATCH 1/3] mxc_nand: set spare size and pages per block Sascha Hauer 2010-08-10 12:19 ` Sascha Hauer 2010-08-10 14:31 ` John Ogness 2010-08-10 14:31 ` John Ogness 2010-08-10 14:43 ` John Ogness 2010-08-10 14:43 ` John Ogness 2010-08-11 12:56 ` Sascha Hauer 2010-08-11 12:56 ` Sascha Hauer 2010-08-11 13:16 ` John Ogness 2010-08-11 13:16 ` John Ogness 2010-08-11 13:27 ` Sascha Hauer 2010-08-11 13:27 ` Sascha Hauer 2010-08-16 11:28 ` Sascha Hauer 2010-08-16 11:28 ` Sascha Hauer 2010-08-16 12:05 ` John Ogness 2010-08-16 12:05 ` John Ogness 2010-08-17 8:54 ` Sascha Hauer 2010-08-17 8:54 ` Sascha Hauer 2010-08-17 17:02 ` John Ogness 2010-08-17 17:02 ` John Ogness 2010-08-29 12:08 ` Artem Bityutskiy 2010-08-29 12:08 ` Artem Bityutskiy
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=80r5i63dn4.fsf@merkur.tec.linutronix.de \ --to=john.ogness@linutronix.de \ --cc=baruch@tkos.co.il \ --cc=ivo.clarysse@gmail.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-mtd@lists.infradead.org \ --cc=s.hauer@pengutronix.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: linkBe 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.