[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YVXMc1A4D/y4kjim@shikoro>
Date: Thu, 30 Sep 2021 16:40:51 +0200
From: Wolfram Sang <wsa+renesas@...g-engineering.com>
To: Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>,
Rob Herring <robh+dt@...nel.org>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Vignesh Raghavendra <vigneshr@...com>,
Miquel Raynal <miquel.raynal@...tlin.com>,
Richard Weinberger <richard@....at>,
Mark Brown <broonie@...nel.org>,
Philipp Zabel <p.zabel@...gutronix.de>,
Sergei Shtylyov <sergei.shtylyov@...il.com>,
devicetree@...r.kernel.org, linux-mtd@...ts.infradead.org,
linux-spi@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-renesas-soc@...r.kernel.org,
Prabhakar <prabhakar.csengg@...il.com>,
Biju Das <biju.das.jz@...renesas.com>
Subject: Re: [PATCH 6/6] memory: renesas-rpc-if: Add support for RZ/G2L
Hi,
> #define RPCIF_CMNCR_IO3FV(val) (((val) & 0x3) << 14) /* undocumented */
> #define RPCIF_CMNCR_IO2FV(val) (((val) & 0x3) << 12) /* undocumented */
> #define RPCIF_CMNCR_IO0FV(val) (((val) & 0x3) << 8)
> -#define RPCIF_CMNCR_IOFV_HIZ (RPCIF_CMNCR_IO0FV(3) | RPCIF_CMNCR_IO2FV(3) | \
> - RPCIF_CMNCR_IO3FV(3))
> +#define RPCIF_CMNCR_IOFV_HIZ(val) (RPCIF_CMNCR_IO0FV(val) | RPCIF_CMNCR_IO2FV(val) | \
> + RPCIF_CMNCR_IO3FV(val))
Is RPCIF_CMNCR_IO3FV and RPCIF_CMNCR_IO2FV actually documented in your
datasheets? I am asking because I have a patch pending to remove writing
to undocumented locations. So, I was aboout to remove the IO3FV and
IO2FV macros.
> +#define RPCIF_PHYADJ1 0x0070 /* R/W */
> +#define RPCIF_PHYADJ2 0x0074 /* R/W */
Those are named 'PHYADD' and 'PHYWR' in the Gen3 documentation. They are
only available on a few of the Gen3 SoCs. I think the Gen3 namings make
more sense because then it becomes easily understandable that the
registers are used to write something to the PHY.
> +#define RPCIF_PHYCNT_CKSEL(v) (((v) & 0x3) << 16)
We should add a comment here that these bits are only valid for G2L...
> #define RPCIF_PHYCNT_STRTIM(v) (((v) & 0x7) << 15)
and these only for Gen3.
> +static void rpcif_timing_adjust_sdr(struct rpcif *rpc)
> +{
> + u32 data;
> +
> + regmap_write(rpc->regmap, RPCIF_PHYADJ2, 0xA5390000);
> + regmap_write(rpc->regmap, RPCIF_PHYADJ1, 0x80000000);
> + regmap_write(rpc->regmap, RPCIF_PHYADJ2, 0x00008080);
> + regmap_write(rpc->regmap, RPCIF_PHYADJ1, 0x80000022);
> + regmap_write(rpc->regmap, RPCIF_PHYADJ2, 0x00008080);
> + regmap_write(rpc->regmap, RPCIF_PHYADJ1, 0x80000024);
Can't we have defines for these magic values? At least in my latest Gen3
documentation, these values are explained.
> +
> + regmap_read(rpc->regmap, RPCIF_PHYCNT, &data);
> + regmap_write(rpc->regmap, RPCIF_PHYCNT, data | RPCIF_PHYCNT_CKSEL(3));
regmap_update_bits?
> + if (rpc->type == RPCIF_RCAR_GEN3) {
> + regmap_write(rpc->regmap, RPCIF_PHYCNT, RPCIF_PHYCNT_STRTIM(7) |
> + RPCIF_PHYCNT_PHYMEM(hyperflash ? 3 : 0) | 0x260);
> + } else {
> + regmap_read(rpc->regmap, RPCIF_PHYCNT, &dummy);
> + dummy &= ~RPCIF_PHYCNT_PHYMEM_MASK;
> + dummy |= RPCIF_PHYCNT_PHYMEM(hyperflash ? 3 : 0) | 0x260;
> + regmap_write(rpc->regmap, RPCIF_PHYCNT, dummy);
regmap_update_bits?
Rest looks good.
Thanks and happy hacking!
Wolfram
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists