void set_power_led(int state) { switch (state) { case LED_ON: case LED_OFF: it8772f_gpio_led(IT8772F_GPIO_DEV, 2 /* set */, 0xF7 /* select */, state /* polarity: state dependent */, 0x00 /* 0=pulldown */, 0x04 /* output */, 0x04 /* 1=Simple IO function */, SIO_GPIO_BLINK_GPIO22, IT8772F_GPIO_BLINK_FREQUENCY_1_HZ); break; case LED_BLINK: it8772f_gpio_led(IT8772F_GPIO_DEV, 2 /* set */, 0xF7 /* select */, 0x04 /* polarity */, 0x04 /* 1=pullup */, 0x04 /* output */, 0x00, /* 0=Alternate function */ SIO_GPIO_BLINK_GPIO22, IT8772F_GPIO_BLINK_FREQUENCY_1_HZ); break; } }
static void setup_sio_gpios(void) { /* * GPIO10 as USBPWRON12# * GPIO12 as USBPWRON13# */ it8772f_gpio_setup(DUMMY_DEV, 1, 0x05, 0x05, 0x00, 0x05, 0x05); /* * GPIO22 as wake SCI# */ it8772f_gpio_setup(DUMMY_DEV, 2, 0x04, 0x04, 0x00, 0x04, 0x04); /* * GPIO32 as EXTSMI# */ it8772f_gpio_setup(DUMMY_DEV, 3, 0x04, 0x04, 0x00, 0x04, 0x04); /* * GPIO45 as LED_POWER# */ it8772f_gpio_led(DUMMY_DEV, 4 /* set */, (0x1<<5) /* select */, 0x00 /* polarity: non-inverting */, 0x00 /* 0=pulldown */, (0x1<<5) /* output */, (0x1<<5) /* 1=Simple IO function */, SIO_GPIO_BLINK_GPIO45, IT8772F_GPIO_BLINK_FREQUENCY_1_HZ); /* * GPIO51 as USBPWRON8# * GPIO52 as USBPWRON1# */ it8772f_gpio_setup(DUMMY_DEV, 5, 0x06, 0x06, 0x00, 0x06, 0x06); it8772f_gpio_setup(DUMMY_DEV, 6, 0x00, 0x00, 0x00, 0x00, 0x00); }
void mainboard_smi_sleep(u8 slp_typ) { /* Disable USB charging if required */ switch (slp_typ) { case 3: it8772f_gpio_led(IT8772F_GPIO_DEV, 1 /* set */, 0x01 /* select */, 0x01 /* polarity */, 0x01 /* 1=pullup */, 0x01 /* output */, 0x00, /* 0=Alternate function */ SIO_GPIO_BLINK_GPIO10, IT8772F_GPIO_BLINK_FREQUENCY_1_HZ); break; case 5: it8772f_gpio_led(IT8772F_GPIO_DEV, 1 /* set */, 0x01 /* select */, 0x00 /* polarity: non-inverting */, 0x00 /* 0=pulldown */, 0x01 /* output */, 0x01 /* 1=Simple IO function */, SIO_GPIO_BLINK_GPIO10, IT8772F_GPIO_BLINK_FREQUENCY_1_HZ); break; default: break; } return; }
/* * Change LED_POWER# (SIO GPIO 45) state based on sleep type. */ void mainboard_smi_sleep(u8 slp_typ) { printk(BIOS_DEBUG, "SMI: sleep S%d\n", slp_typ); switch (slp_typ) { case ACPI_S3: case ACPI_S4: it8772f_gpio_led(DUMMY_DEV, 4 /* set */, (0x1 << 5) /* select */, (0x1 << 5) /* polarity */, (0x1 << 5) /* 1 = pullup */, (0x1 << 5) /* output */, 0x00, /* 0 = Alternate function */ SIO_GPIO_BLINK_GPIO45, IT8772F_GPIO_BLINK_FREQUENCY_1_HZ); break; case ACPI_S5: it8772f_gpio_led(DUMMY_DEV, 4 /* set */, (0x1 << 5) /* select */, 0x00 /* polarity: non-inverting */, 0x00 /* 0 = pulldown */, (0x1 << 5) /* output */, (0x1 << 5) /* 1 = Simple IO function */, SIO_GPIO_BLINK_GPIO45, IT8772F_GPIO_BLINK_FREQUENCY_1_HZ); break; default: break; } }
void set_power_led(int state) { int polarity; if (IS_ENABLED(CONFIG_BOARD_GOOGLE_TIDUS)) { polarity = state == LED_OFF ? 0x00 : 0x01; } else { polarity = state == LED_BLINK ? 0x01 : 0x00; } it8772f_gpio_led(IT8772F_GPIO_DEV, 1, /* set */ 0x01, /* select */ polarity, /* polarity */ state == LED_BLINK ? 0x01 : 0x00, /* pullup/pulldown */ 0x01, /* output */ state == LED_BLINK ? 0x00 : 0x01, /* I/O function */ SIO_GPIO_BLINK_GPIO10, IT8772F_GPIO_BLINK_FREQUENCY_1_HZ); }
void mainboard_romstage_entry(unsigned long bist) { struct pei_data pei_data = { .pei_version = PEI_VERSION, .mchbar = (uintptr_t)DEFAULT_MCHBAR, .dmibar = (uintptr_t)DEFAULT_DMIBAR, .epbar = DEFAULT_EPBAR, .pciexbar = DEFAULT_PCIEXBAR, .smbusbar = SMBUS_IO_BASE, .wdbbar = 0x4000000, .wdbsize = 0x1000, .hpet_address = HPET_ADDR, .rcba = (uintptr_t)DEFAULT_RCBA, .pmbase = DEFAULT_PMBASE, .gpiobase = DEFAULT_GPIOBASE, .temp_mmio_base = 0xfed08000, .system_type = 5, /* ULT */ .tseg_size = CONFIG_SMM_TSEG_SIZE, .spd_addresses = { 0xa0, 0x00, 0xa4, 0x00 }, .ec_present = 0, // 0 = leave channel enabled // 1 = disable dimm 0 on channel // 2 = disable dimm 1 on channel // 3 = disable dimm 0+1 on channel .dimm_channel0_disabled = 2, .dimm_channel1_disabled = 2, // Enable 2x refresh mode .ddr_refresh_2x = 1, .dq_pins_interleaved = 1, .max_ddr3_freq = 1600, .usb_xhci_on_resume = 1, .usb2_ports = { /* Length, Enable, OCn#, Location */ { 0x0064, 1, 0, /* P0: VP8 */ USB_PORT_MINI_PCIE }, { 0x0040, 1, 0, /* P1: Port A, CN22 */ USB_PORT_INTERNAL }, { 0x0040, 1, 1, /* P2: Port B, CN23 */ USB_PORT_INTERNAL }, { 0x0040, 1, USB_OC_PIN_SKIP, /* P3: WLAN */ USB_PORT_INTERNAL }, { 0x0040, 1, 2, /* P4: Port C, CN25 */ USB_PORT_INTERNAL }, { 0x0040, 1, 2, /* P5: Port D, CN25 */ USB_PORT_INTERNAL }, { 0x0040, 1, USB_OC_PIN_SKIP, /* P6: Card Reader */ USB_PORT_INTERNAL }, { 0x0000, 0, 0, /* P7: N/C */ USB_PORT_SKIP }, }, .usb3_ports = { /* Enable, OCn# */ { 1, 0 }, /* P1; CN22 */ { 1, 1 }, /* P2; CN23 */ { 1, 2 }, /* P3; CN25 */ { 1, 2 }, /* P4; CN25 */ }, }; struct romstage_params romstage_params = { .pei_data = &pei_data, .gpio_map = &mainboard_gpio_map, .rcba_config = &rcba_config[0], .bist = bist, }; /* Early SuperIO setup */ ite_kill_watchdog(IT8772F_GPIO_DEV); it8772f_ac_resume_southbridge(IT8772F_DUMMY_DEV); pch_enable_lpc(); ite_enable_serial(IT8772F_SERIAL_DEV, CONFIG_TTYS0_BASE); /* Turn on Power LED GP22 for Tricky */ it8772f_gpio_led(IT8772F_GPIO_DEV, 2 /* set */, 0xF7 /* select */, 0x04 /* polarity: inverting */, 0x00 /* 0=pulldown */, 0x04 /* output */, 0x04 /* 1=Simple IO function */, SIO_GPIO_BLINK_GPIO22, IT8772F_GPIO_BLINK_FREQUENCY_1_HZ); /* Call into the real romstage main with this board's attributes. */ romstage_common(&romstage_params); }