All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] socfpga: initialize MMC
Date: Mon, 21 Jul 2014 12:20:04 +0200	[thread overview]
Message-ID: <20140721102004.GA12896@amd.pavel.ucw.cz> (raw)
In-Reply-To: <20140716125238.CF3833804B5@gemini.denx.de>

Hi!

> > +++ 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.

It was sorted by address before, so I'll keep it like that.

> > --- 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.

This was not sorted and I will not need to modify it in next patch
version, so I'll leave this unfixed.

> > +static char *ALTERA_NAME = "ALTERA DWMMC";
> 
> Please use lower case variable names only.

Actually, it turns out we don't need the variable :-).

> > +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.

Ok.

> Hm, which sense does it make to initialize host as NULL, just to assign
> a different value in the next step?
> 
> Please fix.

Fixed.

> > +	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?

Dynamic allocation does not make much sense here, agreed. But as it is
existing code, and there are bigger issues around, I'd prefer to leave
it to someone else to clean it up...

Thanks,
								Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  parent reply	other threads:[~2014-07-21 10:20 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-16 12:34 [U-Boot] socfpga: initialize MMC Pavel Machek
2014-07-16 12:52 ` Wolfgang Denk
2014-07-16 13:13   ` Wolfgang Denk
2014-07-17 11:00     ` Chin Liang See
2014-07-17 12:01       ` Wolfgang Denk
2014-07-19 12:03         ` Pavel Machek
2014-07-21 10:20   ` Pavel Machek [this message]
2014-07-21 10:50     ` Wolfgang Denk
2014-07-21 12:05       ` Pavel Machek
2014-07-22  9:33         ` Chin Liang See
2014-09-09 13:16       ` [U-Boot] [PATCH] sort drivers/mmc/Makefile Pavel Machek
2014-09-12  7:25         ` Chin Liang See
2014-11-10 21:29         ` [U-Boot] " Tom Rini
2014-07-21 10:30   ` [U-Boot] [PATCH] socfpga: cleanup socfpga_dw_mmc Pavel Machek
2014-07-21 10:49     ` Chin Liang See
2014-07-21 11:30     ` [U-Boot] [PATCHv2] " Pavel Machek
2014-07-22  4:55       ` Chin Liang See
2014-08-30 15:13       ` [U-Boot] [U-Boot,PATCHv2] " Tom Rini
2014-07-22  3:22 ` [U-Boot] socfpga: initialize MMC Jaehoon Chung
2014-07-22  8:49   ` Pavel Machek

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=20140721102004.GA12896@amd.pavel.ucw.cz \
    --to=pavel@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 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.