Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1614951
| From | Zoltan Boszormenyi <zboszor@pr.hu> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 1/3 v2] usb: pci-quirks: Add a common mutex for the I/O port pair of SB800 |
| Date | 2017-04-03 10:00 +0200 |
| Message-ID | <ts545-3XB-7@gated-at.bofh.it> (permalink) |
| References | <ts545-3XB-3@gated-at.bofh.it> <ts545-3XB-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
This patch adds a common mutex in the USB PCI quirks code and starts
using it to synchronize access to the I/O port pair 0xcd6 / 0xcd7 on
SB800.
These I/O ports are also used by i2c-piix4 and sp5100_tco, the next
two patches port these drivers to use this common mutex.
v2: No extra header and no wrapper for mutex_lock() / mutex_unlock()
Signed-off-by: Zoltan Boszormenyi <zboszor@pr.hu>
---
drivers/usb/host/pci-quirks.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index a9a1e4c..1ef0ada 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -279,6 +279,9 @@ bool usb_amd_prefetch_quirk(void)
}
EXPORT_SYMBOL_GPL(usb_amd_prefetch_quirk);
+DEFINE_MUTEX(sb800_mutex);
+EXPORT_SYMBOL_GPL(sb800_mutex);
+
/*
* The hardware normally enables the A-link power management feature, which
* lets the system lower the power consumption in idle states.
@@ -314,11 +317,13 @@ static void usb_amd_quirk_pll(int disable)
if (amd_chipset.sb_type.gen == AMD_CHIPSET_SB800 ||
amd_chipset.sb_type.gen == AMD_CHIPSET_HUDSON2 ||
amd_chipset.sb_type.gen == AMD_CHIPSET_BOLTON) {
+ mutex_lock(&sb800_mutex);
outb_p(AB_REG_BAR_LOW, 0xcd6);
addr_low = inb_p(0xcd7);
outb_p(AB_REG_BAR_HIGH, 0xcd6);
addr_high = inb_p(0xcd7);
addr = addr_high << 8 | addr_low;
+ mutex_unlock(&sb800_mutex);
outl_p(0x30, AB_INDX(addr));
outl_p(0x40, AB_DATA(addr));
--
2.9.3
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/3 v2] Fix regression in the sp5100_tco driver Zoltan Boszormenyi <zboszor@pr.hu> - 2017-04-03 10:00 +0200 [PATCH 1/3 v2] usb: pci-quirks: Add a common mutex for the I/O port pair of SB800 Zoltan Boszormenyi <zboszor@pr.hu> - 2017-04-03 10:00 +0200 [PATCH 3/3 v2] watchdog: sp5100_tco: Use the common mutex Zoltan Boszormenyi <zboszor@pr.hu> - 2017-04-03 10:00 +0200
csiph-web