-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'vfio-v4.2-rc1' of git://github.com/awilliam/linux-vfio
Pull VFIO updates from Alex Williamson: - fix race with device reference versus driver release (Alex Williamson) - add reset hooks and Calxeda xgmac reset for vfio-platform (Eric Auger) - enable vfio-platform for ARM64 (Eric Auger) - tag Baptiste Reynal as vfio-platform sub-maintainer (Alex Williamson) * tag 'vfio-v4.2-rc1' of git://github.com/awilliam/linux-vfio: MAINTAINERS: Add vfio-platform sub-maintainer VFIO: platform: enable ARM64 build VFIO: platform: Calxeda xgmac reset module VFIO: platform: populate the reset function on probe VFIO: platform: add reset callback VFIO: platform: add reset struct and lookup table vfio/pci: Fix racy vfio_device_get_from_dev() call
- Loading branch information
Showing
10 changed files
with
201 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
config VFIO_PLATFORM_CALXEDAXGMAC_RESET | ||
tristate "VFIO support for calxeda xgmac reset" | ||
depends on VFIO_PLATFORM | ||
help | ||
Enables the VFIO platform driver to handle reset for Calxeda xgmac | ||
|
||
If you don't know what to do here, say N. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
vfio-platform-calxedaxgmac-y := vfio_platform_calxedaxgmac.o | ||
|
||
ccflags-y += -Idrivers/vfio/platform | ||
|
||
obj-$(CONFIG_VFIO_PLATFORM_CALXEDAXGMAC_RESET) += vfio-platform-calxedaxgmac.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
* VFIO platform driver specialized for Calxeda xgmac reset | ||
* reset code is inherited from calxeda xgmac native driver | ||
* | ||
* Copyright 2010-2011 Calxeda, Inc. | ||
* Copyright (c) 2015 Linaro Ltd. | ||
* www.linaro.org | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms and conditions of the GNU General Public License, | ||
* version 2, as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
* more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with | ||
* this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <linux/module.h> | ||
#include <linux/kernel.h> | ||
#include <linux/init.h> | ||
#include <linux/io.h> | ||
|
||
#include "vfio_platform_private.h" | ||
|
||
#define DRIVER_VERSION "0.1" | ||
#define DRIVER_AUTHOR "Eric Auger <eric.auger@linaro.org>" | ||
#define DRIVER_DESC "Reset support for Calxeda xgmac vfio platform device" | ||
|
||
#define CALXEDAXGMAC_COMPAT "calxeda,hb-xgmac" | ||
|
||
/* XGMAC Register definitions */ | ||
#define XGMAC_CONTROL 0x00000000 /* MAC Configuration */ | ||
|
||
/* DMA Control and Status Registers */ | ||
#define XGMAC_DMA_CONTROL 0x00000f18 /* Ctrl (Operational Mode) */ | ||
#define XGMAC_DMA_INTR_ENA 0x00000f1c /* Interrupt Enable */ | ||
|
||
/* DMA Control registe defines */ | ||
#define DMA_CONTROL_ST 0x00002000 /* Start/Stop Transmission */ | ||
#define DMA_CONTROL_SR 0x00000002 /* Start/Stop Receive */ | ||
|
||
/* Common MAC defines */ | ||
#define MAC_ENABLE_TX 0x00000008 /* Transmitter Enable */ | ||
#define MAC_ENABLE_RX 0x00000004 /* Receiver Enable */ | ||
|
||
static inline void xgmac_mac_disable(void __iomem *ioaddr) | ||
{ | ||
u32 value = readl(ioaddr + XGMAC_DMA_CONTROL); | ||
|
||
value &= ~(DMA_CONTROL_ST | DMA_CONTROL_SR); | ||
writel(value, ioaddr + XGMAC_DMA_CONTROL); | ||
|
||
value = readl(ioaddr + XGMAC_CONTROL); | ||
value &= ~(MAC_ENABLE_TX | MAC_ENABLE_RX); | ||
writel(value, ioaddr + XGMAC_CONTROL); | ||
} | ||
|
||
int vfio_platform_calxedaxgmac_reset(struct vfio_platform_device *vdev) | ||
{ | ||
struct vfio_platform_region reg = vdev->regions[0]; | ||
|
||
if (!reg.ioaddr) { | ||
reg.ioaddr = | ||
ioremap_nocache(reg.addr, reg.size); | ||
if (!reg.ioaddr) | ||
return -ENOMEM; | ||
} | ||
|
||
/* disable IRQ */ | ||
writel(0, reg.ioaddr + XGMAC_DMA_INTR_ENA); | ||
|
||
/* Disable the MAC core */ | ||
xgmac_mac_disable(reg.ioaddr); | ||
|
||
return 0; | ||
} | ||
EXPORT_SYMBOL_GPL(vfio_platform_calxedaxgmac_reset); | ||
|
||
MODULE_VERSION(DRIVER_VERSION); | ||
MODULE_LICENSE("GPL v2"); | ||
MODULE_AUTHOR(DRIVER_AUTHOR); | ||
MODULE_DESCRIPTION(DRIVER_DESC); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters