staging: fbtft: add SPDX identifiers
[linux/fpc-iii.git] / arch / arm / plat-samsung / platformdata.c
blob6cf52ee7eeecea013ee6388961a26f5cae551bb8
1 /* linux/arch/arm/plat-samsung/platformdata.c
3 * Copyright 2010 Ben Dooks <ben-linux <at> fluff.org>
5 * Helper for platform data setting
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
12 #include <linux/kernel.h>
13 #include <linux/slab.h>
14 #include <linux/string.h>
15 #include <linux/platform_device.h>
17 #include <plat/devs.h>
18 #include <plat/sdhci.h>
20 void __init *s3c_set_platdata(void *pd, size_t pdsize,
21 struct platform_device *pdev)
23 void *npd;
25 if (!pd) {
26 /* too early to use dev_name(), may not be registered */
27 printk(KERN_ERR "%s: no platform data supplied\n", pdev->name);
28 return NULL;
31 npd = kmemdup(pd, pdsize, GFP_KERNEL);
32 if (!npd)
33 return NULL;
35 pdev->dev.platform_data = npd;
36 return npd;
39 void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd,
40 struct s3c_sdhci_platdata *set)
42 set->cd_type = pd->cd_type;
43 set->ext_cd_init = pd->ext_cd_init;
44 set->ext_cd_cleanup = pd->ext_cd_cleanup;
45 set->ext_cd_gpio = pd->ext_cd_gpio;
46 set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert;
48 if (pd->max_width)
49 set->max_width = pd->max_width;
50 if (pd->cfg_gpio)
51 set->cfg_gpio = pd->cfg_gpio;
52 if (pd->host_caps)
53 set->host_caps |= pd->host_caps;
54 if (pd->host_caps2)
55 set->host_caps2 |= pd->host_caps2;
56 if (pd->pm_caps)
57 set->pm_caps |= pd->pm_caps;