| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /** |
|---|
| 2 | | - * emac_arc.c - ARC EMAC specific glue layer |
|---|
| 3 | + * DOC: emac_arc.c - ARC EMAC specific glue layer |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2014 Romain Perier |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Romain Perier <romain.perier@gmail.com> |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 9 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 10 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 11 | | - * (at your option) any later version. |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 14 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 16 | | - * GNU General Public License for more details. |
|---|
| 17 | 8 | */ |
|---|
| 18 | 9 | |
|---|
| 19 | 10 | #include <linux/etherdevice.h> |
|---|
| .. | .. |
|---|
| 24 | 15 | #include "emac.h" |
|---|
| 25 | 16 | |
|---|
| 26 | 17 | #define DRV_NAME "emac_arc" |
|---|
| 27 | | -#define DRV_VERSION "1.0" |
|---|
| 28 | 18 | |
|---|
| 29 | 19 | static int emac_arc_probe(struct platform_device *pdev) |
|---|
| 30 | 20 | { |
|---|
| 31 | 21 | struct device *dev = &pdev->dev; |
|---|
| 32 | | - struct net_device *ndev; |
|---|
| 33 | 22 | struct arc_emac_priv *priv; |
|---|
| 34 | | - int interface, err; |
|---|
| 23 | + phy_interface_t interface; |
|---|
| 24 | + struct net_device *ndev; |
|---|
| 25 | + int err; |
|---|
| 35 | 26 | |
|---|
| 36 | 27 | if (!dev->of_node) |
|---|
| 37 | 28 | return -ENODEV; |
|---|
| .. | .. |
|---|
| 44 | 35 | |
|---|
| 45 | 36 | priv = netdev_priv(ndev); |
|---|
| 46 | 37 | priv->drv_name = DRV_NAME; |
|---|
| 47 | | - priv->drv_version = DRV_VERSION; |
|---|
| 48 | 38 | |
|---|
| 49 | | - interface = of_get_phy_mode(dev->of_node); |
|---|
| 50 | | - if (interface < 0) |
|---|
| 51 | | - interface = PHY_INTERFACE_MODE_MII; |
|---|
| 39 | + err = of_get_phy_mode(dev->of_node, &interface); |
|---|
| 40 | + if (err) { |
|---|
| 41 | + if (err == -ENODEV) |
|---|
| 42 | + interface = PHY_INTERFACE_MODE_MII; |
|---|
| 43 | + else |
|---|
| 44 | + goto out_netdev; |
|---|
| 45 | + } |
|---|
| 52 | 46 | |
|---|
| 53 | 47 | priv->clk = devm_clk_get(dev, "hclk"); |
|---|
| 54 | 48 | if (IS_ERR(priv->clk)) { |
|---|