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

dmaengine: imx-sdma: Only check ratio on parts that support 1:1

On imx8mq B0 chip, AHB/SDMA clock ratio 2:1 can't be supported,
since SDMA clock ratio has to be increased to 250Mhz, AHB can't reach
to 500Mhz, so use 1:1 instead.

To limit this change to the imx8mq for now this patch also adds an
im8mq-sdma compatible string.

Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca>
Acked-by: Robin Gong <yibin.gong@nxp.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Angus Ainslie (Purism) and committed by
Vinod Koul
941acd56 9e1630b8

+14 -1
+14 -1
drivers/dma/imx-sdma.c
··· 419 419 int chnenbl0; 420 420 int num_events; 421 421 struct sdma_script_start_addrs *script_addrs; 422 + bool check_ratio; 422 423 }; 423 424 424 425 struct sdma_engine { ··· 558 557 .script_addrs = &sdma_script_imx7d, 559 558 }; 560 559 560 + static struct sdma_driver_data sdma_imx8mq = { 561 + .chnenbl0 = SDMA_CHNENBL0_IMX35, 562 + .num_events = 48, 563 + .script_addrs = &sdma_script_imx7d, 564 + .check_ratio = 1, 565 + }; 566 + 561 567 static const struct platform_device_id sdma_devtypes[] = { 562 568 { 563 569 .name = "imx25-sdma", ··· 588 580 .name = "imx7d-sdma", 589 581 .driver_data = (unsigned long)&sdma_imx7d, 590 582 }, { 583 + .name = "imx8mq-sdma", 584 + .driver_data = (unsigned long)&sdma_imx8mq, 585 + }, { 591 586 /* sentinel */ 592 587 } 593 588 }; ··· 604 593 { .compatible = "fsl,imx31-sdma", .data = &sdma_imx31, }, 605 594 { .compatible = "fsl,imx25-sdma", .data = &sdma_imx25, }, 606 595 { .compatible = "fsl,imx7d-sdma", .data = &sdma_imx7d, }, 596 + { .compatible = "fsl,imx8mq-sdma", .data = &sdma_imx8mq, }, 607 597 { /* sentinel */ } 608 598 }; 609 599 MODULE_DEVICE_TABLE(of, sdma_dt_ids); ··· 1864 1852 if (ret) 1865 1853 goto disable_clk_ipg; 1866 1854 1867 - if (clk_get_rate(sdma->clk_ahb) == clk_get_rate(sdma->clk_ipg)) 1855 + if (sdma->drvdata->check_ratio && 1856 + (clk_get_rate(sdma->clk_ahb) == clk_get_rate(sdma->clk_ipg))) 1868 1857 sdma->clk_ratio = 1; 1869 1858 1870 1859 /* Be sure SDMA has not started yet */