|
| 1 | +/* |
| 2 | + * Copyright (c) 2023, Intel Corporation |
| 3 | + * |
| 4 | + * SPDX-License-Identifier: Apache-2.0 |
| 5 | + */ |
| 6 | + |
| 7 | +/** |
| 8 | + * @file |
| 9 | + * @brief GPIO macros for the Raptor Lake SoC |
| 10 | + * |
| 11 | + * This header file is used to specify the GPIO macros for |
| 12 | + * the Raptor Lake SoC. |
| 13 | + */ |
| 14 | + |
| 15 | +#ifndef __SOC_GPIO_H_ |
| 16 | +#define __SOC_GPIO_H_ |
| 17 | + |
| 18 | +#define GPIO_INTEL_NR_SUBDEVS 13 |
| 19 | + |
| 20 | +#define REG_PAD_OWNER_BASE 0x00A0 |
| 21 | +#define REG_GPI_INT_STS_BASE 0x0200 |
| 22 | +#define PAD_CFG0_PMODE_MASK (0x07 << 10) |
| 23 | + |
| 24 | +#define REG_GPI_INT_EN_BASE 0x0220 |
| 25 | +#define REG_PAD_HOST_SW_OWNER 0x150 |
| 26 | +#define PAD_BASE_ADDR_MASK 0xfff |
| 27 | + |
| 28 | +#define GPIO_REG_BASE(reg_base) \ |
| 29 | + (reg_base & ~PAD_BASE_ADDR_MASK) |
| 30 | + |
| 31 | +#define GPIO_PAD_BASE(reg_base) \ |
| 32 | + (reg_base & PAD_BASE_ADDR_MASK) |
| 33 | + |
| 34 | +#define GPIO_PAD_OWNERSHIP(raw_pin, pin_offset) \ |
| 35 | + (pin_offset % 8) ? \ |
| 36 | + REG_PAD_OWNER_BASE + \ |
| 37 | + ((((pin_offset / 8) + 1) + (raw_pin / 8)) * 0x4) : \ |
| 38 | + REG_PAD_OWNER_BASE + \ |
| 39 | + (((pin_offset / 8) + (raw_pin / 8)) * 0x4); \ |
| 40 | + |
| 41 | +#define GPIO_OWNERSHIP_BIT(raw_pin) ((raw_pin % 8) * 4) |
| 42 | + |
| 43 | +#define GPIO_RAW_PIN(pin, pin_offset) pin |
| 44 | + |
| 45 | +#define GPIO_INTERRUPT_BASE(cfg) \ |
| 46 | + (cfg->group_index * 0x4) |
| 47 | + |
| 48 | +#define GPIO_BASE(cfg) \ |
| 49 | + (cfg->group_index * 0x4) |
| 50 | + |
| 51 | +#define PIN_OFFSET 0x10 |
| 52 | + |
| 53 | +#endif /* __SOC_GPIO_H_ */ |
0 commit comments