From patchwork Wed Aug 14 18:47:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mary Strodl X-Patchwork-Id: 13763810 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77EA6C3DA4A for ; Wed, 14 Aug 2024 18:47:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DB1EA6B007B; Wed, 14 Aug 2024 14:47:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D39C86B0082; Wed, 14 Aug 2024 14:47:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BDA346B0083; Wed, 14 Aug 2024 14:47:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 9CDD16B007B for ; Wed, 14 Aug 2024 14:47:46 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 09BBB810F5 for ; Wed, 14 Aug 2024 18:47:46 +0000 (UTC) X-FDA: 82451734932.08.5B5BED9 Received: from greygoose-centos7.csh.rit.edu (greygoose-centos7.csh.rit.edu [129.21.49.170]) by imf30.hostedemail.com (Postfix) with ESMTP id 51AFF80012 for ; Wed, 14 Aug 2024 18:47:44 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=csh.rit.edu header.s=mail header.b=a3SmYcbG; spf=pass (imf30.hostedemail.com: domain of mstrodl@csh.rit.edu designates 129.21.49.170 as permitted sender) smtp.mailfrom=mstrodl@csh.rit.edu; dmarc=pass (policy=none) header.from=csh.rit.edu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723661228; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=9a2+MjDCrNpQmwWS82ES5TLiYPQDD5uqSBb8V4lUmFU=; b=jhKAa85o8FcC9TzKcXFRovoQ3xTpfuWF+7NwrVk4yx6WQeK634iCy54SWtWCwlMtpayMiZ VKRZ5mS8vMUsU3g2LFXTwxWS/Npw8hYonVRudIgHL/HTqJ3kKENSwfsj0S6+DTF7x8hx4l C9dqWp0H2FDOpxRQV+3zhB+Q50iuZ6g= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=csh.rit.edu header.s=mail header.b=a3SmYcbG; spf=pass (imf30.hostedemail.com: domain of mstrodl@csh.rit.edu designates 129.21.49.170 as permitted sender) smtp.mailfrom=mstrodl@csh.rit.edu; dmarc=pass (policy=none) header.from=csh.rit.edu ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723661228; a=rsa-sha256; cv=none; b=qli0HtLa3t87J68HtSa2sJU/pj0gqvRr4y3kGyHn2Z2pVBufC+KL5cYD9Je//a8Hr7j6Qt 1XkEeTXQZsLkBkb3o2y11EvDHxCVs3Koaemhgo0aolSdIbFpAjbaSFMbKSFREzd/Z7o7ZQ S6FIk1zILUVWvmqmdB71WWSE67i0/TI= Received: from localhost (localhost [127.0.0.1]) by greygoose-centos7.csh.rit.edu (Postfix) with ESMTP id 0C76C413F741; Wed, 14 Aug 2024 14:47:43 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=csh.rit.edu; h= content-transfer-encoding:mime-version:x-mailer:message-id:date :date:subject:subject:from:from:received:received; s=mail; t= 1723661262; x=1725475663; bh=FixFz6aYCSZJ12RhiPdmM+LsZ5Fd39C07sG tiL0fEfo=; b=a3SmYcbGl4Gn0/aOjtd7RGw7EBYAHjdHcWBusUSO04RYGBndFcf g7nrAOQhl67PwJD6q84XHaDIWkJxg80+PbVpv4KIQUl2wTWifSo8isejRAwMz6fi LMjw9vg/y39eGDC3O2y/6Z9rH6bkKHU53aRMroX8LX6G++QfFmG+Q7kE= X-Virus-Scanned: amavisd-new at csh.rit.edu Received: from greygoose-centos7.csh.rit.edu ([127.0.0.1]) by localhost (mail.csh.rit.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 3nIemSHc2WPf; Wed, 14 Aug 2024 14:47:42 -0400 (EDT) Received: from freedom.csh.rit.edu (freedom.csh.rit.edu [129.21.49.182]) by greygoose-centos7.csh.rit.edu (Postfix) with ESMTP id 4824A457383A; Wed, 14 Aug 2024 14:47:42 -0400 (EDT) From: Mary Strodl To: linux-kernel@vger.kernel.org Cc: akpm@linux-foundation.org, urezki@gmail.com, hch@infradead.org, linux-mm@kvack.org, lee@kernel.org, andi.shyti@kernel.org, linux-i2c@vger.kernel.org, s.hauer@pengutronix.de, christian.gmeiner@gmail.com, Mary Strodl Subject: [PATCH v4 0/2] Add support for Congatec CGEB BIOS interface Date: Wed, 14 Aug 2024 14:47:29 -0400 Message-ID: <20240814184731.1310988-1-mstrodl@csh.rit.edu> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 51AFF80012 X-Stat-Signature: 74ucxkwir7cxare6ms3rxh78yd7eoiua X-HE-Tag: 1723661264-756793 X-HE-Meta: U2FsdGVkX1+U0R6cBZG67dlVXUvXFaeXKLo2T5cyTfwE1doQ2C9ObOUKmHOLE5GtPpkJmu4DF1ZBefeQEscAuIxqrdqOWw4IF1mI48VaX2zRKpQwUv08UrqH0YqN3eeqLLenpb/9WH/dA4uJYCEv1DkAf7QBqDFkR8R79HnRr/92uQtJA+hWI7XJzdcCe4bAlLgRZhqeoc1OB4XJ88x8BVLIPLxz23oc9/3NcDIHLOKgBxJEv2oaDsiRmo3WXHLQl95JBPsmprwMhUZB3PWhE688xOoMUaZchl9wMbgaDUdEsyEFyPHSdOO/0Uw1V883MBHwRW0H1qS/yNgxgKzbLqesMfvVDkSWu3ZJ0wYGZZ54i4HDtNvrpcUtLl2icukosZi5NJ0JSYaQSkzaxfM6K0ciKaKKUCWdqNPl0Xzm5ULPOxfB+l4yLjZBfv8m7lBnymUgfF2GbNwZFMW7np8ZXXrLM3R81nEyB1efRabAsY5T4ezpDbO2hHgn3pRzmnUsYbcstlmvuaKR/bCK0ZbrTWB7db4KC0I32MnwRsDhw/4Hj1B0SWBoZHCQPrqXB4CF0Kaf/kygiex9XSUDys1awm9pwJLZL87EJatuZd2ZQ89KKI2pR/j05S9yGF7qWa6n104fpeUFUtjMw3gZGKUVuUgJZskqhRtAdA+DLfR2UAhJtqRoWBT4l5KNgfRJotXN2GzZy0rKs/8f01398TMlvajR14tEyKMISF6YApUYbq1RjwMCw0vhnTM5dwPvcqk56Oja1JCefaTMKxfAEvCWQgRLKe63oWKM08CrH1Zwwp4Y51VETdw19ephG4xsZ83M/R3tqvmtWLPYj0VyhSofl0fxrDGFgboLxv6ynsNqnTbvSh73Bkso2il2Le4TcRQgW1CXbzoQPQpioA2dOzYvsc77JMClfZlTyicncn/CGQD5hIxZ1ouiPWiGc9LRSDSPSBtpf3MeICvRYZDPcvl ij9lbVqJ TSK5J999GGNcP8hzP7C2R/xW+C4m+3YOxmUTQGtonRyn+IGZ8LbwscW3MROyKzd3F2lQD0J8hk3olNS8jSV0I1m7klMy87qARUdHr9/IeYANykd5E/gsaM+J6Lguy9ILPoGCWojcH9m693TT+USTLkDCO64cnrvatC0cB/wzMNXa4ouXhw7ShBzHwKX1NSRtJDK35qMURJlP3nSJQjc1n+shyLi6AbswnnYaxOeaE4FqMcSZadbAgs7XLrwT/ZLeYhPa4pR45WlmMJ+4= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: The following series adds support for the Congatec CGEB interface found on some Congatec x86 boards. The CGEB interface is a BIOS interface which provides access to onboard peripherals like I2C busses and watchdogs. It works by mapping BIOS code and searching for magic values which specify the entry points to the CGEB call. The CGEB call is an API provided by the BIOS which provides access to the functions in an ioctl like fashion. At the request of some folks the first time I sent this series out, CGEB has a userspace component which runs the x86 blob (rather than running it directly in the kernel), which sends requests back and forth using the cn_netlink API. You can find a reference implementation of the userspace helper here: https://github.com/Mstrodl/cgeb-helper I didn't get an answer when I asked where the userspace component should live, so I didn't put a ton of work into getting the helper up to snuff since similar userspace helpers (like v86d) are not in-tree. If folks would like the helper in-tree, that's fine too. Changelog: v2: * Moved CGEB code snippet execution into userspace v3: * `checkpatch` pass * Should I add the driver files to MAINTAINERS? I'm not sure what the norm is there... * `sparse` pass * I'm not sure there's a good way to keep the __iomem marker around while not making the struct fields really inconvenient to access, so I just cast them away which causes a sparse warning. I figure it's probably okay since this driver is x86-specific anyways? Let me know if this is an issue and what the preferred approach is. v4: * Sort includes * Remove GPL blurb from top of file * Use memremap instead of ioremap_cache, avoids sparse warning * Minor styling stuff * Relocated some static declarations into function bodies This series is based on the excellent work of Sascha Hauer and Christian Gmeiner. You can find their original work here: http://patchwork.ozlabs.org/patch/219756/ http://patchwork.ozlabs.org/patch/219755/ http://patchwork.ozlabs.org/patch/219757/ http://patchwork.ozlabs.org/patch/483262/ http://patchwork.ozlabs.org/patch/483264/ http://patchwork.ozlabs.org/patch/483261/ http://patchwork.ozlabs.org/patch/483263/ Mary Strodl (1): x86: Add basic support for the Congatec CGEB BIOS interface Sascha Hauer (1): i2c: Add Congatec CGEB I2C driver drivers/i2c/busses/Kconfig | 10 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-congatec-cgeb.c | 190 ++++ drivers/mfd/Kconfig | 10 + drivers/mfd/Makefile | 1 + drivers/mfd/congatec-cgeb.c | 1125 ++++++++++++++++++++++++ include/linux/mfd/congatec-cgeb.h | 112 +++ include/uapi/linux/connector.h | 4 +- 8 files changed, 1452 insertions(+), 1 deletion(-) create mode 100644 drivers/i2c/busses/i2c-congatec-cgeb.c create mode 100644 drivers/mfd/congatec-cgeb.c create mode 100644 include/linux/mfd/congatec-cgeb.h