From patchwork Wed Dec 1 19:04:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 12694379 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 349F3C433EF for ; Wed, 1 Dec 2021 19:06:53 +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:References:In-Reply-To: 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: List-Owner; bh=oehKS2VekPMHqg/yLSNzurRZrf43y0310EzNz2siSQ8=; b=sqtzB6Nrls/1fd 8oANqUE3IWyxlgV/Z0KIpzqAICeK9ucroHs/0blk6c/duZp0rTsF/MfcdRg/e4FtIzjSKnxgAKX9n ffgSeyoKZDrvEDaBYtZS7QYUDXzqQS+gjONzhUYqfX0PKbOKm61QOsAAPmd1Sbngul1hx1zBMQpjY HisxzS1Xjnc3mqs+synfsoPp3Wzr/coTVogjWW8UAfyoD4Qz59h2JPdYdLPO1d7E5/BlmxXMIRqZ1 Kc3vx63CKmbcv5h5foG3Cjc2ezaOXXt6A47SWr2MTixe5gyyX2PNsz3efg6camiQjni4F3cj1/Kg9 /y4mADney/ezCbN2dAJQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1msUup-009sqt-QT; Wed, 01 Dec 2021 19:05:16 +0000 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1msUub-009slJ-DM for linux-arm-kernel@lists.infradead.org; Wed, 01 Dec 2021 19:05:03 +0000 Received: by mail-lf1-x134.google.com with SMTP id k37so65495777lfv.3 for ; Wed, 01 Dec 2021 11:04:59 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=AQDun0CJwvM7UQvnluW9dd4LbyUPdKYwbZE5uoVdvOU=; b=QOk2jhLZBSZEjsNg2ZX1HZj7ZbL+gPrU3uTZXF+74C1Ft+LZaIX1QFe6IJAx5gnOgA paxpTFYYkNdavEuXOkFJ0ZIdc5CoYLme8f6QRac/t2rnhsOatPMKm32BkvILVocK5Hk1 6RJRTCzL2qpF4gPlfwrZM3w2v1/o0iW0+WfDOF+aJ0zyj7ym8KGnFenEjcku1pTbKsXh qob0S81qBKydaiMxE9p3+SVbmd2nWI9vPBgmjIki+eDYUAYkYAG0btWmVeJ4LYINwHT/ 3dXghxZoWDQh0Jc8CF1pEvjL1g2fEiAApP2X1/6mJKD98YguTIr+EaI+6aexxCj/G0ap tZcw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=AQDun0CJwvM7UQvnluW9dd4LbyUPdKYwbZE5uoVdvOU=; b=0Tpz69TRZczlq9B2i0bTYhahfhArRN1sPzLeWhZ+fb/5Wgz3ySDg7vlZKnEjbKIqPE rdPCnVORi2ojP+h52fWtKka2I1/u7L+fox5iue7Sei/A+jTMpwPaiSFCQ/XseSO9RBqM 6aa/iw8NZjpYDtVUC+BWcbYDr65Inm7pC9z49hczuPoP0AMxV+OkSe5qodi0aEza452o VXwQgJi8VEpn2SwwB0Mh1ZDKOpeY8ARhN4qXW/7+gTGdMKkrI7zlLdKk6H0jYUY6UrgP MCy9L69d7FmanorPvDBc6BkO7Mhw0gBPd3vJ25vlWvxZAWxM8cSAYCdooDfkuqaJeFOa 0usA== X-Gm-Message-State: AOAM531VFmiOwJF+3a2k7c5umnQZN6a/Yc232MOGCwhh9n9rVCg3Evzp IuxlGOEZOxXC2/4HhkriTVvfTw== X-Google-Smtp-Source: ABdhPJyinqe77utFYvpWzDgZHKPTgwSqv6ZB2SE7iZkufbtEZi8kvrFdCnQkRYOITN+HkdDtvYDHMA== X-Received: by 2002:a05:6512:36c9:: with SMTP id e9mr7617984lfs.87.1638385498478; Wed, 01 Dec 2021 11:04:58 -0800 (PST) Received: from localhost ([31.134.121.151]) by smtp.gmail.com with ESMTPSA id m9sm72412ljg.80.2021.12.01.11.04.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Dec 2021 11:04:58 -0800 (PST) From: Sam Protsenko To: Krzysztof Kozlowski , Rob Herring Cc: Jaewon Kim , Chanho Park , David Virag , Youngmin Nam , Wolfram Sang , Arnd Bergmann , linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH 1/6] dt-bindings: i2c: exynos5: Convert to dtschema Date: Wed, 1 Dec 2021 21:04:50 +0200 Message-Id: <20211201190455.31646-2-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211201190455.31646-1-semen.protsenko@linaro.org> References: <20211201190455.31646-1-semen.protsenko@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211201_110501_495025_49FD1B65 X-CRM114-Status: GOOD ( 21.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 Convert Samsung Exynos High Speed I2C bindings doc to DT schema format. Changes during bindings conversion: 1. Added missing required clock properties (driver fails when it's unable to get the clock) 2. Removed properties and descriptions that can be found in schemas/i2c/i2c-controller.yaml [1] 3. Fixed the example so it can be validated by dtschema [1] https://github.com/robherring/dt-schema/blob/master/schemas/i2c/i2c-controller.yaml Signed-off-by: Sam Protsenko Reviewed-by: Krzysztof Kozlowski --- .../devicetree/bindings/i2c/i2c-exynos5.txt | 53 ------------ .../devicetree/bindings/i2c/i2c-exynos5.yaml | 80 +++++++++++++++++++ 2 files changed, 80 insertions(+), 53 deletions(-) delete mode 100644 Documentation/devicetree/bindings/i2c/i2c-exynos5.txt create mode 100644 Documentation/devicetree/bindings/i2c/i2c-exynos5.yaml diff --git a/Documentation/devicetree/bindings/i2c/i2c-exynos5.txt b/Documentation/devicetree/bindings/i2c/i2c-exynos5.txt deleted file mode 100644 index 2dbc0b62daa6..000000000000 --- a/Documentation/devicetree/bindings/i2c/i2c-exynos5.txt +++ /dev/null @@ -1,53 +0,0 @@ -* Samsung's High Speed I2C controller - -The Samsung's High Speed I2C controller is used to interface with I2C devices -at various speeds ranging from 100khz to 3.4Mhz. - -Required properties: - - compatible: value should be. - -> "samsung,exynos5-hsi2c", (DEPRECATED) - for i2c compatible with HSI2C available - on Exynos5250 and Exynos5420 SoCs. - -> "samsung,exynos5250-hsi2c", for i2c compatible with HSI2C available - on Exynos5250 and Exynos5420 SoCs. - -> "samsung,exynos5260-hsi2c", for i2c compatible with HSI2C available - on Exynos5260 SoCs. - -> "samsung,exynos7-hsi2c", for i2c compatible with HSI2C available - on Exynos7 SoCs. - - - reg: physical base address of the controller and length of memory mapped - region. - - interrupts: interrupt number to the cpu. - - #address-cells: always 1 (for i2c addresses) - - #size-cells: always 0 - - - Pinctrl: - - pinctrl-0: Pin control group to be used for this controller. - - pinctrl-names: Should contain only one value - "default". - -Optional properties: - - clock-frequency: Desired operating frequency in Hz of the bus. - -> If not specified, the bus operates in fast-speed mode at - at 100khz. - -> If specified, the bus operates in high-speed mode only if the - clock-frequency is >= 1Mhz. - -Example: - -hsi2c@12ca0000 { - compatible = "samsung,exynos5250-hsi2c"; - reg = <0x12ca0000 0x100>; - interrupts = <56>; - clock-frequency = <100000>; - - pinctrl-0 = <&i2c4_bus>; - pinctrl-names = "default"; - - #address-cells = <1>; - #size-cells = <0>; - - s2mps11_pmic@66 { - compatible = "samsung,s2mps11-pmic"; - reg = <0x66>; - }; -}; diff --git a/Documentation/devicetree/bindings/i2c/i2c-exynos5.yaml b/Documentation/devicetree/bindings/i2c/i2c-exynos5.yaml new file mode 100644 index 000000000000..53df1571eff1 --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/i2c-exynos5.yaml @@ -0,0 +1,80 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/i2c/i2c-exynos5.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Samsung's High Speed I2C controller + +maintainers: + - Krzysztof Kozlowski + +description: | + The Samsung's High Speed I2C controller is used to interface with I2C devices + at various speeds ranging from 100kHz to 3.4MHz. + +allOf: + - $ref: /schemas/i2c/i2c-controller.yaml# + +properties: + compatible: + oneOf: + - enum: + - "samsung,exynos5250-hsi2c" # Exynos5250 and Exynos5420 + - "samsung,exynos5260-hsi2c" # Exynos5260 + - "samsung,exynos7-hsi2c" # Exynos7 + - const: "samsung,exynos5-hsi2c" # Exynos5250 and Exynos5420 + deprecated: true + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clock-frequency: + default: 100000 + description: + Desired operating frequency in Hz of the bus. + + If not specified, the bus operates in fast-speed mode at 100kHz. + + If specified, the bus operates in high-speed mode only if the + clock-frequency is >= 1MHz. + + clocks: + maxItems: 1 + description: I2C operating clock + + clock-names: + const: hsi2c + +required: + - compatible + - reg + - interrupts + - clocks + +unevaluatedProperties: false + +examples: + - | + #include + #include + #include + + hsi2c_8: i2c@12e00000 { + compatible = "samsung,exynos5250-hsi2c"; + reg = <0x12e00000 0x1000>; + interrupts = ; + #address-cells = <1>; + #size-cells = <0>; + clock-frequency = <100000>; + clocks = <&clock CLK_USI4>; + clock-names = "hsi2c"; + + pmic@66 { + /* compatible = "samsung,s2mps11-pmic"; */ + reg = <0x66>; + }; + }; From patchwork Wed Dec 1 19:04:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 12694381 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 D6092C433F5 for ; Wed, 1 Dec 2021 19:07:12 +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:References:In-Reply-To: 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: List-Owner; bh=vWF5AnFogXuQosr3lslnKZJxgqSYkFEdweHAJVFQScg=; b=sH9qtnncWljaHL e9J3fwimDV1dFwqj2EuPbQha7woxlFeV3Ga7Ov9/sQ3iv0/vTmFVRDeqK/15dXo/l93D76nh+SGez sQNZpt/WBRE70Kj+3lgJYlXZFCzDA5s6C3ng2pFOdtJIUzfEa/Xs4QQ6b6/w9c37pGcIj/EWD6BVN RzYjyHi0n7iVd3VaT4bH+gwQfKvoUN6YYrBdmm2Q0JvJEw8c17MrY4LZChYxxHih6VcHZjtlFyEg+ VCDHJaE6DxqP9exu1wRxHgHpvQsWgVzW0svPAqhU39LRFJu4828q1fvmeFjKR3K8bB/7DrLEQbD+0 1jJ89Zj0Av5hDk7iy6Pw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1msUv0-009ssW-2t; Wed, 01 Dec 2021 19:05:26 +0000 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1msUuc-009slK-MS for linux-arm-kernel@lists.infradead.org; Wed, 01 Dec 2021 19:05:04 +0000 Received: by mail-lf1-x136.google.com with SMTP id f18so65460342lfv.6 for ; Wed, 01 Dec 2021 11:05:01 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=B59ufmsrpetzrryOxTGflLKDbB0Sxf7ZYCipjPGD1eM=; b=l4PxZ0qxUWAdi1BGpU14w3Y1eKPueJzM61nR71M4hvCyBWp5qyggMByjbBnYeVUmIm 4P2xc8pMOpk3HuxA/FmTj5jLjqIefz2zM/xuC6bTUHC1Kfk2WCMMQGyUX7Apj0536mvs BgND9HlDNvs+HS+iIGx1W7SaoqlxODocr5710jmXCFj8OgO/s/HPdimWyOFQyRIsCY9b VXksr3gwPiwVb2kTrzwXwLKASl9mmeYtEMKPE4IlbOjV1oc7YjwyIzRE7IM1aNp37kJU hEvZReTpTuzNrr7d4gCd9puiaAA6WyjlR7JV/YH5+5dHzGcQqnI/j11IEPXExPRJztvI mgsw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=B59ufmsrpetzrryOxTGflLKDbB0Sxf7ZYCipjPGD1eM=; b=vnrnAyqGFXMl5wBi2ck3+9xZAUFlMaI5FJKiSdofPqYb+wvKIe1bJPGbDVZyvRQrMO M0Pm3Ezb14QwZy0afqLUWMhoFr1rXE/GdJYWt6rG4UioQUz3obKiITPaQ2epMh4LyKir tqIFDr2L5C57IiyBBsrXiJqnmxtsyH4GQd2nklwmZJj/D7sh/SbJlyDvohhcbiJoCmKl CiRNNGOlXoLtOHWy23wf6iWma02TjbTAG8f1wfp61JpBabgHwKx1vY0PuY8ldzSWLob9 9ah3wYwefQToEvQ6+FEJ0OHobnricdsjIR05cQSoSVv0nhCf2MvaQoqnqT5pZJcWu0FT GNQg== X-Gm-Message-State: AOAM533D3LlmJD+CG9VidZyxtdSYdsBURwbwWCTKzQRD3mbWQjPdRZn3 qNXY7RDOzfVQ8Y2SoSX3RoZapg== X-Google-Smtp-Source: ABdhPJwYmOC/AgyAZDvE8TeHFpvtm2tQg4UjMnVF8iz8/nBgV2qS64s67Aopur9Vk6oPMQgYw2YZ1g== X-Received: by 2002:a05:6512:3988:: with SMTP id j8mr7597661lfu.599.1638385499863; Wed, 01 Dec 2021 11:04:59 -0800 (PST) Received: from localhost ([31.134.121.151]) by smtp.gmail.com with ESMTPSA id v185sm72425lfa.54.2021.12.01.11.04.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Dec 2021 11:04:59 -0800 (PST) From: Sam Protsenko To: Krzysztof Kozlowski , Rob Herring Cc: Jaewon Kim , Chanho Park , David Virag , Youngmin Nam , Wolfram Sang , Arnd Bergmann , linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH 2/6] dt-bindings: i2c: exynos5: Add exynosautov9-hsi2c compatible Date: Wed, 1 Dec 2021 21:04:51 +0200 Message-Id: <20211201190455.31646-3-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211201190455.31646-1-semen.protsenko@linaro.org> References: <20211201190455.31646-1-semen.protsenko@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211201_110502_764744_AE613300 X-CRM114-Status: GOOD ( 12.90 ) 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 From: Jaewon Kim This patch adds new "samsung,exynosautov9-hsi2c" compatible. It is for i2c compatible with HSI2C available on Exynos SoC with USI. Signed-off-by: Jaewon Kim Signed-off-by: Sam Protsenko Reviewed-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/i2c/i2c-exynos5.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/i2c/i2c-exynos5.yaml b/Documentation/devicetree/bindings/i2c/i2c-exynos5.yaml index 53df1571eff1..db20e703dea0 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-exynos5.yaml +++ b/Documentation/devicetree/bindings/i2c/i2c-exynos5.yaml @@ -13,6 +13,11 @@ description: | The Samsung's High Speed I2C controller is used to interface with I2C devices at various speeds ranging from 100kHz to 3.4MHz. + In case the HSI2C controller is encapsulated within USI block (it's the case + e.g. for Exynos850 and Exynos Auto V9 SoCs), it might be also necessary to + define USI node in device tree file, choosing "i2c" configuration. Please see + Documentation/devicetree/bindings/soc/samsung/exynos-usi.yaml for details. + allOf: - $ref: /schemas/i2c/i2c-controller.yaml# @@ -23,6 +28,7 @@ properties: - "samsung,exynos5250-hsi2c" # Exynos5250 and Exynos5420 - "samsung,exynos5260-hsi2c" # Exynos5260 - "samsung,exynos7-hsi2c" # Exynos7 + - "samsung,exynosautov9-hsi2c" # ExynosAutoV9 - const: "samsung,exynos5-hsi2c" # Exynos5250 and Exynos5420 deprecated: true From patchwork Wed Dec 1 19:04:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 12694382 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 65198C433F5 for ; Wed, 1 Dec 2021 19:07:16 +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:References:In-Reply-To: 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: List-Owner; bh=OCqJSIYDS1m3y5NadfQ3CuqJl9EtVb+lBRVSJ34VmZw=; b=ZIyfJwX0/NNY2b hGfFTFLSvfhL1OmoJdr6Wf+B0LxPbihsw4vZQKI3eHspWtJ0Zs66NDJZ4QmmKRo7zDv4mClUxddgq M3cSoiOfOTe3jLlwuuij6QkzRZ4I+dkO8aGdxMjsOUf+nVzrSs3mFDlI/EbqWMteuASQFU2pXbzfT xf9T96SjPeTNvGRz9TPepJuGqPsnwB6ZxxTaPSULkNjZxMzAEg2BWXyy9UeVdK4E78TWT4kaj7aQd 0n3JhbJzrD1baiwXz+4pc6dmVmsA0kHk34iSAWCk5zBZuM6LaEllvizYpMLqxfEkr7INFekPOoqke e3ivYYHwPXNC83S2+5YA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1msUvC-009suk-Cg; Wed, 01 Dec 2021 19:05:38 +0000 Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1msUud-009slq-Fp for linux-arm-kernel@lists.infradead.org; Wed, 01 Dec 2021 19:05:04 +0000 Received: by mail-lf1-x12d.google.com with SMTP id r26so65448571lfn.8 for ; Wed, 01 Dec 2021 11:05:02 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=RUQx5kq3VrQOJzLJrHIG10H6hCDxVpxGzWKF98as5kk=; b=In8k5sq2384AcnFdRb15c2gEmINBS3KJi7PU5aATZmmOIwm71wY+dCo1UfvvCI8ubY JrQ/3mNIyh5OOfqFRcY9UCd8oSyhc1xh2Hpi7AMODLgBd2wdhiTIEkHae6+aks0/0TwF FYsmK/fu3LQa/TvYW3yTnL6PTiDnFX5+FGMKgA+K/G/y+7iwfx/Iu7gJ+oLFTNmwhoyz ZFdMWczP+U08BUVaO33E/meDGAYiFL22EwDK/QFaCnjmleEA10M7HnVLI/rWH+15Ob83 69+p04MC0BRa9jrE+tT0vrdcuq1CdRN4Q8nBf1UMHkGHjAf+VyPvTmYxwM3OK8CFund8 IiDA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=RUQx5kq3VrQOJzLJrHIG10H6hCDxVpxGzWKF98as5kk=; b=CEmRQJRcdnUkYsjlD7LfOkl23tYqwz3RUHzUKfSkPCPYErtTGPcU19xPzdVnBSCu5b 64zpOGaYtN7VWUEidqrMmUSquPVDlfrkMFs9fh2SHVqNjaQ9nsSlNRx8P9bGTScwXWvD erM2XkGhVyye6fwTZS2RuWyNe4+D1rfi2NnQZ7K6Y36etd8ZFfjpZh84ZA48WrwnTxQO ZVke0uTCRPK2af4d749Q7PUOpDiNpxz1kAA1D8+t9XYEXl0+R41keYJrNsMQvAIdqvoD Ml0ZyWDNPaflWmHejUqerwz6WB54vV2/MBgapSAtwx1WcKAFWBp+08rnsFqR8E/z32fP QnwA== X-Gm-Message-State: AOAM531i9BVAbha9mnw3e+wmLCus+t9RZSSU/91E5PB4V53SUzniLvmx mfi7YIhOj+R9hOvakcNaIN8mCQ== X-Google-Smtp-Source: ABdhPJyXfA1Aj/HuZe6HAzGr6uRY6CRxqJOxRkA1rtTvcyqa/VFMR4R6HUAfwPmKzWFpso4Sn5/UEA== X-Received: by 2002:ac2:42c6:: with SMTP id n6mr7403216lfl.553.1638385501381; Wed, 01 Dec 2021 11:05:01 -0800 (PST) Received: from localhost ([31.134.121.151]) by smtp.gmail.com with ESMTPSA id e20sm71103ljo.119.2021.12.01.11.05.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Dec 2021 11:05:00 -0800 (PST) From: Sam Protsenko To: Krzysztof Kozlowski , Rob Herring Cc: Jaewon Kim , Chanho Park , David Virag , Youngmin Nam , Wolfram Sang , Arnd Bergmann , linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH 3/6] dt-bindings: i2c: exynos5: Add bus clock Date: Wed, 1 Dec 2021 21:04:52 +0200 Message-Id: <20211201190455.31646-4-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211201190455.31646-1-semen.protsenko@linaro.org> References: <20211201190455.31646-1-semen.protsenko@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211201_110503_559230_5DCBB72C X-CRM114-Status: GOOD ( 12.12 ) 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 In new Exynos SoCs (like Exynos850) where HSI2C is implemented as a part of USIv2 block, there are two clocks provided to HSI2C controller: - PCLK: bus clock (APB), provides access to register interface - IPCLK: operating IP-core clock; SCL is derived from this one Both clocks have to be asserted for HSI2C to be functional in that case. Modify bindings doc to allow specifying bus clock in addition to already described operating clock. Make it optional though, as older Exynos SoC variants only have one HSI2C clock. Signed-off-by: Sam Protsenko --- .../devicetree/bindings/i2c/i2c-exynos5.yaml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/i2c/i2c-exynos5.yaml b/Documentation/devicetree/bindings/i2c/i2c-exynos5.yaml index db20e703dea0..a212c1d5e7d9 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-exynos5.yaml +++ b/Documentation/devicetree/bindings/i2c/i2c-exynos5.yaml @@ -49,11 +49,16 @@ properties: clock-frequency is >= 1MHz. clocks: - maxItems: 1 - description: I2C operating clock + minItems: 1 + items: + - description: I2C operating clock + - description: Bus clock (APB) clock-names: - const: hsi2c + minItems: 1 + items: + - const: hsi2c + - const: hsi2c_pclk required: - compatible From patchwork Wed Dec 1 19:04:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 12694383 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 C6DABC433EF for ; Wed, 1 Dec 2021 19:07:32 +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:References:In-Reply-To: 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: List-Owner; bh=IpaXlg9E6gecLcCCLeEvvM7kjzJ/l6oqDEdgPjJQSoI=; b=UjNJR1mtXV3QGD oaGOZKi4rwdXS0sCTE1nedeYj58GNUeATSggW2+TLJBouvG5hqyEzFRhSSF6mrm28vPp97oLsiZxv iAzyJUQ7ZdsrSPIcEgVfAXyS/irCAeYKIVMJDbkl7L+qkOqwlgFOPvuYcVr+NXvsOeMHHZdf9V6iS 5EU5r6zvWiSa9x+7gogl8Un6XQuBjsP+gYSf0PDWyg6i5kQuF3hD0WKxk98tkoUtU54KlESbdd6Y8 ubWXsTE4F3pvAIKZXDUv0jQ3z6cK1xvg264ervWjwxDA1cArvEXHHhGPc8ebPtbQ/mN2o/83zO2vp EfglhibRP6jryOR7kLXg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1msUvN-009sxk-Hs; Wed, 01 Dec 2021 19:05:49 +0000 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1msUuf-009smw-59 for linux-arm-kernel@lists.infradead.org; Wed, 01 Dec 2021 19:05:07 +0000 Received: by mail-lf1-x135.google.com with SMTP id t26so65437252lfk.9 for ; Wed, 01 Dec 2021 11:05:04 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=aAo5L8S04r7ipl+uXm9qNiK/iV6LQnGWXB0cFhZkmdM=; b=rHqvSkrjyON28Or7auVY6T++aDwISh/E4oAAgovbxJ8YKWassoYx1nH9Wc8W5t2LIK HpJh5rttDdFr4ReJ38i2CphfVYXPFEMq9biC78GRdUQjEjghLp02PoN+QxxnyTg86aoz x3oFQmBnuM2hXssgFYik2THgZO2aH6mELyKuHxUhg4/VKKWS0Lv1QA/cNVhBzFuf90I/ Hx2822kzjmdOk5XD2WFYwpBgKUd4rwVSzo9vKUPMWdohJEqv+KzCFXqOlap+2WR+VWPC pvPyBf368FB8oTBosJJYtbKCpTlu2rjQ8XG4qC2gwkRCCshNexVAI8DcQWGDEOU4vju1 70pQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=aAo5L8S04r7ipl+uXm9qNiK/iV6LQnGWXB0cFhZkmdM=; b=VdF+G/4GJ71j9fdmGt79H3hj/xJ8dnNXGieknfYZyHD40FntpyOZ/KMw6WAOmY4E/H 406zk8iXx5RblX+nr1fEvjr5Z2gpztMSaGquXJ4k29rDNDEGgtwtwF+BEneFJLqMxjWh Q5X6PaS0bfBM2bClUSSERkAh73qZlKA8RVThGdhGUK3Ft7a8I1fIocGYQNQjTS83eGJQ TZSBcX1Luxp4od2Juo0J6KcwBJ3ImgQ6QJZH9BHQVrOfQZ0HMHVcNElL0qxRcP9vIrlJ gGlZKphZEFAqmqa+L4OKjgZ5TmXmpdl3A/+2GmEH3rOyYMaWQ6xj2SzM5jP3DEt8avkO KqEw== X-Gm-Message-State: AOAM533RQrf1vO5+oC4AkwRBAxFyPskDN7qwkcUfGSrYhQU8SpYR9612 10KaIJpNJplkmEIU8eT4OwU+Tg== X-Google-Smtp-Source: ABdhPJyYuXcZhjzewZlCgGHfjAN9uPoQI44hRzrim9QZljFWb/IJjkjq+16q4MdxUHqa29lzRPl4qQ== X-Received: by 2002:a05:6512:11c5:: with SMTP id h5mr7501361lfr.431.1638385503089; Wed, 01 Dec 2021 11:05:03 -0800 (PST) Received: from localhost ([31.134.121.151]) by smtp.gmail.com with ESMTPSA id p26sm72178ljj.70.2021.12.01.11.05.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Dec 2021 11:05:02 -0800 (PST) From: Sam Protsenko To: Krzysztof Kozlowski , Rob Herring Cc: Jaewon Kim , Chanho Park , David Virag , Youngmin Nam , Wolfram Sang , Arnd Bergmann , linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH 4/6] i2c: exynos5: Add support for ExynosAutoV9 SoC Date: Wed, 1 Dec 2021 21:04:53 +0200 Message-Id: <20211201190455.31646-5-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211201190455.31646-1-semen.protsenko@linaro.org> References: <20211201190455.31646-1-semen.protsenko@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211201_110505_263764_6467B39C X-CRM114-Status: GOOD ( 23.31 ) 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 From: Jaewon Kim ExynosAutoV9 functioning logic mostly follows I2C_TYPE_EXYNOS7, but timing calculation and configuration procedure is changed: e.g. only timing_s3 has to be set now. Another change of HSI2C controller in ExynosAutoV9 SoC is that it's now a part of USIv2 IP-core. No changes is needed for I2C driver though, as all USI related configuration is done in USI driver. Signed-off-by: Jaewon Kim Signed-off-by: Sam Protsenko Reviewed-by: Krzysztof Kozlowski --- drivers/i2c/busses/i2c-exynos5.c | 62 +++++++++++++++++++++++++++----- 1 file changed, 53 insertions(+), 9 deletions(-) diff --git a/drivers/i2c/busses/i2c-exynos5.c b/drivers/i2c/busses/i2c-exynos5.c index c2e4bab11366..5198e71e8dab 100644 --- a/drivers/i2c/busses/i2c-exynos5.c +++ b/drivers/i2c/busses/i2c-exynos5.c @@ -169,6 +169,7 @@ enum i2c_type_exynos { I2C_TYPE_EXYNOS5, I2C_TYPE_EXYNOS7, + I2C_TYPE_EXYNOSAUTOV9, }; struct exynos5_i2c { @@ -230,6 +231,11 @@ static const struct exynos_hsi2c_variant exynos7_hsi2c_data = { .hw = I2C_TYPE_EXYNOS7, }; +static const struct exynos_hsi2c_variant exynosautov9_hsi2c_data = { + .fifo_depth = 64, + .hw = I2C_TYPE_EXYNOSAUTOV9, +}; + static const struct of_device_id exynos5_i2c_match[] = { { .compatible = "samsung,exynos5-hsi2c", @@ -243,6 +249,9 @@ static const struct of_device_id exynos5_i2c_match[] = { }, { .compatible = "samsung,exynos7-hsi2c", .data = &exynos7_hsi2c_data + }, { + .compatible = "samsung,exynosautov9-hsi2c", + .data = &exynosautov9_hsi2c_data }, {}, }; MODULE_DEVICE_TABLE(of, exynos5_i2c_match); @@ -281,6 +290,31 @@ static int exynos5_i2c_set_timing(struct exynos5_i2c *i2c, bool hs_timings) i2c->op_clock; int div, clk_cycle, temp; + /* + * In case of HSI2C controllers in ExynosAutoV9: + * + * FSCL = IPCLK / ((CLK_DIV + 1) * 16) + * T_SCL_LOW = IPCLK * (CLK_DIV + 1) * (N + M) + * [N : number of 0's in the TSCL_H_HS] + * [M : number of 0's in the TSCL_L_HS] + * T_SCL_HIGH = IPCLK * (CLK_DIV + 1) * (N + M) + * [N : number of 1's in the TSCL_H_HS] + * [M : number of 1's in the TSCL_L_HS] + * + * Result of (N + M) is always 8. + * In general case, we don't need to control timing_s1 and timing_s2. + */ + if (i2c->variant->hw == I2C_TYPE_EXYNOSAUTOV9) { + div = ((clkin / (16 * i2c->op_clock)) - 1); + i2c_timing_s3 = div << 16; + if (hs_timings) + writel(i2c_timing_s3, i2c->regs + HSI2C_TIMING_HS3); + else + writel(i2c_timing_s3, i2c->regs + HSI2C_TIMING_FS3); + + return 0; + } + /* * In case of HSI2C controller in Exynos5 series * FPCLK / FI2C = @@ -422,7 +456,10 @@ static irqreturn_t exynos5_i2c_irq(int irqno, void *dev_id) writel(int_status, i2c->regs + HSI2C_INT_STATUS); /* handle interrupt related to the transfer status */ - if (i2c->variant->hw == I2C_TYPE_EXYNOS7) { + switch (i2c->variant->hw) { + case I2C_TYPE_EXYNOSAUTOV9: + fallthrough; + case I2C_TYPE_EXYNOS7: if (int_status & HSI2C_INT_TRANS_DONE) { i2c->trans_done = 1; i2c->state = 0; @@ -443,7 +480,12 @@ static irqreturn_t exynos5_i2c_irq(int irqno, void *dev_id) i2c->state = -ETIMEDOUT; goto stop; } - } else if (int_status & HSI2C_INT_I2C) { + + break; + case I2C_TYPE_EXYNOS5: + if (!(int_status & HSI2C_INT_I2C)) + break; + trans_status = readl(i2c->regs + HSI2C_TRANS_STATUS); if (trans_status & HSI2C_NO_DEV_ACK) { dev_dbg(i2c->dev, "No ACK from device\n"); @@ -465,6 +507,8 @@ static irqreturn_t exynos5_i2c_irq(int irqno, void *dev_id) i2c->trans_done = 1; i2c->state = 0; } + + break; } if ((i2c->msg->flags & I2C_M_RD) && (int_status & @@ -569,13 +613,13 @@ static void exynos5_i2c_bus_check(struct exynos5_i2c *i2c) { unsigned long timeout; - if (i2c->variant->hw != I2C_TYPE_EXYNOS7) + if (i2c->variant->hw == I2C_TYPE_EXYNOS5) return; /* - * HSI2C_MASTER_ST_LOSE state in EXYNOS7 variant before transaction - * indicates that bus is stuck (SDA is low). In such case bus recovery - * can be performed. + * HSI2C_MASTER_ST_LOSE state (in Exynos7 and ExynosAutoV9 variants) + * before transaction indicates that bus is stuck (SDA is low). + * In such case bus recovery can be performed. */ timeout = jiffies + msecs_to_jiffies(100); for (;;) { @@ -611,10 +655,10 @@ static void exynos5_i2c_message_start(struct exynos5_i2c *i2c, int stop) unsigned long flags; unsigned short trig_lvl; - if (i2c->variant->hw == I2C_TYPE_EXYNOS7) - int_en |= HSI2C_INT_I2C_TRANS; - else + if (i2c->variant->hw == I2C_TYPE_EXYNOS5) int_en |= HSI2C_INT_I2C; + else + int_en |= HSI2C_INT_I2C_TRANS; i2c_ctl = readl(i2c->regs + HSI2C_CTL); i2c_ctl &= ~(HSI2C_TXCHON | HSI2C_RXCHON); From patchwork Wed Dec 1 19:04:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 12694384 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 DD88FC433EF for ; Wed, 1 Dec 2021 19:07:44 +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:References:In-Reply-To: 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: List-Owner; bh=sJ+ddXT1PS1bO21jUUsErclKcPWI0ttPGNCCf/fjDNw=; b=406HcE/2F0/KIh zFQ8wkaCslc3iEfjtKlpWEpLAj3Nlqt7hD3UaZU8yfp8oKSowBj0MdNuEQe0M/1C+2yd94sDEqkVd 05rUv1wOPWtQ3T2PiFe5QHdcoeWxDU511WNhkN6H7EGzBf+fNCxxFml2k+shhW7I1RWUn81Qa99l8 pW2twMeng/QJXKk4Laf7KSs6G4h/jTbMX75GSZ+Fj7MwKgrbsQnhO2E8e9JHvRvEmzhdw2pLZHot+ Ko9XfzfCdKBpl7Dp0CiNPa/dhLqPuXBdP6UfW/EB5YSbmFbDJwYbayeZRCke2RQAaO9hsEynUlavd ojpMADTA2gZXcxPFTy8w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1msUva-009t2h-LU; Wed, 01 Dec 2021 19:06:02 +0000 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1msUug-009snq-Nm for linux-arm-kernel@lists.infradead.org; Wed, 01 Dec 2021 19:05:08 +0000 Received: by mail-lj1-x22a.google.com with SMTP id p8so36631169ljo.5 for ; Wed, 01 Dec 2021 11:05:05 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=xFxNqmuJVHm+4b6lR+Oly3cvobR2qTXZL1lEPZhFsrE=; b=RdnzaNKoUt5b+9agSRLYKRRF9nuVxJFlKMirK78Y43kiqglTOpkdctVQ1SKOm2eFRf 0xtzHaQg0RSsBmtrwxDFDaxljYRW0DBKq3YcdqJDvNC6l8Ghs81VvVpiO63Xtv5tfkXC OBie9N7C1xsNZ4MxtOhoHVtQCPHXcdbJHqRuRDoqEK+hJ4pg4aC4oDWjWiG3PDKNHOId 8sAN6So4lh2PBBJ1XM8KBXJ34ABpRQoGhR5z9Tl/z4NncAeieGYGVxnw9cBjXGLkblIo lTcHBIq0dIhFXBkgrmpj8XXl95XzDt1Hcle+tbSoVOzTe7H/1pB/f0YmmbjPdLjQE995 sbsA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=xFxNqmuJVHm+4b6lR+Oly3cvobR2qTXZL1lEPZhFsrE=; b=JcKmMzxenbqE74IhBQeQugUfC7/UfAoQajkMApcptTfKNTovMFFnDsD+CSRyIRawx3 /Kk3u25UZVhkqOWCd20hy01AVx50OJVGy5Nobd4e7ugNuQz0t4ZWwK6/u1h3Do+WVuHU gQSfoNxgvO/m2KZ9DHTyDKoRSp1dlXjw8NaatxRQcEo7es4WiYry6JKxe39cf2248z3Z OzmHzcsndalBjkI5ZNNmD4J+wkEg4Bk04d1E2DCs+wxcxoAFt9T5IjsgznGJhoRb59jG xhLRP6iUyTtHoabJneo4aGK11NpjclwbxE9CmsnJ/PKP243dmLi05s6oNHPaicvljSaW OIBg== X-Gm-Message-State: AOAM531Eqj/Sjx3m2DcOliEKyzvdvHPj+KRxmB42kCeVPbDsquDny9pz 4jPmUWklwlMV2Eh0hNttX40IVw== X-Google-Smtp-Source: ABdhPJw9cTGW2HXAXJwsyWcNxIPUwF4D6YMKXKVz4KwpsKcwqB6bz/QYaDQRAoJPBAB71ZlXYeIOOg== X-Received: by 2002:a05:651c:106b:: with SMTP id y11mr7225777ljm.504.1638385504477; Wed, 01 Dec 2021 11:05:04 -0800 (PST) Received: from localhost ([31.134.121.151]) by smtp.gmail.com with ESMTPSA id h17sm79175lfj.160.2021.12.01.11.05.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Dec 2021 11:05:04 -0800 (PST) From: Sam Protsenko To: Krzysztof Kozlowski , Rob Herring Cc: Jaewon Kim , Chanho Park , David Virag , Youngmin Nam , Wolfram Sang , Arnd Bergmann , linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH 5/6] i2c: exynos5: Add bus clock support Date: Wed, 1 Dec 2021 21:04:54 +0200 Message-Id: <20211201190455.31646-6-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211201190455.31646-1-semen.protsenko@linaro.org> References: <20211201190455.31646-1-semen.protsenko@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211201_110506_819007_2F1FA240 X-CRM114-Status: GOOD ( 20.14 ) 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 In new Exynos SoCs (like Exynos850) where HSI2C is implemented as a part of USIv2 block, there are two clocks provided to HSI2C controller: - PCLK: bus clock (APB), provides access to register interface - IPCLK: operating IP-core clock; SCL is derived from this one Both clocks have to be asserted for HSI2C to be functional in that case. Add code to obtain and enable/disable PCLK in addition to already handled operating clock. Make it optional though, as older Exynos SoC variants only have one HSI2C clock. Signed-off-by: Sam Protsenko Reviewed-by: Krzysztof Kozlowski Reviewed-by: Chanho Park --- drivers/i2c/busses/i2c-exynos5.c | 46 ++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/drivers/i2c/busses/i2c-exynos5.c b/drivers/i2c/busses/i2c-exynos5.c index 5198e71e8dab..9cde5ecb9449 100644 --- a/drivers/i2c/busses/i2c-exynos5.c +++ b/drivers/i2c/busses/i2c-exynos5.c @@ -182,7 +182,8 @@ struct exynos5_i2c { unsigned int irq; void __iomem *regs; - struct clk *clk; + struct clk *clk; /* operating clock */ + struct clk *pclk; /* bus clock */ struct device *dev; int state; @@ -757,10 +758,14 @@ static int exynos5_i2c_xfer(struct i2c_adapter *adap, struct exynos5_i2c *i2c = adap->algo_data; int i, ret; - ret = clk_enable(i2c->clk); + ret = clk_enable(i2c->pclk); if (ret) return ret; + ret = clk_enable(i2c->clk); + if (ret) + goto err_pclk; + for (i = 0; i < num; ++i) { ret = exynos5_i2c_xfer_msg(i2c, msgs + i, i + 1 == num); if (ret) @@ -768,6 +773,8 @@ static int exynos5_i2c_xfer(struct i2c_adapter *adap, } clk_disable(i2c->clk); +err_pclk: + clk_disable(i2c->pclk); return ret ?: num; } @@ -807,10 +814,18 @@ static int exynos5_i2c_probe(struct platform_device *pdev) return -ENOENT; } - ret = clk_prepare_enable(i2c->clk); + i2c->pclk = devm_clk_get(&pdev->dev, "hsi2c_pclk"); + if (IS_ERR(i2c->pclk)) + i2c->pclk = NULL; /* pclk is optional */ + + ret = clk_prepare_enable(i2c->pclk); if (ret) return ret; + ret = clk_prepare_enable(i2c->clk); + if (ret) + goto err_pclk; + i2c->regs = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(i2c->regs)) { ret = PTR_ERR(i2c->regs); @@ -853,6 +868,7 @@ static int exynos5_i2c_probe(struct platform_device *pdev) platform_set_drvdata(pdev, i2c); clk_disable(i2c->clk); + clk_disable(i2c->pclk); dev_info(&pdev->dev, "%s: HSI2C adapter\n", dev_name(&i2c->adap.dev)); @@ -860,6 +876,9 @@ static int exynos5_i2c_probe(struct platform_device *pdev) err_clk: clk_disable_unprepare(i2c->clk); + + err_pclk: + clk_disable_unprepare(i2c->pclk); return ret; } @@ -870,6 +889,7 @@ static int exynos5_i2c_remove(struct platform_device *pdev) i2c_del_adapter(&i2c->adap); clk_unprepare(i2c->clk); + clk_unprepare(i2c->pclk); return 0; } @@ -881,6 +901,7 @@ static int exynos5_i2c_suspend_noirq(struct device *dev) i2c_mark_adapter_suspended(&i2c->adap); clk_unprepare(i2c->clk); + clk_unprepare(i2c->pclk); return 0; } @@ -890,21 +911,30 @@ static int exynos5_i2c_resume_noirq(struct device *dev) struct exynos5_i2c *i2c = dev_get_drvdata(dev); int ret = 0; - ret = clk_prepare_enable(i2c->clk); + ret = clk_prepare_enable(i2c->pclk); if (ret) return ret; + ret = clk_prepare_enable(i2c->clk); + if (ret) + goto err_pclk; + ret = exynos5_hsi2c_clock_setup(i2c); - if (ret) { - clk_disable_unprepare(i2c->clk); - return ret; - } + if (ret) + goto err_clk; exynos5_i2c_init(i2c); clk_disable(i2c->clk); + clk_disable(i2c->pclk); i2c_mark_adapter_resumed(&i2c->adap); return 0; + +err_clk: + clk_disable_unprepare(i2c->clk); +err_pclk: + clk_disable_unprepare(i2c->pclk); + return ret; } #endif From patchwork Wed Dec 1 19:04:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 12694385 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 CCD30C433F5 for ; Wed, 1 Dec 2021 19:08:07 +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:References:In-Reply-To: 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: List-Owner; bh=9C2JROvkVZQ1TPUlP7Em4JdfjVL0B7Sxcw4lQNSDb3s=; b=kUjeSKh2y9LfRw exKNMM7JFvu1cfhQUBnRKxUTjAqZznOrks3g7eFWswkhjUy49Dwn9wcmz1dx5R9nbNNkYnsxbEU9w zxdZ7k5ZoD8Y/gIis5Wlc5Pq1WwGY+7LP0h4dXpXICMtcoYPVGEqrpoxS/yJ/rGQ8HAdu+3qKgIHy cCA3T+At/vLz+ZrnQGf0ex3Itt1btN7xOVpl3rZdI3MkjjvBJdEK/XJFNKebOOPQKxcY+dL32+PRx 3+SFllim7qGkbdCF97/R0IqCavtuCGwgtSyjZU7ngu5BCZJACNyin3yMeES0pRNUrNVR94gAPNcp8 mKunlX84g1cuSUjTn71Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1msUvq-009t9l-F7; Wed, 01 Dec 2021 19:06:18 +0000 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1msUuh-009soQ-Hs for linux-arm-kernel@lists.infradead.org; Wed, 01 Dec 2021 19:05:09 +0000 Received: by mail-lf1-x136.google.com with SMTP id b40so65442341lfv.10 for ; Wed, 01 Dec 2021 11:05:07 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=d6fIBufmD5QRMsiw/gE/8E+34ToRCzmP+LytC0+70WA=; b=fEwES4k7XV41oxKjE9076qaNcNBSMHNFAhXgS+OoH/wfCgfA7Omf9+QTWzXH+1O22P bJjzldE4J2xo8XME/WQRtuDpwzg/NmNVjUy4lYve9X5mM0vKBfgszZ1EedRZtYjS8gxS SCwbVv4WXThSbX1fPCzbqzfjGrAF/W3wS9IXCT63GL5QfNE1Dig8v92tAGkB/eP15+V2 FSEVaqfrRFO3fKoBr6aZQscuTG5tH1c3ICI4w1lZie+wqeFub5gCYdGU5QV43JlY/B3a BzlOkHaNCmMXicSPAPKmrq3an0KR1khryejau7fF09f5PyZi3MyLFKD660GpUOew1+HU Gefw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=d6fIBufmD5QRMsiw/gE/8E+34ToRCzmP+LytC0+70WA=; b=QfrFj6xpZnOl+UHnK5XBklgDAY5FUFIGVP3wtAjxlXWPPsy8DfTX41uePAedlduU+q X5NsGwqbOT1qF+483Mrc4KxobpB74/LcOle3zO5z+g1HkNx8soua4YeSbLxEOFW50y06 Ob64QFK9ANmavNBv8T66lzFWwrzoKQeNrc4/n1gAUQMLHCviHGKAdqb5ZSO2vAwMmsTT rdeO33o6bdXW3CaFBT8JT2Osd4PnzVXGnnT7h4dbhtz337pEl/NP05FEb3M7dzo83Qv+ Y672dYUPj9rh4U/bD2hYwkpnuAnMOYsm92H0NMNblZoB9PN3cWWnOT9hV4pCkfK4xqdF EULQ== X-Gm-Message-State: AOAM532TiwoTcCRO5c+7Eb/R+bKkP7Op1YSaguieGrMhrQouBRDgwWnF cWcGDAul6MHzT3m2J0MFpQUwJg== X-Google-Smtp-Source: ABdhPJyvjE/0qbt84gWoIGc+pyqYk+/D639fFxWAkgip4SenMEvpmY1/UWceA3HcjGJREntdEe18JQ== X-Received: by 2002:ac2:5bce:: with SMTP id u14mr7529672lfn.467.1638385506127; Wed, 01 Dec 2021 11:05:06 -0800 (PST) Received: from localhost ([31.134.121.151]) by smtp.gmail.com with ESMTPSA id q1sm68855lfo.255.2021.12.01.11.05.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Dec 2021 11:05:05 -0800 (PST) From: Sam Protsenko To: Krzysztof Kozlowski , Rob Herring Cc: Jaewon Kim , Chanho Park , David Virag , Youngmin Nam , Wolfram Sang , Arnd Bergmann , linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH 6/6] i2c: exynos5: Mention Exynos850 and ExynosAutoV9 in Kconfig Date: Wed, 1 Dec 2021 21:04:55 +0200 Message-Id: <20211201190455.31646-7-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211201190455.31646-1-semen.protsenko@linaro.org> References: <20211201190455.31646-1-semen.protsenko@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211201_110507_937846_1EF924CA X-CRM114-Status: GOOD ( 12.44 ) 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 I2C controller chosen by I2C_EXYNOS5 config option is also suitable for Exynos850 and ExynosAutoV9 SoCs. State that specifically in I2C_EXYNOS5 symbol help section. Signed-off-by: Sam Protsenko Reviewed-by: Krzysztof Kozlowski Reviewed-by: Chanho Park --- drivers/i2c/busses/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index df89cb809330..42da31c1ab70 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig @@ -617,7 +617,7 @@ config I2C_EXYNOS5 help High-speed I2C controller on Samsung Exynos5 and newer Samsung SoCs: Exynos5250, Exynos5260, Exynos5410, Exynos542x, Exynos5800, - Exynos5433 and Exynos7. + Exynos5433, Exynos7, Exynos850 and ExynosAutoV9. Choose Y here only if you build for such Samsung SoC. config I2C_GPIO