Simon Glass | 3642ba9 | 2019-02-16 20:25:03 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | /* |
| 3 | * Serial IO defintiions (taken from coreboot file of same name) |
| 4 | * |
| 5 | * Copyright 2019 Google LLC |
| 6 | */ |
| 7 | |
| 8 | #ifndef __ARCH_BROADWELL_SERIALIO_H_ |
| 9 | #define __ARCH_BROADWELL_SERIALIO_H_ |
| 10 | |
| 11 | /* Serial IO IOBP Registers */ |
Simon Glass | 4dcacfc | 2020-05-10 11:40:13 -0600 | [diff] [blame] | 12 | #include <linux/bitops.h> |
Simon Glass | 3642ba9 | 2019-02-16 20:25:03 -0700 | [diff] [blame] | 13 | #define SIO_IOBP_PORTCTRL0 0xcb000000 /* SDIO D23:F0 */ |
| 14 | #define SIO_IOBP_PORTCTRL0_ACPI_IRQ_EN BIT(5) |
| 15 | #define SIO_IOBP_PORTCTRL0_PCI_CONF_DIS BIT(4) |
| 16 | #define SIO_IOBP_PORTCTRL1 0xcb000014 /* SDIO D23:F0 */ |
| 17 | #define SIO_IOBP_PORTCTRL1_SNOOP_SELECT(x) (((x) & 3) << 13) |
| 18 | #define SIO_IOBP_GPIODF 0xcb000154 |
| 19 | #define SIO_IOBP_GPIODF_SDIO_IDLE_DET_EN BIT(4) |
| 20 | #define SIO_IOBP_GPIODF_DMA_IDLE_DET_EN BIT(3) |
| 21 | #define SIO_IOBP_GPIODF_UART_IDLE_DET_EN BIT(2) |
| 22 | #define SIO_IOBP_GPIODF_I2C_IDLE_DET_EN BIT(1) |
| 23 | #define SIO_IOBP_GPIODF_SPI_IDLE_DET_EN BIT(0) |
| 24 | #define SIO_IOBP_GPIODF_UART0_BYTE_ACCESS BIT(10) |
| 25 | #define SIO_IOBP_GPIODF_UART1_BYTE_ACCESS BIT(11) |
| 26 | #define SIO_IOBP_PORTCTRL2 0xcb000240 /* DMA D21:F0 */ |
| 27 | #define SIO_IOBP_PORTCTRL3 0xcb000248 /* I2C0 D21:F1 */ |
| 28 | #define SIO_IOBP_PORTCTRL4 0xcb000250 /* I2C1 D21:F2 */ |
| 29 | #define SIO_IOBP_PORTCTRL5 0xcb000258 /* SPI0 D21:F3 */ |
| 30 | #define SIO_IOBP_PORTCTRL6 0xcb000260 /* SPI1 D21:F4 */ |
| 31 | #define SIO_IOBP_PORTCTRL7 0xcb000268 /* UART0 D21:F5 */ |
| 32 | #define SIO_IOBP_PORTCTRL8 0xcb000270 /* UART1 D21:F6 */ |
| 33 | #define SIO_IOBP_PORTCTRLX(x) (0xcb000240 + ((x) * 8)) |
| 34 | /* PORTCTRL 2-8 have the same layout */ |
| 35 | #define SIO_IOBP_PORTCTRL_ACPI_IRQ_EN BIT(21) |
| 36 | #define SIO_IOBP_PORTCTRL_PCI_CONF_DIS BIT(20) |
| 37 | #define SIO_IOBP_PORTCTRL_SNOOP_SELECT(x) (((x) & 3) << 18) |
| 38 | #define SIO_IOBP_PORTCTRL_INT_PIN(x) (((x) & 0xf) << 2) |
| 39 | #define SIO_IOBP_PORTCTRL_PM_CAP_PRSNT BIT(1) |
| 40 | #define SIO_IOBP_FUNCDIS0 0xce00aa07 /* DMA D21:F0 */ |
| 41 | #define SIO_IOBP_FUNCDIS1 0xce00aa47 /* I2C0 D21:F1 */ |
| 42 | #define SIO_IOBP_FUNCDIS2 0xce00aa87 /* I2C1 D21:F2 */ |
| 43 | #define SIO_IOBP_FUNCDIS3 0xce00aac7 /* SPI0 D21:F3 */ |
| 44 | #define SIO_IOBP_FUNCDIS4 0xce00ab07 /* SPI1 D21:F4 */ |
| 45 | #define SIO_IOBP_FUNCDIS5 0xce00ab47 /* UART0 D21:F5 */ |
| 46 | #define SIO_IOBP_FUNCDIS6 0xce00ab87 /* UART1 D21:F6 */ |
| 47 | #define SIO_IOBP_FUNCDIS7 0xce00ae07 /* SDIO D23:F0 */ |
| 48 | #define SIO_IOBP_FUNCDIS_DIS BIT(8) |
| 49 | |
| 50 | /* Serial IO Devices */ |
| 51 | #define SIO_ID_SDMA 0 /* D21:F0 */ |
| 52 | #define SIO_ID_I2C0 1 /* D21:F1 */ |
| 53 | #define SIO_ID_I2C1 2 /* D21:F2 */ |
| 54 | #define SIO_ID_SPI0 3 /* D21:F3 */ |
| 55 | #define SIO_ID_SPI1 4 /* D21:F4 */ |
| 56 | #define SIO_ID_UART0 5 /* D21:F5 */ |
| 57 | #define SIO_ID_UART1 6 /* D21:F6 */ |
| 58 | #define SIO_ID_SDIO 7 /* D23:F0 */ |
| 59 | |
| 60 | #define SIO_REG_PPR_CLOCK 0x800 |
| 61 | #define SIO_REG_PPR_CLOCK_EN BIT(0) |
| 62 | #define SIO_REG_PPR_CLOCK_UPDATE BIT(31) |
| 63 | #define SIO_REG_PPR_CLOCK_M_DIV 0x25a |
| 64 | #define SIO_REG_PPR_CLOCK_N_DIV 0x7fff |
| 65 | #define SIO_REG_PPR_RST 0x804 |
| 66 | #define SIO_REG_PPR_RST_ASSERT 0x3 |
| 67 | #define SIO_REG_PPR_GEN 0x808 |
| 68 | #define SIO_REG_PPR_GEN_LTR_MODE_MASK BIT(2) |
| 69 | #define SIO_REG_PPR_GEN_VOLTAGE_MASK BIT(3) |
| 70 | #define SIO_REG_PPR_GEN_VOLTAGE(x) ((x & 1) << 3) |
| 71 | #define SIO_REG_AUTO_LTR 0x814 |
| 72 | |
| 73 | #define SIO_REG_SDIO_PPR_GEN 0x1008 |
| 74 | #define SIO_REG_SDIO_PPR_SW_LTR 0x1010 |
| 75 | #define SIO_REG_SDIO_PPR_CMD12 0x3c |
| 76 | #define SIO_REG_SDIO_PPR_CMD12_B30 BIT(30) |
| 77 | |
| 78 | #define SIO_PIN_INTA 1 /* IRQ5 in ACPI mode */ |
| 79 | #define SIO_PIN_INTB 2 /* IRQ6 in ACPI mode */ |
| 80 | #define SIO_PIN_INTC 3 /* IRQ7 in ACPI mode */ |
| 81 | #define SIO_PIN_INTD 4 /* IRQ13 in ACPI mode */ |
| 82 | |
| 83 | #endif /* __ARCH_BROADWELL_SERIALIO_H_ */ |