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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2E0FC433EF for ; Wed, 22 Dec 2021 09:46:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234320AbhLVJqn (ORCPT ); Wed, 22 Dec 2021 04:46:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233101AbhLVJqn (ORCPT ); Wed, 22 Dec 2021 04:46:43 -0500 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72739C061574 for ; Wed, 22 Dec 2021 01:46:42 -0800 (PST) Received: by mail-lf1-x130.google.com with SMTP id g26so4053819lfv.11 for ; Wed, 22 Dec 2021 01:46:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=gqP1kgI4bBi7sIz285iv1G8hI0tK50ES53M0iBeEsbE=; b=ylahN3q274IGuGIIYMYxFdzaj2saZ5O7IG3xOydmJW44xZacSqvsx8G/etizIRwuw6 gfZVR/6FSHg51DjOwodog8DePVBj7Z9FRhC9LIkhNdMz1rEI+mdPRplzdOwaIhZ6LEE2 EJr6HuNnaH9ScokQHFEnhRV8k4fNZ/SbEvBB9QJVJdEMBQHuO9qkVKD2QBvhmzNvZrFD dc30769iAw9Ld8g4hj9Lw/Rseo9iMK+A9gVndnpfs07T0LWYizq0NIkpp9ogij+LB3sF gnCCtq1RPHoAgQy3w+bmUeM76KmjujDkDdD4CGx4igiU/mven8ylpRa2S9Bw2wXgWnNu 6Wcw== 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:mime-version :content-transfer-encoding; bh=gqP1kgI4bBi7sIz285iv1G8hI0tK50ES53M0iBeEsbE=; b=VB5VOh4/78XUe8TxtrWBf9tyxtoMdOaUvezW89cs+gADHFJOLkbXVDsmIV5VMrVhv0 sQ1SJ7H42Bbs9UZuqaHne7vLgeUUHNlFmuz2d28aBeYYphqNWKbZw0bxbe/inu9qsrx6 lt2YcfJkAtf7QMRtoR/jm2WsZrSmC+dteEoHmQ/RBhYrBnPQBkFbXEXrTj13nnlWsj5+ 2Edrz5OTTwUjQuVLnO/9rfRHzi2shXUaq/kc0+bxEC0rKWBxnKS6Ix4OkF0zFTIouThJ RasacsjnQioEZoRqY+BgBlES4CBpossNpkYs2mrXmfv46iJ7m2TItWdTdG4xDEHC1KrH P9Ug== X-Gm-Message-State: AOAM532tnJtGV8U/U6EIR8qwN4wufQM6uEmZyWNVzPjJ+iLSSN9/6krX 9zZRryAumrI1G//4Sbrtxnj0l7EPtMdVFQ== X-Google-Smtp-Source: ABdhPJy9GCrp5bJj+zoLeuDYLyBcdnHGMNv1O7LZ7SgLcchzQVlFNR3cfvHTMyo8bTovQTC1z/9Vng== X-Received: by 2002:ac2:5462:: with SMTP id e2mr1851914lfn.127.1640166400680; Wed, 22 Dec 2021 01:46:40 -0800 (PST) Received: from dabros-l.wifi.semihalf.net ([185.157.14.92]) by smtp.gmail.com with ESMTPSA id e19sm132756ljn.82.2021.12.22.01.46.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Dec 2021 01:46:40 -0800 (PST) From: Jan Dabros To: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, jarkko.nikula@linux.intel.com Cc: andriy.shevchenko@linux.intel.com, mika.westerberg@linux.intel.com, wsa@kernel.org, rrangel@chromium.org, mw@semihalf.com, jaz@semihalf.com, jsd@semihalf.com, upstream@semihalf.com Subject: [RFC 0/2] i2c-designware: Add support for AMD PSP semaphore Date: Wed, 22 Dec 2021 10:45:56 +0100 Message-Id: <20211222094558.2098791-1-jsd@semihalf.com> X-Mailer: git-send-email 2.34.1.307.g9b7440fafd-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patchset comprises support for new i2c-designware controller setup on some AMD Cezanne SoCs, where x86 is sharing i2c bus with PSP. PSP uses the same controller and acts as an i2c arbitrator there (x86 is leasing bus from it). First commit aims to improve generic i2c-designware code by adding extra locking on probe() and disable() paths. I would like to ask someone with access to boards which use Intel BayTrail(CONFIG_I2C_DESIGNWARE_BAYTRAIL) to verify behavior of my changes on such setup. Second commit adds support for new PSP semaphore arbitration mechanism. Implementation is similar to the one from i2c-designware-baytrail.c however there are two main differences: 1) Add new ACPI ID in order to protect against silent binding of the old driver to the setup with PSP semaphore. Extra flag ARBITRATION_SEMAPHORE added to this new _HID allows to recognize setup with PSP. 2) Beside acquire_lock() and release_lock() methods we are also applying quirks to the lock_bus() and unlock_bus() global adapter methods. With this in place all i2c clients drivers may lock i2c bus for a desired number of i2c transactions (e.g. write-wait-read) without being aware of that such bus is shared with another entity. Mark this patchset as RFC, since waiting for new ACPI ID value. As a temporary measure use "AMDI9999". Once proper one will be ready, will re-send this CL for review & merge. Looking forward to some feedback. Jan Dabros (2): i2c: designware: Add missing locks i2c: designware: Add AMD PSP I2C bus support MAINTAINERS | 1 + drivers/acpi/acpi_apd.c | 1 + drivers/i2c/busses/Kconfig | 20 ++ drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-designware-amdpsp.c | 359 ++++++++++++++++++++ drivers/i2c/busses/i2c-designware-common.c | 12 + drivers/i2c/busses/i2c-designware-core.h | 9 +- drivers/i2c/busses/i2c-designware-master.c | 6 + drivers/i2c/busses/i2c-designware-platdrv.c | 3 + 9 files changed, 411 insertions(+), 1 deletion(-) create mode 100644 drivers/i2c/busses/i2c-designware-amdpsp.c -- 2.34.1.307.g9b7440fafd-goog