diff options
author | Subrata Banik <subrata.banik@intel.com> | 2017-03-08 17:55:26 +0530 |
---|---|---|
committer | Martin Roth <martinroth@google.com> | 2017-04-10 20:05:35 +0200 |
commit | ccd8700cac9bda4229ba5628e6f51ab0b96fde41 (patch) | |
tree | bc5b8b94337d609de66b31e603b67e1bed0ca0dd /src/soc/intel/apollolake/itss.c | |
parent | e7ceae79502705a8dc86943e6296fd2cf7735677 (diff) | |
download | coreboot-ccd8700cac9bda4229ba5628e6f51ab0b96fde41.tar.xz |
soc/intel/apollolake: Use common PCR module
This patch use common PCR library to perform CRRd and CRWr operation
using Port Ids, define inside soc/pcr_ids.h
Change-Id: Iacbf58dbd55bf3915676d875fcb484362d357a44
Signed-off-by: Subrata Banik <subrata.banik@intel.com>
Reviewed-on: https://review.coreboot.org/18673
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/soc/intel/apollolake/itss.c')
-rw-r--r-- | src/soc/intel/apollolake/itss.c | 45 |
1 files changed, 18 insertions, 27 deletions
diff --git a/src/soc/intel/apollolake/itss.c b/src/soc/intel/apollolake/itss.c index 9c49d6c655..17b197547f 100644 --- a/src/soc/intel/apollolake/itss.c +++ b/src/soc/intel/apollolake/itss.c @@ -15,34 +15,29 @@ #include <commonlib/helpers.h> #include <console/console.h> +#include <intelblocks/pcr.h> #include <stdint.h> -#include <soc/iosf.h> #include <soc/itss.h> +#include <soc/pcr_ids.h> -#define IOSF_ITSS_PORT_ID 0xd0 -#define ITSS_MAX_IRQ 119 -#define IPC0 0x3200 -#define IRQS_PER_IPC 32 -#define NUM_IPC_REGS ((ITSS_MAX_IRQ + IRQS_PER_IPC - 1)/IRQS_PER_IPC) +#define ITSS_MAX_IRQ 119 +#define IRQS_PER_IPC 32 +#define NUM_IPC_REGS ((ITSS_MAX_IRQ + IRQS_PER_IPC - 1)/IRQS_PER_IPC) +#define PCR_IPC0_CONF 0x3200 void itss_set_irq_polarity(int irq, int active_low) { uint32_t mask; - uint32_t val; uint16_t reg; - const uint16_t port = IOSF_ITSS_PORT_ID; + const uint16_t port = PID_ITSS; if (irq < 0 || irq > ITSS_MAX_IRQ) return; - reg = IPC0 + sizeof(uint32_t) * (irq / IRQS_PER_IPC); + reg = PCR_IPC0_CONF + sizeof(uint32_t) * (irq / IRQS_PER_IPC); mask = 1 << (irq % IRQS_PER_IPC); - val = iosf_read(port, reg); - val &= ~mask; - /* Setting the bit makes the IRQ active low. */ - val |= active_low ? mask : 0; - iosf_write(port, reg, val); + pcr_rmw32(port, reg, ~mask, (active_low ? mask : 0)); } static uint32_t irq_snapshot[NUM_IPC_REGS]; @@ -52,7 +47,7 @@ void itss_snapshot_irq_polarities(int start, int end) int i; int reg_start; int reg_end; - const uint16_t port = IOSF_ITSS_PORT_ID; + const uint16_t port = PID_ITSS; if (start < 0 || start > ITSS_MAX_IRQ || end < 0 || end > ITSS_MAX_IRQ || end < start) @@ -62,20 +57,20 @@ void itss_snapshot_irq_polarities(int start, int end) reg_end = (end + IRQS_PER_IPC - 1) / IRQS_PER_IPC; for (i = reg_start; i < reg_end; i++) { - uint16_t reg = IPC0 + sizeof(uint32_t) * i; - irq_snapshot[i] = iosf_read(port, reg); + uint16_t reg = PCR_IPC0_CONF + sizeof(uint32_t) * i; + irq_snapshot[i] = pcr_read32(port, reg); } } static void show_irq_polarities(const char *msg) { int i; - const uint16_t port = IOSF_ITSS_PORT_ID; + const uint16_t port = PID_ITSS; printk(BIOS_INFO, "ITSS IRQ Polarities %s:\n", msg); for (i = 0; i < NUM_IPC_REGS; i++) { - uint16_t reg = IPC0 + sizeof(uint32_t) * i; - printk(BIOS_INFO, "IPC%d: 0x%08x\n", i, iosf_read(port, reg)); + uint16_t reg = PCR_IPC0_CONF + sizeof(uint32_t) * i; + printk(BIOS_INFO, "IPC%d: 0x%08x\n", i, pcr_read32(port, reg)); } } @@ -84,7 +79,7 @@ void itss_restore_irq_polarities(int start, int end) int i; int reg_start; int reg_end; - const uint16_t port = IOSF_ITSS_PORT_ID; + const uint16_t port = PID_ITSS; if (start < 0 || start > ITSS_MAX_IRQ || end < 0 || end > ITSS_MAX_IRQ || end < start) @@ -97,7 +92,6 @@ void itss_restore_irq_polarities(int start, int end) for (i = reg_start; i < reg_end; i++) { uint32_t mask; - uint32_t val; uint16_t reg; int irq_start; int irq_end; @@ -118,11 +112,8 @@ void itss_restore_irq_polarities(int start, int end) mask = (((1U << irq_end) - 1) | (1U << irq_end)); mask &= ~((1U << irq_start) - 1); - reg = IPC0 + sizeof(uint32_t) * i; - val = iosf_read(port, reg); - val &= ~mask; - val |= mask & irq_snapshot[i]; - iosf_write(port, reg, val); + reg = PCR_IPC0_CONF + sizeof(uint32_t) * i; + pcr_rmw32(port, reg, ~mask, (mask & irq_snapshot[i])); } show_irq_polarities("After"); |