lkml.org 
[lkml]   [2014]   [Feb]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 11/35] mtd: st_spi_fsm: Use device size to determine address width
Date
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>
---
drivers/mtd/devices/st_spi_fsm.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c
index 68fa12e..1d7a13a0 100644
--- a/drivers/mtd/devices/st_spi_fsm.c
+++ b/drivers/mtd/devices/st_spi_fsm.c
@@ -670,6 +670,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 > 0xFFFFFF)
+ info->flags |= FLASH_FLAG_32BIT_ADDR;
+
platform_set_drvdata(pdev, fsm);

fsm->mtd.dev.parent = &pdev->dev;
--
1.8.3.2


\
 
 \ /
  Last update: 2014-02-18 17:41    [W:0.221 / U:2.580 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site