ZII RAVE platform driver
Subsystems (6)
v9 cover ZII RAVE platform driver
Hi everyone,
This patch series is v9 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.
NOTE:
* This driver dependends on crc_ccitt_false(), added by 2da9378d531f8cc6670c7497f20d936b706ab80b in 'linux-next', the patch was pulled in by Andrew Morton and is currently avaiting users, so this series might have to go in through Andrew's tree
Changes since [v8]:
- Driver moved from drivers/platform to drivers/mfd
- Collected Reviewed-by from Guenter (for patches 1, 2 and 3)
- Incorporated feedback from Guenter into watchdog driver
- Incorporated feedback from Rob into watchdog DT bindings
- Removed struct rave_sp_rsp_status, which was a leftover from v5 -> v6 code removal.
- Fixed minor problems reported by checkpatch
Changes since [v7]:
- Added watchdog driver to the patchset, so it would be easier to understand how parent/children drivers are tied together
- Added serdev patches to implement devm_serdev_device_open() and make .remove optional
- "Added" missing serdev_device_close() by converting the driver to use devm_serdev_device_open()
- Converted the driver to use devm_of_platform_populate()
- Removed needless dependency on MFD_CORE
- Removed dependency on SERIAL_DEV_CTRL_TTYPORT
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
Feedback is greatly appreciated!
Thanks,
Andrey Smirnov
[v8] lkml.kernel.org/r/20171018170136.12347-1-andrew.smirnov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org [v7] lkml.kernel.org/r/20171013061321.31252-2-andrew.smirnov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org [v6] lkml.kernel.org/r/20170828163131.24815-2-andrew.smirnov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org [v5] lkml.kernel.org/r/20170728142704.11156-1-andrew.smirnov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org [v4] lkml.kernel.org/r/20170725184450.13171-1-andrew.smirnov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org [v3] lkml.kernel.org/r/20170724150915.4824-1-andrew.smirnov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org [v2] lkml.kernel.org/r/20170718175604.11735-1-andrew.smirnov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org [v1] lkml.kernel.org/r/20170710170449.4544-1-andrew.smirnov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Andrey Smirnov (5):
serdev: Make .remove in struct serdev_device_driver optional
serdev: Introduce devm_serdev_device_open()
mfd: Add driver for RAVE Supervisory Processor
watchdog: Add RAVE SP watchdog driver
dt-bindings: watchdog: Add bindings for RAVE SP watchdog driver
.../bindings/watchdog/zii,rave-sp-wdt.txt | 39 ++ Documentation/driver-model/devres.txt | 3 + drivers/mfd/Kconfig | 9 + drivers/mfd/Makefile | 2 + drivers/mfd/rave-sp.c | 659 +++++++++++++++++++++ drivers/platform/Kconfig | 1 + drivers/tty/serdev/core.c | 31 +- drivers/watchdog/Kconfig | 7 + drivers/watchdog/Makefile | 1 + drivers/watchdog/rave-sp-wdt.c | 343 +++++++++++ include/linux/rave-sp.h | 54 ++ include/linux/serdev.h | 1 + 12 files changed, 1148 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/watchdog/zii,rave-sp-wdt.txt create mode 100644 drivers/mfd/rave-sp.c create mode 100644 drivers/watchdog/rave-sp-wdt.c create mode 100644 include/linux/rave-sp.h
Signature · 6 lines
2.13.5 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v9 1/5 serdev: Make .remove in struct serdev_device_driver optional
Using devres infrastructure it is possible to write a serdev driver that doesn't have any code that needs to be called as a part of .remove. Add code to make .remove optional.
--- drivers/tty/serdev/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serdev/core.c +2 -2
@@ -252,8 +252,8 @@ static int serdev_drv_probe(struct device *dev)static int serdev_drv_remove (struct device *dev) {const struct serdev_device_driver *sdrv =to_serdev_device_driver (dev->driver); - - sdrv->remove (to_serdev_device (dev)); +if (sdrv->remove) + sdrv->remove (to_serdev_device (dev));return 0 ; }
Signature · 1 line
2.13.5
PATCH v9 2/5 serdev: Introduce devm_serdev_device_open()
In reply to Andrey SmirnovAdd code implementing managed version of serdev_device_open() for serdev device drivers that "open" the device during driver's lifecycle only once (e.g. opened in .probe() and closed in .remove()).
--- Documentation/driver-model/devres.txt | 3 +++ drivers/tty/serdev/core.c | 27 +++++++++++++++++++++++++++ include/linux/serdev.h | 1 + 3 files changed, 31 insertions(+)
Documentation/driver-model/devres.txt +3 -0
@@ -383,6 +383,9 @@ RESET devm_reset_control_get() devm_reset_controller_register() +SERDEV + devm_serdev_device_open() + SLAVE DMA ENGINE devm_acpi_dma_controller_register()
drivers/tty/serdev/core.c +27 -0
@@ -116,6 +116,33 @@ void serdev_device_close(struct serdev_device *serdev) }EXPORT_SYMBOL_GPL (serdev_device_close); +static void devm_serdev_device_release (struct device *dev,void *dr) +{ +serdev_device_close (*(struct serdev_device **)dr); +} + +int devm_serdev_device_open (struct device *dev,struct serdev_device *serdev) +{ +struct serdev_device **dr; +int ret; + + dr =devres_alloc (devm_serdev_device_release,sizeof (*dr),GFP_KERNEL ); +if (!dr) +return -ENOMEM ; + + ret =serdev_device_open (serdev); +if (ret) { +devres_free (dr); +return ret; + } + + *dr = serdev; +devres_add (dev, dr); + +return ret; +} +EXPORT_SYMBOL_GPL (devm_serdev_device_open); +void serdev_device_write_wakeup (struct serdev_device *serdev) {complete (&serdev->write_comp);
include/linux/serdev.h +1 -0
@@ -193,6 +193,7 @@ static inline int serdev_controller_receive_buf(struct serdev_controller *ctrl,int serdev_device_open (struct serdev_device *);void serdev_device_close (struct serdev_device *); +int devm_serdev_device_open (struct device *,struct serdev_device *);unsigned int serdev_device_set_baudrate (struct serdev_device *,unsigned int );void serdev_device_set_flow_control (struct serdev_device *,bool );int serdev_device_write_buf (struct serdev_device *,const unsigned char *,size_t );
Signature · 1 line
2.13.5
PATCH v9 3/5 mfd: Add driver for RAVE Supervisory Processor
In reply to Andrey SmirnovAdd a driver for RAVE Supervisory Processor, an MCU implementing various 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/mfd/Kconfig | 9 + drivers/mfd/Makefile | 2 + drivers/mfd/rave-sp.c | 659 +++++++++++++++++++++++++++++++++++++++++++++++ drivers/platform/Kconfig | 1 + include/linux/rave-sp.h | 54 ++++ 5 files changed, 725 insertions(+) create mode 100644 drivers/mfd/rave-sp.c create mode 100644 include/linux/rave-sp.h
drivers/mfd/Kconfig +9 -0
@@ -1818,4 +1818,13 @@ config MFD_VEXPRESS_SYSREG on the ARM Ltd. Versatile Express board. endmenu + +config RAVE_SP_CORE + tristate "RAVE SP MCU core driver" + depends on SERIAL_DEV_BUS + 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/mfd/Makefile +2 -0
@@ -226,3 +226,5 @@ obj-$(CONFIG_MFD_SUN4I_GPADC) += sun4i-gpadc.o obj-$(CONFIG_MFD_STM32_LPTIMER) += stm32-lptimer.o obj-$(CONFIG_MFD_STM32_TIMERS) += stm32-timers.o obj-$(CONFIG_MFD_MXS_LRADC) += mxs-lradc.o + +obj-$(CONFIG_RAVE_SP_CORE) += rave-sp.o
drivers/mfd/rave-sp.c new file +659 -0
659 lines not on this page · raw message
drivers/platform/Kconfig +1 -0
@@ -8,3 +8,4 @@ endif source "drivers/platform/goldfish/Kconfig" source "drivers/platform/chrome/Kconfig" +
include/linux/rave-sp.h new file +54 -0
54 lines not on this page · raw message
Signature · 1 line
2.13.5
PATCH v9 4/5 watchdog: Add RAVE SP watchdog driver
In reply to Andrey SmirnovThis driver provides access to RAVE SP watchdog functionality.
---
Guenter:
In our previous discussion you noted that relying on the state of WDOG_HW_RUNNING was not correct (that should be fixed now), please let me know if using watchdog_hw_running() the way I do in rave_sp_wdt_set_timeout() is incorrect as well.
Thanks,
Andrey Smirnov
drivers/watchdog/Kconfig | 7 + drivers/watchdog/Makefile | 1 + drivers/watchdog/rave-sp-wdt.c | 343 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 351 insertions(+) create mode 100644 drivers/watchdog/rave-sp-wdt.c
drivers/watchdog/Kconfig +7 -0
@@ -223,6 +223,13 @@ config ZIIRAVE_WATCHDOG To compile this driver as a module, choose M here: the module will be called ziirave_wdt. +config RAVE_SP_WATCHDOG + tristate "RAVE SP Watchdog timer" + depends on RAVE_SP_CORE + select WATCHDOG_CORE + help + Support for the watchdog on RAVE SP device. + # ALPHA Architecture # ARM Architecture
drivers/watchdog/Makefile +1 -0
@@ -223,3 +223,4 @@ obj-$(CONFIG_MAX77620_WATCHDOG) += max77620_wdt.o obj-$(CONFIG_ZIIRAVE_WATCHDOG) += ziirave_wdt.o obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o obj-$(CONFIG_MENF21BMC_WATCHDOG) += menf21bmc_wdt.o +obj-$(CONFIG_RAVE_SP_WATCHDOG) += rave-sp-wdt.o
drivers/watchdog/rave-sp-wdt.c new file +343 -0
343 lines not on this page · raw message
Signature · 1 line
2.13.5
Guenter Roeck
maintainerRe: [v9,4/5] watchdog: Add RAVE SP watchdog driver
Quoted 16 lines · Andrey Smirnov
This driver provides access to RAVE SP watchdog functionality.
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]>Cc Andy Shevchenko <[email protected]>Cc Guenter Roeck <[email protected]>Cc Rob Herring <[email protected]>Cc Johan Hovold <[email protected]>Signed-off-by Nikita Yushchenko <[email protected]>Signed-off-by Andrey Smirnov <[email protected]>
Quoted 9 lines
---
Guenter:
In our previous discussion you noted that relying on the state of
WDOG_HW_RUNNINGwas not correct (that should be fixed now), please let me know if usingwatchdog_hw_running()the way I do inrave_sp_wdt_set_timeout()is incorrect as well.
You could as well have used watchdog_active(), but it is ok.
Quoted 9 lines
Thanks,
Andrey Smirnovdrivers/watchdog/Kconfig | 7 + drivers/watchdog/Makefile | 1 + drivers/watchdog/rave-sp-wdt.c | 343 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 351 insertions(+) create mode 100644 drivers/watchdog/rave-sp-wdt.c
[ ... ]
Quoted 5 lines
drivers/watchdog/rave-sp-wdt.c new file +5
-0+ +static int rave_sp_wdt_probe (struct platform_device *pdev) +{ +struct device *dev = &pdev->dev; +const struct of_device_id *id;
drivers/watchdog/rave-sp-wdt.c line 275
Quoted 10 lines
drivers/watchdog/rave-sp-wdt.c new file +10
-0+struct watchdog_device *wdd; +struct rave_sp_wdt *sp_wd; +struct nvmem_cell *cell; +__le16 timeout =0 ; +int ret; + + id =of_match_device (rave_sp_wdt_variants, dev->parent); +if (WARN_ON (!id)) +return -ENODEV ; +
I could understand an error message here, but why a traceback ?
Guenter
Re: [v9,4/5] watchdog: Add RAVE SP watchdog driver
Quoted 21 lines · Guenter Roeck
Quoted 20 lines · Andrey Smirnov
This driver provides access to RAVE SP watchdog functionality.
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]>Cc Andy Shevchenko <[email protected]>Cc Guenter Roeck <[email protected]>Cc Rob Herring <[email protected]>Cc Johan Hovold <[email protected]>Signed-off-by Nikita Yushchenko <[email protected]>Signed-off-by Andrey Smirnov <[email protected]>---
Guenter:
Quoted 8 lines
Quoted 5 lines
In our previous discussion you noted that relying on the state of
WDOG_HW_RUNNINGwas not correct (that should be fixed now), please let me know if usingwatchdog_hw_running()the way I do inrave_sp_wdt_set_timeout()is incorrect as well.You could as well have used
watchdog_active(), but it is ok.
That's easy to change. I'll do that in v10.
Quoted 20 lines
Quoted 9 lines
Thanks,
Andrey Smirnovdrivers/watchdog/Kconfig | 7 + drivers/watchdog/Makefile | 1 + drivers/watchdog/rave-sp-wdt.c | 343 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 351 insertions(+) create mode 100644 drivers/watchdog/rave-sp-wdt.c[ ... ]
Quoted 9 lines
drivers/watchdog/rave-sp-wdt.c new file +9
-0+ +static int rave_sp_wdt_probe (struct platform_device *pdev) +{ +struct device *dev = &pdev->dev; +const struct of_device_id *id; +struct watchdog_device *wdd; +struct rave_sp_wdt *sp_wd; +struct nvmem_cell *cell; +__le16 timeout =0 ;
Quoted 9 lines
drivers/watchdog/rave-sp-wdt.c line 275
Quoted 6 lines
drivers/watchdog/rave-sp-wdt.c new file +6
-0+int ret; + + id =of_match_device (rave_sp_wdt_variants, dev->parent); +if (WARN_ON (!id)) +return -ENODEV ; +I could understand an error message here, but why a traceback ?
I can't think of a good reason for it. I'll change this to a regular error message in v10.
Thanks,
Andrey Smirnov
PATCH v9 5/5 dt-bindings: watchdog: Add bindings for RAVE SP watchdog driver
In reply to Andrey SmirnovAdd Device Tree bindings for RAVE SP watchdog drvier - an MFD cell of parent RAVE SP driver (documented in Documentation/devicetree/bindings/mfd/zii,rave-sp.txt).
--- .../bindings/watchdog/zii,rave-sp-wdt.txt | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Documentation/devicetree/bindings/watchdog/zii,rave-sp-wdt.txt
Documentation/devicetree/bindings/watchdog/zii,rave-sp-wdt.txt new file +39 -0
@@ -0,0 +1,39 @@ +Zodiac Inflight Innovations RAVE Supervisory Processor Watchdog Bindings + +RAVE SP watchdog device is a "MFD cell" device corresponding to +watchdog functionality of RAVE Supervisory Processor. It is expected +that its Device Tree node is specified as a child of the node +corresponding to the parent RAVE SP device (as documented in +Documentation/devicetree/bindings/mfd/zii,rave-sp.txt) + +Required properties: +- compatible: Should be "zii,rave-sp-watchdog" + +Optional properties: + +- wdt-timeout: Two byte nvmem cell specified as per + Documentation/devicetree/bindings/nvmem/nvmem.txt + +Example: + + rave-sp { + compatible = "zii,rave-sp-rdu1"; + current-speed = <38400>; + + eeprom { + compatible = "zii,pic-main-eeprom"; + #address-cells = <1>; + #size-cells = <1>; + + wdt_timeout: wdt-timeout@8E { + reg = <0x8E 2>; + }; + }; + + watchdog { + compatible = "zii,rave-sp-watchdog"; + nvmem-cells = <&wdt_timeout>; + nvmem-cell-names = "wdt-timeout"; + }; + } +
Signature · 6 lines
2.13.5 -- To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v9 5/5] dt-bindings: watchdog: Add bindings for RAVE SP watchdog driver
Quoted 20 lines · Andrey Smirnov
Add Device Tree bindings for RAVE SP watchdog drvier - an MFD cell of parent RAVE SP driver (documented in
Documentation/devicetree/bindings/mfd/zii,rave-sp.txt).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]>Cc Andy Shevchenko <[email protected]>Cc Guenter Roeck <[email protected]>Cc Rob Herring <[email protected]>Cc Johan Hovold <[email protected]>Cc Mark Rutland <[email protected]>Signed-off-by Nikita Yushchenko <[email protected]>Signed-off-by Andrey Smirnov <[email protected]>
Quoted 4 lines
--- .../bindings/watchdog/zii,rave-sp-wdt.txt | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Documentation/devicetree/bindings/watchdog/zii,rave-sp-wdt.txt