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。

重新編譯,一切搞定!!!喝杯茶,休息一下...

 

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