3030#define XILINX_CPM_PCIE_REG_IDRN_MASK 0x00000E3C
3131#define XILINX_CPM_PCIE_MISC_IR_STATUS 0x00000340
3232#define XILINX_CPM_PCIE_MISC_IR_ENABLE 0x00000348
33- #define XILINX_CPM_PCIE_MISC_IR_LOCAL BIT(1)
33+ #define XILINX_CPM_PCIE0_MISC_IR_LOCAL BIT(1)
34+ #define XILINX_CPM_PCIE1_MISC_IR_LOCAL BIT(2)
3435
35- #define XILINX_CPM_PCIE_IR_STATUS 0x000002A0
36- #define XILINX_CPM_PCIE_IR_ENABLE 0x000002A8
37- #define XILINX_CPM_PCIE_IR_LOCAL BIT(0)
36+ #define XILINX_CPM_PCIE0_IR_STATUS 0x000002A0
37+ #define XILINX_CPM_PCIE1_IR_STATUS 0x000002B4
38+ #define XILINX_CPM_PCIE0_IR_ENABLE 0x000002A8
39+ #define XILINX_CPM_PCIE1_IR_ENABLE 0x000002BC
40+ #define XILINX_CPM_PCIE_IR_LOCAL BIT(0)
3841
3942#define IMR (x ) BIT(XILINX_PCIE_INTR_ ##x)
4043
8083enum xilinx_cpm_version {
8184 CPM ,
8285 CPM5 ,
86+ CPM5_HOST1 ,
8387};
8488
8589/**
8690 * struct xilinx_cpm_variant - CPM variant information
8791 * @version: CPM version
92+ * @ir_status: Offset for the error interrupt status register
93+ * @ir_enable: Offset for the CPM5 local error interrupt enable register
94+ * @ir_misc_value: A bitmask for the miscellaneous interrupt status
8895 */
8996struct xilinx_cpm_variant {
9097 enum xilinx_cpm_version version ;
98+ u32 ir_status ;
99+ u32 ir_enable ;
100+ u32 ir_misc_value ;
91101};
92102
93103/**
@@ -269,6 +279,7 @@ static void xilinx_cpm_pcie_event_flow(struct irq_desc *desc)
269279{
270280 struct xilinx_cpm_pcie * port = irq_desc_get_handler_data (desc );
271281 struct irq_chip * chip = irq_desc_get_chip (desc );
282+ const struct xilinx_cpm_variant * variant = port -> variant ;
272283 unsigned long val ;
273284 int i ;
274285
@@ -279,11 +290,11 @@ static void xilinx_cpm_pcie_event_flow(struct irq_desc *desc)
279290 generic_handle_domain_irq (port -> cpm_domain , i );
280291 pcie_write (port , val , XILINX_CPM_PCIE_REG_IDR );
281292
282- if (port -> variant -> version == CPM5 ) {
283- val = readl_relaxed (port -> cpm_base + XILINX_CPM_PCIE_IR_STATUS );
293+ if (variant -> ir_status ) {
294+ val = readl_relaxed (port -> cpm_base + variant -> ir_status );
284295 if (val )
285296 writel_relaxed (val , port -> cpm_base +
286- XILINX_CPM_PCIE_IR_STATUS );
297+ variant -> ir_status );
287298 }
288299
289300 /*
@@ -465,6 +476,8 @@ static int xilinx_cpm_setup_irq(struct xilinx_cpm_pcie *port)
465476 */
466477static void xilinx_cpm_pcie_init_port (struct xilinx_cpm_pcie * port )
467478{
479+ const struct xilinx_cpm_variant * variant = port -> variant ;
480+
468481 if (cpm_pcie_link_up (port ))
469482 dev_info (port -> dev , "PCIe Link is UP\n" );
470483 else
@@ -483,15 +496,15 @@ static void xilinx_cpm_pcie_init_port(struct xilinx_cpm_pcie *port)
483496 * XILINX_CPM_PCIE_MISC_IR_ENABLE register is mapped to
484497 * CPM SLCR block.
485498 */
486- writel (XILINX_CPM_PCIE_MISC_IR_LOCAL ,
499+ writel (variant -> ir_misc_value ,
487500 port -> cpm_base + XILINX_CPM_PCIE_MISC_IR_ENABLE );
488501
489- if (port -> variant -> version == CPM5 ) {
502+ if (variant -> ir_enable ) {
490503 writel (XILINX_CPM_PCIE_IR_LOCAL ,
491- port -> cpm_base + XILINX_CPM_PCIE_IR_ENABLE );
504+ port -> cpm_base + variant -> ir_enable );
492505 }
493506
494- /* Enable the Bridge enable bit */
507+ /* Set Bridge enable bit */
495508 pcie_write (port , pcie_read (port , XILINX_CPM_PCIE_REG_RPSC ) |
496509 XILINX_CPM_PCIE_REG_RPSC_BEN ,
497510 XILINX_CPM_PCIE_REG_RPSC );
@@ -609,10 +622,21 @@ static int xilinx_cpm_pcie_probe(struct platform_device *pdev)
609622
610623static const struct xilinx_cpm_variant cpm_host = {
611624 .version = CPM ,
625+ .ir_misc_value = XILINX_CPM_PCIE0_MISC_IR_LOCAL ,
612626};
613627
614628static const struct xilinx_cpm_variant cpm5_host = {
615629 .version = CPM5 ,
630+ .ir_misc_value = XILINX_CPM_PCIE0_MISC_IR_LOCAL ,
631+ .ir_status = XILINX_CPM_PCIE0_IR_STATUS ,
632+ .ir_enable = XILINX_CPM_PCIE0_IR_ENABLE ,
633+ };
634+
635+ static const struct xilinx_cpm_variant cpm5_host1 = {
636+ .version = CPM5_HOST1 ,
637+ .ir_misc_value = XILINX_CPM_PCIE1_MISC_IR_LOCAL ,
638+ .ir_status = XILINX_CPM_PCIE1_IR_STATUS ,
639+ .ir_enable = XILINX_CPM_PCIE1_IR_ENABLE ,
616640};
617641
618642static const struct of_device_id xilinx_cpm_pcie_of_match [] = {
@@ -624,6 +648,10 @@ static const struct of_device_id xilinx_cpm_pcie_of_match[] = {
624648 .compatible = "xlnx,versal-cpm5-host" ,
625649 .data = & cpm5_host ,
626650 },
651+ {
652+ .compatible = "xlnx,versal-cpm5-host1" ,
653+ .data = & cpm5_host1 ,
654+ },
627655 {}
628656};
629657
0 commit comments