From: "Uwe Kleine-König" <Uwe.Kleine-Koenig@digi.com>
To: netdev@vger.kernel.org
Cc: Andy Fleming <afleming@freescale.com>, Jeff Garzik <jeff@garzik.org>
Subject: config_aneg for phy not supporting autonegotiation
Date: Wed, 5 Dec 2007 11:11:06 +0100 [thread overview]
Message-ID: <20071205101106.GA32729@digi.com> (raw)
Hello,
I added a driver for a phy that doesn't support autonegotiation (see
below).
I didn't add SUPPORTED_Autoneg to hirschmannrs422_driver.features. I
expected that this results in hirschmannrs422_config_aneg never being
called, but that's wrong. So I wonder what it should do.
Moreover that phy only supports 10MBit/Half but still it seems to use
something different first and short after bringing the device up I get a
printk saying:
Trying 10/HALF
I didn't investigate that yet.
I couldn't find a place in the generic phy code that uses
driver.features, probably it's just that that needs fixing?
Best regards
Uwe
--->8---
From: Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
add Hirschmann RS422 phy
Signed-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
---
drivers/net/phy/Kconfig | 3 ++
drivers/net/phy/Makefile | 1 +
drivers/net/phy/hirschmann-rs422.c | 55 ++++++++++++++++++++++++++++++++++++
3 files changed, 59 insertions(+), 0 deletions(-)
create mode 100644 drivers/net/phy/hirschmann-rs422.c
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 54b2ba9..39d4905 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -90,6 +90,9 @@ config FIXED_MII_AMNT
This control will have specified number allocated for each fixed
PHY type enabled.
+config HIRSCHMANNRS422_PHY
+ tristate "Driver for Hirschmann's RS422 PHY"
+
config MDIO_BITBANG
tristate "Support for bitbanged MDIO buses"
help
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
index 3d6cc7b..748d69f 100644
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
@@ -13,4 +13,5 @@ obj-$(CONFIG_VITESSE_PHY) += vitesse.o
obj-$(CONFIG_BROADCOM_PHY) += broadcom.o
obj-$(CONFIG_ICPLUS_PHY) += icplus.o
obj-$(CONFIG_FIXED_PHY) += fixed.o
+obj-$(CONFIG_HIRSCHMANNRS422_PHY) += hirschmann-rs422.o
obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o
diff --git a/drivers/net/phy/hirschmann-rs422.c b/drivers/net/phy/hirschmann-rs422.c
new file mode 100644
index 0000000..f9bc326
--- /dev/null
+++ b/drivers/net/phy/hirschmann-rs422.c
@@ -0,0 +1,55 @@
+/*
+ * drivers/net/phy/hirschmann-rs422.c
+ *
+ * Copyright (C) 2007 by Digi International Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ */
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/phy.h>
+
+int hirschmannrs422_config_aneg(struct phy_device *phydev)
+{
+ /* XXX */
+ dev_warn(&phydev->dev, "I cannot autonegotiate (called from %p)\n",
+ __builtin_return_address(0));
+
+ dev_warn(&phydev->dev, "speed = %d, duplex = %d\n",
+ phydev->speed, phydev->duplex);
+ /* XXX: should better return -Esomething? */
+ return genphy_config_aneg(phydev);
+}
+
+static struct phy_driver hirschmannrs422_driver = {
+ .phy_id = 0x00071810,
+ .name = "Hirschmann_rs422",
+ .phy_id_mask = 0xfffffff0,
+ /* XXX: SUPPORTED_TP? */
+ .features = SUPPORTED_10baseT_Half | SUPPORTED_MII,
+ .read_status = genphy_read_status,
+ .config_aneg = hirschmannrs422_config_aneg,
+ .driver = { .owner = THIS_MODULE,},
+};
+
+static int __init hirschmannrs422_init(void)
+{
+ return phy_driver_register(&hirschmannrs422_driver);
+}
+
+static void __exit hirschmannrs422_exit(void)
+{
+ phy_driver_unregister(&hirschmannrs422_driver);
+}
+
+module_init(hirschmannrs422_init);
+module_exit(hirschmannrs422_exit);
+
+MODULE_AUTHOR("Uwe Kleine-Koenig");
+MODULE_DESCRIPTION("Hirschmann RS422 PHY driver");
+MODULE_LICENSE("GPL");
+
--
1.5.3.6
--
Uwe Kleine-König, Software Engineer
Digi International GmbH Branch Breisach, Küferstrasse 8, 79206 Breisach, Germany
Tax: 315/5781/0242 / VAT: DE153662976 / Reg. Amtsgericht Dortmund HRB 13962
reply other threads:[~2007-12-05 10:11 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071205101106.GA32729@digi.com \
--to=uwe.kleine-koenig@digi.com \
--cc=afleming@freescale.com \
--cc=jeff@garzik.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.