Skip to contentSkip to conversation

Davinci DM355 Build Error Fix

PATCH New Alagu Sankar 1 participant 5 messages May 12, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/5 Davinci DM355 Build Error Fix

Fixed the build process that is broken by the recent changes in DM9000 network driver with __io(p) configuration option

---
 include/configs/davinci_dm355evm.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
include/configs/davinci_dm355evm.h +1 -0
index 37011c0..3828a08 100644
@@ -57,6 +57,7 @@
 #define DM9000_IO			CONFIG_DM9000_BASE
 #define DM9000_DATA			(CONFIG_DM9000_BASE + 2)
 #define CONFIG_NET_MULTI
+#define __io(p)				(p)
 
 /* I2C */
 #define CONFIG_HARD_I2C
Signature · 1 line
1.6.0.6
#1 lore raw

PATCH 2/5 Davinci MMCSD Support

Added support for MMC/SD cards for Davinci. This feature is enabled by CONFIG_DAVINCI_MMC and is dependant on CONFIG_MMC and CONFIG_GENERIC_MMC options. This is tested on DM355 and DM365 EVMs with both the available mmc controllers.

---
 arch/arm/include/asm/arch-davinci/sdmmc_defs.h |  175 +++++++++++
 board/davinci/dm355evm/dm355evm.c              |   44 +++
 board/davinci/dm365evm/dm365evm.c              |   51 +++
 drivers/mmc/Makefile                           |    1 +
 drivers/mmc/davinci_mmc.c                      |  399 ++++++++++++++++++++++++
 include/configs/davinci_dm355evm.h             |   21 +-
 include/configs/davinci_dm365evm.h             |   13 +
 7 files changed, 700 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-davinci/sdmmc_defs.h
 create mode 100644 drivers/mmc/davinci_mmc.c
