分类: LINUX
2014-03-29 21:41:31
需要修改的内容:
1./include/configs/smdk6410.h
增加:
#define CONFIG_GENERIC_MMC 1
#define CONFIG_MMC 1
#define CONFIG_S3C64X0_MMC 1
#define CONFIG_CMD_MMC /* MMC support */
2./board/samsuang/smdk6410/smdk6410.c
增加:
#ifdef CONFIG_GENERIC_MMC
int board_mmc_init(bd_t *bis)
{
return s3c64x0_mmc_init(0);
}
#endif
3./drivers/mmc/makefile
增加:
COBJS-$(CONFIG_S3C64X0_MMC) = s3c64x0_mmc.o
4./arch/arm/asm/arch_s3c64xx/s3c64x0.h
增加:
//zxd -->
struct s3c64x0_mmc {
unsigned int sysad;
unsigned short blksize;
unsigned short blkcnt;
unsigned int argument;
unsigned short trnmod;
unsigned short cmdreg;
unsigned int rspreg0;
unsigned int rspreg1;
unsigned int rspreg2;
unsigned int rspreg3;
unsigned int bdata;
unsigned int prnsts;
unsigned char hostctl;
unsigned char pwrcon;
unsigned char blkgap;
unsigned char wakcon;
unsigned short clkcon;
unsigned char timeoutcon;
unsigned char swrst;
unsigned int norintsts; /* errintsts */
unsigned int norintstsen; /* errintstsen */
unsigned int norintsigen; /* errintsigen */
unsigned short acmd12errsts;
unsigned char res1[2];
unsigned int capareg;
unsigned char res2[4];
unsigned int maxcurr;
unsigned char res3[0x34];
unsigned int control2;
unsigned int control3;
unsigned int control4;
unsigned char res4[0x6e];
unsigned short hcver;
unsigned char res5[0xFFF02];
};
5./arch/arm/asm/arch_s3c64xx/s3c6410.h
增加:
//-->zxd
struct mmc_host {
struct s3c64x0_mmc *reg;
unsigned int version; /* SDHCI spec. version */
unsigned int clock; /* Current clock (MHz) */
};
int s3c64x0_mmc_init(int dev_index);
//<--zxd
6.复制 s3c64x0_mmc.c 到 /drivers/mmc/s3c64x0_mmc.c
s3c64x0_mmc.c增加:
#include /asm/arch/s3c64x0.h
7./include/mmc.h
struct mmc 结构体里面增加:
int (*detect_mmc)(struct mmc_host *mmc_host);//zxd
8./board/samsung/smdk6410/lowlevel_init.S
修改:
把0x200203 改为0x80200203,不然SD卡的命令都会没响应而“Time out error!”
/* FOUT of EPLL is 96MHz */
ldr r1, =0x80200203//zxd 0x200203
str r1, [r0, #EPLL_CON0_OFFSET]
改完后显示如下:
U-Boot 2012.10 (Nov 21 2012 - 16:29:30) for SMDK6410
CPU: S3C6410@533MHz
Fclk = 533MHz, Hclk = 133MHz, Pclk = 66MHz (ASYNC Mode)
Board: SMDK6410
monitor len: 0007F9C8
ramsize: 10000000
TLB table at: 5fff0000
Top of RAM usable for U-Boot at: 5fff0000
Reserving 510k for U-Boot at: 5ff30000
Reserving 544k for malloc() at: 5fea8000
Reserving 40 Bytes for Board Info at: 5fea7fd8
Reserving 120 Bytes for Global Data at: 5fea7f60
New Stack Pointer is: 5fea7f50
DRAM: 256 MiB
relocation Offset is: 08130000
_start addr is: 57e00000
new_gd: 5FEA7F60
new_addr: 5FF30000
new_sp: 5FEA7F50
WARNING: Caches not enabled
Flash: *** failed ***
NAND: 2048 MiB
MMC: SAMSUNG SD/MMC: 0
*** Warning - bad CRC, using default environment
********************************************************
initial lcd controller
clk_freq:9 MHz, div_freq:13 ,rea_freq:9 MHz
HBP = 2 HFP = 2 HSW = 41,Hpixs:480
VBP = 2 VFP = 2 VSW = 10,Vpixs:272
FrameBuff:5ffb0000
LCD initialization Finished.
In: serial
Out: lcd
Err: lcd
Net: dm9000Hit any key to stop autoboot: 0 SMDK6410 #mmcinfo
Device: SAMSUNG SD/MMC
Manufacturer ID: 2
OEM: 544d
Name: SD02G
Tran Speed: 50000000
Rd Block Len: 512
SD version 2.0
High Capacity: No
Capacity: 1.8 GiB
Bus Width: 4-bit
SMDK6410 # fatls mmc 0
15 test.txt
1 file(s), 0 dir(s)
SMDK6410 #