2010-06-09 21:57:15 -06:00
|
|
|
/* linux/arch/arm/plat-samsung/platformdata.c
|
|
|
|
*
|
|
|
|
* Copyright 2010 Ben Dooks <ben-linux <at> fluff.org>
|
|
|
|
*
|
|
|
|
* Helper for platform data setting
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
2011-07-31 16:16:56 -06:00
|
|
|
#include <linux/slab.h>
|
2010-06-09 21:57:15 -06:00
|
|
|
#include <linux/string.h>
|
|
|
|
#include <linux/platform_device.h>
|
|
|
|
|
|
|
|
#include <plat/devs.h>
|
2011-08-18 05:32:01 -06:00
|
|
|
#include <plat/sdhci.h>
|
2010-06-09 21:57:15 -06:00
|
|
|
|
|
|
|
void __init *s3c_set_platdata(void *pd, size_t pdsize,
|
|
|
|
struct platform_device *pdev)
|
|
|
|
{
|
|
|
|
void *npd;
|
|
|
|
|
|
|
|
if (!pd) {
|
|
|
|
/* too early to use dev_name(), may not be registered */
|
|
|
|
printk(KERN_ERR "%s: no platform data supplied\n", pdev->name);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
npd = kmemdup(pd, pdsize, GFP_KERNEL);
|
|
|
|
if (!npd) {
|
|
|
|
printk(KERN_ERR "%s: cannot clone platform data\n", pdev->name);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
pdev->dev.platform_data = npd;
|
|
|
|
return npd;
|
|
|
|
}
|
2011-08-18 05:32:01 -06:00
|
|
|
|
|
|
|
void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd,
|
|
|
|
struct s3c_sdhci_platdata *set)
|
|
|
|
{
|
|
|
|
set->cd_type = pd->cd_type;
|
|
|
|
set->ext_cd_init = pd->ext_cd_init;
|
|
|
|
set->ext_cd_cleanup = pd->ext_cd_cleanup;
|
|
|
|
set->ext_cd_gpio = pd->ext_cd_gpio;
|
|
|
|
set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert;
|
|
|
|
|
|
|
|
if (pd->max_width)
|
|
|
|
set->max_width = pd->max_width;
|
|
|
|
if (pd->cfg_gpio)
|
|
|
|
set->cfg_gpio = pd->cfg_gpio;
|
|
|
|
if (pd->host_caps)
|
|
|
|
set->host_caps |= pd->host_caps;
|
|
|
|
if (pd->clk_type)
|
|
|
|
set->clk_type = pd->clk_type;
|
|
|
|
}
|