From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] mvebu_mmc: Driver addition
Date: Mon, 25 Aug 2014 11:55:18 +0200 [thread overview]
Message-ID: <53FB0806.5030305@denx.de> (raw)
In-Reply-To: <1408908676-25989-1-git-send-email-mario.schuknecht@dresearch-fe.de>
On 24.08.2014 21:31, Mario Schuknecht wrote:
> In function mvebu_mmc_write notice command timeout. It is possible that a
> command is done, but a timeout occurred.
>
> Enable timeout in set bus function.
>
> Set window registers. Without that I could not use the driver on a Kirkwood
> 88F6282 SoC.
>
> Set high capacity and 52MHz driver feature.
Thanks. A few review comments below.
> Signed-off-by: Mario Schuknecht <mario.schuknecht@dresearch-fe.de>
> ---
> drivers/mmc/mvebu_mmc.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 58 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/mvebu_mmc.c b/drivers/mmc/mvebu_mmc.c
> index 9759198..53754aa 100644
> --- a/drivers/mmc/mvebu_mmc.c
> +++ b/drivers/mmc/mvebu_mmc.c
> @@ -17,8 +17,12 @@
> #include <asm/arch/kirkwood.h>
> #include <mvebu_mmc.h>
>
> +DECLARE_GLOBAL_DATA_PTR;
> +
> #define DRIVER_NAME "MVEBU_MMC"
>
> +#define MVEBU_TARGET_DRAM 0
> +
> static void mvebu_mmc_write(u32 offs, u32 val)
> {
> writel(val, CONFIG_SYS_MMC_BASE + (offs));
> @@ -164,6 +168,9 @@ static int mvebu_mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
> return TIMEOUT;
> }
> }
> + if (mvebu_mmc_read(SDIO_ERR_INTR_STATUS) &
> + (SDIO_ERR_CMD_TIMEOUT | SDIO_ERR_DATA_TIMEOUT))
> + return TIMEOUT;
>
> /* Handling response */
> if (cmd->resp_type & MMC_RSP_136) {
> @@ -271,6 +278,7 @@ static void mvebu_mmc_set_bus(unsigned int bus)
>
> /* default to maximum timeout */
> ctrl_reg |= SDIO_HOST_CTRL_TMOUT(SDIO_HOST_CTRL_TMOUT_MAX);
> + ctrl_reg |= SDIO_HOST_CTRL_TMOUT_EN;
>
> ctrl_reg |= SDIO_HOST_CTRL_PUSH_PULL_EN;
>
> @@ -296,6 +304,53 @@ static void mvebu_mmc_set_ios(struct mmc *mmc)
> mvebu_mmc_set_clk(mmc->clock);
> }
>
> +/*
> + * Set window register.
> + */
> +static void mvebu_window_setup(void)
> +{
> + int i;
> +
> + for (i = 0; i < 4; i++) {
> + mvebu_mmc_write(WINDOW_CTRL(i), 0);
> + mvebu_mmc_write(WINDOW_BASE(i), 0);
> + }
Spaces instead of tabs for indentation. Please fix globally (checkpatch
clean)
> + for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
> + u32 size, base, attrib;
> +
> + /* Enable DRAM bank */
> + switch (i) {
> + case 0:
> + attrib = KWCPU_ATTR_DRAM_CS0;
> + break;
> + case 1:
> + attrib = KWCPU_ATTR_DRAM_CS1;
> + break;
> + case 2:
> + attrib = KWCPU_ATTR_DRAM_CS2;
> + break;
> + case 3:
> + attrib = KWCPU_ATTR_DRAM_CS3;
> + break;
> + default:
> + /* invalide bank, disable access */
> + attrib = 0;
> + break;
> + }
> +
> + size = gd->bd->bi_dram[i].size;
> + base = gd->bd->bi_dram[i].start;
> + if ((size) && (attrib))
size and attrib don't need parentheses here.
> + mvebu_mmc_write(WINDOW_CTRL(i),
> + MVCPU_WIN_CTRL_DATA(size, MVEBU_TARGET_DRAM,
> + attrib, MVCPU_WIN_ENABLE));
> + else
> + mvebu_mmc_write(WINDOW_CTRL(i), MVCPU_WIN_DISABLE);
Please use correct coding style for multi-line statements. So this
should look like this:
if (size && attrib) {
mvebu_mmc_write(WINDOW_CTRL(i),
MVCPU_WIN_CTRL_DATA(size, MVEBU_TARGET_DRAM,
attrib, MVCPU_WIN_ENABLE));
} else {
mvebu_mmc_write(WINDOW_CTRL(i), MVCPU_WIN_DISABLE);
}
Thanks,
Stefan
next prev parent reply other threads:[~2014-08-25 9:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-24 19:31 [U-Boot] [PATCH] mvebu_mmc: Driver addition Mario Schuknecht
2014-08-25 9:55 ` Stefan Roese [this message]
2014-08-25 10:53 ` Mario Schuknecht
2014-08-25 10:58 ` Stefan Roese
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=53FB0806.5030305@denx.de \
--to=sr@denx.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox