| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* 10G controller driver for Samsung SoCs |
|---|
| 2 | 3 | * |
|---|
| 3 | 4 | * Copyright (C) 2013 Samsung Electronics Co., Ltd. |
|---|
| 4 | 5 | * http://www.samsung.com |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Author: Siva Reddy Kallam <siva.kallam@samsung.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 version 2 as |
|---|
| 10 | | - * published by the Free Software Foundation. |
|---|
| 11 | 8 | */ |
|---|
| 12 | 9 | |
|---|
| 13 | 10 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
|---|
| .. | .. |
|---|
| 33 | 30 | { |
|---|
| 34 | 31 | struct device_node *np = pdev->dev.of_node; |
|---|
| 35 | 32 | struct sxgbe_dma_cfg *dma_cfg; |
|---|
| 33 | + int err; |
|---|
| 36 | 34 | |
|---|
| 37 | 35 | if (!np) |
|---|
| 38 | 36 | return -ENODEV; |
|---|
| 39 | 37 | |
|---|
| 40 | 38 | *mac = of_get_mac_address(np); |
|---|
| 41 | | - plat->interface = of_get_phy_mode(np); |
|---|
| 39 | + err = of_get_phy_mode(np, &plat->interface); |
|---|
| 40 | + if (err && err != -ENODEV) |
|---|
| 41 | + return err; |
|---|
| 42 | 42 | |
|---|
| 43 | 43 | plat->bus_id = of_alias_get_id(np, "ethernet"); |
|---|
| 44 | 44 | if (plat->bus_id < 0) |
|---|
| .. | .. |
|---|
| 81 | 81 | { |
|---|
| 82 | 82 | int ret; |
|---|
| 83 | 83 | int i, chan; |
|---|
| 84 | | - struct resource *res; |
|---|
| 85 | 84 | struct device *dev = &pdev->dev; |
|---|
| 86 | 85 | void __iomem *addr; |
|---|
| 87 | 86 | struct sxgbe_priv_data *priv = NULL; |
|---|
| .. | .. |
|---|
| 91 | 90 | struct device_node *node = dev->of_node; |
|---|
| 92 | 91 | |
|---|
| 93 | 92 | /* Get memory resource */ |
|---|
| 94 | | - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
|---|
| 95 | | - addr = devm_ioremap_resource(dev, res); |
|---|
| 93 | + addr = devm_platform_ioremap_resource(pdev, 0); |
|---|
| 96 | 94 | if (IS_ERR(addr)) |
|---|
| 97 | 95 | return PTR_ERR(addr); |
|---|
| 98 | 96 | |
|---|
| .. | .. |
|---|
| 124 | 122 | } |
|---|
| 125 | 123 | |
|---|
| 126 | 124 | /* Get MAC address if available (DT) */ |
|---|
| 127 | | - if (mac) |
|---|
| 125 | + if (!IS_ERR_OR_NULL(mac)) |
|---|
| 128 | 126 | ether_addr_copy(priv->dev->dev_addr, mac); |
|---|
| 129 | 127 | |
|---|
| 130 | 128 | /* Get the TX/RX IRQ numbers */ |
|---|