linux_dsm_epyc7002/drivers/net/ibm_emac/ibm_emac_zmii.h

84 lines
2.3 KiB
C
Raw Normal View History

/*
2005-10-11 06:58:14 +07:00
* drivers/net/ibm_emac/ibm_emac_zmii.h
*
2005-10-11 06:58:14 +07:00
* Driver for PowerPC 4xx on-chip ethernet controller, ZMII bridge support.
*
2005-10-11 06:58:14 +07:00
* Copyright (c) 2004, 2005 Zultys Technologies.
* Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
*
2005-10-11 06:58:14 +07:00
* Based on original work by
* Armin Kuster <akuster@mvista.com>
* Copyright 2001 MontaVista Softare Inc.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
2005-10-11 06:58:14 +07:00
*
*/
#ifndef _IBM_EMAC_ZMII_H_
#define _IBM_EMAC_ZMII_H_
#include <linux/config.h>
2005-10-11 06:58:14 +07:00
#include <linux/init.h>
#include <asm/ocp.h>
/* ZMII bridge registers */
struct zmii_regs {
u32 fer; /* Function enable reg */
u32 ssr; /* Speed select reg */
u32 smiirs; /* SMII status reg */
};
/* ZMII device */
struct ibm_ocp_zmii {
struct zmii_regs *base;
2005-10-11 06:58:14 +07:00
int mode; /* subset of PHY_MODE_XXXX */
int users; /* number of EMACs using this ZMII bridge */
2005-10-11 06:58:14 +07:00
u32 fer_save; /* FER value left by firmware */
};
2005-10-11 06:58:14 +07:00
#ifdef CONFIG_IBM_EMAC_ZMII
int zmii_attach(void *emac) __init;
2005-10-11 06:58:14 +07:00
void __zmii_fini(struct ocp_device *ocpdev, int input) __exit;
static inline void zmii_fini(struct ocp_device *ocpdev, int input)
{
if (ocpdev)
__zmii_fini(ocpdev, input);
}
2005-10-11 06:58:14 +07:00
void __zmii_enable_mdio(struct ocp_device *ocpdev, int input);
static inline void zmii_enable_mdio(struct ocp_device *ocpdev, int input)
{
if (ocpdev)
__zmii_enable_mdio(ocpdev, input);
}
2005-10-11 06:58:14 +07:00
void __zmii_set_speed(struct ocp_device *ocpdev, int input, int speed);
static inline void zmii_set_speed(struct ocp_device *ocpdev, int input,
int speed)
{
if (ocpdev)
__zmii_set_speed(ocpdev, input, speed);
}
2005-10-11 06:58:14 +07:00
int __zmii_get_regs_len(struct ocp_device *ocpdev);
static inline int zmii_get_regs_len(struct ocp_device *ocpdev)
{
return ocpdev ? __zmii_get_regs_len(ocpdev) : 0;
}
2005-10-11 06:58:14 +07:00
void *zmii_dump_regs(struct ocp_device *ocpdev, void *buf);
2005-10-11 06:58:14 +07:00
#else
# define zmii_attach(x) 0
# define zmii_fini(x,y) ((void)0)
# define zmii_enable_mdio(x,y) ((void)0)
# define zmii_set_speed(x,y,z) ((void)0)
# define zmii_get_regs_len(x) 0
# define zmii_dump_regs(x,buf) (buf)
#endif /* !CONFIG_IBM_EMAC_ZMII */
#endif /* _IBM_EMAC_ZMII_H_ */