Re: [PATCH v7 1/2] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver

From: Sergei Shtylyov
Date: Thu Jan 24 2019 - 06:27:48 EST


On 01/24/2019 05:06 AM, masonccyang@xxxxxxxxxxx wrote:

>> > +// SPDX-License-Identifier: GPL-2.0
>> > +//
>> > +// Copyright (C) 2018 ~ 2019 Renesas Solutions Corp.
>> > +// Copyright (C) 2018 Macronix International Co., Ltd.
>> > +//
>> > +// R-Car Gen3 RPC-IF SPI/QSPI/Octa driver
>>
>> Do we really support Octa?
>
> yes and it needs to patch spi-nor layer and RPC driver for sure.

It?

>> > +//
>> > +// Authors:
>> > +// Mason Yang <masonccyang@xxxxxxxxxxx>
>> > +//
>> [...]
>> > +#include <asm/unaligned.h>
>> [...]
>> > + } else if (rx_buf) {
>> > + //
>> > + // RPC-IF spoils the data for the commands without an address
>> > + // phase (like RDID) in the manual mode, so we'll have to work
>> > + // around this issue by using the external address space read
>> > + // mode instead.
>> > + //
>> > + if (!(smenr & RPC_SMENR_ADE(0xf))) {
>> > + regmap_update_bits(rpc->regmap, RPC_CMNCR,
>> > + RPC_CMNCR_MD, 0);
>> > + regmap_write(rpc->regmap, RPC_DRCR,
>> > + RPC_DRCR_RBURST(32) | RPC_DRCR_RBE);
>> > + regmap_write(rpc->regmap, RPC_DREAR, RPC_DREAR_EAC(1));
>> > + regmap_write(rpc->regmap, RPC_DRCMR, rpc->cmd);
>> > + regmap_write(rpc->regmap, RPC_DRDMCR, rpc->dummy);
>> > + regmap_write(rpc->regmap, RPC_DROPR, 0);
>> > + regmap_write(rpc->regmap, RPC_DRENR, smenr);
>> > + memcpy_fromio(rx_buf, rpc->dirmap, rpc->xferlen);
>>
>> Just noticed: if rpc->dirmap is NULL (which is now allowed), we
>> have a kernel oops
>> here. :-(
>
> Do you patch your spi-mem.c ?

What do yuo mean? The only extra patch I have to apply now to renesas.git repo's devel
branch is "mtd: devices: m25p80: Use the spi-mem dirmap API"...

> both dirmap_create() in your rpc driver and spi-mem layer should handle it well.

I just saw that you don't fail the driver's probe() method if devm_ioremap_resource()
fails for the "dirmap" and "wbuf" resources...

>> [...]
>> > +static const struct of_device_id rpc_spi_of_ids[] = {
>> > + { .compatible = "renesas,r8a77995-rpc", },
>>
>> Why (if it has no differences with the generic gen3 value below)?
>> Please remove.
>
> By Geert's comments in dts,
>
> rpc: rpc@ee200000 {
> compatible = "renesas,r8a7795-rpc", "renesas,rcar-gen3-rpc";
> reg = <0 0xee200000 0 0x200>, <0 0x08000000 0 0x4000000>,
> <0 0xee208000 0 0x100>;
>
> I modified it to "renesas,r8a77995-rpc" because this is Soc I developed and validated.

Hopefully this matter is cleared up by Geert... :-)

> thanks,
> Mason

MBR, Sergei