AT91SAM9260的DM9161AEP以MII方式无法以NFS方式挂载文件系统

问题现象描述:

以NFS方式挂载文件时打印错误信息:

IP-Config: Guessing netmask 255.255.255.0
IP-Config: Complete:
     device=eth0, addr=192.168.1.221, mask=255.255.255.0, gw=255.255.255.255,
     host=192.168.1.221, domain=, nis-domain=(none),
     bootserver=255.255.255.0, rootserver=192.168.1.130, rootpath=
Looking up port of RPC 100003/2 on 192.168.1.130
eth0: link up (100/Full)
rpcbind: server 192.168.1.130 not responding, timed out
Root-NFS: Unable to get nfsd port number from server, using default
Looking up port of RPC 100005/1 on 192.168.1.130
rpcbind: server 192.168.1.130 not responding, timed out
Root-NFS: Unable to get mountd port number from server, using default
Root-NFS: Server returned error -5 while mounting /home/dah/rfs-1.16-432
VFS: Unable to mount root fs via NFS, trying floppy.
List of all partitions:
No filesystem could mount root, tried:  nfs
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)
[<c002930c>] (unwind_backtrace+0x0/0xdc) from [<c0232ea8>] (panic+0x40/0x110)
[<c0232ea8>] (panic+0x40/0x110) from [<c0008fec>] (mount_block_root+0x1d0/0x210)
[<c0008fec>] (mount_block_root+0x1d0/0x210) from [<c0009284>] (prepare_namespace+0x164/0x1bc)
[<c0009284>] (prepare_namespace+0x164/0x1bc) from [<c000859c>] (kernel_init+0xb8/0xe4)
[<c000859c>] (kernel_init+0xb8/0xe4) from [<c003ce20>] (do_exit+0x0/0x5ac)
[<c003ce20>] (do_exit+0x0/0x5ac) from [<ffffffff>] (0xffffffff)

 

开始一直以为是内核的配置问题。

最开始怀疑.1.130的NFS服务没启动,再怀疑PORTMAP没有启动。重启两服务后,现象依旧。

后面找到一块9260的开发板,它是RMII方式的,将UBOOT,KERNEL烧进开发板,正常。后面就怀疑是硬件的问题。对比了一下原理图,硬件无错。郁闷了N个小时ing...

用TFTP方式上传数据内核,跳到内核运行,相当正常。说明UBOOT初始化没有问题。那么有问题的只可能是内核了。

后面看源码发现,AT91SAM9260部分,发现linux-2.6.30/arch/arm/mach-at91/at91sam9260_devices.c文件中有这么些东东:

/* --------------------------------------------------------------------
 *  Ethernet
 * -------------------------------------------------------------------- */

#if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
static u64 eth_dmamask = DMA_BIT_MASK(32);
static struct at91_eth_data eth_data;

static struct resource eth_resources[] = {
 [0] = {
  .start = AT91SAM9260_BASE_EMAC,
  .end = AT91SAM9260_BASE_EMAC + SZ_16K - 1,
  .flags = IORESOURCE_MEM,
 },
 [1] = {
  .start = AT91SAM9260_ID_EMAC,
  .end = AT91SAM9260_ID_EMAC,
  .flags = IORESOURCE_IRQ,
 },
};

static struct platform_device at91sam9260_eth_device = {
 .name  = "macb",
 .id  = -1,
 .dev  = {
    .dma_mask  = &eth_dmamask,
    .coherent_dma_mask = DMA_BIT_MASK(32),
    .platform_data  = &eth_data,
 },
 .resource = eth_resources,
 .num_resources = ARRAY_SIZE(eth_resources),
};

void __init at91_add_device_eth(struct at91_eth_data *data)
{
 if (!data)
  return;

 if (data->phy_irq_pin) {
  at91_set_gpio_input(data->phy_irq_pin, 0);
  at91_set_deglitch(data->phy_irq_pin, 1);
 }

printk("********data->phy_irq_pin = %d./n",data->phy_irq_pin);

 /* Pins used for MII and RMII */
 at91_set_A_periph(AT91_PIN_PA19, 0); /* ETXCK_EREFCK */
 at91_set_A_periph(AT91_PIN_PA17, 0); /* ERXDV */
 at91_set_A_periph(AT91_PIN_PA14, 0); /* ERX0 */
 at91_set_A_periph(AT91_PIN_PA15, 0); /* ERX1 */
 at91_set_A_periph(AT91_PIN_PA18, 0); /* ERXER */
 at91_set_A_periph(AT91_PIN_PA16, 0); /* ETXEN */
 at91_set_A_periph(AT91_PIN_PA12, 0); /* ETX0 */
 at91_set_A_periph(AT91_PIN_PA13, 0); /* ETX1 */
 at91_set_A_periph(AT91_PIN_PA21, 0); /* EMDIO */
 at91_set_A_periph(AT91_PIN_PA20, 0); /* EMDC */

 if (!data->is_rmii) {
  at91_set_B_periph(AT91_PIN_PA28, 0); /* ECRS */
  at91_set_B_periph(AT91_PIN_PA29, 0); /* ECOL */
  at91_set_B_periph(AT91_PIN_PA25, 0); /* ERX2 */
  at91_set_B_periph(AT91_PIN_PA26, 0); /* ERX3 */
  at91_set_B_periph(AT91_PIN_PA27, 0); /* ERXCK */
  at91_set_B_periph(AT91_PIN_PA23, 0); /* ETX2 */
  at91_set_B_periph(AT91_PIN_PA24, 0); /* ETX3 */
  at91_set_B_periph(AT91_PIN_PA22, 0); /* ETXER */

  printk("********eth0 is MII mode./n");
 }

 eth_data = *data;
 platform_device_register(&at91sam9260_eth_device);
}
#else
void __init at91_add_device_eth(struct at91_eth_data *data) {}
#endif

 

我在上述函数中加了两条打印信息,发现只打印一条:data->phy_irq_pin = 39。这说明data->is_rmii=1。说明内核默认是支持RMII的。其传递的参数是:is_rmii;该参数在linux-2.6.30/arch/arm/mach-at91/board-sam9260.c 中设置。我顺便将irq_phy_pin更改为:AT91_PIN_PC12。

重新编译,一切搞定!!!喝杯茶,休息一下...

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章