Patchwork [1/2] mtd: bcm47xxsflash: implement ChipCommon R/W ops

login
register
mail settings
Submitter Rafał Miłecki
Date March 24, 2013, 8:51 p.m.
Message ID <1364158291-22591-1-git-send-email-zajec5@gmail.com>
Download mbox | patch
Permalink /patch/230489/
State Accepted
Commit 265dfbd9ae4388d582dd58e66aff24f4c30831ed
Headers show

Comments

Rafał Miłecki - March 24, 2013, 8:51 p.m.
They are needed for erasing/writing. Use a magic pointers and small
functions to preapre code for adding other buses suppoer in the future
(like SSB).

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
 drivers/mtd/devices/bcm47xxsflash.c |   13 +++++++++++++
 drivers/mtd/devices/bcm47xxsflash.h |    2 ++
 2 files changed, 15 insertions(+)
Rafał Miłecki - April 25, 2013, 5:50 a.m.
2013/3/24 Rafał Miłecki <zajec5@gmail.com>:
> They are needed for erasing/writing. Use a magic pointers and small
> functions to preapre code for adding other buses suppoer in the future
> (like SSB).

David: is there a chance for picking up that 2 patches for 3.10?
Artem Bityutskiy - May 10, 2013, 11:48 a.m.
On Sun, 2013-03-24 at 21:51 +0100, Rafał Miłecki wrote:
> They are needed for erasing/writing. Use a magic pointers and small
> functions to preapre code for adding other buses suppoer in the future
> (like SSB).
> 
> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

Pushed to l2-mtd.git, thanks!

Patch

diff --git a/drivers/mtd/devices/bcm47xxsflash.c b/drivers/mtd/devices/bcm47xxsflash.c
index 18e7761..d1f0dec 100644
--- a/drivers/mtd/devices/bcm47xxsflash.c
+++ b/drivers/mtd/devices/bcm47xxsflash.c
@@ -48,6 +48,17 @@  static void bcm47xxsflash_fill_mtd(struct bcm47xxsflash *b47s)
  * BCMA
  **************************************************/
 
+static int bcm47xxsflash_bcma_cc_read(struct bcm47xxsflash *b47s, u16 offset)
+{
+	return bcma_cc_read32(b47s->bcma_cc, offset);
+}
+
+static void bcm47xxsflash_bcma_cc_write(struct bcm47xxsflash *b47s, u16 offset,
+					u32 value)
+{
+	bcma_cc_write32(b47s->bcma_cc, offset, value);
+}
+
 static int bcm47xxsflash_bcma_probe(struct platform_device *pdev)
 {
 	struct bcma_sflash *sflash = dev_get_platdata(&pdev->dev);
@@ -62,6 +73,8 @@  static int bcm47xxsflash_bcma_probe(struct platform_device *pdev)
 	sflash->priv = b47s;
 
 	b47s->bcma_cc = container_of(sflash, struct bcma_drv_cc, sflash);
+	b47s->cc_read = bcm47xxsflash_bcma_cc_read;
+	b47s->cc_write = bcm47xxsflash_bcma_cc_write;
 
 	switch (b47s->bcma_cc->capabilities & BCMA_CC_CAP_FLASHT) {
 	case BCMA_CC_FLASHT_STSER:
diff --git a/drivers/mtd/devices/bcm47xxsflash.h b/drivers/mtd/devices/bcm47xxsflash.h
index f22f8c4..fe93daf 100644
--- a/drivers/mtd/devices/bcm47xxsflash.h
+++ b/drivers/mtd/devices/bcm47xxsflash.h
@@ -60,6 +60,8 @@  enum bcm47xxsflash_type {
 
 struct bcm47xxsflash {
 	struct bcma_drv_cc *bcma_cc;
+	int (*cc_read)(struct bcm47xxsflash *b47s, u16 offset);
+	void (*cc_write)(struct bcm47xxsflash *b47s, u16 offset, u32 value);
 
 	enum bcm47xxsflash_type type;