From owner-freebsd-arm@FreeBSD.ORG Mon Mar 5 14:17:17 2007 Return-Path: X-Original-To: freebsd-arm@FreeBSD.org Delivered-To: freebsd-arm@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B002016A400 for ; Mon, 5 Mar 2007 14:17:17 +0000 (UTC) (envelope-from krassi@bulinfo.net) Received: from mx.bulinfo.net (mx.bulinfo.net [193.194.156.1]) by mx1.freebsd.org (Postfix) with ESMTP id 6DBD413C4A6 for ; Mon, 5 Mar 2007 14:17:17 +0000 (UTC) (envelope-from krassi@bulinfo.net) Received: from localhost (localhost [127.0.0.1]) by mx.bulinfo.net (Postfix) with ESMTP id A0FF11E020; Mon, 5 Mar 2007 16:17:14 +0200 (EET) Received: from mx.bulinfo.net ([127.0.0.1]) by localhost (mx.bulinfo.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 54710-06; Mon, 5 Mar 2007 16:17:11 +0200 (EET) Received: from [192.168.2.188] (pythia.bulinfo.net [212.72.195.5]) by mx.bulinfo.net (Postfix) with ESMTP id D1D4C1E01D; Mon, 5 Mar 2007 16:17:11 +0200 (EET) Message-ID: <45EC2667.9040004@bulinfo.net> Date: Mon, 05 Mar 2007 16:17:11 +0200 From: Krassimir Slavchev User-Agent: Thunderbird 1.5 (X11/20060201) MIME-Version: 1.0 To: Warner Losh References: <45E83CAB.1090005@bulinfo.net> <20070302.101744.115917142.imp@bsdimp.com> In-Reply-To: <20070302.101744.115917142.imp@bsdimp.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at mx.bulinfo.net Cc: freebsd-arm@FreeBSD.org Subject: Re: IIC support? X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Mar 2007 14:17:17 -0000 Warner Losh wrote: >> I have problems to access the iic eeprom from userland. Even after set >> SCAN_IICBUS in iicbus.c nothing has been detected. I have made some >> tests from the bootloader to read/write from/to the eeprom and they work. >> Is there any known problems with TWI or any differences between board >> settings? >> > > The IIC bus is not a self enumerating bus. Bad things happen when you > go out and try to 'probe' it, although often you can get away with > that. FreeBSD takes a conservative approach. You need hints for each > iic device on bus that you have on your board. > > Ok, that was just for testing. I am trying to write a driver for pcf8563 (RTC similar to ds1672) but when I call the iicbus_transfer() function the iicbus_transfer_gen() is called instead of at91_twi_transfer(). In the kernel config file I have: ... device at91_twi device iicbus ... Is this correct or I miss something else? > Warner > > From owner-freebsd-arm@FreeBSD.ORG Mon Mar 5 14:31:38 2007 Return-Path: X-Original-To: freebsd-arm@FreeBSD.org Delivered-To: freebsd-arm@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 93F6516A400 for ; Mon, 5 Mar 2007 14:31:38 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 5290313C494 for ; Mon, 5 Mar 2007 14:31:38 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id l25ET8Ur076570; Mon, 5 Mar 2007 07:29:08 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Mon, 05 Mar 2007 07:29:19 -0700 (MST) Message-Id: <20070305.072919.2010473806.imp@bsdimp.com> To: krassi@bulinfo.net From: "M. Warner Losh" In-Reply-To: <45EC2667.9040004@bulinfo.net> References: <45E83CAB.1090005@bulinfo.net> <20070302.101744.115917142.imp@bsdimp.com> <45EC2667.9040004@bulinfo.net> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (harmony.bsdimp.com [127.0.0.1]); Mon, 05 Mar 2007 07:29:08 -0700 (MST) Cc: freebsd-arm@FreeBSD.org Subject: Re: IIC support? X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Mar 2007 14:31:38 -0000 In message: <45EC2667.9040004@bulinfo.net> Krassimir Slavchev writes: : Warner Losh wrote: : >> I have problems to access the iic eeprom from userland. Even after set : >> SCAN_IICBUS in iicbus.c nothing has been detected. I have made some : >> tests from the bootloader to read/write from/to the eeprom and they work. : >> Is there any known problems with TWI or any differences between board : >> settings? : >> : > : > The IIC bus is not a self enumerating bus. Bad things happen when you : > go out and try to 'probe' it, although often you can get away with : > that. FreeBSD takes a conservative approach. You need hints for each : > iic device on bus that you have on your board. : > : > : Ok, that was just for testing. : : I am trying to write a driver for pcf8563 (RTC similar to ds1672) but : when I call the iicbus_transfer() function the iicbus_transfer_gen() is : called instead of at91_twi_transfer(). : In the kernel config file I have: : ... : device at91_twi : device iicbus : ... : : Is this correct or I miss something else? Should be correct. What version of FreeBSD are you using? Warner From owner-freebsd-arm@FreeBSD.ORG Mon Mar 5 14:41:09 2007 Return-Path: X-Original-To: freebsd-arm@freebsd.org Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D7ADE16A403 for ; Mon, 5 Mar 2007 14:41:09 +0000 (UTC) (envelope-from krassi@bulinfo.net) Received: from mx.bulinfo.net (mx.bulinfo.net [193.194.156.1]) by mx1.freebsd.org (Postfix) with ESMTP id 94AC713C494 for ; Mon, 5 Mar 2007 14:41:09 +0000 (UTC) (envelope-from krassi@bulinfo.net) Received: from localhost (localhost [127.0.0.1]) by mx.bulinfo.net (Postfix) with ESMTP id 16F531E109; Mon, 5 Mar 2007 16:41:05 +0200 (EET) Received: from mx.bulinfo.net ([127.0.0.1]) by localhost (mx.bulinfo.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 57177-07-10; Mon, 5 Mar 2007 16:41:02 +0200 (EET) Received: from [192.168.2.188] (pythia.bulinfo.net [212.72.195.5]) by mx.bulinfo.net (Postfix) with ESMTP id 22E511E11B; Mon, 5 Mar 2007 16:40:58 +0200 (EET) Message-ID: <45EC2BF9.2000804@bulinfo.net> Date: Mon, 05 Mar 2007 16:40:57 +0200 From: Krassimir Slavchev User-Agent: Thunderbird 1.5 (X11/20060201) MIME-Version: 1.0 To: "M. Warner Losh" , freebsd-arm@freebsd.org References: <45E83CAB.1090005@bulinfo.net> <20070302.101744.115917142.imp@bsdimp.com> <45EC2667.9040004@bulinfo.net> <20070305.072919.2010473806.imp@bsdimp.com> In-Reply-To: <20070305.072919.2010473806.imp@bsdimp.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at mx.bulinfo.net Cc: Subject: Re: IIC support? X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Mar 2007 14:41:09 -0000 M. Warner Losh wrote: > In message: <45EC2667.9040004@bulinfo.net> > Krassimir Slavchev writes: > : Warner Losh wrote: > : >> I have problems to access the iic eeprom from userland. Even after set > : >> SCAN_IICBUS in iicbus.c nothing has been detected. I have made some > : >> tests from the bootloader to read/write from/to the eeprom and they work. > : >> Is there any known problems with TWI or any differences between board > : >> settings? > : >> > : > > : > The IIC bus is not a self enumerating bus. Bad things happen when you > : > go out and try to 'probe' it, although often you can get away with > : > that. FreeBSD takes a conservative approach. You need hints for each > : > iic device on bus that you have on your board. > : > > : > > : Ok, that was just for testing. > : > : I am trying to write a driver for pcf8563 (RTC similar to ds1672) but > : when I call the iicbus_transfer() function the iicbus_transfer_gen() is > : called instead of at91_twi_transfer(). > : In the kernel config file I have: > : ... > : device at91_twi > : device iicbus > : ... > : > : Is this correct or I miss something else? > > Should be correct. What version of FreeBSD are you using? > 7.0-CURRENT, 2 days old > Warner > > From owner-freebsd-arm@FreeBSD.ORG Mon Mar 5 14:49:37 2007 Return-Path: X-Original-To: freebsd-arm@freebsd.org Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3624716A403 for ; Mon, 5 Mar 2007 14:49:37 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id E117113C48E for ; Mon, 5 Mar 2007 14:49:36 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id l25En9uJ076737; Mon, 5 Mar 2007 07:49:09 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Mon, 05 Mar 2007 07:49:20 -0700 (MST) Message-Id: <20070305.074920.-1090027333.imp@bsdimp.com> To: krassi@bulinfo.net From: "M. Warner Losh" In-Reply-To: <45EC2BF9.2000804@bulinfo.net> References: <45EC2667.9040004@bulinfo.net> <20070305.072919.2010473806.imp@bsdimp.com> <45EC2BF9.2000804@bulinfo.net> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (harmony.bsdimp.com [127.0.0.1]); Mon, 05 Mar 2007 07:49:10 -0700 (MST) Cc: freebsd-arm@freebsd.org Subject: Re: IIC support? X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Mar 2007 14:49:37 -0000 In message: <45EC2BF9.2000804@bulinfo.net> Krassimir Slavchev writes: : M. Warner Losh wrote: : > In message: <45EC2667.9040004@bulinfo.net> : > Krassimir Slavchev writes: : > : Warner Losh wrote: : > : >> I have problems to access the iic eeprom from userland. Even after set : > : >> SCAN_IICBUS in iicbus.c nothing has been detected. I have made some : > : >> tests from the bootloader to read/write from/to the eeprom and they work. : > : >> Is there any known problems with TWI or any differences between board : > : >> settings? : > : >> : > : > : > : > The IIC bus is not a self enumerating bus. Bad things happen when you : > : > go out and try to 'probe' it, although often you can get away with : > : > that. FreeBSD takes a conservative approach. You need hints for each : > : > iic device on bus that you have on your board. : > : > : > : > : > : Ok, that was just for testing. : > : : > : I am trying to write a driver for pcf8563 (RTC similar to ds1672) but : > : when I call the iicbus_transfer() function the iicbus_transfer_gen() is : > : called instead of at91_twi_transfer(). : > : In the kernel config file I have: : > : ... : > : device at91_twi : > : device iicbus : > : ... : > : : > : Is this correct or I miss something else? : > : > Should be correct. What version of FreeBSD are you using? : > : 7.0-CURRENT, 2 days old OK. I'll take a look to see if there are unmerged patches from p4. I'm nearly positive that I fixed this... Warner From owner-freebsd-arm@FreeBSD.ORG Mon Mar 5 19:40:21 2007 Return-Path: X-Original-To: freebsd-arm@freebsd.org Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1F6D816A400 for ; Mon, 5 Mar 2007 19:40:21 +0000 (UTC) (envelope-from jhay@meraka.csir.co.za) Received: from zibbi.meraka.csir.co.za (zibbi.meraka.csir.co.za [146.64.24.58]) by mx1.freebsd.org (Postfix) with ESMTP id B396813C491 for ; Mon, 5 Mar 2007 19:40:20 +0000 (UTC) (envelope-from jhay@meraka.csir.co.za) Received: by zibbi.meraka.csir.co.za (Postfix, from userid 3973) id EFA1933CAE; Mon, 5 Mar 2007 21:40:18 +0200 (SAST) Date: Mon, 5 Mar 2007 21:40:18 +0200 From: John Hay To: "M. Warner Losh" Message-ID: <20070305194018.GA73100@zibbi.meraka.csir.co.za> References: <20070228102459.GB28669@zibbi.meraka.csir.co.za> <45E5A73E.20503@errno.com> <20070228.094155.660269855.imp@bsdimp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070228.094155.660269855.imp@bsdimp.com> User-Agent: Mutt/1.4.2.1i Cc: freebsd-arm@freebsd.org Subject: Re: redboot based boot loader for kernels? X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Mar 2007 19:40:21 -0000 > : > Hi, > : > > : > Does anyone have or is busy with an app that one can load in the > : > redboot flash, that will load the kernel from the active partition > : > of a compact flash? I know one can load the kernel in the redboot > : > flash, but that makes remote upgrading more difficult. The way I > : > have done with our wrap and soekris boards, is to create 2 slices > : > on the CF. When upgrading, you just format and install on the > : > non-active slice, change the active bit and reboot. > : > : A certain someone promised to add read/write support for the flash. > > That would be me... My day job has been crazy and my new son isn't > yet sleeping through the night. > > : When that happens another option is to write the new kernel to flash > : before rebooting. Otherwise we need a redboot image that grok's ufs or > : a secondary bootstrap that can be written to flash that knows how to > : boot from cf (I recall the latter might be in the obsd thecus work). > > The at91 boot2 groks ufs and only needs a function that can read the > sectors from the underlying media to grok new media. Of course, it > inherited most of that from the i386 boot2. Ok, I have it somewhat working for my Avila Gateworks board. I have a bug somewhere in the code that do 16 bit reads from the CF, so for now I have switched to 8 bit accesses. :-/ I'll search for that a little later. One thing that I would like to do is to pass the disk/slice info to the kernel. The reason being that I have 2 FreeBSD slices and would like the kernel to mount the one the boot loader tells it to. From looking at how some of the other archs do it, it looks like I will need some arm assembler foo. :-/ Anybody got ideas/code? I even thought of compiling the kernel with "options ROOTDEVNAME" and then the loader can load the kernel in ram and then search for the ufs:ad0s1a string and twiddle it as appropriate, but that would not work well with .gz.tramp kernels. :-) John -- John Hay -- John.Hay@meraka.csir.co.za / jhay@FreeBSD.org From owner-freebsd-arm@FreeBSD.ORG Mon Mar 5 21:12:21 2007 Return-Path: X-Original-To: freebsd-arm@freebsd.org Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3682816A400 for ; Mon, 5 Mar 2007 21:12:21 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id C930013C442 for ; Mon, 5 Mar 2007 21:12:20 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id l25L8ZRL080078; Mon, 5 Mar 2007 14:08:36 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Mon, 05 Mar 2007 14:08:45 -0700 (MST) Message-Id: <20070305.140845.-1303465514.imp@bsdimp.com> To: jhay@meraka.org.za From: "M. Warner Losh" In-Reply-To: <20070305194018.GA73100@zibbi.meraka.csir.co.za> References: <45E5A73E.20503@errno.com> <20070228.094155.660269855.imp@bsdimp.com> <20070305194018.GA73100@zibbi.meraka.csir.co.za> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (harmony.bsdimp.com [127.0.0.1]); Mon, 05 Mar 2007 14:08:37 -0700 (MST) Cc: freebsd-arm@freebsd.org Subject: Re: redboot based boot loader for kernels? X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Mar 2007 21:12:21 -0000 In message: <20070305194018.GA73100@zibbi.meraka.csir.co.za> John Hay writes: : > : > Hi, : > : > : > : > Does anyone have or is busy with an app that one can load in the : > : > redboot flash, that will load the kernel from the active partition : > : > of a compact flash? I know one can load the kernel in the redboot : > : > flash, but that makes remote upgrading more difficult. The way I : > : > have done with our wrap and soekris boards, is to create 2 slices : > : > on the CF. When upgrading, you just format and install on the : > : > non-active slice, change the active bit and reboot. : > : : > : A certain someone promised to add read/write support for the flash. : > : > That would be me... My day job has been crazy and my new son isn't : > yet sleeping through the night. : > : > : When that happens another option is to write the new kernel to flash : > : before rebooting. Otherwise we need a redboot image that grok's ufs or : > : a secondary bootstrap that can be written to flash that knows how to : > : boot from cf (I recall the latter might be in the obsd thecus work). : > : > The at91 boot2 groks ufs and only needs a function that can read the : > sectors from the underlying media to grok new media. Of course, it : > inherited most of that from the i386 boot2. : : Ok, I have it somewhat working for my Avila Gateworks board. I have : a bug somewhere in the code that do 16 bit reads from the CF, so for : now I have switched to 8 bit accesses. :-/ I'll search for that a : little later. Cool! I'd love to check out the source... : One thing that I would like to do is to pass the disk/slice info to : the kernel. The reason being that I have 2 FreeBSD slices and would : like the kernel to mount the one the boot loader tells it to. From : looking at how some of the other archs do it, it looks like I will : need some arm assembler foo. :-/ Anybody got ideas/code? I even : thought of compiling the kernel with "options ROOTDEVNAME" and then : the loader can load the kernel in ram and then search for the : ufs:ad0s1a string and twiddle it as appropriate, but that would not : work well with .gz.tramp kernels. :-) The way that's normally done is that the boot loader tells the OS in some block of memory... Trouble is that none of that is standard, and besides, the boot loader doesn't really pass anything on ARM right now (it should be passing the board type, but that's about it). That's a long way of saying 'we should invent something'. However, since we're in the Linux space here, chances are good there's already a standard for passing strings in, and maybe we should piggy back on it... Warner From owner-freebsd-arm@FreeBSD.ORG Tue Mar 6 09:59:03 2007 Return-Path: X-Original-To: freebsd-arm@freebsd.org Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BC4DE16A401 for ; Tue, 6 Mar 2007 09:59:03 +0000 (UTC) (envelope-from jhay@meraka.csir.co.za) Received: from zibbi.meraka.csir.co.za (zibbi.meraka.csir.co.za [146.64.24.58]) by mx1.freebsd.org (Postfix) with ESMTP id A9AA513C48E for ; Tue, 6 Mar 2007 09:59:02 +0000 (UTC) (envelope-from jhay@meraka.csir.co.za) Received: by zibbi.meraka.csir.co.za (Postfix, from userid 3973) id B9D8733C8B; Tue, 6 Mar 2007 11:58:59 +0200 (SAST) Date: Tue, 6 Mar 2007 11:58:59 +0200 From: John Hay To: "M. Warner Losh" Message-ID: <20070306095859.GA13199@zibbi.meraka.csir.co.za> References: <45E5A73E.20503@errno.com> <20070228.094155.660269855.imp@bsdimp.com> <20070305194018.GA73100@zibbi.meraka.csir.co.za> <20070305.140845.-1303465514.imp@bsdimp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070305.140845.-1303465514.imp@bsdimp.com> User-Agent: Mutt/1.4.2.1i Cc: freebsd-arm@freebsd.org Subject: Re: redboot based boot loader for kernels? X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Mar 2007 09:59:03 -0000 > : > > : > The at91 boot2 groks ufs and only needs a function that can read the > : > sectors from the underlying media to grok new media. Of course, it > : > inherited most of that from the i386 boot2. > : > : Ok, I have it somewhat working for my Avila Gateworks board. I have > : a bug somewhere in the code that do 16 bit reads from the CF, so for > : now I have switched to 8 bit accesses. :-/ I'll search for that a > : little later. > > Cool! I'd love to check out the source... I'm not going to keep it hidden. You will recognise a lot of it. :-) It is still full of lots of debugging printfs and #ifs. In boot2.c load() I had to clip the destination and entry point addresses: @@ -221,15 +239,18 @@ j++; } for (i = 0; i < 2; i++) { - p = (caddr_t)ep[i].p_paddr; + p = (caddr_t)(ep[i].p_paddr & 0x0fffffff); fs_off = ep[i].p_offset; if (xfsread(ino, p, ep[i].p_filesz)) return; } - addr = eh.e_entry; - ((void(*)(int))addr)(RB_BOOTINFO | (opts & RBX_MASK)); + addr = eh.e_entry & 0x0fffffff; + printf("Entry point %x for %s\n", addr, kname); + clr_board(); + ((void(*)(int))addr)(RB_BOOTINFO /* XXX | (opts & RBX_MASK) */); } In boot2.c dskread() I had to swap some of the 32 bit values in the mbr: ######################################################## @@ -278,28 +300,35 @@ return -1; dp = (void *)(sec + DOSPARTOFF); for (i = 0; i < NDOSPART; i++) { - if (dp[i].dp_typ == DOSPTYP_386BSD) + if ((dp[i].dp_typ == DOSPTYP_386BSD) && (dp[i].dp_flag == 0x80)) break; } if (i == NDOSPART) return -1; + printf("Found an active fbsd partition/slice. (%d)\n", i); // Although dp_start is aligned within the disk partition structure, // DOSPARTOFF is 446, which is only word (2) aligned, not longword (4) // aligned. Cope by using memcpy to fetch the start of this partition. memcpy(&dsk_start, &dp[i].dp_start, 4); + dsk_start = swap32(dsk_start); if (drvread(sec, dsk_start + LABELSECTOR, 1)) return -1; d = (void *)(sec + LABELOFFSET); - if (d->d_magic != DISKMAGIC || d->d_magic2 != DISKMAGIC) { + if ((d->d_magic != DISKMAGIC || d->d_magic2 != DISKMAGIC) && + (swap32(d->d_magic) != DISKMAGIC || swap32(d->d_magic2) != DISKMAGIC )) { printf("Invalid %s\n", "label"); return -1; } if (!d->d_partitions[0].p_size) { printf("Invalid %s\n", "partition"); return -1; } - dsk_start += d->d_partitions[0].p_offset; - dsk_start -= d->d_partitions[RAW_PART].p_offset; + dsk_start += swap32(d->d_partitions[0].p_offset); + dsk_start -= swap32(d->d_partitions[RAW_PART].p_offset); dsk_meta++; } ######################################################## Why do I have to swap them and you didn't need to? I created the disk mbr and slices/partitions with fdisk and bsdlabel on an arm box. > > : One thing that I would like to do is to pass the disk/slice info to > : the kernel. The reason being that I have 2 FreeBSD slices and would > : like the kernel to mount the one the boot loader tells it to. From > : looking at how some of the other archs do it, it looks like I will > : need some arm assembler foo. :-/ Anybody got ideas/code? I even > : thought of compiling the kernel with "options ROOTDEVNAME" and then > : the loader can load the kernel in ram and then search for the > : ufs:ad0s1a string and twiddle it as appropriate, but that would not > : work well with .gz.tramp kernels. :-) > > The way that's normally done is that the boot loader tells the OS in > some block of memory... Trouble is that none of that is standard, and > besides, the boot loader doesn't really pass anything on ARM right now > (it should be passing the board type, but that's about it). That's a > long way of saying 'we should invent something'. However, since we're > in the Linux space here, chances are good there's already a standard > for passing strings in, and maybe we should piggy back on it... Well I wasn't really thinking passing something from redboot itself, more that my boot2 program can tell the kernel which slice/partition to use as its root partition. At the moment I don't even want to do that interactively, it should just look for an active FreeBSD slice, load ther kernel from there (which it does) and then get the kernel to use the same slice/partition as its root. Maybe I should just implement a simple bootinfo structure and call the kernel with its pointer. I'm not sure how easy it will be to have that survive the tramp stuff though. Maybe I should look into building unzip into boot2, then I don't need the tramp mechanism. John -- John Hay -- John.Hay@meraka.csir.co.za / jhay@FreeBSD.org From owner-freebsd-arm@FreeBSD.ORG Tue Mar 6 16:09:15 2007 Return-Path: X-Original-To: freebsd-arm@freebsd.org Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CF5CB16A400 for ; Tue, 6 Mar 2007 16:09:15 +0000 (UTC) (envelope-from krassi@bulinfo.net) Received: from mx.bulinfo.net (mx.bulinfo.net [193.194.156.1]) by mx1.freebsd.org (Postfix) with ESMTP id 5CCE213C494 for ; Tue, 6 Mar 2007 16:09:15 +0000 (UTC) (envelope-from krassi@bulinfo.net) Received: from localhost (localhost [127.0.0.1]) by mx.bulinfo.net (Postfix) with ESMTP id 1C47334547; Tue, 6 Mar 2007 18:09:13 +0200 (EET) Received: from mx.bulinfo.net ([127.0.0.1]) by localhost (mx.bulinfo.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 68073-10; Tue, 6 Mar 2007 18:09:10 +0200 (EET) Received: from [192.168.2.188] (pythia.bulinfo.net [212.72.195.5]) by mx.bulinfo.net (Postfix) with ESMTP id 2BD8A34546; Tue, 6 Mar 2007 18:09:10 +0200 (EET) Message-ID: <45ED9225.1070704@bulinfo.net> Date: Tue, 06 Mar 2007 18:09:09 +0200 From: Krassimir Slavchev User-Agent: Thunderbird 1.5 (X11/20060201) MIME-Version: 1.0 To: "M. Warner Losh" References: <45EC2667.9040004@bulinfo.net> <20070305.072919.2010473806.imp@bsdimp.com> <45EC2BF9.2000804@bulinfo.net> <20070305.074920.-1090027333.imp@bsdimp.com> In-Reply-To: <20070305.074920.-1090027333.imp@bsdimp.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at mx.bulinfo.net Cc: freebsd-arm@freebsd.org Subject: Re: IIC support? X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Mar 2007 16:09:15 -0000 M. Warner Losh wrote: > In message: <45EC2BF9.2000804@bulinfo.net> > Krassimir Slavchev writes: > : M. Warner Losh wrote: > : > In message: <45EC2667.9040004@bulinfo.net> > : > Krassimir Slavchev writes: > : > : Warner Losh wrote: > : > : >> I have problems to access the iic eeprom from userland. Even after set > : > : >> SCAN_IICBUS in iicbus.c nothing has been detected. I have made some > : > : >> tests from the bootloader to read/write from/to the eeprom and they work. > : > : >> Is there any known problems with TWI or any differences between board > : > : >> settings? > : > : >> > : > : > > : > : > The IIC bus is not a self enumerating bus. Bad things happen when you > : > : > go out and try to 'probe' it, although often you can get away with > : > : > that. FreeBSD takes a conservative approach. You need hints for each > : > : > iic device on bus that you have on your board. > : > : > > : > : > > : > : Ok, that was just for testing. > : > : > : > : I am trying to write a driver for pcf8563 (RTC similar to ds1672) but > : > : when I call the iicbus_transfer() function the iicbus_transfer_gen() is > : > : called instead of at91_twi_transfer(). > : > : In the kernel config file I have: > : > : ... > : > : device at91_twi > : > : device iicbus > : > : ... > : > : > : > : Is this correct or I miss something else? > : > > : > Should be correct. What version of FreeBSD are you using? > : > > : 7.0-CURRENT, 2 days old > > OK. I'll take a look to see if there are unmerged patches from p4. > I'm nearly positive that I fixed this... > > When iicbus_transfer() is called with parent device then the right function is called. If this is correct then ds1672 and ad7418 drivers should be corrected. > Warner > > Best Regards From owner-freebsd-arm@FreeBSD.ORG Thu Mar 8 14:07:22 2007 Return-Path: X-Original-To: freebsd-arm@freebsd.org Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5A44E16A402 for ; Thu, 8 Mar 2007 14:07:22 +0000 (UTC) (envelope-from krassi@bulinfo.net) Received: from mx.bulinfo.net (mx.bulinfo.net [193.194.156.1]) by mx1.freebsd.org (Postfix) with ESMTP id 13EEE13C481 for ; Thu, 8 Mar 2007 14:07:22 +0000 (UTC) (envelope-from krassi@bulinfo.net) Received: from localhost (localhost [127.0.0.1]) by mx.bulinfo.net (Postfix) with ESMTP id 98CE164EB2 for ; Thu, 8 Mar 2007 16:07:18 +0200 (EET) Received: from mx.bulinfo.net ([127.0.0.1]) by localhost (mx.bulinfo.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 38866-03 for ; Thu, 8 Mar 2007 16:07:16 +0200 (EET) Received: from [192.168.2.188] (pythia.bulinfo.net [212.72.195.5]) by mx.bulinfo.net (Postfix) with ESMTP id E00EB66582 for ; Thu, 8 Mar 2007 16:07:15 +0200 (EET) Message-ID: <45F01893.3060605@bulinfo.net> Date: Thu, 08 Mar 2007 16:07:15 +0200 From: Krassimir Slavchev User-Agent: Thunderbird 1.5 (X11/20060201) MIME-Version: 1.0 To: freebsd-arm@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at mx.bulinfo.net Subject: driver proposal X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Mar 2007 14:07:22 -0000 Hi, From the datasheet: The PCF8563 is a CMOS real time clock/calendar optimized for low power consumption. A programmable clock output, interrupt output and voltage-low detector are also provided. All address and data are transferred serially via a two-line bidirectional I2C-bus. Maximum bus speed is 400 kbit/s. The built-in word address register is incremented automatically after each written or read data byte. There is the driver: http://mnemonic.bulinfo.net/~krassi/pcf8563.c The chip uses only 0xa2 as a slave address but on my arm board the TWI controller rewrites it to 0x51, so device hints can be used: hint.pcf8563.0.at="iicbus0" hint.pcf8563.0.addr=0x51 I will be very happy if anyone commit this driver. Best Regards From owner-freebsd-arm@FreeBSD.ORG Thu Mar 8 14:13:54 2007 Return-Path: X-Original-To: freebsd-arm@freebsd.org Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1792416A403 for ; Thu, 8 Mar 2007 14:13:54 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id CA06C13C441 for ; Thu, 8 Mar 2007 14:13:53 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id l28EC7RV026372; Thu, 8 Mar 2007 07:12:07 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Thu, 08 Mar 2007 07:12:08 -0700 (MST) Message-Id: <20070308.071208.-135505547.imp@bsdimp.com> To: krassi@bulinfo.net From: "M. Warner Losh" In-Reply-To: <45F01893.3060605@bulinfo.net> References: <45F01893.3060605@bulinfo.net> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (harmony.bsdimp.com [127.0.0.1]); Thu, 08 Mar 2007 07:12:07 -0700 (MST) Cc: freebsd-arm@freebsd.org Subject: Re: driver proposal X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Mar 2007 14:13:54 -0000 In message: <45F01893.3060605@bulinfo.net> Krassimir Slavchev writes: : Hi, : : From the datasheet: : The PCF8563 is a CMOS real time clock/calendar optimized for low power : consumption. A programmable clock output, interrupt output and : voltage-low detector : are also provided. All address and data are transferred serially via a : two-line : bidirectional I2C-bus. Maximum bus speed is 400 kbit/s. The built-in : word address : register is incremented automatically after each written or read data byte. : : There is the driver: : http://mnemonic.bulinfo.net/~krassi/pcf8563.c I'll take a look! thanks for the contribution... : The chip uses only 0xa2 as a slave address but on my arm board the TWI : controller rewrites it to 0x51, so device hints can be used: Actually, I have code in p4 that fixes this issue. All the other iic drivers use 7-1 address notation, while TWI uses 6-0. : hint.pcf8563.0.at="iicbus0" : hint.pcf8563.0.addr=0x51 : : I will be very happy if anyone commit this driver. I'll do so... Warner From owner-freebsd-arm@FreeBSD.ORG Fri Mar 9 07:57:48 2007 Return-Path: X-Original-To: freebsd-arm@freebsd.org Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 36ED016A409 for ; Fri, 9 Mar 2007 07:57:48 +0000 (UTC) (envelope-from krassi@bulinfo.net) Received: from mx.bulinfo.net (mx.bulinfo.net [193.194.156.1]) by mx1.freebsd.org (Postfix) with ESMTP id E1D4213C47E for ; Fri, 9 Mar 2007 07:57:47 +0000 (UTC) (envelope-from krassi@bulinfo.net) Received: from localhost (localhost [127.0.0.1]) by mx.bulinfo.net (Postfix) with ESMTP id 67D87BDCB9 for ; Fri, 9 Mar 2007 09:57:46 +0200 (EET) Received: from mx.bulinfo.net ([127.0.0.1]) by localhost (mx.bulinfo.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 94959-06 for ; Fri, 9 Mar 2007 09:57:44 +0200 (EET) Received: from [192.168.2.188] (pythia.bulinfo.net [212.72.195.5]) by mx.bulinfo.net (Postfix) with ESMTP id A49A6BDCB3 for ; Fri, 9 Mar 2007 09:57:42 +0200 (EET) Message-ID: <45F11376.7080202@bulinfo.net> Date: Fri, 09 Mar 2007 09:57:42 +0200 From: Krassimir Slavchev User-Agent: Thunderbird 1.5 (X11/20060201) MIME-Version: 1.0 To: freebsd-arm@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at mx.bulinfo.net Subject: 1-Wire? X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 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, 09 Mar 2007 07:57:48 -0000 Is there any kind of 1-wire hardware supported? From owner-freebsd-arm@FreeBSD.ORG Fri Mar 9 16:53:24 2007 Return-Path: X-Original-To: freebsd-arm@freebsd.org Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 332E516A402 for ; Fri, 9 Mar 2007 16:53:24 +0000 (UTC) (envelope-from sam@errno.com) Received: from ebb.errno.com (ebb.errno.com [69.12.149.25]) by mx1.freebsd.org (Postfix) with ESMTP id E6F4013C4AC for ; Fri, 9 Mar 2007 16:53:23 +0000 (UTC) (envelope-from sam@errno.com) Received: from [10.0.0.248] (trouble.errno.com [10.0.0.248]) (authenticated bits=0) by ebb.errno.com (8.13.6/8.12.6) with ESMTP id l29GrKfO022152 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 9 Mar 2007 08:53:21 -0800 (PST) (envelope-from sam@errno.com) Message-ID: <45F19100.9010104@errno.com> Date: Fri, 09 Mar 2007 08:53:20 -0800 From: Sam Leffler User-Agent: Thunderbird 1.5.0.9 (X11/20070208) MIME-Version: 1.0 To: Krassimir Slavchev References: <45F11376.7080202@bulinfo.net> In-Reply-To: <45F11376.7080202@bulinfo.net> X-Enigmail-Version: 0.94.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-arm@freebsd.org Subject: Re: 1-Wire? X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 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, 09 Mar 2007 16:53:24 -0000 Krassimir Slavchev wrote: > > Is there any kind of 1-wire hardware supported? No, but there is code in netbsd and openbsd that you can port. Sam From owner-freebsd-arm@FreeBSD.ORG Sat Mar 10 05:40:49 2007 Return-Path: X-Original-To: freebsd-arm@freebsd.org Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E908F16A402 for ; Sat, 10 Mar 2007 05:40:49 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 94CA213C48D for ; Sat, 10 Mar 2007 05:40:49 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id l2A5bkNT055659; Fri, 9 Mar 2007 22:37:50 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Fri, 09 Mar 2007 22:37:05 -0700 (MST) Message-Id: <20070309.223705.-365733480.imp@bsdimp.com> To: krassi@bulinfo.net From: "M. Warner Losh" In-Reply-To: <45F11376.7080202@bulinfo.net> References: <45F11376.7080202@bulinfo.net> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (harmony.bsdimp.com [127.0.0.1]); Fri, 09 Mar 2007 22:37:54 -0700 (MST) Cc: freebsd-arm@freebsd.org Subject: Re: 1-Wire? X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Mar 2007 05:40:50 -0000 In message: <45F11376.7080202@bulinfo.net> Krassimir Slavchev writes: : Is there any kind of 1-wire hardware supported? Not at the moment. Warner From owner-freebsd-arm@FreeBSD.ORG Sat Mar 10 12:38:38 2007 Return-Path: X-Original-To: freebsd-arm@freebsd.org Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 28B9716A404; Sat, 10 Mar 2007 12:38:38 +0000 (UTC) (envelope-from jhay@meraka.csir.co.za) Received: from zibbi.meraka.csir.co.za (zibbi.meraka.csir.co.za [146.64.24.58]) by mx1.freebsd.org (Postfix) with ESMTP id A8C6313C471; Sat, 10 Mar 2007 12:38:37 +0000 (UTC) (envelope-from jhay@meraka.csir.co.za) Received: by zibbi.meraka.csir.co.za (Postfix, from userid 3973) id AD64B33C94; Sat, 10 Mar 2007 14:38:35 +0200 (SAST) Date: Sat, 10 Mar 2007 14:38:35 +0200 From: John Hay To: Sam Leffler Message-ID: <20070310123835.GA83779@zibbi.meraka.csir.co.za> References: <20070228102459.GB28669@zibbi.meraka.csir.co.za> <45E5A73E.20503@errno.com> <20070228.094155.660269855.imp@bsdimp.com> <20070305194018.GA73100@zibbi.meraka.csir.co.za> <45ECBA38.7030607@errno.com> <20070306064715.GA3932@zibbi.meraka.csir.co.za> <45F084C5.8020601@errno.com> <20070309064843.GA3384@zibbi.meraka.csir.co.za> <45F19438.5030109@errno.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <45F19438.5030109@errno.com> User-Agent: Mutt/1.4.2.1i Cc: freebsd-arm@freebsd.org, Olivier Houchard Subject: Re: redboot based boot loader for kernels? X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Mar 2007 12:38:38 -0000 > > > > Well in effect I only get half of the bytes, but not the first or second > > half. With every 16 bit read I get 2 bytes. But some are missing. So if > > the start of the sector on the disk looks like this: > > > > 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 > > 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 > > > > What I read is this: > > > > 01 02 > > 05 06 > > 09 10 > > 13 14 > > 17 18 > > 21 22 > > 25 26 > > 29 30 > > > > So after 128 reads you start to read zeros because all the data has been > > read. > > So you're reading 4 bytes at a time, swab'ing 'em, then taking only 2. Yip, and now after finishing most of the other stuff in my boot2 program, I decided to look at the 16 bit mode again... And it was working without me doing anything. Hmmm I know I have twiddled some of the compile options in my makefile... Maybe it was that. > > In another email you asked: > > > >> I'm probably wrong and it would explain some issues we had with reset. > >> Feel free to send us a patch. I know I used both the appnote and the > >> linux driver as a basis for avila_ata.c ... > > > > I'll have a look at it as soon as I am happy with my boot2 loader. I'll > > just have to figure out how to map CS2. At the moment only CS1 is mapped, > > but for ALT_STATUS and DRV_CNTRL you need CS2. > > Look in ixp425.c for the CS1 entry. Add CS2 and map it in the driver. > But I'm not sure how to deal with gluing this into the ata driver unless > you can just special case those registers and fetch from the alternate > map'd area. All this is kinda surprising as I did a bunch of tests on > my cf w/o seeing any issues--but I'm certainly no ata expert. Everywhere in the Intel appnote (302456-003) where they describe "True IDE Mode", they say that they implemented it with CS1 and CS2. The register set wrap around on an 8 byte boundary and I think we have just been lucky that a write to 0x1e actually went to the ATA_DRIVE register and didn't cause any problems. But the CF is then not really reset. This probably didn't matter too much because the CF is in a pretty sane state. Something else, appart from the Avila boards, I also have a Pronghorn Metro from Adi Engineering. It is very similar to the Avila software wise. The 2 main differences that I have found is, they use the other serial port for the console and they used CS3 and CS4 for the IDE/CF card. It seems silly to make a whole new kernel config for it. Would it be acceptable if one could detect the board type somehow on startup and use that to select the correct serial port and chip selects for the CF? One last thing, I see that npe0 and npe1 use the same mac address. The uClinux that came installed use 2 different addresses: ixp400_eth: Using MAC address 00:d0:12:02:87:10 for port 0 ixp400_eth: Using MAC address 00:d0:12:12:87:10 for port 1 Not sure where they get it though. John -- John Hay -- John.Hay@meraka.csir.co.za / jhay@FreeBSD.org From owner-freebsd-arm@FreeBSD.ORG Sat Mar 10 16:43:28 2007 Return-Path: X-Original-To: freebsd-arm@freebsd.org Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 58E6016A405; Sat, 10 Mar 2007 16:43:28 +0000 (UTC) (envelope-from sam@errno.com) Received: from ebb.errno.com (ebb.errno.com [69.12.149.25]) by mx1.freebsd.org (Postfix) with ESMTP id 177F413C4A8; Sat, 10 Mar 2007 16:43:28 +0000 (UTC) (envelope-from sam@errno.com) Received: from [10.0.0.248] (trouble.errno.com [10.0.0.248]) (authenticated bits=0) by ebb.errno.com (8.13.6/8.12.6) with ESMTP id l2AGhKV8029518 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 10 Mar 2007 08:43:23 -0800 (PST) (envelope-from sam@errno.com) Message-ID: <45F2E028.4080907@errno.com> Date: Sat, 10 Mar 2007 08:43:20 -0800 From: Sam Leffler User-Agent: Thunderbird 1.5.0.9 (X11/20070208) MIME-Version: 1.0 To: John Hay References: <20070228102459.GB28669@zibbi.meraka.csir.co.za> <45E5A73E.20503@errno.com> <20070228.094155.660269855.imp@bsdimp.com> <20070305194018.GA73100@zibbi.meraka.csir.co.za> <45ECBA38.7030607@errno.com> <20070306064715.GA3932@zibbi.meraka.csir.co.za> <45F084C5.8020601@errno.com> <20070309064843.GA3384@zibbi.meraka.csir.co.za> <45F19438.5030109@errno.com> <20070310123835.GA83779@zibbi.meraka.csir.co.za> In-Reply-To: <20070310123835.GA83779@zibbi.meraka.csir.co.za> X-Enigmail-Version: 0.94.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-arm@freebsd.org, Olivier Houchard Subject: Re: redboot based boot loader for kernels? X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Mar 2007 16:43:28 -0000 John Hay wrote: >>> Well in effect I only get half of the bytes, but not the first or second >>> half. With every 16 bit read I get 2 bytes. But some are missing. So if >>> the start of the sector on the disk looks like this: >>> >>> 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 >>> 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 >>> >>> What I read is this: >>> >>> 01 02 >>> 05 06 >>> 09 10 >>> 13 14 >>> 17 18 >>> 21 22 >>> 25 26 >>> 29 30 >>> >>> So after 128 reads you start to read zeros because all the data has been >>> read. >> So you're reading 4 bytes at a time, swab'ing 'em, then taking only 2. > > Yip, and now after finishing most of the other stuff in my boot2 program, > I decided to look at the 16 bit mode again... And it was working without > me doing anything. Hmmm I know I have twiddled some of the compile > options in my makefile... Maybe it was that. Ha, time heals all code :) > >>> In another email you asked: >>> >>>> I'm probably wrong and it would explain some issues we had with reset. >>>> Feel free to send us a patch. I know I used both the appnote and the >>>> linux driver as a basis for avila_ata.c ... >>> I'll have a look at it as soon as I am happy with my boot2 loader. I'll >>> just have to figure out how to map CS2. At the moment only CS1 is mapped, >>> but for ALT_STATUS and DRV_CNTRL you need CS2. >> Look in ixp425.c for the CS1 entry. Add CS2 and map it in the driver. >> But I'm not sure how to deal with gluing this into the ata driver unless >> you can just special case those registers and fetch from the alternate >> map'd area. All this is kinda surprising as I did a bunch of tests on >> my cf w/o seeing any issues--but I'm certainly no ata expert. > > Everywhere in the Intel appnote (302456-003) where they describe "True > IDE Mode", they say that they implemented it with CS1 and CS2. The > register set wrap around on an 8 byte boundary and I think we have just > been lucky that a write to 0x1e actually went to the ATA_DRIVE register > and didn't cause any problems. But the CF is then not really reset. This > probably didn't matter too much because the CF is in a pretty sane state. Olivier and I saw occasional complaints about not being able to reset the part but otherwise it seemed the driver worked fine (and when the complaints stopped we stopped looking). I thought I also verified the register writes against the operation of the linux driver but patches to fix this would be welcome. > > Something else, appart from the Avila boards, I also have a Pronghorn > Metro from Adi Engineering. It is very similar to the Avila software > wise. The 2 main differences that I have found is, they use the other > serial port for the console and they used CS3 and CS4 for the IDE/CF > card. It seems silly to make a whole new kernel config for it. Would > it be acceptable if one could detect the board type somehow on startup > and use that to select the correct serial port and chip selects for > the CF? The console seems like something to specify with hints unless you can auto-detect. Regarding ata maybe you can map CS3 and CS4 too and try probing both places. > > One last thing, I see that npe0 and npe1 use the same mac address. The > uClinux that came installed use 2 different addresses: > ixp400_eth: Using MAC address 00:d0:12:02:87:10 for port 0 > ixp400_eth: Using MAC address 00:d0:12:12:87:10 for port 1 > > Not sure where they get it though. The mac is read from the h/w. If they are the same then it's likely confusion mapping the npe's. That part of the driver needs to use hints and/or better auto-config (though I'm not sure if it's possible to identify different xscale boards/configs). Sam From owner-freebsd-arm@FreeBSD.ORG Sat Mar 10 18:49:39 2007 Return-Path: X-Original-To: freebsd-arm@freebsd.org Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5FBE316A403; Sat, 10 Mar 2007 18:49:39 +0000 (UTC) (envelope-from jhay@meraka.csir.co.za) Received: from zibbi.meraka.csir.co.za (zibbi.meraka.csir.co.za [146.64.24.58]) by mx1.freebsd.org (Postfix) with ESMTP id 940E613C442; Sat, 10 Mar 2007 18:49:38 +0000 (UTC) (envelope-from jhay@meraka.csir.co.za) Received: by zibbi.meraka.csir.co.za (Postfix, from userid 3973) id EAC2A33CAA; Sat, 10 Mar 2007 20:49:36 +0200 (SAST) Date: Sat, 10 Mar 2007 20:49:36 +0200 From: John Hay To: Sam Leffler Message-ID: <20070310184936.GA2769@zibbi.meraka.csir.co.za> References: <45E5A73E.20503@errno.com> <20070228.094155.660269855.imp@bsdimp.com> <20070305194018.GA73100@zibbi.meraka.csir.co.za> <45ECBA38.7030607@errno.com> <20070306064715.GA3932@zibbi.meraka.csir.co.za> <45F084C5.8020601@errno.com> <20070309064843.GA3384@zibbi.meraka.csir.co.za> <45F19438.5030109@errno.com> <20070310123835.GA83779@zibbi.meraka.csir.co.za> <45F2E028.4080907@errno.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <45F2E028.4080907@errno.com> User-Agent: Mutt/1.4.2.1i Cc: freebsd-arm@freebsd.org, Olivier Houchard Subject: Re: redboot based boot loader for kernels? X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Mar 2007 18:49:39 -0000 On Sat, Mar 10, 2007 at 08:43:20AM -0800, Sam Leffler wrote: > > > > Yip, and now after finishing most of the other stuff in my boot2 program, > > I decided to look at the 16 bit mode again... And it was working without > > me doing anything. Hmmm I know I have twiddled some of the compile > > options in my makefile... Maybe it was that. > > Ha, time heals all code :) :-) Still bothers me a bit. > >>>> I'm probably wrong and it would explain some issues we had with reset. > >>>> Feel free to send us a patch. I know I used both the appnote and the > >>>> linux driver as a basis for avila_ata.c ... > >>> I'll have a look at it as soon as I am happy with my boot2 loader. I'll > >>> just have to figure out how to map CS2. At the moment only CS1 is mapped, > >>> but for ALT_STATUS and DRV_CNTRL you need CS2. > >> Look in ixp425.c for the CS1 entry. Add CS2 and map it in the driver. > >> But I'm not sure how to deal with gluing this into the ata driver unless > >> you can just special case those registers and fetch from the alternate > >> map'd area. All this is kinda surprising as I did a bunch of tests on > >> my cf w/o seeing any issues--but I'm certainly no ata expert. > > > > Everywhere in the Intel appnote (302456-003) where they describe "True > > IDE Mode", they say that they implemented it with CS1 and CS2. The > > register set wrap around on an 8 byte boundary and I think we have just > > been lucky that a write to 0x1e actually went to the ATA_DRIVE register > > and didn't cause any problems. But the CF is then not really reset. This > > probably didn't matter too much because the CF is in a pretty sane state. > > Olivier and I saw occasional complaints about not being able to reset > the part but otherwise it seemed the driver worked fine (and when the > complaints stopped we stopped looking). I thought I also verified the > register writes against the operation of the linux driver but patches to > fix this would be welcome. I'll definitely look at it. > > Something else, appart from the Avila boards, I also have a Pronghorn > > Metro from Adi Engineering. It is very similar to the Avila software > > wise. The 2 main differences that I have found is, they use the other > > serial port for the console and they used CS3 and CS4 for the IDE/CF > > card. It seems silly to make a whole new kernel config for it. Would > > it be acceptable if one could detect the board type somehow on startup > > and use that to select the correct serial port and chip selects for > > the CF? > > The console seems like something to specify with hints unless you can > auto-detect. Regarding ata maybe you can map CS3 and CS4 too and try > probing both places. Well if one can assume that whatever ran before, did set the correct CS registers, one can just look at the CS timing registers to see which are configured. I used that today to make my boot2 program work on both boards. The avila_ata.c code already assume that part of those registers are pre setup, so maybe this isn't too bad an assumption. On both boards the unused CS timing registers are 0. In my boot2 program I used that info (CF-IDE CS registers) to choose the uart to use too. :-) Would that be an ok method to use in the kernel too, until we can find a better way? Or do we already have more than the Avila and Pronghorn boards to support? > > One last thing, I see that npe0 and npe1 use the same mac address. The > > uClinux that came installed use 2 different addresses: > > ixp400_eth: Using MAC address 00:d0:12:02:87:10 for port 0 > > ixp400_eth: Using MAC address 00:d0:12:12:87:10 for port 1 > > > > Not sure where they get it though. > > The mac is read from the h/w. If they are the same then it's likely > confusion mapping the npe's. That part of the driver needs to use hints > and/or better auto-config (though I'm not sure if it's possible to > identify different xscale boards/configs). Ignore this one, the macs are different. Probably too long between coffees. :-/ John -- John Hay -- John.Hay@meraka.csir.co.za / jhay@FreeBSD.org