* [PATCH 1/3] mtd: bcm47xxsflash: store info about flash type
@ 2013-02-20 6:32 Rafał Miłecki
2013-02-20 6:32 ` [PATCH 2/3] mtd: bcm47xxsflash: keep a reference to the BCMA ChipCommon Rafał Miłecki
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Rafał Miłecki @ 2013-02-20 6:32 UTC (permalink / raw)
To: linux-mtd, Artem Bityutskiy, David Woodhouse
Cc: Hauke Mehrtens, Rafał Miłecki
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>
---
drivers/mtd/devices/bcm47xxsflash.c | 9 +++++++++
drivers/mtd/devices/bcm47xxsflash.h | 7 +++++++
2 files changed, 16 insertions(+)
diff --git a/drivers/mtd/devices/bcm47xxsflash.c b/drivers/mtd/devices/bcm47xxsflash.c
index 9526628..155a7ea 100644
--- a/drivers/mtd/devices/bcm47xxsflash.c
+++ b/drivers/mtd/devices/bcm47xxsflash.c
@@ -61,6 +61,15 @@ static int bcm47xxsflash_bcma_probe(struct platform_device *pdev)
}
sflash->priv = b47s;
+ 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 ebf6f71..7d5654b 100644
--- a/drivers/mtd/devices/bcm47xxsflash.h
+++ b/drivers/mtd/devices/bcm47xxsflash.h
@@ -3,7 +3,14 @@
#include <linux/mtd/mtd.h>
+enum bcm47xxsflash_type {
+ BCM47XXSFLASH_TYPE_ATMEL,
+ BCM47XXSFLASH_TYPE_ST,
+};
+
struct bcm47xxsflash {
+ enum bcm47xxsflash_type type;
+
u32 window;
u32 blocksize;
u16 numblocks;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] mtd: bcm47xxsflash: keep a reference to the BCMA ChipCommon
2013-02-20 6:32 [PATCH 1/3] mtd: bcm47xxsflash: store info about flash type Rafał Miłecki
@ 2013-02-20 6:32 ` Rafał Miłecki
2013-02-20 6:32 ` [PATCH 3/3] mtd: bcm47xxsflash: define opcodes Rafał Miłecki
2013-03-06 9:23 ` [PATCH 1/3] mtd: bcm47xxsflash: store info about flash type Artem Bityutskiy
2 siblings, 0 replies; 5+ messages in thread
From: Rafał Miłecki @ 2013-02-20 6:32 UTC (permalink / raw)
To: linux-mtd, Artem Bityutskiy, David Woodhouse
Cc: Hauke Mehrtens, Rafał Miłecki
To implement erase and write support we need to "talk" with ChipCommon
BCMA core which serial flash it attached to.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
drivers/mtd/devices/bcm47xxsflash.c | 2 ++
drivers/mtd/devices/bcm47xxsflash.h | 6 ++++++
2 files changed, 8 insertions(+)
diff --git a/drivers/mtd/devices/bcm47xxsflash.c b/drivers/mtd/devices/bcm47xxsflash.c
index 155a7ea..e04e2c5 100644
--- a/drivers/mtd/devices/bcm47xxsflash.c
+++ b/drivers/mtd/devices/bcm47xxsflash.c
@@ -70,6 +70,8 @@ static int bcm47xxsflash_bcma_probe(struct platform_device *pdev)
break;
}
+ b47s->bcma_cc = container_of(sflash, struct bcma_drv_cc, sflash);
+
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 7d5654b..1574ea8 100644
--- a/drivers/mtd/devices/bcm47xxsflash.h
+++ b/drivers/mtd/devices/bcm47xxsflash.h
@@ -3,12 +3,18 @@
#include <linux/mtd/mtd.h>
+struct bcma_drv_cc;
+
enum bcm47xxsflash_type {
BCM47XXSFLASH_TYPE_ATMEL,
BCM47XXSFLASH_TYPE_ST,
};
struct bcm47xxsflash {
+ union {
+ struct bcma_drv_cc *bcma_cc;
+ };
+
enum bcm47xxsflash_type type;
u32 window;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] mtd: bcm47xxsflash: define opcodes
2013-02-20 6:32 [PATCH 1/3] mtd: bcm47xxsflash: store info about flash type Rafał Miłecki
2013-02-20 6:32 ` [PATCH 2/3] mtd: bcm47xxsflash: keep a reference to the BCMA ChipCommon Rafał Miłecki
@ 2013-02-20 6:32 ` Rafał Miłecki
2013-03-06 9:23 ` [PATCH 1/3] mtd: bcm47xxsflash: store info about flash type Artem Bityutskiy
2 siblings, 0 replies; 5+ messages in thread
From: Rafał Miłecki @ 2013-02-20 6:32 UTC (permalink / raw)
To: linux-mtd, Artem Bityutskiy, David Woodhouse
Cc: Hauke Mehrtens, Rafał Miłecki
We need them to add erase/write support. This may duplicate some defines
with bcma and/or ssb code, but it makes more sense to keep that in
bcm47xxsflash which is supposed to work with both buses.
Duplicated defines will be removed from ssb/bcma.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
drivers/mtd/devices/bcm47xxsflash.h | 48 +++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/drivers/mtd/devices/bcm47xxsflash.h b/drivers/mtd/devices/bcm47xxsflash.h
index 1574ea8..3faffcc 100644
--- a/drivers/mtd/devices/bcm47xxsflash.h
+++ b/drivers/mtd/devices/bcm47xxsflash.h
@@ -3,6 +3,54 @@
#include <linux/mtd/mtd.h>
+/* Used for ST flashes only. */
+#define OPCODE_ST_WREN 0x0006 /* Write Enable */
+#define OPCODE_ST_WRDIS 0x0004 /* Write Disable */
+#define OPCODE_ST_RDSR 0x0105 /* Read Status Register */
+#define OPCODE_ST_WRSR 0x0101 /* Write Status Register */
+#define OPCODE_ST_READ 0x0303 /* Read Data Bytes */
+#define OPCODE_ST_PP 0x0302 /* Page Program */
+#define OPCODE_ST_SE 0x02d8 /* Sector Erase */
+#define OPCODE_ST_BE 0x00c7 /* Bulk Erase */
+#define OPCODE_ST_DP 0x00b9 /* Deep Power-down */
+#define OPCODE_ST_RES 0x03ab /* Read Electronic Signature */
+#define OPCODE_ST_CSA 0x1000 /* Keep chip select asserted */
+#define OPCODE_ST_SSE 0x0220 /* Sub-sector Erase */
+
+/* Used for Atmel flashes only. */
+#define OPCODE_AT_READ 0x07e8
+#define OPCODE_AT_PAGE_READ 0x07d2
+#define OPCODE_AT_STATUS 0x01d7
+#define OPCODE_AT_BUF1_WRITE 0x0384
+#define OPCODE_AT_BUF2_WRITE 0x0387
+#define OPCODE_AT_BUF1_ERASE_PROGRAM 0x0283
+#define OPCODE_AT_BUF2_ERASE_PROGRAM 0x0286
+#define OPCODE_AT_BUF1_PROGRAM 0x0288
+#define OPCODE_AT_BUF2_PROGRAM 0x0289
+#define OPCODE_AT_PAGE_ERASE 0x0281
+#define OPCODE_AT_BLOCK_ERASE 0x0250
+#define OPCODE_AT_BUF1_WRITE_ERASE_PROGRAM 0x0382
+#define OPCODE_AT_BUF2_WRITE_ERASE_PROGRAM 0x0385
+#define OPCODE_AT_BUF1_LOAD 0x0253
+#define OPCODE_AT_BUF2_LOAD 0x0255
+#define OPCODE_AT_BUF1_COMPARE 0x0260
+#define OPCODE_AT_BUF2_COMPARE 0x0261
+#define OPCODE_AT_BUF1_REPROGRAM 0x0258
+#define OPCODE_AT_BUF2_REPROGRAM 0x0259
+
+/* Status register bits for ST flashes */
+#define SR_ST_WIP 0x01 /* Write In Progress */
+#define SR_ST_WEL 0x02 /* Write Enable Latch */
+#define SR_ST_BP_MASK 0x1c /* Block Protect */
+#define SR_ST_BP_SHIFT 2
+#define SR_ST_SRWD 0x80 /* Status Register Write Disable */
+
+/* Status register bits for Atmel flashes */
+#define SR_AT_READY 0x80
+#define SR_AT_MISMATCH 0x40
+#define SR_AT_ID_MASK 0x38
+#define SR_AT_ID_SHIFT 3
+
struct bcma_drv_cc;
enum bcm47xxsflash_type {
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] mtd: bcm47xxsflash: store info about flash type
2013-02-20 6:32 [PATCH 1/3] mtd: bcm47xxsflash: store info about flash type Rafał Miłecki
2013-02-20 6:32 ` [PATCH 2/3] mtd: bcm47xxsflash: keep a reference to the BCMA ChipCommon Rafał Miłecki
2013-02-20 6:32 ` [PATCH 3/3] mtd: bcm47xxsflash: define opcodes Rafał Miłecki
@ 2013-03-06 9:23 ` Artem Bityutskiy
2013-03-06 10:39 ` Rafał Miłecki
2 siblings, 1 reply; 5+ messages in thread
From: Artem Bityutskiy @ 2013-03-06 9:23 UTC (permalink / raw)
To: Rafał Miłecki; +Cc: Hauke Mehrtens, linux-mtd, David Woodhouse
On Wed, 2013-02-20 at 07:32 +0100, Rafał Miłecki wrote:
> 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>
Aiaiai!
--------------------------------------------------------------------------------
Bisectability test results for configuration "mips-bcm47xx_defconfig,mips,mips-linux-"
Failed to build the following commit for configuration "mips-bcm47xx_defconfig"":
ab61426 mtd: bcm47xxsflash: store info about flash type
drivers/mtd/devices/bcm47xxsflash.c: In function 'bcm47xxsflash_bcma_probe':
drivers/mtd/devices/bcm47xxsflash.c:64:14: error: 'struct bcm47xxsflash' has no member named 'bcma_cc'
make[4]: *** [drivers/mtd/devices/bcm47xxsflash.o] Error 1
--------------------------------------------------------------------------------
--
Best Regards,
Artem Bityutskiy
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] mtd: bcm47xxsflash: store info about flash type
2013-03-06 9:23 ` [PATCH 1/3] mtd: bcm47xxsflash: store info about flash type Artem Bityutskiy
@ 2013-03-06 10:39 ` Rafał Miłecki
0 siblings, 0 replies; 5+ messages in thread
From: Rafał Miłecki @ 2013-03-06 10:39 UTC (permalink / raw)
To: dedekind1; +Cc: Hauke Mehrtens, linux-mtd, David Woodhouse
2013/3/6 Artem Bityutskiy <dedekind1@gmail.com>:
> On Wed, 2013-02-20 at 07:32 +0100, Rafał Miłecki wrote:
>> 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>
>
> Aiaiai!
>
> --------------------------------------------------------------------------------
>
> Bisectability test results for configuration "mips-bcm47xx_defconfig,mips,mips-linux-"
>
> Failed to build the following commit for configuration "mips-bcm47xx_defconfig"":
>
> ab61426 mtd: bcm47xxsflash: store info about flash type
>
>
> drivers/mtd/devices/bcm47xxsflash.c: In function 'bcm47xxsflash_bcma_probe':
> drivers/mtd/devices/bcm47xxsflash.c:64:14: error: 'struct bcm47xxsflash' has no member named 'bcma_cc'
> make[4]: *** [drivers/mtd/devices/bcm47xxsflash.o] Error 1
For some unknown reason it seems I haven't noticed anything above
> Successfully built configuration "mips-bcm47xx_defconfig,mips,mips-linux-", no issues
:/ Sorry
--
Rafał
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-03-06 10:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-20 6:32 [PATCH 1/3] mtd: bcm47xxsflash: store info about flash type Rafał Miłecki
2013-02-20 6:32 ` [PATCH 2/3] mtd: bcm47xxsflash: keep a reference to the BCMA ChipCommon Rafał Miłecki
2013-02-20 6:32 ` [PATCH 3/3] mtd: bcm47xxsflash: define opcodes Rafał Miłecki
2013-03-06 9:23 ` [PATCH 1/3] mtd: bcm47xxsflash: store info about flash type Artem Bityutskiy
2013-03-06 10:39 ` Rafał Miłecki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox