All of lore.kernel.org
 help / color / mirror / Atom feed
From: York Sun <yorksun@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 27/28] ls2085a: esdhc: Add esdhc support for ls2085a
Date: Thu, 19 Mar 2015 09:45:58 -0700	[thread overview]
Message-ID: <1426783559-26610-27-git-send-email-yorksun@freescale.com> (raw)
In-Reply-To: <1426783559-26610-1-git-send-email-yorksun@freescale.com>

From: Yangbo Lu <yangbo.lu@freescale.com>

This patch adds esdhc support for ls2085a.

Signed-off-by: Yangbo Lu <yangbo.lu@freescale.com>
---
 arch/arm/cpu/armv8/fsl-lsch3/cpu.c           |   10 +++++++
 arch/arm/cpu/armv8/fsl-lsch3/fdt.c           |    7 +++++
 arch/arm/include/asm/arch-fsl-lsch3/config.h |    2 ++
 drivers/mmc/fsl_esdhc.c                      |   36 ++++++++++++++++++++++++--
 include/configs/ls2085a_common.h             |    5 ++--
 include/configs/ls2085aqds.h                 |   19 +++++++++++++-
 include/configs/ls2085ardb.h                 |   11 +++++++-
 include/fsl_esdhc.h                          |    4 +++
 8 files changed, 88 insertions(+), 6 deletions(-)

diff --git a/arch/arm/cpu/armv8/fsl-lsch3/cpu.c b/arch/arm/cpu/armv8/fsl-lsch3/cpu.c
index 22b5fb2..e738c49 100644
--- a/arch/arm/cpu/armv8/fsl-lsch3/cpu.c
+++ b/arch/arm/cpu/armv8/fsl-lsch3/cpu.c
@@ -13,6 +13,9 @@
 #include <fsl_debug_server.h>
 #include <fsl-mc/fsl_mc.h>
 #include <asm/arch/fsl_serdes.h>
+#ifdef CONFIG_FSL_ESDHC
+#include <fsl_esdhc.h>
+#endif
 #include "cpu.h"
 #include "mp.h"
 #include "speed.h"
@@ -416,6 +419,13 @@ int print_cpuinfo(void)
 }
 #endif
 
+#ifdef CONFIG_FSL_ESDHC
+int cpu_mmc_init(bd_t *bis)
+{
+	return fsl_esdhc_mmc_init(bis);
+}
+#endif
+
 int cpu_eth_init(bd_t *bis)
 {
 	int error = 0;
diff --git a/arch/arm/cpu/armv8/fsl-lsch3/fdt.c b/arch/arm/cpu/armv8/fsl-lsch3/fdt.c
index 42c5b58..d370023 100644
--- a/arch/arm/cpu/armv8/fsl-lsch3/fdt.c
+++ b/arch/arm/cpu/armv8/fsl-lsch3/fdt.c
@@ -7,6 +7,9 @@
 #include <common.h>
 #include <libfdt.h>
 #include <fdt_support.h>
+#ifdef CONFIG_FSL_ESDHC
+#include <fsl_esdhc.h>
+#endif
 #include "mp.h"
 
 #ifdef CONFIG_MP
@@ -65,4 +68,8 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 	do_fixup_by_compat_u32(blob, "fsl,ns16550",
 			       "clock-frequency", CONFIG_SYS_NS16550_CLK, 1);
 #endif
+
+#if defined(CONFIG_FSL_ESDHC)
+	fdt_fixup_esdhc(blob, bd);
+#endif
 }
diff --git a/arch/arm/include/asm/arch-fsl-lsch3/config.h b/arch/arm/include/asm/arch-fsl-lsch3/config.h
index 77c20ab..ca8d38c 100644
--- a/arch/arm/include/asm/arch-fsl-lsch3/config.h
+++ b/arch/arm/include/asm/arch-fsl-lsch3/config.h
@@ -31,6 +31,7 @@
 #define CONFIG_SYS_FSL_CH3_CLK_GRPA_ADDR	(CONFIG_SYS_IMMR + 0x00300000)
 #define CONFIG_SYS_FSL_CH3_CLK_GRPB_ADDR	(CONFIG_SYS_IMMR + 0x00310000)
 #define CONFIG_SYS_FSL_CH3_CLK_CTRL_ADDR	(CONFIG_SYS_IMMR + 0x00370000)
