Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dmaengine: qcom_bam_dma: Add BAM v1.3.0 support

We currently have register offset information only for BAM IPs with revision
1.4.0. We add register offset table entries for the legacy (v1.3.0) version
of BAM IPs found on SoCs like APQ8064 and MSM8960.

The register offset table pointers are stored in DT data corresponding to the
BAM IP version specified in the compatible string.

Reviewed-by: Kumar Gala <galak@codeaurora.org>
Reviewed-by: Andy Gross <agross@codeaurora.org>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

authored by

Archit Taneja and committed by
Vinod Koul
f43669de fb93f520

+50 -8
+50 -8
drivers/dma/qcom_bam_dma.c
··· 113 113 unsigned int pipe_mult, evnt_mult, ee_mult; 114 114 }; 115 115 116 - static const struct reg_offset_data reg_info[] = { 116 + static const struct reg_offset_data bam_v1_3_reg_info[] = { 117 + [BAM_CTRL] = { 0x0F80, 0x00, 0x00, 0x00 }, 118 + [BAM_REVISION] = { 0x0F84, 0x00, 0x00, 0x00 }, 119 + [BAM_NUM_PIPES] = { 0x0FBC, 0x00, 0x00, 0x00 }, 120 + [BAM_DESC_CNT_TRSHLD] = { 0x0F88, 0x00, 0x00, 0x00 }, 121 + [BAM_IRQ_SRCS] = { 0x0F8C, 0x00, 0x00, 0x00 }, 122 + [BAM_IRQ_SRCS_MSK] = { 0x0F90, 0x00, 0x00, 0x00 }, 123 + [BAM_IRQ_SRCS_UNMASKED] = { 0x0FB0, 0x00, 0x00, 0x00 }, 124 + [BAM_IRQ_STTS] = { 0x0F94, 0x00, 0x00, 0x00 }, 125 + [BAM_IRQ_CLR] = { 0x0F98, 0x00, 0x00, 0x00 }, 126 + [BAM_IRQ_EN] = { 0x0F9C, 0x00, 0x00, 0x00 }, 127 + [BAM_CNFG_BITS] = { 0x0FFC, 0x00, 0x00, 0x00 }, 128 + [BAM_IRQ_SRCS_EE] = { 0x1800, 0x00, 0x00, 0x80 }, 129 + [BAM_IRQ_SRCS_MSK_EE] = { 0x1804, 0x00, 0x00, 0x80 }, 130 + [BAM_P_CTRL] = { 0x0000, 0x80, 0x00, 0x00 }, 131 + [BAM_P_RST] = { 0x0004, 0x80, 0x00, 0x00 }, 132 + [BAM_P_HALT] = { 0x0008, 0x80, 0x00, 0x00 }, 133 + [BAM_P_IRQ_STTS] = { 0x0010, 0x80, 0x00, 0x00 }, 134 + [BAM_P_IRQ_CLR] = { 0x0014, 0x80, 0x00, 0x00 }, 135 + [BAM_P_IRQ_EN] = { 0x0018, 0x80, 0x00, 0x00 }, 136 + [BAM_P_EVNT_DEST_ADDR] = { 0x102C, 0x00, 0x40, 0x00 }, 137 + [BAM_P_EVNT_REG] = { 0x1018, 0x00, 0x40, 0x00 }, 138 + [BAM_P_SW_OFSTS] = { 0x1000, 0x00, 0x40, 0x00 }, 139 + [BAM_P_DATA_FIFO_ADDR] = { 0x1024, 0x00, 0x40, 0x00 }, 140 + [BAM_P_DESC_FIFO_ADDR] = { 0x101C, 0x00, 0x40, 0x00 }, 141 + [BAM_P_EVNT_GEN_TRSHLD] = { 0x1028, 0x00, 0x40, 0x00 }, 142 + [BAM_P_FIFO_SIZES] = { 0x1020, 0x00, 0x40, 0x00 }, 143 + }; 144 + 145 + static const struct reg_offset_data bam_v1_4_reg_info[] = { 117 146 [BAM_CTRL] = { 0x0000, 0x00, 0x00, 0x00 }, 118 147 [BAM_REVISION] = { 0x0004, 0x00, 0x00, 0x00 }, 119 148 [BAM_NUM_PIPES] = { 0x003C, 0x00, 0x00, 0x00 }, ··· 359 330 /* execution environment ID, from DT */ 360 331 u32 ee; 361 332 333 + const struct reg_offset_data *layout; 334 + 362 335 struct clk *bamclk; 363 336 int irq; 364 337 ··· 377 346 static inline void __iomem *bam_addr(struct bam_device *bdev, u32 pipe, 378 347 enum bam_reg reg) 379 348 { 380 - const struct reg_offset_data r = reg_info[reg]; 349 + const struct reg_offset_data r = bdev->layout[reg]; 381 350 382 351 return bdev->regs + r.base_offset + 383 352 r.pipe_mult * pipe + ··· 1050 1019 bchan->vc.desc_free = bam_dma_free_desc; 1051 1020 } 1052 1021 1022 + static const struct of_device_id bam_of_match[] = { 1023 + { .compatible = "qcom,bam-v1.3.0", .data = &bam_v1_3_reg_info }, 1024 + { .compatible = "qcom,bam-v1.4.0", .data = &bam_v1_4_reg_info }, 1025 + {} 1026 + }; 1027 + 1028 + MODULE_DEVICE_TABLE(of, bam_of_match); 1029 + 1053 1030 static int bam_dma_probe(struct platform_device *pdev) 1054 1031 { 1055 1032 struct bam_device *bdev; 1033 + const struct of_device_id *match; 1056 1034 struct resource *iores; 1057 1035 int ret, i; 1058 1036 ··· 1070 1030 return -ENOMEM; 1071 1031 1072 1032 bdev->dev = &pdev->dev; 1033 + 1034 + match = of_match_node(bam_of_match, pdev->dev.of_node); 1035 + if (!match) { 1036 + dev_err(&pdev->dev, "Unsupported BAM module\n"); 1037 + return -ENODEV; 1038 + } 1039 + 1040 + bdev->layout = match->data; 1073 1041 1074 1042 iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1075 1043 bdev->regs = devm_ioremap_resource(&pdev->dev, iores); ··· 1201 1153 1202 1154 return 0; 1203 1155 } 1204 - 1205 - static const struct of_device_id bam_of_match[] = { 1206 - { .compatible = "qcom,bam-v1.4.0", }, 1207 - {} 1208 - }; 1209 - MODULE_DEVICE_TABLE(of, bam_of_match); 1210 1156 1211 1157 static struct platform_driver bam_dma_driver = { 1212 1158 .probe = bam_dma_probe,