From 80ef7b778e5e5ec8b2940c875df76bb705855ede Mon Sep 17 00:00:00 2001 From: david Date: Mon, 19 Jan 2015 17:11:36 +0800 Subject: IT8772F: Clean up it8772f includes and add a LED API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove it8772f c includes - Add a new LED API, it8772f_gpio_led - Stumpy: using it8772f_gpio_led BUG=chrome-os-partner:28232 BRANCH=Guado TEST=emerge-guado coreboot chromeos-bootimage Change-Id: I08de52515d3c1e7e85d1761c09a0cebffda7dda3 Signed-off-by: David Wu Reviewed-on: https://chromium-review.googlesource.com/241813 Tested-by: David Wu Reviewed-by: Shawn N Commit-Queue: David Wu Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/12797 Tested-by: build bot (Jenkins) Reviewed-by: Kyösti Mälkki --- src/mainboard/samsung/stumpy/romstage.c | 5 +++- src/mainboard/samsung/stumpy/smihandler.c | 40 +++++++++++-------------------- 2 files changed, 18 insertions(+), 27 deletions(-) (limited to 'src/mainboard/samsung') diff --git a/src/mainboard/samsung/stumpy/romstage.c b/src/mainboard/samsung/stumpy/romstage.c index f76de7a8b0..bf1ddb37be 100644 --- a/src/mainboard/samsung/stumpy/romstage.c +++ b/src/mainboard/samsung/stumpy/romstage.c @@ -155,7 +155,10 @@ static void setup_sio_gpios(void) /* * GPIO45 as LED_POWER# */ - it8772f_gpio_setup(DUMMY_DEV, 4, 0x20, 0x20, 0x20, 0x20, 0x20); + 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# diff --git a/src/mainboard/samsung/stumpy/smihandler.c b/src/mainboard/samsung/stumpy/smihandler.c index 39df8a4a55..2e0f0dd25d 100644 --- a/src/mainboard/samsung/stumpy/smihandler.c +++ b/src/mainboard/samsung/stumpy/smihandler.c @@ -22,44 +22,32 @@ #include #include -/* FIXME: Include romstage serial for SIO helper functions */ -#include -//#include +/* Include for SIO helper functions */ +#include #define DUMMY_DEV PNP_DEV(0x2e, 0) /* * Change LED_POWER# (SIO GPIO 45) state based on sleep type. - * The IO address is hardcoded as we don't have device path in SMM. - */ -#define SIO_GPIO_BASE_SET4 (0x730 + 3) -#define SIO_GPIO_BLINK_GPIO45 0x25 +*/ void mainboard_smi_sleep(u8 slp_typ) { - u8 reg8; - + printk(BIOS_DEBUG, "SMI: sleep S%d\n", slp_typ); switch (slp_typ) { case 3: case 4: - /* Blink LED */ - it8772f_enter_conf(DUMMY_DEV); - it8772f_sio_write(DUMMY_DEV, IT8772F_CONFIG_REG_LDN, IT8772F_GPIO); - /* Enable blink pin map */ - it8772f_sio_write(DUMMY_DEV, IT8772F_GPIO_LED_BLINK1_PINMAP, - SIO_GPIO_BLINK_GPIO45); - /* Enable 4HZ blink */ - it8772f_sio_write(DUMMY_DEV, IT8772F_GPIO_LED_BLINK1_CONTROL, 0x02); - /* Set GPIO to alternate function */ - reg8 = it8772f_sio_read(DUMMY_DEV, GPIO_REG_ENABLE(3)); - reg8 &= ~(1 << 5); - it8772f_sio_write(DUMMY_DEV, GPIO_REG_ENABLE(3), reg8); - it8772f_exit_conf(DUMMY_DEV); + 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 5: - /* Turn off LED */ - reg8 = inb(SIO_GPIO_BASE_SET4); - reg8 |= (1 << 5); - outb(reg8, SIO_GPIO_BASE_SET4); + 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; } } -- cgit v1.2.3