0001
0002
0003
0004
0005
0006
0007 #include <linux/kernel.h>
0008 #include <linux/slab.h>
0009 #include <linux/string.h>
0010 #include <linux/platform_device.h>
0011
0012 #include "devs.h"
0013 #include "sdhci.h"
0014
0015 void __init *s3c_set_platdata(void *pd, size_t pdsize,
0016 struct platform_device *pdev)
0017 {
0018 void *npd;
0019
0020 if (!pd) {
0021
0022 printk(KERN_ERR "%s: no platform data supplied\n", pdev->name);
0023 return NULL;
0024 }
0025
0026 npd = kmemdup(pd, pdsize, GFP_KERNEL);
0027 if (!npd)
0028 return NULL;
0029
0030 pdev->dev.platform_data = npd;
0031 return npd;
0032 }
0033
0034 void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd,
0035 struct s3c_sdhci_platdata *set)
0036 {
0037 set->cd_type = pd->cd_type;
0038 set->ext_cd_init = pd->ext_cd_init;
0039 set->ext_cd_cleanup = pd->ext_cd_cleanup;
0040 set->ext_cd_gpio = pd->ext_cd_gpio;
0041 set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert;
0042
0043 if (pd->max_width)
0044 set->max_width = pd->max_width;
0045 if (pd->cfg_gpio)
0046 set->cfg_gpio = pd->cfg_gpio;
0047 if (pd->host_caps)
0048 set->host_caps |= pd->host_caps;
0049 if (pd->host_caps2)
0050 set->host_caps2 |= pd->host_caps2;
0051 if (pd->pm_caps)
0052 set->pm_caps |= pd->pm_caps;
0053 }