regulator: ti-abb: don't use devm_platform_ioremap_resource_byname for shared interrupt register
Message ID | 20240122170442.729374-1-romain.naour@smile.fr |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-33741-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2733335dyb; Mon, 22 Jan 2024 09:49:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IEL8NwtScxy+MStfmq5nVh7NSkZ5IBW4LgNjBblmV376JUdXYWCub/BCrwrosNwLDDwHkZo X-Received: by 2002:a17:90a:8584:b0:290:4c3c:4703 with SMTP id m4-20020a17090a858400b002904c3c4703mr1990037pjn.81.1705945745297; Mon, 22 Jan 2024 09:49:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705945745; cv=pass; d=google.com; s=arc-20160816; b=PsQTtBqwOT7uruySEq2J5PBKriP6/dA68ksmT/+QjhKMPveHuM38gIUWWFqdzWuqg6 UL8+TG9mLHFgEa8ODtOW6fNB/GG9rWLYk5SUnuDVHvKG0eUpfwfMIMKLmj16Dd/7oIhq e2fMe/KQQG3jy4/uULFtR7EKnDmv5Y0MYEzIwkGO3N2qEa4TdRn8emBHyLF1+L4D2lz7 xvDpN4bPOdgfEnfBjM9RZsk1/2XY0vO7d2yO96/u9nNg6AAM+hdsVKS+O1KyJS5RiYVn dxkU/49CLFnuvv7sfg323aruEesu/RlI1dVZ4WB8PYbt8iJit+WfGQYh+DkjHhEVIE53 3QvQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=gTJ/sgvQ4GGqRw4oAEwmS5hEHtXyaauT5zfJynWMNFI=; fh=08di48dxtI85AO/L1PecATU14ToSg+6vuo2LUp1Epfw=; b=uKn1R8GUOVrJUue1HRIrVHc8eaUtYPlFv7V4IbjXCd5a8p9VYcLUB2IHhIZeeX7grv EkO7JOehZ4yEpOGTOScnLEqZjaTq+FQPINfM66M6yrfG/s7vlDYr8Tr6WWyNPOCmQvo5 hrwLd0wyy/GJJJn0Vl9gaSq5x+t0+0aJACAVNMOYgfDBLJNgoE9NMWXc+St6++V6Yt0D yfXm/rTwJ/UVrDeLQ0UdglSvbqUXmXIm1F04aZCoObw941WgeBPGZ5X8rb3eaqsvE/2V 5BVTbuA5YbMKBP4LAg5gmvd1ZwZE9oYmjzy+hy9h9QSo0zzo2RRBSfj28iz/gm/vGg74 xFFg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@smile-fr.20230601.gappssmtp.com header.s=20230601 header.b=NzcAb2+U; arc=pass (i=1 spf=pass spfdomain=smile.fr dkim=pass dkdomain=smile-fr.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-33741-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33741-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id ci7-20020a17090afc8700b0028d11002285si8256014pjb.49.2024.01.22.09.49.05 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 09:49:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33741-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@smile-fr.20230601.gappssmtp.com header.s=20230601 header.b=NzcAb2+U; arc=pass (i=1 spf=pass spfdomain=smile.fr dkim=pass dkdomain=smile-fr.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-33741-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33741-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 87CA928755D for <ouuuleilei@gmail.com>; Mon, 22 Jan 2024 17:43:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 26B8B482D3; Mon, 22 Jan 2024 17:04:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=smile-fr.20230601.gappssmtp.com header.i=@smile-fr.20230601.gappssmtp.com header.b="NzcAb2+U" Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 628E44655B for <linux-kernel@vger.kernel.org>; Mon, 22 Jan 2024 17:04:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705943090; cv=none; b=Yu9GCSItQeS9wEcLJE99JhKE2bYiNAMprFVhoxVlJbxx6WahtelouegNoxDpBMdD2OY3ZXjY0qaNEZOeVpmizi53rbnpOxm/d1iG7V8Rh9U7xtU7FFEb2al0j0c9oFxMxuAiZd3YstoMSMxuQYYkfKQPnczqsCmIDOd7egJlCKY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705943090; c=relaxed/simple; bh=+YlbBFs1br67U/+bf1Vk+lMHJ6zJydlsiLkLL/RlxLA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=kCpkmmLLk7GHO6+JpLmlPP++D4yFHxUNSx3lFYK6RTh1yG3wZgHoa5cm9DGQFEH6yDjxPEqn8rJkNSbDXArbo4CwvmFkDPV87Cy6putifdhjlo7AgbMhFyybz4AiGuNWkfDNMJfK9mV+GUMht7+5TmQQ4xbbfUPa0Oqp8YhzluE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=smile.fr; spf=pass smtp.mailfrom=smile.fr; dkim=pass (2048-bit key) header.d=smile-fr.20230601.gappssmtp.com header.i=@smile-fr.20230601.gappssmtp.com header.b=NzcAb2+U; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=smile.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=smile.fr Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-40eb2f3935eso1247645e9.2 for <linux-kernel@vger.kernel.org>; Mon, 22 Jan 2024 09:04:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smile-fr.20230601.gappssmtp.com; s=20230601; t=1705943085; x=1706547885; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=gTJ/sgvQ4GGqRw4oAEwmS5hEHtXyaauT5zfJynWMNFI=; b=NzcAb2+UIC35jL1KTsNaANpX0gBzwPjKzUgAIMmdFoQUbix7Zrs5LNyG36fDmSVz19 88MlJLJYhvpmEEjFXcXllscZ+Lo7YJkeXySSYwEqfWliuVChVFkeL4I9gBduBr6gn02E EE9rLNOUFSzPRyBhSqTZSEge8+uiDhf4eUQ2qbx0NoRycRklzl5kKp7t+1YAPhFoSbZC fbZGZcuNgpXKU121aqwqJ+ZtxEo1x+pV631xXSyCnEkVBP6V/HfN73tt2J2KpW5trcZZ SJrKMKJOE+hWKTYjGCnjuLHIl1gzpV/fNWinpFipk622ImL1Ps7HBRPXeVCStiwPj2gK EBuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705943085; x=1706547885; 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=gTJ/sgvQ4GGqRw4oAEwmS5hEHtXyaauT5zfJynWMNFI=; b=CWvUk5Jwswu9i9aQKh7MAxEZlTkynEb+0xdNWR+1zM4vLYChuaYC0kmwHVReeo3CKo pWFrb5jhHzoPnBrM3QmEeeQCKYZGQgcZspK4k07dDcF1k7bUWs207gPKtBbQuoy5w+vd CqmDznIQGpPwMCTzlJ/GYO5DWQNIBf2L6VoxZTUgTXSeTlZjgu0msvB4LTZD96o/SS1J KGUYtijquAXPVNFqUT3Bf4h86NEperNr8TSUuaQYrB9M++VGhr8ORqPYzhNvGC4EEE2O xASqPc5ugt7OcRyPxPhFbbXKXIuOgMqd3VSWHYBqNoJ8xYS1DOMhNHzCBHVmiYwLxkme 1Dcw== X-Gm-Message-State: AOJu0Yz68jgs1HcaHHR+fMzrK97+6QChn2aFhdSbi/+KkMj/YbSD7SD2 GyUZVVs6UDoy6T9Li3BhFaXcAOK7xJcZlCoQ8Nqb+3rZhbmtmZkK9MscgxPM3mRO9eckWtFkgdc v X-Received: by 2002:a05:600c:ad7:b0:40d:8f2d:199b with SMTP id c23-20020a05600c0ad700b0040d8f2d199bmr2105509wmr.84.1705943085590; Mon, 22 Jan 2024 09:04:45 -0800 (PST) Received: from P-NTS-Evian.home (2a01cb05945b7e009bdc688723a24f31.ipv6.abo.wanadoo.fr. [2a01:cb05:945b:7e00:9bdc:6887:23a2:4f31]) by smtp.gmail.com with ESMTPSA id p21-20020a05600c359500b0040e3488f16dsm39346047wmq.12.2024.01.22.09.04.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 09:04:45 -0800 (PST) From: Romain Naour <romain.naour@smile.fr> To: linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org Cc: tony@atomide.com, lgirdwood@gmail.com, broonie@kernel.org, Romain Naour <romain.naour@skf.com> Subject: [PATCH] regulator: ti-abb: don't use devm_platform_ioremap_resource_byname for shared interrupt register Date: Mon, 22 Jan 2024 18:04:42 +0100 Message-ID: <20240122170442.729374-1-romain.naour@smile.fr> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788813765608441270 X-GMAIL-MSGID: 1788813765608441270 |
Series |
regulator: ti-abb: don't use devm_platform_ioremap_resource_byname for shared interrupt register
|
|
Commit Message
Romain Naour
Jan. 22, 2024, 5:04 p.m. UTC
From: Romain Naour <romain.naour@skf.com> We can't use devm_platform_ioremap_resource_byname() to remap the interrupt register that can be shared between regulator-abb-{ivahd,dspeve,gpu} drivers instance. From arm/boot/dts/dra7.dtsi: The abb_mpu is the only instance using its own interrupt register: (0x4ae06014) PRM_IRQSTATUS_MPU_2, ABB_MPU_DONE_ST (bit 7) The other tree instance (abb_ivahd, abb_dspeve, abb_gpu) share PRM_IRQSTATUS_MPU register (0x4ae06010) but uses different bit ABB_IVA_DONE_ST (bit 30), ABB_DSPEVE_DONE_ST( bit 29) and ABB_GPU_DONE_ST (but 28). The commit b36c6b1887ff (regulator: ti-abb: Make use of the helper function devm_ioremap related) overlooked the following comment explaining why devm_ioremap() is used in this case: /* * We may have shared interrupt register offsets which are * write-1-to-clear between domains ensuring exclusivity. */ Fixes: [ 1.326660] ti_abb 4ae07e30.regulator-abb-dspeve: can't request region for resource [mem 0x4ae06010-0x4ae06013] [ 1.326660] ti_abb: probe of 4ae07e30.regulator-abb-dspeve failed with error -16 [ 1.327239] ti_abb 4ae07de4.regulator-abb-gpu: can't request region for resource [mem 0x4ae06010-0x4ae06013] [ 1.327270] ti_abb: probe of 4ae07de4.regulator-abb-gpu failed with error -16 This partially reverts commit b36c6b1887ffc6b58b556120bfbd511880515247. Signed-off-by: Romain Naour <romain.naour@skf.com> --- drivers/regulator/ti-abb-regulator.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
Comments
On Mon, Jan 22, 2024 at 06:04:42PM +0100, Romain Naour wrote: > We can't use devm_platform_ioremap_resource_byname() to remap the > interrupt register that can be shared between > regulator-abb-{ivahd,dspeve,gpu} drivers instance. ... > The commit b36c6b1887ff (regulator: ti-abb: Make use of the helper > function devm_ioremap related) overlooked the following comment > explaining why devm_ioremap() is used in this case: > /* > * We may have shared interrupt register offsets which are > * write-1-to-clear between domains ensuring exclusivity. > */ I have to say that I wouldn't infer from that comment that there is any reason why _byname() won't work - one would generally expect that a get_resource_by_name() followed by an ioremap() of that resource would be equivalent to the combined helper. Based on the commit log here I frankly have no idea what the issue is. You should also add something to the code which makes it clear what the issue is so the same conversion isn't performed again, assuming that the fix isn't in the helper. > > Fixes: You're missing the commit here. > This partially reverts commit b36c6b1887ffc6b58b556120bfbd511880515247. Please include human readable descriptions of things like commits and issues being discussed in e-mail in your mails, this makes them much easier for humans to read especially when they have no internet access. I do frequently catch up on my mail on flights or while otherwise travelling so this is even more pressing for me than just being about making things a bit easier to read.
Hello, Le 22/01/2024 à 18:30, Mark Brown a écrit : > On Mon, Jan 22, 2024 at 06:04:42PM +0100, Romain Naour wrote: > >> We can't use devm_platform_ioremap_resource_byname() to remap the >> interrupt register that can be shared between >> regulator-abb-{ivahd,dspeve,gpu} drivers instance. > > ... > >> The commit b36c6b1887ff (regulator: ti-abb: Make use of the helper >> function devm_ioremap related) overlooked the following comment >> explaining why devm_ioremap() is used in this case: > >> /* >> * We may have shared interrupt register offsets which are >> * write-1-to-clear between domains ensuring exclusivity. >> */ > > I have to say that I wouldn't infer from that comment that there is any > reason why _byname() won't work - one would generally expect that a > get_resource_by_name() followed by an ioremap() of that resource would > be equivalent to the combined helper. Based on the commit log here I > frankly have no idea what the issue is. You should also add something > to the code which makes it clear what the issue is so the same > conversion isn't performed again, assuming that the fix isn't in the > helper. I'm agree with you about the existing comment that is not really crystal clear. The combined helper introduce a call to devm_request_mem_region() that create a new busy resource region on PRM_IRQSTATUS_MPU register (0x4ae06010). The first devm_request_mem_region() call succeed for regulator-abb-ivahd but fail for the two other regulator-abb-dspeve and regulator-abb-gpu. Here is the iomem content without this patch: # cat /proc/iomem | grep -i 4ae06 4ae06010-4ae06013 : 4ae07e34.regulator-abb-ivahd int-address 4ae06014-4ae06017 : 4ae07ddc.regulator-abb-mpu int-address regulator-abb-dspeve and regulator-abb-gpu are missing due to devm_request_mem_region() failure (EBUSY) I don't know how to fix this issue keeping devm_platform_ioremap_resource_byname() when the same address is used several time... suggestion welcome. > >> >> Fixes: > > You're missing the commit here. > >> This partially reverts commit b36c6b1887ffc6b58b556120bfbd511880515247. > > Please include human readable descriptions of things like commits and > issues being discussed in e-mail in your mails, this makes them much > easier for humans to read especially when they have no internet access. > I do frequently catch up on my mail on flights or while otherwise > travelling so this is even more pressing for me than just being about > making things a bit easier to read. I added such human description above in the commit log but forgot to update this one, sorry. Thank you for the review. Best regards, Romain
diff --git a/drivers/regulator/ti-abb-regulator.c b/drivers/regulator/ti-abb-regulator.c index f48214e2c3b4..21392b9261f4 100644 --- a/drivers/regulator/ti-abb-regulator.c +++ b/drivers/regulator/ti-abb-regulator.c @@ -726,9 +726,22 @@ static int ti_abb_probe(struct platform_device *pdev) return PTR_ERR(abb->setup_reg); } - abb->int_base = devm_platform_ioremap_resource_byname(pdev, "int-address"); - if (IS_ERR(abb->int_base)) - return PTR_ERR(abb->int_base); + pname = "int-address"; + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, pname); + if (!res) { + dev_err(dev, "Missing '%s' IO resource\n", pname); + return -ENODEV; + } + /* + * We may have shared interrupt register offsets which are + * write-1-to-clear between domains ensuring exclusivity. + */ + abb->int_base = devm_ioremap(dev, res->start, + resource_size(res)); + if (!abb->int_base) { + dev_err(dev, "Unable to map '%s'\n", pname); + return -ENOMEM; + } /* Map Optional resources */ pname = "efuse-address";