LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] mtd: jedec_probe: initialise make sector erase command variable
@ 2011-02-11 10:00 Antony Pavlov
2011-02-11 10:02 ` Guillaume LECERF
2011-02-11 15:06 ` Artem Bityutskiy
0 siblings, 2 replies; 5+ messages in thread
From: Antony Pavlov @ 2011-02-11 10:00 UTC (permalink / raw)
To: dwmw2; +Cc: w.sang, linux-mtd, linux-kernel, Antony Pavlov
In the commit 08968041bef437ec363623cd3218c2b083537ada
(mtd: cfi_cmdset_0002: make sector erase command variable)
introdused a field sector_erase_cmd. In the same commit initialisation
of cfi->sector_erase_cmd made in cfi_chip_setup()
(file drivers/mtd/chips/cfi_probe.c), so the CFI chip has no problem:
...
cfi->cfi_mode = CFI_MODE_CFI;
cfi->sector_erase_cmd = CMD(0x30);
...
But for the JEDEC chips this initialisation is not carried out,
so the JEDEC chips have sector_erase_cmd == 0.
It's not possible symply add the line
p_cfi->sector_erase_cmd = CMD(0x30);
to the cfi_jedec_setup() function be cause CMD() macros needs
map and cfi variables. So this patch makes necessary changes.
Signed-off-by: Antony Pavlov <antony@niisi.msk.ru>
---
drivers/mtd/chips/jedec_probe.c | 35 ++++++++++++++++++-----------------
1 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/drivers/mtd/chips/jedec_probe.c b/drivers/mtd/chips/jedec_probe.c
index d72a5fb..4e1be51 100644
--- a/drivers/mtd/chips/jedec_probe.c
+++ b/drivers/mtd/chips/jedec_probe.c
@@ -1935,14 +1935,14 @@ static void jedec_reset(u32 base, struct map_info *map, struct cfi_private *cfi)
}
-static int cfi_jedec_setup(struct cfi_private *p_cfi, int index)
+static int cfi_jedec_setup(struct map_info *map, struct cfi_private *cfi, int index)
{
int i,num_erase_regions;
uint8_t uaddr;
- if (! (jedec_table[index].devtypes & p_cfi->device_type)) {
+ if (!(jedec_table[index].devtypes & cfi->device_type)) {
DEBUG(MTD_DEBUG_LEVEL1, "Rejecting potential %s with incompatible %d-bit device type\n",
- jedec_table[index].name, 4 * (1<<p_cfi->device_type));
+ jedec_table[index].name, 4 * (1<<cfi->device_type));
return 0;
}
@@ -1950,27 +1950,28 @@ static int cfi_jedec_setup(struct cfi_private *p_cfi, int index)
num_erase_regions = jedec_table[index].nr_regions;
- p_cfi->cfiq = kmalloc(sizeof(struct cfi_ident) + num_erase_regions * 4, GFP_KERNEL);
- if (!p_cfi->cfiq) {
+ cfi->cfiq = kmalloc(sizeof(struct cfi_ident) + num_erase_regions * 4, GFP_KERNEL);
+ if (!cfi->cfiq) {
//xx printk(KERN_WARNING "%s: kmalloc failed for CFI ident structure\n", map->name);
return 0;
}
- memset(p_cfi->cfiq,0,sizeof(struct cfi_ident));
+ memset(cfi->cfiq, 0, sizeof(struct cfi_ident));
- p_cfi->cfiq->P_ID = jedec_table[index].cmd_set;
- p_cfi->cfiq->NumEraseRegions = jedec_table[index].nr_regions;
- p_cfi->cfiq->DevSize = jedec_table[index].dev_size;
- p_cfi->cfi_mode = CFI_MODE_JEDEC;
+ cfi->cfiq->P_ID = jedec_table[index].cmd_set;
+ cfi->cfiq->NumEraseRegions = jedec_table[index].nr_regions;
+ cfi->cfiq->DevSize = jedec_table[index].dev_size;
+ cfi->cfi_mode = CFI_MODE_JEDEC;
+ cfi->sector_erase_cmd = CMD(0x30);
for (i=0; i<num_erase_regions; i++){
- p_cfi->cfiq->EraseRegionInfo[i] = jedec_table[index].regions[i];
+ cfi->cfiq->EraseRegionInfo[i] = jedec_table[index].regions[i];
}
- p_cfi->cmdset_priv = NULL;
+ cfi->cmdset_priv = NULL;
/* This may be redundant for some cases, but it doesn't hurt */
- p_cfi->mfr = jedec_table[index].mfr_id;
- p_cfi->id = jedec_table[index].dev_id;
+ cfi->mfr = jedec_table[index].mfr_id;
+ cfi->id = jedec_table[index].dev_id;
uaddr = jedec_table[index].uaddr;
@@ -1978,8 +1979,8 @@ static int cfi_jedec_setup(struct cfi_private *p_cfi, int index)
our brains explode when we see the datasheets talking about address
lines numbered from A-1 to A18. The CFI table has unlock addresses
in device-words according to the mode the device is connected in */
- p_cfi->addr_unlock1 = unlock_addrs[uaddr].addr1 / p_cfi->device_type;
- p_cfi->addr_unlock2 = unlock_addrs[uaddr].addr2 / p_cfi->device_type;
+ cfi->addr_unlock1 = unlock_addrs[uaddr].addr1 / cfi->device_type;
+ cfi->addr_unlock2 = unlock_addrs[uaddr].addr2 / cfi->device_type;
return 1; /* ok */
}
@@ -2175,7 +2176,7 @@ static int jedec_probe_chip(struct map_info *map, __u32 base,
"MTD %s(): matched device 0x%x,0x%x unlock_addrs: 0x%.4x 0x%.4x\n",
__func__, cfi->mfr, cfi->id,
cfi->addr_unlock1, cfi->addr_unlock2 );
- if (!cfi_jedec_setup(cfi, i))
+ if (!cfi_jedec_setup(map, cfi, i))
return 0;
goto ok_out;
}
--
1.7.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: jedec_probe: initialise make sector erase command variable
2011-02-11 10:00 [PATCH] mtd: jedec_probe: initialise make sector erase command variable Antony Pavlov
@ 2011-02-11 10:02 ` Guillaume LECERF
2011-02-11 15:06 ` Artem Bityutskiy
1 sibling, 0 replies; 5+ messages in thread
From: Guillaume LECERF @ 2011-02-11 10:02 UTC (permalink / raw)
To: Antony Pavlov; +Cc: dwmw2, linux-mtd, w.sang, linux-kernel
Hello.
2011/2/11 Antony Pavlov <antony@niisi.msk.ru>:
> In the commit 08968041bef437ec363623cd3218c2b083537ada
> (mtd: cfi_cmdset_0002: make sector erase command variable)
> introdused a field sector_erase_cmd. In the same commit initialisation
> of cfi->sector_erase_cmd made in cfi_chip_setup()
> (file drivers/mtd/chips/cfi_probe.c), so the CFI chip has no problem:
>
> ...
> cfi->cfi_mode = CFI_MODE_CFI;
> cfi->sector_erase_cmd = CMD(0x30);
> ...
>
> But for the JEDEC chips this initialisation is not carried out,
> so the JEDEC chips have sector_erase_cmd == 0.
>
> It's not possible symply add the line
> p_cfi->sector_erase_cmd = CMD(0x30);
> to the cfi_jedec_setup() function be cause CMD() macros needs
> map and cfi variables. So this patch makes necessary changes.
>
> Signed-off-by: Antony Pavlov <antony@niisi.msk.ru>
Acked-by: Guillaume LECERF <glecerf@gmail.com>
--
Guillaume LECERF
GeeXboX developer - www.geexbox.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: jedec_probe: initialise make sector erase command variable
2011-02-11 10:00 [PATCH] mtd: jedec_probe: initialise make sector erase command variable Antony Pavlov
2011-02-11 10:02 ` Guillaume LECERF
@ 2011-02-11 15:06 ` Artem Bityutskiy
2011-02-14 10:16 ` Guillaume LECERF
1 sibling, 1 reply; 5+ messages in thread
From: Artem Bityutskiy @ 2011-02-11 15:06 UTC (permalink / raw)
To: Antony Pavlov; +Cc: dwmw2, linux-mtd, w.sang, linux-kernel
On Fri, 2011-02-11 at 13:00 +0300, Antony Pavlov wrote:
> In the commit 08968041bef437ec363623cd3218c2b083537ada
> (mtd: cfi_cmdset_0002: make sector erase command variable)
> introdused a field sector_erase_cmd. In the same commit initialisation
> of cfi->sector_erase_cmd made in cfi_chip_setup()
> (file drivers/mtd/chips/cfi_probe.c), so the CFI chip has no problem:
>
> ...
> cfi->cfi_mode = CFI_MODE_CFI;
> cfi->sector_erase_cmd = CMD(0x30);
> ...
>
> But for the JEDEC chips this initialisation is not carried out,
> so the JEDEC chips have sector_erase_cmd == 0.
>
> It's not possible symply add the line
> p_cfi->sector_erase_cmd = CMD(0x30);
> to the cfi_jedec_setup() function be cause CMD() macros needs
> map and cfi variables. So this patch makes necessary changes.
>
> Signed-off-by: Antony Pavlov <antony@niisi.msk.ru>
Pushed to l2-mtd-2.6.git, thanks.
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: jedec_probe: initialise make sector erase command variable
2011-02-11 15:06 ` Artem Bityutskiy
@ 2011-02-14 10:16 ` Guillaume LECERF
2011-02-14 11:05 ` Artem Bityutskiy
0 siblings, 1 reply; 5+ messages in thread
From: Guillaume LECERF @ 2011-02-14 10:16 UTC (permalink / raw)
To: dedekind1; +Cc: Antony Pavlov, linux-mtd, dwmw2, w.sang, linux-kernel
Hi.
2011/2/11 Artem Bityutskiy <dedekind1@gmail.com>:
> Pushed to l2-mtd-2.6.git, thanks.
Maybe it should be sent to -stable ?
--
Guillaume LECERF
GeeXboX developer - www.geexbox.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: jedec_probe: initialise make sector erase command variable
2011-02-14 10:16 ` Guillaume LECERF
@ 2011-02-14 11:05 ` Artem Bityutskiy
0 siblings, 0 replies; 5+ messages in thread
From: Artem Bityutskiy @ 2011-02-14 11:05 UTC (permalink / raw)
To: Guillaume LECERF; +Cc: Antony Pavlov, linux-mtd, dwmw2, w.sang, linux-kernel
On Mon, 2011-02-14 at 11:16 +0100, Guillaume LECERF wrote:
> Hi.
>
> 2011/2/11 Artem Bityutskiy <dedekind1@gmail.com>:
> > Pushed to l2-mtd-2.6.git, thanks.
>
> Maybe it should be sent to -stable ?
OK, I'll add a "cc stable" tag,
thanks.
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-02-14 11:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-11 10:00 [PATCH] mtd: jedec_probe: initialise make sector erase command variable Antony Pavlov
2011-02-11 10:02 ` Guillaume LECERF
2011-02-11 15:06 ` Artem Bityutskiy
2011-02-14 10:16 ` Guillaume LECERF
2011-02-14 11:05 ` Artem Bityutskiy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).