From patchwork Thu Sep 5 07:45:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Song X-Patchwork-Id: 13791845 Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012046.outbound.protection.outlook.com [52.101.66.46]) (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 9C5A5193069 for ; Thu, 5 Sep 2024 07:36:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.66.46 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725521818; cv=fail; b=OUwbl852gO1TlbUP7xGCCHWQfKOsoCilK0IBaPNgiUT414A6ggYOAiAhlc9/MpPmgf60K9InW0EAgPBJsRBxiQorkECCz38JY6JzR7Y37R9w5PCMFM3J4D/vNXr7/NsKxMShgheDgFNMudPRPBbvAY5ztYZIjJC1XkLrwY3fM1A= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725521818; c=relaxed/simple; bh=ja9f9nxxOxBZED56XqeDYfMeEC9anG3OUofDYxUJFGQ=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=fUTJAECAFkynEHFz8mVU6Ws2+vdaiYbd8o6hbsi4EEP5kN3samDPy8yViIbhEVCuWAQRDcwl8r+OTTEHcjcA2RGMqzkex1eeKsbCKS0iv2Evr1NxpY+F9w+9CkCffcu5PmoVVXFsKikVlqhGij6HD/70DUaQDyyiXMycuV4L6/8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=Viv6Esfi; arc=fail smtp.client-ip=52.101.66.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="Viv6Esfi" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Uju+TmWcvChH+6QAqXDtnYuPkkwm8g5YbL/CtR8slChQr0H754YaWdaPDFZgP9NmcNnGn3+zCXSPvyKuml5k3WNqq3P4NvtSt83ckMk1qRSoRiwRL5vRqW27ZT56N2uf75XBZcpdk3Ty4gNfYsDEO+QZreWb41jBmGIQP/mi/zFuW1afeVwlP4ImHp819uRBCchz2qj+xT72kS7RpNr8H0qaqrNGSapa2JsluYK3OyZyEm89pL6uizpQfLqkbAdS474ptwK4UIqT3Od9vuUoziIDIt7JltWknjwI8oQO1lRFp+e0PDeZwvDe+E7Rfsbc2edtrNGADd+2Pn51LPdNww== 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=lniF3Qc/9VXKVYvkp8znNidReg3xMQWnKpjmqnmEmYQ=; b=BRuSo0Yn6VfC5nUiGWJ60IX70BJ1dEcBLKFU54vF7Z9TudSRL+BdhuHa8uFAOpTUg0Z/JGZn9zTwVm9s8b1fOR+g8o5uCnVSq3oo9D3yyo8myGm6ytMIV7rTuhBf4TgVqP4rSnfr2E3gJ1Ya02VVTYlO3Cg+f8owQEgq20wwYzD6haAwW5uTIBq54dmGiQeSp12MThMSLA57qldUqilnpYK95lXJH2lAxtgmHrhV6pRGfnHoRpdkT09Hcb20oBzKrQQqGHxwSKmFKuLndPuKzgshmqZW/fz+61Ih9+PaYaXFu1Xvzdgy6/4nyvmZeeYFMfwjo049YcPuO2uwgPRusg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lniF3Qc/9VXKVYvkp8znNidReg3xMQWnKpjmqnmEmYQ=; b=Viv6EsfikEXqLuPG/5Zh21bU3f+6aDavHu0/+IU/qOGObA1x+fEP/YAWs/WOg/CxpGZNu0MnjZAo36AyxGFb7kcqzkrwbqRseoJKg0SCioXrBzHq1ItrxmoKltTf0b5BnE/NUkxmC8lRdGMt0DdfjcS35tvQ4PChWPGHaNEPQcr8QRc1SIHOq00G3pN+PeBZRnB6fzF0iLVdEmBrMqne7nDxP+7lbSHpG43NVfPz7cd7a46Jgw8TmzKauho9yUJyFsZJnEV4Q8ZqB0H6eM/yOkFBfX9AJ79xk1weV5BRqEuzeUnN0RDFtl1tyDNyGLuWoC/qhp/zLjrSv1qdfC0HwA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5005.eurprd04.prod.outlook.com (2603:10a6:803:57::30) by DB9PR04MB8429.eurprd04.prod.outlook.com (2603:10a6:10:242::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.27; Thu, 5 Sep 2024 07:36:53 +0000 Received: from VI1PR04MB5005.eurprd04.prod.outlook.com ([fe80::3a57:67cf:6ee0:5ddb]) by VI1PR04MB5005.eurprd04.prod.outlook.com ([fe80::3a57:67cf:6ee0:5ddb%4]) with mapi id 15.20.7918.019; Thu, 5 Sep 2024 07:36:53 +0000 From: Carlos Song To: alexandre.belloni@bootlin.com, miquel.raynal@bootlin.com, conor.culhane@silvaco.com, frank.li@nxp.com Cc: linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Carlos Song , Frank Li Subject: [PATCH V4 1/2] i3c: master: support to adjust first broadcast address speed Date: Thu, 5 Sep 2024 15:45:56 +0800 Message-Id: <20240905074557.3810026-1-carlos.song@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: AS4P191CA0024.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:5d9::18) To VI1PR04MB5005.eurprd04.prod.outlook.com (2603:10a6:803:57::30) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5005:EE_|DB9PR04MB8429:EE_ X-MS-Office365-Filtering-Correlation-Id: 99239e10-54a6-4906-1122-08dccd7d829c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016|52116014|38350700014; X-Microsoft-Antispam-Message-Info: mKkTh5eBuma7U2fL8CnRprpyggq2JKb4CXuvG8vAis+fl06MPLD4FgF6wWFXPprdGFr/1Bb0/GmH6VnwNDvEq+bFL2QM2/MaZsCMBa3sof7WF54T+sbSlx8gdRRSR6gG/ZiUXvuvFQwB4BDnz66nCncl/4v/oVwoIsefhm9EvWOYWy2WYBv4+PGB0lbMarC5ZkNlS1Deem3hOuXLwgZRRKBUohkvVLfEVjhtS1t0MqP7RN31OuoJLTUdGoSLN3JpzGBd6udvfcJr9tsWptncGQhBaDw3muu39aAShHp96Wk3gg9AFHUupeKQeSkGAr1eQf1TAcCTONQ5ZVy2mhPSG6xOJdcAf6I90ZuZxtsNu+YObVtpv7sOrvm2NckLfSyBLVQMbcDxsDCiZGHZzAMI31PWMEXZWNHPrWA8lVyfb7MUWPfPD76gkW8hlTmTPTaaobHzzlz0ncB4mtSXo0arJ77pbLRb9L/ZwxcQ4O5kPgc9tu8yZfrJVFsS+mzkUP6gR3VKAdRazixHv424xMPJr8os/DNxhmj8xHGl1AMezmuf/Y4gJtEFOCeKDmNByQC9Iu6+MPrGb+Q0R5XDRPfPKOIO1/v76ezM2Qk313ioFMPF54Ex8fIDQdQR8L4Q4hspGWsF3iyoGOViGq3FcD7xhnarNg/QZ266t2WbLMZ1BmpLcnCZ+u33X9bj8n/vkFkNs8hi7RntEOVQQgstjqJbp1d2uicSyi181MmJBmrheG1IfxXo0P8vgYizO77wcon+HHakXn/yUZ/2gxaXdlf/CckQ70Nf6XggSrUTSjAXt7GLE92HpBhCnE3lwxgjrya2H7AF1StKXLoUqgdna7bkNIMSKyk1gg72oNf1vevQLvg94kGe2WxC2mrfizXNKLMAJ6j+2T3cZrJhvbnMrxXFMNQcg9lc9MsS8hlB9KuPTT8i8zo1IkKrzOYLYobs6Ww/U3BI2Ud1m5+dWzaEAj6MkZChFYRmVsynDIZlsAQ2vYevJShb2GEbEFFytHA4SLTg1lQC+iL/6FJUe+uxzMWPFwv51VkHtshkCsO0NYIhqK23gj9UpiJ1Utrx5UfPkUgPV+FIm+t9wl16JSwkYsNyhdBAvXr0ta1xGGBOtDYrAqpRTRi/3bS14EXA4yjUScpUinkb2aKRPFsVsnPQv74dZG9LlE0i/Mm4ettrF8w0TltqdfW+oCgDK1x2iZEXQoIKq9KerkNe+nkw/FbfGTMOGkuuPUqoA0vmeS1O+OERCGa8OKCHsjmOn8Z1vlbT+KvHeC0+p8VeP2IZvbXVSpGxK8bbalflatDaWW8iRo/TaUspFQEeg/yykzRWxj7iPyDG4sB02Z9tgDhnelQGxbvURfvxdYlTvQQkD+CsuJXME5VYURm+Etny9tA880d1XW+nom1h05F+FysudADtxZkWHQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5005.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(366016)(52116014)(38350700014);DIR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xRj7jw00q9PEh9I9VWi+ai17yCoEodIyTlRR27NrK5x6b78NhCqmmiOXZ/VM/RrFeyXrOhm9JUzofieEYv0W/d8EU56NU+ku3n5UqSGgkwU/k8W6e3ZicZbt5EM9c6TClYfCkQxoi5edScQxAVJfujkwrWdXKH8jyEZM/nH9Z0iSCFNPEsCHsqhE+bokSbk1dJ5oeI5+giaK1vF45Aeoupz7PjLggcAiMhoF4gmW+ueOaKwtk09DNsZkGPBI0aRpEVD8O7rh6JWW6sbcbsQIT2SUyS0LtEG5A+x+4C5WffwvpXXfZHHs037iCnc+FISDuoy6rypXWbAEoOQJwX0BKDFDecrSTjeyftjpMlXtsliSOQ+UDJel1ycB3T7k8HQC+CmJAR1rvzS+0HgLYFVRPZ3LISCoBP/iMudpQfiiPktT2WDncnc1Us50VOCjZeY4wrl1xOZUVw/S7I3Oa7dtCYXdURPVdq4JWmC+4AUD7Y6Uu7TJ/5YjPtiFTlN91Gkfkz1XF8DXtodtHRpVcXHp4zf5cw7qFSGVQSGEfnkplZst0V0MFU7E9gN6x3OqAaOwEX42sSZ/4WqGAnvn2cIi X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 99239e10-54a6-4906-1122-08dccd7d829c X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5005.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2024 07:36:52.9719 (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: T9NI1kUOQGA0b3s09Npfq8ZHnSrQUp+kvlJFAcsLx9tN0E2BNBKpiM/PF49c2xN4G2lw/SAyZwVmGHdR1X04ZA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8429 According to I3C spec 6.2 Timing Specification, the Open Drain High Period of SCL Clock timing for first broadcast address should be adjusted to 200ns at least. I3C device working as i2c device will see the broadcast to close its Spike Filter then change to work at I3C mode. After that I3C open drain SCL high level should be adjusted back. Signed-off-by: Carlos Song Reviewed-by: Miquel Raynal Reviewed-by: Frank Li --- Change for V4: - No change. Send this patch with svc-i3c-master.c fix patch. Change for V3: - Modify comments from Miquel's suggestion Chnage for V2: - Fix set_speed description from Frank's comment --- drivers/i3c/master.c | 12 ++++++++++++ include/linux/i3c/master.h | 16 ++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 7028f03c2c42..6f3eb710a75d 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -1868,6 +1868,12 @@ static int i3c_master_bus_init(struct i3c_master_controller *master) goto err_bus_cleanup; } + if (master->ops->set_speed) { + ret = master->ops->set_speed(master, I3C_OPEN_DRAIN_SLOW_SPEED); + if (ret) + goto err_bus_cleanup; + } + /* * Reset all dynamic address that may have been assigned before * (assigned by the bootloader for example). @@ -1876,6 +1882,12 @@ static int i3c_master_bus_init(struct i3c_master_controller *master) if (ret && ret != I3C_ERROR_M2) goto err_bus_cleanup; + if (master->ops->set_speed) { + master->ops->set_speed(master, I3C_OPEN_DRAIN_NORMAL_SPEED); + if (ret) + goto err_bus_cleanup; + } + /* Disable all slave events before starting DAA. */ ret = i3c_master_disec_locked(master, I3C_BROADCAST_ADDR, I3C_CCC_EVENT_SIR | I3C_CCC_EVENT_MR | diff --git a/include/linux/i3c/master.h b/include/linux/i3c/master.h index 074f632868d9..2a1ed05d5782 100644 --- a/include/linux/i3c/master.h +++ b/include/linux/i3c/master.h @@ -277,6 +277,20 @@ enum i3c_bus_mode { I3C_BUS_MODE_MIXED_SLOW, }; +/** + * enum i3c_open_drain_speed - I3C open-drain speed + * @I3C_OPEN_DRAIN_SLOW_SPEED: Slow open-drain speed for sending the first + * broadcast address. The first broadcast address at this speed + * will be visible to all devices on the I3C bus. I3C devices + * working in I2C mode will turn off their spike filter when + * switching into I3C mode. + * @I3C_OPEN_DRAIN_NORMAL_SPEED: Normal open-drain speed in I3C bus mode. + */ +enum i3c_open_drain_speed { + I3C_OPEN_DRAIN_SLOW_SPEED, + I3C_OPEN_DRAIN_NORMAL_SPEED, +}; + /** * enum i3c_addr_slot_status - I3C address slot status * @I3C_ADDR_SLOT_FREE: address is free @@ -436,6 +450,7 @@ struct i3c_bus { * NULL. * @enable_hotjoin: enable hot join event detect. * @disable_hotjoin: disable hot join event detect. + * @set_speed: adjust I3C open drain mode timing. */ struct i3c_master_controller_ops { int (*bus_init)(struct i3c_master_controller *master); @@ -464,6 +479,7 @@ struct i3c_master_controller_ops { struct i3c_ibi_slot *slot); int (*enable_hotjoin)(struct i3c_master_controller *master); int (*disable_hotjoin)(struct i3c_master_controller *master); + int (*set_speed)(struct i3c_master_controller *master, enum i3c_open_drain_speed speed); }; /**