Skip to contentSkip to conversation

Smartmedia/xD support

PATCH New Maxim Levitsky 1 participant 3 messages Jan 22, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Smartmedia/xD support

Hello,

This is final patch series that depends on two former series and consist of two patches.

First adds a driver for my xD card reader. Patch is almost unchanged from previous submission.
I fixed few problems with suspend/resume. Device just works now.

Second patch, is a new SmartMedia/xD FTL support.
This version reverts many things I did in last version. Driver again doesn't use mtd badblock handling.
Due to all kinds of problems I deciced it will be better to do it here.

I added support for 256 byte nand devices, thus now the FTL covers everything. This is tested with nandsim.

I added lots of error checking. Driver is now very carefull and not erase happy as it was. I decided that repairing the card should be done by fsck like utility and not the driver.

Driver does some checks for device fails, by rereading the CIS.

Everything works now, and I think ready for use.

Best regards,
Maxim Levitsky

#1 lore raw

PATCH 1/2 MTD: Add nand driver for ricoh xD/SmartMedia reader

Quoted 1 line

From 2c1feaad8347819ed2dcc47c28e25c9c0ff57a3e Mon Sep 17 00:00:00 2001

From: Maxim Levitsky <[email protected]>
Date: Fri, 22 Jan 2010 16:42:09 +0200
Subject: [PATCH 1/2] MTD: Add nand driver for ricoh xD/SmartMedia reader

This adds a driver for Ricoh xD card reader with PCI id 0x0852

Since the reader is a part of larger mulifunction chip, it is hard to determine the correct model name. Might be R5C852.

Driver is complete, but bewere of the fact that some (probably only type M) xD cards are 'fake' which means that they have an on board CPU and expose emulated nand command set

These cards don't even store the oob area on the flash, but generate it on the fly from something else.

Thus they demand to have proper values written in the oob area, and therefore only useful with SmartMedia FTL.

---
 MAINTAINERS               |    6 +
 drivers/mtd/nand/Kconfig  |   11 +
 drivers/mtd/nand/Makefile |    1 +
 drivers/mtd/nand/r822.c   | 1086 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/mtd/nand/r822.h   |  152 +++++++
 include/linux/pci_ids.h   |    2 +
 6 files changed, 1258 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/nand/r822.c
 create mode 100644 drivers/mtd/nand/r822.h
MAINTAINERS +6 -0
index 8f0109b..81c451b 100644
@@ -4585,6 +4585,12 @@ S:	Maintained
 F:	Documentation/rfkill.txt
 F:	net/rfkill/
 
+RICOH SMARTMEDIA/XD DRIVER
+M:	Maxim Levitsky <[email protected]>
+S:	Maintained
+F:	drivers/mtd/nand/r822.c
+F:	drivers/mtd/nand/r822.h
+
 RISCOM8 DRIVER
 S:	Orphan
 F:	Documentation/serial/riscom8.txt
drivers/mtd/nand/Kconfig +11 -0
index 13c1fb2..20803fa 100644
@@ -113,6 +113,17 @@ config MTD_NAND_TS7250
 config MTD_NAND_IDS
 	tristate
 
+config MTD_NAND_RICOH
+	tristate "Ricoh xD card reader"
+	default n
+	select MTD_SM_COMMON
+	help
+	  Enable support for Ricoh xD card reader
+	  You also need to enable ether
+	  NAND SSFDC (SmartMedia) read only translation layer' or new
+	  expermental, readwrite
+	  'SmartMedia/xD new translation layer'
+
 config MTD_NAND_AU1550
 	tristate "Au1550/1200 NAND support"
 	depends on SOC_AU1200 || SOC_AU1550
drivers/mtd/nand/Makefile +1 -0
index 09891f6..dc7c0bb 100644
@@ -43,5 +43,6 @@ obj-$(CONFIG_MTD_NAND_TXX9NDFMC)	+= txx9ndfmc.o
 obj-$(CONFIG_MTD_NAND_W90P910)		+= w90p910_nand.o
 obj-$(CONFIG_MTD_NAND_NOMADIK)		+= nomadik_nand.o
 obj-$(CONFIG_MTD_NAND_BCM_UMI)		+= bcm_umi_nand.o nand_bcm_umi.o
