From owner-svn-src-head@FreeBSD.ORG Sat Jun 6 16:38:41 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 04675C5D; Sat, 6 Jun 2015 16:38:41 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) 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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CDD4D17E8; Sat, 6 Jun 2015 16:38:40 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t56GceMD036274; Sat, 6 Jun 2015 16:38:40 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t56Gce9u036273; Sat, 6 Jun 2015 16:38:40 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201506061638.t56Gce9u036273@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 6 Jun 2015 16:38:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r284083 - head/sys/dev/nand X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 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: Sat, 06 Jun 2015 16:38:41 -0000 Author: jhibbits Date: Sat Jun 6 16:38:40 2015 New Revision: 284083 URL: https://svnweb.freebsd.org/changeset/base/284083 Log: Map the LAW for the RouterBoard's NAND LBC memory. Without creating a LAW entry, any access to the NAND hangs the CPU. The original intent was to add a quirk to map all of the RouterBoard's LBC address space in one shot, which would fix it for both NAND and the CF, and that's probably still in the cards. However, for now, this makes NAND usable without a separate hack. Things left before the RouterBoard can run standalone: * Add partitions to the NAND (not specified by the FDT, which we currently require). * Create a YAFFS partition for the kernel. The Mikrotik boot loader requires a 4MB partition at the beginning of NAND, with a file called 'kernel' in the root. Modified: head/sys/dev/nand/nfc_rb.c Modified: head/sys/dev/nand/nfc_rb.c ============================================================================== --- head/sys/dev/nand/nfc_rb.c Sat Jun 6 16:36:13 2015 (r284082) +++ head/sys/dev/nand/nfc_rb.c Sat Jun 6 16:38:40 2015 (r284083) @@ -49,6 +49,9 @@ __FBSDID("$FreeBSD$"); #include #include + +#include + #include "nfc_if.h" #include "gpio_if.h" @@ -128,6 +131,7 @@ rb_nand_attach(device_t dev) struct rb_nand_softc *sc; phandle_t node; uint32_t ale[2],cle[2],nce[2],rdy[2]; + u_long size,start; int err; sc = device_get_softc(dev); @@ -168,6 +172,14 @@ rb_nand_attach(device_t dev) return (ENXIO); } + start = rman_get_start(sc->sc_mem); + size = rman_get_size(sc->sc_mem); + if (law_enable(OCP85XX_TGTIF_LBC, start, size) != 0) { + bus_release_resource(dev, SYS_RES_MEMORY, sc->rid, sc->sc_mem); + device_printf(dev, "could not allocate local address window.\n"); + return (ENXIO); + } + nand_init(&sc->nand_dev, dev, NAND_ECC_SOFT, 0, 0, NULL, NULL); err = nandbus_create(dev);