ref: 05f9a66fd4ea4a3744847d354bda9a1f4aefcdbc
parent: 8630bd35a636a463bcf7211aaa0f014600013463
author: cinap_lenrek <[email protected]>
date: Sun Jul 28 07:39:57 EDT 2019
bcm, bcm64: add vcore support for raspberry pi 3 GPIO expander
--- a/sys/src/9/bcm/fns.h
+++ b/sys/src/9/bcm/fns.h
@@ -32,6 +32,7 @@
extern void dmastart(int, int, int, void*, void*, int);
extern int dmawait(int);
extern uintptr dmaaddr(void *va);
+extern void egpset(uint, int);
extern int fbblank(int);
extern void* fbinit(int, int*, int*, int*);
extern u32int farget(void);
--- a/sys/src/9/bcm/vcore.c
+++ b/sys/src/9/bcm/vcore.c
@@ -40,9 +40,18 @@
TagGetpower = 0x00020001,
TagSetpower = 0x00028001,
Powerwait = 1<<1,
- TagGetclkspd= 0x00030002,
- TagGetclkmax= 0x00030004,
- TagSetclkspd= 0x00038002,
+ TagGetclkstate = 0x00030001,
+ TagGetclkspd = 0x00030002,
+ TagGetclkmax = 0x00030004,
+ TagSetclkstate = 0x00038001,
+ TagSetclkspd = 0x00038002,
+
+ TagGetEgpioState= 0x00030041,
+ TagSetEgpioState= 0x00038041,
+ TagSetSdhostClk = 0x00038042,
+ TagGetEgpioConf = 0x00030043,
+ TagSetEgpioConf = 0x00038043,
+
TagGettemp = 0x00030006,
TagFballoc = 0x00040001,
TagFbfree = 0x00048001,
@@ -387,4 +396,19 @@
vgpio.decs++;
vgpio.counts[port] = (vgpio.incs << 16) | vgpio.decs;
vgpio.ison = on;
+}
+
+/*
+ * Raspberry Pi GPIO expander (Pi 3 and 4)
+ */
+void
+egpset(uint port, int on)
+{
+ u32int buf[2];
+
+ if(port >= 8)
+ return;
+ buf[0] = 128 + port;
+ buf[1] = on;
+ vcreq(TagSetEgpioState, buf, sizeof(buf), sizeof(buf));
}
--- a/sys/src/9/bcm64/fns.h
+++ b/sys/src/9/bcm64/fns.h
@@ -164,6 +164,7 @@
extern uint getcputemp(void);
extern void vgpinit(void);
extern void vgpset(uint port, int on);
+extern void egpset(uint port, int on);
/* bootargs */
extern void bootargsinit(uintptr);