+obj-$(CONFIG_MTD_NAND_RICOH)		+= r822.o
 
 nand-objs := nand_base.o nand_bbt.o
drivers/mtd/nand/r822.c new file +1086 -0

1,086 lines not on this page · raw message

drivers/mtd/nand/r822.h new file +152 -0

152 lines not on this page · raw message

include/linux/pci_ids.h +2 -0
index cca8a04..cef49f2 100644
@@ -1523,6 +1523,8 @@
 #define PCI_DEVICE_ID_RICOH_R5C822	0x0822
 #define PCI_DEVICE_ID_RICOH_R5C832	0x0832
 #define PCI_DEVICE_ID_RICOH_R5C843	0x0843
+#define PCI_DEVICE_ID_RICOH_R5C852	0x0852
+
 
 #define PCI_VENDOR_ID_DLINK		0x1186
 #define PCI_DEVICE_ID_DLINK_DGE510T	0x4c00
Signature · 1 line
1.6.3.3
#2 lore raw

PATCH 2/2 MTD: Add new SmartMedia/xD FTL

In reply to Maxim Levitsky
Quoted 1 line

From 07a6c30621ed3dfe84034a75f928bd8ddfd11a64 Mon Sep 17 00:00:00 2001

From: Maxim Levitsky <[email protected]>
Date: Fri, 22 Jan 2010 16:42:12 +0200
Subject: [PATCH 2/2] MTD: Add new SmartMedia/xD FTL

This implements new readwrite SmartMedia/xd FTL.

mtd driver must have support proper ECC
based on oob parts for 512 bytes nand.

Also mtd driver must define read_oob and write_oob, which are used to read and write both data and oob together.

---
 drivers/mtd/Kconfig  |   20 +
 drivers/mtd/Makefile |    1 +
 drivers/mtd/sm_ftl.c | 1181 ++++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/mtd/sm_ftl.h |   92 ++++
 4 files changed, 1294 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/sm_ftl.c
 create mode 100644 drivers/mtd/sm_ftl.h
drivers/mtd/Kconfig +20 -0
index ecf90f5..ec6c376 100644
@@ -304,6 +304,26 @@ config SSFDC
 	  This enables read only access to SmartMedia formatted NAND
 	  flash. You can mount it with FAT file system.
 
+
+config SM_FTL
+	tristate "SmartMedia/xD new translation layer"
+	depends on EXPERIMENTAL
+	help
+	  This enables new and very EXPERMENTAL support for SmartMedia/xD
+	  FTL (Flash tanslation layer)
+	  Write support isn't yet well tested, therefore this code IS likely to
+	  eat your card, so please don't use it together with valuable data.
+	  Use readonly driver (CONFIG_SSFDC) instead.
+
+config SM_FTL_MUSEUM
+	boolean "Additional Support for 1MB and 2MB SmartMedia cards"
+	depends on SM_FTL && MTD_NAND
+	select MTD_NAND_ECC_SMC
+	help
+	  Very old SmartMedia cards need ECC to be caluculated in the FTL
+	  Such cards are very rare, thus enabling this option is mostly useless
+	  Also this support is completely UNTESTED.
+
 config MTD_OOPS
 	tristate "Log panic/oops to an MTD buffer"
 	depends on MTD
drivers/mtd/Makefile +1 -0
index 82d1e4d..d53357b 100644
@@ -24,6 +24,7 @@ obj-$(CONFIG_NFTL)		+= nftl.o
 obj-$(CONFIG_INFTL)		+= inftl.o
 obj-$(CONFIG_RFD_FTL)		+= rfd_ftl.o
 obj-$(CONFIG_SSFDC)		+= ssfdc.o
+obj-$(CONFIG_SM_FTL)		+= sm_ftl.o
 obj-$(CONFIG_MTD_OOPS)		+= mtdoops.o
 
 nftl-objs		:= nftlcore.o nftlmount.o
drivers/mtd/sm_ftl.c new file +1181 -0

1,181 lines not on this page · raw message

drivers/mtd/sm_ftl.h new file +92 -0

92 lines not on this page · raw message

Signature · 1 line
1.6.3.3