forked from Mirrors/opensbi
		
	lib: utils: Try other FDT drivers when we see SBI_ENODEV
We should try other FDT drivers when we see SBI_ENODEV returned by cold_init() of FDT driver. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com> Reviewed-by: Xiang W <wxjstz@126.com>
This commit is contained in:
		@@ -7,6 +7,7 @@
 | 
			
		||||
 *   Anup Patel <anup.patel@wdc.com>
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <sbi/sbi_error.h>
 | 
			
		||||
#include <sbi/sbi_scratch.h>
 | 
			
		||||
#include <sbi_utils/fdt/fdt_helper.h>
 | 
			
		||||
#include <sbi_utils/ipi/fdt_ipi.h>
 | 
			
		||||
@@ -54,6 +55,8 @@ static int fdt_ipi_cold_init(void)
 | 
			
		||||
					drv->match_table, &match)) >= 0) {
 | 
			
		||||
			if (drv->cold_init) {
 | 
			
		||||
				rc = drv->cold_init(fdt, noff, match);
 | 
			
		||||
				if (rc == SBI_ENODEV)
 | 
			
		||||
					continue;
 | 
			
		||||
				if (rc)
 | 
			
		||||
					return rc;
 | 
			
		||||
			}
 | 
			
		||||
 
 | 
			
		||||
@@ -7,6 +7,7 @@
 | 
			
		||||
 *   Anup Patel <anup.patel@wdc.com>
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <sbi/sbi_error.h>
 | 
			
		||||
#include <sbi/sbi_scratch.h>
 | 
			
		||||
#include <sbi_utils/fdt/fdt_helper.h>
 | 
			
		||||
#include <sbi_utils/irqchip/fdt_irqchip.h>
 | 
			
		||||
@@ -47,6 +48,8 @@ static int fdt_irqchip_cold_init(void)
 | 
			
		||||
					drv->match_table, &match)) >= 0) {
 | 
			
		||||
			if (drv->cold_init) {
 | 
			
		||||
				rc = drv->cold_init(fdt, noff, match);
 | 
			
		||||
				if (rc == SBI_ENODEV)
 | 
			
		||||
					continue;
 | 
			
		||||
				if (rc)
 | 
			
		||||
					return rc;
 | 
			
		||||
			}
 | 
			
		||||
 
 | 
			
		||||
@@ -7,6 +7,7 @@
 | 
			
		||||
 *   Anup Patel <anup.patel@wdc.com>
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <sbi/sbi_error.h>
 | 
			
		||||
#include <sbi/sbi_scratch.h>
 | 
			
		||||
#include <sbi_utils/fdt/fdt_helper.h>
 | 
			
		||||
#include <sbi_utils/reset/fdt_reset.h>
 | 
			
		||||
@@ -39,6 +40,8 @@ int fdt_reset_init(void)
 | 
			
		||||
 | 
			
		||||
		if (drv->init) {
 | 
			
		||||
			rc = drv->init(fdt, noff, match);
 | 
			
		||||
			if (rc == SBI_ENODEV)
 | 
			
		||||
				continue;
 | 
			
		||||
			if (rc)
 | 
			
		||||
				return rc;
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -8,6 +8,7 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <libfdt.h>
 | 
			
		||||
#include <sbi/sbi_error.h>
 | 
			
		||||
#include <sbi/sbi_scratch.h>
 | 
			
		||||
#include <sbi_utils/fdt/fdt_helper.h>
 | 
			
		||||
#include <sbi_utils/serial/fdt_serial.h>
 | 
			
		||||
@@ -59,6 +60,8 @@ int fdt_serial_init(void)
 | 
			
		||||
 | 
			
		||||
		if (drv->init) {
 | 
			
		||||
			rc = drv->init(fdt, noff, match);
 | 
			
		||||
			if (rc == SBI_ENODEV)
 | 
			
		||||
				continue;
 | 
			
		||||
			if (rc)
 | 
			
		||||
				return rc;
 | 
			
		||||
		}
 | 
			
		||||
@@ -80,6 +83,8 @@ int fdt_serial_init(void)
 | 
			
		||||
 | 
			
		||||
		if (drv->init) {
 | 
			
		||||
			rc = drv->init(fdt, noff, match);
 | 
			
		||||
			if (rc == SBI_ENODEV)
 | 
			
		||||
				continue;
 | 
			
		||||
			if (rc)
 | 
			
		||||
				return rc;
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -7,6 +7,7 @@
 | 
			
		||||
 *   Anup Patel <anup.patel@wdc.com>
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <sbi/sbi_error.h>
 | 
			
		||||
#include <sbi/sbi_scratch.h>
 | 
			
		||||
#include <sbi_utils/fdt/fdt_helper.h>
 | 
			
		||||
#include <sbi_utils/timer/fdt_timer.h>
 | 
			
		||||
@@ -54,6 +55,8 @@ static int fdt_timer_cold_init(void)
 | 
			
		||||
					drv->match_table, &match)) >= 0) {
 | 
			
		||||
			if (drv->cold_init) {
 | 
			
		||||
				rc = drv->cold_init(fdt, noff, match);
 | 
			
		||||
				if (rc == SBI_ENODEV)
 | 
			
		||||
					continue;
 | 
			
		||||
				if (rc)
 | 
			
		||||
					return rc;
 | 
			
		||||
			}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user