Received: by 2002:a05:7412:d008:b0:f9:6acb:47ec with SMTP id bd8csp40484rdb; Tue, 19 Dec 2023 08:50:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IHPv0zERbTWRf6BmeqiK71gI6mQjte4q+xKP2eaP1TylKf8aZ2KOCfCtwwGDZWfhqU5AcGr X-Received: by 2002:ad4:5dca:0:b0:67f:13e3:c24d with SMTP id m10-20020ad45dca000000b0067f13e3c24dmr9700253qvh.102.1703004641968; Tue, 19 Dec 2023 08:50:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703004641; cv=none; d=google.com; s=arc-20160816; b=TV41RG5aEPBB/+ArkuuKwxzfAgPLbArCjy/b7AG97nWxTglNjvapSRY9pmahvnteeR 4iRHtTBgCYECf3SAD5zIJOSddtWB/lK79qomIe2i3BoJK4tup1CPKejAs/Brvjgs7aEO rTFv8yOenKvChcPfgt1byx1w+UNKjiVKsZrfNDzht7RKhLs09b/JVA0Rqz215KNECMKq Mi6yY6HCKqxj4uhrv5M6ZzFiqAmNN+StswdM89LSlNXI8xwRnkwB/x/oTBUIoQzjJjVF QZkyVqmIh5t2jbv474u2/4ijV65puYQBSpmCphqBy+x9g2LrK7qR4Q3OKkNcw6+sVPbS 2HUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=0Vtfp1n5W07I5diIldXnV7yLLvDEpoH/ZlZNFRclQDk=; fh=/qi2U4DnazFy7ZonNfnFlckwBA3aPenaqLhq6Ab/z5c=; b=w/W78BE/gpfgpVmJiQqC7ml02m1Nt6B7TNA97WeV7149ckWuuH637WqJEVN6KM+9kH 6Nl73OHqrwMM+Vc+/AugNjRo1lIHtWe+vLQEcN88EDAiRoLVpk6vpW2AGVZeX2dtG/Ob yHnQEeseUnlDZxcEEmkImjitQItyVVyBPj7AAVO6Q5SvRl3xrZy+qY4XqVvBhQxG3anm ibSaQQWIRHSrW2ojWn8N2ocFFZjvLixC1yv7Aqxcd1JpQHXrLW97Oop2du8Q3ecpCR/l eh1KsLsYKwE36cwQK+P2ROgeo6m/l+1aeyD6n9rz44YlF1Wn15BHjNhu1sFSIsf3USg8 NQ8A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-5601-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5601-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id l20-20020a0ce094000000b0067f26db356dsi8458208qvk.73.2023.12.19.08.50.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 08:50:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5601-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-5601-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5601-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B0FCA1C243D8 for ; Tue, 19 Dec 2023 16:50:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E1146224E2; Tue, 19 Dec 2023 16:49:50 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from mx01.omp.ru (mx01.omp.ru [90.154.21.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 339CD20DFE; Tue, 19 Dec 2023 16:49:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=omp.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=omp.ru Received: from [192.168.1.104] (178.176.72.19) by msexch01.omp.ru (10.188.4.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1258.12; Tue, 19 Dec 2023 19:49:30 +0300 Subject: Re: [PATCH net 1/2] net: ravb: Wait for operation mode to be applied To: claudiu beznea , , , , , , , , , , , , CC: , , References: <20231214113137.2450292-1-claudiu.beznea.uj@bp.renesas.com> <20231214113137.2450292-2-claudiu.beznea.uj@bp.renesas.com> <0b807496-f387-4aef-8650-a43a9249468f@tuxon.dev> From: Sergey Shtylyov Organization: Open Mobile Platform Message-ID: <2e70a095-8079-84f1-f842-eb90059610ed@omp.ru> Date: Tue, 19 Dec 2023 19:49:29 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <0b807496-f387-4aef-8650-a43a9249468f@tuxon.dev> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: msexch01.omp.ru (10.188.4.12) To msexch01.omp.ru (10.188.4.12) X-KSE-ServerInfo: msexch01.omp.ru, 9 X-KSE-AntiSpam-Interceptor-Info: scan successful X-KSE-AntiSpam-Version: 6.1.0, Database issued on: 12/19/2023 16:26:24 X-KSE-AntiSpam-Status: KAS_STATUS_NOT_DETECTED X-KSE-AntiSpam-Method: none X-KSE-AntiSpam-Rate: 59 X-KSE-AntiSpam-Info: Lua profiles 182235 [Dec 19 2023] X-KSE-AntiSpam-Info: Version: 6.1.0.3 X-KSE-AntiSpam-Info: Envelope from: s.shtylyov@omp.ru X-KSE-AntiSpam-Info: LuaCore: 7 0.3.7 6d6bf5bd8eea7373134f756a2fd73e9456bb7d1a X-KSE-AntiSpam-Info: {rep_avail} X-KSE-AntiSpam-Info: {Tracking_from_domain_doesnt_match_to} X-KSE-AntiSpam-Info: {relay has no DNS name} X-KSE-AntiSpam-Info: {SMTP from is not routable} X-KSE-AntiSpam-Info: omp.ru:7.1.1;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;178.176.72.19:7.7.3,7.4.1;127.0.0.199:7.1.2 X-KSE-AntiSpam-Info: {cloud_iprep_silent} X-KSE-AntiSpam-Info: ApMailHostAddress: 178.176.72.19 X-KSE-AntiSpam-Info: {DNS response errors} X-KSE-AntiSpam-Info: Rate: 59 X-KSE-AntiSpam-Info: Status: not_detected X-KSE-AntiSpam-Info: Method: none X-KSE-AntiSpam-Info: Auth:dmarc=temperror header.from=omp.ru;spf=temperror smtp.mailfrom=omp.ru;dkim=none X-KSE-Antiphishing-Info: Clean X-KSE-Antiphishing-ScanningType: Heuristic X-KSE-Antiphishing-Method: None X-KSE-Antiphishing-Bases: 12/19/2023 16:32:00 X-KSE-Antivirus-Interceptor-Info: scan successful X-KSE-Antivirus-Info: Clean, bases: 12/19/2023 2:00:00 PM X-KSE-Attachment-Filter-Triggered-Rules: Clean X-KSE-Attachment-Filter-Triggered-Filters: Clean X-KSE-BulkMessagesFiltering-Scan-Result: InTheLimit On 12/15/23 1:04 PM, claudiu beznea wrote: [...] >>> From: Claudiu Beznea >>> >>> CSR.OPS bits specify the current operating mode and (according to >>> documentation) they are updated when the operating mode change request >>> is processed. Thus, check CSR.OPS before proceeding. >> >> The manuals I have indeed say we need to check CSR.OPS... But we only >> need to wait iff we transfer from the operation mode to the config mode... > > RZ/G3S manual say about CSR.OPS "These bits are updated when an operating I was unable to find the RZ/G3 manuals on ther Renesas' website... :-( > mode changes is processed". From this I get we need to check it for any mode. I don't argue with the (safety) checking of CSR.OPS, I was just pointing out that the R-Car gen3 manual says that only transfer from operation to the config mode happens after a considerable amount of time, other transfers do happen immediately after updating CCC.OPC. > Also, on configuration procedure (of RZ/G3S) it say CSR.OPS need to be > checked when switching from reset -> config. Just checked or waited on? The R-car does have a specific algorithm for transferring from the operation to the reset mode (you need to set CC.DTSR first and then wait for CSR.DTS to clear before updating CCC.OPC)... [...] >>> Signed-off-by: Claudiu Beznea >>> --- >>> drivers/net/ethernet/renesas/ravb_main.c | 47 ++++++++++++++++++++---- >>> 1 file changed, 39 insertions(+), 8 deletions(-) >>> >>> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c >>> index 9178f6d60e74..ce95eb5af354 100644 >>> --- a/drivers/net/ethernet/renesas/ravb_main.c >>> +++ b/drivers/net/ethernet/renesas/ravb_main.c [...] >>> @@ -1744,6 +1747,18 @@ static inline int ravb_hook_irq(unsigned int irq, irq_handler_t handler, >>> return error; >>> } >>> >>> +static int ravb_set_reset_mode(struct net_device *ndev) >>> +{ >>> + int error; >>> + >>> + ravb_write(ndev, CCC_OPC_RESET, CCC); >>> + error = ravb_wait(ndev, CSR, CSR_OPS, CSR_OPS_RESET); >>> + if (error) >>> + netdev_err(ndev, "failed to switch device to reset mode\n"); >>> + >>> + return error; >>> +} >>> + >> >> Again, ravb_wait() call doesn't seem necessary here... > > Ok. I followed the guideline from the description of CSR.OPS. Let me know > if you want to keep it or not. I think I haven't saw any issues w/o this. Yes, please remove the waiting. [...] MBR, Sergey