From owner-freebsd-arm@FreeBSD.ORG Sun Sep 29 16:41:59 2013 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 6785C9CE; Sun, 29 Sep 2013 16:41:59 +0000 (UTC) (envelope-from jiashiun@gmail.com) Received: from mail-vc0-x22a.google.com (mail-vc0-x22a.google.com [IPv6:2607:f8b0:400c:c03::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 13F0D2DEB; Sun, 29 Sep 2013 16:41:59 +0000 (UTC) Received: by mail-vc0-f170.google.com with SMTP id lc6so2898044vcb.29 for ; Sun, 29 Sep 2013 09:41:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:cc:content-type; bh=+oGPtRHvI/00ct5rGKdgfUDToVDfwjmC9r//hBWgIz8=; b=uY0j19W/dUq9JEfhbgAoh2IcawgGPYHEFvhdsd0eQhOhFw/VgxrxSzb080c7pS/51C 7cl4RK6U5F3dNIM94mfxj2PLF4Gz1HXvtBrGugHgu68Hd8rHf2N68wfyebGyMIMS57Gm Ee6ymgKIlaNkey5j4D+oSU3ZeNmrAn95imd0/ZT0sMedfSDpcAqmSSx8sLGthXjT5RVI 7x+sqeWoSAKag6WMF7mlCSqzrfo8Gq3CRb7XEMbphZRRHnq49Yr0z9dd8GCjB6YjLBP2 08+cNdRlr6+uhvYFkekwKMinXbsjSm2u2DxUFcMFyfNkMBvFlUw7zRk5jUja70BdbpCq OlHQ== X-Received: by 10.58.187.47 with SMTP id fp15mr2171205vec.22.1380472918176; Sun, 29 Sep 2013 09:41:58 -0700 (PDT) MIME-Version: 1.0 Received: by 10.58.225.34 with HTTP; Sun, 29 Sep 2013 09:41:28 -0700 (PDT) From: Jia-Shiun Li Date: Mon, 30 Sep 2013 00:41:28 +0800 Message-ID: Subject: BBB CPU clock (was: Re: FreeBSD on Cubieboard 2, UDOO and Galaxy Note 10.1 (Exynos). To: ticso@cicely.de Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-arm@freebsd.org" X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Sep 2013 16:41:59 -0000 On Sat, Sep 28, 2013 at 7:18 AM, Bernd Walter 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: 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: initialized simplebus0: on fdtbus0 aintc0: mem 0x48200000-0x48200fff on simplebus0 aintc0: Revision 5.0 ti_scm0: mem 0x44e10000-0x44e11fff on simplebus0 am335x_prcm0: mem 0x44e00000-0x44e012ff on simplebus0 am335x_prcm0: Clocks: System 24.0 MHz, CPU 768 MHz (omitted below) Jia-Shiun.