u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@arm.com>
To: Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.denx.de, Simon Glass <sjg@chromium.org>,
	Sergei Antonov <saproj@gmail.com>,
	Quentin Schulz <quentin.schulz@theobroma-systems.com>
Subject: Re: [PATCHv2 05/19] dm: ns16550: Restore how we define UART_REG
Date: Tue, 17 Jan 2023 23:34:04 +0000	[thread overview]
Message-ID: <20230117233404.20913d18@slackpad.lan> (raw)
In-Reply-To: <20230117221050.630746-1-trini@konsulko.com>

On Tue, 17 Jan 2023 17:10:50 -0500
Tom Rini <trini@konsulko.com> wrote:

> Prior to commit 9591b63531fa ("Convert CONFIG_SYS_NS16550_MEM32 et al to
> Kconfig") we had defined CONFIG_SYS_NS16550_REG_SIZE to -1 with
> DM_SERIAL such that we would then have a size 0 character array. This
> resulted in functionally no padding. The confusion on my part came from
> dealing with the constraints around platforms that do not use DM_SERIAL
> in SPL/TPL. After Andre Przywara reported that sunxi was broken, I've
> re-read the code and comments again and thought on this harder. What we
> want I believe is what this patch does now.
> 
> If DM_SERIAL is defined for this stage, regardless of
> CONFIG_SYS_NS16550_REG_SIZE then we will dynamically handle reg shifts
> and 'struct ns16550' needs no padding (which is functionally what
> unsigned char foo[0] provides). This is the same case as NS16550_DYNAMIC
> and DEBUG_UART. Expand the existing comment here slightly.
> 
> Otherwise, we will have CONFIG_SYS_NS16550_REG_SIZE set to a non-zero
> value, and handle padding within the struct.
> 
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Sergei Antonov <saproj@gmail.com>
> Cc: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> Cc: Andre Przywara <andre.przywara@arm.com>
> Fixes: 9591b63531fa ("Convert CONFIG_SYS_NS16550_MEM32 et al to Kconfig")
> Signed-off-by: Tom Rini <trini@konsulko.com>

Thanks, that indeed fixes the issue for me, booted on LicheePi Nano and
Pine64-LTS:

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Andre Przywara <andre.przywara@arm.com>

Cheers,
Andre

> ---
>  include/ns16550.h | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/include/ns16550.h b/include/ns16550.h
> index 243226fc3d94..e7e68663d030 100644
> --- a/include/ns16550.h
> +++ b/include/ns16550.h
> @@ -26,15 +26,13 @@
>  
>  #include <linux/types.h>
>  
> -#if CONFIG_IS_ENABLED(DM_SERIAL) && !defined(CONFIG_SYS_NS16550_REG_SIZE)
> +#if CONFIG_IS_ENABLED(DM_SERIAL) ||  defined(CONFIG_NS16550_DYNAMIC) || \
> +	defined(CONFIG_DEBUG_UART)
>  /*
>   * For driver model we always use one byte per register, and sort out the
> - * differences in the driver
> + * differences in the driver. In the case of CONFIG_NS16550_DYNAMIC we do
> + * similar, and CONFIG_DEBUG_UART is responsible for shifts in its own manner.
>   */
> -#define CONFIG_SYS_NS16550_REG_SIZE (-1)
> -#endif
> -
> -#if defined(CONFIG_NS16550_DYNAMIC) || defined(CONFIG_DEBUG_UART)
>  #define UART_REG(x)	unsigned char x
>  #else
>  #if !defined(CONFIG_SYS_NS16550_REG_SIZE) || (CONFIG_SYS_NS16550_REG_SIZE == 0)


  reply	other threads:[~2023-01-17 23:36 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-10 16:19 [PATCH 01/19] global: Remove unused CONFIG defines Tom Rini
2023-01-10 16:19 ` [PATCH 02/19] arc: Migrate ARC_MMU_VER to Kconfig Tom Rini
2023-01-10 16:19 ` [PATCH 03/19] i2c: fsl_i2c: Rework usage of CONFIG_SYS_IMMR Tom Rini
2023-01-10 16:19 ` [PATCH 04/19] arm: Rework usage of CONFIG_ARMV[78]_SECURE_BASE in linker scripts Tom Rini
2023-01-10 16:19 ` [PATCH 05/19] dm: ns16550: Change how we get UART_REG to be defined Tom Rini
2023-01-11  0:15   ` Simon Glass
2023-01-17 22:10   ` [PATCHv2 05/19] dm: ns16550: Restore how we define UART_REG Tom Rini
2023-01-17 23:34     ` Andre Przywara [this message]
2023-01-18 14:15     ` Quentin Schulz
2023-01-10 16:19 ` [PATCH 06/19] arm: lib1funcs.S: Update compatibility with Linux comment slightly Tom Rini
2023-01-10 16:19 ` [PATCH 07/19] autoboot: Rework CONFIG_AUTOBOOT_STOP_STR_* usage Tom Rini
2023-01-10 16:19 ` [PATCH 08/19] spl: sata: Rework the loading case it not use IS_ENABLED(...) Tom Rini
2023-01-10 16:19 ` [PATCH 09/19] common/update: Finish Kconfig migration Tom Rini
2023-01-10 16:19 ` [PATCH 10/19] fpga: Migrate CONFIG_MAX_FPGA_DEVICES to Kconfig Tom Rini
2023-01-11  8:17   ` Michal Simek
2023-01-10 16:19 ` [PATCH 11/19] usb: musb: Rename CONFIG_USB_MUSB_TIMEOUT to MUSB_TIMEOUT Tom Rini
2023-01-10 17:20   ` Marek Vasut
2023-01-10 16:19 ` [PATCH 12/19] fsl-layerscape: Rework usage of CONFIG_CLUSTER_CLK_FREQ Tom Rini
2023-01-10 16:19 ` [PATCH 13/19] net: phy: mv88e61xx: Finish migration of MV88E61XX_FIXED_PORTS Tom Rini
2023-01-10 17:11   ` Ramon Fried
2023-01-10 16:19 ` [PATCH 14/19] nxp: Finish migration of SYS_FSL_IFC_BANK_COUNT to Kconfig Tom Rini
2023-01-10 16:19 ` [PATCH 15/19] nxp: Finish migration of SYS_FSL_SRDS_[12] " Tom Rini
2023-01-10 16:19 ` [PATCH 16/19] usbtty: Remove default CONFIG_USBD_* values Tom Rini
2023-01-10 16:19 ` [PATCH 17/19] watchdog: Clean up defaults for imx_watchdog / ulp_wdog Tom Rini
2023-01-10 16:54   ` Stefan Roese
2023-01-10 16:19 ` [PATCH 18/19] global: Finish CONFIG -> CFG migration Tom Rini
2023-01-11  0:15   ` Simon Glass
2023-01-10 16:19 ` [PATCH 19/19] CI: Make check for new defined CONFIG symbols even more robust Tom Rini
2023-01-11  0:15   ` Simon Glass
2023-01-20 23:21 ` [PATCH 01/19] global: Remove unused CONFIG defines Tom Rini

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=20230117233404.20913d18@slackpad.lan \
    --to=andre.przywara@arm.com \
    --cc=quentin.schulz@theobroma-systems.com \
    --cc=saproj@gmail.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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;
as well as URLs for NNTP newsgroup(s).