Re: [PATCH v12 03/12] dmaengine: qcom: bam_dma: Extend the driver's device match data

From: Manivannan Sadhasivam

Date: Wed Mar 11 2026 - 08:50:29 EST


On Tue, Mar 10, 2026 at 04:44:17PM +0100, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
>
> In preparation for supporting the pipe locking feature flag, extend the
> amount of information we can carry in device match data: create a
> separate structure and make the register information one of its fields.
> This way, in subsequent patches, it will be just a matter of adding a
> new field to the device data.
>

Nit: s/patches/commits

> Reviewed-by: Dmitry Baryshkov <lumag@xxxxxxxxxx>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>

Reviewed-by: Manivannan Sadhasivam <mani@xxxxxxxxxx>

- Mani

> ---
> drivers/dma/qcom/bam_dma.c | 28 ++++++++++++++++++++++------
> 1 file changed, 22 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
> index c8601bac555edf1bb4384fd39cb3449ec6e86334..8f6d03f6c673b57ed13aeca6c8331c71596d077b 100644
> --- a/drivers/dma/qcom/bam_dma.c
> +++ b/drivers/dma/qcom/bam_dma.c
> @@ -113,6 +113,10 @@ struct reg_offset_data {
> unsigned int pipe_mult, evnt_mult, ee_mult;
> };
>
> +struct bam_device_data {
> + const struct reg_offset_data *reg_info;
> +};
> +
> static const struct reg_offset_data bam_v1_3_reg_info[] = {
> [BAM_CTRL] = { 0x0F80, 0x00, 0x00, 0x00 },
> [BAM_REVISION] = { 0x0F84, 0x00, 0x00, 0x00 },
> @@ -142,6 +146,10 @@ static const struct reg_offset_data bam_v1_3_reg_info[] = {
> [BAM_P_FIFO_SIZES] = { 0x1020, 0x00, 0x40, 0x00 },
> };
>
> +static const struct bam_device_data bam_v1_3_data = {
> + .reg_info = bam_v1_3_reg_info,
> +};
> +
> static const struct reg_offset_data bam_v1_4_reg_info[] = {
> [BAM_CTRL] = { 0x0000, 0x00, 0x00, 0x00 },
> [BAM_REVISION] = { 0x0004, 0x00, 0x00, 0x00 },
> @@ -171,6 +179,10 @@ static const struct reg_offset_data bam_v1_4_reg_info[] = {
> [BAM_P_FIFO_SIZES] = { 0x1820, 0x00, 0x1000, 0x00 },
> };
>
> +static const struct bam_device_data bam_v1_4_data = {
> + .reg_info = bam_v1_4_reg_info,
> +};
> +
> static const struct reg_offset_data bam_v1_7_reg_info[] = {
> [BAM_CTRL] = { 0x00000, 0x00, 0x00, 0x00 },
> [BAM_REVISION] = { 0x01000, 0x00, 0x00, 0x00 },
> @@ -200,6 +212,10 @@ static const struct reg_offset_data bam_v1_7_reg_info[] = {
> [BAM_P_FIFO_SIZES] = { 0x13820, 0x00, 0x1000, 0x00 },
> };
>
> +static const struct bam_device_data bam_v1_7_data = {
> + .reg_info = bam_v1_7_reg_info,
> +};
> +
> /* BAM CTRL */
> #define BAM_SW_RST BIT(0)
> #define BAM_EN BIT(1)
> @@ -393,7 +409,7 @@ struct bam_device {
> bool powered_remotely;
> u32 active_channels;
>
> - const struct reg_offset_data *layout;
> + const struct bam_device_data *dev_data;
>
> struct clk *bamclk;
> int irq;
> @@ -411,7 +427,7 @@ struct bam_device {
> static inline void __iomem *bam_addr(struct bam_device *bdev, u32 pipe,
> enum bam_reg reg)
> {
> - const struct reg_offset_data r = bdev->layout[reg];
> + const struct reg_offset_data r = bdev->dev_data->reg_info[reg];
>
> return bdev->regs + r.base_offset +
> r.pipe_mult * pipe +
> @@ -1205,9 +1221,9 @@ static void bam_channel_init(struct bam_device *bdev, struct bam_chan *bchan,
> }
>
> static const struct of_device_id bam_of_match[] = {
> - { .compatible = "qcom,bam-v1.3.0", .data = &bam_v1_3_reg_info },
> - { .compatible = "qcom,bam-v1.4.0", .data = &bam_v1_4_reg_info },
> - { .compatible = "qcom,bam-v1.7.0", .data = &bam_v1_7_reg_info },
> + { .compatible = "qcom,bam-v1.3.0", .data = &bam_v1_3_data },
> + { .compatible = "qcom,bam-v1.4.0", .data = &bam_v1_4_data },
> + { .compatible = "qcom,bam-v1.7.0", .data = &bam_v1_7_data },
> {}
> };
>
> @@ -1231,7 +1247,7 @@ static int bam_dma_probe(struct platform_device *pdev)
> return -ENODEV;
> }
>
> - bdev->layout = match->data;
> + bdev->dev_data = match->data;
>
> bdev->regs = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(bdev->regs))
>
> --
> 2.47.3
>

--
மணிவண்ணன் சதாசிவம்