Skip to content

Commit 805b213

Browse files
JhanBoChao-Realtekkartben
authored andcommitted
driver: espi: add espi peripheral channel acpi shd mem driver for rts5912
add espi peripheral channel acpi shd mem driver for rts5912 Signed-off-by: jhan bo chao <[email protected]>
1 parent 4320fb5 commit 805b213

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

drivers/espi/Kconfig.rts5912

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ config ESPI_RTS5912
1010

1111
if ESPI_RTS5912
1212

13+
config ESPI_PERIPHERAL_ACPI_SHM_REGION
14+
default y
15+
1316
config ESPI_PERIPHERAL_HOST_IO
1417
default y
1518

drivers/espi/espi_realtek_rts5912.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ struct espi_rts5912_config {
4141
uint32_t emi0_clk_grp;
4242
uint32_t emi0_clk_idx;
4343
#endif
44+
#ifdef CONFIG_ESPI_PERIPHERAL_ACPI_SHM_REGION
45+
volatile struct emi_reg *const emi1_reg;
46+
uint32_t emi1_clk_grp;
47+
uint32_t emi1_clk_idx;
48+
#endif
4449
#ifdef CONFIG_ESPI_PERIPHERAL_DEBUG_PORT_80
4550
volatile struct port80_reg *const port80_reg;
4651
uint32_t port80_clk_grp;
@@ -66,6 +71,26 @@ struct espi_rts5912_data {
6671
#endif
6772
};
6873

74+
/*
75+
* =========================================================================
76+
* ESPI Peripheral Shared Memory Region
77+
* =========================================================================
78+
*/
79+
80+
#ifdef CONFIG_ESPI_PERIPHERAL_ACPI_SHM_REGION
81+
#define ESPI_RTK_PERIPHERAL_ACPI_SHD_MEM_SIZE 256
82+
83+
static uint8_t acpi_shd_mem_sram[ESPI_RTK_PERIPHERAL_ACPI_SHD_MEM_SIZE] __aligned(256);
84+
85+
static void espi_setup_acpi_shm(const struct espi_rts5912_config *const espi_config)
86+
{
87+
volatile struct emi_reg *const emi1_reg = espi_config->emi1_reg;
88+
89+
emi1_reg->SAR = (uint32_t)&acpi_shd_mem_sram[0];
90+
}
91+
92+
#endif /* CONFIG_ESPI_PERIPHERAL_ACPI_SHM_REGION */
93+
6994
/*
7095
* =========================================================================
7196
* ESPI Peripheral Host IO (ACPI)
@@ -1858,6 +1883,10 @@ static int espi_rts5912_init(const struct device *dev)
18581883
/* Setup eSPI bus reset */
18591884
espi_bus_reset_setup(dev);
18601885

1886+
#ifdef CONFIG_ESPI_PERIPHERAL_ACPI_SHM_REGION
1887+
espi_setup_acpi_shm(espi_config);
1888+
#endif
1889+
18611890
#ifdef CONFIG_ESPI_PERIPHERAL_HOST_IO
18621891
/* Setup ACPI */
18631892
rc = espi_acpi_setup(dev);
@@ -1935,6 +1964,11 @@ static const struct espi_rts5912_config espi_rts5912_config = {
19351964
.emi0_clk_grp = DT_CLOCKS_CELL_BY_NAME(DT_DRV_INST(0), emi0, clk_grp),
19361965
.emi0_clk_idx = DT_CLOCKS_CELL_BY_NAME(DT_DRV_INST(0), emi0, clk_idx),
19371966
#endif
1967+
#ifdef CONFIG_ESPI_PERIPHERAL_ACPI_SHM_REGION
1968+
.emi1_reg = (volatile struct emi_reg *const)DT_INST_REG_ADDR_BY_NAME(0, emi1),
1969+
.emi1_clk_grp = DT_CLOCKS_CELL_BY_NAME(DT_DRV_INST(0), emi1, clk_grp),
1970+
.emi1_clk_idx = DT_CLOCKS_CELL_BY_NAME(DT_DRV_INST(0), emi1, clk_idx),
1971+
#endif
19381972
#ifdef CONFIG_ESPI_PERIPHERAL_DEBUG_PORT_80
19391973
.port80_reg = (volatile struct port80_reg *const)DT_INST_REG_ADDR_BY_NAME(0, port80),
19401974
.port80_clk_grp = DT_CLOCKS_CELL_BY_NAME(DT_DRV_INST(0), port80, clk_grp),

0 commit comments

Comments
 (0)