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 C220EC76195 for ; Mon, 27 Mar 2023 10:31:55 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5101485B82; Mon, 27 Mar 2023 12:31:52 +0200 (CEST) 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="RXiWpaOa"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B0FD385B82; Mon, 27 Mar 2023 12:31:49 +0200 (CEST) Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) (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 47910855AC for ; Mon, 27 Mar 2023 12:31:46 +0200 (CEST) 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-x1036.google.com with SMTP id o6-20020a17090a9f8600b0023f32869993so11361045pjp.1 for ; Mon, 27 Mar 2023 03:31:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679913104; 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=gh9+BBbKr45iUGjoJGDBRXV9383JyM9mv7QVlZqGBzQ=; b=RXiWpaOaEZ+jFXNeVf8MUl7TFtoytOKuM+7M7ZCaizaCApjgc0GFfCUPDEP5P+O4XP 0H0OnAlnd/dV424ob+RerVXbDPskDPf4S2PaxvpQc4EuKSg61mhNzwEk/t8S32wc/x5U IUI4CfAGz3pKqzJkkXHixE2Eqmp9soqWbAazo2siUr4Wnn0c9QD2ASEp8iA5WWr06bJ0 bMqRXHukRp8KQzkWA1tHGcDzrM3Fx82yANNEXWkWAXkx2oR5rEmI1Pk5R7mn9RnIhkbA mOpX5LxegSvR6rKxr9jX4BaY9FGVZRrjTaEeUAxblGbQ8SmJnzkCw/rtanf9xzBu4YnJ zjPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679913104; 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=gh9+BBbKr45iUGjoJGDBRXV9383JyM9mv7QVlZqGBzQ=; b=i0BEFahsBcWKrsSKSnSb9dIf/q2i7kX5LBpG2ocgRa2GFOvOkM0Lx2/98c4FSv7xRR TFuEiv0ryn1VzhHo/V2WBAPeSZu704cOUrxQeoUiXXPKqYSOQBv2cQWdJeWgT8P0qTgA R2gDnNzj+bCcYaEIrkhpqRVKmib8i4P8jHRJF7B5t0YnQGfPlRjElmEZvP/P9CTkKBwM GR7f9qyd4LKKdyW6fyDNADsN/HWbL8DzClhvdzHJ1XMLmS+qZYlVZYGrW3RYQdrcpQS2 V9YcbM2YZX43erbcXQTxat5RQEILxOVxEE8J3xUSbbG2oApRM60znkrgXWnt+uxEDhDV PdJA== X-Gm-Message-State: AO0yUKVaJw5bBhjWtiGXu6+C0gIowMg6auSD2O91MGpOFSLjuMUSy5yt RoeyEewc5nCnw7myy+C4VtU= X-Google-Smtp-Source: AK7set/EVjve7EsVo6QIMaKYkwK9VTaDLfj8gTudlDU7svMwhSQCmyb49qoU7IGPsCmEADS87zSidA== X-Received: by 2002:a05:6a20:3ba3:b0:cb:af96:ace7 with SMTP id b35-20020a056a203ba300b000cbaf96ace7mr10960874pzh.46.1679913104288; Mon, 27 Mar 2023 03:31:44 -0700 (PDT) Received: from hawking.mbtj.net (124-148-102-134.tpgi.com.au. [124.148.102.134]) by smtp.gmail.com with ESMTPSA id l16-20020a62be10000000b0062cf779dcb7sm3781942pff.217.2023.03.27.03.31.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 03:31:43 -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 v3 3/3] arm: mvebu: clearfog: Detect MMC vs SDHC and fixup fdt Date: Mon, 27 Mar 2023 20:31:10 +1000 Message-Id: <20230327103110.56673-1-martin.p.rowe@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: 38fb92cd-6619-28be-d3ac-0576c4c919e5@denx.de References: 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 --- Fixed spacing and removed __maybe_unused arch/arm/mach-mvebu/Kconfig | 1 + board/solidrun/clearfog/clearfog.c | 33 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index 1f0dbef1c6..b1f2e97ae7 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..6edb422155 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,35 @@ 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) +{ + 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