mtd: vt8500: Add support for Wondermedia Serial Flash Controller
PATCH v2 1/1 mtd: vt8500: Add support for Wondermedia Serial Flash Controller
This patch adds support for the Wondermedia serial flash controller found on WM8505, WM8650 and WM8850 SoCs.
---
v2:
Change Kconfig depends to ARCH_VT8500 as this driver can't be used on other platforms.
drivers/mtd/devices/Kconfig | 7 + drivers/mtd/devices/Makefile | 3 +- drivers/mtd/devices/wmt_sflash.c | 614 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 623 insertions(+), 1 deletion(-) create mode 100644 drivers/mtd/devices/wmt_sflash.c
drivers/mtd/devices/Kconfig +7 -0
@@ -128,6 +128,13 @@ config MTD_BCM47XXSFLASH registered by bcma as platform devices. This enables driver for serial flash memories (only read-only mode is implemented). +config MTD_WMT_SFLASH + tristate "WonderMedia Serial Flash Support" + depends on ARCH_VT8500 + help + Enable this option to provide support for the Wondermedia SoC serial + flash controller. + config MTD_SLRAM tristate "Uncached system RAM" help
drivers/mtd/devices/Makefile +2 -1
@@ -19,6 +19,7 @@ obj-$(CONFIG_MTD_DATAFLASH) += mtd_dataflash.o obj-$(CONFIG_MTD_M25P80) += m25p80.o obj-$(CONFIG_MTD_SPEAR_SMI) += spear_smi.o obj-$(CONFIG_MTD_SST25L) += sst25l.o +obj-$(CONFIG_MTD_WMT_SFLASH) += wmt_sflash.o obj-$(CONFIG_MTD_BCM47XXSFLASH) += bcm47xxsflash.o -CFLAGS_docg3.o += -I$(src) +CFLAGS_docg3.o += -I$(src)
drivers/mtd/devices/wmt_sflash.c new file +614 -0
614 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Quoted 4 lines · Tony Prisk
This patch adds support for the Wondermedia serial flash controller found on WM8505, WM8650 and WM8850 SoCs.
Signed-off-by Tony Prisk <[email protected]>
Would please you also send a defconfig which I can use to compile-test this?
Signature · 9 lines
Best Regards, Artem Bityutskiy -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: This is a digitally signed message part URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130115/d1537fdc/attachment.sig>
Quoted 9 lines · Artem Bityutskiy
Quoted 4 lines · Tony Prisk
This patch adds support for the Wondermedia serial flash controller found on WM8505, WM8650 and WM8850 SoCs.
Signed-off-by Tony Prisk <[email protected]>Would please you also send a defconfig which I can use to compile-test this?
This should be sufficient. I haven't done a defconfig for arch-vt8500 yet as multiplatform-only support has gone through in this window and any previous defconfig would now be useless. This defconfig is based on 3.8-rc3 - some features may not be available in earlier revisions.
CONFIG_EXPERIMENTAL=yCONFIG_NO_HZ=yCONFIG_HIGH_RES_TIMERS=y CONFIG_ARCH_VT8500_SINGLE=y
# CONFIG_ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA is not set CONFIG_ARM_ARCH_TIMER=yCONFIG_AEABI=yCONFIG_HIGHMEM=yCONFIG_HIGHPTE=yCONFIG_ARM_APPENDED_DTB=yCONFIG_VFP=yCONFIG_NEON=yCONFIG_NET=yCONFIG_BLK_DEV_SD=yCONFIG_NETDEVICES=y CONFIG_NET_CALXEDA_XGMAC=yCONFIG_SMSC911X=yCONFIG_STMMAC_ETH=yCONFIG_SERIAL_CORE=y CONFIG_SERIAL_CORE_CONSOLE=y CONFIG_SERIAL_VT8500=y CONFIG_SERIAL_VT8500_CONSOLE=y CONFIG_GPIO_VT8500=yCONFIG_GPIOLIB=yCONFIG_FB=yCONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_FB_VT8500=yCONFIG_FB_WM8505=yCONFIG_RTC_CLASS=yCONFIG_RTC_DRV_VT8500=yCONFIG_USB=yCONFIG_MMC=yCONFIG_PWM=yCONFIG_PWM_VT8500=yCONFIG_MTD=yCONFIG_MTD_WMT_SFLASH=yCONFIG_DMADEVICES=y
Regards
Tony P
Quoted 8 lines · Tony Prisk
This patch adds support for the Wondermedia serial flash controller found on WM8505, WM8650 and WM8850 SoCs.
Signed-off-by Tony Prisk <[email protected]>---
v2:
ChangeKconfigdepends toARCH_VT8500as this driver can't be used on other platforms.
Sparse still complains:
@@ @@+drivers/mtd/devices/wmt_sflash.c:442:24: warning: cast removes address space of expression [sparse] +drivers/mtd/devices/wmt_sflash.c:458:17: warning: incorrect type in argument 1 (different address spaces) [sparse]+drivers/mtd/devices/wmt_sflash.c:458:17: expected void volatile [noderef] <asn:2>*<noident> [sparse]+drivers/mtd/devices/wmt_sflash.c:458:17: got unsigned char [usertype] *<noident> [sparse]+drivers/mtd/devices/wmt_sflash.c:465:25: warning: incorrect type in argument 1 (different address spaces) [sparse]+drivers/mtd/devices/wmt_sflash.c:465:25: expected void volatile [noderef] <asn:2>*<noident> [sparse]+drivers/mtd/devices/wmt_sflash.c:465:25: got unsigned char [usertype] *<noident> [sparse]
Also, checkpatch.pl has a valid complaint:
WARNING:CONFIG_DESCRIPTION: please write a paragraph that describes the config symbol fully #26: FILE: drivers/mtd/devices/Kconfig:131:
+config MTD_WMT_SFLASH
total: 0 errors, 1 warnings, 636 lines checked
...
drivers/mtd/devices/wmt_sflash.c line 122
Quoted 8 lines
drivers/mtd/devices/wmt_sflash.c new file +8
-0+/* WinBond */ +#define WB_W25X40BV 0x3013/* 512 KB */ +#define WB_X16A 0x3015/* 2 MB */ +#define WB_X32 0x3016/* 4 MB */ +#define WB_X64 0x3017/* 8 MB */ + + +#define SF_ID (mfr, mdl) ((mfr << 16) | mdl)
The flash manufacturer IDs are not specific to this driver, and should be defined in a common header.
Quoted 24 lines
drivers/mtd/devices/wmt_sflash.c new file +24
-0+ +#define FLASH_UNKNOWN 0x00ffffff + +struct wmt_flash_id { +u32 id; +u32 size;/* Size in KB */ +}; + +static struct wmt_flash_id flash_ids[] = { + {SF_ID (MFR_SPANSION ,SPAN_FL016A ),2048 }, + {SF_ID (MFR_SPANSION ,SPAN_FL064A ),8192 }, + {SF_ID (MFR_EON ,EON_25P16 ),2048 }, + {SF_ID (MFR_EON ,EON_25P64 ),8192 }, + {SF_ID (MFR_EON ,EON_25F40 ),512 }, + {SF_ID (MFR_EON ,EON_25F16 ),2048 }, + {SF_ID (MFR_ATMEL ,AT_25DF041A ),512 }, + {SF_ID (MFR_NUMONYX ,NX_25P16 ),2048 }, + {SF_ID (MFR_NUMONYX ,NX_25P64 ),8192 }, + {SF_ID (MFR_FUDAN ,FM_25F04 ),512 }, + {SF_ID (MFR_SST ,SST_VF016B ),2048 }, + {SF_ID (MFR_MXIC ,MX_L512 ),64 }, + {SF_ID (MFR_MXIC ,MX_L4005A ),512 }, + {SF_ID (MFR_MXIC ,MX_L1605D ),2048 }, + {SF_ID (MFR_MXIC ,MX_L3205D ),4192 },
drivers/mtd/devices/wmt_sflash.c line 156
Quoted 10 lines
drivers/mtd/devices/wmt_sflash.c new file +10
-0+ { SF_ID(MFR_MXIC, MX_L6405D), 8192 }, + { SF_ID(MFR_MXIC, MX_L1635D), 2048 }, + { SF_ID(MFR_MXIC, MX_L3235D), 4192 }, + { SF_ID(MFR_MXIC, MX_L12805D), 16384 }, + { SF_ID(MFR_WINBOND, WB_W25X40BV), 512 }, + { SF_ID(MFR_WINBOND, WB_X16A), 2048 }, + { SF_ID(MFR_WINBOND, WB_X32), 4096 }, + { SF_ID(MFR_WINBOND, WB_X64), 8192 }, + { 0, 0 }, +};
Probably this should also be outside of the driver, since it is not specific to this driver.
drivers/mtd/devices/wmt_sflash.c line 188
Quoted 10 lines
drivers/mtd/devices/wmt_sflash.c new file +10
-0+static u32 sf_get_chip_size (struct device *dev,u32 id) +{ +int i; +for (i =0 ; flash_ids[i].id !=0 ; i++) +if (flash_ids[i].id == id) +return flash_ids[i].size *1024 ; + +dev_err (dev,"Unknown flash id (%08x)\n" , id); +return 0 ; +}
And this.
Signature · 2 lines
Best Regards, Artem Bityutskiy
Quoted 2 lines · Artem Bityutskiy
Probably this should also be outside of the driver, since it is not specific to this driver.
Take a look at this huge array which constantly gets updated with new chips (see git log):
drivers/mtd/devices/m25p80.c
static const struct spi_device_id m25p_ids[]
I think this should be generalized and shared across the drivers.
Signature · 2 lines
Best Regards, Artem Bityutskiy