[PATCH 3/3] arch/x86/pci/sta2x11-fixup.c: reset and enable STA2X11MediaLB clock
From: Giancarlo Asnaghi
Date: Mon Jun 10 2013 - 08:53:10 EST
The MediaLB peripheral, devoted to the MOST protocol, must be reset
using chipset registers, so this code is not part of the MLB PCI
driver.
Signed-off-by: Giancarlo Asnaghi <giancarlo.asnaghi@xxxxxx>
Signed-off-by: Federico Vaga <federico.vaga@xxxxxxxxx>
---
arch/x86/pci/sta2x11-fixup.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/arch/x86/pci/sta2x11-fixup.c b/arch/x86/pci/sta2x11-fixup.c
index 9d8a509..3eae9ab 100644
--- a/arch/x86/pci/sta2x11-fixup.c
+++ b/arch/x86/pci/sta2x11-fixup.c
@@ -26,6 +26,9 @@
#include <linux/pci_ids.h>
#include <linux/export.h>
#include <linux/list.h>
+#include <linux/delay.h>
+#include <linux/mfd/sta2x11-mfd.h>
+#include <asm/sta2x11.h>
#define STA2X11_SWIOTLB_SIZE (4*1024*1024)
extern int swiotlb_late_init_with_default_size(size_t default_size);
@@ -212,6 +215,20 @@ static void sta2x11_setup_pdev(struct pci_dev *pdev)
}
DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_STMICRO, PCI_ANY_ID, sta2x11_setup_pdev);
+static void sta2x11_most_enable(struct pci_dev *pdev)
+{
+ /* trying to reset the MLB */
+ sta2x11_apbreg_mask(pdev, APBREG_PCG, APBREG_MLB, 0);
+ sta2x11_apbreg_mask(pdev, APBREG_PUR, APBREG_MLB, 0);
+ msleep_interruptible(100);
+
+ /* Config clock and release device from reset */
+ sta2x11_apbreg_mask(pdev, APBREG_PCG, APBREG_MLB, APBREG_MLB);
+ sta2x11_apbreg_mask(pdev, APBREG_PUR, APBREG_MLB, APBREG_MLB);
+ msleep_interruptible(100);
+}
+DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_STMICRO, 0xcc12, sta2x11_most_enable);
+
/*
* The following three functions are exported (used in swiotlb: FIXME)
*/
--
1.7.7.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/