mirror of https://github.com/OpenIPC/firmware.git
146 lines
5.3 KiB
Diff
146 lines
5.3 KiB
Diff
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},
|
|
};
|