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 2344EC433F5 for ; Wed, 6 Apr 2022 14:52:20 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8711B83DD5; Wed, 6 Apr 2022 16:52:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=rock-chips.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 2A04283E01; Wed, 6 Apr 2022 16:52:15 +0200 (CEST) Received: from mail-m17664.qiye.163.com (mail-m17664.qiye.163.com [59.111.176.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1B89983DC1 for ; Wed, 6 Apr 2022 16:52:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=rock-chips.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kever.yang@rock-chips.com Received: from [192.168.0.115] (unknown [112.49.233.126]) by mail-m17664.qiye.163.com (Hmail) with ESMTPA id 8FEA51403AA; Wed, 6 Apr 2022 22:51:46 +0800 (CST) Message-ID: Date: Wed, 6 Apr 2022 22:51:46 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH v4 10/12] rockchip: serial: restyle the serial_rockchip.c driver Content-Language: en-US To: Johan Jonker Cc: sjg@chromium.org, philipp.tomsich@vrull.eu, heiko@sntech.de, peng.fan@nxp.com, jh80.chung@samsung.com, u-boot@lists.denx.de References: <20220403230659.12039-1-jbx6244@gmail.com> <20220403230659.12039-11-jbx6244@gmail.com> From: Kever Yang In-Reply-To: <20220403230659.12039-11-jbx6244@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgPGg8OCBgUHx5ZQUlOS1dZCBgUCR5ZQVlLVUtZV1 kWDxoPAgseWUFZKDYvK1lXWShZQUhPN1dZLVlBSVdZDwkaFQgSH1lBWUJCTR9WSEgdSUMaQhpMTB pCVRMBExYaEhckFA4PWVdZFhoPEhUdFFlBWU9LSFVKSktISkxVS1kG X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6Ni46GCo*KD5PHUlMUSxPIyIZ LkowChFVSlVKTU9CSU5NTEtNQkpNVTMWGhIXVRAeDR4JVQIaFRw7CRQYEFYYExILCFUYFBZFWVdZ EgtZQVlKSklVT0JVSUhIVUpJTVlXWQgBWUFPTkxINwY+ X-HM-Tid: 0a7fff5c329bda2fkuws8fea51403aa 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 On 2022/4/4 07:06, Johan Jonker wrote: > 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 Reviewed-by: Kever Yang Thanks, - Kever > --- > > 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)