Skip to contentSkip to conversation

mtd/gpmi : add gpmi support for mx6q

PATCH Superseded Huang Shijie 6 participants 15 messages Feb 6, 2012 – Feb 16, 2012

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd/gpmi : add gpmi support for mx6q

add gpmi support to mx6q.

---
 drivers/mtd/nand/gpmi-nand/bch-regs.h  |   42 ++++++++++++++++++++++++-------
 drivers/mtd/nand/gpmi-nand/gpmi-lib.c  |   14 ++++++----
 drivers/mtd/nand/gpmi-nand/gpmi-nand.c |    3 ++
 drivers/mtd/nand/gpmi-nand/gpmi-nand.h |    2 +
 4 files changed, 45 insertions(+), 16 deletions(-)
drivers/mtd/nand/gpmi-nand/bch-regs.h +32 -10
index 4effb8c..a092451 100644
@@ -51,15 +51,26 @@
 
 #define BP_BCH_FLASH0LAYOUT0_ECC0		12
 #define BM_BCH_FLASH0LAYOUT0_ECC0	(0xf << BP_BCH_FLASH0LAYOUT0_ECC0)
-#define BF_BCH_FLASH0LAYOUT0_ECC0(v)		\
-	(((v) << BP_BCH_FLASH0LAYOUT0_ECC0) & BM_BCH_FLASH0LAYOUT0_ECC0)
+#define MX6Q_BP_BCH_FLASH0LAYOUT0_ECC0		11
+#define MX6Q_BM_BCH_FLASH0LAYOUT0_ECC0	(0x1f << MX6Q_BP_BCH_FLASH0LAYOUT0_ECC0)
+#define BF_BCH_FLASH0LAYOUT0_ECC0(v, x)				\
+	(GPMI_IS_MX6Q(x)					\
+		? (((v) << MX6Q_BP_BCH_FLASH0LAYOUT0_ECC0)	\
+			& MX6Q_BM_BCH_FLASH0LAYOUT0_ECC0)	\
+		: (((v) << BP_BCH_FLASH0LAYOUT0_ECC0)		\
+			& BM_BCH_FLASH0LAYOUT0_ECC0)		\
+	)
 
 #define BP_BCH_FLASH0LAYOUT0_DATA0_SIZE		0
 #define BM_BCH_FLASH0LAYOUT0_DATA0_SIZE		\
 			(0xfff << BP_BCH_FLASH0LAYOUT0_DATA0_SIZE)
-#define BF_BCH_FLASH0LAYOUT0_DATA0_SIZE(v)	\
-	(((v) << BP_BCH_FLASH0LAYOUT0_DATA0_SIZE)\
-					 & BM_BCH_FLASH0LAYOUT0_DATA0_SIZE)
+#define MX6Q_BM_BCH_FLASH0LAYOUT0_DATA0_SIZE	\
+			(0x3ff << BP_BCH_FLASH0LAYOUT0_DATA0_SIZE)
+#define BF_BCH_FLASH0LAYOUT0_DATA0_SIZE(v, x)				\
+	(GPMI_IS_MX6Q(x)						\
+		? (((v) >> 2) & MX6Q_BM_BCH_FLASH0LAYOUT0_DATA0_SIZE)	\
+		: ((v) & BM_BCH_FLASH0LAYOUT0_DATA0_SIZE)		\
+	)
 
 #define HW_BCH_FLASH0LAYOUT1			0x00000090
 
@@ -72,13 +83,24 @@
 
 #define BP_BCH_FLASH0LAYOUT1_ECCN		12
 #define BM_BCH_FLASH0LAYOUT1_ECCN	(0xf << BP_BCH_FLASH0LAYOUT1_ECCN)
-#define BF_BCH_FLASH0LAYOUT1_ECCN(v)		\
-	(((v) << BP_BCH_FLASH0LAYOUT1_ECCN) & BM_BCH_FLASH0LAYOUT1_ECCN)
+#define MX6Q_BP_BCH_FLASH0LAYOUT1_ECCN		11
+#define MX6Q_BM_BCH_FLASH0LAYOUT1_ECCN	(0x1f << MX6Q_BP_BCH_FLASH0LAYOUT1_ECCN)
+#define BF_BCH_FLASH0LAYOUT1_ECCN(v, x)				\
+	(GPMI_IS_MX6Q(x)					\
+		? (((v) << MX6Q_BP_BCH_FLASH0LAYOUT1_ECCN)	\
+			& MX6Q_BM_BCH_FLASH0LAYOUT1_ECCN)	\
+		: (((v) << BP_BCH_FLASH0LAYOUT1_ECCN)		\
+			& BM_BCH_FLASH0LAYOUT1_ECCN)		\
+	)
 
 #define BP_BCH_FLASH0LAYOUT1_DATAN_SIZE		0
 #define BM_BCH_FLASH0LAYOUT1_DATAN_SIZE		\
 			(0xfff << BP_BCH_FLASH0LAYOUT1_DATAN_SIZE)
