Shawn Guo | 47babe6 | 2011-03-16 11:31:06 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 Pengutronix |
| 3 | * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de> |
| 4 | * |
| 5 | * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved. |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify it under |
| 8 | * the terms of the GNU General Public License version 2 as published by the |
| 9 | * Free Software Foundation. |
| 10 | */ |
| 11 | |
| 12 | #include <linux/compiler.h> |
| 13 | #include <linux/err.h> |
| 14 | #include <linux/init.h> |
| 15 | |
| 16 | #include <mach/mx23.h> |
| 17 | #include <mach/mx28.h> |
| 18 | #include <mach/devices-common.h> |
| 19 | |
Shawn Guo | ef9b4d3 | 2012-05-05 20:24:01 +0800 | [diff] [blame^] | 20 | #define mxs_mxs_mmc_data_entry_single(soc, _devid, _id, hwid) \ |
Shawn Guo | 47babe6 | 2011-03-16 11:31:06 +0100 | [diff] [blame] | 21 | { \ |
Shawn Guo | ef9b4d3 | 2012-05-05 20:24:01 +0800 | [diff] [blame^] | 22 | .devid = _devid, \ |
Shawn Guo | 47babe6 | 2011-03-16 11:31:06 +0100 | [diff] [blame] | 23 | .id = _id, \ |
| 24 | .iobase = soc ## _SSP ## hwid ## _BASE_ADDR, \ |
| 25 | .dma = soc ## _DMA_SSP ## hwid, \ |
| 26 | .irq_err = soc ## _INT_SSP ## hwid ## _ERROR, \ |
| 27 | .irq_dma = soc ## _INT_SSP ## hwid ## _DMA, \ |
| 28 | } |
| 29 | |
Shawn Guo | ef9b4d3 | 2012-05-05 20:24:01 +0800 | [diff] [blame^] | 30 | #define mxs_mxs_mmc_data_entry(soc, _devid, _id, hwid) \ |
| 31 | [_id] = mxs_mxs_mmc_data_entry_single(soc, _devid, _id, hwid) |
Shawn Guo | 47babe6 | 2011-03-16 11:31:06 +0100 | [diff] [blame] | 32 | |
| 33 | |
| 34 | #ifdef CONFIG_SOC_IMX23 |
| 35 | const struct mxs_mxs_mmc_data mx23_mxs_mmc_data[] __initconst = { |
Shawn Guo | ef9b4d3 | 2012-05-05 20:24:01 +0800 | [diff] [blame^] | 36 | mxs_mxs_mmc_data_entry(MX23, "imx23-mmc", 0, 1), |
| 37 | mxs_mxs_mmc_data_entry(MX23, "imx23-mmc", 1, 2), |
Shawn Guo | 47babe6 | 2011-03-16 11:31:06 +0100 | [diff] [blame] | 38 | }; |
| 39 | #endif |
| 40 | |
| 41 | #ifdef CONFIG_SOC_IMX28 |
| 42 | const struct mxs_mxs_mmc_data mx28_mxs_mmc_data[] __initconst = { |
Shawn Guo | ef9b4d3 | 2012-05-05 20:24:01 +0800 | [diff] [blame^] | 43 | mxs_mxs_mmc_data_entry(MX28, "imx28-mmc", 0, 0), |
| 44 | mxs_mxs_mmc_data_entry(MX28, "imx28-mmc", 1, 1), |
| 45 | mxs_mxs_mmc_data_entry(MX28, "imx28-mmc", 2, 2), |
| 46 | mxs_mxs_mmc_data_entry(MX28, "imx28-mmc", 3, 3), |
Shawn Guo | 47babe6 | 2011-03-16 11:31:06 +0100 | [diff] [blame] | 47 | }; |
| 48 | #endif |
| 49 | |
| 50 | struct platform_device *__init mxs_add_mxs_mmc( |
| 51 | const struct mxs_mxs_mmc_data *data, |
| 52 | const struct mxs_mmc_platform_data *pdata) |
| 53 | { |
| 54 | struct resource res[] = { |
| 55 | { |
| 56 | .start = data->iobase, |
| 57 | .end = data->iobase + SZ_8K - 1, |
| 58 | .flags = IORESOURCE_MEM, |
| 59 | }, { |
| 60 | .start = data->dma, |
| 61 | .end = data->dma, |
| 62 | .flags = IORESOURCE_DMA, |
| 63 | }, { |
| 64 | .start = data->irq_err, |
| 65 | .end = data->irq_err, |
| 66 | .flags = IORESOURCE_IRQ, |
| 67 | }, { |
| 68 | .start = data->irq_dma, |
| 69 | .end = data->irq_dma, |
| 70 | .flags = IORESOURCE_IRQ, |
| 71 | }, |
| 72 | }; |
| 73 | |
Shawn Guo | ef9b4d3 | 2012-05-05 20:24:01 +0800 | [diff] [blame^] | 74 | return mxs_add_platform_device(data->devid, data->id, |
Shawn Guo | 47babe6 | 2011-03-16 11:31:06 +0100 | [diff] [blame] | 75 | res, ARRAY_SIZE(res), pdata, sizeof(*pdata)); |
| 76 | } |