Clean little bit mess in code included from Atheros (Q)SDK, remove all printf()
authorPiotr Dymacz <pepe2k@gmail.com>
Tue, 22 Mar 2016 00:15:11 +0000 (01:15 +0100)
committerPiotr Dymacz <pepe2k@gmail.com>
Tue, 22 Mar 2016 00:15:11 +0000 (01:15 +0100)
u-boot/board/ar7240/common/athr_s27_phy.c
u-boot/board/ar7240/common/athrs27_phy.c
u-boot/board/ar7240/common/qca-eth-953x.c

index 11d0a91bf1753fdec93a0a53f83eb06c1e65c8a4..af03afaf35b3419ff482b5458eebe0228d078545 100755 (executable)
@@ -49,7 +49,9 @@ extern int ath_gmac_miiphy_write(char *devname, uint32_t phaddr, uint8_t reg, ui
        ath_gmac_miiphy_write(ath_gmac_unit2name(base), addr, reg, data)
 
 
-
+#ifdef S27_PHY_DEBUG
+       #undef S27_PHY_DEBUG
+#endif
 
 
 
@@ -234,7 +236,7 @@ void athrs27_force_10M(int phyAddr,int duplex)
 
 int athrs27_reg_init(void)
 {
-#if S27_PHY_DEBUG
+#ifdef S27_PHY_DEBUG
     uint32_t rd_val;
 #endif
 
@@ -273,7 +275,7 @@ int athrs27_reg_init_lan(void)
 
 
     /* reset switch */
-    printf(MODULE_NAME ": resetting s27\n");
+    //printf(MODULE_NAME ": resetting s27\n");
     athrs27_reg_write(0x0, athrs27_reg_read(0x0)|0x80000000);
 
     while(i--) {
@@ -281,7 +283,7 @@ int athrs27_reg_init_lan(void)
         if(!(athrs27_reg_read(0x0)&0x80000000))
             break;
     }
-    printf(MODULE_NAME ": s27 reset done\n");
+    //printf(MODULE_NAME ": s27 reset done\n");
     athrs27_reg_write(PORT_STATUS_REGISTER0,0x4e);
 
     athrs27_reg_rmw(OPERATIONAL_MODE_REG0,(1<<6));  /* Set GMII mode */
@@ -304,7 +306,7 @@ int athrs27_reg_init_lan(void)
         s27_wr_phy(phyAddr,ATHR_PHY_CONTROL,0x9000);
 #endif
 
-#if S27_PHY_DEBUG
+#ifdef S27_PHY_DEBUG
         rd_val = s27_rd_phy(phyAddr,ATHR_PHY_FUNC_CONTROL);
         printf("S27 ATHR_PHY_FUNC_CONTROL (%d):%x\n",phyAddr,rd_val);
         rd_val = s27_rd_phy(phyAddr,ATHR_PHY_ID1);
@@ -434,7 +436,7 @@ athrs27_phy_setup(int ethUnit)
                          | ATHR_CTRL_SOFTWARE_RESET);
         }
         else  {
-               printf("############ is emulation ############\n");
+               //printf("############ is emulation ############\n");
 
            if(ATHR_ETHUNIT(phyUnit) == ENET_UNIT_WAN) {
                s27_wr_phy(phyAddr, ATHR_AUTONEG_ADVERT,ATHR_ADVERTISE_ALL);
@@ -454,9 +456,9 @@ athrs27_phy_setup(int ethUnit)
            }
        }
        rd_val = s27_rd_phy(phyAddr,ATHR_PHY_CONTROL);
-       printf("%s ATHR_PHY_CONTROL %d :%x\n",__func__,phyAddr,rd_val);
+       //printf("%s ATHR_PHY_CONTROL %d :%x\n",__func__,phyAddr,rd_val);
        rd_val = s27_rd_phy(phyAddr,ATHR_PHY_SPEC_STATUS);
-       printf("%s ATHR_PHY_SPEC_STAUS %d :%x\n",__func__,phyAddr,rd_val);
+       //printf("%s ATHR_PHY_SPEC_STAUS %d :%x\n",__func__,phyAddr,rd_val);
     }
     if (!foundPhy) {
         return FALSE; /* No PHY's configured for this ethUnit */
@@ -523,7 +525,7 @@ athrs27_phy_setup(int ethUnit)
         /* turn off power saving */
         s27_wr_phy(phyUnit, 29, 41);
         s27_wr_phy(phyUnit, 30, 0);
-        printf("def_ S27_VER_1_0\n");
+        //printf("def_ S27_VER_1_0\n");
 #endif
     }
 
index e064d1de39337231213dfcb90d575fda594482f7..4bae6b877b42ece8d880a82f073d6f3a5a12492f 100644 (file)
 /* PHY selections and access functions */
 #define DRV_PRINT(DBG_SW,X)
 
