ssb: add struct for serial flash
authorRafał Miłecki <zajec5@gmail.com>
Mon, 17 Jun 2013 17:56:20 +0000 (19:56 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 17 Jun 2013 18:38:54 +0000 (14:38 -0400)
This data allow writing for example MTD driver.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/ssb/driver_chipcommon_sflash.c
include/linux/ssb/ssb_driver_mips.h

index 1b9e770f5328e1342ceb27b206d9ac2e51861613..205f1c499c463840b7feac961128bd72e2582aae 100644 (file)
@@ -73,6 +73,7 @@ static void ssb_sflash_cmd(struct ssb_chipcommon *cc, u32 opcode)
 /* Initialize serial flash access */
 int ssb_sflash_init(struct ssb_chipcommon *cc)
 {
+       struct ssb_sflash *sflash = &cc->dev->bus->mipscore.sflash;
        const struct ssb_sflash_tbl_e *e;
        u32 id, id2;
 
@@ -131,6 +132,12 @@ int ssb_sflash_init(struct ssb_chipcommon *cc)
                return -ENOTSUPP;
        }
 
+       sflash->window = SSB_FLASH2;
+       sflash->blocksize = e->blocksize;
+       sflash->numblocks = e->numblocks;
+       sflash->size = sflash->blocksize * sflash->numblocks;
+       sflash->present = true;
+
        pr_info("Found %s serial flash (blocksize: 0x%X, blocks: %d)\n",
                e->name, e->blocksize, e->numblocks);
 
index afe79d40a99eaf36dd4eea67c5a0234a40eff683..6535e4718fdebeee689a1d214da4ca39f060f437 100644 (file)
@@ -20,6 +20,18 @@ struct ssb_pflash {
        u32 window_size;
 };
 
+#ifdef CONFIG_SSB_SFLASH
+struct ssb_sflash {
+       bool present;
+       u32 window;
+       u32 blocksize;
+       u16 numblocks;
+       u32 size;
+
+       void *priv;
+};
+#endif
+
 struct ssb_mipscore {
        struct ssb_device *dev;
 
@@ -27,6 +39,9 @@ struct ssb_mipscore {
        struct ssb_serial_port serial_ports[4];
 
        struct ssb_pflash pflash;
+#ifdef CONFIG_SSB_SFLASH
+       struct ssb_sflash sflash;
+#endif
 };
 
 extern void ssb_mipscore_init(struct ssb_mipscore *mcore);