Path: blob/master/arch/arm/mach-mxs/devices/platform-mxs-mmc.c
10819 views
/*1* Copyright (C) 2010 Pengutronix2* Uwe Kleine-Koenig <[email protected]>3*4* Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.5*6* This program is free software; you can redistribute it and/or modify it under7* the terms of the GNU General Public License version 2 as published by the8* Free Software Foundation.9*/1011#include <linux/compiler.h>12#include <linux/err.h>13#include <linux/init.h>1415#include <mach/mx23.h>16#include <mach/mx28.h>17#include <mach/devices-common.h>1819#define mxs_mxs_mmc_data_entry_single(soc, _id, hwid) \20{ \21.id = _id, \22.iobase = soc ## _SSP ## hwid ## _BASE_ADDR, \23.dma = soc ## _DMA_SSP ## hwid, \24.irq_err = soc ## _INT_SSP ## hwid ## _ERROR, \25.irq_dma = soc ## _INT_SSP ## hwid ## _DMA, \26}2728#define mxs_mxs_mmc_data_entry(soc, _id, hwid) \29[_id] = mxs_mxs_mmc_data_entry_single(soc, _id, hwid)303132#ifdef CONFIG_SOC_IMX2333const struct mxs_mxs_mmc_data mx23_mxs_mmc_data[] __initconst = {34mxs_mxs_mmc_data_entry(MX23, 0, 1),35mxs_mxs_mmc_data_entry(MX23, 1, 2),36};37#endif3839#ifdef CONFIG_SOC_IMX2840const struct mxs_mxs_mmc_data mx28_mxs_mmc_data[] __initconst = {41mxs_mxs_mmc_data_entry(MX28, 0, 0),42mxs_mxs_mmc_data_entry(MX28, 1, 1),43};44#endif4546struct platform_device *__init mxs_add_mxs_mmc(47const struct mxs_mxs_mmc_data *data,48const struct mxs_mmc_platform_data *pdata)49{50struct resource res[] = {51{52.start = data->iobase,53.end = data->iobase + SZ_8K - 1,54.flags = IORESOURCE_MEM,55}, {56.start = data->dma,57.end = data->dma,58.flags = IORESOURCE_DMA,59}, {60.start = data->irq_err,61.end = data->irq_err,62.flags = IORESOURCE_IRQ,63}, {64.start = data->irq_dma,65.end = data->irq_dma,66.flags = IORESOURCE_IRQ,67},68};6970return mxs_add_platform_device("mxs-mmc", data->id,71res, ARRAY_SIZE(res), pdata, sizeof(*pdata));72}737475