由于公司的产品板子是自己的工程师画的,可能布线的问题,CPU主频过高导致ARM启动不了,就尝试着降低主频的频率,由于FCLK:HCLK:PCLK的比值关系,原来的CPU主频是400MHz,所以HCLK是100MHz,PCLK是50MHz。FCLK,HCLK,PCLK之间的关系在另一篇博客中有详细的描述。
我之后查看了各种资料和三星的数据手册对bootloader进行修改,把主频降到304MHz,
具体修改如下:下班了,明天再补充
struct klist klist_children;
struct klist_node knode_parent; /* node in sibling list */
struct klist_node knode_driver;
struct klist_node knode_bus;
struct device *parent;
char bus_id[BUS_ID_SIZE]; /* position on parent bus */
struct device_type *type;
unsigned is_registered:1;
unsigned uevent_suppress:1;
* its driver.
*/
struct device_driver *driver; /* which driver has allocated this device */ //这个设备挂接的驱动
void *driver_data; /* data private to the driver */
void *platform_data; /* Platform specific data, device core doesn't touch it */
struct dev_pm_info power;
int numa_node; /* NUMA node this device is close to */
#endif
u64 *dma_mask; /* dma mask (if dma'able device) */
u64 coherent_dma_mask;/* Like dma_mask, but for
alloc_coherent mappings as
not all hardware supports
64 bit addresses for consistent
allocations such descriptors. */
/* arch specific additions */
struct dev_archdata archdata;
struct list_head devres_head;
struct list_head node;
struct class *class;
dev_t devt; /* dev_t, creates the sysfs "dev" */
struct attribute_group **groups; /* optional groups */
};
const char * name; &n
谨以此文纪念过往的岁月
一.前言
SD卡的大名是耳熟能详,但是SDIO总线确是不为人解,不过说起他的近亲SPI就知道了。我们这里主要是理解SDIO总线,并不去理解SPI总线。也许大家会畏惧其庞大的代码,其实我们并不需要详细理解其具体的实现,我们需要理解其架构。
二.主机(host)
在linux2.6.28中,在sdhci-s3c.c实现对主机的sdhci的驱动,而其设备的添加则在smdk6410_devices中。
在sdhci-s3c.c的sdhci_s3c_probe实现对主机端的驱,对于里面具体的一些实现我们就不看了,主要是看其中通用的code。
static int __devinit sdhci_s3c_probe(structplatform_device *pdev)
{
structsdhci_host*host;
structsdhci_s3c *sc;
host= sdhci_alloc_host(dev, sizeof(struct sdhci_s3c));
sc= sdhci_priv(host);
sdhci_add_host(host);
}
对于上面的函数,主要就是关心上面的几段代码。首先,来看sdhci_host这个结构体,这个是个很重要的东西,这个将会贯穿整个驱动。
struct sdhci_host {
/*Data set by hardware interface driver */
constchar *hw_name; /* Hardware bus name */
unsignedint quirks; /* Deviations from spec. */
int irq; /* Device IRQ */
void__iomem * ioaddr; /* Mapped address */
conststruct sdhci_ops *ops; /* Low level hw interface */
structmmc_host *mmc; /* MMC structure */
u64 dma_mask; /* custom DMA mask */
spinlock_t lock; /* Mutex */
int flags; /* Host attributes */
unsignedint version; /* SDHCI spec. version */
unsignedint max_clk; /* Max possible freq (MHz) */
unsignedint timeout_clk; /* Timeout freq (KHz) */
unsignedint clock; /* Current clock (MHz) */
unsignedshort power; /* Current voltage */
structmmc_request *mrq; /* Current request */
structmmc_command *cmd; /* Current command */
structmmc_data *data; /* Current data request */
unsignedint data_early:1; /* Data finished before cmd */
structsg_mapping_iter sg_miter; /* SG state for PIO */
unsignedint &nb