Martin Roth | 3c963d9 | 2022-10-06 16:29:07 -0600 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
Felix Held | 0079200 | 2024-01-26 14:41:14 +0100 | [diff] [blame^] | 3 | #include <amdblocks/acpi.h> |
Martin Roth | 3c963d9 | 2022-10-06 16:29:07 -0600 | [diff] [blame] | 4 | #include <amdblocks/amd_pci_util.h> |
| 5 | #include <commonlib/helpers.h> |
| 6 | #include <device/device.h> |
Martin Roth | 3c963d9 | 2022-10-06 16:29:07 -0600 | [diff] [blame] | 7 | #include <types.h> |
| 8 | #include "gpio.h" |
| 9 | |
| 10 | /* TODO: Update for birman */ |
| 11 | |
Felix Held | cf92ecf | 2022-10-26 00:59:13 +0200 | [diff] [blame] | 12 | /* The IRQ mapping in fch_irq_map ends up getting written to the indirect address space that is |
| 13 | accessed via I/O ports 0xc00/0xc01. */ |
Martin Roth | 3c963d9 | 2022-10-06 16:29:07 -0600 | [diff] [blame] | 14 | |
| 15 | /* |
| 16 | * This controls the device -> IRQ routing. |
| 17 | * |
| 18 | * Hardcoded IRQs: |
| 19 | * 0: timer < soc/amd/common/acpi/lpc.asl |
| 20 | * 1: i8042 - Keyboard |
| 21 | * 2: cascade |
| 22 | * 8: rtc0 <- soc/amd/common/acpi/lpc.asl |
| 23 | * 9: acpi <- soc/amd/common/acpi/lpc.asl |
| 24 | */ |
Felix Held | 067f703 | 2022-10-25 23:30:43 +0200 | [diff] [blame] | 25 | static const struct fch_irq_routing fch_irq_map[] = { |
Martin Roth | 3c963d9 | 2022-10-06 16:29:07 -0600 | [diff] [blame] | 26 | { PIRQ_A, 12, PIRQ_NC }, |
| 27 | { PIRQ_B, 14, PIRQ_NC }, |
| 28 | { PIRQ_C, 15, PIRQ_NC }, |
| 29 | { PIRQ_D, 12, PIRQ_NC }, |
| 30 | { PIRQ_E, 14, PIRQ_NC }, |
| 31 | { PIRQ_F, 15, PIRQ_NC }, |
| 32 | { PIRQ_G, 12, PIRQ_NC }, |
| 33 | { PIRQ_H, 14, PIRQ_NC }, |
| 34 | |
| 35 | { PIRQ_SCI, ACPI_SCI_IRQ, ACPI_SCI_IRQ }, |
Martin Roth | 3c963d9 | 2022-10-06 16:29:07 -0600 | [diff] [blame] | 36 | { PIRQ_SDIO, PIRQ_NC, PIRQ_NC }, |
Martin Roth | 3c963d9 | 2022-10-06 16:29:07 -0600 | [diff] [blame] | 37 | { PIRQ_GPIO, 11, 11 }, |
| 38 | { PIRQ_I2C0, 10, 10 }, |
| 39 | { PIRQ_I2C1, 7, 7 }, |
| 40 | { PIRQ_I2C2, 6, 6 }, |
| 41 | { PIRQ_I2C3, 5, 5 }, |
| 42 | { PIRQ_UART0, 4, 4 }, |
| 43 | { PIRQ_UART1, 3, 3 }, |
| 44 | |
| 45 | /* The MISC registers are not interrupt numbers */ |
| 46 | { PIRQ_MISC, 0xfa, 0x00 }, |
| 47 | { PIRQ_MISC0, 0x91, 0x00 }, |
| 48 | { PIRQ_HPET_L, 0x00, 0x00 }, |
| 49 | { PIRQ_HPET_H, 0x00, 0x00 }, |
| 50 | }; |
| 51 | |
Felix Held | cf92ecf | 2022-10-26 00:59:13 +0200 | [diff] [blame] | 52 | const struct fch_irq_routing *mb_get_fch_irq_mapping(size_t *length) |
Felix Held | 166932c | 2022-10-25 23:40:39 +0200 | [diff] [blame] | 53 | { |
| 54 | *length = ARRAY_SIZE(fch_irq_map); |
| 55 | return fch_irq_map; |
| 56 | } |
| 57 | |
Martin Roth | 3c963d9 | 2022-10-06 16:29:07 -0600 | [diff] [blame] | 58 | static void mainboard_init(void *chip_info) |
| 59 | { |
| 60 | mainboard_program_gpios(); |
| 61 | } |
| 62 | |
Martin Roth | 3c963d9 | 2022-10-06 16:29:07 -0600 | [diff] [blame] | 63 | struct chip_operations mainboard_ops = { |
| 64 | .init = mainboard_init, |
Martin Roth | 3c963d9 | 2022-10-06 16:29:07 -0600 | [diff] [blame] | 65 | }; |