From patchwork Mon Nov 4 10:00:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ciprian Marian Costea X-Patchwork-Id: 13861207 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 B7A1DD132A6 for ; Mon, 4 Nov 2024 10:13:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version: Content-Transfer-Encoding:Content-Type: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=kwZ6s2Kxruih+NW0LgLdVIf3bnoPNU9rRCt/vQ+acig=; b=SAp/JltEFfKaYlSNEo2vgIWtO7 HxOabUqZHW2qg+DmWqBESx6RCwfAaWkItHijPHl2vLn9MdoZ5BT6dISfxSYJQn1MQh3rixGs6Ehys jHNnDo0hrxwJqCBIIMFkc2dd77LIap1QUiZIOZxFGCs0KFE0S+XrLJTasXyOmplBQoFa+SkylyRlf n15n60OIJ8wB1GYomh1xzU42T8XRUxy9oWDMzfX37TqvnBh44z9LR8EU2WlrW9bLl/hbf79FTeJaX anw+NdcFIAUIsz2PKytxQv3aCp8BQlRYwHhWu/ZgS2o0+3+4MTqcfhRmpOKA//awgsGU+dSQa74gG v7cTlcsQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t7u56-0000000DHI8-2EsH; Mon, 04 Nov 2024 10:13:08 +0000 Received: from mail-vi1eur03on20611.outbound.protection.outlook.com ([2a01:111:f403:260c::611] helo=EUR03-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t7ttO-0000000DF5I-3hMy for linux-arm-kernel@lists.infradead.org; Mon, 04 Nov 2024 10:01:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tdvdLq6QSpfO/S2EPipQg58izacjnrz2+Y/3MoogEYkq4pK5HkFijsWBmi8lRE1LZNIf4/GIfG69x4tcsEwh8qTRbgJzun5gtonRk16qXtag5s9Q4ndTR/kp2Yf0VuQAfp25ygyvQBrb0Ocmv/e3KuCSUmi17+R3UTB6hy3DF3jFHbYPw4SLP5p1InirNWcNvEaHEuL1vtGFRGwqUpcDpao9LJBRk1J911Oly2uTiHDS2VOGcN56n2Gp0waE5G5u/KXD7RhUc34rgctxVlnjsQstj9HdIquCi6UcVSW+hdKfdpQ0Q2WD+mzhfn0Q3vPGuPDToLgSt+SxcxgxUYe9tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=kwZ6s2Kxruih+NW0LgLdVIf3bnoPNU9rRCt/vQ+acig=; b=Pvj8QTU2AIUq31m8rRjeujNvg24oTTg8SoWpXFl71jQqGQMHTsotTJTGmZSsvd4PlP4oEYgbbQSBqrjAqEsWNIJnMPN7kohsqHZqSAJOMd5PvalF2M9J/0A2wCy6vb/AEcieqRPdrfy20bHU0+GTXuUlpHQjJyT4Yz76kMvNsFY1DK/NDvk14ItTnKYkQkTCmCAeq+rSm/nNG4Lqfr+WTyilqvwsCyfedDDrgvzLtJtdIHG7+a6zO25XxGpnZbvFmXJdvBvLJZu98bJfMGisBs/kLsYqjo9E3icfdFE4HSPgz7XmKy4eVT8rgsaBc7vBwKJq3nlPpwbNaNanT+sEOA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kwZ6s2Kxruih+NW0LgLdVIf3bnoPNU9rRCt/vQ+acig=; b=M2J2CRCuoU8Wx+qgxfMmws2rP70MRUCr+720XgMhUJ0wKUxOY+n7tFczOjuNhjcw8l6KbEbxnTc+LhevN3TWUiU0ZaJRWMEIIEPLGoT3DoI11SgG4NU/5Yktz0d9Tc4TiXgfgBfqO9OugfV1ko05Css1oCiYF/VGSm/Tq/Zz5scZes88xBfzy1iXL9Z1zOCouwTlzY8b97NOzzTE1G5XNfckoL2uG/U3bi2csO9C4FYOKblDUTpnzRvY0jYcOIKWM2XiJ2kIpfBIP7fqx8htR1zlQ9DzmSODQe+tgs0de6U/FpjgSBSPxBtXQ3g2Evd1Cm0FJs/+DkskeU4qSxhvTA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9251.eurprd04.prod.outlook.com (2603:10a6:10:352::15) by DB8PR04MB6825.eurprd04.prod.outlook.com (2603:10a6:10:112::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30; Mon, 4 Nov 2024 10:00:58 +0000 Received: from DU0PR04MB9251.eurprd04.prod.outlook.com ([fe80::708f:69ee:15df:6ebd]) by DU0PR04MB9251.eurprd04.prod.outlook.com ([fe80::708f:69ee:15df:6ebd%6]) with mapi id 15.20.8114.028; Mon, 4 Nov 2024 10:00:54 +0000 From: Ciprian Costea To: Oleksij Rempel , Pengutronix Kernel Team , Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Fabio Estevam Cc: linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Christophe Lizzi , Alberto Ruiz , Enric Balletbo , Ciprian Marian Costea , Ionut Vicovan Subject: [PATCH 2/2] i2c: imx: add support for S32G2/S32G3 SoCs Date: Mon, 4 Nov 2024 12:00:44 +0200 Message-ID: <20241104100044.3634076-3-ciprianmarian.costea@oss.nxp.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241104100044.3634076-1-ciprianmarian.costea@oss.nxp.com> References: <20241104100044.3634076-1-ciprianmarian.costea@oss.nxp.com> X-ClientProxiedBy: AM8P189CA0028.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:218::33) To DU0PR04MB9251.eurprd04.prod.outlook.com (2603:10a6:10:352::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9251:EE_|DB8PR04MB6825:EE_ X-MS-Office365-Filtering-Correlation-Id: 0e143f73-9541-434c-6ccf-08dcfcb791f8 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?M1P58q1zS7qdkhTPFBe4OnsWFJMBxIm?= =?utf-8?q?7NAu6AmZH0zs4+0oBgNCc5c4MtLWmGMEWNxqg9/6jPm0bVwDQBVhYKKCpR8zOC0h3?= =?utf-8?q?+yJ8EhGXoYeXdlllOovZoGheaFCktBa3muz8VcldOyiGlf+AaOhy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rQ?= =?utf-8?q?NnER0nQ3I2Bmkvr7VakNHaXGhx7uAMUVLkdlXkkYoeTaoxORr2SMA9cZy4lKuaCqC?= =?utf-8?q?0Sram8zwuxKSbYmhrB44DE1nPftkxHghNHTVBoPO7EjRbLd3IaYH2FuhBy4eVNrHw?= =?utf-8?q?uyrCIzIbCmDuWPlvRoLArCzVDff44n2HfVfasvoMmEFE/c0Wo7CF75qfG2Oi2iahL?= =?utf-8?q?C/0LQ9joLOzO9e?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9251.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(7416014)(376014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Y80yBR9sv5oE4TwpFAlV1PwM3Q80?= =?utf-8?q?1+e/F7HRfNkTPpgMd8dxeaGVMD2CakLnbN+jDqEaAwpuOeE1mQlqDDQpuTkQHfbjQ?= =?utf-8?q?+v4HrvytGrKcVP7ZiouTnsuKUtKENEW6EhM+iwZLYoGVm536VUsf2mKwzPg30IccX?= =?utf-8?q?I9diMgJyVLlbfVN2NXcuBC9/maRV7+/krc2aYd4UZQH2hoYpDsuUGkLYNIoKmjpMk?= =?utf-8?q?XLrDKNUCPeDO5W9aSK09bisAyEe65RFq/ERsJZ4cDcTYg/MNF+IxRzlNuM4DpGDtK?= =?utf-8?q?SpMXXVR49QPgWoOVQ2Ul5JZ7QK9UBH556gFHMS1Vm4XIWXiK1F8aJT9wv2PsSHtCI?= =?utf-8?q?kIhxaXg1QUrLxV3g52xYt5zw7lKOIysQQQ+5kg4VXSXxS0AXy4sbJu75ARrc/z82v?= =?utf-8?q?iq0gz6+wZDBn5G6nrWSnBIrHQb0Vq+y+Q96FX5d871zBUICxaUlijGIDNGfZk5oMx?= =?utf-8?q?LeXG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zH5lE7o2xHU4Q7k6NkUGg3KyJnjy0M90EctVV2PyxLYukLAELiiq2?= =?utf-8?q?Z19slzIfF2Cr+MAwhrDbaWs+e29Op1mSqgzp/XEDFtMrsBaq5i/EBAhGdpGHjw6Dd?= =?utf-8?q?PHfWlkqdnOd/X3pIQ4KsEV6xsyPUOhRbTQ7ESOX7KjBSHUvn/ZvQJlH8d09Em4UK5?= =?utf-8?q?d2EWSr69AQY1ajZZ3QSA8T62x1bPd+kGsA=3D=3D?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0e143f73-9541-434c-6ccf-08dcfcb791f8 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9251.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2024 10:00:54.0136 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Rl59JlPJcC7Ly8lTQVmzql1tTvL2nT7l0l2mJ6XTZo11nfHfqbe7UIouSQV6B/ainK+4FunYy+d4noOwwZjIx8kkgSM45XdlJR4lJ4n/jzA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB6825 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241104_020106_621119_824FFA8B X-CRM114-Status: GOOD ( 17.20 ) 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: Ciprian Marian Costea Some S32G2/S32G3 SoC I2C particularities exist such as different pairs. Those are addressed by adding specific S32G2 and S32G3 compatible strings. Co-developed-by: Ionut Vicovan Signed-off-by: Ionut Vicovan Signed-off-by: Ciprian Marian Costea Reviewed-by: Frank Li * * Copyright 2013 Freescale Semiconductor, Inc. - * Copyright 2020 NXP + * Copyright 2020, 2024 NXP * */ @@ -84,6 +84,7 @@ #define IMX_I2C_REGSHIFT 2 #define VF610_I2C_REGSHIFT 0 +#define S32G_I2C_REGSHIFT 0 /* Bits of IMX I2C registers */ #define I2SR_RXAK 0x01 @@ -165,10 +166,35 @@ static struct imx_i2c_clk_pair vf610_i2c_clk_div[] = { { 3840, 0x3F }, { 4096, 0x7B }, { 5120, 0x7D }, { 6144, 0x7E }, }; +/* S32G2/S32G3 clock divider, register value pairs */ +static struct imx_i2c_clk_pair s32g2_i2c_clk_div[] = { + { 34, 0x00 }, { 36, 0x01 }, { 38, 0x02 }, { 40, 0x03 }, + { 42, 0x04 }, { 44, 0x05 }, { 46, 0x06 }, { 48, 0x09 }, + { 52, 0x0A }, { 54, 0x07 }, { 56, 0x0B }, { 60, 0x0C }, + { 64, 0x0D }, { 68, 0x40 }, { 72, 0x0E }, { 76, 0x42 }, + { 80, 0x12 }, { 84, 0x0F }, { 88, 0x13 }, { 96, 0x14 }, + { 104, 0x15 }, { 108, 0x47 }, { 112, 0x19 }, { 120, 0x16 }, + { 128, 0x1A }, { 136, 0x80 }, { 144, 0x17 }, { 152, 0x82 }, + { 160, 0x1C }, { 168, 0x84 }, { 176, 0x1D }, { 192, 0x21 }, + { 208, 0x1E }, { 216, 0x87 }, { 224, 0x22 }, { 240, 0x56 }, + { 256, 0x1F }, { 288, 0x24 }, { 320, 0x25 }, { 336, 0x8F }, + { 352, 0x93 }, { 356, 0x5D }, { 358, 0x98 }, { 384, 0x26 }, + { 416, 0x56 }, { 448, 0x2A }, { 480, 0x27 }, { 512, 0x2B }, + { 576, 0x2C }, { 640, 0x2D }, { 704, 0x9D }, { 768, 0x2E }, + { 832, 0x9D }, { 896, 0x32 }, { 960, 0x2F }, { 1024, 0x33 }, + { 1152, 0x34 }, { 1280, 0x35 }, { 1536, 0x36 }, { 1792, 0x3A }, + { 1920, 0x37 }, { 2048, 0x3B }, { 2304, 0x74 }, { 2560, 0x3D }, + { 3072, 0x3E }, { 3584, 0x7A }, { 3840, 0x3F }, { 4096, 0x7B }, + { 4608, 0x7C }, { 5120, 0x7D }, { 6144, 0x7E }, { 7168, 0xBA }, + { 7680, 0x7F }, { 8192, 0xBB }, { 9216, 0xBC }, { 10240, 0xBD }, + { 12288, 0xBE }, { 15360, 0xBF }, +}; + enum imx_i2c_type { IMX1_I2C, IMX21_I2C, VF610_I2C, + S32G_I2C, }; struct imx_i2c_hwdata { @@ -258,7 +284,15 @@ static struct imx_i2c_hwdata vf610_i2c_hwdata = { .ndivs = ARRAY_SIZE(vf610_i2c_clk_div), .i2sr_clr_opcode = I2SR_CLR_OPCODE_W1C, .i2cr_ien_opcode = I2CR_IEN_OPCODE_0, +}; +static const struct imx_i2c_hwdata s32g2_i2c_hwdata = { + .devtype = S32G_I2C, + .regshift = S32G_I2C_REGSHIFT, + .clk_div = s32g2_i2c_clk_div, + .ndivs = ARRAY_SIZE(s32g2_i2c_clk_div), + .i2sr_clr_opcode = I2SR_CLR_OPCODE_W1C, + .i2cr_ien_opcode = I2CR_IEN_OPCODE_0, }; static const struct platform_device_id imx_i2c_devtype[] = { @@ -288,6 +322,7 @@ static const struct of_device_id i2c_imx_dt_ids[] = { { .compatible = "fsl,imx8mp-i2c", .data = &imx6_i2c_hwdata, }, { .compatible = "fsl,imx8mq-i2c", .data = &imx6_i2c_hwdata, }, { .compatible = "fsl,vf610-i2c", .data = &vf610_i2c_hwdata, }, + { .compatible = "nxp,s32g2-i2c", .data = &s32g2_i2c_hwdata, }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, i2c_imx_dt_ids);