* [PATCH] CFI: major version fixup for Samsung K8P2815UQB NOR Flash
@ 2009-01-09 13:02 Wolfgang Grandegger
2009-01-09 14:31 ` Nicolas Pitre
0 siblings, 1 reply; 2+ messages in thread
From: Wolfgang Grandegger @ 2009-01-09 13:02 UTC (permalink / raw)
To: linux-mtd; +Cc: Nicolas Pitre, David Woodhouse
The NOR Flash memory K8P2815UQB from Samsung uses an incorrect major
version number '0'. This patch introduces the cfi_fixup_major_minor()
function to set the major version to '1' for this chip. A normal
quirk (fixup) cannot be used, because cfi_fixup() is called after the
major/minor version check.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
---
drivers/mtd/chips/cfi_cmdset_0002.c | 10 ++++++++++
include/linux/mtd/cfi.h | 1 +
2 files changed, 11 insertions(+)
Index: linux-2.6/drivers/mtd/chips/cfi_cmdset_0002.c
===================================================================
--- linux-2.6.orig/drivers/mtd/chips/cfi_cmdset_0002.c
+++ linux-2.6/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -322,6 +322,14 @@ static struct cfi_fixup fixup_table[] =
};
+static void cfi_fixup_major_minor(struct cfi_private *cfi,
+ struct cfi_pri_amdstd *extp)
+{
+ if (cfi->mfr == CFI_MFR_SAMSUNG && cfi->id == 0x257e &&
+ extp->MajorVersion == '0')
+ extp->MajorVersion = '1';
+}
+
struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary)
{
struct cfi_private *cfi = map->fldrv_priv;
@@ -363,6 +371,8 @@ struct mtd_info *cfi_cmdset_0002(struct
return NULL;
}
+ cfi_fixup_major_minor(cfi, extp);
+
if (extp->MajorVersion != '1' ||
(extp->MinorVersion < '0' || extp->MinorVersion > '4')) {
printk(KERN_ERR " Unknown Amd/Fujitsu Extended Query "
Index: linux-2.6/include/linux/mtd/cfi.h
===================================================================
--- linux-2.6.orig/include/linux/mtd/cfi.h
+++ linux-2.6/include/linux/mtd/cfi.h
@@ -520,6 +520,7 @@ struct cfi_fixup {
#define CFI_MFR_AMD 0x0001
#define CFI_MFR_ATMEL 0x001F
+#define CFI_MFR_SAMSUNG 0x00EC
#define CFI_MFR_ST 0x0020 /* STMicroelectronics */
void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups);
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] CFI: major version fixup for Samsung K8P2815UQB NOR Flash
2009-01-09 13:02 [PATCH] CFI: major version fixup for Samsung K8P2815UQB NOR Flash Wolfgang Grandegger
@ 2009-01-09 14:31 ` Nicolas Pitre
0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Pitre @ 2009-01-09 14:31 UTC (permalink / raw)
To: Wolfgang Grandegger; +Cc: David Woodhouse, linux-mtd
On Fri, 9 Jan 2009, Wolfgang Grandegger wrote:
> The NOR Flash memory K8P2815UQB from Samsung uses an incorrect major
> version number '0'. This patch introduces the cfi_fixup_major_minor()
> function to set the major version to '1' for this chip. A normal
> quirk (fixup) cannot be used, because cfi_fixup() is called after the
> major/minor version check.
>
> Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Acked-by: Nicolas Pitre <nico@cam.org>
> ---
> drivers/mtd/chips/cfi_cmdset_0002.c | 10 ++++++++++
> include/linux/mtd/cfi.h | 1 +
> 2 files changed, 11 insertions(+)
>
> Index: linux-2.6/drivers/mtd/chips/cfi_cmdset_0002.c
> ===================================================================
> --- linux-2.6.orig/drivers/mtd/chips/cfi_cmdset_0002.c
> +++ linux-2.6/drivers/mtd/chips/cfi_cmdset_0002.c
> @@ -322,6 +322,14 @@ static struct cfi_fixup fixup_table[] =
> };
>
>
> +static void cfi_fixup_major_minor(struct cfi_private *cfi,
> + struct cfi_pri_amdstd *extp)
> +{
> + if (cfi->mfr == CFI_MFR_SAMSUNG && cfi->id == 0x257e &&
> + extp->MajorVersion == '0')
> + extp->MajorVersion = '1';
> +}
> +
> struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary)
> {
> struct cfi_private *cfi = map->fldrv_priv;
> @@ -363,6 +371,8 @@ struct mtd_info *cfi_cmdset_0002(struct
> return NULL;
> }
>
> + cfi_fixup_major_minor(cfi, extp);
> +
> if (extp->MajorVersion != '1' ||
> (extp->MinorVersion < '0' || extp->MinorVersion > '4')) {
> printk(KERN_ERR " Unknown Amd/Fujitsu Extended Query "
> Index: linux-2.6/include/linux/mtd/cfi.h
> ===================================================================
> --- linux-2.6.orig/include/linux/mtd/cfi.h
> +++ linux-2.6/include/linux/mtd/cfi.h
> @@ -520,6 +520,7 @@ struct cfi_fixup {
>
> #define CFI_MFR_AMD 0x0001
> #define CFI_MFR_ATMEL 0x001F
> +#define CFI_MFR_SAMSUNG 0x00EC
> #define CFI_MFR_ST 0x0020 /* STMicroelectronics */
>
> void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-01-09 14:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-09 13:02 [PATCH] CFI: major version fixup for Samsung K8P2815UQB NOR Flash Wolfgang Grandegger
2009-01-09 14:31 ` Nicolas Pitre
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox