* [U-Boot] [PATCH v3 2/2] TI: DaVinci DA850 EVM: support passing maximum allowed cpu clock rate information to kernel
@ 2010-08-18 15:41 Sekhar Nori
2010-08-18 15:53 ` Detlev Zundel
2010-08-19 8:21 ` Stefano Babic
0 siblings, 2 replies; 5+ messages in thread
From: Sekhar Nori @ 2010-08-18 15:41 UTC (permalink / raw)
To: u-boot
The TI DA850/OMAP-L138/AM18x EVM can be populated with devices
having different maximum allowed CPU clock rating.
The maximum clock the chip can support can only be determined from
the label on the package (not software readable).
Introduce a method to pass the maximum allowed clock rate information
to kernel using ATAG_REVISION. The kernel uses this information to
determine the maximum cpu clock rate reachable using cpufreq.
Note that U-Boot itself does not set the CPU clock rate. The CPU
clock is setup by a primary bootloader ("UBL"). The rate setup by
UBL could be different from the maximum clock rate supported by the
device.
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
Changes in v3:
a) renamed maxspeed to maxcpuclk
b) add information regarding the new environment variable in README.davinci
c) use if-else instead of switch to check for value range rather than specific
values of maxcpuclk
d) change comment to document values returned in bit[0-3] by get_board_rev() in
binary
board/davinci/da8xxevm/da850evm.c | 33 +++++++++++++++++++++++++++++++++
doc/README.davinci | 13 +++++++++++++
include/configs/da850evm.h | 1 +
3 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c
index eeb456c..266c4d8 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -70,6 +70,39 @@ static const struct lpsc_resource lpsc[] = {
{ DAVINCI_LPSC_GPIO },
};
+#ifndef CONFIG_DA850_EVM_MAX_CPU_CLK
+#define CONFIG_DA850_EVM_MAX_CPU_CLK 300000000
+#endif
+
+/*
+ * get_board_rev() - setup to pass kernel board revision information
+ * Returns:
+ * bit[0-3] Maximum cpu clock rate supported by onboard SoC
+ * 0000b - 300 MHz
+ * 0001b - 372 MHz
+ * 0010b - 408 MHz
+ * 0011b - 456 MHz
+ */
+u32 get_board_rev(void)
+{
+ char *s;
+ u32 maxcpuclk = CONFIG_DA850_EVM_MAX_CPU_CLK;
+ u32 rev = 0;
+
+ s = getenv("maxcpuclk");
+ if (s)
+ maxcpuclk = simple_strtoul(s, NULL, 10);
+
+ if (maxcpuclk >= 456000000)
+ rev = 3;
+ else if (maxcpuclk >= 408000000)
+ rev = 2;
+ else if (maxcpuclk >= 372000000)
+ rev = 1;
+
+ return rev;
+}
+
int board_init(void)
{
#ifndef CONFIG_USE_IRQ
diff --git a/doc/README.davinci b/doc/README.davinci
index a2e96a5..3e624ee 100644
--- a/doc/README.davinci
+++ b/doc/README.davinci
@@ -95,6 +95,19 @@ into the RAM.
The programmers and UBL are always released as part of any standard TI
software release associated with an SOC.
+Environment Variables
+=====================
+
+The DA850 EVM allows the user to specify the maximum cpu clock allowed by the
+silicon, in Hz, via an environment variable "maxcpuclk".
+
+The maximum clock rate allowed depends on the silicon populated on the EVM.
+Please make sure you understand the restrictions placed on this clock in the
+device specific datasheet before setting up this variable.
+
+If "maxcpuclk" is not defined, the configuration CONFIG_DA850_EVM_MAX_CPU_CLK
+is used to obtain this information.
+
Links
=====
diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h
index 357715d..3ea9032 100644
--- a/include/configs/da850evm.h
+++ b/include/configs/da850evm.h
@@ -102,6 +102,7 @@
*/
#define LINUX_BOOT_PARAM_ADDR (CONFIG_SYS_MEMTEST_START + 0x100)
#define CONFIG_CMDLINE_TAG
+#define CONFIG_REVISION_TAG
#define CONFIG_SETUP_MEMORY_TAGS
#define CONFIG_BOOTARGS \
"mem=32M console=ttyS2,115200n8 root=/dev/mtdblock2 rw noinitrd ip=dhcp"
--
1.6.2.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH v3 2/2] TI: DaVinci DA850 EVM: support passing maximum allowed cpu clock rate information to kernel
2010-08-18 15:41 [U-Boot] [PATCH v3 2/2] TI: DaVinci DA850 EVM: support passing maximum allowed cpu clock rate information to kernel Sekhar Nori
@ 2010-08-18 15:53 ` Detlev Zundel
2010-08-19 5:19 ` Nori, Sekhar
2010-08-19 8:21 ` Stefano Babic
1 sibling, 1 reply; 5+ messages in thread
From: Detlev Zundel @ 2010-08-18 15:53 UTC (permalink / raw)
To: u-boot
Hi Sekhar,
> The TI DA850/OMAP-L138/AM18x EVM can be populated with devices
> having different maximum allowed CPU clock rating.
>
> The maximum clock the chip can support can only be determined from
> the label on the package (not software readable).
>
> Introduce a method to pass the maximum allowed clock rate information
> to kernel using ATAG_REVISION. The kernel uses this information to
> determine the maximum cpu clock rate reachable using cpufreq.
Ok, so I see you ignore my comments on not using the ATAG_REVISION tag
for passing clock frequncies which is fair enough if nobody else
complains.
But then please _at least_ document this in the README and not only in
the git diff files. This is still the most obscure aspects of the
change for me and should be prominent in the documentation.
Cheers
Detlev
--
By all means let's be open-minded, but not so open-minded that our
brains drop out.
-- Richard Dawkins
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH v3 2/2] TI: DaVinci DA850 EVM: support passing maximum allowed cpu clock rate information to kernel
2010-08-18 15:53 ` Detlev Zundel
@ 2010-08-19 5:19 ` Nori, Sekhar
0 siblings, 0 replies; 5+ messages in thread
From: Nori, Sekhar @ 2010-08-19 5:19 UTC (permalink / raw)
To: u-boot
Hi Detlev,
On Wed, Aug 18, 2010 at 21:23:46, Detlev Zundel wrote:
> Hi Sekhar,
>
> > The TI DA850/OMAP-L138/AM18x EVM can be populated with devices
> > having different maximum allowed CPU clock rating.
> >
> > The maximum clock the chip can support can only be determined from
> > the label on the package (not software readable).
> >
> > Introduce a method to pass the maximum allowed clock rate information
> > to kernel using ATAG_REVISION. The kernel uses this information to
> > determine the maximum cpu clock rate reachable using cpufreq.
>
> Ok, so I see you ignore my comments on not using the ATAG_REVISION tag
> for passing clock frequncies which is fair enough if nobody else
No, not "clock frequncies", but "maximum device operating point" information
(which depends on the silicon populated on the EVM).
I am sure you mean exactly that, but using terminology loosely can create a
very different impression.
> But then please _at least_ document this in the README and not only in
> the git diff files. This is still the most obscure aspects of the
> change for me and should be prominent in the documentation.
Sure, will send out an update.
Thanks,
Sekhar
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH v3 2/2] TI: DaVinci DA850 EVM: support passing maximum allowed cpu clock rate information to kernel
2010-08-18 15:41 [U-Boot] [PATCH v3 2/2] TI: DaVinci DA850 EVM: support passing maximum allowed cpu clock rate information to kernel Sekhar Nori
2010-08-18 15:53 ` Detlev Zundel
@ 2010-08-19 8:21 ` Stefano Babic
2010-08-19 9:18 ` Nori, Sekhar
1 sibling, 1 reply; 5+ messages in thread
From: Stefano Babic @ 2010-08-19 8:21 UTC (permalink / raw)
To: u-boot
Sekhar Nori wrote:
> The TI DA850/OMAP-L138/AM18x EVM can be populated with devices
> having different maximum allowed CPU clock rating.
>
> The maximum clock the chip can support can only be determined from
> the label on the package (not software readable).
>
> Introduce a method to pass the maximum allowed clock rate information
> to kernel using ATAG_REVISION. The kernel uses this information to
> determine the maximum cpu clock rate reachable using cpufreq.
>
> Note that U-Boot itself does not set the CPU clock rate. The CPU
> clock is setup by a primary bootloader ("UBL"). The rate setup by
> UBL could be different from the maximum clock rate supported by the
> device.
>
> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
> ---
> Changes in v3:
> a) renamed maxspeed to maxcpuclk
> b) add information regarding the new environment variable in README.davinci
> c) use if-else instead of switch to check for value range rather than specific
> values of maxcpuclk
> d) change comment to document values returned in bit[0-3] by get_board_rev() in
> binary
>
> board/davinci/da8xxevm/da850evm.c | 33 +++++++++++++++++++++++++++++++++
> doc/README.davinci | 13 +++++++++++++
> include/configs/da850evm.h | 1 +
> 3 files changed, 47 insertions(+), 0 deletions(-)
Hi,
sorry if I come only late in the discussion, I have a general question.
As I see, the UBL does not take care at all of the possibility to have
different frequencies, and sets the PLL with a fix value (300 Mhz, as I
read in sources). From my point of view, it makes sense to use the
maximum allowed cpu clock if we then set the CPU to increase the
performances.
If you set the value in a u-boot environment, the value could be easy
overwritten and a wrong value could be displayed. So I have doubt on
using an environment to get a so hardware-related value..
Do you plan to use the maximum cpu clock to set the PLL ? Or is it only
for info purposes ?
Best regards,
Stefano Babic
--
=====================================================================
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
=====================================================================
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH v3 2/2] TI: DaVinci DA850 EVM: support passing maximum allowed cpu clock rate information to kernel
2010-08-19 8:21 ` Stefano Babic
@ 2010-08-19 9:18 ` Nori, Sekhar
0 siblings, 0 replies; 5+ messages in thread
From: Nori, Sekhar @ 2010-08-19 9:18 UTC (permalink / raw)
To: u-boot
Hi Stefano,
On Thu, Aug 19, 2010 at 13:51:46, Stefano Babic wrote:
> Sekhar Nori wrote:
> > The TI DA850/OMAP-L138/AM18x EVM can be populated with devices
> > having different maximum allowed CPU clock rating.
> >
> > The maximum clock the chip can support can only be determined from
> > the label on the package (not software readable).
> >
> > Introduce a method to pass the maximum allowed clock rate information
> > to kernel using ATAG_REVISION. The kernel uses this information to
> > determine the maximum cpu clock rate reachable using cpufreq.
> >
> > Note that U-Boot itself does not set the CPU clock rate. The CPU
> > clock is setup by a primary bootloader ("UBL"). The rate setup by
> > UBL could be different from the maximum clock rate supported by the
> > device.
> >
> > Signed-off-by: Sekhar Nori <nsekhar@ti.com>
> > ---
> > Changes in v3:
> > a) renamed maxspeed to maxcpuclk
> > b) add information regarding the new environment variable in README.davinci
> > c) use if-else instead of switch to check for value range rather than specific
> > values of maxcpuclk
> > d) change comment to document values returned in bit[0-3] by get_board_rev() in
> > binary
> >
> > board/davinci/da8xxevm/da850evm.c | 33 +++++++++++++++++++++++++++++++++
> > doc/README.davinci | 13 +++++++++++++
> > include/configs/da850evm.h | 1 +
> > 3 files changed, 47 insertions(+), 0 deletions(-)
>
> Hi,
>
> sorry if I come only late in the discussion, I have a general question.
> As I see, the UBL does not take care at all of the possibility to have
> different frequencies, and sets the PLL with a fix value (300 Mhz, as I
> read in sources). From my point of view, it makes sense to use the
> maximum allowed cpu clock if we then set the CPU to increase the
> performances.
Yes, cpufreq in kernel can do this based on cpu load.
> If you set the value in a u-boot environment, the value could be easy
> overwritten and a wrong value could be displayed. So I have doubt on
> using an environment to get a so hardware-related value..
Overwritten by whom and displayed where?
> Do you plan to use the maximum cpu clock to set the PLL ? Or is it only
> for info purposes ?
The kernel will use the value to understand the maximum frequency it can
reach using cpufreq. So yes, kernel uses this to set the PLL.
Thanks,
Sekhar
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-08-19 9:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-18 15:41 [U-Boot] [PATCH v3 2/2] TI: DaVinci DA850 EVM: support passing maximum allowed cpu clock rate information to kernel Sekhar Nori
2010-08-18 15:53 ` Detlev Zundel
2010-08-19 5:19 ` Nori, Sekhar
2010-08-19 8:21 ` Stefano Babic
2010-08-19 9:18 ` Nori, Sekhar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox