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

Configure Feed

Select the types of activity you want to include in your feed.

dmaengine: ste_dma40: Get LCPA SRAM from SRAM node

Instead of passing the reserved SRAM as a "reg" field
look for a phandle to the LCPA SRAM memory so we can
use the proper SRAM device tree bindings for the SRAM.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230417-ux500-dma40-cleanup-v3-2-60bfa6785968@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Linus Walleij and committed by
Vinod Koul
5a1a3b9c 4f080c77

+25 -23
+1
drivers/dma/Kconfig
··· 553 553 bool "ST-Ericsson DMA40 support" 554 554 depends on ARCH_U8500 555 555 select DMA_ENGINE 556 + select SRAM 556 557 help 557 558 Support for ST-Ericsson DMA40 controller 558 559
+24 -23
drivers/dma/ste_dma40.c
··· 19 19 #include <linux/pm_runtime.h> 20 20 #include <linux/err.h> 21 21 #include <linux/of.h> 22 + #include <linux/of_address.h> 22 23 #include <linux/of_dma.h> 23 24 #include <linux/amba/bus.h> 24 25 #include <linux/regulator/consumer.h> ··· 3507 3506 { 3508 3507 struct stedma40_platform_data *plat_data = dev_get_platdata(&pdev->dev); 3509 3508 struct device_node *np = pdev->dev.of_node; 3509 + struct device_node *np_lcpa; 3510 3510 int ret = -ENOENT; 3511 3511 struct d40_base *base; 3512 3512 struct resource *res; 3513 + struct resource res_lcpa; 3513 3514 int num_reserved_chans; 3514 3515 u32 val; 3515 3516 ··· 3538 3535 spin_lock_init(&base->interrupt_lock); 3539 3536 spin_lock_init(&base->execmd_lock); 3540 3537 3541 - /* Get IO for logical channel parameter address */ 3542 - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "lcpa"); 3543 - if (!res) { 3544 - ret = -ENOENT; 3545 - d40_err(&pdev->dev, "No \"lcpa\" memory resource\n"); 3546 - goto destroy_cache; 3538 + /* Get IO for logical channel parameter address (LCPA) */ 3539 + np_lcpa = of_parse_phandle(np, "sram", 0); 3540 + if (!np_lcpa) { 3541 + dev_err(&pdev->dev, "no LCPA SRAM node\n"); 3542 + goto report_failure; 3547 3543 } 3548 - base->lcpa_size = resource_size(res); 3549 - base->phy_lcpa = res->start; 3550 - 3551 - if (request_mem_region(res->start, resource_size(res), 3552 - D40_NAME " I/O lcpa") == NULL) { 3553 - ret = -EBUSY; 3554 - d40_err(&pdev->dev, "Failed to request LCPA region %pR\n", res); 3555 - goto destroy_cache; 3544 + /* This is no device so read the address directly from the node */ 3545 + ret = of_address_to_resource(np_lcpa, 0, &res_lcpa); 3546 + if (ret) { 3547 + dev_err(&pdev->dev, "no LCPA SRAM resource\n"); 3548 + goto report_failure; 3556 3549 } 3550 + base->lcpa_size = resource_size(&res_lcpa); 3551 + base->phy_lcpa = res_lcpa.start; 3552 + dev_info(&pdev->dev, "found LCPA SRAM at 0x%08x, size 0x%08x\n", 3553 + (u32)base->phy_lcpa, base->lcpa_size); 3557 3554 3558 3555 /* We make use of ESRAM memory for this. */ 3559 3556 val = readl(base->virtbase + D40_DREG_LCPA); 3560 - if (res->start != val && val != 0) { 3557 + if (base->phy_lcpa != val && val != 0) { 3561 3558 dev_warn(&pdev->dev, 3562 - "[%s] Mismatch LCPA dma 0x%x, def %pa\n", 3563 - __func__, val, &res->start); 3559 + "[%s] Mismatch LCPA dma 0x%x, def %08x\n", 3560 + __func__, val, (u32)base->phy_lcpa); 3564 3561 } else 3565 - writel(res->start, base->virtbase + D40_DREG_LCPA); 3562 + writel(base->phy_lcpa, base->virtbase + D40_DREG_LCPA); 3566 3563 3567 - base->lcpa_base = ioremap(res->start, resource_size(res)); 3564 + base->lcpa_base = ioremap(base->phy_lcpa, base->lcpa_size); 3568 3565 if (!base->lcpa_base) { 3569 3566 ret = -ENOMEM; 3570 3567 d40_err(&pdev->dev, "Failed to ioremap LCPA region\n"); 3571 - goto destroy_cache; 3568 + goto release_base; 3572 3569 } 3573 3570 /* If lcla has to be located in ESRAM we don't need to allocate */ 3574 3571 if (base->plat_data->use_esram_lcla) { ··· 3681 3678 if (base->lcpa_base) 3682 3679 iounmap(base->lcpa_base); 3683 3680 3684 - if (base->phy_lcpa) 3685 - release_mem_region(base->phy_lcpa, 3686 - base->lcpa_size); 3681 + release_base: 3687 3682 if (base->phy_start) 3688 3683 release_mem_region(base->phy_start, 3689 3684 base->phy_size);