AT91SAM9261EK硬件连接如下:
NRD/CFOE-------IOR#
NWE/NWR0/CFWE------IOW#
EBI0-NCS2------CS#
PC11/FIQ------INT
PC10-----------RST
PC2/NWAIT-------IOWAIT
A2——CMD
首先u-boot下是能正常启动dm9000网卡的(TFTP可正常工作),u-boot启动过程输出:
dm9000 i/o: 0x30000000, id: 0x90000a46
MAC: 22:34:56:78:08:14
operating at 100M full duplex mode
/********************************************************************************************************************************************/
dm9000网卡驱动是参考ti-dm355 BSP中的,还有参考了版上comquter对相同问题的解答,对9261 startup修改如下:
pio-init()中增加如下相关代码:
kprintf("ETH, ");
/Set SMC for ETH (refer to u-boot 1.1.4)/
out32(AT91SAM9261_SMC_BASE + AT91_SMC_SETUP(2), AT91_SMC_NWESETUP_(2) | AT91_SMC_NCS_WRSETUP_(0)| AT91_SMC_NRDSETUP_(2) | AT91_SMC_NCS_RDSETUP_(0));
out32(AT91SAM9261_SMC_BASE + AT91_SMC_PULSE(2), AT91_SMC_NWEPULSE_(4) | AT91_SMC_NCS_WRPULSE_( 8 )| AT91_SMC_NRDPULSE_(4) | AT91_SMC_NCS_RDPULSE_( 8 ));
out32(AT91SAM9261_SMC_BASE + AT91_SMC_CYCLE(2), AT91_SMC_NWECYCLE_(16) | AT91_SMC_NRDCYCLE_(16));
out32(AT91SAM9261_SMC_BASE + AT91_SMC_MODE(2), AT91_SMC_BAT_WRITE|AT91_SMC_DBW_16 | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(1));
/Configure Reset signal in output PC10/
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_PER, 0x00000400); // Set in PIO mode
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_OER, 0x00000400); //Configure in Output
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_CODR, 0x00000400); /clear Output/
/Configure PIOC(PC11)interrupt for Ethernet Dm9000 (function inti_gpio_intr()in intrinfo.c )/
/********************************************************************************************************************************/
同时参考i.MX27 BSP的写了GPIO interrupt callout
Init_intrinfo.c中修改增加相关内容
const static struct startup_intrinfo intrs[] = {
{ _NTO_INTR_CLASS_EXTERNAL, // vector base
32, // number of vectors
_NTO_INTR_SPARE, // cascade vector
0, // CPU vector base
0, // CPU vector stride
0, // flags
{ INTR_GENFLAG_LOAD_SYSPAGE, 0, &interrupt_id_at91sam9xx_aic },
{ INTR_GENFLAG_LOAD_SYSPAGE | INTR_GENFLAG_LOAD_INTRMASK, 0, &interrupt_eoi_at91sam9xx_aic },
&interrupt_mask_at91sam9xx_aic, // mask callout
&interrupt_unmask_at91sam9xx_aic, // unmask callout
0, // config callout
&aic_base,
},
{ 32, // vector base
96, // number of vectors
8, // cascade vector how to desicde???
0, // CPU vector base
0, // CPU vector stride
0, // flags
{ 0, 0, &interrupt_id_at91sam9261_gpio },
{ INTR_GENFLAG_LOAD_INTRMASK, 0, &interrupt_eoi_at91sam9261_gpio },
&interrupt_mask_at91sam9261_gpio, // mask callout
&interrupt_unmask_at91sam9261_gpio, // unmask callout
0, // config callout
&gpio_base,
},
};
void init_gpio_intr(void)
{
/Mask off all PIO interrupts, and clear status (disable all PIO interrupts)/
out32(AT91SAM9261_PIOA_BASE + AT91_PIO_IER, 0x00000000);
out32(AT91SAM9261_PIOA_BASE + AT91_PIO_IDR,0xFFFFFFFF);
out32(AT91SAM9261_PIOB_BASE + AT91_PIO_IER, 0x00000000);
out32(AT91SAM9261_PIOB_BASE + AT91_PIO_IDR,0xFFFFFFFF);
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_IER, 0x00000000);
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_IDR,0xFFFFFFFF);
/enalbe PC11 interrupt/
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_IER, 0x00000800);
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_IDR, 0xFFFFF7FF);
/Enable PIO & Configure PIO pin as input, with pull-up resistors, glitch filters and input change interrupts/
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_PER, 0x00000800);
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_PDR, 0xFFFFF7FF);
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_IFER, 0x00000800);
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_IFDR, 0xFFFFF7FF);
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_PUER, 0x00000800);
out32(AT91SAM9261_PIOC_BASE + AT91_PIO_PUDR, 0xFFFFF7FF);
}
/*****************************************************************************************************************************/
系统内核起来后
io-pkt-v4-hc -d dm9000 ioport=0x30000300,irq=107,step=4
Unable to init devn-dm9000.so: Unknown error
sloginfo
Time Sev Major Minor Args
Jan 01 00:01:38 5 14 0 tcpip starting
Jan 01 00:01:38 3 14 0 Unable to attach to pci server: No such file or directory
Jan 01 00:01:38 3 14 0 Using pseudo random generator. See “random” option
Jan 01 00:01:38 5 14 0 initializing IPsec… done
Jan 01 00:01:38 5 14 0 IPsec: Initialized Security Association Processing.
Jan 01 00:01:38 6 10 0 id = 0
Jan 01 00:01:38 6 10 0 id = 0
Jan 01 00:01:38 2 10 0 DM9000 not found
Jan 01 00:01:38 2 14 0 shim: unable to init dll devn-dm9000.so: No such device
Jan 01 00:01:38 2 14 0 Unable to init devn-dm9000.so: Unknown error
执行
io-pkt-v4-hc -d dm9000 ioport=0x30000000,irq=107,step=4
结果也都是无法获取dm9000的ID:id=0
麻烦大家帮分析分析问题出在哪里呀,3Q