The general-purpose media interface (GPMI) host driver implements a standard Linux driver interface to support NAND devices. The host driver is part of the Linux kernel MTD framework.

The i.MX6UL CPU has one GPMI controller.

On the ConnectCore 6UL system-on-module:

  • GPMI connects internally to the NAND chip using eight data lines and NAND control lines.

Kernel configuration

You can manage the GPMI driver support through the following kernel configuration option:

  • Freescale GPMI NAND controller (CONFIG_MTD_NAND_GPMI_NAND)

This option is enabled as built-in on the default ConnectCore 6UL kernel configuration file.

Kernel driver

The driver for the GPMI is located at:

File Description

drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c

GMPI driver

Device tree bindings and customization

The GPMI device tree binding is documented at Documentation/devicetree/bindings/mtd/gpmi-nand.yaml.

Common NAND device tree bindings are documented at Documentation/devicetree/bindings/mtd/nand-controller.yaml.

The common i.MX6UL CPU device tree defines the GPMI controller.

i.MX6UL device tree
gpmi: nand-controller@1806000 {
	compatible = "fsl,imx6q-gpmi-nand";
	#address-cells = <1>;
	#size-cells = <1>;
	reg = <0x01806000 0x2000>, <0x01808000 0x2000>;
	reg-names = "gpmi-nand", "bch";
	interrupts = <0 15 IRQ_TYPE_LEVEL_HIGH>;
	interrupt-names = "bch";
	clocks = <&clks IMX6UL_CLK_GPMI_IO>,
		 <&clks IMX6UL_CLK_GPMI_APB>,
		 <&clks IMX6UL_CLK_GPMI_BCH>,
		 <&clks IMX6UL_CLK_GPMI_BCH_APB>,
		 <&clks IMX6UL_CLK_PER_BCH>;
	clock-names = "gpmi_io", "gpmi_apb", "gpmi_bch",
		      "gpmi_bch_apb", "per1_bch";
	dmas = <&dma_apbh 0>;
	dma-names = "rx-tx";
	status = "disabled";
};

The ConnectCore 6UL device tree enables the GPMI interface using eight data lines.

ConnectCore 6UL device tree
&gpmi {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_gpmi_nand>;
	status = "okay";
};

IOMUX configuration

ConnectCore 6UL device tree
&iomuxc {
	pinctrl_gpmi_nand: gpmigrp {
		fsl,pins = <
			MX6UL_PAD_NAND_CE0_B__RAWNAND_CE0_B	0xb0b1
			MX6UL_PAD_NAND_RE_B__RAWNAND_RE_B	0xb0b1
			MX6UL_PAD_NAND_WE_B__RAWNAND_WE_B	0xb0b1
			MX6UL_PAD_NAND_WP_B__RAWNAND_WP_B	0xb0b1
			MX6UL_PAD_NAND_ALE__RAWNAND_ALE		0xb0b1
			MX6UL_PAD_NAND_CLE__RAWNAND_CLE		0xb0b1
			MX6UL_PAD_NAND_DATA00__RAWNAND_DATA00	0xb0b1
			MX6UL_PAD_NAND_DATA01__RAWNAND_DATA01	0xb0b1
			MX6UL_PAD_NAND_DATA02__RAWNAND_DATA02	0xb0b1
			MX6UL_PAD_NAND_DATA03__RAWNAND_DATA03	0xb0b1
			MX6UL_PAD_NAND_DATA04__RAWNAND_DATA04	0xb0b1
			MX6UL_PAD_NAND_DATA05__RAWNAND_DATA05	0xb0b1
			MX6UL_PAD_NAND_DATA06__RAWNAND_DATA06	0xb0b1
			MX6UL_PAD_NAND_DATA07__RAWNAND_DATA07	0xb0b1
			MX6UL_PAD_NAND_READY_B__RAWNAND_READY_B	0xb0b1
		>;
	};
};

User space usage

On a NAND flash memory, the partitions are established by a kernel parameter (a string) which is passed by the bootloader. See Storage layout for information about the partition layout.

On Linux, you can check the partition table with this command:

# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00300000 00020000 "bootloader"
mtd1: 00100000 00020000 "environment"
mtd2: 00100000 00020000 "safe"
mtd3: 00c00000 00020000 "linux"
mtd4: 00e00000 00020000 "recovery"
mtd5: 07a00000 00020000 "rootfs"
mtd6: 06700000 00020000 "update"

The main system partitions contain UBI volumes. UBI volumes with a file system can be mounted with mount command.