Add PNP functions
This commit is contained in:
parent
da60fc9080
commit
75e0a0b3f9
6
src/board/system76/galp3-c/include/board/pnp.h
Normal file
6
src/board/system76/galp3-c/include/board/pnp.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef _BOARD_PNP_H
|
||||
#define _BOARD_PNP_H
|
||||
|
||||
void pnp_enable(void);
|
||||
|
||||
#endif // _BOARD_PNP_H
|
43
src/board/system76/galp3-c/pnp.c
Normal file
43
src/board/system76/galp3-c/pnp.c
Normal file
@ -0,0 +1,43 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include <common/debug.h>
|
||||
|
||||
volatile uint8_t __xdata __at(0x1200) IHIOA;
|
||||
volatile uint8_t __xdata __at(0x1201) IHD;
|
||||
volatile uint8_t __xdata __at(0x1204) IBMAE;
|
||||
volatile uint8_t __xdata __at(0x1205) IBCTL;
|
||||
void e2ci_write(uint8_t port, uint8_t data) {
|
||||
while (IBCTL & ((1 << 2) | (1 << 1))) {}
|
||||
IHIOA = port;
|
||||
IHD = data;
|
||||
IBMAE = 1;
|
||||
IBCTL = 1;
|
||||
while (IBCTL & (1 << 2)) {}
|
||||
IBMAE = 0;
|
||||
IBCTL = 0;
|
||||
}
|
||||
|
||||
void pnp_write(uint8_t reg, uint8_t data) {
|
||||
e2ci_write(0x2E, reg);
|
||||
e2ci_write(0x2F, data);
|
||||
}
|
||||
|
||||
void pnp_enable() {
|
||||
DEBUG("Enable PNP devices\n");
|
||||
|
||||
// Enable PMC
|
||||
pnp_write(0x07, 0x11);
|
||||
pnp_write(0x30, 0x01);
|
||||
|
||||
// Enable KBC keyboard
|
||||
pnp_write(0x07, 0x06);
|
||||
pnp_write(0x30, 0x01);
|
||||
|
||||
// Enable KBC mouse
|
||||
pnp_write(0x07, 0x05);
|
||||
pnp_write(0x30, 0x01);
|
||||
|
||||
// Enable SWUC
|
||||
pnp_write(0x07, 0x04);
|
||||
pnp_write(0x30, 0x01);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user