Patchwork [V3,2/3] mtd: bcm47xxsflash: store info about flash type

login
register
mail settings
Submitter Rafał Miłecki
Date March 6, 2013, 11:34 a.m.
Message ID <1362569659-14925-1-git-send-email-zajec5@gmail.com>
Download mbox | patch
Permalink /patch/225485/
State New
Headers show

Comments

Rafał Miłecki - March 6, 2013, 11:34 a.m.
It's going to be needed for erase and write operations, they differ
between Atmel and ST flashes.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
V3: rebase after change in 0001
---
 drivers/mtd/devices/bcm47xxsflash.c |    9 +++++++++
 drivers/mtd/devices/bcm47xxsflash.h |    7 +++++++
 2 files changed, 16 insertions(+)

Patch

diff --git a/drivers/mtd/devices/bcm47xxsflash.c b/drivers/mtd/devices/bcm47xxsflash.c
index b22df6d..2f9e629 100644
--- a/drivers/mtd/devices/bcm47xxsflash.c
+++ b/drivers/mtd/devices/bcm47xxsflash.c
@@ -63,6 +63,15 @@  static int bcm47xxsflash_bcma_probe(struct platform_device *pdev)
 
 	b47s->bcma_cc = container_of(sflash, struct bcma_drv_cc, sflash);
 
+	switch (b47s->bcma_cc->capabilities & BCMA_CC_CAP_FLASHT) {
+	case BCMA_CC_FLASHT_STSER:
+		b47s->type = BCM47XXSFLASH_TYPE_ST;
+		break;
+	case BCMA_CC_FLASHT_ATSER:
+		b47s->type = BCM47XXSFLASH_TYPE_ATMEL;
+		break;
+	}
+
 	b47s->window = sflash->window;
 	b47s->blocksize = sflash->blocksize;
 	b47s->numblocks = sflash->numblocks;
diff --git a/drivers/mtd/devices/bcm47xxsflash.h b/drivers/mtd/devices/bcm47xxsflash.h
index e37285e..4498529 100644
--- a/drivers/mtd/devices/bcm47xxsflash.h
+++ b/drivers/mtd/devices/bcm47xxsflash.h
@@ -5,9 +5,16 @@ 
 
 struct bcma_drv_cc;
 
+enum bcm47xxsflash_type {
+	BCM47XXSFLASH_TYPE_ATMEL,
+	BCM47XXSFLASH_TYPE_ST,
+};
+
 struct bcm47xxsflash {
 	struct bcma_drv_cc *bcma_cc;
 
+	enum bcm47xxsflash_type type;
+
 	u32 window;
 	u32 blocksize;
 	u16 numblocks;