+#define CONFIG_SYS_FSL_ESDHC_ADDR		(CONFIG_SYS_IMMR + 0x01140000)
 #define CONFIG_SYS_IFC_ADDR			(CONFIG_SYS_IMMR + 0x01240000)
 #define CONFIG_SYS_NS16550_COM1			(CONFIG_SYS_IMMR + 0x011C0500)
 #define CONFIG_SYS_NS16550_COM2			(CONFIG_SYS_IMMR + 0x011C0600)
@@ -110,6 +111,7 @@
 #define CONFIG_MAX_MEM_MAPPED		CONFIG_SYS_LS2_DDR_BLOCK1_SIZE
 #define CONFIG_SYS_FSL_DDR_VER		FSL_DDR_VER_5_0
 
+#define CONFIG_SYS_FSL_ESDHC_LE
 /* IFC */
 #define CONFIG_SYS_FSL_IFC_LE
 #define CONFIG_SYS_MEMAC_LITTLE_ENDIAN
diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
index c5e270d..7528b9d 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -105,7 +105,8 @@ static uint esdhc_xfertyp(struct mmc_cmd *cmd, struct mmc_data *data)
 	else if (cmd->resp_type & MMC_RSP_PRESENT)
 		xfertyp |= XFERTYP_RSPTYP_48;
 
-#if defined(CONFIG_MX53) || defined(CONFIG_PPC_T4240) || defined(CONFIG_LS102XA)
+#if defined(CONFIG_MX53) || defined(CONFIG_PPC_T4240) || \
+	defined(CONFIG_LS102XA) || defined(CONFIG_LS2085A)
 	if (cmd->cmdidx == MMC_CMD_STOP_TRANSMISSION)
 		xfertyp |= XFERTYP_CMDTYP_ABORT;
 #endif
@@ -183,7 +184,9 @@ static int esdhc_setup_data(struct mmc *mmc, struct mmc_data *data)
 	int timeout;
 	struct fsl_esdhc_cfg *cfg = mmc->priv;
 	struct fsl_esdhc *regs = (struct fsl_esdhc *)cfg->esdhc_base;
-
+#ifdef CONFIG_LS2085A
+	dma_addr_t addr;
+#endif
 	uint wml_value;
 
 	wml_value = data->blocksize/4;
@@ -194,8 +197,16 @@ static int esdhc_setup_data(struct mmc *mmc, struct mmc_data *data)
 
 		esdhc_clrsetbits32(&regs->wml, WML_RD_WML_MASK, wml_value);
 #ifndef CONFIG_SYS_FSL_ESDHC_USE_PIO
+#ifdef CONFIG_LS2085A
+		addr = virt_to_phys((void *)(data->dest));
+		if (upper_32_bits(addr))
+			printf("Error found for upper 32 bits\n");
+		else
+			esdhc_write32(&regs->dsaddr, lower_32_bits(addr));
+#else
 		esdhc_write32(&regs->dsaddr, (u32)data->dest);
 #endif
