1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <device/mmio.h>
4 #include <soc/addressmap.h>
5 #include <soc/pmif_spi.h>
6 #include <soc/pmif_spmi.h>
7 #include <soc/pmif_sw.h>
10 const struct pmif pmif_spmi_arb
[] = {
12 .mtk_pmif
= (struct mtk_pmif_regs
*)PMIF_SPMI_BASE
,
13 .ch
= (struct chan_regs
*)PMIF_SPMI_AP_CHAN
,
14 .mstid
= SPMI_MASTER_0
,
16 .write
= pmif_spmi_write
,
17 .read
= pmif_spmi_read
,
18 .write_field
= pmif_spmi_write_field
,
19 .read_field
= pmif_spmi_read_field
,
20 .is_pmif_init_done
= pmif_check_init_done
,
24 const size_t pmif_spmi_arb_count
= ARRAY_SIZE(pmif_spmi_arb
);
26 const struct pmif pmif_spi_arb
[] = {
28 .mtk_pmif
= (struct mtk_pmif_regs
*)PMIF_SPI_BASE
,
29 .ch
= (struct chan_regs
*)PMIF_SPI_AP_CHAN
,
31 .write
= pmif_spi_write
,
32 .read
= pmif_spi_read
,
33 .write_field
= pmif_spi_write_field
,
34 .read_field
= pmif_spi_read_field
,
35 .is_pmif_init_done
= pmif_check_init_done
,
39 const size_t pmif_spi_arb_count
= ARRAY_SIZE(pmif_spi_arb
);
41 int mtk_pmif_init(void)
45 ret
= pmif_clk_init();
47 ret
= pmif_spmi_init(get_pmif_controller(PMIF_SPMI
, SPMI_MASTER_0
));
48 if (!ret
&& !CONFIG(PWRAP_WITH_PMIF_SPMI
))
49 ret
= pmif_spi_init(get_pmif_controller(PMIF_SPI
, 0));