Lines Matching +full:0 +full:xa044
42 #define SPI_MST_CTL_GO (BIT(0))
44 #define SPI_PERI_ADDR_BASE (0x160000)
45 #define SPI_SYSTEM_ADDR_BASE (0x2000)
46 #define SPI_MST1_ADDR_BASE (0x800)
48 #define DEV_REV_REG (SPI_SYSTEM_ADDR_BASE + 0x00)
49 #define SPI_SYSLOCK_REG (SPI_SYSTEM_ADDR_BASE + 0xA0)
50 #define SPI_CONFIG_PERI_ENABLE_REG (SPI_SYSTEM_ADDR_BASE + 0x108)
53 #define DEV_REV_MASK (GENMASK(7, 0))
56 #define SPI0 (0)
60 #define SPI_DMA_ADDR_BASE (0x1000)
61 #define SPI_DMA_GLOBAL_WR_ENGINE_EN (SPI_DMA_ADDR_BASE + 0x0C)
62 #define SPI_DMA_WR_DOORBELL_REG (SPI_DMA_ADDR_BASE + 0x10)
63 #define SPI_DMA_GLOBAL_RD_ENGINE_EN (SPI_DMA_ADDR_BASE + 0x2C)
64 #define SPI_DMA_RD_DOORBELL_REG (SPI_DMA_ADDR_BASE + 0x30)
65 #define SPI_DMA_INTR_WR_STS (SPI_DMA_ADDR_BASE + 0x4C)
66 #define SPI_DMA_WR_INT_MASK (SPI_DMA_ADDR_BASE + 0x54)
67 #define SPI_DMA_INTR_WR_CLR (SPI_DMA_ADDR_BASE + 0x58)
68 #define SPI_DMA_ERR_WR_STS (SPI_DMA_ADDR_BASE + 0x5C)
69 #define SPI_DMA_INTR_IMWR_WDONE_LOW (SPI_DMA_ADDR_BASE + 0x60)
70 #define SPI_DMA_INTR_IMWR_WDONE_HIGH (SPI_DMA_ADDR_BASE + 0x64)
71 #define SPI_DMA_INTR_IMWR_WABORT_LOW (SPI_DMA_ADDR_BASE + 0x68)
72 #define SPI_DMA_INTR_IMWR_WABORT_HIGH (SPI_DMA_ADDR_BASE + 0x6C)
73 #define SPI_DMA_INTR_WR_IMWR_DATA (SPI_DMA_ADDR_BASE + 0x70)
74 #define SPI_DMA_INTR_RD_STS (SPI_DMA_ADDR_BASE + 0xA0)
75 #define SPI_DMA_RD_INT_MASK (SPI_DMA_ADDR_BASE + 0xA8)
76 #define SPI_DMA_INTR_RD_CLR (SPI_DMA_ADDR_BASE + 0xAC)
77 #define SPI_DMA_ERR_RD_STS (SPI_DMA_ADDR_BASE + 0xB8)
78 #define SPI_DMA_INTR_IMWR_RDONE_LOW (SPI_DMA_ADDR_BASE + 0xCC)
79 #define SPI_DMA_INTR_IMWR_RDONE_HIGH (SPI_DMA_ADDR_BASE + 0xD0)
80 #define SPI_DMA_INTR_IMWR_RABORT_LOW (SPI_DMA_ADDR_BASE + 0xD4)
81 #define SPI_DMA_INTR_IMWR_RABORT_HIGH (SPI_DMA_ADDR_BASE + 0xD8)
82 #define SPI_DMA_INTR_RD_IMWR_DATA (SPI_DMA_ADDR_BASE + 0xDC)
84 #define SPI_DMA_CH0_WR_BASE (SPI_DMA_ADDR_BASE + 0x200)
85 #define SPI_DMA_CH0_RD_BASE (SPI_DMA_ADDR_BASE + 0x300)
86 #define SPI_DMA_CH1_WR_BASE (SPI_DMA_ADDR_BASE + 0x400)
87 #define SPI_DMA_CH1_RD_BASE (SPI_DMA_ADDR_BASE + 0x500)
89 #define SPI_DMA_CH_CTL1_OFFSET (0x00)
90 #define SPI_DMA_CH_XFER_LEN_OFFSET (0x08)
91 #define SPI_DMA_CH_SAR_LO_OFFSET (0x0C)
92 #define SPI_DMA_CH_SAR_HI_OFFSET (0x10)
93 #define SPI_DMA_CH_DAR_LO_OFFSET (0x14)
94 #define SPI_DMA_CH_DAR_HI_OFFSET (0x18)
96 #define SPI_DMA_CH0_DONE_INT BIT(0)
106 /* x refers to SPI Host Controller HW instance id in the below macros - 0 or 1 */
108 #define SPI_MST_CMD_BUF_OFFSET(x) (((x) * SPI_MST1_ADDR_BASE) + 0x00)
109 #define SPI_MST_RSP_BUF_OFFSET(x) (((x) * SPI_MST1_ADDR_BASE) + 0x200)
110 #define SPI_MST_CTL_REG_OFFSET(x) (((x) * SPI_MST1_ADDR_BASE) + 0x400)
111 #define SPI_MST_EVENT_REG_OFFSET(x) (((x) * SPI_MST1_ADDR_BASE) + 0x420)
112 #define SPI_MST_EVENT_MASK_REG_OFFSET(x) (((x) * SPI_MST1_ADDR_BASE) + 0x424)
113 #define SPI_MST_PAD_CTL_REG_OFFSET(x) (((x) * SPI_MST1_ADDR_BASE) + 0x460)
114 #define SPIALERT_MST_DB_REG_OFFSET(x) (((x) * SPI_MST1_ADDR_BASE) + 0x464)
115 #define SPIALERT_MST_VAL_REG_OFFSET(x) (((x) * SPI_MST1_ADDR_BASE) + 0x468)
116 #define SPI_PCI_CTRL_REG_OFFSET(x) (((x) * SPI_MST1_ADDR_BASE) + 0x480)
123 #define SPI_DMA_ENGINE_EN (0x1)
124 #define SPI_DMA_ENGINE_DIS (0x0)
130 #define VENDOR_ID_MCHP 0x1055
132 #define SPI_SUSPEND_CONFIG 0x101
133 #define SPI_RESUME_CONFIG 0x203
176 { PCI_DEVICE_SUB(VENDOR_ID_MCHP, 0xa004, PCI_ANY_ID, 0x0001), 0, 0, 0x02},
177 { PCI_DEVICE_SUB(VENDOR_ID_MCHP, 0xa004, PCI_ANY_ID, 0x0002), 0, 0, 0x01},
178 { PCI_DEVICE_SUB(VENDOR_ID_MCHP, 0xa004, PCI_ANY_ID, 0x0003), 0, 0, 0x11},
179 { PCI_DEVICE_SUB(VENDOR_ID_MCHP, 0xa004, PCI_ANY_ID, PCI_ANY_ID), 0, 0, 0x01},
180 { PCI_DEVICE_SUB(VENDOR_ID_MCHP, 0xa014, PCI_ANY_ID, 0x0001), 0, 0, 0x02},
181 { PCI_DEVICE_SUB(VENDOR_ID_MCHP, 0xa014, PCI_ANY_ID, 0x0002), 0, 0, 0x01},
182 { PCI_DEVICE_SUB(VENDOR_ID_MCHP, 0xa014, PCI_ANY_ID, 0x0003), 0, 0, 0x11},
183 { PCI_DEVICE_SUB(VENDOR_ID_MCHP, 0xa014, PCI_ANY_ID, PCI_ANY_ID), 0, 0, 0x01},
184 { PCI_DEVICE_SUB(VENDOR_ID_MCHP, 0xa024, PCI_ANY_ID, 0x0001), 0, 0, 0x02},
185 { PCI_DEVICE_SUB(VENDOR_ID_MCHP, 0xa024, PCI_ANY_ID, 0x0002), 0, 0, 0x01},
186 { PCI_DEVICE_SUB(VENDOR_ID_MCHP, 0xa024, PCI_ANY_ID, 0x0003), 0, 0, 0x11},
187 { PCI_DEVICE_SUB(VENDOR_ID_MCHP, 0xa024, PCI_ANY_ID, PCI_ANY_ID), 0, 0, 0x01},
188 { PCI_DEVICE_SUB(VENDOR_ID_MCHP, 0xa034, PCI_ANY_ID, 0x0001), 0, 0, 0x02},
189 { PCI_DEVICE_SUB(VENDOR_ID_MCHP, 0xa034, PCI_ANY_ID, 0x0002), 0, 0, 0x01},
190 { PCI_DEVICE_SUB(VENDOR_ID_MCHP, 0xa034, PCI_ANY_ID, 0x0003), 0, 0, 0x11},
191 { PCI_DEVICE_SUB(VENDOR_ID_MCHP, 0xa034, PCI_ANY_ID, PCI_ANY_ID), 0, 0, 0x01},
192 { PCI_DEVICE_SUB(VENDOR_ID_MCHP, 0xa044, PCI_ANY_ID, 0x0001), 0, 0, 0x02},
193 { PCI_DEVICE_SUB(VENDOR_ID_MCHP, 0xa044, PCI_ANY_ID, 0x0002), 0, 0, 0x01},
194 { PCI_DEVICE_SUB(VENDOR_ID_MCHP, 0xa044, PCI_ANY_ID, 0x0003), 0, 0, 0x11},
195 { PCI_DEVICE_SUB(VENDOR_ID_MCHP, 0xa044, PCI_ANY_ID, PCI_ANY_ID), 0, 0, 0x01},
196 { 0, }
221 writel(0x0, par->reg_base + SPI_SYSLOCK_REG); in pci1xxxx_release_sys_lock()
246 if (spi_bus->dev_rev >= 0xC0) { in pci1xxxx_check_spi_can_dma()
258 if (spi_bus->dev_rev < 0xC0 || pf_num) in pci1xxxx_check_spi_can_dma()
274 return 0; in pci1xxxx_check_spi_can_dma()
286 for (iter = 0; iter < spi_bus->total_hw_instances; iter++) { in pci1xxxx_spi_dma_config()
289 if (iter == 0) { in pci1xxxx_spi_dma_config()
306 writel(0, spi_bus->dma_offset_bar + SPI_DMA_INTR_WR_IMWR_DATA); in pci1xxxx_spi_dma_config()
307 writel(0, spi_bus->dma_offset_bar + SPI_DMA_INTR_RD_IMWR_DATA); in pci1xxxx_spi_dma_config()
341 for (iter = 0; iter < hw_inst; iter++) { in pci1xxxx_spi_dma_init()
347 if (ret < 0) in pci1xxxx_spi_dma_init()
356 if (ret < 0) in pci1xxxx_spi_dma_init()
364 return 0; in pci1xxxx_spi_dma_init()
378 regval |= (spi_get_chipselect(spi, 0) << 25); in pci1xxxx_spi_set_cs()
387 u8 val = 0; in pci1xxxx_get_clock_div()
391 else if (par->dev_rev >= 0xC0 && hz >= PCI1XXXX_SPI_CLK_25MHZ) in pci1xxxx_get_clock_div()
471 atomic_set(&p->dma_completion_count, 0); in pci1xxxx_start_spi_xfer()
492 p->bytes_recvd = 0; in pci1xxxx_spi_transfer_with_io()
501 bytes_transfered = 0; in pci1xxxx_spi_transfer_with_io()
502 bytes_recvd = 0; in pci1xxxx_spi_transfer_with_io()
504 if (transfer_len % SPI_MAX_DATA_LEN != 0) in pci1xxxx_spi_transfer_with_io()
507 for (loop_iter = 0; loop_iter < loop_count; loop_iter++) { in pci1xxxx_spi_transfer_with_io()
509 if ((transfer_len % SPI_MAX_DATA_LEN != 0) && in pci1xxxx_spi_transfer_with_io()
535 return 0; in pci1xxxx_spi_transfer_with_io()
544 dma_addr_t tx_dma_addr = 0; in pci1xxxx_spi_transfer_with_dma()
545 int ret = 0; in pci1xxxx_spi_transfer_with_dma()
563 p->bytes_recvd = 0; in pci1xxxx_spi_transfer_with_dma()
589 (regval == 0x0), 0, USEC_PER_MSEC); in pci1xxxx_spi_transfer_with_dma()
610 (regval == 0x0), 0, USEC_PER_MSEC); in pci1xxxx_spi_transfer_with_dma()
623 ret = 0; in pci1xxxx_spi_transfer_with_dma()
663 dma_addr_t tx_dma_addr = 0; in pci1xxxx_spi_setup_next_dma_to_io_transfer()
681 dma_addr_t rx_dma_addr = 0; in pci1xxxx_spi_setup_next_dma_from_io_transfer()
782 u8 i = 0; in pci1xxxx_spi_shared_isr()
784 for (i = 0; i < par->total_hw_instances; i++) in pci1xxxx_spi_shared_isr()
807 int num_vector = 0; in pci1xxxx_spi_probe()
811 hw_inst_cnt = ent->driver_data & 0x0f; in pci1xxxx_spi_probe()
812 start = (ent->driver_data & 0xf0) >> 4; in pci1xxxx_spi_probe()
816 only_sec_inst = 0; in pci1xxxx_spi_probe()
828 for (iter = 0; iter < hw_inst_cnt; iter++) { in pci1xxxx_spi_probe()
851 spi_bus->reg_base = pcim_iomap(pdev, 0, pci_resource_len(pdev, 0)); in pci1xxxx_spi_probe()
857 if (num_vector < 0) { in pci1xxxx_spi_probe()
869 spi_sub_ptr->irq[0] = pci_irq_vector(pdev, 0); in pci1xxxx_spi_probe()
872 ret = devm_request_irq(&pdev->dev, spi_sub_ptr->irq[0], in pci1xxxx_spi_probe()
876 ret = devm_request_irq(&pdev->dev, spi_sub_ptr->irq[0], in pci1xxxx_spi_probe()
880 if (ret < 0) { in pci1xxxx_spi_probe()
882 spi_sub_ptr->irq[0]); in pci1xxxx_spi_probe()
887 regval = readl(spi_bus->reg_base + SPI_PCI_CTRL_REG_OFFSET(0)); in pci1xxxx_spi_probe()
893 writel(regval, spi_bus->reg_base + SPI_PCI_CTRL_REG_OFFSET(0)); in pci1xxxx_spi_probe()
907 spi_sub_ptr->irq[0] = pci_irq_vector(pdev, iter); in pci1xxxx_spi_probe()
908 ret = devm_request_irq(&pdev->dev, spi_sub_ptr->irq[0], in pci1xxxx_spi_probe()
911 if (ret < 0) { in pci1xxxx_spi_probe()
913 spi_sub_ptr->irq[0]); in pci1xxxx_spi_probe()
942 return 0; in pci1xxxx_spi_probe()
978 for (iter = 0; iter < spi_ptr->total_hw_instances; iter++) { in pci1xxxx_spi_resume()
985 store_restore_config(spi_ptr, spi_sub_ptr, iter, 0); in pci1xxxx_spi_resume()
988 return 0; in pci1xxxx_spi_resume()
998 for (iter = 0; iter < spi_ptr->total_hw_instances; iter++) { in pci1xxxx_spi_suspend()
1011 return 0; in pci1xxxx_spi_suspend()