aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/ibm_emac/ibm_emac_rgmii.h
blob: 971e45815c6c4b436e06bf3a6eba5b582d7cbc1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
 * drivers/net/ibm_emac/ibm_emac_rgmii.h
 *
 * Driver for PowerPC 4xx on-chip ethernet controller, RGMII bridge support.
 *
 * Based on ocp_zmii.h/ibm_emac_zmii.h
 * Armin Kuster akuster@mvista.com
 *
 * Copyright 2004 MontaVista Software, Inc.
 * Matt Porter <mporter@kernel.crashing.org>
 *
 * Copyright (c) 2004, 2005 Zultys Technologies.
 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
 *
 * 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.
 */

#ifndef _IBM_EMAC_RGMII_H_
#define _IBM_EMAC_RGMII_H_


/* RGMII bridge */
struct rgmii_regs {
	u32 fer;		/* Function enable register */
	u32 ssr;		/* Speed select register */
};

/* RGMII device */
struct ibm_ocp_rgmii {
	struct rgmii_regs __iomem *base;
	int users;		/* number of EMACs using this RGMII bridge */
};

#ifdef CONFIG_IBM_EMAC_RGMII
int rgmii_attach(void *emac) __init;

void __rgmii_fini(struct ocp_device *ocpdev, int input);
static inline void rgmii_fini(struct ocp_device *ocpdev, int input)
{
	if (ocpdev)
		__rgmii_fini(ocpdev, input);
}

void rgmii_set_speed(struct ocp_device *ocpdev, int input, int speed);

int __rgmii_get_regs_len(struct ocp_device *ocpdev);
static inline int rgmii_get_regs_len(struct ocp_device *ocpdev)
{
	return ocpdev ? __rgmii_get_regs_len(ocpdev) : 0;
}

void *rgmii_dump_regs(struct ocp_device *ocpdev, void *buf);
#else
# define rgmii_attach(x)	0
# define rgmii_fini(x,y)	((void)0)
# define rgmii_set_speed(x,y,z)	((void)0)
# define rgmii_get_regs_len(x)	0
# define rgmii_dump_regs(x,buf)	(buf)
#endif				/* !CONFIG_IBM_EMAC_RGMII */

#endif				/* _IBM_EMAC_RGMII_H_ */