AnsweredAssumed Answered

misbehavior of gpio-addr-flash driver on BF537

Question asked by tstotts on Oct 23, 2012
Latest reply on Oct 26, 2012 by tstotts

I am developing with a BlueTechnix CM-BF537E board without mount option to have 8MiB flash viewable via the first 2MiB of ASYNC memory bank.

 

In boards/cm_bf537e.c I have:

 

#if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
static struct mtd_partition cm_partitions[] = {
     {
          .name   = "cm bootloader(nor)",
          .size   = 0x40000,
          .offset = 0,
     }, {
          .name   = "cm uImage(nor)",
          .size   = MTDPART_SIZ_FULL,
          .offset = MTDPART_OFS_APPEND,
     }
};

static struct physmap_flash_data cm_flash_data = {
     .width    = 2,
     .parts    = cm_partitions,
     .nr_parts = ARRAY_SIZE(cm_partitions),
};


static unsigned cm_flash_gpios[] = { GPIO_PF4, GPIO_PF5 };
//static unsigned cm_flash_gpios[] = { GPIO_PF4 };

static struct resource cm_flash_resource[] = {
     {
          .name  = "cfi_probe",
          .start = 0x20000000,
          .end   = 0x201fffff,
          .flags = IORESOURCE_MEM,
     }, {
          .start = (unsigned long)cm_flash_gpios,
          .end   = ARRAY_SIZE(cm_flash_gpios),
          .flags = IORESOURCE_IRQ,
     }
};

static struct platform_device cm_flash_device = {
     .name          = "gpio-addr-flash",
     .id            = 0,
     .dev = {
          .platform_data = &cm_flash_data,
     },
     .num_resources = ARRAY_SIZE(cm_flash_resource),
     .resource      = cm_flash_resource,
};

#endif

With U-Boot, I am able to read and write to the full 8 MiB of NOR flash by defining GPIO_PF5 as the second GPIO pin for the gpio memory driver. With Linux, if I define 1 GPIO (PF4), I am able to read/write 4 MiB of data sequentially without error. If I define two GPIO (PF4, PF5), read/write returns without error, but data is corrupted. The data I wrote to the flash is not what I read back.

After reading the Linux driver, I think I am using it correctly.

U-Boot is 2010.06.

Linux distribution is 2011R1 RC3

I am using an older U-Boot because the command "flread" was removed from U-Boot in 2011 and it was not possible to read a large NOR flash via a small ASYNC window using GPIO, anymore. In other words, 2010.06 was the last release to support my board (unless this has been addressed).

Outcomes