From patchwork Mon Dec 7 14:08:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Nelson X-Patchwork-Id: 553399 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 191391401CD for ; Tue, 8 Dec 2015 01:09:06 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=nelint.com header.i=@nelint.com header.b=LfB7kTVG; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D7C194B70B; Mon, 7 Dec 2015 15:09:03 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aesBnycTBRX0; Mon, 7 Dec 2015 15:09:03 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3C9084B6ED; Mon, 7 Dec 2015 15:09:03 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E1F864B6ED for ; Mon, 7 Dec 2015 15:08:59 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fr0bf_qY9kqn for ; Mon, 7 Dec 2015 15:08:59 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pa0-f53.google.com (mail-pa0-f53.google.com [209.85.220.53]) by theia.denx.de (Postfix) with ESMTPS id 71CE54B6EA for ; Mon, 7 Dec 2015 15:08:55 +0100 (CET) Received: by pacej9 with SMTP id ej9so125787774pac.2 for ; Mon, 07 Dec 2015 06:08:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nelint.com; s=google; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=ChFWFWBUL3QvEo+6sYa81rz3oOWc+APmHsaSTBuWY4Y=; b=LfB7kTVGrZH0SaA5T6y2Z5JzJk8e+uHbsJVRIAOUI9fenhvDVXh1LAIRNfozjHmTtB PvP39oHfGU2mZL/gJgKNbDhoBf1Mq2MSmVS0DchUF+S2+VsdhCcYDbOgixN7IRpaOklD dzCL+DNUBffqAgPh+Pa8RghIdYi1CTEhumNRA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=ChFWFWBUL3QvEo+6sYa81rz3oOWc+APmHsaSTBuWY4Y=; b=mrCz4gDWIvf6Ssic7b8J3dYShtBdqQhxbEiYszAtbmZiVK/yR02XCgfa0jAIXMRtcg Q0Y2X3vBcgUm+bgn6cQ/jONJL+2poy/Pzu8VRCodtf6dUO8C7B7I0wTZOSBtqmOGBSxv dBdYO2lbXq7PWQq86zB0VSt2u47YtTrQ7L26aRjv09EJlDCELlBQqPL1+1fiwU5FN+DI M6XLkMnN1chiiN25yW821CDOgc/PomLy56DQf96WQtWBbh5+llx5d3NuiZ4WM4To0BHf D3xM0spZ+iOlQUdLiKRMWOPBqOnWVW21pnBh21d5WD/VIvfQs3CJ5P92L8mmDHOJ4qio 0weQ== X-Gm-Message-State: ALoCoQlwheYvRshgG/KbufPtfhCm8KWiXyv9zCiv20K9RGxTsd1XiqusjAd89FXOadguPM/7lKQ4 X-Received: by 10.66.122.105 with SMTP id lr9mr44021193pab.8.1449497334044; Mon, 07 Dec 2015 06:08:54 -0800 (PST) Received: from [192.168.2.184] (ip98-165-107-234.ph.ph.cox.net. [98.165.107.234]) by smtp.gmail.com with ESMTPSA id qz2sm35173241pab.14.2015.12.07.06.08.52 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 07 Dec 2015 06:08:53 -0800 (PST) To: Stefano Babic , u-boot@lists.denx.de References: <1449219732-5396-1-git-send-email-sbabic@denx.de> <56634586.6050200@nelint.com> <5665579F.1080808@denx.de> From: Eric Nelson X-Enigmail-Draft-Status: N1110 Message-ID: <566592F4.4090901@nelint.com> Date: Mon, 7 Dec 2015 07:08:52 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <5665579F.1080808@denx.de> Cc: Fabio Estevam , Eric Nelson Subject: Re: [U-Boot] [PATCH] imx_common: check for Serial Downloader in spl_boot_device X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Hi Stefano, On 12/07/2015 02:55 AM, Stefano Babic wrote: > Hi Eric, > > On 05/12/2015 21:13, Eric Nelson wrote: >> Hi Stefano, >> >> On 12/04/2015 02:02 AM, Stefano Babic wrote: >>> Check for bmode before reading the boot device >>> to check if a serial downloader is started, >>> and returns UART if the serial downloader is set, >>> letting SPL to wait for an image if >>> CONFIG_SPL_YMODEM_SUPPORT is set. >>> ... >> Separately, what's your thought about enabling this when the >> system is reset through "bmode usb"? >> >> http://git.denx.de/?p=u-boot.git;a=blob;f=arch/arm/cpu/armv7/mx6/soc.c;h=bf5ae8cdffd8b0887291249332b06f66dc644832;hb=HEAD#l389 >> >> Since the gpr9 value in this mode is 0x00000001, the switch >> statement currently falls into the NOR/OneNAND block, which >> is pretty useless. > > I agree with you, in fact it does not work - but I do not see a way to > inform the ROM that next time it should run with USB as boot device. > From the fusemap, I tried to set BOOT_CFG4 as 0x40 ("Reserved for serial > ROM"), and fixing BOOT_CFG1 to 0x30, but it was only a try. In fact, we > need to change BMODE from internal to serial, and I do not see a way in > the "official" documentation. > It doesn't help that all of this is undocumented :), but reverse- engineering the bmode command The "bmode usb" command sets gpr9 to 1, which isn't used for anything else, so something like this will work: Secondarily, since the low four bits are discarded in the switch(), this prevents an almost-always-wrong interpretation of 1 as OneNAND/NOR (I think there are very few if any i.MX6 boards using OneNAND or NOR for boot). Regards, Eric diff --git a/arch/arm/imx-common/spl.c b/arch/arm/imx-common/spl.c index 28217d2..54f22e6 100644 --- a/arch/arm/imx-common/spl.c +++ b/arch/arm/imx-common/spl.c @@ -26,8 +26,10 @@ u32 spl_boot_device(void) * Check for BMODE if serial downloader is enabled * BOOT_MODE - see IMX6DQRM Table 8-1 */ - if ((bmode >> 24) == 0x01) /* Serial Downloader */ + if (((bmode >> 24) == 0x01) /* Serial Downloader */ + || (gpr10_boot && (1 == reg))) return BOOT_DEVICE_UART; AFAIK, there isn't any other way to get a value of 1 into GPR9, so the test is safe.