diff options
Diffstat (limited to 'target/linux/ipq806x/patches-4.4')
11 files changed, 148 insertions, 200 deletions
diff --git a/target/linux/ipq806x/patches-4.4/097-usb-dwc3-add-generic-OF-glue-layer.patch b/target/linux/ipq806x/patches-4.4/097-usb-dwc3-add-generic-OF-glue-layer.patch index 96e9859060..214bedc95a 100644 --- a/target/linux/ipq806x/patches-4.4/097-usb-dwc3-add-generic-OF-glue-layer.patch +++ b/target/linux/ipq806x/patches-4.4/097-usb-dwc3-add-generic-OF-glue-layer.patch @@ -24,14 +24,12 @@ Signed-off-by: Nitheesh Sekar <nsekar@codeaurora.org> 3 files changed, 188 insertions(+) create mode 100644 drivers/usb/dwc3/dwc3-of-simple.c -diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig -index 5a42c45..070e704 100644 --- a/drivers/usb/dwc3/Kconfig +++ b/drivers/usb/dwc3/Kconfig @@ -87,6 +87,15 @@ config USB_DWC3_KEYSTONE Support of USB2/3 functionality in TI Keystone2 platforms. Say 'Y' or 'M' here if you have one such device - + +config USB_DWC3_OF_SIMPLE + tristate "Generic OF Simple Glue Layer" + depends on OF && COMMON_CLK @@ -44,20 +42,15 @@ index 5a42c45..070e704 100644 config USB_DWC3_ST tristate "STMicroelectronics Platforms" depends on ARCH_STI && OF -diff --git a/drivers/usb/dwc3/Makefile b/drivers/usb/dwc3/Makefile -index acc951d..6491f9b 100644 --- a/drivers/usb/dwc3/Makefile +++ b/drivers/usb/dwc3/Makefile -@@ -37,5 +37,6 @@ obj-$(CONFIG_USB_DWC3_OMAP) += dwc3-omap.o +@@ -37,5 +37,6 @@ obj-$(CONFIG_USB_DWC3_OMAP) += dwc3-oma obj-$(CONFIG_USB_DWC3_EXYNOS) += dwc3-exynos.o obj-$(CONFIG_USB_DWC3_PCI) += dwc3-pci.o obj-$(CONFIG_USB_DWC3_KEYSTONE) += dwc3-keystone.o +obj-$(CONFIG_USB_DWC3_OF_SIMPLE) += dwc3-of-simple.o obj-$(CONFIG_USB_DWC3_QCOM) += dwc3-qcom.o obj-$(CONFIG_USB_DWC3_ST) += dwc3-st.o -diff --git a/drivers/usb/dwc3/dwc3-of-simple.c b/drivers/usb/dwc3/dwc3-of-simple.c -new file mode 100644 -index 0000000..60c4c5a --- /dev/null +++ b/drivers/usb/dwc3/dwc3-of-simple.c @@ -0,0 +1,178 @@ @@ -239,6 +232,3 @@ index 0000000..60c4c5a +MODULE_LICENSE("GPL v2"); +MODULE_DESCRIPTION("DesignWare USB3 OF Simple Glue Layer"); +MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>"); --- -2.7.2 - diff --git a/target/linux/ipq806x/patches-4.4/098-usb-dwc3-of-simple-fix-build-warning-on-PM.patch b/target/linux/ipq806x/patches-4.4/098-usb-dwc3-of-simple-fix-build-warning-on-PM.patch index 2fbdd1b4be..b982c82367 100644 --- a/target/linux/ipq806x/patches-4.4/098-usb-dwc3-of-simple-fix-build-warning-on-PM.patch +++ b/target/linux/ipq806x/patches-4.4/098-usb-dwc3-of-simple-fix-build-warning-on-PM.patch @@ -16,26 +16,21 @@ Signed-off-by: Nitheesh Sekar <nsekar@codeaurora.org> drivers/usb/dwc3/dwc3-of-simple.c | 2 ++ 1 file changed, 2 insertions(+) -diff --git a/drivers/usb/dwc3/dwc3-of-simple.c b/drivers/usb/dwc3/dwc3-of-simple.c -index 60c4c5a..9c9f741 100644 --- a/drivers/usb/dwc3/dwc3-of-simple.c +++ b/drivers/usb/dwc3/dwc3-of-simple.c -@@ -122,6 +122,7 @@ static int dwc3_of_simple_remove(struct platform_device *pdev) +@@ -122,6 +122,7 @@ static int dwc3_of_simple_remove(struct return 0; } - + +#ifdef CONFIG_PM static int dwc3_of_simple_runtime_suspend(struct device *dev) { struct dwc3_of_simple *simple = dev_get_drvdata(dev); -@@ -150,6 +151,7 @@ static int dwc3_of_simple_runtime_resume(struct device *dev) - +@@ -150,6 +151,7 @@ static int dwc3_of_simple_runtime_resume + return 0; } +#endif - + static const struct dev_pm_ops dwc3_of_simple_dev_pm_ops = { SET_RUNTIME_PM_OPS(dwc3_of_simple_runtime_suspend, --- -2.7.2 - diff --git a/target/linux/ipq806x/patches-4.4/099-usb-dwc3-Remove-impossible-check-for-of_clk_get_pare.patch b/target/linux/ipq806x/patches-4.4/099-usb-dwc3-Remove-impossible-check-for-of_clk_get_pare.patch index 44506c1256..32f9e34177 100644 --- a/target/linux/ipq806x/patches-4.4/099-usb-dwc3-Remove-impossible-check-for-of_clk_get_pare.patch +++ b/target/linux/ipq806x/patches-4.4/099-usb-dwc3-Remove-impossible-check-for-of_clk_get_pare.patch @@ -19,34 +19,29 @@ Signed-off-by: Nitheesh Sekar <nsekar@codeaurora.org> drivers/usb/dwc3/dwc3-of-simple.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) -diff --git a/drivers/usb/dwc3/dwc3-of-simple.c b/drivers/usb/dwc3/dwc3-of-simple.c -index 9c9f741..9743353 100644 --- a/drivers/usb/dwc3/dwc3-of-simple.c +++ b/drivers/usb/dwc3/dwc3-of-simple.c -@@ -42,6 +42,7 @@ static int dwc3_of_simple_probe(struct platform_device *pdev) +@@ -42,6 +42,7 @@ static int dwc3_of_simple_probe(struct p struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; - + + unsigned int count; int ret; int i; - -@@ -49,11 +50,11 @@ static int dwc3_of_simple_probe(struct platform_device *pdev) + +@@ -49,11 +50,11 @@ static int dwc3_of_simple_probe(struct p if (!simple) return -ENOMEM; - + - ret = of_clk_get_parent_count(np); - if (ret < 0) - return ret; + count = of_clk_get_parent_count(np); + if (!count) + return -ENOENT; - + - simple->num_clocks = ret; + simple->num_clocks = count; - + simple->clks = devm_kcalloc(dev, simple->num_clocks, sizeof(struct clk *), GFP_KERNEL); --- -2.7.2 - diff --git a/target/linux/ipq806x/patches-4.4/100-usb-phy-Add-Qualcomm-DWC3-HS-SS-PHY-drivers.patch b/target/linux/ipq806x/patches-4.4/100-usb-phy-Add-Qualcomm-DWC3-HS-SS-PHY-drivers.patch index d5549191e2..0da1927b44 100644 --- a/target/linux/ipq806x/patches-4.4/100-usb-phy-Add-Qualcomm-DWC3-HS-SS-PHY-drivers.patch +++ b/target/linux/ipq806x/patches-4.4/100-usb-phy-Add-Qualcomm-DWC3-HS-SS-PHY-drivers.patch @@ -1,9 +1,9 @@ --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig -@@ -390,4 +390,15 @@ - Enable this to support the Broadcom Cygnus PCIe PHY. - If unsure, say N. - +@@ -390,4 +390,15 @@ config PHY_CYGNUS_PCIE + Enable this to support the Broadcom Cygnus PCIe PHY. + If unsure, say N. + +config PHY_QCOM_DWC3 + tristate "QCOM DWC3 USB PHY support" + depends on ARCH_QCOM @@ -18,7 +18,7 @@ endmenu --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile -@@ -48,3 +48,4 @@ obj-$(CONFIG_PHY_TUSB1210) += +@@ -48,3 +48,4 @@ obj-$(CONFIG_PHY_TUSB1210) += phy-tusb1 obj-$(CONFIG_PHY_BRCMSTB_SATA) += phy-brcmstb-sata.o obj-$(CONFIG_PHY_PISTACHIO_USB) += phy-pistachio-usb.o obj-$(CONFIG_PHY_CYGNUS_PCIE) += phy-bcm-cygnus-pcie.o diff --git a/target/linux/ipq806x/patches-4.4/710-spi-qup-Make-sure-mode-is-only-determined-once.patch b/target/linux/ipq806x/patches-4.4/710-spi-qup-Make-sure-mode-is-only-determined-once.patch index e5dafd76b4..338c3a0c2b 100644 --- a/target/linux/ipq806x/patches-4.4/710-spi-qup-Make-sure-mode-is-only-determined-once.patch +++ b/target/linux/ipq806x/patches-4.4/710-spi-qup-Make-sure-mode-is-only-determined-once.patch @@ -14,22 +14,20 @@ Change-Id: If3cdd924355e037d77dc8201a72895fac0461aa5 drivers/spi/spi-qup.c | 96 +++++++++++++++++++-------------------------------- 1 file changed, 36 insertions(+), 60 deletions(-) -diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c -index eb2cb8c..714fd4e 100644 --- a/drivers/spi/spi-qup.c +++ b/drivers/spi/spi-qup.c @@ -150,13 +150,20 @@ struct spi_qup { int rx_bytes; int qup_v1; - + - int use_dma; + int mode; struct dma_slave_config rx_conf; struct dma_slave_config tx_conf; - int mode; }; - - + + +static inline bool spi_qup_is_dma_xfer(int mode) +{ + if (mode == QUP_IO_M_MODE_DMOV || mode == QUP_IO_M_MODE_BAM) @@ -41,19 +39,19 @@ index eb2cb8c..714fd4e 100644 static inline bool spi_qup_is_valid_state(struct spi_qup *controller) { u32 opstate = readl_relaxed(controller->base + QUP_STATE); -@@ -427,7 +434,7 @@ static irqreturn_t spi_qup_qup_irq(int irq, void *dev_id) +@@ -427,7 +434,7 @@ static irqreturn_t spi_qup_qup_irq(int i error = -EIO; } - + - if (!controller->use_dma) { + if (!spi_qup_is_dma_xfer(controller->mode)) { if (opflags & QUP_OP_IN_SERVICE_FLAG) spi_qup_fifo_read(controller, xfer); - -@@ -446,43 +453,11 @@ static irqreturn_t spi_qup_qup_irq(int irq, void *dev_id) + +@@ -446,43 +453,11 @@ static irqreturn_t spi_qup_qup_irq(int i return IRQ_HANDLED; } - + -static u32 -spi_qup_get_mode(struct spi_master *master, struct spi_transfer *xfer) -{ @@ -93,17 +91,17 @@ index eb2cb8c..714fd4e 100644 - u32 config, iomode, mode, control; + u32 config, iomode, control; int ret, n_words; - + if (spi->mode & SPI_LOOP && xfer->len > controller->in_fifo_sz) { -@@ -503,24 +478,22 @@ static int spi_qup_io_config(struct spi_device *spi, struct spi_transfer *xfer) +@@ -503,24 +478,22 @@ static int spi_qup_io_config(struct spi_ return -EIO; } - + - controller->mode = mode = spi_qup_get_mode(spi->master, xfer); + controller->w_size = DIV_ROUND_UP(xfer->bits_per_word, 8); + controller->n_words = xfer->len / controller->w_size; n_words = controller->n_words; - + - if (mode == QUP_IO_M_MODE_FIFO) { + if (n_words <= (controller->in_fifo_sz / sizeof(u32))) { + controller->mode = QUP_IO_M_MODE_FIFO; @@ -127,9 +125,9 @@ index eb2cb8c..714fd4e 100644 + controller->mode = QUP_IO_M_MODE_BAM; writel_relaxed(0, controller->base + QUP_MX_READ_CNT); writel_relaxed(0, controller->base + QUP_MX_WRITE_CNT); - -@@ -541,19 +514,26 @@ static int spi_qup_io_config(struct spi_device *spi, struct spi_transfer *xfer) - + +@@ -541,19 +514,26 @@ static int spi_qup_io_config(struct spi_ + writel_relaxed(0, controller->base + QUP_MX_OUTPUT_CNT); } + } else { @@ -140,46 +138,46 @@ index eb2cb8c..714fd4e 100644 + writel_relaxed(0, controller->base + QUP_MX_READ_CNT); + writel_relaxed(0, controller->base + QUP_MX_WRITE_CNT); } - + iomode = readl_relaxed(controller->base + QUP_IO_M_MODES); /* Set input and output transfer mode */ iomode &= ~(QUP_IO_M_INPUT_MODE_MASK | QUP_IO_M_OUTPUT_MODE_MASK); - + - if (!controller->use_dma) + if (!spi_qup_is_dma_xfer(controller->mode)) iomode &= ~(QUP_IO_M_PACK_EN | QUP_IO_M_UNPACK_EN); else iomode |= QUP_IO_M_PACK_EN | QUP_IO_M_UNPACK_EN; - + - iomode |= (mode << QUP_IO_M_OUTPUT_MODE_MASK_SHIFT); - iomode |= (mode << QUP_IO_M_INPUT_MODE_MASK_SHIFT); + iomode |= (controller->mode << QUP_IO_M_OUTPUT_MODE_MASK_SHIFT); + iomode |= (controller->mode << QUP_IO_M_INPUT_MODE_MASK_SHIFT); - + writel_relaxed(iomode, controller->base + QUP_IO_M_MODES); - -@@ -594,7 +574,7 @@ static int spi_qup_io_config(struct spi_device *spi, struct spi_transfer *xfer) + +@@ -594,7 +574,7 @@ static int spi_qup_io_config(struct spi_ config |= xfer->bits_per_word - 1; config |= QUP_CONFIG_SPI_MODE; - + - if (controller->use_dma) { + if (spi_qup_is_dma_xfer(controller->mode)) { if (!xfer->tx_buf) config |= QUP_CONFIG_NO_OUTPUT; if (!xfer->rx_buf) -@@ -612,7 +592,7 @@ static int spi_qup_io_config(struct spi_device *spi, struct spi_transfer *xfer) +@@ -612,7 +592,7 @@ static int spi_qup_io_config(struct spi_ * status change in BAM mode */ - + - if (mode == QUP_IO_M_MODE_BAM) + if (spi_qup_is_dma_xfer(controller->mode)) mask = QUP_OP_IN_SERVICE_FLAG | QUP_OP_OUT_SERVICE_FLAG; - + writel_relaxed(mask, controller->base + QUP_OPERATIONAL_MASK); -@@ -646,7 +626,7 @@ static int spi_qup_transfer_one(struct spi_master *master, +@@ -646,7 +626,7 @@ static int spi_qup_transfer_one(struct s controller->tx_bytes = 0; spin_unlock_irqrestore(&controller->lock, flags); - + - if (controller->use_dma) + if (spi_qup_is_dma_xfer(controller->mode)) ret = spi_qup_do_dma(master, xfer); @@ -188,13 +186,13 @@ index eb2cb8c..714fd4e 100644 @@ -670,7 +650,7 @@ exit: ret = controller->error; spin_unlock_irqrestore(&controller->lock, flags); - + - if (ret && controller->use_dma) + if (ret && spi_qup_is_dma_xfer(controller->mode)) spi_qup_dma_terminate(master, xfer); - + return ret; -@@ -681,9 +661,7 @@ static bool spi_qup_can_dma(struct spi_master *master, struct spi_device *spi, +@@ -681,9 +661,7 @@ static bool spi_qup_can_dma(struct spi_m { struct spi_qup *qup = spi_master_get_devdata(master); size_t dma_align = dma_get_cache_alignment(); @@ -202,24 +200,21 @@ index eb2cb8c..714fd4e 100644 - - qup->use_dma = 0; + int n_words; - + if (xfer->rx_buf && (xfer->len % qup->in_blk_sz || IS_ERR_OR_NULL(master->dma_rx) || -@@ -695,12 +673,10 @@ static bool spi_qup_can_dma(struct spi_master *master, struct spi_device *spi, +@@ -695,12 +673,10 @@ static bool spi_qup_can_dma(struct spi_m !IS_ALIGNED((size_t)xfer->tx_buf, dma_align))) return false; - + - mode = spi_qup_get_mode(master, xfer); - if (mode == QUP_IO_M_MODE_FIFO) + n_words = xfer->len / DIV_ROUND_UP(xfer->bits_per_word, 8); + if (n_words <= (qup->in_fifo_sz / sizeof(u32))) return false; - + - qup->use_dma = 1; - return true; } - --- -2.7.2 - + diff --git a/target/linux/ipq806x/patches-4.4/711-spi-qup-Fix-transaction-done-signaling.patch b/target/linux/ipq806x/patches-4.4/711-spi-qup-Fix-transaction-done-signaling.patch index dd4bad344b..99f455ef3c 100644 --- a/target/linux/ipq806x/patches-4.4/711-spi-qup-Fix-transaction-done-signaling.patch +++ b/target/linux/ipq806x/patches-4.4/711-spi-qup-Fix-transaction-done-signaling.patch @@ -16,20 +16,15 @@ Signed-off-by: Andy Gross <andy.gross@linaro.org> drivers/spi/spi-qup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c -index 714fd4e..fe629f2 100644 --- a/drivers/spi/spi-qup.c +++ b/drivers/spi/spi-qup.c -@@ -447,7 +447,8 @@ static irqreturn_t spi_qup_qup_irq(int irq, void *dev_id) +@@ -447,7 +447,8 @@ static irqreturn_t spi_qup_qup_irq(int i controller->xfer = xfer; spin_unlock_irqrestore(&controller->lock, flags); - + - if (controller->rx_bytes == xfer->len || error) + if ((controller->rx_bytes == xfer->len && + (opflags & QUP_OP_MAX_INPUT_DONE_FLAG)) || error) complete(&controller->done); - + return IRQ_HANDLED; --- -2.7.2 - diff --git a/target/linux/ipq806x/patches-4.4/712-spi-qup-Fix-DMA-mode-to-work-correctly.patch b/target/linux/ipq806x/patches-4.4/712-spi-qup-Fix-DMA-mode-to-work-correctly.patch index d9abc65ce2..9c7bbeabda 100644 --- a/target/linux/ipq806x/patches-4.4/712-spi-qup-Fix-DMA-mode-to-work-correctly.patch +++ b/target/linux/ipq806x/patches-4.4/712-spi-qup-Fix-DMA-mode-to-work-correctly.patch @@ -14,29 +14,27 @@ Signed-off-by: Andy Gross <andy.gross@linaro.org> drivers/spi/spi-qup.c | 95 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 63 insertions(+), 32 deletions(-) -diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c -index fe629f2..089c5e8 100644 --- a/drivers/spi/spi-qup.c +++ b/drivers/spi/spi-qup.c @@ -143,6 +143,7 @@ struct spi_qup { - + struct spi_transfer *xfer; struct completion done; + struct completion dma_tx_done; int error; int w_size; /* bytes per SPI word */ int n_words; -@@ -285,16 +286,16 @@ static void spi_qup_fifo_write(struct spi_qup *controller, - +@@ -285,16 +286,16 @@ static void spi_qup_fifo_write(struct sp + static void spi_qup_dma_done(void *data) { - struct spi_qup *qup = data; + struct completion *done = data; - + - complete(&qup->done); + complete(done); } - + static int spi_qup_prep_sg(struct spi_master *master, struct spi_transfer *xfer, enum dma_transfer_direction dir, - dma_async_tx_callback callback) @@ -47,25 +45,25 @@ index fe629f2..089c5e8 100644 unsigned long flags = DMA_PREP_INTERRUPT | DMA_PREP_FENCE; struct dma_async_tx_descriptor *desc; struct scatterlist *sgl; -@@ -313,11 +314,11 @@ static int spi_qup_prep_sg(struct spi_master *master, struct spi_transfer *xfer, +@@ -313,11 +314,11 @@ static int spi_qup_prep_sg(struct spi_ma } - + desc = dmaengine_prep_slave_sg(chan, sgl, nents, dir, flags); - if (!desc) - return -EINVAL; + if (IS_ERR_OR_NULL(desc)) + return desc ? PTR_ERR(desc) : -EINVAL; - + desc->callback = callback; - desc->callback_param = qup; + desc->callback_param = data; - + cookie = dmaengine_submit(desc); - -@@ -333,18 +334,29 @@ static void spi_qup_dma_terminate(struct spi_master *master, + +@@ -333,18 +334,29 @@ static void spi_qup_dma_terminate(struct dmaengine_terminate_all(master->dma_rx); } - + -static int spi_qup_do_dma(struct spi_master *master, struct spi_transfer *xfer) +static int spi_qup_do_dma(struct spi_master *master, struct spi_transfer *xfer, +unsigned long timeout) @@ -73,7 +71,7 @@ index fe629f2..089c5e8 100644 + struct spi_qup *qup = spi_master_get_devdata(master); dma_async_tx_callback rx_done = NULL, tx_done = NULL; int ret; - + + /* before issuing the descriptors, set the QUP to run */ + ret = spi_qup_set_state(qup, QUP_STATE_RUN); + if (ret) { @@ -87,27 +85,27 @@ index fe629f2..089c5e8 100644 + + if (xfer->tx_buf) tx_done = spi_qup_dma_done; - + if (xfer->rx_buf) { - ret = spi_qup_prep_sg(master, xfer, DMA_DEV_TO_MEM, rx_done); + ret = spi_qup_prep_sg(master, xfer, DMA_DEV_TO_MEM, rx_done, + &qup->done); if (ret) return ret; - -@@ -352,17 +364,26 @@ static int spi_qup_do_dma(struct spi_master *master, struct spi_transfer *xfer) + +@@ -352,17 +364,26 @@ static int spi_qup_do_dma(struct spi_mas } - + if (xfer->tx_buf) { - ret = spi_qup_prep_sg(master, xfer, DMA_MEM_TO_DEV, tx_done); + ret = spi_qup_prep_sg(master, xfer, DMA_MEM_TO_DEV, tx_done, + &qup->dma_tx_done); if (ret) return ret; - + dma_async_issue_pending(master->dma_tx); } - + - return 0; + if (xfer->rx_buf && !wait_for_completion_timeout(&qup->done, timeout)) + return -ETIMEDOUT; @@ -118,17 +116,17 @@ index fe629f2..089c5e8 100644 + + return ret; } - + -static int spi_qup_do_pio(struct spi_master *master, struct spi_transfer *xfer) +static int spi_qup_do_pio(struct spi_master *master, struct spi_transfer *xfer, + unsigned long timeout) { struct spi_qup *qup = spi_master_get_devdata(master); int ret; -@@ -382,6 +403,15 @@ static int spi_qup_do_pio(struct spi_master *master, struct spi_transfer *xfer) +@@ -382,6 +403,15 @@ static int spi_qup_do_pio(struct spi_mas if (qup->mode == QUP_IO_M_MODE_FIFO) spi_qup_fifo_write(qup, xfer); - + + ret = spi_qup_set_state(qup, QUP_STATE_RUN); + if (ret) { + dev_warn(qup->dev, "cannot set RUN state\n"); @@ -140,36 +138,36 @@ index fe629f2..089c5e8 100644 + return 0; } - -@@ -430,7 +460,6 @@ static irqreturn_t spi_qup_qup_irq(int irq, void *dev_id) + +@@ -430,7 +460,6 @@ static irqreturn_t spi_qup_qup_irq(int i dev_warn(controller->dev, "CLK_OVER_RUN\n"); if (spi_err & SPI_ERROR_CLK_UNDER_RUN) dev_warn(controller->dev, "CLK_UNDER_RUN\n"); - error = -EIO; } - -@@ -619,6 +648,7 @@ static int spi_qup_transfer_one(struct spi_master *master, + +@@ -619,6 +648,7 @@ static int spi_qup_transfer_one(struct s timeout = 100 * msecs_to_jiffies(timeout); - + reinit_completion(&controller->done); + reinit_completion(&controller->dma_tx_done); - + spin_lock_irqsave(&controller->lock, flags); controller->xfer = xfer; -@@ -628,21 +658,13 @@ static int spi_qup_transfer_one(struct spi_master *master, +@@ -628,21 +658,13 @@ static int spi_qup_transfer_one(struct s spin_unlock_irqrestore(&controller->lock, flags); - + if (spi_qup_is_dma_xfer(controller->mode)) - ret = spi_qup_do_dma(master, xfer); + ret = spi_qup_do_dma(master, xfer, timeout); else - ret = spi_qup_do_pio(master, xfer); + ret = spi_qup_do_pio(master, xfer, timeout); - + if (ret) goto exit; - + - if (spi_qup_set_state(controller, QUP_STATE_RUN)) { - dev_warn(controller->dev, "cannot set EXECUTE state\n"); - goto exit; @@ -181,10 +179,10 @@ index fe629f2..089c5e8 100644 exit: spi_qup_set_state(controller, QUP_STATE_RESET); spin_lock_irqsave(&controller->lock, flags); -@@ -664,15 +686,23 @@ static bool spi_qup_can_dma(struct spi_master *master, struct spi_device *spi, +@@ -664,15 +686,23 @@ static bool spi_qup_can_dma(struct spi_m size_t dma_align = dma_get_cache_alignment(); int n_words; - + - if (xfer->rx_buf && (xfer->len % qup->in_blk_sz || - IS_ERR_OR_NULL(master->dma_rx) || - !IS_ALIGNED((size_t)xfer->rx_buf, dma_align))) @@ -193,7 +191,7 @@ index fe629f2..089c5e8 100644 + if (!IS_ALIGNED((size_t)xfer->rx_buf, dma_align) || + IS_ERR_OR_NULL(master->dma_rx)) + return false; - + - if (xfer->tx_buf && (xfer->len % qup->out_blk_sz || - IS_ERR_OR_NULL(master->dma_tx) || - !IS_ALIGNED((size_t)xfer->tx_buf, dma_align))) @@ -210,17 +208,14 @@ index fe629f2..089c5e8 100644 + if (qup->qup_v1 && (xfer->len % qup->out_blk_sz)) + return false; + } - + n_words = xfer->len / DIV_ROUND_UP(xfer->bits_per_word, 8); if (n_words <= (qup->in_fifo_sz / sizeof(u32))) -@@ -875,6 +905,7 @@ static int spi_qup_probe(struct platform_device *pdev) - +@@ -875,6 +905,7 @@ static int spi_qup_probe(struct platform + spin_lock_init(&controller->lock); init_completion(&controller->done); + init_completion(&controller->dma_tx_done); - + iomode = readl_relaxed(base + QUP_IO_M_MODES); - --- -2.7.2 - + diff --git a/target/linux/ipq806x/patches-4.4/713-spi-qup-Fix-block-mode-to-work-correctly.patch b/target/linux/ipq806x/patches-4.4/713-spi-qup-Fix-block-mode-to-work-correctly.patch index 7a05ecdba5..eb0b45cd1c 100644 --- a/target/linux/ipq806x/patches-4.4/713-spi-qup-Fix-block-mode-to-work-correctly.patch +++ b/target/linux/ipq806x/patches-4.4/713-spi-qup-Fix-block-mode-to-work-correctly.patch @@ -14,13 +14,11 @@ Change-Id: I4b4f4d25be57e6e8148f6f0d24bed376eb287ecf drivers/spi/spi-qup.c | 181 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 141 insertions(+), 40 deletions(-) -diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c -index 089c5e8..e487416 100644 --- a/drivers/spi/spi-qup.c +++ b/drivers/spi/spi-qup.c @@ -83,6 +83,8 @@ #define QUP_IO_M_MODE_BAM 3 - + /* QUP_OPERATIONAL fields */ +#define QUP_OP_IN_BLOCK_READ_REQ BIT(13) +#define QUP_OP_OUT_BLOCK_WRITE_REQ BIT(12) @@ -30,20 +28,20 @@ index 089c5e8..e487416 100644 @@ -156,6 +158,12 @@ struct spi_qup { struct dma_slave_config tx_conf; }; - + +static inline bool spi_qup_is_flag_set(struct spi_qup *controller, u32 flag) +{ + u32 opflag = readl_relaxed(controller->base + QUP_OPERATIONAL); + + return opflag & flag; +} - + static inline bool spi_qup_is_dma_xfer(int mode) { -@@ -217,29 +225,26 @@ static int spi_qup_set_state(struct spi_qup *controller, u32 state) +@@ -217,29 +225,26 @@ static int spi_qup_set_state(struct spi_ return 0; } - + -static void spi_qup_fifo_read(struct spi_qup *controller, - struct spi_transfer *xfer) +static void spi_qup_read_from_fifo(struct spi_qup *controller, @@ -54,18 +52,18 @@ index 089c5e8..e487416 100644 - int idx, shift, w_size; - - w_size = controller->w_size; -- -- while (controller->rx_bytes < xfer->len) { + int i, shift, num_bytes; + u32 word; - + +- while (controller->rx_bytes < xfer->len) { +- - state = readl_relaxed(controller->base + QUP_OPERATIONAL); - if (0 == (state & QUP_OP_IN_FIFO_NOT_EMPTY)) - break; + for (; num_words; num_words--) { - + word = readl_relaxed(controller->base + QUP_INPUT_FIFO); - + + num_bytes = min_t(int, xfer->len - controller->rx_bytes, + controller->w_size); + @@ -74,13 +72,13 @@ index 089c5e8..e487416 100644 + controller->rx_bytes += num_bytes; continue; } - + - for (idx = 0; idx < w_size; idx++, controller->rx_bytes++) { + for (i = 0; i < num_bytes; i++, controller->rx_bytes++) { /* * The data format depends on bytes per SPI word: * 4 bytes: 0x12345678 -@@ -247,38 +252,80 @@ static void spi_qup_fifo_read(struct spi_qup *controller, +@@ -247,38 +252,80 @@ static void spi_qup_fifo_read(struct spi * 1 byte : 0x00000012 */ shift = BITS_PER_BYTE; @@ -90,7 +88,7 @@ index 089c5e8..e487416 100644 } } } - + -static void spi_qup_fifo_write(struct spi_qup *controller, +static void spi_qup_read(struct spi_qup *controller, struct spi_transfer *xfer) @@ -117,24 +115,24 @@ index 089c5e8..e487416 100644 + if (!spi_qup_is_flag_set(controller, + QUP_OP_IN_FIFO_NOT_EMPTY)) + break; -+ + +- w_size = controller->w_size; + num_words = 1; + } - -- w_size = controller->w_size; ++ + /* read up to the maximum transfer size available */ + spi_qup_read_from_fifo(controller, xfer, num_words); - + - while (controller->tx_bytes < xfer->len) { + remainder -= num_words; - + - state = readl_relaxed(controller->base + QUP_OPERATIONAL); - if (state & QUP_OP_OUT_FIFO_FULL) + /* if block mode, check to see if next block is available */ + if (is_block_mode && !spi_qup_is_flag_set(controller, + QUP_OP_IN_BLOCK_READ_REQ)) break; - + + } while (remainder); + + /* @@ -158,7 +156,7 @@ index 089c5e8..e487416 100644 + for (; num_words; num_words--) { word = 0; - for (idx = 0; idx < w_size; idx++, controller->tx_bytes++) { - + - if (!tx_buf) { - controller->tx_bytes += w_size; - break; @@ -169,18 +167,18 @@ index 089c5e8..e487416 100644 + data = tx_buf[controller->tx_bytes + i]; + word |= data << (BITS_PER_BYTE * (3 - i)); } - + - data = tx_buf[controller->tx_bytes]; - word |= data << (BITS_PER_BYTE * (3 - idx)); - } + controller->tx_bytes += num_bytes; - + writel_relaxed(word, controller->base + QUP_OUTPUT_FIFO); } @@ -291,6 +338,44 @@ static void spi_qup_dma_done(void *data) complete(done); } - + +static void spi_qup_write(struct spi_qup *controller, + struct spi_transfer *xfer) +{ @@ -225,36 +223,36 @@ index 089c5e8..e487416 100644 @@ -348,11 +433,13 @@ unsigned long timeout) return ret; } - + - if (xfer->rx_buf) - rx_done = spi_qup_dma_done; + if (!qup->qup_v1) { + if (xfer->rx_buf) + rx_done = spi_qup_dma_done; - + - if (xfer->tx_buf) - tx_done = spi_qup_dma_done; + if (xfer->tx_buf) + tx_done = spi_qup_dma_done; + } - + if (xfer->rx_buf) { ret = spi_qup_prep_sg(master, xfer, DMA_DEV_TO_MEM, rx_done, -@@ -401,7 +488,7 @@ static int spi_qup_do_pio(struct spi_master *master, struct spi_transfer *xfer, +@@ -401,7 +488,7 @@ static int spi_qup_do_pio(struct spi_mas } - + if (qup->mode == QUP_IO_M_MODE_FIFO) - spi_qup_fifo_write(qup, xfer); + spi_qup_write(qup, xfer); - + ret = spi_qup_set_state(qup, QUP_STATE_RUN); if (ret) { -@@ -434,10 +521,11 @@ static irqreturn_t spi_qup_qup_irq(int irq, void *dev_id) - +@@ -434,10 +521,11 @@ static irqreturn_t spi_qup_qup_irq(int i + writel_relaxed(qup_err, controller->base + QUP_ERROR_FLAGS); writel_relaxed(spi_err, controller->base + SPI_ERROR_FLAGS); - writel_relaxed(opflags, controller->base + QUP_OPERATIONAL); - + if (!xfer) { - dev_err_ratelimited(controller->dev, "unexpected irq %08x %08x %08x\n", + writel_relaxed(opflags, controller->base + QUP_OPERATIONAL); @@ -263,10 +261,10 @@ index 089c5e8..e487416 100644 qup_err, spi_err, opflags); return IRQ_HANDLED; } -@@ -463,12 +551,20 @@ static irqreturn_t spi_qup_qup_irq(int irq, void *dev_id) +@@ -463,12 +551,20 @@ static irqreturn_t spi_qup_qup_irq(int i error = -EIO; } - + - if (!spi_qup_is_dma_xfer(controller->mode)) { + if (spi_qup_is_dma_xfer(controller->mode)) { + writel_relaxed(opflags, controller->base + QUP_OPERATIONAL); @@ -280,24 +278,24 @@ index 089c5e8..e487416 100644 if (opflags & QUP_OP_IN_SERVICE_FLAG) - spi_qup_fifo_read(controller, xfer); + spi_qup_read(controller, xfer); - + if (opflags & QUP_OP_OUT_SERVICE_FLAG) - spi_qup_fifo_write(controller, xfer); + spi_qup_write(controller, xfer); } - + spin_lock_irqsave(&controller->lock, flags); -@@ -476,6 +572,9 @@ static irqreturn_t spi_qup_qup_irq(int irq, void *dev_id) +@@ -476,6 +572,9 @@ static irqreturn_t spi_qup_qup_irq(int i controller->xfer = xfer; spin_unlock_irqrestore(&controller->lock, flags); - + + /* re-read opflags as flags may have changed due to actions above */ + opflags = readl_relaxed(controller->base + QUP_OPERATIONAL); + if ((controller->rx_bytes == xfer->len && (opflags & QUP_OP_MAX_INPUT_DONE_FLAG)) || error) complete(&controller->done); -@@ -519,11 +618,13 @@ static int spi_qup_io_config(struct spi_device *spi, struct spi_transfer *xfer) +@@ -519,11 +618,13 @@ static int spi_qup_io_config(struct spi_ /* must be zero for FIFO */ writel_relaxed(0, controller->base + QUP_MX_INPUT_CNT); writel_relaxed(0, controller->base + QUP_MX_OUTPUT_CNT); @@ -311,7 +309,4 @@ index 089c5e8..e487416 100644 + /* must be zero for BLOCK and BAM */ writel_relaxed(0, controller->base + QUP_MX_READ_CNT); writel_relaxed(0, controller->base + QUP_MX_WRITE_CNT); - --- -2.7.2 - + diff --git a/target/linux/ipq806x/patches-4.4/714-spi-qup-properly-detect-extra-interrupts.patch b/target/linux/ipq806x/patches-4.4/714-spi-qup-properly-detect-extra-interrupts.patch index d8a9b31462..0039962481 100644 --- a/target/linux/ipq806x/patches-4.4/714-spi-qup-properly-detect-extra-interrupts.patch +++ b/target/linux/ipq806x/patches-4.4/714-spi-qup-properly-detect-extra-interrupts.patch @@ -17,22 +17,20 @@ Signed-off-by: Matthew McClintock <mmcclint@codeaurora.org> drivers/spi/spi-qup.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) -diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c -index e487416..45e30c7 100644 --- a/drivers/spi/spi-qup.c +++ b/drivers/spi/spi-qup.c -@@ -509,6 +509,7 @@ static irqreturn_t spi_qup_qup_irq(int irq, void *dev_id) +@@ -509,6 +509,7 @@ static irqreturn_t spi_qup_qup_irq(int i u32 opflags, qup_err, spi_err; unsigned long flags; int error = 0; + bool done = 0; - + spin_lock_irqsave(&controller->lock, flags); xfer = controller->xfer; -@@ -567,16 +568,19 @@ static irqreturn_t spi_qup_qup_irq(int irq, void *dev_id) +@@ -567,16 +568,19 @@ static irqreturn_t spi_qup_qup_irq(int i spi_qup_write(controller, xfer); } - + - spin_lock_irqsave(&controller->lock, flags); - controller->error = error; - controller->xfer = xfer; @@ -40,7 +38,7 @@ index e487416..45e30c7 100644 - /* re-read opflags as flags may have changed due to actions above */ opflags = readl_relaxed(controller->base + QUP_OPERATIONAL); - + if ((controller->rx_bytes == xfer->len && (opflags & QUP_OP_MAX_INPUT_DONE_FLAG)) || error) + done = true; @@ -52,9 +50,9 @@ index e487416..45e30c7 100644 + + if (done) complete(&controller->done); - + return IRQ_HANDLED; -@@ -769,7 +773,6 @@ static int spi_qup_transfer_one(struct spi_master *master, +@@ -769,7 +773,6 @@ static int spi_qup_transfer_one(struct s exit: spi_qup_set_state(controller, QUP_STATE_RESET); spin_lock_irqsave(&controller->lock, flags); @@ -62,6 +60,3 @@ index e487416..45e30c7 100644 if (!ret) ret = controller->error; spin_unlock_irqrestore(&controller->lock, flags); --- -2.7.2 - diff --git a/target/linux/ipq806x/patches-4.4/715-spi-qup-don-t-re-read-opflags-to-see-if-transaction-.patch b/target/linux/ipq806x/patches-4.4/715-spi-qup-don-t-re-read-opflags-to-see-if-transaction-.patch index 54711a1d05..a08b442d50 100644 --- a/target/linux/ipq806x/patches-4.4/715-spi-qup-don-t-re-read-opflags-to-see-if-transaction-.patch +++ b/target/linux/ipq806x/patches-4.4/715-spi-qup-don-t-re-read-opflags-to-see-if-transaction-.patch @@ -13,20 +13,15 @@ Signed-off-by: Matthew McClintock <mmcclint@codeaurora.org> drivers/spi/spi-qup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c -index 45e30c7..59bc37c 100644 --- a/drivers/spi/spi-qup.c +++ b/drivers/spi/spi-qup.c -@@ -569,7 +569,8 @@ static irqreturn_t spi_qup_qup_irq(int irq, void *dev_id) +@@ -569,7 +569,8 @@ static irqreturn_t spi_qup_qup_irq(int i } - + /* re-read opflags as flags may have changed due to actions above */ - opflags = readl_relaxed(controller->base + QUP_OPERATIONAL); + if (opflags & QUP_OP_OUT_SERVICE_FLAG) + opflags = readl_relaxed(controller->base + QUP_OPERATIONAL); - + if ((controller->rx_bytes == xfer->len && (opflags & QUP_OP_MAX_INPUT_DONE_FLAG)) || error) --- -2.7.2 - diff --git a/target/linux/ipq806x/patches-4.4/801-override-compiler-flags.patch b/target/linux/ipq806x/patches-4.4/801-override-compiler-flags.patch index 164d9ee4fb..5b419a75d8 100644 --- a/target/linux/ipq806x/patches-4.4/801-override-compiler-flags.patch +++ b/target/linux/ipq806x/patches-4.4/801-override-compiler-flags.patch @@ -1,8 +1,6 @@ -diff --git a/arch/arm/Makefile b/arch/arm/Makefile -index 2c2b28e..64c037d 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile -@@ -67,7 +67,7 @@ KBUILD_CFLAGS += $(call cc-option,-fno-ipa-sra) +@@ -72,7 +72,7 @@ KBUILD_CFLAGS += $(call cc-option,-fno-i # macro, but instead defines a whole series of macros which makes # testing for a specific architecture or later rather impossible. arch-$(CONFIG_CPU_32v7M) =-D__LINUX_ARM_ARCH__=7 -march=armv7-m -Wa,-march=armv7-m |