From: Niek Linnenbank <nieklinnenbank@gmail.com>
To: qianfanguijin@163.com
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org,
"Strahinja Jankovic" <strahinja.p.jankovic@gmail.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Beniamino Galvani" <b.galvani@gmail.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: [PATCH v4 03/11] hw: allwinner-r40: Complete uart devices
Date: Sun, 14 May 2023 20:55:45 +0200 [thread overview]
Message-ID: <CAPan3WrHGhcTWh5R3Uw1BFuVmTLf=jbXpTKTWSz0qNx8JrPszw@mail.gmail.com> (raw)
In-Reply-To: <20230510103004.30015-4-qianfanguijin@163.com>
[-- Attachment #1: Type: text/plain, Size: 4230 bytes --]
Hi Qianfan,
On Wed, May 10, 2023 at 12:30 PM <qianfanguijin@163.com> wrote:
> From: qianfan Zhao <qianfanguijin@163.com>
>
> R40 has eight UARTs, support both 16450 and 16550 compatible modes.
>
> Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
> ---
> hw/arm/allwinner-r40.c | 31 ++++++++++++++++++++++++++++---
> include/hw/arm/allwinner-r40.h | 8 ++++++++
> 2 files changed, 36 insertions(+), 3 deletions(-)
>
> diff --git a/hw/arm/allwinner-r40.c b/hw/arm/allwinner-r40.c
> index 128c0ca470..537a90b23d 100644
> --- a/hw/arm/allwinner-r40.c
> +++ b/hw/arm/allwinner-r40.c
> @@ -45,6 +45,13 @@ const hwaddr allwinner_r40_memmap[] = {
> [AW_R40_DEV_CCU] = 0x01c20000,
> [AW_R40_DEV_PIT] = 0x01c20c00,
> [AW_R40_DEV_UART0] = 0x01c28000,
> + [AW_R40_DEV_UART1] = 0x01c28400,
> + [AW_R40_DEV_UART2] = 0x01c28800,
> + [AW_R40_DEV_UART3] = 0x01c28c00,
> + [AW_R40_DEV_UART4] = 0x01c29000,
> + [AW_R40_DEV_UART5] = 0x01c29400,
> + [AW_R40_DEV_UART6] = 0x01c29800,
> + [AW_R40_DEV_UART7] = 0x01c29c00,
>
After adding the uarts to the memory map here, you should remove them from
the unimplemented array.
[AW_R40_DEV_GIC_DIST] = 0x01c81000,
> [AW_R40_DEV_GIC_CPU] = 0x01c82000,
> [AW_R40_DEV_GIC_HYP] = 0x01c84000,
> @@ -160,6 +167,10 @@ enum {
> AW_R40_GIC_SPI_UART1 = 2,
> AW_R40_GIC_SPI_UART2 = 3,
> AW_R40_GIC_SPI_UART3 = 4,
>
Since you put the addition of UART1-7 in this patch, probably it makes
sense to have adding the lines 'AW_R40_GIC_SPI_UART1/2/3' also part of this
patch.
With the two above remarks resolved, the patch looks good to me.
Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Regards,
Niek
> + AW_R40_GIC_SPI_UART4 = 17,
> + AW_R40_GIC_SPI_UART5 = 18,
> + AW_R40_GIC_SPI_UART6 = 19,
> + AW_R40_GIC_SPI_UART7 = 20,
> AW_R40_GIC_SPI_TIMER0 = 22,
> AW_R40_GIC_SPI_TIMER1 = 23,
> AW_R40_GIC_SPI_MMC0 = 32,
> @@ -387,9 +398,23 @@ static void allwinner_r40_realize(DeviceState *dev,
> Error **errp)
> }
>
> /* UART0. For future clocktree API: All UARTS are connected to
> APB2_CLK. */
> - serial_mm_init(get_system_memory(), s->memmap[AW_R40_DEV_UART0], 2,
> - qdev_get_gpio_in(DEVICE(&s->gic),
> AW_R40_GIC_SPI_UART0),
> - 115200, serial_hd(0), DEVICE_NATIVE_ENDIAN);
> + for (int i = 0; i < AW_R40_NUM_UARTS; i++) {
> + static const int uart_irqs[AW_R40_NUM_UARTS] = {
> + AW_R40_GIC_SPI_UART0,
> + AW_R40_GIC_SPI_UART1,
> + AW_R40_GIC_SPI_UART2,
> + AW_R40_GIC_SPI_UART3,
> + AW_R40_GIC_SPI_UART4,
> + AW_R40_GIC_SPI_UART5,
> + AW_R40_GIC_SPI_UART6,
> + AW_R40_GIC_SPI_UART7,
> + };
> + const hwaddr addr = s->memmap[AW_R40_DEV_UART0 + i];
> +
> + serial_mm_init(get_system_memory(), addr, 2,
> + qdev_get_gpio_in(DEVICE(&s->gic), uart_irqs[i]),
> + 115200, serial_hd(i), DEVICE_NATIVE_ENDIAN);
> + }
>
> /* Unimplemented devices */
> for (i = 0; i < ARRAY_SIZE(r40_unimplemented); i++) {
> diff --git a/include/hw/arm/allwinner-r40.h
> b/include/hw/arm/allwinner-r40.h
> index 3be9dc962b..959b5dc4e0 100644
> --- a/include/hw/arm/allwinner-r40.h
> +++ b/include/hw/arm/allwinner-r40.h
> @@ -41,6 +41,13 @@ enum {
> AW_R40_DEV_CCU,
> AW_R40_DEV_PIT,
> AW_R40_DEV_UART0,
> + AW_R40_DEV_UART1,
> + AW_R40_DEV_UART2,
> + AW_R40_DEV_UART3,
> + AW_R40_DEV_UART4,
> + AW_R40_DEV_UART5,
> + AW_R40_DEV_UART6,
> + AW_R40_DEV_UART7,
> AW_R40_DEV_GIC_DIST,
> AW_R40_DEV_GIC_CPU,
> AW_R40_DEV_GIC_HYP,
> @@ -70,6 +77,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(AwR40State, AW_R40)
> * which are currently emulated by the R40 SoC code.
> */
> #define AW_R40_NUM_MMCS 4
> +#define AW_R40_NUM_UARTS 8
>
> struct AwR40State {
> /*< private >*/
> --
> 2.25.1
>
>
--
Niek Linnenbank
[-- Attachment #2: Type: text/html, Size: 5792 bytes --]
next prev parent reply other threads:[~2023-05-14 18:56 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-10 10:29 [PATCH v4 00/11] *** Add allwinner r40 support *** qianfanguijin
2023-05-10 10:29 ` [PATCH v4 01/11] hw: arm: Add bananapi M2-Ultra and allwinner-r40 support qianfanguijin
2023-05-14 18:38 ` Niek Linnenbank
2023-05-14 18:50 ` Niek Linnenbank
2023-05-23 1:21 ` qianfan
2023-05-10 10:29 ` [PATCH v4 02/11] hw/arm/allwinner-r40: add Clock Control Unit qianfanguijin
2023-05-14 18:40 ` Niek Linnenbank
2023-05-10 10:29 ` [PATCH v4 03/11] hw: allwinner-r40: Complete uart devices qianfanguijin
2023-05-14 18:55 ` Niek Linnenbank [this message]
2023-05-23 1:24 ` qianfan
2023-05-23 3:00 ` qianfan
2023-05-10 10:29 ` [PATCH v4 04/11] hw: arm: allwinner-r40: Add i2c0 device qianfanguijin
2023-05-14 18:57 ` Niek Linnenbank
2023-05-10 10:29 ` [PATCH v4 05/11] hw/misc: Rename axp209 to axp22x and add support AXP221 PMU qianfanguijin
2023-05-15 19:29 ` Niek Linnenbank
2023-05-23 0:40 ` qianfan
2023-05-10 10:29 ` [PATCH v4 06/11] hw/arm/allwinner-r40: add SDRAM controller device qianfanguijin
2023-05-15 19:47 ` Niek Linnenbank
2023-05-23 0:53 ` qianfan
2023-05-10 10:30 ` [PATCH v4 07/11] hw: sd: allwinner-sdhost: Add sun50i-a64 SoC support qianfanguijin
2023-05-15 19:54 ` Niek Linnenbank
2023-05-23 0:53 ` qianfan
2023-05-10 10:30 ` [PATCH v4 08/11] hw: arm: allwinner-r40: Add emac and gmac support qianfanguijin
2023-05-15 19:58 ` Niek Linnenbank
2023-05-23 1:01 ` qianfan
2023-05-10 10:30 ` [PATCH v4 09/11] hw: arm: allwinner-sramc: Add SRAM Controller support for R40 qianfanguijin
2023-05-15 20:05 ` Niek Linnenbank
2023-05-10 10:30 ` [PATCH v4 10/11] tests: avocado: boot_linux_console: Add test case for bpim2u qianfanguijin
2023-05-15 20:09 ` Niek Linnenbank
2023-05-15 20:25 ` [PATCH v4 00/11] *** Add allwinner r40 support *** Niek Linnenbank
2023-05-25 9:48 ` Peter Maydell
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='CAPan3WrHGhcTWh5R3Uw1BFuVmTLf=jbXpTKTWSz0qNx8JrPszw@mail.gmail.com' \
--to=nieklinnenbank@gmail.com \
--cc=b.galvani@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qianfanguijin@163.com \
--cc=strahinja.p.jankovic@gmail.com \
/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).