Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp984883lqh; Sat, 1 Jun 2024 04:54:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWfcANemT85BxfuEaE0KIo2WpmjXj4GHbo9kHiULAltZvPKQhWAZIyuryu5pMuxp4+8SCSoPMac9rO3CXjGY2zfCH9IYC3wspCPWYXcuQ== X-Google-Smtp-Source: AGHT+IF8egk6aYPHeS/8gLoLhr2g9QMUToyDCy8ly26gMDKVqXUq6Ouvp/Tjgyr8CSmCbT+y6m6h X-Received: by 2002:a05:6214:5b06:b0:6ad:73e2:8e8a with SMTP id 6a1803df08f44-6aecd6c25e0mr44350146d6.39.1717242873498; Sat, 01 Jun 2024 04:54:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717242873; cv=pass; d=google.com; s=arc-20160816; b=MsA0DM11g4U2+WFaCXTASv+GXxl1mUOK7LufW1qq9PHwO70bqGUKkXhKa+MSb8d9ma ThIJq0cEs8vwaPLavODtOuIP2+2uzbZCvjzQuc9830ExAyc7N3HGY2eafuXko0LhzM02 JwdpKvy2sBfc11ywEHQJpk/h9n/NlLplmyj5vRtqcKjc9IG9qW07r3ZuQw5X3WPH3xhK WOvR0qCOhcwmHa6Dr7aUAT5PjT/vazblqCrVLkpGaYgcpUpCI2w/LdY7xoZpwoFl/0Xv G+r9po9MlvsfFkOoQINxfYcnn+WVDU974mVN+nRNB0+Gxk6d9wxnJQyhWFnEMHCqSi/Z TQ3Q== 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:feedback-id:references :in-reply-to:message-id:subject:cc:from:to:date:dkim-signature; bh=ZQZES2BbNvBUeOffC7dAFTAqf4ZRcVbqy7kUlYlzRxU=; fh=XtxZ4YsR1CpzJ4pSl75bBs4NUpM4G9nNzzYLWUpF038=; b=vZJgeKBtzrKByyfdbIhj5qKU7dng6yd3DJeVYkJ7Wsb/9SRp8z7daZMP5zHccq0sDN fXJLwL+X5OhSK25RXPnQAm8gRaY+0mttwhvxirB5VlSGQ93p6kabZ6SbdIidEp6a0RO1 LFsRfVPVxIB4FxdT3gTCnUaqtW0fJn2j77AzSvQoCvtFmC4HTQ1dpKBKvvpvwDvBs7Sa n0UlmYomqj7sPNeHspIZ2HDmIT6ObLWjUdHlywpMcbJfbKbytKp0l5VCQ9ptUYzoE8Nj OjBEDbMGFJKN0tGmClQyGZjZ0JYcRtiVpXZyWFAkH1eY1AcKKemoLz8uH1pnRgbDXDbI EKsA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@protonmail.com header.s=protonmail3 header.b=DUcjn+J5; arc=pass (i=1 spf=pass spfdomain=protonmail.com dkim=pass dkdomain=protonmail.com dmarc=pass fromdomain=protonmail.com); spf=pass (google.com: domain of linux-kernel+bounces-197818-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197818-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 6a1803df08f44-6ae4b403c31si42450216d6.216.2024.06.01.04.54.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Jun 2024 04:54:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-197818-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@protonmail.com header.s=protonmail3 header.b=DUcjn+J5; arc=pass (i=1 spf=pass spfdomain=protonmail.com dkim=pass dkdomain=protonmail.com dmarc=pass fromdomain=protonmail.com); spf=pass (google.com: domain of linux-kernel+bounces-197818-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197818-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 388891C20F7F for ; Sat, 1 Jun 2024 11:54:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A418B1509B0; Sat, 1 Jun 2024 11:54:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=protonmail.com header.i=@protonmail.com header.b="DUcjn+J5" Received: from mail-4325.protonmail.ch (mail-4325.protonmail.ch [185.70.43.25]) (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 4E39E15098E for ; Sat, 1 Jun 2024 11:54:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.70.43.25 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717242850; cv=none; b=OZoD5zsilKrWf+4tpNKuXBv5JJr2VVgcWnSKOp5tRa80unhJJJVSP7zlT9rd23wJ4YPolvlcXgHAfdHExE1ldVEtpypHZhdhUte8OQu1v3pZV5QmbdZuiDNxGRJdaIi4LRs+tgMHY8dsCorkMzhrR1jJnYBdRqQ6h+ADQDXPWu0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717242850; c=relaxed/simple; bh=rTGNR1gjpqxgwEbWGFTcY+0ou57HsU3yOk3rGq/T+XQ=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=T+CWzkuPdsU2p/OQ/7Pt1VTN2/nCmlnskzBGEwOM2ajQs5bl2pyhXJ+9jk957fvv+iT37yZVJnNcL4HvuOieIyXvCrtB+5Q8EXg/Wx3BOzcL16usF8j7Tc0PhhHsdMPYpmxUd0/E01xNBAtx2nuxp6071OSPRERRQYOJs79hIz0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=protonmail.com; spf=pass smtp.mailfrom=protonmail.com; dkim=pass (2048-bit key) header.d=protonmail.com header.i=@protonmail.com header.b=DUcjn+J5; arc=none smtp.client-ip=185.70.43.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=protonmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=protonmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1717242841; x=1717502041; bh=ZQZES2BbNvBUeOffC7dAFTAqf4ZRcVbqy7kUlYlzRxU=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=DUcjn+J5bQOBpjzJPFGbK93HK4b50ocPdOIVe+MusH+LuPmCJCgaigQ5FBeZWIpdA F7zzQY57BSZ/+vSQfzJEvFij47CP5AtE7q/WGyeqIvMhTrnRl2moOxgtddnymFgb4c Ckud5tH8LTR970qlCotng7fgS1xOmdRGKb8Ka2WEBkQ/f7aBeIDfCWdVPD4jVyOEPc jBrb0N/sthOuiKduH8lAW9G21Op0mxBHnDFA407j5JrQZH6a5QNWyhZStE3wgOoNUf cgSIP5ua6apXFTjaRLMdtGpaunqCrC/v1aspx3lPxQxBk/IZ/CMASVys161GAEwrHi pBdAeK+1N8y1A== Date: Sat, 01 Jun 2024 11:53:57 +0000 To: linux-kernel@vger.kernel.org From: Raymond Hackley Cc: Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Siddharth Manthan , Stephan Gerhold , Nikita Travkin , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Joe Mason Subject: [PATCH 1/3] arm64: dts: qcom: msm8916-samsung-gprimeltecan: Add NFC Message-ID: <20240601115321.25314-2-raymondhackley@protonmail.com> In-Reply-To: <20240601115321.25314-1-raymondhackley@protonmail.com> References: <20240601115321.25314-1-raymondhackley@protonmail.com> Feedback-ID: 49437091:user:proton X-Pm-Message-ID: fcf6c71ce66daa31f8cf29645cd200c4b361e6b1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Joe Mason The Samsung Galaxy Grand Prime CAN has a Samsung S3FWRN5 NFC chip that works quite well with the s3fwrn5 driver in the Linux NFC subsystem. The clock setup for the NFC chip is a bit special (although this seems to be a common approach used for Qualcomm devices with NFC): The NFC chip has an output GPIO that is asserted whenever the clock is needed to function properly. On the A3/A5 this is wired up to PM8916 GPIO2, which is then configured with a special function (NFC_CLK_REQ or BB_CLK2_REQ). Enabling the rpmcc RPM_SMD_BB_CLK2_PIN clock will then instruct PM8916 to automatically enable the clock whenever the NFC chip requests it. The advantage is that the clock is only enabled when needed and we don't need to manage it ourselves from the NFC driver. Signed-off-by: Joe Mason [Stephan: Put NFC pinctrl into common dtsi to share it with other variants] Signed-off-by: Stephan Gerhold [Raymond: Use interrupts-extended. Keep &blsp_i2c6 enabled by default] Signed-off-by: Raymond Hackley --- .../qcom/msm8916-samsung-fortuna-common.dtsi | 38 +++++++++++++++++++ .../dts/qcom/msm8916-samsung-gprimeltecan.dts | 17 +++++++++ 2 files changed, 55 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/msm8916-samsung-fortuna-common.dtsi b= /arch/arm64/boot/dts/qcom/msm8916-samsung-fortuna-common.dtsi index 4f05cae68b37..4cc83b64e256 100644 --- a/arch/arm64/boot/dts/qcom/msm8916-samsung-fortuna-common.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8916-samsung-fortuna-common.dtsi @@ -6,6 +6,7 @@ #include #include #include +#include =20 / { =09aliases { @@ -227,6 +228,10 @@ touchscreen: touchscreen@20 { =09}; }; =20 +&blsp_i2c6 { +=09status =3D "okay"; +}; + &blsp_uart2 { =09status =3D "okay"; }; @@ -346,6 +351,29 @@ muic_int_default: muic-int-default-state { =09=09bias-disable; =09}; =20 +=09nfc_default: nfc-default-state { +=09=09irq-pins { +=09=09=09pins =3D "gpio21"; +=09=09=09function =3D "gpio"; +=09=09=09drive-strength =3D <2>; +=09=09=09bias-pull-down; +=09=09}; + +=09=09nfc-pins { +=09=09=09pins =3D "gpio20", "gpio49"; +=09=09=09function =3D "gpio"; +=09=09=09drive-strength =3D <2>; +=09=09=09bias-disable; +=09=09}; +=09}; + +=09nfc_i2c_default: nfc-i2c-default-state { +=09=09pins =3D "gpio0", "gpio1"; +=09=09function =3D "gpio"; +=09=09drive-strength =3D <2>; +=09=09bias-disable; +=09}; + =09sdc2_cd_default: sdc2-cd-default-state { =09=09pins =3D "gpio38"; =09=09function =3D "gpio"; @@ -367,3 +395,13 @@ tsp_int_default: tsp-int-default-state { =09=09bias-disable; =09}; }; + +&pm8916_gpios { +=09nfc_clk_req: nfc-clk-req-state { +=09=09pins =3D "gpio2"; +=09=09function =3D "func1"; +=09=09power-source =3D ; +=09=09bias-disable; +=09=09input-enable; +=09}; +}; diff --git a/arch/arm64/boot/dts/qcom/msm8916-samsung-gprimeltecan.dts b/ar= ch/arm64/boot/dts/qcom/msm8916-samsung-gprimeltecan.dts index 4dc74e8bf1d8..7ac86fd3c703 100644 --- a/arch/arm64/boot/dts/qcom/msm8916-samsung-gprimeltecan.dts +++ b/arch/arm64/boot/dts/qcom/msm8916-samsung-gprimeltecan.dts @@ -29,6 +29,23 @@ &bosch_magn { =09status =3D "okay"; }; =20 +&blsp_i2c6 { +=09nfc@27 { +=09=09compatible =3D "samsung,s3fwrn5-i2c"; +=09=09reg =3D <0x27>; + +=09=09interrupts-extended =3D <&tlmm 21 IRQ_TYPE_EDGE_RISING>; + +=09=09en-gpios =3D <&tlmm 20 GPIO_ACTIVE_HIGH>; +=09=09wake-gpios =3D <&tlmm 49 GPIO_ACTIVE_HIGH>; + +=09=09clocks =3D <&rpmcc RPM_SMD_BB_CLK2_PIN>; + +=09=09pinctrl-0 =3D <&nfc_default>, <&nfc_clk_req>; +=09=09pinctrl-names =3D "default"; +=09}; +}; + &mpss_mem { =09/* Firmware for gprimeltecan needs more space */ =09reg =3D <0x0 0x86800000 0x0 0x5400000>; --=20 2.39.2