[PATCH RFC] phylib: fix forced mode misbehaviour for aneg off case
When user disabled autonegotiation via ethtool, and no link is detected, phylib will place phy into forcing mode, and then will start calling phy_force_reduction(). This will break user expectations. For example, user asks for fixed speed 1000: ethtool -s eth0 autoneg off speed 1000 Without link attached what will actually happen is: Trying 100/FULL Trying 100/HALF Trying 10/FULL Trying 10/HALF ... This patch implements software autonegotiation that is equivalent to current behaviour, but enabled only when hardware autonegotiation was enabled and failed afterwards. With aneg disabled, phylib will not try other link setups. Signed-off-by: Anton Vorontsov [EMAIL PROTECTED] --- This is of course post-2.6.25 material and highly RFC, as it changes current behaviour. Please review carefully. Thanks. drivers/net/phy/phy.c | 19 --- include/linux/ethtool.h |4 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 12fccb1..35ad91f 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -264,7 +264,8 @@ void phy_sanitize_settings(struct phy_device *phydev) int idx; /* Sanitize settings based on PHY capabilities */ - if ((features SUPPORTED_Autoneg) == 0) + if ((features SUPPORTED_Autoneg) == 0 + AUTONEG_SOFT != phydev-autoneg) phydev-autoneg = AUTONEG_DISABLE; idx = phy_find_valid(phy_find_setting(phydev-speed, phydev-duplex), @@ -297,13 +298,15 @@ int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd) cmd-advertising = phydev-supported; /* Verify the settings we care about. */ - if (cmd-autoneg != AUTONEG_ENABLE cmd-autoneg != AUTONEG_DISABLE) + if (cmd-autoneg != AUTONEG_ENABLE + cmd-autoneg != AUTONEG_DISABLE + cmd-autoneg != AUTONEG_SOFT) return -EINVAL; if (cmd-autoneg == AUTONEG_ENABLE cmd-advertising == 0) return -EINVAL; - if (cmd-autoneg == AUTONEG_DISABLE + if ((cmd-autoneg == AUTONEG_DISABLE || cmd-autoneg == AUTONEG_SOFT) ((cmd-speed != SPEED_1000 cmd-speed != SPEED_100 cmd-speed != SPEED_10) @@ -433,7 +436,8 @@ int phy_start_aneg(struct phy_device *phydev) mutex_lock(phydev-lock); - if (AUTONEG_DISABLE == phydev-autoneg) + if (AUTONEG_DISABLE == phydev-autoneg || + AUTONEG_SOFT == phydev-autoneg) phy_sanitize_settings(phydev); err = phydev-drv-config_aneg(phydev); @@ -447,7 +451,8 @@ int phy_start_aneg(struct phy_device *phydev) phydev-link_timeout = PHY_AN_TIMEOUT; } else { phydev-state = PHY_FORCING; - phydev-link_timeout = PHY_FORCE_TIMEOUT; + if (AUTONEG_SOFT == phydev-autoneg) + phydev-link_timeout = PHY_FORCE_TIMEOUT; } } @@ -875,7 +880,7 @@ static void phy_state_machine(struct work_struct *work) phydev-speed = settings[idx].speed; phydev-duplex = settings[idx].duplex; - phydev-autoneg = AUTONEG_DISABLE; + phydev-autoneg = AUTONEG_SOFT; pr_info(Trying %d/%s\n, phydev-speed, DUPLEX_FULL == @@ -904,7 +909,7 @@ static void phy_state_machine(struct work_struct *work) if (phydev-link) { phydev-state = PHY_RUNNING; netif_carrier_on(phydev-attached_dev); - } else { + } else if (AUTONEG_SOFT == phydev-autoneg) { if (0 == phydev-link_timeout--) { phy_force_reduction(phydev); needs_aneg = 1; diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index fcbe8b6..446f78b 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h @@ -517,6 +517,10 @@ struct ethtool_ops { */ #define AUTONEG_DISABLE0x00 #define AUTONEG_ENABLE 0x01 +/* Software autonegotiation: will try several link variants in this + * order -- 1000/FULL, 1000/HALF, 100/FULL, 100/HALF, 10/FULL, 10/HALF. + */ +#define AUTONEG_SOFT 0x02 /* Wake-On-Lan options. */ #define WAKE_PHY (1 0) -- 1.5.2.2 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH RFC] phylib: fix forced mode misbehaviour for aneg off case
On Fri, Feb 22, 2008 at 11:40:04AM -0600, Andy Fleming wrote: On Feb 22, 2008, at 09:55, Anton Vorontsov wrote: When user disabled autonegotiation via ethtool, and no link is detected, phylib will place phy into forcing mode, and then will start calling phy_force_reduction(). This will break user expectations. For example, user asks for fixed speed 1000: ethtool -s eth0 autoneg off speed 1000 Without link attached what will actually happen is: Trying 100/FULL Trying 100/HALF Trying 10/FULL Trying 10/HALF ... The intent of phy_force_reduction() was to provide a fallback in case the user unknowingly selects a speed that is not possible with the current link partner. For instance, if you try to select gigabit on a 100MB link, it wouldn't work, but because of the way the code was designed, the phylib will find a link configuration that works. Yup, with this patch phylib will not able to find suitable speed for PHYs without hw angeg capability. The question is: do we have such hardware or this feature was actually unused and we'll not break anything. We can think out something for this case, but it will be still incompatible with old behaviour. For example, for such setups we might introduce kernel command line option, specifying softaneg=eth0, that will force softaneg for PHYs without hw aneg capability. However, I agree that it's not ideal to have the phylib spending a lot of time looking for a link if there's not one there. On the other hand, why is the user trying to force the link to a certain speed if there's no link? To set up fixed speed for the link, thus to not re-setup it when link is gone down... This is how all drivers [not using phylib] are behaving. I'm not really opposed to it, though. This patch implements software autonegotiation that is equivalent to current behaviour, but enabled only when hardware autonegotiation was enabled and failed afterwards. With aneg disabled, phylib will not try other link setups. Signed-off-by: Anton Vorontsov [EMAIL PROTECTED] --- @@ -447,7 +451,8 @@ int phy_start_aneg(struct phy_device *phydev) phydev-link_timeout = PHY_AN_TIMEOUT; } else { phydev-state = PHY_FORCING; -phydev-link_timeout = PHY_FORCE_TIMEOUT; +if (AUTONEG_SOFT == phydev-autoneg) +phydev-link_timeout = PHY_FORCE_TIMEOUT; } } I'm worried that phydev-link_timeout may end up being left in an unknown state here. Are you expecting it to be 0? If so, I think it would be best to set it to 0 in an if clause. Um.. I though about it when I wrote this, and to me it seems we really don't use link_timeout with AUTONEG_DISABLED... We use it for PHY_AN, PHY_FORCING AUTONEG_SOFT, and PHY_RESUMING AUTONEG_ENABLED. But as a matter of safety, I probably indeed add link_timeout zeroing... Thanks, -- Anton Vorontsov email: [EMAIL PROTECTED] backup email: [EMAIL PROTECTED] irc://irc.freenode.net/bd2 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [2.6 patch] net/phy/fixed.c: fix a use-after-free
On Sat, Feb 02, 2008 at 11:15:02PM +0200, Adrian Bunk wrote: This patch fixes a use-after-free introduced by commit a79d8e93d300adb8438ac396cfb118c238ad and spotted by the Coverity checker. Nice catch. We didn't encounter this bug because fixed.c is bool, so module_exit isn't used. Thus, technically, we can remove it completely. But I prefer your patch, because later, we might want to create library versions of the fixed_mdio_bus_{init,exit}. To use, for example, with PCI ethernet card that might have MDIO-less PHY, i.e. configuration is hardwired in the eeprom, but driver still want to use phylib framework. Thanks, Signed-off-by: Adrian Bunk [EMAIL PROTECTED] --- 20c51455b2faed63c3026fd4d7139e5a6a917d31 diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c index 73b6d39..ca9b040 100644 --- a/drivers/net/phy/fixed.c +++ b/drivers/net/phy/fixed.c @@ -236,12 +236,12 @@ module_init(fixed_mdio_bus_init); static void __exit fixed_mdio_bus_exit(void) { struct fixed_mdio_bus *fmb = platform_fmb; - struct fixed_phy *fp; + struct fixed_phy *fp, *tmp; mdiobus_unregister(fmb-mii_bus); platform_device_unregister(pdev); - list_for_each_entry(fp, fmb-phys, node) { + list_for_each_entry_safe(fp, tmp, fmb-phys, node) { list_del(fp-node); kfree(fp); } -- Anton Vorontsov email: [EMAIL PROTECTED] backup email: [EMAIL PROTECTED] irc://irc.freenode.net/bd2 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] [NET] phy/broadcom: add support for BCM5481 PHY
This patch adds support for BCM5481 PHY. Unfortunately it's hard to get specifications for this PHY, so its special register 0x18 isn't annotated properly (but we know it's used to set up the delays). I've kept the magic numbers, so we'll not forget to fix it at the first opportunity, and will name that register and its bits correctly. Signed-off-by: Anton Vorontsov [EMAIL PROTECTED] --- drivers/net/phy/broadcom.c | 54 1 files changed, 54 insertions(+), 0 deletions(-) diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c index 29666c8..d15280e 100644 --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c @@ -99,6 +99,41 @@ static int bcm54xx_config_intr(struct phy_device *phydev) return err; } +static int bcm5481_config_aneg(struct phy_device *phydev) +{ + int ret; + + /* Aneg firsly. */ + ret = genphy_config_aneg(phydev); + + /* Then we can set up the delay. */ + if (phydev-interface == PHY_INTERFACE_MODE_RGMII_ID) { + u16 reg; + + /* +* There is no BCM5481 specification available, so down +* here is everything we know about register 0x18. This +* at least helps BCM5481 to successfuly receive packets +* on MPC8360E-RDK board. Peter Barada [EMAIL PROTECTED] +* says: This sets delay between the RXD and RXC signals +* instead of using trace lengths to achieve timing. +*/ + + /* Set RDX clk delay. */ + reg = 0x7 | (0x7 12); + phy_write(phydev, 0x18, reg); + + reg = phy_read(phydev, 0x18); + /* Set RDX-RXC skew. */ + reg |= (1 8); + /* Write bits 14:0. */ + reg |= (1 15); + phy_write(phydev, 0x18, reg); + } + + return ret; +} + static struct phy_driver bcm5411_driver = { .phy_id = 0x00206070, .phy_id_mask= 0xfff0, @@ -141,6 +176,20 @@ static struct phy_driver bcm5461_driver = { .driver = { .owner = THIS_MODULE }, }; +static struct phy_driver bcm5481_driver = { + .phy_id = 0x0143bca0, + .phy_id_mask= 0xfff0, + .name = Broadcom BCM5481, + .features = PHY_GBIT_FEATURES, + .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, + .config_init= bcm54xx_config_init, + .config_aneg= bcm5481_config_aneg, + .read_status= genphy_read_status, + .ack_interrupt = bcm54xx_ack_interrupt, + .config_intr= bcm54xx_config_intr, + .driver = { .owner = THIS_MODULE }, +}; + static int __init broadcom_init(void) { int ret; @@ -154,8 +203,13 @@ static int __init broadcom_init(void) ret = phy_driver_register(bcm5461_driver); if (ret) goto out_5461; + ret = phy_driver_register(bcm5481_driver); + if (ret) + goto out_5481; return ret; +out_5481: + phy_driver_unregister(bcm5461_driver); out_5461: phy_driver_unregister(bcm5421_driver); out_5421: -- 1.5.2.2 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH for 2.6.25 2/2] [NET] ucc_geth: add support for netpoll
This patch adds netpoll support for the QE UCC Gigabit Ethernet driver. Tested using netconsole and KGDBoE. Signed-off-by: Anton Vorontsov [EMAIL PROTECTED] --- Just resending this. drivers/net/ucc_geth.c | 20 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index e41da46..fba0811 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c @@ -3666,6 +3666,23 @@ static irqreturn_t ucc_geth_irq_handler(int irq, void *info) return IRQ_HANDLED; } +#ifdef CONFIG_NET_POLL_CONTROLLER +/* + * Polling 'interrupt' - used by things like netconsole to send skbs + * without having to re-enable interrupts. It's not called while + * the interrupt routine is executing. + */ +static void ucc_netpoll(struct net_device *dev) +{ + struct ucc_geth_private *ugeth = netdev_priv(dev); + int irq = ugeth-ug_info-uf_info.irq; + + disable_irq(irq); + ucc_geth_irq_handler(irq, dev); + enable_irq(irq); +} +#endif /* CONFIG_NET_POLL_CONTROLLER */ + /* Called when something needs to use the ethernet device */ /* Returns 0 for success. */ static int ucc_geth_open(struct net_device *dev) @@ -4008,6 +4025,9 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma #ifdef CONFIG_UGETH_NAPI netif_napi_add(dev, ugeth-napi, ucc_geth_poll, UCC_GETH_DEV_WEIGHT); #endif /* CONFIG_UGETH_NAPI */ +#ifdef CONFIG_NET_POLL_CONTROLLER + dev-poll_controller = ucc_netpoll; +#endif dev-stop = ucc_geth_close; //dev-change_mtu = ucc_geth_change_mtu; dev-mtu = 1500; -- 1.5.2.2 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH for 2.6.25 1/2] [NET] ucc_geth: fix module removal
- uccf should be set to NULL to not double-free memory on subsequent calls; - ind_hash_q and group_hash_q lists should be initialized in the probe() function, instead of struct_init() (called by open()), otherwise there will be an oops if ucc_geth_driver removed prior 'ifconfig ethX up'; - add unregister_netdev(); - reorder geth_remove() steps. Signed-off-by: Anton Vorontsov [EMAIL PROTECTED] --- Hi Li, You kinda promised that these two patches would hit 2.6.25... ;-) I've rebased the patches so they apply cleanly on the current tree. Thanks, drivers/net/ucc_geth.c | 17 ++--- 1 files changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index 4ffd873..e41da46 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c @@ -2084,8 +2084,10 @@ static void ucc_geth_memclean(struct ucc_geth_private *ugeth) if (!ugeth) return; - if (ugeth-uccf) + if (ugeth-uccf) { ucc_fast_free(ugeth-uccf); + ugeth-uccf = NULL; + } if (ugeth-p_thread_data_tx) { qe_muram_free(ugeth-thread_dat_tx_offset); @@ -2305,10 +2307,6 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) ug_info = ugeth-ug_info; uf_info = ug_info-uf_info; - /* Create CQs for hash tables */ - INIT_LIST_HEAD(ugeth-group_hash_q); - INIT_LIST_HEAD(ugeth-ind_hash_q); - if (!((uf_info-bd_mem_part == MEM_PART_SYSTEM) || (uf_info-bd_mem_part == MEM_PART_MURAM))) { if (netif_msg_probe(ugeth)) @@ -3990,6 +3988,10 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma ugeth = netdev_priv(dev); spin_lock_init(ugeth-lock); + /* Create CQs for hash tables */ + INIT_LIST_HEAD(ugeth-group_hash_q); + INIT_LIST_HEAD(ugeth-ind_hash_q); + dev_set_drvdata(device, dev); /* Set the dev-base_addr to the gfar reg region */ @@ -4040,9 +4042,10 @@ static int ucc_geth_remove(struct of_device* ofdev) struct net_device *dev = dev_get_drvdata(device); struct ucc_geth_private *ugeth = netdev_priv(dev); - dev_set_drvdata(device, NULL); - ucc_geth_memclean(ugeth); + unregister_netdev(dev); free_netdev(dev); + ucc_geth_memclean(ugeth); + dev_set_drvdata(device, NULL); return 0; } -- 1.5.2.2 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] [POWERPC][NET][SERIAL] UCCs: replace device-id with cell-index (was: Re: [PATCH] [POWERPC] get rid of `model = UCC' in the ucc nodes)
On Fri, Feb 01, 2008 at 09:32:38AM -0600, Kumar Gala wrote: On Feb 1, 2008, at 9:01 AM, Anton Vorontsov wrote: It isn't used anywhere, so remove it. If we'll ever need something like this, we'll use compatible property instead. Signed-off-by: Anton Vorontsov [EMAIL PROTECTED] --- Rebased on top of recent tree. Documentation/powerpc/booting-without-of.txt |1 - arch/powerpc/boot/dts/mpc832x_mds.dts|3 --- arch/powerpc/boot/dts/mpc832x_rdb.dts|2 -- arch/powerpc/boot/dts/mpc836x_mds.dts|2 -- arch/powerpc/boot/dts/mpc8568mds.dts |2 -- 5 files changed, 0 insertions(+), 10 deletions(-) diff --git a/Documentation/powerpc/booting-without-of.txt b/ Documentation/powerpc/booting-without-of.txt index 410c847..dcf9758 100644 --- a/Documentation/powerpc/booting-without-of.txt +++ b/Documentation/powerpc/booting-without-of.txt @@ -1675,7 +1675,6 @@ platforms are moved over to use the flattened- device-tree model. [EMAIL PROTECTED] { device_type = network; compatible = ucc_geth; -model = UCC; device-id = 1; can we change device-id to cell-index? Sure. But let's do this in the separate patch? Because this change actually touches the code in the two subsystems: net and serial. I hope everybody will agree to pass it through powerpc tree..? - - - - From: Anton Vorontsov [EMAIL PROTECTED] Subject: [POWERPC][NET][SERIAL] UCCs: replace device-id with cell-index device-id is worse than cell-index. Probably cell-index isn't good either, but device-id is worse anyway. Drivers are modified for backward compatibility's sake. Signed-off-by: Anton Vorontsov [EMAIL PROTECTED] --- Documentation/powerpc/booting-without-of.txt |4 ++-- arch/powerpc/boot/dts/mpc832x_mds.dts|4 +--- arch/powerpc/boot/dts/mpc832x_rdb.dts|2 -- arch/powerpc/boot/dts/mpc836x_mds.dts|2 -- arch/powerpc/boot/dts/mpc836x_rdk.dts| 12 ++-- arch/powerpc/boot/dts/mpc8568mds.dts |2 -- drivers/net/ucc_geth.c |8 +++- drivers/net/ucc_geth_mii.c | 11 --- drivers/serial/ucc_uart.c| 16 9 files changed, 36 insertions(+), 25 deletions(-) diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt index dcf9758..7b30798 100644 --- a/Documentation/powerpc/booting-without-of.txt +++ b/Documentation/powerpc/booting-without-of.txt @@ -1618,7 +1618,7 @@ platforms are moved over to use the flattened-device-tree model. bisync, atm, or serial. - compatible : could be ucc_geth or fsl_atm and so on. - model : should be UCC. - - device-id : the ucc number(1-8), corresponding to UCCx in UM. + - cell-index : the ucc number(1-8), corresponding to UCCx in UM. - reg : Offset and length of the register set for the device - interrupts : a b where a is the interrupt number and b is a field that represents an encoding of the sense and level @@ -1675,7 +1675,7 @@ platforms are moved over to use the flattened-device-tree model. [EMAIL PROTECTED] { device_type = network; compatible = ucc_geth; - device-id = 1; + cell-index = 1; reg = 2000 200; interrupts = a0 0; interrupt-parent = 700; diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts b/arch/powerpc/boot/dts/mpc832x_mds.dts index f8b4a37..539e02f 100644 --- a/arch/powerpc/boot/dts/mpc832x_mds.dts +++ b/arch/powerpc/boot/dts/mpc832x_mds.dts @@ -256,7 +256,6 @@ device_type = network; compatible = ucc_geth; cell-index = 3; - device-id = 3; reg = 0x2200 0x200; interrupts = 34; interrupt-parent = qeic; @@ -271,7 +270,6 @@ device_type = network; compatible = ucc_geth; cell-index = 4; - device-id = 4; reg = 0x3200 0x200; interrupts = 35; interrupt-parent = qeic; @@ -285,7 +283,7 @@ [EMAIL PROTECTED] { device_type = serial; compatible = ucc_uart; - device-id = 5;/* The UCC number, 1-7*/ + cell-index = 5; /* The UCC number, 1-7*/ port-number = 0; /* Which ttyQEx device */ soft-uart; /* We need Soft-UART */ reg = 0x2400 0x200; diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts b/arch/powerpc/boot/dts/mpc832x_rdb.dts index ea7fcbf..179c81c 100644 --- a/arch/powerpc/boot/dts/mpc832x_rdb.dts +++ b/arch/powerpc
Re: [PATCH UCC TDM 1/3 Updated] Platform changes for UCC TDM driver for MPC8323eRDB. Also includes related QE changes and dts entries.
Hello Poonam, On Thu, Jan 24, 2008 at 04:00:06PM +0530, Poonam_Aggrwal-b10812 wrote: Thanks Stephen for your comments, incorporated them. From: Poonam Aggrwal [EMAIL PROTECTED] This patch makes necessary changes in the QE and UCC framework to support TDM. It also adds support to configure the BRG properly through device tree entries. Includes the device tree changes for UCC TDM driver as well. It also includes device tree entries for UCC TDM driver. Tested on MPC8323ERDB platform. Signed-off-by: Poonam Aggrwal [EMAIL PROTECTED] Signed-off-by: Ashish Kalra [EMAIL PROTECTED] Signed-off-by: Kim Phillips [EMAIL PROTECTED] Signed-off-by: Michael Barkowski [EMAIL PROTECTED] --- arch/powerpc/boot/dts/mpc832x_rdb.dts | 58 +++ arch/powerpc/sysdev/qe_lib/qe.c | 184 +-- arch/powerpc/sysdev/qe_lib/ucc.c | 265 + arch/powerpc/sysdev/qe_lib/ucc_fast.c | 37 + include/asm-powerpc/qe.h |8 + include/asm-powerpc/ucc.h |4 + include/asm-powerpc/ucc_fast.h|4 + 7 files changed, 548 insertions(+), 12 deletions(-) diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts b/arch/powerpc/boot/dts/mpc832x_rdb.dts index 388c8a7..c0e6283 100644 --- a/arch/powerpc/boot/dts/mpc832x_rdb.dts +++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts @@ -105,6 +105,17 @@ device_type = par_io; num-ports = 7; + ucc1pio:[EMAIL PROTECTED] { + pio-map = + /* port pin dir open_drain assignment has_irq */ + 0 e 2 0 1 0/* CLK11 */ + 3 16 1 0 2 0/* BRG9 */ + 3 1b 1 0 2 0/* BRG3 */ + 0 0 3 0 2 0/* TDMATxD0 */ + 0 4 3 0 2 0/* TDMARxD0 */ + 3 1b 2 0 1 0; /* CLK1 */ + }; + Can we not introduce new pio-maps in the device trees? There were debates regarding this, and if I understood everything correctly, pio-maps considered as a bad taste. Better do bunch of par_io_config_pin() in the board file. Better yet fixup the firmware (u-boot) to set up dedicated pins correctly. Thanks, -- Anton Vorontsov email: [EMAIL PROTECTED] backup email: [EMAIL PROTECTED] irc://irc.freenode.net/bd2 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH UCC TDM 1/3 Updated] Platform changes for UCC TDM driver for MPC8323eRDB. Also includes related QE changes and dts entries.
On Thu, Jan 24, 2008 at 09:55:31AM -0600, Timur Tabi wrote: Anton Vorontsov wrote: Can we not introduce new pio-maps in the device trees? There were debates regarding this, and if I understood everything correctly, pio-maps considered as a bad taste. Better do bunch of par_io_config_pin() in the board file. Better yet fixup the firmware (u-boot) to set up dedicated pins correctly. I'm on the fence with respect to pio-maps vs. par_io_config_pin() calls. The problem is that the configuration of these pins is board-specific, but pins are used by devices. A device driver can't call par_io_config_pin(), because the calls are different depending on which SoC and which UCC you're using. The platform code can't call par_io_config_pin(), because that configuration depends on which drivers are loaded. Are you saying that TDM is sharing same pins with the other QE device, and we can choose to use/not use some device depending on which driver is loaded? I think this particular board and patch isn't that case. Even if someday there will be the case when drivers are mutually exclusive, i.e. presence of some driver should trigger pins reconfiguration, then anyway this should be handled differently. That is, we should not _register_ two mutually exclusive devices in the first place, so drivers will not probe them. That's board setup code authority, and pins configuration still should happen there. [ Irrelevant to UCCs and this particular case: lately I've encountered one interesting case of Par IO usage. FHCI USB needs switching between pin's dedicated functions and GPIO functions. So, firstly it is using pins as dedicated, and later (at the bus reset) driver turns them to act as GPIOs. This is still handled without pio-map though, via gpios = property for that driver. ] In other words, the pin configurations are dependent on the UCC configurations, and the UCC configurations are stored in the device tree. So it makes sense to put the pin configurations in the device tree, too. In that particular case UCC configuration is static, for every UCC. So, we can set up all pins in the firmware/board file. Please correct me if I'm wrong. -- Anton Vorontsov email: [EMAIL PROTECTED] backup email: [EMAIL PROTECTED] irc://irc.freenode.net/bd2 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH UCC TDM 1/3 Updated] Platform changes for UCC TDM driver for MPC8323eRDB. Also includes related QE changes and dts entries.
On Thu, Jan 24, 2008 at 10:33:47AM -0600, Timur Tabi wrote: Anton Vorontsov wrote: Are you saying that TDM is sharing same pins with the other QE device, and we can choose to use/not use some device depending on which driver is loaded? No. I'd have to closely examine the DTS, but I don't think that UCC devices share pins at all. But that isn't my point. In that particular case UCC configuration is static, for every UCC. So, we can set up all pins in the firmware/board file. Yes, but deciding what the UCC does might not be static. At what point do we declare, UCC5 is for eth0 and eth0 only? The advantage of putting the pin configurations in the device tree is that they now become configurable. I can envision a scenario where UCC5 could be either an Ethernet or a UART, depending on the setting of some jumpers on the board. That's what the QE was designed for: any UCC can do any task, and you can even have a UCC change its purpose while the system is running. So I don't want the pin configurations hard-coded into the kernel. Having them in the device tree gives me some flexibility. If hardware configuration is selected at the bootup time, by jumpers or switches, it's even easier to do it right. Without pio-map. For instance, I have a plan (that I keep postponing) to introduce a new feature in U-Boot where U-Boot can determine the settings of some board jumpers and modify the device tree accordingly. The instructions on how to modify the device tree would be embedded in the tree itself. Why you need to modify the device tree for that? Let the U-Boot simply setup pins for the kernel. Regarding kernel overwriting pins configuration... I can't support this feature if the kernel calls par_io_config_pin() regardless of what's in the device tree. What I've understood from the previous debates, is that ideally kernel should not touch pins' configuration. Today we're using pio-map solely to fix up some old firmware misconfiguration. And we can do this in the board file still. To determine if we need to fixup the firmware or not, we can use some device tree property instead (firmware version?). p.s. I'm neither for pio-map nor against. I just want some consequence regarding this. Last thread ended with consequence that pio-map is a bad thing to use... -- Anton Vorontsov email: [EMAIL PROTECTED] backup email: [EMAIL PROTECTED] irc://irc.freenode.net/bd2 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] [NET] cpmac: convert to new Fixed PHY infrastructure (was: Re: fixed phy support (warning related to FIXED_MII_100_FDX))
On Mon, Jan 21, 2008 at 01:19:41PM -0600, Kumar Gala wrote: Anton, it looks like the TI AR7 CPMAC Ethernet support uses FIXED_PHY and was selecting FIXED_MII_100_FDX which is gone. Can you look into this. I get the following warning now: scripts/kconfig/conf -s arch/powerpc/Kconfig drivers/net/Kconfig:1713:warning: 'select' used by config symbol 'CPMAC' refers to undefined symbol 'FIXED_MII_100_FDX' Wow. I thought there were no Fixed PHY users. :-) Jeff, as you've already Acked Fixed PHY rework to go through powerpc tree, would you please Ack this patch in addition? I hope cpmac maintainer will fix remaining issues as time goes by. Thanks! - - - - From: Anton Vorontsov [EMAIL PROTECTED] Subject: [PATCH] [NET] cpmac: convert to new Fixed PHY infrastructure This patch converts cpmac to the new Fixed PHY infrastructure, though it doesn't fix all the problems with that driver. I didn't even bother to test this patch to compile, because cpmac driver is broken in several ways: 1. This driver won't compile by itself because lack of its header describing platform data; 2. It assumes that fixed PHYs should be created by the ethernet driver. It is wrong assumption: fixed PHYs creation is platform code authority, driver must blindly accept bus_id and phy_id platform data variables instead. Also, it seem that that driver doesn't have actual in-tree users, so nothing to fix further. The main purpose of that patch is to get rid of the following Kconfig warning: scripts/kconfig/conf -s arch/powerpc/Kconfig drivers/net/Kconfig:1713:warning: 'select' used by config symbol 'CPMAC' refers to undefined symbol 'FIXED_MII_100_FDX' Signed-off-by: Anton Vorontsov [EMAIL PROTECTED] --- drivers/net/Kconfig |4 +-- drivers/net/cpmac.c | 55 -- 2 files changed, 19 insertions(+), 40 deletions(-) diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 114771a..5380ff9 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -1707,10 +1707,8 @@ config SC92031 config CPMAC tristate TI AR7 CPMAC Ethernet support (EXPERIMENTAL) - depends on NET_ETHERNET EXPERIMENTAL AR7 + depends on NET_ETHERNET EXPERIMENTAL AR7 BROKEN select PHYLIB - select FIXED_PHY - select FIXED_MII_100_FDX help TI AR7 CPMAC Ethernet support diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c index 6fd95a2..88eeb1d 100644 --- a/drivers/net/cpmac.c +++ b/drivers/net/cpmac.c @@ -848,15 +848,6 @@ static void cpmac_adjust_link(struct net_device *dev) spin_unlock(priv-lock); } -static int cpmac_link_update(struct net_device *dev, -struct fixed_phy_status *status) -{ - status-link = 1; - status-speed = 100; - status-duplex = 1; - return 0; -} - static int cpmac_open(struct net_device *dev) { int i, size, res; @@ -999,11 +990,11 @@ static int external_switch; static int __devinit cpmac_probe(struct platform_device *pdev) { int rc, phy_id, i; + int mdio_bus_id = cpmac_mii.id; struct resource *mem; struct cpmac_priv *priv; struct net_device *dev; struct plat_cpmac_data *pdata; - struct fixed_info *fixed_phy; DECLARE_MAC_BUF(mac); pdata = pdev-dev.platform_data; @@ -1017,9 +1008,23 @@ static int __devinit cpmac_probe(struct platform_device *pdev) } if (phy_id == PHY_MAX_ADDR) { - if (external_switch || dumb_switch) + if (external_switch || dumb_switch) { + struct fixed_phy_status status = {}; + + mdio_bus_id = 0; + + /* +* FIXME: this should be in the platform code! +* Since there is not platform code at all (that is, +* no mainline users of that driver), place it here +* for now. +*/ phy_id = 0; - else { + status.link = 1; + status.duplex = 1; + status.speed = 100; + fixed_phy_add(PHY_POLL, phy_id, status); + } else { printk(KERN_ERR cpmac: no PHY present\n); return -ENODEV; } @@ -1063,32 +1068,8 @@ static int __devinit cpmac_probe(struct platform_device *pdev) priv-msg_enable = netif_msg_init(debug_level, 0xff); memcpy(dev-dev_addr, pdata-dev_addr, sizeof(dev-dev_addr)); - if (phy_id == 31) { - snprintf(priv-phy_name, BUS_ID_SIZE, PHY_ID_FMT, cpmac_mii.id, -phy_id); - } else { - /* Let's try to get a free fixed phy... */ - for (i = 0; i MAX_PHY_AMNT; i++) { - fixed_phy = fixed_mdio_get_phydev(i
[PATCH 2/4] [POWERPC][NET] ucc_geth_mii and users: get rid of device_type
device_type property is bogus, thus use proper compatible. Also change compatible property to fsl,ucc-mdio. Per http://ozlabs.org/pipermail/linuxppc-dev/2007-December/048388.html Signed-off-by: Anton Vorontsov [EMAIL PROTECTED] --- arch/powerpc/boot/dts/mpc832x_mds.dts |3 +-- arch/powerpc/boot/dts/mpc832x_rdb.dts |3 +-- arch/powerpc/boot/dts/mpc836x_mds.dts |3 +-- arch/powerpc/boot/dts/mpc8568mds.dts |2 +- drivers/net/ucc_geth_mii.c|3 +++ 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts b/arch/powerpc/boot/dts/mpc832x_mds.dts index 010c8d9..cf41194 100644 --- a/arch/powerpc/boot/dts/mpc832x_mds.dts +++ b/arch/powerpc/boot/dts/mpc832x_mds.dts @@ -255,8 +255,7 @@ #address-cells = 1; #size-cells = 0; reg = 2320 18; - device_type = mdio; - compatible = ucc_geth_phy; + compatible = fsl,ucc-mdio; phy3: [EMAIL PROTECTED] { interrupt-parent = ipic ; diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts b/arch/powerpc/boot/dts/mpc832x_rdb.dts index 3a73134..09301c1 100644 --- a/arch/powerpc/boot/dts/mpc832x_rdb.dts +++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts @@ -236,8 +236,7 @@ #address-cells = 1; #size-cells = 0; reg = 3120 18; - device_type = mdio; - compatible = ucc_geth_phy; + compatible = fsl,ucc-mdio; phy00:[EMAIL PROTECTED] { interrupt-parent = pic; diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/boot/dts/mpc836x_mds.dts index 2986860..3eb8f72 100644 --- a/arch/powerpc/boot/dts/mpc836x_mds.dts +++ b/arch/powerpc/boot/dts/mpc836x_mds.dts @@ -288,8 +288,7 @@ #address-cells = 1; #size-cells = 0; reg = 2120 18; - device_type = mdio; - compatible = ucc_geth_phy; + compatible = fsl,ucc-mdio; phy0: [EMAIL PROTECTED] { interrupt-parent = ipic ; diff --git a/arch/powerpc/boot/dts/mpc8568mds.dts b/arch/powerpc/boot/dts/mpc8568mds.dts index 7440347..2bc147f 100644 --- a/arch/powerpc/boot/dts/mpc8568mds.dts +++ b/arch/powerpc/boot/dts/mpc8568mds.dts @@ -356,7 +356,7 @@ #address-cells = 1; #size-cells = 0; reg = 2120 18; - compatible = ucc_geth_phy; + compatible = fsl,ucc-mdio; /* These are the same PHYs as on * gianfar's MDIO bus */ diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c index df884f0..e3ba14a 100644 --- a/drivers/net/ucc_geth_mii.c +++ b/drivers/net/ucc_geth_mii.c @@ -256,6 +256,9 @@ static struct of_device_id uec_mdio_match[] = { .type = mdio, .compatible = ucc_geth_phy, }, + { + .compatible = fsl,ucc-mdio, + }, {}, }; -- 1.5.2.2 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/.24] [NET] fs_enet: check for phydev existence in the ethtool handlers
Otherwise oops will happen if ethernet device has not been opened: Unable to handle kernel paging request for data at address 0x014c Faulting instruction address: 0xc016f7f0 Oops: Kernel access of bad area, sig: 11 [#1] MPC85xx NIP: c016f7f0 LR: c01722a0 CTR: REGS: c79ddc70 TRAP: 0300 Not tainted (2.6.24-rc3-g820a386b) MSR: 00029000 EE,ME CR: 20004428 XER: 2000 DEAR: 014c, ESR: TASK = c789f5e0[999] 'snmpd' THREAD: c79dc000 GPR00: c01aceb8 c79ddd20 c789f5e0 c79ddd3c c79ddd64 GPR08: c7845b60 c79dde3c c01ace80 20004422 200249fc 02a0 100da728 GPR16: 100c 20022078 0009 200220e0 bfc85558 GPR24: c79ddd3c c02e0e70 c022fc64 c7845800 bfc85498 NIP [c016f7f0] phy_ethtool_gset+0x0/0x4c LR [c01722a0] fs_get_settings+0x18/0x28 Call Trace: [c79ddd20] [c79dde38] 0xc79dde38 (unreliable) [c79ddd30] [c01aceb8] dev_ethtool+0x294/0x11ec [c79dde30] [c01aaa44] dev_ioctl+0x454/0x6a8 [c79ddeb0] [c019b9d4] sock_ioctl+0x84/0x230 [c79dded0] [c007ded8] do_ioctl+0x34/0x8c [c79ddee0] [c007dfbc] vfs_ioctl+0x8c/0x41c [c79ddf10] [c007e38c] sys_ioctl+0x40/0x74 [c79ddf40] [c000d4c0] ret_from_syscall+0x0/0x3c Instruction dump: 8163 800b0030 2f80 419e0010 7c0803a6 4e800021 7c691b78 80010014 7d234b78 38210010 7c0803a6 4e800020 8003014c 7c6b1b78 3860 90040004 Signed-off-by: Anton Vorontsov [EMAIL PROTECTED] --- drivers/net/fs_enet/fs_enet-main.c | 11 +-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index f2a4d39..23fddc3 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c @@ -897,14 +897,21 @@ static void fs_get_regs(struct net_device *dev, struct ethtool_regs *regs, static int fs_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) { struct fs_enet_private *fep = netdev_priv(dev); + + if (!fep-phydev) + return -ENODEV; + return phy_ethtool_gset(fep-phydev, cmd); } static int fs_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) { struct fs_enet_private *fep = netdev_priv(dev); - phy_ethtool_sset(fep-phydev, cmd); - return 0; + + if (!fep-phydev) + return -ENODEV; + + return phy_ethtool_sset(fep-phydev, cmd); } static int fs_nway_reset(struct net_device *dev) -- 1.5.2.2 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 2/4] [POWERPC][NET] ucc_geth_mii and users: get rid of device_type
device_type property is bogus, thus use proper compatible. Also change compatible property to fsl,ucc-mdio. Per http://ozlabs.org/pipermail/linuxppc-dev/2007-December/048388.html Signed-off-by: Anton Vorontsov [EMAIL PROTECTED] --- arch/powerpc/boot/dts/mpc832x_mds.dts |3 +-- arch/powerpc/boot/dts/mpc832x_rdb.dts |3 +-- arch/powerpc/boot/dts/mpc836x_mds.dts |3 +-- arch/powerpc/boot/dts/mpc8568mds.dts |2 +- drivers/net/ucc_geth_mii.c|3 +++ 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts b/arch/powerpc/boot/dts/mpc832x_mds.dts index 588d658..8844d30 100644 --- a/arch/powerpc/boot/dts/mpc832x_mds.dts +++ b/arch/powerpc/boot/dts/mpc832x_mds.dts @@ -255,8 +255,7 @@ #address-cells = 1; #size-cells = 0; reg = 2320 18; - device_type = mdio; - compatible = ucc_geth_phy; + compatible = fsl,ucc-mdio; phy3: [EMAIL PROTECTED] { interrupt-parent = ipic ; diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts b/arch/powerpc/boot/dts/mpc832x_rdb.dts index 719f375..a7a2e45 100644 --- a/arch/powerpc/boot/dts/mpc832x_rdb.dts +++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts @@ -236,8 +236,7 @@ #address-cells = 1; #size-cells = 0; reg = 3120 18; - device_type = mdio; - compatible = ucc_geth_phy; + compatible = fsl,ucc-mdio; phy00:[EMAIL PROTECTED] { interrupt-parent = pic; diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/boot/dts/mpc836x_mds.dts index 8d7124e..5f0b427 100644 --- a/arch/powerpc/boot/dts/mpc836x_mds.dts +++ b/arch/powerpc/boot/dts/mpc836x_mds.dts @@ -288,8 +288,7 @@ #address-cells = 1; #size-cells = 0; reg = 2120 18; - device_type = mdio; - compatible = ucc_geth_phy; + compatible = fsl,ucc-mdio; phy0: [EMAIL PROTECTED] { interrupt-parent = ipic ; diff --git a/arch/powerpc/boot/dts/mpc8568mds.dts b/arch/powerpc/boot/dts/mpc8568mds.dts index 89add8d..ea70010 100644 --- a/arch/powerpc/boot/dts/mpc8568mds.dts +++ b/arch/powerpc/boot/dts/mpc8568mds.dts @@ -356,7 +356,7 @@ #address-cells = 1; #size-cells = 0; reg = 2120 18; - compatible = ucc_geth_phy; + compatible = fsl,ucc-mdio; /* These are the same PHYs as on * gianfar's MDIO bus */ diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c index df884f0..e3ba14a 100644 --- a/drivers/net/ucc_geth_mii.c +++ b/drivers/net/ucc_geth_mii.c @@ -256,6 +256,9 @@ static struct of_device_id uec_mdio_match[] = { .type = mdio, .compatible = ucc_geth_phy, }, + { + .compatible = fsl,ucc-mdio, + }, {}, }; -- 1.5.2.2 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/4] [POWERPC][NET] ucc_geth_mii and users: get rid of device_type
device_type property is bogus, better use proper compatible property. Also change compatible to fsl,ucc-mdio. Per http://ozlabs.org/pipermail/linuxppc-dev/2007-December/048388.html Signed-off-by: Anton Vorontsov [EMAIL PROTECTED] --- arch/powerpc/boot/dts/mpc832x_mds.dts |3 +-- arch/powerpc/boot/dts/mpc832x_rdb.dts |3 +-- arch/powerpc/boot/dts/mpc836x_mds.dts |3 +-- arch/powerpc/boot/dts/mpc8568mds.dts |2 +- drivers/net/ucc_geth_mii.c|3 +-- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts b/arch/powerpc/boot/dts/mpc832x_mds.dts index ef8cd1e..97757ed 100644 --- a/arch/powerpc/boot/dts/mpc832x_mds.dts +++ b/arch/powerpc/boot/dts/mpc832x_mds.dts @@ -254,8 +254,7 @@ #address-cells = 1; #size-cells = 0; reg = 2320 18; - device_type = mdio; - compatible = ucc_geth_phy; + compatible = fsl,ucc-mdio; phy3: [EMAIL PROTECTED] { interrupt-parent = ipic ; diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts b/arch/powerpc/boot/dts/mpc832x_rdb.dts index 7c4f028..b1c73f1 100644 --- a/arch/powerpc/boot/dts/mpc832x_rdb.dts +++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts @@ -235,8 +235,7 @@ #address-cells = 1; #size-cells = 0; reg = 3120 18; - device_type = mdio; - compatible = ucc_geth_phy; + compatible = fsl,ucc-mdio; phy00:[EMAIL PROTECTED] { interrupt-parent = pic; diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/boot/dts/mpc836x_mds.dts index 5c73786..330212d 100644 --- a/arch/powerpc/boot/dts/mpc836x_mds.dts +++ b/arch/powerpc/boot/dts/mpc836x_mds.dts @@ -287,8 +287,7 @@ #address-cells = 1; #size-cells = 0; reg = 2120 18; - device_type = mdio; - compatible = ucc_geth_phy; + compatible = fsl,ucc-mdio; phy0: [EMAIL PROTECTED] { interrupt-parent = ipic ; diff --git a/arch/powerpc/boot/dts/mpc8568mds.dts b/arch/powerpc/boot/dts/mpc8568mds.dts index 7ad4b9f..c00aec9 100644 --- a/arch/powerpc/boot/dts/mpc8568mds.dts +++ b/arch/powerpc/boot/dts/mpc8568mds.dts @@ -355,7 +355,7 @@ #address-cells = 1; #size-cells = 0; reg = 2120 18; - compatible = ucc_geth_phy; + compatible = fsl,ucc-mdio; /* These are the same PHYs as on * gianfar's MDIO bus */ diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c index df884f0..de8ba1f 100644 --- a/drivers/net/ucc_geth_mii.c +++ b/drivers/net/ucc_geth_mii.c @@ -253,8 +253,7 @@ int uec_mdio_remove(struct of_device *ofdev) static struct of_device_id uec_mdio_match[] = { { - .type = mdio, - .compatible = ucc_geth_phy, + .compatible = fsl,ucc-mdio, }, {}, }; -- 1.5.2.2 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] [NET][POWERPC] ucc_geth: really fix section mismatch
Commit ed7e63a51d46e835422d89c687b8a3e419a4212a has tried to fix section mismatch: WARNING: vmlinux.o(.init.text+0x17278): Section mismatch: reference to .exit.text:uec_mdio_exit (between 'ucc_geth_init' and 'uec_mdio_init') But that mismatch still happens. This patch actually fixing section mismatch by removing __exit from the header file. Signed-off-by: Anton Vorontsov [EMAIL PROTECTED] --- drivers/net/ucc_geth_mii.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/net/ucc_geth_mii.h b/drivers/net/ucc_geth_mii.h index d834370..1e45b20 100644 --- a/drivers/net/ucc_geth_mii.h +++ b/drivers/net/ucc_geth_mii.h @@ -96,5 +96,5 @@ enum enet_tbi_mii_reg { int uec_mdio_read(struct mii_bus *bus, int mii_id, int regnum); int uec_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value); int __init uec_mdio_init(void); -void __exit uec_mdio_exit(void); +void uec_mdio_exit(void); #endif /* __UEC_MII_H */ -- 1.5.2.2 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH][RESEND] PHY: Add the phy_device_release device method.
On Tue, Dec 04, 2007 at 08:38:47AM +0100, Thierry Reding wrote: * Andrew Morton wrote: On Mon, 3 Dec 2007 09:35:11 +0100 Thierry Reding [EMAIL PROTECTED] wrote: [...] I've been sitting on ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.24-rc3/2.6.24-rc3-mm2/broken-out/phy-implement-release-function.patch for a few weeks. For some reason I have it in my nacked netdev patches section but I think that was a mistake and it has not (yet ;)) been nacked. Heh, it has been otherwise Acked-by: Andy Fleming, informal(?) phylib maintainer. Anyway, Anton's patch looks somewhat different from yours. Please compare notes. FWIW, I like Anton's patch better, especially since it plugs a possible memory leak. I'm not sure it's useful or necessary to export the phy_device_free symbol, though. Makes sense, I think. Here is the newer patch, the only difference is removed EXPORT_SYMBOL(). Because of trivial change, I dared to keep Andy's Acked-by intact. - - - - From: Anton Vorontsov [EMAIL PROTECTED] Subject: [PATCH] phy: implement release function Lately I've got this nice badness on mdio bus removal: Device 'e0103120:06' does not have a release() function, it is broken and must be fixed. [ cut here ] Badness at drivers/base/core.c:107 NIP: c015c1a8 LR: c015c1a8 CTR: c0157488 REGS: c34bdcf0 TRAP: 0700 Not tainted (2.6.23-rc5-g9ebadfbb-dirty) MSR: 00029032 EE,ME,IR,DR CR: 24088422 XER: ... [c34bdda0] [c015c1a8] device_release+0x78/0x80 (unreliable) [c34bddb0] [c01354cc] kobject_cleanup+0x80/0xbc [c34bddd0] [c01365f0] kref_put+0x54/0x6c [c34bdde0] [c013543c] kobject_put+0x24/0x34 [c34bddf0] [c015c384] put_device+0x1c/0x2c [c34bde00] [c0180e84] mdiobus_unregister+0x2c/0x58 ... Though actually there is nothing broken, it just device subsystem core expects another pattern of resource managment. This patch implement phy device's release function, thus we're getting rid of this badness. Also small hidden bug fixed, hope none other introduced. ;-) Signed-off-by: Anton Vorontsov [EMAIL PROTECTED] Acked-by: Andy Fleming [EMAIL PROTECTED] --- drivers/net/phy/mdio_bus.c |9 + drivers/net/phy/phy_device.c | 12 include/linux/phy.h |1 + 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index fc2f0e6..c30196d 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -91,9 +91,12 @@ int mdiobus_register(struct mii_bus *bus) err = device_register(phydev-dev); - if (err) + if (err) { printk(KERN_ERR phy %d failed to register\n, i); + phy_device_free(phydev); + phydev = NULL; + } } bus-phy_map[i] = phydev; @@ -110,10 +113,8 @@ void mdiobus_unregister(struct mii_bus *bus) int i; for (i = 0; i PHY_MAX_ADDR; i++) { - if (bus-phy_map[i]) { + if (bus-phy_map[i]) device_unregister(bus-phy_map[i]-dev); - kfree(bus-phy_map[i]); - } } } EXPORT_SYMBOL(mdiobus_unregister); diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index f6e4848..5b9e175 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -44,6 +44,16 @@ static struct phy_driver genphy_driver; extern int mdio_bus_init(void); extern void mdio_bus_exit(void); +void phy_device_free(struct phy_device *phydev) +{ + kfree(phydev); +} + +static void phy_device_release(struct device *dev) +{ + phy_device_free(to_phy_device(dev)); +} + struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id) { struct phy_device *dev; @@ -54,6 +64,8 @@ struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id) if (NULL == dev) return (struct phy_device*) PTR_ERR((void*)-ENOMEM); + dev-dev.release = phy_device_release; + dev-speed = 0; dev-duplex = -1; dev-pause = dev-asym_pause = 0; diff --git a/include/linux/phy.h b/include/linux/phy.h index e10763d..554836e 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -403,6 +403,7 @@ int phy_mii_ioctl(struct phy_device *phydev, int phy_start_interrupts(struct phy_device *phydev); void phy_print_status(struct phy_device *phydev); struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id); +void phy_device_free(struct phy_device *phydev); extern struct bus_type mdio_bus_type; #endif /* __PHY_H */ -- 1.5.2.2 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org
Re: [PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHYlayer functionality
On Sun, Dec 02, 2007 at 12:54:36PM +0100, Joakim Tjernlund wrote: [SNIP] ^^ the correct solution is to implement arch_initcall function which will create fixed PHYs, and then leave only snprintf(fpi-bus_id, 16, PHY_ID_FMT, 0, *data); part in the fs_enet's find_phy(). Try add something like this to the fsl_soc.c (compile untested): - - - - static int __init of_add_fixed_phys(void) { struct device_node *np; const u32 *prop; struct fixed_phy_status status = {}; while ((np = of_find_node_by_name(NULL, ethernet))) { data = of_get_property(np, fixed-link, NULL); if (!data) continue; status.link = 1; status.duplex = data[1]; status.speed = data[2]; What about Pause and Asym_Pause? Will be addressed in the next respin of these patches. Let's hope on Monday. Dunno why so few, if any, eth drivers impl. it, but the PHY lib supports it. Even if fixed PHYs doesn't support it directly I think the OF interface should have it. - fixed-link : a b c d e where a is emulated phy id - choose any, but unique to the all specified fixed-links, b is duplex - 0 half, 1 full, c is link speed - d#10/d#100/d#1000, d is pause - 0 no pause, 1 pause, d asym_pause - 0 no asym_pause, 1 asym_pause. -- Anton Vorontsov email: [EMAIL PROTECTED] backup email: [EMAIL PROTECTED] irc://irc.freenode.net/bd2 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHY layer functionality
On Sat, Dec 01, 2007 at 02:48:54PM +0100, Jochen Friedrich wrote: Hi Vitaly, With that patch fixed.c now fully emulates MDIO bus, thus no need to duplicate PHY layer functionality. That, in turn, drastically simplifies the code, and drops down line count. As an additional bonus, now there is no need to register MDIO bus for each PHY, all emulated PHYs placed on the platform fixed MDIO bus. There is also no more need to pre-allocate PHYs via .config option, this is all now handled dynamically. p.s. Don't even try to understand patch content! Better: apply patch and look into resulting drivers/net/phy/fixed.c. If i understand your code correctly, you seem to rely on the fact that fixed_phy_add() is called before the fixed MDIO bus is scanned for devices. Yes, indeed. The other name of fixed phys are platform phys or platform MDIO bus on which virtual PHYs are placed. That is, these phys supposed to be created by the platform setup code (arch/). The rationale here is: we do hardware emulation, thus to make drivers actually see that hardware, we have to create it early. I tried to add fixed-phy support to fs_enet, but the fixed phy is not found this way. --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c @@ -36,6 +36,7 @@ #include linux/fs.h #include linux/platform_device.h #include linux/phy.h +#include linux/phy_fixed.h #include linux/vmalloc.h #include asm/pgtable.h @@ -1174,8 +1175,24 @@ static int __devinit find_phy(struct device_node *np, struct device_node *phynode, *mdionode; struct resource res; int ret = 0, len; + const u32 *data; + struct fixed_phy_status status = {}; + + data = of_get_property(np, fixed-link, NULL); + if (data) { + status.link = 1; + status.duplex = data[1]; + status.speed = data[2]; + + ret = fixed_phy_add(PHY_POLL, data[0], status); + if (ret) + return ret; + + snprintf(fpi-bus_id, 16, PHY_ID_FMT, 0, *data); + return 0; + } - const u32 *data = of_get_property(np, phy-handle, len); + data = of_get_property(np, phy-handle, len); if (!data || len != 4) return -EINVAL; ^^ the correct solution is to implement arch_initcall function which will create fixed PHYs, and then leave only snprintf(fpi-bus_id, 16, PHY_ID_FMT, 0, *data); part in the fs_enet's find_phy(). Try add something like this to the fsl_soc.c (compile untested): - - - - static int __init of_add_fixed_phys(void) { struct device_node *np; const u32 *prop; struct fixed_phy_status status = {}; while ((np = of_find_node_by_name(NULL, ethernet))) { data = of_get_property(np, fixed-link, NULL); if (!data) continue; status.link = 1; status.duplex = data[1]; status.speed = data[2]; ret = fixed_phy_add(PHY_POLL, data[0], status); if (ret) return ret; } return 0; } arch_initcall(of_add_fixed_phys); - - - - And remove fixed_phy_add() from the fs_enet. This should work nicely and also should be ideologically correct. ;-) How is this supposed to work for modules or for the PPC_CPM_NEW_BINDING mode where the device tree is no longer scanned during fs_soc initialization but during device initialization? We should mark fixed.c as bool. Fake/virtual/fixed/platform PHYs creation is architecture code anyway, can't be =m. -- Anton Vorontsov email: [EMAIL PROTECTED] backup email: [EMAIL PROTECTED] irc://irc.freenode.net/bd2 -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] [POWERPC] fsl_soc: add support for gianfar for fixed-link property
On Mon, Nov 26, 2007 at 04:04:08PM +0100, Joakim Tjernlund wrote: On Mon, 2007-11-26 at 17:29 +0300, Vitaly Bordug wrote: fixed-link says: register new Fixed/emulated PHY, i.e. PHY that not connected to the real MDIO bus. Signed-off-by: Vitaly Bordug [EMAIL PROTECTED] Signed-off-by: Anton Vorontsov [EMAIL PROTECTED] --- Documentation/powerpc/booting-without-of.txt |3 + arch/powerpc/sysdev/fsl_soc.c| 56 ++ 2 files changed, 42 insertions(+), 17 deletions(-) diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt index e9a3cb1..cf25070 100644 --- a/Documentation/powerpc/booting-without-of.txt +++ b/Documentation/powerpc/booting-without-of.txt @@ -1254,6 +1254,9 @@ platforms are moved over to use the flattened-device-tree model. services interrupts for this device. - phy-handle : The phandle for the PHY connected to this ethernet controller. +- fixed-link : a b c where a is emulated phy id - choose any, + but unique to the all specified fixed-links, b is duplex - 0 half, + 1 full, c is link speed - d#10/d#100/d#1000. Good work! May I suggest adding a d to a b c where d is flow control - 0 no, 1 yes Well, I see no reference of the flow neither in the include/linux/mii.h nor in the drivers/net/phy/*. :-/ Thus today there is no such register bit we can emulate?.. flow control or not just popped up here today so I got a use for it. ..and I looked into few drivers (gianfar, ucc), and they seem to use hard-coded flow control values, thus they don't speak to the PHYs about that. Can you give any reference to the driver that needs that parameter? Does it use PHY subsystem to obtain flow-control on/off information? Thanks, -- Anton Vorontsov email: [EMAIL PROTECTED] backup email: [EMAIL PROTECTED] irc://irc.freenode.net/bd2 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] [POWERPC] fsl_soc: add support for gianfar for fixed-link property
On Tue, Nov 27, 2007 at 02:17:11PM +0100, Joakim Tjernlund wrote: On Tue, 2007-11-27 at 14:39 +0300, Anton Vorontsov wrote: On Mon, Nov 26, 2007 at 04:04:08PM +0100, Joakim Tjernlund wrote: On Mon, 2007-11-26 at 17:29 +0300, Vitaly Bordug wrote: fixed-link says: register new Fixed/emulated PHY, i.e. PHY that not connected to the real MDIO bus. Signed-off-by: Vitaly Bordug [EMAIL PROTECTED] Signed-off-by: Anton Vorontsov [EMAIL PROTECTED] --- Documentation/powerpc/booting-without-of.txt |3 + arch/powerpc/sysdev/fsl_soc.c| 56 ++ 2 files changed, 42 insertions(+), 17 deletions(-) diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt index e9a3cb1..cf25070 100644 --- a/Documentation/powerpc/booting-without-of.txt +++ b/Documentation/powerpc/booting-without-of.txt @@ -1254,6 +1254,9 @@ platforms are moved over to use the flattened-device-tree model. services interrupts for this device. - phy-handle : The phandle for the PHY connected to this ethernet controller. +- fixed-link : a b c where a is emulated phy id - choose any, + but unique to the all specified fixed-links, b is duplex - 0 half, + 1 full, c is link speed - d#10/d#100/d#1000. Good work! May I suggest adding a d to a b c where d is flow control - 0 no, 1 yes Well, I see no reference of the flow neither in the include/linux/mii.h nor in the drivers/net/phy/*. :-/ Thus today there is no such register bit we can emulate?.. Well, as good as I can recall, flow control(pause) is something that the PHY negotiates, just like FDX/HDX and should be dealt with in the adjust_link callback but not many do currently. If you seach for pause in phy_device.c you will find it. Ah, pause. Sure, we can emulate that. -- Anton Vorontsov email: [EMAIL PROTECTED] backup email: [EMAIL PROTECTED] irc://irc.freenode.net/bd2 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/5] fixups for mpc8360 rev. 2.1 erratum #2 (RGMII Timing)
On Thu, Nov 08, 2007 at 01:11:35PM -0600, Kim Phillips wrote: [...] right, but whether it does or not doesn't affect your failure outcome either I'm assuming. If it's something like 0x03, the u-boot patch will probably look like: if ((bcsr[12] == 0x10) (immr-sysconf.spridr == SPR_8360_REV21 || immr-sysconf.spridr == SPR_8360E_REV21)) /* if phy-connection-type is rgmii-id, set it to rgmii-rxid */ ... but these linux patches would remain the same (the clk and data delay settings for the UCC's are still valid; it's just the PHY config that is triggering your problem from what I can tell). Yup, most likely this is not UCC specific, but PHY. For some reason delays making harm here... And today I was unable to reproduce yesterday's behaviour. Your patches works fine, with sixth patch and without it. With -rxid and with just -id. Though, after few resets I hit on that: - - - - U-Boot 1.3.0-rc3-g281df457-dirty (Nov 6 2007 - 18:19:35) MPC83XX Reset Status: External/Internal Soft, External/Internal Hard CPU: e300c1, MPC8360E, Rev: 21 at 528 MHz, CSB: 264 MHz Board: Freescale MPC8360EMDS I2C: ready DRAM: 256 MB (DDR2, 64-bit, ECC on) SDRAM: 64 MB (local bus) FLASH: 32 MB In:serial Out: serial Err: serial Net: UEC: PHY is Marvell 88E11x1 (1410cc2) FSL UEC0: Full Duplex switching to rgmii 100 FSL UEC0: Speed 100BT FSL UEC0: Link is up read wrong value : mii_id 1,mii_reg 2, base e0103120 read wrong value : mii_id 1,mii_reg 3, base e0103120 UEC: PHY is Generic MII () read wrong value : mii_id 1,mii_reg 1, base e0103120 read wrong value : mii_id 1,mii_reg 1, base e0103120 read wrong value : mii_id 1,mii_reg 5, base e0103120 FSL UEC1: Full Duplex switching to rgmii 100 FSL UEC1: Speed 100BT FSL UEC1: Link is up FSL UEC0, FSL UEC1 - - - - And UCC1 does not work at all. After another reset that message disappears and it does work again. So, I think hardware is tricking me in various ways, not your patches fault. :-( -- Anton Vorontsov email: [EMAIL PROTECTED] backup email: [EMAIL PROTECTED] irc://irc.freenode.net/bd2 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/5] fixups for mpc8360 rev. 2.1 erratum #2 (RGMII Timing)
On Mon, Nov 05, 2007 at 12:15:30PM -0600, Kim Phillips wrote: Hello all, the following patches fix RGMII timing for rev. 2.1 of the mpc8360, according to erratum #2 (erratum text included below). Basically the most intrusive part is the addition of two new RGMII Internal Delay modes; one for TX delay only, and the other for RX delay only (i.e, not both at the same time). Please review, and since this affects both netdev and powerpc trees, one maintainer should ack them for the other to push upstream (i.e, Kumar acks them, and Leo picks them up to go through netdev or the other way around; either way is fine with me). I'm hoping they're trivial enough to go in 2.6.24. All five patches are Tested-by: Anton Vorontsov [EMAIL PROTECTED] Let's hope they'll hit 2.6.24. Thanks, -- Anton Vorontsov email: [EMAIL PROTECTED] backup email: [EMAIL PROTECTED] irc://irc.freenode.net/bd2 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/5] fixups for mpc8360 rev. 2.1 erratum #2 (RGMII Timing)
On Mon, Nov 05, 2007 at 12:15:30PM -0600, Kim Phillips wrote: Hello all, the following patches fix RGMII timing for rev. 2.1 of the mpc8360, according to erratum #2 (erratum text included below). Basically the most intrusive part is the addition of two new RGMII Internal Delay modes; one for TX delay only, and the other for RX delay only (i.e, not both at the same time). Please review, and since this affects both netdev and powerpc trees, one maintainer should ack them for the other to push upstream (i.e, Kumar acks them, and Leo picks them up to go through netdev or the other way around; either way is fine with me). I'm hoping they're trivial enough to go in 2.6.24. Depending on how the review goes, a follow-on patch to u-boot will be sent out that fixes up the phy-connection-type in the device tree (from rgmii-id to rgmii-rxid iff on mpc8360rev2.1). I've upgraded CPU to rev2.1, board rev0.3. Applied 5/5 patches onto paulus/powerpc.git at e403149c92a. Here is the results: If I use -rxid, then geth not able to transmit anything. With -txid geth not able to receive anything. With just -id everything works fine though... Maybe there should be another condition, in addition to cpu rev2.1? Thanks, Kim mpc8360 rev 2.1 erratum #2: --- Recommended AC timings for chip 8360Rev2.1 UCC ETH RGMII when working with Rev Pilot MDS for proper RGMII operation: IMMR_BASE + 0x14A8[4:5] = 11 (clk delay for UCC 2) IMMR_BASE + 0x14A8[18:19] = 11 (clk delay for UCC 1) IMMR_BASE + 0x14AC[20:27] = 10101010 (data delay for both UCC's) The Phy (Marvell 88e) should be configured NOT to work with RGMII delay for TxD. Thanks, -- Anton Vorontsov email: [EMAIL PROTECTED] backup email: [EMAIL PROTECTED] irc://irc.freenode.net/bd2 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/5] fixups for mpc8360 rev. 2.1 erratum #2 (RGMII Timing)
On Thu, Nov 08, 2007 at 12:15:08PM -0600, Kim Phillips wrote: On Thu, 8 Nov 2007 17:16:11 +0300 Anton Vorontsov [EMAIL PROTECTED] wrote: On Mon, Nov 05, 2007 at 12:15:30PM -0600, Kim Phillips wrote: Hello all, the following patches fix RGMII timing for rev. 2.1 of the mpc8360, according to erratum #2 (erratum text included below). Basically the most intrusive part is the addition of two new RGMII Internal Delay modes; one for TX delay only, and the other for RX delay only (i.e, not both at the same time). Please review, and since this affects both netdev and powerpc trees, one maintainer should ack them for the other to push upstream (i.e, Kumar acks them, and Leo picks them up to go through netdev or the other way around; either way is fine with me). I'm hoping they're trivial enough to go in 2.6.24. Depending on how the review goes, a follow-on patch to u-boot will be sent out that fixes up the phy-connection-type in the device tree (from rgmii-id to rgmii-rxid iff on mpc8360rev2.1). I've upgraded CPU to rev2.1, board rev0.3. thanks for testing this. I tested these patches on a pilot assy 0.3. Same here. Applied 5/5 patches onto paulus/powerpc.git at e403149c92a. Here is the results: If I use -rxid, then geth not able to transmit anything. With -txid geth not able to receive anything. With just -id everything works fine though... Maybe there should be another condition, in addition to cpu rev2.1? the errata simply states 'pilot boards', but we can probably modify u-boot to look at the cpu rev and the board rev (BCSR 12). My bcsr12 looks like: = md.b f80c 1 f80c: 10. what is yours? = md.b f80c 1 f80c: 10. :-/ U-Boot 1.3.0-rc3-g281df457-dirty (Nov 6 2007 - 18:19:35) MPC83XX CPU: e300c1, MPC8360E, Rev: 21 at 528 MHz, CSB: 264 MHz [EMAIL PROTECTED]:~# cat /proc/cpuinfo processor : 0 cpu : e300c1 clock : 528.00MHz revision: 3.1 (pvr 8083 0031) bogomips: 131.58 timebase: 6600 platform: MPC836x MDS + /* handle mpc8360ea rev.2.1 erratum 2: RGMII Timing */ + svid = mfspr(SPRN_SVR); + if (svid == 0x80480021) { ^^ that branch executes on the board I'm testing. If it's something like 0x03, the u-boot patch will probably look like: if ((bcsr[12] == 0x10) (immr-sysconf.spridr == SPR_8360_REV21 || immr-sysconf.spridr == SPR_8360E_REV21)) /* if phy-connection-type is rgmii-id, set it to rgmii-rxid */ ... but these linux patches would remain the same (the clk and data delay settings for the UCC's are still valid; it's just the PHY config that is triggering your problem from what I can tell). Yup, most likely this is not UCC specific, but PHY. For some reason delays making harm here... Thanks, -- Anton Vorontsov email: [EMAIL PROTECTED] backup email: [EMAIL PROTECTED] irc://irc.freenode.net/bd2 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] ucc_geth: add support for netpoll
On Thu, Nov 01, 2007 at 10:33:24AM +0800, Li Yang-r58472 wrote: -Original Message- From: Anton Vorontsov [mailto:[EMAIL PROTECTED] Sent: Thursday, November 01, 2007 5:59 AM To: Li Yang-r58472 Cc: netdev@vger.kernel.org; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PATCH] ucc_geth: add support for netpoll On Mon, Oct 29, 2007 at 03:17:44PM +0300, Anton Vorontsov wrote: [...] Oops. The original patch happened to hit the Junk mail box. :( That one as well? http://lkml.org/lkml/2007/10/11/128 I think the patch is good to merge after the cosmetic change. I can do it in next pull request to Jeff. Ok, great. Thanks. I'm wondering if you missed that email again. Maybe your mail client/server doing weird things with emails from @ru.mvista.com? No. I have explicitly add you to the whitelist. :) Hehe, thanks. ;-) Please be patient, isn't this patch a new feature which can only be integrated in the merge window? Sure it is. I didn't mean to hurry up you, of course not. Just wondered if you've solved issues with getting my emails. Such wonders are quite normal if there was a precedent lately. ;-) Sorry for troubling you, -- Anton Vorontsov email: [EMAIL PROTECTED] backup email: [EMAIL PROTECTED] irc://irc.freenode.net/bd2 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] ucc_geth: add support for netpoll
On Mon, Oct 29, 2007 at 03:17:44PM +0300, Anton Vorontsov wrote: [...] Oops. The original patch happened to hit the Junk mail box. :( That one as well? http://lkml.org/lkml/2007/10/11/128 I think the patch is good to merge after the cosmetic change. I can do it in next pull request to Jeff. Ok, great. Thanks. I'm wondering if you missed that email again. Maybe your mail client/server doing weird things with emails from @ru.mvista.com? Thanks. Here it is: - - - - From: Anton Vorontsov [EMAIL PROTECTED] Subject: [PATCH] ucc_geth: add support for netpoll This patch adds netpoll support for the QE UCC Gigabit Ethernet driver. Tested using netconsole and KGDBoE. Signed-off-by: Anton Vorontsov [EMAIL PROTECTED] --- drivers/net/ucc_geth.c | 20 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index bec413b..94e78d8 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c @@ -3678,6 +3678,23 @@ static irqreturn_t ucc_geth_irq_handler(int irq, void *info) return IRQ_HANDLED; } +#ifdef CONFIG_NET_POLL_CONTROLLER +/* + * Polling 'interrupt' - used by things like netconsole to send skbs + * without having to re-enable interrupts. It's not called while + * the interrupt routine is executing. + */ +static void ucc_netpoll(struct net_device *dev) +{ + struct ucc_geth_private *ugeth = netdev_priv(dev); + int irq = ugeth-ug_info-uf_info.irq; + + disable_irq(irq); + ucc_geth_irq_handler(irq, dev); + enable_irq(irq); +} +#endif /* CONFIG_NET_POLL_CONTROLLER */ + /* Called when something needs to use the ethernet device */ /* Returns 0 for success. */ static int ucc_geth_open(struct net_device *dev) @@ -3963,6 +3980,9 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma #ifdef CONFIG_UGETH_NAPI netif_napi_add(dev, ugeth-napi, ucc_geth_poll, UCC_GETH_DEV_WEIGHT); #endif /* CONFIG_UGETH_NAPI */ +#ifdef CONFIG_NET_POLL_CONTROLLER + dev-poll_controller = ucc_netpoll; +#endif dev-stop = ucc_geth_close; //dev-change_mtu = ucc_geth_change_mtu; dev-mtu = 1500; -- 1.5.2.2 -- Anton Vorontsov email: [EMAIL PROTECTED] backup email: [EMAIL PROTECTED] irc://irc.freenode.net/bd2 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] ucc_geth: add support for netpoll
On Mon, Oct 29, 2007 at 02:12:07PM +0800, Li Yang-r58472 wrote: [...] +#ifdef CONFIG_NET_POLL_CONTROLLER +/* + * Polling 'interrupt' - used by things like netconsole to send +skbs + * without having to re-enable interrupts. It's not called while + * the interrupt routine is executing. + */ +static void ucc_netpoll(struct net_device *dev) { + struct ucc_geth_private *ugeth = netdev_priv(dev); + + disable_irq(ugeth-ug_info-uf_info.irq); + ucc_geth_irq_handler(ugeth-ug_info-uf_info.irq, dev); + enable_irq(ugeth-ug_info-uf_info.irq); Why not make it less complex (for a reader and gcc too :-) ? Yup, I'm agree here but it's too late. Again. ;-) This patch already accepted into the -mm (a week or so after the silence), so.. now I'd rather not bother Andrew with such really cosmetic changes. But if Jeff would directly apply modfied patch, I'll send it. ;-) Oops. The original patch happened to hit the Junk mail box. :( That one as well? http://lkml.org/lkml/2007/10/11/128 I think the patch is good to merge after the cosmetic change. I can do it in next pull request to Jeff. Ok, great. Thanks. Here it is: - - - - From: Anton Vorontsov [EMAIL PROTECTED] Subject: [PATCH] ucc_geth: add support for netpoll This patch adds netpoll support for the QE UCC Gigabit Ethernet driver. Tested using netconsole and KGDBoE. Signed-off-by: Anton Vorontsov [EMAIL PROTECTED] --- drivers/net/ucc_geth.c | 20 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index bec413b..94e78d8 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c @@ -3678,6 +3678,23 @@ static irqreturn_t ucc_geth_irq_handler(int irq, void *info) return IRQ_HANDLED; } +#ifdef CONFIG_NET_POLL_CONTROLLER +/* + * Polling 'interrupt' - used by things like netconsole to send skbs + * without having to re-enable interrupts. It's not called while + * the interrupt routine is executing. + */ +static void ucc_netpoll(struct net_device *dev) +{ + struct ucc_geth_private *ugeth = netdev_priv(dev); + int irq = ugeth-ug_info-uf_info.irq; + + disable_irq(irq); + ucc_geth_irq_handler(irq, dev); + enable_irq(irq); +} +#endif /* CONFIG_NET_POLL_CONTROLLER */ + /* Called when something needs to use the ethernet device */ /* Returns 0 for success. */ static int ucc_geth_open(struct net_device *dev) @@ -3963,6 +3980,9 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma #ifdef CONFIG_UGETH_NAPI netif_napi_add(dev, ugeth-napi, ucc_geth_poll, UCC_GETH_DEV_WEIGHT); #endif /* CONFIG_UGETH_NAPI */ +#ifdef CONFIG_NET_POLL_CONTROLLER + dev-poll_controller = ucc_netpoll; +#endif dev-stop = ucc_geth_close; //dev-change_mtu = ucc_geth_change_mtu; dev-mtu = 1500; -- 1.5.2.2 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] ucc_geth: add support for netpoll
On Sat, Oct 27, 2007 at 05:09:51PM +0400, Sergei Shtylyov wrote: Hello. Anton Vorontsov wrote: This patch adds netpoll support for the QE UCC Gigabit Ethernet driver. The approach is very similar to the gianfar driver. It's rather contrarywise -- this is standard approach and gianfar with its 3 TSEC IRQs has a quite non-standard poll_controller() implementation. Oh.. well, right -- gianfar a bit more comlex in that regard. Tested using netconsole. KGDBoE is considered a better test (I hope you've also tested with it). At the time of posting it was tested using netconsole only, a few days later it's was tested using KGDBoE also. So, it works indeed. Signed-off-by: Anton Vorontsov [EMAIL PROTECTED] diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index 18a6f48..06807ce 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c @@ -3691,6 +3691,22 @@ static irqreturn_t ucc_geth_irq_handler(int irq, void *info) return IRQ_HANDLED; } +#ifdef CONFIG_NET_POLL_CONTROLLER +/* + * Polling 'interrupt' - used by things like netconsole to send skbs + * without having to re-enable interrupts. It's not called while + * the interrupt routine is executing. + */ +static void ucc_netpoll(struct net_device *dev) +{ + struct ucc_geth_private *ugeth = netdev_priv(dev); + + disable_irq(ugeth-ug_info-uf_info.irq); + ucc_geth_irq_handler(ugeth-ug_info-uf_info.irq, dev); + enable_irq(ugeth-ug_info-uf_info.irq); Why not make it less complex (for a reader and gcc too :-) ? Yup, I'm agree here but it's too late. Again. ;-) This patch already accepted into the -mm (a week or so after the silence), so.. now I'd rather not bother Andrew with such really cosmetic changes. But if Jeff would directly apply modfied patch, I'll send it. ;-) Anyhow, I'm sincerely appreciate your comments. Thanks, -- Anton Vorontsov email: [EMAIL PROTECTED] backup email: [EMAIL PROTECTED] irc://irc.freenode.net/bd2 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH][NET] gianfar: fix obviously wrong #ifdef CONFIG_GFAR_NAPI placement
Erroneous #ifdef introduced by 293c8513398657f6263fcdb03c87f2760cf61be4 causing NAPI-less ethernet malfunctioning. Signed-off-by: Anton Vorontsov [EMAIL PROTECTED] Signed-off-by: Vitaly Bordug [EMAIL PROTECTED] --- if (...) #if ...; #endif good candidate for checkpatch? drivers/net/gianfar.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index cc288d8..38268d7 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c @@ -956,10 +956,12 @@ static int gfar_enet_open(struct net_device *dev) } err = startup_gfar(dev); - if (err) + if (err) { #ifdef CONFIG_GFAR_NAPI napi_disable(priv-napi); #endif + return err; + } netif_start_queue(dev); -- 1.5.0.6 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH respin] ucc_geth: fix module removal
- uccf should be set to NULL to not double-free memory on subsequent calls; - ind_hash_q and group_hash_q lists should be initialized in the probe() function, instead of struct_init() (called by open()), otherwise there will be an oops if ucc_geth_driver removed prior 'ifconfig ethX up'; - add unregister_netdev(); - reorder geth_remove() steps. Signed-off-by: Anton Vorontsov [EMAIL PROTECTED] --- drivers/net/ucc_geth.c | 17 ++--- 1 files changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index 7dedc96..18a6f48 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c @@ -2080,8 +2080,10 @@ static void ucc_geth_memclean(struct ucc_geth_private *ugeth) if (!ugeth) return; - if (ugeth-uccf) + if (ugeth-uccf) { ucc_fast_free(ugeth-uccf); + ugeth-uccf = NULL; + } if (ugeth-p_thread_data_tx) { qe_muram_free(ugeth-thread_dat_tx_offset); @@ -2312,10 +2314,6 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) ug_info = ugeth-ug_info; uf_info = ug_info-uf_info; - /* Create CQs for hash tables */ - INIT_LIST_HEAD(ugeth-group_hash_q); - INIT_LIST_HEAD(ugeth-ind_hash_q); - if (!((uf_info-bd_mem_part == MEM_PART_SYSTEM) || (uf_info-bd_mem_part == MEM_PART_MURAM))) { if (netif_msg_probe(ugeth)) @@ -3949,6 +3947,10 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma ugeth = netdev_priv(dev); spin_lock_init(ugeth-lock); + /* Create CQs for hash tables */ + INIT_LIST_HEAD(ugeth-group_hash_q); + INIT_LIST_HEAD(ugeth-ind_hash_q); + dev_set_drvdata(device, dev); /* Set the dev-base_addr to the gfar reg region */ @@ -4002,9 +4004,10 @@ static int ucc_geth_remove(struct of_device* ofdev) struct net_device *dev = dev_get_drvdata(device); struct ucc_geth_private *ugeth = netdev_priv(dev); - dev_set_drvdata(device, NULL); - ucc_geth_memclean(ugeth); + unregister_netdev(dev); free_netdev(dev); + ucc_geth_memclean(ugeth); + dev_set_drvdata(device, NULL); return 0; } -- 1.5.0.6 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] ucc_geth: add support for netpoll
This patch adds netpoll support for the QE UCC Gigabit Ethernet driver. The approach is very similar to the gianfar driver. Tested using netconsole. Signed-off-by: Anton Vorontsov [EMAIL PROTECTED] --- drivers/net/ucc_geth.c | 19 +++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index 18a6f48..06807ce 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c @@ -3691,6 +3691,22 @@ static irqreturn_t ucc_geth_irq_handler(int irq, void *info) return IRQ_HANDLED; } +#ifdef CONFIG_NET_POLL_CONTROLLER +/* + * Polling 'interrupt' - used by things like netconsole to send skbs + * without having to re-enable interrupts. It's not called while + * the interrupt routine is executing. + */ +static void ucc_netpoll(struct net_device *dev) +{ + struct ucc_geth_private *ugeth = netdev_priv(dev); + + disable_irq(ugeth-ug_info-uf_info.irq); + ucc_geth_irq_handler(ugeth-ug_info-uf_info.irq, dev); + enable_irq(ugeth-ug_info-uf_info.irq); +} +#endif /* CONFIG_NET_POLL_CONTROLLER */ + /* Called when something needs to use the ethernet device */ /* Returns 0 for success. */ static int ucc_geth_open(struct net_device *dev) @@ -3969,6 +3985,9 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma dev-poll = ucc_geth_poll; dev-weight = UCC_GETH_DEV_WEIGHT; #endif /* CONFIG_UGETH_NAPI */ +#ifdef CONFIG_NET_POLL_CONTROLLER + dev-poll_controller = ucc_netpoll; +#endif dev-stop = ucc_geth_close; dev-get_stats = ucc_geth_get_stats; //dev-change_mtu = ucc_geth_change_mtu; -- 1.5.0.6 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH respin] phy: implement release function
Lately I've got this nice badness on mdio bus removal: Device 'e0103120:06' does not have a release() function, it is broken and must be fixed. [ cut here ] Badness at drivers/base/core.c:107 NIP: c015c1a8 LR: c015c1a8 CTR: c0157488 REGS: c34bdcf0 TRAP: 0700 Not tainted (2.6.23-rc5-g9ebadfbb-dirty) MSR: 00029032 EE,ME,IR,DR CR: 24088422 XER: ... [c34bdda0] [c015c1a8] device_release+0x78/0x80 (unreliable) [c34bddb0] [c01354cc] kobject_cleanup+0x80/0xbc [c34bddd0] [c01365f0] kref_put+0x54/0x6c [c34bdde0] [c013543c] kobject_put+0x24/0x34 [c34bddf0] [c015c384] put_device+0x1c/0x2c [c34bde00] [c0180e84] mdiobus_unregister+0x2c/0x58 ... Though actually there is nothing broken, it just device subsystem core expects another pattern of resource managment. This patch implement phy device's release function, thus we're getting rid of this badness. Also small hidden bug fixed, hope none other introduced. ;-) Signed-off-by: Anton Vorontsov [EMAIL PROTECTED] Acked-by: Andy Fleming [EMAIL PROTECTED] --- drivers/net/phy/mdio_bus.c |9 + drivers/net/phy/phy_device.c | 13 + include/linux/phy.h |1 + 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index fc2f0e6..c30196d 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -91,9 +91,12 @@ int mdiobus_register(struct mii_bus *bus) err = device_register(phydev-dev); - if (err) + if (err) { printk(KERN_ERR phy %d failed to register\n, i); + phy_device_free(phydev); + phydev = NULL; + } } bus-phy_map[i] = phydev; @@ -110,10 +113,8 @@ void mdiobus_unregister(struct mii_bus *bus) int i; for (i = 0; i PHY_MAX_ADDR; i++) { - if (bus-phy_map[i]) { + if (bus-phy_map[i]) device_unregister(bus-phy_map[i]-dev); - kfree(bus-phy_map[i]); - } } } EXPORT_SYMBOL(mdiobus_unregister); diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 49328e0..8e25bf7 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -44,6 +44,17 @@ static struct phy_driver genphy_driver; extern int mdio_bus_init(void); extern void mdio_bus_exit(void); +void phy_device_free(struct phy_device *phydev) +{ + kfree(phydev); +} +EXPORT_SYMBOL(phy_device_free); + +static void phy_device_release(struct device *dev) +{ + phy_device_free(to_phy_device(dev)); +} + struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id) { struct phy_device *dev; @@ -54,6 +65,8 @@ struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id) if (NULL == dev) return (struct phy_device*) PTR_ERR((void*)-ENOMEM); + dev-dev.release = phy_device_release; + dev-speed = 0; dev-duplex = -1; dev-pause = dev-asym_pause = 0; diff --git a/include/linux/phy.h b/include/linux/phy.h index 2a65978..9ec1363 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -398,6 +398,7 @@ int phy_mii_ioctl(struct phy_device *phydev, int phy_start_interrupts(struct phy_device *phydev); void phy_print_status(struct phy_device *phydev); struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id); +void phy_device_free(struct phy_device *phydev); extern struct bus_type mdio_bus_type; #endif /* __PHY_H */ -- 1.5.0.6 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] ucc_geth: fix compilation
Currently qe_bd_t is used in the macro call -- dma_unmap_single, which is a no-op on PPC32, thus error is hidden today. Starting with 2.6.24, macro will be replaced by the empty static function, and erroneous use of qe_bd_t will trigger compilation error. Signed-off-by: Anton Vorontsov [EMAIL PROTECTED] --- Reposting this to include netdev in Cc. drivers/net/ucc_geth.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index 12e01b2..9a38dfe 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c @@ -2148,7 +2148,7 @@ static void ucc_geth_memclean(struct ucc_geth_private *ugeth) for (j = 0; j ugeth-ug_info-bdRingLenTx[i]; j++) { if (ugeth-tx_skbuff[i][j]) { dma_unmap_single(NULL, -((qe_bd_t *)bd)-buf, +((struct qe_bd *)bd)-buf, (in_be32((u32 *)bd) BD_LENGTH_MASK), DMA_TO_DEVICE); -- 1.5.0.6 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] [POWERPC] ucc_geth: fix module removal
- uccf should be set to NULL to not double-free memory on subsequent calls; - ind_hash_q and group_hash_q lists should be initialized in the probe() function, instead of struct_init() (called by open()), otherwise there will be an oops if ucc_geth_driver removed prior 'ifconfig ethX up'; - add unregister_netdev(); - reorder geth_remove() steps. Signed-off-by: Anton Vorontsov [EMAIL PROTECTED] --- drivers/net/ucc_geth.c | 17 ++--- 1 files changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index 9a38dfe..bc2b3bf 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c @@ -2080,8 +2080,10 @@ static void ucc_geth_memclean(struct ucc_geth_private *ugeth) if (!ugeth) return; - if (ugeth-uccf) + if (ugeth-uccf) { ucc_fast_free(ugeth-uccf); + ugeth-uccf = NULL; + } if (ugeth-p_thread_data_tx) { qe_muram_free(ugeth-thread_dat_tx_offset); @@ -2312,10 +2314,6 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) ug_info = ugeth-ug_info; uf_info = ug_info-uf_info; - /* Create CQs for hash tables */ - INIT_LIST_HEAD(ugeth-group_hash_q); - INIT_LIST_HEAD(ugeth-ind_hash_q); - if (!((uf_info-bd_mem_part == MEM_PART_SYSTEM) || (uf_info-bd_mem_part == MEM_PART_MURAM))) { if (netif_msg_probe(ugeth)) @@ -3949,6 +3947,10 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma ugeth = netdev_priv(dev); spin_lock_init(ugeth-lock); + /* Create CQs for hash tables */ + INIT_LIST_HEAD(ugeth-group_hash_q); + INIT_LIST_HEAD(ugeth-ind_hash_q); + dev_set_drvdata(device, dev); /* Set the dev-base_addr to the gfar reg region */ @@ -4002,9 +4004,10 @@ static int ucc_geth_remove(struct of_device* ofdev) struct net_device *dev = dev_get_drvdata(device); struct ucc_geth_private *ugeth = netdev_priv(dev); - dev_set_drvdata(device, NULL); - ucc_geth_memclean(ugeth); + unregister_netdev(dev); free_netdev(dev); + ucc_geth_memclean(ugeth); + dev_set_drvdata(device, NULL); return 0; } -- 1.5.0.6 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] phy: implement release function
Lately I've got this nice badness on mdio bus removal: Device 'e0103120:06' does not have a release() function, it is broken and must be fixed. [ cut here ] Badness at drivers/base/core.c:107 NIP: c015c1a8 LR: c015c1a8 CTR: c0157488 REGS: c34bdcf0 TRAP: 0700 Not tainted (2.6.23-rc5-g9ebadfbb-dirty) MSR: 00029032 EE,ME,IR,DR CR: 24088422 XER: ... [c34bdda0] [c015c1a8] device_release+0x78/0x80 (unreliable) [c34bddb0] [c01354cc] kobject_cleanup+0x80/0xbc [c34bddd0] [c01365f0] kref_put+0x54/0x6c [c34bdde0] [c013543c] kobject_put+0x24/0x34 [c34bddf0] [c015c384] put_device+0x1c/0x2c [c34bde00] [c0180e84] mdiobus_unregister+0x2c/0x58 ... Though actually there is nothing broken, it just device subsystem core expects another pattern of resource managment. This patch implement phy device's release function, thus we're getting rid of this badness. Also small hidden bug fixed, hope none other introduced. ;-) Signed-off-by: Anton Vorontsov [EMAIL PROTECTED] --- drivers/net/phy/mdio_bus.c |9 + drivers/net/phy/phy_device.c | 13 + include/linux/phy.h |1 + 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index fc2f0e6..c30196d 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -91,9 +91,12 @@ int mdiobus_register(struct mii_bus *bus) err = device_register(phydev-dev); - if (err) + if (err) { printk(KERN_ERR phy %d failed to register\n, i); + phy_device_free(phydev); + phydev = NULL; + } } bus-phy_map[i] = phydev; @@ -110,10 +113,8 @@ void mdiobus_unregister(struct mii_bus *bus) int i; for (i = 0; i PHY_MAX_ADDR; i++) { - if (bus-phy_map[i]) { + if (bus-phy_map[i]) device_unregister(bus-phy_map[i]-dev); - kfree(bus-phy_map[i]); - } } } EXPORT_SYMBOL(mdiobus_unregister); diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index e275df8..80c283c 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -44,6 +44,17 @@ static struct phy_driver genphy_driver; extern int mdio_bus_init(void); extern void mdio_bus_exit(void); +void phy_device_free(struct phy_device *phydev) +{ + kfree(phydev); +} +EXPORT_SYMBOL(phy_device_free); + +static void phy_device_release(struct device *dev) +{ + phy_device_free(to_phy_device(dev)); +} + struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id) { struct phy_device *dev; @@ -54,6 +65,8 @@ struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id) if (NULL == dev) return (struct phy_device*) PTR_ERR((void*)-ENOMEM); + dev-dev.release = phy_device_release; + dev-speed = 0; dev-duplex = -1; dev-pause = dev-asym_pause = 0; diff --git a/include/linux/phy.h b/include/linux/phy.h index 2a65978..9ec1363 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -398,6 +398,7 @@ int phy_mii_ioctl(struct phy_device *phydev, int phy_start_interrupts(struct phy_device *phydev); void phy_print_status(struct phy_device *phydev); struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id); +void phy_device_free(struct phy_device *phydev); extern struct bus_type mdio_bus_type; #endif /* __PHY_H */ -- 1.5.0.6 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html