30
30
#define XILINX_CPM_PCIE_REG_IDRN_MASK 0x00000E3C
31
31
#define XILINX_CPM_PCIE_MISC_IR_STATUS 0x00000340
32
32
#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)
34
35
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)
38
41
39
42
#define IMR (x ) BIT(XILINX_PCIE_INTR_ ##x)
40
43
80
83
enum xilinx_cpm_version {
81
84
CPM ,
82
85
CPM5 ,
86
+ CPM5_HOST1 ,
83
87
};
84
88
85
89
/**
86
90
* struct xilinx_cpm_variant - CPM variant information
87
91
* @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
88
95
*/
89
96
struct xilinx_cpm_variant {
90
97
enum xilinx_cpm_version version ;
98
+ u32 ir_status ;
99
+ u32 ir_enable ;
100
+ u32 ir_misc_value ;
91
101
};
92
102
93
103
/**
@@ -269,6 +279,7 @@ static void xilinx_cpm_pcie_event_flow(struct irq_desc *desc)
269
279
{
270
280
struct xilinx_cpm_pcie * port = irq_desc_get_handler_data (desc );
271
281
struct irq_chip * chip = irq_desc_get_chip (desc );
282
+ const struct xilinx_cpm_variant * variant = port -> variant ;
272
283
unsigned long val ;
273
284
int i ;
274
285
@@ -279,11 +290,11 @@ static void xilinx_cpm_pcie_event_flow(struct irq_desc *desc)
279
290
generic_handle_domain_irq (port -> cpm_domain , i );
280
291
pcie_write (port , val , XILINX_CPM_PCIE_REG_IDR );
281
292
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 );
284
295
if (val )
285
296
writel_relaxed (val , port -> cpm_base +
286
- XILINX_CPM_PCIE_IR_STATUS );
297
+ variant -> ir_status );
287
298
}
288
299
289
300
/*
@@ -465,6 +476,8 @@ static int xilinx_cpm_setup_irq(struct xilinx_cpm_pcie *port)
465
476
*/
466
477
static void xilinx_cpm_pcie_init_port (struct xilinx_cpm_pcie * port )
467
478
{
479
+ const struct xilinx_cpm_variant * variant = port -> variant ;
480
+
468
481
if (cpm_pcie_link_up (port ))
469
482
dev_info (port -> dev , "PCIe Link is UP\n" );
470
483
else
@@ -483,15 +496,15 @@ static void xilinx_cpm_pcie_init_port(struct xilinx_cpm_pcie *port)
483
496
* XILINX_CPM_PCIE_MISC_IR_ENABLE register is mapped to
484
497
* CPM SLCR block.
485
498
*/
486
- writel (XILINX_CPM_PCIE_MISC_IR_LOCAL ,
499
+ writel (variant -> ir_misc_value ,
487
500
port -> cpm_base + XILINX_CPM_PCIE_MISC_IR_ENABLE );
488
501
489
- if (port -> variant -> version == CPM5 ) {
502
+ if (variant -> ir_enable ) {
490
503
writel (XILINX_CPM_PCIE_IR_LOCAL ,
491
- port -> cpm_base + XILINX_CPM_PCIE_IR_ENABLE );
504
+ port -> cpm_base + variant -> ir_enable );
492
505
}
493
506
494
- /* Enable the Bridge enable bit */
507
+ /* Set Bridge enable bit */
495
508
pcie_write (port , pcie_read (port , XILINX_CPM_PCIE_REG_RPSC ) |
496
509
XILINX_CPM_PCIE_REG_RPSC_BEN ,
497
510
XILINX_CPM_PCIE_REG_RPSC );
@@ -609,10 +622,21 @@ static int xilinx_cpm_pcie_probe(struct platform_device *pdev)
609
622
610
623
static const struct xilinx_cpm_variant cpm_host = {
611
624
.version = CPM ,
625
+ .ir_misc_value = XILINX_CPM_PCIE0_MISC_IR_LOCAL ,
612
626
};
613
627
614
628
static const struct xilinx_cpm_variant cpm5_host = {
615
629
.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 ,
616
640
};
617
641
618
642
static 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[] = {
624
648
.compatible = "xlnx,versal-cpm5-host" ,
625
649
.data = & cpm5_host ,
626
650
},
651
+ {
652
+ .compatible = "xlnx,versal-cpm5-host1" ,
653
+ .data = & cpm5_host1 ,
654
+ },
627
655
{}
628
656
};
629
657
0 commit comments