blob: 971e45815c6c4b436e06bf3a6eba5b582d7cbc1c [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Uwe Zeisbergerf30c2262006-10-03 23:01:26 +02002 * drivers/net/ibm_emac/ibm_emac_rgmii.h
Eugene Surovegin37448f72005-10-10 16:58:14 -07003 *
4 * Driver for PowerPC 4xx on-chip ethernet controller, RGMII bridge support.
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 *
6 * Based on ocp_zmii.h/ibm_emac_zmii.h
7 * Armin Kuster akuster@mvista.com
8 *
9 * Copyright 2004 MontaVista Software, Inc.
10 * Matt Porter <mporter@kernel.crashing.org>
11 *
Eugene Surovegin37448f72005-10-10 16:58:14 -070012 * Copyright (c) 2004, 2005 Zultys Technologies.
13 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
14 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070015 * This program is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License as published by the
17 * Free Software Foundation; either version 2 of the License, or (at your
18 * option) any later version.
19 */
20
21#ifndef _IBM_EMAC_RGMII_H_
22#define _IBM_EMAC_RGMII_H_
23
Linus Torvalds1da177e2005-04-16 15:20:36 -070024
25/* RGMII bridge */
Eugene Surovegin37448f72005-10-10 16:58:14 -070026struct rgmii_regs {
Linus Torvalds1da177e2005-04-16 15:20:36 -070027 u32 fer; /* Function enable register */
28 u32 ssr; /* Speed select register */
Eugene Surovegin37448f72005-10-10 16:58:14 -070029};
Linus Torvalds1da177e2005-04-16 15:20:36 -070030
31/* RGMII device */
32struct ibm_ocp_rgmii {
Al Virob43de2d2005-12-01 10:15:21 -050033 struct rgmii_regs __iomem *base;
Linus Torvalds1da177e2005-04-16 15:20:36 -070034 int users; /* number of EMACs using this RGMII bridge */
35};
36
Eugene Surovegin37448f72005-10-10 16:58:14 -070037#ifdef CONFIG_IBM_EMAC_RGMII
38int rgmii_attach(void *emac) __init;
Linus Torvalds1da177e2005-04-16 15:20:36 -070039
Eugene Surovegin0ec6d952007-05-16 11:57:37 -070040void __rgmii_fini(struct ocp_device *ocpdev, int input);
Eugene Surovegin37448f72005-10-10 16:58:14 -070041static inline void rgmii_fini(struct ocp_device *ocpdev, int input)
42{
43 if (ocpdev)
44 __rgmii_fini(ocpdev, input);
45}
Linus Torvalds1da177e2005-04-16 15:20:36 -070046
Eugene Surovegin37448f72005-10-10 16:58:14 -070047void rgmii_set_speed(struct ocp_device *ocpdev, int input, int speed);
Linus Torvalds1da177e2005-04-16 15:20:36 -070048
Eugene Surovegin37448f72005-10-10 16:58:14 -070049int __rgmii_get_regs_len(struct ocp_device *ocpdev);
50static inline int rgmii_get_regs_len(struct ocp_device *ocpdev)
51{
52 return ocpdev ? __rgmii_get_regs_len(ocpdev) : 0;
53}
Linus Torvalds1da177e2005-04-16 15:20:36 -070054
Eugene Surovegin37448f72005-10-10 16:58:14 -070055void *rgmii_dump_regs(struct ocp_device *ocpdev, void *buf);
56#else
57# define rgmii_attach(x) 0
58# define rgmii_fini(x,y) ((void)0)
59# define rgmii_set_speed(x,y,z) ((void)0)
60# define rgmii_get_regs_len(x) 0
61# define rgmii_dump_regs(x,buf) (buf)
62#endif /* !CONFIG_IBM_EMAC_RGMII */
Linus Torvalds1da177e2005-04-16 15:20:36 -070063
64#endif /* _IBM_EMAC_RGMII_H_ */