From patchwork Fri Oct 20 10:20:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 1852424 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=sartura.hr header.i=@sartura.hr header.a=rsa-sha256 header.s=sartura header.b=aT99BPqW; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SBgbt73yCz23jq for ; Fri, 20 Oct 2023 21:21:29 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6BFF187479; Fri, 20 Oct 2023 12:21:24 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=sartura.hr 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=sartura.hr header.i=@sartura.hr header.b="aT99BPqW"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5508087476; Fri, 20 Oct 2023 12:21:23 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) (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 40E0780F06 for ; Fri, 20 Oct 2023 12:21:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=sartura.hr Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=robert.marko@sartura.hr Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-9bf0ac97fdeso97964466b.2 for ; Fri, 20 Oct 2023 03:21:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sartura.hr; s=sartura; t=1697797281; x=1698402081; darn=lists.denx.de; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=VJ/mQOEAMI18a06QHYq0i7pMNnph7rmZfPRHcbrS3Jc=; b=aT99BPqW0x5IIu/1IGnylnutOnYTNWUg0zwU14IpZHbUdHG61lKvtoZR3qW2oZSBMX wtiwnmbrhAVQa2T4qHl92bx9CoFYizuwkzTdp5mmERsgCDNy0GWJGy4RLu0p8u3CpfE0 jLocTLhIDfroQj1Gsr3nOSBCqvmTIQMOUKWerPIKhCrxgRLXk8OiSygG41oLac6/P2wY RiS5tboacmxPaGnawbxAcT8M0ji/tklr0VOyAa+PFyTcgmtDVh4qv/Lu9GTLCS+MDZ7c TG0f5Uf8zg5RhkVr20wKbt9uaJ4VSsjVVTGXIRkVFcGPi2ZEm6ZGhhf1Fbp4et5SzRBb fS1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697797281; x=1698402081; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VJ/mQOEAMI18a06QHYq0i7pMNnph7rmZfPRHcbrS3Jc=; b=FIMssQV4h471TpME/kEP3xfjGJVxG0zeqnMxiQ+OKIuITKNIef7GgG7hCPrgC9V4tb KRWyNlIZD4QlaU6evxBUHvGUBLkvaGkserS6IEo50lgNkvYKgNv5KSNYiUNPIHZ9C/1m zfYo04clc9HrPqEgtW9omblbQFFnZKRhoEIyLn+/9xfG6yd2YVpmwhlyUUkF9M8mBW5o G0HmK3g+TYeQsyvI88CzD3Kj7Efndk3PUWMoZHXvh5D9pvT0jrpaebltRknG7xse+IN4 JN5mqNdikqVbboCSV5kSFC0d7xIzyQ2hc1YGJpkhCClvadqpUk+rVQUFpBXn3bHMhTus 662Q== X-Gm-Message-State: AOJu0YxZ5duhh7LMraHgchSyvKgcf1LSwfY65JJbQ7iTM3vNRhU7Aswa zhP7UxM8h2EnE9mkcgQpYUf4WA== X-Google-Smtp-Source: AGHT+IFzdsOma789YoYIqNlEWSHsVOo4MY3nL3Bm2raRGojctRYEa1C8zFwzyzMV64T9ySEvTNEBew== X-Received: by 2002:a17:907:9724:b0:9bd:f3b0:c087 with SMTP id jg36-20020a170907972400b009bdf3b0c087mr1012118ejc.2.1697797280569; Fri, 20 Oct 2023 03:21:20 -0700 (PDT) Received: from fedora.. (dh207-96-32.xnet.hr. [88.207.96.32]) by smtp.googlemail.com with ESMTPSA id e27-20020a170906749b00b009a198078c53sm1204693ejl.214.2023.10.20.03.21.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 03:21:19 -0700 (PDT) From: Robert Marko To: sr@denx.de, u-boot@lists.denx.de Cc: Robert Marko Subject: [PATCH v2 1/3] arm: mvebu: Espressobin: move FDT fixup into a separate function Date: Fri, 20 Oct 2023 12:20:53 +0200 Message-ID: <20231020102117.1583572-1-robert.marko@sartura.hr> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 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 Currently, Esspresobin FDT is being fixed up directly in ft_board_setup() which makes it hard to add support for any other board to be fixed up. So, lets just move the FDT fixup code to a separate function and call it if compatible matches, there should be no functional change. Signed-off-by: Robert Marko Reviewed-by: Stefan Roese --- board/Marvell/mvebu_armada-37xx/board.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c index 04124d8014..1471caa9a6 100644 --- a/board/Marvell/mvebu_armada-37xx/board.c +++ b/board/Marvell/mvebu_armada-37xx/board.c @@ -363,18 +363,14 @@ EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init); #endif #ifdef CONFIG_OF_BOARD_SETUP -int ft_board_setup(void *blob, struct bd_info *bd) +static int espressobin_fdt_setup(void *blob) { -#ifdef CONFIG_ENV_IS_IN_SPI_FLASH int ret; int spi_off; int parts_off; int part_off; /* Fill SPI MTD partitions for Linux kernel on Espressobin */ - if (!of_machine_is_compatible("globalscale,espressobin")) - return 0; - spi_off = fdt_node_offset_by_compatible(blob, -1, "jedec,spi-nor"); if (spi_off < 0) return 0; @@ -459,6 +455,14 @@ int ft_board_setup(void *blob, struct bd_info *bd) return 0; } + return 0; +} + +int ft_board_setup(void *blob, struct bd_info *bd) +{ +#ifdef CONFIG_ENV_IS_IN_SPI_FLASH + if (of_machine_is_compatible("globalscale,espressobin")) + return espressobin_fdt_setup(blob); #endif return 0; } From patchwork Fri Oct 20 10:20:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 1852425 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=sartura.hr header.i=@sartura.hr header.a=rsa-sha256 header.s=sartura header.b=rBD7H2bj; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SBgc70Km9z23jq for ; Fri, 20 Oct 2023 21:21:43 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CF01E86EFD; Fri, 20 Oct 2023 12:21:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=sartura.hr 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=sartura.hr header.i=@sartura.hr header.b="rBD7H2bj"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 354C087481; Fri, 20 Oct 2023 12:21:25 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) (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 74FD487469 for ; Fri, 20 Oct 2023 12:21:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=sartura.hr Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=robert.marko@sartura.hr Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-53dd3f169d8so864747a12.3 for ; Fri, 20 Oct 2023 03:21:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sartura.hr; s=sartura; t=1697797282; x=1698402082; darn=lists.denx.de; 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=9qfYEZyRAjVnQUY0HQ8yI5/v6WUBIN6sIU0c/uefkD4=; b=rBD7H2bjkOiVeorKuPX0xHJNL/2+LQ7sgWyiqYvvvQzvXpHqDKXWiN7p4rSCD2xnmZ RRZR2LC8OI+tuzZ96WOCESlR9+kw7t1RAgPO99WxZgGzw0sNjTotORTWcKzB4X0z6k9z gDPSOtQvr3ww6nWMChEVjbqIMHspDcBqt6LAJrx0RBp2UyvxQvevhBi+iLDWnmiKldBz y/q5w32Nz/rNE/S4globdHxxiupuy05XBaEuxyiPegkIBNR9QyIOF21/0JovSdlDobCj qEnKNpxX8YIjnbYjfNVy2i0/T/uUQdIelj3FZP0tECErsSvB84EsCuFXkp8XiyGwokr5 WdBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697797282; x=1698402082; 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=9qfYEZyRAjVnQUY0HQ8yI5/v6WUBIN6sIU0c/uefkD4=; b=WJ8b/4fwRnudthWIAjNsbIc5KG/mU7cVDV3QAFncELuVp86PXIjH3XSgoVnNWqUhmX p87HlcSKKWlhtHcdzVkKnJ1PI5mlJiQYkHma3xBw+W7NH4phmARAXfTjfN8bzUYzUApk LKotyfFXlr0qU/9i6DmQ51kA9IOuDRQDLkqHm3zOBYMBpIMHNLi/NLHwIdg2VYG1pkAe kCND4lr8Mfe9LlkLB/BUdwOOu8C6J6dicftre0qxtQwQIaWI0D6uSwVHPapiLp7kTwfM mmTBuo9mSOxGYt5+7oSVgVjcpidbpWLFDOj01P1Uyk0uGlDSDSbQKW7j2ZjVeAY7S5UZ Xz4Q== X-Gm-Message-State: AOJu0Yx1byI+E6gBMcl9pUkP33EZDmPqkoW5iNBB/iX/bwil+IRCN+0z m/f71IqIAdix5c64itq3OwarNteeHFxObz+fnLs= X-Google-Smtp-Source: AGHT+IG18P2jNyKsoQJ/rBZZCrDqKdYnQ0zbB7VGb/RXDl5GA6BWdMZRlizBQ5ZkgI3d/WEffa8n1w== X-Received: by 2002:a17:907:36c1:b0:9be:a170:81d with SMTP id bj1-20020a17090736c100b009bea170081dmr963220ejc.25.1697797281822; Fri, 20 Oct 2023 03:21:21 -0700 (PDT) Received: from fedora.. (dh207-96-32.xnet.hr. [88.207.96.32]) by smtp.googlemail.com with ESMTPSA id e27-20020a170906749b00b009a198078c53sm1204693ejl.214.2023.10.20.03.21.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 03:21:21 -0700 (PDT) From: Robert Marko To: sr@denx.de, u-boot@lists.denx.de Cc: Robert Marko Subject: [PATCH v2 2/3] arm: mvebu: Espressobin: move network setup into a separate function Date: Fri, 20 Oct 2023 12:20:54 +0200 Message-ID: <20231020102117.1583572-2-robert.marko@sartura.hr> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231020102117.1583572-1-robert.marko@sartura.hr> References: <20231020102117.1583572-1-robert.marko@sartura.hr> MIME-Version: 1.0 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 Currently, Esspresobin switch is being setup directly in last_stage_init() which makes it hard to add support for any other board to be setup. So, lets just move the switch setup code to a separate function and call it if compatible matches, there should be no functional change. Signed-off-by: Robert Marko Reviewed-by: Stefan Roese --- Changes in v2: * Rebase on top of current master and resolve conflicts board/Marvell/mvebu_armada-37xx/board.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c index 1471caa9a6..f532486b70 100644 --- a/board/Marvell/mvebu_armada-37xx/board.c +++ b/board/Marvell/mvebu_armada-37xx/board.c @@ -301,14 +301,12 @@ static int mii_multi_chip_mode_write(struct udevice *bus, int dev_smi_addr, return 0; } -/* Bring-up board-specific network stuff */ -static int last_stage_init(void) +static int espressobin_last_stage_init(void) { struct udevice *bus; ofnode node; - if (!CONFIG_IS_ENABLED(DM_MDIO) || - !of_machine_is_compatible("globalscale,espressobin")) + if (!CONFIG_IS_ENABLED(DM_MDIO)) return 0; node = ofnode_by_compatible(ofnode_null(), "marvell,orion-mdio"); @@ -358,8 +356,17 @@ static int last_stage_init(void) return 0; } -EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init); +/* Bring-up board-specific network stuff */ +static int last_stage_init(void) +{ + + if (of_machine_is_compatible("globalscale,espressobin")) + return espressobin_last_stage_init(); + + return 0; +} +EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init); #endif #ifdef CONFIG_OF_BOARD_SETUP From patchwork Fri Oct 20 10:20:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 1852426 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=sartura.hr header.i=@sartura.hr header.a=rsa-sha256 header.s=sartura header.b=FDKY+9Hz; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SBgcD3tMxz23jq for ; Fri, 20 Oct 2023 21:21:48 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3D43C87488; Fri, 20 Oct 2023 12:21:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=sartura.hr 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=sartura.hr header.i=@sartura.hr header.b="FDKY+9Hz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CA5BD87469; Fri, 20 Oct 2023 12:21:25 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) (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 D275280F06 for ; Fri, 20 Oct 2023 12:21:23 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=sartura.hr Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=robert.marko@sartura.hr Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-991c786369cso99743166b.1 for ; Fri, 20 Oct 2023 03:21:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sartura.hr; s=sartura; t=1697797283; x=1698402083; darn=lists.denx.de; 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=+KVLbCyuuu61IBmb1+yGoQUkko3ipX0YBEu2ka5e53Y=; b=FDKY+9HzDwewu9mwXYnbDuUyygU1DeBmySa9lX6Ba0cod2/iRwTVe93jL2p5DFaPls wFbJinaBcSNC3B2ueX+qwA5qaCjZz/wOGnmTja27kfKdZTxXczLKBI4VhKSbRjEcrGjH DMadSbKEPYVn0p6ytHzMW0m9818YIrM5Zx9gewqUgSNvR50BqkpUPyh/zOP5A1CNaqGR A4Y+0R84u2aPPOC3AjQsT9evPnmWaZMx3btAOMHHIVbG4hOkTh+gCtmdHxUc+FgLC+G/ VgYVlk/je+wievRQwDLew9qMUTDlf9h/A7VW7EddYC/ALALJkUqJTIp/ZIkhbAZqP8Hz AG8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697797283; x=1698402083; 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=+KVLbCyuuu61IBmb1+yGoQUkko3ipX0YBEu2ka5e53Y=; b=bDuExTzLU6Srd/oq4G2K3tMDx+L8J0P2d49pitG1+E5NDFRoNatLADdu2SoYDv+LSi jS2aIm+dcX4nded+BWpMCvdEIX5q3dzsnR6+/+v4f3EDUDcSxKJtO395ykWggBlFuxYq Y6Z1zyc3TrFII63VAvfIdOosrtUyNR/ik1XVOzbYXwZ7DMZd/aCQzXm/1LUt/n2dLt4K IOnpPlY9mkjJVdnp7slQSNWPm3bi4YHbDQfWIivxfCAf9g8e8FNfwmho3yx0mb9T4P/t GEBQMcINskEB6i7wXJKvTxgzErVLw/30QM0+6AvlzS6wg8ykBwZPY+1I2dsdtxkH7fxK EZAg== X-Gm-Message-State: AOJu0Yzy+PV4QCiTyJDi6Yjthi5/MFSjagS8e/gCtFoQSk4QZP3vAkhD q7Bc8kkVQ6CJAx4h/Md+9m485zC0qNoRw3WN1XA= X-Google-Smtp-Source: AGHT+IE8xhgGt3OsizT2bJOKxZBT1pB7J6UewZMOuE8CcmGXpfqGbrXIwzOvmzC0yUkdS/IKoxmfHw== X-Received: by 2002:a17:907:26c2:b0:9ae:6ffd:bdf7 with SMTP id bp2-20020a17090726c200b009ae6ffdbdf7mr1072712ejc.39.1697797283268; Fri, 20 Oct 2023 03:21:23 -0700 (PDT) Received: from fedora.. (dh207-96-32.xnet.hr. [88.207.96.32]) by smtp.googlemail.com with ESMTPSA id e27-20020a170906749b00b009a198078c53sm1204693ejl.214.2023.10.20.03.21.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 03:21:22 -0700 (PDT) From: Robert Marko To: sr@denx.de, u-boot@lists.denx.de Cc: Robert Marko Subject: [PATCH v2 3/3] arm: mvebu: eDPU: support new board revision Date: Fri, 20 Oct 2023 12:20:55 +0200 Message-ID: <20231020102117.1583572-3-robert.marko@sartura.hr> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231020102117.1583572-1-robert.marko@sartura.hr> References: <20231020102117.1583572-1-robert.marko@sartura.hr> MIME-Version: 1.0 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 There is a new eDPU revision that uses Marvell 88E6361 switch onboard. We can rely on detecting the switch to enable and fixup the Linux DTS so a single DTS can be used. There is currently no support for the 88E6361 switch and thus no working networking in U-Boot, so we disable both ports. Signed-off-by: Robert Marko Reviewed-by: Stefan Roese --- arch/arm/dts/armada-3720-eDPU-u-boot.dtsi | 13 ++- arch/arm/dts/armada-3720-eDPU.dts | 47 ++++++++ board/Marvell/mvebu_armada-37xx/board.c | 125 ++++++++++++++++++++++ configs/eDPU_defconfig | 1 + 4 files changed, 181 insertions(+), 5 deletions(-) diff --git a/arch/arm/dts/armada-3720-eDPU-u-boot.dtsi b/arch/arm/dts/armada-3720-eDPU-u-boot.dtsi index cb02b70e54..c3d450dd83 100644 --- a/arch/arm/dts/armada-3720-eDPU-u-boot.dtsi +++ b/arch/arm/dts/armada-3720-eDPU-u-boot.dtsi @@ -32,14 +32,17 @@ bootph-all; }; -ð0 { - /* G.hn does not work without additional configuration */ - status = "disabled"; -}; - ð1 { fixed-link { speed = <1000>; full-duplex; }; }; + +/* + * eDPU v2 has a MV88E6361 switch on the MDIO bus and U-boot is used + * to patch the Linux DTS if its found so enable MDIO by default. + */ +&mdio { + status = "okay"; +}; diff --git a/arch/arm/dts/armada-3720-eDPU.dts b/arch/arm/dts/armada-3720-eDPU.dts index 57fc698e55..d6d37a1f6f 100644 --- a/arch/arm/dts/armada-3720-eDPU.dts +++ b/arch/arm/dts/armada-3720-eDPU.dts @@ -12,3 +12,50 @@ ð0 { phy-mode = "2500base-x"; }; + +/* + * External MV88E6361 switch is only available on v2 of the board. + * U-Boot will enable the MDIO bus and switch nodes. + */ +&mdio { + status = "disabled"; + pinctrl-names = "default"; + pinctrl-0 = <&smi_pins>; + + /* Actual device is MV88E6361 */ + switch: switch@0 { + compatible = "marvell,mv88e6190"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + status = "disabled"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "cpu"; + phy-mode = "2500base-x"; + managed = "in-band-status"; + ethernet = <ð0>; + }; + + port@9 { + reg = <9>; + label = "downlink"; + phy-mode = "2500base-x"; + managed = "in-band-status"; + }; + + port@a { + reg = <10>; + label = "uplink"; + phy-mode = "2500base-x"; + managed = "in-band-status"; + sfp = <&sfp_eth1>; + }; + }; + }; +}; diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c index f532486b70..aeddff7468 100644 --- a/board/Marvell/mvebu_armada-37xx/board.c +++ b/board/Marvell/mvebu_armada-37xx/board.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -50,6 +51,7 @@ DECLARE_GLOBAL_DATA_PTR; /* Single-chip mode */ /* Switch Port Registers */ #define MVEBU_SW_LINK_CTRL_REG (1) +#define MVEBU_SW_PORT_SWITCH_ID (3) #define MVEBU_SW_PORT_CTRL_REG (4) #define MVEBU_SW_PORT_BASE_VLAN (6) @@ -57,6 +59,8 @@ DECLARE_GLOBAL_DATA_PTR; #define MVEBU_G2_SMI_PHY_CMD_REG (24) #define MVEBU_G2_SMI_PHY_DATA_REG (25) +#define SWITCH_88E6361_PRODUCT_NUMBER 0x2610 + /* * Memory Controller Registers * @@ -73,6 +77,27 @@ DECLARE_GLOBAL_DATA_PTR; #define A3700_MC_CTRL2_SDRAM_TYPE_DDR3 2 #define A3700_MC_CTRL2_SDRAM_TYPE_DDR4 3 +static bool is_edpu_plus(void) +{ + struct udevice *bus; + ofnode node; + int val; + + node = ofnode_by_compatible(ofnode_null(), "marvell,orion-mdio"); + if (!ofnode_valid(node) || + uclass_get_device_by_ofnode(UCLASS_MDIO, node, &bus) || + device_probe(bus)) { + printf("Cannot find MDIO bus\n"); + return -ENODEV; + } + + val = dm_mdio_read(bus, 0x0, MDIO_DEVAD_NONE, MVEBU_SW_PORT_SWITCH_ID); + if (val == SWITCH_88E6361_PRODUCT_NUMBER) + return true; + else + return false; +} + int board_early_init_f(void) { return 0; @@ -357,6 +382,41 @@ static int espressobin_last_stage_init(void) return 0; } +static int edpu_plus_last_stage_init(void) +{ + struct udevice *dev; + int ret; + + if (is_edpu_plus()) { + ret = uclass_get_device_by_name(UCLASS_ETH, + "ethernet@40000", + &dev); + if (!ret) { + device_remove(dev, DM_REMOVE_NORMAL); + device_unbind(dev); + } + + /* Currently no networking support on the eDPU+ board */ + ret = uclass_get_device_by_name(UCLASS_ETH, + "ethernet@30000", + &dev); + if (!ret) { + device_remove(dev, DM_REMOVE_NORMAL); + device_unbind(dev); + } + } else { + ret = uclass_get_device_by_name(UCLASS_ETH, + "ethernet@30000", + &dev); + if (!ret) { + device_remove(dev, DM_REMOVE_NORMAL); + device_unbind(dev); + } + } + + return 0; +} + /* Bring-up board-specific network stuff */ static int last_stage_init(void) { @@ -364,6 +424,9 @@ static int last_stage_init(void) if (of_machine_is_compatible("globalscale,espressobin")) return espressobin_last_stage_init(); + if (of_machine_is_compatible("methode,edpu")) + return edpu_plus_last_stage_init(); + return 0; } EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init); @@ -465,12 +528,74 @@ static int espressobin_fdt_setup(void *blob) return 0; } +static int edpu_plus_fdt_setup(void *blob) +{ + const char *ports[] = { "downlink", "uplink" }; + uint8_t mac[ETH_ALEN]; + const char *path; + int i, ret; + + if (is_edpu_plus()) { + ret = fdt_set_status_by_compatible(blob, + "marvell,orion-mdio", + FDT_STATUS_OKAY); + if (ret) + printf("Failed to enable MDIO!\n"); + + ret = fdt_set_status_by_alias(blob, + "ethernet1", + FDT_STATUS_DISABLED); + if (ret) + printf("Failed to disable ethernet1!\n"); + + path = fdt_get_alias(blob, "ethernet0"); + if (path) + do_fixup_by_path_string(blob, path, "phy-mode", "2500base-x"); + else + printf("Failed to update ethernet0 phy-mode to 2500base-x!\n"); + + ret = fdt_set_status_by_compatible(blob, + "marvell,mv88e6190", + FDT_STATUS_OKAY); + if (ret) + printf("Failed to enable MV88E6361!\n"); + + /* + * MAC-s for Uplink and Downlink ports are stored under + * non standard variable names, so lets manually fixup the + * switch port nodes to have the desired MAC-s. + */ + for (i = 0; i < 2; i++) { + if (eth_env_get_enetaddr(ports[i], mac)) { + do_fixup_by_prop(blob, + "label", + ports[i], + strlen(ports[i]) + 1, + "mac-address", + mac, ARP_HLEN, 1); + + do_fixup_by_prop(blob, + "label", + ports[i], + strlen(ports[i]) + 1, + "local-mac-address", + mac, ARP_HLEN, 1); + } + } + } + + return 0; +} + int ft_board_setup(void *blob, struct bd_info *bd) { #ifdef CONFIG_ENV_IS_IN_SPI_FLASH if (of_machine_is_compatible("globalscale,espressobin")) return espressobin_fdt_setup(blob); #endif + if (of_machine_is_compatible("methode,edpu")) + return edpu_plus_fdt_setup(blob); + return 0; } #endif diff --git a/configs/eDPU_defconfig b/configs/eDPU_defconfig index f51df7861a..6bd28f9a1a 100644 --- a/configs/eDPU_defconfig +++ b/configs/eDPU_defconfig @@ -17,6 +17,7 @@ CONFIG_DEBUG_UART=y CONFIG_FIT=y CONFIG_FIT_VERBOSE=y CONFIG_DISTRO_DEFAULTS=y +CONFIG_OF_BOARD_SETUP=y CONFIG_USE_PREBOOT=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set