Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2038959rdb; Tue, 20 Feb 2024 15:24:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW7zUTj5ujsaMXwBDWS3MRBqXKjDsIIVbPqmGpIz5mtOn7k77Lfh+YXCCgLMjxDqwlVZANNldnosQ7rqJJFTg/+p2xiSMUJ98NO8N0oIQ== X-Google-Smtp-Source: AGHT+IHLN/W1vMgcNcAEujhxx3/gYxci5Xq+baUVhzk2zuzXJ32s9mKTupHIqtM3sXjqiWejFd+6 X-Received: by 2002:a05:6358:6f0b:b0:178:6211:871 with SMTP id r11-20020a0563586f0b00b0017862110871mr19686405rwn.0.1708471489236; Tue, 20 Feb 2024 15:24:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708471489; cv=pass; d=google.com; s=arc-20160816; b=a9A/xNQqfE+EqfPUQ7ntZLXlVql4tIrEd9unao63mOKgeHqiCfgTNzZoAGevDaapai IqVzWypwt/++V3SgAJrNEEZ34RzW3C/L/QqEbOhqGIblUlpx8Lreoz+F6S5yjy3ReM08 FSTQSnaH5iC4i/msC3ajFE6Ivg/k+dBdCy6o2TgTJAY+yKw2voFNNQM/C8lztCpwoY9+ Ue4gl7PtuqmgCUa6n9tJ4A+q05HUpsdNji1tRMtXDgt3vV3QD0i03MFPrhE+i+7DMJZu ArC/3xDudRSqElpA/NONQ4AnohAbRUe9tRRa/ghJR3SrO4ahQt1x+FNDW0bGuZi4v9w+ qUlA== 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; bh=rVYNFb4dnaw+/NltKdzh8QCL1M+gDqbuKyyinsO5VDA=; fh=hXKRbtuACcTYJ9rkoxN4lTZkH1X8PXuHiOu2uuQw4Rg=; b=XpCt+4ffD1i7JYSIQV+/qVOtK09e1yekwsIWV8pNa74+235FJAdDRVydPFvlXSvRaM uV1b/rW+yBgsm3P0c3DaGRj5/aAlzH+hHi/mSm5CJg3oJaoFFytnw68vC7JKJmm5dnUb 5VUn0AO1T4twun7l61/pSyB5BpmsOP9mEkrMpwFWQA7ibQ6oLqE+DfTv+g63JBMBxKbI WziNCRGPGi8umuWS7S10v9lMKlXkOsPz2PK7SkES+GXP+zFhFH72YOimYyniHjOmqVL0 r8bk8P81y1hPoIXSAHQ/8sIq4MzAm14ehP0+J63Kin51FFj6pzE/HOG685j/NqMjy6g/ hIXQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-73821-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73821-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id p26-20020a63951a000000b005cdbf06a032si6784840pgd.716.2024.02.20.15.24.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 15:24:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-73821-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-73821-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73821-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 DEC2F2818FF for ; Tue, 20 Feb 2024 23:24:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AD651154457; Tue, 20 Feb 2024 23:24:44 +0000 (UTC) Received: from fgw22-7.mail.saunalahti.fi (fgw22-7.mail.saunalahti.fi [62.142.5.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6FE8678688 for ; Tue, 20 Feb 2024 23:24:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.142.5.83 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708471484; cv=none; b=Nn1+vnxmY5HzSuZRkLYrnZgp9MYQF/z5K13LL1YrRLiZQABVVjt/3/9SQpBvCqIwwN3hpNUFxGcxYOk0+4BmHQJAbbIYlGEORu8b8pyt8yRz7JP0TFcMSXJ5QV6G4rZ4F8pXHfwBiW/7EtYvQ0cDn2WjI63X9ksP/cv6N1rR4JE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708471484; c=relaxed/simple; bh=YzA2k/AdymtzIhBonHaiNWOg2C4Dk+kM9Xbi3ONFdlw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ewDN+awDELxuU0V6Atj0VwzlP/khvzFxu6U/TGqrnkkvjZ7UgVZIU+1CQmGSSzbHyQbXtdITtqCm0zj4z1wI3K4HVRXNisK3pK0irSTbwOkm8OL5DGehThGP4ek9PvGPwGqnO428n4UqMgPVfWl4AG5Z30390KAMzU8l19X59Qg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=fail smtp.mailfrom=gmail.com; arc=none smtp.client-ip=62.142.5.83 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=gmail.com Received: from localhost (88-113-26-217.elisa-laajakaista.fi [88.113.26.217]) by fgw22.mail.saunalahti.fi (Halon) with ESMTP id 1007d64b-d047-11ee-a9de-005056bdf889; Wed, 21 Feb 2024 01:23:32 +0200 (EET) From: andy.shevchenko@gmail.com To: Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Linus Walleij , Bartosz Golaszewski Subject: [PATCH v1 1/1] gpio: mmio: Support 64-bit BE access Date: Wed, 21 Feb 2024 01:23:28 +0200 Message-ID: <20240220232328.1881707-1-andy.shevchenko@gmail.com> X-Mailer: git-send-email 2.43.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Use ioread64be()/iowrite64be() for 64-bit BE access. Signed-off-by: Andy Shevchenko --- drivers/gpio/gpio-mmio.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/gpio/gpio-mmio.c b/drivers/gpio/gpio-mmio.c index 71e1af7c2184..cd5ef9233152 100644 --- a/drivers/gpio/gpio-mmio.c +++ b/drivers/gpio/gpio-mmio.c @@ -92,12 +92,12 @@ static unsigned long bgpio_read32(void __iomem *reg) #if BITS_PER_LONG >= 64 static void bgpio_write64(void __iomem *reg, unsigned long data) { - writeq(data, reg); + iowrite64(data, reg); } static unsigned long bgpio_read64(void __iomem *reg) { - return readq(reg); + return ioread64(reg); } #endif /* BITS_PER_LONG >= 64 */ @@ -121,6 +121,18 @@ static unsigned long bgpio_read32be(void __iomem *reg) return ioread32be(reg); } +#if BITS_PER_LONG >= 64 +static void bgpio_write64be(void __iomem *reg, unsigned long data) +{ + iowrite64be(data, reg); +} + +static unsigned long bgpio_read64be(void __iomem *reg) +{ + return ioread64be(reg); +} +#endif /* BITS_PER_LONG >= 64 */ + static unsigned long bgpio_line2mask(struct gpio_chip *gc, unsigned int line) { if (gc->be_bits) @@ -445,9 +457,8 @@ static int bgpio_setup_accessors(struct device *dev, #if BITS_PER_LONG >= 64 case 64: if (byte_be) { - dev_err(dev, - "64 bit big endian byte order unsupported\n"); - return -EINVAL; + gc->read_reg = bgpio_read64be; + gc->write_reg = bgpio_write64be; } else { gc->read_reg = bgpio_read64; gc->write_reg = bgpio_write64; -- 2.43.2