mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Holger Assmann <h.assmann@pengutronix.de>
Cc: barebox@lists.infradead.org, "Leonard Göhrs" <l.goehrs@pengutronix.de>
Subject: Re: [PATCH] ARM: i.MX8MP: add TQ mba8mpxl board
Date: Mon, 24 Oct 2022 14:32:39 +0200	[thread overview]
Message-ID: <20221024123239.GN6702@pengutronix.de> (raw)
In-Reply-To: <20221024120952.2162839-1-h.assmann@pengutronix.de>

On Mon, Oct 24, 2022 at 02:09:52PM +0200, Holger Assmann wrote:
> This commit adds support for the TQ MBa8MPxL with TQMa8MPxL module with
> i.MX8M Plus Quad/Dual SoC. This very combination results in configuration
> symbol "MACH_TQ_MBA8MPXL". A possible variant based on i.MX8M Plus Dual
> would be supported transparently, once barebox deleted the CPU nodes
> when it detects that they were fused away. It already does so for
> i.MX8MM and i.MX8MN.
> 
> We use the respective Linux upstream device trees and their implications
> regarding hardware support.
> 
> Known to be unsupported for now is the second Ethernet interface around
> the eqos dwmac IP. This has to be resolved by porting over the fitting
> wrapper from Linux.
> 
> Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
> Signed-off-by: Holger Assmann <h.assmann@pengutronix.de>
> ---
>  arch/arm/boards/Makefile                      |    1 +
>  arch/arm/boards/mba8mpxl/Makefile             |    4 +
>  arch/arm/boards/mba8mpxl/board.c              |   54 +
>  .../mba8mpxl/flash-header-tqma8mpxl.imxcfg    |    7 +
>  arch/arm/boards/mba8mpxl/lowlevel.c           |  111 +
>  arch/arm/boards/mba8mpxl/lpddr4-timing.c      | 1856 +++++++++++++++++
>  arch/arm/dts/Makefile                         |    1 +
>  arch/arm/dts/imx8mp-tqma8mpql-mba8mpxl.dts    |   59 +
>  arch/arm/mach-imx/Kconfig                     |   10 +
>  images/Makefile.imx                           |    5 +
>  10 files changed, 2108 insertions(+)
>  create mode 100644 arch/arm/boards/mba8mpxl/Makefile
>  create mode 100644 arch/arm/boards/mba8mpxl/board.c
>  create mode 100644 arch/arm/boards/mba8mpxl/flash-header-tqma8mpxl.imxcfg
>  create mode 100644 arch/arm/boards/mba8mpxl/lowlevel.c
>  create mode 100644 arch/arm/boards/mba8mpxl/lpddr4-timing.c
>  create mode 100644 arch/arm/dts/imx8mp-tqma8mpql-mba8mpxl.dts
> 
> diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
> index a0e84c24d7..9db3669a5e 100644
> --- a/arch/arm/boards/Makefile
> +++ b/arch/arm/boards/Makefile
> @@ -91,6 +91,7 @@ obj-$(CONFIG_MACH_NXP_IMX8MQ_EVK)		+= nxp-imx8mq-evk/
>  obj-$(CONFIG_MACH_NXP_IMX8MM_EVK)		+= nxp-imx8mm-evk/
>  obj-$(CONFIG_MACH_NXP_IMX8MN_EVK)		+= nxp-imx8mn-evk/
>  obj-$(CONFIG_MACH_NXP_IMX8MP_EVK)		+= nxp-imx8mp-evk/
> +obj-$(CONFIG_MACH_TQ_MBA8MPXL)			+= mba8mpxl/
>  obj-$(CONFIG_MACH_OMAP343xSDP)			+= omap343xdsp/
>  obj-$(CONFIG_MACH_OMAP3EVM)			+= omap3evm/
>  obj-$(CONFIG_MACH_PANDA)			+= panda/
> diff --git a/arch/arm/boards/mba8mpxl/Makefile b/arch/arm/boards/mba8mpxl/Makefile
> new file mode 100644
> index 0000000000..35d8640087
> --- /dev/null
> +++ b/arch/arm/boards/mba8mpxl/Makefile
> @@ -0,0 +1,4 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +
> +obj-y += board.o
> +lwl-y += lowlevel.o lpddr4-timing.o
> diff --git a/arch/arm/boards/mba8mpxl/board.c b/arch/arm/boards/mba8mpxl/board.c
> new file mode 100644
> index 0000000000..f654a64995
> --- /dev/null
> +++ b/arch/arm/boards/mba8mpxl/board.c
> @@ -0,0 +1,54 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (C) 2022 Holger Assmann <h.assmann@pengutronix.de>
> + */
> +
> +#include <asm/memory.h>
> +#include <bootsource.h>
> +#include <common.h>
> +#include <deep-probe.h>
> +#include <init.h>
> +#include <linux/phy.h>
> +#include <linux/sizes.h>
> +#include <mach/bbu.h>
> +#include <mach/iomux-mx8mp.h>
> +#include <gpio.h>
> +#include <envfs.h>
> +
> +static int tqma8mpxl_probe(struct device_d *dev)
> +{
> +	int emmc_bbu_flag = 0;
> +	int sd_bbu_flag = 0;
> +
> +	if (bootsource_get() == BOOTSOURCE_MMC) {
> +		if (bootsource_get_instance() == 2) {
> +			of_device_enable_path("/chosen/environment-emmc");
> +			emmc_bbu_flag = BBU_HANDLER_FLAG_DEFAULT;
> +		} else {
> +			of_device_enable_path("/chosen/environment-sd");
> +			sd_bbu_flag = BBU_HANDLER_FLAG_DEFAULT;
> +		}
> +	} else {
> +		of_device_enable_path("/chosen/environment-emmc");
> +		emmc_bbu_flag = BBU_HANDLER_FLAG_DEFAULT;
> +	}

You can write this as:

	if (bootsource_get() == BOOTSOURCE_MMC && bootsource_get_instance() == 2) {
		of_device_enable_path("/chosen/environment-sd");
		sd_bbu_flag = BBU_HANDLER_FLAG_DEFAULT;
	} else {
		of_device_enable_path("/chosen/environment-emmc");
		emmc_bbu_flag = BBU_HANDLER_FLAG_DEFAULT;
	}

> +static __noreturn noinline void tqma8mpxl_start(void)
> +{
> +	extern char __dtb_z_imx8mp_tqma8mpql_mba8mpxl_start[];
> +
> +	setup_uart();
> +
> +	if (current_el() == 3) {
> +		extern struct dram_timing_info dram_timing_2gb_no_ecc;
> +
> +		power_init_board();
> +
> +		imx8mp_ddr_init(&dram_timing_2gb_no_ecc, DRAM_TYPE_LPDDR4);
> +	

Trailing whitespace here.

> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> index 99f44e7b04..5ceb97129f 100644
> --- a/arch/arm/dts/Makefile
> +++ b/arch/arm/dts/Makefile
> @@ -146,6 +146,7 @@ lwl-$(CONFIG_MACH_NXP_IMX8MN_EVK) += imx8mn-evk.dtb.o imx8mn-ddr4-evk.dtb.o
>  lwl-$(CONFIG_MACH_NXP_IMX8MP_EVK) += imx8mp-evk.dtb.o
>  lwl-$(CONFIG_MACH_NXP_IMX8MQ_EVK) += imx8mq-evk.dtb.o
>  lwl-$(CONFIG_MACH_INNOCOMM_WB15) += imx8mm-innocomm-wb15-evk.dtb.o
> +lwl-$(CONFIG_MACH_TQ_MBA8MPXL) += imx8mp-tqma8mpql-mba8mpxl.dtb.o
>  lwl-$(CONFIG_MACH_TORADEX_COLIBRI_T20) += tegra20-colibri-iris.dtb.o
>  lwl-$(CONFIG_MACH_TOSHIBA_AC100) += tegra20-paz00.dtb.o
>  lwl-$(CONFIG_MACH_TQMA53) += imx53-mba53.dtb.o
> diff --git a/arch/arm/dts/imx8mp-tqma8mpql-mba8mpxl.dts b/arch/arm/dts/imx8mp-tqma8mpql-mba8mpxl.dts
> new file mode 100644
> index 0000000000..8bd9efbaef
> --- /dev/null
> +++ b/arch/arm/dts/imx8mp-tqma8mpql-mba8mpxl.dts
> @@ -0,0 +1,59 @@
> +// SPDX-License-Identifier: (GPL-2.0 OR MIT)
> +/*
> + * Copyright 2017 NXP
> + * Copyright (C) 2017 Pengutronix, Oleksij Rempel <kernel@pengutronix.de>
> + */
> +
> +/dts-v1/;
> +
> +#include <arm64/freescale/imx8mp-tqma8mpql-mba8mpxl.dts>
> +#include "imx8mp.dtsi"
> +
> +/ {
> +	chosen {
> +		environment-sd {
> +			compatible = "barebox,environment";
> +			device-path = &usdhc2, "partname:barebox-environment";

Please add a label to the environment partition and point to that here.

> +			status = "disabled";
> +		};
> +		environment-emmc {
> +			compatible = "barebox,environment";
> +			device-path = &usdhc3, "partname:barebox-environment";

ditto.

Sascha


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



  parent reply	other threads:[~2022-10-24 12:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-24 12:09 Holger Assmann
2022-10-24 12:22 ` [PATCH] fixup! " Ahmad Fatoum
2022-10-24 12:23 ` [PATCH] " Ahmad Fatoum
2022-10-24 12:32 ` Sascha Hauer [this message]
2022-10-24 12:37   ` Ahmad Fatoum

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=20221024123239.GN6702@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=h.assmann@pengutronix.de \
    --cc=l.goehrs@pengutronix.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