source: rtems-libbsd/rtemsbsd/powerpc/include/linux/phy.h @ cd089b9

55-freebsd-126-freebsd-12
Last change on this file since cd089b9 was cd089b9, checked in by Sebastian Huber <sebastian.huber@…>, on 05/05/17 at 06:47:39

Linux update to 4.11-rc5

Linux baseline a71c9a1c779f2499fb2afc0553e543f18aff6edf (4.11-rc5).

  • Property mode set to 100644
File size: 3.5 KB
Line 
1/*
2 * Copyright (c) 2015, 2017 embedded brains GmbH
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
18 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
20 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#ifndef _LINUX_PHY_H
28#define _LINUX_PHY_H
29
30#include <sys/queue.h>
31#include <linux/device.h>
32#include <linux/list.h>
33#include <linux/netdevice.h>
34
35#ifdef __cplusplus
36extern "C" {
37#endif /* __cplusplus */
38
39typedef enum {
40        PHY_INTERFACE_MODE_NA,
41        PHY_INTERFACE_MODE_MII,
42        PHY_INTERFACE_MODE_GMII,
43        PHY_INTERFACE_MODE_SGMII,
44        PHY_INTERFACE_MODE_TBI,
45        PHY_INTERFACE_MODE_REVMII,
46        PHY_INTERFACE_MODE_RMII,
47        PHY_INTERFACE_MODE_RGMII,
48        PHY_INTERFACE_MODE_RGMII_ID,
49        PHY_INTERFACE_MODE_RGMII_RXID,
50        PHY_INTERFACE_MODE_RGMII_TXID,
51        PHY_INTERFACE_MODE_RTBI,
52        PHY_INTERFACE_MODE_SMII,
53        PHY_INTERFACE_MODE_XGMII,
54        PHY_INTERFACE_MODE_MOCA,
55        PHY_INTERFACE_MODE_QSGMII,
56        PHY_INTERFACE_MODE_MAX
57} phy_interface_t;
58
59#define SPEED_10 10
60#define SPEED_100 100
61#define SPEED_1000 1000
62#define SPEED_2500 2500
63#define SPEED_5000 5000
64#define SPEED_10000 10000
65#define SPEED_20000 20000
66#define SPEED_25000 25000
67#define SPEED_40000 40000
68#define SPEED_50000 50000
69#define SPEED_56000 56000
70#define SPEED_100000 100000
71
72#define SUPPORTED_10000baseT_Full       (1U << 0)
73#define SUPPORTED_1000baseT_Full        (1U << 1)
74#define SUPPORTED_100baseT_Full         (1U << 2)
75#define SUPPORTED_100baseT_Half         (1U << 3)
76#define SUPPORTED_10baseT_Full          (1U << 4)
77#define SUPPORTED_10baseT_Half          (1U << 5)
78#define SUPPORTED_Asym_Pause            (1U << 6)
79#define SUPPORTED_Autoneg               (1U << 7)
80#define SUPPORTED_MII                   (1U << 8)
81#define SUPPORTED_Pause                 (1U << 9)
82
83struct mdio_bus {
84        int (*read)(struct mdio_bus *bus, int phy, int reg);
85        int (*write)(struct mdio_bus *bus, int phy, int reg, int val);
86        SLIST_ENTRY(mdio_bus) next;
87        int node;
88};
89
90struct phy_device {
91        struct {
92                struct device dev;
93                int addr;
94                struct mdio_bus *bus;
95        } mdio;
96};
97
98static inline int
99phy_read(struct phy_device *phy_dev, int reg)
100{
101        struct mdio_bus *mdio_dev;
102
103        mdio_dev = phy_dev->mdio.bus;
104        return ((*mdio_dev->read)(mdio_dev, phy_dev->mdio.addr, (int)reg));
105}
106
107static inline int
108phy_write(struct phy_device *phy_dev, int reg, int val)
109{
110        struct mdio_bus *mdio_dev;
111
112        mdio_dev = phy_dev->mdio.bus;
113        return ((*mdio_dev->write)(mdio_dev, phy_dev->mdio.addr, reg, val));
114}
115
116#ifdef __cplusplus
117}
118#endif /* __cplusplus */
119
120#endif /* _LINUX_PHY_H */
Note: See TracBrowser for help on using the repository browser.