Skip to contentSkip to conversation

address lines

DISCUSSION M8 (Servaes Joordens) 2 participants 10 messages Nov 3, 2007 – Nov 4, 2007 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

I took a closer look at the bank-switching problem. The situation is:

- I have an 4Mb Flash chip MT28F320J3FS-11
- A0-A19 are connected to the data-bus
- A20 is connected to GPIO PF4

So the hardware probe detects 4MB flash in 1 chip and tries to access it in a normal manner. How should I solve this? I got a patch from the manufacturer of the hardware for the file cfi_cmdset_0001.c, but I do wonder if that is the correct way to do it?

regards
Servaes

Signature · 13 lines
Servaes Joordens

-------------------------------------------
M8
Tappersweg 29
2031ET	Haarlem
The Netherlands
Tel:	+31 23 5311122
Mob:	+31 6 51183379
Fax:	+31 23 5322388

VAT-ID: nl-813029090B01
kvk:	34131430 Haarlem
#1 lore raw
Quoted 11 lines · On Sat, 2007-11-03 at 11:54 +0100, M8 (Servaes Joordens) wrote:

I took a closer look at the bank-switching problem. The situation is:

- I have an 4Mb Flash chip MT28F320J3FS-11
- A0-A19 are connected to the data-bus
- A20 is connected to GPIO PF4

So the hardware probe detects 4MB flash in 1 chip and tries to access it
in a normal manner. How should I solve this? I got a patch from the manufacturer of the hardware for the file cfi_cmdset_0001.c, but I do wonder if that is the correct way to do it?

No, it isn't. The correct way to do it is a fairly trivial 'complex mapping' driver, which ensures that the GPIO is set appropriately for the high bit of the address, before each access. Didn't I already point you to examples?

Signature · 1 line
dwmw2
#2 lore raw

David,

Yes you did. I did the following:

- I changed the call to simple_map_init(xxx) in physmap.c to my_simple_map_init(xxx)
- I add the bank-switching routines in physmap.c and link them via my_simple_map_init(xxx)

I put an printk in every bank-switching routine. I does work properly in the begining, but then I get the following prints: (I added a printk in every function to check the caling order of things)

cfi_cmdset_001.c: cfi_intelext_point
cfi_cmdset_001.c: do_point_onechip
cfi_cmdset_001.c: get_chip
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000000: 0x890a in stead

I expected that prior to error-report a read or write action to the flash is done. In that case I should have seen an printk saying physmap.c:bank_switching_map_read or physmap.c:bank_switching_map_write.

Servaes

Quoted 18 lines · David Woodhouse
Quoted 9 lines · On Sat, 2007-11-03 at 11:54 +0100, M8 (Servaes Joordens) wrote:

I took a closer look at the bank-switching problem. The situation is:

- I have an 4Mb Flash chip MT28F320J3FS-11
- A0-A19 are connected to the data-bus
- A20 is connected to GPIO PF4

So the hardware probe detects 4MB flash in 1 chip and tries to access
it in a normal manner. How should I solve this? I got a patch from the manufacturer of the hardware for the file cfi_cmdset_0001.c, but I do wonder if that is the correct way to do it?

No, it isn't. The correct way to do it is a fairly trivial 'complex mapping' driver, which ensures that the GPIO is set appropriately for the high bit of the address, before each access. Didn't I already point you to examples?

Signature · 13 lines
Servaes Joordens

-------------------------------------------
M8
Tappersweg 29
2031ET	Haarlem
The Netherlands
Tel:	+31 23 5311122
Mob:	+31 6 51183379
Fax:	+31 23 5322388

VAT-ID: nl-813029090B01
kvk:	34131430 Haarlem
#3 lore raw
Quoted 9 lines · On Sat, 2007-11-03 at 13:07 +0100, M8 (Servaes Joordens) wrote:

cfi_cmdset_001.c: cfi_intelext_point
cfi_cmdset_001.c: do_point_onechip
cfi_cmdset_001.c: get_chip
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000000:0x890a instead

I expected that prior to error-report a read or write action to the flash is done. In that case I should have seen an printk saying physmap.c:bank_switching_map_read or physmap.c:bank_switching_map_write.

Hm, yes. The 'point' method bypasses the normal access functions, on the assumption that the entire device is actually directly mappable.

The sbc_gxx driver to which I referred you sets map->phys = NO_XIP;

Did you?

I don't understand why you're messing with physmap.c when that isn't the one I told you to use as a template.

Signature · 1 line
dwmw2
#4 lore raw
Quoted 16 lines · David Woodhouse
Quoted 10 lines · On Sat, 2007-11-03 at 13:07 +0100, M8 (Servaes Joordens) wrote:

cfi_cmdset_001.c: cfi_intelext_point
cfi_cmdset_001.c: do_point_onechip
cfi_cmdset_001.c: get_chip
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000000:0x890a instead

I expected that prior to error-report a read or write action to the flash is done. In that case I should have seen an printk saying physmap.c:bank_switching_map_read or physmap.c:bank_switching_map_write.

Hm, yes. The 'point' method bypasses the normal access functions, on the assumption that the entire device is actually directly mappable.

Quoted 7 lines

The sbc_gxx driver to which I referred you sets map->phys = NO_XIP;

