forked from Mirrors/opensbi
		
	lib: utils/ipi: Add Andes fdt ipi driver support
Move Andes PLICSW ipi device to fdt ipi framework, this patch is based
on Leo's modified IPI scheme on PLICSW.
Current IPI scheme uses bit 0 of pending reigster on PLICSW to send IPI
from hart 0 to hart 7, but bit 0 needs to be hardwired to 0 according
to spec. After some investigation, self-IPI seems to be seldom or never
used, so we re-order the IPI scheme to support 8 core platforms.
dts example (Quad-core AX45MP):
  plicsw: interrupt-controller@e6400000 {
          compatible = "andestech,plicsw";
          reg = <0x00000000 0xe6400000 0x00000000 0x00400000>;
          interrupts-extended = <&CPU0_intc 3
                                 &CPU1_intc 3
                                 &CPU2_intc 3
                                 &CPU3_intc 3>;
          interrupt-controller;
          #address-cells = <2>;
          #interrupt-cells = <2>;
  };
Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
			
			
This commit is contained in:
		
				
					committed by
					
						
						Anup Patel
					
				
			
			
				
	
			
			
			
						parent
						
							6f3258e671
						
					
				
				
					commit
					ce7c490719
				
			
							
								
								
									
										46
									
								
								include/sbi_utils/ipi/andes_plicsw.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								include/sbi_utils/ipi/andes_plicsw.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,46 @@
 | 
			
		||||
/*
 | 
			
		||||
 * SPDX-License-Identifier: BSD-2-Clause
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (c) 2022 Andes Technology Corporation
 | 
			
		||||
 *
 | 
			
		||||
 * Authors:
 | 
			
		||||
 *   Zong Li <zong@andestech.com>
 | 
			
		||||
 *   Nylon Chen <nylon7@andestech.com>
 | 
			
		||||
 *   Leo Yu-Chi Liang <ycliang@andestech.com>
 | 
			
		||||
 *   Yu Chien Peter Lin <peterlin@andestech.com>
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef _IPI_ANDES_PLICSW_H_
 | 
			
		||||
#define _IPI_ANDES_PLICSW_H_
 | 
			
		||||
 | 
			
		||||
#define PLICSW_PRIORITY_BASE 0x4
 | 
			
		||||
 | 
			
		||||
#define PLICSW_PENDING_BASE 0x1000
 | 
			
		||||
#define PLICSW_PENDING_STRIDE 0x8
 | 
			
		||||
 | 
			
		||||
#define PLICSW_ENABLE_BASE 0x2000
 | 
			
		||||
#define PLICSW_ENABLE_STRIDE 0x80
 | 
			
		||||
 | 
			
		||||
#define PLICSW_CONTEXT_BASE 0x200000
 | 
			
		||||
#define PLICSW_CONTEXT_STRIDE 0x1000
 | 
			
		||||
#define PLICSW_CONTEXT_CLAIM 0x4
 | 
			
		||||
 | 
			
		||||
#define PLICSW_HART_MASK 0x01010101
 | 
			
		||||
 | 
			
		||||
#define PLICSW_HART_MAX_NR 8
 | 
			
		||||
 | 
			
		||||
#define PLICSW_REGION_ALIGN 0x1000
 | 
			
		||||
 | 
			
		||||
struct plicsw_data {
 | 
			
		||||
	unsigned long addr;
 | 
			
		||||
	unsigned long size;
 | 
			
		||||
	uint32_t hart_count;
 | 
			
		||||
	/* hart id to source id table */
 | 
			
		||||
	uint32_t source_id[PLICSW_HART_MAX_NR];
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
int plicsw_warm_ipi_init(void);
 | 
			
		||||
 | 
			
		||||
int plicsw_cold_ipi_init(struct plicsw_data *plicsw);
 | 
			
		||||
 | 
			
		||||
#endif /* _IPI_ANDES_PLICSW_H_ */
 | 
			
		||||
		Reference in New Issue
	
	Block a user