Merge branch 'acpica' into release
[firefly-linux-kernel-4.4.55.git] / include / linux / cs5535.h
index 39e93e8ed95d98d36102a87a7781f35985d2935e..d5a1d4810b800bbf8164f0aad8ff48a39aeecbb4 100644 (file)
 #define _CS5535_H
 
 /* MSRs */
+#define MSR_GLIU_P2D_RO0       0x10000029
+
+#define MSR_LX_GLD_MSR_CONFIG  0x48002001
+#define MSR_LX_MSR_PADSEL      0x48002011      /* NOT 0x48000011; the data
+                                                * sheet has the wrong value */
+#define MSR_GLCP_SYS_RSTPLL    0x4C000014
+#define MSR_GLCP_DOTPLL                0x4C000015
+
 #define MSR_LBAR_SMB           0x5140000B
 #define MSR_LBAR_GPIO          0x5140000C
 #define MSR_LBAR_MFGPT         0x5140000D
 #define MSR_MFGPT_NR           0x51400029
 #define MSR_MFGPT_SETUP                0x5140002B
 
+#define MSR_LX_SPARE_MSR       0x80000011      /* DC-specific */
+
+#define MSR_GX_GLD_MSR_CONFIG  0xC0002001
+#define MSR_GX_MSR_PADSEL      0xC0002011
+
 /* resource sizes */
 #define LBAR_GPIO_SIZE         0xFF
 #define LBAR_MFGPT_SIZE                0x40
 #define LBAR_ACPI_SIZE         0x40
 #define LBAR_PMS_SIZE          0x80
 
+/* VSA2 magic values */
+#define VSA_VRC_INDEX          0xAC1C
+#define VSA_VRC_DATA           0xAC1E
+#define VSA_VR_UNLOCK          0xFC53  /* unlock virtual register */
+#define VSA_VR_SIGNATURE       0x0003
+#define VSA_VR_MEM_SIZE                0x0200
+#define AMD_VSA_SIG            0x4132  /* signature is ascii 'VSA2' */
+#define GSW_VSA_SIG            0x534d  /* General Software signature */
+
+#include <linux/io.h>
+
+static inline int cs5535_has_vsa2(void)
+{
+       static int has_vsa2 = -1;
+
+       if (has_vsa2 == -1) {
+               uint16_t val;
+
+               /*
+                * The VSA has virtual registers that we can query for a
+                * signature.
+                */
+               outw(VSA_VR_UNLOCK, VSA_VRC_INDEX);
+               outw(VSA_VR_SIGNATURE, VSA_VRC_INDEX);
+
+               val = inw(VSA_VRC_DATA);
+               has_vsa2 = (val == AMD_VSA_SIG || val == GSW_VSA_SIG);
+       }
+
+       return has_vsa2;
+}
+
 /* GPIOs */
 #define GPIO_OUTPUT_VAL                0x00
 #define GPIO_OUTPUT_ENABLE     0x04