|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] xen/arm: introduce vexpress_syscfg
# HG changeset patch
# User Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
# Date 1360935139 0
# Node ID d030eb79a811360e1f1d0ee788bc47227c71b400
# Parent eff908f314224f9617d9fdcc57b166c29c44f78d
xen/arm: introduce vexpress_syscfg
Introduce a Versatile Express specific function to read/write
motherboard settings.
Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Committed-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
diff -r eff908f31422 -r d030eb79a811 xen/arch/arm/Makefile
--- a/xen/arch/arm/Makefile Fri Feb 15 13:32:18 2013 +0000
+++ b/xen/arch/arm/Makefile Fri Feb 15 13:32:19 2013 +0000
@@ -1,4 +1,5 @@
subdir-$(arm32) += arm32
+subdir-y += platforms
obj-y += early_printk.o
obj-y += domain.o
diff -r eff908f31422 -r d030eb79a811 xen/arch/arm/arm32/mode_switch.S
--- a/xen/arch/arm/arm32/mode_switch.S Fri Feb 15 13:32:18 2013 +0000
+++ b/xen/arch/arm/arm32/mode_switch.S Fri Feb 15 13:32:19 2013 +0000
@@ -19,7 +19,7 @@
#include <asm/config.h>
#include <asm/page.h>
-#include <asm/platform_vexpress.h>
+#include <asm/platforms/vexpress.h>
#include <asm/asm_defns.h>
#include <asm/gic.h>
diff -r eff908f31422 -r d030eb79a811 xen/arch/arm/platforms/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/platforms/Makefile Fri Feb 15 13:32:19 2013 +0000
@@ -0,0 +1,1 @@
+obj-y += vexpress.o
diff -r eff908f31422 -r d030eb79a811 xen/arch/arm/platforms/vexpress.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/platforms/vexpress.c Fri Feb 15 13:32:19 2013 +0000
@@ -0,0 +1,100 @@
+/*
+ * xen/arch/arm/platform_vexpress.c
+ *
+ * Versatile Express specific settings
+ *
+ * Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
+ * Copyright (c) 2013 Citrix Systems.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that 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.
+ */
+
+#include <asm/platforms/vexpress.h>
+#include <xen/mm.h>
+
+#define DCC_SHIFT 26
+#define FUNCTION_SHIFT 20
+#define SITE_SHIFT 16
+#define POSITION_SHIFT 12
+#define DEVICE_SHIFT 0
+
+static inline int vexpress_ctrl_start(uint32_t *syscfg, int write,
+ int function, int device)
+{
+ int dcc = 0; /* DCC to access */
+ int site = 0; /* motherboard */
+ int position = 0; /* daughterboard */
+ uint32_t stat;
+
+ /* set control register */
+ syscfg[V2M_SYS_CFGCTRL/4] = V2M_SYS_CFG_START |
+ (write ? V2M_SYS_CFG_WRITE : 0) |
+ (dcc << DCC_SHIFT) | (function << FUNCTION_SHIFT) |
+ (site << SITE_SHIFT) | (position << POSITION_SHIFT) |
+ (device << DEVICE_SHIFT);
+
+ /* wait for complete flag to be set */
+ do {
+ stat = syscfg[V2M_SYS_CFGSTAT/4];
+ dsb();
+ } while ( !(stat & V2M_SYS_CFG_COMPLETE) );
+
+ /* check error status and return error flag if set */
+ if ( stat & V2M_SYS_CFG_ERROR )
+ {
+ printk(KERN_ERR "V2M SYS_CFGSTAT reported a configuration error\n");
+ return -1;
+ }
+ return 0;
+}
+
+int vexpress_syscfg(int write, int function, int device, uint32_t *data)
+{
+ uint32_t *syscfg = (uint32_t *) FIXMAP_ADDR(FIXMAP_MISC);
+ int ret = -1;
+
+ set_fixmap(FIXMAP_MISC, V2M_SYS_MMIO_BASE >> PAGE_SHIFT, DEV_SHARED);
+
+ if ( syscfg[V2M_SYS_CFGCTRL/4] & V2M_SYS_CFG_START )
+ goto out;
+
+ /* clear the complete bit in the V2M_SYS_CFGSTAT status register */
+ syscfg[V2M_SYS_CFGSTAT/4] = 0;
+
+ if ( write )
+ {
+ /* write data */
+ syscfg[V2M_SYS_CFGDATA/4] = *data;
+
+ if ( vexpress_ctrl_start(syscfg, write, function, device) < 0 )
+ goto out;
+ } else {
+ if ( vexpress_ctrl_start(syscfg, write, function, device) < 0 )
+ goto out;
+ else
+ /* read data */
+ *data = syscfg[V2M_SYS_CFGDATA/4];
+ }
+
+ ret = 0;
+out:
+ clear_fixmap(FIXMAP_MISC);
+ return ret;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r eff908f31422 -r d030eb79a811 xen/include/asm-arm/platform_vexpress.h
--- a/xen/include/asm-arm/platform_vexpress.h Fri Feb 15 13:32:18 2013 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-#ifndef __ASM_ARM_PLATFORM_H
-#define __ASM_ARM_PLATFORM_H
-
-/* V2M */
-#define V2M_SYS_MMIO_BASE (0x1c010000)
-#define V2M_SYS_FLAGSSET (0x30)
-#define V2M_SYS_FLAGSCLR (0x34)
-
-#endif /* __ASM_ARM_PLATFORM_H */
-/*
- * Local variables:
- * mode: C
- * c-set-style: "BSD"
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- */
diff -r eff908f31422 -r d030eb79a811 xen/include/asm-arm/platforms/vexpress.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/platforms/vexpress.h Fri Feb 15 13:32:19 2013 +0000
@@ -0,0 +1,40 @@
+#ifndef __ASM_ARM_PLATFORMS_VEXPRESS_H
+#define __ASM_ARM_PLATFORMS_VEXPRESS_H
+
+/* V2M */
+#define V2M_SYS_MMIO_BASE (0x1c010000)
+#define V2M_SYS_FLAGSSET (0x30)
+#define V2M_SYS_FLAGSCLR (0x34)
+
+#define V2M_SYS_CFGDATA (0x00A0)
+#define V2M_SYS_CFGCTRL (0x00A4)
+#define V2M_SYS_CFGSTAT (0x00A8)
+
+#define V2M_SYS_CFG_START (1<<31)
+#define V2M_SYS_CFG_WRITE (1<<30)
+#define V2M_SYS_CFG_ERROR (1<<1)
+#define V2M_SYS_CFG_COMPLETE (1<<0)
+
+#define V2M_SYS_CFG_OSC_FUNC 1
+#define V2M_SYS_CFG_OSC0 0
+#define V2M_SYS_CFG_OSC1 1
+#define V2M_SYS_CFG_OSC2 2
+#define V2M_SYS_CFG_OSC3 3
+#define V2M_SYS_CFG_OSC4 4
+#define V2M_SYS_CFG_OSC5 5
+
+#ifndef __ASSEMBLY__
+#include <xen/inttypes.h>
+
+int vexpress_syscfg(int write, int function, int device, uint32_t *data);
+#endif
+
+#endif /* __ASM_ARM_PLATFORMS_VEXPRESS_H */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |