• Sudhakar Rajashekhara's avatar
    Implement memory accessor interface in the MTD layer which enables the · fdfaf855
    Sudhakar Rajashekhara authored
    kernel to access flash data.
    
    This patch adds two new members to the mtd_partition structure, a function
    handler which will be called during setup of the partition and an argument
    to be passed to this setup function.
    
    Example:
    +static struct mtd_partition spi_flash_partitions[] = {
    +       [0] = {
    +               .name       = "U-Boot",
    +               .offset     = 0,
    +               .size       = SZ_256K,
    +               .mask_flags = MTD_WRITEABLE,
    +       },
    +       [1] = {
    +               .name       = "U-Boot Environment",
    +               .offset     = MTDPART_OFS_NXTBLK,
    +               .size       = SZ_64K,
    +               .mask_flags = MTD_WRITEABLE,
    +       },
    +       [2] = {
    +               .name       = "Linux",
    +               .offset     = MTDPART_OFS_NXTBLK,
    +               .size       = SZ_7M,
    +               .mask_flags = 0,
    +       },
    +       [3] = {
    +               .name       = "MAC Address",
    +               .offset     = MTDPART_OFS_NXTBLK,
    +               .size       = SZ_64K,
    +               .mask_flags = 0,
    +               .setup      = davinci_get_mac_addr,
    +               .context    = (void *)0,
    +       },
    +};
    
    The davinci_get_mac_addr function reads the MAC address from
    offset ZERO of last MTD partition.
    Signed-off-by: default avatarSudhakar Rajashekhara <sudhakar.raj@ti.com>
    Cc: David Brownell <david-b@pacbell.net>
    Cc: David Woodhouse <dwmw2@infradead.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    fdfaf855
mtdpart.c 17 KB