lkml.org 
[lkml]   [2020]   [Jan]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v2 2/3] spi: Add HiSilicon v3xx SPI NOR flash controller driver
Date
On 09/12/2019 14:08, John Garry wrote:
> + if (ret)
> + return ret;
> +
> + if (op->data.dir == SPI_MEM_DATA_IN)
> + hisi_sfc_v3xx_read_databuf(host, op->data.buf.in, len);
> +
> + return 0;
> +}
> +
> +static int hisi_sfc_v3xx_exec_op(struct spi_mem *mem,
> + const struct spi_mem_op *op)
> +{
> + struct hisi_sfc_v3xx_host *host;
> + struct spi_device *spi = mem->spi;
> + u8 chip_select = spi->chip_select;
> +
> + host = spi_controller_get_devdata(spi->master);
> +
> + return hisi_sfc_v3xx_generic_exec_op(host, op, chip_select);
> +}
> +
> +static const struct spi_controller_mem_ops hisi_sfc_v3xx_mem_ops = {
> + .adjust_op_size = hisi_sfc_v3xx_adjust_op_size,
> + .exec_op = hisi_sfc_v3xx_exec_op,
> +};
> +
> +static int hisi_sfc_v3xx_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct hisi_sfc_v3xx_host *host;
> + struct spi_controller *ctlr;
> + u32 version;
> + int ret;
> +
> + ctlr = spi_alloc_master(&pdev->dev, sizeof(*host));
> + if (!ctlr)
> + return -ENOMEM;
> +


Hi Mark,

> + ctlr->mode_bits = SPI_RX_DUAL | SPI_RX_QUAD |
> + SPI_TX_DUAL | SPI_TX_QUAD;

I have an issue with dual/quad support. I naively thought that setting
these bits would give me the highest protocol available.

However, now I notice that spi_device.mode needs to be set for supported
protocols for the slave - I'm using the generic spi mem ops to check if
protocols are supported based on this value.

From checking acpi_spi_add_resource() or anywhere else, I cannot see
how SPI_RX_DUAL or the others are set for spi_device.mode. What am I
missing? Are these just not supported yet for ACPI? Or should the
spi-nor code not be relying on this since we should be able to get this
info from the SPI NOR part?

Cheers,
John

> +
> + host = spi_controller_get_devdata(ctlr);
> + host->dev = dev;
> +
> + platform_set_drvdata(pdev, host);
> +
> + host->regbase = devm_platform_ioremap_resource(pdev, 0);
> + if (IS_ERR(host->regbase)) {
> + ret = PTR_ERR(host->regbase);
> + goto err_put_master;

\
 
 \ /
  Last update: 2020-01-09 16:55    [W:0.099 / U:10.716 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site