Received: by 10.192.165.148 with SMTP id m20csp1779377imm; Thu, 3 May 2018 05:24:26 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrlUgmL/osUfpu8I9GJGxSeJykqwpW1ZWMChcMBCxc7ipV/ZjwaP2+eP30oIJ9P7x6MaSQE X-Received: by 2002:a65:4542:: with SMTP id x2-v6mr19562087pgr.24.1525350266056; Thu, 03 May 2018 05:24:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525350266; cv=none; d=google.com; s=arc-20160816; b=0lreJqrdvIv2/Wg+tu2GtthrM81D2HXlpAhOULZ5+kxgSuSvDm+69FXOznnG/E7vRv uYJPASrFx9AiVo0/QFOa1jWJqWKw6rdxmzA8ts4CFFMgDIJz8lCdH/R9yDdksM1Zvabb ++wnV73VNjV+G5Q3bu3sB8KnDHhu8znRNDrzMlnast7fl+z+4ELA3Wzzr4bsvzWNloNL Z01jrIK3YX1Cu/Atx99FC/dvDDm7nTBFun0a9LKFblU1l9NRsG2yd3fXwJtiLqXbtugR OI2c3SS2atXBD6u44ZN+FHBsGS3I2ODkQnuMC0+nxE//rkih1bcURUWAwl/ecSS7iIbp hxFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=2UzGzBtW4fDpQ3AeaDJVe8U5ixiKytQdKemAl/ZB6As=; b=0L17+zdWljaCmW+uVpIk29Wa+G+rHEROk7KQ+/MkE450FnUy2qXXmnSqmF84hs0L51 E2w2zBzFj8wNRE6NSsq7YSCLpDCRTSwR/Z9AMBpnQzLLHDVJg4VNmBjEhSumIEO44HIJ JGI1rIUtjdahI74cV4pwF0L+Z8zgvf3Po+9pLiMcRpd6mrt8rJHfG6jooaKviQEpyj7k oNMVKyewt366BBQOYt9dEqqLTg53vQMvYFPUXCaGB8rb6gFm3AYIflOJohzVPfsAibdy laUhtPNpm81z4kOowmKk5/WDuQ+M7wDyVp6c0oF2RNaU/iYJHmHsl5w2RNd5mO3tBpSw JpVA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c129si13305088pfc.367.2018.05.03.05.24.12; Thu, 03 May 2018 05:24:26 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751917AbeECMXO (ORCPT + 99 others); Thu, 3 May 2018 08:23:14 -0400 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:62848 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751360AbeECMXL (ORCPT ); Thu, 3 May 2018 08:23:11 -0400 X-IronPort-AV: E=Sophos;i="5.49,358,1520924400"; d="scan'208";a="11659498" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 03 May 2018 05:23:10 -0700 Received: from [10.145.6.85] (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Thu, 3 May 2018 05:23:09 -0700 Subject: Re: [RFC PATCH 4/5] net: macb: Add support for suspend/resume with full power down To: Harini Katakam CC: Nicolas Ferre , David Miller , , , , References: <1521726700-22634-1-git-send-email-harinikatakamlinux@gmail.com> <1521726700-22634-5-git-send-email-harinikatakamlinux@gmail.com> <35d980af-b9d5-495e-88af-c4fc911b8429@microchip.com> From: Claudiu Beznea Message-ID: <585eabe8-aae4-cfd3-01aa-bad17197a28d@microchip.com> Date: Thu, 3 May 2018 15:23:06 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03.05.2018 14:20, Harini Katakam wrote: > Hi Claudiu, > > On Thu, May 3, 2018 at 3:39 PM, Claudiu Beznea > wrote: >> >> >> On 22.03.2018 15:51, harinikatakamlinux@gmail.com wrote: >>> From: Harini Katakam >>> >>> When macb device is suspended and system is powered down, the clocks >>> are removed and hence macb should be closed gracefully and restored >>> upon resume. >> >> Is this a power saving mode which shut down the core? > > The Ethernet IP is suspended and a majority of the SoC is shut down, yes. > > >>> + netif_device_detach(netdev); >>> + } else { >>> + netif_device_detach(netdev); >>> + for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) >>> + napi_disable(&queue->napi); >>> + phy_stop(netdev->phydev); >>> + phy_suspend(netdev->phydev); >>> + spin_lock_irqsave(&bp->lock, flags); >>> + macb_reset_hw(bp); >>> + spin_unlock_irqrestore(&bp->lock, flags); >> >> Wouldn't be simple to just call macb_close() here? > > >> >> Wouln't be simpler to call macb_open() here? > > No, I think that would be excessive for suspend. This does just > enough to put the IP into suspend and cut off clocks. > For ex., the RX and TX buffers are not freed and allocated again > in this cycle, just the buffer descriptors. > For me looks simpler to just call macb_close()/macb_open() in suspend/resume hooks. Maybe this doesn't fit to your needs... But most of the code you added in suspend/resume hooks is already present in macb_open()/macb_close(), except the TX/RX buffers alloc/free. SAMA5D2 also uses this IP. SAMA5d2 has a power saving mode where core power is cut off (including this IP). We are using macb_open()/macb_close() + restoring all few other registers after this (by calling macb_set_rx_mode() and a variant of macb_set_features() and few other registers). This is not yet mainlined. I was intending to send soon a version. Thank you, Claudiu > Regards, > Harini >