imx: Add iMX6 NAND support
Subsystems (8)
cover imx: Add iMX6 NAND support
To support NAND on the iMX6 this patch moves some headers into i.MX common locations. Instead of creating new files in the imx6 include directory containing nearly the same content.
Here the diffstat:
Stefan Roese (4):
imx: Move some header files from arch-mxs to imx-common
imx: Move some i.MX common functions into the imx-common directory
dma: Add i.MX6 support to drivers/dma/apbh_dma.c
mtd: mxs_nand: Add support for i.MX6
Makefile | 2 +-
arch/arm/cpu/arm926ejs/mxs/mxs.c | 65 +----------------
arch/arm/cpu/armv7/mx6/soc.c | 7 ++
arch/arm/imx-common/Makefile | 3 +
arch/arm/imx-common/misc.c | 84 ++++++++++++++++++++++
arch/arm/include/asm/arch-mx6/imx-regs.h | 4 ++
arch/arm/include/asm/arch-mx6/sys_proto.h | 10 +++
arch/arm/include/asm/arch-mxs/imx-regs.h | 6 +-
arch/arm/include/asm/arch-mxs/regs-clkctrl-mx23.h | 2 +-
arch/arm/include/asm/arch-mxs/regs-clkctrl-mx28.h | 2 +-
arch/arm/include/asm/arch-mxs/regs-digctl.h | 2 +-
arch/arm/include/asm/arch-mxs/regs-i2c.h | 2 +-
arch/arm/include/asm/arch-mxs/regs-lcdif.h | 2 +-
arch/arm/include/asm/arch-mxs/regs-lradc.h | 2 +-
arch/arm/include/asm/arch-mxs/regs-ocotp.h | 2 +-
arch/arm/include/asm/arch-mxs/regs-pinctrl.h | 2 +-
arch/arm/include/asm/arch-mxs/regs-power-mx23.h | 2 +-
arch/arm/include/asm/arch-mxs/regs-power-mx28.h | 2 +-
arch/arm/include/asm/arch-mxs/regs-rtc.h | 2 +-
arch/arm/include/asm/arch-mxs/regs-ssp.h | 2 +-
arch/arm/include/asm/arch-mxs/regs-timrot.h | 2 +-
.../arm/include/asm/{arch-mxs => imx-common}/dma.h | 12 ++++
.../asm/{arch-mxs => imx-common}/regs-apbh.h | 19 ++++-
.../asm/{arch-mxs => imx-common}/regs-bch.h | 12 +++-
.../asm/{arch-mxs => imx-common}/regs-common.h | 0
.../asm/{arch-mxs => imx-common}/regs-gpmi.h | 2 +-
drivers/dma/apbh_dma.c | 5 +-
drivers/mmc/mxsmmc.c | 2 +-
drivers/mtd/nand/mxs_nand.c | 15 +++-
drivers/spi/mxs_spi.c | 2 +-
spl/Makefile | 4 ++
31 files changed, 188 insertions(+), 92 deletions(-)
create mode 100644 arch/arm/imx-common/misc.c
rename arch/arm/include/asm/{arch-mxs => imx-common}/dma.h (93%)
rename arch/arm/include/asm/{arch-mxs => imx-common}/regs-apbh.h (97%)
rename arch/arm/include/asm/{arch-mxs => imx-common}/regs-bch.h (96%)
rename arch/arm/include/asm/{arch-mxs => imx-common}/regs-common.h (100%)
rename arch/arm/include/asm/{arch-mxs => imx-common}/regs-gpmi.h (99%)Comments welcome.
Thanks,
Stefan
PATCH 1/4 imx: Move some header files from arch-mxs to imx-common
The following headers are moved to a i.MX common location:
- regs-common.h
- regs-apbh.h
- regs-bch.h
- regs-gpmi.h
- dma.h
This way this header can be re-used also by other i.MX platforms. For example the i.MX6 which will need it for the upcoming NAND support.
---
arch/arm/cpu/arm926ejs/mxs/mxs.c | 2 +-
arch/arm/include/asm/arch-mxs/imx-regs.h | 6 +++---
arch/arm/include/asm/arch-mxs/regs-clkctrl-mx23.h | 2 +-
arch/arm/include/asm/arch-mxs/regs-clkctrl-mx28.h | 2 +-
arch/arm/include/asm/arch-mxs/regs-digctl.h | 2 +-
arch/arm/include/asm/arch-mxs/regs-i2c.h | 2 +-
arch/arm/include/asm/arch-mxs/regs-lcdif.h | 2 +-
arch/arm/include/asm/arch-mxs/regs-lradc.h | 2 +-
arch/arm/include/asm/arch-mxs/regs-ocotp.h | 2 +-
arch/arm/include/asm/arch-mxs/regs-pinctrl.h | 2 +-
arch/arm/include/asm/arch-mxs/regs-power-mx23.h | 2 +-
arch/arm/include/asm/arch-mxs/regs-power-mx28.h | 2 +-
arch/arm/include/asm/arch-mxs/regs-rtc.h | 2 +-
arch/arm/include/asm/arch-mxs/regs-ssp.h | 2 +-
arch/arm/include/asm/arch-mxs/regs-timrot.h | 2 +-
arch/arm/include/asm/{arch-mxs => imx-common}/dma.h | 0
arch/arm/include/asm/{arch-mxs => imx-common}/regs-apbh.h | 2 +-
arch/arm/include/asm/{arch-mxs => imx-common}/regs-bch.h | 2 +-
arch/arm/include/asm/{arch-mxs => imx-common}/regs-common.h | 0
arch/arm/include/asm/{arch-mxs => imx-common}/regs-gpmi.h | 2 +-
drivers/dma/apbh_dma.c | 3 ++-
drivers/mmc/mxsmmc.c | 2 +-
drivers/mtd/nand/mxs_nand.c | 4 +++-
drivers/spi/mxs_spi.c | 2 +-
24 files changed, 27 insertions(+), 24 deletions(-)
rename arch/arm/include/asm/{arch-mxs => imx-common}/dma.h (100%)
rename arch/arm/include/asm/{arch-mxs => imx-common}/regs-apbh.h (99%)
rename arch/arm/include/asm/{arch-mxs => imx-common}/regs-bch.h (99%)
rename arch/arm/include/asm/{arch-mxs => imx-common}/regs-common.h (100%)
rename arch/arm/include/asm/{arch-mxs => imx-common}/regs-gpmi.h (99%)arch/arm/cpu/arm926ejs/mxs/mxs.c +1 -1
@@ -30,7 +30,7 @@#include <asm/errno.h> #include <asm/io.h> #include <asm/arch/clock.h> -#include <asm/arch/dma.h> +#include <asm/imx-common/dma.h> #include <asm/arch/gpio.h> #include <asm/arch/iomux.h> #include <asm/arch/imx-regs.h>
arch/arm/include/asm/arch-mxs/imx-regs.h +3 -3
@@ -23,11 +23,11 @@#ifndef __IMX_REGS_H__#define __IMX_REGS_H__ -#include <asm/arch/regs-apbh.h> +#include <asm/imx-common/regs-apbh.h> #include <asm/arch/regs-base.h> -#include <asm/arch/regs-bch.h> +#include <asm/imx-common/regs-bch.h> #include <asm/arch/regs-digctl.h> -#include <asm/arch/regs-gpmi.h> +#include <asm/imx-common/regs-gpmi.h> #include <asm/arch/regs-i2c.h> #include <asm/arch/regs-lcdif.h> #include <asm/arch/regs-lradc.h>
arch/arm/include/asm/arch-mxs/regs-clkctrl-mx23.h +1 -1
@@ -26,7 +26,7 @@#ifndef __MX23_REGS_CLKCTRL_H__#define __MX23_REGS_CLKCTRL_H__ -#include <asm/arch/regs-common.h> +#include <asm/imx-common/regs-common.h> #ifndef __ASSEMBLY__ struct mxs_clkctrl_regs {
arch/arm/include/asm/arch-mxs/regs-clkctrl-mx28.h +1 -1
@@ -26,7 +26,7 @@#ifndef __MX28_REGS_CLKCTRL_H__#define __MX28_REGS_CLKCTRL_H__ -#include <asm/arch/regs-common.h> +#include <asm/imx-common/regs-common.h> #ifndef __ASSEMBLY__ struct mxs_clkctrl_regs {
arch/arm/include/asm/arch-mxs/regs-digctl.h +1 -1
@@ -22,7 +22,7 @@#ifndef __MX28_REGS_DIGCTL_H__#define __MX28_REGS_DIGCTL_H__ -#include <asm/arch/regs-common.h> +#include <asm/imx-common/regs-common.h> #ifndef __ASSEMBLY__ struct mxs_digctl_regs {
arch/arm/include/asm/arch-mxs/regs-i2c.h +1 -1
@@ -23,7 +23,7 @@#ifndef __MX28_REGS_I2C_H__#define __MX28_REGS_I2C_H__ -#include <asm/arch/regs-common.h> +#include <asm/imx-common/regs-common.h> #ifndef __ASSEMBLY__ struct mxs_i2c_regs {
arch/arm/include/asm/arch-mxs/regs-lcdif.h +1 -1
@@ -26,7 +26,7 @@#ifndef __MX28_REGS_LCDIF_H__#define __MX28_REGS_LCDIF_H__ -#include <asm/arch/regs-common.h> +#include <asm/imx-common/regs-common.h> #ifndef __ASSEMBLY__ struct mxs_lcdif_regs {
arch/arm/include/asm/arch-mxs/regs-lradc.h +1 -1
@@ -26,7 +26,7 @@#ifndef __MX28_REGS_LRADC_H__#define __MX28_REGS_LRADC_H__ -#include <asm/arch/regs-common.h> +#include <asm/imx-common/regs-common.h> #ifndef __ASSEMBLY__ struct mxs_lradc_regs {
arch/arm/include/asm/arch-mxs/regs-ocotp.h +1 -1
@@ -26,7 +26,7 @@#ifndef __MX28_REGS_OCOTP_H__#define __MX28_REGS_OCOTP_H__ -#include <asm/arch/regs-common.h> +#include <asm/imx-common/regs-common.h> #ifndef __ASSEMBLY__ struct mxs_ocotp_regs {
arch/arm/include/asm/arch-mxs/regs-pinctrl.h +1 -1
@@ -26,7 +26,7 @@#ifndef __MX28_REGS_PINCTRL_H__#define __MX28_REGS_PINCTRL_H__ -#include <asm/arch/regs-common.h> +#include <asm/imx-common/regs-common.h> #ifndef __ASSEMBLY__ struct mxs_pinctrl_regs {
arch/arm/include/asm/arch-mxs/regs-power-mx23.h +1 -1
@@ -22,7 +22,7 @@#ifndef __MX23_REGS_POWER_H__#define __MX23_REGS_POWER_H__ -#include <asm/arch/regs-common.h> +#include <asm/imx-common/regs-common.h> #ifndef __ASSEMBLY__ struct mxs_power_regs {
arch/arm/include/asm/arch-mxs/regs-power-mx28.h +1 -1
@@ -22,7 +22,7 @@#ifndef __MX28_REGS_POWER_H__#define __MX28_REGS_POWER_H__ -#include <asm/arch/regs-common.h> +#include <asm/imx-common/regs-common.h> #ifndef __ASSEMBLY__ struct mxs_power_regs {
arch/arm/include/asm/arch-mxs/regs-rtc.h +1 -1
@@ -23,7 +23,7 @@#ifndef __MX28_REGS_RTC_H__#define __MX28_REGS_RTC_H__ -#include <asm/arch/regs-common.h> +#include <asm/imx-common/regs-common.h> #ifndef __ASSEMBLY__ struct mxs_rtc_regs {
arch/arm/include/asm/arch-mxs/regs-ssp.h +1 -1
@@ -25,7 +25,7 @@#ifndef __MX28_REGS_SSP_H__#define __MX28_REGS_SSP_H__ -#include <asm/arch/regs-common.h> +#include <asm/imx-common/regs-common.h> #ifndef __ASSEMBLY__#if defined(CONFIG_MX23 )
arch/arm/include/asm/arch-mxs/regs-timrot.h +1 -1
@@ -25,7 +25,7 @@#ifndef __MX28_REGS_TIMROT_H__#define __MX28_REGS_TIMROT_H__ -#include <asm/arch/regs-common.h> +#include <asm/imx-common/regs-common.h> #ifndef __ASSEMBLY__ struct mxs_timrot_regs {
arch/arm/include/asm/imx-common/dma.h renamed from arch/arm/include/asm/arch-mxs/dma.h +0 -0
arch/arm/include/asm/imx-common/regs-apbh.h renamed from arch/arm/include/asm/arch-mxs/regs-apbh.h +1 -1
@@ -26,7 +26,7 @@#ifndef __REGS_APBH_H__#define __REGS_APBH_H__ -#include <asm/arch/regs-common.h> +#include <asm/imx-common/regs-common.h> #ifndef __ASSEMBLY__
arch/arm/include/asm/imx-common/regs-bch.h renamed from arch/arm/include/asm/arch-mxs/regs-bch.h +1 -1
@@ -26,7 +26,7 @@#ifndef __MX28_REGS_BCH_H__#define __MX28_REGS_BCH_H__ -#include <asm/arch/regs-common.h> +#include <asm/imx-common/regs-common.h> #ifndef __ASSEMBLY__ struct mxs_bch_regs {
arch/arm/include/asm/imx-common/regs-common.h renamed from arch/arm/include/asm/arch-mxs/regs-common.h +0 -0
arch/arm/include/asm/imx-common/regs-gpmi.h renamed from arch/arm/include/asm/arch-mxs/regs-gpmi.h +1 -1
@@ -26,7 +26,7 @@#ifndef __MX28_REGS_GPMI_H__#define __MX28_REGS_GPMI_H__ -#include <asm/arch/regs-common.h> +#include <asm/imx-common/regs-common.h> #ifndef __ASSEMBLY__ struct mxs_gpmi_regs {
drivers/dma/apbh_dma.c +2 -1
@@ -31,7 +31,8 @@#include <asm/arch/clock.h> #include <asm/arch/imx-regs.h> #include <asm/arch/sys_proto.h> -#include <asm/arch/dma.h> +#include <asm/imx-common/dma.h> +#include <asm/imx-common/regs-apbh.h> static struct mxs_dma_chan mxs_dma_channels[MXS_MAX_DMA_CHANNELS ];
drivers/mmc/mxsmmc.c +1 -1
@@ -41,7 +41,7 @@#include <asm/arch/clock.h> #include <asm/arch/imx-regs.h> #include <asm/arch/sys_proto.h> -#include <asm/arch/dma.h> +#include <asm/imx-common/dma.h> #include <bouncebuf.h> struct mxsmmc_priv {
drivers/mtd/nand/mxs_nand.c +3 -1
@@ -34,8 +34,10 @@#include <asm/io.h> #include <asm/arch/clock.h> #include <asm/arch/imx-regs.h> +#include <asm/imx-common/regs-bch.h> +#include <asm/imx-common/regs-gpmi.h> #include <asm/arch/sys_proto.h> -#include <asm/arch/dma.h> +#include <asm/imx-common/dma.h> #define MXS_NAND_DMA_DESCRIPTOR_COUNT 4
drivers/spi/mxs_spi.c +1 -1
@@ -31,7 +31,7 @@#include <asm/arch/clock.h> #include <asm/arch/imx-regs.h> #include <asm/arch/sys_proto.h> -#include <asm/arch/dma.h> +#include <asm/imx-common/dma.h> #define MXS_SPI_MAX_TIMEOUT 1000000#define MXS_SPI_PORT_OFFSET 0x2000
Signature · 1 line
1.8.2.1
PATCH 2/4 imx: Move some i.MX common functions into the imx-common directory
In reply to Stefan RoeseThis patch moves the following functions into the imx-common directory:
- mxs_wait_mask_set()
- mxs_wait_mask_clr()
- mxs_reset_block()
These are currently used by i.MX28. But the upcoming GPMI NAND port for i.MX6 will also use these functions. So lets move them to a common location to re-use them.
--- Makefile | 2 +- arch/arm/cpu/arm926ejs/mxs/mxs.c | 63 ----------------------- arch/arm/imx-common/Makefile | 3 ++ arch/arm/imx-common/misc.c | 84 +++++++++++++++++++++++++++++++ arch/arm/include/asm/arch-mx6/sys_proto.h | 10 ++++ spl/Makefile | 4 ++ 6 files changed, 102 insertions(+), 64 deletions(-) create mode 100644 arch/arm/imx-common/misc.c
Makefile +1 -1
@@ -335,7 +335,7 @@ ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP34XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(C LIBS-y += $(CPUDIR)/omap-common/libomap-common.o endif -ifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35)) +ifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35 mxs)) LIBS-y += arch/$(ARCH)/imx-common/libimx-common.o endif
arch/arm/cpu/arm926ejs/mxs/mxs.c +0 -63
75 lines not on this page · raw message
arch/arm/imx-common/Makefile +3 -0
@@ -31,6 +31,9 @@ ifeq ($(SOC),$(filter $(SOC),mx5 mx6)) COBJS-y = iomux-v3.o timer.o cpu.o speed.o COBJS-$(CONFIG_I2C_MXC) += i2c-mxv7.o endif +ifeq ($(SOC),$(filter $(SOC),mx6 mxs)) +COBJS-y += misc.o +endif COBJS-$(CONFIG_CMD_BMODE) += cmd_bmode.o COBJS := $(sort $(COBJS-y))
arch/arm/imx-common/misc.c new file +84 -0
84 lines not on this page · raw message
arch/arm/include/asm/arch-mx6/sys_proto.h +10 -0
@@ -24,6 +24,8 @@#ifndef _SYS_PROTO_H_#define _SYS_PROTO_H_ +#include <asm/imx-common/regs-common.h> +#define MXC_CPU_MX51 0x51#define MXC_CPU_MX53 0x53#define MXC_CPU_MX6SL 0x60
@@ -46,4 +48,12 @@ void set_vddsoc(u32 mv);int fecmxc_initialize (bd_t *bis);u32 get_ahb_clk (void );u32 get_periph_clk (void ); + +int mxs_reset_block (struct mxs_register_32 *reg); +int mxs_wait_mask_set (struct mxs_register_32 *reg, +uint32_t mask, +unsigned int timeout); +int mxs_wait_mask_clr (struct mxs_register_32 *reg, +uint32_t mask, +unsigned int timeout);#endif
spl/Makefile +4 -0
@@ -94,6 +94,10 @@ LIBS-y += arch/$(ARCH)/cpu/tegra-common/libcputegra-common.o LIBS-y += $(CPUDIR)/tegra-common/libtegra-common.o endif +ifneq ($(CONFIG_MX23),) +LIBS-y += arch/$(ARCH)/imx-common/libimx-common.o +endif + # Add GCC lib ifeq ("$(USE_PRIVATE_LIBGCC)", "yes") PLATFORM_LIBGCC = $(SPLTREE)/arch/$(ARCH)/lib/libgcc.o
Signature · 1 line
1.8.2.1
PATCH 3/4 dma: Add i.MX6 support to drivers/dma/apbh_dma.c
In reply to Stefan RoeseThis will be used by the i.MX6 NAND support.
--- arch/arm/include/asm/arch-mx6/imx-regs.h | 4 ++++ arch/arm/include/asm/imx-common/dma.h | 12 ++++++++++++ arch/arm/include/asm/imx-common/regs-apbh.h | 17 ++++++++++++++++- drivers/dma/apbh_dma.c | 2 +- 4 files changed, 33 insertions(+), 2 deletions(-)
arch/arm/include/asm/arch-mx6/imx-regs.h +4 -0
@@ -38,6 +38,10 @@#define DTCP_ARB_BASE_ADDR 0x00138000#define DTCP_ARB_END_ADDR 0x0013BFFF +#define MXS_APBH_BASE APBH_DMA_ARB_BASE_ADDR +#define MXS_GPMI_BASE (APBH_DMA_ARB_BASE_ADDR + 0x02000) +#define MXS_BCH_BASE (APBH_DMA_ARB_BASE_ADDR + 0x04000) +/* GPV - PL301 configuration ports */ #define GPV2_BASE_ADDR 0x00200000#define GPV3_BASE_ADDR 0x00300000
arch/arm/include/asm/imx-common/dma.h +12 -0
@@ -72,6 +72,18 @@ enum {MXS_DMA_CHANNEL_AHB_APBH_RESERVED1 , MXS_MAX_DMA_CHANNELS, }; +#elif defined(CONFIG_MX6 ) +enum { +MXS_DMA_CHANNEL_AHB_APBH_GPMI0 =0 , +MXS_DMA_CHANNEL_AHB_APBH_GPMI1 , +MXS_DMA_CHANNEL_AHB_APBH_GPMI2 , +MXS_DMA_CHANNEL_AHB_APBH_GPMI3 , +MXS_DMA_CHANNEL_AHB_APBH_GPMI4 , +MXS_DMA_CHANNEL_AHB_APBH_GPMI5 , +MXS_DMA_CHANNEL_AHB_APBH_GPMI6 , +MXS_DMA_CHANNEL_AHB_APBH_GPMI7 , +MXS_MAX_DMA_CHANNELS , +};#endif /*
arch/arm/include/asm/imx-common/regs-apbh.h +16 -1
@@ -109,7 +109,7 @@ struct mxs_apbh_regs { mxs_reg_32(hw_apbh_version) }; -#elif defined(CONFIG_MX28) +#elif (defined(CONFIG_MX28) || defined(CONFIG_MX6)) struct mxs_apbh_regs { mxs_reg_32(hw_apbh_ctrl0) mxs_reg_32(hw_apbh_ctrl1)
@@ -288,6 +288,17 @@ struct mxs_apbh_regs {#define APBH_CTRL0_CLKGATE_CHANNEL_NAND7 0x0800#define APBH_CTRL0_CLKGATE_CHANNEL_HSADC 0x1000#define APBH_CTRL0_CLKGATE_CHANNEL_LCDIF 0x2000 +#elif defined(CONFIG_MX6 ) +#define APBH_CTRL0_CLKGATE_CHANNEL_OFFSET 0 +#define APBH_CTRL0_CLKGATE_CHANNEL_NAND0 0x0001 +#define APBH_CTRL0_CLKGATE_CHANNEL_NAND1 0x0002 +#define APBH_CTRL0_CLKGATE_CHANNEL_NAND2 0x0004 +#define APBH_CTRL0_CLKGATE_CHANNEL_NAND3 0x0008 +#define APBH_CTRL0_CLKGATE_CHANNEL_NAND4 0x0010 +#define APBH_CTRL0_CLKGATE_CHANNEL_NAND5 0x0020 +#define APBH_CTRL0_CLKGATE_CHANNEL_NAND6 0x0040 +#define APBH_CTRL0_CLKGATE_CHANNEL_NAND7 0x0080 +#define APBH_CTRL0_CLKGATE_CHANNEL_SSP 0x0100#endif #define APBH_CTRL1_CH15_CMDCMPLT_IRQ_EN (1 << 31)
@@ -393,6 +404,10 @@ struct mxs_apbh_regs {#define APBH_CHANNEL_CTRL_FREEZE_CHANNEL_LCDIF 0x2000#endif +#if defined(CONFIG_MX6 ) +#define APBH_CHANNEL_CTRL_RESET_CHANNEL_OFFSET 16 +#endif +#if defined(CONFIG_MX23 )#define APBH_DEVSEL_CH7_MASK (0xf << 28)#define APBH_DEVSEL_CH7_OFFSET 28
drivers/dma/apbh_dma.c +1 -1
@@ -227,7 +227,7 @@ static int mxs_dma_reset(int channel)#if defined(CONFIG_MX23 )uint32_t setreg = (uint32_t )(&apbh_regs->hw_apbh_ctrl0_set);uint32_t offset =APBH_CTRL0_RESET_CHANNEL_OFFSET ; -#elif defined(CONFIG_MX28 ) +#elif (defined(CONFIG_MX28 ) || defined(CONFIG_MX6 ))uint32_t setreg = (uint32_t )(&apbh_regs->hw_apbh_channel_ctrl_set);uint32_t offset =APBH_CHANNEL_CTRL_RESET_CHANNEL_OFFSET ;#endif
Signature · 1 line
1.8.2.1
PATCH 4/4 mtd: mxs_nand: Add support for i.MX6
In reply to Stefan Roese--- arch/arm/cpu/armv7/mx6/soc.c | 7 +++++++ arch/arm/include/asm/imx-common/regs-bch.h | 10 ++++++++++ drivers/mtd/nand/mxs_nand.c | 11 +++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-)
arch/arm/cpu/armv7/mx6/soc.c +7 -0
@@ -30,6 +30,7 @@#include <asm/arch/clock.h> #include <asm/arch/sys_proto.h> #include <asm/imx-common/boot_mode.h> +#include <asm/imx-common/dma.h> #include <stdbool.h> struct scu_regs {
@@ -139,6 +140,12 @@ int arch_cpu_init(void)set_vddsoc (1200 );/* Set VDDSOC to 1.2V */ imx_set_wdog_powerdown (false);/* Disable PDE bit of WMCR register */ + +#ifdef CONFIG_APBH_DMA +/* Start APBH DMA */ +mxs_dma_init (); +#endif +return 0 ; }
arch/arm/include/asm/imx-common/regs-bch.h +10 -0
@@ -136,8 +136,13 @@ struct mxs_bch_regs {#define BCH_FLASHLAYOUT0_NBLOCKS_OFFSET 24#define BCH_FLASHLAYOUT0_META_SIZE_MASK (0xff << 16)#define BCH_FLASHLAYOUT0_META_SIZE_OFFSET 16 +#if defined(CONFIG_MX6 ) +#define BCH_FLASHLAYOUT0_ECC0_MASK (0x1f << 11) +#define BCH_FLASHLAYOUT0_ECC0_OFFSET 11 +#else #define BCH_FLASHLAYOUT0_ECC0_MASK (0xf << 12)#define BCH_FLASHLAYOUT0_ECC0_OFFSET 12 +#endif #define BCH_FLASHLAYOUT0_ECC0_NONE (0x0 << 12)#define BCH_FLASHLAYOUT0_ECC0_ECC2 (0x1 << 12)#define BCH_FLASHLAYOUT0_ECC0_ECC4 (0x2 << 12)
@@ -161,8 +166,13 @@ struct mxs_bch_regs {#define BCH_FLASHLAYOUT1_PAGE_SIZE_MASK (0xffff << 16)#define BCH_FLASHLAYOUT1_PAGE_SIZE_OFFSET 16 +#if defined(CONFIG_MX6 ) +#define BCH_FLASHLAYOUT1_ECCN_MASK (0x1f << 11) +#define BCH_FLASHLAYOUT1_ECCN_OFFSET 11 +#else #define BCH_FLASHLAYOUT1_ECCN_MASK (0xf << 12)#define BCH_FLASHLAYOUT1_ECCN_OFFSET 12 +#endif #define BCH_FLASHLAYOUT1_ECCN_NONE (0x0 << 12)#define BCH_FLASHLAYOUT1_ECCN_ECC2 (0x1 << 12)#define BCH_FLASHLAYOUT1_ECCN_ECC4 (0x2 << 12)
drivers/mtd/nand/mxs_nand.c +9 -2
@@ -42,6 +42,11 @@#define MXS_NAND_DMA_DESCRIPTOR_COUNT 4#define MXS_NAND_CHUNK_DATA_CHUNK_SIZE 512 +#if defined(CONFIG_MX6 ) +#define MXS_NAND_CHUNK_DATA_CHUNK_SIZE_SHIFT 2 +#else +#define MXS_NAND_CHUNK_DATA_CHUNK_SIZE_SHIFT 0 +#endif #define MXS_NAND_METADATA_SIZE 10#define MXS_NAND_COMMAND_BUFFER_SIZE 32
@@ -982,14 +987,16 @@ static int mxs_nand_scan_bbt(struct mtd_info *mtd) tmp |=MXS_NAND_METADATA_SIZE <<BCH_FLASHLAYOUT0_META_SIZE_OFFSET ; tmp |= (mxs_nand_get_ecc_strength (mtd->writesize, mtd->oobsize) >>1 ) <<BCH_FLASHLAYOUT0_ECC0_OFFSET ; - tmp |=MXS_NAND_CHUNK_DATA_CHUNK_SIZE ; + tmp |=MXS_NAND_CHUNK_DATA_CHUNK_SIZE + >>MXS_NAND_CHUNK_DATA_CHUNK_SIZE_SHIFT ;writel (tmp, &bch_regs->hw_bch_flash0layout0); tmp = (mtd->writesize + mtd->oobsize) <<BCH_FLASHLAYOUT1_PAGE_SIZE_OFFSET ; tmp |= (mxs_nand_get_ecc_strength (mtd->writesize, mtd->oobsize) >>1 ) <<BCH_FLASHLAYOUT1_ECCN_OFFSET ; - tmp |=MXS_NAND_CHUNK_DATA_CHUNK_SIZE ; + tmp |=MXS_NAND_CHUNK_DATA_CHUNK_SIZE + >>MXS_NAND_CHUNK_DATA_CHUNK_SIZE_SHIFT ;writel (tmp, &bch_regs->hw_bch_flash0layout1);/* Set *all* chip selects to use layout 0 */
Signature · 1 line
1.8.2.1
PATCH 4/4 mtd: mxs_nand: Add support for i.MX6
Quoted 16 lines · Stefan Roese
Signed-off-by Stefan Roese <[email protected]>Cc Stefano Babic <[email protected]>Cc Marek Vasut <[email protected]>Cc Fabio Estevam <[email protected]>Cc Scott Wood <[email protected]>--- arch/arm/cpu/armv7/mx6/soc.c | 7 +++++++ arch/arm/include/asm/imx-common/regs-bch.h | 10 ++++++++++ drivers/mtd/nand/mxs_nand.c | 11 +++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-)arch/arm/cpu/armv7/mx6/soc.c +0
-0
[snip]
Quoted 1 line
+#ifdef
CONFIG_APBH_DMA
This tab should be a space.
drivers/mtd/nand/mxs_nand.c
Quoted 4 lines
drivers/mtd/nand/mxs_nand.c +0
-0
The drives/mtd/nand change is:
-Scott
PATCH v2 4/4 mtd: mxs_nand: Add support for i.MX6
In reply to Stefan Roese---
v2:
- Changed tab to space after "#ifdef"
Scott, is it okay for you if Stefano pulls this patchset via his ARM/imx repository? As it touches mainly ARM related bits and the MTD driver change is quite small (I have added your Acked-by to this patch version)?
Thanks,
Stefan
arch/arm/cpu/armv7/mx6/soc.c | 7 +++++++ arch/arm/include/asm/imx-common/regs-bch.h | 10 ++++++++++ drivers/mtd/nand/mxs_nand.c | 11 +++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-)
arch/arm/cpu/armv7/mx6/soc.c +7 -0
@@ -30,6 +30,7 @@#include <asm/arch/clock.h> #include <asm/arch/sys_proto.h> #include <asm/imx-common/boot_mode.h> +#include <asm/imx-common/dma.h> #include <stdbool.h> struct scu_regs {
@@ -151,6 +152,12 @@ int arch_cpu_init(void)set_vddsoc (1200 );/* Set VDDSOC to 1.2V */ imx_set_wdog_powerdown (false);/* Disable PDE bit of WMCR register */ + +#ifdef CONFIG_APBH_DMA +/* Start APBH DMA */ +mxs_dma_init (); +#endif +return 0 ; }
arch/arm/include/asm/imx-common/regs-bch.h +10 -0
@@ -136,8 +136,13 @@ struct mxs_bch_regs {#define BCH_FLASHLAYOUT0_NBLOCKS_OFFSET 24#define BCH_FLASHLAYOUT0_META_SIZE_MASK (0xff << 16)#define BCH_FLASHLAYOUT0_META_SIZE_OFFSET 16 +#if defined(CONFIG_MX6 ) +#define BCH_FLASHLAYOUT0_ECC0_MASK (0x1f << 11) +#define BCH_FLASHLAYOUT0_ECC0_OFFSET 11 +#else #define BCH_FLASHLAYOUT0_ECC0_MASK (0xf << 12)#define BCH_FLASHLAYOUT0_ECC0_OFFSET 12 +#endif #define BCH_FLASHLAYOUT0_ECC0_NONE (0x0 << 12)#define BCH_FLASHLAYOUT0_ECC0_ECC2 (0x1 << 12)#define BCH_FLASHLAYOUT0_ECC0_ECC4 (0x2 << 12)
@@ -161,8 +166,13 @@ struct mxs_bch_regs {#define BCH_FLASHLAYOUT1_PAGE_SIZE_MASK (0xffff << 16)#define BCH_FLASHLAYOUT1_PAGE_SIZE_OFFSET 16 +#if defined(CONFIG_MX6 ) +#define BCH_FLASHLAYOUT1_ECCN_MASK (0x1f << 11) +#define BCH_FLASHLAYOUT1_ECCN_OFFSET 11 +#else #define BCH_FLASHLAYOUT1_ECCN_MASK (0xf << 12)#define BCH_FLASHLAYOUT1_ECCN_OFFSET 12 +#endif #define BCH_FLASHLAYOUT1_ECCN_NONE (0x0 << 12)#define BCH_FLASHLAYOUT1_ECCN_ECC2 (0x1 << 12)#define BCH_FLASHLAYOUT1_ECCN_ECC4 (0x2 << 12)
drivers/mtd/nand/mxs_nand.c +9 -2
@@ -42,6 +42,11 @@#define MXS_NAND_DMA_DESCRIPTOR_COUNT 4#define MXS_NAND_CHUNK_DATA_CHUNK_SIZE 512 +#if defined(CONFIG_MX6 ) +#define MXS_NAND_CHUNK_DATA_CHUNK_SIZE_SHIFT 2 +#else +#define MXS_NAND_CHUNK_DATA_CHUNK_SIZE_SHIFT 0 +#endif #define MXS_NAND_METADATA_SIZE 10#define MXS_NAND_COMMAND_BUFFER_SIZE 32
@@ -982,14 +987,16 @@ static int mxs_nand_scan_bbt(struct mtd_info *mtd) tmp |=MXS_NAND_METADATA_SIZE <<BCH_FLASHLAYOUT0_META_SIZE_OFFSET ; tmp |= (mxs_nand_get_ecc_strength (mtd->writesize, mtd->oobsize) >>1 ) <<BCH_FLASHLAYOUT0_ECC0_OFFSET ; - tmp |=MXS_NAND_CHUNK_DATA_CHUNK_SIZE ; + tmp |=MXS_NAND_CHUNK_DATA_CHUNK_SIZE + >>MXS_NAND_CHUNK_DATA_CHUNK_SIZE_SHIFT ;writel (tmp, &bch_regs->hw_bch_flash0layout0); tmp = (mtd->writesize + mtd->oobsize) <<BCH_FLASHLAYOUT1_PAGE_SIZE_OFFSET ; tmp |= (mxs_nand_get_ecc_strength (mtd->writesize, mtd->oobsize) >>1 ) <<BCH_FLASHLAYOUT1_ECCN_OFFSET ; - tmp |=MXS_NAND_CHUNK_DATA_CHUNK_SIZE ; + tmp |=MXS_NAND_CHUNK_DATA_CHUNK_SIZE + >>MXS_NAND_CHUNK_DATA_CHUNK_SIZE_SHIFT ;writel (tmp, &bch_regs->hw_bch_flash0layout1);/* Set *all* chip selects to use layout 0 */
Signature · 1 line
1.8.2.1
PATCH v2 4/4 mtd: mxs_nand: Add support for i.MX6
Quoted 5 lines · Stefan Roese
Signed-off-by Stefan Roese <[email protected]>Acked-by Scott Wood <[email protected]>Cc Stefano Babic <[email protected]>Cc Marek Vasut <[email protected]>Cc Fabio Estevam <[email protected]>
Quoted 8 lines
---
v2:
- Changed tab to space after "#ifdef"Scott, is it okay for you if Stefano pulls this patchset via his ARM/imx repository? As it touches mainly ARM related bits and the MTD driver change is quite small (I have added your Acked-by to this patch version)?
Yes, it's fine. I'd have responded sooner if I were on CC. :-)
-Scott
cover imx: Add iMX6 NAND support
In reply to Stefan RoeseDear Stefan Roese,
Quoted 5 lines
To support NAND on the iMX6 this patch moves some headers into i.MX common locations. Instead of creating new files in the imx6 include directory containing nearly the same content.
Here the diffstat:
They look reasonable, can you give them a test on m28evk please?
Best regards,
Marek Vasut
cover imx: Add iMX6 NAND support
Hi Marek,
Quoted 7 lines · Marek Vasut
Quoted 5 lines
To support NAND on the iMX6 this patch moves some headers into i.MX common locations. Instead of creating new files in the imx6 include directory containing nearly the same content.
Here the diffstat:
They look reasonable, can you give them a test on m28evk please?
Yes. Unfortunately it doesn't boot to the prompt. But this is not a problem of my patchset. It also happens with the latest master branch:
U-Boot 2013.04-rc2-00031-gfac150e (Apr 11 2013 - 11:24:25)
CPU: Freescale i.MX28 rev1.2 at 454 MHz
Here it hangs!!! :-(
You are the m28 expert, so perhaps you might want to take a look? ;)
Thanks,
Stefan
cover imx: Add iMX6 NAND support
Dear Stefan Roese,
Quoted 13 lines
Hi Marek,
Quoted 6 lines · Marek Vasut
Quoted 5 lines
To support NAND on the iMX6 this patch moves some headers into i.MX common locations. Instead of creating new files in the imx6 include directory containing nearly the same content.
Here the diffstat:
They look reasonable, can you give them a test on m28evk please?
Yes. Unfortunately it doesn't boot to the prompt. But this is not a problem of my patchset. It also happens with the latest master branch:
Quoted 7 lines
U-Boot 2013.04-rc2-00031-gfac150e (Apr 11 2013 - 11:24:25)
CPU: Freescale i.MX28 rev1.2 at 454 MHz
Here it hangs!!! :-(
You are the m28 expert, so perhaps you might want to take a look? ;)
I just tested latest u-boot/master on M28EVK_V20 (baseboard) + M28 V2.0 (module) , works like a charm.
Best regards,
Marek Vasut