aboutsummaryrefslogtreecommitdiff
path: root/src/southbridge/intel/lynxpoint/lp_gpio.c
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@chromium.org>2013-05-24 11:06:49 -0700
committerStefan Reinauer <stefan.reinauer@coreboot.org>2013-11-25 23:38:36 +0100
commitc593999a0ad9b9f19c8171f6229faa191d055491 (patch)
tree0759809b866a346d98870803a6ad5aceb4905149 /src/southbridge/intel/lynxpoint/lp_gpio.c
parent7820c77f2c118d604d0acfce8deb40536cae3121 (diff)
lynxpoint: Enable extra 16 IOAPIC entries for GPIO PIRQ
LynxPoint-LP has an additional 16 entries in the IOAPIC that can be assigned to specific GPIOs when they are configured as PIRQ. The maximum redirection entries field in the IOAPIC needs to be set to 0x27 when this is enabled. Additionally specific GPIOs need to be routed to PIRQ so they interrupt via the IOAPIC instead of the GPIO IRQ 14/15. Change-Id: Ie587e1d203422ff6fb7fc5056d20a5ae66720991 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/56620 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/4203 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'src/southbridge/intel/lynxpoint/lp_gpio.c')
-rw-r--r--src/southbridge/intel/lynxpoint/lp_gpio.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/southbridge/intel/lynxpoint/lp_gpio.c b/src/southbridge/intel/lynxpoint/lp_gpio.c
index b90e5ba4b8..7d1a28d73c 100644
--- a/src/southbridge/intel/lynxpoint/lp_gpio.c
+++ b/src/southbridge/intel/lynxpoint/lp_gpio.c
@@ -36,6 +36,35 @@ static u16 get_gpio_base(void)
#endif
}
+
+/*
+ * This function will return a number that indicates which PIRQ
+ * this GPIO maps to. If this is not a PIRQ capable GPIO then
+ * it will return -1. The GPIO to PIRQ mapping is not linear.
+ */
+static int lp_gpio_to_pirq(int gpio)
+{
+ switch (gpio) {
+ case 8: return 0; /* PIRQI */
+ case 9: return 1; /* PIRQJ */
+ case 10: return 2; /* PIRQK */
+ case 13: return 3; /* PIRQL */
+ case 14: return 4; /* PIRQM */
+ case 45: return 5; /* PIRQN */
+ case 46: return 6; /* PIRQO */
+ case 47: return 7; /* PIRQP */
+ case 48: return 8; /* PIRQQ */
+ case 49: return 9; /* PIRQR */
+ case 50: return 10; /* PIRQS */
+ case 51: return 11; /* PIRQT */
+ case 52: return 12; /* PIRQU */
+ case 53: return 13; /* PIRQV */
+ case 54: return 14; /* PIRQW */
+ case 55: return 15; /* PIRQX */
+ default: return -1;
+ };
+}
+
void setup_pch_lp_gpios(const struct pch_lp_gpio_map map[])
{
u16 gpio_base = get_gpio_base();
@@ -45,6 +74,7 @@ void setup_pch_lp_gpios(const struct pch_lp_gpio_map map[])
u32 irqen[3] = {0};
u32 reset[3] = {0};
u32 blink = 0;
+ u16 pirq2apic = 0;
int set, bit, gpio = 0;
for (config = map; config->conf0 != GPIO_LIST_END; config++, gpio++) {
@@ -67,6 +97,13 @@ void setup_pch_lp_gpios(const struct pch_lp_gpio_map map[])
if (set == 0)
blink |= config->blink << bit;
+
+ /* PIRQ to IO-APIC map */
+ if (config->pirq == GPIO_PIRQ_APIC_ROUTE) {
+ set = lp_gpio_to_pirq(gpio);
+ if (set >= 0)
+ pirq2apic |= 1 << set;
+ }
}
for (set = 0; set <= 2; set++) {
@@ -77,6 +114,7 @@ void setup_pch_lp_gpios(const struct pch_lp_gpio_map map[])
}
outl(blink, gpio_base + GPIO_BLINK);
+ outl(pirq2apic, gpio_base + GPIO_PIRQ_APIC_EN);
}
int get_gpio(int gpio_num)