* [PATCH 1/5] net/phy/marvell: Expose IDs and flags in a .h and add dns323 LEDs setup flag
@ 2010-05-22 10:54 Benjamin Herrenschmidt
2010-05-22 13:06 ` Wolfram Sang
0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2010-05-22 10:54 UTC (permalink / raw)
To: linux-arm-kernel@lists.infradead.org; +Cc: netdev, Wolfram Sang, Nicolas Pitre
This moves the various known Marvell PHY IDs to include/linux/marvell_phy.h
along with dev_flags definitions for use by the driver.
I then added a flag that changes the PHY init code to setup the LEDs
config to the values needed to operate a dns323 rev C1 NAS.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: netdev@vger.kernel.org
CC: Wolfram Sang <w.sang@pengutronix.de>
---
Note: My subsequent DNS-323 rev C support patches depend on that one, so if
you (netdev) guys are ok with it, it could be merged via the ARM tree along
with the other stuff.
drivers/net/phy/marvell.c | 34 +++++++++++++++++++---------------
include/linux/marvell_phy.h | 19 +++++++++++++++++++
2 files changed, 38 insertions(+), 15 deletions(-)
create mode 100644 include/linux/marvell_phy.h
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 64c7fbe..34447ef 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -29,6 +29,7 @@
#include <linux/mii.h>
#include <linux/ethtool.h>
#include <linux/phy.h>
+#include <linux/marvell_phy.h>
#include <asm/io.h>
#include <asm/irq.h>
@@ -350,7 +351,10 @@ static int m88e1118_config_init(struct phy_device *phydev)
return err;
/* Adjust LED Control */
- err = phy_write(phydev, 0x10, 0x021e);
+ if (phydev->dev_flags & MARVELL_PHY_DNS323_LEDS)
+ err = phy_write(phydev, 0x10, 0x1100);
+ else
+ err = phy_write(phydev, 0x10, 0x021e);
if (err < 0)
return err;
@@ -529,8 +533,8 @@ static int m88e1121_did_interrupt(struct phy_device *phydev)
static struct phy_driver marvell_drivers[] = {
{
- .phy_id = 0x01410c60,
- .phy_id_mask = 0xfffffff0,
+ .phy_id = MARVELL_PHY_ID_88E1101,
+ .phy_id_mask = MARVELL_PHY_ID_MASK,
.name = "Marvell 88E1101",
.features = PHY_GBIT_FEATURES,
.flags = PHY_HAS_INTERRUPT,
@@ -541,8 +545,8 @@ static struct phy_driver marvell_drivers[] = {
.driver = { .owner = THIS_MODULE },
},
{
- .phy_id = 0x01410c90,
- .phy_id_mask = 0xfffffff0,
+ .phy_id = MARVELL_PHY_ID_88E1112,
+ .phy_id_mask = MARVELL_PHY_ID_MASK,
.name = "Marvell 88E1112",
.features = PHY_GBIT_FEATURES,
.flags = PHY_HAS_INTERRUPT,
@@ -554,8 +558,8 @@ static struct phy_driver marvell_drivers[] = {
.driver = { .owner = THIS_MODULE },
},
{
- .phy_id = 0x01410cc0,
- .phy_id_mask = 0xfffffff0,
+ .phy_id = MARVELL_PHY_ID_88E1111,
+ .phy_id_mask = MARVELL_PHY_ID_MASK,
.name = "Marvell 88E1111",
.features = PHY_GBIT_FEATURES,
.flags = PHY_HAS_INTERRUPT,
@@ -567,8 +571,8 @@ static struct phy_driver marvell_drivers[] = {
.driver = { .owner = THIS_MODULE },
},
{
- .phy_id = 0x01410e10,
- .phy_id_mask = 0xfffffff0,
+ .phy_id = MARVELL_PHY_ID_88E1118,
+ .phy_id_mask = MARVELL_PHY_ID_MASK,
.name = "Marvell 88E1118",
.features = PHY_GBIT_FEATURES,
.flags = PHY_HAS_INTERRUPT,
@@ -580,8 +584,8 @@ static struct phy_driver marvell_drivers[] = {
.driver = {.owner = THIS_MODULE,},
},
{
- .phy_id = 0x01410cb0,
- .phy_id_mask = 0xfffffff0,
+ .phy_id = MARVELL_PHY_ID_88E1121R,
+ .phy_id_mask = MARVELL_PHY_ID_MASK,
.name = "Marvell 88E1121R",
.features = PHY_GBIT_FEATURES,
.flags = PHY_HAS_INTERRUPT,
@@ -593,8 +597,8 @@ static struct phy_driver marvell_drivers[] = {
.driver = { .owner = THIS_MODULE },
},
{
- .phy_id = 0x01410cd0,
- .phy_id_mask = 0xfffffff0,
+ .phy_id = MARVELL_PHY_ID_88E1145,
+ .phy_id_mask = MARVELL_PHY_ID_MASK,
.name = "Marvell 88E1145",
.features = PHY_GBIT_FEATURES,
.flags = PHY_HAS_INTERRUPT,
@@ -606,8 +610,8 @@ static struct phy_driver marvell_drivers[] = {
.driver = { .owner = THIS_MODULE },
},
{
- .phy_id = 0x01410e30,
- .phy_id_mask = 0xfffffff0,
+ .phy_id = MARVELL_PHY_ID_88E1240,
+ .phy_id_mask = MARVELL_PHY_ID_MASK,
.name = "Marvell 88E1240",
.features = PHY_GBIT_FEATURES,
.flags = PHY_HAS_INTERRUPT,
diff --git a/include/linux/marvell_phy.h b/include/linux/marvell_phy.h
new file mode 100644
index 0000000..b5cb8c8
--- /dev/null
+++ b/include/linux/marvell_phy.h
@@ -0,0 +1,19 @@
+#ifndef _MARVELL_PHY_H
+#define _MARVELL_PHY_H
+
+/* Mask used for ID comparisons */
+#define MARVELL_PHY_ID_MASK 0xfffffff0
+
+/* Known PHY IDs */
+#define MARVELL_PHY_ID_88E1101 0x01410c60
+#define MARVELL_PHY_ID_88E1112 0x01410c90
+#define MARVELL_PHY_ID_88E1111 0x01410cc0
+#define MARVELL_PHY_ID_88E1118 0x01410e10
+#define MARVELL_PHY_ID_88E1121R 0x01410cb0
+#define MARVELL_PHY_ID_88E1145 0x01410cd0
+#define MARVELL_PHY_ID_88E1240 0x01410e30
+
+/* struct phy_device dev_flags definitions */
+#define MARVELL_PHY_DNS323_LEDS 0x00000001
+
+#endif /* _MARVELL_PHY_H */
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/5] net/phy/marvell: Expose IDs and flags in a .h and add dns323 LEDs setup flag
2010-05-22 10:54 [PATCH 1/5] net/phy/marvell: Expose IDs and flags in a .h and add dns323 LEDs setup flag Benjamin Herrenschmidt
@ 2010-05-22 13:06 ` Wolfram Sang
2010-05-22 22:53 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 3+ messages in thread
From: Wolfram Sang @ 2010-05-22 13:06 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: linux-arm-kernel@lists.infradead.org, netdev, Nicolas Pitre
[-- Attachment #1: Type: text/plain, Size: 708 bytes --]
On Sat, May 22, 2010 at 08:54:43PM +1000, Benjamin Herrenschmidt wrote:
> This moves the various known Marvell PHY IDs to include/linux/marvell_phy.h
> along with dev_flags definitions for use by the driver.
I think this one from the driver should go there, too:
#define M1145_DEV_FLAGS_RESISTANCE 0x00000001
(which makes me wonder how this flag was set as it was not exported before)
and thus yours could be maybe like
#define M1118_DEV_FLAGS_ALT_LED_INIT 0x00000001
(or 1 << 0)
?
Otherwise looks good enough to me.
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/5] net/phy/marvell: Expose IDs and flags in a .h and add dns323 LEDs setup flag
2010-05-22 13:06 ` Wolfram Sang
@ 2010-05-22 22:53 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2010-05-22 22:53 UTC (permalink / raw)
To: Wolfram Sang; +Cc: netdev, linux-arm-kernel@lists.infradead.org, Nicolas Pitre
On Sat, 2010-05-22 at 15:06 +0200, Wolfram Sang wrote:
> On Sat, May 22, 2010 at 08:54:43PM +1000, Benjamin Herrenschmidt wrote:
> > This moves the various known Marvell PHY IDs to include/linux/marvell_phy.h
> > along with dev_flags definitions for use by the driver.
>
> I think this one from the driver should go there, too:
>
> #define M1145_DEV_FLAGS_RESISTANCE 0x00000001
>
> (which makes me wonder how this flag was set as it was not exported before)
I missed that one indeed.
> and thus yours could be maybe like
>
> #define M1118_DEV_FLAGS_ALT_LED_INIT 0x00000001
>
> (or 1 << 0)
Right, it should be 2. I'd rather keep the "DNS323" name in there
since the LED setup is specific to that NAS and somebody else might
need a different one. If we end up in the long run with too many
of them, we'll find a better solution, but we aren't there yet.
> Otherwise looks good enough to me.
Ok, thanks. I'll respin the whole lot soon.
Cheers,
Ben.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-05-22 22:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-22 10:54 [PATCH 1/5] net/phy/marvell: Expose IDs and flags in a .h and add dns323 LEDs setup flag Benjamin Herrenschmidt
2010-05-22 13:06 ` Wolfram Sang
2010-05-22 22:53 ` Benjamin Herrenschmidt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).