| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /** |
|---|
| 2 | 3 | * emac-rockchip.c - Rockchip EMAC specific glue layer |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2014 Romain Perier <romain.perier@gmail.com> |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 8 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | | - * (at your option) any later version. |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | | - * GNU General Public License for more details. |
|---|
| 15 | 6 | */ |
|---|
| 16 | 7 | |
|---|
| 17 | 8 | #include <linux/etherdevice.h> |
|---|
| .. | .. |
|---|
| 25 | 16 | #include "emac.h" |
|---|
| 26 | 17 | |
|---|
| 27 | 18 | #define DRV_NAME "rockchip_emac" |
|---|
| 28 | | -#define DRV_VERSION "1.1" |
|---|
| 29 | 19 | |
|---|
| 30 | 20 | struct emac_rockchip_soc_data { |
|---|
| 31 | 21 | unsigned int grf_offset; |
|---|
| .. | .. |
|---|
| 106 | 96 | struct net_device *ndev; |
|---|
| 107 | 97 | struct rockchip_priv_data *priv; |
|---|
| 108 | 98 | const struct of_device_id *match; |
|---|
| 99 | + phy_interface_t interface; |
|---|
| 109 | 100 | u32 data; |
|---|
| 110 | | - int err, interface; |
|---|
| 101 | + int err; |
|---|
| 111 | 102 | |
|---|
| 112 | 103 | if (!pdev->dev.of_node) |
|---|
| 113 | 104 | return -ENODEV; |
|---|
| .. | .. |
|---|
| 120 | 111 | |
|---|
| 121 | 112 | priv = netdev_priv(ndev); |
|---|
| 122 | 113 | priv->emac.drv_name = DRV_NAME; |
|---|
| 123 | | - priv->emac.drv_version = DRV_VERSION; |
|---|
| 124 | 114 | priv->emac.set_mac_speed = emac_rockchip_set_mac_speed; |
|---|
| 125 | 115 | |
|---|
| 126 | | - interface = of_get_phy_mode(dev->of_node); |
|---|
| 116 | + err = of_get_phy_mode(dev->of_node, &interface); |
|---|
| 117 | + if (err) |
|---|
| 118 | + goto out_netdev; |
|---|
| 127 | 119 | |
|---|
| 128 | 120 | /* RK3036/RK3066/RK3188 SoCs only support RMII */ |
|---|
| 129 | 121 | if (interface != PHY_INTERFACE_MODE_RMII) { |
|---|