mgmtdev 65 drivers/dma/qcom/hidma_mgmt.c int hidma_mgmt_setup(struct hidma_mgmt_dev *mgmtdev) mgmtdev 70 drivers/dma/qcom/hidma_mgmt.c if (!is_power_of_2(mgmtdev->max_write_request) || mgmtdev 71 drivers/dma/qcom/hidma_mgmt.c (mgmtdev->max_write_request < 128) || mgmtdev 72 drivers/dma/qcom/hidma_mgmt.c (mgmtdev->max_write_request > 1024)) { mgmtdev 73 drivers/dma/qcom/hidma_mgmt.c dev_err(&mgmtdev->pdev->dev, "invalid write request %d\n", mgmtdev 74 drivers/dma/qcom/hidma_mgmt.c mgmtdev->max_write_request); mgmtdev 78 drivers/dma/qcom/hidma_mgmt.c if (!is_power_of_2(mgmtdev->max_read_request) || mgmtdev 79 drivers/dma/qcom/hidma_mgmt.c (mgmtdev->max_read_request < 128) || mgmtdev 80 drivers/dma/qcom/hidma_mgmt.c (mgmtdev->max_read_request > 1024)) { mgmtdev 81 drivers/dma/qcom/hidma_mgmt.c dev_err(&mgmtdev->pdev->dev, "invalid read request %d\n", mgmtdev 82 drivers/dma/qcom/hidma_mgmt.c mgmtdev->max_read_request); mgmtdev 86 drivers/dma/qcom/hidma_mgmt.c if (mgmtdev->max_wr_xactions > HIDMA_MAX_WR_XACTIONS_MASK) { mgmtdev 87 drivers/dma/qcom/hidma_mgmt.c dev_err(&mgmtdev->pdev->dev, mgmtdev 93 drivers/dma/qcom/hidma_mgmt.c if (mgmtdev->max_rd_xactions > HIDMA_MAX_RD_XACTIONS_MASK) { mgmtdev 94 drivers/dma/qcom/hidma_mgmt.c dev_err(&mgmtdev->pdev->dev, mgmtdev 100 drivers/dma/qcom/hidma_mgmt.c for (i = 0; i < mgmtdev->dma_channels; i++) { mgmtdev 101 drivers/dma/qcom/hidma_mgmt.c if (mgmtdev->priority[i] > 1) { mgmtdev 102 drivers/dma/qcom/hidma_mgmt.c dev_err(&mgmtdev->pdev->dev, mgmtdev 107 drivers/dma/qcom/hidma_mgmt.c if (mgmtdev->weight[i] > HIDMA_MAX_CHANNEL_WEIGHT) { mgmtdev 108 drivers/dma/qcom/hidma_mgmt.c dev_err(&mgmtdev->pdev->dev, mgmtdev 115 drivers/dma/qcom/hidma_mgmt.c if (mgmtdev->weight[i] == 0) mgmtdev 116 drivers/dma/qcom/hidma_mgmt.c mgmtdev->weight[i] = 1; mgmtdev 119 drivers/dma/qcom/hidma_mgmt.c pm_runtime_get_sync(&mgmtdev->pdev->dev); mgmtdev 120 drivers/dma/qcom/hidma_mgmt.c val = readl(mgmtdev->virtaddr + HIDMA_MAX_BUS_REQ_LEN_OFFSET); mgmtdev 122 drivers/dma/qcom/hidma_mgmt.c val |= mgmtdev->max_write_request << HIDMA_MAX_BUS_WR_REQ_BIT_POS; mgmtdev 124 drivers/dma/qcom/hidma_mgmt.c val |= mgmtdev->max_read_request; mgmtdev 125 drivers/dma/qcom/hidma_mgmt.c writel(val, mgmtdev->virtaddr + HIDMA_MAX_BUS_REQ_LEN_OFFSET); mgmtdev 127 drivers/dma/qcom/hidma_mgmt.c val = readl(mgmtdev->virtaddr + HIDMA_MAX_XACTIONS_OFFSET); mgmtdev 129 drivers/dma/qcom/hidma_mgmt.c val |= mgmtdev->max_wr_xactions << HIDMA_MAX_WR_XACTIONS_BIT_POS; mgmtdev 131 drivers/dma/qcom/hidma_mgmt.c val |= mgmtdev->max_rd_xactions; mgmtdev 132 drivers/dma/qcom/hidma_mgmt.c writel(val, mgmtdev->virtaddr + HIDMA_MAX_XACTIONS_OFFSET); mgmtdev 134 drivers/dma/qcom/hidma_mgmt.c mgmtdev->hw_version = mgmtdev 135 drivers/dma/qcom/hidma_mgmt.c readl(mgmtdev->virtaddr + HIDMA_HW_VERSION_OFFSET); mgmtdev 136 drivers/dma/qcom/hidma_mgmt.c mgmtdev->hw_version_major = (mgmtdev->hw_version >> 28) & 0xF; mgmtdev 137 drivers/dma/qcom/hidma_mgmt.c mgmtdev->hw_version_minor = (mgmtdev->hw_version >> 16) & 0xF; mgmtdev 139 drivers/dma/qcom/hidma_mgmt.c for (i = 0; i < mgmtdev->dma_channels; i++) { mgmtdev 140 drivers/dma/qcom/hidma_mgmt.c u32 weight = mgmtdev->weight[i]; mgmtdev 141 drivers/dma/qcom/hidma_mgmt.c u32 priority = mgmtdev->priority[i]; mgmtdev 143 drivers/dma/qcom/hidma_mgmt.c val = readl(mgmtdev->virtaddr + HIDMA_QOS_N_OFFSET + (4 * i)); mgmtdev 148 drivers/dma/qcom/hidma_mgmt.c writel(val, mgmtdev->virtaddr + HIDMA_QOS_N_OFFSET + (4 * i)); mgmtdev 151 drivers/dma/qcom/hidma_mgmt.c val = readl(mgmtdev->virtaddr + HIDMA_CHRESET_TIMEOUT_OFFSET); mgmtdev 153 drivers/dma/qcom/hidma_mgmt.c val |= mgmtdev->chreset_timeout_cycles & HIDMA_CHRESET_TIMEOUT_MASK; mgmtdev 154 drivers/dma/qcom/hidma_mgmt.c writel(val, mgmtdev->virtaddr + HIDMA_CHRESET_TIMEOUT_OFFSET); mgmtdev 156 drivers/dma/qcom/hidma_mgmt.c pm_runtime_mark_last_busy(&mgmtdev->pdev->dev); mgmtdev 157 drivers/dma/qcom/hidma_mgmt.c pm_runtime_put_autosuspend(&mgmtdev->pdev->dev); mgmtdev 164 drivers/dma/qcom/hidma_mgmt.c struct hidma_mgmt_dev *mgmtdev; mgmtdev 190 drivers/dma/qcom/hidma_mgmt.c mgmtdev = devm_kzalloc(&pdev->dev, sizeof(*mgmtdev), GFP_KERNEL); mgmtdev 191 drivers/dma/qcom/hidma_mgmt.c if (!mgmtdev) { mgmtdev 196 drivers/dma/qcom/hidma_mgmt.c mgmtdev->pdev = pdev; mgmtdev 197 drivers/dma/qcom/hidma_mgmt.c mgmtdev->addrsize = resource_size(res); mgmtdev 198 drivers/dma/qcom/hidma_mgmt.c mgmtdev->virtaddr = virtaddr; mgmtdev 201 drivers/dma/qcom/hidma_mgmt.c &mgmtdev->dma_channels); mgmtdev 209 drivers/dma/qcom/hidma_mgmt.c &mgmtdev->chreset_timeout_cycles); mgmtdev 216 drivers/dma/qcom/hidma_mgmt.c &mgmtdev->max_write_request); mgmtdev 223 drivers/dma/qcom/hidma_mgmt.c (max_write_request != mgmtdev->max_write_request)) { mgmtdev 226 drivers/dma/qcom/hidma_mgmt.c mgmtdev->max_write_request = max_write_request; mgmtdev 228 drivers/dma/qcom/hidma_mgmt.c max_write_request = mgmtdev->max_write_request; mgmtdev 231 drivers/dma/qcom/hidma_mgmt.c &mgmtdev->max_read_request); mgmtdev 237 drivers/dma/qcom/hidma_mgmt.c (max_read_request != mgmtdev->max_read_request)) { mgmtdev 240 drivers/dma/qcom/hidma_mgmt.c mgmtdev->max_read_request = max_read_request; mgmtdev 242 drivers/dma/qcom/hidma_mgmt.c max_read_request = mgmtdev->max_read_request; mgmtdev 245 drivers/dma/qcom/hidma_mgmt.c &mgmtdev->max_wr_xactions); mgmtdev 251 drivers/dma/qcom/hidma_mgmt.c (max_wr_xactions != mgmtdev->max_wr_xactions)) { mgmtdev 254 drivers/dma/qcom/hidma_mgmt.c mgmtdev->max_wr_xactions = max_wr_xactions; mgmtdev 256 drivers/dma/qcom/hidma_mgmt.c max_wr_xactions = mgmtdev->max_wr_xactions; mgmtdev 259 drivers/dma/qcom/hidma_mgmt.c &mgmtdev->max_rd_xactions); mgmtdev 265 drivers/dma/qcom/hidma_mgmt.c (max_rd_xactions != mgmtdev->max_rd_xactions)) { mgmtdev 268 drivers/dma/qcom/hidma_mgmt.c mgmtdev->max_rd_xactions = max_rd_xactions; mgmtdev 270 drivers/dma/qcom/hidma_mgmt.c max_rd_xactions = mgmtdev->max_rd_xactions; mgmtdev 272 drivers/dma/qcom/hidma_mgmt.c mgmtdev->priority = devm_kcalloc(&pdev->dev, mgmtdev 273 drivers/dma/qcom/hidma_mgmt.c mgmtdev->dma_channels, mgmtdev 274 drivers/dma/qcom/hidma_mgmt.c sizeof(*mgmtdev->priority), mgmtdev 276 drivers/dma/qcom/hidma_mgmt.c if (!mgmtdev->priority) { mgmtdev 281 drivers/dma/qcom/hidma_mgmt.c mgmtdev->weight = devm_kcalloc(&pdev->dev, mgmtdev 282 drivers/dma/qcom/hidma_mgmt.c mgmtdev->dma_channels, mgmtdev 283 drivers/dma/qcom/hidma_mgmt.c sizeof(*mgmtdev->weight), GFP_KERNEL); mgmtdev 284 drivers/dma/qcom/hidma_mgmt.c if (!mgmtdev->weight) { mgmtdev 289 drivers/dma/qcom/hidma_mgmt.c rc = hidma_mgmt_setup(mgmtdev); mgmtdev 296 drivers/dma/qcom/hidma_mgmt.c val = readl(mgmtdev->virtaddr + HIDMA_CFG_OFFSET); mgmtdev 298 drivers/dma/qcom/hidma_mgmt.c writel(val, mgmtdev->virtaddr + HIDMA_CFG_OFFSET); mgmtdev 300 drivers/dma/qcom/hidma_mgmt.c rc = hidma_mgmt_init_sys(mgmtdev); mgmtdev 308 drivers/dma/qcom/hidma_mgmt.c mgmtdev->hw_version_major, mgmtdev->hw_version_minor, mgmtdev 309 drivers/dma/qcom/hidma_mgmt.c &res->start, mgmtdev->dma_channels); mgmtdev 311 drivers/dma/qcom/hidma_mgmt.c platform_set_drvdata(pdev, mgmtdev); mgmtdev 31 drivers/dma/qcom/hidma_mgmt.h int hidma_mgmt_setup(struct hidma_mgmt_dev *mgmtdev);