arch/arm/include/asm/arch-davinci/sdmmc_defs.h new file +175 -0
new file mode 100644
index 0000000..a9118f9
@@ -0,0 +1,175 @@
+/*
+ * Davinci MMC Controller Defines - Based on Linux davinci_mmc.c
+ *
+ * Copyright (C) Texas Instruments.
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef _SDMMC_DEFS_H_
+#define _SDMMC_DEFS_H_
+
+#include <asm/arch/hardware.h>
+
+/* MMC Control Reg fields */
+#define MMCCTL_DATRST		(1 << 0)
+#define MMCCTL_CMDRST		(1 << 1)
+#define MMCCTL_WIDTH_4_BIT	(1 << 2)
+#define MMCCTL_DATEG_DISABLED	(0 << 6)
+#define MMCCTL_DATEG_RISING	(1 << 6)
+#define MMCCTL_DATEG_FALLING	(2 << 6)
+#define MMCCTL_DATEG_BOTH	(3 << 6)
+#define MMCCTL_PERMDR_LE	(0 << 9)
+#define MMCCTL_PERMDR_BE	(1 << 9)
+#define MMCCTL_PERMDX_LE	(0 << 10)
+#define MMCCTL_PERMDX_BE	(1 << 10)
+
+/* MMC Clock Control Reg fields */
+#define MMCCLK_CLKEN		(1 << 8)
+#define MMCCLK_CLKRT_MASK	(0xFF << 0)
+
+/* MMC Status Reg0 fields */
+#define MMCST0_DATDNE		(1 << 0)
+#define MMCST0_BSYDNE		(1 << 1)
+#define MMCST0_RSPDNE		(1 << 2)
+#define MMCST0_TOUTRD		(1 << 3)
+#define MMCST0_TOUTRS		(1 << 4)
+#define MMCST0_CRCWR		(1 << 5)
+#define MMCST0_CRCRD		(1 << 6)
+#define MMCST0_CRCRS		(1 << 7)
+#define MMCST0_DXRDY		(1 << 9)
+#define MMCST0_DRRDY		(1 << 10)
+#define MMCST0_DATED		(1 << 11)
+#define MMCST0_TRNDNE		(1 << 12)
+
+#define MMCST0_ERR_MASK		(0x00F8)
+
+/* MMC Status Reg1 fields */
+#define MMCST1_BUSY		(1 << 0)
+#define MMCST1_CLKSTP		(1 << 1)
+#define MMCST1_DXEMP		(1 << 2)
+#define MMCST1_DRFUL		(1 << 3)
+#define MMCST1_DAT3ST		(1 << 4)
+#define MMCST1_FIFOEMP		(1 << 5)
+#define MMCST1_FIFOFUL		(1 << 6)
+
+/* MMC INT Mask Reg fields */
+#define MMCIM_EDATDNE		(1 << 0)
+#define MMCIM_EBSYDNE		(1 << 1)
+#define MMCIM_ERSPDNE		(1 << 2)
+#define MMCIM_ETOUTRD		(1 << 3)
+#define MMCIM_ETOUTRS		(1 << 4)
+#define MMCIM_ECRCWR		(1 << 5)
+#define MMCIM_ECRCRD		(1 << 6)
+#define MMCIM_ECRCRS		(1 << 7)
+#define MMCIM_EDXRDY		(1 << 9)
+#define MMCIM_EDRRDY		(1 << 10)
+#define MMCIM_EDATED		(1 << 11)
+#define MMCIM_ETRNDNE		(1 << 12)
+
+#define MMCIM_MASKALL		(0xFFFFFFFF)
+
+/* MMC Resp Tout Reg fields */
+#define MMCTOR_TOR_MASK		(0xFF)		/* dont write to reg, | it */
+#define MMCTOR_TOD_20_16_SHIFT  (8)
+
+/* MMC Data Read Tout Reg fields */
+#define MMCTOD_TOD_0_15_MASK	(0xFFFF)
+
+/* MMC Block len Reg fields */
+#define MMCBLEN_BLEN_MASK	(0xFFF)
+
+/* MMC Num Blocks Reg fields */
+#define MMCNBLK_NBLK_MASK	(0xFFFF)
+#define MMCNBLK_NBLK_MAX	(0xFFFF)
+
+/* MMC Num Blocks Counter Reg fields */
+#define MMCNBLC_NBLC_MASK	(0xFFFF)
+
+/* MMC Cmd Reg fields */
+#define MMCCMD_CMD_MASK		(0x3F)
+#define MMCCMD_PPLEN		(1 << 7)
+#define MMCCMD_BSYEXP		(1 << 8)
+#define MMCCMD_RSPFMT_NONE	(0 << 9)
+#define MMCCMD_RSPFMT_R1567	(1 << 9)
+#define MMCCMD_RSPFMT_R2	(2 << 9)
+#define MMCCMD_RSPFMT_R3	(3 << 9)
+#define MMCCMD_DTRW		(1 << 11)
+#define MMCCMD_STRMTP		(1 << 12)
+#define MMCCMD_WDATX		(1 << 13)
+#define MMCCMD_INITCK		(1 << 14)
+#define MMCCMD_DCLR		(1 << 15)
+#define MMCCMD_DMATRIG		(1 << 16)
+
+/* FIFO control Reg fields */
+#define MMCFIFOCTL_FIFORST	(1 << 0)
+#define MMCFIFOCTL_FIFODIR	(1 << 1)
+#define MMCFIFOCTL_FIFOLEV	(1 << 2)
+#define MMCFIFOCTL_ACCWD_4	(0 << 3)	/* access width of 4 bytes */
+#define MMCFIFOCTL_ACCWD_3	(1 << 3)	/* access width of 3 bytes */
+#define MMCFIFOCTL_ACCWD_2	(2 << 3)	/* access width of 2 bytes */
+#define MMCFIFOCTL_ACCWD_1	(3 << 3)	/* access width of 1 byte */
+
+/* Davinci MMC Register definitions */
+struct davinci_mmc_regs {
+	dv_reg mmcctl;
+	dv_reg mmcclk;
+	dv_reg mmcst0;
+	dv_reg mmcst1;
+	dv_reg mmcim;
+	dv_reg mmctor;
+	dv_reg mmctod;
+	dv_reg mmcblen;
+	dv_reg mmcnblk;
+	dv_reg mmcnblc;
+	dv_reg mmcdrr;
+	dv_reg mmcdxr;
+	dv_reg mmccmd;
+	dv_reg mmcarghl;
+	dv_reg mmcrsp01;
+	dv_reg mmcrsp23;
+	dv_reg mmcrsp45;
+	dv_reg mmcrsp67;
+	dv_reg mmcdrsp;
+	dv_reg mmcetok;
+	dv_reg mmccidx;
+	dv_reg mmcckc;
+	dv_reg mmctorc;
+	dv_reg mmctodc;
+	dv_reg mmcblnc;
+	dv_reg sdioctl;
+	dv_reg sdiost0;
+	dv_reg sdioien;
+	dv_reg sdioist;
+	dv_reg mmcfifoctl;
+};
+
+/* Davinci MMC board definitions */
+struct davinci_mmc {
+	struct davinci_mmc_regs *reg_base;	/* Register base address */
+	uint input_clk;		/* Input clock to MMC controller */
+	uint host_caps;		/* Host capabilities */
+	uint voltages;		/* Host supported voltages */
+	uint version;		/* MMC Controller version */
+};
+
+enum {
+	MMC_CTLR_VERSION_1 = 0,	/* DM644x and DM355 */
+	MMC_CTLR_VERSION_2,	/* DA830 */
+};
+
+int davinci_mmc_init(bd_t *bis, struct davinci_mmc *host);
+
+#endif /* _SDMMC_DEFS_H */
board/davinci/dm355evm/dm355evm.c +44 -0

