From owner-svn-src-stable@FreeBSD.ORG Sat Dec 14 00:55:35 2013 Return-Path: Delivered-To: svn-src-stable@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 ESMTPS id F2F1B46A; Sat, 14 Dec 2013 00:55:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C4EAD10DD; Sat, 14 Dec 2013 00:55:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBE0tYAE009842; Sat, 14 Dec 2013 00:55:34 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBE0tYe8009841; Sat, 14 Dec 2013 00:55:34 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201312140055.rBE0tYe8009841@svn.freebsd.org> From: Ian Lepore Date: Sat, 14 Dec 2013 00:55:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259372 - stable/10/sys/dev/nand X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Dec 2013 00:55:35 -0000 Author: ian Date: Sat Dec 14 00:55:34 2013 New Revision: 259372 URL: http://svnweb.freebsd.org/changeset/base/259372 Log: MFC r258740: Look up a nand chip by id in the static table before trying to obtain ONFI parameters. This allows a static table entry to provide valid data for chips known to provide invalid ONFI data. Modified: stable/10/sys/dev/nand/nandbus.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/nand/nandbus.c ============================================================================== --- stable/10/sys/dev/nand/nandbus.c Sat Dec 14 00:54:05 2013 (r259371) +++ stable/10/sys/dev/nand/nandbus.c Sat Dec 14 00:55:34 2013 (r259372) @@ -195,8 +195,27 @@ nandbus_attach(device_t dev) if (chip_id.man_id == 0xff) continue; - /* Check if chip is ONFI compliant */ - if (nand_probe_onfi(dev, &onfi) != 0) { + /* + * First try to get info from the table. If that fails, see if + * the chip can provide ONFI info. We check the table first to + * allow table entries to override info from chips that are + * known to provide bad ONFI data. + */ + onfi = 0; + chip_params = nand_get_params(&chip_id); + if (chip_params == NULL) { + nand_probe_onfi(dev, &onfi); + } + + /* + * At this point it appears there is a chip at this chipselect, + * so if we can't work with it, whine about it. + */ + if (chip_params == NULL && onfi == 0) { + if (bootverbose || (nand_debug_flag & NDBG_BUS)) + printf("Chip params not found, chipsel: %d " + "(manuf: 0x%0x, chipid: 0x%0x, onfi: %d)\n", + cs, chip_id.man_id, chip_id.dev_id, onfi); continue; } @@ -218,15 +237,6 @@ nandbus_attach(device_t dev) continue; } - chip_params = nand_get_params(&chip_id); - if (chip_params == NULL) { - nand_debug(NDBG_BUS,"Chip description not found! " - "(manuf: 0x%0x, chipid: 0x%0x)\n", - chip_id.man_id, chip_id.dev_id); - free(ivar, M_NAND); - continue; - } - ivar->cs = cs; ivar->cols = 1; ivar->rows = 2;