Lines Matching refs:gpi_dev
467 struct gpi_dev { struct
504 struct gpi_dev *gpi_dev; member
617 devm_free_irq(gpii->gpi_dev->dev, gpii->irq, gpii); in gpi_disable_interrupts()
632 ret = devm_request_irq(gpii->gpi_dev->dev, gpii->irq, in gpi_config_interrupts()
636 dev_err(gpii->gpi_dev->dev, "error request irq:%d ret:%d\n", in gpi_config_interrupts()
699 dev_dbg(gpii->gpi_dev->dev, in gpi_send_cmd()
713 dev_err(gpii->gpi_dev->dev, "cmd: %s completion timeout:%u\n", in gpi_send_cmd()
810 dev_dbg(gpii->gpi_dev->dev, "irq_stts:0x%x\n", irq_stts); in gpi_process_gen_err_irq()
829 dev_err(gpii->gpi_dev->dev, "invalid error status:0x%x\n", irq_stts); in gpi_process_glob_err_irq()
852 dev_err(gpii->gpi_dev->dev, "receive interrupt while in %s state\n", in gpi_handle_irq()
878 dev_dbg(gpii->gpi_dev->dev, in gpi_handle_irq()
899 dev_dbg(gpii->gpi_dev->dev, "setting EV state to %s\n", in gpi_handle_irq()
907 dev_dbg(gpii->gpi_dev->dev, "process CH CTRL interrupts\n"); in gpi_handle_irq()
913 dev_err(gpii->gpi_dev->dev, "Unhandled interrupt status:0x%x\n", type); in gpi_handle_irq()
945 dev_err(gpii->gpi_dev->dev, "skipping processing event because ch @ %s state\n", in gpi_process_imed_data_event()
957 dev_dbg(gpii->gpi_dev->dev, "event without a pending descriptor!\n"); in gpi_process_imed_data_event()
959 dev_dbg(gpii->gpi_dev->dev, in gpi_process_imed_data_event()
964 dev_dbg(gpii->gpi_dev->dev, in gpi_process_imed_data_event()
1025 dev_err(gpii->gpi_dev->dev, "skipping processing event because ch @ %s state\n", in gpi_process_xfer_compl_event()
1036 dev_err(gpii->gpi_dev->dev, "Event without a pending descriptor!\n"); in gpi_process_xfer_compl_event()
1038 dev_err(gpii->gpi_dev->dev, in gpi_process_xfer_compl_event()
1069 dev_err(gpii->gpi_dev->dev, "Error in Transaction\n"); in gpi_process_xfer_compl_event()
1072 dev_dbg(gpii->gpi_dev->dev, "Transaction Success\n"); in gpi_process_xfer_compl_event()
1076 dev_dbg(gpii->gpi_dev->dev, "Residue %d\n", result.residue); in gpi_process_xfer_compl_event()
1108 dev_dbg(gpii->gpi_dev->dev, in gpi_process_events()
1121 dev_dbg(gpii->gpi_dev->dev, "stale event, not processing\n"); in gpi_process_events()
1129 dev_dbg(gpii->gpi_dev->dev, "QUP_NOTIF_EV_TYPE\n"); in gpi_process_events()
1132 dev_dbg(gpii->gpi_dev->dev, in gpi_process_events()
1156 dev_err(gpii->gpi_dev->dev, "not processing any events, pm_state:%s\n", in gpi_ev_tasklet()
1206 dev_err(gpii->gpi_dev->dev, "Error with cmd:%s ret:%d\n", in gpi_reset_chan()
1239 dev_err(gpii->gpi_dev->dev, "Error with cmd:%s ret:%d\n", in gpi_start_chan()
1259 dev_err(gpii->gpi_dev->dev, "Error with cmd:%s ret:%d\n", in gpi_stop_chan()
1280 dev_err(gpii->gpi_dev->dev, "Error with cmd:%s ret:%d\n", in gpi_alloc_chan()
1315 dev_err(gpii->gpi_dev->dev, "error with cmd:%s ret:%d\n", in gpi_alloc_ev_chan()
1400 dma_free_coherent(gpii->gpi_dev->dev, ring->alloc_size, in gpi_free_ring()
1418 dev_dbg(gpii->gpi_dev->dev, in gpi_alloc_ring()
1423 ring->pre_aligned = dma_alloc_coherent(gpii->gpi_dev->dev, in gpi_alloc_ring()
1427 dev_err(gpii->gpi_dev->dev, "could not alloc size:%zu mem for ring\n", in gpi_alloc_ring()
1446 dev_dbg(gpii->gpi_dev->dev, in gpi_alloc_ring()
1464 dev_err(gpii->gpi_dev->dev, "Error adding ring element to xfer ring\n"); in gpi_queue_xfer()
1509 dev_err(gpii->gpi_dev->dev, "Error resetting channel ret:%d\n", ret); in gpi_terminate_all()
1516 dev_err(gpii->gpi_dev->dev, "Error alloc_channel ret:%d\n", ret); in gpi_terminate_all()
1527 dev_err(gpii->gpi_dev->dev, "Error Starting Channel ret:%d\n", ret); in gpi_terminate_all()
1551 dev_dbg(gpii->gpi_dev->dev, "channel is already paused\n"); in gpi_pause()
1587 dev_dbg(gpii->gpi_dev->dev, "channel is already active\n"); in gpi_resume()
1598 dev_err(gpii->gpi_dev->dev, "Error starting chan, ret:%d\n", ret); in gpi_resume()
1641 struct device *dev = chan->gpii->gpi_dev->dev; in gpi_create_i2c_tre()
1716 struct device *dev = chan->gpii->gpi_dev->dev; in gpi_create_spi_tre()
1797 struct device *dev = gpii->gpi_dev->dev; in gpi_prep_slave_sg()
1806 dev_err(gpii->gpi_dev->dev, "invalid dma direction: %d\n", direction); in gpi_prep_slave_sg()
1893 const int ev_factor = gpii->gpi_dev->ev_factor; in gpi_ch_init()
1906 dev_err(gpii->gpi_dev->dev, "protocol did not match protocol %u != %u\n", in gpi_ch_init()
1925 dev_err(gpii->gpi_dev->dev, "error config. interrupts, ret:%d\n", ret); in gpi_ch_init()
1932 dev_err(gpii->gpi_dev->dev, "error alloc_ev_chan:%d\n", ret); in gpi_ch_init()
1940 dev_err(gpii->gpi_dev->dev, "Error allocating chan:%d\n", ret); in gpi_ch_init()
1949 dev_err(gpii->gpi_dev->dev, "Error start chan:%d\n", ret); in gpi_ch_init()
1995 dev_err(gpii->gpi_dev->dev, "error resetting channel:%d\n", ret); in gpi_free_chan_resources()
2068 static int gpi_find_avail_gpii(struct gpi_dev *gpi_dev, u32 seid) in gpi_find_avail_gpii() argument
2074 for (gpii = 0; gpii < gpi_dev->max_gpii; gpii++) { in gpi_find_avail_gpii()
2075 if (!((1 << gpii) & gpi_dev->gpii_mask)) in gpi_find_avail_gpii()
2078 tx_chan = &gpi_dev->gpiis[gpii].gchan[GPI_TX_CHAN]; in gpi_find_avail_gpii()
2079 rx_chan = &gpi_dev->gpiis[gpii].gchan[GPI_RX_CHAN]; in gpi_find_avail_gpii()
2088 for (gpii = 0; gpii < gpi_dev->max_gpii; gpii++) { in gpi_find_avail_gpii()
2089 if (!((1 << gpii) & gpi_dev->gpii_mask)) in gpi_find_avail_gpii()
2092 tx_chan = &gpi_dev->gpiis[gpii].gchan[GPI_TX_CHAN]; in gpi_find_avail_gpii()
2093 rx_chan = &gpi_dev->gpiis[gpii].gchan[GPI_RX_CHAN]; in gpi_find_avail_gpii()
2112 struct gpi_dev *gpi_dev = (struct gpi_dev *)of_dma->of_dma_data; in gpi_of_dma_xlate() local
2118 dev_err(gpi_dev->dev, "gpii require minimum 2 args, client passed:%d args\n", in gpi_of_dma_xlate()
2125 dev_err(gpi_dev->dev, "gpii channel:%d not valid\n", chid); in gpi_of_dma_xlate()
2132 gpii = gpi_find_avail_gpii(gpi_dev, seid); in gpi_of_dma_xlate()
2134 dev_err(gpi_dev->dev, "no available gpii instances\n"); in gpi_of_dma_xlate()
2138 gchan = &gpi_dev->gpiis[gpii].gchan[chid]; in gpi_of_dma_xlate()
2140 dev_err(gpi_dev->dev, "gpii:%d chid:%d seid:%d already configured\n", in gpi_of_dma_xlate()
2153 struct gpi_dev *gpi_dev; in gpi_probe() local
2158 gpi_dev = devm_kzalloc(&pdev->dev, sizeof(*gpi_dev), GFP_KERNEL); in gpi_probe()
2159 if (!gpi_dev) in gpi_probe()
2162 gpi_dev->dev = &pdev->dev; in gpi_probe()
2163 gpi_dev->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &gpi_dev->res); in gpi_probe()
2164 if (IS_ERR(gpi_dev->regs)) in gpi_probe()
2165 return PTR_ERR(gpi_dev->regs); in gpi_probe()
2166 gpi_dev->ee_base = gpi_dev->regs; in gpi_probe()
2168 ret = of_property_read_u32(gpi_dev->dev->of_node, "dma-channels", in gpi_probe()
2169 &gpi_dev->max_gpii); in gpi_probe()
2171 dev_err(gpi_dev->dev, "missing 'max-no-gpii' DT node\n"); in gpi_probe()
2175 ret = of_property_read_u32(gpi_dev->dev->of_node, "dma-channel-mask", in gpi_probe()
2176 &gpi_dev->gpii_mask); in gpi_probe()
2178 dev_err(gpi_dev->dev, "missing 'gpii-mask' DT node\n"); in gpi_probe()
2182 ee_offset = (uintptr_t)device_get_match_data(gpi_dev->dev); in gpi_probe()
2183 gpi_dev->ee_base = gpi_dev->ee_base - ee_offset; in gpi_probe()
2185 gpi_dev->ev_factor = EV_FACTOR; in gpi_probe()
2187 ret = dma_set_mask(gpi_dev->dev, DMA_BIT_MASK(64)); in gpi_probe()
2189 dev_err(gpi_dev->dev, "Error setting dma_mask to 64, ret:%d\n", ret); in gpi_probe()
2193 gpi_dev->gpiis = devm_kzalloc(gpi_dev->dev, sizeof(*gpi_dev->gpiis) * in gpi_probe()
2194 gpi_dev->max_gpii, GFP_KERNEL); in gpi_probe()
2195 if (!gpi_dev->gpiis) in gpi_probe()
2199 INIT_LIST_HEAD(&gpi_dev->dma_device.channels); in gpi_probe()
2200 for (i = 0; i < gpi_dev->max_gpii; i++) { in gpi_probe()
2201 struct gpii *gpii = &gpi_dev->gpiis[i]; in gpi_probe()
2204 if (!((1 << i) & gpi_dev->gpii_mask)) in gpi_probe()
2208 gpii->ev_cntxt_base_reg = gpi_dev->ee_base + GPII_n_EV_CH_k_CNTXT_0_OFFS(i, 0); in gpi_probe()
2209 gpii->ev_cntxt_db_reg = gpi_dev->ee_base + GPII_n_EV_CH_k_DOORBELL_0_OFFS(i, 0); in gpi_probe()
2211 gpii->ev_cmd_reg = gpi_dev->ee_base + GPII_n_EV_CH_CMD_OFFS(i); in gpi_probe()
2212 gpii->ieob_clr_reg = gpi_dev->ee_base + GPII_n_CNTXT_SRC_IEOB_IRQ_CLR_OFFS(i); in gpi_probe()
2225 gchan->ch_cntxt_base_reg = gpi_dev->ee_base + in gpi_probe()
2227 gchan->ch_cntxt_db_reg = gpi_dev->ee_base + in gpi_probe()
2229 gchan->ch_cmd_reg = gpi_dev->ee_base + GPII_n_CH_CMD_OFFS(i); in gpi_probe()
2232 vchan_init(&gchan->vc, &gpi_dev->dma_device); in gpi_probe()
2244 gpii->regs = gpi_dev->ee_base; in gpi_probe()
2245 gpii->gpi_dev = gpi_dev; in gpi_probe()
2248 platform_set_drvdata(pdev, gpi_dev); in gpi_probe()
2251 dma_cap_zero(gpi_dev->dma_device.cap_mask); in gpi_probe()
2252 dma_cap_set(DMA_SLAVE, gpi_dev->dma_device.cap_mask); in gpi_probe()
2255 gpi_dev->dma_device.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV); in gpi_probe()
2256 gpi_dev->dma_device.residue_granularity = DMA_RESIDUE_GRANULARITY_DESCRIPTOR; in gpi_probe()
2257 gpi_dev->dma_device.src_addr_widths = DMA_SLAVE_BUSWIDTH_8_BYTES; in gpi_probe()
2258 gpi_dev->dma_device.dst_addr_widths = DMA_SLAVE_BUSWIDTH_8_BYTES; in gpi_probe()
2259 gpi_dev->dma_device.device_alloc_chan_resources = gpi_alloc_chan_resources; in gpi_probe()
2260 gpi_dev->dma_device.device_free_chan_resources = gpi_free_chan_resources; in gpi_probe()
2261 gpi_dev->dma_device.device_tx_status = dma_cookie_status; in gpi_probe()
2262 gpi_dev->dma_device.device_issue_pending = gpi_issue_pending; in gpi_probe()
2263 gpi_dev->dma_device.device_prep_slave_sg = gpi_prep_slave_sg; in gpi_probe()
2264 gpi_dev->dma_device.device_config = gpi_peripheral_config; in gpi_probe()
2265 gpi_dev->dma_device.device_terminate_all = gpi_terminate_all; in gpi_probe()
2266 gpi_dev->dma_device.dev = gpi_dev->dev; in gpi_probe()
2267 gpi_dev->dma_device.device_pause = gpi_pause; in gpi_probe()
2268 gpi_dev->dma_device.device_resume = gpi_resume; in gpi_probe()
2271 ret = dma_async_device_register(&gpi_dev->dma_device); in gpi_probe()
2273 dev_err(gpi_dev->dev, "async_device_register failed ret:%d", ret); in gpi_probe()
2277 ret = of_dma_controller_register(gpi_dev->dev->of_node, in gpi_probe()
2278 gpi_of_dma_xlate, gpi_dev); in gpi_probe()
2280 dev_err(gpi_dev->dev, "of_dma_controller_reg failed ret:%d", ret); in gpi_probe()