+#endif
 	} else {
 #ifndef CONFIG_SYS_FSL_ESDHC_USE_PIO
 		flush_dcache_range((ulong)data->src,
@@ -212,8 +223,16 @@ static int esdhc_setup_data(struct mmc *mmc, struct mmc_data *data)
 		esdhc_clrsetbits32(&regs->wml, WML_WR_WML_MASK,
 					wml_value << 16);
 #ifndef CONFIG_SYS_FSL_ESDHC_USE_PIO
+#ifdef CONFIG_LS2085A
+		addr = virt_to_phys((void *)(data->src));
+		if (upper_32_bits(addr))
+			printf("Error found for upper 32 bits\n");
+		else
+			esdhc_write32(&regs->dsaddr, lower_32_bits(addr));
+#else
 		esdhc_write32(&regs->dsaddr, (u32)data->src);
 #endif
+#endif
 	}
 
 	esdhc_write32(&regs->blkattr, data->blocks << 16 | data->blocksize);
@@ -259,10 +278,23 @@ static int esdhc_setup_data(struct mmc *mmc, struct mmc_data *data)
 static void check_and_invalidate_dcache_range
 	(struct mmc_cmd *cmd,
 	 struct mmc_data *data) {
+#ifdef CONFIG_LS2085A
+	unsigned start = 0;
+#else
 	unsigned start = (unsigned)data->dest ;
+#endif
 	unsigned size = roundup(ARCH_DMA_MINALIGN,
 				data->blocks*data->blocksize);
 	unsigned end = start+size ;
+#ifdef CONFIG_LS2085A
+	dma_addr_t addr;
+
+	addr = virt_to_phys((void *)(data->dest));
+	if (upper_32_bits(addr))
+		printf("Error found for upper 32 bits\n");
+	else
+		start = lower_32_bits(addr);
+#endif
 	invalidate_dcache_range(start, end);
 }
 #endif
diff --git a/include/configs/ls2085a_common.h b/include/configs/ls2085a_common.h
index febf4da..01ae2ef 100644
--- a/include/configs/ls2085a_common.h
+++ b/include/configs/ls2085a_common.h
@@ -153,6 +153,9 @@ unsigned long long get_qixis_addr(void);
 #define QIXIS_BASE				get_qixis_addr()
 #define QIXIS_BASE_PHYS				0x20000000
 #define QIXIS_BASE_PHYS_EARLY			0xC000000
+#define QIXIS_STAT_PRES1			0xb
+#define QIXIS_SDID_MASK				0x07
+#define QIXIS_ESDHC_NO_ADAPTER			0x7
 
 #define CONFIG_SYS_NAND_BASE			0x530000000ULL
 #define CONFIG_SYS_NAND_BASE_PHYS		0x30000000
@@ -217,8 +220,6 @@ unsigned long long get_qixis_addr(void);
 #define CONFIG_CMD_BOOTD
 #define CONFIG_CMD_ECHO
 #define CONFIG_CMD_SOURCE
-#define CONFIG_CMD_FAT
-#define CONFIG_DOS_PARTITION
 
 /* Miscellaneous configurable options */
 #define CONFIG_SYS_LOAD_ADDR	(CONFIG_SYS_DDR_SDRAM_BASE + 0x10000000)
diff --git a/include/configs/ls2085aqds.h b/include/configs/ls2085aqds.h
index 0203276..d11568c 100644
--- a/include/configs/ls2085aqds.h
+++ b/include/configs/ls2085aqds.h
@@ -278,6 +278,14 @@ unsigned long get_board_ddr_clk(void);
 #define I2C_MUX_CH_DEFAULT      0x8
 
 /*
+ * MMC
+ */
+#ifdef CONFIG_MMC
+#define CONFIG_ESDHC_DETECT_QUIRK ((readb(QIXIS_BASE + QIXIS_STAT_PRES1) & \
+	QIXIS_SDID_MASK) != QIXIS_ESDHC_NO_ADAPTER)
+#endif
+
+/*
  * RTC configuration
  */
 #define RTC
@@ -307,7 +315,16 @@ unsigned long get_board_ddr_clk(void);
 #define CONFIG_CMD_NET
 #endif
 
-
+/*  MMC  */
+#define CONFIG_MMC
+#ifdef CONFIG_MMC
+#define CONFIG_CMD_MMC
+#define CONFIG_FSL_ESDHC
+#define CONFIG_SYS_FSL_MMC_HAS_CAPBLT_VS33
+#define CONFIG_GENERIC_MMC
+#define CONFIG_CMD_FAT
+#define CONFIG_DOS_PARTITION
+#endif
 
 /* Initial environment variables */
 #undef CONFIG_EXTRA_ENV_SETTINGS
