S3C2410+linux下的SPI驱动代码,开源到底

static int spi_open(struct inode *inode, struct file *file)
{
unsigned long temp1,temp2,temp4;
int i;
// printk("SPPRE = %ld,SPCON = %ld,SPPIN = %ld\n",rSPPRE0,rSPCON0,rSPPIN0);
// printk("CLKCON = 0x%X\n",rCLKCON); //for debug
temp4 = __raw_readl(S3C2410_GPEUP);
// temp4 &= ~(0x3800);
// temp4 |= 0x2000;
temp4 |= 0x1800;
__raw_writel(temp4,S3C2410_GPEUP);
printk("s3c2410_GPEUP value 0x%X\n",__raw_readl(S3C2410_GPEUP)); //for debug
temp1 = __raw_readl(S3C2410_GPECON);
temp1 &= 0xF03FFFFF;
temp1 |= 0xA800000 ;
__raw_writel(temp1,S3C2410_GPECON);
printk("s3c2410_GPECON value 0x%X\n",__raw_readl(S3C2410_GPECON)); //for debug
/*
temp3 = __raw_readl(S3C2410_GPGUP);
temp3 |= 0x04;
__raw_writel(temp3,S3C2410_GPGUP); //spi0 cs0 poll enable
*/
printk("s3c2410_GPGUP value 0x%X\n",__raw_readl(S3C2410_GPGUP)); //for debug
temp2 = __raw_readl(S3C2410_GPGCON);
temp2 &= 0xFFFFFDCF;
temp2 |= 0x50;
__raw_writel(temp2,S3C2410_GPGCON); //for spi0 cs0

查看更多代码


}

posted @ 2010-01-04 10:19  clara  阅读(875)  评论(0编辑  收藏  举报