aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/asic3.c
diff options
context:
space:
mode:
authorIan Molton <ian@mnementh.co.uk>2010-01-06 07:51:48 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2010-01-18 06:30:27 -0500
commit64e8867ba8098b69889c1af94997a5ba2348fb26 (patch)
tree3391806575ec3435a26043a22ba45c9d76f0b791 /drivers/mfd/asic3.c
parent6f2af72a2451b7491fba820b1d1b0b91c6a84027 (diff)
mfd: tmio_mmc hardware abstraction for CNF area
This patch abstracts out the CNF area code from tmio_mmc which is not present in all hardware that can use this driver. This is required so that we can support non-toshiba based hardware. ASIC3 support by Philipp Zabel Signed-off-by: Ian Molton <ian@mnementh.co.uk> Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/asic3.c')
-rw-r--r--drivers/mfd/asic3.c40
1 files changed, 32 insertions, 8 deletions
diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c
index e22128c3e9a8..95c1e6bd1729 100644
--- a/drivers/mfd/asic3.c
+++ b/drivers/mfd/asic3.c
@@ -80,6 +80,7 @@ struct asic3 {
80 u16 irq_bothedge[4]; 80 u16 irq_bothedge[4];
81 struct gpio_chip gpio; 81 struct gpio_chip gpio;
82 struct device *dev; 82 struct device *dev;
83 void __iomem *tmio_cnf;
83 84
84 struct asic3_clk clocks[ARRAY_SIZE(asic3_clk_init)]; 85 struct asic3_clk clocks[ARRAY_SIZE(asic3_clk_init)];
85}; 86};
@@ -685,8 +686,24 @@ static struct mfd_cell asic3_cell_ds1wm = {
685 .resources = ds1wm_resources, 686 .resources = ds1wm_resources,
686}; 687};
687 688
689static void asic3_mmc_pwr(struct platform_device *pdev, int state)
690{
691 struct asic3 *asic = dev_get_drvdata(pdev->dev.parent);
692
693 tmio_core_mmc_pwr(asic->tmio_cnf, 1 - asic->bus_shift, state);
694}
695
696static void asic3_mmc_clk_div(struct platform_device *pdev, int state)
697{
698 struct asic3 *asic = dev_get_drvdata(pdev->dev.parent);
699
700 tmio_core_mmc_clk_div(asic->tmio_cnf, 1 - asic->bus_shift, state);
701}
702
688static struct tmio_mmc_data asic3_mmc_data = { 703static struct tmio_mmc_data asic3_mmc_data = {
689 .hclk = 24576000, 704 .hclk = 24576000,
705 .set_pwr = asic3_mmc_pwr,
706 .set_clk_div = asic3_mmc_clk_div,
690}; 707};
691 708
692static struct resource asic3_mmc_resources[] = { 709static struct resource asic3_mmc_resources[] = {
@@ -696,11 +713,6 @@ static struct resource asic3_mmc_resources[] = {
696 .flags = IORESOURCE_MEM, 713 .flags = IORESOURCE_MEM,
697 }, 714 },
698 { 715 {
699 .start = ASIC3_SD_CONFIG_BASE,
700 .end = ASIC3_SD_CONFIG_BASE + 0x1ff,
701 .flags = IORESOURCE_MEM,
702 },
703 {
704 .start = 0, 716 .start = 0,
705 .end = 0, 717 .end = 0,
706 .flags = IORESOURCE_IRQ, 718 .flags = IORESOURCE_IRQ,
@@ -743,6 +755,10 @@ static int asic3_mmc_enable(struct platform_device *pdev)
743 asic3_set_register(asic, ASIC3_OFFSET(SDHWCTRL, SDCONF), 755 asic3_set_register(asic, ASIC3_OFFSET(SDHWCTRL, SDCONF),
744 ASIC3_SDHWCTRL_SDPWR, 1); 756 ASIC3_SDHWCTRL_SDPWR, 1);
745 757
758 /* ASIC3_SD_CTRL_BASE assumes 32-bit addressing, TMIO is 16-bit */
759 tmio_core_mmc_enable(asic->tmio_cnf, 1 - asic->bus_shift,
760 ASIC3_SD_CTRL_BASE >> 1);
761
746 return 0; 762 return 0;
747} 763}
748 764
@@ -797,10 +813,15 @@ static int __init asic3_mfd_probe(struct platform_device *pdev,
797 asic3_cell_ds1wm.data_size = sizeof(asic3_cell_ds1wm); 813 asic3_cell_ds1wm.data_size = sizeof(asic3_cell_ds1wm);
798 814
799 /* MMC */ 815 /* MMC */
816 asic->tmio_cnf = ioremap((ASIC3_SD_CONFIG_BASE >> asic->bus_shift) +
817 mem_sdio->start, 0x400 >> asic->bus_shift);
818 if (!asic->tmio_cnf) {
819 ret = -ENOMEM;
820 dev_dbg(asic->dev, "Couldn't ioremap SD_CONFIG\n");
821 goto out;
822 }
800 asic3_mmc_resources[0].start >>= asic->bus_shift; 823 asic3_mmc_resources[0].start >>= asic->bus_shift;
801 asic3_mmc_resources[0].end >>= asic->bus_shift; 824 asic3_mmc_resources[0].end >>= asic->bus_shift;
802 asic3_mmc_resources[1].start >>= asic->bus_shift;
803 asic3_mmc_resources[1].end >>= asic->bus_shift;
804 825
805 asic3_cell_mmc.platform_data = &asic3_cell_mmc; 826 asic3_cell_mmc.platform_data = &asic3_cell_mmc;
806 asic3_cell_mmc.data_size = sizeof(asic3_cell_mmc); 827 asic3_cell_mmc.data_size = sizeof(asic3_cell_mmc);
@@ -820,7 +841,10 @@ static int __init asic3_mfd_probe(struct platform_device *pdev,
820 841
821static void asic3_mfd_remove(struct platform_device *pdev) 842static void asic3_mfd_remove(struct platform_device *pdev)
822{ 843{
844 struct asic3 *asic = platform_get_drvdata(pdev);
845
823 mfd_remove_devices(&pdev->dev); 846 mfd_remove_devices(&pdev->dev);
847 iounmap(asic->tmio_cnf);
824} 848}
825 849
826/* Core */ 850/* Core */