All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen-Yu Tsai <wens@csie.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 06/10] ARM: sunxi-mmc: Add mmc support for sun6i / A31
Date: Wed, 24 Sep 2014 16:01:09 +0800	[thread overview]
Message-ID: <1411545673-5591-7-git-send-email-wens@csie.org> (raw)
In-Reply-To: <1411545673-5591-1-git-send-email-wens@csie.org>

From: Hans de Goede <hdegoede@redhat.com>

The mmc hardware on sun6i has an extra reset control that needs to
be de-asserted prior to usage. Also the FIFO address is different.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
[wens at csie.org: use setbits_le32 for reset control, drop obsolete changes,
		rewrite different FIFO address handling, add commit message]
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 arch/arm/include/asm/arch-sunxi/mmc.h |  5 ++++-
 drivers/mmc/sunxi_mmc.c               | 11 +++++++----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/arch/arm/include/asm/arch-sunxi/mmc.h b/arch/arm/include/asm/arch-sunxi/mmc.h
index 53196e3..6a31184 100644
--- a/arch/arm/include/asm/arch-sunxi/mmc.h
+++ b/arch/arm/include/asm/arch-sunxi/mmc.h
@@ -43,7 +43,10 @@ struct sunxi_mmc {
 	u32 chda;		/* 0x90 */
 	u32 cbda;		/* 0x94 */
 	u32 res1[26];
-	u32 fifo;		/* 0x100 FIFO access address */
+#if defined(CONFIG_SUN6I)
+	u32 res2[64];
+#endif
+	u32 fifo;		/* 0x100 (0x200 on sun6i) FIFO access address */
 };
 
 #define SUNXI_MMC_CLK_POWERSAVE		(0x1 << 17)
diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
index d4e574f..1982988 100644
--- a/drivers/mmc/sunxi_mmc.c
+++ b/drivers/mmc/sunxi_mmc.c
@@ -19,7 +19,6 @@
 struct sunxi_mmc_host {
 	unsigned mmc_no;
 	uint32_t *mclkreg;
-	unsigned database;
 	unsigned fatal_err;
 	unsigned mod_clk;
 	struct sunxi_mmc *reg;
@@ -57,7 +56,6 @@ static int mmc_resource_init(int sdc_no)
 		printf("Wrong mmc number %d\n", sdc_no);
 		return -1;
 	}
-	mmchost->database = (unsigned int)mmchost->reg + 0x100;
 	mmchost->mmc_no = sdc_no;
 
 	return 0;
@@ -75,6 +73,11 @@ static int mmc_clk_io_on(int sdc_no)
 	/* config ahb clock */
 	setbits_le32(&ccm->ahb_gate0, 1 << AHB_GATE_OFFSET_MMC(sdc_no));
 
+#if defined(CONFIG_SUN6I)
+	/* unassert reset */
+	setbits_le32(&ccm->ahb_reset0_cfg, 1 << AHB_RESET_OFFSET_MMC(sdc_no));
+#endif
+
 	/* config mod clock */
 	pll_clk = clock_get_pll6();
 	/* should be close to 100 MHz but no more, so round up */
@@ -194,9 +197,9 @@ static int mmc_trans_data_by_cpu(struct mmc *mmc, struct mmc_data *data)
 		}
 
 		if (reading)
-			buff[i] = readl(mmchost->database);
+			buff[i] = readl(&mmchost->reg->fifo);
 		else
-			writel(buff[i], mmchost->database);
+			writel(buff[i], &mmchost->reg->fifo);
 	}
 
 	return 0;
-- 
2.1.0

  parent reply	other threads:[~2014-09-24  8:01 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-24  8:01 [U-Boot] [PATCH v2 00/10] ARM: sunxi: Add basic support for Allwinner A31 (sun6i) Chen-Yu Tsai
2014-09-24  8:01 ` [U-Boot] [PATCH v2 01/10] ARM: sunxi: Use macro values for setting UART GPIO pull-ups Chen-Yu Tsai
2014-09-25 18:45   ` Ian Campbell
2014-09-24  8:01 ` [U-Boot] [PATCH v2 02/10] ARM: sunxi: Fix build break when CONFIG_USB_EHCI is not defined Chen-Yu Tsai
2014-09-24  8:01 ` [U-Boot] [PATCH v2 03/10] ARM: sun6i: Add base address for the new controllers in A31 Chen-Yu Tsai
2014-09-24  8:01 ` [U-Boot] [PATCH v2 04/10] ARM: sun6i: Add support for the power reset control module found on the A31 Chen-Yu Tsai
2014-09-25 18:47   ` Ian Campbell
2014-09-24  8:01 ` [U-Boot] [PATCH v2 05/10] ARM: sun6i: Add clock support Chen-Yu Tsai
2014-09-25 18:51   ` Ian Campbell
2014-09-24  8:01 ` Chen-Yu Tsai [this message]
2014-09-25 18:52   ` [U-Boot] [PATCH v2 06/10] ARM: sunxi-mmc: Add mmc support for sun6i / A31 Ian Campbell
2014-10-31 15:03     ` Pantelis Antoniou
2014-09-24  8:01 ` [U-Boot] [PATCH v2 07/10] ARM: sun6i: Define UART0 pins for A31 Chen-Yu Tsai
2014-09-25 18:54   ` Ian Campbell
2014-09-24  8:01 ` [U-Boot] [PATCH v2 08/10] ARM: sun6i: Setup the A31 UART0 muxing Chen-Yu Tsai
2014-09-25 18:54   ` Ian Campbell
2014-09-24  8:01 ` [U-Boot] [PATCH v2 09/10] ARM: sunxi: Add basic A31 support Chen-Yu Tsai
2014-09-25 18:56   ` Ian Campbell
2014-09-24  8:01 ` [U-Boot] [PATCH v2 10/10] ARM: sun6i: Add Colombus board defconfig Chen-Yu Tsai
2014-09-25 19:09   ` Ian Campbell
2014-09-28 15:33     ` Ian Campbell
2014-09-28 15:37       ` Chen-Yu Tsai
2014-09-28 15:43         ` Ian Campbell
2014-09-28 16:39           ` Maxime Ripard
2014-09-28 15:40       ` Hans de Goede
2014-09-28 16:20         ` [U-Boot] [linux-sunxi] " Ian Campbell
2014-09-28 17:03           ` Iain Paton
2014-09-28 18:10           ` Hans de Goede
2014-09-28 21:36             ` Ian Campbell
2014-09-29 18:08               ` Hans de Goede
2014-09-30  7:06                 ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1411545673-5591-7-git-send-email-wens@csie.org \
    --to=wens@csie.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.