ssb: add struct for serial flash
PATCH 1/1 ssb: add struct for serial flash
This data allow writing for example MTD driver.
--- drivers/ssb/driver_chipcommon_sflash.c | 7 +++++++ include/linux/ssb/ssb_driver_mips.h | 15 +++++++++++++++ 2 files changed, 22 insertions(+)
drivers/ssb/driver_chipcommon_sflash.c +7 -0
@@ -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);
include/linux/ssb/ssb_driver_mips.h +15 -0
@@ -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);
Signature · 1 line
1.7.10.4
Hello Rafal,
Quoted 1 line · Rafał Miłecki
This data allow writing for example MTD driver.
Your commit message could probably have some more information, by looking at the patch, it is not entirely clear to me what this does, especially as sflash is just a write only structure?
Quoted 65 lines
Signed-off-by Rafał Miłecki <[email protected]>--- drivers/ssb/driver_chipcommon_sflash.c | 7 +++++++ include/linux/ssb/ssb_driver_mips.h | 15 +++++++++++++++ 2 files changed, 22 insertions(+)(quoted diff) +0
-0
b/drivers/ssb/driver_chipcommon_sflash.cindex 1b9e770..205f1c4 100644drivers/ssb/driver_chipcommon_sflash.c +0
-0@@ -73,6 +73,7 @@ static void ssb_sflash_cmd(struct ssb_chipcommon *cc, u32opcode) /* Initialize serial flash access */
intssb_sflash_init(struct ssb_chipcommon *cc)
{drivers/ssb/driver_chipcommon_sflash.c +7
-0+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);(quoted diff) +0
-0
b/include/linux/ssb/ssb_driver_mips.hindex afe79d4..6535e47 100644include/linux/ssb/ssb_driver_mips.h +15
-0@@ -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);
Signature · 1 line
Florian
2013/6/17 Florian Fainelli <[email protected]>:
Quoted 8 lines
Hello Rafal,
Quoted 1 line · Rafał Miłecki
This data allow writing for example MTD driver.
Your commit message could probably have some more information, by looking at the patch, it is not entirely clear to me what this does, especially as sflash is just a write only structure?
OK, no problem. I'll give people w little more time for comments, and then I'll submit next version.
Signature · 1 line
Rafał
2013/6/17 Rafał Miłecki <[email protected]>:
Quoted 4 lines
2013/6/17 Florian Fainelli <[email protected]>:
Quoted 3 lines
Hello Rafal,
Le lundi 17 juin 2013 18:56:20, Rafał Miłecki a écrit :
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
This data allow writing for example MTD driver.
Your commit message could probably have some more information, by looking at the patch, it is not entirely clear to me what this does, especially as sflash is just a write only structure?
OK, no problem. I'll give people w little more time for comments, and then I'll submit next version.
It's already in wireless-next, so I'll explain this just in an e-mail. There is not much more to explain anyway ;)
Signature · 1 line
Rafał
2013/6/17 Rafał Miłecki <[email protected]>:
Quoted 1 line
This data allow writing for example MTD driver.
To make this a bit more clear:
Up until now, we were detecting flash model in driver_chipcommon_sflash.c, but nothing more than that. It was printed and that's all. Noone could read it's details or/and use it.
As providing an access to the flash is usually a good idea, we need an additional MTD driver for it. Such MTD driver needs some basic info about flash. It's mapping address and size at least.
With this patch we put all important data in struct ssb_sflash. It can be accessed in two possible ways:
1) With the: bus->mipscore.sflash path. How to get a reference to the "bus"? It's an static exported symbols on some archs (bcm47xx).
2) Directly, it "sflash" is registered as a platform driver data. My next patch will address that.
Signature · 1 line
Rafał
2013/6/17 Rafał Miłecki <[email protected]>:
Quoted 5 lines
2013/6/17 Rafał Miłecki <[email protected]>:
Quoted 1 line
This data allow writing for example MTD driver.
To make this a bit more clear:
Quoted 7 lines
Up until now, we were detecting flash model in
driver_chipcommon_sflash.c, but nothing more than that. It was printed and that's all. Noone could read it's details or/and use it.As providing an access to the flash is usually a good idea, we need an additional MTD driver for it. Such MTD driver needs some basic info about flash. It's mapping address and size at least.
As an example you can see drivers/mtd/devices/bcm47xxsflash.c which a driver for "bcma_sflash" platform device.
Signature · 1 line
Rafał
Quoted 9 lines · Rafał Miłecki
2013/6/17 Rafał Miłecki <[email protected]>:
Quoted 1 line
This data allow writing for example MTD driver.
To make this a bit more clear:
Up until now, we were detecting flash model in
driver_chipcommon_sflash.c, but nothing more than that. It was printed and that's all. Noone could read it's details or/and use it.
Quoted 9 lines
As providing an access to the flash is usually a good idea, we need an additional MTD driver for it. Such MTD driver needs some basic info about flash. It's mapping address and size at least.
With this patch we put all important data in structssb_sflash. It can be accessed in two possible ways:
1) With the:bus->mipscore.sflashpath. How to get a reference to the "bus"? It's an static exported symbols on some archs (bcm47xx).
2) Directly, it "sflash" is registered as a platform driver data. My next patch will address that.
Ok, well this was probably worth a cover letter just for this, and the second patch to be posted too ;) Thanks for the explanation
Signature · 1 line
Florian