A few questions about SD/MMC drivers

Martin Galvan omgalvan.86 at gmail.com
Mon Oct 6 00:32:06 UTC 2014


Hi Warner! Thanks for your answer.

2014-10-05 20:06 GMT-03:00 Warner Losh <imp at bsdimp.com>:
> On Oct 5, 2014, at 4:05 PM, Martin Galvan <omgalvan.86 at gmail.com> wrote:
>
>> 2) The code I'm working on is based off the Linux driver for the same
>> host, which as of today stands as the only "documentation", so to
>> speak, on that particular host. According to the Linux driver, we need
>> to do a phase shift adjustment while setting the clock in the set_ios
>> function. That involves several steps, one of which is calling
>> clk_set_rate, which seems to be a function many other Linux drivers
>> use. As I'm not familiar with Linux kernel internals, so far I haven't
>> been able to find the equivalent for that function on BSD, so how
>> should I go about this?
>
> Most likely you’ll need to write the clock infrastructure for allwinner to
> make this work. I don’t believe that it is actually there today. Note: I’ve
> not looked at the allwinner core code in a long time, so maybe this
> has already been rectified.

Well, there's a a10_clk.c file in the current tree that (sort of)
takes care of the clocking for Allwinner.

> clk_set_rate in Linux adjusts the produced clock frequency for a clock
> that’s programmable in the SoC.

I actually forgot to mention I'm reworking Alex Fedorov's MMC patch.
While indeed there's not a function for clocking the MMC host yet in
the tree, Alex's patch did include a basic clocking function in
a10_clk.c that does the necessary register magic to get things
working, but doesn't do any of the phase shifting. I believe I can get
that done if I could find a way to implement something similar to
clk_set_rate, at least for this driver. In any case, the phase shift
thing seems to be mostly for speeding things up a bit (I managed to
get Alex's driver working by fixing a couple of bugs here and there;
it's kind of slow since it doesn't support DMA nor multiblock
operations yet), and we can probably add that later.

Speaking of multiblock support, I noticed at some point your
at91_mci.c had multiblock operations working but then you switched to
single-block only (at least I'm sure I saw a version where
MMCBR_IVAR_MAX_DATA returned something other than 1). Do you remember
what happened there?

Again, thanks a lot for your answer.


More information about the freebsd-embedded mailing list