-#define BF_BCH_FLASH0LAYOUT1_DATAN_SIZE(v)	\
-	(((v) << BP_BCH_FLASH0LAYOUT1_DATAN_SIZE) \
-					 & BM_BCH_FLASH0LAYOUT1_DATAN_SIZE)
+#define MX6Q_BM_BCH_FLASH0LAYOUT1_DATAN_SIZE	\
+			(0x3ff << BP_BCH_FLASH0LAYOUT1_DATAN_SIZE)
+#define BF_BCH_FLASH0LAYOUT1_DATAN_SIZE(v, x)				\
+	(GPMI_IS_MX6Q(x)						\
+		? (((v) >> 2) & MX6Q_BM_BCH_FLASH0LAYOUT1_DATAN_SIZE)	\
+		: ((v) & BM_BCH_FLASH0LAYOUT1_DATAN_SIZE)		\
+	)
 #endif
drivers/mtd/nand/gpmi-nand/gpmi-lib.c +8 -6
index 28f8df0..fd39350 100644
@@ -223,13 +223,13 @@ int bch_set_geometry(struct gpmi_nand_data *this)
 	/* Configure layout 0. */
 	writel(BF_BCH_FLASH0LAYOUT0_NBLOCKS(block_count)
 			| BF_BCH_FLASH0LAYOUT0_META_SIZE(metadata_size)
-			| BF_BCH_FLASH0LAYOUT0_ECC0(ecc_strength)
-			| BF_BCH_FLASH0LAYOUT0_DATA0_SIZE(block_size),
+			| BF_BCH_FLASH0LAYOUT0_ECC0(ecc_strength, this)
+			| BF_BCH_FLASH0LAYOUT0_DATA0_SIZE(block_size, this),
 			r->bch_regs + HW_BCH_FLASH0LAYOUT0);
 
 	writel(BF_BCH_FLASH0LAYOUT1_PAGE_SIZE(page_size)
-			| BF_BCH_FLASH0LAYOUT1_ECCN(ecc_strength)
-			| BF_BCH_FLASH0LAYOUT1_DATAN_SIZE(block_size),
+			| BF_BCH_FLASH0LAYOUT1_ECCN(ecc_strength, this)
+			| BF_BCH_FLASH0LAYOUT1_DATAN_SIZE(block_size, this),
 			r->bch_regs + HW_BCH_FLASH0LAYOUT1);
 
 	/* Set *all* chip selects to use layout 0. */
@@ -803,7 +803,8 @@ int gpmi_is_ready(struct gpmi_nand_data *this, unsigned chip)
 	if (GPMI_IS_MX23(this)) {
 		mask = MX23_BM_GPMI_DEBUG_READY0 << chip;
 		reg = readl(r->gpmi_regs + HW_GPMI_DEBUG);
-	} else if (GPMI_IS_MX28(this)) {
+	} else if (GPMI_IS_MX28(this) || GPMI_IS_MX6Q(this)) {
+		/* MX28 shares the same R/B register as MX6Q. */
 		mask = MX28_BF_GPMI_STAT_READY_BUSY(1 << chip);
 		reg = readl(r->gpmi_regs + HW_GPMI_STAT);
 	} else
