David Gibson | 1d3bb99 | 2007-08-23 13:56:01 +1000 | [diff] [blame] | 1 | /* |
Paul Gortmaker | 3396c78 | 2012-01-27 13:36:01 +0000 | [diff] [blame] | 2 | * drivers/net/ethernet/ibm/emac/rgmii.h |
David Gibson | 1d3bb99 | 2007-08-23 13:56:01 +1000 | [diff] [blame] | 3 | * |
| 4 | * Driver for PowerPC 4xx on-chip ethernet controller, RGMII bridge support. |
| 5 | * |
Benjamin Herrenschmidt | 17cf803 | 2007-12-05 11:14:33 +1100 | [diff] [blame] | 6 | * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. |
| 7 | * <benh@kernel.crashing.org> |
| 8 | * |
| 9 | * Based on the arch/ppc version of the driver: |
| 10 | * |
David Gibson | 1d3bb99 | 2007-08-23 13:56:01 +1000 | [diff] [blame] | 11 | * Based on ocp_zmii.h/ibm_emac_zmii.h |
| 12 | * Armin Kuster akuster@mvista.com |
| 13 | * |
| 14 | * Copyright 2004 MontaVista Software, Inc. |
| 15 | * Matt Porter <mporter@kernel.crashing.org> |
| 16 | * |
| 17 | * Copyright (c) 2004, 2005 Zultys Technologies. |
| 18 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> |
| 19 | * |
| 20 | * This program is free software; you can redistribute it and/or modify it |
| 21 | * under the terms of the GNU General Public License as published by the |
| 22 | * Free Software Foundation; either version 2 of the License, or (at your |
| 23 | * option) any later version. |
| 24 | */ |
| 25 | |
| 26 | #ifndef __IBM_NEWEMAC_RGMII_H |
| 27 | #define __IBM_NEWEMAC_RGMII_H |
| 28 | |
| 29 | /* RGMII bridge type */ |
| 30 | #define RGMII_STANDARD 0 |
| 31 | #define RGMII_AXON 1 |
| 32 | |
| 33 | /* RGMII bridge */ |
| 34 | struct rgmii_regs { |
| 35 | u32 fer; /* Function enable register */ |
| 36 | u32 ssr; /* Speed select register */ |
| 37 | }; |
| 38 | |
| 39 | /* RGMII device */ |
| 40 | struct rgmii_instance { |
| 41 | struct rgmii_regs __iomem *base; |
| 42 | |
Benjamin Herrenschmidt | 1f57877 | 2007-12-05 11:14:28 +1100 | [diff] [blame] | 43 | /* RGMII bridge flags */ |
| 44 | int flags; |
| 45 | #define EMAC_RGMII_FLAG_HAS_MDIO 0x00000001 |
David Gibson | 1d3bb99 | 2007-08-23 13:56:01 +1000 | [diff] [blame] | 46 | |
| 47 | /* Only one EMAC whacks us at a time */ |
| 48 | struct mutex lock; |
| 49 | |
| 50 | /* number of EMACs using this RGMII bridge */ |
| 51 | int users; |
| 52 | |
| 53 | /* OF device instance */ |
Grant Likely | 2dc1158 | 2010-08-06 09:25:50 -0600 | [diff] [blame] | 54 | struct platform_device *ofdev; |
David Gibson | 1d3bb99 | 2007-08-23 13:56:01 +1000 | [diff] [blame] | 55 | }; |
| 56 | |
Tony Breeds | 3b3bceef | 2011-08-18 21:33:49 -0700 | [diff] [blame] | 57 | #ifdef CONFIG_IBM_EMAC_RGMII |
David Gibson | 1d3bb99 | 2007-08-23 13:56:01 +1000 | [diff] [blame] | 58 | |
Joe Perches | d4cb2ee | 2013-09-23 11:37:59 -0700 | [diff] [blame] | 59 | int rgmii_init(void); |
| 60 | void rgmii_exit(void); |
| 61 | int rgmii_attach(struct platform_device *ofdev, int input, int mode); |
| 62 | void rgmii_detach(struct platform_device *ofdev, int input); |
| 63 | void rgmii_get_mdio(struct platform_device *ofdev, int input); |
| 64 | void rgmii_put_mdio(struct platform_device *ofdev, int input); |
| 65 | void rgmii_set_speed(struct platform_device *ofdev, int input, int speed); |
| 66 | int rgmii_get_regs_len(struct platform_device *ofdev); |
| 67 | void *rgmii_dump_regs(struct platform_device *ofdev, void *buf); |
David Gibson | 1d3bb99 | 2007-08-23 13:56:01 +1000 | [diff] [blame] | 68 | |
| 69 | #else |
| 70 | |
| 71 | # define rgmii_init() 0 |
| 72 | # define rgmii_exit() do { } while(0) |
| 73 | # define rgmii_attach(x,y,z) (-ENXIO) |
| 74 | # define rgmii_detach(x,y) do { } while(0) |
| 75 | # define rgmii_get_mdio(o,i) do { } while (0) |
| 76 | # define rgmii_put_mdio(o,i) do { } while (0) |
| 77 | # define rgmii_set_speed(x,y,z) do { } while(0) |
| 78 | # define rgmii_get_regs_len(x) 0 |
| 79 | # define rgmii_dump_regs(x,buf) (buf) |
Tony Breeds | 3b3bceef | 2011-08-18 21:33:49 -0700 | [diff] [blame] | 80 | #endif /* !CONFIG_IBM_EMAC_RGMII */ |
David Gibson | 1d3bb99 | 2007-08-23 13:56:01 +1000 | [diff] [blame] | 81 | |
| 82 | #endif /* __IBM_NEWEMAC_RGMII_H */ |