Did you?

I don't understand why you're messing with physmap.c when that isn't the one I told you to use as a template.

How do I enable my own driver file based on sbc_gxx.c? I cannot find an configuration option in the kernel by menuconfig.

Signature · 13 lines
Servaes Joordens

-------------------------------------------
M8
Tappersweg 29
2031ET	Haarlem
The Netherlands
Tel:	+31 23 5311122
Mob:	+31 6 51183379
Fax:	+31 23 5322388

VAT-ID: nl-813029090B01
kvk:	34131430 Haarlem
#5 lore raw
Quoted 2 lines · On Sat, 2007-11-03 at 13:27 +0100, M8 (Servaes Joordens) wrote:

How do I enable my own driver file based on sbc_gxx.c? I cannot find an configuration option in the kernel by menuconfig.

Copy sbc_gxx.c to create your own driver. Copy the configuration option in drivers/mtd/maps/Kconfig too, renaming it appropriately and giving it appropriate dependencies. Add an appropriate line in drivers/mtd/maps/Makefile, using your new config option and your new filename.

Signature · 1 line
dwmw2
#6 lore raw
Quoted 6 lines · David Woodhouse
Quoted 3 lines · On Sat, 2007-11-03 at 13:27 +0100, M8 (Servaes Joordens) wrote:

How do I enable my own driver file based on sbc_gxx.c? I cannot find an configuration option in the kernel by menuconfig.

Quoted 7 lines

Copy sbc_gxx.c to create your own driver. Copy the configuration option in drivers/mtd/maps/Kconfig too, renaming it appropriately and giving it appropriate dependencies. Add an appropriate line in drivers/mtd/maps/Makefile, using your new config option and your new filename.

Ok, I did it. Can you tell me the meaning of the calls to ioremap and request_region?

I used the following defines:

#define WINDOW_START 0x20000000
#define WINDOW_SHIFT 20

I do not know what to do with:
#define PAGE_IO 258
#define DEVICE_ENABLE 0x8000

Signature · 13 lines
Servaes Joordens

-------------------------------------------
M8
Tappersweg 29
2031ET	Haarlem
The Netherlands
Tel:	+31 23 5311122
Mob:	+31 6 51183379
Fax:	+31 23 5322388

VAT-ID: nl-813029090B01
kvk:	34131430 Haarlem
#7 lore raw
In reply to David Woodhouse
Quoted 6 lines · David Woodhouse
Quoted 3 lines · On Sat, 2007-11-03 at 13:27 +0100, M8 (Servaes Joordens) wrote:

How do I enable my own driver file based on sbc_gxx.c? I cannot find an configuration option in the kernel by menuconfig.

Quoted 7 lines

Copy sbc_gxx.c to create your own driver. Copy the configuration option in drivers/mtd/maps/Kconfig too, renaming it appropriately and giving it appropriate dependencies. Add an appropriate line in drivers/mtd/maps/Makefile, using your new config option and your new filename.

physmap is still active next to my new driver with complex mappings. Is this correct, or should I disable the configuration option for physmap?

Signature · 13 lines
Servaes Joordens

-------------------------------------------
M8
Tappersweg 29
2031ET	Haarlem
The Netherlands
Tel:	+31 23 5311122
Mob:	+31 6 51183379
Fax:	+31 23 5322388

VAT-ID: nl-813029090B01
kvk:	34131430 Haarlem
#8 lore raw
In reply to David Woodhouse
Quoted 6 lines · David Woodhouse
Quoted 3 lines · On Sat, 2007-11-03 at 13:27 +0100, M8 (Servaes Joordens) wrote:

How do I enable my own driver file based on sbc_gxx.c? I cannot find an configuration option in the kernel by menuconfig.

Quoted 7 lines

Copy sbc_gxx.c to create your own driver. Copy the configuration option in drivers/mtd/maps/Kconfig too, renaming it appropriately and giving it appropriate dependencies. Add an appropriate line in drivers/mtd/maps/Makefile, using your new config option and your new filename.

David,

I got everything working now, except for the fact that when I write anything to my jffs2 partition, it fails. The error report states that the disk is full. Do you have any idea's?

In the configuration, I disabled the map_funcs file and replace it with my own version.I had to write some code to distiguish between flash memory and ram. This works fine now.

regards,
Servaes

Signature · 13 lines
Servaes Joordens

-------------------------------------------
M8
Tappersweg 29
2031ET	Haarlem
The Netherlands
Tel:	+31 23 5311122
Mob:	+31 6 51183379
Fax:	+31 23 5322388

VAT-ID: nl-813029090B01
kvk:	34131430 Haarlem
#9 lore raw
Quoted 3 lines · On Sun, 2007-11-04 at 10:30 +0100, M8 (Servaes Joordens) wrote:

I got everything working now, except for the fact that when I write anything to my jffs2 partition, it fails. The error report states that the disk is full. Do you have any idea's?

How big is your JFFS2 partition? How big is the image you put on it to start with? Do writes to the flash work at all from Linux? What _precisely_ is the error yo uget?

Quoted 3 lines

In the configuration, I disabled the map_funcs file and replace it with my own version.I had to write some code to distiguish between flash memory and ram.

This seems a little strange. Can you show your code?

Signature · 1 line
dwmw2