* [PATCH] ssb: check for flash presentence
@ 2012-08-08 17:37 Rafał Miłecki
2012-08-10 12:54 ` Hauke Mehrtens
0 siblings, 1 reply; 4+ messages in thread
From: Rafał Miłecki @ 2012-08-08 17:37 UTC (permalink / raw)
To: linux-wireless, John W. Linville; +Cc: Rafał Miłecki, Hauke Mehrtens
We can not assume parallel flash is always present, there are boards
with *serial* flash and probably some without flash at all.
Define some bits by the way.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Cc: Hauke Mehrtens <hauke@hauke-m.de>
---
drivers/ssb/driver_mipscore.c | 28 +++++++++++++++++++++-------
include/linux/ssb/ssb_driver_chipcommon.h | 4 +++-
2 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/drivers/ssb/driver_mipscore.c b/drivers/ssb/driver_mipscore.c
index 7e2ddc0..c625086 100644
--- a/drivers/ssb/driver_mipscore.c
+++ b/drivers/ssb/driver_mipscore.c
@@ -190,16 +190,30 @@ static void ssb_mips_flash_detect(struct ssb_mipscore *mcore)
{
struct ssb_bus *bus = mcore->dev->bus;
- mcore->flash_buswidth = 2;
- if (bus->chipco.dev) {
- mcore->flash_window = 0x1c000000;
- mcore->flash_window_size = 0x02000000;
+ /* When there is no chipcommon on the bus there is 4MB flash */
+ if (!bus->chipco.dev) {
+ mcore->flash_buswidth = 2;
+ mcore->flash_window = SSB_FLASH1;
+ mcore->flash_window_size = SSB_FLASH1_SZ;
+ return;
+ }
+
+ /* There is ChipCommon, so use it to read info about flash */
+ switch (bus->chipco.capabilities & SSB_CHIPCO_CAP_FLASHT) {
+ case SSB_CHIPCO_FLASHT_STSER:
+ case SSB_CHIPCO_FLASHT_ATSER:
+ pr_err("Serial flash not supported\n");
+ break;
+ case SSB_CHIPCO_FLASHT_PARA:
+ pr_debug("Found parallel flash\n");
+ mcore->flash_window = SSB_FLASH2;
+ mcore->flash_window_size = SSB_FLASH2_SZ;
if ((ssb_read32(bus->chipco.dev, SSB_CHIPCO_FLASH_CFG)
& SSB_CHIPCO_CFG_DS16) == 0)
mcore->flash_buswidth = 1;
- } else {
- mcore->flash_window = 0x1fc00000;
- mcore->flash_window_size = 0x00400000;
+ else
+ mcore->flash_buswidth = 2;
+ break;
}
}
diff --git a/include/linux/ssb/ssb_driver_chipcommon.h b/include/linux/ssb/ssb_driver_chipcommon.h
index 1a6b004..c2b02a5 100644
--- a/include/linux/ssb/ssb_driver_chipcommon.h
+++ b/include/linux/ssb/ssb_driver_chipcommon.h
@@ -504,7 +504,9 @@
#define SSB_CHIPCO_FLASHCTL_ST_SE 0x02D8 /* Sector Erase */
#define SSB_CHIPCO_FLASHCTL_ST_BE 0x00C7 /* Bulk Erase */
#define SSB_CHIPCO_FLASHCTL_ST_DP 0x00B9 /* Deep Power-down */
-#define SSB_CHIPCO_FLASHCTL_ST_RSIG 0x03AB /* Read Electronic Signature */
+#define SSB_CHIPCO_FLASHCTL_ST_RES 0x03AB /* Read Electronic Signature */
+#define SSB_CHIPCO_FLASHCTL_ST_CSA 0x1000 /* Keep chip select asserted */
+#define SSB_CHIPCO_FLASHCTL_ST_SSE 0x0220 /* Sub-sector Erase */
/* Status register bits for ST flashes */
#define SSB_CHIPCO_FLASHSTA_ST_WIP 0x01 /* Write In Progress */
--
1.7.7
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ssb: check for flash presentence
2012-08-08 17:37 [PATCH] ssb: check for flash presentence Rafał Miłecki
@ 2012-08-10 12:54 ` Hauke Mehrtens
2012-08-10 13:37 ` Rafał Miłecki
0 siblings, 1 reply; 4+ messages in thread
From: Hauke Mehrtens @ 2012-08-10 12:54 UTC (permalink / raw)
To: Rafał Miłecki; +Cc: linux-wireless, John W. Linville
On 08/08/2012 07:37 PM, Rafał Miłecki wrote:
> We can not assume parallel flash is always present, there are boards
> with *serial* flash and probably some without flash at all.
> Define some bits by the way.
>
> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
> Cc: Hauke Mehrtens <hauke@hauke-m.de>
> ---
> drivers/ssb/driver_mipscore.c | 28 +++++++++++++++++++++-------
> include/linux/ssb/ssb_driver_chipcommon.h | 4 +++-
> 2 files changed, 24 insertions(+), 8 deletions(-)
I haven't tested this patch on my devices, but it looks good to me.
In an additional patch we also need a bool or something like this to
indicate if there is a parallel, serial or no flash present on the SoC.
For serial and parallel flash it is not possible to have both of them.
Reviewed-by: Hauke Mehrtens <hauke@hauke-m.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ssb: check for flash presentence
2012-08-10 12:54 ` Hauke Mehrtens
@ 2012-08-10 13:37 ` Rafał Miłecki
2012-08-10 22:40 ` Hauke Mehrtens
0 siblings, 1 reply; 4+ messages in thread
From: Rafał Miłecki @ 2012-08-10 13:37 UTC (permalink / raw)
To: Hauke Mehrtens; +Cc: linux-wireless, John W. Linville
2012/8/10 Hauke Mehrtens <hauke@hauke-m.de>:
> On 08/08/2012 07:37 PM, Rafał Miłecki wrote:
>> We can not assume parallel flash is always present, there are boards
>> with *serial* flash and probably some without flash at all.
>> Define some bits by the way.
>>
>> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
>> Cc: Hauke Mehrtens <hauke@hauke-m.de>
>> ---
>> drivers/ssb/driver_mipscore.c | 28 +++++++++++++++++++++-------
>> include/linux/ssb/ssb_driver_chipcommon.h | 4 +++-
>> 2 files changed, 24 insertions(+), 8 deletions(-)
>
> I haven't tested this patch on my devices, but it looks good to me.
> In an additional patch we also need a bool or something like this to
> indicate if there is a parallel, serial or no flash present on the SoC.
> For serial and parallel flash it is not possible to have both of them.
Can I ask why? In theory there are 2 different possible mappings
(SSB_FLASH1 and SSB_FLASH2).
--
Rafał
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ssb: check for flash presentence
2012-08-10 13:37 ` Rafał Miłecki
@ 2012-08-10 22:40 ` Hauke Mehrtens
0 siblings, 0 replies; 4+ messages in thread
From: Hauke Mehrtens @ 2012-08-10 22:40 UTC (permalink / raw)
To: Rafał Miłecki; +Cc: linux-wireless, John W. Linville
On 08/10/2012 03:37 PM, Rafał Miłecki wrote:
> 2012/8/10 Hauke Mehrtens <hauke@hauke-m.de>:
>> On 08/08/2012 07:37 PM, Rafał Miłecki wrote:
>>> We can not assume parallel flash is always present, there are boards
>>> with *serial* flash and probably some without flash at all.
>>> Define some bits by the way.
>>>
>>> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
>>> Cc: Hauke Mehrtens <hauke@hauke-m.de>
>>> ---
>>> drivers/ssb/driver_mipscore.c | 28 +++++++++++++++++++++-------
>>> include/linux/ssb/ssb_driver_chipcommon.h | 4 +++-
>>> 2 files changed, 24 insertions(+), 8 deletions(-)
>>
>> I haven't tested this patch on my devices, but it looks good to me.
>> In an additional patch we also need a bool or something like this to
>> indicate if there is a parallel, serial or no flash present on the SoC.
>> For serial and parallel flash it is not possible to have both of them.
>
> Can I ask why? In theory there are 2 different possible mappings
> (SSB_FLASH1 and SSB_FLASH2).
>
Ok, it could be possible, but the configuration bits in the cc core
capabilities currently do not allow such a configuration and I have
never heard of such a device.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-08-10 22:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-08 17:37 [PATCH] ssb: check for flash presentence Rafał Miłecki
2012-08-10 12:54 ` Hauke Mehrtens
2012-08-10 13:37 ` Rafał Miłecki
2012-08-10 22:40 ` Hauke Mehrtens
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).