Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * OF console routines
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  * Copyright (C) Paul Mackerras 1997.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #include <stddef.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #include "types.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #include "elf.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include "string.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include "stdio.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include "page.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include "ops.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include "of.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) static unsigned int of_stdout_handle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) static int of_console_open(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	void *devp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	if (((devp = of_finddevice("/chosen")) != NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	    && (of_getprop(devp, "stdout", &of_stdout_handle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 			   sizeof(of_stdout_handle))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 		== sizeof(of_stdout_handle))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 		of_stdout_handle = be32_to_cpu(of_stdout_handle);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) static void of_console_write(const char *buf, int len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	of_call_prom("write", 3, 1, of_stdout_handle, buf, len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) void of_console_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	console_ops.open = of_console_open;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	console_ops.write = of_console_write;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) }