1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright(c) 2015 EZchip Technologies.
6 #include <linux/init.h>
8 #include <asm/mach_desc.h>
11 static void __init
eznps_configure_msu(void)
14 struct nps_host_reg_msu_en_cfg msu_en_cfg
= {.value
= 0};
16 msu_en_cfg
.msu_en
= 1;
17 msu_en_cfg
.ipi_en
= 1;
18 msu_en_cfg
.gim_0_en
= 1;
19 msu_en_cfg
.gim_1_en
= 1;
21 /* enable IPI and GIM messages on all clusters */
22 for (cpu
= 0 ; cpu
< eznps_max_cpus
; cpu
+= eznps_cpus_per_cluster
)
23 iowrite32be(msu_en_cfg
.value
,
24 nps_host_reg(cpu
, NPS_MSU_BLKID
, NPS_MSU_EN_CFG
));
27 static void __init
eznps_configure_gim(void)
31 struct nps_host_reg_gim_p_int_dst gim_p_int_dst
= {.value
= 0};
33 gim_int_lines
= NPS_GIM_UART_LINE
;
34 gim_int_lines
|= NPS_GIM_DBG_LAN_EAST_TX_DONE_LINE
;
35 gim_int_lines
|= NPS_GIM_DBG_LAN_EAST_RX_RDY_LINE
;
36 gim_int_lines
|= NPS_GIM_DBG_LAN_WEST_TX_DONE_LINE
;
37 gim_int_lines
|= NPS_GIM_DBG_LAN_WEST_RX_RDY_LINE
;
42 * negative or positive edge
44 reg_value
= ioread32be(REG_GIM_P_INT_POL_0
);
45 reg_value
&= ~gim_int_lines
;
46 iowrite32be(reg_value
, REG_GIM_P_INT_POL_0
);
48 /* IRQ type level or edge */
49 reg_value
= ioread32be(REG_GIM_P_INT_SENS_0
);
50 reg_value
|= NPS_GIM_DBG_LAN_EAST_TX_DONE_LINE
;
51 reg_value
|= NPS_GIM_DBG_LAN_WEST_TX_DONE_LINE
;
52 iowrite32be(reg_value
, REG_GIM_P_INT_SENS_0
);
55 * GIM interrupt select type for
56 * dbg_lan TX and RX interrupts
62 iowrite32be(gim_p_int_dst
.value
, REG_GIM_P_INT_DST_10
);
63 iowrite32be(gim_p_int_dst
.value
, REG_GIM_P_INT_DST_11
);
64 iowrite32be(gim_p_int_dst
.value
, REG_GIM_P_INT_DST_25
);
65 iowrite32be(gim_p_int_dst
.value
, REG_GIM_P_INT_DST_26
);
68 * CTOP IRQ lines should be defined
71 iowrite32be(gim_int_lines
, REG_GIM_P_INT_BLK_0
);
73 /* enable CTOP IRQ lines in GIM */
74 iowrite32be(gim_int_lines
, REG_GIM_P_INT_EN_0
);
77 static void __init
eznps_early_init(void)
79 eznps_configure_msu();
80 eznps_configure_gim();
83 static const char *eznps_compat
[] __initconst
= {
88 MACHINE_START(NPS
, "nps")
89 .dt_compat
= eznps_compat
,
90 .init_early
= eznps_early_init
,