mfd: intel_quark_i2c_gpio: Convert I²C to use software nodes
Subsystems (4)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Andy Shevchenko
reviewerPATCH 1/2 mfd: intel_quark_i2c_gpio: Convert I²C to use software nodes
The driver can provide a software node group instead of passing legacy platform data. This will allow to drop the legacy platform data structures along with unifying a child device driver to use same interface for all property providers, i.e. Device Tree, ACPI, and board files.
--- drivers/mfd/intel_quark_i2c_gpio.c | 41 +++++++++++++++++++----------- 1 file changed, 26 insertions(+), 15 deletions(-)
drivers/mfd/intel_quark_i2c_gpio.c +26 -15
@@ -18,7 +18,7 @@#include <linux/dmi.h> #include <linux/i2c.h> #include <linux/platform_data/gpio-dwapb.h> -#include <linux/platform_data/i2c-designware.h> +#include <linux/property.h> /* PCI BAR for register base address */ #define MFD_I2C_BAR 0
@@ -50,24 +50,44 @@ struct intel_quark_mfd {struct clk_lookup *i2c_clk_lookup; }; +static const struct property_entry intel_quark_i2c_controller_standard_properties[] = { +PROPERTY_ENTRY_U32 ("clock-frequency" ,I2C_MAX_STANDARD_MODE_FREQ ), + { } +}; + +static const struct software_node intel_quark_i2c_controller_standard_node = { + .name ="intel-quark-i2c-controller" , + .properties = intel_quark_i2c_controller_standard_properties, +}; + +static const struct property_entry intel_quark_i2c_controller_fast_properties[] = { +PROPERTY_ENTRY_U32 ("clock-frequency" ,I2C_MAX_FAST_MODE_FREQ ), + { } +}; + +static const struct software_node intel_quark_i2c_controller_fast_node = { + .name ="intel-quark-i2c-controller" , + .properties = intel_quark_i2c_controller_fast_properties, +}; +static const struct dmi_system_id dmi_platform_info[] = { { .matches = {DMI_EXACT_MATCH (DMI_BOARD_NAME ,"Galileo" ), }, - .driver_data = (void *)I2C_MAX_STANDARD_MODE_FREQ , + .driver_data = (void *)&intel_quark_i2c_controller_standard_node, }, { .matches = {DMI_EXACT_MATCH (DMI_BOARD_NAME ,"GalileoGen2" ), }, - .driver_data = (void *)I2C_MAX_FAST_MODE_FREQ , + .driver_data = (void *)&intel_quark_i2c_controller_fast_node, }, { .matches = {DMI_EXACT_MATCH (DMI_BOARD_NAME ,"SIMATIC IOT2000" ), }, - .driver_data = (void *)I2C_MAX_FAST_MODE_FREQ , + .driver_data = (void *)&intel_quark_i2c_controller_fast_node, }, {} };
@@ -162,8 +182,6 @@ static int intel_quark_i2c_setup(struct pci_dev *pdev)struct mfd_cell *cell = &intel_quark_mfd_cells[MFD_I2C_BAR ];struct resource *res = intel_quark_i2c_res;const struct dmi_system_id *dmi_id; -struct dw_i2c_platform_data *pdata; -struct device *dev = &pdev->dev; res[INTEL_QUARK_IORES_MEM ].start =pci_resource_start (pdev,MFD_I2C_BAR ); res[INTEL_QUARK_IORES_MEM ].end =pci_resource_end (pdev,MFD_I2C_BAR );
@@ -171,19 +189,12 @@ static int intel_quark_i2c_setup(struct pci_dev *pdev) res[INTEL_QUARK_IORES_IRQ ].start =pci_irq_vector (pdev,0 ); res[INTEL_QUARK_IORES_IRQ ].end =pci_irq_vector (pdev,0 ); - pdata =devm_kzalloc (dev,sizeof (*pdata),GFP_KERNEL ); -if (!pdata) -return -ENOMEM ; -/* Normal mode by default */ - pdata->i2c_scl_freq =I2C_MAX_STANDARD_MODE_FREQ ; + cell->swnode = &intel_quark_i2c_controller_standard_node; dmi_id =dmi_first_match (dmi_platform_info);if (dmi_id) - pdata->i2c_scl_freq = (uintptr_t )dmi_id->driver_data; - - cell->platform_data = pdata; - cell->pdata_size =sizeof (*pdata); + cell->swnode = (struct software_node *)dmi_id->driver_data;return 0 ; }
Signature · 1 line
2.30.2
Quoted 10 lines · Andy Shevchenko
The driver can provide a software node group instead of passing legacy platform data. This will allow to drop the legacy platform data structures along with unifying a child device driver to use same interface for all property providers, i.e. Device Tree, ACPI, and board files.
Signed-off-by Andy Shevchenko <[email protected]>--- drivers/mfd/intel_quark_i2c_gpio.c | 41 +++++++++++++++++++----------- 1 file changed, 26 insertions(+), 15 deletions(-)
For my own reference (apply this as-is to your sign-off block):
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
Lee Jones
AppliedQuoted 10 lines · Andy Shevchenko
The driver can provide a software node group instead of passing legacy platform data. This will allow to drop the legacy platform data structures along with unifying a child device driver to use same interface for all property providers, i.e. Device Tree, ACPI, and board files.
Signed-off-by Andy Shevchenko <[email protected]>--- drivers/mfd/intel_quark_i2c_gpio.c | 41 +++++++++++++++++++----------- 1 file changed, 26 insertions(+), 15 deletions(-)
Applied, thanks.
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
Andy Shevchenko
reviewerPATCH 2/2 i2c: designware: Get rid of legacy platform data
In reply to a message not in the archivePlatform data is a legacy interface to supply device properties to the driver. In this case we don't have anymore in-kernel users for it. Just remove it for good.
--- drivers/i2c/busses/i2c-designware-platdrv.c | 7 +------ include/linux/platform_data/i2c-designware.h | 13 ------------- 2 files changed, 1 insertion(+), 19 deletions(-) delete mode 100644 include/linux/platform_data/i2c-designware.h
drivers/i2c/busses/i2c-designware-platdrv.c +1 -6
@@ -22,7 +22,6 @@#include <linux/mfd/syscon.h> #include <linux/module.h> #include <linux/of.h> -#include <linux/platform_data/i2c-designware.h> #include <linux/platform_device.h> #include <linux/pm.h> #include <linux/pm_runtime.h>
@@ -206,7 +205,6 @@ static const struct dmi_system_id dw_i2c_hwmon_class_dmi[] = {static int dw_i2c_plat_probe (struct platform_device *pdev) { -struct dw_i2c_platform_data *pdata =dev_get_platdata (&pdev->dev);struct i2c_adapter *adap;struct dw_i2c_dev *dev;struct i2c_timings *t;
@@ -236,10 +234,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)reset_control_deassert (dev->rst); t = &dev->timings; -if (pdata) - t->bus_freq_hz = pdata->i2c_scl_freq; -else -i2c_parse_fw_timings (&pdev->dev, t, false); +i2c_parse_fw_timings (&pdev->dev, t, false);i2c_dw_adjust_bus_speed (dev);
include/linux/platform_data/i2c-designware.h deleted +0 -13
@@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* -* Copyright(c) 2014 Intel Corporation. -*/ - -#ifndef I2C_DESIGNWARE_H -#define I2C_DESIGNWARE_H - -struct dw_i2c_platform_data { -unsigned int i2c_scl_freq; -}; - -#endif
Signature · 1 line
2.30.2
Re: [PATCH v1 2/2] i2c: designware: Get rid of legacy platform data
Quoted 5 lines · Andy Shevchenko
Platform data is a legacy interface to supply device properties to the driver. In this case we don't have anymore in-kernel users for it. Just remove it for good.
Signed-off-by Andy Shevchenko <[email protected]>
Jarkko Nikula
Acked-byRe: [PATCH v1 2/2] i2c: designware: Get rid of legacy platform data
Quoted 9 lines · Wolfram Sang
Quoted 5 lines · Andy Shevchenko
Platform data is a legacy interface to supply device properties to the driver. In this case we don't have anymore in-kernel users for it. Just remove it for good.
Signed-off-by Andy Shevchenko <[email protected]>Acked-by Wolfram Sang <[email protected]>
Re: [PATCH v1 2/2] i2c: designware: Get rid of legacy platform data
In reply to Wolfram SangQuoted 8 lines · Wolfram Sang
Quoted 5 lines · Andy Shevchenko
Platform data is a legacy interface to supply device properties to the driver. In this case we don't have anymore in-kernel users for it. Just remove it for good.
Signed-off-by Andy Shevchenko <[email protected]>Acked-by Wolfram Sang <[email protected]>
Do you require an immutable branch?
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH v1 2/2] i2c: designware: Get rid of legacy platform data
Quoted 10 lines
Quoted 8 lines
Quoted 6 lines
Platform data is a legacy interface to supply device properties to the driver. In this case we don't have anymore in-kernel users for it. Just remove it for good.
Signed-off-by Andy Shevchenko <[email protected]>Acked-by Wolfram Sang <[email protected]>Do you require an immutable branch?
Nope, but thanks for asking.
Lee Jones
AppliedRe: [PATCH v1 2/2] i2c: designware: Get rid of legacy platform data
In reply to Andy ShevchenkoQuoted 10 lines · Andy Shevchenko
Platform data is a legacy interface to supply device properties to the driver. In this case we don't have anymore in-kernel users for it. Just remove it for good.
Signed-off-by Andy Shevchenko <[email protected]>--- drivers/i2c/busses/i2c-designware-platdrv.c | 7 +------ include/linux/platform_data/i2c-designware.h | 13 ------------- 2 files changed, 1 insertion(+), 19 deletions(-) delete mode 100644 include/linux/platform_data/i2c-designware.h
Applied, thanks.
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH v1 0/2] mfd: intel_quark_i2c_gpio: Covert I²C part to software nodes
In reply to a message not in the archiveQuoted 3 lines
driver). In any case I guess the procedure is pretty much standard, i.e. Lee creates an immutable branch that Wolfram can pull into his tree.
Yes, that would be my favourite.
Andy Shevchenko
reviewerRe: [PATCH v1 0/2] mfd: intel_quark_i2c_gpio: Covert I²C part to software nodes
Quoted 5 lines · Wolfram Sang
Quoted 3 lines
driver). In any case I guess the procedure is pretty much standard, i.e. Lee creates an immutable branch that Wolfram can pull into his tree.
Yes, that would be my favourite.
Can you Ack the patch then?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Andy Shevchenko
reviewerRe: [PATCH v1 0/2] mfd: intel_quark_i2c_gpio: Covert I²C part to software nodes
In reply to a message not in the archiveQuoted 8 lines · Andy Shevchenko
Since we have software nodes support in MFD core, we may start converting
intel_quark_i2c_gpiodriver to use it. For the starter it converts I²C part. and as a result we get rid of platform data for I²C DesignWare driver.This series depends on the stuff in MFD. OTOH the DesignWare patch should not be in conflict with other patches floating around (against I²C DesignWare driver). In any case I guess the procedure is pretty much standard, i.e. Lee creates an immutable branch that Wolfram can pull into his tree.
Lee, can you, please, apply this series?
It seems we have all Acked by respective maintainer(s).
Quoted 13 lines
Andy Shevchenko (2):
mfd:intel_quark_i2c_gpio: Convert I²C to use software nodes
i2c: designware: Get rid of legacy platform datadrivers/i2c/busses/i2c-designware-platdrv.c | 7 +--- drivers/mfd/intel_quark_i2c_gpio.c | 41 +++++++++++++------- include/linux/platform_data/i2c-designware.h | 13 ------- 3 files changed, 27 insertions(+), 34 deletions(-) delete mode 100644 include/linux/platform_data/i2c-designware.hSignature · 1 line
2.30.2
Signature · 2 lines
With Best Regards, Andy Shevchenko