* [PATCH] ssb: add struct for serial flash
@ 2013-06-17 17:56 Rafał Miłecki
2013-06-17 19:38 ` Florian Fainelli
2013-06-17 20:38 ` Rafał Miłecki
0 siblings, 2 replies; 7+ messages in thread
From: Rafał Miłecki @ 2013-06-17 17:56 UTC (permalink / raw)
To: linux-wireless, John W. Linville; +Cc: Hauke Mehrtens, Rafał Miłecki
This data allow writing for example MTD driver.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
drivers/ssb/driver_chipcommon_sflash.c | 7 +++++++
include/linux/ssb/ssb_driver_mips.h | 15 +++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/drivers/ssb/driver_chipcommon_sflash.c b/drivers/ssb/driver_chipcommon_sflash.c
index 1b9e770..205f1c4 100644
--- a/drivers/ssb/driver_chipcommon_sflash.c
+++ b/drivers/ssb/driver_chipcommon_sflash.c
@@ -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);
diff --git a/include/linux/ssb/ssb_driver_mips.h b/include/linux/ssb/ssb_driver_mips.h
index afe79d4..6535e47 100644
--- a/include/linux/ssb/ssb_driver_mips.h
+++ b/include/linux/ssb/ssb_driver_mips.h
@@ -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);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] ssb: add struct for serial flash
2013-06-17 17:56 [PATCH] ssb: add struct for serial flash Rafał Miłecki
@ 2013-06-17 19:38 ` Florian Fainelli
2013-06-17 19:46 ` Rafał Miłecki
2013-06-17 20:38 ` Rafał Miłecki
1 sibling, 1 reply; 7+ messages in thread
From: Florian Fainelli @ 2013-06-17 19:38 UTC (permalink / raw)
To: Rafał Miłecki; +Cc: linux-wireless, John W. Linville, Hauke Mehrtens
Hello Rafal,
Le lundi 17 juin 2013 18:56:20, Rafał Miłecki a écrit :
> 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?
>
> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
> ---
> drivers/ssb/driver_chipcommon_sflash.c | 7 +++++++
> include/linux/ssb/ssb_driver_mips.h | 15 +++++++++++++++
> 2 files changed, 22 insertions(+)
>
> diff --git a/drivers/ssb/driver_chipcommon_sflash.c
> b/drivers/ssb/driver_chipcommon_sflash.c index 1b9e770..205f1c4 100644
> --- a/drivers/ssb/driver_chipcommon_sflash.c
> +++ b/drivers/ssb/driver_chipcommon_sflash.c
> @@ -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);
>
> diff --git a/include/linux/ssb/ssb_driver_mips.h
> b/include/linux/ssb/ssb_driver_mips.h index afe79d4..6535e47 100644
> --- a/include/linux/ssb/ssb_driver_mips.h
> +++ b/include/linux/ssb/ssb_driver_mips.h
> @@ -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);
--
Florian
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ssb: add struct for serial flash
2013-06-17 19:38 ` Florian Fainelli
@ 2013-06-17 19:46 ` Rafał Miłecki
2013-06-17 20:33 ` Rafał Miłecki
0 siblings, 1 reply; 7+ messages in thread
From: Rafał Miłecki @ 2013-06-17 19:46 UTC (permalink / raw)
To: Florian Fainelli; +Cc: linux-wireless, John W. Linville, Hauke Mehrtens
2013/6/17 Florian Fainelli <florian@openwrt.org>:
> Hello Rafal,
>
> Le lundi 17 juin 2013 18:56:20, Rafał Miłecki a écrit :
>> 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.
--
Rafał
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ssb: add struct for serial flash
2013-06-17 19:46 ` Rafał Miłecki
@ 2013-06-17 20:33 ` Rafał Miłecki
0 siblings, 0 replies; 7+ messages in thread
From: Rafał Miłecki @ 2013-06-17 20:33 UTC (permalink / raw)
To: Florian Fainelli; +Cc: linux-wireless, John W. Linville, Hauke Mehrtens
2013/6/17 Rafał Miłecki <zajec5@gmail.com>:
> 2013/6/17 Florian Fainelli <florian@openwrt.org>:
>> Hello Rafal,
>>
>> Le lundi 17 juin 2013 18:56:20, Rafał Miłecki a écrit :
>>> 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 ;)
--
Rafał
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ssb: add struct for serial flash
2013-06-17 17:56 [PATCH] ssb: add struct for serial flash Rafał Miłecki
2013-06-17 19:38 ` Florian Fainelli
@ 2013-06-17 20:38 ` Rafał Miłecki
2013-06-17 20:40 ` Rafał Miłecki
2013-06-17 21:09 ` Florian Fainelli
1 sibling, 2 replies; 7+ messages in thread
From: Rafał Miłecki @ 2013-06-17 20:38 UTC (permalink / raw)
To: linux-wireless, John W. Linville; +Cc: Hauke Mehrtens, Rafał Miłecki
2013/6/17 Rafał Miłecki <zajec5@gmail.com>:
> 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.
--
Rafał
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ssb: add struct for serial flash
2013-06-17 20:38 ` Rafał Miłecki
@ 2013-06-17 20:40 ` Rafał Miłecki
2013-06-17 21:09 ` Florian Fainelli
1 sibling, 0 replies; 7+ messages in thread
From: Rafał Miłecki @ 2013-06-17 20:40 UTC (permalink / raw)
To: linux-wireless, John W. Linville; +Cc: Hauke Mehrtens, Rafał Miłecki
2013/6/17 Rafał Miłecki <zajec5@gmail.com>:
> 2013/6/17 Rafał Miłecki <zajec5@gmail.com>:
>> 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.
As an example you can see drivers/mtd/devices/bcm47xxsflash.c which a
driver for "bcma_sflash" platform device.
--
Rafał
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ssb: add struct for serial flash
2013-06-17 20:38 ` Rafał Miłecki
2013-06-17 20:40 ` Rafał Miłecki
@ 2013-06-17 21:09 ` Florian Fainelli
1 sibling, 0 replies; 7+ messages in thread
From: Florian Fainelli @ 2013-06-17 21:09 UTC (permalink / raw)
To: Rafał Miłecki; +Cc: linux-wireless, John W. Linville, Hauke Mehrtens
Le lundi 17 juin 2013 21:38:42, Rafał Miłecki a écrit :
> 2013/6/17 Rafał Miłecki <zajec5@gmail.com>:
> > 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.
Ok, well this was probably worth a cover letter just for this, and the second
patch to be posted too ;) Thanks for the explanation
--
Florian
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-06-17 21:09 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-17 17:56 [PATCH] ssb: add struct for serial flash Rafał Miłecki
2013-06-17 19:38 ` Florian Fainelli
2013-06-17 19:46 ` Rafał Miłecki
2013-06-17 20:33 ` Rafał Miłecki
2013-06-17 20:38 ` Rafał Miłecki
2013-06-17 20:40 ` Rafał Miłecki
2013-06-17 21:09 ` Florian Fainelli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).