From patchwork Tue Nov 30 11:13:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 12694145 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BF31AC4332F for ; Tue, 30 Nov 2021 11:15:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=BQEUzzmS7aHoSSXRKJKXXeaQ3TGqOE/IlW3KghW3Jms=; b=yDXxmjj6MmxbvQ uQ5er1HWyzNrwaplbD0+hn3vnz9sitnWJK8OxrMYmGb5hztRh+RkwH3/NRzPyV8z38b2V7fqIp4uV KwuYku72Z8Ar3Po9XHUPJl5/vjKHByMhB3mk2wwSc3hl1JSJ4XA7L7pvs9DxAagmVD1fG5fo0Inm8 PxGtFSJoREi5nJN+CJKZn3W8B+iGPtsSPxRDBcTSMQtA2fjddMNathtmd7iV7uUVpTrzy5YtkGn5x 0rAmi+lbEmPYvgLLOkMNlo9i67nniIJFjXH53MtwcndP78zwOBZ+IfQukC0uEsV5aj4WT4NQKNR+C iBWJZT5+ORyajdH7gOlw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ms14o-004n5z-P4; Tue, 30 Nov 2021 11:13:34 +0000 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ms14j-004n3s-4G for linux-arm-kernel@lists.infradead.org; Tue, 30 Nov 2021 11:13:30 +0000 Received: by mail-lf1-x130.google.com with SMTP id k37so52836919lfv.3 for ; Tue, 30 Nov 2021 03:13:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=skodrfetI6sQYeMS84TqmzdXMiAWMy4xHtCAByWVHFI=; b=NN1gLQ6ZhDhSiyAh6hHxZjFFbU+o0aZMHv0WdzvXxzujKnmjbroGcnNEYvup4NVhvO zyHF49SMxTWzu+MDfYNdIqoMonEtgXLYfHmm/Hmo6038EqrL2w6wlfQVsWfEkX6fAN+I vuJpKn4n5vq22jHEIQezZN65K81Gqq/qNONPAUd7hOQ6Dz+Yoj23cNh3H00kv789YBm9 RqU3EuEn/NdRjgukedVz/yjXwHU/4+AvMUnwsDKJIvBqjWmiUHVjfYu05qxwiJh8dxeh I/bbgVvF1S+LlGpb0M11cwgYLBcVFBlATV8hSV8l77FTGw3wm7UlMfni/nm8GDRTno+2 6BPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=skodrfetI6sQYeMS84TqmzdXMiAWMy4xHtCAByWVHFI=; b=J78Rbyyvb4XUV5bRVBkr9xPiG8OtEJIHr98AxwL1vGs8VwJ4+E+LFxK5miIhi6nYVm W9xs+Eb4g/Eey/V/YsAM7sPzNbzJh98IgJPrti+6y3Vim9M5YtUlHFy6uPGJ0z+OWEaI qiyljX1wBIsZa1DFD8Z3ZgOPxqtodjUuvyG0aO9GZD9BsxTG50uLfpmhSjvnHrX7LoWy LrMGVFKDmgPGxvjBejfQoCNvOlC6/TS9vlEkRapllPmgJjec3Zjpm1ib1FDD42YJODep c1sIWhTiLT0sIM4/9HpukaX+7z8Ak4HAdJ4AV+3PdNkZcyNK2tVYuXQMvSEnt1ivfCco cbUw== X-Gm-Message-State: AOAM533hAJOgnKpNsw4ML7gT2rZzM357I2zCVAAEy4L6M+KfVmXPcpX/ iLDcliWOToqMzlBDl2m9e0sWzQ== X-Google-Smtp-Source: ABdhPJxi5miZzbt8q+GI/aVfntdWzDkTcjLze8k3gHSi7jFuDn7DNzNHUChiiCmEdpxUddEvmIHGrA== X-Received: by 2002:a05:6512:1094:: with SMTP id j20mr51460255lfg.237.1638270807395; Tue, 30 Nov 2021 03:13:27 -0800 (PST) Received: from localhost ([31.134.121.151]) by smtp.gmail.com with ESMTPSA id b13sm1903706lfv.200.2021.11.30.03.13.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Nov 2021 03:13:26 -0800 (PST) From: Sam Protsenko To: Krzysztof Kozlowski , Rob Herring , Greg Kroah-Hartman Cc: Jiri Slaby , Jaewon Kim , Chanho Park , David Virag , Youngmin Nam , devicetree@vger.kernel.org, linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v2 RESEND 0/5] soc: samsung: Add USI driver Date: Tue, 30 Nov 2021 13:13:20 +0200 Message-Id: <20211130111325.29328-1-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211130_031329_211697_0FEE1E67 X-CRM114-Status: GOOD ( 20.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org USIv2 IP-core provides selectable serial protocol (UART, SPI or High-Speed I2C); only one can be chosen at a time. This series implements USIv2 driver, which allows one to select particular USI function in device tree, and also performs USI block initialization. With that driver implemented, it's not needed to do USI initialization in protocol drivers anymore, so that code is removed from the serial driver. Because USI driver is tristate (can be built as a module), serial driver was reworked so it's possible to use its console part as a module too. This way we can load serial driver module from user space and still have serial console functional. Make it impossible to build UART/SPI/I2C driver as a built-in when USIv2 driver built as a module: USIv2 configuration must be always done before tinkering with particular protocol it implements. Design features: - "reg" property contains USI registers start address (0xc0 offset); it's used in the driver to access USI_CON and USI_OPTION registers. This way all USI initialization (reset, HWACG, etc) can be done in USIv2 driver separately, rather than duplicating that code over UART/SPI/I2C drivers - System Register (system controller node) and its SW_CONF register offset are provided in "samsung,sysreg" property; it's used to select USI function (protocol to be used) - USI function is specified in "samsung,mode" property; integer value is used to simplify parsing - there is "samsung,clkreq-on" bool property, which makes driver disable HWACG control (needed for UART to work properly) - PCLK and IPCLK clocks are both provided to USI node; apparently both need to be enabled to access USI registers - protocol nodes are embedded (as a child nodes) in USI node; it allows correct init order, and reflects HW properly - USIv2 driver is a tristate: can be also useful from Android GKI requirements point of view - driver functions are implemented with further development in mind: we might want to add some SysFS interface later for example, or provide some functions to serial drivers with EXPORT_SYMBOL(), etc; also another USI revisions could be added (like USIv1) Changes in v2: - Renamed all 'usi_v2' wording to just 'usi' everywhere - Removed patches adding dependency on EXYNOS_USI for UART/I2C/SPI drivers - Added patch: "tty: serial: samsung: Fix console registration from module" - Combined dt-bindings doc and dt-bindings header patches - Reworked USI driver to be ready for USIv1 addition - Improved dt-bindings - Added USI_V2_NONE mode value Sam Protsenko (5): dt-bindings: soc: samsung: Add Exynos USI bindings soc: samsung: Add USI driver tty: serial: samsung: Remove USI initialization tty: serial: samsung: Enable console as module tty: serial: samsung: Fix console registration from module .../bindings/soc/samsung/exynos-usi.yaml | 135 +++++++++ drivers/soc/samsung/Kconfig | 14 + drivers/soc/samsung/Makefile | 2 + drivers/soc/samsung/exynos-usi.c | 274 ++++++++++++++++++ drivers/tty/serial/Kconfig | 2 +- drivers/tty/serial/samsung_tty.c | 78 ++--- include/dt-bindings/soc/samsung,exynos-usi.h | 17 ++ include/linux/serial_s3c.h | 9 - 8 files changed, 483 insertions(+), 48 deletions(-) create mode 100644 Documentation/devicetree/bindings/soc/samsung/exynos-usi.yaml create mode 100644 drivers/soc/samsung/exynos-usi.c create mode 100644 include/dt-bindings/soc/samsung,exynos-usi.h