From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9B98C47082 for ; Tue, 8 Jun 2021 09:49:53 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 0BFD161008 for ; Tue, 8 Jun 2021 09:49:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0BFD161008 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5CED182E68; Tue, 8 Jun 2021 11:49:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org 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=kernel.org header.i=@kernel.org header.b="SS9+A74u"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9A68082E85; Tue, 8 Jun 2021 11:49:49 +0200 (CEST) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5BAF082D73 for ; Tue, 8 Jun 2021 11:49:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: by mail.kernel.org (Postfix) with ESMTPSA id CB39861185; Tue, 8 Jun 2021 09:49:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1623145783; bh=JYUC+K1gYuyGo9uYSsNhLzSk6MtQabzWV3d8yurwYYE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SS9+A74uYsXfEG30I4uOCYywCNPAdlEscTj/45pG9jlP1E/9Zw3eD2MEBNbZrbWHJ dsREE2Q6Z5Alfb1ZqNOHKKF9Je13sHcvCsIDJK/MAb1Bhu22I9+IKXrE+vNNCYFb9a YDwJ/WKzoCGYC2KdDpIhNV7wCdNddqKyrj2GV8xjBu7feCCIWSBNS3eEsXQ8ioniET e0HJYxLPnyXhreNJewumQMAHeuatqP2lyNHjZN7B+14GCiJ95usDLvNPMyfv9SX9jO 5RC0SCbnyhj+bZaHocQqz1sGyUlHJzXcvxnKunEgyKUH9rAik4OH5TdQc1JaPbhDNp 55t/oYNz84kew== Received: by pali.im (Postfix) id AD5827CC; Tue, 8 Jun 2021 11:49:41 +0200 (CEST) Date: Tue, 8 Jun 2021 11:49:41 +0200 From: Pali =?utf-8?B?Um9ow6Fy?= To: Marek =?utf-8?B?QmVow7pu?= Cc: Stefan Roese , u-boot@lists.denx.de Subject: Re: [PATCH u-boot-marvell v2 3/6] arm: mvebu: turris_mox: start blinking PHY LEDs when entering rescue Message-ID: <20210608094941.luv7zii7typbykxp@pali> References: <20210607143451.5343-1-marek.behun@nic.cz> <20210607143451.5343-4-marek.behun@nic.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210607143451.5343-4-marek.behun@nic.cz> User-Agent: NeoMutt/20180716 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.4 at phobos.denx.de X-Virus-Status: Clean On Monday 07 June 2021 16:34:48 Marek Behún wrote: > Configure blinking on ethernet PHY LEDs on the MOX A board when entering > rescue mode via reset button. > > Signed-off-by: Marek Behún Reviewed-by: Pali Rohár > --- > board/CZ.NIC/turris_mox/turris_mox.c | 35 ++++++++++++++++++++++++++++ > 1 file changed, 35 insertions(+) > > diff --git a/board/CZ.NIC/turris_mox/turris_mox.c b/board/CZ.NIC/turris_mox/turris_mox.c > index a78f33661e..44c272c7cb 100644 > --- a/board/CZ.NIC/turris_mox/turris_mox.c > +++ b/board/CZ.NIC/turris_mox/turris_mox.c > @@ -377,6 +377,38 @@ int misc_init_r(void) > return 0; > } > > +static void mox_phy_modify(struct phy_device *phydev, int page, int reg, > + u16 mask, u16 set) > +{ > + int val; > + > + val = phydev->drv->readext(phydev, MDIO_DEVAD_NONE, page, reg); > + val &= ~mask; > + val |= set; > + phydev->drv->writeext(phydev, MDIO_DEVAD_NONE, page, reg, val); > +} > + > +static void mox_phy_leds_start_blinking(void) > +{ > + struct phy_device *phydev; > + struct mii_dev *bus; > + > + bus = miiphy_get_dev_by_name("neta@30000"); > + if (!bus) { > + printf("Cannot get MDIO bus device!\n"); > + return; > + } > + > + phydev = phy_find_by_mask(bus, BIT(1), PHY_INTERFACE_MODE_RGMII); > + if (!phydev) { > + printf("Cannot get ethernet PHY!\n"); > + return; > + } > + > + mox_phy_modify(phydev, 3, 0x12, 0x700, 0x400); > + mox_phy_modify(phydev, 3, 0x10, 0xff, 0xbb); > +} > + > static bool read_reset_button(void) > { > struct udevice *button, *led; > @@ -424,6 +456,9 @@ static void handle_reset_button(void) > /* Ensure bootcmd_rescue is used by distroboot */ > env_set("boot_targets", "rescue"); > > + /* start blinking PHY LEDs */ > + mox_phy_leds_start_blinking(); > + > printf("RESET button was pressed, overwriting boot_targets!\n"); > } else { > /* > -- > 2.31.1 >