@@ -39,12 +39,14 @@ enum zynqmp_r5_cluster_mode {
39
39
* struct mem_bank_data - Memory Bank description
40
40
*
41
41
* @addr: Start address of memory bank
42
+ * @da: device address
42
43
* @size: Size of Memory bank
43
44
* @pm_domain_id: Power-domains id of memory bank for firmware to turn on/off
44
45
* @bank_name: name of the bank for remoteproc framework
45
46
*/
46
47
struct mem_bank_data {
47
48
phys_addr_t addr ;
49
+ u32 da ;
48
50
size_t size ;
49
51
u32 pm_domain_id ;
50
52
char * bank_name ;
@@ -76,18 +78,18 @@ struct mbox_info {
76
78
* accepted for system-dt specifications and upstreamed in linux kernel
77
79
*/
78
80
static const struct mem_bank_data zynqmp_tcm_banks_split [] = {
79
- {0xffe00000UL , 0x10000UL , PD_R5_0_ATCM , "atcm0" }, /* TCM 64KB each */
80
- {0xffe20000UL , 0x10000UL , PD_R5_0_BTCM , "btcm0" },
81
- {0xffe90000UL , 0x10000UL , PD_R5_1_ATCM , "atcm1" },
82
- {0xffeb0000UL , 0x10000UL , PD_R5_1_BTCM , "btcm1" },
81
+ {0xffe00000UL , 0x0 , 0x10000UL , PD_R5_0_ATCM , "atcm0" }, /* TCM 64KB each */
82
+ {0xffe20000UL , 0x20000 , 0x10000UL , PD_R5_0_BTCM , "btcm0" },
83
+ {0xffe90000UL , 0x0 , 0x10000UL , PD_R5_1_ATCM , "atcm1" },
84
+ {0xffeb0000UL , 0x20000 , 0x10000UL , PD_R5_1_BTCM , "btcm1" },
83
85
};
84
86
85
87
/* In lockstep mode cluster combines each 64KB TCM and makes 128KB TCM */
86
88
static const struct mem_bank_data zynqmp_tcm_banks_lockstep [] = {
87
- {0xffe00000UL , 0x20000UL , PD_R5_0_ATCM , "atcm0" }, /* TCM 128KB each */
88
- {0xffe20000UL , 0x20000UL , PD_R5_0_BTCM , "btcm0" },
89
- {0 , 0 , PD_R5_1_ATCM , "" },
90
- {0 , 0 , PD_R5_1_BTCM , "" },
89
+ {0xffe00000UL , 0x0 , 0x20000UL , PD_R5_0_ATCM , "atcm0" }, /* TCM 128KB each */
90
+ {0xffe20000UL , 0x20000 , 0x20000UL , PD_R5_0_BTCM , "btcm0" },
91
+ {0 , 0 , 0 , PD_R5_1_ATCM , "" },
92
+ {0 , 0 , 0 , PD_R5_1_BTCM , "" },
91
93
};
92
94
93
95
/**
@@ -534,30 +536,6 @@ static int tcm_mem_map(struct rproc *rproc,
534
536
/* clear TCMs */
535
537
memset_io (va , 0 , mem -> len );
536
538
537
- /*
538
- * The R5s expect their TCM banks to be at address 0x0 and 0x2000,
539
- * while on the Linux side they are at 0xffexxxxx.
540
- *
541
- * Zero out the high 12 bits of the address. This will give
542
- * expected values for TCM Banks 0A and 0B (0x0 and 0x20000).
543
- */
544
- mem -> da &= 0x000fffff ;
545
-
546
- /*
547
- * TCM Banks 1A and 1B still have to be translated.
548
- *
549
- * Below handle these two banks' absolute addresses (0xffe90000 and
550
- * 0xffeb0000) and convert to the expected relative addresses
551
- * (0x0 and 0x20000).
552
- */
553
- if (mem -> da == 0x90000 || mem -> da == 0xB0000 )
554
- mem -> da -= 0x90000 ;
555
-
556
- /* if translated TCM bank address is not valid report error */
557
- if (mem -> da != 0x0 && mem -> da != 0x20000 ) {
558
- dev_err (& rproc -> dev , "invalid TCM address: %x\n" , mem -> da );
559
- return - EINVAL ;
560
- }
561
539
return 0 ;
562
540
}
563
541
@@ -579,6 +557,7 @@ static int add_tcm_carveout_split_mode(struct rproc *rproc)
579
557
u32 pm_domain_id ;
580
558
size_t bank_size ;
581
559
char * bank_name ;
560
+ u32 da ;
582
561
583
562
r5_core = rproc -> priv ;
584
563
dev = r5_core -> dev ;
@@ -591,6 +570,7 @@ static int add_tcm_carveout_split_mode(struct rproc *rproc)
591
570
*/
592
571
for (i = 0 ; i < num_banks ; i ++ ) {
593
572
bank_addr = r5_core -> tcm_banks [i ]-> addr ;
573
+ da = r5_core -> tcm_banks [i ]-> da ;
594
574
bank_name = r5_core -> tcm_banks [i ]-> bank_name ;
595
575
bank_size = r5_core -> tcm_banks [i ]-> size ;
596
576
pm_domain_id = r5_core -> tcm_banks [i ]-> pm_domain_id ;
@@ -603,11 +583,11 @@ static int add_tcm_carveout_split_mode(struct rproc *rproc)
603
583
goto release_tcm_split ;
604
584
}
605
585
606
- dev_dbg (dev , "TCM carveout split mode %s addr=%llx, size=0x%lx" ,
607
- bank_name , bank_addr , bank_size );
586
+ dev_dbg (dev , "TCM carveout split mode %s addr=%llx, da=0x%x, size=0x%lx" ,
587
+ bank_name , bank_addr , da , bank_size );
608
588
609
589
rproc_mem = rproc_mem_entry_init (dev , NULL , bank_addr ,
610
- bank_size , bank_addr ,
590
+ bank_size , da ,
611
591
tcm_mem_map , tcm_mem_unmap ,
612
592
bank_name );
613
593
if (!rproc_mem ) {
@@ -648,6 +628,7 @@ static int add_tcm_carveout_lockstep_mode(struct rproc *rproc)
648
628
struct device * dev ;
649
629
u32 pm_domain_id ;
650
630
char * bank_name ;
631
+ u32 da ;
651
632
652
633
r5_core = rproc -> priv ;
653
634
dev = r5_core -> dev ;
@@ -679,11 +660,12 @@ static int add_tcm_carveout_lockstep_mode(struct rproc *rproc)
679
660
continue ;
680
661
681
662
bank_addr = r5_core -> tcm_banks [i ]-> addr ;
663
+ da = r5_core -> tcm_banks [i ]-> da ;
682
664
bank_name = r5_core -> tcm_banks [i ]-> bank_name ;
683
665
684
666
/* Register TCM address range, TCM map and unmap functions */
685
667
rproc_mem = rproc_mem_entry_init (dev , NULL , bank_addr ,
686
- bank_size , bank_addr ,
668
+ bank_size , da ,
687
669
tcm_mem_map , tcm_mem_unmap ,
688
670
bank_name );
689
671
if (!rproc_mem ) {
@@ -695,8 +677,8 @@ static int add_tcm_carveout_lockstep_mode(struct rproc *rproc)
695
677
/* If registration is success, add carveouts */
696
678
rproc_add_carveout (rproc , rproc_mem );
697
679
698
- dev_dbg (dev , "TCM add carveout lockstep mode %s addr=0x%llx, size=0x%lx" ,
699
- bank_name , bank_addr , bank_size );
680
+ dev_dbg (dev , "TCM carveout lockstep mode %s addr=0x%llx, da=0x%x , size=0x%lx" ,
681
+ bank_name , bank_addr , da , bank_size );
700
682
}
701
683
702
684
return 0 ;
0 commit comments