@@ -39,12 +39,14 @@ enum zynqmp_r5_cluster_mode {
3939 * struct mem_bank_data - Memory Bank description
4040 *
4141 * @addr: Start address of memory bank
42+ * @da: device address
4243 * @size: Size of Memory bank
4344 * @pm_domain_id: Power-domains id of memory bank for firmware to turn on/off
4445 * @bank_name: name of the bank for remoteproc framework
4546 */
4647struct mem_bank_data {
4748 phys_addr_t addr ;
49+ u32 da ;
4850 size_t size ;
4951 u32 pm_domain_id ;
5052 char * bank_name ;
@@ -76,18 +78,18 @@ struct mbox_info {
7678 * accepted for system-dt specifications and upstreamed in linux kernel
7779 */
7880static 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" },
8385};
8486
8587/* In lockstep mode cluster combines each 64KB TCM and makes 128KB TCM */
8688static 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 , "" },
9193};
9294
9395/**
@@ -534,30 +536,6 @@ static int tcm_mem_map(struct rproc *rproc,
534536 /* clear TCMs */
535537 memset_io (va , 0 , mem -> len );
536538
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- }
561539 return 0 ;
562540}
563541
@@ -579,6 +557,7 @@ static int add_tcm_carveout_split_mode(struct rproc *rproc)
579557 u32 pm_domain_id ;
580558 size_t bank_size ;
581559 char * bank_name ;
560+ u32 da ;
582561
583562 r5_core = rproc -> priv ;
584563 dev = r5_core -> dev ;
@@ -591,6 +570,7 @@ static int add_tcm_carveout_split_mode(struct rproc *rproc)
591570 */
592571 for (i = 0 ; i < num_banks ; i ++ ) {
593572 bank_addr = r5_core -> tcm_banks [i ]-> addr ;
573+ da = r5_core -> tcm_banks [i ]-> da ;
594574 bank_name = r5_core -> tcm_banks [i ]-> bank_name ;
595575 bank_size = r5_core -> tcm_banks [i ]-> size ;
596576 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)
603583 goto release_tcm_split ;
604584 }
605585
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 );
608588
609589 rproc_mem = rproc_mem_entry_init (dev , NULL , bank_addr ,
610- bank_size , bank_addr ,
590+ bank_size , da ,
611591 tcm_mem_map , tcm_mem_unmap ,
612592 bank_name );
613593 if (!rproc_mem ) {
@@ -648,6 +628,7 @@ static int add_tcm_carveout_lockstep_mode(struct rproc *rproc)
648628 struct device * dev ;
649629 u32 pm_domain_id ;
650630 char * bank_name ;
631+ u32 da ;
651632
652633 r5_core = rproc -> priv ;
653634 dev = r5_core -> dev ;
@@ -679,11 +660,12 @@ static int add_tcm_carveout_lockstep_mode(struct rproc *rproc)
679660 continue ;
680661
681662 bank_addr = r5_core -> tcm_banks [i ]-> addr ;
663+ da = r5_core -> tcm_banks [i ]-> da ;
682664 bank_name = r5_core -> tcm_banks [i ]-> bank_name ;
683665
684666 /* Register TCM address range, TCM map and unmap functions */
685667 rproc_mem = rproc_mem_entry_init (dev , NULL , bank_addr ,
686- bank_size , bank_addr ,
668+ bank_size , da ,
687669 tcm_mem_map , tcm_mem_unmap ,
688670 bank_name );
689671 if (!rproc_mem ) {
@@ -695,8 +677,8 @@ static int add_tcm_carveout_lockstep_mode(struct rproc *rproc)
695677 /* If registration is success, add carveouts */
696678 rproc_add_carveout (rproc , rproc_mem );
697679
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 );
700682 }
701683
702684 return 0 ;
0 commit comments