All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [U-Boot, v2, 6/6] dm: sunxi: Add support for serial using driver model
Date: Fri, 24 Oct 2014 11:10:19 +0200	[thread overview]
Message-ID: <544A177B.4050006@redhat.com> (raw)
In-Reply-To: <1414036962-28463-7-git-send-email-sjg@chromium.org>

Hi,

On 10/23/2014 06:02 AM, Simon Glass wrote:
> Add a driver for the designware serial UART used on sunxi. This just
> redirects to the normal ns16550 driver.
> 
> Add a stdout-path to the device tree so that the correct UART is chosen.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Looks good:

Acked-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans

> ---
> 
> Changes in v2:
> - Split non-sunxi patches into a separate dependent series
> 
>  arch/arm/dts/sun7i-a20-pcduino3.dts |  4 ++++
>  drivers/serial/Makefile             |  1 +
>  drivers/serial/serial_dw.c          | 39 +++++++++++++++++++++++++++++++++++++
>  include/configs/sun7i.h             |  3 +++
>  include/configs/sunxi-common.h      | 12 +++++++-----
>  5 files changed, 54 insertions(+), 5 deletions(-)
>  create mode 100644 drivers/serial/serial_dw.c
> 
> diff --git a/arch/arm/dts/sun7i-a20-pcduino3.dts b/arch/arm/dts/sun7i-a20-pcduino3.dts
> index 046dfc0..f7cc8e7 100644
> --- a/arch/arm/dts/sun7i-a20-pcduino3.dts
> +++ b/arch/arm/dts/sun7i-a20-pcduino3.dts
> @@ -20,6 +20,10 @@
>  	model = "LinkSprite pcDuino3";
>  	compatible = "linksprite,pcduino3", "allwinner,sun7i-a20";
>  
> +	chosen {
> +		stdout-path = &uart0;
> +	};
> +
>  	soc at 01c00000 {
>  		mmc0: mmc at 01c0f000 {
>  			pinctrl-names = "default";
> diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
> index cd87d18..588573a 100644
> --- a/drivers/serial/Makefile
> +++ b/drivers/serial/Makefile
> @@ -19,6 +19,7 @@ obj-$(CONFIG_ALTERA_UART) += altera_uart.o
>  obj-$(CONFIG_ALTERA_JTAG_UART) += altera_jtag_uart.o
>  obj-$(CONFIG_ARM_DCC) += arm_dcc.o
>  obj-$(CONFIG_ATMEL_USART) += atmel_usart.o
> +obj-$(CONFIG_DW_SERIAL) += serial_dw.o
>  obj-$(CONFIG_LPC32XX_HSUART) += lpc32xx_hsuart.o
>  obj-$(CONFIG_MCFUART) += mcfuart.o
>  obj-$(CONFIG_OPENCORES_YANU) += opencores_yanu.o
> diff --git a/drivers/serial/serial_dw.c b/drivers/serial/serial_dw.c
> new file mode 100644
> index 0000000..a348f29
> --- /dev/null
> +++ b/drivers/serial/serial_dw.c
> @@ -0,0 +1,39 @@
> +/*
> + * Copyright (c) 2014 Google, Inc
> + *
> + * SPDX-License-Identifier:	GPL-2.0+
> + */
> +
> +#include <common.h>
> +#include <dm.h>
> +#include <ns16550.h>
> +#include <serial.h>
> +
> +static const struct udevice_id dw_serial_ids[] = {
> +	{ .compatible = "snps,dw-apb-uart" },
> +	{ }
> +};
> +
> +static int dw_serial_ofdata_to_platdata(struct udevice *dev)
> +{
> +	struct ns16550_platdata *plat = dev_get_platdata(dev);
> +	int ret;
> +
> +	ret = ns16550_serial_ofdata_to_platdata(dev);
> +	if (ret)
> +		return ret;
> +	plat->clock = CONFIG_SYS_NS16550_CLK;
> +
> +	return 0;
> +}
> +
> +U_BOOT_DRIVER(serial_ns16550) = {
> +	.name	= "serial_dw",
> +	.id	= UCLASS_SERIAL,
> +	.of_match = dw_serial_ids,
> +	.ofdata_to_platdata = dw_serial_ofdata_to_platdata,
> +	.platdata_auto_alloc_size = sizeof(struct ns16550_platdata),
> +	.priv_auto_alloc_size = sizeof(struct NS16550),
> +	.probe = ns16550_serial_probe,
> +	.ops	= &ns16550_serial_ops,
> +};
> diff --git a/include/configs/sun7i.h b/include/configs/sun7i.h
> index 2314e97..108694a 100644
> --- a/include/configs/sun7i.h
> +++ b/include/configs/sun7i.h
> @@ -39,6 +39,9 @@
>  #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_DM)
>  # define CONFIG_CMD_DM
>  # define CONFIG_DM_GPIO
> +# define CONFIG_DM_SERIAL
> +# define CONFIG_SYS_MALLOC_F_LEN	(1 << 10)
> +# define CONFIG_DW_SERIAL
>  #endif
>  
>  /*
> diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
> index 1d947d7..e26bdf9 100644
> --- a/include/configs/sunxi-common.h
> +++ b/include/configs/sunxi-common.h
> @@ -36,12 +36,14 @@
>  #define CONFIG_SYS_NS16550
>  #define CONFIG_SYS_NS16550_SERIAL
>  /* ns16550 reg in the low bits of cpu reg */
> -#define CONFIG_SYS_NS16550_REG_SIZE	-4
>  #define CONFIG_SYS_NS16550_CLK		24000000
> -#define CONFIG_SYS_NS16550_COM1		SUNXI_UART0_BASE
> -#define CONFIG_SYS_NS16550_COM2		SUNXI_UART1_BASE
> -#define CONFIG_SYS_NS16550_COM3		SUNXI_UART2_BASE
> -#define CONFIG_SYS_NS16550_COM4		SUNXI_UART3_BASE
> +#ifndef CONFIG_DM_SERIAL
> +# define CONFIG_SYS_NS16550_REG_SIZE	-4
> +# define CONFIG_SYS_NS16550_COM1		SUNXI_UART0_BASE
> +# define CONFIG_SYS_NS16550_COM2		SUNXI_UART1_BASE
> +# define CONFIG_SYS_NS16550_COM3		SUNXI_UART2_BASE
> +# define CONFIG_SYS_NS16550_COM4		SUNXI_UART3_BASE
> +#endif
>  
>  /* DRAM Base */
>  #define CONFIG_SYS_SDRAM_BASE		0x40000000
> 

  reply	other threads:[~2014-10-24  9:10 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-23  4:02 [U-Boot] [PATCH v2 0/6] dm: Introduce driver model for sunxi Simon Glass
2014-10-23  4:02 ` [U-Boot] [PATCH v2 1/6] dm: sunxi: dts: Add sun7i device tree files Simon Glass
2014-10-24  8:32   ` [U-Boot] [U-Boot, v2, " Hans de Goede
2014-10-28  1:05     ` Simon Glass
2014-10-23  4:02 ` [U-Boot] [PATCH v2 2/6] dm: sunxi: Add a new config for an FDT-based pcDuino3 Simon Glass
2014-10-24  8:38   ` [U-Boot] [U-Boot, v2, " Hans de Goede
2014-10-28  0:04     ` Simon Glass
2014-10-28  9:13       ` Hans de Goede
2014-10-29  3:02         ` Simon Glass
2014-10-29  9:32           ` Hans de Goede
2014-10-29 19:30             ` Simon Glass
2014-10-30  8:36               ` Hans de Goede
2014-10-23  4:02 ` [U-Boot] [PATCH v2 3/6] dm: sunxi: Add pinmux functions which take a bank parameter Simon Glass
2014-10-24  9:00   ` [U-Boot] [U-Boot, v2, " Hans de Goede
2014-10-23  4:02 ` [U-Boot] [PATCH v2 4/6] dm: sunxi: Make sure that GPIOs are requested Simon Glass
2014-10-24  9:01   ` [U-Boot] [U-Boot, v2, " Hans de Goede
2014-10-23  4:02 ` [U-Boot] [PATCH v2 5/6] dm: sunxi: Modify the GPIO driver to support driver model Simon Glass
2014-10-24  9:08   ` [U-Boot] [U-Boot, v2, " Hans de Goede
2014-10-28  0:05     ` Simon Glass
2014-10-28  2:53       ` Chen-Yu Tsai
2014-10-28  3:29         ` Simon Glass
2014-10-28  3:39           ` Chen-Yu Tsai
2014-10-28 14:30             ` Maxime Ripard
2014-10-23  4:02 ` [U-Boot] [PATCH v2 6/6] dm: sunxi: Add support for serial using " Simon Glass
2014-10-24  9:10   ` Hans de Goede [this message]
2014-10-24  9:42   ` Ian Campbell
2014-10-28  0:06     ` Simon Glass
2014-10-29  8:05       ` Ian Campbell
2014-10-29 19:28         ` Simon Glass
2014-10-30  9:08           ` Ian Campbell
2014-10-30  9:36             ` Hans de Goede
2014-10-30 10:14               ` Ian Campbell
2014-10-31  2:45                 ` Simon Glass
2014-10-31  9:07                 ` Hans de Goede
2014-10-31  9:30                   ` Ian Campbell
2014-10-31  9:33                     ` Hans de Goede
2014-10-31  9:55                       ` Ian Campbell

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=544A177B.4050006@redhat.com \
    --to=hdegoede@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.