Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp944047imp; Thu, 21 Feb 2019 14:44:44 -0800 (PST) X-Google-Smtp-Source: AHgI3IZMFzP4JuLcrymuLfnzNUWobzfbJnbw+xN9emQHhbqKUmKslW3GCzge3IEdU9TdlVHOE2y1 X-Received: by 2002:a63:1a03:: with SMTP id a3mr858236pga.192.1550789084651; Thu, 21 Feb 2019 14:44:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550789084; cv=none; d=google.com; s=arc-20160816; b=dR6MntVvoHDMPl1QSm5YFt1NYcRz0sI4WvyQRQfV8d1MGu7Ow10qDnWCc/axDW+qbS YRo7oMWfVgNmZ8Hw9WFLqUIy/8iyliScU1MMHNYZFJAF5OfQ8VPo0EjZ0AOPo5VMRUcn PhfIXhsjmEGe7f5Ts6VJmhjz9UNDZpzTDHDHu+lMbZPOrH6u598d3MxD4+Ab4GEPrzxd DWZM9lU5LgxWvm/DYEVUGY3jLACtGlrpeWxHv4gwSb5G0qV0jHnqOFfmMSl1FeBFLHTY yAUMgRaOiAVhZP9IVYXL927dT7EHokPi+wFVkodImUtQIJcJikLp1GghE8+fith6S2NK f6Gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=AoP52D/tICJ3bRLNmIOxk1RnsAknvX4p09ko1Ac3Izs=; b=osDtsaGJvFX8hvjVwDBLBzz24KrCYP9v3b3HiWpHPI+zIm8adyJVPzUyGeLxoJYxUO tIEXBFjFTq+iR9DZ8nVBRhBXOqoRJ8SziFaT+fgCYTYO35YnMDNfBwbDxAyGOuf72n7C cejc1vg+TWZH4+9MADAL/zqFI8W1VoJ3pJcnKyLd60kqVp0JencR+9/bqJc6hJs+fByG FpI10RI0qMlPO5BxJNrctz0Qe+tRk9pUigP+KA7xwfifgsUJ9N/hQZwOJbwSXNTA4854 NcG5yyOmcLyzD3arhu4C0187SvZQMMjIIgjTvtbDLXB9uwR+8/EscNQhQCVIPnqxYwfy WFRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@crapouillou.net header.s=mail header.b=nbAm42HY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b60si109957plc.95.2019.02.21.14.44.28; Thu, 21 Feb 2019 14:44:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@crapouillou.net header.s=mail header.b=nbAm42HY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726978AbfBUWnW (ORCPT + 99 others); Thu, 21 Feb 2019 17:43:22 -0500 Received: from outils.crapouillou.net ([89.234.176.41]:40396 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725961AbfBUWnW (ORCPT ); Thu, 21 Feb 2019 17:43:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1550788999; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=AoP52D/tICJ3bRLNmIOxk1RnsAknvX4p09ko1Ac3Izs=; b=nbAm42HYVX5FH97/NBS1ukdFDS/X+yTHyHrGIAryjH64c4PuvbmfRfwUGvaCZ5VE9BW3Q9 DjVCSKlipH0sZ5LppTjiY8FAgp1FIaKuIgX3lQ8nmDcbGVjahzzEDZ9qJzNg8nkU5Ctam7 ZjuSJ5aGQrGwrhP6L+lKOKAOJImHjYc= From: Paul Cercueil To: Ralf Baechle , Paul Burton , James Hogan Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v2] MIPS: ingenic: Add support for appended devicetree Date: Thu, 21 Feb 2019 19:43:10 -0300 Message-Id: <20190221224310.9507-1-paul@crapouillou.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support for booting the kernel from an externally-appended devicetree, if no devicetree was built-in. Signed-off-by: Paul Cercueil --- Changes: v2: Use fw_passed_dtb instead of __appended_dtb arch/mips/Kconfig | 2 +- arch/mips/jz4740/setup.c | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index a84c24d894aa..8b7ea9062198 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -391,7 +391,7 @@ config MACH_INGENIC select GPIOLIB select COMMON_CLK select GENERIC_IRQ_CHIP - select BUILTIN_DTB + select BUILTIN_DTB if MIPS_NO_APPENDED_DTB select USE_OF select LIBFDT diff --git a/arch/mips/jz4740/setup.c b/arch/mips/jz4740/setup.c index afb40f8bce96..7e63c54eb8d2 100644 --- a/arch/mips/jz4740/setup.c +++ b/arch/mips/jz4740/setup.c @@ -31,7 +31,6 @@ #define JZ4740_EMC_SDRAM_CTRL 0x80 - static void __init jz4740_detect_mem(void) { void __iomem *jz_emc_base; @@ -66,15 +65,22 @@ static unsigned long __init get_board_mach_type(const void *fdt) void __init plat_mem_setup(void) { int offset; + void *dtb; jz4740_reset_init(); - __dt_setup_arch(__dtb_start); - offset = fdt_path_offset(__dtb_start, "/memory"); + if (__dtb_start != __dtb_end) + dtb = __dtb_start; + else + dtb = (void *)fw_passed_dtb; + + __dt_setup_arch(dtb); + + offset = fdt_path_offset(dtb, "/memory"); if (offset < 0) jz4740_detect_mem(); - mips_machtype = get_board_mach_type(__dtb_start); + mips_machtype = get_board_mach_type(dtb); } void __init device_tree_init(void) -- 2.11.0