+#ifdef S27_PHY_DEBUG
+       #undef S27_PHY_DEBUG
+#endif
+
 #define ATHR_LAN_PORT_VLAN     1
 #define ATHR_WAN_PORT_VLAN     2
 #define ENET_UNIT_LAN          1
@@ -158,12 +162,12 @@ int athrs27_reg_init_lan(void){
        int i = 60;
        int phyUnit;
        uint32_t phyAddr = 0;
-       #if S27_PHY_DEBUG
+       #ifdef S27_PHY_DEBUG
        uint32_t rd_val;
        #endif
 
        /* reset switch */
-#if S27_PHY_DEBUG
+#ifdef S27_PHY_DEBUG
        printf(MODULE_NAME ": resetting s27\n");
 #endif
 
@@ -177,7 +181,7 @@ int athrs27_reg_init_lan(void){
                }
        }
 
-#if S27_PHY_DEBUG
+#ifdef S27_PHY_DEBUG
        printf(MODULE_NAME ": s27 reset done\n");
 #endif
 
@@ -200,7 +204,7 @@ int athrs27_reg_init_lan(void){
                s27_wr_phy(phyAddr, ATHR_PHY_CONTROL, 0x9000);
 #endif
 
-#if S27_PHY_DEBUG
+#ifdef S27_PHY_DEBUG
                rd_val = s27_rd_phy(phyAddr, ATHR_PHY_FUNC_CONTROL);
                printf("S27 ATHR_PHY_FUNC_CONTROL (%d):%x\n", phyAddr, rd_val);
 
@@ -303,7 +307,7 @@ int athrs27_phy_setup(int ethUnit){
        uint16_t phyHwStatus;
        uint16_t timeout;
        uint32_t phyAddr = 0;
-#if S27_PHY_DEBUG
+#ifdef S27_PHY_DEBUG
        uint32_t rd_val = 0;
 #endif
 
@@ -334,7 +338,7 @@ int athrs27_phy_setup(int ethUnit){
                        }
                }
 
-#if S27_PHY_DEBUG
+#ifdef S27_PHY_DEBUG
                rd_val = s27_rd_phy(phyAddr,ATHR_PHY_CONTROL);
                printf("%s ATHR_PHY_CONTROL %d: 0x%x\n",__func__,phyAddr,rd_val);
 
index 6fb86f1ebc1535bcc8efb00001d908bede097308..26f5e7b398c335fabbc459047618e4229f2f52cd 100755 (executable)
@@ -173,7 +173,7 @@ void ath_gmac_mii_setup(ath_gmac_mac_t *mac)
        ath_reg_wr(SWITCH_CLOCK_SPARE_ADDRESS, 0x231);
        //ath_reg_wr(SWITCH_CLOCK_SPARE_ADDRESS, 0x520);
        if ((mac->mac_unit == 1)) {
-               printf("Honey Bee ---->  MAC 1 S27 PHY *\n");
+               //printf("Honey Bee ---->  MAC 1 S27 PHY *\n");
                ath_reg_wr(ATH_ETH_CFG, ETH_CFG_ETH_RXDV_DELAY_SET(3) |
                                        ETH_CFG_ETH_RXD_DELAY_SET(3)|
                                        ETH_CFG_RGMII_GE0_SET(1));
@@ -190,7 +190,7 @@ void ath_gmac_mii_setup(ath_gmac_mac_t *mac)
        }
 
        if (is_vir_phy()) {
-               printf("Honey Bee ---->VIR PHY*\n");
+               //printf("Honey Bee ---->VIR PHY*\n");
 
                ath_reg_wr(ATH_ETH_CFG, ETH_CFG_ETH_RXDV_DELAY_SET(3) |
                                        ETH_CFG_ETH_RXD_DELAY_SET(3)|
@@ -207,7 +207,7 @@ void ath_gmac_mii_setup(ath_gmac_mac_t *mac)
        }
        if (is_s27()) {
                mgmt_cfg_val = 2;
-               printf("Scorpion ---->S27 PHY*\n");
+               //printf("Scorpion ---->S27 PHY*\n");
                ath_reg_wr(ETH_CFG_ADDRESS, ETH_CFG_MII_GE0_SET(1)|
                                         ETH_CFG_MII_GE0_SLAVE_SET(1));
                udelay(1000);
@@ -252,8 +252,8 @@ static void ath_gmac_hw_start(ath_gmac_mac_t *mac)
 
        ath_gmac_reg_wr(mac, ATH_MAC_FIFO_CFG_3, 0x1f00140);
 
-       printf(": cfg1 %#x cfg2 %#x\n", ath_gmac_reg_rd(mac, ATH_MAC_CFG1),
-                       ath_gmac_reg_rd(mac, ATH_MAC_CFG2));
+       //printf(": cfg1 %#x cfg2 %#x\n", ath_gmac_reg_rd(mac, ATH_MAC_CFG1),
+       //              ath_gmac_reg_rd(mac, ATH_MAC_CFG2));
 
 
 }
@@ -354,7 +354,7 @@ static int ath_gmac_alloc_fifo(int ndesc, ath_gmac_desc_t ** fifo)
        size += CFG_CACHELINE_SIZE - 1;
 
        if ((p = malloc(size)) == NULL) {
-               printf("Cant allocate fifos\n");
+               //printf("Cant allocate fifos\n");
                return -1;
        }
 
@@ -433,7 +433,7 @@ static void ath_gmac_get_ethaddr(struct eth_device *dev)
                eeprom += 6;
                memcpy(mac, eeprom, 6);
        } else {
-               printf("%s: unknown ethernet device %s\n", __func__, dev->name);
+               //printf("%s: unknown ethernet device %s\n", __func__, dev->name);
                return;
        }
        /* Use fixed address if the above address is invalid */
@@ -449,8 +449,6 @@ static void ath_gmac_get_ethaddr(struct eth_device *dev)
                mac[4] = 0x08;
                mac[5] = 0x41;
                /*printf("No valid address in Flash. Using fixed address\n");*/
-       } else {
-               printf("Fetching MAC Address from 0x%p\n", __func__, eeprom);
        }
 }
 
