mirror of https://github.com/OpenIPC/firmware.git
				
				
				
			Add ability to set phyaddr(u/d) from kernel cmdline for Hi3516Cv100
							parent
							
								
									7c8b2efef0
								
							
						
					
					
						commit
						faf4c2e791
					
				|  | @ -0,0 +1,30 @@ | |||
| diff --git a/drivers/mmc/host/himciv100/himci.c b/drivers/mmc/host/himciv100/himci.c
 | ||||
| index 64f9af3..dd49323 100644
 | ||||
| --- a/drivers/mmc/host/himciv100/himci.c
 | ||||
| +++ b/drivers/mmc/host/himciv100/himci.c
 | ||||
| @@ -112,6 +112,17 @@ static void hi_mci_sys_reset(struct himci_host *host)
 | ||||
|  	local_irq_restore(flags); | ||||
|  } | ||||
|   | ||||
| +static void hi_mci_sys_undo_reset(struct himci_host *host)
 | ||||
| +{
 | ||||
| +	unsigned long flags;
 | ||||
| +
 | ||||
| +	himci_trace(2, "undo reset");
 | ||||
| +
 | ||||
| +	local_irq_save(flags);
 | ||||
| +	hi_mci_ctr_undo_reset();
 | ||||
| +	local_irq_restore(flags);
 | ||||
| +}
 | ||||
| +
 | ||||
