mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Fabian Pflug <f.pflug@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: BAREBOX <barebox@lists.infradead.org>,
	Marco Felsch <m.felsch@pengutronix.de>
Subject: Re: [PATCH v4 2/3] ARM: boards: tqma8mpxl: extend with support for xs
Date: Fri, 13 Mar 2026 15:19:52 +0100	[thread overview]
Message-ID: <2d81955609d42ee98e53e1510d4267634df68bff.camel@pengutronix.de> (raw)
In-Reply-To: <abQPA1BFyCN4M51O@pengutronix.de>

Hi,

On Fri, 2026-03-13 at 14:20 +0100, Sascha Hauer wrote:
> On Thu, Mar 12, 2026 at 12:34:32PM +0100, Fabian Pflug wrote:
> > The TQMA8MPxS is another board from TQ with the same processor, but a
> > different formfactor. Nevertheless they share a lot of code and can be
> > used from the same barebox resulting in the rename of tqma8mpxl to
> > tqma8mpxx.
> > 
> > Signed-off-by: Fabian Pflug <f.pflug@pengutronix.de>
> > ---
> >  arch/arm/boards/tqma8mpxx/board.c                  |    1 +
> >  arch/arm/boards/tqma8mpxx/lowlevel.c               |   97 +-
> >  arch/arm/dts/Makefile                              |    2 +-
> >  .../dts/imx8mp-tqma8mpqs-mb-smarc-2-upstream.dts   |  402 ++++++++
> >  arch/arm/dts/imx8mp-tqma8mpqs-mba8mpxs.dts         |   15 +
> >  arch/arm/dts/imx8mp-tqma8mpqs-upstream.dtsi        | 1075 ++++++++++++++++++++
> >  arch/arm/mach-imx/Kconfig                          |    3 +-
> >  7 files changed, 1574 insertions(+), 21 deletions(-)
> > 
> > -static void power_init_board(void)
> > +static bool tqma_is_eeprom_valid(struct tq_eeprom *eeprom)
> >  {
> > -	struct pbl_i2c *i2c;
> > +	int ramsize;
> >  
> > -	imx8mp_setup_pad(MX8MP_PAD_I2C1_SCL__I2C1_SCL | I2C_PAD_CTRL);
> > -	imx8mp_setup_pad(MX8MP_PAD_I2C1_SDA__I2C1_SDA | I2C_PAD_CTRL);
> > -
> > -	imx8m_ccgr_clock_enable(IMX8M_CCM_CCGR_I2C1);
> > -
> > -	i2c = imx8m_i2c_early_init(IOMEM(MX8MP_I2C1_BASE_ADDR));
> > -
> > -	pmic_configure(i2c, 0x25, pca9450_cfg, ARRAY_SIZE(pca9450_cfg));
> > +	if (!*eeprom->serial || !*eeprom->id)
> > +		return false;
> > +	ramsize = tq_vard_ramsize(&eeprom->vard) / (SZ_1G);
> > +	if (ramsize != 1 && ramsize != 2 && ramsize != 4 && ramsize != 8)
> > +		return false;
> > +	return true;
> >  }
> >  
> > -static __noreturn noinline void tqma8mpxx_start(void)
> > +static noinline void tqma8mpxx_start(void)
> >  {
> >  	extern char __dtb_z_imx8mp_tqma8mpql_mba8mpxl_start[];
> > +	extern char __dtb_z_imx8mp_tqma8mpqs_mba8mpxs_start[];
> >  
> > -	setup_uart();
> > +	struct tq_eeprom *eeprom;
> > +	struct pbl_i2c *i2c;
> > +	void *boarddata;
> > +
> > +	i2c = tqma_i2c1_init();
> > +
> > +	/**
> > +	 * The difference for the lowlevel code between xS and xL is:
> > +	 * PMIC: xS on i2c2, xL on i2C1
> > +	 * VARD: address 0x50 on xS, address 0x53 on xL.
> > +	 *       offset 0x1000 on xS, offset 0x0 on xL
> > +	 */
> > +
> > +	eeprom = pbl_tq_read_eeprom(i2c, 0x50, 0x1000 | I2C_ADDR_16_BIT);
> > +	if (tqma_is_eeprom_valid(eeprom)) {
> > +		/* found xS board */
> > +		i2c = tqma_i2c2_init();
> 
> Something is mixed up here. You come here when you find a valid EEPROM
> on I2C1 which according to the comment indicates you're on a xL board.
> Also i2c is set here but unused for the rest of this function.

No, the i2c is used later to setup the pmic in line 171.
The xS has the pmic on i2c2, wheras the xL has the PMIc on i2c1.

> 
> Have you tested this on both boards? If not I would prefer that you look
> for an EEPROM on the board that you don't have first so that we can be
> sure that looking up a non existent EEPROM doesn't hang the board.

Yes, I have tested both, but did not measure the time the failed attempt took.
But I can confirm, that it did not hang.

Fabian

> 
> > +		boarddata = __dtb_z_imx8mp_tqma8mpqs_mba8mpxs_start;
> > +		setup_uart(IOMEM(MX8M_UART3_BASE_ADDR),
> > +			   MX8MP_PAD_SD1_DATA6__UART3_DCE_TX,
> > +			   MX8MP_PAD_SD1_DATA7__UART3_DCE_RX);
> > +	} else {
> > +		eeprom = pbl_tq_read_eeprom(i2c, 0x53, 0);
> > +		if (!tqma_is_eeprom_valid(eeprom))
> > +			panic("Could not read VARD!\n");
> > +
> > +		/* found xL board */
> > +		boarddata = __dtb_z_imx8mp_tqma8mpql_mba8mpxl_start;
> > +		setup_uart(IOMEM(MX8M_UART4_BASE_ADDR),
> > +			   MX8MP_PAD_UART4_TXD__UART4_DCE_TX,
> > +			   MX8MP_PAD_UART4_RXD__UART4_DCE_RX);
> > +
> > +	}
> >  
> 
> Sascha



  reply	other threads:[~2026-03-13 14:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-12 11:34 [PATCH v4 0/3] ARM: boards: add support for tqma8mpxs boards Fabian Pflug
2026-03-12 11:34 ` [PATCH v4 1/3] ARM: boards: tqma8mpxl: rename to tqma8mpxx Fabian Pflug
2026-03-12 11:37   ` Marco Felsch
2026-03-12 11:34 ` [PATCH v4 2/3] ARM: boards: tqma8mpxl: extend with support for xs Fabian Pflug
2026-03-13 13:20   ` Sascha Hauer
2026-03-13 14:19     ` Fabian Pflug [this message]
2026-03-13 14:27       ` Sascha Hauer
2026-03-12 11:34 ` [PATCH v4 3/3] ARM: boards: tqma8mpxx: add no_ecc ram timings Fabian Pflug
2026-03-13 14:31 ` [PATCH v4 0/3] ARM: boards: add support for tqma8mpxs boards Sascha Hauer

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=2d81955609d42ee98e53e1510d4267634df68bff.camel@pengutronix.de \
    --to=f.pflug@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=m.felsch@pengutronix.de \
    --cc=s.hauer@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