ZII RAVE platform driver
v7 cover ZII RAVE platform driver
Hi everyone,
This patch series is v7 of the driver for supervisory processor found on RAVE series of devices from ZII. Supervisory processor is a PIC microcontroller connected to various electrical subsystems on RAVE devices whose firmware implements protocol to command/qery them.
Changes since [v6]:
- Patch 2/2 has been applied by Lee so it is no longer a part of the series
- Removed all sysfs and debugfs attribute to reduce the scope of the driver propsed for inclusion. This is not a critical to have feature and can be added/discussed later.
Changes since [v5]:
- Fixed a build break, introduced by a last minute change in [v5]
- Moved majority of attributes that were exposed over sysfs to debugfs
- Document remaining sysfs attributes in Documentation/ABI/testing/sysfs-platform-rave-sp
Changes since [v4]:
- Replaced usage of DEVICE_ATTR with DEVICE_ATTR_RW
- Fixed a number of warnings produces by sparse tool
- Incorporated event more feedback from Andy Shevchenko
- Collected Reviewed-by from Andy
Changes since [v3]:
- Re-collected lost Acked-by from Rob
- Incorporated further feedback from Andy Shevchenko
- Dropped useless change (stray newline) to drivers/mfd/Makefile
Changes since [v2]:
- Fixed swapped command codes in rave_sp_common_get_boot_source() and rave_sp_common_set_boot_source() revealed by further testing of the code
- Incorporated feedback from Andy Shevchenko
Changes since [v1]:
- Updated wording in DT-bindings as per Rob's request.
- Collected Rob's Acked-by for patch 2/2
NOTE:
* The driver for "zii,rave-sp-watchdog" exists, but I haven't submitted it yet, becuase I wanted to make sure that API exposed by this MFD is acceptable and doesn't need drastic changes.
* This driver is dependent on crc_ccitt_false() introduced in 2da9378d531f8cc6670c7497f20d936b706ab80b in 'linux-next'
Feedback is greatly appreciated!
Thanks,
Andrey Smirnov
[v6] lkml.kernel.org/r/[email protected] [v5] lkml.kernel.org/r/[email protected] [v4] lkml.kernel.org/r/[email protected] [v3] lkml.kernel.org/r/[email protected] [v2] lkml.kernel.org/r/[email protected] [v1] lkml.kernel.org/r/[email protected]
Andrey Smirnov (1):
platform: Add driver for RAVE Supervisory Processor
drivers/platform/Kconfig | 2 + drivers/platform/Makefile | 1 + drivers/platform/rave/Kconfig | 26 ++ drivers/platform/rave/Makefile | 1 + drivers/platform/rave/rave-sp.c | 677 ++++++++++++++++++++++++++++++++++++++++ include/linux/rave-sp.h | 54 ++++ 6 files changed, 761 insertions(+) create mode 100644 drivers/platform/rave/Kconfig create mode 100644 drivers/platform/rave/Makefile create mode 100644 drivers/platform/rave/rave-sp.c create mode 100644 include/linux/rave-sp.h
Signature · 1 line
2.13.5
PATCH RESEND v7 1/1 platform: Add driver for RAVE Supervisory Processor
Add a driver for RAVE Supervisory Processor, an MCU implementing varoius bits of housekeeping functionality (watchdoging, backlight control, LED control, etc) on RAVE family of products by Zodiac Inflight Innovations.
This driver implementes core MFD/serdev device as well as communication subroutines necessary for commanding the device.
--- drivers/platform/Kconfig | 2 + drivers/platform/Makefile | 1 + drivers/platform/rave/Kconfig | 26 ++ drivers/platform/rave/Makefile | 1 + drivers/platform/rave/rave-sp.c | 677 ++++++++++++++++++++++++++++++++++++++++ include/linux/rave-sp.h | 54 ++++ 6 files changed, 761 insertions(+) create mode 100644 drivers/platform/rave/Kconfig create mode 100644 drivers/platform/rave/Makefile create mode 100644 drivers/platform/rave/rave-sp.c create mode 100644 include/linux/rave-sp.h
drivers/platform/Kconfig +2 -0
@@ -8,3 +8,5 @@ endif source "drivers/platform/goldfish/Kconfig" source "drivers/platform/chrome/Kconfig" + +source "drivers/platform/rave/Kconfig"
drivers/platform/Makefile +1 -0
@@ -7,3 +7,4 @@ obj-$(CONFIG_MIPS) += mips/ obj-$(CONFIG_OLPC) += olpc/ obj-$(CONFIG_GOLDFISH) += goldfish/ obj-$(CONFIG_CHROME_PLATFORMS) += chrome/ +obj-y += rave/
drivers/platform/rave/Kconfig new file +26 -0
@@ -0,0 +1,26 @@ +# +# Platform support for Zodiac RAVE hardware +# + +menuconfig RAVE_PLATFORMS + bool "Platform support for Zodiac RAVE hardware" + depends on SERIAL_DEV_BUS && SERIAL_DEV_CTRL_TTYPORT + help + Say Y here to get to see options for platform support for + various devices present in RAVE hardware. This option alone + does not add any kernel code. + + If you say N, all options in this submenu will be skipped + and disabled. + +if RAVE_PLATFORMS + +config RAVE_SP_CORE + tristate "RAVE SP MCU core driver" + select MFD_CORE + select CRC_CCITT + help + Select this to get support for the Supervisory Processor + device found on several devices in RAVE line of hardware. + +endif
drivers/platform/rave/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_RAVE_SP_CORE) += rave-sp.o
drivers/platform/rave/rave-sp.c new file +677 -0
677 lines not on this page · raw message
include/linux/rave-sp.h new file +54 -0
54 lines not on this page · raw message
Signature · 1 line
2.13.5
Re: [RESEND PATCH v7 1/1] platform: Add driver for RAVE Supervisory Processor
Quoted 7 lines · Andrey Smirnov
Add a driver for RAVE Supervisory Processor, an MCU implementing varoius bits of housekeeping functionality (watchdoging, backlight control, LED control, etc) on RAVE family of products by Zodiac Inflight Innovations.
This driver implementes core MFD/serdev device as well as communication subroutines necessary for commanding the device.
I only skimmed this, but have a few of comments below.
Quoted 10 lines
Cc Lucas Stach <[email protected]>Cc Nikita Yushchenko <[email protected]>Cc Lee Jones <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc Pavel Machek <[email protected]>Tested-by Chris Healy <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>Signed-off-by Andrey Smirnov <[email protected]>
Quoted 6 lines
--- drivers/platform/Kconfig | 2 + drivers/platform/Makefile | 1 + drivers/platform/rave/Kconfig | 26 ++ drivers/platform/rave/Makefile | 1 + drivers/platform/rave/rave-sp.c | 677 ++++++++++++++++++++++++++++++++++++++++
First of all, why do these live in drivers/platform and why don't use the mfd subsystem to implement this driver (instead of rolling your own mfd-implementation)?
Quoted 32 lines
include/linux/rave-sp.h | 54 ++++ 6 files changed, 761 insertions(+) create mode 100644 drivers/platform/rave/Kconfig create mode 100644 drivers/platform/rave/Makefile create mode 100644 drivers/platform/rave/rave-sp.c create mode 100644 include/linux/rave-sp.hdrivers/platform/Kconfig +2
-0@@ -8,3 +8,5 @@ endif source "drivers/platform/goldfish/Kconfig" source "drivers/platform/chrome/Kconfig" + +source "drivers/platform/rave/Kconfig"drivers/platform/Makefile +1
-0@@ -7,3 +7,4 @@ obj-$(CONFIG_MIPS) += mips/ obj-$(CONFIG_OLPC) += olpc/ obj-$(CONFIG_GOLDFISH) += goldfish/ obj-$(CONFIG_CHROME_PLATFORMS) += chrome/ +obj-y += rave/drivers/platform/rave/Kconfig new file +0
-0
drivers/platform/rave/Kconfig line 7
Quoted 7 lines
drivers/platform/rave/Kconfig new file +7
-0@@ -0,0 +1,26 @@ +# +# Platform support for Zodiac RAVE hardware +# + +menuconfig RAVE_PLATFORMS + bool "Platform support for Zodiac RAVE hardware" + depends on SERIAL_DEV_BUS && SERIAL_DEV_CTRL_TTYPORT
You don't strictly depend on SERIAL_DEV_CTRL_TTYPORT even if I understand why you added it (that controller will default to Y when serdev is enabled soon).
Also this is not the entry that depends on serdev, RAVE_SP_CORE is the driver that depends on it.
I think this one can just be removed, and like for normal mfd drivers, have the "child drivers" depend on the mfd driver (e.g. RAVE_SP_CORE) below.
drivers/platform/rave/Kconfig line 20
Quoted 13 lines
drivers/platform/rave/Kconfig new file +13
-0+ help + Say Y here to get to see options for platform support for + various devices present in RAVE hardware. This option alone + does not add any kernel code. + + If you say N, all options in this submenu will be skipped + and disabled. + +if RAVE_PLATFORMS + +config RAVE_SP_CORE + tristate "RAVE SP MCU core driver" + select MFD_CORE
And here you select on mfd core even though you currently don't seem to use it at all.
drivers/platform/rave/rave-sp.c
Quoted 18 lines
drivers/platform/rave/Kconfig new file +6
-0+ select CRC_CCITT + help + Select this to get support for the Supervisory Processor + device found on several devices in RAVE line of hardware. + +endifdrivers/platform/rave/Makefile new file +1
-0@@ -0,0 +1 @@ +obj-$(CONFIG_RAVE_SP_CORE) += rave-sp.odrivers/platform/rave/rave-sp.c new file +0
-0
[ ignoring the driver implementation ]
drivers/platform/rave/rave-sp.c line 608
Quoted 6 lines
drivers/platform/rave/rave-sp.c new file +6
-0+static const struct of_device_id rave_sp_dt_ids[] = { + { .compatible =COMPATIBLE_RAVE_SP_NIU , .data = &rave_sp_legacy }, + { .compatible =COMPATIBLE_RAVE_SP_MEZZ , .data = &rave_sp_legacy }, + { .compatible =COMPATIBLE_RAVE_SP_ESB , .data = &rave_sp_legacy }, + { .compatible =COMPATIBLE_RAVE_SP_RDU1 , .data = &rave_sp_rdu1 }, + { .compatible =COMPATIBLE_RAVE_SP_RDU2 , .data = &rave_sp_rdu2 },
I think you should use the compatible strings directly here rather than use these defines.
Quoted 29 lines
drivers/platform/rave/rave-sp.c new file +28
-0+ {/* sentinel */ } +}; +static int rave_sp_probe (struct serdev_device *serdev) +{ +struct device *dev = &serdev->dev; +struct rave_sp *sp; +u32 baud; +int ret; + +if (of_property_read_u32 (dev->of_node,"current-speed" , &baud)) { +dev_err (dev, +"'current-speed' is not specified in device node\n" ); +return -EINVAL ; + } + + sp =devm_kzalloc (dev,sizeof (*sp),GFP_KERNEL ); +if (!sp) +return -ENOMEM ; + + sp->serdev = serdev; +dev_set_drvdata (dev, sp); + + sp->variant =of_device_get_match_data (dev); +if (!sp->variant) +return -ENODEV ; + +mutex_init (&sp->bus_lock); +mutex_init (&sp->reply_lock);
drivers/platform/rave/rave-sp.c line 652
Quoted 10 lines
drivers/platform/rave/rave-sp.c new file +10
-0+BLOCKING_INIT_NOTIFIER_HEAD (&sp->event_notifier_list); + +serdev_device_set_client_ops (serdev, &rave_sp_serdev_device_ops); + ret =serdev_device_open (serdev); +if (ret) +return ret; + +serdev_device_set_baudrate (serdev, baud); + +return of_platform_default_populate (dev->of_node,NULL , dev);
You must close the serdev before returning on errors.
Quoted 7 lines
drivers/platform/rave/rave-sp.c new file +7
-0+} + +static void rave_sp_remove (struct serdev_device *serdev) +{ +of_platform_depopulate (&serdev->dev); +serdev_device_close (serdev); +}
drivers/platform/rave/rave-sp.c
Quoted 10 lines
drivers/platform/rave/rave-sp.c new file +9
-0+ +MODULE_DEVICE_TABLE (of, rave_sp_dt_ids); +#define COMPATIBLE_RAVE_SP_NIU "zii,rave-sp-niu" +#define COMPATIBLE_RAVE_SP_MEZZ "zii,rave-sp-mezz" +#define COMPATIBLE_RAVE_SP_ESB "zii,rave-sp-esb" +#define COMPATIBLE_RAVE_SP_RDU1 "zii,rave-sp-rdu1" +#define COMPATIBLE_RAVE_SP_RDU2 "zii,rave-sp-rdu2" + +#endif /* _LINUX_RAVE_SP_H_ */
Johan
Re: [RESEND PATCH v7 1/1] platform: Add driver for RAVE Supervisory Processor
Quoted 28 lines · Johan Hovold
Quoted 7 lines · Andrey Smirnov
Add a driver for RAVE Supervisory Processor, an MCU implementing varoius bits of housekeeping functionality (watchdoging, backlight control, LED control, etc) on RAVE family of products by Zodiac Inflight Innovations.
This driver implementes core MFD/serdev device as well as communication subroutines necessary for commanding the device.
I only skimmed this, but have a few of comments below.
Quoted 10 lines
Cc Lucas Stach <[email protected]>Cc Nikita Yushchenko <[email protected]>Cc Lee Jones <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc Pavel Machek <[email protected]>Tested-by Chris Healy <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>Signed-off-by Andrey Smirnov <[email protected]>Quoted 6 lines
--- drivers/platform/Kconfig | 2 + drivers/platform/Makefile | 1 + drivers/platform/rave/Kconfig | 26 ++ drivers/platform/rave/Makefile | 1 + drivers/platform/rave/rave-sp.c | 677 ++++++++++++++++++++++++++++++++++++++++
Quoted 4 lines
First of all, why do these live in
drivers/platformand why don't use the mfd subsystem to implement this driver (instead of rolling your own mfd-implementation)?
Because when I submitted this driver to MFD Lee Jones told me that it didn't belong to that subsystem and should be added to the kernel in "drivers/platform".
Could you elaborate more on "instead of rolling your own mfd-implementation"? It was my understanding that using "simple-mfd" binding and of_platform_default_populate() was the simplest way to create a DT-only MFD and that's how the driver was implemented when I submitted it for inclusion to MFD as well. Am I re-inventing something and is there a simpler way?
Quoted 44 lines
Quoted 32 lines
include/linux/rave-sp.h | 54 ++++ 6 files changed, 761 insertions(+) create mode 100644 drivers/platform/rave/Kconfig create mode 100644 drivers/platform/rave/Makefile create mode 100644 drivers/platform/rave/rave-sp.c create mode 100644 include/linux/rave-sp.hdrivers/platform/Kconfig +2
-0@@ -8,3 +8,5 @@ endif source "drivers/platform/goldfish/Kconfig" source "drivers/platform/chrome/Kconfig" + +source "drivers/platform/rave/Kconfig"drivers/platform/Makefile +1
-0@@ -7,3 +7,4 @@ obj-$(CONFIG_MIPS) += mips/ obj-$(CONFIG_OLPC) += olpc/ obj-$(CONFIG_GOLDFISH) += goldfish/ obj-$(CONFIG_CHROME_PLATFORMS) += chrome/ +obj-y += rave/drivers/platform/rave/Kconfig new file +0
-0drivers/platform/rave/Kconfig line 7
Quoted 7 lines
drivers/platform/rave/Kconfig new file +7
-0@@ -0,0 +1,26 @@ +# +# Platform support for Zodiac RAVE hardware +# + +menuconfig RAVE_PLATFORMS + bool "Platform support for Zodiac RAVE hardware" + depends on SERIAL_DEV_BUS && SERIAL_DEV_CTRL_TTYPORTYou don't strictly depend on
SERIAL_DEV_CTRL_TTYPORTeven if I understand why you added it (that controller will default to Y when serdev is enabled soon).
Quoted 7 lines
Also this is not the entry that depends on serdev,
RAVE_SP_COREis the driver that depends on it.I think this one can just be removed, and like for normal mfd drivers, have the "child drivers" depend on the mfd driver (e.g.
RAVE_SP_CORE) below.
Sure, I can change that.
Quoted 8 lines
Quoted 8 lines
drivers/platform/rave/Kconfig new file +8
-0+ help + Say Y here to get to see options for platform support for + various devices present in RAVE hardware. This option alone + does not add any kernel code. + + If you say N, all options in this submenu will be skipped + and disabled. +
Quoted 9 lines
drivers/platform/rave/Kconfig line 20
Quoted 5 lines
drivers/platform/rave/Kconfig new file +5
-0+if RAVE_PLATFORMS + +config RAVE_SP_CORE + tristate "RAVE SP MCU core driver" + select MFD_COREAnd here you select on mfd core even though you currently don't seem to use it at all.
My bad, for some reason I thought I was using something from mfd-core.c, but I don't. Will remove in v8.
Quoted 28 lines
drivers/platform/rave/rave-sp.c
Quoted 18 lines
drivers/platform/rave/Kconfig new file +6
-0+ select CRC_CCITT + help + Select this to get support for the Supervisory Processor + device found on several devices in RAVE line of hardware. + +endifdrivers/platform/rave/Makefile new file +1
-0@@ -0,0 +1 @@ +obj-$(CONFIG_RAVE_SP_CORE) += rave-sp.odrivers/platform/rave/rave-sp.c new file +0
-0[ ignoring the driver implementation ]
drivers/platform/rave/rave-sp.c line 608
Quoted 6 lines
drivers/platform/rave/rave-sp.c new file +6
-0+static const struct of_device_id rave_sp_dt_ids[] = { + { .compatible =COMPATIBLE_RAVE_SP_NIU , .data = &rave_sp_legacy }, + { .compatible =COMPATIBLE_RAVE_SP_MEZZ , .data = &rave_sp_legacy }, + { .compatible =COMPATIBLE_RAVE_SP_ESB , .data = &rave_sp_legacy }, + { .compatible =COMPATIBLE_RAVE_SP_RDU1 , .data = &rave_sp_rdu1 }, + { .compatible =COMPATIBLE_RAVE_SP_RDU2 , .data = &rave_sp_rdu2 },
Quoted 3 lines
I think you should use the compatible strings directly here rather than use these defines.
Those compatible strings are also re-used by cell drivers for this device (not a part of this series) to determine which ICD is applicable, hence the defines instead of normal strings.
Quoted 33 lines
Quoted 33 lines
drivers/platform/rave/rave-sp.c new file +32
-0+ {/* sentinel */ } +}; +static int rave_sp_probe (struct serdev_device *serdev) +{ +struct device *dev = &serdev->dev; +struct rave_sp *sp; +u32 baud; +int ret; + +if (of_property_read_u32 (dev->of_node,"current-speed" , &baud)) { +dev_err (dev, +"'current-speed' is not specified in device node\n" ); +return -EINVAL ; + } + + sp =devm_kzalloc (dev,sizeof (*sp),GFP_KERNEL ); +if (!sp) +return -ENOMEM ; + + sp->serdev = serdev; +dev_set_drvdata (dev, sp); + + sp->variant =of_device_get_match_data (dev); +if (!sp->variant) +return -ENODEV ; + +mutex_init (&sp->bus_lock); +mutex_init (&sp->reply_lock); +BLOCKING_INIT_NOTIFIER_HEAD (&sp->event_notifier_list); + +serdev_device_set_client_ops (serdev, &rave_sp_serdev_device_ops); + ret =serdev_device_open (serdev);
Quoted 9 lines
drivers/platform/rave/rave-sp.c line 652
Quoted 6 lines
drivers/platform/rave/rave-sp.c new file +6
-0+if (ret) +return ret; + +serdev_device_set_baudrate (serdev, baud); + +return of_platform_default_populate (dev->of_node,NULL , dev);You must close the serdev before returning on errors.
Oops, missed this one, thanks. Will fix in v8.
Thanks,
Andrey Smirnov
Re: [RESEND PATCH v7 1/1] platform: Add driver for RAVE Supervisory Processor
Quoted 29 lines · Andrey Smirnov
Quoted 28 lines · Johan Hovold
Quoted 7 lines · Andrey Smirnov
Add a driver for RAVE Supervisory Processor, an MCU implementing varoius bits of housekeeping functionality (watchdoging, backlight control, LED control, etc) on RAVE family of products by Zodiac Inflight Innovations.
This driver implementes core MFD/serdev device as well as communication subroutines necessary for commanding the device.
I only skimmed this, but have a few of comments below.
Quoted 16 lines
Cc Lucas Stach <[email protected]>Cc Nikita Yushchenko <[email protected]>Cc Lee Jones <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc Pavel Machek <[email protected]>Tested-by Chris Healy <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>Signed-off-by Andrey Smirnov <[email protected]>--- drivers/platform/Kconfig | 2 + drivers/platform/Makefile | 1 + drivers/platform/rave/Kconfig | 26 ++ drivers/platform/rave/Makefile | 1 + drivers/platform/rave/rave-sp.c | 677 ++++++++++++++++++++++++++++++++++++++++
Quoted 8 lines
Quoted 4 lines
First of all, why do these live in
drivers/platformand why don't use the mfd subsystem to implement this driver (instead of rolling your own mfd-implementation)?Because when I submitted this driver to MFD Lee Jones told me that it didn't belong to that subsystem and should be added to the kernel in "
drivers/platform".
When I first reviewed this driver, it looked far too complex to be an MFD driver. Most of the code doesn't deal with what I'd expect to be handled in MFD. Why do you have ~600 lines of protocol handling?
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [RESEND PATCH v7 1/1] platform: Add driver for RAVE Supervisory Processor
Quoted 36 lines · Lee Jones
Quoted 34 lines · Andrey Smirnov
Quoted 32 lines · Johan Hovold
Quoted 7 lines · Andrey Smirnov
Add a driver for RAVE Supervisory Processor, an MCU implementing varoius bits of housekeeping functionality (watchdoging, backlight control, LED control, etc) on RAVE family of products by Zodiac Inflight Innovations.
This driver implementes core MFD/serdev device as well as communication subroutines necessary for commanding the device.
I only skimmed this, but have a few of comments below.
Quoted 10 lines
Cc Lucas Stach <[email protected]>Cc Nikita Yushchenko <[email protected]>Cc Lee Jones <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc Pavel Machek <[email protected]>Tested-by Chris Healy <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>Signed-off-by Andrey Smirnov <[email protected]>Quoted 6 lines
--- drivers/platform/Kconfig | 2 + drivers/platform/Makefile | 1 + drivers/platform/rave/Kconfig | 26 ++ drivers/platform/rave/Makefile | 1 + drivers/platform/rave/rave-sp.c | 677 ++++++++++++++++++++++++++++++++++++++++First of all, why do these live in
drivers/platformand why don't use the mfd subsystem to implement this driver (instead of rolling your own mfd-implementation)?
Quoted 6 lines
Quoted 3 lines
Because when I submitted this driver to MFD Lee Jones told me that it didn't belong to that subsystem and should be added to the kernel in "
drivers/platform".When I first reviewed this driver, it looked far too complex to be an MFD driver.
With exception of removed sysfs/debugfs entries (and minor code changes) the driver is still the same as when you reviewed it.
Quoted 3 lines
Most of the code doesn't deal with what I'd expect to be handled in MFD. Why do you have ~600 lines of protocol handling?
Because there are three ever-so-slightly different ICDs that the firmware of the device implements depending on the variant/generation of the overall platform it is a part of.
Thanks,
Andrey Smirnov
Re: [RESEND PATCH v7 1/1] platform: Add driver for RAVE Supervisory Processor
Quoted 47 lines · Andrey Smirnov
Quoted 36 lines · Lee Jones
Quoted 34 lines · Andrey Smirnov
Quoted 32 lines · Johan Hovold
Quoted 7 lines · Andrey Smirnov
Add a driver for RAVE Supervisory Processor, an MCU implementing varoius bits of housekeeping functionality (watchdoging, backlight control, LED control, etc) on RAVE family of products by Zodiac Inflight Innovations.
This driver implementes core MFD/serdev device as well as communication subroutines necessary for commanding the device.
I only skimmed this, but have a few of comments below.
Quoted 10 lines
Cc Lucas Stach <[email protected]>Cc Nikita Yushchenko <[email protected]>Cc Lee Jones <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc Pavel Machek <[email protected]>Tested-by Chris Healy <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>Signed-off-by Andrey Smirnov <[email protected]>Quoted 6 lines
--- drivers/platform/Kconfig | 2 + drivers/platform/Makefile | 1 + drivers/platform/rave/Kconfig | 26 ++ drivers/platform/rave/Makefile | 1 + drivers/platform/rave/rave-sp.c | 677 ++++++++++++++++++++++++++++++++++++++++First of all, why do these live in
drivers/platformand why don't use the mfd subsystem to implement this driver (instead of rolling your own mfd-implementation)?Quoted 6 lines
Quoted 3 lines
Because when I submitted this driver to MFD Lee Jones told me that it didn't belong to that subsystem and should be added to the kernel in "
drivers/platform".When I first reviewed this driver, it looked far too complex to be an MFD driver.
With exception of removed sysfs/debugfs entries (and minor code changes) the driver is still the same as when you reviewed it.
Quoted 7 lines
Quoted 3 lines
Most of the code doesn't deal with what I'd expect to be handled in MFD. Why do you have ~600 lines of protocol handling?
Because there are three ever-so-slightly different ICDs that the firmware of the device implements depending on the variant/generation of the overall platform it is a part of.
Okay, it sounds like this might fit into MFD after all.
Sorry for the fuss.
Do you want me to review the first submission, or will you submit again?
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [RESEND PATCH v7 1/1] platform: Add driver for RAVE Supervisory Processor
Quoted 57 lines · Lee Jones
Quoted 47 lines · Andrey Smirnov
Quoted 36 lines · Lee Jones
Quoted 34 lines · Andrey Smirnov
Quoted 32 lines · Johan Hovold
Quoted 7 lines · Andrey Smirnov
Add a driver for RAVE Supervisory Processor, an MCU implementing varoius bits of housekeeping functionality (watchdoging, backlight control, LED control, etc) on RAVE family of products by Zodiac Inflight Innovations.
This driver implementes core MFD/serdev device as well as communication subroutines necessary for commanding the device.
I only skimmed this, but have a few of comments below.
Quoted 10 lines
Cc Lucas Stach <[email protected]>Cc Nikita Yushchenko <[email protected]>Cc Lee Jones <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc Pavel Machek <[email protected]>Tested-by Chris Healy <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>Signed-off-by Andrey Smirnov <[email protected]>Quoted 6 lines
--- drivers/platform/Kconfig | 2 + drivers/platform/Makefile | 1 + drivers/platform/rave/Kconfig | 26 ++ drivers/platform/rave/Makefile | 1 + drivers/platform/rave/rave-sp.c | 677 ++++++++++++++++++++++++++++++++++++++++First of all, why do these live in
drivers/platformand why don't use the mfd subsystem to implement this driver (instead of rolling your own mfd-implementation)?Quoted 6 lines
Quoted 3 lines
Because when I submitted this driver to MFD Lee Jones told me that it didn't belong to that subsystem and should be added to the kernel in "
drivers/platform".When I first reviewed this driver, it looked far too complex to be an MFD driver.
With exception of removed sysfs/debugfs entries (and minor code changes) the driver is still the same as when you reviewed it.
Quoted 7 lines
Quoted 3 lines
Most of the code doesn't deal with what I'd expect to be handled in MFD. Why do you have ~600 lines of protocol handling?
Because there are three ever-so-slightly different ICDs that the firmware of the device implements depending on the variant/generation of the overall platform it is a part of.
Quoted 7 lines
Okay, it sounds like this might fit into MFD after all.
Sorry for the fuss.
Do you want me to review the first submission, or will you submit again?
No worries. I'll move the code back to "drivers/mfd" in v9 of this patchset and we can go from there.
Thanks,
Andrey Smirnov
Re: [RESEND PATCH v7 1/1] platform: Add driver for RAVE Supervisory Processor
In reply to Lee JonesHi!
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 5 lines
drivers/platform/Kconfig | 2 + drivers/platform/Makefile | 1 + drivers/platform/rave/Kconfig | 26 ++ drivers/platform/rave/Makefile | 1 + drivers/platform/rave/rave-sp.c | 677 ++++++++++++++++++++++++++++++++++++++++First of all, why do these live in
drivers/platformand why don't use the mfd subsystem to implement this driver (instead of rolling your own mfd-implementation)?
Quoted 7 lines
Quoted 3 lines
Because when I submitted this driver to MFD Lee Jones told me that it didn't belong to that subsystem and should be added to the kernel in "
drivers/platform".When I first reviewed this driver, it looked far too complex to be an MFD driver. Most of the code doesn't deal with what I'd expect to be handled in MFD. Why do you have ~600 lines of protocol handling?
Some drivers are more complex than other ones... I don't think that's unexpected.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [RESEND PATCH v7 1/1] platform: Add driver for RAVE Supervisory Processor
In reply to Andrey SmirnovQuoted 38 lines · Andrey Smirnov
Quoted 28 lines · Johan Hovold
Quoted 7 lines · Andrey Smirnov
Add a driver for RAVE Supervisory Processor, an MCU implementing varoius bits of housekeeping functionality (watchdoging, backlight control, LED control, etc) on RAVE family of products by Zodiac Inflight Innovations.
This driver implementes core MFD/serdev device as well as communication subroutines necessary for commanding the device.
I only skimmed this, but have a few of comments below.
Quoted 10 lines
Cc Lucas Stach <[email protected]>Cc Nikita Yushchenko <[email protected]>Cc Lee Jones <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc Pavel Machek <[email protected]>Tested-by Chris Healy <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>Signed-off-by Andrey Smirnov <[email protected]>Quoted 6 lines
--- drivers/platform/Kconfig | 2 + drivers/platform/Makefile | 1 + drivers/platform/rave/Kconfig | 26 ++ drivers/platform/rave/Makefile | 1 + drivers/platform/rave/rave-sp.c | 677 ++++++++++++++++++++++++++++++++++++++++Quoted 4 lines
First of all, why do these live in
drivers/platformand why don't use the mfd subsystem to implement this driver (instead of rolling your own mfd-implementation)?Because when I submitted this driver to MFD Lee Jones told me that it didn't belong to that subsystem and should be added to the kernel in "
drivers/platform".
Quoted 6 lines
Could you elaborate more on "instead of rolling your own mfd-implementation"? It was my understanding that using "simple-mfd" binding and
of_platform_default_populate()was the simplest way to create a DT-only MFD and that's how the driver was implemented when I submitted it for inclusion to MFD as well. Am I re-inventing something and is there a simpler way?
AFAICS you're not using "simple-mfd" here. You're implementing an MFD driver and the corresponding compatible strings were listed in the binding docs (e.g. "zii,rave-sp-rdu1").
Also note that no drivers under drivers/platforms does anything like this.
Quoted 18 lines
Quoted 7 lines
drivers/platform/rave/Kconfig line 20
Quoted 3 lines
drivers/platform/rave/Kconfig new file +3
-0+config RAVE_SP_CORE + tristate "RAVE SP MCU core driver" + select MFD_COREAnd here you select on mfd core even though you currently don't seem to use it at all.
My bad, for some reason I thought I was using something from
mfd-core.c, but I don't. Will remove in v8.Quoted 7 lines
Quoted 6 lines
drivers/platform/rave/rave-sp.c new file +6
-0+static const struct of_device_id rave_sp_dt_ids[] = { + { .compatible =COMPATIBLE_RAVE_SP_NIU , .data = &rave_sp_legacy }, + { .compatible =COMPATIBLE_RAVE_SP_MEZZ , .data = &rave_sp_legacy }, + { .compatible =COMPATIBLE_RAVE_SP_ESB , .data = &rave_sp_legacy }, + { .compatible =COMPATIBLE_RAVE_SP_RDU1 , .data = &rave_sp_rdu1 }, + { .compatible =COMPATIBLE_RAVE_SP_RDU2 , .data = &rave_sp_rdu2 },
Quoted 6 lines
Quoted 2 lines
I think you should use the compatible strings directly here rather than use these defines.
Those compatible strings are also re-used by cell drivers for this device (not a part of this series) to determine which ICD is applicable, hence the defines instead of normal strings.
I'd say that is indicative that you're doing something wrong here. You've already matched your MFD and therefore have all the information you need. You can pass that data to the child drivers through mfd-cells.
You should submit at least one of your subdrivers along with the core MFD driver before we merge anything so we can see how things will end up getting used.
Johan
Re: [RESEND PATCH v7 1/1] platform: Add driver for RAVE Supervisory Processor
Quoted 46 lines · Johan Hovold
Quoted 38 lines · Andrey Smirnov
Quoted 28 lines · Johan Hovold
Quoted 7 lines · Andrey Smirnov
Add a driver for RAVE Supervisory Processor, an MCU implementing varoius bits of housekeeping functionality (watchdoging, backlight control, LED control, etc) on RAVE family of products by Zodiac Inflight Innovations.
This driver implementes core MFD/serdev device as well as communication subroutines necessary for commanding the device.
I only skimmed this, but have a few of comments below.
Quoted 10 lines
Cc Lucas Stach <[email protected]>Cc Nikita Yushchenko <[email protected]>Cc Lee Jones <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc Pavel Machek <[email protected]>Tested-by Chris Healy <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>Signed-off-by Andrey Smirnov <[email protected]>Quoted 6 lines
--- drivers/platform/Kconfig | 2 + drivers/platform/Makefile | 1 + drivers/platform/rave/Kconfig | 26 ++ drivers/platform/rave/Makefile | 1 + drivers/platform/rave/rave-sp.c | 677 ++++++++++++++++++++++++++++++++++++++++Quoted 4 lines
First of all, why do these live in
drivers/platformand why don't use the mfd subsystem to implement this driver (instead of rolling your own mfd-implementation)?Because when I submitted this driver to MFD Lee Jones told me that it didn't belong to that subsystem and should be added to the kernel in "
drivers/platform".Quoted 6 lines
Could you elaborate more on "instead of rolling your own mfd-implementation"? It was my understanding that using "simple-mfd" binding and
of_platform_default_populate()was the simplest way to create a DT-only MFD and that's how the driver was implemented when I submitted it for inclusion to MFD as well. Am I re-inventing something and is there a simpler way?
Quoted 4 lines
AFAICS you're not using "simple-mfd" here. You're implementing an MFD driver and the corresponding compatible strings were listed in the binding docs (e.g. "zii,rave-sp-rdu1").
The reason I mentioned "simple-mfd" was because I assumed it was necessary to use of_platform_default_populate(), which, re-reading the corresponding code, seems to have been a mistake on my part. However, now I am not sure I understand the point you are/were trying to make. The way I understand "instead of rolling your own mfd-implementation" is "You ignored/missed the precedent and didn't use agreed-upon way of creating an MFD from DT and re-invented the code to do so", in which case I'd like to know the canonical way I missed.
Form you response, however, I get a feeling that you are trying to convince me that the driver I submitted is an MFD driver. If so, then there's no need, we are in agreement here.
Quoted 3 lines
Also note that no drivers under
drivers/platformsdoes anything like this.
I am aware of that. As I as I mentioned before, the decision to place this code into "drivers/platforms" was not mine.
Quoted 21 lines
Quoted 21 lines
Quoted 7 lines
drivers/platform/rave/Kconfig line 20
Quoted 3 lines
drivers/platform/rave/Kconfig new file +3
-0+config RAVE_SP_CORE + tristate "RAVE SP MCU core driver" + select MFD_COREAnd here you select on mfd core even though you currently don't seem to use it at all.
My bad, for some reason I thought I was using something from
mfd-core.c, but I don't. Will remove in v8.Quoted 9 lines
drivers/platform/rave/rave-sp.c line 608
Quoted 6 lines
drivers/platform/rave/rave-sp.c new file +6
-0+static const struct of_device_id rave_sp_dt_ids[] = { + { .compatible =COMPATIBLE_RAVE_SP_NIU , .data = &rave_sp_legacy }, + { .compatible =COMPATIBLE_RAVE_SP_MEZZ , .data = &rave_sp_legacy }, + { .compatible =COMPATIBLE_RAVE_SP_ESB , .data = &rave_sp_legacy }, + { .compatible =COMPATIBLE_RAVE_SP_RDU1 , .data = &rave_sp_rdu1 }, + { .compatible =COMPATIBLE_RAVE_SP_RDU2 , .data = &rave_sp_rdu2 },I think you should use the compatible strings directly here rather than use these defines.
Quoted 7 lines
Quoted 3 lines
Those compatible strings are also re-used by cell drivers for this device (not a part of this series) to determine which ICD is applicable, hence the defines instead of normal strings.
I'd say that is indicative that you're doing something wrong here. You've already matched your MFD and therefore have all the information you need.
I have all the information I need at this layer, however there are ICD differences that are local to functionality covered by individual cell which I wanted to keep local to the corresponding drivers.
Quoted 2 lines
You can pass that data to the child drivers through mfd-cells.
I don't need "that" data for individual cell drivers, they have their own local data sets form which to chose based on the "flavor" of the parent device. Obviously that "flavor" can be passed as custom data to child drivers as well, but I don't think that could be done with less code than just using of_match_device(variants_table, dev->parent) which is why I chose that route.
As you suggested, I'll add a cell driver to v8 and, hopefully, it'll make it more clear as to why I have those defines.
Thanks,
Andrey Smirnov
Re: [RESEND PATCH v7 1/1] platform: Add driver for RAVE Supervisory Processor
Quoted 21 lines · Andrey Smirnov
Quoted 10 lines · Johan Hovold
Quoted 9 lines · Andrey Smirnov
Quoted 8 lines · Johan Hovold
Quoted 7 lines · Andrey Smirnov
Add a driver for RAVE Supervisory Processor, an MCU implementing varoius bits of housekeeping functionality (watchdoging, backlight control, LED control, etc) on RAVE family of products by Zodiac Inflight Innovations.
This driver implementes core MFD/serdev device as well as communication subroutines necessary for commanding the device.
The reason I mentioned "simple-mfd" was because I assumed it was necessary to use
of_platform_default_populate(), which, re-reading the corresponding code, seems to have been a mistake on my part. However, now I am not sure I understand the point you are/were trying to make. The way I understand "instead of rolling your own mfd-implementation" is "You ignored/missed the precedent and didn't use agreed-upon way of creating an MFD from DT and re-invented the code to do so", in which case I'd like to know the canonical way I missed.
Quoted 3 lines
Form you response, however, I get a feeling that you are trying to convince me that the driver I submitted is an MFD driver. If so, then there's no need, we are in agreement here.
Good, then we just need to convince Lee. ;)
I was merely pointing out that, yes, you are implementing an MFD driver, but you placed it in drivers/platform and did not not use any facilities provided by the MFD subsystem (hence, the "rolling your own").
Take a look at the dln2 mfd driver which I believe implement something similar albeit using USB as a transport (and therefore does not use DT to instantiates the children). One point being that not all mfd drivers use i2c/spi and regmap.
Quoted 6 lines
Quoted 3 lines
Also note that no drivers under
drivers/platformsdoes anything like this.I am aware of that. As I as I mentioned before, the decision to place this code into "
drivers/platforms" was not mine.
You should have put this in the changelog and commit message since its far from obvious what happened here.
Johan
Re: [RESEND PATCH v7 1/1] platform: Add driver for RAVE Supervisory Processor
In reply to Johan HovoldHi!
Quoted 9 lines
Quoted 5 lines
drivers/platform/Kconfig | 2 + drivers/platform/Makefile | 1 + drivers/platform/rave/Kconfig | 26 ++ drivers/platform/rave/Makefile | 1 + drivers/platform/rave/rave-sp.c | 677 ++++++++++++++++++++++++++++++++++++++++First of all, why do these live in
drivers/platformand why don't use the mfd subsystem to implement this driver (instead of rolling your own mfd-implementation)?
Sending contributors around like this is quite uncool.
1st, it should not matter much in which directory the driver lives.
2nd, there's no reasonable way for contributor to proceed if he gets "stuck" between two maintainers.
Can you discuss with MFD maintainers, and provide clear guidance?
Thanks,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [RESEND PATCH v7 1/1] platform: Add driver for RAVE Supervisory Processor
Quoted 8 lines · Pavel Machek
Hi!
Quoted 6 lines
Quoted 5 lines
drivers/platform/Kconfig | 2 + drivers/platform/Makefile | 1 + drivers/platform/rave/Kconfig | 26 ++ drivers/platform/rave/Makefile | 1 + drivers/platform/rave/rave-sp.c | 677 ++++++++++++++++++++++++++++++++++++++++
Quoted 5 lines
Quoted 3 lines
First of all, why do these live in
drivers/platformand why don't use the mfd subsystem to implement this driver (instead of rolling your own mfd-implementation)?Sending contributors around like this is quite uncool.
Asking questions when things are done in unexpected ways is part of the review process, and the backstory here wasn't documented in the patch or cover letter.
Quoted 6 lines
1st, it should not matter much in which directory the driver lives.
2nd, there's no reasonable way for contributor to proceed if he gets "stuck" between two maintainers.
Can you discuss with MFD maintainers, and provide clear guidance?
Seems we all agree this driver belongs in mfd now.
Johan
Re: [RESEND PATCH v7 1/1] platform: Add driver for RAVE Supervisory Processor
Quoted 13 lines · Johan Hovold
Quoted 12 lines · Pavel Machek
Hi!
Quoted 9 lines
Quoted 5 lines
drivers/platform/Kconfig | 2 + drivers/platform/Makefile | 1 + drivers/platform/rave/Kconfig | 26 ++ drivers/platform/rave/Makefile | 1 + drivers/platform/rave/rave-sp.c | 677 ++++++++++++++++++++++++++++++++++++++++First of all, why do these live in
drivers/platformand why don't use the mfd subsystem to implement this driver (instead of rolling your own mfd-implementation)?
Quoted 5 lines
Quoted 1 line
Sending contributors around like this is quite uncool.
Asking questions when things are done in unexpected ways is part of the review process, and the backstory here wasn't documented in the patch or cover letter.
Cover letter for this submission contains the link to v1 of the patchset (marked as "[v1]"):
https://marc.info/?l=linux-kernel&m=149970632624803&w=2
whose cover letter captures why the driver was added to "drivers/platform" to a degree and contains a link to original submission:
https://marc.info/?l=linux-kernel&m=149677241805627&w=2
Granted it is not completely effortless to get to all of that, but I don't think it is fair to say that all of that was not documented.
Andrey Smirnov
Re: [RESEND PATCH v7 1/1] platform: Add driver for RAVE Supervisory Processor
Quoted 20 lines · Andrey Smirnov
Quoted 13 lines · Johan Hovold
Quoted 12 lines · Pavel Machek
Hi!
Quoted 9 lines
Quoted 5 lines
drivers/platform/Kconfig | 2 + drivers/platform/Makefile | 1 + drivers/platform/rave/Kconfig | 26 ++ drivers/platform/rave/Makefile | 1 + drivers/platform/rave/rave-sp.c | 677 ++++++++++++++++++++++++++++++++++++++++First of all, why do these live in
drivers/platformand why don't use the mfd subsystem to implement this driver (instead of rolling your own mfd-implementation)?Quoted 5 lines
Quoted 1 line
Sending contributors around like this is quite uncool.
Asking questions when things are done in unexpected ways is part of the review process, and the backstory here wasn't documented in the patch or cover letter.
Quoted 8 lines
Cover letter for this submission contains the link to v1 of the patchset (marked as "[v1]"):
https://marc.info/?l=linux-kernel&m=149970632624803&w=2
whose cover letter captures why the driver was added to "
drivers/platform" to a degree and contains a link to original submission:
You cannot expect a reviewer to go through seven revisions of a patch series to find this information.
Quoted 2 lines
Granted it is not completely effortless to get to all of that, but I don't think it is fair to say that all of that was not documented.
I said it "wasn't documented in the patch or cover letter", which I still claim to be an accurate description.
You did something odd, I called it out, and now the issue is resolved. Let's move on.
Johan