⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 regs-ide.h

📁 优龙2410linux2.6.8内核源代码
💻 H
字号:
/*  created by hzh. to support CF card and IDE on yl-2410/2440 development platform */#include <linux/config.h>#include <asm/irq.h>#include <asm/io.h>#include <asm/hardware.h>#include <asm/mach-types.h>#if 1// defined(CONFIG_ARCH_FS2410) || defined(CONFIG_ARCH_FS2440)/* * Set up a hw structure for a specified data port, control port and IRQ. * This should follow whatever the default interface uses. */static __inline__ voidide_init_hwif_ports(hw_regs_t *hw, int data_port, int ctrl_port, int *irq){	ide_ioreg_t reg;	int i;	int regincr = 1;		regincr = 1 << 1;	memset(hw, 0, sizeof(*hw));	reg = (ide_ioreg_t)data_port;	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {		hw->io_ports[i] = reg;		reg += regincr;	}		hw->io_ports[IDE_CONTROL_OFFSET] = (ide_ioreg_t) ctrl_port;		if (irq)		*irq = 0;}/* * This registers the standard ports for this architecture with the IDE * driver. */#define S3C2410_CF_PWR_CTL	(GPIO_MODE_OUT | GPIO_PULLUP_DIS | GPIO_B10)#define S3C2410_CF_BASE		0x28000000	//nGCS5#define S3C2410_CF_CTL_BASE	0x28800000	//A23 high#define	S3C2410_CF_IRQ		IRQ_EINT3#define S3C2410_IDE_BASE	0x10000000	//nGCS2#define	S3C2410_IDE_IRQ		IRQ_EINT1static __inline__ voidide_init_default_hwifs(void){	hw_regs_t hw_cf, hw_ide;	int cf_base, cf_ctl_base, ide_base;	int ret;	/* map physical adress */	ide_base = (unsigned long) ioremap(S3C2410_IDE_BASE, 0x10000);	if(!ide_base)		printk("ioremap IDE failed\n");	else {// init the interface		ide_init_hwif_ports(&hw_ide, ide_base+0x20, ide_base+0x1c, NULL);		hw_ide.irq = S3C2410_IDE_IRQ;		set_external_irq(hw_ide.irq, EXT_RISING_EDGE, GPIO_PULLUP_DIS);		ret = ide_register_hw(&hw_ide, NULL);		//printk(KERN_INFO "ide_register_hw return %d\n", ret);	}	set_gpio_ctrl(S3C2410_CF_PWR_CTL);	write_gpio_bit(S3C2410_CF_PWR_CTL, 1);	//???	/* map physical adress */		cf_base     = (unsigned long) ioremap(S3C2410_CF_BASE, 0x10000);	cf_ctl_base = (unsigned long) ioremap(S3C2410_CF_CTL_BASE, 0x10000);	if(!cf_base||!cf_ctl_base) {		printk("ioremap CF card failed\n");		if(cf_base)			iounmap((void *)cf_base);		if(cf_ctl_base)			iounmap((void *)cf_ctl_base);	} else {		// init the interface		ide_init_hwif_ports(&hw_cf, cf_base, cf_ctl_base+0xc, NULL);		hw_cf.irq = S3C2410_CF_IRQ;		set_external_irq(hw_cf.irq, EXT_RISING_EDGE, GPIO_PULLUP_DIS);		ret = ide_register_hw(&hw_cf, NULL);		//printk(KERN_INFO "ide_register_hw return %d\n", ret);	}	}#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -