From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V2 7/9] fsl_esdhc: add support for mx51 processor
Date: Wed, 20 Jan 2010 10:33:00 +0100 [thread overview]
Message-ID: <4B56CDCC.3000605@denx.de> (raw)
In-Reply-To: <2acbd3e41001190026p64dd7325pd057ebf23ce8768f@mail.gmail.com>
Andy Fleming wrote:
> Wolfgang has already covered most of this, but I have a few other
> comments (plus a couple of redundant ones)
Hi Andy,
> I know why you did this, but I really think it's a bad idea to "trick"
> the driver into doing the right thing.
I agree, I wanted only to point out why I need to do this ;)
> It's more painful, but we need
> to change all of the out_be32/in_be32 commands into something generic,
> and then add support for big and little endian accesses. This is just
> a hack. :(
Ok, let's see if I have really understood and I can proceed with the
modifications. I start to change the driver replacing all _be32
functions with a more neutral name (write_register/read_register or
something like that). I will define these functions then in asm-ppc/io.h
and asm-arm/io.h, setting them to the desired function.
> Let's try to use #ifdefs sparingly, and definitely have them trigger
> on constants that are directly related to the difference. This isn't
> a PPC/ARM problem. I see you've already agreed to use gd->sdhc_clk,
> though, so that's good.
I agree, using global data is a good idea.
> You have two choices, here. Either create a new CONFIG_SYS option
> that declares the existence of this register for platforms that have
> it,
In this case we will probably get a lot of CONFIG_SYS options when
Freescale changes version or uses this controller on other processors.
There are some different registers, not only for snooping. In most
cases, some further bits are added. At least I need to know if the
SDCLK_EN bit is present in the control register (present in the MX.51
implementation, absent in PowerQuick).
> OR (my preference) design a configuration mechanism which allows
> board/cpu code to declare such things.
I agree with you. I have already changed the initialization procedure
and I can pass (as you suggest later) a configuration structure that
describe the feature of the controller. The board can set this structure
in board_mmc_init(). If it is not set, the driver should work as now
(powerpc), so the structure must be filled only by arm boards.
> Ideally, the driver could
> detect this based on a version register, but I'm well aware that FSL's
> hardware designers frequently forget to increment their version
> numbers for such "small" changes.
I know, the version register is not reliable enough...
> What is certain is that CONFIG_PPC
> is wrong.
Absolutely agree, I get rid of it.
>> const char *compat = "fsl,esdhc";
>> @@ -365,3 +414,4 @@ out:
>> do_fixup_by_compat(blob, compat, "status", status,
>> strlen(status) + 1, 1);
>> }
>> +#endif
>
> Use the OF config option, here.
Ok, thanks.
>> +#define clrbits_be32(addr, clear) clrbits(l, addr, clear)
>> +#define setbits_be32(addr, set) setbits(l, addr, set)
>> +#define clrsetbits_be32(addr, clear, set) clrsetbits(l, addr, clear, set)
>> +
>> +
>
> This should be part of a completely different patch. Also, I'm
> positive that it's completely wrong. setbits_be32 is big endian,
> writel is little endian.
Agree. I will set a separate patch to setup the newer functions to
access the registers.
>> #ifdef CONFIG_FSL_ESDHC
>> int fsl_esdhc_mmc_init(bd_t *bis);
>> +int fsl_esdhc_initialize(bd_t *bis, uint32_t esdhc_addr,
>> + int (*getcd)(struct mmc *mmc));
>
>
> Hmmm....this doesn't scale well. Rather than pass in an address and a
> function pointer, create a structure with that information, and then
> pass *that* in. That way, when we discover we want some other
> information/functions, we can add them without having to modify the
> API.
You are right. I will create a structure that I can use to describe the
feature of the controller, as you already suggested.
> I think getcd needs more discussion, but even if it doesn't, this
> clearly belongs in a separate patch. You are modifying the U-Boot MMC
> API, here, not just the fsl_esdhc driver.
Probably I do not need anymore. I can implement as you suggest a weakly
defined function, something like:
int board_mmc_getcd(u8 *cd, struct mmc *mmc)__attribute__((weak,
alias("__board_mmc_getcd")))
If this failed, I can use the internal bits of the controller to check
the presence of the card.
Stefano
--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
next prev parent reply other threads:[~2010-01-20 9:33 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-13 9:50 [U-Boot] MX51 Support V2 Stefano Babic
2010-01-13 9:50 ` [U-Boot] [PATCH V2 1/9] mkimage: Add Freescale imx Boot Image support (imximage) Stefano Babic
2010-01-13 9:50 ` [U-Boot] [PATCH V2 2/9] MX51: Add initial support for the Freescale MX51 Stefano Babic
2010-01-13 9:50 ` [U-Boot] [PATCH V2 3/9] MX51: Add register definitions Stefano Babic
2010-01-13 9:50 ` [U-Boot] [PATCH V2 4/9] MX51: Add pin and multiplexer definitions Stefano Babic
2010-01-13 9:50 ` [U-Boot] [PATCH V2 5/9] serial_mxc: add support for MX51 processor Stefano Babic
2010-01-13 9:50 ` [U-Boot] [PATCH V2 6/9] fec_mxc: " Stefano Babic
2010-01-13 9:50 ` [U-Boot] [PATCH V2 7/9] fsl_esdhc: add support for mx51 processor Stefano Babic
2010-01-13 9:50 ` [U-Boot] [PATCH V2 8/9] mmc: check correctness of the voltage mask in ocr Stefano Babic
2010-01-13 9:50 ` [U-Boot] [PATCH V2 9/9] Add initial support for Freescale mx51evk board Stefano Babic
2010-01-19 8:26 ` [U-Boot] [PATCH V2 7/9] fsl_esdhc: add support for mx51 processor Andy Fleming
2010-01-20 9:33 ` Stefano Babic [this message]
2010-01-13 17:08 ` [U-Boot] [PATCH V2 1/9] mkimage: Add Freescale imx Boot Image support (imximage) Fabio Estevam
2010-01-14 8:51 ` Stefano Babic
2010-01-15 0:56 ` Fabio Estevam
2010-01-15 8:40 ` stefano at babic.homelinux.org
2010-01-15 12:19 ` Fabio Estevam
2010-01-15 15:01 ` Stefano Babic
2010-01-15 15:39 ` Wolfgang Denk
2010-01-18 6:27 ` Stefano Babic
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=4B56CDCC.3000605@denx.de \
--to=sbabic@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