From patchwork Thu Aug 22 17:58:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 821870 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (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 785D91CF2AF; Thu, 22 Aug 2024 18:04:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724349867; cv=none; b=YN4q2Q24fzSA760uo3t3ii2YO0xR3q1eOmIyEAxaKOUtL94pw8pQAHqJhf1ysNJfK/bhCWnic83QqBQY++QMP55/uebBK/xdWyvlfD3TrNzVdbzzUNggoSpaq2U0Outmxb59N8AN9UrcH1/0TxbO6H6YKEfFWBBsr4EukW9ktz8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724349867; c=relaxed/simple; bh=+BKVVtf/v0HbG+gOMvddYZA8yuI36a4N7ul6v8KrfnY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kFtixP5LNpEcVSOFLkgCUnUOGr+jOP+TmkHGqxK8pJ/0NmppfNeHqFWcUj2tJ2k7/CawoaZFB+ud0tcC3w8VpYjL776DZWL3eabq8bGdupntkk+wFtz4zom03ZBLGveFy2W6kHwSOE+rkRNluSmCU/EOJhW1hr4P6UfWTTZnX2A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=eflP1u1/; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="eflP1u1/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724349865; x=1755885865; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+BKVVtf/v0HbG+gOMvddYZA8yuI36a4N7ul6v8KrfnY=; b=eflP1u1/LsL1q0qNR0xeUoeoUGkPpFNvMZeq/x+gSVzTMjmhjBBeHQ9C Sckpka5qTpOQVR08H22wA/DQbd52JkW7G19yA2N5pA/IvQTpCGIIuseom DBBgq+ucX0zNNSk6kf9X46ggks89SAMrbKPL9H7WOKkF3pdINgdPdPjs2 FIO9JQ20VQCfqzPFujxMsrGtjFWCslPz5KZlUD5IouUxW3Nd/bhN185jt GnnHuw/6zB0zTCkp+dRT7IsXqYVXty5ukY1j94JMZb9mHXJPYrSWM/8Oo iP10B8kr3OZZfDHWaxL0SFndXw7gkSHP2Wy9sf2KRkyorNbDAQmG0nyCp w==; X-CSE-ConnectionGUID: 939DClVVQxucmpS6LrQaCA== X-CSE-MsgGUID: 8/VzKJDmRja+MNrvQOXOOw== X-IronPort-AV: E=McAfee;i="6700,10204,11172"; a="26656205" X-IronPort-AV: E=Sophos;i="6.10,167,1719903600"; d="scan'208";a="26656205" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Aug 2024 11:04:20 -0700 X-CSE-ConnectionGUID: wH7pBY6+SWaiM7xTNAkNRw== X-CSE-MsgGUID: ckRQbNvzRX2qUtZh7EO3ZQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,167,1719903600"; d="scan'208";a="62074203" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa007.jf.intel.com with ESMTP; 22 Aug 2024 11:04:16 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 5245F268; Thu, 22 Aug 2024 21:04:12 +0300 (EEST) From: Andy Shevchenko To: Andi Shyti , Jarkko Nikula , Andy Shevchenko , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mika Westerberg , Jan Dabros , Narasimhan.V@amd.com, Borislav Petkov , Kim Phillips , Mario Limonciello Subject: [PATCH v1 1/5] i2c: designware: Rename dw_i2c_of_configure() -> i2c_dw_of_configure() Date: Thu, 22 Aug 2024 20:58:37 +0300 Message-ID: <20240822180411.2298991-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240822180411.2298991-1-andriy.shevchenko@linux.intel.com> References: <20240822180411.2298991-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 For the sake of consistency, rename dw_i2c_of_configure() and change its parameter to be aligned with the i2c_dw_acpi_configure(). Reviewed-by: Andi Shyti Reviewed-by: Mario Limonciello Acked-by: Jarkko Nikula Signed-off-by: Andy Shevchenko --- drivers/i2c/busses/i2c-designware-platdrv.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index cd24d2b8becf..981a2d399c9f 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -110,9 +110,10 @@ static int mscc_twi_set_sda_hold_time(struct dw_i2c_dev *dev) return 0; } -static void dw_i2c_of_configure(struct platform_device *pdev) +static void i2c_dw_of_configure(struct device *device) { - struct dw_i2c_dev *dev = platform_get_drvdata(pdev); + struct platform_device *pdev = to_platform_device(device); + struct dw_i2c_dev *dev = dev_get_drvdata(device); switch (dev->flags & MODEL_MASK) { case MODEL_MSCC_OCELOT: @@ -130,7 +131,7 @@ static int bt1_i2c_request_regs(struct dw_i2c_dev *dev) return -ENODEV; } -static inline void dw_i2c_of_configure(struct platform_device *pdev) +static inline void i2c_dw_of_configure(struct device *device) { } #endif @@ -276,7 +277,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) i2c_dw_adjust_bus_speed(dev); if (pdev->dev.of_node) - dw_i2c_of_configure(pdev); + i2c_dw_of_configure(&pdev->dev); if (has_acpi_companion(&pdev->dev)) i2c_dw_acpi_configure(&pdev->dev); From patchwork Thu Aug 22 17:58:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 821455 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 483EE17C220; Thu, 22 Aug 2024 18:04:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724349859; cv=none; b=XiCm7f77mFR64uAdrqjibxFKwcM1RP2Xii5Kpi4QdpTUHVKa/9u331wKsi9ci28vV7kdHP3BJkqtEF64acM0yMUaSDdnpDOG4muOda5ode+cDkX7S48UuUamwgnYgCc9V2CpVvOgAR6KrbTYu9X3sVgyj4AV/sVGqPwogacdGs8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724349859; c=relaxed/simple; bh=OA4kb5LzL/1YA4zXW7b6x6znzrZuwLNBRax1lE+xTEg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=scYg571k/6I3bjCS2TAr9zUx0UHEXWrwboiaZXJrR7O5vERAFP3B4UW/4Dee6wU/fnUiwzGGZTBpcqDwGY+UvgJiQ6j8IkYYpl1l9+6jbiz9Tkr+TuJUw+wWedH6B6jCdIKiErsYCqgML7zs+yKSWHrY0nJXAOBP8gUzoaWbSJg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=OTKW1BDP; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="OTKW1BDP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724349857; x=1755885857; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OA4kb5LzL/1YA4zXW7b6x6znzrZuwLNBRax1lE+xTEg=; b=OTKW1BDPiudf6gaqYv2/UeyOl/aTTK42z21v50pbH+gTQnjWkSls1BWW 7l27lOG5DrOrXG/wUQuKJYbIe3EVyGv9DvJ/3vILKBGJPwiGpDmbVLK1M 4LEIj7681q24QZbrkoGspwbyyKjQ7se3vryrQcD2o7uE6Ofm4yTDxvy0z j3L7URTbxCb1xX5clOcdjIlhXwC3V/l/5MdOvloABKViv4+8hCo8TMGPA ePX7EPbYIyq5Wo1KQeI/u5SoFyRNjHfFsuazjqnrCK6U89EktpMtA3arc 3rKGtD5g+Y5C2kOCZrZoMkskscU+DmyLp6zqTUMeEyFBnyyefb0+PiJjg w==; X-CSE-ConnectionGUID: /eXaDUUmSWqQUgsWRr7sIg== X-CSE-MsgGUID: +gJUPpKhQ+y5TdJUMwjXig== X-IronPort-AV: E=McAfee;i="6700,10204,11172"; a="33409870" X-IronPort-AV: E=Sophos;i="6.10,167,1719903600"; d="scan'208";a="33409870" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Aug 2024 11:04:16 -0700 X-CSE-ConnectionGUID: roJ2Qa6MQCq1XBoIh1G/oQ== X-CSE-MsgGUID: hmfffN3NQzKDcrpgXzV7fg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,167,1719903600"; d="scan'208";a="99049979" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa001.jf.intel.com with ESMTP; 22 Aug 2024 11:04:14 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 5DBC92B3; Thu, 22 Aug 2024 21:04:12 +0300 (EEST) From: Andy Shevchenko To: Andi Shyti , Jarkko Nikula , Andy Shevchenko , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mika Westerberg , Jan Dabros , Narasimhan.V@amd.com, Borislav Petkov , Kim Phillips , Mario Limonciello Subject: [PATCH v1 2/5] i2c: designware: Consolidate firmware parsing and configuring code Date: Thu, 22 Aug 2024 20:58:38 +0300 Message-ID: <20240822180411.2298991-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240822180411.2298991-1-andriy.shevchenko@linux.intel.com> References: <20240822180411.2298991-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 We have the same code flows in the PCI and plaform drivers. Moreover, the flow requires the common code to export a few functions. Instead, consolidate that flow under new function called i2c_dw_fw_parse_and_configure() and drop unneeded exports. Reviewed-by: Andi Shyti Reviewed-by: Mario Limonciello Signed-off-by: Andy Shevchenko --- drivers/i2c/busses/i2c-designware-common.c | 68 +++++++++++++++++++-- drivers/i2c/busses/i2c-designware-core.h | 9 +-- drivers/i2c/busses/i2c-designware-pcidrv.c | 11 +--- drivers/i2c/busses/i2c-designware-platdrv.c | 48 +-------------- 4 files changed, 66 insertions(+), 70 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-common.c b/drivers/i2c/busses/i2c-designware-common.c index f0d7cad92f1c..b0d3c47d93ce 100644 --- a/drivers/i2c/busses/i2c-designware-common.c +++ b/drivers/i2c/busses/i2c-designware-common.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -188,7 +189,7 @@ static const u32 supported_speeds[] = { I2C_MAX_STANDARD_MODE_FREQ, }; -int i2c_dw_validate_speed(struct dw_i2c_dev *dev) +static int i2c_dw_validate_speed(struct dw_i2c_dev *dev) { struct i2c_timings *t = &dev->timings; unsigned int i; @@ -208,7 +209,44 @@ int i2c_dw_validate_speed(struct dw_i2c_dev *dev) return -EINVAL; } -EXPORT_SYMBOL_GPL(i2c_dw_validate_speed); + +#ifdef CONFIG_OF + +#include + +#define MSCC_ICPU_CFG_TWI_DELAY 0x0 +#define MSCC_ICPU_CFG_TWI_DELAY_ENABLE BIT(0) +#define MSCC_ICPU_CFG_TWI_SPIKE_FILTER 0x4 + +static int mscc_twi_set_sda_hold_time(struct dw_i2c_dev *dev) +{ + writel((dev->sda_hold_time << 1) | MSCC_ICPU_CFG_TWI_DELAY_ENABLE, + dev->ext + MSCC_ICPU_CFG_TWI_DELAY); + + return 0; +} + +static void i2c_dw_of_configure(struct device *device) +{ + struct platform_device *pdev = to_platform_device(device); + struct dw_i2c_dev *dev = dev_get_drvdata(device); + + switch (dev->flags & MODEL_MASK) { + case MODEL_MSCC_OCELOT: + dev->ext = devm_platform_ioremap_resource(pdev, 1); + if (!IS_ERR(dev->ext)) + dev->set_sda_hold_time = mscc_twi_set_sda_hold_time; + break; + default: + break; + } +} + +#else /* CONFIG_OF */ + +static inline void i2c_dw_of_configure(struct device *device) { } + +#endif /* CONFIG_OF */ #ifdef CONFIG_ACPI @@ -255,7 +293,7 @@ static void i2c_dw_acpi_params(struct device *device, char method[], kfree(buf.pointer); } -void i2c_dw_acpi_configure(struct device *device) +static void i2c_dw_acpi_configure(struct device *device) { struct dw_i2c_dev *dev = dev_get_drvdata(device); struct i2c_timings *t = &dev->timings; @@ -286,7 +324,6 @@ void i2c_dw_acpi_configure(struct device *device) break; } } -EXPORT_SYMBOL_GPL(i2c_dw_acpi_configure); static u32 i2c_dw_acpi_round_bus_speed(struct device *device) { @@ -308,11 +345,13 @@ static u32 i2c_dw_acpi_round_bus_speed(struct device *device) #else /* CONFIG_ACPI */ +static inline void i2c_dw_acpi_configure(struct device *device) { } + static inline u32 i2c_dw_acpi_round_bus_speed(struct device *device) { return 0; } #endif /* CONFIG_ACPI */ -void i2c_dw_adjust_bus_speed(struct dw_i2c_dev *dev) +static void i2c_dw_adjust_bus_speed(struct dw_i2c_dev *dev) { u32 acpi_speed = i2c_dw_acpi_round_bus_speed(dev->dev); struct i2c_timings *t = &dev->timings; @@ -328,7 +367,24 @@ void i2c_dw_adjust_bus_speed(struct dw_i2c_dev *dev) else t->bus_freq_hz = I2C_MAX_FAST_MODE_FREQ; } -EXPORT_SYMBOL_GPL(i2c_dw_adjust_bus_speed); + +int i2c_dw_fw_parse_and_configure(struct dw_i2c_dev *dev) +{ + struct i2c_timings *t = &dev->timings; + struct device *device = dev->dev; + + i2c_parse_fw_timings(device, t, false); + + i2c_dw_adjust_bus_speed(dev); + + if (device->of_node) + i2c_dw_of_configure(device); + if (has_acpi_companion(device)) + i2c_dw_acpi_configure(device); + + return i2c_dw_validate_speed(dev); +} +EXPORT_SYMBOL_GPL(i2c_dw_fw_parse_and_configure); static u32 i2c_dw_read_scl_reg(struct dw_i2c_dev *dev, u32 reg) { diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h index ebcf816b731c..b9f97f4eedf5 100644 --- a/drivers/i2c/busses/i2c-designware-core.h +++ b/drivers/i2c/busses/i2c-designware-core.h @@ -416,11 +416,4 @@ int i2c_dw_baytrail_probe_lock_support(struct dw_i2c_dev *dev); int i2c_dw_amdpsp_probe_lock_support(struct dw_i2c_dev *dev); #endif -int i2c_dw_validate_speed(struct dw_i2c_dev *dev); -void i2c_dw_adjust_bus_speed(struct dw_i2c_dev *dev); - -#if IS_ENABLED(CONFIG_ACPI) -void i2c_dw_acpi_configure(struct device *device); -#else -static inline void i2c_dw_acpi_configure(struct device *device) { } -#endif +int i2c_dw_fw_parse_and_configure(struct dw_i2c_dev *dev); diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c index cbbcbcc265c9..14186230622d 100644 --- a/drivers/i2c/busses/i2c-designware-pcidrv.c +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c @@ -253,7 +253,6 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev, int r; struct dw_pci_controller *controller; struct dw_scl_sda_cfg *cfg; - struct i2c_timings *t; if (id->driver_data >= ARRAY_SIZE(dw_pci_controllers)) return dev_err_probe(&pdev->dev, -EINVAL, @@ -288,9 +287,6 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev, dev->irq = pci_irq_vector(pdev, 0); dev->flags |= controller->flags; - t = &dev->timings; - i2c_parse_fw_timings(&pdev->dev, t, false); - pci_set_drvdata(pdev, dev); if (controller->setup) { @@ -299,12 +295,7 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev, return r; } - i2c_dw_adjust_bus_speed(dev); - - if (has_acpi_companion(&pdev->dev)) - i2c_dw_acpi_configure(&pdev->dev); - - r = i2c_dw_validate_speed(dev); + r = i2c_dw_fw_parse_and_configure(dev); if (r) return r; diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index 981a2d399c9f..7e2f26d0593e 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -97,43 +96,11 @@ static int bt1_i2c_request_regs(struct dw_i2c_dev *dev) dev->map = devm_regmap_init(dev->dev, NULL, dev, &bt1_i2c_cfg); return PTR_ERR_OR_ZERO(dev->map); } - -#define MSCC_ICPU_CFG_TWI_DELAY 0x0 -#define MSCC_ICPU_CFG_TWI_DELAY_ENABLE BIT(0) -#define MSCC_ICPU_CFG_TWI_SPIKE_FILTER 0x4 - -static int mscc_twi_set_sda_hold_time(struct dw_i2c_dev *dev) -{ - writel((dev->sda_hold_time << 1) | MSCC_ICPU_CFG_TWI_DELAY_ENABLE, - dev->ext + MSCC_ICPU_CFG_TWI_DELAY); - - return 0; -} - -static void i2c_dw_of_configure(struct device *device) -{ - struct platform_device *pdev = to_platform_device(device); - struct dw_i2c_dev *dev = dev_get_drvdata(device); - - switch (dev->flags & MODEL_MASK) { - case MODEL_MSCC_OCELOT: - dev->ext = devm_platform_ioremap_resource(pdev, 1); - if (!IS_ERR(dev->ext)) - dev->set_sda_hold_time = mscc_twi_set_sda_hold_time; - break; - default: - break; - } -} #else static int bt1_i2c_request_regs(struct dw_i2c_dev *dev) { return -ENODEV; } - -static inline void i2c_dw_of_configure(struct device *device) -{ -} #endif static int txgbe_i2c_request_regs(struct dw_i2c_dev *dev) @@ -242,7 +209,6 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) { struct i2c_adapter *adap; struct dw_i2c_dev *dev; - struct i2c_timings *t; int irq, ret; irq = platform_get_irq(pdev, 0); @@ -271,18 +237,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) reset_control_deassert(dev->rst); - t = &dev->timings; - i2c_parse_fw_timings(&pdev->dev, t, false); - - i2c_dw_adjust_bus_speed(dev); - - if (pdev->dev.of_node) - i2c_dw_of_configure(&pdev->dev); - - if (has_acpi_companion(&pdev->dev)) - i2c_dw_acpi_configure(&pdev->dev); - - ret = i2c_dw_validate_speed(dev); + ret = i2c_dw_fw_parse_and_configure(dev); if (ret) goto exit_reset; @@ -310,6 +265,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) goto exit_reset; if (dev->clk) { + struct i2c_timings *t = &dev->timings; u64 clk_khz; dev->get_clk_rate_khz = i2c_dw_get_clk_rate_khz; From patchwork Thu Aug 22 17:58:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 821453 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (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 9AE3F1D04B5; Thu, 22 Aug 2024 18:04:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724349868; cv=none; b=Ue9pnIYKKBUezLzkoPt+JQ5GSRs+34LIhRPeADyag1g56eZxyoP3fQw95B/a42UDW0tDnjmrPJwW97rOVkc+H6u4jtWGF0h1CDI16T8bXuj/pHneYchcmKuxdnTlHt0EVZxfYxsiQy40UlKDueyy/I96xec8if/yO5HVBpg81YQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724349868; c=relaxed/simple; bh=JK0kDqy8Ygqq4oUSt4jmNEjBBamULbvcQSANgMZ1PzY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IigLXoAA87LRzLx5h0BWx1gUVhqjGCvyRPeDFxWXETEJRGrlAKQd2palB/36fA/tVcrkXsCm85/VB0DM9eSXTSDGbvAJCyxghnLLxPLUvrBCvVn0GWGK/PgQvLtyBpoDH7I+0/+pgtzn1rrMd62grsWDPt9uczvpBU004psN8ts= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=jzJqJR7d; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="jzJqJR7d" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724349866; x=1755885866; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JK0kDqy8Ygqq4oUSt4jmNEjBBamULbvcQSANgMZ1PzY=; b=jzJqJR7dmOmYpB+EDA39mpyI1KmiVdhs8vG4NyZOfuVRraK0SxeC3PVg 0s2LlBcBXZY9S2yRYW9byZbt4Omd1KdtWx7VkTQiG47ezg8sGHQb+htOM xjFj3ccprMIgzwx/WZexSrGDQgO+ibRrzOf42ONQZtlKR85B56uu+KsWU 2/2lgQXdO3I3vPm1xvevNhwbwxAmCpqWpEoB3tFxQ7w5GyyCNO1S/Qnlh B+NebRfDXH3Dh7dR0ZwuDAypv+SOe3MpcPppYLj60SC0raNhRymcEEaHk eJBCILQujC3TMxWf+vYV1KCgiJrgG/xI0aTxFkR9SPQcAvGGlQA+UyJmM w==; X-CSE-ConnectionGUID: Ik854R7FQ3i9C0MjSUxR7w== X-CSE-MsgGUID: KlXMZmIbQZuLyBlJNoZyfw== X-IronPort-AV: E=McAfee;i="6700,10204,11172"; a="26656209" X-IronPort-AV: E=Sophos;i="6.10,167,1719903600"; d="scan'208";a="26656209" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Aug 2024 11:04:20 -0700 X-CSE-ConnectionGUID: +hCcj4xPSTeh0y1sovcqmA== X-CSE-MsgGUID: ux4SOoZ9T7KrKvtOMBMkKQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,167,1719903600"; d="scan'208";a="62074201" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa007.jf.intel.com with ESMTP; 22 Aug 2024 11:04:16 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 6E618331; Thu, 22 Aug 2024 21:04:12 +0300 (EEST) From: Andy Shevchenko To: Andi Shyti , Jarkko Nikula , Andy Shevchenko , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mika Westerberg , Jan Dabros , Narasimhan.V@amd.com, Borislav Petkov , Kim Phillips , Mario Limonciello Subject: [PATCH v1 3/5] i2c: designware: Unify the firmware type checks Date: Thu, 22 Aug 2024 20:58:39 +0300 Message-ID: <20240822180411.2298991-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240822180411.2298991-1-andriy.shevchenko@linux.intel.com> References: <20240822180411.2298991-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Instead of asymmetrical checks for the firmware type use the is_*_node() calls. Reviewed-by: Andi Shyti Reviewed-by: Mario Limonciello Signed-off-by: Andy Shevchenko --- drivers/i2c/busses/i2c-designware-common.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-common.c b/drivers/i2c/busses/i2c-designware-common.c index b0d3c47d93ce..2c460093b7ab 100644 --- a/drivers/i2c/busses/i2c-designware-common.c +++ b/drivers/i2c/busses/i2c-designware-common.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -372,14 +373,15 @@ int i2c_dw_fw_parse_and_configure(struct dw_i2c_dev *dev) { struct i2c_timings *t = &dev->timings; struct device *device = dev->dev; + struct fwnode_handle *fwnode = dev_fwnode(device); i2c_parse_fw_timings(device, t, false); i2c_dw_adjust_bus_speed(dev); - if (device->of_node) + if (is_of_node(fwnode)) i2c_dw_of_configure(device); - if (has_acpi_companion(device)) + else if (is_acpi_node(fwnode)) i2c_dw_acpi_configure(device); return i2c_dw_validate_speed(dev); From patchwork Thu Aug 22 17:58:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 821871 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (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 E7DD01CFEA3; Thu, 22 Aug 2024 18:04:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724349862; cv=none; b=ssWnwLiD8fC4r+0k8ngFiPZrYfOfmRR4hUwbzvXsNL3z5Fo9ob5hr4xqky0JPofguVqCb7ob2i11tY5zTBJTTQk3FZbZgxGVP6I26cPmch6yRiUWssloBIWkDnRk4lz6LQGuIHVmHDQRVUJiFiM5mSaRqyn68hJxrE8YZxM6Gfc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724349862; c=relaxed/simple; bh=h7LsJHBIzXuSTaTAvZwPJobQMQQe2FjkCJdegZnWH84=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jl/8G7tTBL75vkOdKKxbaoxbGgnewv3d6aAnUjsxUDTg2uz2/+z7QAW+kMlVJZ5f6EQCmwyKp6XR5QQAPEViZoR7cLCEl0rqbhx/EQtoB5S711Dt8jQz6rVL1y/+77P6g1RsLHMNni5MM1Ibp+HaZnVJv61laIcZ7RreWC0wzjg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=gkF5CdpI; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="gkF5CdpI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724349861; x=1755885861; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=h7LsJHBIzXuSTaTAvZwPJobQMQQe2FjkCJdegZnWH84=; b=gkF5CdpIvvO0lvMvWdpy26wpnjxF5RR2lVo6KaWPAxhm2DaVqds9Gkln 14suUuAJaFKjr/xoNCDXt9ZDikUJ+aqcaAahVzAreVnEL54K9mjoyYzTZ rJmF1w1L1PZR9Uk3SAq46RNuSbbeE+qjVGnowZnyZ9FKvSLvd6i6vKn4J ZneTnQOwwKyBOAvC7tZDYbRQQppPPpXQspzrzAeEPyBFfxkrGsgZskdBL xSPZ4Wpw20adS8jj8TYifD4jUU0K7RK9Sf2lR1996E7aS1yCMCRqlFkse Yw6ZcSkwYUlATk1CnMPFNx3rKVD0cdL5uzXlx7RyZ+RauNhiIa6f7pLuP Q==; X-CSE-ConnectionGUID: oa/5PlfYTwGxZ+i4WK9V+Q== X-CSE-MsgGUID: qZVqLmfNSgyPViAkSKwemg== X-IronPort-AV: E=McAfee;i="6700,10204,11172"; a="26656193" X-IronPort-AV: E=Sophos;i="6.10,167,1719903600"; d="scan'208";a="26656193" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Aug 2024 11:04:20 -0700 X-CSE-ConnectionGUID: Dfm2sxuuSHGJlrzOcWHxMw== X-CSE-MsgGUID: 6nn7VvhuRiiQ8AsWCMF+Kg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,167,1719903600"; d="scan'208";a="62074202" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa007.jf.intel.com with ESMTP; 22 Aug 2024 11:04:16 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 7A56E43E; Thu, 22 Aug 2024 21:04:12 +0300 (EEST) From: Andy Shevchenko To: Andi Shyti , Jarkko Nikula , Andy Shevchenko , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mika Westerberg , Jan Dabros , Narasimhan.V@amd.com, Borislav Petkov , Kim Phillips Subject: [PATCH v1 4/5] i2c: designware: Move exports to I2C_DW namespaces Date: Thu, 22 Aug 2024 20:58:40 +0300 Message-ID: <20240822180411.2298991-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240822180411.2298991-1-andriy.shevchenko@linux.intel.com> References: <20240822180411.2298991-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reduce scope of the I²C DesignWare driver exports to I2C_DW namespaces. This will prevent abuse of the symbols and clean up global namespace. Reviewed-by: Andi Shyti Signed-off-by: Andy Shevchenko --- drivers/i2c/busses/i2c-designware-common.c | 2 ++ drivers/i2c/busses/i2c-designware-master.c | 3 +++ drivers/i2c/busses/i2c-designware-pcidrv.c | 2 ++ drivers/i2c/busses/i2c-designware-platdrv.c | 2 ++ drivers/i2c/busses/i2c-designware-slave.c | 3 +++ 5 files changed, 12 insertions(+) diff --git a/drivers/i2c/busses/i2c-designware-common.c b/drivers/i2c/busses/i2c-designware-common.c index 2c460093b7ab..2601876f76ad 100644 --- a/drivers/i2c/busses/i2c-designware-common.c +++ b/drivers/i2c/busses/i2c-designware-common.c @@ -28,6 +28,8 @@ #include #include +#define DEFAULT_SYMBOL_NAMESPACE I2C_DW_COMMON + #include "i2c-designware-core.h" static char *abort_sources[] = { diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c index d3b466592be4..a890a73e197e 100644 --- a/drivers/i2c/busses/i2c-designware-master.c +++ b/drivers/i2c/busses/i2c-designware-master.c @@ -22,6 +22,8 @@ #include #include +#define DEFAULT_SYMBOL_NAMESPACE I2C_DW + #include "i2c-designware-core.h" #define AMD_TIMEOUT_MIN_US 25 @@ -1037,3 +1039,4 @@ EXPORT_SYMBOL_GPL(i2c_dw_probe_master); MODULE_DESCRIPTION("Synopsys DesignWare I2C bus master adapter"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(I2C_DW_COMMON); diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c index 14186230622d..2f2085700594 100644 --- a/drivers/i2c/busses/i2c-designware-pcidrv.c +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c @@ -410,3 +410,5 @@ module_pci_driver(dw_i2c_driver); MODULE_AUTHOR("Baruch Siach "); MODULE_DESCRIPTION("Synopsys DesignWare PCI I2C bus adapter"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(I2C_DW); +MODULE_IMPORT_NS(I2C_DW_COMMON); diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index 7e2f26d0593e..7a3f4e96d59e 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -462,3 +462,5 @@ module_exit(dw_i2c_exit_driver); MODULE_AUTHOR("Baruch Siach "); MODULE_DESCRIPTION("Synopsys DesignWare I2C bus adapter"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(I2C_DW); +MODULE_IMPORT_NS(I2C_DW_COMMON); diff --git a/drivers/i2c/busses/i2c-designware-slave.c b/drivers/i2c/busses/i2c-designware-slave.c index 78e2c47e3d7d..5995361b5615 100644 --- a/drivers/i2c/busses/i2c-designware-slave.c +++ b/drivers/i2c/busses/i2c-designware-slave.c @@ -16,6 +16,8 @@ #include #include +#define DEFAULT_SYMBOL_NAMESPACE I2C_DW + #include "i2c-designware-core.h" static void i2c_dw_configure_fifo_slave(struct dw_i2c_dev *dev) @@ -279,3 +281,4 @@ EXPORT_SYMBOL_GPL(i2c_dw_probe_slave); MODULE_AUTHOR("Luis Oliveira "); MODULE_DESCRIPTION("Synopsys DesignWare I2C bus slave adapter"); MODULE_LICENSE("GPL v2"); +MODULE_IMPORT_NS(I2C_DW_COMMON); From patchwork Thu Aug 22 17:58:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 821869 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (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 850DF1D04B5; Thu, 22 Aug 2024 18:04:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724349873; cv=none; b=WdRo9dDjvnou8T5mtOjv3MzvObrxGkuII8XPWHXTEAobsOgsN/8BassW0AbpYaUov2TSFZNLexjpLdOowobD/v8xB8ySoJmt7cpSiKZ5svv1MIzPDvfh6E/7F/ZkfMr4SFgcfiLODprA2Xp/+5y2ge0qcRKpmeyfslzjTkusWXw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724349873; c=relaxed/simple; bh=PLg9DW14fUbZUKvPzBr5SKlhiqNP2bi/e6w3+deC6jY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=M155sD5fNamCSCGXbWuJlGacqhsggwXETtEPxJoWVlG1zkN+jgkQtEVuas/bFDMECzVDp+TVuND+d7XQQSDWBWR1ZdCpc6w4mICz+LY6BcZDFfK7uMoob6amin1a/0n3rYjVpDhMlqGEYgDtJvaOPdjCEq/PXXxnEACf0oBm/qw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=gu+1KxH9; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="gu+1KxH9" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724349871; x=1755885871; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PLg9DW14fUbZUKvPzBr5SKlhiqNP2bi/e6w3+deC6jY=; b=gu+1KxH9HLT5tltbbxXV0FJzS355UeqGUNmf76g6q5t40sFaS44aODYX R/icQF4Zp7Yq1pJo1yESQiM5331+8+MPOB/vZQWLp6ws29bQaFhissbxv K2lBi2wpk11gFWuG8ur9kYBul9y+HoBnJ/oW15UoygyPq3U/w0SrKvqRX LgxTWIYdk9OCcyLp48vsH5D5iurxxziNZ4Uwbi4xk6d1x3mK+ZYK1IoLb hF51yUl3wZY2u78Bdek90IIi/lqI4L5NsSvtYDKWquQ3T10b9kh6JeVjZ nVCytwtokLaSL0YXGVtJDGoBFNlWLkAHuK97MYX/bgY2DSCP75P9IAvGf g==; X-CSE-ConnectionGUID: pDe+YdgoRLSZ2hcOrmPrdQ== X-CSE-MsgGUID: sgN0ZmVKQ+2MI2QcY3oeZQ== X-IronPort-AV: E=McAfee;i="6700,10204,11172"; a="26656231" X-IronPort-AV: E=Sophos;i="6.10,167,1719903600"; d="scan'208";a="26656231" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Aug 2024 11:04:30 -0700 X-CSE-ConnectionGUID: XxlS/6KOR0GrlJwGcQU6iw== X-CSE-MsgGUID: jPU8kpFpTOeVkY75015g5Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,167,1719903600"; d="scan'208";a="62074266" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa007.jf.intel.com with ESMTP; 22 Aug 2024 11:04:28 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 8A4A94D7; Thu, 22 Aug 2024 21:04:12 +0300 (EEST) From: Andy Shevchenko To: Andi Shyti , Jarkko Nikula , Andy Shevchenko , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mika Westerberg , Jan Dabros , Narasimhan.V@amd.com, Borislav Petkov , Kim Phillips Subject: [PATCH v1 5/5] i2c: designware: Remove ->disable() callback Date: Thu, 22 Aug 2024 20:58:41 +0300 Message-ID: <20240822180411.2298991-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240822180411.2298991-1-andriy.shevchenko@linux.intel.com> References: <20240822180411.2298991-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Commit 90312351fd1e ("i2c: designware: MASTER mode as separated driver") introduced ->disable() callback but there is no real use for it. Both i2c-designware-master.c and i2c-designware-slave.c set it to the same i2c_dw_disable() and scope is inside the same kernel module. That said, replace the callback by explicitly calling the i2c_dw_disable(). Reviewed-by: Andi Shyti Signed-off-by: Andy Shevchenko --- drivers/i2c/busses/i2c-designware-common.c | 1 + drivers/i2c/busses/i2c-designware-core.h | 4 +--- drivers/i2c/busses/i2c-designware-master.c | 1 - drivers/i2c/busses/i2c-designware-pcidrv.c | 5 +++-- drivers/i2c/busses/i2c-designware-platdrv.c | 4 ++-- drivers/i2c/busses/i2c-designware-slave.c | 3 +-- 6 files changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-common.c b/drivers/i2c/busses/i2c-designware-common.c index 2601876f76ad..b60c55587e48 100644 --- a/drivers/i2c/busses/i2c-designware-common.c +++ b/drivers/i2c/busses/i2c-designware-common.c @@ -734,6 +734,7 @@ void i2c_dw_disable(struct dw_i2c_dev *dev) i2c_dw_release_lock(dev); } +EXPORT_SYMBOL_GPL(i2c_dw_disable); MODULE_DESCRIPTION("Synopsys DesignWare I2C bus adapter core"); MODULE_LICENSE("GPL"); diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h index b9f97f4eedf5..723d599cca93 100644 --- a/drivers/i2c/busses/i2c-designware-core.h +++ b/drivers/i2c/busses/i2c-designware-core.h @@ -237,7 +237,6 @@ struct reset_control; * @semaphore_idx: Index of table with semaphore type attached to the bus. It's * -1 if there is no semaphore. * @shared_with_punit: true if this bus is shared with the SoCs PUNIT - * @disable: function to disable the controller * @init: function to initialize the I2C hardware * @set_sda_hold_time: callback to retrieve IP specific SDA hold timing * @mode: operation mode - DW_IC_MASTER or DW_IC_SLAVE @@ -295,7 +294,6 @@ struct dw_i2c_dev { void (*release_lock)(void); int semaphore_idx; bool shared_with_punit; - void (*disable)(struct dw_i2c_dev *dev); int (*init)(struct dw_i2c_dev *dev); int (*set_sda_hold_time)(struct dw_i2c_dev *dev); int mode; @@ -342,7 +340,6 @@ int i2c_dw_wait_bus_not_busy(struct dw_i2c_dev *dev); int i2c_dw_handle_tx_abort(struct dw_i2c_dev *dev); int i2c_dw_set_fifo_size(struct dw_i2c_dev *dev); u32 i2c_dw_func(struct i2c_adapter *adap); -void i2c_dw_disable(struct dw_i2c_dev *dev); static inline void __i2c_dw_enable(struct dw_i2c_dev *dev) { @@ -375,6 +372,7 @@ static inline void __i2c_dw_read_intr_mask(struct dw_i2c_dev *dev, } void __i2c_dw_disable(struct dw_i2c_dev *dev); +void i2c_dw_disable(struct dw_i2c_dev *dev); extern void i2c_dw_configure_master(struct dw_i2c_dev *dev); extern int i2c_dw_probe_master(struct dw_i2c_dev *dev); diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c index a890a73e197e..e46f1b22c360 100644 --- a/drivers/i2c/busses/i2c-designware-master.c +++ b/drivers/i2c/busses/i2c-designware-master.c @@ -949,7 +949,6 @@ int i2c_dw_probe_master(struct dw_i2c_dev *dev) init_completion(&dev->cmd_complete); dev->init = i2c_dw_init_master; - dev->disable = i2c_dw_disable; ret = i2c_dw_init_regmap(dev); if (ret) diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c index 2f2085700594..dd188ccd961e 100644 --- a/drivers/i2c/busses/i2c-designware-pcidrv.c +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c @@ -198,7 +198,7 @@ static int __maybe_unused i2c_dw_pci_runtime_suspend(struct device *dev) { struct dw_i2c_dev *i_dev = dev_get_drvdata(dev); - i_dev->disable(i_dev); + i2c_dw_disable(i_dev); return 0; } @@ -339,7 +339,8 @@ static void i2c_dw_pci_remove(struct pci_dev *pdev) { struct dw_i2c_dev *dev = pci_get_drvdata(pdev); - dev->disable(dev); + i2c_dw_disable(dev); + pm_runtime_forbid(&pdev->dev); pm_runtime_get_noresume(&pdev->dev); diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index 7a3f4e96d59e..e49c68c6e142 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -328,7 +328,7 @@ static void dw_i2c_plat_remove(struct platform_device *pdev) i2c_del_adapter(&dev->adapter); - dev->disable(dev); + i2c_dw_disable(dev); pm_runtime_dont_use_autosuspend(&pdev->dev); pm_runtime_put_sync(&pdev->dev); @@ -357,7 +357,7 @@ static int dw_i2c_plat_runtime_suspend(struct device *dev) if (i_dev->shared_with_punit) return 0; - i_dev->disable(i_dev); + i2c_dw_disable(i_dev); i2c_dw_prepare_clk(i_dev, false); return 0; diff --git a/drivers/i2c/busses/i2c-designware-slave.c b/drivers/i2c/busses/i2c-designware-slave.c index 5995361b5615..7035296aa24c 100644 --- a/drivers/i2c/busses/i2c-designware-slave.c +++ b/drivers/i2c/busses/i2c-designware-slave.c @@ -90,7 +90,7 @@ static int i2c_dw_unreg_slave(struct i2c_client *slave) struct dw_i2c_dev *dev = i2c_get_adapdata(slave->adapter); regmap_write(dev->map, DW_IC_INTR_MASK, 0); - dev->disable(dev); + i2c_dw_disable(dev); synchronize_irq(dev->irq); dev->slave = NULL; pm_runtime_put(dev->dev); @@ -237,7 +237,6 @@ int i2c_dw_probe_slave(struct dw_i2c_dev *dev) int ret; dev->init = i2c_dw_init_slave; - dev->disable = i2c_dw_disable; ret = i2c_dw_init_regmap(dev); if (ret)