[U-Boot] socfpga: initialize MMC
Wolfgang Denk
wd at denx.de
Wed Jul 16 14:52:38 CEST 2014
Dear Pavel Machek,
In message <20140716123422.GA8844 at amd.pavel.ucw.cz> you wrote:
>
> Once ethernet changes I merged, I can rediff mmc changes for
> application. It will look something like this:
>
> Albert, can you apply the ethernet patch? I'd like to continue on top
> of it...
Please mark such stuff for discussion explicitly as RFC so they can
easily be spottet in PW.
> +++ b/arch/arm/include/asm/arch-socfpga/socfpga_base_addrs.h
> @@ -14,5 +14,8 @@
> #define SOCFPGA_CLKMGR_ADDRESS 0xffd04000
> #define SOCFPGA_RSTMGR_ADDRESS 0xffd05000
> #define SOCFPGA_SYSMGR_ADDRESS 0xffd08000
> +#define SOCFPGA_SDMMC_ADDRESS 0xff704000
Please keep list sorted.
> --- a/drivers/mmc/Makefile
> +++ b/drivers/mmc/Makefile
> @@ -28,6 +28,7 @@ obj-$(CONFIG_SPEAR_SDHCI) += spear_sdhci.o
> obj-$(CONFIG_TEGRA_MMC) += tegra_mmc.o
> obj-$(CONFIG_DWMMC) += dw_mmc.o
> obj-$(CONFIG_EXYNOS_DWMMC) += exynos_dw_mmc.o
> +obj-$(CONFIG_ALTERA_DWMMC) += altera_dw_mmc.o
> obj-$(CONFIG_MMC_SUNXI) += sunxi_mmc.o
> obj-$(CONFIG_ZYNQ_SDHCI) += zynq_sdhci.o
> obj-$(CONFIG_SOCFPGA_DWMMC) += socfpga_dw_mmc.o
Ditto. This should be a sorted list.
> --- /dev/null
> +++ b/drivers/mmc/altera_dw_mmc.c
> @@ -0,0 +1,74 @@
> +/*
> + * Copyright (C) 2013 Altera Corporation <www.altera.com>
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
NAK. Please use SPDX ID tags instead.
> +static char *ALTERA_NAME = "ALTERA DWMMC";
Please use lower case variable names only.
> +int altera_dwmmc_init(u32 regbase, int bus_width, int index)
> +{
> + struct dwmci_host *host = NULL;
> + host = malloc(sizeof(struct dwmci_host));
Please separate declartions and code by a blank line.
Hm, which sense does it make to initialize host as NULL, just to assign
a different value in the next step?
Please fix.
> + host->name = ALTERA_NAME;
> + host->ioaddr = (void *)regbase;
> + host->buswidth = bus_width;
> + host->clksel = altera_dwmci_clksel;
> + host->dev_index = index;
> + host->bus_hz = 400000;
> + host->fifoth_val = MSIZE(0x2) |
> + RX_WMARK(CONFIG_DWMMC_FIFO_DEPTH / 2 - 1) |
> + TX_WMARK(CONFIG_DWMMC_FIFO_DEPTH / 2);
> +
> + add_dwmci(host, host->bus_hz, host->bus_hz);
Is there a free(host) anywhere?
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
While money can't buy happiness, it certainly lets you choose your
own form of misery.
More information about the U-Boot
mailing list