Skip to contentSkip to conversation

magician: enable flash VPP GPIO and build in MTD, physmap-flash and JFFS2

PATCH In review pHilipp Zabel 2 participants 2 messages Mar 21, 2008 – Apr 22, 2008 3 messages not in the archive Memory technology devices (MTD)

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

PATCH 5/9 magician: enable flash VPP GPIO and build in MTD, physmap-flash and JFFS2

Hi, I'd like to forward you a question about this patch that I'd like to get in via Russell King's queue.

The way the MTD subsystem / physmap driver handle set_vpp, can the magician_set_vpp function below race with itself? Or would it be better to use a counting approach like omap_set_vpp in the omap-nor driver?

The full patch is here:
http://lists.arm.linux.org.uk/lurker/message/20080317.201751.2fa54cff.en.html

thanks
Philipp

---------- Forwarded message ----------
From: pHilipp Zabel <[email protected]>
Date: Fri, Mar 21, 2008 at 12:48 PM
Subject: Re: [PATCH 5/9] magician: enable flash VPP GPIO and build in MTD, physmap-flash and JFFS2
To: Russell King - ARM Linux <[email protected]>
Cc: linux-arm-kernel <[email protected]>

Quoted 9 lines · Russell King - ARM Linux

arch/arm/mach-pxa/magician.c static struct pxaohci_platform_data

Quoted 8 lines · Philipp Zabel

This enables rootfs on StrataFlash if the bootloader supplies the partition list.

arch/arm/mach-pxa/magician.c +0 -0
index 3a3252e..531be3d 100644
@@ -223,6 +223,15 @@ static struct pxaohci_platform_data

magician_ohci_info = {

Quoted 14 lines

arch/arm/mach-pxa/magician.c static struct pxaohci_platform_data · line 234

Quoted 12 lines
arch/arm/mach-pxa/magician.c +9 -0
  * StrataFlash
  */
 
+static void magician_set_vpp(struct map_info *map, int vpp)
+{
+     static int old_vpp;
+     if (vpp == old_vpp)
+             return;
+     gpio_set_value(EGPIO_MAGICIAN_FLASH_VPP, vpp);
+     old_vpp = vpp;
+}
+

Have you checked that this can't race with itself?

No, I have just seen that set_vpp is called very often in quick succession with the same vpp value and wanted to avoid overhead, assuming that the mtd subsystem cares about locking.
I have just seen that omap-nor does something similar but with a counter. Maybe this would be better?

static void omap_set_vpp(struct map_info *map, int enable)

 {
        static int      count;

        if (enable) {
                if (count++ == 0)
                        OMAP_EMIFS_CONFIG_REG |= OMAP_EMIFS_CONFIG_WP;
        } else {
                if (count && (--count == 0))
                        OMAP_EMIFS_CONFIG_REG &= ~OMAP_EMIFS_CONFIG_WP;
        }

}

There's also a comment in chips/cfi_cmdset_0001.c:
/* We should really make set_vpp() count, rather than doing this */

regards
Philipp

#4 lore raw
Quoted 7 lines · pHilipp Zabel

Hi, I'd like to forward you a question about this patch that I'd like to get in via Russell King's queue.

The way the MTD subsystem / physmap driver handle set_vpp, can the magician_set_vpp function below race with itself? Or would it be better to use a counting approach like omap_set_vpp in the omap-nor driver?

I believe that when used for a single chip (or set of chips with a single map driver), all access is serialised. It's only if you use the same set_vpp() function for multiple different maps that you need to play counting tricks.

Signature · 1 line
dwmw2