@@ -480,7 +478,7 @@ athr_mgmt_init(void)
 
        ath_reg_wr(GPIO_OUT_FUNCTION4_ADDRESS, rddata);
 #endif
-       printf ("%s ::done\n",__func__);
+       //printf ("%s ::done\n",__func__);
 }
 
 int ath_gmac_enet_initialize(bd_t * bis)
@@ -489,7 +487,7 @@ int ath_gmac_enet_initialize(bd_t * bis)
        u32 mask, mac_h, mac_l;
        int i;
 
-       printf("%s...\n", __func__);
+       //printf("%s...\n", __func__);
 
        /* Switch Analog and digital reset seq */
        mask = ATH_RESET_GE1_PHY |  ATH_RESET_GE0_PHY;
@@ -541,7 +539,7 @@ int ath_gmac_enet_initialize(bd_t * bis)
                        mask = (ATH_RESET_GE0_MAC | ATH_RESET_GE1_MAC | ATH_RESET_GE0_MDIO | ATH_RESET_GE1_MDIO);
 
 
-                       printf("%s: reset mask:%x \n", __func__, mask);
+                       //printf("%s: reset mask:%x \n", __func__, mask);
 
                        ath_reg_rmw_set(RST_RESET_ADDRESS, mask);
                        udelay(1000 * 100);
@@ -570,19 +568,19 @@ int ath_gmac_enet_initialize(bd_t * bis)
 
                if (ath_gmac_macs[i]->mac_unit == 0) { /* WAN Phy */
 #ifdef  CFG_ATHRS27_PHY
-                       printf("S27 reg init\n");
+                       //printf("S27 reg init\n");
                        athrs27_reg_init();
                        mask = ATH_RESET_GE0_MAC;
                         ath_reg_rmw_clear(RST_RESET_ADDRESS, mask);
 #endif
 
 #ifdef CONFIG_VIR_PHY
-                       printf("VIRPhy reg init \n");
+                       //printf("VIRPhy reg init \n");
                        athr_vir_reg_init();
 #endif
                } else {
 #ifdef  CFG_ATHRS27_PHY
-                       printf("S27 reg init\n");
+                       //printf("S27 reg init\n");
                        athrs27_reg_init_lan();
                        mask = ATH_RESET_GE1_MAC;
                         ath_reg_rmw_clear(RST_RESET_ADDRESS, mask);
@@ -604,9 +602,9 @@ int ath_gmac_enet_initialize(bd_t * bis)
                {
                        unsigned char *mac = dev[i]->enetaddr;
 
-                       printf("%s: %02x:%02x:%02x:%02x:%02x:%02x\n", dev[i]->name,
-                                       mac[0] & 0xff, mac[1] & 0xff, mac[2] & 0xff,
-                                       mac[3] & 0xff, mac[4] & 0xff, mac[5] & 0xff);
+                       //printf("%s: %02x:%02x:%02x:%02x:%02x:%02x\n", dev[i]->name,
+                       //              mac[0] & 0xff, mac[1] & 0xff, mac[2] & 0xff,
+                       //              mac[3] & 0xff, mac[4] & 0xff, mac[5] & 0xff);
                }
                mac_l = (dev[i]->enetaddr[4] << 8) | (dev[i]->enetaddr[5]);
                mac_h = (dev[i]->enetaddr[0] << 24) | (dev[i]->enetaddr[1] << 16) |
@@ -617,7 +615,7 @@ int ath_gmac_enet_initialize(bd_t * bis)
 
 
        ath_gmac_phy_setup(ath_gmac_macs[i]->mac_unit);
-               printf("%s up\n",dev[i]->name);
+               //printf("%s up\n",dev[i]->name);
        }