Merge branch 'next/cross-platform' of git://git.linaro.org/people/arnd/arm-soc
[deliverable/linux.git] / arch / arm / plat-samsung / platformdata.c
CommitLineData
3911dab8
BD
1/* linux/arch/arm/plat-samsung/platformdata.c
2 *
3 * Copyright 2010 Ben Dooks <ben-linux <at> fluff.org>
4 *
5 * Helper for platform data setting
6 *
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.
10*/
11
12#include <linux/kernel.h>
13#include <linux/string.h>
14#include <linux/platform_device.h>
15
16#include <plat/devs.h>
5e8e0a10 17#include <plat/sdhci.h>
3911dab8
BD
18
19void __init *s3c_set_platdata(void *pd, size_t pdsize,
20 struct platform_device *pdev)
21{
22 void *npd;
23
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;
28 }
29
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;
34 }
35
36 pdev->dev.platform_data = npd;
37 return npd;
38}
5e8e0a10
BG
39
40void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd,
41 struct s3c_sdhci_platdata *set)
42{
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;
48
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;
59}
This page took 0.101595 seconds and 5 git commands to generate.