@@ -1066,8 +1067,9 @@ int gpmi_read_page(struct gpmi_nand_data *this,
 		| BF_GPMI_CTRL0_ADDRESS(address)
 		| BF_GPMI_CTRL0_XFER_COUNT(geo->page_size);
 	pio[1] = 0;
+	pio[2] = 0; /* set GPMI_HW_GPMI_ECCCTRL, disable the BCH. */
 	desc = channel->device->device_prep_slave_sg(channel,
-				(struct scatterlist *)pio, 2,
+				(struct scatterlist *)pio, 3,
 				DMA_TRANS_NONE,
 				DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	if (!desc) {
drivers/mtd/nand/gpmi-nand/gpmi-nand.c +3 -0
index 493ec2f..90545e2 100644
@@ -1582,6 +1582,9 @@ static const struct platform_device_id gpmi_ids[] = {
 	}, {
 		.name = "imx28-gpmi-nand",
 		.driver_data = IS_MX28,
+	}, {
+		.name = "imx6q-gpmi-nand",
+		.driver_data = IS_MX6Q,
 	}, {},
 };
 
drivers/mtd/nand/gpmi-nand/gpmi-nand.h +2 -0
index 1c7fdbb..a302dd1 100644
@@ -268,6 +268,8 @@ extern int gpmi_read_page(struct gpmi_nand_data *,
 /* Use the platform_id to distinguish different Archs. */
 #define IS_MX23			0x1
 #define IS_MX28			0x2
+#define IS_MX6Q			0x8
 #define GPMI_IS_MX23(x)		((x)->pdev->id_entry->driver_data == IS_MX23)
 #define GPMI_IS_MX28(x)		((x)->pdev->id_entry->driver_data == IS_MX28)
+#define GPMI_IS_MX6Q(x)		((x)->pdev->id_entry->driver_data == IS_MX6Q)
 #endif
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 1/1 mtd/gpmi : add gpmi support for mx6q

Quoted 3 lines · Huang Shijie

add gpmi support to mx6q.

Please, let me know how I can compile-test this. This diver depends on imx23 or imx28 and I cannot find a defconfig for these. When I select MXS platform the compilation fails. Could you please describe some way to generate a compilable configuration which would include this driver as well, or send me the defconfig file.

Signature · 20 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/20120213/864fef04/attachment.sig>
-------------- next part --------------
---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki 
Business Identity Code: 0357606 - 4 
Domiciled in Helsinki 

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#2 lore raw

PATCH 1/1 mtd/gpmi : add gpmi support for mx6q

Quoted 5 lines

Please, let me know how I can compile-test this. This diver depends on imx23 or imx28 and I cannot find a defconfig for these. When I select MXS platform the compilation fails. Could you please describe some way to generate a compilable configuration which would include this driver as well, or send me the defconfig file.

I can't tell about MX6, but the defconfig for mx23/28 is called mxs_defconfig.

Signature · 9 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120213/c1a93c32/attachment.sig>
#3 lore raw

PATCH 1/1 mtd/gpmi : add gpmi support for mx6q

Quoted 2 lines · Wolfram Sang

I can't tell about MX6, but the defconfig for mx23/28 is called mxs_defconfig.

For mx6 the defconfig is imx_v6_v7_defconfig.

#4 lore raw
In reply to Bityutskiy, Artem

Hi Artem:

Quoted 5 lines

Please, let me know how I can compile-test this. This diver depends on imx23 or imx28 and I cannot find a defconfig for these. When I select MXS platform the compilation fails. Could you please describe some way to generate a compilable configuration which would include this driver as well, or send me the defconfig file.

use make mxs_defconfig to make the .config.
and select the gpmi-nand driver. then you can compile it.

This patch is just part of the patches for mx6q, another two patches are the mxs-dma patches. So in the mx6q, I do not enable the gpmi-nand driver. you can compile-test it just on mxs_defconfig.

BR
Huang Shijie

#5 lore raw
Quoted 8 lines · On Mon, 2012-02-13 at 15:05 +0000, Huang Shijie-B32955 wrote:

Hi Artem:

Quoted 5 lines

Please, let me know how I can compile-test this. This diver depends on imx23 or imx28 and I cannot find a defconfig for these. When I select MXS platform the compilation fails. Could you please describe some way to generate a compilable configuration which would include this driver as well, or send me the defconfig file.

Quoted 5 lines

use make mxs_defconfig to make the .config.
and select the gpmi-nand driver. then you can compile it.

This patch is just part of the patches for mx6q, another two patches are the mxs-dma patches. So in the mx6q, I do not enable the gpmi-nand driver. you can compile-test it just on mxs_defconfig.

Thanks. When I select MTD stuff I get the following Kbuild complaint:

scripts/kconfig/conf --savedefconfig=defconfig Kconfig
warning: (MTD_NAND_GPMI_NAND) selects MTD_CMDLINE_PARTS which has unmet direct dependencies (MTD=y)

Would mxs people send a fix?

Signature · 20 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/20120213/8efe94ba/attachment.sig>
-------------- next part --------------
---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki 
Business Identity Code: 0357606 - 4 
Domiciled in Helsinki 

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#6 lore raw

Hi,

Quoted 4 lines

scripts/kconfig/conf --savedefconfig=defconfig Kconfig
warning: (MTD_NAND_GPMI_NAND) selects MTD_CMDLINE_PARTS which has unmet direct dependencies (MTD=y)

Would mxs people send a fix?

Do you mean i have to remove the "select MTD_CMD_LINE_PARTS" for gpmi-nand?

BR
Huang Shijie

#7 lore raw
Quoted 8 lines · On Mon, 2012-02-13 at 15:48 +0000, Huang Shijie-B32955 wrote:

Hi,

Quoted 4 lines

scripts/kconfig/conf --savedefconfig=defconfig Kconfig
warning: (MTD_NAND_GPMI_NAND) selects MTD_CMDLINE_PARTS which has unmet direct dependencies (MTD=y)

Would mxs people send a fix?

Do you mean i have to remove the "select MTD_CMD_LINE_PARTS" for gpmi-nand?

Not sure, think of something :-) I've attached the defconfig I used. Probably something to do with the fact that I enabled everything as a module. If you are unable to analyze, let me know and I'll try to look closer.

Signature · 216 lines
Best Regards,
Artem Bityutskiy
-------------- next part --------------
CONFIG_EXPERIMENTAL=y
CONFIG_SYSVIPC=y
CONFIG_TASKSTATS=y
CONFIG_TASK_DELAY_ACCT=y
CONFIG_TASK_XACCT=y
CONFIG_TASK_IO_ACCOUNTING=y
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
# CONFIG_UTS_NS is not set
# CONFIG_IPC_NS is not set
# CONFIG_USER_NS is not set
# CONFIG_PID_NS is not set
# CONFIG_NET_NS is not set
CONFIG_PERF_EVENTS=y
# CONFIG_COMPAT_BRK is not set
CONFIG_MODULES=y
CONFIG_MODULE_FORCE_LOAD=y
CONFIG_MODULE_UNLOAD=y
CONFIG_MODULE_FORCE_UNLOAD=y
CONFIG_MODVERSIONS=y
CONFIG_BLK_DEV_INTEGRITY=y
# CONFIG_IOSCHED_DEADLINE is not set
# CONFIG_IOSCHED_CFQ is not set
CONFIG_ARCH_MXS=y
CONFIG_MACH_STMP378X_DEVB=y
CONFIG_MACH_MX23EVK=y
CONFIG_MACH_MX28EVK=y
CONFIG_MACH_TX28=y
CONFIG_MACH_M28EVK=y
# CONFIG_ARM_THUMB is not set
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_PREEMPT_VOLUNTARY=y
CONFIG_AEABI=y
CONFIG_DEFAULT_MMAP_MIN_ADDR=65536
CONFIG_AUTO_ZRELADDR=y
CONFIG_FPE_NWFPE=y
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_INET=y
CONFIG_IP_PNP=y
CONFIG_IP_PNP_DHCP=y
CONFIG_SYN_COOKIES=y
# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
# CONFIG_INET_XFRM_MODE_TUNNEL is not set
# CONFIG_INET_XFRM_MODE_BEET is not set
# CONFIG_INET_LRO is not set
# CONFIG_INET_DIAG is not set
# CONFIG_IPV6 is not set
CONFIG_CAN=m
CONFIG_CAN_RAW=m
CONFIG_CAN_BCM=m
CONFIG_CAN_FLEXCAN=m
# CONFIG_WIRELESS is not set
CONFIG_DEVTMPFS=y
# CONFIG_FIRMWARE_IN_KERNEL is not set
CONFIG_MTD=m
CONFIG_MTD_TESTS=m
CONFIG_MTD_REDBOOT_PARTS=m
CONFIG_MTD_AFS_PARTS=m
CONFIG_MTD_AR7_PARTS=m
CONFIG_MTD_CHAR=m
CONFIG_MTD_BLOCK=m
CONFIG_MTD_BLOCK_RO=m
CONFIG_FTL=m
CONFIG_NFTL=m
CONFIG_INFTL=m
CONFIG_RFD_FTL=m
CONFIG_SSFDC=m
CONFIG_SM_FTL=m
CONFIG_MTD_OOPS=m
CONFIG_MTD_SWAP=m
CONFIG_MTD_CFI=m
CONFIG_MTD_JEDECPROBE=m
CONFIG_MTD_CFI_ADV_OPTIONS=y
CONFIG_MTD_CFI_GEOMETRY=y
CONFIG_MTD_CFI_I8=y
CONFIG_MTD_OTP=y
CONFIG_MTD_CFI_INTELEXT=m
CONFIG_MTD_CFI_AMDSTD=m
CONFIG_MTD_CFI_STAA=m
CONFIG_MTD_ROM=m
CONFIG_MTD_ABSENT=m
CONFIG_MTD_COMPLEX_MAPPINGS=y
CONFIG_MTD_PHYSMAP=m
CONFIG_MTD_PHYSMAP_COMPAT=y
CONFIG_MTD_GPIO_ADDR=m
CONFIG_MTD_PLATRAM=m
CONFIG_MTD_LATCH_ADDR=m
CONFIG_MTD_DATAFLASH=m
CONFIG_MTD_DATAFLASH_OTP=y
CONFIG_MTD_M25P80=m
CONFIG_MTD_SST25L=m
CONFIG_MTD_SLRAM=m
CONFIG_MTD_PHRAM=m
CONFIG_MTD_MTDRAM=m
CONFIG_MTD_BLOCK2MTD=m
CONFIG_MTD_DOC2000=m
CONFIG_MTD_DOC2001=m
CONFIG_MTD_DOC2001PLUS=m
CONFIG_MTD_DOCG3=m
CONFIG_MTD_DOCPROBE_ADVANCED=y
CONFIG_MTD_DOCPROBE_HIGH=y
CONFIG_MTD_DOCPROBE_55AA=y
CONFIG_MTD_NAND_ECC_SMC=y
CONFIG_MTD_NAND=m
CONFIG_MTD_NAND_VERIFY_WRITE=y
CONFIG_MTD_NAND_ECC_BCH=y
CONFIG_MTD_NAND_MUSEUM_IDS=y
CONFIG_MTD_NAND_GPIO=m
CONFIG_MTD_NAND_DISKONCHIP=m
CONFIG_MTD_NAND_DISKONCHIP_BBTWRITE=y
CONFIG_MTD_NAND_DOCG4=m
CONFIG_MTD_NAND_NANDSIM=m
CONFIG_MTD_NAND_GPMI_NAND=y
CONFIG_MTD_NAND_PLATFORM=m
CONFIG_MTD_ONENAND=m
CONFIG_MTD_ONENAND_VERIFY_WRITE=y
CONFIG_MTD_ONENAND_GENERIC=m
CONFIG_MTD_ONENAND_OTP=y
CONFIG_MTD_ONENAND_2X_PROGRAM=y
CONFIG_MTD_ONENAND_SIM=m
CONFIG_MTD_LPDDR=m
CONFIG_MTD_UBI=m
CONFIG_MTD_UBI_GLUEBI=m
CONFIG_MTD_UBI_DEBUG=y
# CONFIG_BLK_DEV is not set
CONFIG_NETDEVICES=y
CONFIG_ENC28J60=y
# CONFIG_WLAN is not set
# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
CONFIG_INPUT_EVDEV=m
# CONFIG_INPUT_KEYBOARD is not set
# CONFIG_INPUT_MOUSE is not set
CONFIG_INPUT_TOUCHSCREEN=y
CONFIG_TOUCHSCREEN_TSC2007=m
# CONFIG_SERIO is not set
CONFIG_VT_HW_CONSOLE_BINDING=y
CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
# CONFIG_LEGACY_PTYS is not set
# CONFIG_DEVKMEM is not set
CONFIG_SERIAL_AMBA_PL011=y
CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
# CONFIG_HW_RANDOM is not set
CONFIG_I2C=m
# CONFIG_I2C_COMPAT is not set
CONFIG_I2C_CHARDEV=m
CONFIG_I2C_MXS=m
CONFIG_SPI=y
CONFIG_SPI_GPIO=m
CONFIG_DEBUG_GPIO=y
CONFIG_GPIO_SYSFS=y
# CONFIG_HWMON is not set
# CONFIG_HID_SUPPORT is not set
# CONFIG_USB_SUPPORT is not set
CONFIG_MMC=y
CONFIG_MMC_MXS=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_DS1307=m
CONFIG_DMADEVICES=y
CONFIG_MXS_DMA=y
CONFIG_EXT3_FS=y
# CONFIG_DNOTIFY is not set
CONFIG_FSCACHE=m
CONFIG_FSCACHE_STATS=y
CONFIG_CACHEFILES=m
CONFIG_TMPFS=y
CONFIG_TMPFS_POSIX_ACL=y
CONFIG_JFFS2_FS=m
CONFIG_JFFS2_FS_WBUF_VERIFY=y
CONFIG_JFFS2_SUMMARY=y
CONFIG_JFFS2_COMPRESSION_OPTIONS=y
# CONFIG_JFFS2_RTIME is not set
CONFIG_JFFS2_CMODE_NONE=y
CONFIG_UBIFS_FS=m
CONFIG_UBIFS_FS_XATTR=y
CONFIG_UBIFS_FS_ADVANCED_COMPR=y
# CONFIG_UBIFS_FS_LZO is not set
# CONFIG_UBIFS_FS_ZLIB is not set
CONFIG_UBIFS_FS_DEBUG=y
CONFIG_LOGFS=m
CONFIG_NFS_FS=y
CONFIG_NFS_V3=y
CONFIG_NFS_V3_ACL=y
CONFIG_NFS_V4=y
CONFIG_ROOT_NFS=y
CONFIG_PRINTK_TIME=y
CONFIG_FRAME_WARN=2048
CONFIG_MAGIC_SYSRQ=y
CONFIG_UNUSED_SYMBOLS=y
CONFIG_DEBUG_KERNEL=y
CONFIG_LOCKUP_DETECTOR=y
CONFIG_TIMER_STATS=y
CONFIG_PROVE_LOCKING=y
CONFIG_DEBUG_INFO=y
CONFIG_SYSCTL_SYSCALL_CHECK=y
CONFIG_BLK_DEV_IO_TRACE=y
CONFIG_STRICT_DEVMEM=y
CONFIG_DEBUG_USER=y
CONFIG_CRYPTO=y
CONFIG_CRYPTO_CRC32C=m
# CONFIG_CRYPTO_ANSI_CPRNG is not set
# CONFIG_CRYPTO_HW is not set
CONFIG_CRC_ITU_T=m
CONFIG_CRC7=m
-------------- 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/20120213/8eb99ce3/attachment.sig>
#8 lore raw
In reply to Huang Shijie-B32955
Quoted 8 lines · On Mon, 2012-02-13 at 15:05 +0000, Huang Shijie-B32955 wrote:

Hi Artem:

Quoted 5 lines

Please, let me know how I can compile-test this. This diver depends on imx23 or imx28 and I cannot find a defconfig for these. When I select MXS platform the compilation fails. Could you please describe some way to generate a compilable configuration which would include this driver as well, or send me the defconfig file.

Quoted 5 lines

use make mxs_defconfig to make the .config.
and select the gpmi-nand driver. then you can compile it.

This patch is just part of the patches for mx6q, another two patches are the mxs-dma patches. So in the mx6q, I do not enable the gpmi-nand driver. you can compile-test it just on mxs_defconfig.

I cannot apply this to l2-mtd.git tree anyway:

$:~/git/l2-mtd$ git am ~/tmp/gpmi.mbox
Applying: mtd/gpmi : add gpmi support for mx6q
error: patch failed: drivers/mtd/nand/gpmi-nand/gpmi-lib.c:1066
error: drivers/mtd/nand/gpmi-nand/gpmi-lib.c: patch does not apply
Patch failed at 0001 mtd/gpmi : add gpmi support for mx6q
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".
$:~/git/l2-mtd$ patch -p1 < .git/rebase-apply/patch 
patching file drivers/mtd/nand/gpmi-nand/bch-regs.h
patching file drivers/mtd/nand/gpmi-nand/gpmi-lib.c
Hunk #3 FAILED@1067.
1 out of 3 hunks FAILED -- saving rejects to file drivers/mtd/nand/gpmi-nand/gpmi-lib.c.rej
patching file drivers/mtd/nand/gpmi-nand/gpmi-nand.c
patching file drivers/mtd/nand/gpmi-nand/gpmi-nand.h
Signature · 20 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/20120213/893c4050/attachment.sig>
-------------- next part --------------
---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki 
Business Identity Code: 0357606 - 4 
Domiciled in Helsinki 

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#9 lore raw

PATCH 1/1 mtd/gpmi : add gpmi support for mx6q

In reply to Huang Shijie
Quoted 124 lines · Huang Shijie

add gpmi support to mx6q.

---
 drivers/mtd/nand/gpmi-nand/bch-regs.h  |   42 ++++++++++++++++++++++++-------
 drivers/mtd/nand/gpmi-nand/gpmi-lib.c  |   14 ++++++----
 drivers/mtd/nand/gpmi-nand/gpmi-nand.c |    3 ++
 drivers/mtd/nand/gpmi-nand/gpmi-nand.h |    2 +
 4 files changed, 45 insertions(+), 16 deletions(-)
drivers/mtd/nand/gpmi-nand/bch-regs.h +32 -10
index 4effb8c..a092451 100644
@@ -51,15 +51,26 @@
 
 #define BP_BCH_FLASH0LAYOUT0_ECC0		12
 #define BM_BCH_FLASH0LAYOUT0_ECC0	(0xf << BP_BCH_FLASH0LAYOUT0_ECC0)
-#define BF_BCH_FLASH0LAYOUT0_ECC0(v)		\
-	(((v) << BP_BCH_FLASH0LAYOUT0_ECC0) & BM_BCH_FLASH0LAYOUT0_ECC0)
+#define MX6Q_BP_BCH_FLASH0LAYOUT0_ECC0		11
+#define MX6Q_BM_BCH_FLASH0LAYOUT0_ECC0	(0x1f << MX6Q_BP_BCH_FLASH0LAYOUT0_ECC0)
+#define BF_BCH_FLASH0LAYOUT0_ECC0(v, x)				\
+	(GPMI_IS_MX6Q(x)					\
+		? (((v) << MX6Q_BP_BCH_FLASH0LAYOUT0_ECC0)	\
+			& MX6Q_BM_BCH_FLASH0LAYOUT0_ECC0)	\
+		: (((v) << BP_BCH_FLASH0LAYOUT0_ECC0)		\
+			& BM_BCH_FLASH0LAYOUT0_ECC0)		\
+	)
 
 #define BP_BCH_FLASH0LAYOUT0_DATA0_SIZE		0
 #define BM_BCH_FLASH0LAYOUT0_DATA0_SIZE		\
 			(0xfff << BP_BCH_FLASH0LAYOUT0_DATA0_SIZE)
-#define BF_BCH_FLASH0LAYOUT0_DATA0_SIZE(v)	\
-	(((v) << BP_BCH_FLASH0LAYOUT0_DATA0_SIZE)\
-					 & BM_BCH_FLASH0LAYOUT0_DATA0_SIZE)
+#define MX6Q_BM_BCH_FLASH0LAYOUT0_DATA0_SIZE	\
+			(0x3ff << BP_BCH_FLASH0LAYOUT0_DATA0_SIZE)
+#define BF_BCH_FLASH0LAYOUT0_DATA0_SIZE(v, x)				\
+	(GPMI_IS_MX6Q(x)						\
+		? (((v) >> 2) & MX6Q_BM_BCH_FLASH0LAYOUT0_DATA0_SIZE)	\
+		: ((v) & BM_BCH_FLASH0LAYOUT0_DATA0_SIZE)		\
+	)
 
 #define HW_BCH_FLASH0LAYOUT1			0x00000090
 
@@ -72,13 +83,24 @@
 
 #define BP_BCH_FLASH0LAYOUT1_ECCN		12
 #define BM_BCH_FLASH0LAYOUT1_ECCN	(0xf << BP_BCH_FLASH0LAYOUT1_ECCN)
-#define BF_BCH_FLASH0LAYOUT1_ECCN(v)		\
-	(((v) << BP_BCH_FLASH0LAYOUT1_ECCN) & BM_BCH_FLASH0LAYOUT1_ECCN)
+#define MX6Q_BP_BCH_FLASH0LAYOUT1_ECCN		11
+#define MX6Q_BM_BCH_FLASH0LAYOUT1_ECCN	(0x1f << MX6Q_BP_BCH_FLASH0LAYOUT1_ECCN)
+#define BF_BCH_FLASH0LAYOUT1_ECCN(v, x)				\
+	(GPMI_IS_MX6Q(x)					\
+		? (((v) << MX6Q_BP_BCH_FLASH0LAYOUT1_ECCN)	\
+			& MX6Q_BM_BCH_FLASH0LAYOUT1_ECCN)	\
+		: (((v) << BP_BCH_FLASH0LAYOUT1_ECCN)		\
+			& BM_BCH_FLASH0LAYOUT1_ECCN)		\
+	)
 
 #define BP_BCH_FLASH0LAYOUT1_DATAN_SIZE		0
 #define BM_BCH_FLASH0LAYOUT1_DATAN_SIZE		\
 			(0xfff << BP_BCH_FLASH0LAYOUT1_DATAN_SIZE)
-#define BF_BCH_FLASH0LAYOUT1_DATAN_SIZE(v)	\
-	(((v) << BP_BCH_FLASH0LAYOUT1_DATAN_SIZE) \
-					 & BM_BCH_FLASH0LAYOUT1_DATAN_SIZE)
+#define MX6Q_BM_BCH_FLASH0LAYOUT1_DATAN_SIZE	\
+			(0x3ff << BP_BCH_FLASH0LAYOUT1_DATAN_SIZE)
+#define BF_BCH_FLASH0LAYOUT1_DATAN_SIZE(v, x)				\
+	(GPMI_IS_MX6Q(x)						\
+		? (((v) >> 2) & MX6Q_BM_BCH_FLASH0LAYOUT1_DATAN_SIZE)	\
+		: ((v) & BM_BCH_FLASH0LAYOUT1_DATAN_SIZE)		\
+	)
 #endif
drivers/mtd/nand/gpmi-nand/gpmi-lib.c +8 -6
index 28f8df0..fd39350 100644
@@ -223,13 +223,13 @@ int bch_set_geometry(struct gpmi_nand_data *this)
 	/* Configure layout 0. */
 	writel(BF_BCH_FLASH0LAYOUT0_NBLOCKS(block_count)
 			| BF_BCH_FLASH0LAYOUT0_META_SIZE(metadata_size)
-			| BF_BCH_FLASH0LAYOUT0_ECC0(ecc_strength)
-			| BF_BCH_FLASH0LAYOUT0_DATA0_SIZE(block_size),
+			| BF_BCH_FLASH0LAYOUT0_ECC0(ecc_strength, this)
+			| BF_BCH_FLASH0LAYOUT0_DATA0_SIZE(block_size, this),
 			r->bch_regs + HW_BCH_FLASH0LAYOUT0);
 
 	writel(BF_BCH_FLASH0LAYOUT1_PAGE_SIZE(page_size)
-			| BF_BCH_FLASH0LAYOUT1_ECCN(ecc_strength)
-			| BF_BCH_FLASH0LAYOUT1_DATAN_SIZE(block_size),
+			| BF_BCH_FLASH0LAYOUT1_ECCN(ecc_strength, this)
+			| BF_BCH_FLASH0LAYOUT1_DATAN_SIZE(block_size, this),
 			r->bch_regs + HW_BCH_FLASH0LAYOUT1);
 
 	/* Set *all* chip selects to use layout 0. */
@@ -803,7 +803,8 @@ int gpmi_is_ready(struct gpmi_nand_data *this, unsigned chip)
 	if (GPMI_IS_MX23(this)) {
 		mask = MX23_BM_GPMI_DEBUG_READY0 << chip;
 		reg = readl(r->gpmi_regs + HW_GPMI_DEBUG);
-	} else if (GPMI_IS_MX28(this)) {
+	} else if (GPMI_IS_MX28(this) || GPMI_IS_MX6Q(this)) {
+		/* MX28 shares the same R/B register as MX6Q. */
 		mask = MX28_BF_GPMI_STAT_READY_BUSY(1 << chip);
 		reg = readl(r->gpmi_regs + HW_GPMI_STAT);
 	} else
@@ -1066,8 +1067,9 @@ int gpmi_read_page(struct gpmi_nand_data *this,
 		| BF_GPMI_CTRL0_ADDRESS(address)
 		| BF_GPMI_CTRL0_XFER_COUNT(geo->page_size);
 	pio[1] = 0;
+	pio[2] = 0; /* set GPMI_HW_GPMI_ECCCTRL, disable the BCH. */
 	desc = channel->device->device_prep_slave_sg(channel,
-				(struct scatterlist *)pio, 2,
+				(struct scatterlist *)pio, 3,
 				DMA_TRANS_NONE,
 				DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	if (!desc) {
drivers/mtd/nand/gpmi-nand/gpmi-nand.c +0 -0
index 493ec2f..90545e2 100644

drivers/mtd/nand/gpmi-nand/gpmi-nand.c static const struct platform_device_id gpmi_ids[] = { · line 1590

Quoted 9 lines
drivers/mtd/nand/gpmi-nand/gpmi-nand.c +3 -0
@@ -1582,6 +1582,9 @@ static const struct platform_device_id gpmi_ids[] = {
 	}, {
 		.name = "imx28-gpmi-nand",
 		.driver_data = IS_MX28,
+	}, {
+		.name = "imx6q-gpmi-nand",
+		.driver_data = IS_MX6Q,
 	}, {},
 };
 

The imx6q only supports DT boot, but I do not see you are adding DT probe for the driver, so I'm wondering how you tested the driver on imx6q.

Signature · 2 lines
Regards,
Shawn
Quoted 15 lines
drivers/mtd/nand/gpmi-nand/gpmi-nand.h +2 -0
index 1c7fdbb..a302dd1 100644
@@ -268,6 +268,8 @@ extern int gpmi_read_page(struct gpmi_nand_data *,
 /* Use the platform_id to distinguish different Archs. */
 #define IS_MX23			0x1
 #define IS_MX28			0x2
+#define IS_MX6Q			0x8
 #define GPMI_IS_MX23(x)		((x)->pdev->id_entry->driver_data == IS_MX23)
 #define GPMI_IS_MX28(x)		((x)->pdev->id_entry->driver_data == IS_MX28)
+#define GPMI_IS_MX6Q(x)		((x)->pdev->id_entry->driver_data == IS_MX6Q)
 #endif
Signature · 1 line
1.7.0.4
#10 lore raw

PATCH 1/1 mtd/gpmi : add gpmi support for mx6q

Hi,

Quoted 4 lines

The imx6q only supports DT boot, but I do not see you are adding DT probe for the driver, so I'm wondering how you tested the driver on imx6q.

This patch is just the first patch for mx6q. My following patches will add DT to the gpmi nand driver for mx6q. Due to the dependency issue, I will send the patches
in the following order:
[1] mtd/gpmi: add gpmi support for mx6q.
[2] [PATCH v5] patch set about the MXS-DMA
[3] add DT support to gpmi for mx6q.

I tested this patch based on our bsp code.

BR
Huang Shijie

#11 lore raw

PATCH 1/1 mtd/gpmi : add gpmi support for mx6q

Quoted 5 lines · Huang Shijie

Hi,

Quoted 4 lines

The imx6q only supports DT boot, but I do not see you are adding DT probe for the driver, so I'm wondering how you tested the driver on imx6q.

Quoted 8 lines

This patch is just the first patch for mx6q. My following patches will add DT to the gpmi nand driver for mx6q. Due to the dependency issue, I will send the patches
in the following order:
[1] mtd/gpmi: add gpmi support for mx6q.
[2] [PATCH v5] patch set about the MXS-DMA
[3] add DT support to gpmi for mx6q.

It should be:

1. MXS-DMA series
2. Add imx6q support with DT probe

Quoted 2 lines

I tested this patch based on our bsp code.

This is wrong approach. You are submitting patches to mainline, so you should test your patches on mainline tree.

Signature · 2 lines
Regards,
Shawn
#12 lore raw

PATCH 1/1 mtd/gpmi : add gpmi support for mx6q

Hi,

Quoted 14 lines · Huang Shijie
Quoted 5 lines

Hi,

Quoted 4 lines

The imx6q only supports DT boot, but I do not see you are adding DT probe for the driver, so I'm wondering how you tested the driver on imx6q.

Quoted 8 lines

This patch is just the first patch for mx6q. My following patches will add DT to the gpmi nand driver for mx6q. Due to the dependency issue, I will send the patches
in the following order:
[1] mtd/gpmi: add gpmi support for mx6q.
[2] [PATCH v5] patch set about the MXS-DMA
[3] add DT support to gpmi for mx6q.

Quoted 5 lines

It should be:

1. MXS-DMA series
2. Add imx6q support with DT probe

I ever did so in this order. But the mxs-dma series delayed for long time( I missed the CCs).
But Artem's tree is faster to merge patch.

Quoted 5 lines
Quoted 2 lines

I tested this patch based on our bsp code.

This is wrong approach. You are submitting patches to mainline, so you should test your patches on mainline tree.

Beside the DT, the gpmi nand driver is the same.

Is the mainline tree ready now? How can i to set the pinmux for gpmi?

BR
Huang Shijie

#13 lore raw

PATCH 1/1 mtd/gpmi : add gpmi support for mx6q

Quoted 15 lines · Huang Shijie

Hi,

Quoted 14 lines · Huang Shijie
Quoted 13 lines

Hi,

Quoted 4 lines

The imx6q only supports DT boot, but I do not see you are adding DT probe for the driver, so I'm wondering how you tested the driver on imx6q.

This patch is just the first patch for mx6q. My following patches will add DT to the gpmi nand driver for mx6q. Due to the dependency issue, I will send the patches
in the following order:
[1] mtd/gpmi: add gpmi support for mx6q.
[2] [PATCH v5] patch set about the MXS-DMA
[3] add DT support to gpmi for mx6q.

Quoted 8 lines
Quoted 5 lines

It should be:

1. MXS-DMA series
2. Add imx6q support with DT probe

I ever did so in this order. But the mxs-dma series delayed for long time( I missed the CCs).
But Artem's tree is faster to merge patch.

You can not change the order because of that. The fact is imx6q gpmi support depends on the mxs-dma change.

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

I tested this patch based on our bsp code.

This is wrong approach. You are submitting patches to mainline, so you should test your patches on mainline tree.

Beside the DT, the gpmi nand driver is the same.

Is the mainline tree ready now? How can i to set the pinmux for gpmi?

People have eventually archived the agreement on pinctrl DT design, and the patch will come out pretty soon. Before we have the pinctrl driver for imx6q, you can rely on boot loader to set pins up properly for your testing.

Signature · 2 lines
Regards,
Shawn
#14 lore raw

PATCH 1/1 mtd/gpmi : add gpmi support for mx6q

hi

Quoted 3 lines

You can not change the order because of that. The fact is imx6q gpmi support depends on the mxs-dma change.

ok, I will send out the new version about this patch set.

thanks
Huang Shijie