147babe692e90e0333b2448969639b8f0940e3682Shawn Guo/* 247babe692e90e0333b2448969639b8f0940e3682Shawn Guo * Copyright (C) 2010 Pengutronix 347babe692e90e0333b2448969639b8f0940e3682Shawn Guo * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de> 447babe692e90e0333b2448969639b8f0940e3682Shawn Guo * 547babe692e90e0333b2448969639b8f0940e3682Shawn Guo * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved. 647babe692e90e0333b2448969639b8f0940e3682Shawn Guo * 747babe692e90e0333b2448969639b8f0940e3682Shawn Guo * This program is free software; you can redistribute it and/or modify it under 847babe692e90e0333b2448969639b8f0940e3682Shawn Guo * the terms of the GNU General Public License version 2 as published by the 947babe692e90e0333b2448969639b8f0940e3682Shawn Guo * Free Software Foundation. 1047babe692e90e0333b2448969639b8f0940e3682Shawn Guo */ 1147babe692e90e0333b2448969639b8f0940e3682Shawn Guo 1247babe692e90e0333b2448969639b8f0940e3682Shawn Guo#include <linux/compiler.h> 1347babe692e90e0333b2448969639b8f0940e3682Shawn Guo#include <linux/err.h> 1447babe692e90e0333b2448969639b8f0940e3682Shawn Guo#include <linux/init.h> 1547babe692e90e0333b2448969639b8f0940e3682Shawn Guo 1647babe692e90e0333b2448969639b8f0940e3682Shawn Guo#include <mach/mx23.h> 1747babe692e90e0333b2448969639b8f0940e3682Shawn Guo#include <mach/mx28.h> 1847babe692e90e0333b2448969639b8f0940e3682Shawn Guo#include <mach/devices-common.h> 1947babe692e90e0333b2448969639b8f0940e3682Shawn Guo 2047babe692e90e0333b2448969639b8f0940e3682Shawn Guo#define mxs_mxs_mmc_data_entry_single(soc, _id, hwid) \ 2147babe692e90e0333b2448969639b8f0940e3682Shawn Guo { \ 2247babe692e90e0333b2448969639b8f0940e3682Shawn Guo .id = _id, \ 2347babe692e90e0333b2448969639b8f0940e3682Shawn Guo .iobase = soc ## _SSP ## hwid ## _BASE_ADDR, \ 2447babe692e90e0333b2448969639b8f0940e3682Shawn Guo .dma = soc ## _DMA_SSP ## hwid, \ 2547babe692e90e0333b2448969639b8f0940e3682Shawn Guo .irq_err = soc ## _INT_SSP ## hwid ## _ERROR, \ 2647babe692e90e0333b2448969639b8f0940e3682Shawn Guo .irq_dma = soc ## _INT_SSP ## hwid ## _DMA, \ 2747babe692e90e0333b2448969639b8f0940e3682Shawn Guo } 2847babe692e90e0333b2448969639b8f0940e3682Shawn Guo 2947babe692e90e0333b2448969639b8f0940e3682Shawn Guo#define mxs_mxs_mmc_data_entry(soc, _id, hwid) \ 3047babe692e90e0333b2448969639b8f0940e3682Shawn Guo [_id] = mxs_mxs_mmc_data_entry_single(soc, _id, hwid) 3147babe692e90e0333b2448969639b8f0940e3682Shawn Guo 3247babe692e90e0333b2448969639b8f0940e3682Shawn Guo 3347babe692e90e0333b2448969639b8f0940e3682Shawn Guo#ifdef CONFIG_SOC_IMX23 3447babe692e90e0333b2448969639b8f0940e3682Shawn Guoconst struct mxs_mxs_mmc_data mx23_mxs_mmc_data[] __initconst = { 3547babe692e90e0333b2448969639b8f0940e3682Shawn Guo mxs_mxs_mmc_data_entry(MX23, 0, 1), 3647babe692e90e0333b2448969639b8f0940e3682Shawn Guo mxs_mxs_mmc_data_entry(MX23, 1, 2), 3747babe692e90e0333b2448969639b8f0940e3682Shawn Guo}; 3847babe692e90e0333b2448969639b8f0940e3682Shawn Guo#endif 3947babe692e90e0333b2448969639b8f0940e3682Shawn Guo 4047babe692e90e0333b2448969639b8f0940e3682Shawn Guo#ifdef CONFIG_SOC_IMX28 4147babe692e90e0333b2448969639b8f0940e3682Shawn Guoconst struct mxs_mxs_mmc_data mx28_mxs_mmc_data[] __initconst = { 4247babe692e90e0333b2448969639b8f0940e3682Shawn Guo mxs_mxs_mmc_data_entry(MX28, 0, 0), 4347babe692e90e0333b2448969639b8f0940e3682Shawn Guo mxs_mxs_mmc_data_entry(MX28, 1, 1), 44bfc0b9c8a9d546eb53a3491c893fad72d96540cbLothar Waßmann mxs_mxs_mmc_data_entry(MX28, 2, 2), 45bfc0b9c8a9d546eb53a3491c893fad72d96540cbLothar Waßmann mxs_mxs_mmc_data_entry(MX28, 3, 3), 4647babe692e90e0333b2448969639b8f0940e3682Shawn Guo}; 4747babe692e90e0333b2448969639b8f0940e3682Shawn Guo#endif 4847babe692e90e0333b2448969639b8f0940e3682Shawn Guo 4947babe692e90e0333b2448969639b8f0940e3682Shawn Guostruct platform_device *__init mxs_add_mxs_mmc( 5047babe692e90e0333b2448969639b8f0940e3682Shawn Guo const struct mxs_mxs_mmc_data *data, 5147babe692e90e0333b2448969639b8f0940e3682Shawn Guo const struct mxs_mmc_platform_data *pdata) 5247babe692e90e0333b2448969639b8f0940e3682Shawn Guo{ 5347babe692e90e0333b2448969639b8f0940e3682Shawn Guo struct resource res[] = { 5447babe692e90e0333b2448969639b8f0940e3682Shawn Guo { 5547babe692e90e0333b2448969639b8f0940e3682Shawn Guo .start = data->iobase, 5647babe692e90e0333b2448969639b8f0940e3682Shawn Guo .end = data->iobase + SZ_8K - 1, 5747babe692e90e0333b2448969639b8f0940e3682Shawn Guo .flags = IORESOURCE_MEM, 5847babe692e90e0333b2448969639b8f0940e3682Shawn Guo }, { 5947babe692e90e0333b2448969639b8f0940e3682Shawn Guo .start = data->dma, 6047babe692e90e0333b2448969639b8f0940e3682Shawn Guo .end = data->dma, 6147babe692e90e0333b2448969639b8f0940e3682Shawn Guo .flags = IORESOURCE_DMA, 6247babe692e90e0333b2448969639b8f0940e3682Shawn Guo }, { 6347babe692e90e0333b2448969639b8f0940e3682Shawn Guo .start = data->irq_err, 6447babe692e90e0333b2448969639b8f0940e3682Shawn Guo .end = data->irq_err, 6547babe692e90e0333b2448969639b8f0940e3682Shawn Guo .flags = IORESOURCE_IRQ, 6647babe692e90e0333b2448969639b8f0940e3682Shawn Guo }, { 6747babe692e90e0333b2448969639b8f0940e3682Shawn Guo .start = data->irq_dma, 6847babe692e90e0333b2448969639b8f0940e3682Shawn Guo .end = data->irq_dma, 6947babe692e90e0333b2448969639b8f0940e3682Shawn Guo .flags = IORESOURCE_IRQ, 7047babe692e90e0333b2448969639b8f0940e3682Shawn Guo }, 7147babe692e90e0333b2448969639b8f0940e3682Shawn Guo }; 7247babe692e90e0333b2448969639b8f0940e3682Shawn Guo 7347babe692e90e0333b2448969639b8f0940e3682Shawn Guo return mxs_add_platform_device("mxs-mmc", data->id, 7447babe692e90e0333b2448969639b8f0940e3682Shawn Guo res, ARRAY_SIZE(res), pdata, sizeof(*pdata)); 7547babe692e90e0333b2448969639b8f0940e3682Shawn Guo} 76