diff options
author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2020-08-03 15:57:12 +0300 |
---|---|---|
committer | Vinod Koul <vkoul@kernel.org> | 2020-08-17 10:50:30 +0530 |
commit | ce310bd70414392448d7f8301e0817151555a34e (patch) | |
tree | 65a3bf6d3880879abebf3232d2f9c96aeb48c50e /drivers/dma/ti/k3-psil.c | |
parent | 0ec083e50ca816953e65e3209c7199cd1a203ddc (diff) | |
download | linux-ce310bd70414392448d7f8301e0817151555a34e.tar.bz2 |
dmaengine: ti: k3-psil: Use soc_device_match to get the psil map
Instead of separate of_machine_is_compatible() it is better to use
soc_device_match() and soc_device_attribute struct to get the PSI-L map
for the booted device.
By using soc_device_match() it is easier to add support for new devices.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Link: https://lore.kernel.org/r/20200803125713.17829-2-peter.ujfalusi@ti.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/dma/ti/k3-psil.c')
-rw-r--r-- | drivers/dma/ti/k3-psil.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/dma/ti/k3-psil.c b/drivers/dma/ti/k3-psil.c index fb7c8150b0d1..fa106e8bd56b 100644 --- a/drivers/dma/ti/k3-psil.c +++ b/drivers/dma/ti/k3-psil.c @@ -9,11 +9,18 @@ #include <linux/init.h> #include <linux/mutex.h> #include <linux/of.h> +#include <linux/sys_soc.h> #include "k3-psil-priv.h" static DEFINE_MUTEX(ep_map_mutex); -static struct psil_ep_map *soc_ep_map; +static const struct psil_ep_map *soc_ep_map; + +static const struct soc_device_attribute k3_soc_devices[] = { + { .family = "AM65X", .data = &am654_ep_map }, + { .family = "J721E", .data = &j721e_ep_map }, + { /* sentinel */ } +}; struct psil_endpoint_config *psil_get_ep_config(u32 thread_id) { @@ -21,10 +28,11 @@ struct psil_endpoint_config *psil_get_ep_config(u32 thread_id) mutex_lock(&ep_map_mutex); if (!soc_ep_map) { - if (of_machine_is_compatible("ti,am654")) { - soc_ep_map = &am654_ep_map; - } else if (of_machine_is_compatible("ti,j721e")) { - soc_ep_map = &j721e_ep_map; + const struct soc_device_attribute *soc; + + soc = soc_device_match(k3_soc_devices); + if (soc) { + soc_ep_map = soc->data; } else { pr_err("PSIL: No compatible machine found for map\n"); mutex_unlock(&ep_map_mutex); |