lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20071205101106.GA32729@digi.com>
Date:	Wed, 5 Dec 2007 11:11:06 +0100
From:	Uwe Kleine-König <Uwe.Kleine-Koenig@...i.com>
To:	netdev@...r.kernel.org
Cc:	Andy Fleming <afleming@...escale.com>,
	Jeff Garzik <jeff@...zik.org>
Subject: config_aneg for phy not supporting autonegotiation

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@...i.com>

add Hirschmann RS422 phy

Signed-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig@...i.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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