Skip to content

Commit e454203

Browse files
akanisettifabiobaltieri
authored andcommitted
soc: x86: raptor_lake: Add GPIO support for rpl_crb
Enabled GPIO support for rpl_crb board by adding platform GPIO specific definitions. Signed-off-by: Anisetti Avinash Krishna <[email protected]>
1 parent c8c859c commit e454203

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

soc/x86/raptor_lake/soc.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
#include <zephyr/random/rand32.h>
2222
#endif
2323

24+
#ifdef CONFIG_GPIO_INTEL
25+
#include "soc_gpio.h"
26+
#endif
27+
2428
#if DT_ON_BUS(DT_CHOSEN(zephyr_console), pcie)
2529
#include <zephyr/drivers/pcie/pcie.h>
2630
#define X86_SOC_EARLY_SERIAL_PCIDEV DT_REG_ADDR(DT_CHOSEN(zephyr_console))

soc/x86/raptor_lake/soc_gpio.h

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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

Comments
 (0)