Commit e7cc4244 authored by Mark Brown's avatar Mark Brown

spi: Pull in Atmel fix

Pull in Atmel fix series, only first patch of which is for Linus
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parents 6f381481 f4cf11df
...@@ -277,6 +277,9 @@ static int atmel_qspi_find_mode(const struct spi_mem_op *op) ...@@ -277,6 +277,9 @@ static int atmel_qspi_find_mode(const struct spi_mem_op *op)
static bool atmel_qspi_supports_op(struct spi_mem *mem, static bool atmel_qspi_supports_op(struct spi_mem *mem,
const struct spi_mem_op *op) const struct spi_mem_op *op)
{ {
if (!spi_mem_default_supports_op(mem, op))
return false;
if (atmel_qspi_find_mode(op) < 0) if (atmel_qspi_find_mode(op) < 0)
return false; return false;
...@@ -285,12 +288,6 @@ static bool atmel_qspi_supports_op(struct spi_mem *mem, ...@@ -285,12 +288,6 @@ static bool atmel_qspi_supports_op(struct spi_mem *mem,
op->dummy.nbytes == 0) op->dummy.nbytes == 0)
return false; return false;
/* DTR ops not supported. */
if (op->cmd.dtr || op->addr.dtr || op->dummy.dtr || op->data.dtr)
return false;
if (op->cmd.nbytes != 1)
return false;
return true; return true;
} }
......
...@@ -1205,7 +1205,7 @@ static int bcm_qspi_exec_mem_op(struct spi_mem *mem, ...@@ -1205,7 +1205,7 @@ static int bcm_qspi_exec_mem_op(struct spi_mem *mem,
addr = op->addr.val; addr = op->addr.val;
len = op->data.nbytes; len = op->data.nbytes;
if (bcm_qspi_bspi_ver_three(qspi) == true) { if (has_bspi(qspi) && bcm_qspi_bspi_ver_three(qspi) == true) {
/* /*
* The address coming into this function is a raw flash offset. * The address coming into this function is a raw flash offset.
* But for BSPI <= V3, we need to convert it to a remapped BSPI * But for BSPI <= V3, we need to convert it to a remapped BSPI
...@@ -1224,7 +1224,7 @@ static int bcm_qspi_exec_mem_op(struct spi_mem *mem, ...@@ -1224,7 +1224,7 @@ static int bcm_qspi_exec_mem_op(struct spi_mem *mem,
len < 4) len < 4)
mspi_read = true; mspi_read = true;
if (mspi_read) if (!has_bspi(qspi) || mspi_read)
return bcm_qspi_mspi_exec_mem_op(spi, op); return bcm_qspi_mspi_exec_mem_op(spi, op);
ret = bcm_qspi_bspi_set_mode(qspi, op, 0); ret = bcm_qspi_bspi_set_mode(qspi, op, 0);
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <linux/iopoll.h> #include <linux/iopoll.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/log2.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/of.h> #include <linux/of.h>
...@@ -102,12 +103,6 @@ struct cqspi_driver_platdata { ...@@ -102,12 +103,6 @@ struct cqspi_driver_platdata {
#define CQSPI_TIMEOUT_MS 500 #define CQSPI_TIMEOUT_MS 500
#define CQSPI_READ_TIMEOUT_MS 10 #define CQSPI_READ_TIMEOUT_MS 10
/* Instruction type */
#define CQSPI_INST_TYPE_SINGLE 0
#define CQSPI_INST_TYPE_DUAL 1
#define CQSPI_INST_TYPE_QUAD 2
#define CQSPI_INST_TYPE_OCTAL 3
#define CQSPI_DUMMY_CLKS_PER_BYTE 8 #define CQSPI_DUMMY_CLKS_PER_BYTE 8
#define CQSPI_DUMMY_BYTES_MAX 4 #define CQSPI_DUMMY_BYTES_MAX 4
#define CQSPI_DUMMY_CLKS_MAX 31 #define CQSPI_DUMMY_CLKS_MAX 31
...@@ -376,10 +371,6 @@ static unsigned int cqspi_calc_dummy(const struct spi_mem_op *op, bool dtr) ...@@ -376,10 +371,6 @@ static unsigned int cqspi_calc_dummy(const struct spi_mem_op *op, bool dtr)
static int cqspi_set_protocol(struct cqspi_flash_pdata *f_pdata, static int cqspi_set_protocol(struct cqspi_flash_pdata *f_pdata,
const struct spi_mem_op *op) const struct spi_mem_op *op)
{ {
f_pdata->inst_width = CQSPI_INST_TYPE_SINGLE;
f_pdata->addr_width = CQSPI_INST_TYPE_SINGLE;
f_pdata->data_width = CQSPI_INST_TYPE_SINGLE;
/* /*
* For an op to be DTR, cmd phase along with every other non-empty * For an op to be DTR, cmd phase along with every other non-empty
* phase should have dtr field set to 1. If an op phase has zero * phase should have dtr field set to 1. If an op phase has zero
...@@ -389,32 +380,23 @@ static int cqspi_set_protocol(struct cqspi_flash_pdata *f_pdata, ...@@ -389,32 +380,23 @@ static int cqspi_set_protocol(struct cqspi_flash_pdata *f_pdata,
(!op->addr.nbytes || op->addr.dtr) && (!op->addr.nbytes || op->addr.dtr) &&
(!op->data.nbytes || op->data.dtr); (!op->data.nbytes || op->data.dtr);
switch (op->data.buswidth) { f_pdata->inst_width = 0;
case 0: if (op->cmd.buswidth)
break; f_pdata->inst_width = ilog2(op->cmd.buswidth);
case 1:
f_pdata->data_width = CQSPI_INST_TYPE_SINGLE; f_pdata->addr_width = 0;
break; if (op->addr.buswidth)
case 2: f_pdata->addr_width = ilog2(op->addr.buswidth);
f_pdata->data_width = CQSPI_INST_TYPE_DUAL;
break; f_pdata->data_width = 0;
case 4: if (op->data.buswidth)
f_pdata->data_width = CQSPI_INST_TYPE_QUAD; f_pdata->data_width = ilog2(op->data.buswidth);
break;
case 8:
f_pdata->data_width = CQSPI_INST_TYPE_OCTAL;
break;
default:
return -EINVAL;
}
/* Right now we only support 8-8-8 DTR mode. */ /* Right now we only support 8-8-8 DTR mode. */
if (f_pdata->dtr) { if (f_pdata->dtr) {
switch (op->cmd.buswidth) { switch (op->cmd.buswidth) {
case 0: case 0:
break;
case 8: case 8:
f_pdata->inst_width = CQSPI_INST_TYPE_OCTAL;
break; break;
default: default:
return -EINVAL; return -EINVAL;
...@@ -422,9 +404,7 @@ static int cqspi_set_protocol(struct cqspi_flash_pdata *f_pdata, ...@@ -422,9 +404,7 @@ static int cqspi_set_protocol(struct cqspi_flash_pdata *f_pdata,
switch (op->addr.buswidth) { switch (op->addr.buswidth) {
case 0: case 0:
break;
case 8: case 8:
f_pdata->addr_width = CQSPI_INST_TYPE_OCTAL;
break; break;
default: default:
return -EINVAL; return -EINVAL;
...@@ -432,9 +412,7 @@ static int cqspi_set_protocol(struct cqspi_flash_pdata *f_pdata, ...@@ -432,9 +412,7 @@ static int cqspi_set_protocol(struct cqspi_flash_pdata *f_pdata,
switch (op->data.buswidth) { switch (op->data.buswidth) {
case 0: case 0:
break;
case 8: case 8:
f_pdata->data_width = CQSPI_INST_TYPE_OCTAL;
break; break;
default: default:
return -EINVAL; return -EINVAL;
...@@ -1437,9 +1415,24 @@ static bool cqspi_supports_mem_op(struct spi_mem *mem, ...@@ -1437,9 +1415,24 @@ static bool cqspi_supports_mem_op(struct spi_mem *mem,
all_false = !op->cmd.dtr && !op->addr.dtr && !op->dummy.dtr && all_false = !op->cmd.dtr && !op->addr.dtr && !op->dummy.dtr &&
!op->data.dtr; !op->data.dtr;
/* Mixed DTR modes not supported. */ if (all_true) {
if (!(all_true || all_false)) /* Right now we only support 8-8-8 DTR mode. */
if (op->cmd.nbytes && op->cmd.buswidth != 8)
return false;
if (op->addr.nbytes && op->addr.buswidth != 8)
return false;
if (op->data.nbytes && op->data.buswidth != 8)
return false;
} else if (all_false) {
/* Only 1-1-X ops are supported without DTR */
if (op->cmd.nbytes && op->cmd.buswidth > 1)
return false;
if (op->addr.nbytes && op->addr.buswidth > 1)
return false;
} else {
/* Mixed DTR modes are not supported. */
return false; return false;
}
return spi_mem_default_supports_op(mem, op); return spi_mem_default_supports_op(mem, op);
} }
......
...@@ -72,6 +72,7 @@ static const struct pci_device_id intel_spi_pci_ids[] = { ...@@ -72,6 +72,7 @@ static const struct pci_device_id intel_spi_pci_ids[] = {
{ PCI_VDEVICE(INTEL, 0x4da4), (unsigned long)&bxt_info }, { PCI_VDEVICE(INTEL, 0x4da4), (unsigned long)&bxt_info },
{ PCI_VDEVICE(INTEL, 0x51a4), (unsigned long)&cnl_info }, { PCI_VDEVICE(INTEL, 0x51a4), (unsigned long)&cnl_info },
{ PCI_VDEVICE(INTEL, 0x54a4), (unsigned long)&cnl_info }, { PCI_VDEVICE(INTEL, 0x54a4), (unsigned long)&cnl_info },
{ PCI_VDEVICE(INTEL, 0x7a24), (unsigned long)&cnl_info },
{ PCI_VDEVICE(INTEL, 0x7aa4), (unsigned long)&cnl_info }, { PCI_VDEVICE(INTEL, 0x7aa4), (unsigned long)&cnl_info },
{ PCI_VDEVICE(INTEL, 0xa0a4), (unsigned long)&bxt_info }, { PCI_VDEVICE(INTEL, 0xa0a4), (unsigned long)&bxt_info },
{ PCI_VDEVICE(INTEL, 0xa1a4), (unsigned long)&bxt_info }, { PCI_VDEVICE(INTEL, 0xa1a4), (unsigned long)&bxt_info },
......
...@@ -960,7 +960,17 @@ static int __maybe_unused mtk_nor_suspend(struct device *dev) ...@@ -960,7 +960,17 @@ static int __maybe_unused mtk_nor_suspend(struct device *dev)
static int __maybe_unused mtk_nor_resume(struct device *dev) static int __maybe_unused mtk_nor_resume(struct device *dev)
{ {
return pm_runtime_force_resume(dev); struct spi_controller *ctlr = dev_get_drvdata(dev);
struct mtk_nor *sp = spi_controller_get_devdata(ctlr);
int ret;
ret = pm_runtime_force_resume(dev);
if (ret)
return ret;
mtk_nor_init(sp);
return 0;
} }
static const struct dev_pm_ops mtk_nor_pm_ops = { static const struct dev_pm_ops mtk_nor_pm_ops = {
......
...@@ -813,6 +813,7 @@ static int mxic_spi_probe(struct platform_device *pdev) ...@@ -813,6 +813,7 @@ static int mxic_spi_probe(struct platform_device *pdev)
if (ret) { if (ret) {
dev_err(&pdev->dev, "spi_register_master failed\n"); dev_err(&pdev->dev, "spi_register_master failed\n");
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
mxic_spi_mem_ecc_remove(mxic);
} }
return ret; return ret;
......
...@@ -158,14 +158,18 @@ static int rpcif_spi_probe(struct platform_device *pdev) ...@@ -158,14 +158,18 @@ static int rpcif_spi_probe(struct platform_device *pdev)
error = rpcif_hw_init(rpc, false); error = rpcif_hw_init(rpc, false);
if (error) if (error)
return error; goto out_disable_rpm;
error = spi_register_controller(ctlr); error = spi_register_controller(ctlr);
if (error) { if (error) {
dev_err(&pdev->dev, "spi_register_controller failed\n"); dev_err(&pdev->dev, "spi_register_controller failed\n");
rpcif_disable_rpm(rpc); goto out_disable_rpm;
} }
return 0;
out_disable_rpm:
rpcif_disable_rpm(rpc);
return error; return error;
} }
......
...@@ -1130,11 +1130,15 @@ static int __spi_unmap_msg(struct spi_controller *ctlr, struct spi_message *msg) ...@@ -1130,11 +1130,15 @@ static int __spi_unmap_msg(struct spi_controller *ctlr, struct spi_message *msg)
if (ctlr->dma_tx) if (ctlr->dma_tx)
tx_dev = ctlr->dma_tx->device->dev; tx_dev = ctlr->dma_tx->device->dev;
else if (ctlr->dma_map_dev)
tx_dev = ctlr->dma_map_dev;
else else
tx_dev = ctlr->dev.parent; tx_dev = ctlr->dev.parent;
if (ctlr->dma_rx) if (ctlr->dma_rx)
rx_dev = ctlr->dma_rx->device->dev; rx_dev = ctlr->dma_rx->device->dev;
else if (ctlr->dma_map_dev)
rx_dev = ctlr->dma_map_dev;
else else
rx_dev = ctlr->dev.parent; rx_dev = ctlr->dev.parent;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment