public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* Why does it increase the dsor value in MMC?
@ 2007-06-29  9:52 Kyungmin Park
  2007-06-29 14:15 ` Tuukka.Tikkanen
  0 siblings, 1 reply; 6+ messages in thread
From: Kyungmin Park @ 2007-06-29  9:52 UTC (permalink / raw)
  To: 'Linux OMAP'

Hi,

In mmc_omap_calc_divisor(). We calculate the dsor value.
In the code why does it increase the dsor at the end of code?

Now the Apollon board uses func_clk_rate as 95,000,000 and ios->clock is
20,000,000

	dsor = func_clk_rate / ios->clock;	=> 4
        if (dsor < 1)
                dsor = 1;

        if (func_clk_rate / dsor > ios->clock)	=> True
                dsor++;				=> 5

        if (dsor > 250)
                dsor = 250;
        dsor++;					=> 6

After the current calculation, we use the host clock as 15,833,333 (dsor 6). But
if it is not increased, we can use the 19,000,000 (dsor 5)

It there any reason to increase this value?

Thank you,
Kyungmin Park

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Why does it increase the dsor value in MMC?
  2007-06-29  9:52 Why does it increase the dsor value in MMC? Kyungmin Park
@ 2007-06-29 14:15 ` Tuukka.Tikkanen
  2007-06-29 15:28   ` Syed Mohammed, Khasim
  0 siblings, 1 reply; 6+ messages in thread
From: Tuukka.Tikkanen @ 2007-06-29 14:15 UTC (permalink / raw)
  To: linux-omap-open-source

[-- Attachment #1: Type: text/plain, Size: 2529 bytes --]

Hello,

I wrote the original code (and it did not have 2 increments), but the
second increment has appeared later on. I suspect might be duplicate
from the if statement caused by some merge conflict resolution. I do not
have OMAP TRM any longer, so I cannot check whether for example the
hardware register value has some funny offset (or if value 251 would be
illegal, for that matter.)

Another strong possibility is that whoever has been modifying the code
had a MMC card that reported higher speeds that it was actually able to
handle and adding the final increment "magically" fixed his/her
problems.

Removing the line improves performance for most people, but might break
some hardware combinations (the above case). If you can verify from TRM
that the value written to register is the actual divisor (and not like
1=0, 2=1 etc), I'm all for removing the last line, since its
undocumented and causing confusion. Unless, of course, someone can come
up with a reason for it and it gets documented.

Tuukka


-----Original Message-----
From: linux-omap-open-source-bounces@linux.omap.com
[mailto:linux-omap-open-source-bounces@linux.omap.com] On Behalf Of
Kyungmin Park
Sent: 29 June 2007 12:52
To: 'Linux OMAP'
Subject: Why does it increase the dsor value in MMC?

Hi,

In mmc_omap_calc_divisor(). We calculate the dsor value.
In the code why does it increase the dsor at the end of code?

Now the Apollon board uses func_clk_rate as 95,000,000 and ios->clock is
20,000,000

	dsor = func_clk_rate / ios->clock;	=> 4
        if (dsor < 1)
                dsor = 1;

        if (func_clk_rate / dsor > ios->clock)	=> True
                dsor++;				=> 5

        if (dsor > 250)
                dsor = 250;
        dsor++;					=> 6

After the current calculation, we use the host clock as 15,833,333 (dsor
6). But
if it is not increased, we can use the 19,000,000 (dsor 5)

It there any reason to increase this value?

Thank you,
Kyungmin Park

_______________________________________________
Linux-omap-open-source mailing list
Linux-omap-open-source@linux.omap.com
http://linux.omap.com/mailman/listinfo/linux-omap-open-source


----------------------------------------------------------------
Please note: This e-mail may contain confidential information
intended solely for the addressee. If you have received this
e-mail in error, please do not disclose it to anyone, notify
the sender promptly, and delete the message from your system.
Thank you.


[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Why does it increase the dsor value in MMC?
  2007-06-29 14:15 ` Tuukka.Tikkanen
@ 2007-06-29 15:28   ` Syed Mohammed, Khasim
  2007-07-02  2:14     ` Kyungmin Park
  0 siblings, 1 reply; 6+ messages in thread
From: Syed Mohammed, Khasim @ 2007-06-29 15:28 UTC (permalink / raw)
  To: Tuukka.Tikkanen, linux-omap-open-source


Hi,

>Removing the line improves performance for most people, but might break
>some hardware combinations (the above case). If you can verify from TRM
>that the value written to register is the actual divisor (and not like
>1=0, 2=1 etc), 
It is like this, writing 0 will disable the clock and 1 to 0x3FF are valid values.

Regards,
Khasim

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Why does it increase the dsor value in MMC?
  2007-06-29 15:28   ` Syed Mohammed, Khasim
@ 2007-07-02  2:14     ` Kyungmin Park
  2007-07-02  3:04       ` Syed Mohammed, Khasim
  0 siblings, 1 reply; 6+ messages in thread
From: Kyungmin Park @ 2007-07-02  2:14 UTC (permalink / raw)
  To: 'Syed Mohammed, Khasim', Tuukka.Tikkanen,
	linux-omap-open-source

> 
> >Removing the line improves performance for most people, but might break
> >some hardware combinations (the above case). If you can verify from TRM
> >that the value written to register is the actual divisor (and not like
> >1=0, 2=1 etc),
> It is like this, writing 0 will disable the clock and 1 to 0x3FF are valid
> values.

Then how about to append the following code?

/* If the dsor is zero, we increase the dsor value to enable the clock */
if (dsor == 0)
	dsor++;

It not only assigns the correct dsor values, but also enables the other
platform. 

Thank you,
Kyungmin Park

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Why does it increase the dsor value in MMC?
  2007-07-02  2:14     ` Kyungmin Park
@ 2007-07-02  3:04       ` Syed Mohammed, Khasim
  2007-08-10  7:48         ` Tony Lindgren
  0 siblings, 1 reply; 6+ messages in thread
From: Syed Mohammed, Khasim @ 2007-07-02  3:04 UTC (permalink / raw)
  To: kmpark, Tuukka.Tikkanen, linux-omap-open-source

Hi,

>Then how about to append the following code?
>
>/* If the dsor is zero, we increase the dsor value to enable the clock */
>if (dsor == 0)
>	dsor++;
>
>It not only assigns the correct dsor values, but also enables the other
>platform.
>

In TI's code we do the following, we don't add the extra dsor increment. This works for 2420 / 2430 and 3430 processors for all different types of MMC/SD cards.
       if (ios->clock) {
                /* Enable MMC_SD_CLK */
                dsor = OMAP_MMC_MASTER_CLOCK / ios->clock;
                if (dsor < 1)
                        dsor = 1;

                if (OMAP_MMC_MASTER_CLOCK / dsor > ios->clock)
                        dsor++;

                if (dsor > 250)
                        dsor = 250;
        }

As Tuukka suggested we might have to check the history and see if this line was mistakenly added. I was not able to browse history through muru.com / source.mvista.com looks like some server problem.

Regards,
Khasim

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Why does it increase the dsor value in MMC?
  2007-07-02  3:04       ` Syed Mohammed, Khasim
@ 2007-08-10  7:48         ` Tony Lindgren
  0 siblings, 0 replies; 6+ messages in thread
From: Tony Lindgren @ 2007-08-10  7:48 UTC (permalink / raw)
  To: Syed Mohammed, Khasim; +Cc: Tuukka.Tikkanen, linux-omap-open-source, kmpark

* Syed Mohammed, Khasim <x0khasim@ti.com> [070701 20:05]:
> Hi,
> 
> >Then how about to append the following code?
> >
> >/* If the dsor is zero, we increase the dsor value to enable the clock */
> >if (dsor == 0)
> >	dsor++;
> >
> >It not only assigns the correct dsor values, but also enables the other
> >platform.
> >
> 
> In TI's code we do the following, we don't add the extra dsor increment. This works for 2420 / 2430 and 3430 processors for all different types of MMC/SD cards.
>        if (ios->clock) {
>                 /* Enable MMC_SD_CLK */
>                 dsor = OMAP_MMC_MASTER_CLOCK / ios->clock;
>                 if (dsor < 1)
>                         dsor = 1;
> 
>                 if (OMAP_MMC_MASTER_CLOCK / dsor > ios->clock)
>                         dsor++;
> 
>                 if (dsor > 250)
>                         dsor = 250;
>         }
> 
> As Tuukka suggested we might have to check the history and see if this line was mistakenly added. I was not able to browse history through muru.com / source.mvista.com looks like some server problem.

I'll remove the extra dsor++ line as suggested. Let's see
if anything breaks.

Tony

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-08-10  7:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-29  9:52 Why does it increase the dsor value in MMC? Kyungmin Park
2007-06-29 14:15 ` Tuukka.Tikkanen
2007-06-29 15:28   ` Syed Mohammed, Khasim
2007-07-02  2:14     ` Kyungmin Park
2007-07-02  3:04       ` Syed Mohammed, Khasim
2007-08-10  7:48         ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox