public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [RFC 0/3] mtd: bcm47xxnflash: adding support for new NANDs
@ 2014-02-23 11:26 Rafał Miłecki
  2014-02-23 11:26 ` [RFC 1/3] Revert "mtd: bcm47xxnflash: Use module_platform_driver" Rafał Miłecki
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Rafał Miłecki @ 2014-02-23 11:26 UTC (permalink / raw)
  To: linux-mtd; +Cc: Hauke Mehrtens, Rafał Miłecki

New Broadcom SoCs have NAND flashes attached & programmed in a totally different
way. Instead of accessing them with help of ChipCommon core, they can be used
directly.

To support them we can extend bcm47xxnflash in the way this patches implements.
However almost nothing in the code will be shared between support for old and
new devices.

How should we proceed? Implement it that way anyway? Or maybe writing a
separated driver (bcm53xxnflash?) would be a better idea?

Rafał Miłecki (3):
  Revert "mtd: bcm47xxnflash: Use module_platform_driver"
  mtd: bcm47xxnflash: add separated config for platform driver
  mtd: bcm47xxnflash: prepare for adding BCMA driver

 drivers/mtd/nand/Kconfig                | 25 ++++++++---
 drivers/mtd/nand/bcm47xxnflash/Makefile |  2 +-
 drivers/mtd/nand/bcm47xxnflash/main.c   | 80 ++++++++++++++++++++++++++++++++-
 3 files changed, 100 insertions(+), 7 deletions(-)

-- 
1.8.4.5

^ permalink raw reply	[flat|nested] 7+ messages in thread
* [RFC 3/3] mtd: bcm47xxnflash: prepare for adding BCMA driver
@ 2014-02-23 11:34 Rafał Miłecki
  0 siblings, 0 replies; 7+ messages in thread
From: Rafał Miłecki @ 2014-02-23 11:34 UTC (permalink / raw)
  To: linux-mtd; +Cc: Hauke Mehrtens, Rafał Miłecki

---
 drivers/mtd/nand/Kconfig              |  7 +++++
 drivers/mtd/nand/bcm47xxnflash/main.c | 56 +++++++++++++++++++++++++++++++++--
 2 files changed, 60 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index a3e8ad2..fecde1e 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -405,6 +405,13 @@ config MTD_NAND_BCM47XXNFLASH_PLATFORM
 	  most common was BCM4706, but it rarely could be also found on
 	  BCM5357.
 
+config MTD_NAND_BCM47XXNFLASH_BCMA
+	bool "NAND attached to BCMA as standalone core"
+	depends on MTD_NAND_BCM47XXNFLASH && BROKEN
+	help
+	  New SoCs (most probably only these ARM based) have NAND
+	  flash as separated bus core.
+
 config MTD_NAND_PLATFORM
 	tristate "Support for generic platform NAND driver"
 	depends on HAS_IOMEM
diff --git a/drivers/mtd/nand/bcm47xxnflash/main.c b/drivers/mtd/nand/bcm47xxnflash/main.c
index c9d9b3f..aebe2d5 100644
--- a/drivers/mtd/nand/bcm47xxnflash/main.c
+++ b/drivers/mtd/nand/bcm47xxnflash/main.c
@@ -80,6 +80,36 @@ static struct platform_driver bcm47xxnflash_driver = {
 #endif
 
 /**************************************************
+ * BCMA
+ **************************************************/
+
+#if IS_ENABLED(CONFIG_MTD_NAND_BCM47XXNFLASH_BCMA)
+static const struct bcma_device_id bcm47xxnflash_bcma_tbl[] = {
+	BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_NAND, BCMA_ANY_REV, BCMA_ANY_CLASS),
+	BCMA_CORETABLE_END
+};
+MODULE_DEVICE_TABLE(bcma, bcm47xxnflash_bcma_tbl);
+
+static int bcm47xxnflash_bcma_probe(struct bcma_device *core)
+{
+	pr_info("Device ID: 0x%08X\n", bcma_read32(core, 0x194));
+
+	return -ENOTSUPP;
+}
+
+static void bcm47xxnflash_bcma_remove(struct bcma_device *core)
+{
+}
+
+static struct bcma_driver bcm47xxnflash_bcma_driver = {
+	.name		= KBUILD_MODNAME,
+	.id_table	= bcm47xxnflash_bcma_tbl,
+	.probe		= bcm47xxnflash_bcma_probe,
+	.remove		= bcm47xxnflash_bcma_remove,
+};
+#endif
+
+/**************************************************
  * Init & exit
  **************************************************/
 
@@ -89,16 +119,36 @@ static int __init bcm47xxnflash_init(void)
 
 #if IS_ENABLED(CONFIG_MTD_NAND_BCM47XXNFLASH_PLATFORM)
 	err = platform_driver_register(&bcm47xxnflash_driver);
-	if (err)
-		pr_err("Failed to register bcm47xx nand flash driver: %d\n",
-		       err);
+	if (err) {
+		pr_err("Failed to register platform driver: %d\n", err);
+		return err;
+	}
+#endif
+
+#if IS_ENABLED(CONFIG_MTD_NAND_BCM47XXNFLASH_BCMA)
+	err = bcma_driver_register(&bcm47xxnflash_bcma_driver);
+	if (err) {
+		pr_err("Failed to register bcma driver: %d\n", err);
+		goto err_plat_unregister;
+	}
 #endif
 
+	return 0;
+
+#if IS_ENABLED(CONFIG_MTD_NAND_BCM47XXNFLASH_BCMA)
+err_plat_unregister:
+#endif
+#if IS_ENABLED(CONFIG_MTD_NAND_BCM47XXNFLASH_PLATFORM)
+	platform_driver_unregister(&bcm47xxnflash_driver);
+#endif
 	return err;
 }
 
 static void __exit bcm47xxnflash_exit(void)
 {
+#if IS_ENABLED(CONFIG_MTD_NAND_BCM47XXNFLASH_BCMA)
+	bcma_driver_unregister(&bcm47xxnflash_bcma_driver);
+#endif
 #if IS_ENABLED(CONFIG_MTD_NAND_BCM47XXNFLASH_PLATFORM)
 	platform_driver_unregister(&bcm47xxnflash_driver);
 #endif
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-02-26  3:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-23 11:26 [RFC 0/3] mtd: bcm47xxnflash: adding support for new NANDs Rafał Miłecki
2014-02-23 11:26 ` [RFC 1/3] Revert "mtd: bcm47xxnflash: Use module_platform_driver" Rafał Miłecki
2014-02-23 11:26 ` [RFC 2/3] mtd: bcm47xxnflash: add separated config for platform driver Rafał Miłecki
2014-02-23 11:26 ` [RFC 3/3] mtd: bcm47xxnflash: prepare for adding BCMA driver Rafał Miłecki
2014-02-23 11:31 ` [RFC 0/3] mtd: bcm47xxnflash: adding support for new NANDs Hauke Mehrtens
2014-02-26  3:09   ` Brian Norris
  -- strict thread matches above, loose matches on Subject: below --
2014-02-23 11:34 [RFC 3/3] mtd: bcm47xxnflash: prepare for adding BCMA driver 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