cdns 194 drivers/soundwire/cadence_master.c static inline u32 cdns_readl(struct sdw_cdns *cdns, int offset) cdns 196 drivers/soundwire/cadence_master.c return readl(cdns->registers + offset); cdns 199 drivers/soundwire/cadence_master.c static inline void cdns_writel(struct sdw_cdns *cdns, int offset, u32 value) cdns 201 drivers/soundwire/cadence_master.c writel(value, cdns->registers + offset); cdns 204 drivers/soundwire/cadence_master.c static inline void cdns_updatel(struct sdw_cdns *cdns, cdns 209 drivers/soundwire/cadence_master.c tmp = cdns_readl(cdns, offset); cdns 211 drivers/soundwire/cadence_master.c cdns_writel(cdns, offset, tmp); cdns 214 drivers/soundwire/cadence_master.c static int cdns_clear_bit(struct sdw_cdns *cdns, int offset, u32 value) cdns 219 drivers/soundwire/cadence_master.c writel(value, cdns->registers + offset); cdns 223 drivers/soundwire/cadence_master.c reg_read = readl(cdns->registers + offset); cdns 241 drivers/soundwire/cadence_master.c static ssize_t cdns_sprintf(struct sdw_cdns *cdns, cdns 245 drivers/soundwire/cadence_master.c "%4x\t%8x\n", reg, cdns_readl(cdns, reg)); cdns 250 drivers/soundwire/cadence_master.c struct sdw_cdns *cdns = s->private; cdns 264 drivers/soundwire/cadence_master.c ret += cdns_sprintf(cdns, buf, ret, i); cdns 270 drivers/soundwire/cadence_master.c ret += cdns_sprintf(cdns, buf, ret, i); cdns 274 drivers/soundwire/cadence_master.c ret += cdns_sprintf(cdns, buf, ret, CDNS_MCP_SSP_CTRL0); cdns 275 drivers/soundwire/cadence_master.c ret += cdns_sprintf(cdns, buf, ret, CDNS_MCP_SSP_CTRL1); cdns 276 drivers/soundwire/cadence_master.c ret += cdns_sprintf(cdns, buf, ret, CDNS_MCP_CLK_CTRL0); cdns 277 drivers/soundwire/cadence_master.c ret += cdns_sprintf(cdns, buf, ret, CDNS_MCP_CLK_CTRL1); cdns 286 drivers/soundwire/cadence_master.c num_ports = cdns->num_ports + CDNS_PCM_PDI_OFFSET; cdns 293 drivers/soundwire/cadence_master.c ret += cdns_sprintf(cdns, buf, ret, j); cdns 304 drivers/soundwire/cadence_master.c ret += cdns_sprintf(cdns, buf, ret, j); cdns 310 drivers/soundwire/cadence_master.c ret += cdns_sprintf(cdns, buf, ret, cdns 318 drivers/soundwire/cadence_master.c ret += cdns_sprintf(cdns, buf, ret, CDNS_PDI_CONFIG(i)); cdns 332 drivers/soundwire/cadence_master.c void sdw_cdns_debugfs_init(struct sdw_cdns *cdns, struct dentry *root) cdns 334 drivers/soundwire/cadence_master.c debugfs_create_file("cdns-registers", 0400, root, cdns, &cdns_reg_fops); cdns 344 drivers/soundwire/cadence_master.c cdns_fill_msg_resp(struct sdw_cdns *cdns, cdns 352 drivers/soundwire/cadence_master.c if (!(cdns->response_buf[i] & CDNS_MCP_RESP_ACK)) { cdns 354 drivers/soundwire/cadence_master.c dev_dbg_ratelimited(cdns->dev, "Msg Ack not received\n"); cdns 355 drivers/soundwire/cadence_master.c if (cdns->response_buf[i] & CDNS_MCP_RESP_NACK) { cdns 357 drivers/soundwire/cadence_master.c dev_err_ratelimited(cdns->dev, "Msg NACK received\n"); cdns 363 drivers/soundwire/cadence_master.c dev_err_ratelimited(cdns->dev, "Msg NACKed for Slave %d\n", msg->dev_num); cdns 366 drivers/soundwire/cadence_master.c dev_dbg_ratelimited(cdns->dev, "Msg ignored for Slave %d\n", msg->dev_num); cdns 372 drivers/soundwire/cadence_master.c msg->buf[i + offset] = cdns->response_buf[i] >> cdns 379 drivers/soundwire/cadence_master.c _cdns_xfer_msg(struct sdw_cdns *cdns, struct sdw_msg *msg, int cmd, cdns 387 drivers/soundwire/cadence_master.c if (cdns->msg_count != count) { cdns 388 drivers/soundwire/cadence_master.c cdns_writel(cdns, CDNS_MCP_FIFOLEVEL, count); cdns 389 drivers/soundwire/cadence_master.c cdns->msg_count = count; cdns 404 drivers/soundwire/cadence_master.c cdns_writel(cdns, base, data); cdns 412 drivers/soundwire/cadence_master.c time = wait_for_completion_timeout(&cdns->tx_complete, cdns 415 drivers/soundwire/cadence_master.c dev_err(cdns->dev, "IO transfer timed out\n"); cdns 420 drivers/soundwire/cadence_master.c return cdns_fill_msg_resp(cdns, msg, count, offset); cdns 424 drivers/soundwire/cadence_master.c cdns_program_scp_addr(struct sdw_cdns *cdns, struct sdw_msg *msg) cdns 432 drivers/soundwire/cadence_master.c if (cdns->msg_count != CDNS_SCP_RX_FIFOLEVEL) { cdns 433 drivers/soundwire/cadence_master.c cdns_writel(cdns, CDNS_MCP_FIFOLEVEL, CDNS_SCP_RX_FIFOLEVEL); cdns 434 drivers/soundwire/cadence_master.c cdns->msg_count = CDNS_SCP_RX_FIFOLEVEL; cdns 448 drivers/soundwire/cadence_master.c cdns_writel(cdns, base, data[0]); cdns 450 drivers/soundwire/cadence_master.c cdns_writel(cdns, base, data[1]); cdns 452 drivers/soundwire/cadence_master.c time = wait_for_completion_timeout(&cdns->tx_complete, cdns 455 drivers/soundwire/cadence_master.c dev_err(cdns->dev, "SCP Msg trf timed out\n"); cdns 462 drivers/soundwire/cadence_master.c if (!(cdns->response_buf[i] & CDNS_MCP_RESP_ACK)) { cdns 464 drivers/soundwire/cadence_master.c dev_err(cdns->dev, "Program SCP Ack not received\n"); cdns 465 drivers/soundwire/cadence_master.c if (cdns->response_buf[i] & CDNS_MCP_RESP_NACK) { cdns 467 drivers/soundwire/cadence_master.c dev_err(cdns->dev, "Program SCP NACK received\n"); cdns 474 drivers/soundwire/cadence_master.c dev_err_ratelimited(cdns->dev, cdns 478 drivers/soundwire/cadence_master.c dev_dbg_ratelimited(cdns->dev, cdns 486 drivers/soundwire/cadence_master.c static int cdns_prep_msg(struct sdw_cdns *cdns, struct sdw_msg *msg, int *cmd) cdns 491 drivers/soundwire/cadence_master.c ret = cdns_program_scp_addr(cdns, msg); cdns 508 drivers/soundwire/cadence_master.c dev_err(cdns->dev, "Invalid msg cmd: %d\n", msg->flags); cdns 518 drivers/soundwire/cadence_master.c struct sdw_cdns *cdns = bus_to_cdns(bus); cdns 521 drivers/soundwire/cadence_master.c ret = cdns_prep_msg(cdns, msg, &cmd); cdns 526 drivers/soundwire/cadence_master.c ret = _cdns_xfer_msg(cdns, msg, cmd, i * CDNS_MCP_CMD_LEN, cdns 535 drivers/soundwire/cadence_master.c ret = _cdns_xfer_msg(cdns, msg, cmd, i * CDNS_MCP_CMD_LEN, cdns 547 drivers/soundwire/cadence_master.c struct sdw_cdns *cdns = bus_to_cdns(bus); cdns 554 drivers/soundwire/cadence_master.c ret = cdns_prep_msg(cdns, msg, &cmd); cdns 558 drivers/soundwire/cadence_master.c cdns->defer = defer; cdns 559 drivers/soundwire/cadence_master.c cdns->defer->length = msg->len; cdns 561 drivers/soundwire/cadence_master.c return _cdns_xfer_msg(cdns, msg, cmd, 0, msg->len, true); cdns 568 drivers/soundwire/cadence_master.c struct sdw_cdns *cdns = bus_to_cdns(bus); cdns 575 drivers/soundwire/cadence_master.c return cdns_program_scp_addr(cdns, &msg); cdns 583 drivers/soundwire/cadence_master.c static void cdns_read_response(struct sdw_cdns *cdns) cdns 588 drivers/soundwire/cadence_master.c num_resp = cdns_readl(cdns, CDNS_MCP_FIFOSTAT); cdns 594 drivers/soundwire/cadence_master.c cdns->response_buf[i] = cdns_readl(cdns, cmd_base); cdns 599 drivers/soundwire/cadence_master.c static int cdns_update_slave_status(struct sdw_cdns *cdns, cdns 643 drivers/soundwire/cadence_master.c dev_warn_ratelimited(cdns->dev, cdns 654 drivers/soundwire/cadence_master.c return sdw_handle_slave_status(&cdns->bus, status); cdns 666 drivers/soundwire/cadence_master.c struct sdw_cdns *cdns = dev_id; cdns 671 drivers/soundwire/cadence_master.c if (!cdns->link_up) cdns 674 drivers/soundwire/cadence_master.c int_status = cdns_readl(cdns, CDNS_MCP_INTSTAT); cdns 680 drivers/soundwire/cadence_master.c cdns_read_response(cdns); cdns 682 drivers/soundwire/cadence_master.c if (cdns->defer) { cdns 683 drivers/soundwire/cadence_master.c cdns_fill_msg_resp(cdns, cdns->defer->msg, cdns 684 drivers/soundwire/cadence_master.c cdns->defer->length, 0); cdns 685 drivers/soundwire/cadence_master.c complete(&cdns->defer->complete); cdns 686 drivers/soundwire/cadence_master.c cdns->defer = NULL; cdns 688 drivers/soundwire/cadence_master.c complete(&cdns->tx_complete); cdns 694 drivers/soundwire/cadence_master.c dev_err_ratelimited(cdns->dev, "Parity error\n"); cdns 699 drivers/soundwire/cadence_master.c dev_err_ratelimited(cdns->dev, "Bus clash for control word\n"); cdns 707 drivers/soundwire/cadence_master.c dev_err_ratelimited(cdns->dev, "Bus clash for data word\n"); cdns 712 drivers/soundwire/cadence_master.c cdns_updatel(cdns, CDNS_MCP_INTMASK, cdns 719 drivers/soundwire/cadence_master.c cdns_writel(cdns, CDNS_MCP_INTSTAT, int_status); cdns 731 drivers/soundwire/cadence_master.c struct sdw_cdns *cdns = dev_id; cdns 734 drivers/soundwire/cadence_master.c dev_dbg_ratelimited(cdns->dev, "Slave status change\n"); cdns 736 drivers/soundwire/cadence_master.c slave0 = cdns_readl(cdns, CDNS_MCP_SLAVE_INTSTAT0); cdns 737 drivers/soundwire/cadence_master.c slave1 = cdns_readl(cdns, CDNS_MCP_SLAVE_INTSTAT1); cdns 739 drivers/soundwire/cadence_master.c cdns_update_slave_status(cdns, slave0, slave1); cdns 740 drivers/soundwire/cadence_master.c cdns_writel(cdns, CDNS_MCP_SLAVE_INTSTAT0, slave0); cdns 741 drivers/soundwire/cadence_master.c cdns_writel(cdns, CDNS_MCP_SLAVE_INTSTAT1, slave1); cdns 744 drivers/soundwire/cadence_master.c cdns_writel(cdns, CDNS_MCP_INTSTAT, CDNS_MCP_INT_SLAVE_MASK); cdns 745 drivers/soundwire/cadence_master.c cdns_updatel(cdns, CDNS_MCP_INTMASK, cdns 755 drivers/soundwire/cadence_master.c static int _cdns_enable_interrupt(struct sdw_cdns *cdns) cdns 759 drivers/soundwire/cadence_master.c cdns_writel(cdns, CDNS_MCP_SLAVE_INTMASK0, cdns 761 drivers/soundwire/cadence_master.c cdns_writel(cdns, CDNS_MCP_SLAVE_INTMASK1, cdns 785 drivers/soundwire/cadence_master.c cdns_writel(cdns, CDNS_MCP_INTMASK, mask); cdns 794 drivers/soundwire/cadence_master.c int sdw_cdns_enable_interrupt(struct sdw_cdns *cdns) cdns 798 drivers/soundwire/cadence_master.c _cdns_enable_interrupt(cdns); cdns 799 drivers/soundwire/cadence_master.c ret = cdns_clear_bit(cdns, CDNS_MCP_CONFIG_UPDATE, cdns 802 drivers/soundwire/cadence_master.c dev_err(cdns->dev, "Config update timedout\n"); cdns 808 drivers/soundwire/cadence_master.c static int cdns_allocate_pdi(struct sdw_cdns *cdns, cdns 818 drivers/soundwire/cadence_master.c pdi = devm_kcalloc(cdns->dev, num, sizeof(*pdi), GFP_KERNEL); cdns 837 drivers/soundwire/cadence_master.c int sdw_cdns_pdi_init(struct sdw_cdns *cdns, cdns 843 drivers/soundwire/cadence_master.c cdns->pcm.num_bd = config.pcm_bd; cdns 844 drivers/soundwire/cadence_master.c cdns->pcm.num_in = config.pcm_in; cdns 845 drivers/soundwire/cadence_master.c cdns->pcm.num_out = config.pcm_out; cdns 846 drivers/soundwire/cadence_master.c cdns->pdm.num_bd = config.pdm_bd; cdns 847 drivers/soundwire/cadence_master.c cdns->pdm.num_in = config.pdm_in; cdns 848 drivers/soundwire/cadence_master.c cdns->pdm.num_out = config.pdm_out; cdns 851 drivers/soundwire/cadence_master.c stream = &cdns->pcm; cdns 859 drivers/soundwire/cadence_master.c ret = cdns_allocate_pdi(cdns, &stream->bd, cdns 866 drivers/soundwire/cadence_master.c ret = cdns_allocate_pdi(cdns, &stream->in, cdns 873 drivers/soundwire/cadence_master.c ret = cdns_allocate_pdi(cdns, &stream->out, cdns 880 drivers/soundwire/cadence_master.c cdns->num_ports = stream->num_pdi; cdns 883 drivers/soundwire/cadence_master.c stream = &cdns->pdm; cdns 885 drivers/soundwire/cadence_master.c ret = cdns_allocate_pdi(cdns, &stream->bd, cdns 892 drivers/soundwire/cadence_master.c ret = cdns_allocate_pdi(cdns, &stream->in, cdns 899 drivers/soundwire/cadence_master.c ret = cdns_allocate_pdi(cdns, &stream->out, cdns 906 drivers/soundwire/cadence_master.c cdns->num_ports += stream->num_pdi; cdns 908 drivers/soundwire/cadence_master.c cdns->ports = devm_kcalloc(cdns->dev, cdns->num_ports, cdns 909 drivers/soundwire/cadence_master.c sizeof(*cdns->ports), GFP_KERNEL); cdns 910 drivers/soundwire/cadence_master.c if (!cdns->ports) { cdns 915 drivers/soundwire/cadence_master.c for (i = 0; i < cdns->num_ports; i++) { cdns 916 drivers/soundwire/cadence_master.c cdns->ports[i].assigned = false; cdns 917 drivers/soundwire/cadence_master.c cdns->ports[i].num = i + 1; /* Port 0 reserved for bulk */ cdns 942 drivers/soundwire/cadence_master.c int sdw_cdns_init(struct sdw_cdns *cdns) cdns 944 drivers/soundwire/cadence_master.c struct sdw_bus *bus = &cdns->bus; cdns 951 drivers/soundwire/cadence_master.c ret = cdns_clear_bit(cdns, CDNS_MCP_CONTROL, cdns 954 drivers/soundwire/cadence_master.c dev_err(cdns->dev, "Couldn't exit from clock stop\n"); cdns 961 drivers/soundwire/cadence_master.c cdns_updatel(cdns, CDNS_MCP_CLK_CTRL0, cdns 963 drivers/soundwire/cadence_master.c cdns_updatel(cdns, CDNS_MCP_CLK_CTRL1, cdns 972 drivers/soundwire/cadence_master.c cdns_writel(cdns, CDNS_MCP_FRAME_SHAPE_INIT, val); cdns 975 drivers/soundwire/cadence_master.c cdns_writel(cdns, CDNS_MCP_SSP_CTRL0, CDNS_DEFAULT_SSP_INTERVAL); cdns 976 drivers/soundwire/cadence_master.c cdns_writel(cdns, CDNS_MCP_SSP_CTRL1, CDNS_DEFAULT_SSP_INTERVAL); cdns 979 drivers/soundwire/cadence_master.c cdns_updatel(cdns, CDNS_MCP_CONTROL, CDNS_MCP_CONTROL_CMD_ACCEPT, cdns 983 drivers/soundwire/cadence_master.c val = cdns_readl(cdns, CDNS_MCP_CONFIG); cdns 1004 drivers/soundwire/cadence_master.c cdns_writel(cdns, CDNS_MCP_CONFIG, val); cdns 1013 drivers/soundwire/cadence_master.c struct sdw_cdns *cdns = bus_to_cdns(bus); cdns 1018 drivers/soundwire/cadence_master.c dev_err(cdns->dev, "NULL curr_dr_freq\n"); cdns 1031 drivers/soundwire/cadence_master.c cdns_updatel(cdns, mcp_clkctrl_off, CDNS_MCP_CLK_MCLKD_MASK, divider); cdns 1040 drivers/soundwire/cadence_master.c struct sdw_cdns *cdns = bus_to_cdns(bus); cdns 1048 drivers/soundwire/cadence_master.c dpn_config = cdns_readl(cdns, dpn_config_off); cdns 1057 drivers/soundwire/cadence_master.c cdns_writel(cdns, dpn_config_off, dpn_config); cdns 1066 drivers/soundwire/cadence_master.c struct sdw_cdns *cdns = bus_to_cdns(bus); cdns 1090 drivers/soundwire/cadence_master.c dpn_config = cdns_readl(cdns, dpn_config_off); cdns 1096 drivers/soundwire/cadence_master.c cdns_writel(cdns, dpn_config_off, dpn_config); cdns 1102 drivers/soundwire/cadence_master.c cdns_writel(cdns, dpn_offsetctrl_off, dpn_offsetctrl); cdns 1110 drivers/soundwire/cadence_master.c cdns_writel(cdns, dpn_hctrl_off, dpn_hctrl); cdns 1111 drivers/soundwire/cadence_master.c cdns_writel(cdns, dpn_samplectrl_off, (t_params->sample_interval - 1)); cdns 1119 drivers/soundwire/cadence_master.c struct sdw_cdns *cdns = bus_to_cdns(bus); cdns 1128 drivers/soundwire/cadence_master.c cdns_writel(cdns, dpn_chnen_off, ch_mask); cdns 1143 drivers/soundwire/cadence_master.c int sdw_cdns_probe(struct sdw_cdns *cdns) cdns 1145 drivers/soundwire/cadence_master.c init_completion(&cdns->tx_complete); cdns 1146 drivers/soundwire/cadence_master.c cdns->bus.port_ops = &cdns_port_ops; cdns 1155 drivers/soundwire/cadence_master.c struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai); cdns 1167 drivers/soundwire/cadence_master.c dma->bus = &cdns->bus; cdns 1168 drivers/soundwire/cadence_master.c dma->link_id = cdns->instance; cdns 1190 drivers/soundwire/cadence_master.c static struct sdw_cdns_pdi *cdns_find_pdi(struct sdw_cdns *cdns, cdns 1215 drivers/soundwire/cadence_master.c void sdw_cdns_config_stream(struct sdw_cdns *cdns, cdns 1225 drivers/soundwire/cadence_master.c cdns_updatel(cdns, offset, CDNS_PORTCTRL_DIRN, val); cdns 1229 drivers/soundwire/cadence_master.c cdns_writel(cdns, CDNS_PDI_CONFIG(pdi->num), val); cdns 1241 drivers/soundwire/cadence_master.c static int cdns_get_num_pdi(struct sdw_cdns *cdns, cdns 1276 drivers/soundwire/cadence_master.c int sdw_cdns_get_stream(struct sdw_cdns *cdns, cdns 1283 drivers/soundwire/cadence_master.c pdis = cdns_get_num_pdi(cdns, stream->in, stream->num_in, ch); cdns 1285 drivers/soundwire/cadence_master.c pdis = cdns_get_num_pdi(cdns, stream->out, stream->num_out, ch); cdns 1289 drivers/soundwire/cadence_master.c pdis = cdns_get_num_pdi(cdns, stream->bd, stream->num_bd, ch); cdns 1304 drivers/soundwire/cadence_master.c int sdw_cdns_alloc_stream(struct sdw_cdns *cdns, cdns 1311 drivers/soundwire/cadence_master.c pdi = cdns_find_pdi(cdns, stream->num_in, stream->in); cdns 1313 drivers/soundwire/cadence_master.c pdi = cdns_find_pdi(cdns, stream->num_out, stream->out); cdns 1317 drivers/soundwire/cadence_master.c pdi = cdns_find_pdi(cdns, stream->num_bd, stream->bd); cdns 155 drivers/soundwire/cadence_master.h int sdw_cdns_probe(struct sdw_cdns *cdns); cdns 161 drivers/soundwire/cadence_master.h int sdw_cdns_init(struct sdw_cdns *cdns); cdns 162 drivers/soundwire/cadence_master.h int sdw_cdns_pdi_init(struct sdw_cdns *cdns, cdns 164 drivers/soundwire/cadence_master.h int sdw_cdns_enable_interrupt(struct sdw_cdns *cdns); cdns 167 drivers/soundwire/cadence_master.h void sdw_cdns_debugfs_init(struct sdw_cdns *cdns, struct dentry *root); cdns 170 drivers/soundwire/cadence_master.h int sdw_cdns_get_stream(struct sdw_cdns *cdns, cdns 173 drivers/soundwire/cadence_master.h int sdw_cdns_alloc_stream(struct sdw_cdns *cdns, cdns 176 drivers/soundwire/cadence_master.h void sdw_cdns_config_stream(struct sdw_cdns *cdns, struct sdw_cdns_port *port, cdns 103 drivers/soundwire/intel.c struct sdw_cdns cdns; cdns 111 drivers/soundwire/intel.c #define cdns_to_intel(_cdns) container_of(_cdns, struct sdw_intel, cdns) cdns 262 drivers/soundwire/intel.c struct dentry *root = sdw->cdns.bus.debugfs; cdns 272 drivers/soundwire/intel.c sdw_cdns_debugfs_init(&sdw->cdns, sdw->debugfs); cdns 305 drivers/soundwire/intel.c sdw->cdns.link_up = true; cdns 361 drivers/soundwire/intel.c dev_err(sdw->cdns.dev, "Failed to set sync period: %d\n", ret); cdns 386 drivers/soundwire/intel.c dev_dbg(sdw->cdns.dev, "PCM cap bd:%d in:%d out:%d\n", cdns 399 drivers/soundwire/intel.c dev_dbg(sdw->cdns.dev, "PDM cap bd:%d in:%d out:%d\n", cdns 469 drivers/soundwire/intel.c intel_pdi_stream_ch_update(sdw, &sdw->cdns.pcm, true); cdns 470 drivers/soundwire/intel.c intel_pdi_stream_ch_update(sdw, &sdw->cdns.pdm, false); cdns 551 drivers/soundwire/intel.c struct sdw_cdns *cdns = bus_to_cdns(bus); cdns 552 drivers/soundwire/intel.c struct sdw_intel *sdw = cdns_to_intel(cdns); cdns 570 drivers/soundwire/intel.c struct sdw_cdns *cdns = bus_to_cdns(bus); cdns 571 drivers/soundwire/intel.c struct sdw_intel *sdw = cdns_to_intel(cdns); cdns 603 drivers/soundwire/intel.c dev_err(sdw->cdns.dev, "Post bank switch failed: %d\n", ret); cdns 615 drivers/soundwire/intel.c struct sdw_cdns *cdns = &sdw->cdns; cdns 619 drivers/soundwire/intel.c for (i = 0; i < cdns->num_ports; i++) { cdns 620 drivers/soundwire/intel.c if (cdns->ports[i].assigned) cdns 623 drivers/soundwire/intel.c port = &cdns->ports[i]; cdns 631 drivers/soundwire/intel.c dev_err(cdns->dev, "Unable to find a free port\n"); cdns 636 drivers/soundwire/intel.c ret = sdw_cdns_alloc_stream(cdns, &cdns->pcm, port, ch, dir); cdns 641 drivers/soundwire/intel.c sdw_cdns_config_stream(cdns, port, ch, dir, port->pdi); cdns 646 drivers/soundwire/intel.c ret = sdw_cdns_alloc_stream(cdns, &cdns->pdm, port, ch, dir); cdns 676 drivers/soundwire/intel.c struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai); cdns 677 drivers/soundwire/intel.c struct sdw_intel *sdw = cdns_to_intel(cdns); cdns 696 drivers/soundwire/intel.c dma->nr_ports = sdw_cdns_get_stream(cdns, &cdns->pdm, ch, dir); cdns 699 drivers/soundwire/intel.c dma->nr_ports = sdw_cdns_get_stream(cdns, &cdns->pcm, ch, dir); cdns 751 drivers/soundwire/intel.c ret = sdw_stream_add_master(&cdns->bus, &sconfig, cdns 754 drivers/soundwire/intel.c dev_err(cdns->dev, "add master to stream failed:%d\n", ret); cdns 772 drivers/soundwire/intel.c struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai); cdns 780 drivers/soundwire/intel.c ret = sdw_stream_remove_master(&cdns->bus, dma->stream); cdns 833 drivers/soundwire/intel.c static int intel_create_dai(struct sdw_cdns *cdns, cdns 846 drivers/soundwire/intel.c cdns->instance, i); cdns 853 drivers/soundwire/intel.c cdns->instance, i); cdns 868 drivers/soundwire/intel.c cdns->instance, i); cdns 894 drivers/soundwire/intel.c struct sdw_cdns *cdns = &sdw->cdns; cdns 900 drivers/soundwire/intel.c num_dai = cdns->pcm.num_pdi + cdns->pdm.num_pdi; cdns 902 drivers/soundwire/intel.c dais = devm_kcalloc(cdns->dev, num_dai, sizeof(*dais), GFP_KERNEL); cdns 907 drivers/soundwire/intel.c stream = &cdns->pcm; cdns 909 drivers/soundwire/intel.c ret = intel_create_dai(cdns, dais, INTEL_PDI_IN, cdns->pcm.num_in, cdns 914 drivers/soundwire/intel.c off += cdns->pcm.num_in; cdns 915 drivers/soundwire/intel.c ret = intel_create_dai(cdns, dais, INTEL_PDI_OUT, cdns->pcm.num_out, cdns 920 drivers/soundwire/intel.c off += cdns->pcm.num_out; cdns 921 drivers/soundwire/intel.c ret = intel_create_dai(cdns, dais, INTEL_PDI_BD, cdns->pcm.num_bd, cdns 927 drivers/soundwire/intel.c stream = &cdns->pdm; cdns 928 drivers/soundwire/intel.c off += cdns->pcm.num_bd; cdns 929 drivers/soundwire/intel.c ret = intel_create_dai(cdns, dais, INTEL_PDI_IN, cdns->pdm.num_in, cdns 934 drivers/soundwire/intel.c off += cdns->pdm.num_in; cdns 935 drivers/soundwire/intel.c ret = intel_create_dai(cdns, dais, INTEL_PDI_OUT, cdns->pdm.num_out, cdns 940 drivers/soundwire/intel.c off += cdns->pdm.num_out; cdns 941 drivers/soundwire/intel.c ret = intel_create_dai(cdns, dais, INTEL_PDI_BD, cdns->pdm.num_bd, cdns 946 drivers/soundwire/intel.c return snd_soc_register_component(cdns->dev, &dai_component, cdns 1017 drivers/soundwire/intel.c sdw->cdns.dev = &pdev->dev; cdns 1018 drivers/soundwire/intel.c sdw->cdns.registers = sdw->res->registers; cdns 1019 drivers/soundwire/intel.c sdw->cdns.instance = sdw->instance; cdns 1020 drivers/soundwire/intel.c sdw->cdns.msg_count = 0; cdns 1021 drivers/soundwire/intel.c sdw->cdns.bus.dev = &pdev->dev; cdns 1022 drivers/soundwire/intel.c sdw->cdns.bus.link_id = pdev->id; cdns 1024 drivers/soundwire/intel.c sdw_cdns_probe(&sdw->cdns); cdns 1028 drivers/soundwire/intel.c sdw->cdns.bus.ops = &sdw_intel_ops; cdns 1032 drivers/soundwire/intel.c ret = sdw_add_bus_master(&sdw->cdns.bus); cdns 1038 drivers/soundwire/intel.c if (sdw->cdns.bus.prop.hw_disabled) { cdns 1040 drivers/soundwire/intel.c sdw->cdns.bus.link_id); cdns 1048 drivers/soundwire/intel.c ret = sdw_cdns_init(&sdw->cdns); cdns 1052 drivers/soundwire/intel.c ret = sdw_cdns_enable_interrupt(&sdw->cdns); cdns 1056 drivers/soundwire/intel.c ret = sdw_cdns_pdi_init(&sdw->cdns, config); cdns 1064 drivers/soundwire/intel.c IRQF_SHARED, KBUILD_MODNAME, &sdw->cdns); cdns 1066 drivers/soundwire/intel.c dev_err(sdw->cdns.dev, "unable to grab IRQ %d, disabling device\n", cdns 1074 drivers/soundwire/intel.c dev_err(sdw->cdns.dev, "DAI registration failed: %d\n", ret); cdns 1075 drivers/soundwire/intel.c snd_soc_unregister_component(sdw->cdns.dev); cdns 1086 drivers/soundwire/intel.c sdw_delete_bus_master(&sdw->cdns.bus); cdns 1097 drivers/soundwire/intel.c if (!sdw->cdns.bus.prop.hw_disabled) { cdns 1100 drivers/soundwire/intel.c snd_soc_unregister_component(sdw->cdns.dev); cdns 1102 drivers/soundwire/intel.c sdw_delete_bus_master(&sdw->cdns.bus); cdns 1180 drivers/tty/serial/xilinx_uartps.c OF_EARLYCON_DECLARE(cdns, "xlnx,xuartps", cdns_early_console_setup); cdns 1181 drivers/tty/serial/xilinx_uartps.c OF_EARLYCON_DECLARE(cdns, "cdns,uart-r1p8", cdns_early_console_setup); cdns 1182 drivers/tty/serial/xilinx_uartps.c OF_EARLYCON_DECLARE(cdns, "cdns,uart-r1p12", cdns_early_console_setup); cdns 1183 drivers/tty/serial/xilinx_uartps.c OF_EARLYCON_DECLARE(cdns, "xlnx,zynqmp-uart", cdns_early_console_setup); cdns 28 drivers/usb/cdns3/core.c static int cdns3_idle_init(struct cdns3 *cdns); cdns 31 drivers/usb/cdns3/core.c struct cdns3_role_driver *cdns3_get_current_role_driver(struct cdns3 *cdns) cdns 33 drivers/usb/cdns3/core.c WARN_ON(!cdns->roles[cdns->role]); cdns 34 drivers/usb/cdns3/core.c return cdns->roles[cdns->role]; cdns 37 drivers/usb/cdns3/core.c static int cdns3_role_start(struct cdns3 *cdns, enum usb_role role) cdns 44 drivers/usb/cdns3/core.c mutex_lock(&cdns->mutex); cdns 45 drivers/usb/cdns3/core.c cdns->role = role; cdns 46 drivers/usb/cdns3/core.c mutex_unlock(&cdns->mutex); cdns 48 drivers/usb/cdns3/core.c if (!cdns->roles[role]) cdns 51 drivers/usb/cdns3/core.c if (cdns->roles[role]->state == CDNS3_ROLE_STATE_ACTIVE) cdns 54 drivers/usb/cdns3/core.c mutex_lock(&cdns->mutex); cdns 55 drivers/usb/cdns3/core.c ret = cdns->roles[role]->start(cdns); cdns 57 drivers/usb/cdns3/core.c cdns->roles[role]->state = CDNS3_ROLE_STATE_ACTIVE; cdns 58 drivers/usb/cdns3/core.c mutex_unlock(&cdns->mutex); cdns 63 drivers/usb/cdns3/core.c static void cdns3_role_stop(struct cdns3 *cdns) cdns 65 drivers/usb/cdns3/core.c enum usb_role role = cdns->role; cdns 70 drivers/usb/cdns3/core.c if (cdns->roles[role]->state == CDNS3_ROLE_STATE_INACTIVE) cdns 73 drivers/usb/cdns3/core.c mutex_lock(&cdns->mutex); cdns 74 drivers/usb/cdns3/core.c cdns->roles[role]->stop(cdns); cdns 75 drivers/usb/cdns3/core.c cdns->roles[role]->state = CDNS3_ROLE_STATE_INACTIVE; cdns 76 drivers/usb/cdns3/core.c mutex_unlock(&cdns->mutex); cdns 79 drivers/usb/cdns3/core.c static void cdns3_exit_roles(struct cdns3 *cdns) cdns 81 drivers/usb/cdns3/core.c cdns3_role_stop(cdns); cdns 82 drivers/usb/cdns3/core.c cdns3_drd_exit(cdns); cdns 85 drivers/usb/cdns3/core.c static enum usb_role cdsn3_hw_role_state_machine(struct cdns3 *cdns); cdns 93 drivers/usb/cdns3/core.c static int cdns3_core_init_role(struct cdns3 *cdns) cdns 95 drivers/usb/cdns3/core.c struct device *dev = cdns->dev; cdns 101 drivers/usb/cdns3/core.c cdns->role = USB_ROLE_NONE; cdns 122 drivers/usb/cdns3/core.c best_dr_mode = cdns->dr_mode; cdns 124 drivers/usb/cdns3/core.c ret = cdns3_idle_init(cdns); cdns 129 drivers/usb/cdns3/core.c best_dr_mode = cdns->dr_mode; cdns 130 drivers/usb/cdns3/core.c } else if (cdns->dr_mode == USB_DR_MODE_OTG) { cdns 132 drivers/usb/cdns3/core.c } else if (cdns->dr_mode != dr_mode) { cdns 140 drivers/usb/cdns3/core.c ret = cdns3_host_init(cdns); cdns 149 drivers/usb/cdns3/core.c ret = cdns3_gadget_init(cdns); cdns 157 drivers/usb/cdns3/core.c cdns->dr_mode = dr_mode; cdns 159 drivers/usb/cdns3/core.c ret = cdns3_drd_update_mode(cdns); cdns 164 drivers/usb/cdns3/core.c ret = cdns3_role_start(cdns, USB_ROLE_NONE); cdns 168 drivers/usb/cdns3/core.c switch (cdns->dr_mode) { cdns 170 drivers/usb/cdns3/core.c ret = cdns3_hw_role_switch(cdns); cdns 175 drivers/usb/cdns3/core.c ret = cdns3_role_start(cdns, USB_ROLE_DEVICE); cdns 180 drivers/usb/cdns3/core.c ret = cdns3_role_start(cdns, USB_ROLE_HOST); cdns 191 drivers/usb/cdns3/core.c cdns3_exit_roles(cdns); cdns 201 drivers/usb/cdns3/core.c static enum usb_role cdsn3_hw_role_state_machine(struct cdns3 *cdns) cdns 206 drivers/usb/cdns3/core.c if (cdns->dr_mode != USB_DR_MODE_OTG) cdns 209 drivers/usb/cdns3/core.c id = cdns3_get_id(cdns); cdns 210 drivers/usb/cdns3/core.c vbus = cdns3_get_vbus(cdns); cdns 218 drivers/usb/cdns3/core.c role = cdns->role; cdns 241 drivers/usb/cdns3/core.c dev_dbg(cdns->dev, "role %d -> %d\n", cdns->role, role); cdns 246 drivers/usb/cdns3/core.c if (cdns3_is_host(cdns)) cdns 248 drivers/usb/cdns3/core.c if (cdns3_is_device(cdns)) cdns 254 drivers/usb/cdns3/core.c static int cdns3_idle_role_start(struct cdns3 *cdns) cdns 259 drivers/usb/cdns3/core.c static void cdns3_idle_role_stop(struct cdns3 *cdns) cdns 262 drivers/usb/cdns3/core.c phy_reset(cdns->usb3_phy); cdns 265 drivers/usb/cdns3/core.c static int cdns3_idle_init(struct cdns3 *cdns) cdns 269 drivers/usb/cdns3/core.c rdrv = devm_kzalloc(cdns->dev, sizeof(*rdrv), GFP_KERNEL); cdns 280 drivers/usb/cdns3/core.c cdns->roles[USB_ROLE_NONE] = rdrv; cdns 289 drivers/usb/cdns3/core.c int cdns3_hw_role_switch(struct cdns3 *cdns) cdns 295 drivers/usb/cdns3/core.c if (cdns->role_override) cdns 298 drivers/usb/cdns3/core.c pm_runtime_get_sync(cdns->dev); cdns 300 drivers/usb/cdns3/core.c current_role = cdns->role; cdns 301 drivers/usb/cdns3/core.c real_role = cdsn3_hw_role_state_machine(cdns); cdns 307 drivers/usb/cdns3/core.c cdns3_role_stop(cdns); cdns 309 drivers/usb/cdns3/core.c dev_dbg(cdns->dev, "Switching role %d -> %d", current_role, real_role); cdns 311 drivers/usb/cdns3/core.c ret = cdns3_role_start(cdns, real_role); cdns 314 drivers/usb/cdns3/core.c dev_err(cdns->dev, "set %d has failed, back to %d\n", cdns 316 drivers/usb/cdns3/core.c ret = cdns3_role_start(cdns, current_role); cdns 318 drivers/usb/cdns3/core.c dev_err(cdns->dev, "back to %d failed too\n", cdns 322 drivers/usb/cdns3/core.c pm_runtime_put_sync(cdns->dev); cdns 335 drivers/usb/cdns3/core.c struct cdns3 *cdns = dev_get_drvdata(dev); cdns 337 drivers/usb/cdns3/core.c return cdns->role; cdns 351 drivers/usb/cdns3/core.c struct cdns3 *cdns = dev_get_drvdata(dev); cdns 354 drivers/usb/cdns3/core.c pm_runtime_get_sync(cdns->dev); cdns 376 drivers/usb/cdns3/core.c cdns->role_override = 0; cdns 378 drivers/usb/cdns3/core.c cdns->role_override = 1; cdns 384 drivers/usb/cdns3/core.c if (!cdns->role_override && cdns->dr_mode == USB_DR_MODE_OTG) { cdns 385 drivers/usb/cdns3/core.c cdns3_hw_role_switch(cdns); cdns 389 drivers/usb/cdns3/core.c if (cdns->role == role) cdns 392 drivers/usb/cdns3/core.c if (cdns->dr_mode == USB_DR_MODE_HOST) { cdns 403 drivers/usb/cdns3/core.c if (cdns->dr_mode == USB_DR_MODE_PERIPHERAL) { cdns 414 drivers/usb/cdns3/core.c cdns3_role_stop(cdns); cdns 415 drivers/usb/cdns3/core.c ret = cdns3_role_start(cdns, role); cdns 417 drivers/usb/cdns3/core.c dev_err(cdns->dev, "set role %d has failed\n", role); cdns 422 drivers/usb/cdns3/core.c pm_runtime_put_sync(cdns->dev); cdns 442 drivers/usb/cdns3/core.c struct cdns3 *cdns; cdns 452 drivers/usb/cdns3/core.c cdns = devm_kzalloc(dev, sizeof(*cdns), GFP_KERNEL); cdns 453 drivers/usb/cdns3/core.c if (!cdns) cdns 456 drivers/usb/cdns3/core.c cdns->dev = dev; cdns 458 drivers/usb/cdns3/core.c platform_set_drvdata(pdev, cdns); cdns 466 drivers/usb/cdns3/core.c cdns->xhci_res[0] = *res; cdns 474 drivers/usb/cdns3/core.c cdns->xhci_res[1] = *res; cdns 476 drivers/usb/cdns3/core.c cdns->dev_irq = platform_get_irq_byname(pdev, "peripheral"); cdns 477 drivers/usb/cdns3/core.c if (cdns->dev_irq == -EPROBE_DEFER) cdns 478 drivers/usb/cdns3/core.c return cdns->dev_irq; cdns 480 drivers/usb/cdns3/core.c if (cdns->dev_irq < 0) cdns 487 drivers/usb/cdns3/core.c cdns->dev_regs = regs; cdns 489 drivers/usb/cdns3/core.c cdns->otg_irq = platform_get_irq_byname(pdev, "otg"); cdns 490 drivers/usb/cdns3/core.c if (cdns->otg_irq == -EPROBE_DEFER) cdns 491 drivers/usb/cdns3/core.c return cdns->otg_irq; cdns 493 drivers/usb/cdns3/core.c if (cdns->otg_irq < 0) { cdns 495 drivers/usb/cdns3/core.c return cdns->otg_irq; cdns 504 drivers/usb/cdns3/core.c cdns->otg_res = *res; cdns 506 drivers/usb/cdns3/core.c mutex_init(&cdns->mutex); cdns 508 drivers/usb/cdns3/core.c cdns->usb2_phy = devm_phy_optional_get(dev, "cdns3,usb2-phy"); cdns 509 drivers/usb/cdns3/core.c if (IS_ERR(cdns->usb2_phy)) cdns 510 drivers/usb/cdns3/core.c return PTR_ERR(cdns->usb2_phy); cdns 512 drivers/usb/cdns3/core.c ret = phy_init(cdns->usb2_phy); cdns 516 drivers/usb/cdns3/core.c cdns->usb3_phy = devm_phy_optional_get(dev, "cdns3,usb3-phy"); cdns 517 drivers/usb/cdns3/core.c if (IS_ERR(cdns->usb3_phy)) cdns 518 drivers/usb/cdns3/core.c return PTR_ERR(cdns->usb3_phy); cdns 520 drivers/usb/cdns3/core.c ret = phy_init(cdns->usb3_phy); cdns 524 drivers/usb/cdns3/core.c ret = phy_power_on(cdns->usb2_phy); cdns 528 drivers/usb/cdns3/core.c ret = phy_power_on(cdns->usb3_phy); cdns 532 drivers/usb/cdns3/core.c cdns->role_sw = usb_role_switch_register(dev, &cdns3_switch_desc); cdns 533 drivers/usb/cdns3/core.c if (IS_ERR(cdns->role_sw)) { cdns 534 drivers/usb/cdns3/core.c ret = PTR_ERR(cdns->role_sw); cdns 539 drivers/usb/cdns3/core.c ret = cdns3_drd_init(cdns); cdns 543 drivers/usb/cdns3/core.c ret = cdns3_core_init_role(cdns); cdns 563 drivers/usb/cdns3/core.c cdns3_drd_exit(cdns); cdns 564 drivers/usb/cdns3/core.c usb_role_switch_unregister(cdns->role_sw); cdns 566 drivers/usb/cdns3/core.c phy_power_off(cdns->usb3_phy); cdns 569 drivers/usb/cdns3/core.c phy_power_off(cdns->usb2_phy); cdns 571 drivers/usb/cdns3/core.c phy_exit(cdns->usb3_phy); cdns 573 drivers/usb/cdns3/core.c phy_exit(cdns->usb2_phy); cdns 586 drivers/usb/cdns3/core.c struct cdns3 *cdns = platform_get_drvdata(pdev); cdns 591 drivers/usb/cdns3/core.c cdns3_exit_roles(cdns); cdns 592 drivers/usb/cdns3/core.c usb_role_switch_unregister(cdns->role_sw); cdns 593 drivers/usb/cdns3/core.c phy_power_off(cdns->usb2_phy); cdns 594 drivers/usb/cdns3/core.c phy_power_off(cdns->usb3_phy); cdns 595 drivers/usb/cdns3/core.c phy_exit(cdns->usb2_phy); cdns 596 drivers/usb/cdns3/core.c phy_exit(cdns->usb3_phy); cdns 604 drivers/usb/cdns3/core.c struct cdns3 *cdns = dev_get_drvdata(dev); cdns 607 drivers/usb/cdns3/core.c if (cdns->role == USB_ROLE_HOST) cdns 613 drivers/usb/cdns3/core.c if (cdns->roles[cdns->role]->suspend) { cdns 614 drivers/usb/cdns3/core.c spin_lock_irqsave(&cdns->gadget_dev->lock, flags); cdns 615 drivers/usb/cdns3/core.c cdns->roles[cdns->role]->suspend(cdns, false); cdns 616 drivers/usb/cdns3/core.c spin_unlock_irqrestore(&cdns->gadget_dev->lock, flags); cdns 624 drivers/usb/cdns3/core.c struct cdns3 *cdns = dev_get_drvdata(dev); cdns 627 drivers/usb/cdns3/core.c if (cdns->role == USB_ROLE_HOST) cdns 630 drivers/usb/cdns3/core.c if (cdns->roles[cdns->role]->resume) { cdns 631 drivers/usb/cdns3/core.c spin_lock_irqsave(&cdns->gadget_dev->lock, flags); cdns 632 drivers/usb/cdns3/core.c cdns->roles[cdns->role]->resume(cdns, false); cdns 633 drivers/usb/cdns3/core.c spin_unlock_irqrestore(&cdns->gadget_dev->lock, flags); cdns 30 drivers/usb/cdns3/core.h int (*start)(struct cdns3 *cdns); cdns 31 drivers/usb/cdns3/core.h void (*stop)(struct cdns3 *cdns); cdns 32 drivers/usb/cdns3/core.h int (*suspend)(struct cdns3 *cdns, bool do_wakeup); cdns 33 drivers/usb/cdns3/core.h int (*resume)(struct cdns3 *cdns, bool hibernated); cdns 96 drivers/usb/cdns3/core.h int cdns3_hw_role_switch(struct cdns3 *cdns); cdns 30 drivers/usb/cdns3/drd.c int cdns3_set_mode(struct cdns3 *cdns, enum usb_dr_mode mode) cdns 41 drivers/usb/cdns3/drd.c dev_dbg(cdns->dev, "Set controller to OTG mode\n"); cdns 42 drivers/usb/cdns3/drd.c if (cdns->version == CDNS3_CONTROLLER_V1) { cdns 43 drivers/usb/cdns3/drd.c reg = readl(&cdns->otg_v1_regs->override); cdns 45 drivers/usb/cdns3/drd.c writel(reg, &cdns->otg_v1_regs->override); cdns 47 drivers/usb/cdns3/drd.c reg = readl(&cdns->otg_v0_regs->ctrl1); cdns 49 drivers/usb/cdns3/drd.c writel(reg, &cdns->otg_v0_regs->ctrl1); cdns 60 drivers/usb/cdns3/drd.c dev_err(cdns->dev, "Unsupported mode of operation %d\n", mode); cdns 67 drivers/usb/cdns3/drd.c int cdns3_get_id(struct cdns3 *cdns) cdns 71 drivers/usb/cdns3/drd.c id = readl(&cdns->otg_regs->sts) & OTGSTS_ID_VALUE; cdns 72 drivers/usb/cdns3/drd.c dev_dbg(cdns->dev, "OTG ID: %d", id); cdns 77 drivers/usb/cdns3/drd.c int cdns3_get_vbus(struct cdns3 *cdns) cdns 81 drivers/usb/cdns3/drd.c vbus = !!(readl(&cdns->otg_regs->sts) & OTGSTS_VBUS_VALID); cdns 82 drivers/usb/cdns3/drd.c dev_dbg(cdns->dev, "OTG VBUS: %d", vbus); cdns 87 drivers/usb/cdns3/drd.c int cdns3_is_host(struct cdns3 *cdns) cdns 89 drivers/usb/cdns3/drd.c if (cdns->dr_mode == USB_DR_MODE_HOST) cdns 91 drivers/usb/cdns3/drd.c else if (!cdns3_get_id(cdns)) cdns 97 drivers/usb/cdns3/drd.c int cdns3_is_device(struct cdns3 *cdns) cdns 99 drivers/usb/cdns3/drd.c if (cdns->dr_mode == USB_DR_MODE_PERIPHERAL) cdns 101 drivers/usb/cdns3/drd.c else if (cdns->dr_mode == USB_DR_MODE_OTG) cdns 102 drivers/usb/cdns3/drd.c if (cdns3_get_id(cdns)) cdns 112 drivers/usb/cdns3/drd.c static void cdns3_otg_disable_irq(struct cdns3 *cdns) cdns 114 drivers/usb/cdns3/drd.c writel(0, &cdns->otg_regs->ien); cdns 121 drivers/usb/cdns3/drd.c static void cdns3_otg_enable_irq(struct cdns3 *cdns) cdns 124 drivers/usb/cdns3/drd.c OTGIEN_VBUSVALID_FALL_INT, &cdns->otg_regs->ien); cdns 134 drivers/usb/cdns3/drd.c int cdns3_drd_switch_host(struct cdns3 *cdns, int on) cdns 141 drivers/usb/cdns3/drd.c writel(OTGCMD_HOST_BUS_REQ | reg, &cdns->otg_regs->cmd); cdns 143 drivers/usb/cdns3/drd.c dev_dbg(cdns->dev, "Waiting till Host mode is turned on\n"); cdns 144 drivers/usb/cdns3/drd.c ret = readl_poll_timeout_atomic(&cdns->otg_regs->sts, val, cdns 148 drivers/usb/cdns3/drd.c dev_err(cdns->dev, "timeout waiting for xhci_ready\n"); cdns 154 drivers/usb/cdns3/drd.c &cdns->otg_regs->cmd); cdns 156 drivers/usb/cdns3/drd.c readl_poll_timeout_atomic(&cdns->otg_regs->state, val, cdns 171 drivers/usb/cdns3/drd.c int cdns3_drd_switch_gadget(struct cdns3 *cdns, int on) cdns 178 drivers/usb/cdns3/drd.c writel(OTGCMD_DEV_BUS_REQ | reg, &cdns->otg_regs->cmd); cdns 180 drivers/usb/cdns3/drd.c dev_dbg(cdns->dev, "Waiting till Device mode is turned on\n"); cdns 182 drivers/usb/cdns3/drd.c ret = readl_poll_timeout_atomic(&cdns->otg_regs->sts, val, cdns 186 drivers/usb/cdns3/drd.c dev_err(cdns->dev, "timeout waiting for dev_ready\n"); cdns 197 drivers/usb/cdns3/drd.c &cdns->otg_regs->cmd); cdns 199 drivers/usb/cdns3/drd.c readl_poll_timeout_atomic(&cdns->otg_regs->state, val, cdns 213 drivers/usb/cdns3/drd.c static int cdns3_init_otg_mode(struct cdns3 *cdns) cdns 217 drivers/usb/cdns3/drd.c cdns3_otg_disable_irq(cdns); cdns 219 drivers/usb/cdns3/drd.c writel(~0, &cdns->otg_regs->ivect); cdns 221 drivers/usb/cdns3/drd.c ret = cdns3_set_mode(cdns, USB_DR_MODE_OTG); cdns 225 drivers/usb/cdns3/drd.c cdns3_otg_enable_irq(cdns); cdns 235 drivers/usb/cdns3/drd.c int cdns3_drd_update_mode(struct cdns3 *cdns) cdns 239 drivers/usb/cdns3/drd.c switch (cdns->dr_mode) { cdns 241 drivers/usb/cdns3/drd.c ret = cdns3_set_mode(cdns, USB_DR_MODE_PERIPHERAL); cdns 244 drivers/usb/cdns3/drd.c ret = cdns3_set_mode(cdns, USB_DR_MODE_HOST); cdns 247 drivers/usb/cdns3/drd.c ret = cdns3_init_otg_mode(cdns); cdns 250 drivers/usb/cdns3/drd.c dev_err(cdns->dev, "Unsupported mode of operation %d\n", cdns 251 drivers/usb/cdns3/drd.c cdns->dr_mode); cdns 260 drivers/usb/cdns3/drd.c struct cdns3 *cdns = data; cdns 262 drivers/usb/cdns3/drd.c cdns3_hw_role_switch(cdns); cdns 278 drivers/usb/cdns3/drd.c struct cdns3 *cdns = data; cdns 281 drivers/usb/cdns3/drd.c if (cdns->dr_mode != USB_DR_MODE_OTG) cdns 284 drivers/usb/cdns3/drd.c reg = readl(&cdns->otg_regs->ivect); cdns 290 drivers/usb/cdns3/drd.c dev_dbg(cdns->dev, "OTG IRQ: new ID: %d\n", cdns 291 drivers/usb/cdns3/drd.c cdns3_get_id(cdns)); cdns 297 drivers/usb/cdns3/drd.c dev_dbg(cdns->dev, "OTG IRQ: new VBUS: %d\n", cdns 298 drivers/usb/cdns3/drd.c cdns3_get_vbus(cdns)); cdns 303 drivers/usb/cdns3/drd.c writel(~0, &cdns->otg_regs->ivect); cdns 307 drivers/usb/cdns3/drd.c int cdns3_drd_init(struct cdns3 *cdns) cdns 313 drivers/usb/cdns3/drd.c regs = devm_ioremap_resource(cdns->dev, &cdns->otg_res); cdns 326 drivers/usb/cdns3/drd.c cdns->otg_v0_regs = regs; cdns 327 drivers/usb/cdns3/drd.c if (!readl(&cdns->otg_v0_regs->cmd)) { cdns 328 drivers/usb/cdns3/drd.c cdns->version = CDNS3_CONTROLLER_V0; cdns 329 drivers/usb/cdns3/drd.c cdns->otg_v1_regs = NULL; cdns 330 drivers/usb/cdns3/drd.c cdns->otg_regs = regs; cdns 331 drivers/usb/cdns3/drd.c writel(1, &cdns->otg_v0_regs->simulate); cdns 332 drivers/usb/cdns3/drd.c dev_info(cdns->dev, "DRD version v0 (%08x)\n", cdns 333 drivers/usb/cdns3/drd.c readl(&cdns->otg_v0_regs->version)); cdns 335 drivers/usb/cdns3/drd.c cdns->otg_v0_regs = NULL; cdns 336 drivers/usb/cdns3/drd.c cdns->otg_v1_regs = regs; cdns 337 drivers/usb/cdns3/drd.c cdns->otg_regs = (void *)&cdns->otg_v1_regs->cmd; cdns 338 drivers/usb/cdns3/drd.c cdns->version = CDNS3_CONTROLLER_V1; cdns 339 drivers/usb/cdns3/drd.c writel(1, &cdns->otg_v1_regs->simulate); cdns 340 drivers/usb/cdns3/drd.c dev_info(cdns->dev, "DRD version v1 (ID: %08x, rev: %08x)\n", cdns 341 drivers/usb/cdns3/drd.c readl(&cdns->otg_v1_regs->did), cdns 342 drivers/usb/cdns3/drd.c readl(&cdns->otg_v1_regs->rid)); cdns 345 drivers/usb/cdns3/drd.c state = OTGSTS_STRAP(readl(&cdns->otg_regs->sts)); cdns 348 drivers/usb/cdns3/drd.c cdns->dr_mode = USB_DR_MODE_OTG; cdns 350 drivers/usb/cdns3/drd.c dev_dbg(cdns->dev, "Controller strapped to HOST\n"); cdns 351 drivers/usb/cdns3/drd.c cdns->dr_mode = USB_DR_MODE_HOST; cdns 353 drivers/usb/cdns3/drd.c dev_dbg(cdns->dev, "Controller strapped to PERIPHERAL\n"); cdns 354 drivers/usb/cdns3/drd.c cdns->dr_mode = USB_DR_MODE_PERIPHERAL; cdns 357 drivers/usb/cdns3/drd.c ret = devm_request_threaded_irq(cdns->dev, cdns->otg_irq, cdns 361 drivers/usb/cdns3/drd.c dev_name(cdns->dev), cdns); cdns 364 drivers/usb/cdns3/drd.c dev_err(cdns->dev, "couldn't get otg_irq\n"); cdns 368 drivers/usb/cdns3/drd.c state = readl(&cdns->otg_regs->sts); cdns 370 drivers/usb/cdns3/drd.c dev_err(cdns->dev, "Cadence USB3 OTG device not ready\n"); cdns 377 drivers/usb/cdns3/drd.c int cdns3_drd_exit(struct cdns3 *cdns) cdns 379 drivers/usb/cdns3/drd.c cdns3_otg_disable_irq(cdns); cdns 156 drivers/usb/cdns3/drd.h int cdns3_is_host(struct cdns3 *cdns); cdns 157 drivers/usb/cdns3/drd.h int cdns3_is_device(struct cdns3 *cdns); cdns 158 drivers/usb/cdns3/drd.h int cdns3_get_id(struct cdns3 *cdns); cdns 159 drivers/usb/cdns3/drd.h int cdns3_get_vbus(struct cdns3 *cdns); cdns 160 drivers/usb/cdns3/drd.h int cdns3_drd_init(struct cdns3 *cdns); cdns 161 drivers/usb/cdns3/drd.h int cdns3_drd_exit(struct cdns3 *cdns); cdns 162 drivers/usb/cdns3/drd.h int cdns3_drd_update_mode(struct cdns3 *cdns); cdns 163 drivers/usb/cdns3/drd.h int cdns3_drd_switch_gadget(struct cdns3 *cdns, int on); cdns 164 drivers/usb/cdns3/drd.h int cdns3_drd_switch_host(struct cdns3 *cdns, int on); cdns 165 drivers/usb/cdns3/drd.h int cdns3_set_mode(struct cdns3 *cdns, enum usb_dr_mode mode); cdns 15 drivers/usb/cdns3/gadget-export.h int cdns3_gadget_init(struct cdns3 *cdns); cdns 16 drivers/usb/cdns3/gadget-export.h void cdns3_gadget_exit(struct cdns3 *cdns); cdns 19 drivers/usb/cdns3/gadget-export.h static inline int cdns3_gadget_init(struct cdns3 *cdns) cdns 24 drivers/usb/cdns3/gadget-export.h static inline void cdns3_gadget_exit(struct cdns3 *cdns) { } cdns 2542 drivers/usb/cdns3/gadget.c void cdns3_gadget_exit(struct cdns3 *cdns) cdns 2546 drivers/usb/cdns3/gadget.c priv_dev = cdns->gadget_dev; cdns 2548 drivers/usb/cdns3/gadget.c devm_free_irq(cdns->dev, cdns->dev_irq, priv_dev); cdns 2550 drivers/usb/cdns3/gadget.c pm_runtime_mark_last_busy(cdns->dev); cdns 2551 drivers/usb/cdns3/gadget.c pm_runtime_put_autosuspend(cdns->dev); cdns 2574 drivers/usb/cdns3/gadget.c cdns->gadget_dev = NULL; cdns 2575 drivers/usb/cdns3/gadget.c cdns3_drd_switch_gadget(cdns, 0); cdns 2578 drivers/usb/cdns3/gadget.c static int cdns3_gadget_start(struct cdns3 *cdns) cdns 2588 drivers/usb/cdns3/gadget.c cdns->gadget_dev = priv_dev; cdns 2589 drivers/usb/cdns3/gadget.c priv_dev->sysdev = cdns->dev; cdns 2590 drivers/usb/cdns3/gadget.c priv_dev->dev = cdns->dev; cdns 2591 drivers/usb/cdns3/gadget.c priv_dev->regs = cdns->dev_regs; cdns 2605 drivers/usb/cdns3/gadget.c max_speed = usb_get_maximum_speed(cdns->dev); cdns 2614 drivers/usb/cdns3/gadget.c dev_err(cdns->dev, "invalid maximum_speed parameter %d\n", cdns 2690 drivers/usb/cdns3/gadget.c cdns->gadget_dev = NULL; cdns 2694 drivers/usb/cdns3/gadget.c static int __cdns3_gadget_init(struct cdns3 *cdns) cdns 2699 drivers/usb/cdns3/gadget.c ret = dma_set_mask_and_coherent(cdns->dev, DMA_BIT_MASK(32)); cdns 2701 drivers/usb/cdns3/gadget.c dev_err(cdns->dev, "Failed to set dma mask: %d\n", ret); cdns 2705 drivers/usb/cdns3/gadget.c cdns3_drd_switch_gadget(cdns, 1); cdns 2706 drivers/usb/cdns3/gadget.c pm_runtime_get_sync(cdns->dev); cdns 2708 drivers/usb/cdns3/gadget.c ret = cdns3_gadget_start(cdns); cdns 2716 drivers/usb/cdns3/gadget.c ret = devm_request_threaded_irq(cdns->dev, cdns->dev_irq, cdns 2719 drivers/usb/cdns3/gadget.c IRQF_SHARED, dev_name(cdns->dev), cdns 2720 drivers/usb/cdns3/gadget.c cdns->gadget_dev); cdns 2727 drivers/usb/cdns3/gadget.c cdns3_gadget_exit(cdns); cdns 2731 drivers/usb/cdns3/gadget.c static int cdns3_gadget_suspend(struct cdns3 *cdns, bool do_wakeup) cdns 2733 drivers/usb/cdns3/gadget.c struct cdns3_device *priv_dev = cdns->gadget_dev; cdns 2747 drivers/usb/cdns3/gadget.c static int cdns3_gadget_resume(struct cdns3 *cdns, bool hibernated) cdns 2749 drivers/usb/cdns3/gadget.c struct cdns3_device *priv_dev = cdns->gadget_dev; cdns 2766 drivers/usb/cdns3/gadget.c int cdns3_gadget_init(struct cdns3 *cdns) cdns 2770 drivers/usb/cdns3/gadget.c rdrv = devm_kzalloc(cdns->dev, sizeof(*rdrv), GFP_KERNEL); cdns 2780 drivers/usb/cdns3/gadget.c cdns->roles[USB_ROLE_DEVICE] = rdrv; cdns 14 drivers/usb/cdns3/host-export.h int cdns3_host_init(struct cdns3 *cdns); cdns 18 drivers/usb/cdns3/host-export.h static inline int cdns3_host_init(struct cdns3 *cdns) cdns 23 drivers/usb/cdns3/host-export.h static inline void cdns3_host_exit(struct cdns3 *cdns) { } cdns 17 drivers/usb/cdns3/host.c static int __cdns3_host_init(struct cdns3 *cdns) cdns 22 drivers/usb/cdns3/host.c cdns3_drd_switch_host(cdns, 1); cdns 26 drivers/usb/cdns3/host.c dev_err(cdns->dev, "couldn't allocate xHCI device\n"); cdns 30 drivers/usb/cdns3/host.c xhci->dev.parent = cdns->dev; cdns 31 drivers/usb/cdns3/host.c cdns->host_dev = xhci; cdns 33 drivers/usb/cdns3/host.c ret = platform_device_add_resources(xhci, cdns->xhci_res, cdns 36 drivers/usb/cdns3/host.c dev_err(cdns->dev, "couldn't add resources to xHCI device\n"); cdns 42 drivers/usb/cdns3/host.c dev_err(cdns->dev, "failed to register xHCI device\n"); cdns 52 drivers/usb/cdns3/host.c static void cdns3_host_exit(struct cdns3 *cdns) cdns 54 drivers/usb/cdns3/host.c platform_device_unregister(cdns->host_dev); cdns 55 drivers/usb/cdns3/host.c cdns->host_dev = NULL; cdns 56 drivers/usb/cdns3/host.c cdns3_drd_switch_host(cdns, 0); cdns 59 drivers/usb/cdns3/host.c int cdns3_host_init(struct cdns3 *cdns) cdns 63 drivers/usb/cdns3/host.c rdrv = devm_kzalloc(cdns->dev, sizeof(*rdrv), GFP_KERNEL); cdns 72 drivers/usb/cdns3/host.c cdns->roles[USB_ROLE_HOST] = rdrv;