bcm, bcm64: add vcore support for raspberry pi 3 GPIO expander

This commit is contained in:
cinap_lenrek 2019-07-28 11:39:57 +02:00
parent 8630bd35a6
commit 05f9a66fd4
3 changed files with 29 additions and 3 deletions

View file

@ -32,6 +32,7 @@ extern void dmaflush(int, void*, ulong);
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);

View file

@ -40,9 +40,18 @@ enum {
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,
@ -388,3 +397,18 @@ vgpset(uint port, int on)
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));
}

View file

@ -164,6 +164,7 @@ extern void setclkrate(int clkid, ulong hz);
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);