]> git.sur5r.net Git - u-boot/blobdiff - board/netphone/netphone.c
Merge branch 'master' of /home/stefan/git/u-boot/u-boot
[u-boot] / board / netphone / netphone.c
index 698115a319154296f5c7cdc968d88da44b3c230e..53d3172068d8dccb739374b1b56316bf2f8d253f 100644 (file)
 #include <watchdog.h>
 #endif
 
+int fec8xx_miiphy_read(char *devname, unsigned char addr,
+               unsigned char  reg, unsigned short *value);
+int fec8xx_miiphy_write(char *devname, unsigned char  addr,
+               unsigned char  reg, unsigned short value);
+
 /****************************************************************/
 
 /* some sane bit macros */
@@ -351,7 +356,7 @@ static const uint nandcs_table[0x40] = {
 #define MAR_SDRAM_INIT         ((CAS_LATENCY << 6) | 0x00000008LU)
 
 /* 8 */
-#define CFG_MAMR       ((CFG_MAMR_PTA << MAMR_PTA_SHIFT)  | MAMR_PTAE      |   \
+#define CONFIG_SYS_MAMR        ((CONFIG_SYS_MAMR_PTA << MAMR_PTA_SHIFT)  | MAMR_PTAE       |   \
                         MAMR_AMA_TYPE_0 | MAMR_DSA_1_CYCL | MAMR_G0CLA_A11 |   \
                         MAMR_RLFA_1X    | MAMR_WLFA_1X    | MAMR_TLFA_4X)
 
@@ -399,9 +404,9 @@ void check_ram(unsigned int addr, unsigned int size)
        }
 }
 
-long int initdram(int board_type)
+phys_size_t initdram(int board_type)
 {
-       volatile immap_t *immap = (immap_t *) CFG_IMMR;
+       volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
        volatile memctl8xx_t *memctl = &immap->im_memctl;
        long int size;
 
@@ -417,10 +422,10 @@ long int initdram(int board_type)
        /*
         * Map controller bank 3 to the SDRAM bank at preliminary address.
         */
-       memctl->memc_or3 = CFG_OR3_PRELIM;
-       memctl->memc_br3 = CFG_BR3_PRELIM;
+       memctl->memc_or3 = CONFIG_SYS_OR3_PRELIM;
+       memctl->memc_br3 = CONFIG_SYS_BR3_PRELIM;
 
-       memctl->memc_mbmr = CFG_MAMR & ~MAMR_PTAE;      /* no refresh yet */
+       memctl->memc_mbmr = CONFIG_SYS_MAMR & ~MAMR_PTAE;       /* no refresh yet */
 
        udelay(200);
 
@@ -483,12 +488,13 @@ void reset_phys(void)
        mii_init();
 
        for (phyno = 0; phyno < 32; ++phyno) {
-               miiphy_read(phyno, PHY_PHYIDR1, &v);
+               fec8xx_miiphy_read(NULL, phyno, PHY_PHYIDR1, &v);
                if (v == 0xFFFF)
                        continue;
-               miiphy_write(phyno, PHY_BMCR, PHY_BMCR_POWD);
+               fec8xx_miiphy_write(NULL, phyno, PHY_BMCR, PHY_BMCR_POWD);
                udelay(10000);
-               miiphy_write(phyno, PHY_BMCR, PHY_BMCR_RESET | PHY_BMCR_AUTON);
+               fec8xx_miiphy_write(NULL, phyno, PHY_BMCR,
+                               PHY_BMCR_RESET | PHY_BMCR_AUTON);
                udelay(10000);
        }
 }
@@ -540,7 +546,7 @@ void reset_phys(void)
 
 int board_early_init_f(void)
 {
-       volatile immap_t *immap = (immap_t *) CFG_IMMR;
+       volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
        volatile iop8xx_t *ioport = &immap->im_ioport;
        volatile cpm8xx_t *cpm = &immap->im_cpm;
        volatile memctl8xx_t *memctl = &immap->im_memctl;
@@ -591,18 +597,18 @@ int board_early_init_f(void)
        return 0;
 }
 
-#if (CONFIG_COMMANDS & CFG_CMD_NAND)
+#if defined(CONFIG_CMD_NAND)
 
-#include <linux/mtd/nand.h>
+#include <linux/mtd/nand_legacy.h>
 
 extern ulong nand_probe(ulong physadr);
-extern struct nand_chip nand_dev_desc[CFG_MAX_NAND_DEVICE];
+extern struct nand_chip nand_dev_desc[CONFIG_SYS_MAX_NAND_DEVICE];
 
 void nand_init(void)
 {
        unsigned long totlen;
 
-       totlen = nand_probe(CFG_NAND_BASE);
+       totlen = nand_probe(CONFIG_SYS_NAND_BASE);
        printf ("%4lu MB\n", totlen >> 20);
 }
 #endif
@@ -620,7 +626,7 @@ void hw_watchdog_reset(void)
 
 static volatile int left_to_poll = PHONE_CONSOLE_POLL_HZ;      /* poll */
 
-/* called from timer interrupt every 1/CFG_HZ sec */
+/* called from timer interrupt every 1/CONFIG_SYS_HZ sec */
 void board_show_activity(ulong timestamp)
 {
        if (left_to_poll > -PHONE_CONSOLE_POLL_HZ)
@@ -650,7 +656,7 @@ void show_activity(int arg)
 
 #endif
 
-#if defined(CFG_CONSOLE_IS_IN_ENV) && defined(CFG_CONSOLE_OVERWRITE_ROUTINE)
+#if defined(CONFIG_SYS_CONSOLE_IS_IN_ENV) && defined(CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE)
 int overwrite_console(void)
 {
        /* printf("overwrite_console called\n"); */
@@ -673,19 +679,19 @@ int last_stage_init(void)
 
 #if CONFIG_NETPHONE_VERSION == 2
        /* assert peripheral reset */
-       ((volatile immap_t *)CFG_IMMR)->im_ioport.iop_pcdat &= ~_BW(12);
+       ((volatile immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcdat &= ~_BW(12);
        for (i = 0; i < 10; i++)
                udelay(1000);
-       ((volatile immap_t *)CFG_IMMR)->im_ioport.iop_pcdat |=  _BW(12);
+       ((volatile immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcdat |=  _BW(12);
 #endif
        reset_phys();
 
        /* check in order to enable the local console */
        left_to_poll = PHONE_CONSOLE_POLL_HZ;
-       i = CFG_HZ * 2;
+       i = CONFIG_SYS_HZ * 2;
        while (i > 0) {
 
-               if (tstc()) {
+               if (tstc()) {
                        getc();
                        break;
                }
@@ -696,7 +702,7 @@ int last_stage_init(void)
                        status_led_set(0, STATUS_LED_ON);
                        while (!drv_phone_is_idle()) {
                                do_poll();
-                               udelay(1000000 / CFG_HZ);
+                               udelay(1000000 / CONFIG_SYS_HZ);
                        }
 
                        console_assign(stdin, "phone");
@@ -706,7 +712,7 @@ int last_stage_init(void)
                        break;
                }
 
-               udelay(1000000 / CFG_HZ);
+               udelay(1000000 / CONFIG_SYS_HZ);
                i--;
                left_to_poll--;
        }