From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 23:11:11 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D7F7E1065673 for ; Mon, 30 Jul 2012 23:11:10 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 6F52E8FC19 for ; Mon, 30 Jul 2012 23:11:10 +0000 (UTC) Received: by obbun3 with SMTP id un3so12430487obb.13 for ; Mon, 30 Jul 2012 16:11:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer :x-gm-message-state; bh=KVuOmfwQil9w0BUKuecYf1Bm6KR/6TA+ZqegEMnreWg=; b=LMitdH3LFUt9c6pf5MC1/pthPUFJ3RmVMf4zUQ9jrzMt+tLi5LDqXZwHDU4rVkWI/O zNZVl19ITEYB+XVIQc0zGO+imht1Goune/wB1pD7s7EYbyzUGZSKPwDaQPvzep/D/heP gaCb+Yws3U95+2dNaBTuNPNNitIOHMpELRxzcED9b3wkALbMkHs4NHzV0PBNGBtmanT2 vu+bxWXSsKVOy9F7gsIRsy09iLQYMX303fqh8yD6e5Ia44LjLZEDim/l4GeH8STgT7pr TVBoQDwyEfu6LYt5o3Hl706lycw+wmUS0duLTIx2F3NkcIMQnV4FzwyQaJ8NYQavAPtk 1JyQ== Received: by 10.182.0.13 with SMTP id 13mr6913286oba.55.1343689870078; Mon, 30 Jul 2012 16:11:10 -0700 (PDT) Received: from [10.30.101.53] ([209.117.142.2]) by mx.google.com with ESMTPS id bp7sm10224911obc.12.2012.07.30.16.11.08 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 30 Jul 2012 16:11:09 -0700 (PDT) Sender: Warner Losh Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: <201207310028.12533.Daan@vitsch.nl> Date: Mon, 30 Jul 2012 17:11:07 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <1E3463C8-3D39-4FC6-9163-A0298502A3E0@bsdimp.com> References: <201206290418.q5T4IqpX018099@svn.freebsd.org> <201207310028.12533.Daan@vitsch.nl> To: Daan Vreeken X-Mailer: Apple Mail (2.1084) X-Gm-Message-State: ALoCoQkzUkKQkvHcGmPw5tZIWsvlD22b3PfyaxoFHtQ3PCK72A/x/S/WkLDEEiDrf9uwP5rWnSpA Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Warner Losh Subject: Re: svn commit: r237742 - in head/sys/arm: at91 conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jul 2012 23:11:11 -0000 Thanks for the review. I'm pretty sure that code is wrong. I'll go = over your comments with a printed datasheet. They are likely correct. = This code suffers a bitt too much from being cut and pasted too many = times. Warner On Jul 30, 2012, at 4:28 PM, Daan Vreeken wrote: > Hi Warner, >=20 >=20 > On Friday 29 June 2012 06:18:52 Warner Losh wrote: >> Author: imp >> Date: Fri Jun 29 04:18:52 2012 >> New Revision: 237742 >> URL: http://svn.freebsd.org/changeset/base/237742 >>=20 >> Log: >> Initital support for AT91SAM9X25 SoC and the SAM9X25-EK evaluation >> board. Much work remains. > ... >> Added: head/sys/arm/at91/at91sam9x25.c >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= >> =3D=3D=3D --- /dev/null 00:00:00 1970 (empty, because file is = newly added) >> +++ head/sys/arm/at91/at91sam9x25.c Fri Jun 29 04:18:52 2012 = (r237742) >> @@ -0,0 +1,343 @@ > ... >> +static uint32_t >> +at91_pll_outa(int freq) >> +{ >> + >> + switch (freq / 10000000) { >=20 > You seem to be dividing freq into multiples of 10MHz instead of 1MHz = here. I=20 > think dividing by 1e6 was the intention. >=20 >> + case 747 ... 801: return ((1 << 29) | (0 << 14)); >> + case 697 ... 746: return ((1 << 29) | (1 << 14)); >> + case 647 ... 696: return ((1 << 29) | (2 << 14)); >> + case 597 ... 646: return ((1 << 29) | (3 << 14)); >> + case 547 ... 596: return ((1 << 29) | (1 << 14)); >> + case 497 ... 546: return ((1 << 29) | (2 << 14)); >> + case 447 ... 496: return ((1 << 29) | (3 << 14)); >=20 >> + case 397 ... 446: return ((1 << 29) | (4 << 14)); >=20 > The (4 << 14) looks a bit strange here, as OUTA only occupies bit 14 = and 15 of=20 > CKGR_PLLAR. (See Atmel doc11054, page 201 and 1103.) >=20 > Maybe this entire routine could be written as something like: > uint8_t outa; >=20 > freq /=3D 1000000; > // optional: > //freq +=3D 3; > // see doc11054, page 1103 > outa =3D 3 - ((freq / 50) & 3); >=20 > return ((1 << 29) | (outa << 14)); >=20 > Just glancing at the code, setting ICPLLA in PMC_PLLICPR for = frequencies <=3D=20 > 600MHz seems to be missing at this moment (or I'm just not seeing it). > (see page 212 and 1103) >=20 >=20 > Regards, > --=20 > Daan Vreeken > Vitsch Electronics > http://Vitsch.nl/ > http://VitschVPN.nl/ > tel: +31-(0)40-7113051 > KvK nr: 17174380