| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2011-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com> |
|---|
| 3 | 4 | * Copyright (C) 2016 Hauke Mehrtens <hauke@hauke-m.de> |
|---|
| 4 | | - * |
|---|
| 5 | | - * This program is free software; you can distribute it and/or modify it |
|---|
| 6 | | - * under the terms of the GNU General Public License (Version 2) as |
|---|
| 7 | | - * published by the Free Software Foundation. |
|---|
| 8 | 5 | */ |
|---|
| 9 | 6 | |
|---|
| 10 | 7 | #include <linux/kernel.h> |
|---|
| .. | .. |
|---|
| 18 | 15 | #include <linux/completion.h> |
|---|
| 19 | 16 | #include <linux/spinlock.h> |
|---|
| 20 | 17 | #include <linux/err.h> |
|---|
| 21 | | -#include <linux/gpio.h> |
|---|
| 22 | 18 | #include <linux/pm_runtime.h> |
|---|
| 23 | 19 | #include <linux/spi/spi.h> |
|---|
| 24 | 20 | |
|---|
| .. | .. |
|---|
| 53 | 49 | #define LTQ_SPI_RXCNT 0x84 |
|---|
| 54 | 50 | #define LTQ_SPI_DMACON 0xec |
|---|
| 55 | 51 | #define LTQ_SPI_IRNEN 0xf4 |
|---|
| 56 | | -#define LTQ_SPI_IRNICR 0xf8 |
|---|
| 57 | | -#define LTQ_SPI_IRNCR 0xfc |
|---|
| 58 | 52 | |
|---|
| 59 | 53 | #define LTQ_SPI_CLC_SMC_S 16 /* Clock divider for sleep mode */ |
|---|
| 60 | 54 | #define LTQ_SPI_CLC_SMC_M (0xFF << LTQ_SPI_CLC_SMC_S) |
|---|
| .. | .. |
|---|
| 64 | 58 | #define LTQ_SPI_CLC_DISR BIT(0) /* Disable request bit */ |
|---|
| 65 | 59 | |
|---|
| 66 | 60 | #define LTQ_SPI_ID_TXFS_S 24 /* Implemented TX FIFO size */ |
|---|
| 67 | | -#define LTQ_SPI_ID_TXFS_M (0x3F << LTQ_SPI_ID_TXFS_S) |
|---|
| 68 | 61 | #define LTQ_SPI_ID_RXFS_S 16 /* Implemented RX FIFO size */ |
|---|
| 69 | | -#define LTQ_SPI_ID_RXFS_M (0x3F << LTQ_SPI_ID_RXFS_S) |
|---|
| 70 | 62 | #define LTQ_SPI_ID_MOD_S 8 /* Module ID */ |
|---|
| 71 | 63 | #define LTQ_SPI_ID_MOD_M (0xff << LTQ_SPI_ID_MOD_S) |
|---|
| 72 | 64 | #define LTQ_SPI_ID_CFG_S 5 /* DMA interface support */ |
|---|
| .. | .. |
|---|
| 129 | 121 | LTQ_SPI_WHBSTATE_CLRTUE) |
|---|
| 130 | 122 | |
|---|
| 131 | 123 | #define LTQ_SPI_RXFCON_RXFITL_S 8 /* FIFO interrupt trigger level */ |
|---|
| 132 | | -#define LTQ_SPI_RXFCON_RXFITL_M (0x3F << LTQ_SPI_RXFCON_RXFITL_S) |
|---|
| 133 | 124 | #define LTQ_SPI_RXFCON_RXFLU BIT(1) /* FIFO flush */ |
|---|
| 134 | 125 | #define LTQ_SPI_RXFCON_RXFEN BIT(0) /* FIFO enable */ |
|---|
| 135 | 126 | |
|---|
| 136 | 127 | #define LTQ_SPI_TXFCON_TXFITL_S 8 /* FIFO interrupt trigger level */ |
|---|
| 137 | | -#define LTQ_SPI_TXFCON_TXFITL_M (0x3F << LTQ_SPI_TXFCON_TXFITL_S) |
|---|
| 138 | 128 | #define LTQ_SPI_TXFCON_TXFLU BIT(1) /* FIFO flush */ |
|---|
| 139 | 129 | #define LTQ_SPI_TXFCON_TXFEN BIT(0) /* FIFO enable */ |
|---|
| 140 | 130 | |
|---|
| 141 | 131 | #define LTQ_SPI_FSTAT_RXFFL_S 0 |
|---|
| 142 | | -#define LTQ_SPI_FSTAT_RXFFL_M (0x3f << LTQ_SPI_FSTAT_RXFFL_S) |
|---|
| 143 | 132 | #define LTQ_SPI_FSTAT_TXFFL_S 8 |
|---|
| 144 | | -#define LTQ_SPI_FSTAT_TXFFL_M (0x3f << LTQ_SPI_FSTAT_TXFFL_S) |
|---|
| 145 | 133 | |
|---|
| 146 | 134 | #define LTQ_SPI_GPOCON_ISCSBN_S 8 |
|---|
| 147 | 135 | #define LTQ_SPI_GPOCON_INVOUTN_S 0 |
|---|
| .. | .. |
|---|
| 161 | 149 | #define LTQ_SPI_IRNEN_T_XRX BIT(0) /* Receive end interrupt request */ |
|---|
| 162 | 150 | #define LTQ_SPI_IRNEN_ALL 0x1F |
|---|
| 163 | 151 | |
|---|
| 152 | +struct lantiq_ssc_spi; |
|---|
| 153 | + |
|---|
| 164 | 154 | struct lantiq_ssc_hwcfg { |
|---|
| 165 | | - unsigned int irnen_r; |
|---|
| 166 | | - unsigned int irnen_t; |
|---|
| 155 | + int (*cfg_irq)(struct platform_device *pdev, struct lantiq_ssc_spi *spi); |
|---|
| 156 | + unsigned int irnen_r; |
|---|
| 157 | + unsigned int irnen_t; |
|---|
| 158 | + unsigned int irncr; |
|---|
| 159 | + unsigned int irnicr; |
|---|
| 160 | + bool irq_ack; |
|---|
| 161 | + u32 fifo_size_mask; |
|---|
| 167 | 162 | }; |
|---|
| 168 | 163 | |
|---|
| 169 | 164 | struct lantiq_ssc_spi { |
|---|
| .. | .. |
|---|
| 213 | 208 | |
|---|
| 214 | 209 | static unsigned int tx_fifo_level(const struct lantiq_ssc_spi *spi) |
|---|
| 215 | 210 | { |
|---|
| 211 | + const struct lantiq_ssc_hwcfg *hwcfg = spi->hwcfg; |
|---|
| 216 | 212 | u32 fstat = lantiq_ssc_readl(spi, LTQ_SPI_FSTAT); |
|---|
| 217 | 213 | |
|---|
| 218 | | - return (fstat & LTQ_SPI_FSTAT_TXFFL_M) >> LTQ_SPI_FSTAT_TXFFL_S; |
|---|
| 214 | + return (fstat >> LTQ_SPI_FSTAT_TXFFL_S) & hwcfg->fifo_size_mask; |
|---|
| 219 | 215 | } |
|---|
| 220 | 216 | |
|---|
| 221 | 217 | static unsigned int rx_fifo_level(const struct lantiq_ssc_spi *spi) |
|---|
| 222 | 218 | { |
|---|
| 219 | + const struct lantiq_ssc_hwcfg *hwcfg = spi->hwcfg; |
|---|
| 223 | 220 | u32 fstat = lantiq_ssc_readl(spi, LTQ_SPI_FSTAT); |
|---|
| 224 | 221 | |
|---|
| 225 | | - return fstat & LTQ_SPI_FSTAT_RXFFL_M; |
|---|
| 222 | + return (fstat >> LTQ_SPI_FSTAT_RXFFL_S) & hwcfg->fifo_size_mask; |
|---|
| 226 | 223 | } |
|---|
| 227 | 224 | |
|---|
| 228 | 225 | static unsigned int tx_fifo_free(const struct lantiq_ssc_spi *spi) |
|---|
| .. | .. |
|---|
| 395 | 392 | u32 gpocon; |
|---|
| 396 | 393 | |
|---|
| 397 | 394 | /* GPIOs are used for CS */ |
|---|
| 398 | | - if (gpio_is_valid(spidev->cs_gpio)) |
|---|
| 395 | + if (spidev->cs_gpiod) |
|---|
| 399 | 396 | return 0; |
|---|
| 400 | 397 | |
|---|
| 401 | 398 | dev_dbg(spi->dev, "using internal chipselect %u\n", cs); |
|---|
| .. | .. |
|---|
| 626 | 623 | static irqreturn_t lantiq_ssc_xmit_interrupt(int irq, void *data) |
|---|
| 627 | 624 | { |
|---|
| 628 | 625 | struct lantiq_ssc_spi *spi = data; |
|---|
| 626 | + const struct lantiq_ssc_hwcfg *hwcfg = spi->hwcfg; |
|---|
| 627 | + u32 val = lantiq_ssc_readl(spi, hwcfg->irncr); |
|---|
| 628 | + |
|---|
| 629 | + spin_lock(&spi->lock); |
|---|
| 630 | + if (hwcfg->irq_ack) |
|---|
| 631 | + lantiq_ssc_writel(spi, val, hwcfg->irncr); |
|---|
| 629 | 632 | |
|---|
| 630 | 633 | if (spi->tx) { |
|---|
| 631 | 634 | if (spi->rx && spi->rx_todo) |
|---|
| .. | .. |
|---|
| 648 | 651 | } |
|---|
| 649 | 652 | } |
|---|
| 650 | 653 | |
|---|
| 654 | + spin_unlock(&spi->lock); |
|---|
| 651 | 655 | return IRQ_HANDLED; |
|---|
| 652 | 656 | |
|---|
| 653 | 657 | completed: |
|---|
| 654 | 658 | queue_work(spi->wq, &spi->work); |
|---|
| 659 | + spin_unlock(&spi->lock); |
|---|
| 655 | 660 | |
|---|
| 656 | 661 | return IRQ_HANDLED; |
|---|
| 657 | 662 | } |
|---|
| .. | .. |
|---|
| 659 | 664 | static irqreturn_t lantiq_ssc_err_interrupt(int irq, void *data) |
|---|
| 660 | 665 | { |
|---|
| 661 | 666 | struct lantiq_ssc_spi *spi = data; |
|---|
| 667 | + const struct lantiq_ssc_hwcfg *hwcfg = spi->hwcfg; |
|---|
| 662 | 668 | u32 stat = lantiq_ssc_readl(spi, LTQ_SPI_STAT); |
|---|
| 669 | + u32 val = lantiq_ssc_readl(spi, hwcfg->irncr); |
|---|
| 663 | 670 | |
|---|
| 664 | 671 | if (!(stat & LTQ_SPI_STAT_ERRORS)) |
|---|
| 665 | 672 | return IRQ_NONE; |
|---|
| 673 | + |
|---|
| 674 | + spin_lock(&spi->lock); |
|---|
| 675 | + if (hwcfg->irq_ack) |
|---|
| 676 | + lantiq_ssc_writel(spi, val, hwcfg->irncr); |
|---|
| 666 | 677 | |
|---|
| 667 | 678 | if (stat & LTQ_SPI_STAT_RUE) |
|---|
| 668 | 679 | dev_err(spi->dev, "receive underflow error\n"); |
|---|
| .. | .. |
|---|
| 684 | 695 | if (spi->master->cur_msg) |
|---|
| 685 | 696 | spi->master->cur_msg->status = -EIO; |
|---|
| 686 | 697 | queue_work(spi->wq, &spi->work); |
|---|
| 698 | + spin_unlock(&spi->lock); |
|---|
| 699 | + |
|---|
| 700 | + return IRQ_HANDLED; |
|---|
| 701 | +} |
|---|
| 702 | + |
|---|
| 703 | +static irqreturn_t intel_lgm_ssc_isr(int irq, void *data) |
|---|
| 704 | +{ |
|---|
| 705 | + struct lantiq_ssc_spi *spi = data; |
|---|
| 706 | + const struct lantiq_ssc_hwcfg *hwcfg = spi->hwcfg; |
|---|
| 707 | + u32 val = lantiq_ssc_readl(spi, hwcfg->irncr); |
|---|
| 708 | + |
|---|
| 709 | + if (!(val & LTQ_SPI_IRNEN_ALL)) |
|---|
| 710 | + return IRQ_NONE; |
|---|
| 711 | + |
|---|
| 712 | + if (val & LTQ_SPI_IRNEN_E) |
|---|
| 713 | + return lantiq_ssc_err_interrupt(irq, data); |
|---|
| 714 | + |
|---|
| 715 | + if ((val & hwcfg->irnen_t) || (val & hwcfg->irnen_r)) |
|---|
| 716 | + return lantiq_ssc_xmit_interrupt(irq, data); |
|---|
| 687 | 717 | |
|---|
| 688 | 718 | return IRQ_HANDLED; |
|---|
| 689 | 719 | } |
|---|
| .. | .. |
|---|
| 788 | 818 | return transfer_start(spi, spidev, t); |
|---|
| 789 | 819 | } |
|---|
| 790 | 820 | |
|---|
| 821 | +static int intel_lgm_cfg_irq(struct platform_device *pdev, struct lantiq_ssc_spi *spi) |
|---|
| 822 | +{ |
|---|
| 823 | + int irq; |
|---|
| 824 | + |
|---|
| 825 | + irq = platform_get_irq(pdev, 0); |
|---|
| 826 | + if (irq < 0) |
|---|
| 827 | + return irq; |
|---|
| 828 | + |
|---|
| 829 | + return devm_request_irq(&pdev->dev, irq, intel_lgm_ssc_isr, 0, "spi", spi); |
|---|
| 830 | +} |
|---|
| 831 | + |
|---|
| 832 | +static int lantiq_cfg_irq(struct platform_device *pdev, struct lantiq_ssc_spi *spi) |
|---|
| 833 | +{ |
|---|
| 834 | + int irq, err; |
|---|
| 835 | + |
|---|
| 836 | + irq = platform_get_irq_byname(pdev, LTQ_SPI_RX_IRQ_NAME); |
|---|
| 837 | + if (irq < 0) |
|---|
| 838 | + return irq; |
|---|
| 839 | + |
|---|
| 840 | + err = devm_request_irq(&pdev->dev, irq, lantiq_ssc_xmit_interrupt, |
|---|
| 841 | + 0, LTQ_SPI_RX_IRQ_NAME, spi); |
|---|
| 842 | + if (err) |
|---|
| 843 | + return err; |
|---|
| 844 | + |
|---|
| 845 | + irq = platform_get_irq_byname(pdev, LTQ_SPI_TX_IRQ_NAME); |
|---|
| 846 | + if (irq < 0) |
|---|
| 847 | + return irq; |
|---|
| 848 | + |
|---|
| 849 | + err = devm_request_irq(&pdev->dev, irq, lantiq_ssc_xmit_interrupt, |
|---|
| 850 | + 0, LTQ_SPI_TX_IRQ_NAME, spi); |
|---|
| 851 | + |
|---|
| 852 | + if (err) |
|---|
| 853 | + return err; |
|---|
| 854 | + |
|---|
| 855 | + irq = platform_get_irq_byname(pdev, LTQ_SPI_ERR_IRQ_NAME); |
|---|
| 856 | + if (irq < 0) |
|---|
| 857 | + return irq; |
|---|
| 858 | + |
|---|
| 859 | + err = devm_request_irq(&pdev->dev, irq, lantiq_ssc_err_interrupt, |
|---|
| 860 | + 0, LTQ_SPI_ERR_IRQ_NAME, spi); |
|---|
| 861 | + return err; |
|---|
| 862 | +} |
|---|
| 863 | + |
|---|
| 791 | 864 | static const struct lantiq_ssc_hwcfg lantiq_ssc_xway = { |
|---|
| 792 | | - .irnen_r = LTQ_SPI_IRNEN_R_XWAY, |
|---|
| 793 | | - .irnen_t = LTQ_SPI_IRNEN_T_XWAY, |
|---|
| 865 | + .cfg_irq = lantiq_cfg_irq, |
|---|
| 866 | + .irnen_r = LTQ_SPI_IRNEN_R_XWAY, |
|---|
| 867 | + .irnen_t = LTQ_SPI_IRNEN_T_XWAY, |
|---|
| 868 | + .irnicr = 0xF8, |
|---|
| 869 | + .irncr = 0xFC, |
|---|
| 870 | + .fifo_size_mask = GENMASK(5, 0), |
|---|
| 871 | + .irq_ack = false, |
|---|
| 794 | 872 | }; |
|---|
| 795 | 873 | |
|---|
| 796 | 874 | static const struct lantiq_ssc_hwcfg lantiq_ssc_xrx = { |
|---|
| 797 | | - .irnen_r = LTQ_SPI_IRNEN_R_XRX, |
|---|
| 798 | | - .irnen_t = LTQ_SPI_IRNEN_T_XRX, |
|---|
| 875 | + .cfg_irq = lantiq_cfg_irq, |
|---|
| 876 | + .irnen_r = LTQ_SPI_IRNEN_R_XRX, |
|---|
| 877 | + .irnen_t = LTQ_SPI_IRNEN_T_XRX, |
|---|
| 878 | + .irnicr = 0xF8, |
|---|
| 879 | + .irncr = 0xFC, |
|---|
| 880 | + .fifo_size_mask = GENMASK(5, 0), |
|---|
| 881 | + .irq_ack = false, |
|---|
| 882 | +}; |
|---|
| 883 | + |
|---|
| 884 | +static const struct lantiq_ssc_hwcfg intel_ssc_lgm = { |
|---|
| 885 | + .cfg_irq = intel_lgm_cfg_irq, |
|---|
| 886 | + .irnen_r = LTQ_SPI_IRNEN_R_XRX, |
|---|
| 887 | + .irnen_t = LTQ_SPI_IRNEN_T_XRX, |
|---|
| 888 | + .irnicr = 0xFC, |
|---|
| 889 | + .irncr = 0xF8, |
|---|
| 890 | + .fifo_size_mask = GENMASK(7, 0), |
|---|
| 891 | + .irq_ack = true, |
|---|
| 799 | 892 | }; |
|---|
| 800 | 893 | |
|---|
| 801 | 894 | static const struct of_device_id lantiq_ssc_match[] = { |
|---|
| 802 | 895 | { .compatible = "lantiq,ase-spi", .data = &lantiq_ssc_xway, }, |
|---|
| 803 | 896 | { .compatible = "lantiq,falcon-spi", .data = &lantiq_ssc_xrx, }, |
|---|
| 804 | 897 | { .compatible = "lantiq,xrx100-spi", .data = &lantiq_ssc_xrx, }, |
|---|
| 898 | + { .compatible = "intel,lgm-spi", .data = &intel_ssc_lgm, }, |
|---|
| 805 | 899 | {}, |
|---|
| 806 | 900 | }; |
|---|
| 807 | 901 | MODULE_DEVICE_TABLE(of, lantiq_ssc_match); |
|---|
| .. | .. |
|---|
| 810 | 904 | { |
|---|
| 811 | 905 | struct device *dev = &pdev->dev; |
|---|
| 812 | 906 | struct spi_master *master; |
|---|
| 813 | | - struct resource *res; |
|---|
| 814 | 907 | struct lantiq_ssc_spi *spi; |
|---|
| 815 | 908 | const struct lantiq_ssc_hwcfg *hwcfg; |
|---|
| 816 | 909 | const struct of_device_id *match; |
|---|
| 817 | | - int err, rx_irq, tx_irq, err_irq; |
|---|
| 818 | 910 | u32 id, supports_dma, revision; |
|---|
| 819 | 911 | unsigned int num_cs; |
|---|
| 912 | + int err; |
|---|
| 820 | 913 | |
|---|
| 821 | 914 | match = of_match_device(lantiq_ssc_match, dev); |
|---|
| 822 | 915 | if (!match) { |
|---|
| .. | .. |
|---|
| 824 | 917 | return -EINVAL; |
|---|
| 825 | 918 | } |
|---|
| 826 | 919 | hwcfg = match->data; |
|---|
| 827 | | - |
|---|
| 828 | | - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
|---|
| 829 | | - if (!res) { |
|---|
| 830 | | - dev_err(dev, "failed to get resources\n"); |
|---|
| 831 | | - return -ENXIO; |
|---|
| 832 | | - } |
|---|
| 833 | | - |
|---|
| 834 | | - rx_irq = platform_get_irq_byname(pdev, LTQ_SPI_RX_IRQ_NAME); |
|---|
| 835 | | - if (rx_irq < 0) { |
|---|
| 836 | | - dev_err(dev, "failed to get %s\n", LTQ_SPI_RX_IRQ_NAME); |
|---|
| 837 | | - return -ENXIO; |
|---|
| 838 | | - } |
|---|
| 839 | | - |
|---|
| 840 | | - tx_irq = platform_get_irq_byname(pdev, LTQ_SPI_TX_IRQ_NAME); |
|---|
| 841 | | - if (tx_irq < 0) { |
|---|
| 842 | | - dev_err(dev, "failed to get %s\n", LTQ_SPI_TX_IRQ_NAME); |
|---|
| 843 | | - return -ENXIO; |
|---|
| 844 | | - } |
|---|
| 845 | | - |
|---|
| 846 | | - err_irq = platform_get_irq_byname(pdev, LTQ_SPI_ERR_IRQ_NAME); |
|---|
| 847 | | - if (err_irq < 0) { |
|---|
| 848 | | - dev_err(dev, "failed to get %s\n", LTQ_SPI_ERR_IRQ_NAME); |
|---|
| 849 | | - return -ENXIO; |
|---|
| 850 | | - } |
|---|
| 851 | 920 | |
|---|
| 852 | 921 | master = spi_alloc_master(dev, sizeof(struct lantiq_ssc_spi)); |
|---|
| 853 | 922 | if (!master) |
|---|
| .. | .. |
|---|
| 858 | 927 | spi->dev = dev; |
|---|
| 859 | 928 | spi->hwcfg = hwcfg; |
|---|
| 860 | 929 | platform_set_drvdata(pdev, spi); |
|---|
| 861 | | - |
|---|
| 862 | | - spi->regbase = devm_ioremap_resource(dev, res); |
|---|
| 930 | + spi->regbase = devm_platform_ioremap_resource(pdev, 0); |
|---|
| 863 | 931 | if (IS_ERR(spi->regbase)) { |
|---|
| 864 | 932 | err = PTR_ERR(spi->regbase); |
|---|
| 865 | 933 | goto err_master_put; |
|---|
| 866 | 934 | } |
|---|
| 867 | 935 | |
|---|
| 868 | | - err = devm_request_irq(dev, rx_irq, lantiq_ssc_xmit_interrupt, |
|---|
| 869 | | - 0, LTQ_SPI_RX_IRQ_NAME, spi); |
|---|
| 870 | | - if (err) |
|---|
| 871 | | - goto err_master_put; |
|---|
| 872 | | - |
|---|
| 873 | | - err = devm_request_irq(dev, tx_irq, lantiq_ssc_xmit_interrupt, |
|---|
| 874 | | - 0, LTQ_SPI_TX_IRQ_NAME, spi); |
|---|
| 875 | | - if (err) |
|---|
| 876 | | - goto err_master_put; |
|---|
| 877 | | - |
|---|
| 878 | | - err = devm_request_irq(dev, err_irq, lantiq_ssc_err_interrupt, |
|---|
| 879 | | - 0, LTQ_SPI_ERR_IRQ_NAME, spi); |
|---|
| 936 | + err = hwcfg->cfg_irq(pdev, spi); |
|---|
| 880 | 937 | if (err) |
|---|
| 881 | 938 | goto err_master_put; |
|---|
| 882 | 939 | |
|---|
| .. | .. |
|---|
| 915 | 972 | |
|---|
| 916 | 973 | master->dev.of_node = pdev->dev.of_node; |
|---|
| 917 | 974 | master->num_chipselect = num_cs; |
|---|
| 975 | + master->use_gpio_descriptors = true; |
|---|
| 918 | 976 | master->setup = lantiq_ssc_setup; |
|---|
| 919 | 977 | master->set_cs = lantiq_ssc_set_cs; |
|---|
| 920 | 978 | master->handle_err = lantiq_ssc_handle_err; |
|---|
| .. | .. |
|---|
| 926 | 984 | master->bits_per_word_mask = SPI_BPW_RANGE_MASK(2, 8) | |
|---|
| 927 | 985 | SPI_BPW_MASK(16) | SPI_BPW_MASK(32); |
|---|
| 928 | 986 | |
|---|
| 929 | | - spi->wq = alloc_ordered_workqueue(dev_name(dev), 0); |
|---|
| 987 | + spi->wq = alloc_ordered_workqueue(dev_name(dev), WQ_MEM_RECLAIM); |
|---|
| 930 | 988 | if (!spi->wq) { |
|---|
| 931 | 989 | err = -ENOMEM; |
|---|
| 932 | 990 | goto err_clk_put; |
|---|
| .. | .. |
|---|
| 934 | 992 | INIT_WORK(&spi->work, lantiq_ssc_bussy_work); |
|---|
| 935 | 993 | |
|---|
| 936 | 994 | id = lantiq_ssc_readl(spi, LTQ_SPI_ID); |
|---|
| 937 | | - spi->tx_fifo_size = (id & LTQ_SPI_ID_TXFS_M) >> LTQ_SPI_ID_TXFS_S; |
|---|
| 938 | | - spi->rx_fifo_size = (id & LTQ_SPI_ID_RXFS_M) >> LTQ_SPI_ID_RXFS_S; |
|---|
| 995 | + spi->tx_fifo_size = (id >> LTQ_SPI_ID_TXFS_S) & hwcfg->fifo_size_mask; |
|---|
| 996 | + spi->rx_fifo_size = (id >> LTQ_SPI_ID_RXFS_S) & hwcfg->fifo_size_mask; |
|---|
| 939 | 997 | supports_dma = (id & LTQ_SPI_ID_CFG_M) >> LTQ_SPI_ID_CFG_S; |
|---|
| 940 | 998 | revision = id & LTQ_SPI_ID_REV_M; |
|---|
| 941 | 999 | |
|---|