* [PATCH v3 0/2] mfd: intel_quark_i2c_gpio: Refactor and support for IOT2000
@ 2017-05-30 8:17 Jan Kiszka
2017-05-30 8:17 ` [PATCH v3 1/2] mfd: intel_quark_i2c_gpio: Use dmi_system_id table for retrieving frequency Jan Kiszka
2017-05-30 8:17 ` [PATCH v3 2/2] mfd: intel_quark_i2c_gpio: Add support for SIMATIC IOT2000 platform Jan Kiszka
0 siblings, 2 replies; 5+ messages in thread
From: Jan Kiszka @ 2017-05-30 8:17 UTC (permalink / raw)
To: Lee Jones; +Cc: Linux Kernel Mailing List, Andy Shevchenko, Sascha Weisenberger
Changes in v3:
- added Andy's reviewed tag
Jan
Jan Kiszka (2):
mfd: intel_quark_i2c_gpio: Use dmi_system_id table for retrieving
frequency
mfd: intel_quark_i2c_gpio: Add support for SIMATIC IOT2000 platform
drivers/mfd/intel_quark_i2c_gpio.c | 49 ++++++++++++++++++++++----------------
1 file changed, 29 insertions(+), 20 deletions(-)
--
2.12.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 1/2] mfd: intel_quark_i2c_gpio: Use dmi_system_id table for retrieving frequency
2017-05-30 8:17 [PATCH v3 0/2] mfd: intel_quark_i2c_gpio: Refactor and support for IOT2000 Jan Kiszka
@ 2017-05-30 8:17 ` Jan Kiszka
2017-05-30 10:13 ` Lee Jones
2017-05-30 8:17 ` [PATCH v3 2/2] mfd: intel_quark_i2c_gpio: Add support for SIMATIC IOT2000 platform Jan Kiszka
1 sibling, 1 reply; 5+ messages in thread
From: Jan Kiszka @ 2017-05-30 8:17 UTC (permalink / raw)
To: Lee Jones; +Cc: Linux Kernel Mailing List, Andy Shevchenko, Sascha Weisenberger
Avoids reimplementation of DMI matching in intel_quark_i2c_setup.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/mfd/intel_quark_i2c_gpio.c | 33 +++++++++++++--------------------
1 file changed, 13 insertions(+), 20 deletions(-)
diff --git a/drivers/mfd/intel_quark_i2c_gpio.c b/drivers/mfd/intel_quark_i2c_gpio.c
index 7946d6e38b87..050061320377 100644
--- a/drivers/mfd/intel_quark_i2c_gpio.c
+++ b/drivers/mfd/intel_quark_i2c_gpio.c
@@ -58,19 +58,18 @@ struct intel_quark_mfd {
struct clk_lookup *i2c_clk_lookup;
};
-struct i2c_mode_info {
- const char *name;
- unsigned int i2c_scl_freq;
-};
-
-static const struct i2c_mode_info platform_i2c_mode_info[] = {
+static const struct dmi_system_id dmi_platform_info[] = {
{
- .name = "Galileo",
- .i2c_scl_freq = 100000,
+ .matches = {
+ DMI_EXACT_MATCH(DMI_BOARD_NAME, "Galileo"),
+ },
+ .driver_data = (void *)100000,
},
{
- .name = "GalileoGen2",
- .i2c_scl_freq = 400000,
+ .matches = {
+ DMI_EXACT_MATCH(DMI_BOARD_NAME, "GalileoGen2"),
+ },
+ .driver_data = (void *)400000,
},
{}
};
@@ -160,8 +159,7 @@ static void intel_quark_unregister_i2c_clk(struct device *dev)
static int intel_quark_i2c_setup(struct pci_dev *pdev, struct mfd_cell *cell)
{
- const char *board_name = dmi_get_system_info(DMI_BOARD_NAME);
- const struct i2c_mode_info *info;
+ const struct dmi_system_id *dmi_id;
struct dw_i2c_platform_data *pdata;
struct resource *res = (struct resource *)cell->resources;
struct device *dev = &pdev->dev;
@@ -181,14 +179,9 @@ static int intel_quark_i2c_setup(struct pci_dev *pdev, struct mfd_cell *cell)
/* Normal mode by default */
pdata->i2c_scl_freq = 100000;
- if (board_name) {
- for (info = platform_i2c_mode_info; info->name; info++) {
- if (!strcmp(board_name, info->name)) {
- pdata->i2c_scl_freq = info->i2c_scl_freq;
- break;
- }
- }
- }
+ 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);
--
2.12.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 2/2] mfd: intel_quark_i2c_gpio: Add support for SIMATIC IOT2000 platform
2017-05-30 8:17 [PATCH v3 0/2] mfd: intel_quark_i2c_gpio: Refactor and support for IOT2000 Jan Kiszka
2017-05-30 8:17 ` [PATCH v3 1/2] mfd: intel_quark_i2c_gpio: Use dmi_system_id table for retrieving frequency Jan Kiszka
@ 2017-05-30 8:17 ` Jan Kiszka
2017-05-30 10:13 ` Lee Jones
1 sibling, 1 reply; 5+ messages in thread
From: Jan Kiszka @ 2017-05-30 8:17 UTC (permalink / raw)
To: Lee Jones; +Cc: Linux Kernel Mailing List, Andy Shevchenko, Sascha Weisenberger
The SIMATIC IOT2020 and IOT2040 are derived from the Galileo Gen2 board
and share its I2C frequency.
Signed-off-by: Sascha Weisenberger <sascha.weisenberger@siemens.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/mfd/intel_quark_i2c_gpio.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/mfd/intel_quark_i2c_gpio.c b/drivers/mfd/intel_quark_i2c_gpio.c
index 050061320377..90e35dec8648 100644
--- a/drivers/mfd/intel_quark_i2c_gpio.c
+++ b/drivers/mfd/intel_quark_i2c_gpio.c
@@ -71,6 +71,22 @@ static const struct dmi_system_id dmi_platform_info[] = {
},
.driver_data = (void *)400000,
},
+ {
+ .matches = {
+ DMI_EXACT_MATCH(DMI_BOARD_NAME, "SIMATIC IOT2000"),
+ DMI_EXACT_MATCH(DMI_BOARD_ASSET_TAG,
+ "6ES7647-0AA00-0YA2"),
+ },
+ .driver_data = (void *)400000,
+ },
+ {
+ .matches = {
+ DMI_EXACT_MATCH(DMI_BOARD_NAME, "SIMATIC IOT2000"),
+ DMI_EXACT_MATCH(DMI_BOARD_ASSET_TAG,
+ "6ES7647-0AA00-1YA2"),
+ },
+ .driver_data = (void *)400000,
+ },
{}
};
--
2.12.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3 2/2] mfd: intel_quark_i2c_gpio: Add support for SIMATIC IOT2000 platform
2017-05-30 8:17 ` [PATCH v3 2/2] mfd: intel_quark_i2c_gpio: Add support for SIMATIC IOT2000 platform Jan Kiszka
@ 2017-05-30 10:13 ` Lee Jones
0 siblings, 0 replies; 5+ messages in thread
From: Lee Jones @ 2017-05-30 10:13 UTC (permalink / raw)
To: Jan Kiszka
Cc: Linux Kernel Mailing List, Andy Shevchenko, Sascha Weisenberger
On Tue, 30 May 2017, Jan Kiszka wrote:
> The SIMATIC IOT2020 and IOT2040 are derived from the Galileo Gen2 board
> and share its I2C frequency.
>
> Signed-off-by: Sascha Weisenberger <sascha.weisenberger@siemens.com>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/mfd/intel_quark_i2c_gpio.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
Applied, thanks.
> diff --git a/drivers/mfd/intel_quark_i2c_gpio.c b/drivers/mfd/intel_quark_i2c_gpio.c
> index 050061320377..90e35dec8648 100644
> --- a/drivers/mfd/intel_quark_i2c_gpio.c
> +++ b/drivers/mfd/intel_quark_i2c_gpio.c
> @@ -71,6 +71,22 @@ static const struct dmi_system_id dmi_platform_info[] = {
> },
> .driver_data = (void *)400000,
> },
> + {
> + .matches = {
> + DMI_EXACT_MATCH(DMI_BOARD_NAME, "SIMATIC IOT2000"),
> + DMI_EXACT_MATCH(DMI_BOARD_ASSET_TAG,
> + "6ES7647-0AA00-0YA2"),
> + },
> + .driver_data = (void *)400000,
> + },
> + {
> + .matches = {
> + DMI_EXACT_MATCH(DMI_BOARD_NAME, "SIMATIC IOT2000"),
> + DMI_EXACT_MATCH(DMI_BOARD_ASSET_TAG,
> + "6ES7647-0AA00-1YA2"),
> + },
> + .driver_data = (void *)400000,
> + },
> {}
> };
>
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3 1/2] mfd: intel_quark_i2c_gpio: Use dmi_system_id table for retrieving frequency
2017-05-30 8:17 ` [PATCH v3 1/2] mfd: intel_quark_i2c_gpio: Use dmi_system_id table for retrieving frequency Jan Kiszka
@ 2017-05-30 10:13 ` Lee Jones
0 siblings, 0 replies; 5+ messages in thread
From: Lee Jones @ 2017-05-30 10:13 UTC (permalink / raw)
To: Jan Kiszka
Cc: Linux Kernel Mailing List, Andy Shevchenko, Sascha Weisenberger
On Tue, 30 May 2017, Jan Kiszka wrote:
> Avoids reimplementation of DMI matching in intel_quark_i2c_setup.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/mfd/intel_quark_i2c_gpio.c | 33 +++++++++++++--------------------
> 1 file changed, 13 insertions(+), 20 deletions(-)
Applied, thanks.
> diff --git a/drivers/mfd/intel_quark_i2c_gpio.c b/drivers/mfd/intel_quark_i2c_gpio.c
> index 7946d6e38b87..050061320377 100644
> --- a/drivers/mfd/intel_quark_i2c_gpio.c
> +++ b/drivers/mfd/intel_quark_i2c_gpio.c
> @@ -58,19 +58,18 @@ struct intel_quark_mfd {
> struct clk_lookup *i2c_clk_lookup;
> };
>
> -struct i2c_mode_info {
> - const char *name;
> - unsigned int i2c_scl_freq;
> -};
> -
> -static const struct i2c_mode_info platform_i2c_mode_info[] = {
> +static const struct dmi_system_id dmi_platform_info[] = {
> {
> - .name = "Galileo",
> - .i2c_scl_freq = 100000,
> + .matches = {
> + DMI_EXACT_MATCH(DMI_BOARD_NAME, "Galileo"),
> + },
> + .driver_data = (void *)100000,
> },
> {
> - .name = "GalileoGen2",
> - .i2c_scl_freq = 400000,
> + .matches = {
> + DMI_EXACT_MATCH(DMI_BOARD_NAME, "GalileoGen2"),
> + },
> + .driver_data = (void *)400000,
> },
> {}
> };
> @@ -160,8 +159,7 @@ static void intel_quark_unregister_i2c_clk(struct device *dev)
>
> static int intel_quark_i2c_setup(struct pci_dev *pdev, struct mfd_cell *cell)
> {
> - const char *board_name = dmi_get_system_info(DMI_BOARD_NAME);
> - const struct i2c_mode_info *info;
> + const struct dmi_system_id *dmi_id;
> struct dw_i2c_platform_data *pdata;
> struct resource *res = (struct resource *)cell->resources;
> struct device *dev = &pdev->dev;
> @@ -181,14 +179,9 @@ static int intel_quark_i2c_setup(struct pci_dev *pdev, struct mfd_cell *cell)
> /* Normal mode by default */
> pdata->i2c_scl_freq = 100000;
>
> - if (board_name) {
> - for (info = platform_i2c_mode_info; info->name; info++) {
> - if (!strcmp(board_name, info->name)) {
> - pdata->i2c_scl_freq = info->i2c_scl_freq;
> - break;
> - }
> - }
> - }
> + 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);
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-05-30 10:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-30 8:17 [PATCH v3 0/2] mfd: intel_quark_i2c_gpio: Refactor and support for IOT2000 Jan Kiszka
2017-05-30 8:17 ` [PATCH v3 1/2] mfd: intel_quark_i2c_gpio: Use dmi_system_id table for retrieving frequency Jan Kiszka
2017-05-30 10:13 ` Lee Jones
2017-05-30 8:17 ` [PATCH v3 2/2] mfd: intel_quark_i2c_gpio: Add support for SIMATIC IOT2000 platform Jan Kiszka
2017-05-30 10:13 ` Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®