diff options
Diffstat (limited to 'cpu/arm926ejs/davinci')
-rw-r--r-- | cpu/arm926ejs/davinci/dp83848.c | 2 | ||||
-rw-r--r-- | cpu/arm926ejs/davinci/ether.c | 99 | ||||
-rw-r--r-- | cpu/arm926ejs/davinci/lowlevel_init.S | 4 | ||||
-rw-r--r-- | cpu/arm926ejs/davinci/nand.c | 22 |
4 files changed, 65 insertions, 62 deletions
diff --git a/cpu/arm926ejs/davinci/dp83848.c b/cpu/arm926ejs/davinci/dp83848.c index 5719845..2aa9ef1 100644 --- a/cpu/arm926ejs/davinci/dp83848.c +++ b/cpu/arm926ejs/davinci/dp83848.c @@ -125,7 +125,7 @@ int dp83848_auto_negotiate(int phy_addr) * 10BaseTFD and HD, IEEE 802.3 */ tmp = DP83848_NP | DP83848_TX_FDX | DP83848_TX_HDX | - DP83848_10_FDX | DP83848_10_HDX | DP83848_AN_IEEE_802_3; + DP83848_10_FDX | DP83848_10_HDX | DP83848_AN_IEEE_802_3; dm644x_eth_phy_write(phy_addr, DP83848_ANA_REG, tmp); diff --git a/cpu/arm926ejs/davinci/ether.c b/cpu/arm926ejs/davinci/ether.c index 766bc7d..d286ec0 100644 --- a/cpu/arm926ejs/davinci/ether.c +++ b/cpu/arm926ejs/davinci/ether.c @@ -489,7 +489,7 @@ static void dm644x_eth_ch_teardown(int ch) dly--; udelay(1); if (dly == 0) - break; + break; } adap_emac->TX0CP = cnt; adap_emac->TX0HDP = 0; @@ -504,7 +504,7 @@ static void dm644x_eth_ch_teardown(int ch) dly--; udelay(1); if (dly == 0) - break; + break; } adap_emac->RX0CP = cnt; adap_emac->RX0HDP = 0; @@ -535,83 +535,85 @@ static int tx_send_loop = 0; * This function sends a single packet on the network and returns * positive number (number of bytes transmitted) or negative for error */ -static int dm644x_eth_send_packet(volatile void *packet, int length) +static int dm644x_eth_send_packet (volatile void *packet, int length) { int ret_status = -1; + tx_send_loop = 0; /* Return error if no link */ - if (!phy.get_link_speed(active_phy_addr)) - { - printf("WARN: emac_send_packet: No link\n"); + if (!phy.get_link_speed (active_phy_addr)) { + printf ("WARN: emac_send_packet: No link\n"); return (ret_status); } /* Check packet size and if < EMAC_MIN_ETHERNET_PKT_SIZE, pad it up */ - if (length < EMAC_MIN_ETHERNET_PKT_SIZE) - { + if (length < EMAC_MIN_ETHERNET_PKT_SIZE) { length = EMAC_MIN_ETHERNET_PKT_SIZE; } /* Populate the TX descriptor */ - emac_tx_desc->next = 0; - emac_tx_desc->buffer = (u_int8_t *)packet; + emac_tx_desc->next = 0; + emac_tx_desc->buffer = (u_int8_t *) packet; emac_tx_desc->buff_off_len = (length & 0xffff); emac_tx_desc->pkt_flag_len = ((length & 0xffff) | - EMAC_CPPI_SOP_BIT | - EMAC_CPPI_OWNERSHIP_BIT | - EMAC_CPPI_EOP_BIT); + EMAC_CPPI_SOP_BIT | + EMAC_CPPI_OWNERSHIP_BIT | + EMAC_CPPI_EOP_BIT); /* Send the packet */ - adap_emac->TX0HDP = (unsigned int)emac_tx_desc; + adap_emac->TX0HDP = (unsigned int) emac_tx_desc; /* Wait for packet to complete or link down */ while (1) { - if (!phy.get_link_speed(active_phy_addr)) { - dm644x_eth_ch_teardown(EMAC_CH_TX); - return (ret_status); - } - if (adap_emac->TXINTSTATRAW & 0x01) { - ret_status = length; - break; + if (!phy.get_link_speed (active_phy_addr)) { + dm644x_eth_ch_teardown (EMAC_CH_TX); + return (ret_status); + } + if (adap_emac->TXINTSTATRAW & 0x01) { + ret_status = length; + break; } - tx_send_loop++; + tx_send_loop++; } - return(ret_status); + return (ret_status); } /* * This function handles receipt of a packet from the network */ -static int dm644x_eth_rcv_packet(void) +static int dm644x_eth_rcv_packet (void) { - volatile emac_desc *rx_curr_desc; - volatile emac_desc *curr_desc; - volatile emac_desc *tail_desc; - int status, ret = -1; + volatile emac_desc *rx_curr_desc; + volatile emac_desc *curr_desc; + volatile emac_desc *tail_desc; + int status, ret = -1; rx_curr_desc = emac_rx_active_head; status = rx_curr_desc->pkt_flag_len; if ((rx_curr_desc) && ((status & EMAC_CPPI_OWNERSHIP_BIT) == 0)) { - if (status & EMAC_CPPI_RX_ERROR_FRAME) { - /* Error in packet - discard it and requeue desc */ - printf("WARN: emac_rcv_pkt: Error in packet\n"); + if (status & EMAC_CPPI_RX_ERROR_FRAME) { + /* Error in packet - discard it and requeue desc */ + printf ("WARN: emac_rcv_pkt: Error in packet\n"); } else { - NetReceive(rx_curr_desc->buffer, (rx_curr_desc->buff_off_len & 0xffff)); + NetReceive (rx_curr_desc->buffer, + (rx_curr_desc->buff_off_len & 0xffff)); ret = rx_curr_desc->buff_off_len & 0xffff; - } + } - /* Ack received packet descriptor */ - adap_emac->RX0CP = (unsigned int)rx_curr_desc; - curr_desc = rx_curr_desc; - emac_rx_active_head = (volatile emac_desc *)rx_curr_desc->next; + /* Ack received packet descriptor */ + adap_emac->RX0CP = (unsigned int) rx_curr_desc; + curr_desc = rx_curr_desc; + emac_rx_active_head = + (volatile emac_desc *) rx_curr_desc->next; - if (status & EMAC_CPPI_EOQ_BIT) { - if (emac_rx_active_head) { - adap_emac->RX0HDP = (unsigned int)emac_rx_active_head; + if (status & EMAC_CPPI_EOQ_BIT) { + if (emac_rx_active_head) { + adap_emac->RX0HDP = + (unsigned int) emac_rx_active_head; } else { emac_rx_queue_active = 0; - printf("INFO:emac_rcv_packet: RX Queue not active\n"); + printf ("INFO:emac_rcv_packet: RX Queue not active\n"); } } @@ -621,28 +623,29 @@ static int dm644x_eth_rcv_packet(void) rx_curr_desc->next = 0; if (emac_rx_active_head == 0) { - printf("INFO: emac_rcv_pkt: active queue head = 0\n"); + printf ("INFO: emac_rcv_pkt: active queue head = 0\n"); emac_rx_active_head = curr_desc; emac_rx_active_tail = curr_desc; if (emac_rx_queue_active != 0) { - adap_emac->RX0HDP = (unsigned int)emac_rx_active_head; - printf("INFO: emac_rcv_pkt: active queue head = 0, HDP fired\n"); + adap_emac->RX0HDP = + (unsigned int) emac_rx_active_head; + printf ("INFO: emac_rcv_pkt: active queue head = 0, HDP fired\n"); emac_rx_queue_active = 1; } } else { tail_desc = emac_rx_active_tail; emac_rx_active_tail = curr_desc; - tail_desc->next = (unsigned int)curr_desc; + tail_desc->next = (unsigned int) curr_desc; status = tail_desc->pkt_flag_len; if (status & EMAC_CPPI_EOQ_BIT) { - adap_emac->RX0HDP = (unsigned int)curr_desc; + adap_emac->RX0HDP = (unsigned int) curr_desc; status &= ~EMAC_CPPI_EOQ_BIT; tail_desc->pkt_flag_len = status; } } - return(ret); + return (ret); } - return(0); + return (0); } #endif /* CONFIG_CMD_NET */ diff --git a/cpu/arm926ejs/davinci/lowlevel_init.S b/cpu/arm926ejs/davinci/lowlevel_init.S index a87c112..0a4b2cf 100644 --- a/cpu/arm926ejs/davinci/lowlevel_init.S +++ b/cpu/arm926ejs/davinci/lowlevel_init.S @@ -110,7 +110,7 @@ checkGemStatClkStop: str r10, [r6] /*------------------------------------------------------* - * DDR2 PLL Initialization * + * DDR2 PLL Initialization * *------------------------------------------------------*/ /* Select the Clock Mode Depending on the Value written in the Boot Table by the run script */ @@ -547,7 +547,7 @@ VTP1Lock: /* * Call board-specific lowlevel init. - * That MUST be present and THAT returns + * That MUST be present and THAT returns * back to arch calling code with "mov pc, lr." */ b dv_board_init diff --git a/cpu/arm926ejs/davinci/nand.c b/cpu/arm926ejs/davinci/nand.c index 127be9f..ffc770f 100644 --- a/cpu/arm926ejs/davinci/nand.c +++ b/cpu/arm926ejs/davinci/nand.c @@ -325,17 +325,17 @@ static void nand_flash_init(void) * * *------------------------------------------------------------------*/ acfg1 = 0 - | (0 << 31 ) /* selectStrobe */ - | (0 << 30 ) /* extWait */ - | (1 << 26 ) /* writeSetup 10 ns */ - | (3 << 20 ) /* writeStrobe 40 ns */ - | (1 << 17 ) /* writeHold 10 ns */ - | (1 << 13 ) /* readSetup 10 ns */ - | (5 << 7 ) /* readStrobe 60 ns */ - | (1 << 4 ) /* readHold 10 ns */ - | (3 << 2 ) /* turnAround ?? ns */ - | (0 << 0 ) /* asyncSize 8-bit bus */ - ; + | (0 << 31 ) /* selectStrobe */ + | (0 << 30 ) /* extWait */ + | (1 << 26 ) /* writeSetup 10 ns */ + | (3 << 20 ) /* writeStrobe 40 ns */ + | (1 << 17 ) /* writeHold 10 ns */ + | (1 << 13 ) /* readSetup 10 ns */ + | (5 << 7 ) /* readStrobe 60 ns */ + | (1 << 4 ) /* readHold 10 ns */ + | (3 << 2 ) /* turnAround ?? ns */ + | (0 << 0 ) /* asyncSize 8-bit bus */ + ; emif_regs = (emifregs)DAVINCI_ASYNC_EMIF_CNTRL_BASE; |