From owner-freebsd-arm@freebsd.org Fri Feb 2 11:11:38 2018 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2BFC0ED0D15 for ; Fri, 2 Feb 2018 11:11:38 +0000 (UTC) (envelope-from k@7he.at) Received: from smtp-01.sil.at (smtp-01-5.sil.at [78.142.186.29]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BCF34867F1 for ; Fri, 2 Feb 2018 11:11:36 +0000 (UTC) (envelope-from k@7he.at) Received: from mx.7he.at ([86.59.13.138]) by smtp-01.sil.at with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1ehZFg-0003Ip-SE; Fri, 02 Feb 2018 12:11:28 +0100 Received: from [192.168.6.60] ([93.83.242.219]) by mx.7he.at (8.15.2/8.15.2) with ESMTPS id w12BBOpT092294 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 2 Feb 2018 12:11:24 +0100 (CET) (envelope-from k@7he.at) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.99.2 at mx.7he.at Subject: Re: RPI3 / bcm2835 sdhci device driver To: Oleksandr Tymoshenko Cc: freebsd-arm@freebsd.org References: <6fc103a5-6634-8cc0-34d9-702b4484c2e0@7he.at> <20180128220927.GA56771@bluezbox.com> From: "Klaus P. Ohrhallinger" Message-ID: <17f3f24f-476b-dd1c-6b26-5f13b3556ec5@7he.at> Date: Fri, 2 Feb 2018 12:11:33 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180128220927.GA56771@bluezbox.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.3 required=5.0 tests=DATE_IN_FUTURE_48_96, HELO_MISC_IP,RDNS_NONE autolearn=no autolearn_force=no version=3.4.1 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mx.7he.at X-Scan-Signature: 8f32f02f8db636c17c2978c24389a02e X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 11:11:38 -0000 On 28.01.2018 23:09, Oleksandr Tymoshenko wrote: Hello, > > Hi Klaus, > > Thanks a lot for working on this. You might consider using > https://reviews.freebsd.org for patch submissions. Its UI is not > exactly the paramaunt of usability but still beats posting comments > in emails. Also there is command-line cient for patch management > that is pretty usable: https://wiki.freebsd.org/Phabricator There it is: https://reviews.freebsd.org/D14168 > > I have several comments on current version of the driver: > > - Looks like Linux and official name for the driver is sdhost, > as compatible string suggest, so I suggest renaming it to > bcm2835_sdhost. It's more distinctive from sdhci comparing to > sdhci0 Renaming done. > > - "+#define DEBUG 0". DEBUG flag is set using "options DEBUG" in > kernel config, so overriding it introduces side-effects. If you > need internal flag for development use prefixed version like > SDHOST_DEBUG. Also I'd suggest against using numeric values to > indicate boolean conditions in preprocessor directives. Common > expectation is to signal such conditions using #define FOO and > to check them using #ifdef FOO or #if defined(FOO) Renamed to SDHOST_DEBUG and not using numeric values anymore. > > - bcm2835_gpio_dev + bcm_gpio_set_alternate hack is bad. I > know that there are hacks like this in other drivers but I am > working on pinmux support for Pi and once it's done whole > bcm_sdhci0_swap_pins can be just deleted. Pins are going to be > muxed using information from device tree. I hope to finish it > "real soon". I will let you know once it's done. I know it's a bad hack and I will be happy to remove it. The new version also contains a fix for properly waiting on erase commands. After some more testing, the panic()s should be replaced/deleted. It would be good if some people could test the driver with different types and makes of sd-cards. Also, DMA support would be nice to have, but I don't have time for that now. Regards, Klaus