public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Fundu <fundu_1999@yahoo.com>
To: linux-mtd@lists.infradead.org
Subject: Flash Mapping and gpio
Date: Thu, 11 Sep 2008 13:52:31 -0700 (PDT)	[thread overview]
Message-ID: <306578.90559.qm@web63402.mail.re1.yahoo.com> (raw)

Hi,

I trying to access 256mb flash from a pripheral that can only access 128 mb.
flash are in x16 mode and interleaved.
A gpio is connected to A25 pin of the flash parts.

Such that any of the two 128mb "areas" can be accessed.

I'm trying to configure the mtd drivers such that i can do the following 

so when ofs 00000000 -> 07ffffff, A25(gpio)= 0
ofs 08000000 -> 0fffffff, A25(gpio) =1


i have added helper the following function in include/linux/cfi.h

#define GPIO_FLASH_MASK 0x00000800
static inline void flash_cs(u32 addr, char is_ret)
{
    u32 gpio_data = is_ret ? 0 : GPIO_FLASH_MASK;
    if (addr & 0x08000000)
    {
        ibm_gpio_out(0, GPIO_FLASH_MASK, gpio_data);
    }
}

/* adjust the ofs such that 0800_0000 seems like 0000_0000 */
static inline u32 update_addr(u32 addr)
{
    return (addr & 0x08000000) ? (addr - 0x08000000) : addr;
}


static inline void cfi_write(struct map_info *map, cfi_word val, __u32 addr)
{
    flash_cs(map->phys + addr, 0);
    u32 new_addr = update_addr(addr);

    cfi_write_o(map, val, new_addr);

    flash_cs(map->phys + addr, 1); // sets A25 back to 0
}

static inline cfi_word cfi_read(struct map_info *map, __u32 addr)
{
    flash_cs(map->phys + addr, 0);
    u32 new_addr = update_addr(addr);

    cfi_word returnVal = cfi_read_o(map, new_addr);

    flash_cs(map->phys + addr, 1); // sets A25 back to 0

    return returnVal;
}

cfi_read_o and cfi_write_o are the original fn.

Also in cfi_send_gen_cmd i don't call the modified cfi_write 
as all Commands go to base address which is 0.

Questions 
---------
there are 2 things that i'm seeing that doesn't make sense
in cfi_probe.c the print_cfi_ident prints the following

Typical byte/word write timeout: 64 us
Maximum byte/word write timeout: 512 us
Typical full buffer write timeout: 64 us
Maximum full buffer write timeout: 2048 us
Typical block erase timeout: 512 ms
Maximum block erase timeout: 4096 ms
Typical chip erase timeout: 524288 ms
Maximum chip erase timeout: 2097152 ms
Device size: 0x8000000 bytes (128 MiB)
Flash Device Interface description: 0x0002

1) which seems wrong as the Device size should come out to be 256 instead of 128.
This doesn't look right, any ideas ? 

other is that when i do a erase i'm seeing a this ...
MTD do_erase_oneblock(): Wacky!  Unable to decode failure status
MTD do_erase_oneblock(): 0x07f40000(0x00ff00ff): 0x27051956 0x27051956 0x27051956 0x27051956

thanks !
fundu


      

             reply	other threads:[~2008-09-11 20:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-11 20:52 Fundu [this message]
2008-09-11 21:28 ` Flash Mapping and gpio Mike Frysinger
2008-09-11 21:34   ` Fundu
2008-09-11 21:38     ` Mike Frysinger
2008-09-11 22:23       ` Fundu
2008-09-12 14:00         ` Allon Stern
2008-09-12 16:54           ` Fundu
2008-09-12 17:14             ` Allon Stern

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=306578.90559.qm@web63402.mail.re1.yahoo.com \
    --to=fundu_1999@yahoo.com \
    --cc=linux-mtd@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox