forked from mirrors/linux
		
	[Resent to net instead of net-next - may clash with Anders Roxell's patch series addressing duplicate module names] Commit31dd83b966("net-next: phy: new Asix Electronics PHY driver") introduced a new PHY driver drivers/net/phy/asix.c that causes a module name conflict with a pre-existiting driver (drivers/net/usb/asix.c). The PHY driver is used by the X-Surf 100 ethernet card driver, and loaded by that driver via its PHY ID. A rename of the driver looks unproblematic. Rename PHY driver to ax88796b.c in order to resolve name conflict. Signed-off-by: Michael Schmitz <schmitzmic@gmail.com> Tested-by: Michael Schmitz <schmitzmic@gmail.com> Fixes:31dd83b966("net-next: phy: new Asix Electronics PHY driver") Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
		
			
				
	
	
		
			57 lines
		
	
	
	
		
			1.4 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			57 lines
		
	
	
	
		
			1.4 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
// SPDX-License-Identifier: GPL-2.0+
 | 
						|
/* Driver for Asix PHYs
 | 
						|
 *
 | 
						|
 * Author: Michael Schmitz <schmitzmic@gmail.com>
 | 
						|
 */
 | 
						|
#include <linux/kernel.h>
 | 
						|
#include <linux/errno.h>
 | 
						|
#include <linux/init.h>
 | 
						|
#include <linux/module.h>
 | 
						|
#include <linux/mii.h>
 | 
						|
#include <linux/phy.h>
 | 
						|
 | 
						|
#define PHY_ID_ASIX_AX88796B		0x003b1841
 | 
						|
 | 
						|
MODULE_DESCRIPTION("Asix PHY driver");
 | 
						|
MODULE_AUTHOR("Michael Schmitz <schmitzmic@gmail.com>");
 | 
						|
MODULE_LICENSE("GPL");
 | 
						|
 | 
						|
/**
 | 
						|
 * asix_soft_reset - software reset the PHY via BMCR_RESET bit
 | 
						|
 * @phydev: target phy_device struct
 | 
						|
 *
 | 
						|
 * Description: Perform a software PHY reset using the standard
 | 
						|
 * BMCR_RESET bit and poll for the reset bit to be cleared.
 | 
						|
 * Toggle BMCR_RESET bit off to accommodate broken AX8796B PHY implementation
 | 
						|
 * such as used on the Individual Computers' X-Surf 100 Zorro card.
 | 
						|
 *
 | 
						|
 * Returns: 0 on success, < 0 on failure
 | 
						|
 */
 | 
						|
static int asix_soft_reset(struct phy_device *phydev)
 | 
						|
{
 | 
						|
	int ret;
 | 
						|
 | 
						|
	/* Asix PHY won't reset unless reset bit toggles */
 | 
						|
	ret = phy_write(phydev, MII_BMCR, 0);
 | 
						|
	if (ret < 0)
 | 
						|
		return ret;
 | 
						|
 | 
						|
	return genphy_soft_reset(phydev);
 | 
						|
}
 | 
						|
 | 
						|
static struct phy_driver asix_driver[] = { {
 | 
						|
	.phy_id		= PHY_ID_ASIX_AX88796B,
 | 
						|
	.name		= "Asix Electronics AX88796B",
 | 
						|
	.phy_id_mask	= 0xfffffff0,
 | 
						|
	/* PHY_BASIC_FEATURES */
 | 
						|
	.soft_reset	= asix_soft_reset,
 | 
						|
} };
 | 
						|
 | 
						|
module_phy_driver(asix_driver);
 | 
						|
 | 
						|
static struct mdio_device_id __maybe_unused asix_tbl[] = {
 | 
						|
	{ PHY_ID_ASIX_AX88796B, 0xfffffff0 },
 | 
						|
	{ }
 | 
						|
};
 | 
						|
 | 
						|
MODULE_DEVICE_TABLE(mdio, asix_tbl);
 |