All pastes #2061713 Raw Edit

Stuff

public diff v1 · immutable
#2061713 ·published 2011-05-16 17:29 UTC
rendered paste body
Index: target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c===================================================================--- target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c	(revisione 26891)+++ target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c	(copia locale)@@ -236,7 +236,6 @@ 	     ubnt_lssr71_setup);  #define UBNT_M_WAN_PHYMASK	BIT(4)-#define UBNT_M_LAN_PHYMASK	BIT(0)  static void __init ubnt_m_setup(void) {@@ -246,7 +245,7 @@  	ar71xx_add_device_m25p80(NULL); -	ar71xx_add_device_mdio(~(UBNT_M_WAN_PHYMASK | UBNT_M_LAN_PHYMASK));+	ar71xx_add_device_mdio(~UBNT_M_WAN_PHYMASK);  	ar71xx_init_mac(ar71xx_eth0_data.mac_addr, mac1, 0); 	ar71xx_init_mac(ar71xx_eth1_data.mac_addr, mac2, 0);Index: target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ar7240.c===================================================================--- target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ar7240.c	(revisione 26891)+++ target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ar7240.c	(copia locale)@@ -828,6 +828,47 @@ 	return as; } +static void link_function(struct work_struct *work) {+	struct ag71xx *ag = container_of(work, struct ag71xx, link_work);+	unsigned long flags;+	int i;+	int status = 0;++	for (i = 0; i < 4; i++) {+		int link = ar7240sw_phy_read(ag->mii_bus, i, MII_BMSR);+		if(link & BMSR_LSTATUS) {+			status = 1;+			break;+		}+	}++	spin_lock_irqsave(&ag->lock, flags);+	if(status != ag->link) {+		ag->link = status;+		ag71xx_link_adjust(ag);+	}+	spin_unlock_irqrestore(&ag->lock, flags);++	schedule_delayed_work(&ag->link_work, HZ);+}++static int ag71xx_phy_connect_fake(struct ag71xx *ag)+{+	struct net_device *dev = ag->dev;+	struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag);+	int phy_addr;++	ag->link = 1;+	ag->speed = SPEED_1000;+	ag->duplex = DUPLEX_FULL;++	printk("setting phy%d to Fake\n", phy_addr);++	INIT_DELAYED_WORK(&ag->link_work, link_function);++	return 0;+}+ void ag71xx_ar7240_start(struct ag71xx *ag) { 	struct ar7240sw *as = ag->phy_priv;@@ -841,10 +882,13 @@  	ar7240_set_addr(as, ag->dev->dev_addr); 	ar7240_hw_apply(&as->swdev);++	schedule_delayed_work(&ag->link_work, HZ); }  void ag71xx_ar7240_stop(struct ag71xx *ag) {+	cancel_delayed_work(&ag->link_work); }  int __devinit ag71xx_ar7240_init(struct ag71xx *ag)@@ -858,6 +902,8 @@ 	ag->phy_priv = as; 	ar7240sw_reset(as); +	ag71xx_phy_connect_fake(ag);+ 	return 0; } Index: target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h===================================================================--- target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h	(revisione 26891)+++ target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h	(copia locale)@@ -162,6 +162,7 @@ 	int			duplex;  	struct work_struct	restart_work;+	struct delayed_work	link_work; 	struct timer_list	oom_timer;  #ifdef CONFIG_AG71XX_DEBUG_FS