Merge remote-tracking branch 'leds/for-mm'
[linux-2.6/next.git] / arch / arm / plat-samsung / platformdata.c
blob6de1a38259276de08a0b1dbe9835801fb5affba8
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/string.h>
14 #include <linux/platform_device.h>
16 #include <plat/devs.h>
17 #include <plat/sdhci.h>
19 void __init *s3c_set_platdata(void *pd, size_t pdsize,
20 struct platform_device *pdev)
22 void *npd;
24 if (!pd) {
25 /* too early to use dev_name(), may not be registered */
26 printk(KERN_ERR "%s: no platform data supplied\n", pdev->name);
27 return NULL;
30 npd = kmemdup(pd, pdsize, GFP_KERNEL);
31 if (!npd) {
32 printk(KERN_ERR "%s: cannot clone platform data\n", pdev->name);
33 return NULL;
36 pdev->dev.platform_data = npd;
37 return npd;
40 void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd,
41 struct s3c_sdhci_platdata *set)
43 set->cd_type = pd->cd_type;
44 set->ext_cd_init = pd->ext_cd_init;
45 set->ext_cd_cleanup = pd->ext_cd_cleanup;
46 set->ext_cd_gpio = pd->ext_cd_gpio;
47 set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert;
49 if (pd->max_width)
50 set->max_width = pd->max_width;
51 if (pd->cfg_gpio)
52 set->cfg_gpio = pd->cfg_gpio;
53 if (pd->cfg_card)
54 set->cfg_card = pd->cfg_card;
55 if (pd->host_caps)
56 set->host_caps |= pd->host_caps;
57 if (pd->clk_type)
58 set->clk_type = pd->clk_type;