TCC8900具有8个SD卡接口(Port),其中它们与GPIO复用:
----------------------------------------------------------------------------------------------------------------
* GPIOB[0-7] = SD_Port5[0-7], GPIOB[12]=SD_CMD_Port5, GPIOB[13]=SD_CLK_Port5
----------------------------------------------------------------------------------------------------------------
* GPIOB[21-28] = SD_Port6[0-7], GPIOB[29]=SD_CMD_Port6, GPIOB[30]=SD_CLK_Port6
----------------------------------------------------------------------------------------------------------------
* GPIOC[14-21] = SD_Port0[0-7], GPIOC[23]=SD_CMD_Port0, GPIOC[22]=SD_CLK_Port0
----------------------------------------------------------------------------------------------------------------
* GPIOE[12-19] = SD_Port2[0-7], GPIOE[21]=SD_CMD_Port2, GPIOE[20]=SD_CLK_Port2
----------------------------------------------------------------------------------------------------------------
* GPIOE[28-31] = SD_Port7[0-3], GPIOE[26]=SD_CMD_Port7, GPIOE[27]=SD_CLK_Port7
----------------------------------------------------------------------------------------------------------------
* GPIOE[8-11] = SD_Port4[0-3], GPIOE[7]=SD_CMD_Port4, GPIOE[6]=SD_CLK_Port4
----------------------------------------------------------------------------------------------------------------
* GPIOF[0-7] = SD_Port3[0-7], GPIOF[8]=SD_CMD_Port3, GPIOF[9]=SD_CLK_Port3
----------------------------------------------------------------------------------------------------------------
* GPIOF[18-21] = SD_Port1[0-3], GPIOF[22]=SD_CMD_Port1, GPIOF[23]=SD_CLK_Port1
----------------------------------------------------------------------------------------------------------------
从上可以看出,Port1、Port4、Port7的数据宽度为4位,其他的port则都为8位,8个端口主要由三个控制寄存器支配,它们分别是:
0xF05A0000 SD/MMC Controller 0
0XF0FA0200 SD/MMC Controller 1
0XF0FA0800 SD Port Configure Registers
通过配置 0xF0FA0800 的寄存器,可以将SD/MMC_Controller0和SD/MMC_Controller1分配到8个Port中的任意一个,例如在
Telechips的EVB评估板上的Linux平台中,MMC_Controller0分配到了Port2,MMC_Controller1分配到了Port5。
在寄存器组织方面,SD以MMC_Controller为中心分为两个核心(分别为Core0和Core1),每个核心分别有两个slot,它们的地址分配情况是:
而对于0XF0FA0800对应的 SD Port Configure Registers则除了0XF0FA0800以外,也对应地分为四组:
另外,SD卡的数据传输还涉及到DMA的问题,这与TCC8900的DMA设置密切相关。
在TCC8900-Linux的内核中可以从文件:
arch/arm/mach-tcc8900/include/mach/TCC89x_Physical.h看到如下的内存定义:
#define HwSDCORESLOT0_BASE *(volatile unsigned long *) 0xF05A0000
#define HwSDCORESLOT1_BASE *(volatile unsigned long *) 0xF05A0100
#define HwSDCORESLOT2_BASE *(volatile unsigned long *) 0xF05A0200
#define HwSDCORESLOT3_BASE *(volatile unsigned long *) 0xF05A0300
//Channel Control Register
#define HwSDCHCTRL_BASE *(volatile unsigned long *) 0xF05A0800
在Linux中,4个slot被做成了平台设备,供用户选配,可以在文件:
arch/arm/mach-tcc8900/devices.c
#if defined(CONFIG_MMC_TCC_SDHC_CORE0_SLOT0)|| defined(CONFIG_MMC_TCC_SDHC_CORE0_SLOT0_MODULE)
static u64 tcc8900_device_mmc_core0_slot0_slot0_dmamask=0xffffffffUL;
static struct resource tcc8900_mmc_core0_slot0_resource[]={
[0]={
.start = 0xF05A0000,
.end = 0xF05A00FF,
.flags = IORESOURCE_MEM,
},
[1]={
.start = INT_SD0_SLOT0,
.end = INT_SD0_SLOT0,
.flags = IORESOURCE_IRQ,
},
}
#endif
从上述源码看出系统为每个SD/MMC的slot分配了一段地址(就是对应寄存器地址域)以及一个中断,
同时,也可以看出TCC89XX支持两路SD同时传输数据。