2005-03-31 04:34:31 +07:00
|
|
|
/*****************************************************************************
|
|
|
|
* *
|
|
|
|
* File: cphy.h *
|
Update Chelsio gige net driver.
- Use extern prefix for functions required.
- Removed a lot of wrappers, including t1_read/write_reg_4.
- Removed various macros, using native kernel calls now.
- Enumerated various #defines.
- Removed a lot of shared code which is not currently used in "NIC only" mode.
- Removed dead code.
Documentation/networking/cxgb.txt:
- Updated release notes for version 2.1.1
drivers/net/chelsio/ch_ethtool.h
- removed file, no longer using ETHTOOL namespace.
drivers/net/chelsio/common.h
- moved code from osdep.h to common.h
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/cphy.h
- removed dead code.
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/cxgb2.c
- use DMA_{32,64}BIT_MASK in include/linux/dma-mapping.h.
- removed unused code.
- use printk message for link info resembling drivers/net/mii.c.
- no longer using the MODULE_xxx namespace.
- no longer using "pci_" namespace.
- no longer using ETHTOOL namespace.
drivers/net/chelsio/cxgb2.h
- removed file, merged into common.h
drivers/net/chelsio/elmer0.h
- removed dead code.
- added various enums.
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/espi.c
- removed various macros, using native kernel calls now.
- removed a lot of wrappers, including t1_read/write_reg_4.
drivers/net/chelsio/espi.h
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/gmac.h
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/mv88x201x.c
- changes to sync with Chelsio TOT.
drivers/net/chelsio/osdep.h
- removed file, consolidation. osdep was used to translate wrapper functions
since our code supports multiple OSs. removed wrappers.
drivers/net/chelsio/pm3393.c
- removed various macros, using native kernel calls now.
- removed a lot of wrappers, including t1_read/write_reg_4.
- removed unused code.
drivers/net/chelsio/regs.h
- added a few register entries for future and current feature support.
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/sge.c
- rewrote large portion of scatter-gather engine to stabilize
performance.
- using u8/u16/u32 kernel types instead of __u8/__u16/__u32 compiler
types.
drivers/net/chelsio/sge.h
- rewrote large portion of scatter-gather engine to stabilize
performance.
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/subr.c
- merged tp.c into subr.c
- removed various macros, using native kernel calls now.
- removed a lot of wrappers, including t1_read/write_reg_4.
- removed unused code.
drivers/net/chelsio/suni1x10gexp_regs.h
- modified copyright and authorship of file.
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/tp.c
- removed file, merged into subr.c.
drivers/net/chelsio/tp.h
- removed file.
include/linux/pci_ids.h
- patched to include PCI_VENDOR_ID_CHELSIO 0x1425, removed define from
our code.
2005-06-23 12:40:19 +07:00
|
|
|
* $Revision: 1.7 $ *
|
|
|
|
* $Date: 2005/06/21 18:29:47 $ *
|
2005-03-31 04:34:31 +07:00
|
|
|
* Description: *
|
|
|
|
* part of the Chelsio 10Gb Ethernet Driver. *
|
|
|
|
* *
|
|
|
|
* 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. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License along *
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc., *
|
|
|
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
|
|
|
* *
|
|
|
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED *
|
|
|
|
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF *
|
|
|
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. *
|
|
|
|
* *
|
|
|
|
* http://www.chelsio.com *
|
|
|
|
* *
|
|
|
|
* Copyright (c) 2003 - 2005 Chelsio Communications, Inc. *
|
|
|
|
* All rights reserved. *
|
|
|
|
* *
|
|
|
|
* Maintainers: maintainers@chelsio.com *
|
|
|
|
* *
|
|
|
|
* Authors: Dimitrios Michailidis <dm@chelsio.com> *
|
|
|
|
* Tina Yang <tainay@chelsio.com> *
|
|
|
|
* Felix Marti <felix@chelsio.com> *
|
|
|
|
* Scott Bardone <sbardone@chelsio.com> *
|
|
|
|
* Kurt Ottaway <kottaway@chelsio.com> *
|
|
|
|
* Frank DiMambro <frank@chelsio.com> *
|
|
|
|
* *
|
|
|
|
* History: *
|
|
|
|
* *
|
|
|
|
****************************************************************************/
|
|
|
|
|
Update Chelsio gige net driver.
- Use extern prefix for functions required.
- Removed a lot of wrappers, including t1_read/write_reg_4.
- Removed various macros, using native kernel calls now.
- Enumerated various #defines.
- Removed a lot of shared code which is not currently used in "NIC only" mode.
- Removed dead code.
Documentation/networking/cxgb.txt:
- Updated release notes for version 2.1.1
drivers/net/chelsio/ch_ethtool.h
- removed file, no longer using ETHTOOL namespace.
drivers/net/chelsio/common.h
- moved code from osdep.h to common.h
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/cphy.h
- removed dead code.
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/cxgb2.c
- use DMA_{32,64}BIT_MASK in include/linux/dma-mapping.h.
- removed unused code.
- use printk message for link info resembling drivers/net/mii.c.
- no longer using the MODULE_xxx namespace.
- no longer using "pci_" namespace.
- no longer using ETHTOOL namespace.
drivers/net/chelsio/cxgb2.h
- removed file, merged into common.h
drivers/net/chelsio/elmer0.h
- removed dead code.
- added various enums.
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/espi.c
- removed various macros, using native kernel calls now.
- removed a lot of wrappers, including t1_read/write_reg_4.
drivers/net/chelsio/espi.h
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/gmac.h
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/mv88x201x.c
- changes to sync with Chelsio TOT.
drivers/net/chelsio/osdep.h
- removed file, consolidation. osdep was used to translate wrapper functions
since our code supports multiple OSs. removed wrappers.
drivers/net/chelsio/pm3393.c
- removed various macros, using native kernel calls now.
- removed a lot of wrappers, including t1_read/write_reg_4.
- removed unused code.
drivers/net/chelsio/regs.h
- added a few register entries for future and current feature support.
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/sge.c
- rewrote large portion of scatter-gather engine to stabilize
performance.
- using u8/u16/u32 kernel types instead of __u8/__u16/__u32 compiler
types.
drivers/net/chelsio/sge.h
- rewrote large portion of scatter-gather engine to stabilize
performance.
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/subr.c
- merged tp.c into subr.c
- removed various macros, using native kernel calls now.
- removed a lot of wrappers, including t1_read/write_reg_4.
- removed unused code.
drivers/net/chelsio/suni1x10gexp_regs.h
- modified copyright and authorship of file.
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/tp.c
- removed file, merged into subr.c.
drivers/net/chelsio/tp.h
- removed file.
include/linux/pci_ids.h
- patched to include PCI_VENDOR_ID_CHELSIO 0x1425, removed define from
our code.
2005-06-23 12:40:19 +07:00
|
|
|
#ifndef _CXGB_CPHY_H_
|
|
|
|
#define _CXGB_CPHY_H_
|
2005-03-31 04:34:31 +07:00
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
|
|
|
|
struct mdio_ops {
|
|
|
|
void (*init)(adapter_t *adapter, const struct board_info *bi);
|
2009-04-29 15:06:34 +07:00
|
|
|
int (*read)(struct net_device *dev, int phy_addr, int mmd_addr,
|
|
|
|
u16 reg_addr);
|
|
|
|
int (*write)(struct net_device *dev, int phy_addr, int mmd_addr,
|
|
|
|
u16 reg_addr, u16 val);
|
|
|
|
unsigned mode_support;
|
2005-03-31 04:34:31 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
/* PHY interrupt types */
|
|
|
|
enum {
|
|
|
|
cphy_cause_link_change = 0x1,
|
2006-12-02 07:36:16 +07:00
|
|
|
cphy_cause_error = 0x2,
|
|
|
|
cphy_cause_fifo_error = 0x3
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
PHY_LINK_UP = 0x1,
|
|
|
|
PHY_AUTONEG_RDY = 0x2,
|
|
|
|
PHY_AUTONEG_EN = 0x4
|
2005-03-31 04:34:31 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct cphy;
|
|
|
|
|
|
|
|
/* PHY operations */
|
|
|
|
struct cphy_ops {
|
|
|
|
void (*destroy)(struct cphy *);
|
|
|
|
int (*reset)(struct cphy *, int wait);
|
|
|
|
|
|
|
|
int (*interrupt_enable)(struct cphy *);
|
|
|
|
int (*interrupt_disable)(struct cphy *);
|
|
|
|
int (*interrupt_clear)(struct cphy *);
|
|
|
|
int (*interrupt_handler)(struct cphy *);
|
|
|
|
|
|
|
|
int (*autoneg_enable)(struct cphy *);
|
|
|
|
int (*autoneg_disable)(struct cphy *);
|
|
|
|
int (*autoneg_restart)(struct cphy *);
|
|
|
|
|
|
|
|
int (*advertise)(struct cphy *phy, unsigned int advertise_map);
|
|
|
|
int (*set_loopback)(struct cphy *, int on);
|
|
|
|
int (*set_speed_duplex)(struct cphy *phy, int speed, int duplex);
|
|
|
|
int (*get_link_status)(struct cphy *phy, int *link_ok, int *speed,
|
|
|
|
int *duplex, int *fc);
|
2009-04-29 15:06:34 +07:00
|
|
|
|
|
|
|
u32 mmds;
|
2005-03-31 04:34:31 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
/* A PHY instance */
|
|
|
|
struct cphy {
|
2006-12-02 07:36:16 +07:00
|
|
|
int state; /* Link status state machine */
|
2005-03-31 04:34:31 +07:00
|
|
|
adapter_t *adapter; /* associated adapter */
|
2006-12-02 07:36:16 +07:00
|
|
|
|
2006-12-06 02:36:26 +07:00
|
|
|
struct delayed_work phy_update;
|
2006-12-02 07:36:16 +07:00
|
|
|
|
|
|
|
u16 bmsr;
|
|
|
|
int count;
|
|
|
|
int act_count;
|
|
|
|
int act_on;
|
|
|
|
|
|
|
|
u32 elmer_gpo;
|
|
|
|
|
2007-02-21 06:58:02 +07:00
|
|
|
const struct cphy_ops *ops; /* PHY operations */
|
2009-04-29 15:06:34 +07:00
|
|
|
struct mdio_if_info mdio;
|
2005-03-31 04:34:31 +07:00
|
|
|
struct cphy_instance *instance;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Convenience MDIO read/write wrappers */
|
2009-04-29 15:06:34 +07:00
|
|
|
static inline int cphy_mdio_read(struct cphy *cphy, int mmd, int reg,
|
|
|
|
unsigned int *valp)
|
2005-03-31 04:34:31 +07:00
|
|
|
{
|
2009-04-29 15:06:34 +07:00
|
|
|
int rc = cphy->mdio.mdio_read(cphy->mdio.dev, cphy->mdio.prtad, mmd,
|
|
|
|
reg);
|
|
|
|
*valp = (rc >= 0) ? rc : -1;
|
|
|
|
return (rc >= 0) ? 0 : rc;
|
2005-03-31 04:34:31 +07:00
|
|
|
}
|
|
|
|
|
2009-04-29 15:06:34 +07:00
|
|
|
static inline int cphy_mdio_write(struct cphy *cphy, int mmd, int reg,
|
|
|
|
unsigned int val)
|
2005-03-31 04:34:31 +07:00
|
|
|
{
|
2009-04-29 15:06:34 +07:00
|
|
|
return cphy->mdio.mdio_write(cphy->mdio.dev, cphy->mdio.prtad, mmd,
|
|
|
|
reg, val);
|
2005-03-31 04:34:31 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int simple_mdio_read(struct cphy *cphy, int reg,
|
|
|
|
unsigned int *valp)
|
|
|
|
{
|
2009-04-29 15:06:34 +07:00
|
|
|
return cphy_mdio_read(cphy, MDIO_DEVAD_NONE, reg, valp);
|
2005-03-31 04:34:31 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int simple_mdio_write(struct cphy *cphy, int reg,
|
|
|
|
unsigned int val)
|
|
|
|
{
|
2009-04-29 15:06:34 +07:00
|
|
|
return cphy_mdio_write(cphy, MDIO_DEVAD_NONE, reg, val);
|
2005-03-31 04:34:31 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Convenience initializer */
|
2009-05-20 22:56:12 +07:00
|
|
|
static inline void cphy_init(struct cphy *phy, struct net_device *dev,
|
2005-03-31 04:34:31 +07:00
|
|
|
int phy_addr, struct cphy_ops *phy_ops,
|
2007-02-21 06:58:02 +07:00
|
|
|
const struct mdio_ops *mdio_ops)
|
2005-03-31 04:34:31 +07:00
|
|
|
{
|
2009-05-20 22:56:12 +07:00
|
|
|
struct adapter *adapter = netdev_priv(dev);
|
2005-03-31 04:34:31 +07:00
|
|
|
phy->adapter = adapter;
|
|
|
|
phy->ops = phy_ops;
|
|
|
|
if (mdio_ops) {
|
2009-04-29 15:06:34 +07:00
|
|
|
phy->mdio.prtad = phy_addr;
|
|
|
|
phy->mdio.mmds = phy_ops->mmds;
|
|
|
|
phy->mdio.mode_support = mdio_ops->mode_support;
|
|
|
|
phy->mdio.mdio_read = mdio_ops->read;
|
|
|
|
phy->mdio.mdio_write = mdio_ops->write;
|
2005-03-31 04:34:31 +07:00
|
|
|
}
|
2009-05-20 22:56:12 +07:00
|
|
|
phy->mdio.dev = dev;
|
2005-03-31 04:34:31 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Operations of the PHY-instance factory */
|
|
|
|
struct gphy {
|
|
|
|
/* Construct a PHY instance with the given PHY address */
|
2009-05-20 22:56:12 +07:00
|
|
|
struct cphy *(*create)(struct net_device *dev, int phy_addr,
|
2007-02-21 06:58:02 +07:00
|
|
|
const struct mdio_ops *mdio_ops);
|
2005-03-31 04:34:31 +07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Reset the PHY chip. This resets the whole PHY chip, not individual
|
|
|
|
* ports.
|
|
|
|
*/
|
|
|
|
int (*reset)(adapter_t *adapter);
|
|
|
|
};
|
|
|
|
|
2007-02-21 06:58:02 +07:00
|
|
|
extern const struct gphy t1_my3126_ops;
|
|
|
|
extern const struct gphy t1_mv88e1xxx_ops;
|
|
|
|
extern const struct gphy t1_vsc8244_ops;
|
|
|
|
extern const struct gphy t1_mv88x201x_ops;
|
Update Chelsio gige net driver.
- Use extern prefix for functions required.
- Removed a lot of wrappers, including t1_read/write_reg_4.
- Removed various macros, using native kernel calls now.
- Enumerated various #defines.
- Removed a lot of shared code which is not currently used in "NIC only" mode.
- Removed dead code.
Documentation/networking/cxgb.txt:
- Updated release notes for version 2.1.1
drivers/net/chelsio/ch_ethtool.h
- removed file, no longer using ETHTOOL namespace.
drivers/net/chelsio/common.h
- moved code from osdep.h to common.h
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/cphy.h
- removed dead code.
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/cxgb2.c
- use DMA_{32,64}BIT_MASK in include/linux/dma-mapping.h.
- removed unused code.
- use printk message for link info resembling drivers/net/mii.c.
- no longer using the MODULE_xxx namespace.
- no longer using "pci_" namespace.
- no longer using ETHTOOL namespace.
drivers/net/chelsio/cxgb2.h
- removed file, merged into common.h
drivers/net/chelsio/elmer0.h
- removed dead code.
- added various enums.
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/espi.c
- removed various macros, using native kernel calls now.
- removed a lot of wrappers, including t1_read/write_reg_4.
drivers/net/chelsio/espi.h
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/gmac.h
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/mv88x201x.c
- changes to sync with Chelsio TOT.
drivers/net/chelsio/osdep.h
- removed file, consolidation. osdep was used to translate wrapper functions
since our code supports multiple OSs. removed wrappers.
drivers/net/chelsio/pm3393.c
- removed various macros, using native kernel calls now.
- removed a lot of wrappers, including t1_read/write_reg_4.
- removed unused code.
drivers/net/chelsio/regs.h
- added a few register entries for future and current feature support.
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/sge.c
- rewrote large portion of scatter-gather engine to stabilize
performance.
- using u8/u16/u32 kernel types instead of __u8/__u16/__u32 compiler
types.
drivers/net/chelsio/sge.h
- rewrote large portion of scatter-gather engine to stabilize
performance.
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/subr.c
- merged tp.c into subr.c
- removed various macros, using native kernel calls now.
- removed a lot of wrappers, including t1_read/write_reg_4.
- removed unused code.
drivers/net/chelsio/suni1x10gexp_regs.h
- modified copyright and authorship of file.
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/tp.c
- removed file, merged into subr.c.
drivers/net/chelsio/tp.h
- removed file.
include/linux/pci_ids.h
- patched to include PCI_VENDOR_ID_CHELSIO 0x1425, removed define from
our code.
2005-06-23 12:40:19 +07:00
|
|
|
|
|
|
|
#endif /* _CXGB_CPHY_H_ */
|