[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <12af2632-491d-0e01-66c9-0ead4f9d985a@cogentembedded.com>
Date: Wed, 23 Jan 2019 21:04:26 +0300
From: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To: Mason Yang <masonccyang@...c.com.tw>, broonie@...nel.org,
marek.vasut@...il.com, linux-kernel@...r.kernel.org,
linux-spi@...r.kernel.org, bbrezillon@...nel.org,
linux-renesas-soc@...r.kernel.org,
Geert Uytterhoeven <geert+renesas@...der.be>
Cc: juliensu@...c.com.tw, Simon Horman <horms@...ge.net.au>,
zhengxunli@...c.com.tw
Subject: Re: [PATCH v7 1/2] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller
driver
Hello!
On 01/23/2019 10:09 AM, Mason Yang wrote:
> Add a driver for Renesas R-Car Gen3 RPC-IF SPI controller.
>
> Signed-off-by: Mason Yang <masonccyang@...c.com.tw>
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
[...]
> diff --git a/drivers/spi/spi-renesas-rpc.c b/drivers/spi/spi-renesas-rpc.c
> new file mode 100644
> index 0000000..0127f25
> --- /dev/null
> +++ b/drivers/spi/spi-renesas-rpc.c
> @@ -0,0 +1,805 @@
> +// 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?
> +//
> +// Authors:
> +// Mason Yang <masonccyang@...c.com.tw>
> +//
[...]
> +#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. :-(
[...]
> +static int rpc_spi_probe(struct platform_device *pdev)
> +{
> + struct spi_controller *ctlr;
> + struct resource *res;
> + struct rpc_spi *rpc;
> + struct device_node *rpc_if;
Don't think that's a good name. Why not call it 'flash'?
> + int ret;
> +
> + rpc_if = of_get_next_child(pdev->dev.of_node, NULL);
> + if (!rpc_if) {
> + dev_warn(&pdev->dev, "no spi-nor device node found\n");
How about "no flash node found"?
> + return -ENODEV;
> + }
> +
> + ret = of_device_is_compatible(rpc_if, "jedec,spi-nor");
> + if (!ret) {
> + dev_warn(&pdev->dev, "no compatible spi-nor device found\n");
"no SPI-NOR device found"?
[...]
> + ret = spi_register_controller(ctlr);
> + if (ret) {
> + dev_err(&pdev->dev, "spi_register_controller failed\n");
> + goto err_put_ctlr;
> + }
> + return 0;
> +
> +err_put_ctlr:
> + spi_controller_put(ctlr);
> + pm_runtime_disable(&pdev->dev);
> +
> + return ret;
> +}
[...]
> +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.
> + { .compatible = "renesas,rcar-gen3-rpc", },
> + { /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, rpc_spi_of_ids);
[...]
MBR, Sergei
Powered by blists - more mailing lists