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

mmc: renesas-sdhi: provide a whitelist for Gen3 SoC ES versions

Provide a whitelist for Gen3 SoC ES versions for both the SYS DMAC and
internal DMAC variants of the SDHI driver. This is to allow drivers to
only initialise for Gen3 SoC ES versions for which they are the appropriate
DMAC implementation. Currently internal DMAC is the appropriate
implementation for all supported Gen3 SoC ES versions.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Simon Horman and committed by
Ulf Hansson
cd09780f 4406ae21

+30
+15
drivers/mmc/host/renesas_sdhi_internal_dmac.c
··· 18 18 #include <linux/module.h> 19 19 #include <linux/pagemap.h> 20 20 #include <linux/scatterlist.h> 21 + #include <linux/sys_soc.h> 21 22 22 23 #include "renesas_sdhi.h" 23 24 #include "tmio_mmc.h" ··· 242 241 .dataend = renesas_sdhi_internal_dmac_dataend_dma, 243 242 }; 244 243 244 + /* 245 + * Whitelist of specific R-Car Gen3 SoC ES versions to use this DMAC 246 + * implementation as others may use a different implementation. 247 + */ 248 + static const struct soc_device_attribute gen3_soc_whitelist[] = { 249 + { .soc_id = "r8a7795", .revision = "ES1.*" }, 250 + { .soc_id = "r8a7795", .revision = "ES2.0" }, 251 + { .soc_id = "r8a7796", .revision = "ES1.0" }, 252 + { /* sentinel */ } 253 + }; 254 + 245 255 static int renesas_sdhi_internal_dmac_probe(struct platform_device *pdev) 246 256 { 257 + if (!soc_device_match(gen3_soc_whitelist)) 258 + return -ENODEV; 259 + 247 260 return renesas_sdhi_probe(pdev, &renesas_sdhi_internal_dmac_dma_ops); 248 261 } 249 262
+15
drivers/mmc/host/renesas_sdhi_sys_dmac.c
··· 18 18 #include <linux/mmc/host.h> 19 19 #include <linux/mod_devicetable.h> 20 20 #include <linux/module.h> 21 + #include <linux/of_device.h> 21 22 #include <linux/pagemap.h> 22 23 #include <linux/scatterlist.h> 24 + #include <linux/sys_soc.h> 23 25 24 26 #include "renesas_sdhi.h" 25 27 #include "tmio_mmc.h" ··· 461 459 .dataend = renesas_sdhi_sys_dmac_dataend_dma, 462 460 }; 463 461 462 + /* 463 + * Whitelist of specific R-Car Gen3 SoC ES versions to use this DMAC 464 + * implementation. Currently empty as all supported ES versions use 465 + * the internal DMAC. 466 + */ 467 + static const struct soc_device_attribute gen3_soc_whitelist[] = { 468 + { /* sentinel */ } 469 + }; 470 + 464 471 static int renesas_sdhi_sys_dmac_probe(struct platform_device *pdev) 465 472 { 473 + if (of_device_get_match_data(&pdev->dev) == &of_rcar_gen3_compatible && 474 + !soc_device_match(gen3_soc_whitelist)) 475 + return -ENODEV; 476 + 466 477 return renesas_sdhi_probe(pdev, &renesas_sdhi_sys_dmac_dma_ops); 467 478 } 468 479