summaryrefslogtreecommitdiffstats
path: root/sys/arm/versatile/versatile_scm.h
diff options
context:
space:
mode:
authorgonzo <gonzo@FreeBSD.org>2018-03-23 01:37:31 +0000
committergonzo <gonzo@FreeBSD.org>2018-03-23 01:37:31 +0000
commit88f6a775bc28c92868c663894900fa5b9f932d7f (patch)
tree9cdc3703618b99a76734ec251de370aa8ec38f0c /sys/arm/versatile/versatile_scm.h
parentd8cded4e35edc537360da8f1d4530cda39bb464c (diff)
downloadFreeBSD-src-88f6a775bc28c92868c663894900fa5b9f932d7f.zip
FreeBSD-src-88f6a775bc28c92868c663894900fa5b9f932d7f.tar.gz
MFC r316370-r316371
r316370: [versatilepb] Convert VERSATILEPB kernel to INTRNG and switch to upstream DTB Scope of this change is somewhat larger than just converting to INTRNG. The reason for this is that INTRNG support required switching from custom to upstream DTS because custom DTS didn't have interrup routing information. This switch caused rewrite of PCI and CLCD drivers and adding SCM module. List of changes in this commit: - Enable INTRNG and switch to versatile-pb.dts - Add SCM driver that controls various peripheral devices like LCD or PCI controller. Previously registers required for power-up and configuring peripherals were part of their respective nodes. Upstream DTS has dedicated node for SCM - Convert PL190 driver to INTRNG - Convert Versatile SIC (secondary interrupt controller) to INTRNG - Refactor CLCD driver to use SCM API to power up and configuration - Refactor PCI driver to use SCM API to enable controller - Refactor PCI driver to use interrupt map provided in DTS for interrupt routing. As a result it fixes broken IRQ routing and it's no longer required to run QEMU with "-global versatile_pci.broken-irq-mapping=1" command-line arguments r316371: [versatilepb] Fix keyboard driver after switching to upstream DTS FreeBSD's DTS contained only one PL050 node and driver considered it to be PS/2 keyboard. In reality PL050 is a PS/2 port that pushes bytes to/from the periphers connected to it. New DTS contains two nodes and QEMU emulates keyboard connected to port #0 and mouse connected to port #1. Since there is no way to say what's connected to port by checking DTS we hardcode this knowledge in the driver: it assumes keyboard on port #0 and ignores port #1 altogether. Also QEMU defaults emulated keyboard to scan code set 2 while driver used to work with scan code set 1 so when initializing driver make sure keyboard is switched to scan code set 1
Diffstat (limited to 'sys/arm/versatile/versatile_scm.h')
-rw-r--r--sys/arm/versatile/versatile_scm.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/sys/arm/versatile/versatile_scm.h b/sys/arm/versatile/versatile_scm.h
new file mode 100644
index 0000000..a59ad06
--- /dev/null
+++ b/sys/arm/versatile/versatile_scm.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2017 Oleksandr Tymoshenko <gonzo@freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Ben Gray.
+ * 4. The name of the company nor the name of the author may be used to
+ * endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY BEN GRAY ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL BEN GRAY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _VERSATILE_SCM_H_
+#define _VERSATILE_SCM_H_
+
+#define SCM_PCICTL 0x44
+#define SCM_CLCD 0x50
+#define SCM_CLCD_CLCDID_SHIFT 0x08
+#define SCM_CLCD_CLCDID_MASK 0x1f
+#define SCM_CLCD_PWR3V5VSWITCH (1 << 4)
+#define SCM_CLCD_VDDPOSSWITCH (1 << 3)
+#define SCM_CLCD_NLCDIOON (1 << 2)
+#define SCM_CLCD_LCD_MODE_MASK 0x03
+
+int versatile_scm_reg_read_4(uint32_t reg, uint32_t *val);
+int versatile_scm_reg_write_4(uint32_t reg, uint32_t val);
+
+#endif /* _VERSATILE_SCM_H_ */
OpenPOWER on IntegriCloud