diff --git a/include/configs/ls2085ardb.h b/include/configs/ls2085ardb.h
index 34aa3e5..af3052e 100644
--- a/include/configs/ls2085ardb.h
+++ b/include/configs/ls2085ardb.h
@@ -280,7 +280,16 @@ unsigned long get_board_sys_clk(void);
 #define CONFIG_CMD_NET
 #endif
 
-
+/*  MMC  */
+#define CONFIG_MMC
+#ifdef CONFIG_MMC
+#define CONFIG_CMD_MMC
+#define CONFIG_FSL_ESDHC
+#define CONFIG_SYS_FSL_MMC_HAS_CAPBLT_VS33
+#define CONFIG_GENERIC_MMC
+#define CONFIG_CMD_FAT
+#define CONFIG_DOS_PARTITION
+#endif
 
 /* Initial environment variables */
 #undef CONFIG_EXTRA_ENV_SETTINGS
diff --git a/include/fsl_esdhc.h b/include/fsl_esdhc.h
index 57295b4..41bf05b 100644
--- a/include/fsl_esdhc.h
+++ b/include/fsl_esdhc.h
@@ -158,7 +158,11 @@
 #define ESDHC_VENDORSPEC_VSELECT 0x00000002 /* Use 1.8V */
 
 struct fsl_esdhc_cfg {
+#ifdef CONFIG_LS2085A
+	u64	esdhc_base;
+#else
 	u32	esdhc_base;
+#endif
 	u32	sdhc_clk;
 	u8	max_bus_width;
 	struct mmc_config cfg;
-- 
1.7.9.5

  parent reply	other threads:[~2015-03-19 16:45 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-19 16:45 [U-Boot] [PATCH 01/28] armv8/fsl-lsch3: Implement workaround for erratum A008585 York Sun
2015-03-19 16:45 ` [U-Boot] [PATCH 02/28] armv8/ls2085a: Update common header file York Sun
2015-03-19 16:45 ` [U-Boot] [PATCH 03/28] armv8/fsl-lsch3: Fix platform clock calculation York Sun
2015-03-19 16:45 ` [U-Boot] [PATCH 04/28] armv8/ls2085a: Fix generic timer clock source York Sun
2015-03-19 18:08   ` Mark Rutland
2015-03-19 18:16     ` York Sun
2015-03-19 18:17       ` Mark Rutland
2015-03-19 18:24         ` York Sun
2015-03-19 18:46           ` Mark Rutland
2015-03-19 19:26             ` York Sun
2015-03-19 16:45 ` [U-Boot] [PATCH 05/28] armv8/ls2085a: Add support for reset request York Sun
2015-03-19 16:45 ` [U-Boot] [PATCH 06/28] armv8/fsl-lsch3: Set nodes in DVM domain York Sun
2015-03-19 16:45 ` [U-Boot] [PATCH 07/28] armv8/fsl-lsch3: Update early MMU table York Sun
2015-03-19 16:45 ` [U-Boot] [PATCH 08/28] fsl-lsch3: Introduce place for common early SoC init York Sun
2015-03-19 16:45 ` [U-Boot] [PATCH 09/28] armv8/ls2085a: Add workaround for USB erratum A-008751 York Sun
2015-03-19 16:45 ` [U-Boot] [PATCH 10/28] armv8/fsl-lsch3: Use correct compatible for serial clock fixup York Sun
2015-03-19 16:45 ` [U-Boot] [PATCH 11/28] driver/ldpaa_eth: Update ldpaa ethernet driver York Sun
2015-03-19 16:45 ` [U-Boot] [PATCH 12/28] armv8: Add SerDes framework for LayerScape Architecture York Sun
2015-03-19 16:45 ` [U-Boot] [PATCH 13/28] net/phy/cortina: Fix compilation warning York Sun
2015-03-19 17:17   ` Joe Hershberger
2015-03-19 16:45 ` [U-Boot] [PATCH 14/28] drivers/fsl-mc: Changed MC firmware loading for new boot architecture York Sun
2015-03-19 17:53   ` Kim Phillips
2015-03-23 20:06     ` Jose Rivera
2015-03-23 20:34       ` Kim Phillips
2015-03-23 21:15         ` Jose Rivera
2015-03-23 22:05           ` Kim Phillips
2015-03-24 15:14             ` Jose Rivera
2015-03-24 15:35               ` Kim Phillips
     [not found]                 ` <CALRxmdDfZKYh3QOSnz1LzvkpWuS2OzontG_fLECuMgzz2N68uA@mail.gmail.com>
2015-03-25 21:12                   ` Kim Phillips
2015-03-26 23:57                     ` Jose Rivera
2015-03-27 16:01                       ` Kim Phillips
2015-03-19 16:45 ` [U-Boot] [PATCH 15/28] net/memac_phy: reuse driver for little endian SoCs York Sun
2015-03-19 18:03   ` Joe Hershberger
2015-03-20  3:06     ` Shaohui Xie
2015-03-20  3:33       ` Joe Hershberger
2015-03-20  3:48         ` Shaohui Xie
2015-03-20  3:58           ` Joe Hershberger
2015-03-19 16:45 ` [U-Boot] [PATCH 16/28] armv8/fsl-ch3: Add support to print RCW configuration York Sun
2015-03-19 16:45 ` [U-Boot] [PATCH 17/28] armv8/fsl-lsch3: Enable system error aborts York Sun
2015-03-19 18:14   ` Mark Rutland
2015-03-19 19:52     ` Scott Wood
2015-03-19 19:54       ` York Sun
2015-03-19 19:58         ` Scott Wood
2015-03-19 20:02           ` York Sun
2015-03-19 20:06             ` Scott Wood
2015-03-19 20:27               ` York Sun
2015-03-19 20:37                 ` Scott Wood
2015-03-19 20:47                   ` York Sun
2015-03-19 20:51                     ` Scott Wood
2015-03-19 20:56                       ` York Sun
2015-03-19 21:34                         ` Scott Wood
2015-03-20 11:31       ` Mark Rutland
2015-03-19 16:45 ` [U-Boot] [PATCH 18/28] driver/ldpaa: Add support of WRIOP static data structure York Sun
2015-03-19 16:45 ` [U-Boot] [PATCH 19/28] armv8/ls2085aqds: Add support of LS2085AQDS platform York Sun
2015-03-19 16:45 ` [U-Boot] [PATCH 20/28] armv8/ls2085ardb: Add support of LS2085ARDB platform York Sun
2015-03-20 23:01   ` Scott Wood
2015-03-21  0:08     ` York Sun
2015-03-21  0:12       ` Scott Wood
2015-03-21  0:16         ` York Sun
2015-03-19 16:45 ` [U-Boot] [PATCH 21/28] drivers/fsl-mc: Autoload AOIP image from NOR flash York Sun
2015-03-19 16:45 ` [U-Boot] [PATCH 22/28] board/ls2085qds: Add support ethernet York Sun
2015-03-19 16:45 ` [U-Boot] [PATCH 23/28] driver/ifc: Add 64KB page support York Sun
2015-03-19 16:45 ` [U-Boot] [PATCH 24/28] armv8/ls2085aqds: NAND boot support York Sun
2015-03-19 16:45 ` [U-Boot] [PATCH 25/28] freescale/qixis: Add support for booting from NAND York Sun
2015-03-19 16:45 ` [U-Boot] [PATCH 26/28] armv8/ls2085ardb: Enable NAND SPL support York Sun
2015-03-19 16:45 ` York Sun [this message]
2015-03-19 16:45 ` [U-Boot] [PATCH 28/28] armv8/fsl-lsch3: Implement workaround for I2C issue York Sun
2015-03-20  5:35   ` Heiko Schocher
2015-03-20 16:08     ` York Sun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1426783559-26610-27-git-send-email-yorksun@freescale.com \
    --to=yorksun@freescale.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.