53 lines not on this page · raw message

board/davinci/dm365evm/dm365evm.c +51 -0

60 lines not on this page · raw message

drivers/mmc/Makefile +1 -0
index 6fa04b8..566ab44 100644
@@ -32,6 +32,7 @@ COBJS-$(CONFIG_OMAP3_MMC) += omap3_mmc.o
 COBJS-$(CONFIG_FSL_ESDHC) += fsl_esdhc.o
 COBJS-$(CONFIG_MXC_MMC) += mxcmmc.o
 COBJS-$(CONFIG_PXA_MMC) += pxa_mmc.o
+COBJS-$(CONFIG_DAVINCI_MMC) += davinci_mmc.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
drivers/mmc/davinci_mmc.c new file +399 -0

399 lines not on this page · raw message

include/configs/davinci_dm355evm.h +17 -4
index 3828a08..2b7019b 100644
@@ -78,6 +78,12 @@
 #define CONFIG_SYS_MAX_NAND_DEVICE	1
 #define CONFIG_SYS_NAND_MAX_CHIPS	2
 
+/* SD/MMC */
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_DAVINCI_MMC
+#define CONFIG_DAVINCI_MMC_SD1
+
 /* USB: OTG connector */
 /* NYET -- #define CONFIG_USB_DAVINCI */
 
@@ -95,6 +101,13 @@
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_SAVES
 
+#ifdef CONFIG_MMC
+#define CONFIG_DOS_PARTITION
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_MMC
+#endif
+
 #ifdef CONFIG_NAND_DAVINCI
 #define CONFIG_CMD_MTDPARTS
 #define CONFIG_MTD_PARTITIONS
@@ -123,7 +136,7 @@
 #define CONFIG_SYS_PROMPT	"DM355 EVM # "	/* Monitor Command Prompt */
 #define CONFIG_SYS_CBSIZE	1024		/* Console I/O Buffer Size  */
 #define CONFIG_SYS_PBSIZE			/* Print buffer size */ \
