Jeff Garzik | 6aa20a2 | 2006-09-13 13:24:59 -0400 | [diff] [blame] | 1 | /* |
Andy Fleming | bb40dcb | 2005-09-23 22:54:21 -0400 | [diff] [blame] | 2 | * drivers/net/gianfar_mii.h |
| 3 | * |
| 4 | * Gianfar Ethernet Driver -- MII Management Bus Implementation |
| 5 | * Driver for the MDIO bus controller in the Gianfar register space |
| 6 | * |
| 7 | * Author: Andy Fleming |
Kumar Gala | 4c8d3d9 | 2005-11-13 16:06:30 -0800 | [diff] [blame] | 8 | * Maintainer: Kumar Gala |
Andy Fleming | bb40dcb | 2005-09-23 22:54:21 -0400 | [diff] [blame] | 9 | * |
| 10 | * Copyright (c) 2002-2004 Freescale Semiconductor, Inc. |
| 11 | * |
| 12 | * This program is free software; you can redistribute it and/or modify it |
| 13 | * under the terms of the GNU General Public License as published by the |
| 14 | * Free Software Foundation; either version 2 of the License, or (at your |
| 15 | * option) any later version. |
| 16 | * |
| 17 | */ |
| 18 | #ifndef __GIANFAR_MII_H |
| 19 | #define __GIANFAR_MII_H |
| 20 | |
Trent Piepho | c132419 | 2008-10-30 18:17:06 -0700 | [diff] [blame^] | 21 | struct gfar_private; /* forward ref */ |
| 22 | |
Andy Fleming | bb40dcb | 2005-09-23 22:54:21 -0400 | [diff] [blame] | 23 | #define MIIMIND_BUSY 0x00000001 |
| 24 | #define MIIMIND_NOTVALID 0x00000004 |
| 25 | |
| 26 | #define MII_READ_COMMAND 0x00000001 |
| 27 | |
| 28 | #define GFAR_SUPPORTED (SUPPORTED_10baseT_Half \ |
Andy Fleming | 7f7f531 | 2005-11-11 12:38:59 -0600 | [diff] [blame] | 29 | | SUPPORTED_10baseT_Full \ |
Andy Fleming | bb40dcb | 2005-09-23 22:54:21 -0400 | [diff] [blame] | 30 | | SUPPORTED_100baseT_Half \ |
| 31 | | SUPPORTED_100baseT_Full \ |
| 32 | | SUPPORTED_Autoneg \ |
| 33 | | SUPPORTED_MII) |
| 34 | |
| 35 | struct gfar_mii { |
| 36 | u32 miimcfg; /* 0x.520 - MII Management Config Register */ |
| 37 | u32 miimcom; /* 0x.524 - MII Management Command Register */ |
| 38 | u32 miimadd; /* 0x.528 - MII Management Address Register */ |
| 39 | u32 miimcon; /* 0x.52c - MII Management Control Register */ |
| 40 | u32 miimstat; /* 0x.530 - MII Management Status Register */ |
| 41 | u32 miimind; /* 0x.534 - MII Management Indicator Register */ |
| 42 | }; |
| 43 | |
| 44 | int gfar_mdio_read(struct mii_bus *bus, int mii_id, int regnum); |
| 45 | int gfar_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value); |
Paul Gortmaker | d031358 | 2008-04-17 00:08:10 -0400 | [diff] [blame] | 46 | int gfar_local_mdio_write(struct gfar_mii __iomem *regs, int mii_id, |
| 47 | int regnum, u16 value); |
| 48 | int gfar_local_mdio_read(struct gfar_mii __iomem *regs, int mii_id, int regnum); |
Trent Piepho | c132419 | 2008-10-30 18:17:06 -0700 | [diff] [blame^] | 49 | struct mii_bus *gfar_get_miibus(const struct gfar_private *priv); |
Andy Fleming | bb40dcb | 2005-09-23 22:54:21 -0400 | [diff] [blame] | 50 | int __init gfar_mdio_init(void); |
Kumar Gala | b9daf6c | 2007-07-26 00:52:34 -0500 | [diff] [blame] | 51 | void gfar_mdio_exit(void); |
Andy Fleming | bb40dcb | 2005-09-23 22:54:21 -0400 | [diff] [blame] | 52 | #endif /* GIANFAR_PHY_H */ |