|  static void hi_mci_ctrl_power(struct himci_host *host, unsigned int flag) | ||||
|  { | ||||
|  	himci_trace(2, "begin"); | ||||
| @@ -256,6 +267,8 @@ static void hi_mci_init_card(struct himci_host *host)
 | ||||
|  	hi_mci_ctrl_power(host, POWER_ON); | ||||
|  	udelay(200); | ||||
|   | ||||
| +	hi_mci_sys_undo_reset(host);
 | ||||
| +
 | ||||
|  	/* clear MMC host intr */ | ||||
|  	himci_writel(ALL_INT_CLR, host->base + MCI_RINTSTS); | ||||
|  | @ -0,0 +1,145 @@ | |||
| diff --git a/drivers/net/hieth-sf/glb.c b/drivers/net/hieth-sf/glb.c
 | ||||
| index a145449..6723cca 100644
 | ||||
| --- a/drivers/net/hieth-sf/glb.c
 | ||||
| +++ b/drivers/net/hieth-sf/glb.c
 | ||||
| @@ -18,7 +18,7 @@ int hieth_port_init(struct hieth_netdev_local *ld, int port)
 | ||||
|  	hieth_set_negmode(ld, HIETH_NEGMODE_CPUSET); | ||||
|   | ||||
|  	/* MII or RMII mode */ | ||||
| -	hieth_set_mii_mode(ld, UD_BIT_NAME(CONFIG_HIETH_MII_RMII_MODE));
 | ||||
| +	hieth_set_mii_mode(ld, ld->mdio_intf);
 | ||||
|   | ||||
|  	/*clear all interrupt status*/ | ||||
|  	hieth_clear_irqstatus(ld, UD_BIT_NAME(BITS_IRQS_MASK)); | ||||
| diff --git a/drivers/net/hieth-sf/hieth.h b/drivers/net/hieth-sf/hieth.h
 | ||||
| index 9696300..0df35dc 100644
 | ||||
| --- a/drivers/net/hieth-sf/hieth.h
 | ||||
| +++ b/drivers/net/hieth-sf/hieth.h
 | ||||
| @@ -91,6 +91,8 @@ struct hieth_netdev_local {
 | ||||
|  	unsigned long iobase;		/* virtual io addr */ | ||||
|  	unsigned long iobase_phys;	/* physical io addr */ | ||||
|  	int port;			/* 0 => up port, 1 => down port */ | ||||
| +	int mdio_intf;			/* 0 => mii, 1 => rmii */
 | ||||
| +	int phyaddr;
 | ||||
|   | ||||
|  	struct device *dev; | ||||
|  	struct net_device_stats stats; | ||||
| diff --git a/drivers/net/hieth-sf/net.c b/drivers/net/hieth-sf/net.c
 | ||||
| index c100d7e..db9a1bf 100644
 | ||||
| --- a/drivers/net/hieth-sf/net.c
 | ||||
| +++ b/drivers/net/hieth-sf/net.c
 | ||||
| @@ -29,10 +29,24 @@ static struct net_device *hieth_devs_save[2] = {NULL, NULL};
 | ||||
|   | ||||
|  static struct sockaddr macaddr; | ||||
|   | ||||
| +int hieth_mdio_if_u = CONFIG_HIETH_MII_RMII_MODE_U;
 | ||||
| +module_param_named(mdioifu, hieth_mdio_if_u, int, S_IRUGO);
 | ||||
| +
 | ||||
| +int hieth_mdio_if_d = CONFIG_HIETH_MII_RMII_MODE_D;
 | ||||
| +module_param_named(mdioifd, hieth_mdio_if_d, int, S_IRUGO);
 | ||||
| +
 | ||||
| +int hieth_phyaddr_u = CONFIG_HIETH_PHYID_U;
 | ||||
| +module_param_named(phyaddru, hieth_phyaddr_u, int, S_IRUGO);
 | ||||
| +
 | ||||
| +int hieth_phyaddr_d = CONFIG_HIETH_PHYID_D;
 | ||||
| +module_param_named(phyaddrd, hieth_phyaddr_d, int, S_IRUGO);
 | ||||
| +
 | ||||
| +
 | ||||
|  int tx_flow_ctrl_en; | ||||
|  int tx_flow_ctrl_active_threshold = CONFIG_TX_FLOW_CTRL_ACTIVE_THRESHOLD; | ||||
|  int tx_flow_ctrl_deactive_threshold = CONFIG_TX_FLOW_CTRL_DEACTIVE_THRESHOLD; | ||||
|   | ||||
| +
 | ||||
|  int eee_available; | ||||
|  static int __init hieth_parse_tag(const struct tag *tag) | ||||
|  { | ||||
| @@ -83,7 +97,7 @@ static void hieth_adjust_link(struct net_device *dev)
 | ||||
|  		hieth_set_linkstat(ld, stat); | ||||
|  		phy_print_status(ld->phy); | ||||
|  		ld->link_stat = stat; | ||||
| -		hieth_set_mii_mode(ld, UD_BIT_NAME(CONFIG_HIETH_MII_RMII_MODE));
 | ||||
| +		hieth_set_mii_mode(ld, ld->mdio_intf);
 | ||||
|  	} | ||||
|  } | ||||
|   | ||||
| @@ -704,6 +718,8 @@ static int hieth_platdev_probe_port(struct platform_device *pdev, int port)
 | ||||
|  	ld->iobase_phys = CONFIG_HIETH_IOBASE; | ||||
|   | ||||
|  	ld->port = port; | ||||
| +	ld->mdio_intf = (port == UP_PORT) ? hieth_mdio_if_u : hieth_mdio_if_d;
 | ||||
| +	ld->phyaddr = (port == UP_PORT) ? hieth_phyaddr_u : hieth_phyaddr_d;
 | ||||
|   | ||||
|  	ld->dev = &(pdev->dev); | ||||
|   | ||||
| @@ -715,10 +731,10 @@ static int hieth_platdev_probe_port(struct platform_device *pdev, int port)
 | ||||
|   | ||||
|  	memset(ld->phy_name, 0, sizeof(ld->phy_name)); | ||||
|  	snprintf(ld->phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT, \ | ||||
| -		HIETH_MIIBUS_NAME, UD_PHY_NAME(CONFIG_HIETH_PHYID));
 | ||||
| +		HIETH_MIIBUS_NAME, ld->phyaddr);
 | ||||
