mirror of
				https://xff.cz/git/u-boot/
				synced 2025-10-31 18:35:42 +01:00 
			
		
		
		
	net: mii: Changes not made by spatch
If the functions passed to the registration function are not in the same C file (extern) then spatch will not handle the dependent changes. Make those changes manually. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> For the 4xx related files: Acked-by: Stefan Roese <sr@denx.de> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
		| @@ -15,6 +15,8 @@ | ||||
| #ifndef	fec_h | ||||
| #define	fec_h | ||||
|  | ||||
| #include <phy.h> | ||||
|  | ||||
| /* Buffer descriptors used FEC. | ||||
| */ | ||||
| typedef struct cpm_buf_desc { | ||||
| @@ -341,10 +343,9 @@ int fecpin_setclear(struct eth_device *dev, int setclear); | ||||
| void __mii_init(void); | ||||
| uint mii_send(uint mii_cmd); | ||||
| int mii_discover_phy(struct eth_device *dev); | ||||
| int mcffec_miiphy_read(const char *devname, unsigned char addr, | ||||
| 		       unsigned char reg, unsigned short *value); | ||||
| int mcffec_miiphy_write(const char *devname, unsigned char addr, | ||||
| 			unsigned char reg, unsigned short value); | ||||
| int mcffec_miiphy_read(struct mii_dev *bus, int addr, int devad, int reg); | ||||
| int mcffec_miiphy_write(struct mii_dev *bus, int addr, int devad, int reg, | ||||
| 			u16 value); | ||||
| #endif | ||||
|  | ||||
| #endif				/* fec_h */ | ||||
|   | ||||
| @@ -318,8 +318,7 @@ static int emac_miiphy_command(u8 addr, u8 reg, int cmd, u16 value) | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| int emac4xx_miiphy_read (const char *devname, unsigned char addr, unsigned char reg, | ||||
| 			 unsigned short *value) | ||||
| int emac4xx_miiphy_read(struct mii_dev *bus, int addr, int devad, int reg) | ||||
| { | ||||
| 	unsigned long sta_reg; | ||||
| 	unsigned long emac_reg; | ||||
| @@ -330,17 +329,15 @@ int emac4xx_miiphy_read (const char *devname, unsigned char addr, unsigned char | ||||
| 		return -1; | ||||
|  | ||||
| 	sta_reg = in_be32((void *)EMAC0_STACR + emac_reg); | ||||
| 	*value = sta_reg >> 16; | ||||
|  | ||||
| 	return 0; | ||||
| 	return sta_reg >> 16; | ||||
| } | ||||
|  | ||||
| /***********************************************************/ | ||||
| /* write a phy reg and return the value with a rc	    */ | ||||
| /***********************************************************/ | ||||
|  | ||||
| int emac4xx_miiphy_write (const char *devname, unsigned char addr, unsigned char reg, | ||||
| 			  unsigned short value) | ||||
| int emac4xx_miiphy_write(struct mii_dev *bus, int addr, int devad, int reg, | ||||
| 			 u16 value) | ||||
| { | ||||
| 	return emac_miiphy_command(addr, reg, EMAC_STACR_WRITE, value); | ||||
| } | ||||
|   | ||||
| @@ -283,10 +283,9 @@ static void mal_err (struct eth_device *dev, unsigned long isr, | ||||
| static void emac_err (struct eth_device *dev, unsigned long isr); | ||||
|  | ||||
| extern int phy_setup_aneg (char *devname, unsigned char addr); | ||||
| extern int emac4xx_miiphy_read (const char *devname, unsigned char addr, | ||||
| 		unsigned char reg, unsigned short *value); | ||||
| extern int emac4xx_miiphy_write (const char *devname, unsigned char addr, | ||||
| 		unsigned char reg, unsigned short value); | ||||
| int emac4xx_miiphy_read(struct mii_dev *bus, int addr, int devad, int reg); | ||||
| int emac4xx_miiphy_write(struct mii_dev *bus, int addr, int devad, int reg, | ||||
| 			 u16 value); | ||||
|  | ||||
| int board_emac_count(void); | ||||
|  | ||||
|   | ||||
| @@ -596,12 +596,10 @@ bool gmac_mii_busywait(unsigned int timeout) | ||||
| 	return tmp & (1 << GMAC_MII_BUSY_SHIFT); | ||||
| } | ||||
|  | ||||
| int gmac_miiphy_read(const char *devname, unsigned char phyaddr, | ||||
| 			unsigned char reg, unsigned short *value) | ||||
| int gmac_miiphy_read(struct mii_dev *bus, int phyaddr, int devad, int reg) | ||||
| { | ||||
| 	uint32_t tmp = 0; | ||||
|  | ||||
| 	(void)devname; | ||||
| 	u16 value = 0; | ||||
|  | ||||
| 	/* Busy wait timeout is 1ms */ | ||||
| 	if (gmac_mii_busywait(1000)) { | ||||
| @@ -621,18 +619,16 @@ int gmac_miiphy_read(const char *devname, unsigned char phyaddr, | ||||
| 		return -1; | ||||
| 	} | ||||
|  | ||||
| 	*value = readl(GMAC_MII_DATA_ADDR) & 0xffff; | ||||
| 	debug("MII read data 0x%x\n", *value); | ||||
| 	return 0; | ||||
| 	value = readl(GMAC_MII_DATA_ADDR) & 0xffff; | ||||
| 	debug("MII read data 0x%x\n", value); | ||||
| 	return value; | ||||
| } | ||||
|  | ||||
| int gmac_miiphy_write(const char *devname, unsigned char phyaddr, | ||||
| 			 unsigned char reg, unsigned short value) | ||||
| int gmac_miiphy_write(struct mii_dev *bus, int phyaddr, int devad, int reg, | ||||
| 		      u16 value) | ||||
| { | ||||
| 	uint32_t tmp = 0; | ||||
|  | ||||
| 	(void)devname; | ||||
|  | ||||
| 	/* Busy wait timeout is 1ms */ | ||||
| 	if (gmac_mii_busywait(1000)) { | ||||
| 		error("%s: Prepare MII write: MII/MDIO busy\n", __func__); | ||||
|   | ||||
| @@ -244,7 +244,18 @@ int bcm_sf2_eth_register(bd_t *bis, u8 dev_num) | ||||
| 	eth_register(dev); | ||||
|  | ||||
| #ifdef CONFIG_CMD_MII | ||||
| 	miiphy_register(dev->name, eth->miiphy_read, eth->miiphy_write); | ||||
| 	int retval; | ||||
| 	struct mii_dev *mdiodev = mdio_alloc(); | ||||
|  | ||||
| 	if (!mdiodev) | ||||
| 		return -ENOMEM; | ||||
| 	strncpy(mdiodev->name, dev->name, MDIO_NAME_LEN); | ||||
| 	mdiodev->read = eth->miiphy_read; | ||||
| 	mdiodev->write = eth->miiphy_write; | ||||
|  | ||||
| 	retval = mdio_register(mdiodev); | ||||
| 	if (retval < 0) | ||||
| 		return retval; | ||||
| #endif | ||||
|  | ||||
| 	/* Initialization */ | ||||
|   | ||||
| @@ -54,10 +54,10 @@ struct eth_info { | ||||
| 	struct phy_device *port[BCM_ETH_MAX_PORT_NUM]; | ||||
| 	int port_num; | ||||
|  | ||||
| 	int (*miiphy_read)(const char *devname, unsigned char phyaddr, | ||||
| 			   unsigned char reg, unsigned short *value); | ||||
| 	int (*miiphy_write)(const char *devname, unsigned char phyaddr, | ||||
| 			    unsigned char reg, unsigned short value); | ||||
| 	int (*miiphy_read)(struct mii_dev *bus, int phyaddr, int devad, | ||||
| 			   int reg); | ||||
| 	int (*miiphy_write)(struct mii_dev *bus, int phyaddr, int devad, | ||||
| 			    int reg, u16 value); | ||||
|  | ||||
| 	int (*mac_init)(struct eth_device *dev); | ||||
| 	int (*enable_mac)(void); | ||||
|   | ||||
| @@ -277,8 +277,7 @@ void __mii_init(void) | ||||
|  *	  Otherwise they hang in mii_send() !!! Sorry! | ||||
|  */ | ||||
|  | ||||
| int mcffec_miiphy_read(const char *devname, unsigned char addr, unsigned char reg, | ||||
| 		       unsigned short *value) | ||||
| int mcffec_miiphy_read(struct mii_dev *bus, int addr, int devad, int reg) | ||||
| { | ||||
| 	short rdreg;		/* register working value */ | ||||
|  | ||||
| @@ -287,28 +286,22 @@ int mcffec_miiphy_read(const char *devname, unsigned char addr, unsigned char re | ||||
| #endif | ||||
| 	rdreg = mii_send(mk_mii_read(addr, reg)); | ||||
|  | ||||
| 	*value = rdreg; | ||||
|  | ||||
| #ifdef MII_DEBUG | ||||
| 	printf("0x%04x\n", *value); | ||||
| 	printf("0x%04x\n", rdreg); | ||||
| #endif | ||||
|  | ||||
| 	return 0; | ||||
| 	return rdreg; | ||||
| } | ||||
|  | ||||
| int mcffec_miiphy_write(const char *devname, unsigned char addr, unsigned char reg, | ||||
| 			unsigned short value) | ||||
| int mcffec_miiphy_write(struct mii_dev *bus, int addr, int devad, int reg, | ||||
| 			u16 value) | ||||
| { | ||||
| #ifdef MII_DEBUG | ||||
| 	printf("miiphy_write(0x%x) @ 0x%x = ", reg, addr); | ||||
| 	printf("miiphy_write(0x%x) @ 0x%x = 0x%04x\n", reg, addr, value); | ||||
| #endif | ||||
|  | ||||
| 	mii_send(mk_mii_write(addr, reg, value)); | ||||
|  | ||||
| #ifdef MII_DEBUG | ||||
| 	printf("0x%04x\n", value); | ||||
| #endif | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -230,24 +230,18 @@ static void miiphy_pre(struct bb_miiphy_bus *bus, char read, | ||||
|  * Returns: | ||||
|  *   0 on success | ||||
|  */ | ||||
| int bb_miiphy_read(const char *devname, unsigned char addr, | ||||
| 		   unsigned char reg, unsigned short *value) | ||||
| int bb_miiphy_read(struct mii_dev *miidev, int addr, int devad, int reg) | ||||
| { | ||||
| 	short rdreg; /* register working value */ | ||||
| 	int v; | ||||
| 	int j; /* counter */ | ||||
| 	struct bb_miiphy_bus *bus; | ||||
|  | ||||
| 	bus = bb_miiphy_getbus(devname); | ||||
| 	bus = bb_miiphy_getbus(miidev->name); | ||||
| 	if (bus == NULL) { | ||||
| 		return -1; | ||||
| 	} | ||||
|  | ||||
| 	if (value == NULL) { | ||||
| 		puts("NULL value pointer\n"); | ||||
| 		return -1; | ||||
| 	} | ||||
|  | ||||
| 	miiphy_pre (bus, 1, addr, reg); | ||||
|  | ||||
| 	/* tri-state our MDIO I/O pin so we can read */ | ||||
| @@ -267,8 +261,7 @@ int bb_miiphy_read(const char *devname, unsigned char addr, | ||||
| 			bus->set_mdc(bus, 1); | ||||
| 			bus->delay(bus); | ||||
| 		} | ||||
| 		/* There is no PHY, set value to 0xFFFF and return */ | ||||
| 		*value = 0xFFFF; | ||||
| 		/* There is no PHY, return */ | ||||
| 		return -1; | ||||
| 	} | ||||
|  | ||||
| @@ -294,13 +287,11 @@ int bb_miiphy_read(const char *devname, unsigned char addr, | ||||
| 	bus->set_mdc(bus, 1); | ||||
| 	bus->delay(bus); | ||||
|  | ||||
| 	*value = rdreg; | ||||
|  | ||||
| #ifdef DEBUG | ||||
| 	printf ("miiphy_read(0x%x) @ 0x%x = 0x%04x\n", reg, addr, *value); | ||||
| 	printf("miiphy_read(0x%x) @ 0x%x = 0x%04x\n", reg, addr, rdreg); | ||||
| #endif | ||||
|  | ||||
| 	return 0; | ||||
| 	return rdreg; | ||||
| } | ||||
|  | ||||
|  | ||||
| @@ -311,13 +302,13 @@ int bb_miiphy_read(const char *devname, unsigned char addr, | ||||
|  * Returns: | ||||
|  *   0 on success | ||||
|  */ | ||||
| int bb_miiphy_write (const char *devname, unsigned char addr, | ||||
| 		     unsigned char reg, unsigned short value) | ||||
| int bb_miiphy_write(struct mii_dev *miidev, int addr, int devad, int reg, | ||||
| 		    u16 value) | ||||
| { | ||||
| 	struct bb_miiphy_bus *bus; | ||||
| 	int j;			/* counter */ | ||||
|  | ||||
| 	bus = bb_miiphy_getbus(devname); | ||||
| 	bus = bb_miiphy_getbus(miidev->name); | ||||
| 	if (bus == NULL) { | ||||
| 		/* Bus not found! */ | ||||
| 		return -1; | ||||
|   | ||||
| @@ -86,10 +86,9 @@ extern struct bb_miiphy_bus bb_miiphy_buses[]; | ||||
| extern int bb_miiphy_buses_num; | ||||
|  | ||||
| void bb_miiphy_init(void); | ||||
| int bb_miiphy_read(const char *devname, unsigned char addr, | ||||
| 		    unsigned char reg, unsigned short *value); | ||||
| int bb_miiphy_write(const char *devname, unsigned char addr, | ||||
| 		     unsigned char reg, unsigned short value); | ||||
| int bb_miiphy_read(struct mii_dev *miidev, int addr, int devad, int reg); | ||||
| int bb_miiphy_write(struct mii_dev *miidev, int addr, int devad, int reg, | ||||
| 		    u16 value); | ||||
| #endif | ||||
|  | ||||
| /* phy seed setup */ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user