Skip to contentSkip to conversation

infineon danube/twinpass mtd support

DISCUSSION [email protected] 2 participants 2 messages Mar 7, 2009 – Mar 17, 2009 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

Hi all,

we rewrote the infineon danube/twinpass support a while back and bumped the original vendor code to 2.6. we are currently looking into some left over details, before sending the patches upstream.

1 open issue is the mtd map. the danube has a EBU (External Bus Unit) which connects pci and mtd to the mips core. for PCI to work, the EBU needs to endiness swap in-/ex-gress DMA data. however, due to a design issue(?!) the EBU only swaps MTD one way. hence we needed to add some complex mappings.

there is 1 really ugly hack, we needed to add to make it work. the patch can be found here ->
https://dev.openwrt.org/browser/trunk/target/linux/ifxmips/patches-2.6.28/160-cfi-swap.patch

and the map driver here -->
https://dev.openwrt.org/browser/trunk/target/linux/ifxmips/files/drivers/mtd/maps/ifxmips.c

i would appreciate to get some input, whether this is the correct solution. i think the mtd subsystem is missing a generic way to handle this kind of situation. but correct me if i am worng please.

thanks,
John

Signature · 14 lines
John Crispin
hacking, coding, etc
blogic on irc

   _______                     ________        __
  |       |.-----.-----.-----.|  |  |  |.----.|  |_
  |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
  |_______||   __|_____|__|__||________||__|  |____|
           |__| W I R E L E S S   F R E E D O M
  KAMIKAZE (bleeding edge) -----------------------
   * 10 oz Vodka       Shake well with ice and strain
   * 10 oz Triple sec  mixture into 10 shot glasses.
   * 10 oz lime juice  Salute!
  ---------------------------------------------------
#1 lore raw
Quoted 10 lines · On Sat, 2009-03-07 at 13:30 +0100, [email protected] wrote:

we rewrote the infineon danube/twinpass support a while back and bumped the original vendor code to 2.6. we are currently looking into some left over details, before sending the patches upstream.

1 open issue is the mtd map. the danube has a EBU (External Bus Unit) which connects pci and mtd to the mips core. for PCI to work, the EBU needs to endiness swap in-/ex-gress DMA data. however, due to a design issue(?!) the EBU only swaps MTD one way. hence we needed to add some complex mappings.

Your issue is that your address lines to the flash are effectively swapped, so what the _chip_ thinks is address 0x0002 isn't actually appearing at that location when you try to read/write it.

That doesn't _matter_ for the data, if you're thinking of it as a ROM chip. You need to be able to just execute code directly from it when the CPU starts up, and you want to be able to just memcpy directly from it -- so you want your data to _appear_ unmangled, which means that inside the _chip_ it's actually swapped. But that doesn't matter because you have no way of telling unless you take the chip out and put it in a normal machine or PROM programmer.

That's just for _data_, though.

The chip _does_ care which address the magic unlock commands are sent to. It has to be address 0x555 on the chip, otherwise it'll ignore you.

So one option is just to mangle the unlock addresses... except that the probe is also going to be screwed up because the CFI table is going to be swapped, too.

I suspect the best answer is to add an extra argument to the map driver's write function, indicating whether it's a command or data cycle. And your map driver will only mangle the addresses for the _command_ cycles.

Signature · 2 lines
David Woodhouse                            Open Source Technology Centre
[email protected]                              Intel Corporation