Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Sep 2013 00:41:28 +0800
From:      Jia-Shiun Li <jiashiun@gmail.com>
To:        ticso@cicely.de
Cc:        "freebsd-arm@freebsd.org" <freebsd-arm@freebsd.org>
Subject:   BBB CPU clock (was: Re: FreeBSD on Cubieboard 2, UDOO and Galaxy Note 10.1 (Exynos).
Message-ID:  <CAHNYxxPtD5vgrohumwccoC_5bZv7fuV3RYK2vgLUpyEZCmOgqg@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
On Sat, Sep 28, 2013 at 7:18 AM, Bernd Walter <ticso@cicely7.cicely.de> wrote:
> On Thu, Sep 26, 2013 at 07:43:39PM -0700, Tim Kientzle wrote:
>>
>> I've not looked into the code required, but I know some of the issues:
>>
>> * For the older "white" Beaglebone, at least, the CPU frequency
>>    needs to be set properly depending on the power supply.  So
>>    "someone" needs to read the PMIC and determine whether
>>    power is coming from the 5V input or from USB.  In the latter
>>    case, I believe the lower frequency may be appropriate.
>>
>> * For BB White, I believe the "someone" was U-Boot; the FreeBSD
>>   kernel just assumed the CPU was already properly initialized.
>>   I haven't looked to see if the U-Boot we're using now does power
>>   config for BBB.
>>
>> * We should add a PMIC driver and do this setting in our kernel.
>
> This matches with what I got from reading some mails on a NetBSD list:
> http://mail-index.netbsd.org/port-arm/2013/08/01/msg001932.html
>
> I didn't find any definitive answer about barrel plug vs. USB supply.
> It seems that via USB the performance is to be reduced.
> However using a lab supply I measured via barrel plug supply 270mA with
> 550MHz FreBSD and 320mA with preinstalled Linux at unknown frequency.
> Maybe precaution for higher load, or USB devices sucking power.

According the the manual, the PMIC does not seems to do too much different
between two power supply sources.
Only that USB input has lower current limit, and AC is preferred when
both are connected. I suppose it is just for convenience. And there is no much
dynamic voltage output setting available. Output voltages are all fixed to
support am335x needs. So I think we can skip this part too.

I looked into the u-boot code (13.04) and there seems no difference among
all am335x based boards. The PLL init code just blindly sets MPU to 550MHz
( via CONFIG_SYS_MPUCLK). But after changing the value to 1000 and
rebuilding u-boot, kernel still reports 550MHz. Dumping registers under u-boot
prompt also confirmed what kernel sees .

But I manually modified registers using the sequence in mpu_pll_config() of
u-boot and got the MPU clocked at the value I gave. There seems to be some
unknown sequences in u-boot either skipping or overwriting MPU PLL settings.



U-Boot SPL 2013.04 (Sep 27 2013 - 11:03:02)
OMAP SD/MMC: 0
reading bb-uboot.img
reading bb-uboot.img


U-Boot 2013.04 (Sep 27 2013 - 11:03:02)

I2C:   ready
DRAM:  512 MiB
WARNING: Caches not enabled
MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
Using default environment

musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, HB-ISO Rx, HB-ISO Tx, SoftConn)
musb-hdrc: MHDRC RTL version 2.0
musb-hdrc: setup fifo_mode 4
musb-hdrc: 28/31 max ep, 16384/16384 memory
USB Peripheral mode controller at 47401000 using PIO, IRQ 0
musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, HB-ISO Rx, HB-ISO Tx, SoftConn)
musb-hdrc: MHDRC RTL version 2.0
musb-hdrc: setup fifo_mode 4
musb-hdrc: 28/31 max ep, 16384/16384 memory
USB Host mode controller at 47401800 using PIO, IRQ 0
Net:   <ethaddr> not set. Validating first E-fuse MAC
cpsw, usb_ether
Hit any key to stop autoboot:  0
U-Boot# md.l 0x44e00400
44e00400: 00001e16 00000002 00000002 00000002    ................
44e00410: 00000002 52580002 0000001e 00000000    ......XR........
44e00420: 00000001 00000000 00000000 00022617    .............&..
44e00430: 00000000 00000001 00000000 00000000    ................
44e00440: 00019017 00000000 00000100 00000000    ................
44e00450: 00000000 00000000 00000000 00000001    ................
44e00460: 00000000 00000000 0003e817 00000000    ................
44e00470: 00000001 00000000 00000000 00000300    ................
44e00480: 0000022a 00000228 00000007 00000007    *...(...........
44e00490: 00000007 00000007 00000004 0403c017    ................
44e004a0: 00000201 00000001 00000201 00000205    ................
44e004b0: 00040002 00000002 00000002 00030000    ................
44e004c0: 00030000 00030000 00030000 00000006    ................
44e004d0: 00000002 00000002 00000004 00000000    ................
44e004e0: 00000000 00000000 00000000 00000000    ................
44e004f0: 00000000 00000000 00000000 00000000    ................
U-Boot# mm.l 0x44e00488
44e00488: 00000007 ? 0x00000004
44e0048c: 00000007 ? U-Boot# md.l 0x44e00400
44e00400: 00001e16 00000002 00000002 00000002    ................
44e00410: 00000002 52580002 0000001e 00000000    ......XR........
44e00420: 00000100 00000000 00000000 00000017    ................
44e00430: 00000000 00000001 00000000 00000000    ................
44e00440: 00019017 00000000 00000100 00000000    ................
44e00450: 00000000 00000000 00000000 00000001    ................
44e00460: 00000000 00000000 0003e817 00000000    ................
44e00470: 00000001 00000000 00000000 00000300    ................
44e00480: 0000022a 00000228 00000004 00000007    *...(...........
44e00490: 00000007 00000007 00000004 0403c017    ................
44e004a0: 00000201 00000001 00000201 00000205    ................
44e004b0: 00040002 00000002 00000002 00030000    ................
44e004c0: 00030000 00030000 00030000 00000006    ................
44e004d0: 00000002 00000002 00000004 00000000    ................
44e004e0: 00000000 00000000 00000000 00000000    ................
44e004f0: 00000000 00000000 00000000 00000000    ................
U-Boot# mm.l 0x44e0042c
44e0042c: 00000017 ? 0x00030017
44e00430: 00000000 ? U-Boot# mm.l 0x44e004a8
44e004a8: 00000201 ? 0x00000201
44e004ac: 00000205 ? U-Boot# mm.l 0x44e00488
44e00488: 00000004 ? 0x00000007
44e0048c: 00000007 ? U-Boot# md 0x44e00400
44e00400: 00001e16 00000002 00000002 00000002    ................
44e00410: 00000002 52580002 0000001e 00000000    ......XR........
44e00420: 00000001 00000000 00000000 00030017    ................
44e00430: 00000000 00000001 00000000 00000000    ................
44e00440: 00019017 00000000 00000100 00000000    ................
44e00450: 00000000 00000000 00000000 00000001    ................
44e00460: 00000000 00000000 0003e817 00000000    ................
44e00470: 00000001 00000000 00000000 00000300    ................
44e00480: 0000022a 00000228 00000007 00000007    *...(...........
44e00490: 00000007 00000007 00000004 0403c017    ................
44e004a0: 00000201 00000001 00000201 00000205    ................
44e004b0: 00040002 00000002 00000002 00030000    ................
44e004c0: 00030000 00030000 00030000 00000006    ................
44e004d0: 00000002 00000002 00000004 00000000    ................
44e004e0: 00000000 00000000 00000000 00000000    ................
44e004f0: 00000000 00000000 00000000 00000000    ................
U-Boot# boot
mmc0 is current device
SD/MMC found on device 0
reading bb-uEnv.txt
reading bbubldr
237032 bytes read in 31 ms (7.3 MiB/s)
reading bboneblk.dtb
15203 bytes read in 7 ms (2.1 MiB/s)
Booting from mmc ...
## Starting application at 0x88000054 ...
Consoles: U-Boot console
Compatible API signature found @9f242240
Number of U-Boot devices: 2

FreeBSD/armv6 U-Boot loader, Revision 1.2
(jsli@4cbsd, Fri Sep 27 10:45:52 CST 2013)
DRAM:    512MB

Device: disk
Loading /boot/defaults/loader.conf
/boot/kernel/kernel data=0x454388+0x17d564 syms=[0x4+0x83c10+0x4+0x4f96d]

Hit [Enter] to boot immediately, or any other key for command prompt.
Booting [/boot/kernel/kernel]...
Using DTB provided by U-Boot.
Kernel entry at 0x80200100...
Kernel args: (null)
KDB: debugger backends: ddb
KDB: current backend: ddb
Copyright (c) 1992-2013 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 10.0-ALPHA3 #0 r255876: Fri Sep 27 10:43:09 CST 2013
    jsli@4cbsd:/root/crochet-freebsd/work/obj/arm.armv6/usr/src/sys/BEAGLEBONE
arm
FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610
WARNING: WITNESS option enabled, expect reduced performance.
CPU: Cortex A8-r3 rev 2 (Cortex-A core)
 Supported features: ARM_ISA THUMB2 JAZELLE THUMBEE ARMv4 Security_Ext
 WB disabled EABT branch prediction enabled
LoUU:2 LoC:2 LoUIS:1
Cache level 1:
 32KB/64B 4-way data cache WT WB Read-Alloc
 32KB/64B 4-way instruction cache Read-Alloc
Cache level 2:
 256KB/64B 8-way unified cache WT WB Read-Alloc Write-Alloc
real memory  = 536870912 (512 MB)
avail memory = 515723264 (491 MB)
Texas Instruments AM3358 Processor, Revision ES1.1
random device not loaded; using insecure entropy
random: <Software, Yarrow> initialized
simplebus0: <Flattened device tree simple bus> on fdtbus0
aintc0: <TI AINTC Interrupt Controller> mem 0x48200000-0x48200fff on simplebus0
aintc0: Revision 5.0
ti_scm0: <TI Control Module> mem 0x44e10000-0x44e11fff on simplebus0
am335x_prcm0: <AM335x Power and Clock Management> mem
0x44e00000-0x44e012ff on simplebus0
am335x_prcm0: Clocks: System 24.0 MHz, CPU 768 MHz
(omitted below)

Jia-Shiun.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAHNYxxPtD5vgrohumwccoC_5bZv7fuV3RYK2vgLUpyEZCmOgqg>