From owner-freebsd-arm@FreeBSD.ORG Fri Feb 15 16:46:55 2013 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 54CD97A0 for ; Fri, 15 Feb 2013 16:46:55 +0000 (UTC) (envelope-from dmarion.freebsd@gmail.com) Received: from mail-bk0-f44.google.com (mail-bk0-f44.google.com [209.85.214.44]) by mx1.freebsd.org (Postfix) with ESMTP id DEA8E885 for ; Fri, 15 Feb 2013 16:46:54 +0000 (UTC) Received: by mail-bk0-f44.google.com with SMTP id j4so1633491bkw.3 for ; Fri, 15 Feb 2013 08:46:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:content-type:mime-version:subject:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to:x-mailer; bh=Z0UIDR5Wx37rWSxKJztXdVLsAdP+ag2C/bGt/+b0mF4=; b=DyZAUim/kkus9sMQ1KExrR7OmpvIaiWBVi46MSmaU0qIKIP2UYgU968UVe/iyLPdIw G/CSlyNJUrO/2TaGMhf3oIhhf4NeCMX1zCaBQuXO03FeXybIRSEsD7p6pG7WR3rwSXT+ H+f2Uvfh0AX5HwZBfAwUba4ZuWLjLHLi8l38hof4HxRtMX7+P0iGoq0ZSrqRzudxIy1A A2Sxlxi6loS1XT3fQZdao/dXSbfnXvKkuD2aCdt/7qQDOV0cQv2wHfh/zP6BciYwxvB1 PMnVdQ3Tgor9y0If1D4xL5iUWSg6uE7lZNVaXYPpfZEqyJRYIsVGS3ODdBNZJvI2qmhe rv4Q== X-Received: by 10.204.7.144 with SMTP id d16mr1097100bkd.48.1360946808058; Fri, 15 Feb 2013 08:46:48 -0800 (PST) Received: from damarion-mac.home (cpe-109-60-68-159.zg3.cable.xnet.hr. [109.60.68.159]) by mx.google.com with ESMTPS id g28sm17953252bkv.17.2013.02.15.08.46.45 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Feb 2013 08:46:46 -0800 (PST) Sender: Damjan Marion Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) Subject: Re: Beaglebone Serial Ports Progress From: Damjan Marion In-Reply-To: <511E1A08.4020105@g7iii.net> Date: Fri, 15 Feb 2013 17:46:44 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: References: <511E1A08.4020105@g7iii.net> To: Iain Young X-Mailer: Apple Mail (2.1499) 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: Fri, 15 Feb 2013 16:46:55 -0000 On Feb 15, 2013, at 12:20 PM, Iain Young wrote: > Hi Folks, >=20 > After waiting for deliveries, and a few false starts, I have made > -some- progress on adding support for the Beaglebone's serial ports > (UARTS1-5) to FreeBSD >=20 > First thing I did was add the pinmux stuff, having worked out exactly > what I needed to add to the DTS, and recompile. This seems to have > worked out well, and on a reboot I see: >=20 > setting internal 28 for uart1_rxd > setting internal 0 for uart1_txd >=20 >=20 > This is good. kernel comes up,curiously though, I don't see lines > output for the RTS and CTS lines (which I do set to the correct mode, > yet I do for UART3 CTS and UART4 CTS, which I added as a test. >=20 > I then proceeded to add the uart1 device itself to the DTS, and > added the following: >=20 > uart1: serial@48022000 { > compatible =3D "ns16550"; > reg =3D <0x48022000 0x1000>; > reg-shift =3D <2>; > interrupts =3D < 73 >; > interrupt-parent =3D <&AINTC>; > clock-frequency =3D < 48000000 >; > }; >=20 > This caused the kernel to dump me in db (debugger I guess). I figured > out that 't' gave me a trace, and it looked like it was in the middle > of probing for UARTS. (This is about as much knowledge I have about = the > kernel debugger) >=20 > I tried changing 0x1000 for 0x2000, as it seems the next reg is also > reserved for UART1. No more luck. So, thinking I needed to add it as = an > alias (as UART0 is), I added that, but it still dumped me at the > debugger on boot. >=20 > The only other thing is reg-shift. I must confess, I am a bit blind > here. Not knowing what it actually did I left it as with UART0. I'm > hoping it essentially includes the next register up for UART1, as > while that's listed as "Reserved" in the memory map [Yes, I consulted > SPRUH73G :)] , it seems to be reserved for UART1, but I am just > guessing (Yes, I know, not good practice when kernel hacking...) >=20 > I've attached the latest version of my patch, the output from the > kernel until it blows up, as well as the trace. Patch is based on > r246610 >=20 > Anyone able to point me in the right direction ? I can't be too far > away, and I can then add UART2-5, and submit an actual working patch! >=20 It is very likely that clock is disabled for USART1. Problem is that = usart uses standard serial driver which is not requesting clock to be enabled = during the attach by invoking ti_prcm_clk_enable(). Can you try to put following at the end of am335x_prcm_attach()? prcm_write_4(6c, 2); This should be register CM_PER_UART1_CLKCTRL. Damjan