dmaengine: ste_dma40: Fetch disabled channels from DT
authorLee Jones <lee.jones@linaro.org>
Wed, 15 May 2013 09:52:02 +0000 (10:52 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 4 Jun 2013 09:12:12 +0000 (11:12 +0200)
Some platforms have channels which are not available for normal use.
This information is currently passed though platform data in internal
BSP kernels. Once those platforms land, they'll need to configure them
appropriately, so we may as well add the infrastructure.

Cc: Dan Williams <djbw@fb.com>
Cc: Per Forlin <per.forlin@stericsson.com>
Cc: Rabin Vincent <rabin@rab.in>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Documentation/devicetree/bindings/dma/ste-dma40.txt
drivers/dma/ste_dma40.c

index aa272d866f6ebb320b056484226ff331b71ea896..bea5b73a739009634c579d20e892c1c4a17ebc92 100644 (file)
@@ -11,6 +11,7 @@ Required properties:
 Optional properties:
 - dma-channels: Number of channels supported by hardware - if not present
                the driver will attempt to obtain the information from H/W
+- disabled-channels: Channels which can not be used
 
 Example:
 
@@ -23,6 +24,7 @@ Example:
 
                #dma-cells = <2>;
                memcpy-channels  = <56 57 58 59 60>;
+               disabled-channels  = <12>;
                dma-channels = <8>;
        };
 
index 4e528dd30ad5d44ec75ee9b7cccf1df06fe9e593..ffac8225ff544fe2906381bcfbccfb2d343bbc0f 100644 (file)
@@ -3482,7 +3482,7 @@ static int __init d40_of_probe(struct platform_device *pdev,
                               struct device_node *np)
 {
        struct stedma40_platform_data *pdata;
-       int num_phy = 0, num_memcpy = 0;
+       int num_phy = 0, num_memcpy = 0, num_disabled = 0;
        const const __be32 *list;
 
        pdata = devm_kzalloc(&pdev->dev,
@@ -3511,6 +3511,21 @@ static int __init d40_of_probe(struct platform_device *pdev,
                                   dma40_memcpy_channels,
                                   num_memcpy);
 
+       list = of_get_property(np, "disabled-channels", &num_disabled);
+       num_disabled /= sizeof(*list);
+
+       if (num_disabled > STEDMA40_MAX_PHYS || num_disabled < 0) {
+               d40_err(&pdev->dev,
+                       "Invalid number of disabled channels specified (%d)\n",
+                       num_disabled);
+               return -EINVAL;
+       }
+
+       of_property_read_u32_array(np, "disabled-channels",
+                                  pdata->disabled_channels,
+                                  num_disabled);
+       pdata->disabled_channels[num_disabled] = -1;
+
        pdev->dev.platform_data = pdata;
 
        return 0;