| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * VFIO platform driver specialized for AMD xgbe reset |
|---|
| 3 | 4 | * reset code is inherited from AMD xgbe native driver |
|---|
| 4 | 5 | * |
|---|
| 5 | 6 | * Copyright (c) 2015 Linaro Ltd. |
|---|
| 6 | 7 | * www.linaro.org |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 9 | | - * under the terms and conditions of the GNU General Public License, |
|---|
| 10 | | - * version 2, as published by the Free Software Foundation. |
|---|
| 11 | | - * |
|---|
| 12 | | - * This program is distributed in the hope it will be useful, but WITHOUT |
|---|
| 13 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 14 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 15 | | - * more details. |
|---|
| 16 | | - * |
|---|
| 17 | | - * You should have received a copy of the GNU General Public License along with |
|---|
| 18 | | - * this program. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 19 | 8 | */ |
|---|
| 20 | 9 | |
|---|
| 21 | 10 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 25 | 14 | #include <uapi/linux/mdio.h> |
|---|
| 26 | 15 | #include <linux/delay.h> |
|---|
| 27 | 16 | |
|---|
| 28 | | -#include "vfio_platform_private.h" |
|---|
| 17 | +#include "../vfio_platform_private.h" |
|---|
| 29 | 18 | |
|---|
| 30 | 19 | #define DMA_MR 0x3000 |
|---|
| 31 | 20 | #define MAC_VR 0x0110 |
|---|
| .. | .. |
|---|
| 35 | 24 | #define MDIO_AN_INT 0x8002 |
|---|
| 36 | 25 | #define MDIO_AN_INTMASK 0x8001 |
|---|
| 37 | 26 | |
|---|
| 38 | | -static unsigned int xmdio_read(void *ioaddr, unsigned int mmd, |
|---|
| 27 | +static unsigned int xmdio_read(void __iomem *ioaddr, unsigned int mmd, |
|---|
| 39 | 28 | unsigned int reg) |
|---|
| 40 | 29 | { |
|---|
| 41 | 30 | unsigned int mmd_address, value; |
|---|
| .. | .. |
|---|
| 46 | 35 | return value; |
|---|
| 47 | 36 | } |
|---|
| 48 | 37 | |
|---|
| 49 | | -static void xmdio_write(void *ioaddr, unsigned int mmd, |
|---|
| 38 | +static void xmdio_write(void __iomem *ioaddr, unsigned int mmd, |
|---|
| 50 | 39 | unsigned int reg, unsigned int value) |
|---|
| 51 | 40 | { |
|---|
| 52 | 41 | unsigned int mmd_address; |
|---|
| .. | .. |
|---|
| 65 | 54 | |
|---|
| 66 | 55 | if (!xgmac_regs->ioaddr) { |
|---|
| 67 | 56 | xgmac_regs->ioaddr = |
|---|
| 68 | | - ioremap_nocache(xgmac_regs->addr, xgmac_regs->size); |
|---|
| 57 | + ioremap(xgmac_regs->addr, xgmac_regs->size); |
|---|
| 69 | 58 | if (!xgmac_regs->ioaddr) |
|---|
| 70 | 59 | return -ENOMEM; |
|---|
| 71 | 60 | } |
|---|
| 72 | 61 | if (!xpcs_regs->ioaddr) { |
|---|
| 73 | 62 | xpcs_regs->ioaddr = |
|---|
| 74 | | - ioremap_nocache(xpcs_regs->addr, xpcs_regs->size); |
|---|
| 63 | + ioremap(xpcs_regs->addr, xpcs_regs->size); |
|---|
| 75 | 64 | if (!xpcs_regs->ioaddr) |
|---|
| 76 | 65 | return -ENOMEM; |
|---|
| 77 | 66 | } |
|---|
| .. | .. |
|---|
| 89 | 78 | } while ((pcs_value & MDIO_CTRL1_RESET) && --count); |
|---|
| 90 | 79 | |
|---|
| 91 | 80 | if (pcs_value & MDIO_CTRL1_RESET) |
|---|
| 92 | | - pr_warn("%s XGBE PHY reset timeout\n", __func__); |
|---|
| 81 | + dev_warn(vdev->device, "%s: XGBE PHY reset timeout\n", |
|---|
| 82 | + __func__); |
|---|
| 93 | 83 | |
|---|
| 94 | 84 | /* disable auto-negotiation */ |
|---|
| 95 | 85 | value = xmdio_read(xpcs_regs->ioaddr, MDIO_MMD_AN, MDIO_CTRL1); |
|---|
| .. | .. |
|---|
| 114 | 104 | usleep_range(500, 600); |
|---|
| 115 | 105 | |
|---|
| 116 | 106 | if (!count) |
|---|
| 117 | | - pr_warn("%s MAC SW reset failed\n", __func__); |
|---|
| 107 | + dev_warn(vdev->device, "%s: MAC SW reset failed\n", __func__); |
|---|
| 118 | 108 | |
|---|
| 119 | 109 | return 0; |
|---|
| 120 | 110 | } |
|---|