Michał Żygowski has uploaded this change for review. ( https://review.coreboot.org/27729
Change subject: mb/pcengines/apu2: correct LED setting ......................................................................
mb/pcengines/apu2: correct LED setting
Due to vendor's requirements LED 2 and LED 3 should be turned off in late boot process. Add appropriate functions to read and write GPIO status.
Change-Id: Ia286ef7d02cfcefacf0e8d358847406efe1496fb Signed-off-by: Michał Żygowski michal.zygowski@3mdeb.com --- M src/mainboard/pcengines/apu2/gpio_ftns.c M src/mainboard/pcengines/apu2/gpio_ftns.h M src/mainboard/pcengines/apu2/mainboard.c 3 files changed, 24 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/29/27729/1
diff --git a/src/mainboard/pcengines/apu2/gpio_ftns.c b/src/mainboard/pcengines/apu2/gpio_ftns.c index b14d8a4..9a4a9ff 100644 --- a/src/mainboard/pcengines/apu2/gpio_ftns.c +++ b/src/mainboard/pcengines/apu2/gpio_ftns.c @@ -41,6 +41,18 @@ *iomuxptr = iomux_ftn & 0x3; }
+u8 read_gpio(u32 gpio) +{ + u32 *memptr = (u32 *)(ACPI_MMIO_BASE + GPIO_OFFSET + gpio); + return (*memptr & GPIO_PIN_STS) ? 1 : 0; +} + +void write_gpio(u32 gpio, u8 value) +{ + u32 *memptr = (u32 *)(ACPI_MMIO_BASE + GPIO_OFFSET + gpio); + *memptr |= (value > 0) ? GPIO_OUTPUT_VALUE : 0; +} + int get_spd_offset(void) { u8 index = 0; diff --git a/src/mainboard/pcengines/apu2/gpio_ftns.h b/src/mainboard/pcengines/apu2/gpio_ftns.h index 05f5414..24d6a7f 100644 --- a/src/mainboard/pcengines/apu2/gpio_ftns.h +++ b/src/mainboard/pcengines/apu2/gpio_ftns.h @@ -17,6 +17,8 @@ #define GPIO_FTNS_H
void configure_gpio(u32 iomux_gpio, u8 iomux_ftn, u32 gpio, u32 setting); +u8 read_gpio(u32 gpio); +void write_gpio(u32 gpio, u8 value); int get_spd_offset(void);
#define IOMUX_OFFSET 0xD00 diff --git a/src/mainboard/pcengines/apu2/mainboard.c b/src/mainboard/pcengines/apu2/mainboard.c index 8f2d622..9434b93 100644 --- a/src/mainboard/pcengines/apu2/mainboard.c +++ b/src/mainboard/pcengines/apu2/mainboard.c @@ -178,6 +178,15 @@ pirq_setup(); }
+static void mainboard_final(void *chip_info) +{ + // + // Turn off LED 2 and LED 3 + // + write_gpio(GPIO_58, 1); + write_gpio(GPIO_59, 1); +} + /* * We will stuff a modified version of the first NICs (BDF 1:0.0) MAC address * into the smbios serial number location. @@ -228,4 +237,5 @@
struct chip_operations mainboard_ops = { .enable_dev = mainboard_enable, + .final = mainboard_final, };