-		(CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
+	(CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
 #define CONFIG_SYS_MAXARGS	16		/* max number of command args */
 #define CONFIG_SYS_HUSH_PARSER
 #define CONFIG_SYS_PROMPT_HUSH_PS2	"> "
@@ -138,10 +151,10 @@
 
 #define CONFIG_BOOTDELAY	5
 #define CONFIG_BOOTCOMMAND \
-		"dhcp;bootm"
+	"dhcp;bootm"
 #define CONFIG_BOOTARGS \
-		"console=ttyS0,115200n8 " \
-		"root=/dev/mmcblk0p1 rootwait rootfstype=ext3 ro"
+	"console=ttyS0,115200n8 " \
+"root=/dev/mmcblk0p1 rootwait rootfstype=ext3 ro"
 
 #define CONFIG_CMDLINE_EDITING
 #define CONFIG_VERSION_VARIABLE
include/configs/davinci_dm365evm.h +13 -0
index 6f99ae0..bcc2f06 100644
@@ -85,6 +85,12 @@
 #define CONFIG_SYS_MAX_NAND_DEVICE	1
 #define CONFIG_SYS_NAND_MAX_CHIPS	2
 
+/* SD/MMC */
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_DAVINCI_MMC
+#define CONFIG_DAVINCI_MMC_SD1
+
 #define PINMUX4_USBDRVBUS_BITCLEAR       0x3000
 #define PINMUX4_USBDRVBUS_BITSET         0x2000
 
@@ -137,6 +143,13 @@
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_SAVES
 
+#ifdef CONFIG_MMC
+#define CONFIG_DOS_PARTITION
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_MMC
+#endif
+
 #ifdef CONFIG_NAND_DAVINCI
 #define CONFIG_CMD_MTDPARTS
 #define CONFIG_MTD_PARTITIONS
Signature · 1 line
1.6.0.6
#2 lore raw

PATCH 3/5 Davinci Multiblock MMC

Multi-block Read/Write support for Davinci. Uses the new CONFIG_MMC_MBLOCK feature under Generic MMC framework.

---
 drivers/mmc/davinci_mmc.c          |    3 +++
 include/configs/davinci_dm355evm.h |    1 +
 include/configs/davinci_dm365evm.h |    1 +
 3 files changed, 5 insertions(+), 0 deletions(-)
drivers/mmc/davinci_mmc.c +3 -0
index 7ec841c..01a84d6 100644
@@ -392,6 +392,9 @@ int davinci_mmc_init(bd_t *bis, struct davinci_mmc *host)
 	mmc->voltages = host->voltages;
 	mmc->host_caps = host->host_caps;
 
+#ifdef CONFIG_MMC_MBLOCK
+	mmc->b_max = DAVINCI_MAX_BLOCKS;
+#endif
 	mmc_register(mmc);
 
 	return 0;
include/configs/davinci_dm355evm.h +1 -0
index 2b7019b..c11f59e 100644
@@ -83,6 +83,7 @@
 #define CONFIG_GENERIC_MMC
 #define CONFIG_DAVINCI_MMC
 #define CONFIG_DAVINCI_MMC_SD1
+#define CONFIG_MMC_MBLOCK
 
 /* USB: OTG connector */
 /* NYET -- #define CONFIG_USB_DAVINCI */
include/configs/davinci_dm365evm.h +1 -0
index bcc2f06..f426b4f 100644
@@ -90,6 +90,7 @@
 #define CONFIG_GENERIC_MMC
 #define CONFIG_DAVINCI_MMC
 #define CONFIG_DAVINCI_MMC_SD1
+#define CONFIG_MMC_MBLOCK
 
 #define PINMUX4_USBDRVBUS_BITCLEAR       0x3000
 #define PINMUX4_USBDRVBUS_BITSET         0x2000
Signature · 1 line
1.6.0.6
#3 lore raw

PATCH 4/5 Davinci: Environment in MMC

Enables Configuration support in MMC for Davinci. Works with Davinci uflash utility for storing pre-defined configuration options in MMC card.

---
 include/configs/davinci_dm355evm.h |    8 ++++++++
 include/configs/davinci_dm365evm.h |    8 ++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)
include/configs/davinci_dm355evm.h +8 -0
index c11f59e..6067502 100644
@@ -150,6 +150,14 @@
 #undef CONFIG_ENV_IS_IN_FLASH
 #endif
 
+#if defined(CONFIG_MMC) && !defined(CONFIG_ENV_IS_IN_NAND)
+#define CONFIG_CMD_ENV
+#define CONFIG_ENV_SIZE		(16 << 10)	/* 16 KiB */
+#define CONFIG_ENV_OFFSET	(51 << 9)	/* Sector 51 */
+#define CONFIG_ENV_IS_IN_MMC
+#undef CONFIG_ENV_IS_IN_FLASH
+#endif
+
 #define CONFIG_BOOTDELAY	5
 #define CONFIG_BOOTCOMMAND \
 	"dhcp;bootm"
include/configs/davinci_dm365evm.h +8 -0
index f426b4f..8436aad 100644
@@ -182,6 +182,14 @@
 #undef CONFIG_ENV_IS_IN_FLASH
 #endif
 
+#if defined(CONFIG_MMC) && !defined(CONFIG_ENV_IS_IN_NAND)
+#define CONFIG_CMD_ENV
+#define CONFIG_ENV_SIZE		(16 << 10)	/* 16 KiB */
+#define CONFIG_ENV_OFFSET	(51 << 9)	/* Sector 51 */
+#define CONFIG_ENV_IS_IN_MMC
+#undef CONFIG_ENV_IS_IN_FLASH
+#endif
+
 #define CONFIG_BOOTDELAY	3
 #define CONFIG_BOOTCOMMAND \
 		"dhcp;bootm"
Signature · 1 line
1.6.0.6
#4 lore raw

PATCH 5/5 Davinci: Utility for MMC boot

This is a Linux command line tool specific to TI's Davinci platforms, for flashing UBL (User Boot Loader), u-boot and u-boot Environment in the MMC/SD card. This MMC/SD card can be used for booting Davinci platforms that supports MMC/SD boot option.

---
 Makefile                |    2 +-
 tools/uflash/Makefile   |   13 ++
 tools/uflash/README     |  125 ++++++++++++++++
 tools/uflash/config.txt |   11 ++
 tools/uflash/uflash.c   |  379 +++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 529 insertions(+), 1 deletions(-)
 create mode 100644 tools/uflash/Makefile
 create mode 100644 tools/uflash/README
 create mode 100644 tools/uflash/config.txt
 create mode 100644 tools/uflash/uflash.c
Makefile +1 -1
index 82cbbf4..c2b63db 100644
@@ -3746,7 +3746,7 @@ clean:
 	@rm -f $(obj)examples/api/demo{,.bin}
 	@rm -f $(obj)tools/bmp_logo	   $(obj)tools/easylogo/easylogo  \
 	       $(obj)tools/env/{fw_printenv,fw_setenv}			  \
-	       $(obj)tools/envcrc					  \
+	       $(obj)tools/envcrc	   $(obj)tools/uflash/uflash	  \
 	       $(obj)tools/gdb/{astest,gdbcont,gdbsend}			  \
 	       $(obj)tools/gen_eth_addr    $(obj)tools/img2srec		  \
 	       $(obj)tools/mkimage	   $(obj)tools/mpc86x_clk	  \
tools/uflash/Makefile new file +13 -0
new file mode 100644
index 0000000..ab98441
@@ -0,0 +1,13 @@
+include $(TOPDIR)/config.mk
+
+all: $(obj)uflash
+
+HOSTCFLAGS_NOPED += -I $(SRCTREE)/include -DUSE_HOSTCC
+
+$(obj)uflash: $(SRCTREE)/tools/uflash/uflash.c $(SRCTREE)/lib/crc32.c
+	$(HOSTCC) $(HOSTCFLAGS_NOPED) $(HOSTLDFLAGS) -o $@ $^
+
+clean:
+	rm -f $(obj)uflash
+
+.PHONY: all clean
tools/uflash/README new file +125 -0

125 lines not on this page · raw message

tools/uflash/config.txt new file +11 -0
new file mode 100644
index 0000000..f6acb22
@@ -0,0 +1,11 @@
+bootargs=console=ttyS0,115200n8 root=/dev/mmcblk0p1 rootwait rootfstype=ext3 rw
+bootcmd=ext2load mmc 0 0x80700000 boot/uImage; bootm 0x80700000
+bootdelay=1
+baudrate=115200
+bootfile="uImage"
+stdin=serial
+stdout=serial
+stderr=serial
+ethact=dm9000
+videostd=ntsc
+
tools/uflash/uflash.c new file +379 -0

379 lines not on this page · raw message

Signature · 1 line
1.6.0.6