public inbox for opensbi@lists.infradead.org
 help / color / mirror / Atom feed
From: "Manuel Hernández | OPENCHIP" <manuel.hernandez@openchip.com>
To: "opensbi@lists.infradead.org" <opensbi@lists.infradead.org>
Cc: "Manuel Hernández | OPENCHIP" <manuel.hernandez@openchip.com>
Subject: [PATCH] platform: openpiton: use generic early init
Date: Fri, 7 Nov 2025 07:54:42 +0000	[thread overview]
Message-ID: <20251107075429.1382-1-manuel.hernandez@openchip.com> (raw)

From: Manuel Hernández Méndez <manuel.hernandez@openchip.com>

Add code for using generic_early_init,
so the uart parameters are parsed from dtb.

Signed-off-by: Manuel Hernández Méndez <manuel.hernandez@openchip.com>
---
 platform/generic/openhwgroup/openpiton.c | 25 +++---------------------
 1 file changed, 3 insertions(+), 22 deletions(-)

diff --git a/platform/generic/openhwgroup/openpiton.c b/platform/generic/openhwgroup/openpiton.c
index 3be66de6..60d719e1 100644
--- a/platform/generic/openhwgroup/openpiton.c
+++ b/platform/generic/openhwgroup/openpiton.c
@@ -8,16 +8,8 @@
 #include <sbi_utils/fdt/fdt_fixup.h>
 #include <sbi_utils/ipi/aclint_mswi.h>
 #include <sbi_utils/irqchip/plic.h>
-#include <sbi_utils/serial/uart8250.h>
 #include <sbi_utils/timer/aclint_mtimer.h>
 
-#define OPENPITON_DEFAULT_UART_ADDR		0xfff0c2c000ULL
-#define OPENPITON_DEFAULT_UART_FREQ		60000000
-#define OPENPITON_DEFAULT_UART_BAUDRATE		115200
-#define OPENPITON_DEFAULT_UART_REG_SHIFT	0
-#define OPENPITON_DEFAULT_UART_REG_WIDTH	1
-#define OPENPITON_DEFAULT_UART_REG_OFFSET	0
-#define OPENPITON_DEFAULT_UART_CAPS		0
 #define OPENPITON_DEFAULT_PLIC_ADDR		0xfff1100000ULL
 #define OPENPITON_DEFAULT_PLIC_SIZE		(0x200000 + \
 				(OPENPITON_DEFAULT_HART_COUNT * 0x1000))
@@ -30,11 +22,6 @@
 #define OPENPITON_DEFAULT_ACLINT_MTIMER_ADDR	\
 		(OPENPITON_DEFAULT_CLINT_ADDR + CLINT_MTIMER_OFFSET)
 
-static struct platform_uart_data uart = {
-	(unsigned long)OPENPITON_DEFAULT_UART_ADDR,
-	OPENPITON_DEFAULT_UART_FREQ,
-	OPENPITON_DEFAULT_UART_BAUDRATE,
-};
 static struct plic_data plic = {
 	.addr = (unsigned long)OPENPITON_DEFAULT_PLIC_ADDR,
 	.size = OPENPITON_DEFAULT_PLIC_SIZE,
@@ -73,7 +60,6 @@ static struct aclint_mtimer_data mtimer = {
 static int openpiton_early_init(bool cold_boot)
 {
 	const void *fdt;
-	struct platform_uart_data uart_data = { 0 };
 	struct plic_data plic_data = plic;
 	unsigned long aclint_freq;
 	uint64_t clint_addr;
@@ -83,9 +69,9 @@ static int openpiton_early_init(bool cold_boot)
 		return 0;
 	fdt = fdt_get_address();
 
-	rc = fdt_parse_uart8250(fdt, &uart_data, "ns16550");
-	if (!rc)
-		uart = uart_data;
+	rc = generic_early_init(cold_boot);
+	if (rc)
+		return rc;
 
 	rc = fdt_parse_plic(fdt, &plic_data, "riscv,plic0");
 	if (!rc)
@@ -104,11 +90,6 @@ static int openpiton_early_init(bool cold_boot)
 				    ACLINT_DEFAULT_MTIMECMP_OFFSET;
 	}
 
-	rc = uart8250_init(uart.addr, uart.freq, uart.baud,
-			   OPENPITON_DEFAULT_UART_REG_SHIFT,
-			   OPENPITON_DEFAULT_UART_REG_WIDTH,
-			   OPENPITON_DEFAULT_UART_REG_OFFSET,
-			   OPENPITON_DEFAULT_UART_CAPS);
 	if (rc)
 		return rc;
 
-- 
2.34.1

-- 
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi

             reply	other threads:[~2025-11-07  7:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-07  7:54 Manuel Hernández | OPENCHIP [this message]
2025-12-01  5:14 ` [PATCH] platform: openpiton: use generic early init Anup Patel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251107075429.1382-1-manuel.hernandez@openchip.com \
    --to=manuel.hernandez@openchip.com \
    --cc=opensbi@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox