diff options
author | Michał Żygowski <michal.zygowski@3mdeb.com> | 2024-07-17 09:54:38 +0200 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2024-08-09 17:01:45 +0000 |
commit | 001f33cc03a724467138bb6a16aaa4496d3b4a44 (patch) | |
tree | dd81483f45af15e36eb55d74512b4f02ae69b781 /src/mainboard/samsung | |
parent | ec049cb29dcc7fd9ba3f7e8fc21a7bf086a2891c (diff) |
superio/ite,mb: Switch to new ITE GPIO driver
Refactor mainboards' code to use the new GPIO driver.
TEST=Put Google Jecht to S3 sleep and check if the LED blinks.
Change-Id: I707ee090ee2551b4935847e12ade678d36ff9302
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Tested-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83469
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'src/mainboard/samsung')
-rw-r--r-- | src/mainboard/samsung/stumpy/early_init.c | 35 | ||||
-rw-r--r-- | src/mainboard/samsung/stumpy/smihandler.c | 17 |
2 files changed, 30 insertions, 22 deletions
diff --git a/src/mainboard/samsung/stumpy/early_init.c b/src/mainboard/samsung/stumpy/early_init.c index 852759ead9..e4b402027e 100644 --- a/src/mainboard/samsung/stumpy/early_init.c +++ b/src/mainboard/samsung/stumpy/early_init.c @@ -5,6 +5,7 @@ #include <pc80/mc146818rtc.h> #include <bootmode.h> #include <superio/ite/common/ite.h> +#include <superio/ite/common/ite_gpio.h> #include <superio/ite/it8772f/it8772f.h> #include <northbridge/intel/sandybridge/sandybridge.h> #include <northbridge/intel/sandybridge/raminit.h> @@ -58,32 +59,40 @@ static void setup_sio_gpios(void) * GPIO10 as USBPWRON12# * GPIO12 as USBPWRON13# */ - it8772f_gpio_setup(GPIO_DEV, 1, 0x05, 0x05, 0x00, 0x05, 0x05); - + ite_reg_write(GPIO_DEV, ITE_GPIO_REG_SELECT(0), 0x05); + ite_gpio_setup(GPIO_DEV, 10, ITE_GPIO_OUTPUT, ITE_GPIO_SIMPLE_IO_MODE, + ITE_GPIO_POL_INVERT); + ite_gpio_setup(GPIO_DEV, 12, ITE_GPIO_OUTPUT, ITE_GPIO_SIMPLE_IO_MODE, + ITE_GPIO_POL_INVERT); /* * GPIO22 as wake SCI# */ - it8772f_gpio_setup(GPIO_DEV, 2, 0x04, 0x04, 0x00, 0x04, 0x04); - + ite_reg_write(GPIO_DEV, ITE_GPIO_REG_SELECT(1), 0x04); + ite_gpio_setup(GPIO_DEV, 22, ITE_GPIO_OUTPUT, ITE_GPIO_SIMPLE_IO_MODE, + ITE_GPIO_POL_INVERT); /* * GPIO32 as EXTSMI# */ - it8772f_gpio_setup(GPIO_DEV, 3, 0x04, 0x04, 0x00, 0x04, 0x04); - + ite_reg_write(GPIO_DEV, ITE_GPIO_REG_SELECT(2), 0x04); + ite_gpio_setup(GPIO_DEV, 32, ITE_GPIO_OUTPUT, ITE_GPIO_SIMPLE_IO_MODE, + ITE_GPIO_POL_INVERT); /* * GPIO45 as LED_POWER# */ - it8772f_gpio_led(GPIO_DEV, 4 /* set */, (0x1 << 5) /* select */, - (0x1 << 5) /* polarity */, (0x1 << 5) /* 1 = pullup */, - (0x1 << 5) /* output */, (0x1 << 5) /* 1 = Simple IO function */, - SIO_GPIO_BLINK_GPIO45, IT8772F_GPIO_BLINK_FREQUENCY_1_HZ); - + ite_reg_write(GPIO_DEV, ITE_GPIO_REG_SELECT(3), 0x20); + ite_gpio_setup(GPIO_DEV, 45, ITE_GPIO_OUTPUT, ITE_GPIO_SIMPLE_IO_MODE, + ITE_GPIO_POL_INVERT | ITE_GPIO_PULLUP_ENABLE); + ite_gpio_setup_led(GPIO_DEV, 45, ITE_GPIO_LED_1, ITE_LED_FREQ_1HZ, + ITE_LED_CONTROL_DEFAULT); /* * GPIO51 as USBPWRON8# * GPIO52 as USBPWRON1# */ - it8772f_gpio_setup(GPIO_DEV, 5, 0x06, 0x06, 0x00, 0x06, 0x06); - it8772f_gpio_setup(GPIO_DEV, 6, 0x00, 0x00, 0x00, 0x00, 0x00); + ite_reg_write(GPIO_DEV, ITE_GPIO_REG_SELECT(4), 0x06); + ite_gpio_setup(GPIO_DEV, 51, ITE_GPIO_OUTPUT, ITE_GPIO_SIMPLE_IO_MODE, + ITE_GPIO_POL_INVERT); + ite_gpio_setup(GPIO_DEV, 52, ITE_GPIO_OUTPUT, ITE_GPIO_SIMPLE_IO_MODE, + ITE_GPIO_POL_INVERT); } void mainboard_fill_pei_data(struct pei_data *pei_data) diff --git a/src/mainboard/samsung/stumpy/smihandler.c b/src/mainboard/samsung/stumpy/smihandler.c index f9b9d3b8db..0b6e133558 100644 --- a/src/mainboard/samsung/stumpy/smihandler.c +++ b/src/mainboard/samsung/stumpy/smihandler.c @@ -8,6 +8,8 @@ #include <northbridge/intel/sandybridge/sandybridge.h> /* Include for SIO helper functions */ +#include <superio/ite/common/ite.h> +#include <superio/ite/common/ite_gpio.h> #include <superio/ite/it8772f/it8772f.h> #define GPIO_DEV PNP_DEV(0x2e, IT8772F_GPIO) @@ -20,17 +22,14 @@ void mainboard_smi_sleep(u8 slp_typ) switch (slp_typ) { case ACPI_S3: case ACPI_S4: - it8772f_gpio_led(GPIO_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); + ite_gpio_setup(GPIO_DEV, 45, ITE_GPIO_OUTPUT, ITE_GPIO_ALT_FN_MODE, + ITE_GPIO_POL_INVERT | ITE_GPIO_PULLUP_ENABLE); + ite_gpio_setup_led(GPIO_DEV, 45, ITE_GPIO_LED_1, ITE_LED_FREQ_1HZ, + ITE_LED_CONTROL_DEFAULT); break; - case ACPI_S5: - it8772f_gpio_led(GPIO_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); + ite_gpio_setup(GPIO_DEV, 45, ITE_GPIO_OUTPUT, ITE_GPIO_SIMPLE_IO_MODE, + ITE_GPIO_CONTROL_DEFAULT); break; default: break; |