|   | ||||
|  	ld->phy = phy_connect(netdev, ld->phy_name, hieth_adjust_link, 0, \ | ||||
| -			UD_BIT_NAME(CONFIG_HIETH_MII_RMII_MODE) ? \
 | ||||
| +			ld->mdio_intf ? \
 | ||||
|  			PHY_INTERFACE_MODE_RMII : PHY_INTERFACE_MODE_MII); | ||||
|  	if (IS_ERR(ld->phy)) { | ||||
|  		hieth_error("connect to phy_device %s failed!", ld->phy_name); | ||||
| @@ -810,7 +826,7 @@ static void phy_quirk(struct hieth_mdio_local *mdio, int phyaddr)
 | ||||
|  	id2 = hieth_mdio_read(mdio, phyaddr, 0x03); | ||||
|   | ||||
|  	phy_id = (((id1 & 0xffff) << 16) | (id2 & 0xffff)); | ||||
| -	if (CONFIG_HIETH_MII_RMII_MODE_U == 1) {
 | ||||
| +	if (hieth_mdio_if_u == 1) {
 | ||||
|  		/* PHY-KSZ8051RNL */ | ||||
|  		if ((phy_id & 0xFFFFFFF0) == 0x221550) { | ||||
|  			reg = hieth_mdio_read(mdio, phyaddr, 0x1F); | ||||
| @@ -866,8 +882,8 @@ static int hieth_plat_driver_probe(struct platform_device *pdev)
 | ||||
|  	hieth_platdev_probe_port(pdev, DOWN_PORT); | ||||
|  #endif | ||||
|   | ||||
| -	phy_quirk(&hieth_mdio_local_device, CONFIG_HIETH_PHYID_U);
 | ||||
| -	phy_quirk(&hieth_mdio_local_device, CONFIG_HIETH_PHYID_D);
 | ||||
| +	phy_quirk(&hieth_mdio_local_device, hieth_phyaddr_u);
 | ||||
| +	phy_quirk(&hieth_mdio_local_device, hieth_phyaddr_d);
 | ||||
|   | ||||
|  	if (hieth_devs_save[UP_PORT]) | ||||
|  		ndev = hieth_devs_save[UP_PORT]; | ||||
| @@ -982,8 +998,8 @@ static int hieth_plat_driver_resume(struct platform_device *pdev)
 | ||||
|  { | ||||
|  	hieth_sys_resume(); | ||||
|   | ||||
| -	phy_quirk(&hieth_mdio_local_device, CONFIG_HIETH_PHYID_U);
 | ||||
| -	phy_quirk(&hieth_mdio_local_device, CONFIG_HIETH_PHYID_D);
 | ||||
| +	phy_quirk(&hieth_mdio_local_device, hieth_phyaddr_u);
 | ||||
| +	phy_quirk(&hieth_mdio_local_device, hieth_phyaddr_d);
 | ||||
|   | ||||
|  	hieth_plat_driver_resume_port(pdev, UP_PORT); | ||||
|  	hieth_plat_driver_resume_port(pdev, DOWN_PORT); | ||||
| diff --git a/drivers/net/hieth-sf/phy_id.c b/drivers/net/hieth-sf/phy_id.c
 | ||||
| index b738f5a..d399d4f 100644
 | ||||
| --- a/drivers/net/hieth-sf/phy_id.c
 | ||||
| +++ b/drivers/net/hieth-sf/phy_id.c
 | ||||
| @@ -29,6 +29,10 @@ static struct hiphy_driver  hiphy_driver_smsc_lan8740 = {
 | ||||
|  	.eee_enable = phy_smsc_a_eee_enable, | ||||
|  }; | ||||
|   | ||||
| +static struct hiphy_driver  hiphy_driver_SMSC_a = {
 | ||||
| +	.eee_enable = phy_smsc_a_eee_enable,
 | ||||
| +};
 | ||||
| +
 | ||||
|  struct hiphy_info phy_info_table[] = { | ||||
|  	/* phy_name		phy_id	  with_eee phy_driver */ | ||||
|  /* SMSC */ | ||||
| @@ -40,10 +44,10 @@ struct hiphy_info phy_info_table[] = {
 | ||||
|  	{"Realtek 8211EG",	0x1cc915, PHY_EEE, &hiphy_driver_rtl8211EG}, | ||||
|  #endif | ||||
|   | ||||
| -/*	{"Realtek 8201",	0x1cc816,  MAC_EEE, &hiphy_driver_SMSC_a},
 | ||||
| -
 | ||||
| +	{"Realtek 8201",	0x1cc816,  MAC_EEE, &hiphy_driver_SMSC_a},
 | ||||
|  	{"IC+ IP101G_DS_R01",	0x2430c54,  MAC_EEE, &hiphy_driver_SMSC_a}, | ||||
| -	{"Micrel KSZ8091MNX-RNB",   0x220000,  MAC_EEE, &hiphy_driver_SMSC_a},*/
 | ||||
| +
 | ||||
| +/*	{"Micrel KSZ8091MNX-RNB",   0x220000,  MAC_EEE, &hiphy_driver_SMSC_a},*/
 | ||||
|  	{0, 0, 0, 0}, | ||||
|  }; | ||||
|  | @ -0,0 +1,48 @@ | |||
| --- a/drivers/net/stmmac/stmmac_main.c	2022-01-14 11:09:38.965900712 +0300
 | ||||
| +++ b/drivers/net/stmmac/stmmac_main.c	2022-01-14 11:48:05.613133817 +0300
 | ||||
| @@ -125,6 +125,10 @@
 | ||||
|  module_param(debug, int, S_IRUGO | S_IWUSR); | ||||
|  MODULE_PARM_DESC(debug, "Message Level (0: no output, 16: all)"); | ||||
|   | ||||
| +static int phymode = -1;
 | ||||
| +module_param(phymode, int, S_IRUGO | S_IWUSR);
 | ||||
| +MODULE_PARM_DESC(phymode, "PHY interface mode (0=MII,4=RMII,5=RGMII)");
 | ||||
| +
 | ||||
|  static int phyaddr = -1; | ||||
|  module_param(phyaddr, int, S_IRUGO); | ||||
|  MODULE_PARM_DESC(phyaddr, "Physical device address"); | ||||
| @@ -347,10 +351,21 @@
 | ||||
|  	else | ||||
|  		netif_carrier_off(priv->dev); | ||||
|   | ||||
| -	/* Always RGMII mode */
 | ||||
| -	newval |= 0x20;
 | ||||
| +        switch (priv->phy_interface) {
 | ||||
| +        case PHY_INTERFACE_MODE_RGMII:
 | ||||
| +        case PHY_INTERFACE_MODE_RGMII_ID:
 | ||||
| +        case PHY_INTERFACE_MODE_RGMII_RXID:
 | ||||
| +        case PHY_INTERFACE_MODE_RGMII_TXID:
 | ||||
| +          newval |= 0x20;
 | ||||
| +          break;
 | ||||
| +        case PHY_INTERFACE_MODE_RMII:
 | ||||
| +          newval |= 0x80;
 | ||||
| +          break;
 | ||||
| +        default:
 | ||||
| +          break;
 | ||||
| +        }
 | ||||
|   | ||||
| -	/* Shift left for GMAC1 */
 | ||||
| +        /* Shift left for GMAC1 */
 | ||||
|  	newval <<= shift; | ||||
|   | ||||
|  	newval |= oldval & ~(mask << shift); | ||||
| @@ -2235,6 +2250,9 @@
 | ||||
|   | ||||
|  	/* Override with kernel parameters if supplied XXX CRS XXX | ||||
|  	 * this needs to have multiple instances */ | ||||
| +	if (phymode >= 0)
 | ||||
| +		plat_dat->interface = phymode;
 | ||||
| +
 | ||||
|  	if ((phyaddr >= 0) && (phyaddr <= 31)) | ||||
|  		plat_dat->phy_addr = phyaddr; | ||||
|   | ||||
		Loading…
	
		Reference in New Issue