aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/devices/st_spi_fsm.c
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2014-03-20 09:20:43 +0000
committerBrian Norris <computersforpeace@gmail.com>2014-03-20 04:17:16 -0700
commit3b5d1981933b25973b02684dccb17d4282fd4d6d (patch)
treebf05d43445067666b3647f7ee04efc0430425c41 /drivers/mtd/devices/st_spi_fsm.c
parentmtd: st_spi_fsm: Search for preferred FSM message sequence configurations (diff)
downloadlinux-dev-3b5d1981933b25973b02684dccb17d4282fd4d6d.tar.xz
linux-dev-3b5d1981933b25973b02684dccb17d4282fd4d6d.zip
mtd: st_spi_fsm: Use device size to determine address width
Take some known parameters, namely size and number of sectors and use them to determine weather a device can support 32bit addressing or not. If it can, set the associated flash capability flag for latter use. Acked-by Angus Clark <angus.clark@st.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd/devices/st_spi_fsm.c')
-rw-r--r--drivers/mtd/devices/st_spi_fsm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c
index 2740ae195ef5..5a1b470ce908 100644
--- a/drivers/mtd/devices/st_spi_fsm.c
+++ b/drivers/mtd/devices/st_spi_fsm.c
@@ -671,6 +671,10 @@ static int stfsm_probe(struct platform_device *pdev)
return -ENODEV;
fsm->info = info;
+ /* Use device size to determine address width */
+ if (info->sector_size * info->n_sectors > 0x1000000)
+ info->flags |= FLASH_FLAG_32BIT_ADDR;
+
fsm->mtd.dev.parent = &pdev->dev;
fsm->mtd.type = MTD_NORFLASH;
fsm->mtd.writesize = 4;