From patchwork Thu Feb 9 11:37:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manikanta Guntupalli X-Patchwork-Id: 13134429 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 B1D52C05027 for ; Thu, 9 Feb 2023 11:38:57 +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=yX9xNx8scJIdgWxum70fFvLBrl9o3QBI0t38zL1J5yQ=; b=Goh9MmIK2kbIJj EtHWOvrAD9wqoQK3T4GMsozfbX8qmAJ4MIajalpPl2Ag6X9RZv/a08moaX19YR5YBbLGNIjNinprs 7jkr/Oc2XiKFCrodOheS8heZpNvtR+V5K+2AcecaPEbDLsnJJHY/cVyrbg9p6NJU/8ef8bsSndjcq VtB6elvoPqHnkQ4JPH2FBEYu9/1aFegS03iGEF4LUzo0hCkHyCVIIobrnCp7MifUl/rPNP3z73p06 ISYDDf6qKkzyLW+3LsKSXdkcTEbnS+kSoZB1oKSTHH8aSR8aphn/YYZGZB4gcrqr0rmXJSwPCyykU Tdt1t2Xe8sZilhw/MRTw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pQ5FS-001L90-SY; Thu, 09 Feb 2023 11:37:55 +0000 Received: from mail-dm6nam04on2060e.outbound.protection.outlook.com ([2a01:111:f400:7e8b::60e] helo=NAM04-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pQ5FP-001L7q-H1 for linux-arm-kernel@lists.infradead.org; Thu, 09 Feb 2023 11:37:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tenu2ftdbPhdhWd48RzGfdvVm0RtqDTTiv7DSrenATtpR76J+E86Ms+tNelAu4vP8B/ECDE9otek28+5Ru7WcYlvenyDpI2NhYPYJ97OdQtZqzyUa5vq8O+mx3u6R88b9OdJli3dfLeyWeosHglDaU3SvkSgg+ODwBuAQfYUzQ7uKArPduI8Pp0S41zHGArqvm3OVQZfWpLVImDRxi2HDTk3H0g2sJnf3SuAhOjmPIfZOb31G7k4yIO0QDyEdOk1PzKRQ1qOz+/PZleRNBdnHVV90xVAJXuQqcwOzi57Ei1zQIji+iNPuNbz9UhX8x6DnjnFnZ8hP3FM3R14ILDObw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VTW1rPAfGYXE0C7eFxNCzEElcbw2ilIUMSihvB88G4M=; b=F+Fb/2Q/Jl6NqDJsVdEDPbXdZtMvU8N/fyZw0f7w5HyZjLbzJ2zVQwXm50Ek+Y7O+wGzeMiIlb570K2Xc2iHvTzg7V7AD6610RbS9nKqC/XYdbmGHiMyqBs/pfh/Cj8hxwD0iztd8ZejKquTGX6ahrAfAAfbh+Mc7BP8wikQIzgZGLVT2rcGRgV7D1JkhuHJBynQj5y8STfNnr8XxMQ1lTy5ErCifpA5eOlkMnTKAp0FHseXVdIJiN7JLofzqPEE2A4kMY6Dmy4bzRlheoL4eqFFwAvWYR/bDXxH9zYRQtwwr/utteFenzIN0TdoC8ILne4vUUefhM5LxXlnohkfSw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=amd.com smtp.mailfrom=xilinx.com; dmarc=fail (p=quarantine sp=quarantine pct=100) action=quarantine header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VTW1rPAfGYXE0C7eFxNCzEElcbw2ilIUMSihvB88G4M=; b=jTOe0RJvlqHf251jLSTAXfQXtLyHpB6tR3MdNlo2pJq/+kKExIHPk5bVH0lyQJY3Bx2g7K4iQ2XKe9UYKmDt2DJBY4CCft0a6Fs7FU4hu/CpG4+zF/VMa/9cJ4JFPchuDbEhO36x0jfk5rnT3B/ivcKlNwmOlLT1bsiJQpdjtoM= Received: from DS7PR03CA0082.namprd03.prod.outlook.com (2603:10b6:5:3bb::27) by CY8PR02MB9180.namprd02.prod.outlook.com (2603:10b6:930:9b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34; Thu, 9 Feb 2023 11:37:49 +0000 Received: from DM3NAM02FT009.eop-nam02.prod.protection.outlook.com (2603:10b6:5:3bb:cafe::c1) by DS7PR03CA0082.outlook.office365.com (2603:10b6:5:3bb::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.19 via Frontend Transport; Thu, 9 Feb 2023 11:37:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=fail action=quarantine header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; pr=C Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by DM3NAM02FT009.mail.protection.outlook.com (10.13.5.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6086.19 via Frontend Transport; Thu, 9 Feb 2023 11:37:48 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Thu, 9 Feb 2023 03:37:42 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Thu, 9 Feb 2023 03:37:42 -0800 Received: from [172.23.64.3] (port=47171 helo=xhdvnc103.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1pQ5FG-0009Ke-Kf; Thu, 09 Feb 2023 03:37:42 -0800 Received: by xhdvnc103.xilinx.com (Postfix, from userid 90444) id 95BCA1055BA; Thu, 9 Feb 2023 17:07:29 +0530 (IST) From: Manikanta Guntupalli To: , , , , , , , , CC: , , , , , Raviteja Narayanam Subject: [PATCH V5 1/3] dt-bindings: i2c: xiic: Add 'xlnx,axi-iic-2.1' to compatible Date: Thu, 9 Feb 2023 17:07:24 +0530 Message-ID: <1675942646-31006-2-git-send-email-manikanta.guntupalli@amd.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1675942646-31006-1-git-send-email-manikanta.guntupalli@amd.com> References: <1675942646-31006-1-git-send-email-manikanta.guntupalli@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM3NAM02FT009:EE_|CY8PR02MB9180:EE_ X-MS-Office365-Filtering-Correlation-Id: 196c2329-f2ab-408f-4e5a-08db0a92122e X-MS-Exchange-SenderADCheck: 0 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Sje8ZvIdcD1F2xFL2snlpcQX0I+YxaISbD+wu2lmeoDJvZz/L+FlZz2GMJitA0bPxf6agNWR83xv7mbS12Ob6uPMcwHNrWevoYx/dhmGKdWDLTjdkzIcHH/Quy87eaSI+Sf+9OkN0jQFCrcwnLaza/6OGNworpouN56mYLf4kONAeXhnFu8J75ClggSZHHyhFvhg4JGFD+zCAjQ0+JphylAwgs4JEiU2mtlnQIC6muG1+I29hfHdLQ+CfGWzq5OVOJ1kdhkS+FcO4kwF4y+05WOs9pKvJImOF+GnQaSG6aM3vrZFMBG9j0zUbEqdCl3lKa6p93EgVD4bnRmxlJOFYKjVhntygZLBhqZ5OSAq3ItRqjXUM6bPJQ25AJZ2xB1LuZBAJTld6XTZdUD5njfsFVg6rdbFwRWr7JPlqf3//j0MsL6NgTFBj6hB9U6xsgLdBR18DhUiQwDyQypF+nhsLfhJmsl/fxR/UyXra/9AEXG/F0LVWpoKToNtilM/5uiCuHplrzXPANczZhUwFCtAszSmOFCx1ZybosZ4ozlz2SMkutbi8YQZ7R67e1Y/0QBUbN9E5AkL2K0OeCj2Zq36eAZR5TpN/Fa17MU2wpi6EcRgAjJ6dXqzsLALiEEWuepPvlQnytIqis9lC2+lWfLUWiTVdJ+ZJLw8GH05AiRNLqfdTlh/E3HHHVDFuxE0lSjyA1xNoIoDBtRYHSh3gk24qfGmE9fD8fTSvM32u/JC+uFX4eoZRKCiukBiLKVI7I3w X-Forefront-Antispam-Report: CIP:149.199.62.198;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapexch02.xlnx.xilinx.com;PTR:unknown-62-198.xilinx.com;CAT:NONE;SFS:(13230025)(376002)(39860400002)(396003)(136003)(346002)(451199018)(36840700001)(40470700004)(46966006)(42882007)(336012)(7416002)(36860700001)(5660300002)(8936002)(2616005)(70586007)(70206006)(4326008)(82310400005)(8676002)(478600001)(41300700001)(47076005)(36756003)(54906003)(110136005)(2906002)(316002)(356005)(83380400001)(42186006)(7636003)(82740400003)(26005)(83170400001)(186003)(40460700003)(6266002)(6666004)(44832011)(40480700001)(107886003)(102446001)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2023 11:37:48.8647 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 196c2329-f2ab-408f-4e5a-08db0a92122e X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.62.198];Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: DM3NAM02FT009.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR02MB9180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230209_033751_589970_4B6274D9 X-CRM114-Status: UNSURE ( 8.87 ) X-CRM114-Notice: Please train this message. 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: Raviteja Narayanam Add xilinx I2C new version 'xlnx,axi-iic-2.1' string to compatible Add clock-frequency as optional property. Signed-off-by: Raviteja Narayanam Signed-off-by: Manikanta Guntupalli Acked-by: Michal Simek --- Changes for v4: Add description for clock-frequency in xlnx,xps-iic-2.00.a.yaml Changes for v5: Update description and add default value details for clock-frequency in xlnx,xps-iic-2.00.a.yaml --- .../devicetree/bindings/i2c/xlnx,xps-iic-2.00.a.yaml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/i2c/xlnx,xps-iic-2.00.a.yaml b/Documentation/devicetree/bindings/i2c/xlnx,xps-iic-2.00.a.yaml index 8d241a703d85..3f95ff2b5771 100644 --- a/Documentation/devicetree/bindings/i2c/xlnx,xps-iic-2.00.a.yaml +++ b/Documentation/devicetree/bindings/i2c/xlnx,xps-iic-2.00.a.yaml @@ -14,7 +14,9 @@ allOf: properties: compatible: - const: xlnx,xps-iic-2.00.a + enum: + - xlnx,axi-iic-2.1 + - xlnx,xps-iic-2.00.a reg: maxItems: 1 @@ -30,6 +32,13 @@ properties: description: | Input clock name. + clock-frequency: + description: + Optional I2C SCL clock frequency. If not specified, do not configure + in software, rely only on hardware design value. Supported frequencies + are 100KHz, 400KHz and 1MHz. + default: 100000 + required: - compatible - reg From patchwork Thu Feb 9 11:37:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manikanta Guntupalli X-Patchwork-Id: 13134430 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 EF988C61DA4 for ; Thu, 9 Feb 2023 11:39:09 +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=vhevP3xDOJqYW8ZnqU33yx/fYriVddH+6PvlwZgj/I8=; b=gw2BfXtRdIJ15/ yYDIwrBu7ki57MWx/FMH3bgIdv/awO44vmG3NyJ0rFJ0KM4mV2B1F9Cz0XC0vscuIPbyKtarKbB7A dBocg3cLqpP1aru9JhWc8VNX9nQwjXTEyJ9p30+ql87htpWHcMJO/WfX6StaPL1uVn1tokeAft4RR b17axtlmwMHyxN+VVCmptvymcfh4jid1cV0nXrImuF5Dln/pBfo48K/DHNTt1Ur62ve2s2Qke/12/ Ul82Xb1jjEN2/ndQzzmul2RZcMiAAFEp+1eRkYxGEGD2oEdtk+DioR/tjT5rXag1Zzqxq1rwo6UwA SgqBOvNiMxAioA4kvtmg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pQ5Ff-001LC5-3C; Thu, 09 Feb 2023 11:38:07 +0000 Received: from mail-bn8nam11on20601.outbound.protection.outlook.com ([2a01:111:f400:7eae::601] helo=NAM11-BN8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pQ5Fb-001LAU-M6 for linux-arm-kernel@lists.infradead.org; Thu, 09 Feb 2023 11:38:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NqAY3LPKpLOWpnrySsu3PgPU5Gr2a2gBkRiMWpEuShj9iT6zjH7u3UVoBPb4kzfa2UBncIUp4f72c6quF8p2ZiDDMcXG1Aw8rGc+MhMJFQrUvkRdsMMbIuOgvxm17WdLqrhjjzcoyUanAkroGT+IEnrtQavO9ce7AEj5OSw9D2IKYsdgzDL+uVCF1QqDwNGESAJwg91bRX8vp3jSe+9cPYf1m/8cfEHwOu+CjgOgGhvoX4aa892Bcmxeo34LfjESafCSq4RnaV3WsXW0Stz7h+dzyW0hGPh/ChDm7NoQhNaBA72OekIAk9IeFCfOdfHCCs6laE5BOt0BNU4G+Tlwgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qEVsbWMhvskk0tDHfRtWjbb5khEKp1SDVyrJPV5vf04=; b=X/Q8KEbdGTeFBaZSaBlKKe05rpWp19PNVIh6T+I2skOTU6gyChdQzQ1LMt9E02tSFWngEQ9AfgxyAb/8wouN6ZaE6Ox6klRwYwsd794A3TaEY27q2NzCv+IyEe5obz06SexiSSx453TkQQrAUO/VKJ5f4cMWY3WivXibTe5wXnD/3oBENPEdeU3JjPfi4z7mH5fQMtTxGkQUKFravisawvFnldi3fv11Wyc8SJFLb9Xe3Tm+TUIYIE8TDi0aObSvCQTxuBXK6ONZGlQF1xtuJKfLg4pckizY8HO2iqeAfmK3RE/FyyR5a2iGE2AQC5weUvZr6d4rEs7BxsFwY4BmnA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=amd.com smtp.mailfrom=xilinx.com; dmarc=fail (p=quarantine sp=quarantine pct=100) action=quarantine header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qEVsbWMhvskk0tDHfRtWjbb5khEKp1SDVyrJPV5vf04=; b=fPc4xec45CBoc3pdwKImTGSI3xkH42/xQAXflyyRZMH3+i976BieCAKep62JQgClQD3d/4VPDEIYumHd91vX9hknhfM5bEqeKat3rMKhkbn9LuG5zv94FwC4kLGUbVoJ+Xe16mSgyo7buPKPA3weYSTQ8PuOKkkDIGjXOaFB/sM= Received: from DM6PR06CA0025.namprd06.prod.outlook.com (2603:10b6:5:120::38) by BL3PR02MB8185.namprd02.prod.outlook.com (2603:10b6:208:338::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34; Thu, 9 Feb 2023 11:37:59 +0000 Received: from DM3NAM02FT027.eop-nam02.prod.protection.outlook.com (2603:10b6:5:120:cafe::b) by DM6PR06CA0025.outlook.office365.com (2603:10b6:5:120::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.19 via Frontend Transport; Thu, 9 Feb 2023 11:37:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=fail action=quarantine header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; pr=C Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by DM3NAM02FT027.mail.protection.outlook.com (10.13.5.130) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6086.19 via Frontend Transport; Thu, 9 Feb 2023 11:37:58 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Thu, 9 Feb 2023 03:37:56 -0800 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Thu, 9 Feb 2023 03:37:56 -0800 Received: from [172.23.64.3] (port=47173 helo=xhdvnc103.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1pQ5FT-0007SE-QM; Thu, 09 Feb 2023 03:37:56 -0800 Received: by xhdvnc103.xilinx.com (Postfix, from userid 90444) id 1AEFE1055BB; Thu, 9 Feb 2023 17:07:31 +0530 (IST) From: Manikanta Guntupalli To: , , , , , , , , CC: , , , , , Raviteja Narayanam Subject: [PATCH V5 2/3] i2c: xiic: Update compatible with new IP version Date: Thu, 9 Feb 2023 17:07:25 +0530 Message-ID: <1675942646-31006-3-git-send-email-manikanta.guntupalli@amd.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1675942646-31006-1-git-send-email-manikanta.guntupalli@amd.com> References: <1675942646-31006-1-git-send-email-manikanta.guntupalli@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM3NAM02FT027:EE_|BL3PR02MB8185:EE_ X-MS-Office365-Filtering-Correlation-Id: d537d8e2-4de4-43b5-9395-08db0a9217fa X-MS-Exchange-SenderADCheck: 0 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SDJg5qtDSlMkDYf8d3ufPKEI3/v8ubmUV1nStq4H9phLFLKLu4QllmiLyGGZ/C0KBuLiUMP+QXee5xUkU2A/00XMKI0BZmYZ2h+PtdDSTtaFela3fD0tM91Nh5aeGl73AHgtpGntMjVR2pKgqSYITkichpm4xYU7tc2EOq1Pn6MptogVlyYNITttVvjxeIv786kxtNS2/obbxgTsMMLfLV2Dsqdmrfw+fzxf3h3mDzzGVv9Ncj+3be6dL8EchDsd5QIQuEJ4bR7gGC2wrzNP7/szSJQwVI3k/NZ4CwfLvw1189onpup4kC7s0BepNO51ckUYeIvq/jl+/Yijssywc9FUQ121oOWpB05TB/O6jyTYYrU3Owggg954IIP7K1ZAJTtSXRVoD9XK9l7bVWyFHaQ/f6Bc8Wy2/g8R+itN7zd+IQX76YhgkMJ4L0SHJIjPaGS0TPCft5yQJPIB6IvXFPXkxS7fb0DradfCXICvBmCIDvyFj6HfJlebhaJywBc4NJs1AtoJM+EbVTFzk8cWDrRDc4ps2nbEUr/t2gy/KDRI3W5/q7aYuwuM1qCW1kUtzRNN2S9uvg+N0pWnuR8SZ0rVfJiI1vvb7VAcSvWiKfrljYkzII8bIGENcPRIhQirV+IRpSE9/aXLJhSOIherWCswvN6ILu5SMo4GLQdhCwG+SoCzGBC1MDWLvQOSwsko+z8N8iqRt+K4h8HXir+90iFatX7QFZBDWX109uQyp3WMnIHI4BKbf72Dgg6o4EV8 X-Forefront-Antispam-Report: CIP:149.199.62.198;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapexch02.xlnx.xilinx.com;PTR:unknown-62-198.xilinx.com;CAT:NONE;SFS:(13230025)(376002)(136003)(346002)(39860400002)(396003)(451199018)(40470700004)(36840700001)(46966006)(40480700001)(316002)(42882007)(36860700001)(42186006)(478600001)(47076005)(83380400001)(110136005)(336012)(54906003)(36756003)(2616005)(15650500001)(40460700003)(356005)(26005)(6266002)(186003)(44832011)(5660300002)(7416002)(70206006)(70586007)(4326008)(82310400005)(41300700001)(8676002)(8936002)(6666004)(107886003)(2906002)(7636003)(83170400001)(82740400003)(102446001)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2023 11:37:58.5920 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d537d8e2-4de4-43b5-9395-08db0a9217fa X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.62.198];Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: DM3NAM02FT027.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR02MB8185 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230209_033803_753924_195ADC79 X-CRM114-Status: GOOD ( 10.00 ) 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: Raviteja Narayanam Xilinx AXI I2C IP is updated with a bug fix for dynamic mode reads. Older IPs are handled with a workaround in which they are using xiic standard mode for all these effected use cases. Add the new IP version to compatible. Signed-off-by: Raviteja Narayanam Signed-off-by: Manikanta Guntupalli Acked-by: Michal Simek --- drivers/i2c/busses/i2c-xiic.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c index 8503b5016aaf..682b3567e83e 100644 --- a/drivers/i2c/busses/i2c-xiic.c +++ b/drivers/i2c/busses/i2c-xiic.c @@ -1074,6 +1074,7 @@ static const struct xiic_version_data xiic_2_00 = { #if defined(CONFIG_OF) static const struct of_device_id xiic_of_match[] = { { .compatible = "xlnx,xps-iic-2.00.a", .data = &xiic_2_00 }, + { .compatible = "xlnx,axi-iic-2.1", }, {}, }; MODULE_DEVICE_TABLE(of, xiic_of_match); From patchwork Thu Feb 9 11:37:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manikanta Guntupalli X-Patchwork-Id: 13134431 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 68290C61DA4 for ; Thu, 9 Feb 2023 11:39:24 +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=HlVHKNeUxPToGDPn141NRK0QLcorsCkG+bqp0hsmCLQ=; b=VbaPV5I+8QHVSp 429o93RhA9gCkK6wLXD+8TXSivI4MSzDouNN6l25O9hVhAkbM4yFO7YTEPC38hE5MAjmHgv1pYDhA wsAs4/XgywkVDjqlcvWNi8jcbRudoJWRSxyI9KMebJHDvgZTx/tX4Xdqrd41Fkw3S+SbeqPeYhJwU ly1kp10AFunqpRRq9Lc5fAk7GsHSXei5A28KuHU66fN/1wTAcIhFWIP2Vqfnhqqisc7M/KAM/8PaU iqledkIewVt6meOgkVCmJqYnhjxsoQJR8XNPdUzBeWrekhaoNSlou8ZH+pRj5eOuDMRswXRHt9k/A fEELSqswZEgIb4VTL7KQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pQ5Ft-001LGO-Jb; Thu, 09 Feb 2023 11:38:23 +0000 Received: from mail-mw2nam04on20631.outbound.protection.outlook.com ([2a01:111:f400:7e8c::631] helo=NAM04-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pQ5Fo-001LEd-F7 for linux-arm-kernel@lists.infradead.org; Thu, 09 Feb 2023 11:38:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Mc1kOSx0qQUehZbRHWxSRdzFYSAyz6O2A4V9PyCulu+rUiDYNf9GGzR3xIrjIIGjUggHNVJaWSfWzWUuBhs9sFPlWvsl1691e+vpVb89tjy7q+X9UIKHJFem71+DkXo3XhA3qQZZBjImrfedoxOQeZdZNUrPsLl+F2JojxsAodrnWYPkI87sozhi1Mayw1U9PdbfqdUelqUPfPaXbIdVdEmBrpxpl9o6AnjJM3rZJAR1VJEJ4YZvKh8bkHRD4CBneu4ztKinwMeR1mFWJ5/N2wiKcQ2u75V/mSBEoP0YdkvnwBrH1SodGllyNFF2/fS0l41z1wAYEF6/J/EHi93cdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zBsX1+pRlI42Vjnyt7QG1jZNA26/1AjE4ooPk5i3+qE=; b=I656h9/a+7L8XEbG1xae1dCLYixK3IywLu53PcniEI0ajegOpxDWUno6fpMoDUTxurQtBumcIMPhHW/Hl91udf0oYIAUEF7+Rc6U7GeUn8j1mQJvKSgMN2ZwKgzo+asxOCVLqTseiPgwNzwHXfRCAMDxVt5Oouoclb6YB3j0Q85jXe9aoAXVAZ0otOIU6wAHeF8OXJafnQy8ms5kb/A7vkV7hMxAifBUg7k7fgdfrs4pBz5GY8Zq6Iu0TpI2ESH0jfNF2LMeHpOSKcWnBdbKexz5G6PfWgbWiyFpdUjbIATjGuGcvUhUkKdLWk8bfggwour7Ti/Z0jjThNWWlcyt+g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=amd.com smtp.mailfrom=xilinx.com; dmarc=fail (p=quarantine sp=quarantine pct=100) action=quarantine header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zBsX1+pRlI42Vjnyt7QG1jZNA26/1AjE4ooPk5i3+qE=; b=l5ZCdy2wGyJAA2Vh5FsKwMdzN7VCzH3L3nU+Lgw0QmsPI4O7sXMxPTn8JJ6FJ/wpWtnB5XhvUPg04Y14c2hSIAR2TPZ9HehRXKF4tf91zNY2UMOtMYuhKLU5S75kpxpCJnHq00j7a/gRjCxLXRGpMqNDL2L/oZYnt0rpdva0oYc= Received: from SA1P222CA0008.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:22c::35) by SJ0PR02MB7136.namprd02.prod.outlook.com (2603:10b6:a03:294::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.19; Thu, 9 Feb 2023 11:38:12 +0000 Received: from SN1NAM02FT0057.eop-nam02.prod.protection.outlook.com (2603:10b6:806:22c:cafe::8b) by SA1P222CA0008.outlook.office365.com (2603:10b6:806:22c::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.19 via Frontend Transport; Thu, 9 Feb 2023 11:38:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=fail action=quarantine header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; pr=C Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0057.mail.protection.outlook.com (10.97.4.123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6086.17 via Frontend Transport; Thu, 9 Feb 2023 11:38:12 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Thu, 9 Feb 2023 03:38:09 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Thu, 9 Feb 2023 03:38:09 -0800 Received: from [172.23.64.3] (port=47181 helo=xhdvnc103.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1pQ5Fh-0009OZ-08; Thu, 09 Feb 2023 03:38:09 -0800 Received: by xhdvnc103.xilinx.com (Postfix, from userid 90444) id C9C201055BC; Thu, 9 Feb 2023 17:07:32 +0530 (IST) From: Manikanta Guntupalli To: , , , , , , , , CC: , , , , , Raviteja Narayanam Subject: [PATCH V5 3/3] i2c: xiic: Add SCL frequency configuration support Date: Thu, 9 Feb 2023 17:07:26 +0530 Message-ID: <1675942646-31006-4-git-send-email-manikanta.guntupalli@amd.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1675942646-31006-1-git-send-email-manikanta.guntupalli@amd.com> References: <1675942646-31006-1-git-send-email-manikanta.guntupalli@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1NAM02FT0057:EE_|SJ0PR02MB7136:EE_ X-MS-Office365-Filtering-Correlation-Id: 2a32a8ed-86cf-46dc-af25-08db0a922000 X-MS-Exchange-SenderADCheck: 0 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vx0zQCTYk6YVeuSzE2d6QGjzmSZMPZ8W43bzNWuHoOdQ42jiMD5H3R3LHtIZXAOeE1vSkGOHXRomZyXVAllbOP+tw2FrGZmcongp8NtLQ40ln/z4TOkOaKnoj6UCrlMOCdfXERop5S2QrEQtfRapsIMsUX9LoPmA4dy2RJyfk1cyAhW3lLWeGbKTXuCKUJRuAig0u6DU/YgpKyZTzCYVimYuUQzqTJPZ8Gr5fElBbK9+9xVtaDzR8FYeYGQTVy6hdSzymHyhxiyXWppZ159BCMQmeBJDHBqv4vFH7lHPELGWjsrIyca8YG4af/841I5IecgQRZrNfOLp6fMfOwIFk3kUsFuLLe8ftWeC9+p3HEUuczRK9jfssNa/79AxsD5NiriPg3WpJs2QRbT6XX8gT6RM6WB8O8dsEZSFW/Q4CsfL6dANjiV4lKZ1N8aJR5Ee+6WUPMJt91IBNBP0mlKuEM+1Gk1LRfI4hdREeM8eZaOoXstKPBFdukUJa/eb9XOF4WzSatI5FUgdEAq2bBpKykiurpXBQ1hQ/bVCGWM+X/CjjS/7kBNL3fb4zc2YSc0GYdx9QAX9YKt6vyIr6f9iKXQkakfLoI9rSB9vy30d1/u/YN3UvI/2K/pEUtUQ+i3Dw9+lpqsdijuvZUJhbsttUPAfbh5NetkobrmY94SYZuCH7vRmd8Y8jlMxZ1tO6M+U6r7oNoK752BclJEVtW+k6rypfj9LDs5L984EKnJO1nA4OsFFnBZI5rHtuO5Z+Wd+ X-Forefront-Antispam-Report: CIP:149.199.62.198;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapexch01.xlnx.xilinx.com;PTR:unknown-62-198.xilinx.com;CAT:NONE;SFS:(13230025)(396003)(136003)(346002)(376002)(39860400002)(451199018)(36840700001)(46966006)(40470700004)(47076005)(5660300002)(6666004)(8676002)(40460700003)(83380400001)(107886003)(8936002)(42882007)(44832011)(336012)(7416002)(41300700001)(70586007)(4326008)(70206006)(2906002)(42186006)(316002)(26005)(356005)(36860700001)(478600001)(40480700001)(36756003)(7636003)(82310400005)(186003)(83170400001)(54906003)(40140700001)(110136005)(6266002)(2616005)(82740400003)(102446001)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2023 11:38:12.0694 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2a32a8ed-86cf-46dc-af25-08db0a922000 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.62.198];Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0057.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR02MB7136 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230209_033816_563440_611C2A81 X-CRM114-Status: GOOD ( 22.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: Raviteja Narayanam From 'clock-frequency' device tree property, configure I2C SCL frequency by calculating the timing register values according to input clock. After soft reset in reinit function, the timing registers are set to default values (configured in design tool). So, setting SCL frequency is done inside reinit function after the soft reset. This allows configuration of SCL frequency exclusively through software via device tree property, overriding the design. If the clock-frequency parameter is not specified in DT, driver doesn't configure frequency, making it backward compatible. Signed-off-by: Raviteja Narayanam Signed-off-by: Manikanta Guntupalli Acked-by: Michal Simek --- drivers/i2c/busses/i2c-xiic.c | 148 ++++++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+) diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c index 682b3567e83e..1e89e8270749 100644 --- a/drivers/i2c/busses/i2c-xiic.c +++ b/drivers/i2c/busses/i2c-xiic.c @@ -46,6 +46,12 @@ enum xiic_endian { BIG }; +enum i2c_scl_freq { + REG_VALUES_100KHZ = 0, + REG_VALUES_400KHZ = 1, + REG_VALUES_1MHZ = 2 +}; + /** * struct xiic_i2c - Internal representation of the XIIC I2C bus * @dev: Pointer to device structure @@ -66,6 +72,8 @@ enum xiic_endian { * @prev_msg_tx: Previous message is Tx * @quirks: To hold platform specific bug info * @smbus_block_read: Flag to handle block read + * @input_clk: Input clock to I2C controller + * @i2c_clk: I2C SCL frequency */ struct xiic_i2c { struct device *dev; @@ -86,12 +94,37 @@ struct xiic_i2c { bool prev_msg_tx; u32 quirks; bool smbus_block_read; + unsigned long input_clk; + unsigned int i2c_clk; }; struct xiic_version_data { u32 quirks; }; +/** + * struct timing_regs - AXI I2C timing registers that depend on I2C spec + * @tsusta: setup time for a repeated START condition + * @tsusto: setup time for a STOP condition + * @thdsta: hold time for a repeated START condition + * @tsudat: setup time for data + * @tbuf: bus free time between STOP and START + */ +struct timing_regs { + unsigned int tsusta; + unsigned int tsusto; + unsigned int thdsta; + unsigned int tsudat; + unsigned int tbuf; +}; + +/* Reg values in ns derived from I2C spec and AXI I2C PG for different frequencies */ +static const struct timing_regs timing_reg_values[] = { + { 5700, 5000, 4300, 550, 5000 }, /* Reg values for 100KHz */ + { 900, 900, 900, 400, 1600 }, /* Reg values for 400KHz */ + { 380, 380, 380, 170, 620 }, /* Reg values for 1MHz */ +}; + #define XIIC_MSB_OFFSET 0 #define XIIC_REG_OFFSET (0x100 + XIIC_MSB_OFFSET) @@ -110,6 +143,19 @@ struct xiic_version_data { #define XIIC_RFD_REG_OFFSET (0x20 + XIIC_REG_OFFSET) /* Rx FIFO Depth reg */ #define XIIC_GPO_REG_OFFSET (0x24 + XIIC_REG_OFFSET) /* Output Register */ +/* + * Timing register offsets from RegisterBase. These are used only for + * setting i2c clock frequency for the line. + */ +#define XIIC_TSUSTA_REG_OFFSET (0x28 + XIIC_REG_OFFSET) /* TSUSTA Register */ +#define XIIC_TSUSTO_REG_OFFSET (0x2C + XIIC_REG_OFFSET) /* TSUSTO Register */ +#define XIIC_THDSTA_REG_OFFSET (0x30 + XIIC_REG_OFFSET) /* THDSTA Register */ +#define XIIC_TSUDAT_REG_OFFSET (0x34 + XIIC_REG_OFFSET) /* TSUDAT Register */ +#define XIIC_TBUF_REG_OFFSET (0x38 + XIIC_REG_OFFSET) /* TBUF Register */ +#define XIIC_THIGH_REG_OFFSET (0x3C + XIIC_REG_OFFSET) /* THIGH Register */ +#define XIIC_TLOW_REG_OFFSET (0x40 + XIIC_REG_OFFSET) /* TLOW Register */ +#define XIIC_THDDAT_REG_OFFSET (0x44 + XIIC_REG_OFFSET) /* THDDAT Register */ + /* Control Register masks */ #define XIIC_CR_ENABLE_DEVICE_MASK 0x01 /* Device enable = 1 */ #define XIIC_CR_TX_FIFO_RESET_MASK 0x02 /* Transmit FIFO reset=1 */ @@ -310,12 +356,102 @@ static int xiic_wait_tx_empty(struct xiic_i2c *i2c) return 0; } +/** + * xiic_setclk - Sets the configured clock rate + * @i2c: Pointer to the xiic device structure + * + * The timing register values are calculated according to the input clock + * frequency and configured scl frequency. For details, please refer the + * AXI I2C PG and NXP I2C Spec. + * Supported frequencies are 100KHz, 400KHz and 1MHz. + * + * Return: 0 on success (Supported frequency selected or not configurable in SW) + * -EINVAL on failure (scl frequency not supported or THIGH is 0) + */ +static int xiic_setclk(struct xiic_i2c *i2c) +{ + unsigned int clk_in_mhz; + unsigned int index = 0; + u32 reg_val; + + dev_dbg(i2c->adap.dev.parent, + "%s entry, i2c->input_clk: %ld, i2c->i2c_clk: %d\n", + __func__, i2c->input_clk, i2c->i2c_clk); + + /* If not specified in DT, do not configure in SW. Rely only on Vivado design */ + if (!i2c->i2c_clk || !i2c->input_clk) + return 0; + + clk_in_mhz = DIV_ROUND_UP(i2c->input_clk, 1000000); + + switch (i2c->i2c_clk) { + case I2C_MAX_FAST_MODE_PLUS_FREQ: + index = REG_VALUES_1MHZ; + break; + case I2C_MAX_FAST_MODE_FREQ: + index = REG_VALUES_400KHZ; + break; + case I2C_MAX_STANDARD_MODE_FREQ: + index = REG_VALUES_100KHZ; + break; + default: + dev_warn(i2c->adap.dev.parent, "Unsupported scl frequency\n"); + return -EINVAL; + } + + /* + * Value to be stored in a register is the number of clock cycles required + * for the time duration. So the time is divided by the input clock time + * period to get the number of clock cycles required. Refer Xilinx AXI I2C + * PG document and I2C specification for further details. + */ + + /* THIGH - Depends on SCL clock frequency(i2c_clk) as below */ + reg_val = (DIV_ROUND_UP(i2c->input_clk, 2 * i2c->i2c_clk)) - 7; + if (reg_val == 0) + return -EINVAL; + + xiic_setreg32(i2c, XIIC_THIGH_REG_OFFSET, reg_val - 1); + + /* TLOW - Value same as THIGH */ + xiic_setreg32(i2c, XIIC_TLOW_REG_OFFSET, reg_val - 1); + + /* TSUSTA */ + reg_val = (timing_reg_values[index].tsusta * clk_in_mhz) / 1000; + xiic_setreg32(i2c, XIIC_TSUSTA_REG_OFFSET, reg_val - 1); + + /* TSUSTO */ + reg_val = (timing_reg_values[index].tsusto * clk_in_mhz) / 1000; + xiic_setreg32(i2c, XIIC_TSUSTO_REG_OFFSET, reg_val - 1); + + /* THDSTA */ + reg_val = (timing_reg_values[index].thdsta * clk_in_mhz) / 1000; + xiic_setreg32(i2c, XIIC_THDSTA_REG_OFFSET, reg_val - 1); + + /* TSUDAT */ + reg_val = (timing_reg_values[index].tsudat * clk_in_mhz) / 1000; + xiic_setreg32(i2c, XIIC_TSUDAT_REG_OFFSET, reg_val - 1); + + /* TBUF */ + reg_val = (timing_reg_values[index].tbuf * clk_in_mhz) / 1000; + xiic_setreg32(i2c, XIIC_TBUF_REG_OFFSET, reg_val - 1); + + /* THDDAT */ + xiic_setreg32(i2c, XIIC_THDDAT_REG_OFFSET, 1); + + return 0; +} + static int xiic_reinit(struct xiic_i2c *i2c) { int ret; xiic_setreg32(i2c, XIIC_RESETR_OFFSET, XIIC_RESET_MASK); + ret = xiic_setclk(i2c); + if (ret) + return ret; + /* Set receive Fifo depth to maximum (zero based). */ xiic_setreg8(i2c, XIIC_RFD_REG_OFFSET, IIC_RX_FIFO_DEPTH - 1); @@ -1138,6 +1274,15 @@ static int xiic_i2c_probe(struct platform_device *pdev) pm_runtime_use_autosuspend(i2c->dev); pm_runtime_set_active(i2c->dev); pm_runtime_enable(i2c->dev); + + /* SCL frequency configuration */ + i2c->input_clk = clk_get_rate(i2c->clk); + ret = of_property_read_u32(pdev->dev.of_node, "clock-frequency", + &i2c->i2c_clk); + /* If clock-frequency not specified in DT, do not configure in SW */ + if (ret || i2c->i2c_clk > I2C_MAX_FAST_MODE_PLUS_FREQ) + i2c->i2c_clk = 0; + ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, xiic_process, IRQF_ONESHOT, pdev->name, i2c); @@ -1181,6 +1326,9 @@ static int xiic_i2c_probe(struct platform_device *pdev) i2c_new_client_device(&i2c->adap, pdata->devices + i); } + dev_dbg(&pdev->dev, "mmio %08lx irq %d scl clock frequency %d\n", + (unsigned long)res->start, irq, i2c->i2c_clk); + return 0; err_clk_dis: