iMX23 MMC support and environment addition
Subsystems (4)
cover iMX23 MMC support and environment addition
This patchset adds MMC suuport, in PIO mode for now, to iMX23; it has been boot tested in mx23evk board. I did a brief look at DMA support but it seems not fast to implement so I would prefer to have this patchset merged so other people can start using and playing with it.
Marek Vasut (3):
mx23: Add SSP registers map
mx23: Use XFER_COUNT field in HW_SSP_CTRL0 register in MMC PIO mode
mx23_olinuxino: Add MMC support
Otavio Salvador (6):
mx23: Fix transfer size setting for SPI
mx23evk: Add initial board support
mx23_olinuxino: Skip MMC Card detection
mx23_olinuxino: Add default environment
mxs: Fix MMC reset to avoid write errors and timeout in iMX23
mx23: Use PIO mode support for MMC
arch/arm/include/asm/arch-mxs/regs-ssp.h | 28 +++ board/freescale/mx23evk/Makefile | 47 +++++ board/freescale/mx23evk/mx23evk.c | 81 +++++++++ board/freescale/mx23evk/spl_boot.c | 115 ++++++++++++ board/olimex/mx23_olinuxino/mx23_olinuxino.c | 17 +- board/olimex/mx23_olinuxino/spl_boot.c | 10 ++ boards.cfg | 1 + drivers/mmc/mxsmmc.c | 50 ++++-- drivers/spi/mxs_spi.c | 5 + include/configs/mx23_olinuxino.h | 103 ++++++++++- include/configs/mx23evk.h | 252 +++++++++++++++++++++++++++ 11 files changed, 697 insertions(+), 12 deletions(-) create mode 100644 board/freescale/mx23evk/Makefile create mode 100644 board/freescale/mx23evk/mx23evk.c create mode 100644 board/freescale/mx23evk/spl_boot.c create mode 100644 include/configs/mx23evk.h
Signature · 1 line
1.8.1
PATCH 1/9 mx23: Add SSP registers map
From: Marek Vasut <[email protected]>
--- arch/arm/include/asm/arch-mxs/regs-ssp.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
arch/arm/include/asm/arch-mxs/regs-ssp.h +28 -0
@@ -28,6 +28,28 @@#include <asm/arch/regs-common.h> #ifndef __ASSEMBLY__ +#if defined(CONFIG_MX23) +struct mxs_ssp_regs { + mxs_reg_32(hw_ssp_ctrl0) + mxs_reg_32(hw_ssp_cmd0) + mxs_reg_32(hw_ssp_cmd1) + mxs_reg_32(hw_ssp_compref) + mxs_reg_32(hw_ssp_compmask) + mxs_reg_32(hw_ssp_timing) + mxs_reg_32(hw_ssp_ctrl1) + mxs_reg_32(hw_ssp_data) + mxs_reg_32(hw_ssp_sdresp0) + mxs_reg_32(hw_ssp_sdresp1) + mxs_reg_32(hw_ssp_sdresp2) + mxs_reg_32(hw_ssp_sdresp3) + mxs_reg_32(hw_ssp_status) + + uint32_t reserved1[12]; + + mxs_reg_32(hw_ssp_debug) + mxs_reg_32(hw_ssp_version) +}; +#elif defined(CONFIG_MX28) struct mxs_ssp_regs { mxs_reg_32(hw_ssp_ctrl0) mxs_reg_32(hw_ssp_cmd0)
@@ -50,6 +72,7 @@ struct mxs_ssp_regs { mxs_reg_32(hw_ssp_debug) mxs_reg_32(hw_ssp_version) }; +#endif static inline struct mxs_ssp_regs *mxs_ssp_regs_by_bus (unsigned int port) {
@@ -90,6 +113,11 @@ static inline struct mxs_ssp_regs *mxs_ssp_regs_by_bus(unsigned int port)#define SSP_CTRL0_GET_RESP (1 << 17)#define SSP_CTRL0_ENABLE (1 << 16) +#ifdef CONFIG_MX23 +#define SSP_CTRL0_XFER_COUNT_OFFSET 0 +#define SSP_CTRL0_XFER_COUNT_MASK 0xffff +#endif +#define SSP_CMD0_SOFT_TERMINATE (1 << 26)#define SSP_CMD0_DBL_DATA_RATE_EN (1 << 25)#define SSP_CMD0_PRIM_BOOT_OP_EN (1 << 24)
Signature · 1 line
1.8.1
PATCH 2/9 mx23: Use XFER_COUNT field in HW_SSP_CTRL0 register in MMC PIO mode
In reply to Otavio SalvadorFrom: Marek Vasut <[email protected]>
--- drivers/mmc/mxsmmc.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-)
drivers/mmc/mxsmmc.c +21 -3
@@ -211,14 +211,32 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data) } ctrl0 |=SSP_CTRL0_DATA_XFER ; + + reg = data->blocksize * data->blocks; +#if defined(CONFIG_MX23 ) +if (reg & ~SSP_CTRL0_XFER_COUNT_MASK ) { +printf ("MMC%d: Transfer too large (%i bytes)!\n" , + mmc->block_dev.dev, reg); +return -EINVAL ; + } + + ctrl0 |= reg &SSP_CTRL0_XFER_COUNT_MASK ; + + reg =readl (&ssp_regs->hw_ssp_cmd0); + reg &= ~0xfff00 ; + reg |= (data->blocks -1 ) <<8 ; + reg |= (ffs (data->blocksize) -1 ) <<16 ; + +writel (reg, &ssp_regs->hw_ssp_cmd0); +#elif defined(CONFIG_MX28 ) +writel (reg, &ssp_regs->hw_ssp_xfer_size); + reg = ((data->blocks -1 ) <<SSP_BLOCK_SIZE_BLOCK_COUNT_OFFSET ) | ((ffs (data->blocksize) -1 ) <<SSP_BLOCK_SIZE_BLOCK_SIZE_OFFSET );writel (reg, &ssp_regs->hw_ssp_block_size); - - reg = data->blocksize * data->blocks; -writel (reg, &ssp_regs->hw_ssp_xfer_size); +#endif }/* Kick off the command */
Signature · 1 line
1.8.1
PATCH 2/9 mx23: Use XFER_COUNT field in HW_SSP_CTRL0 register in MMC PIO mode
Dear Otavio Salvador,
Quoted 21 lines
From: Marek Vasut <[email protected]>
Signed-off-by Marek Vasut <[email protected]>Signed-off-by Otavio Salvador <[email protected]>--- drivers/mmc/mxsmmc.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-)drivers/mmc/mxsmmc.c +5
-0@@ -211,14 +211,32 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data) } ctrl0 |=SSP_CTRL0_DATA_XFER ; + + reg = data->blocksize * data->blocks; +#if defined(CONFIG_MX23 ) +if (reg & ~SSP_CTRL0_XFER_COUNT_MASK ) { + printf("MMC%d: Transfer too large (%i bytes)!\n",
drivers/mmc/mxsmmc.c mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, · line 228
Quoted 10 lines
drivers/mmc/mxsmmc.c +10
-0+ mmc->block_dev.dev, reg); +return -EINVAL ; + } + + ctrl0 |= reg &SSP_CTRL0_XFER_COUNT_MASK ; + + reg =readl (&ssp_regs->hw_ssp_cmd0); + reg &= ~0xfff00 ; + reg |= (data->blocks -1 ) <<8 ; + reg |= (ffs (data->blocksize) -1 ) <<16 ;
This is using some random hard-coded offsets, I told you numerous times I will NAK this.
Sorry.
Best regards,
Marek Vasut
PATCH 2/9 mx23: Use XFER_COUNT field in HW_SSP_CTRL0 register in MMC PIO mode
Quoted 28 lines · Marek Vasut
Dear Otavio Salvador,
Quoted 26 lines
From: Marek Vasut <[email protected]>
Signed-off-by Marek Vasut <[email protected]>Signed-off-by Otavio Salvador <[email protected]>--- drivers/mmc/mxsmmc.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-)drivers/mmc/mxsmmc.c +10
-0@@ -211,14 +211,32 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data) } ctrl0 |=SSP_CTRL0_DATA_XFER ; + + reg = data->blocksize * data->blocks; +#if defined(CONFIG_MX23 ) +if (reg & ~SSP_CTRL0_XFER_COUNT_MASK ) { +printf ("MMC%d: Transfer too large (%i bytes)!\n" , + mmc->block_dev.dev, reg); +return -EINVAL ; + } + + ctrl0 |= reg &SSP_CTRL0_XFER_COUNT_MASK ;
Quoted 8 lines
drivers/mmc/mxsmmc.c mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data) · line 228
Quoted 5 lines
drivers/mmc/mxsmmc.c +5
-0+ + reg =readl (&ssp_regs->hw_ssp_cmd0); + reg &= ~0xfff00 ; + reg |= (data->blocks -1 ) <<8 ; + reg |= (ffs (data->blocksize) -1 ) <<16 ;This is using some random hard-coded offsets, I told you numerous times I will NAK this.
It is your patch ;-) So ...
--
Otavio Salvador O.S. Systems
E-mail: otavio at ossystems.com.br http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br
PATCH 2/9 mx23: Use XFER_COUNT field in HW_SSP_CTRL0 register in MMC PIO mode
Dear Otavio Salvador,
Quoted 40 lines · Marek Vasut
Quoted 30 lines
Dear Otavio Salvador,
Quoted 28 lines
From: Marek Vasut <[email protected]>
Signed-off-by Marek Vasut <[email protected]>Signed-off-by Otavio Salvador <[email protected]>---
drivers/mmc/mxsmmc.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-)drivers/mmc/mxsmmc.c +10
-0@@ -211,14 +211,32 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data) } ctrl0 |=SSP_CTRL0_DATA_XFER ; + + reg = data->blocksize * data->blocks; +#if defined(CONFIG_MX23 ) +if (reg & ~SSP_CTRL0_XFER_COUNT_MASK ) { +printf ("MMC%d: Transfer too large (%i bytes)!\n" , + mmc->block_dev.dev, reg); +return -EINVAL ; + } + + ctrl0 |= reg &SSP_CTRL0_XFER_COUNT_MASK ;Quoted 8 lines
drivers/mmc/mxsmmc.c mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data) · line 228
Quoted 5 lines
drivers/mmc/mxsmmc.c +5
-0+ + reg =readl (&ssp_regs->hw_ssp_cmd0); + reg &= ~0xfff00 ; + reg |= (data->blocks -1 ) <<8 ; + reg |= (ffs (data->blocksize) -1 ) <<16 ;This is using some random hard-coded offsets, I told you numerous times I will NAK this.
Quoted 1 line
It is your patch ;-) So ...
So I'll NAK it. I have no problem with it. Besides, this is only based on my work, but whatever.
Best regards,
Marek Vasut
PATCH 3/9 mx23: Fix transfer size setting for SPI
In reply to Otavio Salvador--- drivers/spi/mxs_spi.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/spi/mxs_spi.c +5 -0
@@ -167,8 +167,13 @@ static int mxs_spi_xfer_pio(struct mxs_spi_slave *slave,mxs_spi_start_xfer (ssp_regs);while (length--) { +#if defined(CONFIG_MX23 ) +writel (SSP_CTRL0_XFER_COUNT_MASK , &ssp_regs->hw_ssp_ctrl0_clr); +writel (1 , &ssp_regs->hw_ssp_ctrl0_set); +#elif defined(CONFIG_MX28 )/* We transfer 1 byte */ writel (1 , &ssp_regs->hw_ssp_xfer_size); +#endif if ((flags &SPI_XFER_END ) && !length)mxs_spi_end_xfer (ssp_regs);
Signature · 1 line
1.8.1
PATCH 3/9 mx23: Fix transfer size setting for SPI
Dear Otavio Salvador,
Description missing. Was this ever tested? Does SSP DMA work?
Quoted 13 lines
Signed-off-by Otavio Salvador <[email protected]>--- drivers/spi/mxs_spi.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/spi/mxs_spi.c +0
-0@@ -167,8 +167,13 @@ static int mxs_spi_xfer_pio(struct mxs_spi_slave *slave,mxs_spi_start_xfer (ssp_regs);while (length--) {
drivers/spi/mxs_spi.c static int mxs_spi_xfer_pio(struct mxs_spi_slave · line 179
Quoted 10 lines
drivers/spi/mxs_spi.c +5
-0+#if defined(CONFIG_MX23 ) +writel (SSP_CTRL0_XFER_COUNT_MASK , &ssp_regs->hw_ssp_ctrl0_clr); +writel (1 , &ssp_regs->hw_ssp_ctrl0_set); +#elif defined(CONFIG_MX28 )/* We transfer 1 byte */ writel (1 , &ssp_regs->hw_ssp_xfer_size); +#endif if ((flags &SPI_XFER_END ) && !length)mxs_spi_end_xfer (ssp_regs);
Best regards,
Marek Vasut
PATCH 3/9 mx23: Fix transfer size setting for SPI
Quoted 5 lines · Marek Vasut
Dear Otavio Salvador,
Description missing. Was this ever tested? Does SSP DMA work?
Quoted 1 line
Signed-off-by Otavio Salvador <[email protected]>
No; I did not test it as NAND support is not yet done but this was need to get it going. This is exactly same code as done in v3.7 kernel so seems fine.
What you want added in description?
--
Otavio Salvador O.S. Systems
E-mail: otavio at ossystems.com.br http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br
PATCH 3/9 mx23: Fix transfer size setting for SPI
Dear Otavio Salvador,
Quoted 10 lines · Marek Vasut
Quoted 5 lines
Dear Otavio Salvador,
Description missing. Was this ever tested? Does SSP DMA work?
Quoted 1 line
Signed-off-by Otavio Salvador <[email protected]>No; I did not test it as NAND support is not yet done but this was need to get it going. This is exactly same code as done in v3.7 kernel so seems fine.
SPI has nothing to do with NAND. Please at least test code or clearly state the code was untested.
Quoted 1 line
What you want added in description?
What this patch does.
Best regards,
Marek Vasut
Marek Vasut
NAKPATCH 3/9 mx23: Fix transfer size setting for SPI
In reply to Otavio SalvadorDear Otavio Salvador,
NAK, this won't work. SSP0 DMA has this +1 offset in it's channel placement (so SSP0 DMA channel is actually channel 1), check the MMC patch.
Quoted 13 lines
Signed-off-by Otavio Salvador <[email protected]>--- drivers/spi/mxs_spi.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/spi/mxs_spi.c +0
-0@@ -167,8 +167,13 @@ static int mxs_spi_xfer_pio(struct mxs_spi_slave *slave,mxs_spi_start_xfer (ssp_regs);while (length--) {
drivers/spi/mxs_spi.c static int mxs_spi_xfer_pio(struct mxs_spi_slave · line 179
Quoted 10 lines
drivers/spi/mxs_spi.c +5
-0+#if defined(CONFIG_MX23 ) +writel (SSP_CTRL0_XFER_COUNT_MASK , &ssp_regs->hw_ssp_ctrl0_clr); +writel (1 , &ssp_regs->hw_ssp_ctrl0_set); +#elif defined(CONFIG_MX28 )/* We transfer 1 byte */ writel (1 , &ssp_regs->hw_ssp_xfer_size); +#endif if ((flags &SPI_XFER_END ) && !length)mxs_spi_end_xfer (ssp_regs);
Best regards,
Marek Vasut
PATCH 4/9 mx23evk: Add initial board support
In reply to Otavio Salvador--- board/freescale/mx23evk/Makefile | 47 +++++++ board/freescale/mx23evk/mx23evk.c | 81 ++++++++++++ board/freescale/mx23evk/spl_boot.c | 115 +++++++++++++++++ boards.cfg | 1 + include/configs/mx23evk.h | 252 +++++++++++++++++++++++++++++++++++++ 5 files changed, 496 insertions(+) create mode 100644 board/freescale/mx23evk/Makefile create mode 100644 board/freescale/mx23evk/mx23evk.c create mode 100644 board/freescale/mx23evk/spl_boot.c create mode 100644 include/configs/mx23evk.h
board/freescale/mx23evk/Makefile new file +47 -0
@@ -0,0 +1,47 @@ +# +# (C) Copyright 2000-2006 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. +# +# See file CREDITS for list of people who contributed to this +# project. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(BOARD).o + +ifndef CONFIG_SPL_BUILD +COBJS := mx23evk.o +else +COBJS := spl_boot.o +endif + +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) + +$(LIB): $(obj).depend $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################
board/freescale/mx23evk/mx23evk.c new file +81 -0
81 lines not on this page · raw message
board/freescale/mx23evk/spl_boot.c new file +115 -0
115 lines not on this page · raw message
boards.cfg +1 -0
@@ -193,6 +193,7 @@ imx27lite arm arm926ejs imx27lite logicpd magnesium arm arm926ejs imx27lite logicpd mx27 mx23_olinuxino arm arm926ejs mx23_olinuxino olimex mxs mx23_olinuxino apx4devkit arm arm926ejs apx4devkit bluegiga mxs apx4devkit +mx23evk arm arm926ejs mx23evk freescale mxs mx23evk m28evk arm arm926ejs m28evk denx mxs m28evk mx28evk arm arm926ejs mx28evk freescale mxs mx28evk sc_sps_1 arm arm926ejs sc_sps_1 schulercontrol mxs
include/configs/mx23evk.h new file +252 -0
252 lines not on this page · raw message
Signature · 1 line
1.8.1
PATCH 4/9 mx23evk: Add initial board support
Dear Otavio Salvador,
This should not be a part of the patchset. Description is missing.
Best regards,
Marek Vasut
PATCH 4/9 mx23evk: Add initial board support
Quoted 3 lines · Marek Vasut
Dear Otavio Salvador,
This should not be a part of the patchset. Description is missing.
Well, this is the first version of the board support. I see no better description for it.
--
Otavio Salvador O.S. Systems
E-mail: otavio at ossystems.com.br http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br
PATCH 4/9 mx23evk: Add initial board support
Dear Otavio Salvador,
Quoted 7 lines · Marek Vasut
Quoted 3 lines
Dear Otavio Salvador,
This should not be a part of the patchset. Description is missing.
Well, this is the first version of the board support. I see no better description for it.
Check other patches adding boards then please. Description of the board is sufficient.
Best regards,
Marek Vasut
Fabio Estevam
reviewerPATCH 4/9 mx23evk: Add initial board support
In reply to Otavio SalvadorQuoted 12 lines · Otavio Salvador
Signed-off-by Otavio Salvador <[email protected]>--- board/freescale/mx23evk/Makefile | 47 +++++++ board/freescale/mx23evk/mx23evk.c | 81 ++++++++++++ board/freescale/mx23evk/spl_boot.c | 115 +++++++++++++++++ boards.cfg | 1 + include/configs/mx23evk.h | 252 +++++++++++++++++++++++++++++++++++++ 5 files changed, 496 insertions(+) create mode 100644 board/freescale/mx23evk/Makefile create mode 100644 board/freescale/mx23evk/mx23evk.c create mode 100644 board/freescale/mx23evk/spl_boot.c create mode 100644 include/configs/mx23evk.h
An entry to MAINTAINERS file is missing.
include/configs/mx23evk.h line 169
Quoted 10 lines
include/configs/mx23evk.h new file +10
-0+/* +* USB +*/ +#ifdef CONFIG_CMD_USB +#define CONFIG_USB_EHCI +#define CONFIG_USB_EHCI_MXS +#define CONFIG_EHCI_MXS_PORT 1 +#define CONFIG_EHCI_IS_TDI +#define CONFIG_USB_STORAGE +#endif
Is USB functional? If not, please remove this.
PATCH 4/9 mx23evk: Add initial board support
Dear Fabio Estevam,
Quoted 20 lines
On Mon, Jan 21, 2013 at 11:47 PM, Otavio Salvador
Quoted 14 lines · <[email protected]> wrote:
Signed-off-by Otavio Salvador <[email protected]>---
board/freescale/mx23evk/Makefile | 47 +++++++ board/freescale/mx23evk/mx23evk.c | 81 ++++++++++++ board/freescale/mx23evk/spl_boot.c | 115 +++++++++++++++++ boards.cfg | 1 + include/configs/mx23evk.h | 252 +++++++++++++++++++++++++++++++++++++ 5 files changed, 496 insertions(+) create mode 100644 board/freescale/mx23evk/Makefile create mode 100644 board/freescale/mx23evk/mx23evk.c create mode 100644 board/freescale/mx23evk/spl_boot.c create mode 100644 include/configs/mx23evk.hAn entry to
MAINTAINERSfile is missing.
Quoted 12 lines
include/configs/mx23evk.h line 169
Quoted 10 lines
include/configs/mx23evk.h new file +10
-0+/* +* USB +*/ +#ifdef CONFIG_CMD_USB +#define CONFIG_USB_EHCI +#define CONFIG_USB_EHCI_MXS +#define CONFIG_EHCI_MXS_PORT 1 +#define CONFIG_EHCI_IS_TDI +#define CONFIG_USB_STORAGE +#endif Is USB functional? If not, please remove this.
I don't think so ... besides, MX23 has only one USB port. How can this even compile if USBPHY1 and such values are undefined?
Best regards,
Marek Vasut
PATCH 4/9 mx23evk: Add initial board support
In reply to Fabio EstevamQuoted 15 lines · Fabio Estevam
Quoted 12 lines · Otavio Salvador
Signed-off-by Otavio Salvador <[email protected]>--- board/freescale/mx23evk/Makefile | 47 +++++++ board/freescale/mx23evk/mx23evk.c | 81 ++++++++++++ board/freescale/mx23evk/spl_boot.c | 115 +++++++++++++++++ boards.cfg | 1 + include/configs/mx23evk.h | 252 +++++++++++++++++++++++++++++++++++++ 5 files changed, 496 insertions(+) create mode 100644 board/freescale/mx23evk/Makefile create mode 100644 board/freescale/mx23evk/mx23evk.c create mode 100644 board/freescale/mx23evk/spl_boot.c create mode 100644 include/configs/mx23evk.h
Quoted 1 line
An entry to
MAINTAINERSfile is missing.
Right.
Quoted 4 lines
Quoted 4 lines
include/configs/mx23evk.h new file +4
-0+/* +* USB +*/ +#ifdef CONFIG_CMD_USB
Quoted 8 lines
include/configs/mx23evk.h line 169
Quoted 6 lines
include/configs/mx23evk.h new file +6
-0+#define CONFIG_USB_EHCI +#define CONFIG_USB_EHCI_MXS +#define CONFIG_EHCI_MXS_PORT 1 +#define CONFIG_EHCI_IS_TDI +#define CONFIG_USB_STORAGE +#endif Is USB functional? If not, please remove this.
It is not; will check if I can drop it.
--
Otavio Salvador O.S. Systems
E-mail: otavio at ossystems.com.br http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br
PATCH 5/9 mx23_olinuxino: Add MMC support
In reply to Otavio SalvadorFrom: Marek Vasut <[email protected]>
--- board/olimex/mx23_olinuxino/mx23_olinuxino.c | 17 ++++++++++++++++- board/olimex/mx23_olinuxino/spl_boot.c | 10 ++++++++++ include/configs/mx23_olinuxino.h | 12 ++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-)
board/olimex/mx23_olinuxino/mx23_olinuxino.c +16 -1
@@ -23,7 +23,10 @@*/ #include <common.h> +#include <asm/io.h> +#include <asm/arch/iomux-mx23.h> #include <asm/arch/imx-regs.h> +#include <asm/arch/clock.h> #include <asm/arch/sys_proto.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -33,7 +36,12 @@ DECLARE_GLOBAL_DATA_PTR;*/ int board_early_init_f (void ) { -/* SSP clock init will come here soon. */ +/* IO0 clock at 480MHz */ +mxs_set_ioclk (MXC_IOCLK0 ,480000 ); + +/* SSP0 clock at 96MHz */ +mxs_set_sspclk (MXC_SSPCLK0 ,96000 ,0 ); +return 0 ; }
@@ -42,6 +50,13 @@ int dram_init(void)return mxs_dram_init (); } +#ifdef CONFIG_CMD_MMC +int board_mmc_init (bd_t *bis) +{ +return mxsmmc_initialize (bis,0 ,NULL ); +} +#endif +int board_init (void ) {/* Adress of boot parameters */
board/olimex/mx23_olinuxino/spl_boot.c +10 -0
@@ -30,6 +30,7 @@#include <asm/arch/sys_proto.h> #define MUX_CONFIG_EMI (MXS_PAD_3V3 | MXS_PAD_12MA | MXS_PAD_NOPULL) +#define MUX_CONFIG_SSP (MXS_PAD_3V3 | MXS_PAD_8MA | MXS_PAD_PULLUP)const iomux_cfg_t iomux_setup[] = {/* DUART */
@@ -82,6 +83,15 @@ const iomux_cfg_t iomux_setup[] = {MX23_PAD_EMI_CKE__EMI_CKE |MUX_CONFIG_EMI ,MX23_PAD_EMI_RASN__EMI_RASN |MUX_CONFIG_EMI ,MX23_PAD_EMI_WEN__EMI_WEN |MUX_CONFIG_EMI , + +/* MMC 0 */ +MX23_PAD_SSP1_CMD__SSP1_CMD |MUX_CONFIG_SSP , +MX23_PAD_SSP1_DETECT__SSP1_DETECT |MUX_CONFIG_SSP , +MX23_PAD_SSP1_DATA0__SSP1_DATA0 |MUX_CONFIG_SSP , +MX23_PAD_SSP1_DATA1__SSP1_DATA1 |MUX_CONFIG_SSP , +MX23_PAD_SSP1_DATA2__SSP1_DATA2 |MUX_CONFIG_SSP , +MX23_PAD_SSP1_DATA3__SSP1_DATA3 |MUX_CONFIG_SSP , + MX23_PAD_SSP1_SCK__SSP1_SCK | MUX_CONFIG_SSP, };void board_init_ll (void )
include/configs/mx23_olinuxino.h +12 -0
@@ -53,8 +53,10 @@#define CONFIG_DOS_PARTITION #define CONFIG_CMD_CACHE +#define CONFIG_CMD_EXT2 #define CONFIG_CMD_FAT #define CONFIG_CMD_GPIO +#define CONFIG_CMD_MMC /* * Memory configurations
@@ -110,6 +112,16 @@#define CONFIG_BAUDRATE 115200/* Default baud rate */ /* +* MMC Driver +*/ +#ifdef CONFIG_CMD_MMC +#define CONFIG_MMC +#define CONFIG_BOUNCE_BUFFER +#define CONFIG_GENERIC_MMC +#define CONFIG_MXS_MMC +#endif + +/* * APBH DMA */ #define CONFIG_APBH_DMA
Signature · 1 line
1.8.1
PATCH 5/9 mx23_olinuxino: Add MMC support
Dear Otavio Salvador,
Description is missing.
Quoted 103 lines
From: Marek Vasut <[email protected]>
Signed-off-by Marek Vasut <[email protected]>--- board/olimex/mx23_olinuxino/mx23_olinuxino.c | 17 ++++++++++++++++- board/olimex/mx23_olinuxino/spl_boot.c | 10 ++++++++++ include/configs/mx23_olinuxino.h | 12 ++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/board/olimex/mx23_olinuxino/mx23_olinuxino.cindex 2fcad26..421ed9c 100644board/olimex/mx23_olinuxino/mx23_olinuxino.c +16
-1@@ -23,7 +23,10 @@*/ #include <common.h> +#include <asm/io.h> +#include <asm/arch/iomux-mx23.h> #include <asm/arch/imx-regs.h> +#include <asm/arch/clock.h> #include <asm/arch/sys_proto.h> DECLARE_GLOBAL_DATA_PTR ;@@ -33,7 +36,12 @@ DECLARE_GLOBAL_DATA_PTR;*/ int board_early_init_f (void ) { -/* SSP clock init will come here soon. */ +/* IO0 clock at 480MHz */ +mxs_set_ioclk (MXC_IOCLK0 ,480000 ); + +/* SSP0 clock at 96MHz */ +mxs_set_sspclk (MXC_SSPCLK0 ,96000 ,0 ); +return 0 ; }@@ -42,6 +50,13 @@ int dram_init(void)return mxs_dram_init (); } +#ifdef CONFIG_CMD_MMC +int board_mmc_init (bd_t *bis) +{ +return mxsmmc_initialize (bis,0 ,NULL ); +} +#endif +int board_init (void ) {/* Adress of boot parameters */ (quoted diff) +0
-0
b/board/olimex/mx23_olinuxino/spl_boot.cindex aaebe6c..3cc40cd 100644board/olimex/mx23_olinuxino/spl_boot.c +10
-0@@ -30,6 +30,7 @@#include <asm/arch/sys_proto.h> #define MUX_CONFIG_EMI (MXS_PAD_3V3 | MXS_PAD_12MA | MXS_PAD_NOPULL) +#define MUX_CONFIG_SSP (MXS_PAD_3V3 | MXS_PAD_8MA | MXS_PAD_PULLUP)const iomux_cfg_t iomux_setup[] = {/* DUART */ @@ -82,6 +83,15 @@ const iomux_cfg_t iomux_setup[] = {MX23_PAD_EMI_CKE__EMI_CKE |MUX_CONFIG_EMI ,MX23_PAD_EMI_RASN__EMI_RASN |MUX_CONFIG_EMI ,MX23_PAD_EMI_WEN__EMI_WEN |MUX_CONFIG_EMI , + +/* MMC 0 */ +MX23_PAD_SSP1_CMD__SSP1_CMD |MUX_CONFIG_SSP , +MX23_PAD_SSP1_DETECT__SSP1_DETECT |MUX_CONFIG_SSP , +MX23_PAD_SSP1_DATA0__SSP1_DATA0 |MUX_CONFIG_SSP , +MX23_PAD_SSP1_DATA1__SSP1_DATA1 |MUX_CONFIG_SSP , +MX23_PAD_SSP1_DATA2__SSP1_DATA2 |MUX_CONFIG_SSP , +MX23_PAD_SSP1_DATA3__SSP1_DATA3 |MUX_CONFIG_SSP , + MX23_PAD_SSP1_SCK__SSP1_SCK | MUX_CONFIG_SSP, };void board_init_ll (void )(quoted diff) +0
-0
b/include/configs/mx23_olinuxino.hindex e5e718c..bc63481 100644include/configs/mx23_olinuxino.h +5
-0@@ -53,8 +53,10 @@#define CONFIG_DOS_PARTITION #define CONFIG_CMD_CACHE +#define CONFIG_CMD_EXT2 #define CONFIG_CMD_FAT #define CONFIG_CMD_GPIO +#define CONFIG_CMD_MMC /* * Memory configurations @@ -110,6 +112,16 @@#define CONFIG_BAUDRATE 115200/* Default baud rate */ /* +* MMC Driver +*/ +#ifdef CONFIG_CMD_MMC
include/configs/mx23_olinuxino.h line 127
Quoted 10 lines
include/configs/mx23_olinuxino.h +7
-0+#define CONFIG_MMC +#define CONFIG_BOUNCE_BUFFER +#define CONFIG_GENERIC_MMC +#define CONFIG_MXS_MMC +#endif + +/* * APBH DMA */ #define CONFIG_APBH_DMA
Best regards,
Marek Vasut
PATCH 5/9 mx23_olinuxino: Add MMC support
Quoted 7 lines · Marek Vasut
Dear Otavio Salvador,
Description is missing.
Quoted 3 lines
From: Marek Vasut <[email protected]>
Signed-off-by Marek Vasut <[email protected]>
Please provide me the description you wish and I amend it.
--
Otavio Salvador O.S. Systems
E-mail: otavio at ossystems.com.br http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br
PATCH 6/9 mx23_olinuxino: Skip MMC Card detection
In reply to Otavio Salvador--- drivers/mmc/mxsmmc.c | 2 ++ include/configs/mx23_olinuxino.h | 1 + 2 files changed, 3 insertions(+)
drivers/mmc/mxsmmc.c +2 -0
@@ -165,11 +165,13 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)return TIMEOUT ; } +#ifndef CONFIG_MMC_SKIP_CARD_DETECT /* See if card is present */ if (readl (&ssp_regs->hw_ssp_status) &SSP_STATUS_CARD_DETECT ) {printf ("MMC%d: No card detected!\n" , mmc->block_dev.dev);return NO_CARD_ERR ; } +#endif /* Start building CTRL0 contents */ ctrl0 = priv->buswidth;
include/configs/mx23_olinuxino.h +1 -0
@@ -116,6 +116,7 @@*/ #ifdef CONFIG_CMD_MMC #define CONFIG_MMC +#define CONFIG_MMC_SKIP_CARD_DETECT #define CONFIG_BOUNCE_BUFFER #define CONFIG_GENERIC_MMC #define CONFIG_MXS_MMC
Signature · 1 line
1.8.1
PATCH 6/9 mx23_olinuxino: Skip MMC Card detection
Dear Otavio Salvador,
Quoted 11 lines
Signed-off-by Otavio Salvador <[email protected]>--- drivers/mmc/mxsmmc.c | 2 ++ include/configs/mx23_olinuxino.h | 1 + 2 files changed, 3 insertions(+)drivers/mmc/mxsmmc.c +0
-0
drivers/mmc/mxsmmc.c mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, · line 168
Quoted 4 lines
drivers/mmc/mxsmmc.c +1
-0@@ -165,11 +165,13 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data) return TIMEOUT; } +#ifndef CONFIG_MMC_SKIP_CARD_DETECT
Undocumented feature added. I think mxsmmc_register() call can take a param for this.
Best regards,
Marek Vasut
PATCH 6/9 mx23_olinuxino: Skip MMC Card detection
Quoted 16 lines · Marek Vasut
Dear Otavio Salvador,
Quoted 14 lines
Signed-off-by Otavio Salvador <[email protected]>--- drivers/mmc/mxsmmc.c | 2 ++ include/configs/mx23_olinuxino.h | 1 + 2 files changed, 3 insertions(+)drivers/mmc/mxsmmc.c +0
-0@@ -165,11 +165,13 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data) return TIMEOUT; }
Quoted 4 lines
drivers/mmc/mxsmmc.c mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data) · line 168
Quoted 1 line
drivers/mmc/mxsmmc.c +1
-0+#ifndef CONFIG_MMC_SKIP_CARD_DETECT Undocumented feature added. I think
mxsmmc_register()call can take a param for this.
Where I should document it? mmc_register cannot.
--
Otavio Salvador O.S. Systems
E-mail: otavio at ossystems.com.br http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br
PATCH 6/9 mx23_olinuxino: Skip MMC Card detection
Dear Otavio Salvador,
Quoted 17 lines · Marek Vasut
Quoted 16 lines
Dear Otavio Salvador,
Quoted 14 lines
Signed-off-by Otavio Salvador <[email protected]>---
drivers/mmc/mxsmmc.c | 2 ++ include/configs/mx23_olinuxino.h | 1 + 2 files changed, 3 insertions(+)drivers/mmc/mxsmmc.c +0
-0@@ -165,11 +165,13 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data) return TIMEOUT;
Quoted 8 lines
Quoted 6 lines
drivers/mmc/mxsmmc.c mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data) · line 168
Quoted 3 lines
drivers/mmc/mxsmmc.c +1
-0} +#ifndef CONFIG_MMC_SKIP_CARD_DETECT Undocumented feature added. I think
mxsmmc_register()call can take a param for this.Where I should document it?
mmc_registercannot.
mxsmmc_initialize() can.
Best regards,
Marek Vasut
PATCH 7/9 mx23_olinuxino: Add default environment
In reply to Otavio Salvador--- include/configs/mx23_olinuxino.h | 90 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 89 insertions(+), 1 deletion(-)
include/configs/mx23_olinuxino.h +89 -1
@@ -140,9 +140,97 @@#define CONFIG_SETUP_MEMORY_TAGS #define CONFIG_BOOTDELAY 3#define CONFIG_BOOTFILE "uImage" -#define CONFIG_BOOTARGS "console=ttyAMA0,115200n8 "#define CONFIG_LOADADDR 0x42000000#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR#define CONFIG_OF_LIBFDT +/* +* Extra Environments +*/ +#define CONFIG_EXTRA_ENV_SETTINGS \ + "update_sd_firmware_filename=u-boot.sd\0" \ + "update_nand_full_filename=u-boot.nand\0" \ + "update_nand_firmware_filename=u-boot.sb\0" \ + "update_sd_firmware_filename=u-boot.sd\0" \ + "update_nand_firmware_maxsz=0x100000\0" \ + "update_nand_stride=0x40\0"/* MX28 datasheet ch. 12.12 */ \ +"update_nand_count=0x4\0" /* MX28 datasheet ch. 12.12 */ \ +"update_nand_get_fcb_size=" /* Get size of FCB blocks */ \ +"nand device 0 ; " \ +"nand info ; " \ +"setexpr fcb_sz ${update_nand_stride} * ${update_nand_count};" \ +"setexpr update_nand_fcb ${fcb_sz} * ${nand_writesize}\0" \ +"update_nand_full=" /* Update FCB, DBBT and FW */ \ +"if tftp ${update_nand_full_filename} ; then " \ +"run update_nand_get_fcb_size ; " \ +"nand scrub -y 0x0 ${filesize} ; " \ +"nand write.raw ${loadaddr} 0x0 ${fcb_sz} ; " \ +"setexpr update_off ${loadaddr} + ${update_nand_fcb} ; " \ +"setexpr update_sz ${filesize} - ${update_nand_fcb} ; " \ +"nand write ${update_off} ${update_nand_fcb} ${update_sz} ; " \ +"fi\0" \ +"update_nand_firmware=" /* Update only firmware */ \ +"if tftp ${update_nand_firmware_filename} ; then " \ +"run update_nand_get_fcb_size ; " \ +"setexpr fcb_sz ${update_nand_fcb} * 2 ; " /* FCB + DBBT */ \ +"setexpr fw_sz ${update_nand_firmware_maxsz} * 2 ; " \ +"setexpr fw_off ${fcb_sz} + ${update_nand_firmware_maxsz};" \ +"nand erase ${fcb_sz} ${fw_sz} ; " \ +"nand write ${loadaddr} ${fcb_sz} ${filesize} ; " \ +"nand write ${loadaddr} ${fw_off} ${filesize} ; " \ +"fi\0" \ +"update_sd_firmware=" /* Update the SD firmware partition */ \ +"if mmc rescan ; then " \ +"if tftp ${update_sd_firmware_filename} ; then " \ +"setexpr fw_sz ${filesize} / 0x200 ; " /* SD block size */ \ +"setexpr fw_sz ${fw_sz} + 1 ; " \ +"mmc write ${loadaddr} 0x800 ${fw_sz} ; " \ +"fi ; " \ +"fi\0" \ +"script=boot.scr\0" \ +"uimage=uImage\0" \ +"console=ttyAMA0\0" \ +"fdt_file=imx23-evk.dtb\0" \ +"fdt_addr=0x41000000\0" \ +"boot_fdt=try\0" \ +"mmcdev=0\0" \ +"mmcpart=2\0" \ +"mmcroot=/dev/mmcblk0p3 rw rootwait\0" \ +"mmcargs=setenv bootargs console=${console},${baudrate} " \ +"root=${mmcroot}\0" \ +"loadbootscript=" \ +"fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ +"bootscript=echo Running bootscript from mmc ...; " \ +"source\0" \ +"loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \ +"loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ +"mmcboot=echo Booting from mmc ...; " \ +"run mmcargs; " \ +"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ +"if run loadfdt; then " \ +"bootm ${loadaddr} - ${fdt_addr}; " \ +"else " \ +"if test ${boot_fdt} = try; then " \ +"bootm; " \ +"else " \ +"echo WARN: Cannot load the DT; " \ +"fi; " \ +"fi; " \ +"else " \ +"bootm; " \ + "fi;\0" + +#define CONFIG_BOOTCOMMAND \ + "mmc dev ${mmcdev}; if mmc rescan; then " \ + "if run loadbootscript; then " \ + "run bootscript; " \ + "else " \ + "if run loaduimage; then " \ + "run mmcboot; " \ + "else " \ + "echo ERR: Fail to boot from MMC; " \ + "fi; " \ + "fi; " \ + "else exit; fi" +#endif /* __MX23_OLINUXINO_CONFIG_H__ */
Signature · 1 line
1.8.1
PATCH 7/9 mx23_olinuxino: Add default environment
Dear Otavio Salvador,
Description missing.
Quoted 11 lines
Signed-off-by Otavio Salvador <[email protected]>--- include/configs/mx23_olinuxino.h | 90+++++++++++++++++++++++++++++++++++++++- 1 file changed, 89 insertions(+), 1 deletion(-)
(quoted diff) +0
-0
b/include/configs/mx23_olinuxino.hindex a62e3a2..7d34168 100644
include/configs/mx23_olinuxino.h line 143
Quoted 4 lines
include/configs/mx23_olinuxino.h +0
-1@@ -140,9 +140,97 @@#define CONFIG_SETUP_MEMORY_TAGS #define CONFIG_BOOTDELAY 3#define CONFIG_BOOTFILE "uImage" -#define CONFIG_BOOTARGS "console=ttyAMA0,115200n8 "
No need to remove this.
Quoted 6 lines
include/configs/mx23_olinuxino.h +2
-0#define CONFIG_LOADADDR 0x42000000#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR#define CONFIG_OF_LIBFDT +/* +* Extra Environments
include/configs/mx23_olinuxino.h line 158
Quoted 10 lines
include/configs/mx23_olinuxino.h +10
-0+*/ +#define CONFIG_EXTRA_ENV_SETTINGS \ + "update_sd_firmware_filename=u-boot.sd\0" \ + "update_nand_full_filename=u-boot.nand\0" \ + "update_nand_firmware_filename=u-boot.sb\0" \ + "update_sd_firmware_filename=u-boot.sd\0" \ + "update_nand_firmware_maxsz=0x100000\0" \ + "update_nand_stride=0x40\0"/* MX28 datasheet ch. 12.12 */ \ +"update_nand_count=0x4\0" /* MX28 datasheet ch. 12.12 */ \ +"update_nand_get_fcb_size=" /* Get size of FCB blocks */ \
This board has no NAND.
Best regards,
Marek Vasut
PATCH 7/9 mx23_olinuxino: Add default environment
Quoted 10 lines · Marek Vasut
Dear Otavio Salvador,
Description missing.
Quoted 6 lines
Signed-off-by Otavio Salvador <[email protected]>--- include/configs/mx23_olinuxino.h | 90+++++++++++++++++++++++++++++++++++++++- 1 file changed, 89 insertions(+), 1 deletion(-)
Quoted 11 lines
include/configs/mx23_olinuxino.h line 143
Quoted 9 lines
(quoted diff) +0
-0
b/include/configs/mx23_olinuxino.hindex a62e3a2..7d34168 100644include/configs/mx23_olinuxino.h +0
-1@@ -140,9 +140,97 @@#define CONFIG_SETUP_MEMORY_TAGS #define CONFIG_BOOTDELAY 3#define CONFIG_BOOTFILE "uImage" -#define CONFIG_BOOTARGS "console=ttyAMA0,115200n8 "No need to remove this.
It has an extended version in the end.
Quoted 4 lines
Quoted 4 lines
include/configs/mx23_olinuxino.h +0
-0#define CONFIG_LOADADDR 0x42000000#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR#define CONFIG_OF_LIBFDT
Quoted 14 lines
include/configs/mx23_olinuxino.h line 158
Quoted 12 lines
include/configs/mx23_olinuxino.h +12
-0+/* +* Extra Environments +*/ +#define CONFIG_EXTRA_ENV_SETTINGS \ + "update_sd_firmware_filename=u-boot.sd\0" \ + "update_nand_full_filename=u-boot.nand\0" \ + "update_nand_firmware_filename=u-boot.sb\0" \ + "update_sd_firmware_filename=u-boot.sd\0" \ + "update_nand_firmware_maxsz=0x100000\0" \ + "update_nand_stride=0x40\0"/* MX28 datasheet ch. 12.12 */ \ +"update_nand_count=0x4\0" /* MX28 datasheet ch. 12.12 */ \ +"update_nand_get_fcb_size=" /* Get size of FCB blocks */ \This board has no NAND.
Good catch; will drop it for v2 after Stefano and Fabio's comments.
--
Otavio Salvador O.S. Systems
E-mail: otavio at ossystems.com.br http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br
Fabio Estevam
reviewerPATCH 7/9 mx23_olinuxino: Add default environment
In reply to Otavio Salvadorinclude/configs/mx23_olinuxino.h line 193
Quoted 4 lines · Otavio Salvador
include/configs/mx23_olinuxino.h +4
-0+"script=boot.scr\0" \ +"uimage=uImage\0" \ +"console=ttyAMA0\0" \ +"fdt_file=imx23-evk.dtb\0" \
The dtb file should be imx23-olinuxino.dtb instead.
PATCH 8/9 mxs: Fix MMC reset to avoid write errors and timeout in iMX23
In reply to Otavio SalvadorThis does the same reset mask as done in v3.7 Linux kernel code; it fixed the saveenv command in mx23evk.
--- drivers/mmc/mxsmmc.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/mmc/mxsmmc.c +11 -5
@@ -354,11 +354,17 @@ static int mxsmmc_init(struct mmc *mmc)/* Reset SSP */ mxs_reset_block (&ssp_regs->hw_ssp_ctrl0_reg); -/* 8 bits word length in MMC mode */ -clrsetbits_le32 (&ssp_regs->hw_ssp_ctrl1, -SSP_CTRL1_SSP_MODE_MASK |SSP_CTRL1_WORD_LENGTH_MASK | -SSP_CTRL1_DMA_ENABLE , -SSP_CTRL1_SSP_MODE_SD_MMC |SSP_CTRL1_WORD_LENGTH_EIGHT_BITS ); +/* Reset MMC */ +writel (SSP_CTRL1_SSP_MODE_SD_MMC | +SSP_CTRL1_WORD_LENGTH_EIGHT_BITS | +SSP_CTRL1_DMA_ENABLE | +SSP_CTRL1_POLARITY | +SSP_CTRL1_RECV_TIMEOUT_IRQ_EN | +SSP_CTRL1_DATA_CRC_IRQ_EN | +SSP_CTRL1_DATA_TIMEOUT_IRQ_EN | +SSP_CTRL1_RESP_TIMEOUT_IRQ_EN | +SSP_CTRL1_RESP_ERR_IRQ_EN , + &ssp_regs->hw_ssp_ctrl1_set);/* Set initial bit clock 400 KHz */ mxs_set_ssp_busclock (priv->id,400 );
Signature · 1 line
1.8.1
PATCH 8/9 mxs: Fix MMC reset to avoid write errors and timeout in iMX23
Dear Otavio Salvador,
Quoted 16 lines
This does the same reset mask as done in v3.7 Linux kernel code; it fixed the saveenv command in mx23evk.
Signed-off-by Otavio Salvador <[email protected]>--- drivers/mmc/mxsmmc.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)drivers/mmc/mxsmmc.c +0
-0@@ -354,11 +354,17 @@ static int mxsmmc_init(struct mmc *mmc)/* Reset SSP */ mxs_reset_block (&ssp_regs->hw_ssp_ctrl0_reg);
drivers/mmc/mxsmmc.c static int mxsmmc_init(struct mmc *mmc) · line 361
Quoted 10 lines
drivers/mmc/mxsmmc.c +5
-5-/* 8 bits word length in MMC mode */ -clrsetbits_le32 (&ssp_regs->hw_ssp_ctrl1, -SSP_CTRL1_SSP_MODE_MASK |SSP_CTRL1_WORD_LENGTH_MASK | -SSP_CTRL1_DMA_ENABLE , -SSP_CTRL1_SSP_MODE_SD_MMC |SSP_CTRL1_WORD_LENGTH_EIGHT_BITS ); +/* Reset MMC */ + writel(SSP_CTRL1_SSP_MODE_SD_MMC | + SSP_CTRL1_WORD_LENGTH_EIGHT_BITS | + SSP_CTRL1_DMA_ENABLE | + SSP_CTRL1_POLARITY |
Will this addition not break mx28?
drivers/mmc/mxsmmc.c static int mxsmmc_init(struct mmc *mmc) · line 370
Quoted 9 lines
drivers/mmc/mxsmmc.c +6
-0+SSP_CTRL1_RECV_TIMEOUT_IRQ_EN | +SSP_CTRL1_DATA_CRC_IRQ_EN | +SSP_CTRL1_DATA_TIMEOUT_IRQ_EN | +SSP_CTRL1_RESP_TIMEOUT_IRQ_EN | +SSP_CTRL1_RESP_ERR_IRQ_EN , + &ssp_regs->hw_ssp_ctrl1_set);/* Set initial bit clock 400 KHz */ mxs_set_ssp_busclock (priv->id,400 );
Best regards,
Marek Vasut
PATCH 8/9 mxs: Fix MMC reset to avoid write errors and timeout in iMX23
Quoted 18 lines · Marek Vasut
Dear Otavio Salvador,
Quoted 16 lines
This does the same reset mask as done in v3.7 Linux kernel code; it fixed the saveenv command in mx23evk.
Signed-off-by Otavio Salvador <[email protected]>--- drivers/mmc/mxsmmc.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)drivers/mmc/mxsmmc.c +0
-0@@ -354,11 +354,17 @@ static int mxsmmc_init(struct mmc *mmc)/* Reset SSP */ mxs_reset_block (&ssp_regs->hw_ssp_ctrl0_reg);
Quoted 12 lines
drivers/mmc/mxsmmc.c static int mxsmmc_init(struct mmc *mmc) · line 361
Quoted 10 lines
drivers/mmc/mxsmmc.c +5
-5-/* 8 bits word length in MMC mode */ -clrsetbits_le32 (&ssp_regs->hw_ssp_ctrl1, -SSP_CTRL1_SSP_MODE_MASK |SSP_CTRL1_WORD_LENGTH_MASK | -SSP_CTRL1_DMA_ENABLE , -SSP_CTRL1_SSP_MODE_SD_MMC |SSP_CTRL1_WORD_LENGTH_EIGHT_BITS ); +/* Reset MMC */ + writel(SSP_CTRL1_SSP_MODE_SD_MMC | + SSP_CTRL1_WORD_LENGTH_EIGHT_BITS | + SSP_CTRL1_DMA_ENABLE | + SSP_CTRL1_POLARITY |Will this addition not break mx28?
Not tested. I hope it does not as it has been taken from v3.7 kernel.
Quoted 7 lines
Quoted 7 lines
drivers/mmc/mxsmmc.c +6
-0+SSP_CTRL1_RECV_TIMEOUT_IRQ_EN | +SSP_CTRL1_DATA_CRC_IRQ_EN | +SSP_CTRL1_DATA_TIMEOUT_IRQ_EN | +SSP_CTRL1_RESP_TIMEOUT_IRQ_EN | +SSP_CTRL1_RESP_ERR_IRQ_EN , + &ssp_regs->hw_ssp_ctrl1_set);
Quoted 5 lines
drivers/mmc/mxsmmc.c static int mxsmmc_init(struct mmc *mmc) · line 370
Quoted 2 lines
drivers/mmc/mxsmmc.c +0
-0/* Set initial bit clock 400 KHz */ mxs_set_ssp_busclock (priv->id,400 );Best regards,
Marek Vasut
--
Otavio Salvador O.S. Systems
E-mail: otavio at ossystems.com.br http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br
PATCH 8/9 mxs: Fix MMC reset to avoid write errors and timeout in iMX23
Dear Otavio Salvador,
Quoted 34 lines · Marek Vasut
Quoted 20 lines
Dear Otavio Salvador,
Quoted 18 lines
This does the same reset mask as done in v3.7 Linux kernel code; it fixed the saveenv command in mx23evk.
Signed-off-by Otavio Salvador <[email protected]>---
drivers/mmc/mxsmmc.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)drivers/mmc/mxsmmc.c +0
-0@@ -354,11 +354,17 @@ static int mxsmmc_init(struct mmc *mmc)/* Reset SSP */ mxs_reset_block (&ssp_regs->hw_ssp_ctrl0_reg);Quoted 12 lines
drivers/mmc/mxsmmc.c static int mxsmmc_init(struct mmc *mmc) · line 361
Quoted 10 lines
drivers/mmc/mxsmmc.c +0
-5-/* 8 bits word length in MMC mode */ - clrsetbits_le32(&ssp_regs->hw_ssp_ctrl1, - SSP_CTRL1_SSP_MODE_MASK | SSP_CTRL1_WORD_LENGTH_MASK | - SSP_CTRL1_DMA_ENABLE, - SSP_CTRL1_SSP_MODE_SD_MMC |
SSP_CTRL1_WORD_LENGTH_EIGHT_BITS); + /* Reset MMC */drivers/mmc/mxsmmc.c +4
-0+ writel(SSP_CTRL1_SSP_MODE_SD_MMC | + SSP_CTRL1_WORD_LENGTH_EIGHT_BITS | + SSP_CTRL1_DMA_ENABLE | + SSP_CTRL1_POLARITY |Will this addition not break mx28?
Quoted 1 line
Not tested. I hope it does not as it has been taken from v3.7 kernel.
Please, mark all such untested code which can possibly break other platforms in the description.
Best regards,
Marek Vasut
PATCH 9/9 mx23: Use PIO mode support for MMC
In reply to Otavio Salvador--- drivers/mmc/mxsmmc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/mmc/mxsmmc.c +6 -2
@@ -50,6 +50,7 @@ struct mxsmmc_priv {uint32_t buswidth;int (*mmc_is_wp)(int );struct mxs_dma_desc *desc; +int force_pio; };#define MXSMMC_MAX_TIMEOUT 10000
@@ -184,7 +185,7 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)if (cmd->resp_type &MMC_RSP_136 )/* It's a 136 bits response */ ctrl0 |=SSP_CTRL0_LONG_RESP ; -if (data && (data->blocksize * data->blocks <MXSMMC_SMALL_TRANSFER )) +if (priv->force_pio || (data && (data->blocksize * data->blocks <MXSMMC_SMALL_TRANSFER )))writel (SSP_CTRL1_DMA_ENABLE , &ssp_regs->hw_ssp_ctrl1_clr);else writel (SSP_CTRL1_DMA_ENABLE , &ssp_regs->hw_ssp_ctrl1_set);
@@ -287,7 +288,7 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)if (!data)return 0 ; -if (data->blocksize * data->blocks <MXSMMC_SMALL_TRANSFER ) { +if (priv->force_pio || (data->blocksize * data->blocks <MXSMMC_SMALL_TRANSFER )) { ret =mxsmmc_send_cmd_pio (priv, data);if (ret) { printf("MMC%d: Data timeout with command %d "
@@ -385,9 +386,11 @@ int mxsmmc_initialize(bd_t *bis, int id, int (*wp)(int))#if defined(CONFIG_MX23 )const unsigned int mxsmmc_max_id =2 ;const unsigned int mxsmmc_clk_id =0 ; +const unsigned int mxsmmc_force_pio =1 ;#elif defined(CONFIG_MX28 )const unsigned int mxsmmc_max_id =4 ;const unsigned int mxsmmc_clk_id = id; +const unsigned int mxsmmc_force_pio =0 ;#endif if (id >= mxsmmc_max_id)
@@ -417,6 +420,7 @@ int mxsmmc_initialize(bd_t *bis, int id, int (*wp)(int)) priv->mmc_is_wp = wp; priv->id = id; priv->regs =mxs_ssp_regs_by_bus (id); + priv->force_pio = mxsmmc_force_pio;sprintf (mmc->name,"MXS MMC" ); mmc->send_cmd = mxsmmc_send_cmd;
Signature · 1 line
1.8.1
PATCH 9/9 mx23: Use PIO mode support for MMC
Dear Otavio Salvador,
NAK. DMA works on MX28 and works in Linux on MX23, therefore the DMA is not broken on either. Thus there's no reason to introduce such "force_pio" stuff.
Best regards,
Marek Vasut
PATCH 9/9 mx23: Use PIO mode support for MMC
Quoted 4 lines · Marek Vasut
Dear Otavio Salvador,
NAK. DMA works on MX28 and works in Linux on MX23, therefore the DMA is not broken on either. Thus there's no reason to introduce such "
force_pio" stuff.
Lack of time to work on it is one reason. I won't be able to work on it for some days and I prefer a working solution than skip it for another release.
--
Otavio Salvador O.S. Systems
E-mail: otavio at ossystems.com.br http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br
PATCH 9/9 mx23: Use PIO mode support for MMC
Dear Otavio Salvador,
Quoted 10 lines · Marek Vasut
Quoted 5 lines
Dear Otavio Salvador,
NAK. DMA works on MX28 and works in Linux on MX23, therefore the DMA is not broken on either. Thus there's no reason to introduce such "
force_pio" stuff.Lack of time to work on it is one reason. I won't be able to work on it for some days and I prefer a working solution than skip it for another release.
The solution you propose adds undocumented feature and is not working, this is clearly a workaround.
Best regards,
Marek Vasut
PATCH 9/9 mx23: Use PIO mode support for MMC
In reply to Otavio SalvadorQuoted 6 lines · Otavio Salvador
Quoted 4 lines · Marek Vasut
Dear Otavio Salvador,
NAK. DMA works on MX28 and works in Linux on MX23, therefore the DMA is not broken on either. Thus there's no reason to introduce such "
force_pio" stuff.
Quoted 9 lines
Lack of time to work on it is one reason. I won't be able to work on it for some days and I prefer a working solution than skip it for another release.
--
Otavio SalvadorO.S. Systems
E-mail: otavio at ossystems.com.br http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br
Hi Otavio, hi Marek,
let me say some words about this discussion. I agree that if there is no support for DMA for MX23, we could add support with PIO mode. However, there should be a very good reason, because as far as I understand, added support for DMA is valid for mxs platform. The solution introduced with this patchset lets also the door open for people that can use MX28 in PIO mode. I think (I have already seen in ML Marek's patchset for it) the way to fix DMA for mx23 and then add support for MMC is the rught way to do.
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH 9/9 mx23: Use PIO mode support for MMC
Quoted 19 lines · Stefano Babic
Quoted 6 lines · Otavio Salvador
Quoted 4 lines · Marek Vasut
Dear Otavio Salvador,
NAK. DMA works on MX28 and works in Linux on MX23, therefore the DMA is not broken on either. Thus there's no reason to introduce such "
force_pio" stuff.Quoted 9 lines
Lack of time to work on it is one reason. I won't be able to work on it for some days and I prefer a working solution than skip it for another release.
--
Otavio SalvadorO.S. Systems
E-mail: otavio at ossystems.com.br http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.brHi Otavio, hi Marek,
Quoted 8 lines
let me say some words about this discussion. I agree that if there is no support for DMA for MX23, we could add support with PIO mode. However, there should be a very good reason, because as far as I understand, added support for DMA is valid for mxs platform. The solution introduced with this patchset lets also the door open for people that can use MX28 in PIO mode. I think (I have already seen in ML Marek's patchset for it) the way to fix DMA for mx23 and then add support for MMC is the rught way to do.
So you'd like to have this patch ported to Marek's patchset so the support for PIO mode is kept available? Instead of enabling it for MX23 we can have a config option which allows force PIO mode and disable DMA. This is what you want?
--
Otavio Salvador O.S. Systems
E-mail: otavio at ossystems.com.br http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br
PATCH 9/9 mx23: Use PIO mode support for MMC
Dear Otavio Salvador,
Quoted 29 lines · Stefano Babic
Quoted 19 lines · Otavio Salvador
Quoted 7 lines · Marek Vasut
Quoted 5 lines
Dear Otavio Salvador,
NAK. DMA works on MX28 and works in Linux on MX23, therefore the DMA is not broken on either. Thus there's no reason to introduce such "
force_pio" stuff.Quoted 8 lines
Lack of time to work on it is one reason. I won't be able to work on it for some days and I prefer a working solution than skip it for another release.
--
Otavio SalvadorO.S. Systems
E-mail: otavio at ossystems.com.br http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.brHi Otavio, hi Marek,
Quoted 8 lines
let me say some words about this discussion. I agree that if there is no support for DMA for MX23, we could add support with PIO mode. However, there should be a very good reason, because as far as I understand, added support for DMA is valid for mxs platform. The solution introduced with this patchset lets also the door open for people that can use MX28 in PIO mode. I think (I have already seen in ML Marek's patchset for it) the way to fix DMA for mx23 and then add support for MMC is the rught way to do.
Quoted 4 lines
So you'd like to have this patch ported to Marek's patchset so the support for PIO mode is kept available? Instead of enabling it for MX23 we can have a config option which allows force PIO mode and disable DMA. This is what you want?
Forcing PIO is nonsense, why would it be of any use?
Best regards,
Marek Vasut
PATCH 9/9 mx23: Use PIO mode support for MMC
Quoted 11 lines · Marek Vasut
Quoted 11 lines
Quoted 10 lines
Hi Otavio, hi Marek,
let me say some words about this discussion. I agree that if there is no support for DMA for MX23, we could add support with PIO mode. However, there should be a very good reason, because as far as I understand, added support for DMA is valid for mxs platform. The solution introduced with this patchset lets also the door open for people that can use MX28 in PIO mode. I think (I have already seen in ML Marek's patchset for it) the way to fix DMA for mx23 and then add support for MMC is the rught way to do.
Quoted 6 lines
Quoted 4 lines
So you'd like to have this patch ported to Marek's patchset so the support for PIO mode is kept available? Instead of enabling it for MX23 we can have a config option which allows force PIO mode and disable DMA. This is what you want?
Forcing PIO is nonsense, why would it be of any use?
No, I agree with Marek - if DMA is then working also for MX23, we do not need PIO at all.
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH 9/9 mx23: Use PIO mode support for MMC
Dear Stefano Babic,
Quoted 17 lines · Marek Vasut
Quoted 16 lines
Quoted 15 lines
Quoted 10 lines
Hi Otavio, hi Marek,
let me say some words about this discussion. I agree that if there is no support for DMA for MX23, we could add support with PIO mode. However, there should be a very good reason, because as far as I understand, added support for DMA is valid for mxs platform. The solution introduced with this patchset lets also the door open for people that can use MX28 in PIO mode. I think (I have already seen in ML Marek's patchset for it) the way to fix DMA for mx23 and then add support for MMC is the rught way to do.
So you'd like to have this patch ported to Marek's patchset so the support for PIO mode is kept available? Instead of enabling it for MX23 we can have a config option which allows force PIO mode and disable DMA. This is what you want?
Quoted 4 lines
Quoted 1 line
Forcing PIO is nonsense, why would it be of any use?
No, I agree with Marek - if DMA is then working also for MX23, we do not need PIO at all.
Stefano, it's now using mixed mode -- PIO for small transfers, DMA for large transfers. That is the best pick of both worlds ;-)
Best regards,
Marek Vasut
PATCH 9/9 mx23: Use PIO mode support for MMC
Quoted 19 lines · Marek Vasut
Dear Stefano Babic,
Quoted 17 lines · Marek Vasut
Quoted 16 lines
Quoted 15 lines
Quoted 10 lines
Hi Otavio, hi Marek,
let me say some words about this discussion. I agree that if there is no support for DMA for MX23, we could add support with PIO mode. However, there should be a very good reason, because as far as I understand, added support for DMA is valid for mxs platform. The solution introduced with this patchset lets also the door open for people that can use MX28 in PIO mode. I think (I have already seen in ML Marek's patchset for it) the way to fix DMA for mx23 and then add support for MMC is the rught way to do.
So you'd like to have this patch ported to Marek's patchset so the support for PIO mode is kept available? Instead of enabling it for MX23 we can have a config option which allows force PIO mode and disable DMA. This is what you want?
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Forcing PIO is nonsense, why would it be of any use?
No, I agree with Marek - if DMA is then working also for MX23, we do not need PIO at all.
Stefano, it's now using mixed mode -- PIO for small transfers, DMA for large transfers. That is the best pick of both worlds ;-)
That's fine; I just wanted to check if I had understood it right.
No problem; I will update the environments and send a v2 of my patchset basing on top of Marek's changes.
--
Otavio Salvador O.S. Systems
E-mail: otavio at ossystems.com.br http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br