imx8: add iomuxpad() helper for pad and mux control

This commit is contained in:
cinap_lenrek 2022-06-13 19:06:00 +00:00
parent d35e41424c
commit 90428d0561
5 changed files with 1139 additions and 22 deletions

View file

@ -150,3 +150,6 @@ extern void powerup(char *dom);
/* lcd */
extern void lcdinit(void);
/* iomuc */
extern void iomuxpad(char *pads, char *sel, char *cfg);

1125
sys/src/9/imx8/iomux.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -16,12 +16,6 @@ extern Memimage *gscreen;
/* pinmux registers */
enum {
IOMUXC_CTL_PAD_SAI5_RXC = 0x144/4, /* for gpio3 20 */
IOMUXC_CTL_PAD_SPDIF_RX = 0x1EC/4, /* for pwm2 */
IOMUXC_CTL_PAD_GPIO1_IO10 = 0x50/4, /* for gpio1 10 */
SION = 1<<4,
MUX_MODE = 7,
IOMUXC_GPR_GPR13 = 0x10034/4, /* GPR13 for MIPI_MUX_SEL */
MIPI_MUX_SEL = 1<<2,
MIPI_MUX_INV = 1<<3,
@ -825,13 +819,15 @@ lcdinit(void)
I2Cdev *bridge;
char *err;
/* gpio3 20 for sn65dsi86 bridge */
mr(iomuxc, IOMUXC_CTL_PAD_SAI5_RXC, 5, MUX_MODE);
/* gpio1 10 pad for panel */
mr(iomuxc, IOMUXC_CTL_PAD_GPIO1_IO10, 0, MUX_MODE);
/* pwm2 pad */
mr(iomuxc, IOMUXC_CTL_PAD_SPDIF_RX, 1, MUX_MODE);
/* gpio3_io20: sn65dsi86 bridge */
iomuxpad("pad_sai5_rxc", "gpio3_io20", nil);
/* gpio1_io10: for panel */
iomuxpad("pad_gpio1_io10", "gpio1_io10", nil);
/* pwm2_out: for panel backlight */
iomuxpad("pad_spdif_rx", "pwm2_out", nil);
/* lcdif to dpi=0, dcss=1 */
mr(iomuxc, IOMUXC_GPR_GPR13, 0, MIPI_MUX_SEL);

View file

@ -40,6 +40,7 @@ misc
gic
uartimx
lcd
iomux
port
int cpuserver = 0;
bootdir

View file

@ -1875,16 +1875,8 @@ reset(Hci *hp)
Found:
if(i == 0){
static u32int *iomuxc = (u32int*)(VIRTIO + 0x330000);
enum {
IOMUXC_CTL_PAD_GPIO1_IO13 = 0x5C/4, /* for gpio1 13 */
IOMUXC_CTL_PAD_GPIO1_IO14 = 0x60/4, /* for gpio1 14 */
IOMUXC_SW_PAD_CTRL_PAD_GPIO1_IO14 = 0x2C8/4,
};
iomuxc[IOMUXC_CTL_PAD_GPIO1_IO13] = 1;
iomuxc[IOMUXC_CTL_PAD_GPIO1_IO14] = 0;
iomuxc[IOMUXC_SW_PAD_CTRL_PAD_GPIO1_IO14] = 0x16;
iomuxpad("pad_gpio1_io13", "usb1_otg_oc", nil);
iomuxpad("pad_gpio1_io14", "gpio1_io14", "FAST 45_OHM");
hubreset(0);
microdelay(500);