Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 311BBC76195 for ; Sat, 25 Mar 2023 00:04:05 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 576B485D9D; Sat, 25 Mar 2023 01:03:54 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="GtusmIGj"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E7B3385DAD; Sat, 25 Mar 2023 01:03:50 +0100 (CET) Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 12A7985D94 for ; Sat, 25 Mar 2023 01:03:33 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=martin.p.rowe@gmail.com Received: by mail-pj1-x102b.google.com with SMTP id r7-20020a17090b050700b002404be7920aso2561561pjz.5 for ; Fri, 24 Mar 2023 17:03:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679702611; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bFlqKNTbwVpNO+VQJz9NYk/WWoryizPJFeQpcZjHcak=; b=GtusmIGjILDIPw+o7pT8EZtMo15ijiPWLIQ6SzwS1b0iJmUXcaWjQcAjktTc151FKF 8aYFC4wvF7yj7fbL0pPmwSnDQaR4kLcTcDzbZxantvrOtWF60SDbCum4s04+p5up3l4D kc4dhOgU4XVh5iP2TYhyU6MLgpZjNaynLxGfxbOvajGhuWqVMIG1uek62GbLKoYn0Gbk 6mu9ppbw8ElNjO11tJp+fb1y4nuHKf7zp2/q9YHPrxXyoZRs02zxUBRzdMwUORa2wNnL ZGAMhFYlUbeDdAUei53OTjA+ncZZQj7u/XbplCir6B5Glhu6OWUYu2UlZSOa92Mhk74s hDOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679702611; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bFlqKNTbwVpNO+VQJz9NYk/WWoryizPJFeQpcZjHcak=; b=XPUq99bOxnwLCmPINTP38gK8wD/HtxwLe+PbQo97iYp7p3TrAt89YMvcIsPQo9Uqzi cisY3VEkbCF0pinKKODgHlsPjYNv7pMoerPMhQ6gbFqe58T9957sxtNbfhe6kVuBQuvf /BXAb6U9XmbHtf90ZHKuA86DEiDaIAQnVHA7431Z8dDqWT8A3pBjI9A/Tv6LJ9KkacfY rWl5oMcfhci0Jiy6l81EKG5n82hehUVtsSKRp1nioVhCKydQd0LkNXc0aXWP/7qfpqc8 sUR2GQSnTnjc8M1opSTnPqnv8kXPFwlK3gfF69EhNsccNrRpsEL6IYuegffQcdUZolUm hPrQ== X-Gm-Message-State: AAQBX9fEEsKLbtllY06JQ/Pv9GKvjNsqstF1Pa0WxvjjyhhNWkURQCre Rp07aPprvV1JfiByJiO94n4= X-Google-Smtp-Source: AKy350YbiY9SkOyFNm2UU2MVGc0Aqcm1Gg3bBzkeWrty4kKRKOG5z/iUPePTQ0DmQQ3ZqpTdK1MBPw== X-Received: by 2002:a17:90b:4d0d:b0:23a:f6e6:8ea5 with SMTP id mw13-20020a17090b4d0d00b0023af6e68ea5mr3635328pjb.24.1679702611090; Fri, 24 Mar 2023 17:03:31 -0700 (PDT) Received: from hawking.mbtj.net (60-240-212-34.tpgi.com.au. [60.240.212.34]) by smtp.gmail.com with ESMTPSA id u12-20020a17090ae00c00b002311c4596f6sm399020pjy.54.2023.03.24.17.03.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Mar 2023 17:03:30 -0700 (PDT) From: Martin Rowe To: pali@kernel.org, sr@denx.de Cc: josua@solid-run.com, jon@solid-run.com, mibodhi@gmail.com, u-boot@lists.denx.de, Martin Rowe Subject: [PATCH v2 3/3] arm: mvebu: clearfog: Detect MMC vs SDHC and fixup fdt Date: Sat, 25 Mar 2023 10:02:45 +1000 Message-Id: <20230325000245.8467-4-martin.p.rowe@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230325000245.8467-1-martin.p.rowe@gmail.com> References: <20230325000245.8467-1-martin.p.rowe@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean [upstream of vendor commit 19a96f7c40a8fc1d0a6546ac2418d966e5840a99] The Clearfog devices have only one SDHC device. This is either eMMC if it is populated on the SOM or SDHC if not. The Linux device tree assumes the SDHC case. Detect if the device is an eMMC and fixup the device-tree so it will be detected by Linux. Ported from vendor repo at https://github.com/SolidRun/u-boot Signed-off-by: Martin Rowe --- arch/arm/mach-mvebu/Kconfig | 1 + board/solidrun/clearfog/clearfog.c | 32 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index fb3cff43f7..773635d691 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig @@ -107,6 +107,7 @@ config TARGET_CLEARFOG bool "Support ClearFog" select 88F6820 select BOARD_LATE_INIT + select OF_BOARD_SETUP config TARGET_HELIOS4 bool "Support Helios4" diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c index 03adb591d8..0087fea7db 100644 --- a/board/solidrun/clearfog/clearfog.c +++ b/board/solidrun/clearfog/clearfog.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -261,3 +262,34 @@ int board_late_init(void) return 0; } + +static bool has_emmc(void) +{ + struct mmc *mmc; + mmc = find_mmc_device(0); + if (!mmc) + return 0; + return (!mmc_init(mmc) && IS_MMC(mmc)) ? true : false; +} + +/* + * The Clearfog devices have only one SDHC device. This is either eMMC + * if it is populated on the SOM or SDHC if not. The Linux device tree + * assumes the SDHC case. Detect if the device is an eMMC and fixup the + * device-tree, so that it will be detected by Linux. + */ +int ft_board_setup(void *blob, struct bd_info *bd) +{ + __maybe_unused int node; + + if (has_emmc()) { + node = fdt_node_offset_by_compatible(blob, -1, "marvell,armada-380-sdhci"); + if (node < 0) + return 0; /* Unexpected eMMC device; patching not supported */ + + puts("Patching FDT so that eMMC is detected by OS\n"); + return fdt_setprop_empty(blob, node, "non-removable"); + } + + return 0; +} -- 2.40.0