2017-12-25 19:54:35 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
//
|
|
|
|
// Copyright 2010 Ben Dooks <ben-linux <at> fluff.org>
|
|
|
|
//
|
|
|
|
// Helper for platform data setting
|
2010-06-10 03:57:15 +00:00
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
2011-07-31 22:16:56 +00:00
|
|
|
#include <linux/slab.h>
|
2010-06-10 03:57:15 +00:00
|
|
|
#include <linux/string.h>
|
|
|
|
#include <linux/platform_device.h>
|
|
|
|
|
2019-09-02 16:37:30 +00:00
|
|
|
#include "devs.h"
|
|
|
|
#include "sdhci.h"
|
2010-06-10 03:57:15 +00: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);
|
2017-10-04 07:33:52 +00:00
|
|
|
if (!npd)
|
2010-06-10 03:57:15 +00:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
pdev->dev.platform_data = npd;
|
|
|
|
return npd;
|
|
|
|
}
|
2011-08-18 11:32:01 +00: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;
|
2012-02-07 06:59:01 +00:00
|
|
|
if (pd->host_caps2)
|
|
|
|
set->host_caps2 |= pd->host_caps2;
|
2011-12-08 03:49:29 +00:00
|
|
|
if (pd->pm_caps)
|
|
|
|
set->pm_caps |= pd->pm_caps;
|
2011-08-18 11:32:01 +00:00
|
|
|
}
|