Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EE5E3C433EF for ; Sun, 3 Apr 2022 23:11:06 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id ED93E83C8F; Mon, 4 Apr 2022 01:08:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="mUCujZCQ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E21FB83C27; Mon, 4 Apr 2022 01:07:40 +0200 (CEST) Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0A59283BEF for ; Mon, 4 Apr 2022 01:07:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jbx6244@gmail.com Received: by mail-ej1-x632.google.com with SMTP id i27so9355603ejd.9 for ; Sun, 03 Apr 2022 16:07:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Y6C4AwT6WidLXmSNzq88zfmHiYg7bNFD01fXGcXX2Tw=; b=mUCujZCQCxzYGSH+Nj6uIBo/GuVjTpjFhUGLasr2SVF6XbjDmtZcs9vD0h16rgG54N pp1TvcuFC1D8mQl/X1Il8p3JB9GXHfvVF+U5eWKc02GUl6L/diLG8HqUbfuKJ/IKD1Tw h5crtZvAGayO/YnFlU2o5BX7V7TpE8rEz8fsnCpZhsYk64VVJ4izqqLaYBCWrSLrPpnW CB/aDCwFdB4PrOhcBzdHVn6lt+9wzSgzG1jm+UUE9p/Q5O0T+0d/M7b19jzF0wHg2jnv o5wBsQL5xc4WOa7mJFg2EbRUMyVD5ADfbnpuizRshMYUWLZ6om2mWqo6OVUOqXrHSzZY +H9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Y6C4AwT6WidLXmSNzq88zfmHiYg7bNFD01fXGcXX2Tw=; b=wZaPzit4Nkl5+br/G0x/CCmp16ZhBGaxwF510JhoY2AyyAZi9hwZaBbWIFq6pdW0GV 4QSw5q8SgxgSDzP0txxmwV+fT2B38y/gtAcKyLtj5KbtNi6srOFTJsDyEY5hcXAM2qIP HRGvOYxAY2G2f0z7VtTGgIKHhqd9OBYrnPtHgBdfZbX1yGvlM1N55dcn2zqttDeoQrMX ZoF3HO7pvNpTe25Ax3pogsnLNNAgMUVIRyX7twyWca2CeZcZ0RkQ+l+sGEIYbMlQtc3m oLMKmTTwwrG0/2GUc5W6852MiS8rInRKj5ePqwVrlfEbcYtT2T5OvrwPwP5vgBpMIaQP LRXQ== X-Gm-Message-State: AOAM532IsAFSaaVv3VwH0sfGp6AF7mw40kdNcXe7mlZWAeRcccthb0Hg umkq16D42U887c/7B+eHMdg= X-Google-Smtp-Source: ABdhPJx6bKABdIZWOvAbB0fVlzlQqmTqJ4g9o59T/8qWi2Fh+/MfQsn4mdU2AyMPQoYLsh/msO/uYw== X-Received: by 2002:a17:907:6e88:b0:6da:8f01:7a8f with SMTP id sh8-20020a1709076e8800b006da8f017a8fmr8538881ejc.619.1649027232593; Sun, 03 Apr 2022 16:07:12 -0700 (PDT) Received: from debian.home (81-204-249-205.fixed.kpn.net. [81.204.249.205]) by smtp.gmail.com with ESMTPSA id c14-20020a170906340e00b006ce98f2581asm3645597ejb.205.2022.04.03.16.07.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Apr 2022 16:07:12 -0700 (PDT) From: Johan Jonker To: kever.yang@rock-chips.com Cc: sjg@chromium.org, philipp.tomsich@vrull.eu, heiko@sntech.de, peng.fan@nxp.com, jh80.chung@samsung.com, u-boot@lists.denx.de Subject: [PATCH v4 10/12] rockchip: serial: restyle the serial_rockchip.c driver Date: Mon, 4 Apr 2022 01:06:57 +0200 Message-Id: <20220403230659.12039-11-jbx6244@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220403230659.12039-1-jbx6244@gmail.com> References: <20220403230659.12039-1-jbx6244@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.5 at phobos.denx.de X-Virus-Status: Clean The ns16550.c driver has the following conditions for .of_match: CONFIG_IS_ENABLED(OF_REAL) For Rockchip SoCs with TPL/SPL and platform data that need serial support the serial_rockchip.c driver was made. It copies this data and then calls ns16550_serial_probe(). With the addition of yet an other SoC type this driver is in need for a little restyle. Simplify struct rockchip_uart_plat and add extra SoCs with DM_DRIVER_ALIAS(). Return -ENODEV when the ns16550.c driver probe function is available. Signed-off-by: Johan Jonker Reviewed-by: Simon Glass --- Changed V4: add empty line --- drivers/serial/serial_rockchip.c | 37 +++++++++++++------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/drivers/serial/serial_rockchip.c b/drivers/serial/serial_rockchip.c index 97d40869a2..f5ac705f4d 100644 --- a/drivers/serial/serial_rockchip.c +++ b/drivers/serial/serial_rockchip.c @@ -12,22 +12,20 @@ #include #include -#if defined(CONFIG_ROCKCHIP_RK3188) -struct rockchip_uart_plat { - struct dtd_rockchip_rk3188_uart dtplat; - struct ns16550_plat plat; -}; -struct dtd_rockchip_rk3188_uart *dtplat, s_dtplat; -#elif defined(CONFIG_ROCKCHIP_RK3288) struct rockchip_uart_plat { +#if CONFIG_IS_ENABLED(OF_PLATDATA) struct dtd_rockchip_rk3288_uart dtplat; +#endif struct ns16550_plat plat; }; + +#if CONFIG_IS_ENABLED(OF_PLATDATA) struct dtd_rockchip_rk3288_uart *dtplat, s_dtplat; #endif static int rockchip_serial_probe(struct udevice *dev) { +#if CONFIG_IS_ENABLED(OF_PLATDATA) struct rockchip_uart_plat *plat = dev_get_plat(dev); /* Create some new platform data for the standard driver */ @@ -38,24 +36,19 @@ static int rockchip_serial_probe(struct udevice *dev) dev_set_plat(dev, &plat->plat); return ns16550_serial_probe(dev); +#else + return -ENODEV; +#endif } -U_BOOT_DRIVER(rockchip_rk3188_uart) = { - .name = "rockchip_rk3188_uart", - .id = UCLASS_SERIAL, - .priv_auto = sizeof(struct ns16550), - .plat_auto = sizeof(struct rockchip_uart_plat), - .probe = rockchip_serial_probe, - .ops = &ns16550_serial_ops, - .flags = DM_FLAG_PRE_RELOC, -}; - U_BOOT_DRIVER(rockchip_rk3288_uart) = { - .name = "rockchip_rk3288_uart", - .id = UCLASS_SERIAL, + .name = "rockchip_rk3288_uart", + .id = UCLASS_SERIAL, .priv_auto = sizeof(struct ns16550), .plat_auto = sizeof(struct rockchip_uart_plat), - .probe = rockchip_serial_probe, - .ops = &ns16550_serial_ops, - .flags = DM_FLAG_PRE_RELOC, + .probe = rockchip_serial_probe, + .ops = &ns16550_serial_ops, + .flags = DM_FLAG_PRE_RELOC, }; +DM_DRIVER_ALIAS(rockchip_rk3288_uart, rockchip_rk3066_uart) +DM_DRIVER_ALIAS(rockchip_rk3288_uart, rockchip_rk3188_uart) -- 2.20.1