From patchwork Fri May 19 10:43:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 1783720 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=denx.de header.i=@denx.de header.a=rsa-sha256 header.s=phobos-20191101 header.b=GOESLO55; dkim=pass (2048-bit key) header.d=denx.de header.i=@denx.de header.a=rsa-sha256 header.s=phobos-20191101 header.b=jBq+pzTt; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QN3Rr6w8cz20dX for ; Fri, 19 May 2023 20:46:32 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 51A218631E; Fri, 19 May 2023 12:44:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1684493092; bh=1+MHIzySg3SkL5Cv9x6Uid2u3Wa5wr76bb7EN/aoU+M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=GOESLO55csTF2lMs0ZcrO/75nioW6W7z6yagG8exjxIPujoj1rbq855kgxuBHzQwJ UP+qFGWpKVleAQq1jRiNgmI+0Bvy3zqK7vJrkdkYY68pxilZQOYlbqdI6XSQjig+LT QjwPbqE/XqSZxeJKHoiJhfIZiU25sE7vVH+iEjw16ubwqIgMv3Pz18t6UzbjfVLrE1 fyVGm2mLgx/7l/a/gu+HKWK+BEGsD4PzWZBFVqWNkekGCvQgyldiS9LNSGs+cxLZ6q hgB4SpCwtvtPt4Rfb64+sVp5er7Z13/sQ/A1QEukVJVmt2R5qeZCvv15ve5JsjGAYK 9Ffn+GxVXm0Sw== Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: lukma@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 096C0862F7; Fri, 19 May 2023 12:44:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1684493072; bh=1+MHIzySg3SkL5Cv9x6Uid2u3Wa5wr76bb7EN/aoU+M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jBq+pzTtWGL3OXmVxOWW98sin3RF+oRzht7ccVVHrvneimCVVMFYNnWt5r0quDp75 8zAP2dttCEOpKR+n+eZaceThD9SEWNQc+JOwGtJElxcj/GTgxeyBARWUeSxTsyPuW6 5L5qvK4lUOEHEHxMzYsYYhEX+i2J4vm7OJfFP7iHMvV1KFMUHuRlGBO00B2q3rKvBp TX2J1WnDkQuodr8M5GcEOTw93oWKPCYysSIe8HRCuBop807fH/Kspn+S6a6RhZKtAZ /r9lr+QC07V7HBYHdCiP1asDz9Xeozg7Y+UqylWHFIka3t7brdR5u0Mb0d5vYva3NN DkWJb09nkeXSA== From: Lukasz Majewski To: Stefano Babic , Fabio Estevam , Tom Rini , u-boot@lists.denx.de, Marek Vasut , NXP u-boot Cc: Lukasz Majewski , =?utf-8?q?Pali_Roh=C3=A1r?= , Simon Glass , Stefan Roese Subject: [PATCH v1 10/16] serial: pl01x: Prepare the driver to support SPL_OF_PLATDATA Date: Fri, 19 May 2023 12:43:52 +0200 Message-Id: <20230519104359.2048821-11-lukma@denx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230519104359.2048821-1-lukma@denx.de> References: <20230519104359.2048821-1-lukma@denx.de> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean This commit prepares the pl01x serial driver to be used with SPL_OF_PLATDATA enabled. Signed-off-by: Lukasz Majewski --- drivers/serial/serial_pl01x.c | 12 ++++++++++++ include/dm/platform_data/serial_pl01x.h | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/drivers/serial/serial_pl01x.c b/drivers/serial/serial_pl01x.c index 18332c2192..dbf2b2df34 100644 --- a/drivers/serial/serial_pl01x.c +++ b/drivers/serial/serial_pl01x.c @@ -291,8 +291,16 @@ int pl01x_serial_probe(struct udevice *dev) struct pl01x_serial_plat *plat = dev_get_plat(dev); struct pl01x_priv *priv = dev_get_priv(dev); +#if CONFIG_IS_ENABLED(OF_PLATDATA) + struct dtd_serial_pl01x *dtplat = &plat->dtplat; + + priv->regs = (struct pl01x_regs *)dtplat->reg[0]; + plat->type = dtplat->type; +#else priv->regs = (struct pl01x_regs *)plat->base; +#endif priv->type = plat->type; + if (!plat->skip_init) return pl01x_generic_serial_init(priv->regs, priv->type); else @@ -380,8 +388,10 @@ int pl01x_serial_of_to_plat(struct udevice *dev) U_BOOT_DRIVER(serial_pl01x) = { .name = "serial_pl01x", .id = UCLASS_SERIAL, +#if CONFIG_IS_ENABLED(OF_REAL) .of_match = of_match_ptr(pl01x_serial_id), .of_to_plat = of_match_ptr(pl01x_serial_of_to_plat), +#endif .plat_auto = sizeof(struct pl01x_serial_plat), .probe = pl01x_serial_probe, .ops = &pl01x_serial_ops, @@ -389,6 +399,8 @@ U_BOOT_DRIVER(serial_pl01x) = { .priv_auto = sizeof(struct pl01x_priv), }; +DM_DRIVER_ALIAS(serial_pl01x, arm_pl011) +DM_DRIVER_ALIAS(serial_pl01x, arm_pl010) #endif #if defined(CONFIG_DEBUG_UART_PL010) || defined(CONFIG_DEBUG_UART_PL011) diff --git a/include/dm/platform_data/serial_pl01x.h b/include/dm/platform_data/serial_pl01x.h index e3d4e308a1..811697ce5c 100644 --- a/include/dm/platform_data/serial_pl01x.h +++ b/include/dm/platform_data/serial_pl01x.h @@ -20,7 +20,11 @@ enum pl01x_type { * @skip_init: Don't attempt to change port configuration (also means @clock * is ignored) */ +#include struct pl01x_serial_plat { +#if CONFIG_IS_ENABLED(OF_PLATDATA) + struct dtd_serial_pl01x dtplat; +#endif unsigned long base; enum pl01x_type type; unsigned int clock;