Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Eugene Surovegin | 37448f7 | 2005-10-10 16:58:14 -0700 | [diff] [blame] | 2 | * drivers/net/ibm_emac/ibm_emac_rgmii.c |
| 3 | * |
| 4 | * Driver for PowerPC 4xx on-chip ethernet controller, RGMII bridge support. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | * |
| 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 Surovegin | 37448f7 | 2005-10-10 16:58:14 -0700 | [diff] [blame] | 12 | * Copyright (c) 2004, 2005 Zultys Technologies. |
| 13 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> |
| 14 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | * 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 | |
| 24 | #include <linux/config.h> |
| 25 | |
| 26 | /* RGMII bridge */ |
Eugene Surovegin | 37448f7 | 2005-10-10 16:58:14 -0700 | [diff] [blame] | 27 | struct rgmii_regs { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | u32 fer; /* Function enable register */ |
| 29 | u32 ssr; /* Speed select register */ |
Eugene Surovegin | 37448f7 | 2005-10-10 16:58:14 -0700 | [diff] [blame] | 30 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | |
| 32 | /* RGMII device */ |
| 33 | struct ibm_ocp_rgmii { |
| 34 | struct rgmii_regs *base; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | int users; /* number of EMACs using this RGMII bridge */ |
| 36 | }; |
| 37 | |
Eugene Surovegin | 37448f7 | 2005-10-10 16:58:14 -0700 | [diff] [blame] | 38 | #ifdef CONFIG_IBM_EMAC_RGMII |
| 39 | int rgmii_attach(void *emac) __init; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | |
Eugene Surovegin | 37448f7 | 2005-10-10 16:58:14 -0700 | [diff] [blame] | 41 | void __rgmii_fini(struct ocp_device *ocpdev, int input) __exit; |
| 42 | static inline void rgmii_fini(struct ocp_device *ocpdev, int input) |
| 43 | { |
| 44 | if (ocpdev) |
| 45 | __rgmii_fini(ocpdev, input); |
| 46 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | |
Eugene Surovegin | 37448f7 | 2005-10-10 16:58:14 -0700 | [diff] [blame] | 48 | void rgmii_set_speed(struct ocp_device *ocpdev, int input, int speed); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | |
Eugene Surovegin | 37448f7 | 2005-10-10 16:58:14 -0700 | [diff] [blame] | 50 | int __rgmii_get_regs_len(struct ocp_device *ocpdev); |
| 51 | static inline int rgmii_get_regs_len(struct ocp_device *ocpdev) |
| 52 | { |
| 53 | return ocpdev ? __rgmii_get_regs_len(ocpdev) : 0; |
| 54 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | |
Eugene Surovegin | 37448f7 | 2005-10-10 16:58:14 -0700 | [diff] [blame] | 56 | void *rgmii_dump_regs(struct ocp_device *ocpdev, void *buf); |
| 57 | #else |
| 58 | # define rgmii_attach(x) 0 |
| 59 | # define rgmii_fini(x,y) ((void)0) |
| 60 | # define rgmii_set_speed(x,y,z) ((void)0) |
| 61 | # define rgmii_get_regs_len(x) 0 |
| 62 | # define rgmii_dump_regs(x,buf) (buf) |
| 63 | #endif /* !CONFIG_IBM_EMAC_RGMII */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | |
| 65 | #endif /* _IBM_EMAC_RGMII_H_ */ |