1/*
2 * linux/arch/arm/mach-exynos4/dev-dwmci.c
3 *
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
5 *		http://www.samsung.com
6 *
7 * Platform device for Synopsys DesignWare Mobile Storage IP
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 */
14
15#include <linux/kernel.h>
16#include <linux/dma-mapping.h>
17#include <linux/platform_device.h>
18#include <linux/interrupt.h>
19#include <linux/ioport.h>
20#include <linux/mmc/dw_mmc.h>
21
22#include <plat/devs.h>
23
24#include <mach/map.h>
25
26static int exynos4_dwmci_get_bus_wd(u32 slot_id)
27{
28	return 4;
29}
30
31static int exynos4_dwmci_init(u32 slot_id, irq_handler_t handler, void *data)
32{
33	return 0;
34}
35
36static struct resource exynos4_dwmci_resource[] = {
37	[0] = DEFINE_RES_MEM(EXYNOS4_PA_DWMCI, SZ_4K),
38	[1] = DEFINE_RES_IRQ(EXYNOS4_IRQ_DWMCI),
39};
40
41static struct dw_mci_board exynos4_dwci_pdata = {
42	.num_slots			= 1,
43	.quirks				= DW_MCI_QUIRK_BROKEN_CARD_DETECTION,
44	.bus_hz				= 80 * 1000 * 1000,
45	.detect_delay_ms	= 200,
46	.init				= exynos4_dwmci_init,
47	.get_bus_wd			= exynos4_dwmci_get_bus_wd,
48};
49
50static u64 exynos4_dwmci_dmamask = DMA_BIT_MASK(32);
51
52struct platform_device exynos4_device_dwmci = {
53	.name		= "dw_mmc",
54	.id		= -1,
55	.num_resources	= ARRAY_SIZE(exynos4_dwmci_resource),
56	.resource	= exynos4_dwmci_resource,
57	.dev		= {
58		.dma_mask		= &exynos4_dwmci_dmamask,
59		.coherent_dma_mask	= DMA_BIT_MASK(32),
60		.platform_data	= &exynos4_dwci_pdata,
61	},
62};
63
64void __init exynos4_dwmci_set_platdata(struct dw_mci_board *pd)
65{
66	struct dw_mci_board *npd;
67
68	npd = s3c_set_platdata(pd, sizeof(struct dw_mci_board),
69			&exynos4_device_dwmci);
70
71	if (!npd->init)
72		npd->init = exynos4_dwmci_init;
73	if (!npd->get_bus_wd)
74		npd->get_bus_wd = exynos4_dwmci_get_bus_wd;
75}
76