You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge remote-tracking branches 'spi/topic/atmel', 'spi/topic/config', 'spi/topic/dln2' and 'spi/topic/dw' into spi-next
This commit is contained in:
@@ -293,7 +293,6 @@ static void mrst_power_off_unused_dev(struct pci_dev *dev)
|
||||
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0801, mrst_power_off_unused_dev);
|
||||
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0809, mrst_power_off_unused_dev);
|
||||
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x080C, mrst_power_off_unused_dev);
|
||||
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0812, mrst_power_off_unused_dev);
|
||||
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0815, mrst_power_off_unused_dev);
|
||||
|
||||
/*
|
||||
|
||||
+10
-1
@@ -185,6 +185,16 @@ config SPI_DAVINCI
|
||||
help
|
||||
SPI master controller for DaVinci/DA8x/OMAP-L/AM1x SPI modules.
|
||||
|
||||
config SPI_DLN2
|
||||
tristate "Diolan DLN-2 USB SPI adapter"
|
||||
depends on MFD_DLN2
|
||||
help
|
||||
If you say yes to this option, support will be included for Diolan
|
||||
DLN2, a USB to SPI interface.
|
||||
|
||||
This driver can also be built as a module. If so, the module
|
||||
will be called spi-dln2.
|
||||
|
||||
config SPI_EFM32
|
||||
tristate "EFM32 SPI controller"
|
||||
depends on OF && ARM && (ARCH_EFM32 || COMPILE_TEST)
|
||||
@@ -595,7 +605,6 @@ config SPI_XTENSA_XTFPGA
|
||||
16 bit words in SPI mode 0, automatically asserting CS on transfer
|
||||
start and deasserting on end.
|
||||
|
||||
|
||||
config SPI_NUC900
|
||||
tristate "Nuvoton NUC900 series SPI"
|
||||
depends on ARCH_W90X900
|
||||
|
||||
@@ -27,6 +27,7 @@ obj-$(CONFIG_SPI_CADENCE) += spi-cadence.o
|
||||
obj-$(CONFIG_SPI_CLPS711X) += spi-clps711x.o
|
||||
obj-$(CONFIG_SPI_COLDFIRE_QSPI) += spi-coldfire-qspi.o
|
||||
obj-$(CONFIG_SPI_DAVINCI) += spi-davinci.o
|
||||
obj-$(CONFIG_SPI_DLN2) += spi-dln2.o
|
||||
obj-$(CONFIG_SPI_DESIGNWARE) += spi-dw.o
|
||||
obj-$(CONFIG_SPI_DW_MMIO) += spi-dw-mmio.o
|
||||
obj-$(CONFIG_SPI_DW_PCI) += spi-dw-midpci.o
|
||||
|
||||
@@ -1046,6 +1046,7 @@ static int atmel_spi_one_transfer(struct spi_master *master,
|
||||
struct atmel_spi_device *asd;
|
||||
int timeout;
|
||||
int ret;
|
||||
unsigned long dma_timeout;
|
||||
|
||||
as = spi_master_get_devdata(master);
|
||||
|
||||
@@ -1103,15 +1104,12 @@ static int atmel_spi_one_transfer(struct spi_master *master,
|
||||
|
||||
/* interrupts are disabled, so free the lock for schedule */
|
||||
atmel_spi_unlock(as);
|
||||
ret = wait_for_completion_timeout(&as->xfer_completion,
|
||||
SPI_DMA_TIMEOUT);
|
||||
dma_timeout = wait_for_completion_timeout(&as->xfer_completion,
|
||||
SPI_DMA_TIMEOUT);
|
||||
atmel_spi_lock(as);
|
||||
if (WARN_ON(ret == 0)) {
|
||||
dev_err(&spi->dev,
|
||||
"spi trasfer timeout, err %d\n", ret);
|
||||
if (WARN_ON(dma_timeout == 0)) {
|
||||
dev_err(&spi->dev, "spi transfer timeout\n");
|
||||
as->done_status = -EIO;
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
if (as->done_status)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -247,9 +247,9 @@ static struct dw_spi_dma_ops mid_dma_ops = {
|
||||
|
||||
/* Some specific info for SPI0 controller on Intel MID */
|
||||
|
||||
/* HW info for MRST CLk Control Unit, one 32b reg */
|
||||
/* HW info for MRST Clk Control Unit, 32b reg per controller */
|
||||
#define MRST_SPI_CLK_BASE 100000000 /* 100m */
|
||||
#define MRST_CLK_SPI0_REG 0xff11d86c
|
||||
#define MRST_CLK_SPI_REG 0xff11d86c
|
||||
#define CLK_SPI_BDIV_OFFSET 0
|
||||
#define CLK_SPI_BDIV_MASK 0x00000007
|
||||
#define CLK_SPI_CDIV_OFFSET 9
|
||||
@@ -261,16 +261,17 @@ int dw_spi_mid_init(struct dw_spi *dws)
|
||||
void __iomem *clk_reg;
|
||||
u32 clk_cdiv;
|
||||
|
||||
clk_reg = ioremap_nocache(MRST_CLK_SPI0_REG, 16);
|
||||
clk_reg = ioremap_nocache(MRST_CLK_SPI_REG, 16);
|
||||
if (!clk_reg)
|
||||
return -ENOMEM;
|
||||
|
||||
/* get SPI controller operating freq info */
|
||||
clk_cdiv = (readl(clk_reg) & CLK_SPI_CDIV_MASK) >> CLK_SPI_CDIV_OFFSET;
|
||||
/* Get SPI controller operating freq info */
|
||||
clk_cdiv = readl(clk_reg + dws->bus_num * sizeof(u32));
|
||||
clk_cdiv &= CLK_SPI_CDIV_MASK;
|
||||
clk_cdiv >>= CLK_SPI_CDIV_OFFSET;
|
||||
dws->max_freq = MRST_SPI_CLK_BASE / (clk_cdiv + 1);
|
||||
iounmap(clk_reg);
|
||||
|
||||
dws->num_cs = 16;
|
||||
iounmap(clk_reg);
|
||||
|
||||
#ifdef CONFIG_SPI_DW_MID_DMA
|
||||
dws->dma_priv = kzalloc(sizeof(struct mid_dma), GFP_KERNEL);
|
||||
|
||||
@@ -30,10 +30,20 @@ struct dw_spi_pci {
|
||||
|
||||
struct spi_pci_desc {
|
||||
int (*setup)(struct dw_spi *);
|
||||
u16 num_cs;
|
||||
u16 bus_num;
|
||||
};
|
||||
|
||||
static struct spi_pci_desc spi_pci_mid_desc = {
|
||||
static struct spi_pci_desc spi_pci_mid_desc_1 = {
|
||||
.setup = dw_spi_mid_init,
|
||||
.num_cs = 32,
|
||||
.bus_num = 0,
|
||||
};
|
||||
|
||||
static struct spi_pci_desc spi_pci_mid_desc_2 = {
|
||||
.setup = dw_spi_mid_init,
|
||||
.num_cs = 4,
|
||||
.bus_num = 1,
|
||||
};
|
||||
|
||||
static int spi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
@@ -65,18 +75,23 @@ static int spi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
|
||||
dws->regs = pcim_iomap_table(pdev)[pci_bar];
|
||||
|
||||
dws->bus_num = 0;
|
||||
dws->num_cs = 4;
|
||||
dws->irq = pdev->irq;
|
||||
|
||||
/*
|
||||
* Specific handling for paltforms, like dma setup,
|
||||
* clock rate, FIFO depth.
|
||||
*/
|
||||
if (desc && desc->setup) {
|
||||
ret = desc->setup(dws);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (desc) {
|
||||
dws->num_cs = desc->num_cs;
|
||||
dws->bus_num = desc->bus_num;
|
||||
|
||||
if (desc->setup) {
|
||||
ret = desc->setup(dws);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
ret = dw_spi_add_host(&pdev->dev, dws);
|
||||
@@ -121,7 +136,14 @@ static SIMPLE_DEV_PM_OPS(dw_spi_pm_ops, spi_suspend, spi_resume);
|
||||
|
||||
static const struct pci_device_id pci_ids[] = {
|
||||
/* Intel MID platform SPI controller 0 */
|
||||
{ PCI_VDEVICE(INTEL, 0x0800), (kernel_ulong_t)&spi_pci_mid_desc},
|
||||
/*
|
||||
* The access to the device 8086:0801 is disabled by HW, since it's
|
||||
* exclusively used by SCU to communicate with MSIC.
|
||||
*/
|
||||
/* Intel MID platform SPI controller 1 */
|
||||
{ PCI_VDEVICE(INTEL, 0x0800), (kernel_ulong_t)&spi_pci_mid_desc_1},
|
||||
/* Intel MID platform SPI controller 2 */
|
||||
{ PCI_VDEVICE(INTEL, 0x0812), (kernel_ulong_t)&spi_pci_mid_desc_2},
|
||||
{},
|
||||
};
|
||||
|
||||
|
||||
@@ -608,7 +608,7 @@ static void dw_spi_cleanup(struct spi_device *spi)
|
||||
}
|
||||
|
||||
/* Restart the controller, disable all interrupts, clean rx fifo */
|
||||
static void spi_hw_init(struct dw_spi *dws)
|
||||
static void spi_hw_init(struct device *dev, struct dw_spi *dws)
|
||||
{
|
||||
spi_enable_chip(dws, 0);
|
||||
spi_mask_intr(dws, 0xff);
|
||||
@@ -626,9 +626,10 @@ static void spi_hw_init(struct dw_spi *dws)
|
||||
if (fifo != dw_readw(dws, DW_SPI_TXFLTR))
|
||||
break;
|
||||
}
|
||||
dw_writew(dws, DW_SPI_TXFLTR, 0);
|
||||
|
||||
dws->fifo_len = (fifo == 2) ? 0 : fifo - 1;
|
||||
dw_writew(dws, DW_SPI_TXFLTR, 0);
|
||||
dev_dbg(dev, "Detected FIFO size: %u bytes\n", dws->fifo_len);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -668,7 +669,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws)
|
||||
master->dev.of_node = dev->of_node;
|
||||
|
||||
/* Basic HW init */
|
||||
spi_hw_init(dws);
|
||||
spi_hw_init(dev, dws);
|
||||
|
||||
if (dws->dma_ops && dws->dma_ops->dma_init) {
|
||||
ret = dws->dma_ops->dma_init(dws);
|
||||
@@ -731,7 +732,7 @@ int dw_spi_resume_host(struct dw_spi *dws)
|
||||
{
|
||||
int ret;
|
||||
|
||||
spi_hw_init(dws);
|
||||
spi_hw_init(&dws->master->dev, dws);
|
||||
ret = spi_master_resume(dws->master);
|
||||
if (ret)
|
||||
dev_err(&dws->master->dev, "fail to start queue (%d)\n", ret);
|
||||
|
||||
Reference in New Issue
Block a user