* [PATCH v2 0/5] Add board support for TS-4800 @ 2015-10-29 20:27 ` Damien Riegel 0 siblings, 0 replies; 52+ messages in thread From: Damien Riegel @ 2015-10-29 20:27 UTC (permalink / raw) To: linux-kernel, linux-arm-kernel, linux-watchdog Cc: shawnguo, kernel, wim, robh+dt, sameo, lee.jones, dinh.linux, linux, kernel, Damien Riegel This patch serie adds support for TS-4800 board. This board, manufactured by Technologic Systems, is based on an IMX515. The first stage bootloader, called TS-BOOTROM, enables the watchdog, so a watchdog driver is required to prevent board from rebooting. The current device tree is minimal but it allows to get a shell on the board. Changes in v2: - Added a mfd driver to handle syscon registers - The watchdog driver now uses the regmap (created by the mfd driver) to access the feed register - Remove watchdog's dependency on SOC_IMX51 Damien Riegel (5): of: add vendor prefix for Technologic Systems mfd: ts4800-syscon: add driver for TS-4800 syscon watchdog: ts4800: add driver for TS-4800 watchdog ARM: imx_v6_v7_defconfig: add TS-4800 watchdog and syscon ARM: dts: TS-4800: add basic device tree Documentation/devicetree/bindings/arm/ts.txt | 6 + .../devicetree/bindings/mfd/ts4800-syscon.txt | 20 ++ .../devicetree/bindings/vendor-prefixes.txt | 1 + .../devicetree/bindings/watchdog/ts4800-wdt.txt | 12 ++ arch/arm/boot/dts/Makefile | 3 +- arch/arm/boot/dts/imx51-ts4800.dts | 192 ++++++++++++++++++ arch/arm/configs/imx_v6_v7_defconfig | 2 + drivers/mfd/Kconfig | 8 + drivers/mfd/Makefile | 1 + drivers/mfd/ts4800-syscon.c | 95 +++++++++ drivers/watchdog/Kconfig | 10 + drivers/watchdog/Makefile | 1 + drivers/watchdog/ts4800_wdt.c | 216 +++++++++++++++++++++ include/linux/mfd/ts4800-syscon.h | 24 +++ 14 files changed, 590 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/arm/ts.txt create mode 100644 Documentation/devicetree/bindings/mfd/ts4800-syscon.txt create mode 100644 Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt create mode 100644 arch/arm/boot/dts/imx51-ts4800.dts create mode 100644 drivers/mfd/ts4800-syscon.c create mode 100644 drivers/watchdog/ts4800_wdt.c create mode 100644 include/linux/mfd/ts4800-syscon.h -- 2.5.0 ^ permalink raw reply [flat|nested] 52+ messages in thread
* [PATCH v2 0/5] Add board support for TS-4800 @ 2015-10-29 20:27 ` Damien Riegel 0 siblings, 0 replies; 52+ messages in thread From: Damien Riegel @ 2015-10-29 20:27 UTC (permalink / raw) To: linux-arm-kernel This patch serie adds support for TS-4800 board. This board, manufactured by Technologic Systems, is based on an IMX515. The first stage bootloader, called TS-BOOTROM, enables the watchdog, so a watchdog driver is required to prevent board from rebooting. The current device tree is minimal but it allows to get a shell on the board. Changes in v2: - Added a mfd driver to handle syscon registers - The watchdog driver now uses the regmap (created by the mfd driver) to access the feed register - Remove watchdog's dependency on SOC_IMX51 Damien Riegel (5): of: add vendor prefix for Technologic Systems mfd: ts4800-syscon: add driver for TS-4800 syscon watchdog: ts4800: add driver for TS-4800 watchdog ARM: imx_v6_v7_defconfig: add TS-4800 watchdog and syscon ARM: dts: TS-4800: add basic device tree Documentation/devicetree/bindings/arm/ts.txt | 6 + .../devicetree/bindings/mfd/ts4800-syscon.txt | 20 ++ .../devicetree/bindings/vendor-prefixes.txt | 1 + .../devicetree/bindings/watchdog/ts4800-wdt.txt | 12 ++ arch/arm/boot/dts/Makefile | 3 +- arch/arm/boot/dts/imx51-ts4800.dts | 192 ++++++++++++++++++ arch/arm/configs/imx_v6_v7_defconfig | 2 + drivers/mfd/Kconfig | 8 + drivers/mfd/Makefile | 1 + drivers/mfd/ts4800-syscon.c | 95 +++++++++ drivers/watchdog/Kconfig | 10 + drivers/watchdog/Makefile | 1 + drivers/watchdog/ts4800_wdt.c | 216 +++++++++++++++++++++ include/linux/mfd/ts4800-syscon.h | 24 +++ 14 files changed, 590 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/arm/ts.txt create mode 100644 Documentation/devicetree/bindings/mfd/ts4800-syscon.txt create mode 100644 Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt create mode 100644 arch/arm/boot/dts/imx51-ts4800.dts create mode 100644 drivers/mfd/ts4800-syscon.c create mode 100644 drivers/watchdog/ts4800_wdt.c create mode 100644 include/linux/mfd/ts4800-syscon.h -- 2.5.0 ^ permalink raw reply [flat|nested] 52+ messages in thread
* [PATCH v2 1/5] of: add vendor prefix for Technologic Systems 2015-10-29 20:27 ` Damien Riegel @ 2015-10-29 20:27 ` Damien Riegel -1 siblings, 0 replies; 52+ messages in thread From: Damien Riegel @ 2015-10-29 20:27 UTC (permalink / raw) To: linux-kernel, linux-arm-kernel, linux-watchdog Cc: shawnguo, kernel, wim, robh+dt, sameo, lee.jones, dinh.linux, linux, kernel, Damien Riegel Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> --- Documentation/devicetree/bindings/vendor-prefixes.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt index d444757..68aad78a 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.txt +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt @@ -211,6 +211,7 @@ toshiba Toshiba Corporation toumaz Toumaz tplink TP-LINK Technologies Co., Ltd. truly Truly Semiconductors Limited +ts Technologic Systems usi Universal Scientific Industrial Co., Ltd. v3 V3 Semiconductor variscite Variscite Ltd. -- 2.5.0 ^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v2 1/5] of: add vendor prefix for Technologic Systems @ 2015-10-29 20:27 ` Damien Riegel 0 siblings, 0 replies; 52+ messages in thread From: Damien Riegel @ 2015-10-29 20:27 UTC (permalink / raw) To: linux-arm-kernel Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> --- Documentation/devicetree/bindings/vendor-prefixes.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt index d444757..68aad78a 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.txt +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt @@ -211,6 +211,7 @@ toshiba Toshiba Corporation toumaz Toumaz tplink TP-LINK Technologies Co., Ltd. truly Truly Semiconductors Limited +ts Technologic Systems usi Universal Scientific Industrial Co., Ltd. v3 V3 Semiconductor variscite Variscite Ltd. -- 2.5.0 ^ permalink raw reply related [flat|nested] 52+ messages in thread
* Re: [PATCH v2 1/5] of: add vendor prefix for Technologic Systems 2015-10-29 20:27 ` Damien Riegel (?) @ 2015-10-30 18:04 ` Lee Jones -1 siblings, 0 replies; 52+ messages in thread From: Lee Jones @ 2015-10-30 18:04 UTC (permalink / raw) To: Damien Riegel Cc: linux-kernel, linux-arm-kernel, linux-watchdog, shawnguo, kernel, wim, robh+dt, sameo, dinh.linux, linux, kernel On Thu, 29 Oct 2015, Damien Riegel wrote: > Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> > --- > Documentation/devicetree/bindings/vendor-prefixes.txt | 1 + > 1 file changed, 1 insertion(+) Acked-by: Lee Jones <lee.jones@linaro.org> > diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt > index d444757..68aad78a 100644 > --- a/Documentation/devicetree/bindings/vendor-prefixes.txt > +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt > @@ -211,6 +211,7 @@ toshiba Toshiba Corporation > toumaz Toumaz > tplink TP-LINK Technologies Co., Ltd. > truly Truly Semiconductors Limited > +ts Technologic Systems > usi Universal Scientific Industrial Co., Ltd. > v3 V3 Semiconductor > variscite Variscite Ltd. -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog -- To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v2 1/5] of: add vendor prefix for Technologic Systems @ 2015-10-30 18:04 ` Lee Jones 0 siblings, 0 replies; 52+ messages in thread From: Lee Jones @ 2015-10-30 18:04 UTC (permalink / raw) To: Damien Riegel Cc: linux-kernel, linux-arm-kernel, linux-watchdog, shawnguo, kernel, wim, robh+dt, sameo, dinh.linux, linux, kernel On Thu, 29 Oct 2015, Damien Riegel wrote: > Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> > --- > Documentation/devicetree/bindings/vendor-prefixes.txt | 1 + > 1 file changed, 1 insertion(+) Acked-by: Lee Jones <lee.jones@linaro.org> > diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt > index d444757..68aad78a 100644 > --- a/Documentation/devicetree/bindings/vendor-prefixes.txt > +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt > @@ -211,6 +211,7 @@ toshiba Toshiba Corporation > toumaz Toumaz > tplink TP-LINK Technologies Co., Ltd. > truly Truly Semiconductors Limited > +ts Technologic Systems > usi Universal Scientific Industrial Co., Ltd. > v3 V3 Semiconductor > variscite Variscite Ltd. -- 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] 52+ messages in thread
* [PATCH v2 1/5] of: add vendor prefix for Technologic Systems @ 2015-10-30 18:04 ` Lee Jones 0 siblings, 0 replies; 52+ messages in thread From: Lee Jones @ 2015-10-30 18:04 UTC (permalink / raw) To: linux-arm-kernel On Thu, 29 Oct 2015, Damien Riegel wrote: > Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> > --- > Documentation/devicetree/bindings/vendor-prefixes.txt | 1 + > 1 file changed, 1 insertion(+) Acked-by: Lee Jones <lee.jones@linaro.org> > diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt > index d444757..68aad78a 100644 > --- a/Documentation/devicetree/bindings/vendor-prefixes.txt > +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt > @@ -211,6 +211,7 @@ toshiba Toshiba Corporation > toumaz Toumaz > tplink TP-LINK Technologies Co., Ltd. > truly Truly Semiconductors Limited > +ts Technologic Systems > usi Universal Scientific Industrial Co., Ltd. > v3 V3 Semiconductor > variscite Variscite Ltd. -- 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] 52+ messages in thread
* Re: [PATCH v2 1/5] of: add vendor prefix for Technologic Systems 2015-10-30 18:04 ` Lee Jones @ 2015-10-30 19:58 ` Damien Riegel -1 siblings, 0 replies; 52+ messages in thread From: Damien Riegel @ 2015-10-30 19:58 UTC (permalink / raw) To: Lee Jones Cc: linux-kernel, linux-arm-kernel, linux-watchdog, shawnguo, kernel, wim, robh+dt, sameo, dinh.linux, linux, kernel On Fri, Oct 30, 2015 at 06:04:00PM +0000, Lee Jones wrote: > On Thu, 29 Oct 2015, Damien Riegel wrote: > > > Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> > > --- > > Documentation/devicetree/bindings/vendor-prefixes.txt | 1 + > > 1 file changed, 1 insertion(+) > > Acked-by: Lee Jones <lee.jones@linaro.org> Arnd Bergmann suggested in the v1 thread [1] to change it to 'technologic' to avoid confusion. No problem with that ? [1] http://www.spinics.net/lists/devicetree/msg100696.html ^ permalink raw reply [flat|nested] 52+ messages in thread
* [PATCH v2 1/5] of: add vendor prefix for Technologic Systems @ 2015-10-30 19:58 ` Damien Riegel 0 siblings, 0 replies; 52+ messages in thread From: Damien Riegel @ 2015-10-30 19:58 UTC (permalink / raw) To: linux-arm-kernel On Fri, Oct 30, 2015 at 06:04:00PM +0000, Lee Jones wrote: > On Thu, 29 Oct 2015, Damien Riegel wrote: > > > Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> > > --- > > Documentation/devicetree/bindings/vendor-prefixes.txt | 1 + > > 1 file changed, 1 insertion(+) > > Acked-by: Lee Jones <lee.jones@linaro.org> Arnd Bergmann suggested in the v1 thread [1] to change it to 'technologic' to avoid confusion. No problem with that ? [1] http://www.spinics.net/lists/devicetree/msg100696.html ^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v2 1/5] of: add vendor prefix for Technologic Systems 2015-10-30 19:58 ` Damien Riegel (?) @ 2015-11-02 9:13 ` Lee Jones -1 siblings, 0 replies; 52+ messages in thread From: Lee Jones @ 2015-11-02 9:13 UTC (permalink / raw) To: Damien Riegel Cc: linux-kernel, linux-arm-kernel, linux-watchdog, shawnguo, kernel, wim, robh+dt, sameo, dinh.linux, linux, kernel On Fri, 30 Oct 2015, Damien Riegel wrote: > On Fri, Oct 30, 2015 at 06:04:00PM +0000, Lee Jones wrote: > > On Thu, 29 Oct 2015, Damien Riegel wrote: > > > > > Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> > > > --- > > > Documentation/devicetree/bindings/vendor-prefixes.txt | 1 + > > > 1 file changed, 1 insertion(+) > > > > Acked-by: Lee Jones <lee.jones@linaro.org> > > Arnd Bergmann suggested in the v1 thread [1] to change it to > 'technologic' to avoid confusion. No problem with that ? > > [1] http://www.spinics.net/lists/devicetree/msg100696.html Sounds very reasonable. For 'technologic': Acked-by: Lee Jones <lee.jones@linaro.org> -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog -- To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v2 1/5] of: add vendor prefix for Technologic Systems @ 2015-11-02 9:13 ` Lee Jones 0 siblings, 0 replies; 52+ messages in thread From: Lee Jones @ 2015-11-02 9:13 UTC (permalink / raw) To: Damien Riegel Cc: linux-kernel, linux-arm-kernel, linux-watchdog, shawnguo, kernel, wim, robh+dt, sameo, dinh.linux, linux, kernel On Fri, 30 Oct 2015, Damien Riegel wrote: > On Fri, Oct 30, 2015 at 06:04:00PM +0000, Lee Jones wrote: > > On Thu, 29 Oct 2015, Damien Riegel wrote: > > > > > Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> > > > --- > > > Documentation/devicetree/bindings/vendor-prefixes.txt | 1 + > > > 1 file changed, 1 insertion(+) > > > > Acked-by: Lee Jones <lee.jones@linaro.org> > > Arnd Bergmann suggested in the v1 thread [1] to change it to > 'technologic' to avoid confusion. No problem with that ? > > [1] http://www.spinics.net/lists/devicetree/msg100696.html Sounds very reasonable. For 'technologic': Acked-by: Lee Jones <lee.jones@linaro.org> -- 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] 52+ messages in thread
* [PATCH v2 1/5] of: add vendor prefix for Technologic Systems @ 2015-11-02 9:13 ` Lee Jones 0 siblings, 0 replies; 52+ messages in thread From: Lee Jones @ 2015-11-02 9:13 UTC (permalink / raw) To: linux-arm-kernel On Fri, 30 Oct 2015, Damien Riegel wrote: > On Fri, Oct 30, 2015 at 06:04:00PM +0000, Lee Jones wrote: > > On Thu, 29 Oct 2015, Damien Riegel wrote: > > > > > Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> > > > --- > > > Documentation/devicetree/bindings/vendor-prefixes.txt | 1 + > > > 1 file changed, 1 insertion(+) > > > > Acked-by: Lee Jones <lee.jones@linaro.org> > > Arnd Bergmann suggested in the v1 thread [1] to change it to > 'technologic' to avoid confusion. No problem with that ? > > [1] http://www.spinics.net/lists/devicetree/msg100696.html Sounds very reasonable. For 'technologic': Acked-by: Lee Jones <lee.jones@linaro.org> -- 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] 52+ messages in thread
* [PATCH v2 2/5] mfd: ts4800-syscon: add driver for TS-4800 syscon 2015-10-29 20:27 ` Damien Riegel @ 2015-10-29 20:27 ` Damien Riegel -1 siblings, 0 replies; 52+ messages in thread From: Damien Riegel @ 2015-10-29 20:27 UTC (permalink / raw) To: linux-kernel, linux-arm-kernel, linux-watchdog Cc: shawnguo, kernel, wim, robh+dt, sameo, lee.jones, dinh.linux, linux, kernel, Damien Riegel Driver for TS-4800 syscon. These registers belong to a FPGA that is memory mapped and are used for counters, enable various IPs in the FPGA, control LEDs, control IOs, etc. Currently, only the watchdog is handled. Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> --- .../devicetree/bindings/mfd/ts4800-syscon.txt | 12 ++++ drivers/mfd/Kconfig | 7 ++ drivers/mfd/Makefile | 1 + drivers/mfd/ts4800-syscon.c | 84 ++++++++++++++++++++++ include/linux/mfd/ts4800-syscon.h | 24 +++++++ 5 files changed, 128 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/ts4800-syscon.txt create mode 100644 drivers/mfd/ts4800-syscon.c create mode 100644 include/linux/mfd/ts4800-syscon.h diff --git a/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt new file mode 100644 index 0000000..8dbc12c --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt @@ -0,0 +1,12 @@ +Technologic Systems Syscon + +Required properties: +- compatible : must be "ts,ts4800-syscon" +- reg : physical base address and length of memory mapped region + +Example: + +syscon@b0010000 { + compatible = "ts,ts4800-syscon"; + reg = <0xb0010000 0x3d>; +}; diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 3f68dd2..8f03dce 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -1302,6 +1302,13 @@ config MFD_TC6393XB help Support for Toshiba Mobile IO Controller TC6393XB +config MFD_TS4800_SYSCON + tristate "TS-4800 Syscon Support" + select REGMAP + select REGMAP_MMIO + help + Support for TS-4800's FPGA Syscon registers + config MFD_VX855 tristate "VIA VX855/VX875 integrated south bridge" depends on PCI diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index ea40e07..e2c0f1b 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -181,6 +181,7 @@ obj-$(CONFIG_MFD_HI6421_PMIC) += hi6421-pmic-core.o obj-$(CONFIG_MFD_DLN2) += dln2.o obj-$(CONFIG_MFD_RT5033) += rt5033.o obj-$(CONFIG_MFD_SKY81452) += sky81452.o +obj-$(CONFIG_MFD_TS4800_SYSCON) += ts4800-syscon.o intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o diff --git a/drivers/mfd/ts4800-syscon.c b/drivers/mfd/ts4800-syscon.c new file mode 100644 index 0000000..1e42e96 --- /dev/null +++ b/drivers/mfd/ts4800-syscon.c @@ -0,0 +1,84 @@ +/* + * Device driver for TS-4800 FPGA's syscon + * + * Copyright (c) 2015 - Savoir-faire Linux + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +#include <linux/device.h> +#include <linux/err.h> +#include <linux/mfd/core.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/platform_device.h> +#include <linux/regmap.h> +#include <linux/mfd/ts4800-syscon.h> + + +static const struct regmap_config ts4800_regmap_config = { + .reg_bits = 32, + .reg_stride = 2, + .val_bits = 16, +}; + +static int ts4800_syscon_probe(struct platform_device *pdev) +{ + struct ts4800_syscon *syscon; + struct resource *res; + void __iomem *base; + + syscon = devm_kzalloc(&pdev->dev, sizeof(*syscon), GFP_KERNEL); + if (!syscon) + return -ENOMEM; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(base)) + return PTR_ERR(base); + + syscon->regmap = devm_regmap_init_mmio_clk(&pdev->dev, NULL, base, + &ts4800_regmap_config); + if (IS_ERR(syscon->regmap)) { + dev_err(&pdev->dev, + "regmap init failed: %ld\n", + PTR_ERR(syscon->regmap)); + return PTR_ERR(syscon->regmap); + } + + platform_set_drvdata(pdev, syscon); + + return 0; +} + +static int ts4800_syscon_remove(struct platform_device *pdev) +{ + return 0; +} + +static const struct of_device_id ts4800_syscon_of_match[] = { + { .compatible = "ts,ts4800-syscon", }, + { }, +}; + +static struct platform_driver ts4800_syscon_driver = { + .driver = { + .name = "ts4800_syscon", + .of_match_table = ts4800_syscon_of_match, + }, + .probe = ts4800_syscon_probe, + .remove = ts4800_syscon_remove, +}; +module_platform_driver(ts4800_syscon_driver); + +MODULE_AUTHOR("Damien Riegel <damien.riegel@savoirfairelinux.com>"); +MODULE_DESCRIPTION("TS-4800 Syscon driver"); +MODULE_LICENSE("GPL v2"); diff --git a/include/linux/mfd/ts4800-syscon.h b/include/linux/mfd/ts4800-syscon.h new file mode 100644 index 0000000..3d29184 --- /dev/null +++ b/include/linux/mfd/ts4800-syscon.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2015 - Savoir-faire Linux + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +#ifndef __LINUX_MFD_TS4800_SYSCON_H +#define __LINUX_MFD_TS4800_SYSCON_H + +#include <linux/regmap.h> + +struct ts4800_syscon { + struct regmap *regmap; +}; + +#endif /* __LINUX_MFD_TS4800_SYSCON_H */ -- 2.5.0 ^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v2 2/5] mfd: ts4800-syscon: add driver for TS-4800 syscon @ 2015-10-29 20:27 ` Damien Riegel 0 siblings, 0 replies; 52+ messages in thread From: Damien Riegel @ 2015-10-29 20:27 UTC (permalink / raw) To: linux-arm-kernel Driver for TS-4800 syscon. These registers belong to a FPGA that is memory mapped and are used for counters, enable various IPs in the FPGA, control LEDs, control IOs, etc. Currently, only the watchdog is handled. Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> --- .../devicetree/bindings/mfd/ts4800-syscon.txt | 12 ++++ drivers/mfd/Kconfig | 7 ++ drivers/mfd/Makefile | 1 + drivers/mfd/ts4800-syscon.c | 84 ++++++++++++++++++++++ include/linux/mfd/ts4800-syscon.h | 24 +++++++ 5 files changed, 128 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/ts4800-syscon.txt create mode 100644 drivers/mfd/ts4800-syscon.c create mode 100644 include/linux/mfd/ts4800-syscon.h diff --git a/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt new file mode 100644 index 0000000..8dbc12c --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt @@ -0,0 +1,12 @@ +Technologic Systems Syscon + +Required properties: +- compatible : must be "ts,ts4800-syscon" +- reg : physical base address and length of memory mapped region + +Example: + +syscon at b0010000 { + compatible = "ts,ts4800-syscon"; + reg = <0xb0010000 0x3d>; +}; diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 3f68dd2..8f03dce 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -1302,6 +1302,13 @@ config MFD_TC6393XB help Support for Toshiba Mobile IO Controller TC6393XB +config MFD_TS4800_SYSCON + tristate "TS-4800 Syscon Support" + select REGMAP + select REGMAP_MMIO + help + Support for TS-4800's FPGA Syscon registers + config MFD_VX855 tristate "VIA VX855/VX875 integrated south bridge" depends on PCI diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index ea40e07..e2c0f1b 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -181,6 +181,7 @@ obj-$(CONFIG_MFD_HI6421_PMIC) += hi6421-pmic-core.o obj-$(CONFIG_MFD_DLN2) += dln2.o obj-$(CONFIG_MFD_RT5033) += rt5033.o obj-$(CONFIG_MFD_SKY81452) += sky81452.o +obj-$(CONFIG_MFD_TS4800_SYSCON) += ts4800-syscon.o intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o diff --git a/drivers/mfd/ts4800-syscon.c b/drivers/mfd/ts4800-syscon.c new file mode 100644 index 0000000..1e42e96 --- /dev/null +++ b/drivers/mfd/ts4800-syscon.c @@ -0,0 +1,84 @@ +/* + * Device driver for TS-4800 FPGA's syscon + * + * Copyright (c) 2015 - Savoir-faire Linux + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +#include <linux/device.h> +#include <linux/err.h> +#include <linux/mfd/core.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/platform_device.h> +#include <linux/regmap.h> +#include <linux/mfd/ts4800-syscon.h> + + +static const struct regmap_config ts4800_regmap_config = { + .reg_bits = 32, + .reg_stride = 2, + .val_bits = 16, +}; + +static int ts4800_syscon_probe(struct platform_device *pdev) +{ + struct ts4800_syscon *syscon; + struct resource *res; + void __iomem *base; + + syscon = devm_kzalloc(&pdev->dev, sizeof(*syscon), GFP_KERNEL); + if (!syscon) + return -ENOMEM; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(base)) + return PTR_ERR(base); + + syscon->regmap = devm_regmap_init_mmio_clk(&pdev->dev, NULL, base, + &ts4800_regmap_config); + if (IS_ERR(syscon->regmap)) { + dev_err(&pdev->dev, + "regmap init failed: %ld\n", + PTR_ERR(syscon->regmap)); + return PTR_ERR(syscon->regmap); + } + + platform_set_drvdata(pdev, syscon); + + return 0; +} + +static int ts4800_syscon_remove(struct platform_device *pdev) +{ + return 0; +} + +static const struct of_device_id ts4800_syscon_of_match[] = { + { .compatible = "ts,ts4800-syscon", }, + { }, +}; + +static struct platform_driver ts4800_syscon_driver = { + .driver = { + .name = "ts4800_syscon", + .of_match_table = ts4800_syscon_of_match, + }, + .probe = ts4800_syscon_probe, + .remove = ts4800_syscon_remove, +}; +module_platform_driver(ts4800_syscon_driver); + +MODULE_AUTHOR("Damien Riegel <damien.riegel@savoirfairelinux.com>"); +MODULE_DESCRIPTION("TS-4800 Syscon driver"); +MODULE_LICENSE("GPL v2"); diff --git a/include/linux/mfd/ts4800-syscon.h b/include/linux/mfd/ts4800-syscon.h new file mode 100644 index 0000000..3d29184 --- /dev/null +++ b/include/linux/mfd/ts4800-syscon.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2015 - Savoir-faire Linux + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +#ifndef __LINUX_MFD_TS4800_SYSCON_H +#define __LINUX_MFD_TS4800_SYSCON_H + +#include <linux/regmap.h> + +struct ts4800_syscon { + struct regmap *regmap; +}; + +#endif /* __LINUX_MFD_TS4800_SYSCON_H */ -- 2.5.0 ^ permalink raw reply related [flat|nested] 52+ messages in thread
* Re: [PATCH v2 2/5] mfd: ts4800-syscon: add driver for TS-4800 syscon 2015-10-29 20:27 ` Damien Riegel (?) @ 2015-10-30 17:56 ` Lee Jones -1 siblings, 0 replies; 52+ messages in thread From: Lee Jones @ 2015-10-30 17:56 UTC (permalink / raw) To: Damien Riegel Cc: linux-kernel, linux-arm-kernel, linux-watchdog, shawnguo, kernel, wim, robh+dt, sameo, dinh.linux, linux, kernel On Thu, 29 Oct 2015, Damien Riegel wrote: > Driver for TS-4800 syscon. These registers belong to a FPGA that is > memory mapped and are used for counters, enable various IPs in the FPGA, > control LEDs, control IOs, etc. > > Currently, only the watchdog is handled. Why do you require your own syscon driver? What's wrong with the generic one? > Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> > --- > .../devicetree/bindings/mfd/ts4800-syscon.txt | 12 ++++ Separate patch please. > drivers/mfd/Kconfig | 7 ++ > drivers/mfd/Makefile | 1 + > drivers/mfd/ts4800-syscon.c | 84 ++++++++++++++++++++++ > include/linux/mfd/ts4800-syscon.h | 24 +++++++ > 5 files changed, 128 insertions(+) > create mode 100644 Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > create mode 100644 drivers/mfd/ts4800-syscon.c > create mode 100644 include/linux/mfd/ts4800-syscon.h > > diff --git a/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > new file mode 100644 > index 0000000..8dbc12c > --- /dev/null > +++ b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > @@ -0,0 +1,12 @@ > +Technologic Systems Syscon > + > +Required properties: > +- compatible : must be "ts,ts4800-syscon" > +- reg : physical base address and length of memory mapped region > + > +Example: > + > +syscon@b0010000 { > + compatible = "ts,ts4800-syscon"; > + reg = <0xb0010000 0x3d>; > +}; > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig > index 3f68dd2..8f03dce 100644 > --- a/drivers/mfd/Kconfig > +++ b/drivers/mfd/Kconfig > @@ -1302,6 +1302,13 @@ config MFD_TC6393XB > help > Support for Toshiba Mobile IO Controller TC6393XB > > +config MFD_TS4800_SYSCON > + tristate "TS-4800 Syscon Support" > + select REGMAP > + select REGMAP_MMIO > + help > + Support for TS-4800's FPGA Syscon registers > + > config MFD_VX855 > tristate "VIA VX855/VX875 integrated south bridge" > depends on PCI > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile > index ea40e07..e2c0f1b 100644 > --- a/drivers/mfd/Makefile > +++ b/drivers/mfd/Makefile > @@ -181,6 +181,7 @@ obj-$(CONFIG_MFD_HI6421_PMIC) += hi6421-pmic-core.o > obj-$(CONFIG_MFD_DLN2) += dln2.o > obj-$(CONFIG_MFD_RT5033) += rt5033.o > obj-$(CONFIG_MFD_SKY81452) += sky81452.o > +obj-$(CONFIG_MFD_TS4800_SYSCON) += ts4800-syscon.o > > intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o > obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o > diff --git a/drivers/mfd/ts4800-syscon.c b/drivers/mfd/ts4800-syscon.c > new file mode 100644 > index 0000000..1e42e96 > --- /dev/null > +++ b/drivers/mfd/ts4800-syscon.c > @@ -0,0 +1,84 @@ > +/* > + * Device driver for TS-4800 FPGA's syscon > + * > + * Copyright (c) 2015 - Savoir-faire Linux > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. Why is the MFD v2+ and the Watchdog driver only v2? > + * This program is distributed in the hope it will be useful, but WITHOUT > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > + * more details. > + */ > + > +#include <linux/device.h> > +#include <linux/err.h> > +#include <linux/mfd/core.h> > +#include <linux/module.h> > +#include <linux/of.h> > +#include <linux/platform_device.h> > +#include <linux/regmap.h> > +#include <linux/mfd/ts4800-syscon.h> Alphabetical. > + > + Superfluous '\n'. > +static const struct regmap_config ts4800_regmap_config = { > + .reg_bits = 32, > + .reg_stride = 2, > + .val_bits = 16, > +}; > + > +static int ts4800_syscon_probe(struct platform_device *pdev) > +{ > + struct ts4800_syscon *syscon; > + struct resource *res; > + void __iomem *base; > + > + syscon = devm_kzalloc(&pdev->dev, sizeof(*syscon), GFP_KERNEL); > + if (!syscon) > + return -ENOMEM; > + > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > + base = devm_ioremap_resource(&pdev->dev, res); > + if (IS_ERR(base)) > + return PTR_ERR(base); > + > + syscon->regmap = devm_regmap_init_mmio_clk(&pdev->dev, NULL, base, > + &ts4800_regmap_config); > + if (IS_ERR(syscon->regmap)) { > + dev_err(&pdev->dev, > + "regmap init failed: %ld\n", > + PTR_ERR(syscon->regmap)); > + return PTR_ERR(syscon->regmap); > + } > + > + platform_set_drvdata(pdev, syscon); > + > + return 0; > +} > + > +static int ts4800_syscon_remove(struct platform_device *pdev) > +{ > + return 0; > +} If it doesn't do anything, don't provide it. > +static const struct of_device_id ts4800_syscon_of_match[] = { > + { .compatible = "ts,ts4800-syscon", }, > + { }, > +}; > + > +static struct platform_driver ts4800_syscon_driver = { > + .driver = { > + .name = "ts4800_syscon", > + .of_match_table = ts4800_syscon_of_match, > + }, > + .probe = ts4800_syscon_probe, > + .remove = ts4800_syscon_remove, > +}; > +module_platform_driver(ts4800_syscon_driver); > + > +MODULE_AUTHOR("Damien Riegel <damien.riegel@savoirfairelinux.com>"); > +MODULE_DESCRIPTION("TS-4800 Syscon driver"); > +MODULE_LICENSE("GPL v2"); This does not match the header. > diff --git a/include/linux/mfd/ts4800-syscon.h b/include/linux/mfd/ts4800-syscon.h > new file mode 100644 > index 0000000..3d29184 > --- /dev/null > +++ b/include/linux/mfd/ts4800-syscon.h > @@ -0,0 +1,24 @@ > +/* > + * Copyright (c) 2015 - Savoir-faire Linux > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + * > + * This program is distributed in the hope it will be useful, but WITHOUT > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > + * more details. > + */ > + > +#ifndef __LINUX_MFD_TS4800_SYSCON_H > +#define __LINUX_MFD_TS4800_SYSCON_H > + > +#include <linux/regmap.h> > + > +struct ts4800_syscon { > + struct regmap *regmap; > +}; > + > +#endif /* __LINUX_MFD_TS4800_SYSCON_H */ -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog -- To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v2 2/5] mfd: ts4800-syscon: add driver for TS-4800 syscon @ 2015-10-30 17:56 ` Lee Jones 0 siblings, 0 replies; 52+ messages in thread From: Lee Jones @ 2015-10-30 17:56 UTC (permalink / raw) To: Damien Riegel Cc: linux-kernel, linux-arm-kernel, linux-watchdog, shawnguo, kernel, wim, robh+dt, sameo, dinh.linux, linux, kernel On Thu, 29 Oct 2015, Damien Riegel wrote: > Driver for TS-4800 syscon. These registers belong to a FPGA that is > memory mapped and are used for counters, enable various IPs in the FPGA, > control LEDs, control IOs, etc. > > Currently, only the watchdog is handled. Why do you require your own syscon driver? What's wrong with the generic one? > Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> > --- > .../devicetree/bindings/mfd/ts4800-syscon.txt | 12 ++++ Separate patch please. > drivers/mfd/Kconfig | 7 ++ > drivers/mfd/Makefile | 1 + > drivers/mfd/ts4800-syscon.c | 84 ++++++++++++++++++++++ > include/linux/mfd/ts4800-syscon.h | 24 +++++++ > 5 files changed, 128 insertions(+) > create mode 100644 Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > create mode 100644 drivers/mfd/ts4800-syscon.c > create mode 100644 include/linux/mfd/ts4800-syscon.h > > diff --git a/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > new file mode 100644 > index 0000000..8dbc12c > --- /dev/null > +++ b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > @@ -0,0 +1,12 @@ > +Technologic Systems Syscon > + > +Required properties: > +- compatible : must be "ts,ts4800-syscon" > +- reg : physical base address and length of memory mapped region > + > +Example: > + > +syscon@b0010000 { > + compatible = "ts,ts4800-syscon"; > + reg = <0xb0010000 0x3d>; > +}; > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig > index 3f68dd2..8f03dce 100644 > --- a/drivers/mfd/Kconfig > +++ b/drivers/mfd/Kconfig > @@ -1302,6 +1302,13 @@ config MFD_TC6393XB > help > Support for Toshiba Mobile IO Controller TC6393XB > > +config MFD_TS4800_SYSCON > + tristate "TS-4800 Syscon Support" > + select REGMAP > + select REGMAP_MMIO > + help > + Support for TS-4800's FPGA Syscon registers > + > config MFD_VX855 > tristate "VIA VX855/VX875 integrated south bridge" > depends on PCI > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile > index ea40e07..e2c0f1b 100644 > --- a/drivers/mfd/Makefile > +++ b/drivers/mfd/Makefile > @@ -181,6 +181,7 @@ obj-$(CONFIG_MFD_HI6421_PMIC) += hi6421-pmic-core.o > obj-$(CONFIG_MFD_DLN2) += dln2.o > obj-$(CONFIG_MFD_RT5033) += rt5033.o > obj-$(CONFIG_MFD_SKY81452) += sky81452.o > +obj-$(CONFIG_MFD_TS4800_SYSCON) += ts4800-syscon.o > > intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o > obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o > diff --git a/drivers/mfd/ts4800-syscon.c b/drivers/mfd/ts4800-syscon.c > new file mode 100644 > index 0000000..1e42e96 > --- /dev/null > +++ b/drivers/mfd/ts4800-syscon.c > @@ -0,0 +1,84 @@ > +/* > + * Device driver for TS-4800 FPGA's syscon > + * > + * Copyright (c) 2015 - Savoir-faire Linux > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. Why is the MFD v2+ and the Watchdog driver only v2? > + * This program is distributed in the hope it will be useful, but WITHOUT > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > + * more details. > + */ > + > +#include <linux/device.h> > +#include <linux/err.h> > +#include <linux/mfd/core.h> > +#include <linux/module.h> > +#include <linux/of.h> > +#include <linux/platform_device.h> > +#include <linux/regmap.h> > +#include <linux/mfd/ts4800-syscon.h> Alphabetical. > + > + Superfluous '\n'. > +static const struct regmap_config ts4800_regmap_config = { > + .reg_bits = 32, > + .reg_stride = 2, > + .val_bits = 16, > +}; > + > +static int ts4800_syscon_probe(struct platform_device *pdev) > +{ > + struct ts4800_syscon *syscon; > + struct resource *res; > + void __iomem *base; > + > + syscon = devm_kzalloc(&pdev->dev, sizeof(*syscon), GFP_KERNEL); > + if (!syscon) > + return -ENOMEM; > + > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > + base = devm_ioremap_resource(&pdev->dev, res); > + if (IS_ERR(base)) > + return PTR_ERR(base); > + > + syscon->regmap = devm_regmap_init_mmio_clk(&pdev->dev, NULL, base, > + &ts4800_regmap_config); > + if (IS_ERR(syscon->regmap)) { > + dev_err(&pdev->dev, > + "regmap init failed: %ld\n", > + PTR_ERR(syscon->regmap)); > + return PTR_ERR(syscon->regmap); > + } > + > + platform_set_drvdata(pdev, syscon); > + > + return 0; > +} > + > +static int ts4800_syscon_remove(struct platform_device *pdev) > +{ > + return 0; > +} If it doesn't do anything, don't provide it. > +static const struct of_device_id ts4800_syscon_of_match[] = { > + { .compatible = "ts,ts4800-syscon", }, > + { }, > +}; > + > +static struct platform_driver ts4800_syscon_driver = { > + .driver = { > + .name = "ts4800_syscon", > + .of_match_table = ts4800_syscon_of_match, > + }, > + .probe = ts4800_syscon_probe, > + .remove = ts4800_syscon_remove, > +}; > +module_platform_driver(ts4800_syscon_driver); > + > +MODULE_AUTHOR("Damien Riegel <damien.riegel@savoirfairelinux.com>"); > +MODULE_DESCRIPTION("TS-4800 Syscon driver"); > +MODULE_LICENSE("GPL v2"); This does not match the header. > diff --git a/include/linux/mfd/ts4800-syscon.h b/include/linux/mfd/ts4800-syscon.h > new file mode 100644 > index 0000000..3d29184 > --- /dev/null > +++ b/include/linux/mfd/ts4800-syscon.h > @@ -0,0 +1,24 @@ > +/* > + * Copyright (c) 2015 - Savoir-faire Linux > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + * > + * This program is distributed in the hope it will be useful, but WITHOUT > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > + * more details. > + */ > + > +#ifndef __LINUX_MFD_TS4800_SYSCON_H > +#define __LINUX_MFD_TS4800_SYSCON_H > + > +#include <linux/regmap.h> > + > +struct ts4800_syscon { > + struct regmap *regmap; > +}; > + > +#endif /* __LINUX_MFD_TS4800_SYSCON_H */ -- 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] 52+ messages in thread
* [PATCH v2 2/5] mfd: ts4800-syscon: add driver for TS-4800 syscon @ 2015-10-30 17:56 ` Lee Jones 0 siblings, 0 replies; 52+ messages in thread From: Lee Jones @ 2015-10-30 17:56 UTC (permalink / raw) To: linux-arm-kernel On Thu, 29 Oct 2015, Damien Riegel wrote: > Driver for TS-4800 syscon. These registers belong to a FPGA that is > memory mapped and are used for counters, enable various IPs in the FPGA, > control LEDs, control IOs, etc. > > Currently, only the watchdog is handled. Why do you require your own syscon driver? What's wrong with the generic one? > Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> > --- > .../devicetree/bindings/mfd/ts4800-syscon.txt | 12 ++++ Separate patch please. > drivers/mfd/Kconfig | 7 ++ > drivers/mfd/Makefile | 1 + > drivers/mfd/ts4800-syscon.c | 84 ++++++++++++++++++++++ > include/linux/mfd/ts4800-syscon.h | 24 +++++++ > 5 files changed, 128 insertions(+) > create mode 100644 Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > create mode 100644 drivers/mfd/ts4800-syscon.c > create mode 100644 include/linux/mfd/ts4800-syscon.h > > diff --git a/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > new file mode 100644 > index 0000000..8dbc12c > --- /dev/null > +++ b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > @@ -0,0 +1,12 @@ > +Technologic Systems Syscon > + > +Required properties: > +- compatible : must be "ts,ts4800-syscon" > +- reg : physical base address and length of memory mapped region > + > +Example: > + > +syscon at b0010000 { > + compatible = "ts,ts4800-syscon"; > + reg = <0xb0010000 0x3d>; > +}; > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig > index 3f68dd2..8f03dce 100644 > --- a/drivers/mfd/Kconfig > +++ b/drivers/mfd/Kconfig > @@ -1302,6 +1302,13 @@ config MFD_TC6393XB > help > Support for Toshiba Mobile IO Controller TC6393XB > > +config MFD_TS4800_SYSCON > + tristate "TS-4800 Syscon Support" > + select REGMAP > + select REGMAP_MMIO > + help > + Support for TS-4800's FPGA Syscon registers > + > config MFD_VX855 > tristate "VIA VX855/VX875 integrated south bridge" > depends on PCI > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile > index ea40e07..e2c0f1b 100644 > --- a/drivers/mfd/Makefile > +++ b/drivers/mfd/Makefile > @@ -181,6 +181,7 @@ obj-$(CONFIG_MFD_HI6421_PMIC) += hi6421-pmic-core.o > obj-$(CONFIG_MFD_DLN2) += dln2.o > obj-$(CONFIG_MFD_RT5033) += rt5033.o > obj-$(CONFIG_MFD_SKY81452) += sky81452.o > +obj-$(CONFIG_MFD_TS4800_SYSCON) += ts4800-syscon.o > > intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o > obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o > diff --git a/drivers/mfd/ts4800-syscon.c b/drivers/mfd/ts4800-syscon.c > new file mode 100644 > index 0000000..1e42e96 > --- /dev/null > +++ b/drivers/mfd/ts4800-syscon.c > @@ -0,0 +1,84 @@ > +/* > + * Device driver for TS-4800 FPGA's syscon > + * > + * Copyright (c) 2015 - Savoir-faire Linux > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. Why is the MFD v2+ and the Watchdog driver only v2? > + * This program is distributed in the hope it will be useful, but WITHOUT > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > + * more details. > + */ > + > +#include <linux/device.h> > +#include <linux/err.h> > +#include <linux/mfd/core.h> > +#include <linux/module.h> > +#include <linux/of.h> > +#include <linux/platform_device.h> > +#include <linux/regmap.h> > +#include <linux/mfd/ts4800-syscon.h> Alphabetical. > + > + Superfluous '\n'. > +static const struct regmap_config ts4800_regmap_config = { > + .reg_bits = 32, > + .reg_stride = 2, > + .val_bits = 16, > +}; > + > +static int ts4800_syscon_probe(struct platform_device *pdev) > +{ > + struct ts4800_syscon *syscon; > + struct resource *res; > + void __iomem *base; > + > + syscon = devm_kzalloc(&pdev->dev, sizeof(*syscon), GFP_KERNEL); > + if (!syscon) > + return -ENOMEM; > + > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > + base = devm_ioremap_resource(&pdev->dev, res); > + if (IS_ERR(base)) > + return PTR_ERR(base); > + > + syscon->regmap = devm_regmap_init_mmio_clk(&pdev->dev, NULL, base, > + &ts4800_regmap_config); > + if (IS_ERR(syscon->regmap)) { > + dev_err(&pdev->dev, > + "regmap init failed: %ld\n", > + PTR_ERR(syscon->regmap)); > + return PTR_ERR(syscon->regmap); > + } > + > + platform_set_drvdata(pdev, syscon); > + > + return 0; > +} > + > +static int ts4800_syscon_remove(struct platform_device *pdev) > +{ > + return 0; > +} If it doesn't do anything, don't provide it. > +static const struct of_device_id ts4800_syscon_of_match[] = { > + { .compatible = "ts,ts4800-syscon", }, > + { }, > +}; > + > +static struct platform_driver ts4800_syscon_driver = { > + .driver = { > + .name = "ts4800_syscon", > + .of_match_table = ts4800_syscon_of_match, > + }, > + .probe = ts4800_syscon_probe, > + .remove = ts4800_syscon_remove, > +}; > +module_platform_driver(ts4800_syscon_driver); > + > +MODULE_AUTHOR("Damien Riegel <damien.riegel@savoirfairelinux.com>"); > +MODULE_DESCRIPTION("TS-4800 Syscon driver"); > +MODULE_LICENSE("GPL v2"); This does not match the header. > diff --git a/include/linux/mfd/ts4800-syscon.h b/include/linux/mfd/ts4800-syscon.h > new file mode 100644 > index 0000000..3d29184 > --- /dev/null > +++ b/include/linux/mfd/ts4800-syscon.h > @@ -0,0 +1,24 @@ > +/* > + * Copyright (c) 2015 - Savoir-faire Linux > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + * > + * This program is distributed in the hope it will be useful, but WITHOUT > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > + * more details. > + */ > + > +#ifndef __LINUX_MFD_TS4800_SYSCON_H > +#define __LINUX_MFD_TS4800_SYSCON_H > + > +#include <linux/regmap.h> > + > +struct ts4800_syscon { > + struct regmap *regmap; > +}; > + > +#endif /* __LINUX_MFD_TS4800_SYSCON_H */ -- 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] 52+ messages in thread
* Re: [PATCH v2 2/5] mfd: ts4800-syscon: add driver for TS-4800 syscon 2015-10-30 17:56 ` Lee Jones (?) @ 2015-10-30 20:08 ` Damien Riegel -1 siblings, 0 replies; 52+ messages in thread From: Damien Riegel @ 2015-10-30 20:08 UTC (permalink / raw) To: Lee Jones Cc: linux-kernel, linux-arm-kernel, linux-watchdog, shawnguo, kernel, wim, robh+dt, sameo, dinh.linux, linux, kernel On Fri, Oct 30, 2015 at 05:56:56PM +0000, Lee Jones wrote: > On Thu, 29 Oct 2015, Damien Riegel wrote: > > > Driver for TS-4800 syscon. These registers belong to a FPGA that is > > memory mapped and are used for counters, enable various IPs in the FPGA, > > control LEDs, control IOs, etc. > > > > Currently, only the watchdog is handled. > > Why do you require your own syscon driver? > > What's wrong with the generic one? > The generic one uses a regmap_config with reg_stride set to 4 and val_bits to 32. TS-4800 syscon registers are 16-bit wide and must be accessed with 16 bit read and writes: http://wiki.embeddedarm.com/wiki/TS-4800#Syscon I will address the other issues in the next version (split commit, license issue, style, and superfluous remove). > > Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> > > --- > > .../devicetree/bindings/mfd/ts4800-syscon.txt | 12 ++++ > > Separate patch please. > > > drivers/mfd/Kconfig | 7 ++ > > drivers/mfd/Makefile | 1 + > > drivers/mfd/ts4800-syscon.c | 84 ++++++++++++++++++++++ > > include/linux/mfd/ts4800-syscon.h | 24 +++++++ > > 5 files changed, 128 insertions(+) > > create mode 100644 Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > > create mode 100644 drivers/mfd/ts4800-syscon.c > > create mode 100644 include/linux/mfd/ts4800-syscon.h > > > > diff --git a/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > > new file mode 100644 > > index 0000000..8dbc12c > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > > @@ -0,0 +1,12 @@ > > +Technologic Systems Syscon > > + > > +Required properties: > > +- compatible : must be "ts,ts4800-syscon" > > +- reg : physical base address and length of memory mapped region > > + > > +Example: > > + > > +syscon@b0010000 { > > + compatible = "ts,ts4800-syscon"; > > + reg = <0xb0010000 0x3d>; > > +}; > > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig > > index 3f68dd2..8f03dce 100644 > > --- a/drivers/mfd/Kconfig > > +++ b/drivers/mfd/Kconfig > > @@ -1302,6 +1302,13 @@ config MFD_TC6393XB > > help > > Support for Toshiba Mobile IO Controller TC6393XB > > > > +config MFD_TS4800_SYSCON > > + tristate "TS-4800 Syscon Support" > > + select REGMAP > > + select REGMAP_MMIO > > + help > > + Support for TS-4800's FPGA Syscon registers > > + > > config MFD_VX855 > > tristate "VIA VX855/VX875 integrated south bridge" > > depends on PCI > > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile > > index ea40e07..e2c0f1b 100644 > > --- a/drivers/mfd/Makefile > > +++ b/drivers/mfd/Makefile > > @@ -181,6 +181,7 @@ obj-$(CONFIG_MFD_HI6421_PMIC) += hi6421-pmic-core.o > > obj-$(CONFIG_MFD_DLN2) += dln2.o > > obj-$(CONFIG_MFD_RT5033) += rt5033.o > > obj-$(CONFIG_MFD_SKY81452) += sky81452.o > > +obj-$(CONFIG_MFD_TS4800_SYSCON) += ts4800-syscon.o > > > > intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o > > obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o > > diff --git a/drivers/mfd/ts4800-syscon.c b/drivers/mfd/ts4800-syscon.c > > new file mode 100644 > > index 0000000..1e42e96 > > --- /dev/null > > +++ b/drivers/mfd/ts4800-syscon.c > > @@ -0,0 +1,84 @@ > > +/* > > + * Device driver for TS-4800 FPGA's syscon > > + * > > + * Copyright (c) 2015 - Savoir-faire Linux > > + * > > + * This program is free software; you can redistribute it and/or modify > > + * it under the terms of the GNU General Public License as published by > > + * the Free Software Foundation; either version 2 of the License, or > > + * (at your option) any later version. > > Why is the MFD v2+ and the Watchdog driver only v2? > > > + * This program is distributed in the hope it will be useful, but WITHOUT > > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > > + * more details. > > + */ > > + > > +#include <linux/device.h> > > +#include <linux/err.h> > > +#include <linux/mfd/core.h> > > +#include <linux/module.h> > > +#include <linux/of.h> > > +#include <linux/platform_device.h> > > +#include <linux/regmap.h> > > +#include <linux/mfd/ts4800-syscon.h> > > Alphabetical. > > > + > > + > > Superfluous '\n'. > > > +static const struct regmap_config ts4800_regmap_config = { > > + .reg_bits = 32, > > + .reg_stride = 2, > > + .val_bits = 16, > > +}; > > + > > +static int ts4800_syscon_probe(struct platform_device *pdev) > > +{ > > + struct ts4800_syscon *syscon; > > + struct resource *res; > > + void __iomem *base; > > + > > + syscon = devm_kzalloc(&pdev->dev, sizeof(*syscon), GFP_KERNEL); > > + if (!syscon) > > + return -ENOMEM; > > + > > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > > + base = devm_ioremap_resource(&pdev->dev, res); > > + if (IS_ERR(base)) > > + return PTR_ERR(base); > > + > > + syscon->regmap = devm_regmap_init_mmio_clk(&pdev->dev, NULL, base, > > + &ts4800_regmap_config); > > + if (IS_ERR(syscon->regmap)) { > > + dev_err(&pdev->dev, > > + "regmap init failed: %ld\n", > > + PTR_ERR(syscon->regmap)); > > + return PTR_ERR(syscon->regmap); > > + } > > + > > + platform_set_drvdata(pdev, syscon); > > + > > + return 0; > > +} > > + > > +static int ts4800_syscon_remove(struct platform_device *pdev) > > +{ > > + return 0; > > +} > > If it doesn't do anything, don't provide it. > > > +static const struct of_device_id ts4800_syscon_of_match[] = { > > + { .compatible = "ts,ts4800-syscon", }, > > + { }, > > +}; > > + > > +static struct platform_driver ts4800_syscon_driver = { > > + .driver = { > > + .name = "ts4800_syscon", > > + .of_match_table = ts4800_syscon_of_match, > > + }, > > + .probe = ts4800_syscon_probe, > > + .remove = ts4800_syscon_remove, > > +}; > > +module_platform_driver(ts4800_syscon_driver); > > + > > +MODULE_AUTHOR("Damien Riegel <damien.riegel@savoirfairelinux.com>"); > > +MODULE_DESCRIPTION("TS-4800 Syscon driver"); > > +MODULE_LICENSE("GPL v2"); > > This does not match the header. > > > diff --git a/include/linux/mfd/ts4800-syscon.h b/include/linux/mfd/ts4800-syscon.h > > new file mode 100644 > > index 0000000..3d29184 > > --- /dev/null > > +++ b/include/linux/mfd/ts4800-syscon.h > > @@ -0,0 +1,24 @@ > > +/* > > + * Copyright (c) 2015 - Savoir-faire Linux > > + * > > + * This program is free software; you can redistribute it and/or modify > > + * it under the terms of the GNU General Public License as published by > > + * the Free Software Foundation; either version 2 of the License, or > > + * (at your option) any later version. > > + * > > + * This program is distributed in the hope it will be useful, but WITHOUT > > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > > + * more details. > > + */ > > + > > +#ifndef __LINUX_MFD_TS4800_SYSCON_H > > +#define __LINUX_MFD_TS4800_SYSCON_H > > + > > +#include <linux/regmap.h> > > + > > +struct ts4800_syscon { > > + struct regmap *regmap; > > +}; > > + > > +#endif /* __LINUX_MFD_TS4800_SYSCON_H */ > > -- > Lee Jones > Linaro STMicroelectronics Landing Team Lead > Linaro.org │ Open source software for ARM SoCs > Follow Linaro: Facebook | Twitter | Blog -- To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v2 2/5] mfd: ts4800-syscon: add driver for TS-4800 syscon @ 2015-10-30 20:08 ` Damien Riegel 0 siblings, 0 replies; 52+ messages in thread From: Damien Riegel @ 2015-10-30 20:08 UTC (permalink / raw) To: Lee Jones Cc: linux-kernel, linux-arm-kernel, linux-watchdog, shawnguo, kernel, wim, robh+dt, sameo, dinh.linux, linux, kernel On Fri, Oct 30, 2015 at 05:56:56PM +0000, Lee Jones wrote: > On Thu, 29 Oct 2015, Damien Riegel wrote: > > > Driver for TS-4800 syscon. These registers belong to a FPGA that is > > memory mapped and are used for counters, enable various IPs in the FPGA, > > control LEDs, control IOs, etc. > > > > Currently, only the watchdog is handled. > > Why do you require your own syscon driver? > > What's wrong with the generic one? > The generic one uses a regmap_config with reg_stride set to 4 and val_bits to 32. TS-4800 syscon registers are 16-bit wide and must be accessed with 16 bit read and writes: http://wiki.embeddedarm.com/wiki/TS-4800#Syscon I will address the other issues in the next version (split commit, license issue, style, and superfluous remove). > > Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> > > --- > > .../devicetree/bindings/mfd/ts4800-syscon.txt | 12 ++++ > > Separate patch please. > > > drivers/mfd/Kconfig | 7 ++ > > drivers/mfd/Makefile | 1 + > > drivers/mfd/ts4800-syscon.c | 84 ++++++++++++++++++++++ > > include/linux/mfd/ts4800-syscon.h | 24 +++++++ > > 5 files changed, 128 insertions(+) > > create mode 100644 Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > > create mode 100644 drivers/mfd/ts4800-syscon.c > > create mode 100644 include/linux/mfd/ts4800-syscon.h > > > > diff --git a/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > > new file mode 100644 > > index 0000000..8dbc12c > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > > @@ -0,0 +1,12 @@ > > +Technologic Systems Syscon > > + > > +Required properties: > > +- compatible : must be "ts,ts4800-syscon" > > +- reg : physical base address and length of memory mapped region > > + > > +Example: > > + > > +syscon@b0010000 { > > + compatible = "ts,ts4800-syscon"; > > + reg = <0xb0010000 0x3d>; > > +}; > > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig > > index 3f68dd2..8f03dce 100644 > > --- a/drivers/mfd/Kconfig > > +++ b/drivers/mfd/Kconfig > > @@ -1302,6 +1302,13 @@ config MFD_TC6393XB > > help > > Support for Toshiba Mobile IO Controller TC6393XB > > > > +config MFD_TS4800_SYSCON > > + tristate "TS-4800 Syscon Support" > > + select REGMAP > > + select REGMAP_MMIO > > + help > > + Support for TS-4800's FPGA Syscon registers > > + > > config MFD_VX855 > > tristate "VIA VX855/VX875 integrated south bridge" > > depends on PCI > > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile > > index ea40e07..e2c0f1b 100644 > > --- a/drivers/mfd/Makefile > > +++ b/drivers/mfd/Makefile > > @@ -181,6 +181,7 @@ obj-$(CONFIG_MFD_HI6421_PMIC) += hi6421-pmic-core.o > > obj-$(CONFIG_MFD_DLN2) += dln2.o > > obj-$(CONFIG_MFD_RT5033) += rt5033.o > > obj-$(CONFIG_MFD_SKY81452) += sky81452.o > > +obj-$(CONFIG_MFD_TS4800_SYSCON) += ts4800-syscon.o > > > > intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o > > obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o > > diff --git a/drivers/mfd/ts4800-syscon.c b/drivers/mfd/ts4800-syscon.c > > new file mode 100644 > > index 0000000..1e42e96 > > --- /dev/null > > +++ b/drivers/mfd/ts4800-syscon.c > > @@ -0,0 +1,84 @@ > > +/* > > + * Device driver for TS-4800 FPGA's syscon > > + * > > + * Copyright (c) 2015 - Savoir-faire Linux > > + * > > + * This program is free software; you can redistribute it and/or modify > > + * it under the terms of the GNU General Public License as published by > > + * the Free Software Foundation; either version 2 of the License, or > > + * (at your option) any later version. > > Why is the MFD v2+ and the Watchdog driver only v2? > > > + * This program is distributed in the hope it will be useful, but WITHOUT > > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > > + * more details. > > + */ > > + > > +#include <linux/device.h> > > +#include <linux/err.h> > > +#include <linux/mfd/core.h> > > +#include <linux/module.h> > > +#include <linux/of.h> > > +#include <linux/platform_device.h> > > +#include <linux/regmap.h> > > +#include <linux/mfd/ts4800-syscon.h> > > Alphabetical. > > > + > > + > > Superfluous '\n'. > > > +static const struct regmap_config ts4800_regmap_config = { > > + .reg_bits = 32, > > + .reg_stride = 2, > > + .val_bits = 16, > > +}; > > + > > +static int ts4800_syscon_probe(struct platform_device *pdev) > > +{ > > + struct ts4800_syscon *syscon; > > + struct resource *res; > > + void __iomem *base; > > + > > + syscon = devm_kzalloc(&pdev->dev, sizeof(*syscon), GFP_KERNEL); > > + if (!syscon) > > + return -ENOMEM; > > + > > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > > + base = devm_ioremap_resource(&pdev->dev, res); > > + if (IS_ERR(base)) > > + return PTR_ERR(base); > > + > > + syscon->regmap = devm_regmap_init_mmio_clk(&pdev->dev, NULL, base, > > + &ts4800_regmap_config); > > + if (IS_ERR(syscon->regmap)) { > > + dev_err(&pdev->dev, > > + "regmap init failed: %ld\n", > > + PTR_ERR(syscon->regmap)); > > + return PTR_ERR(syscon->regmap); > > + } > > + > > + platform_set_drvdata(pdev, syscon); > > + > > + return 0; > > +} > > + > > +static int ts4800_syscon_remove(struct platform_device *pdev) > > +{ > > + return 0; > > +} > > If it doesn't do anything, don't provide it. > > > +static const struct of_device_id ts4800_syscon_of_match[] = { > > + { .compatible = "ts,ts4800-syscon", }, > > + { }, > > +}; > > + > > +static struct platform_driver ts4800_syscon_driver = { > > + .driver = { > > + .name = "ts4800_syscon", > > + .of_match_table = ts4800_syscon_of_match, > > + }, > > + .probe = ts4800_syscon_probe, > > + .remove = ts4800_syscon_remove, > > +}; > > +module_platform_driver(ts4800_syscon_driver); > > + > > +MODULE_AUTHOR("Damien Riegel <damien.riegel@savoirfairelinux.com>"); > > +MODULE_DESCRIPTION("TS-4800 Syscon driver"); > > +MODULE_LICENSE("GPL v2"); > > This does not match the header. > > > diff --git a/include/linux/mfd/ts4800-syscon.h b/include/linux/mfd/ts4800-syscon.h > > new file mode 100644 > > index 0000000..3d29184 > > --- /dev/null > > +++ b/include/linux/mfd/ts4800-syscon.h > > @@ -0,0 +1,24 @@ > > +/* > > + * Copyright (c) 2015 - Savoir-faire Linux > > + * > > + * This program is free software; you can redistribute it and/or modify > > + * it under the terms of the GNU General Public License as published by > > + * the Free Software Foundation; either version 2 of the License, or > > + * (at your option) any later version. > > + * > > + * This program is distributed in the hope it will be useful, but WITHOUT > > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > > + * more details. > > + */ > > + > > +#ifndef __LINUX_MFD_TS4800_SYSCON_H > > +#define __LINUX_MFD_TS4800_SYSCON_H > > + > > +#include <linux/regmap.h> > > + > > +struct ts4800_syscon { > > + struct regmap *regmap; > > +}; > > + > > +#endif /* __LINUX_MFD_TS4800_SYSCON_H */ > > -- > 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] 52+ messages in thread
* [PATCH v2 2/5] mfd: ts4800-syscon: add driver for TS-4800 syscon @ 2015-10-30 20:08 ` Damien Riegel 0 siblings, 0 replies; 52+ messages in thread From: Damien Riegel @ 2015-10-30 20:08 UTC (permalink / raw) To: linux-arm-kernel On Fri, Oct 30, 2015 at 05:56:56PM +0000, Lee Jones wrote: > On Thu, 29 Oct 2015, Damien Riegel wrote: > > > Driver for TS-4800 syscon. These registers belong to a FPGA that is > > memory mapped and are used for counters, enable various IPs in the FPGA, > > control LEDs, control IOs, etc. > > > > Currently, only the watchdog is handled. > > Why do you require your own syscon driver? > > What's wrong with the generic one? > The generic one uses a regmap_config with reg_stride set to 4 and val_bits to 32. TS-4800 syscon registers are 16-bit wide and must be accessed with 16 bit read and writes: http://wiki.embeddedarm.com/wiki/TS-4800#Syscon I will address the other issues in the next version (split commit, license issue, style, and superfluous remove). > > Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> > > --- > > .../devicetree/bindings/mfd/ts4800-syscon.txt | 12 ++++ > > Separate patch please. > > > drivers/mfd/Kconfig | 7 ++ > > drivers/mfd/Makefile | 1 + > > drivers/mfd/ts4800-syscon.c | 84 ++++++++++++++++++++++ > > include/linux/mfd/ts4800-syscon.h | 24 +++++++ > > 5 files changed, 128 insertions(+) > > create mode 100644 Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > > create mode 100644 drivers/mfd/ts4800-syscon.c > > create mode 100644 include/linux/mfd/ts4800-syscon.h > > > > diff --git a/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > > new file mode 100644 > > index 0000000..8dbc12c > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > > @@ -0,0 +1,12 @@ > > +Technologic Systems Syscon > > + > > +Required properties: > > +- compatible : must be "ts,ts4800-syscon" > > +- reg : physical base address and length of memory mapped region > > + > > +Example: > > + > > +syscon at b0010000 { > > + compatible = "ts,ts4800-syscon"; > > + reg = <0xb0010000 0x3d>; > > +}; > > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig > > index 3f68dd2..8f03dce 100644 > > --- a/drivers/mfd/Kconfig > > +++ b/drivers/mfd/Kconfig > > @@ -1302,6 +1302,13 @@ config MFD_TC6393XB > > help > > Support for Toshiba Mobile IO Controller TC6393XB > > > > +config MFD_TS4800_SYSCON > > + tristate "TS-4800 Syscon Support" > > + select REGMAP > > + select REGMAP_MMIO > > + help > > + Support for TS-4800's FPGA Syscon registers > > + > > config MFD_VX855 > > tristate "VIA VX855/VX875 integrated south bridge" > > depends on PCI > > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile > > index ea40e07..e2c0f1b 100644 > > --- a/drivers/mfd/Makefile > > +++ b/drivers/mfd/Makefile > > @@ -181,6 +181,7 @@ obj-$(CONFIG_MFD_HI6421_PMIC) += hi6421-pmic-core.o > > obj-$(CONFIG_MFD_DLN2) += dln2.o > > obj-$(CONFIG_MFD_RT5033) += rt5033.o > > obj-$(CONFIG_MFD_SKY81452) += sky81452.o > > +obj-$(CONFIG_MFD_TS4800_SYSCON) += ts4800-syscon.o > > > > intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o > > obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o > > diff --git a/drivers/mfd/ts4800-syscon.c b/drivers/mfd/ts4800-syscon.c > > new file mode 100644 > > index 0000000..1e42e96 > > --- /dev/null > > +++ b/drivers/mfd/ts4800-syscon.c > > @@ -0,0 +1,84 @@ > > +/* > > + * Device driver for TS-4800 FPGA's syscon > > + * > > + * Copyright (c) 2015 - Savoir-faire Linux > > + * > > + * This program is free software; you can redistribute it and/or modify > > + * it under the terms of the GNU General Public License as published by > > + * the Free Software Foundation; either version 2 of the License, or > > + * (at your option) any later version. > > Why is the MFD v2+ and the Watchdog driver only v2? > > > + * This program is distributed in the hope it will be useful, but WITHOUT > > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > > + * more details. > > + */ > > + > > +#include <linux/device.h> > > +#include <linux/err.h> > > +#include <linux/mfd/core.h> > > +#include <linux/module.h> > > +#include <linux/of.h> > > +#include <linux/platform_device.h> > > +#include <linux/regmap.h> > > +#include <linux/mfd/ts4800-syscon.h> > > Alphabetical. > > > + > > + > > Superfluous '\n'. > > > +static const struct regmap_config ts4800_regmap_config = { > > + .reg_bits = 32, > > + .reg_stride = 2, > > + .val_bits = 16, > > +}; > > + > > +static int ts4800_syscon_probe(struct platform_device *pdev) > > +{ > > + struct ts4800_syscon *syscon; > > + struct resource *res; > > + void __iomem *base; > > + > > + syscon = devm_kzalloc(&pdev->dev, sizeof(*syscon), GFP_KERNEL); > > + if (!syscon) > > + return -ENOMEM; > > + > > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > > + base = devm_ioremap_resource(&pdev->dev, res); > > + if (IS_ERR(base)) > > + return PTR_ERR(base); > > + > > + syscon->regmap = devm_regmap_init_mmio_clk(&pdev->dev, NULL, base, > > + &ts4800_regmap_config); > > + if (IS_ERR(syscon->regmap)) { > > + dev_err(&pdev->dev, > > + "regmap init failed: %ld\n", > > + PTR_ERR(syscon->regmap)); > > + return PTR_ERR(syscon->regmap); > > + } > > + > > + platform_set_drvdata(pdev, syscon); > > + > > + return 0; > > +} > > + > > +static int ts4800_syscon_remove(struct platform_device *pdev) > > +{ > > + return 0; > > +} > > If it doesn't do anything, don't provide it. > > > +static const struct of_device_id ts4800_syscon_of_match[] = { > > + { .compatible = "ts,ts4800-syscon", }, > > + { }, > > +}; > > + > > +static struct platform_driver ts4800_syscon_driver = { > > + .driver = { > > + .name = "ts4800_syscon", > > + .of_match_table = ts4800_syscon_of_match, > > + }, > > + .probe = ts4800_syscon_probe, > > + .remove = ts4800_syscon_remove, > > +}; > > +module_platform_driver(ts4800_syscon_driver); > > + > > +MODULE_AUTHOR("Damien Riegel <damien.riegel@savoirfairelinux.com>"); > > +MODULE_DESCRIPTION("TS-4800 Syscon driver"); > > +MODULE_LICENSE("GPL v2"); > > This does not match the header. > > > diff --git a/include/linux/mfd/ts4800-syscon.h b/include/linux/mfd/ts4800-syscon.h > > new file mode 100644 > > index 0000000..3d29184 > > --- /dev/null > > +++ b/include/linux/mfd/ts4800-syscon.h > > @@ -0,0 +1,24 @@ > > +/* > > + * Copyright (c) 2015 - Savoir-faire Linux > > + * > > + * This program is free software; you can redistribute it and/or modify > > + * it under the terms of the GNU General Public License as published by > > + * the Free Software Foundation; either version 2 of the License, or > > + * (at your option) any later version. > > + * > > + * This program is distributed in the hope it will be useful, but WITHOUT > > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > > + * more details. > > + */ > > + > > +#ifndef __LINUX_MFD_TS4800_SYSCON_H > > +#define __LINUX_MFD_TS4800_SYSCON_H > > + > > +#include <linux/regmap.h> > > + > > +struct ts4800_syscon { > > + struct regmap *regmap; > > +}; > > + > > +#endif /* __LINUX_MFD_TS4800_SYSCON_H */ > > -- > 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] 52+ messages in thread
* Re: [PATCH v2 2/5] mfd: ts4800-syscon: add driver for TS-4800 syscon 2015-10-30 20:08 ` Damien Riegel (?) @ 2015-11-02 9:12 ` Lee Jones -1 siblings, 0 replies; 52+ messages in thread From: Lee Jones @ 2015-11-02 9:12 UTC (permalink / raw) To: Damien Riegel Cc: linux-kernel, linux-arm-kernel, linux-watchdog, shawnguo, kernel, wim, robh+dt, sameo, dinh.linux, linux, kernel, arnd [Cc'ing Arnd] On Fri, 30 Oct 2015, Damien Riegel wrote: > On Fri, Oct 30, 2015 at 05:56:56PM +0000, Lee Jones wrote: > > On Thu, 29 Oct 2015, Damien Riegel wrote: > > > > > Driver for TS-4800 syscon. These registers belong to a FPGA that is > > > memory mapped and are used for counters, enable various IPs in the FPGA, > > > control LEDs, control IOs, etc. > > > > > > Currently, only the watchdog is handled. > > > > Why do you require your own syscon driver? > > > > What's wrong with the generic one? > > > > The generic one uses a regmap_config with reg_stride set to 4 and val_bits > to 32. > > TS-4800 syscon registers are 16-bit wide and must be accessed with 16 > bit read and writes: > http://wiki.embeddedarm.com/wiki/TS-4800#Syscon > > I will address the other issues in the next version (split commit, > license issue, style, and superfluous remove). The Syscon driver was written to be generic so that each vendor/platform didn't require their own incarnation. How unique is the TS-4800? Perhaps it might be better to supply a generic 16 bit Syscon for devices akin to the TS-4800? Arnd, any opinion on this? > > > Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> > > > --- > > > .../devicetree/bindings/mfd/ts4800-syscon.txt | 12 ++++ > > > > Separate patch please. > > > > > drivers/mfd/Kconfig | 7 ++ > > > drivers/mfd/Makefile | 1 + > > > drivers/mfd/ts4800-syscon.c | 84 ++++++++++++++++++++++ > > > include/linux/mfd/ts4800-syscon.h | 24 +++++++ > > > 5 files changed, 128 insertions(+) > > > create mode 100644 Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > > > create mode 100644 drivers/mfd/ts4800-syscon.c > > > create mode 100644 include/linux/mfd/ts4800-syscon.h > > > > > > diff --git a/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > > > new file mode 100644 > > > index 0000000..8dbc12c > > > --- /dev/null > > > +++ b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > > > @@ -0,0 +1,12 @@ > > > +Technologic Systems Syscon > > > + > > > +Required properties: > > > +- compatible : must be "ts,ts4800-syscon" > > > +- reg : physical base address and length of memory mapped region > > > + > > > +Example: > > > + > > > +syscon@b0010000 { > > > + compatible = "ts,ts4800-syscon"; > > > + reg = <0xb0010000 0x3d>; > > > +}; > > > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig > > > index 3f68dd2..8f03dce 100644 > > > --- a/drivers/mfd/Kconfig > > > +++ b/drivers/mfd/Kconfig > > > @@ -1302,6 +1302,13 @@ config MFD_TC6393XB > > > help > > > Support for Toshiba Mobile IO Controller TC6393XB > > > > > > +config MFD_TS4800_SYSCON > > > + tristate "TS-4800 Syscon Support" > > > + select REGMAP > > > + select REGMAP_MMIO > > > + help > > > + Support for TS-4800's FPGA Syscon registers > > > + > > > config MFD_VX855 > > > tristate "VIA VX855/VX875 integrated south bridge" > > > depends on PCI > > > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile > > > index ea40e07..e2c0f1b 100644 > > > --- a/drivers/mfd/Makefile > > > +++ b/drivers/mfd/Makefile > > > @@ -181,6 +181,7 @@ obj-$(CONFIG_MFD_HI6421_PMIC) += hi6421-pmic-core.o > > > obj-$(CONFIG_MFD_DLN2) += dln2.o > > > obj-$(CONFIG_MFD_RT5033) += rt5033.o > > > obj-$(CONFIG_MFD_SKY81452) += sky81452.o > > > +obj-$(CONFIG_MFD_TS4800_SYSCON) += ts4800-syscon.o > > > > > > intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o > > > obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o > > > diff --git a/drivers/mfd/ts4800-syscon.c b/drivers/mfd/ts4800-syscon.c > > > new file mode 100644 > > > index 0000000..1e42e96 > > > --- /dev/null > > > +++ b/drivers/mfd/ts4800-syscon.c > > > @@ -0,0 +1,84 @@ > > > +/* > > > + * Device driver for TS-4800 FPGA's syscon > > > + * > > > + * Copyright (c) 2015 - Savoir-faire Linux > > > + * > > > + * This program is free software; you can redistribute it and/or modify > > > + * it under the terms of the GNU General Public License as published by > > > + * the Free Software Foundation; either version 2 of the License, or > > > + * (at your option) any later version. > > > > Why is the MFD v2+ and the Watchdog driver only v2? > > > > > + * This program is distributed in the hope it will be useful, but WITHOUT > > > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > > > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > > > + * more details. > > > + */ > > > + > > > +#include <linux/device.h> > > > +#include <linux/err.h> > > > +#include <linux/mfd/core.h> > > > +#include <linux/module.h> > > > +#include <linux/of.h> > > > +#include <linux/platform_device.h> > > > +#include <linux/regmap.h> > > > +#include <linux/mfd/ts4800-syscon.h> > > > > Alphabetical. > > > > > + > > > + > > > > Superfluous '\n'. > > > > > +static const struct regmap_config ts4800_regmap_config = { > > > + .reg_bits = 32, > > > + .reg_stride = 2, > > > + .val_bits = 16, > > > +}; > > > + > > > +static int ts4800_syscon_probe(struct platform_device *pdev) > > > +{ > > > + struct ts4800_syscon *syscon; > > > + struct resource *res; > > > + void __iomem *base; > > > + > > > + syscon = devm_kzalloc(&pdev->dev, sizeof(*syscon), GFP_KERNEL); > > > + if (!syscon) > > > + return -ENOMEM; > > > + > > > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > > > + base = devm_ioremap_resource(&pdev->dev, res); > > > + if (IS_ERR(base)) > > > + return PTR_ERR(base); > > > + > > > + syscon->regmap = devm_regmap_init_mmio_clk(&pdev->dev, NULL, base, > > > + &ts4800_regmap_config); > > > + if (IS_ERR(syscon->regmap)) { > > > + dev_err(&pdev->dev, > > > + "regmap init failed: %ld\n", > > > + PTR_ERR(syscon->regmap)); > > > + return PTR_ERR(syscon->regmap); > > > + } > > > + > > > + platform_set_drvdata(pdev, syscon); > > > + > > > + return 0; > > > +} > > > + > > > +static int ts4800_syscon_remove(struct platform_device *pdev) > > > +{ > > > + return 0; > > > +} > > > > If it doesn't do anything, don't provide it. > > > > > +static const struct of_device_id ts4800_syscon_of_match[] = { > > > + { .compatible = "ts,ts4800-syscon", }, > > > + { }, > > > +}; > > > + > > > +static struct platform_driver ts4800_syscon_driver = { > > > + .driver = { > > > + .name = "ts4800_syscon", > > > + .of_match_table = ts4800_syscon_of_match, > > > + }, > > > + .probe = ts4800_syscon_probe, > > > + .remove = ts4800_syscon_remove, > > > +}; > > > +module_platform_driver(ts4800_syscon_driver); > > > + > > > +MODULE_AUTHOR("Damien Riegel <damien.riegel@savoirfairelinux.com>"); > > > +MODULE_DESCRIPTION("TS-4800 Syscon driver"); > > > +MODULE_LICENSE("GPL v2"); > > > > This does not match the header. > > > > > diff --git a/include/linux/mfd/ts4800-syscon.h b/include/linux/mfd/ts4800-syscon.h > > > new file mode 100644 > > > index 0000000..3d29184 > > > --- /dev/null > > > +++ b/include/linux/mfd/ts4800-syscon.h > > > @@ -0,0 +1,24 @@ > > > +/* > > > + * Copyright (c) 2015 - Savoir-faire Linux > > > + * > > > + * This program is free software; you can redistribute it and/or modify > > > + * it under the terms of the GNU General Public License as published by > > > + * the Free Software Foundation; either version 2 of the License, or > > > + * (at your option) any later version. > > > + * > > > + * This program is distributed in the hope it will be useful, but WITHOUT > > > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > > > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > > > + * more details. > > > + */ > > > + > > > +#ifndef __LINUX_MFD_TS4800_SYSCON_H > > > +#define __LINUX_MFD_TS4800_SYSCON_H > > > + > > > +#include <linux/regmap.h> > > > + > > > +struct ts4800_syscon { > > > + struct regmap *regmap; > > > +}; > > > + > > > +#endif /* __LINUX_MFD_TS4800_SYSCON_H */ > > -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog -- To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v2 2/5] mfd: ts4800-syscon: add driver for TS-4800 syscon @ 2015-11-02 9:12 ` Lee Jones 0 siblings, 0 replies; 52+ messages in thread From: Lee Jones @ 2015-11-02 9:12 UTC (permalink / raw) To: Damien Riegel Cc: linux-kernel, linux-arm-kernel, linux-watchdog, shawnguo, kernel, wim, robh+dt, sameo, dinh.linux, linux, kernel, arnd [Cc'ing Arnd] On Fri, 30 Oct 2015, Damien Riegel wrote: > On Fri, Oct 30, 2015 at 05:56:56PM +0000, Lee Jones wrote: > > On Thu, 29 Oct 2015, Damien Riegel wrote: > > > > > Driver for TS-4800 syscon. These registers belong to a FPGA that is > > > memory mapped and are used for counters, enable various IPs in the FPGA, > > > control LEDs, control IOs, etc. > > > > > > Currently, only the watchdog is handled. > > > > Why do you require your own syscon driver? > > > > What's wrong with the generic one? > > > > The generic one uses a regmap_config with reg_stride set to 4 and val_bits > to 32. > > TS-4800 syscon registers are 16-bit wide and must be accessed with 16 > bit read and writes: > http://wiki.embeddedarm.com/wiki/TS-4800#Syscon > > I will address the other issues in the next version (split commit, > license issue, style, and superfluous remove). The Syscon driver was written to be generic so that each vendor/platform didn't require their own incarnation. How unique is the TS-4800? Perhaps it might be better to supply a generic 16 bit Syscon for devices akin to the TS-4800? Arnd, any opinion on this? > > > Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> > > > --- > > > .../devicetree/bindings/mfd/ts4800-syscon.txt | 12 ++++ > > > > Separate patch please. > > > > > drivers/mfd/Kconfig | 7 ++ > > > drivers/mfd/Makefile | 1 + > > > drivers/mfd/ts4800-syscon.c | 84 ++++++++++++++++++++++ > > > include/linux/mfd/ts4800-syscon.h | 24 +++++++ > > > 5 files changed, 128 insertions(+) > > > create mode 100644 Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > > > create mode 100644 drivers/mfd/ts4800-syscon.c > > > create mode 100644 include/linux/mfd/ts4800-syscon.h > > > > > > diff --git a/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > > > new file mode 100644 > > > index 0000000..8dbc12c > > > --- /dev/null > > > +++ b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > > > @@ -0,0 +1,12 @@ > > > +Technologic Systems Syscon > > > + > > > +Required properties: > > > +- compatible : must be "ts,ts4800-syscon" > > > +- reg : physical base address and length of memory mapped region > > > + > > > +Example: > > > + > > > +syscon@b0010000 { > > > + compatible = "ts,ts4800-syscon"; > > > + reg = <0xb0010000 0x3d>; > > > +}; > > > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig > > > index 3f68dd2..8f03dce 100644 > > > --- a/drivers/mfd/Kconfig > > > +++ b/drivers/mfd/Kconfig > > > @@ -1302,6 +1302,13 @@ config MFD_TC6393XB > > > help > > > Support for Toshiba Mobile IO Controller TC6393XB > > > > > > +config MFD_TS4800_SYSCON > > > + tristate "TS-4800 Syscon Support" > > > + select REGMAP > > > + select REGMAP_MMIO > > > + help > > > + Support for TS-4800's FPGA Syscon registers > > > + > > > config MFD_VX855 > > > tristate "VIA VX855/VX875 integrated south bridge" > > > depends on PCI > > > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile > > > index ea40e07..e2c0f1b 100644 > > > --- a/drivers/mfd/Makefile > > > +++ b/drivers/mfd/Makefile > > > @@ -181,6 +181,7 @@ obj-$(CONFIG_MFD_HI6421_PMIC) += hi6421-pmic-core.o > > > obj-$(CONFIG_MFD_DLN2) += dln2.o > > > obj-$(CONFIG_MFD_RT5033) += rt5033.o > > > obj-$(CONFIG_MFD_SKY81452) += sky81452.o > > > +obj-$(CONFIG_MFD_TS4800_SYSCON) += ts4800-syscon.o > > > > > > intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o > > > obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o > > > diff --git a/drivers/mfd/ts4800-syscon.c b/drivers/mfd/ts4800-syscon.c > > > new file mode 100644 > > > index 0000000..1e42e96 > > > --- /dev/null > > > +++ b/drivers/mfd/ts4800-syscon.c > > > @@ -0,0 +1,84 @@ > > > +/* > > > + * Device driver for TS-4800 FPGA's syscon > > > + * > > > + * Copyright (c) 2015 - Savoir-faire Linux > > > + * > > > + * This program is free software; you can redistribute it and/or modify > > > + * it under the terms of the GNU General Public License as published by > > > + * the Free Software Foundation; either version 2 of the License, or > > > + * (at your option) any later version. > > > > Why is the MFD v2+ and the Watchdog driver only v2? > > > > > + * This program is distributed in the hope it will be useful, but WITHOUT > > > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > > > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > > > + * more details. > > > + */ > > > + > > > +#include <linux/device.h> > > > +#include <linux/err.h> > > > +#include <linux/mfd/core.h> > > > +#include <linux/module.h> > > > +#include <linux/of.h> > > > +#include <linux/platform_device.h> > > > +#include <linux/regmap.h> > > > +#include <linux/mfd/ts4800-syscon.h> > > > > Alphabetical. > > > > > + > > > + > > > > Superfluous '\n'. > > > > > +static const struct regmap_config ts4800_regmap_config = { > > > + .reg_bits = 32, > > > + .reg_stride = 2, > > > + .val_bits = 16, > > > +}; > > > + > > > +static int ts4800_syscon_probe(struct platform_device *pdev) > > > +{ > > > + struct ts4800_syscon *syscon; > > > + struct resource *res; > > > + void __iomem *base; > > > + > > > + syscon = devm_kzalloc(&pdev->dev, sizeof(*syscon), GFP_KERNEL); > > > + if (!syscon) > > > + return -ENOMEM; > > > + > > > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > > > + base = devm_ioremap_resource(&pdev->dev, res); > > > + if (IS_ERR(base)) > > > + return PTR_ERR(base); > > > + > > > + syscon->regmap = devm_regmap_init_mmio_clk(&pdev->dev, NULL, base, > > > + &ts4800_regmap_config); > > > + if (IS_ERR(syscon->regmap)) { > > > + dev_err(&pdev->dev, > > > + "regmap init failed: %ld\n", > > > + PTR_ERR(syscon->regmap)); > > > + return PTR_ERR(syscon->regmap); > > > + } > > > + > > > + platform_set_drvdata(pdev, syscon); > > > + > > > + return 0; > > > +} > > > + > > > +static int ts4800_syscon_remove(struct platform_device *pdev) > > > +{ > > > + return 0; > > > +} > > > > If it doesn't do anything, don't provide it. > > > > > +static const struct of_device_id ts4800_syscon_of_match[] = { > > > + { .compatible = "ts,ts4800-syscon", }, > > > + { }, > > > +}; > > > + > > > +static struct platform_driver ts4800_syscon_driver = { > > > + .driver = { > > > + .name = "ts4800_syscon", > > > + .of_match_table = ts4800_syscon_of_match, > > > + }, > > > + .probe = ts4800_syscon_probe, > > > + .remove = ts4800_syscon_remove, > > > +}; > > > +module_platform_driver(ts4800_syscon_driver); > > > + > > > +MODULE_AUTHOR("Damien Riegel <damien.riegel@savoirfairelinux.com>"); > > > +MODULE_DESCRIPTION("TS-4800 Syscon driver"); > > > +MODULE_LICENSE("GPL v2"); > > > > This does not match the header. > > > > > diff --git a/include/linux/mfd/ts4800-syscon.h b/include/linux/mfd/ts4800-syscon.h > > > new file mode 100644 > > > index 0000000..3d29184 > > > --- /dev/null > > > +++ b/include/linux/mfd/ts4800-syscon.h > > > @@ -0,0 +1,24 @@ > > > +/* > > > + * Copyright (c) 2015 - Savoir-faire Linux > > > + * > > > + * This program is free software; you can redistribute it and/or modify > > > + * it under the terms of the GNU General Public License as published by > > > + * the Free Software Foundation; either version 2 of the License, or > > > + * (at your option) any later version. > > > + * > > > + * This program is distributed in the hope it will be useful, but WITHOUT > > > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > > > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > > > + * more details. > > > + */ > > > + > > > +#ifndef __LINUX_MFD_TS4800_SYSCON_H > > > +#define __LINUX_MFD_TS4800_SYSCON_H > > > + > > > +#include <linux/regmap.h> > > > + > > > +struct ts4800_syscon { > > > + struct regmap *regmap; > > > +}; > > > + > > > +#endif /* __LINUX_MFD_TS4800_SYSCON_H */ > > -- 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] 52+ messages in thread
* [PATCH v2 2/5] mfd: ts4800-syscon: add driver for TS-4800 syscon @ 2015-11-02 9:12 ` Lee Jones 0 siblings, 0 replies; 52+ messages in thread From: Lee Jones @ 2015-11-02 9:12 UTC (permalink / raw) To: linux-arm-kernel [Cc'ing Arnd] On Fri, 30 Oct 2015, Damien Riegel wrote: > On Fri, Oct 30, 2015 at 05:56:56PM +0000, Lee Jones wrote: > > On Thu, 29 Oct 2015, Damien Riegel wrote: > > > > > Driver for TS-4800 syscon. These registers belong to a FPGA that is > > > memory mapped and are used for counters, enable various IPs in the FPGA, > > > control LEDs, control IOs, etc. > > > > > > Currently, only the watchdog is handled. > > > > Why do you require your own syscon driver? > > > > What's wrong with the generic one? > > > > The generic one uses a regmap_config with reg_stride set to 4 and val_bits > to 32. > > TS-4800 syscon registers are 16-bit wide and must be accessed with 16 > bit read and writes: > http://wiki.embeddedarm.com/wiki/TS-4800#Syscon > > I will address the other issues in the next version (split commit, > license issue, style, and superfluous remove). The Syscon driver was written to be generic so that each vendor/platform didn't require their own incarnation. How unique is the TS-4800? Perhaps it might be better to supply a generic 16 bit Syscon for devices akin to the TS-4800? Arnd, any opinion on this? > > > Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> > > > --- > > > .../devicetree/bindings/mfd/ts4800-syscon.txt | 12 ++++ > > > > Separate patch please. > > > > > drivers/mfd/Kconfig | 7 ++ > > > drivers/mfd/Makefile | 1 + > > > drivers/mfd/ts4800-syscon.c | 84 ++++++++++++++++++++++ > > > include/linux/mfd/ts4800-syscon.h | 24 +++++++ > > > 5 files changed, 128 insertions(+) > > > create mode 100644 Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > > > create mode 100644 drivers/mfd/ts4800-syscon.c > > > create mode 100644 include/linux/mfd/ts4800-syscon.h > > > > > > diff --git a/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > > > new file mode 100644 > > > index 0000000..8dbc12c > > > --- /dev/null > > > +++ b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > > > @@ -0,0 +1,12 @@ > > > +Technologic Systems Syscon > > > + > > > +Required properties: > > > +- compatible : must be "ts,ts4800-syscon" > > > +- reg : physical base address and length of memory mapped region > > > + > > > +Example: > > > + > > > +syscon at b0010000 { > > > + compatible = "ts,ts4800-syscon"; > > > + reg = <0xb0010000 0x3d>; > > > +}; > > > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig > > > index 3f68dd2..8f03dce 100644 > > > --- a/drivers/mfd/Kconfig > > > +++ b/drivers/mfd/Kconfig > > > @@ -1302,6 +1302,13 @@ config MFD_TC6393XB > > > help > > > Support for Toshiba Mobile IO Controller TC6393XB > > > > > > +config MFD_TS4800_SYSCON > > > + tristate "TS-4800 Syscon Support" > > > + select REGMAP > > > + select REGMAP_MMIO > > > + help > > > + Support for TS-4800's FPGA Syscon registers > > > + > > > config MFD_VX855 > > > tristate "VIA VX855/VX875 integrated south bridge" > > > depends on PCI > > > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile > > > index ea40e07..e2c0f1b 100644 > > > --- a/drivers/mfd/Makefile > > > +++ b/drivers/mfd/Makefile > > > @@ -181,6 +181,7 @@ obj-$(CONFIG_MFD_HI6421_PMIC) += hi6421-pmic-core.o > > > obj-$(CONFIG_MFD_DLN2) += dln2.o > > > obj-$(CONFIG_MFD_RT5033) += rt5033.o > > > obj-$(CONFIG_MFD_SKY81452) += sky81452.o > > > +obj-$(CONFIG_MFD_TS4800_SYSCON) += ts4800-syscon.o > > > > > > intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o > > > obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o > > > diff --git a/drivers/mfd/ts4800-syscon.c b/drivers/mfd/ts4800-syscon.c > > > new file mode 100644 > > > index 0000000..1e42e96 > > > --- /dev/null > > > +++ b/drivers/mfd/ts4800-syscon.c > > > @@ -0,0 +1,84 @@ > > > +/* > > > + * Device driver for TS-4800 FPGA's syscon > > > + * > > > + * Copyright (c) 2015 - Savoir-faire Linux > > > + * > > > + * This program is free software; you can redistribute it and/or modify > > > + * it under the terms of the GNU General Public License as published by > > > + * the Free Software Foundation; either version 2 of the License, or > > > + * (at your option) any later version. > > > > Why is the MFD v2+ and the Watchdog driver only v2? > > > > > + * This program is distributed in the hope it will be useful, but WITHOUT > > > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > > > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > > > + * more details. > > > + */ > > > + > > > +#include <linux/device.h> > > > +#include <linux/err.h> > > > +#include <linux/mfd/core.h> > > > +#include <linux/module.h> > > > +#include <linux/of.h> > > > +#include <linux/platform_device.h> > > > +#include <linux/regmap.h> > > > +#include <linux/mfd/ts4800-syscon.h> > > > > Alphabetical. > > > > > + > > > + > > > > Superfluous '\n'. > > > > > +static const struct regmap_config ts4800_regmap_config = { > > > + .reg_bits = 32, > > > + .reg_stride = 2, > > > + .val_bits = 16, > > > +}; > > > + > > > +static int ts4800_syscon_probe(struct platform_device *pdev) > > > +{ > > > + struct ts4800_syscon *syscon; > > > + struct resource *res; > > > + void __iomem *base; > > > + > > > + syscon = devm_kzalloc(&pdev->dev, sizeof(*syscon), GFP_KERNEL); > > > + if (!syscon) > > > + return -ENOMEM; > > > + > > > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > > > + base = devm_ioremap_resource(&pdev->dev, res); > > > + if (IS_ERR(base)) > > > + return PTR_ERR(base); > > > + > > > + syscon->regmap = devm_regmap_init_mmio_clk(&pdev->dev, NULL, base, > > > + &ts4800_regmap_config); > > > + if (IS_ERR(syscon->regmap)) { > > > + dev_err(&pdev->dev, > > > + "regmap init failed: %ld\n", > > > + PTR_ERR(syscon->regmap)); > > > + return PTR_ERR(syscon->regmap); > > > + } > > > + > > > + platform_set_drvdata(pdev, syscon); > > > + > > > + return 0; > > > +} > > > + > > > +static int ts4800_syscon_remove(struct platform_device *pdev) > > > +{ > > > + return 0; > > > +} > > > > If it doesn't do anything, don't provide it. > > > > > +static const struct of_device_id ts4800_syscon_of_match[] = { > > > + { .compatible = "ts,ts4800-syscon", }, > > > + { }, > > > +}; > > > + > > > +static struct platform_driver ts4800_syscon_driver = { > > > + .driver = { > > > + .name = "ts4800_syscon", > > > + .of_match_table = ts4800_syscon_of_match, > > > + }, > > > + .probe = ts4800_syscon_probe, > > > + .remove = ts4800_syscon_remove, > > > +}; > > > +module_platform_driver(ts4800_syscon_driver); > > > + > > > +MODULE_AUTHOR("Damien Riegel <damien.riegel@savoirfairelinux.com>"); > > > +MODULE_DESCRIPTION("TS-4800 Syscon driver"); > > > +MODULE_LICENSE("GPL v2"); > > > > This does not match the header. > > > > > diff --git a/include/linux/mfd/ts4800-syscon.h b/include/linux/mfd/ts4800-syscon.h > > > new file mode 100644 > > > index 0000000..3d29184 > > > --- /dev/null > > > +++ b/include/linux/mfd/ts4800-syscon.h > > > @@ -0,0 +1,24 @@ > > > +/* > > > + * Copyright (c) 2015 - Savoir-faire Linux > > > + * > > > + * This program is free software; you can redistribute it and/or modify > > > + * it under the terms of the GNU General Public License as published by > > > + * the Free Software Foundation; either version 2 of the License, or > > > + * (at your option) any later version. > > > + * > > > + * This program is distributed in the hope it will be useful, but WITHOUT > > > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > > > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > > > + * more details. > > > + */ > > > + > > > +#ifndef __LINUX_MFD_TS4800_SYSCON_H > > > +#define __LINUX_MFD_TS4800_SYSCON_H > > > + > > > +#include <linux/regmap.h> > > > + > > > +struct ts4800_syscon { > > > + struct regmap *regmap; > > > +}; > > > + > > > +#endif /* __LINUX_MFD_TS4800_SYSCON_H */ > > -- 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] 52+ messages in thread
* Re: [PATCH v2 2/5] mfd: ts4800-syscon: add driver for TS-4800 syscon 2015-11-02 9:12 ` Lee Jones @ 2015-11-02 18:13 ` Damien Riegel -1 siblings, 0 replies; 52+ messages in thread From: Damien Riegel @ 2015-11-02 18:13 UTC (permalink / raw) To: Lee Jones Cc: linux-kernel, linux-arm-kernel, linux-watchdog, shawnguo, kernel, wim, robh+dt, sameo, dinh.linux, linux, kernel, arnd On Mon, Nov 02, 2015 at 09:12:53AM +0000, Lee Jones wrote: > [Cc'ing Arnd] > > On Fri, 30 Oct 2015, Damien Riegel wrote: > > On Fri, Oct 30, 2015 at 05:56:56PM +0000, Lee Jones wrote: > > > On Thu, 29 Oct 2015, Damien Riegel wrote: > > > > > > > Driver for TS-4800 syscon. These registers belong to a FPGA that is > > > > memory mapped and are used for counters, enable various IPs in the FPGA, > > > > control LEDs, control IOs, etc. > > > > > > > > Currently, only the watchdog is handled. > > > > > > Why do you require your own syscon driver? > > > > > > What's wrong with the generic one? > > > > > > > The generic one uses a regmap_config with reg_stride set to 4 and val_bits > > to 32. > > > > TS-4800 syscon registers are 16-bit wide and must be accessed with 16 > > bit read and writes: > > http://wiki.embeddedarm.com/wiki/TS-4800#Syscon > > > > I will address the other issues in the next version (split commit, > > license issue, style, and superfluous remove). > > The Syscon driver was written to be generic so that each > vendor/platform didn't require their own incarnation. How unique is > the TS-4800? > > Perhaps it might be better to supply a generic 16 bit Syscon for > devices akin to the TS-4800? The TS-4800 syscon could use a generic 16-bit syscon. There is nothing specific that requires a driver besides that. We could add some optional properties to the generic syscon node to configure reg_bits, val_bits, and reg_stride (and pad_bits ?). Would that be a good solution ? > Arnd, any opinion on this? > ^ permalink raw reply [flat|nested] 52+ messages in thread
* [PATCH v2 2/5] mfd: ts4800-syscon: add driver for TS-4800 syscon @ 2015-11-02 18:13 ` Damien Riegel 0 siblings, 0 replies; 52+ messages in thread From: Damien Riegel @ 2015-11-02 18:13 UTC (permalink / raw) To: linux-arm-kernel On Mon, Nov 02, 2015 at 09:12:53AM +0000, Lee Jones wrote: > [Cc'ing Arnd] > > On Fri, 30 Oct 2015, Damien Riegel wrote: > > On Fri, Oct 30, 2015 at 05:56:56PM +0000, Lee Jones wrote: > > > On Thu, 29 Oct 2015, Damien Riegel wrote: > > > > > > > Driver for TS-4800 syscon. These registers belong to a FPGA that is > > > > memory mapped and are used for counters, enable various IPs in the FPGA, > > > > control LEDs, control IOs, etc. > > > > > > > > Currently, only the watchdog is handled. > > > > > > Why do you require your own syscon driver? > > > > > > What's wrong with the generic one? > > > > > > > The generic one uses a regmap_config with reg_stride set to 4 and val_bits > > to 32. > > > > TS-4800 syscon registers are 16-bit wide and must be accessed with 16 > > bit read and writes: > > http://wiki.embeddedarm.com/wiki/TS-4800#Syscon > > > > I will address the other issues in the next version (split commit, > > license issue, style, and superfluous remove). > > The Syscon driver was written to be generic so that each > vendor/platform didn't require their own incarnation. How unique is > the TS-4800? > > Perhaps it might be better to supply a generic 16 bit Syscon for > devices akin to the TS-4800? The TS-4800 syscon could use a generic 16-bit syscon. There is nothing specific that requires a driver besides that. We could add some optional properties to the generic syscon node to configure reg_bits, val_bits, and reg_stride (and pad_bits ?). Would that be a good solution ? > Arnd, any opinion on this? > ^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v2 2/5] mfd: ts4800-syscon: add driver for TS-4800 syscon 2015-11-02 18:13 ` Damien Riegel (?) @ 2015-11-03 8:38 ` Lee Jones -1 siblings, 0 replies; 52+ messages in thread From: Lee Jones @ 2015-11-03 8:38 UTC (permalink / raw) To: Damien Riegel Cc: linux-kernel, linux-arm-kernel, linux-watchdog, shawnguo, kernel, wim, robh+dt, sameo, dinh.linux, linux, kernel, arnd On Mon, 02 Nov 2015, Damien Riegel wrote: > On Mon, Nov 02, 2015 at 09:12:53AM +0000, Lee Jones wrote: > > [Cc'ing Arnd] > > > > On Fri, 30 Oct 2015, Damien Riegel wrote: > > > On Fri, Oct 30, 2015 at 05:56:56PM +0000, Lee Jones wrote: > > > > On Thu, 29 Oct 2015, Damien Riegel wrote: > > > > > > > > > Driver for TS-4800 syscon. These registers belong to a FPGA that is > > > > > memory mapped and are used for counters, enable various IPs in the FPGA, > > > > > control LEDs, control IOs, etc. > > > > > > > > > > Currently, only the watchdog is handled. > > > > > > > > Why do you require your own syscon driver? > > > > > > > > What's wrong with the generic one? > > > > > > > > > > The generic one uses a regmap_config with reg_stride set to 4 and val_bits > > > to 32. > > > > > > TS-4800 syscon registers are 16-bit wide and must be accessed with 16 > > > bit read and writes: > > > http://wiki.embeddedarm.com/wiki/TS-4800#Syscon > > > > > > I will address the other issues in the next version (split commit, > > > license issue, style, and superfluous remove). > > > > The Syscon driver was written to be generic so that each > > vendor/platform didn't require their own incarnation. How unique is > > the TS-4800? > > > > Perhaps it might be better to supply a generic 16 bit Syscon for > > devices akin to the TS-4800? > > The TS-4800 syscon could use a generic 16-bit syscon. There is nothing > specific that requires a driver besides that. > > We could add some optional properties to the generic syscon node to > configure reg_bits, val_bits, and reg_stride (and pad_bits ?). Would > that be a good solution ? Without looking at the ramifications of such an addition, the premise sounds good to me. So long as the current behaviour remains the default. > > Arnd, any opinion on this? -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog -- To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v2 2/5] mfd: ts4800-syscon: add driver for TS-4800 syscon @ 2015-11-03 8:38 ` Lee Jones 0 siblings, 0 replies; 52+ messages in thread From: Lee Jones @ 2015-11-03 8:38 UTC (permalink / raw) To: Damien Riegel Cc: linux-kernel, linux-arm-kernel, linux-watchdog, shawnguo, kernel, wim, robh+dt, sameo, dinh.linux, linux, kernel, arnd On Mon, 02 Nov 2015, Damien Riegel wrote: > On Mon, Nov 02, 2015 at 09:12:53AM +0000, Lee Jones wrote: > > [Cc'ing Arnd] > > > > On Fri, 30 Oct 2015, Damien Riegel wrote: > > > On Fri, Oct 30, 2015 at 05:56:56PM +0000, Lee Jones wrote: > > > > On Thu, 29 Oct 2015, Damien Riegel wrote: > > > > > > > > > Driver for TS-4800 syscon. These registers belong to a FPGA that is > > > > > memory mapped and are used for counters, enable various IPs in the FPGA, > > > > > control LEDs, control IOs, etc. > > > > > > > > > > Currently, only the watchdog is handled. > > > > > > > > Why do you require your own syscon driver? > > > > > > > > What's wrong with the generic one? > > > > > > > > > > The generic one uses a regmap_config with reg_stride set to 4 and val_bits > > > to 32. > > > > > > TS-4800 syscon registers are 16-bit wide and must be accessed with 16 > > > bit read and writes: > > > http://wiki.embeddedarm.com/wiki/TS-4800#Syscon > > > > > > I will address the other issues in the next version (split commit, > > > license issue, style, and superfluous remove). > > > > The Syscon driver was written to be generic so that each > > vendor/platform didn't require their own incarnation. How unique is > > the TS-4800? > > > > Perhaps it might be better to supply a generic 16 bit Syscon for > > devices akin to the TS-4800? > > The TS-4800 syscon could use a generic 16-bit syscon. There is nothing > specific that requires a driver besides that. > > We could add some optional properties to the generic syscon node to > configure reg_bits, val_bits, and reg_stride (and pad_bits ?). Would > that be a good solution ? Without looking at the ramifications of such an addition, the premise sounds good to me. So long as the current behaviour remains the default. > > Arnd, any opinion on this? -- 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] 52+ messages in thread
* [PATCH v2 2/5] mfd: ts4800-syscon: add driver for TS-4800 syscon @ 2015-11-03 8:38 ` Lee Jones 0 siblings, 0 replies; 52+ messages in thread From: Lee Jones @ 2015-11-03 8:38 UTC (permalink / raw) To: linux-arm-kernel On Mon, 02 Nov 2015, Damien Riegel wrote: > On Mon, Nov 02, 2015 at 09:12:53AM +0000, Lee Jones wrote: > > [Cc'ing Arnd] > > > > On Fri, 30 Oct 2015, Damien Riegel wrote: > > > On Fri, Oct 30, 2015 at 05:56:56PM +0000, Lee Jones wrote: > > > > On Thu, 29 Oct 2015, Damien Riegel wrote: > > > > > > > > > Driver for TS-4800 syscon. These registers belong to a FPGA that is > > > > > memory mapped and are used for counters, enable various IPs in the FPGA, > > > > > control LEDs, control IOs, etc. > > > > > > > > > > Currently, only the watchdog is handled. > > > > > > > > Why do you require your own syscon driver? > > > > > > > > What's wrong with the generic one? > > > > > > > > > > The generic one uses a regmap_config with reg_stride set to 4 and val_bits > > > to 32. > > > > > > TS-4800 syscon registers are 16-bit wide and must be accessed with 16 > > > bit read and writes: > > > http://wiki.embeddedarm.com/wiki/TS-4800#Syscon > > > > > > I will address the other issues in the next version (split commit, > > > license issue, style, and superfluous remove). > > > > The Syscon driver was written to be generic so that each > > vendor/platform didn't require their own incarnation. How unique is > > the TS-4800? > > > > Perhaps it might be better to supply a generic 16 bit Syscon for > > devices akin to the TS-4800? > > The TS-4800 syscon could use a generic 16-bit syscon. There is nothing > specific that requires a driver besides that. > > We could add some optional properties to the generic syscon node to > configure reg_bits, val_bits, and reg_stride (and pad_bits ?). Would > that be a good solution ? Without looking at the ramifications of such an addition, the premise sounds good to me. So long as the current behaviour remains the default. > > Arnd, any opinion on this? -- 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] 52+ messages in thread
* Re: [PATCH v2 2/5] mfd: ts4800-syscon: add driver for TS-4800 syscon 2015-11-03 8:38 ` Lee Jones (?) @ 2015-11-03 8:39 ` Lee Jones -1 siblings, 0 replies; 52+ messages in thread From: Lee Jones @ 2015-11-03 8:39 UTC (permalink / raw) To: Damien Riegel Cc: linux-kernel, linux-arm-kernel, linux-watchdog, shawnguo, kernel, wim, robh+dt, sameo, dinh.linux, linux, kernel, arnd On Tue, 03 Nov 2015, Lee Jones wrote: > On Mon, 02 Nov 2015, Damien Riegel wrote: > > On Mon, Nov 02, 2015 at 09:12:53AM +0000, Lee Jones wrote: > > > [Cc'ing Arnd] > > > > > > On Fri, 30 Oct 2015, Damien Riegel wrote: > > > > On Fri, Oct 30, 2015 at 05:56:56PM +0000, Lee Jones wrote: > > > > > On Thu, 29 Oct 2015, Damien Riegel wrote: > > > > > > > > > > > Driver for TS-4800 syscon. These registers belong to a FPGA that is > > > > > > memory mapped and are used for counters, enable various IPs in the FPGA, > > > > > > control LEDs, control IOs, etc. > > > > > > > > > > > > Currently, only the watchdog is handled. > > > > > > > > > > Why do you require your own syscon driver? > > > > > > > > > > What's wrong with the generic one? > > > > > > > > > > > > > The generic one uses a regmap_config with reg_stride set to 4 and val_bits > > > > to 32. > > > > > > > > TS-4800 syscon registers are 16-bit wide and must be accessed with 16 > > > > bit read and writes: > > > > http://wiki.embeddedarm.com/wiki/TS-4800#Syscon > > > > > > > > I will address the other issues in the next version (split commit, > > > > license issue, style, and superfluous remove). > > > > > > The Syscon driver was written to be generic so that each > > > vendor/platform didn't require their own incarnation. How unique is > > > the TS-4800? > > > > > > Perhaps it might be better to supply a generic 16 bit Syscon for > > > devices akin to the TS-4800? > > > > The TS-4800 syscon could use a generic 16-bit syscon. There is nothing > > specific that requires a driver besides that. > > > > We could add some optional properties to the generic syscon node to > > configure reg_bits, val_bits, and reg_stride (and pad_bits ?). Would > > that be a good solution ? > > Without looking at the ramifications of such an addition, the premise > sounds good to me. So long as the current behaviour remains the > default. Perhaps a "syscon-16bit" compatible might be in order? > > > Arnd, any opinion on this? > -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog -- To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v2 2/5] mfd: ts4800-syscon: add driver for TS-4800 syscon @ 2015-11-03 8:39 ` Lee Jones 0 siblings, 0 replies; 52+ messages in thread From: Lee Jones @ 2015-11-03 8:39 UTC (permalink / raw) To: Damien Riegel Cc: linux-kernel, linux-arm-kernel, linux-watchdog, shawnguo, kernel, wim, robh+dt, sameo, dinh.linux, linux, kernel, arnd On Tue, 03 Nov 2015, Lee Jones wrote: > On Mon, 02 Nov 2015, Damien Riegel wrote: > > On Mon, Nov 02, 2015 at 09:12:53AM +0000, Lee Jones wrote: > > > [Cc'ing Arnd] > > > > > > On Fri, 30 Oct 2015, Damien Riegel wrote: > > > > On Fri, Oct 30, 2015 at 05:56:56PM +0000, Lee Jones wrote: > > > > > On Thu, 29 Oct 2015, Damien Riegel wrote: > > > > > > > > > > > Driver for TS-4800 syscon. These registers belong to a FPGA that is > > > > > > memory mapped and are used for counters, enable various IPs in the FPGA, > > > > > > control LEDs, control IOs, etc. > > > > > > > > > > > > Currently, only the watchdog is handled. > > > > > > > > > > Why do you require your own syscon driver? > > > > > > > > > > What's wrong with the generic one? > > > > > > > > > > > > > The generic one uses a regmap_config with reg_stride set to 4 and val_bits > > > > to 32. > > > > > > > > TS-4800 syscon registers are 16-bit wide and must be accessed with 16 > > > > bit read and writes: > > > > http://wiki.embeddedarm.com/wiki/TS-4800#Syscon > > > > > > > > I will address the other issues in the next version (split commit, > > > > license issue, style, and superfluous remove). > > > > > > The Syscon driver was written to be generic so that each > > > vendor/platform didn't require their own incarnation. How unique is > > > the TS-4800? > > > > > > Perhaps it might be better to supply a generic 16 bit Syscon for > > > devices akin to the TS-4800? > > > > The TS-4800 syscon could use a generic 16-bit syscon. There is nothing > > specific that requires a driver besides that. > > > > We could add some optional properties to the generic syscon node to > > configure reg_bits, val_bits, and reg_stride (and pad_bits ?). Would > > that be a good solution ? > > Without looking at the ramifications of such an addition, the premise > sounds good to me. So long as the current behaviour remains the > default. Perhaps a "syscon-16bit" compatible might be in order? > > > Arnd, any opinion on this? > -- 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] 52+ messages in thread
* [PATCH v2 2/5] mfd: ts4800-syscon: add driver for TS-4800 syscon @ 2015-11-03 8:39 ` Lee Jones 0 siblings, 0 replies; 52+ messages in thread From: Lee Jones @ 2015-11-03 8:39 UTC (permalink / raw) To: linux-arm-kernel On Tue, 03 Nov 2015, Lee Jones wrote: > On Mon, 02 Nov 2015, Damien Riegel wrote: > > On Mon, Nov 02, 2015 at 09:12:53AM +0000, Lee Jones wrote: > > > [Cc'ing Arnd] > > > > > > On Fri, 30 Oct 2015, Damien Riegel wrote: > > > > On Fri, Oct 30, 2015 at 05:56:56PM +0000, Lee Jones wrote: > > > > > On Thu, 29 Oct 2015, Damien Riegel wrote: > > > > > > > > > > > Driver for TS-4800 syscon. These registers belong to a FPGA that is > > > > > > memory mapped and are used for counters, enable various IPs in the FPGA, > > > > > > control LEDs, control IOs, etc. > > > > > > > > > > > > Currently, only the watchdog is handled. > > > > > > > > > > Why do you require your own syscon driver? > > > > > > > > > > What's wrong with the generic one? > > > > > > > > > > > > > The generic one uses a regmap_config with reg_stride set to 4 and val_bits > > > > to 32. > > > > > > > > TS-4800 syscon registers are 16-bit wide and must be accessed with 16 > > > > bit read and writes: > > > > http://wiki.embeddedarm.com/wiki/TS-4800#Syscon > > > > > > > > I will address the other issues in the next version (split commit, > > > > license issue, style, and superfluous remove). > > > > > > The Syscon driver was written to be generic so that each > > > vendor/platform didn't require their own incarnation. How unique is > > > the TS-4800? > > > > > > Perhaps it might be better to supply a generic 16 bit Syscon for > > > devices akin to the TS-4800? > > > > The TS-4800 syscon could use a generic 16-bit syscon. There is nothing > > specific that requires a driver besides that. > > > > We could add some optional properties to the generic syscon node to > > configure reg_bits, val_bits, and reg_stride (and pad_bits ?). Would > > that be a good solution ? > > Without looking at the ramifications of such an addition, the premise > sounds good to me. So long as the current behaviour remains the > default. Perhaps a "syscon-16bit" compatible might be in order? > > > Arnd, any opinion on this? > -- 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] 52+ messages in thread
* Re: [PATCH v2 2/5] mfd: ts4800-syscon: add driver for TS-4800 syscon 2015-11-03 8:39 ` Lee Jones @ 2015-11-03 8:40 ` Arnd Bergmann -1 siblings, 0 replies; 52+ messages in thread From: Arnd Bergmann @ 2015-11-03 8:40 UTC (permalink / raw) To: Lee Jones Cc: Damien Riegel, linux-kernel, linux-arm-kernel, linux-watchdog, shawnguo, kernel, wim, robh+dt, sameo, dinh.linux, linux, kernel On Tuesday 03 November 2015 08:39:23 Lee Jones wrote: > On Tue, 03 Nov 2015, Lee Jones wrote: > > > On Mon, 02 Nov 2015, Damien Riegel wrote: > > > On Mon, Nov 02, 2015 at 09:12:53AM +0000, Lee Jones wrote: > > > > [Cc'ing Arnd] > > > > > > > > On Fri, 30 Oct 2015, Damien Riegel wrote: > > > > > On Fri, Oct 30, 2015 at 05:56:56PM +0000, Lee Jones wrote: > > > > > > On Thu, 29 Oct 2015, Damien Riegel wrote: > > > > > > > > > > > > > Driver for TS-4800 syscon. These registers belong to a FPGA that is > > > > > > > memory mapped and are used for counters, enable various IPs in the FPGA, > > > > > > > control LEDs, control IOs, etc. > > > > > > > > > > > > > > Currently, only the watchdog is handled. > > > > > > > > > > > > Why do you require your own syscon driver? > > > > > > > > > > > > What's wrong with the generic one? > > > > > > > > > > > > > > > > The generic one uses a regmap_config with reg_stride set to 4 and val_bits > > > > > to 32. > > > > > > > > > > TS-4800 syscon registers are 16-bit wide and must be accessed with 16 > > > > > bit read and writes: > > > > > http://wiki.embeddedarm.com/wiki/TS-4800#Syscon > > > > > > > > > > I will address the other issues in the next version (split commit, > > > > > license issue, style, and superfluous remove). > > > > > > > > The Syscon driver was written to be generic so that each > > > > vendor/platform didn't require their own incarnation. How unique is > > > > the TS-4800? > > > > > > > > Perhaps it might be better to supply a generic 16 bit Syscon for > > > > devices akin to the TS-4800? > > > > > > The TS-4800 syscon could use a generic 16-bit syscon. There is nothing > > > specific that requires a driver besides that. > > > > > > We could add some optional properties to the generic syscon node to > > > configure reg_bits, val_bits, and reg_stride (and pad_bits ?). Would > > > that be a good solution ? > > > > Without looking at the ramifications of such an addition, the premise > > sounds good to me. So long as the current behaviour remains the > > default. > > Perhaps a "syscon-16bit" compatible might be in order? > > I think a 'buswidth=<16>;' property in addition to 'compatible="syscon"' is more in line with what other subsystems do. Arnd ^ permalink raw reply [flat|nested] 52+ messages in thread
* [PATCH v2 2/5] mfd: ts4800-syscon: add driver for TS-4800 syscon @ 2015-11-03 8:40 ` Arnd Bergmann 0 siblings, 0 replies; 52+ messages in thread From: Arnd Bergmann @ 2015-11-03 8:40 UTC (permalink / raw) To: linux-arm-kernel On Tuesday 03 November 2015 08:39:23 Lee Jones wrote: > On Tue, 03 Nov 2015, Lee Jones wrote: > > > On Mon, 02 Nov 2015, Damien Riegel wrote: > > > On Mon, Nov 02, 2015 at 09:12:53AM +0000, Lee Jones wrote: > > > > [Cc'ing Arnd] > > > > > > > > On Fri, 30 Oct 2015, Damien Riegel wrote: > > > > > On Fri, Oct 30, 2015 at 05:56:56PM +0000, Lee Jones wrote: > > > > > > On Thu, 29 Oct 2015, Damien Riegel wrote: > > > > > > > > > > > > > Driver for TS-4800 syscon. These registers belong to a FPGA that is > > > > > > > memory mapped and are used for counters, enable various IPs in the FPGA, > > > > > > > control LEDs, control IOs, etc. > > > > > > > > > > > > > > Currently, only the watchdog is handled. > > > > > > > > > > > > Why do you require your own syscon driver? > > > > > > > > > > > > What's wrong with the generic one? > > > > > > > > > > > > > > > > The generic one uses a regmap_config with reg_stride set to 4 and val_bits > > > > > to 32. > > > > > > > > > > TS-4800 syscon registers are 16-bit wide and must be accessed with 16 > > > > > bit read and writes: > > > > > http://wiki.embeddedarm.com/wiki/TS-4800#Syscon > > > > > > > > > > I will address the other issues in the next version (split commit, > > > > > license issue, style, and superfluous remove). > > > > > > > > The Syscon driver was written to be generic so that each > > > > vendor/platform didn't require their own incarnation. How unique is > > > > the TS-4800? > > > > > > > > Perhaps it might be better to supply a generic 16 bit Syscon for > > > > devices akin to the TS-4800? > > > > > > The TS-4800 syscon could use a generic 16-bit syscon. There is nothing > > > specific that requires a driver besides that. > > > > > > We could add some optional properties to the generic syscon node to > > > configure reg_bits, val_bits, and reg_stride (and pad_bits ?). Would > > > that be a good solution ? > > > > Without looking at the ramifications of such an addition, the premise > > sounds good to me. So long as the current behaviour remains the > > default. > > Perhaps a "syscon-16bit" compatible might be in order? > > I think a 'buswidth=<16>;' property in addition to 'compatible="syscon"' is more in line with what other subsystems do. Arnd ^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v2 2/5] mfd: ts4800-syscon: add driver for TS-4800 syscon 2015-11-03 8:40 ` Arnd Bergmann (?) @ 2015-11-03 10:12 ` Lee Jones -1 siblings, 0 replies; 52+ messages in thread From: Lee Jones @ 2015-11-03 10:12 UTC (permalink / raw) To: Arnd Bergmann Cc: Damien Riegel, linux-kernel, linux-arm-kernel, linux-watchdog, shawnguo, kernel, wim, robh+dt, sameo, dinh.linux, linux, kernel On Tue, 03 Nov 2015, Arnd Bergmann wrote: > On Tuesday 03 November 2015 08:39:23 Lee Jones wrote: > > On Tue, 03 Nov 2015, Lee Jones wrote: > > > > > On Mon, 02 Nov 2015, Damien Riegel wrote: > > > > On Mon, Nov 02, 2015 at 09:12:53AM +0000, Lee Jones wrote: > > > > > [Cc'ing Arnd] > > > > > > > > > > On Fri, 30 Oct 2015, Damien Riegel wrote: > > > > > > On Fri, Oct 30, 2015 at 05:56:56PM +0000, Lee Jones wrote: > > > > > > > On Thu, 29 Oct 2015, Damien Riegel wrote: > > > > > > > > > > > > > > > Driver for TS-4800 syscon. These registers belong to a FPGA that is > > > > > > > > memory mapped and are used for counters, enable various IPs in the FPGA, > > > > > > > > control LEDs, control IOs, etc. > > > > > > > > > > > > > > > > Currently, only the watchdog is handled. > > > > > > > > > > > > > > Why do you require your own syscon driver? > > > > > > > > > > > > > > What's wrong with the generic one? > > > > > > > > > > > > > > > > > > > The generic one uses a regmap_config with reg_stride set to 4 and val_bits > > > > > > to 32. > > > > > > > > > > > > TS-4800 syscon registers are 16-bit wide and must be accessed with 16 > > > > > > bit read and writes: > > > > > > http://wiki.embeddedarm.com/wiki/TS-4800#Syscon > > > > > > > > > > > > I will address the other issues in the next version (split commit, > > > > > > license issue, style, and superfluous remove). > > > > > > > > > > The Syscon driver was written to be generic so that each > > > > > vendor/platform didn't require their own incarnation. How unique is > > > > > the TS-4800? > > > > > > > > > > Perhaps it might be better to supply a generic 16 bit Syscon for > > > > > devices akin to the TS-4800? > > > > > > > > The TS-4800 syscon could use a generic 16-bit syscon. There is nothing > > > > specific that requires a driver besides that. > > > > > > > > We could add some optional properties to the generic syscon node to > > > > configure reg_bits, val_bits, and reg_stride (and pad_bits ?). Would > > > > that be a good solution ? > > > > > > Without looking at the ramifications of such an addition, the premise > > > sounds good to me. So long as the current behaviour remains the > > > default. > > > > Perhaps a "syscon-16bit" compatible might be in order? > > > > > > I think a 'buswidth=<16>;' property in addition to 'compatible="syscon"' > is more in line with what other subsystems do. Perfect. Are you happy coding this up Damien? -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog -- To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v2 2/5] mfd: ts4800-syscon: add driver for TS-4800 syscon @ 2015-11-03 10:12 ` Lee Jones 0 siblings, 0 replies; 52+ messages in thread From: Lee Jones @ 2015-11-03 10:12 UTC (permalink / raw) To: Arnd Bergmann Cc: Damien Riegel, linux-kernel, linux-arm-kernel, linux-watchdog, shawnguo, kernel, wim, robh+dt, sameo, dinh.linux, linux, kernel On Tue, 03 Nov 2015, Arnd Bergmann wrote: > On Tuesday 03 November 2015 08:39:23 Lee Jones wrote: > > On Tue, 03 Nov 2015, Lee Jones wrote: > > > > > On Mon, 02 Nov 2015, Damien Riegel wrote: > > > > On Mon, Nov 02, 2015 at 09:12:53AM +0000, Lee Jones wrote: > > > > > [Cc'ing Arnd] > > > > > > > > > > On Fri, 30 Oct 2015, Damien Riegel wrote: > > > > > > On Fri, Oct 30, 2015 at 05:56:56PM +0000, Lee Jones wrote: > > > > > > > On Thu, 29 Oct 2015, Damien Riegel wrote: > > > > > > > > > > > > > > > Driver for TS-4800 syscon. These registers belong to a FPGA that is > > > > > > > > memory mapped and are used for counters, enable various IPs in the FPGA, > > > > > > > > control LEDs, control IOs, etc. > > > > > > > > > > > > > > > > Currently, only the watchdog is handled. > > > > > > > > > > > > > > Why do you require your own syscon driver? > > > > > > > > > > > > > > What's wrong with the generic one? > > > > > > > > > > > > > > > > > > > The generic one uses a regmap_config with reg_stride set to 4 and val_bits > > > > > > to 32. > > > > > > > > > > > > TS-4800 syscon registers are 16-bit wide and must be accessed with 16 > > > > > > bit read and writes: > > > > > > http://wiki.embeddedarm.com/wiki/TS-4800#Syscon > > > > > > > > > > > > I will address the other issues in the next version (split commit, > > > > > > license issue, style, and superfluous remove). > > > > > > > > > > The Syscon driver was written to be generic so that each > > > > > vendor/platform didn't require their own incarnation. How unique is > > > > > the TS-4800? > > > > > > > > > > Perhaps it might be better to supply a generic 16 bit Syscon for > > > > > devices akin to the TS-4800? > > > > > > > > The TS-4800 syscon could use a generic 16-bit syscon. There is nothing > > > > specific that requires a driver besides that. > > > > > > > > We could add some optional properties to the generic syscon node to > > > > configure reg_bits, val_bits, and reg_stride (and pad_bits ?). Would > > > > that be a good solution ? > > > > > > Without looking at the ramifications of such an addition, the premise > > > sounds good to me. So long as the current behaviour remains the > > > default. > > > > Perhaps a "syscon-16bit" compatible might be in order? > > > > > > I think a 'buswidth=<16>;' property in addition to 'compatible="syscon"' > is more in line with what other subsystems do. Perfect. Are you happy coding this up Damien? -- 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] 52+ messages in thread
* [PATCH v2 2/5] mfd: ts4800-syscon: add driver for TS-4800 syscon @ 2015-11-03 10:12 ` Lee Jones 0 siblings, 0 replies; 52+ messages in thread From: Lee Jones @ 2015-11-03 10:12 UTC (permalink / raw) To: linux-arm-kernel On Tue, 03 Nov 2015, Arnd Bergmann wrote: > On Tuesday 03 November 2015 08:39:23 Lee Jones wrote: > > On Tue, 03 Nov 2015, Lee Jones wrote: > > > > > On Mon, 02 Nov 2015, Damien Riegel wrote: > > > > On Mon, Nov 02, 2015 at 09:12:53AM +0000, Lee Jones wrote: > > > > > [Cc'ing Arnd] > > > > > > > > > > On Fri, 30 Oct 2015, Damien Riegel wrote: > > > > > > On Fri, Oct 30, 2015 at 05:56:56PM +0000, Lee Jones wrote: > > > > > > > On Thu, 29 Oct 2015, Damien Riegel wrote: > > > > > > > > > > > > > > > Driver for TS-4800 syscon. These registers belong to a FPGA that is > > > > > > > > memory mapped and are used for counters, enable various IPs in the FPGA, > > > > > > > > control LEDs, control IOs, etc. > > > > > > > > > > > > > > > > Currently, only the watchdog is handled. > > > > > > > > > > > > > > Why do you require your own syscon driver? > > > > > > > > > > > > > > What's wrong with the generic one? > > > > > > > > > > > > > > > > > > > The generic one uses a regmap_config with reg_stride set to 4 and val_bits > > > > > > to 32. > > > > > > > > > > > > TS-4800 syscon registers are 16-bit wide and must be accessed with 16 > > > > > > bit read and writes: > > > > > > http://wiki.embeddedarm.com/wiki/TS-4800#Syscon > > > > > > > > > > > > I will address the other issues in the next version (split commit, > > > > > > license issue, style, and superfluous remove). > > > > > > > > > > The Syscon driver was written to be generic so that each > > > > > vendor/platform didn't require their own incarnation. How unique is > > > > > the TS-4800? > > > > > > > > > > Perhaps it might be better to supply a generic 16 bit Syscon for > > > > > devices akin to the TS-4800? > > > > > > > > The TS-4800 syscon could use a generic 16-bit syscon. There is nothing > > > > specific that requires a driver besides that. > > > > > > > > We could add some optional properties to the generic syscon node to > > > > configure reg_bits, val_bits, and reg_stride (and pad_bits ?). Would > > > > that be a good solution ? > > > > > > Without looking at the ramifications of such an addition, the premise > > > sounds good to me. So long as the current behaviour remains the > > > default. > > > > Perhaps a "syscon-16bit" compatible might be in order? > > > > > > I think a 'buswidth=<16>;' property in addition to 'compatible="syscon"' > is more in line with what other subsystems do. Perfect. Are you happy coding this up Damien? -- 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] 52+ messages in thread
* Re: [PATCH v2 2/5] mfd: ts4800-syscon: add driver for TS-4800 syscon 2015-11-03 10:12 ` Lee Jones @ 2015-11-03 10:48 ` Arnd Bergmann -1 siblings, 0 replies; 52+ messages in thread From: Arnd Bergmann @ 2015-11-03 10:48 UTC (permalink / raw) To: Lee Jones Cc: Damien Riegel, linux-kernel, linux-arm-kernel, linux-watchdog, shawnguo, kernel, wim, robh+dt, sameo, dinh.linux, linux, kernel On Tuesday 03 November 2015 10:12:17 Lee Jones wrote: > > > > I think a 'buswidth=<16>;' property in addition to 'compatible="syscon"' > > is more in line with what other subsystems do. > > Perfect. > Just to clarify: I just checked the other DT bindings and it should actually be "bus-width", not "buswidth". Arnd ^ permalink raw reply [flat|nested] 52+ messages in thread
* [PATCH v2 2/5] mfd: ts4800-syscon: add driver for TS-4800 syscon @ 2015-11-03 10:48 ` Arnd Bergmann 0 siblings, 0 replies; 52+ messages in thread From: Arnd Bergmann @ 2015-11-03 10:48 UTC (permalink / raw) To: linux-arm-kernel On Tuesday 03 November 2015 10:12:17 Lee Jones wrote: > > > > I think a 'buswidth=<16>;' property in addition to 'compatible="syscon"' > > is more in line with what other subsystems do. > > Perfect. > Just to clarify: I just checked the other DT bindings and it should actually be "bus-width", not "buswidth". Arnd ^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v2 2/5] mfd: ts4800-syscon: add driver for TS-4800 syscon 2015-11-03 10:48 ` Arnd Bergmann @ 2015-11-03 14:36 ` Damien Riegel -1 siblings, 0 replies; 52+ messages in thread From: Damien Riegel @ 2015-11-03 14:36 UTC (permalink / raw) To: Arnd Bergmann Cc: Lee Jones, linux-kernel, linux-arm-kernel, linux-watchdog, shawnguo, kernel, wim, robh+dt, sameo, dinh.linux, linux, kernel On Tue, Nov 03, 2015 at 11:48:38AM +0100, Arnd Bergmann wrote: > On Tuesday 03 November 2015 10:12:17 Lee Jones wrote: > > > > > > I think a 'buswidth=<16>;' property in addition to 'compatible="syscon"' > > > is more in line with what other subsystems do. > > > > Perfect. > > > > Just to clarify: I just checked the other DT bindings and it should > actually be "bus-width", not "buswidth". Actually, I need the set the three following values of regmap_config: reg_bits, reg_stride, and val_bits. I had the following mapping in mind: @@ -69,6 +70,18 @@ static struct syscon *of_syscon_register(struct device_node *np) else if (of_property_read_bool(np, "little-endian")) syscon_config.val_format_endian = REGMAP_ENDIAN_LITTLE; + ret = of_property_read_u32(np, "reg-bits", &val); + if (!ret) + syscon_config.reg_bits = val; + + ret = of_property_read_u32(np, "val-bits", &val); + if (!ret) + syscon_config.val_bits = val; + + ret = of_property_read_u32(np, "reg-stride", &val); + if (!ret) + syscon_config.reg_stride = val; + regmap = regmap_init_mmio(NULL, base, &syscon_config); if (IS_ERR(regmap)) { pr_err("regmap init failed\n"); Would you prefer other property names, like "reg-bus-width", "val-bus-width", and "reg-stride"? Should I prefix them with "syscon,"? Damien ^ permalink raw reply [flat|nested] 52+ messages in thread
* [PATCH v2 2/5] mfd: ts4800-syscon: add driver for TS-4800 syscon @ 2015-11-03 14:36 ` Damien Riegel 0 siblings, 0 replies; 52+ messages in thread From: Damien Riegel @ 2015-11-03 14:36 UTC (permalink / raw) To: linux-arm-kernel On Tue, Nov 03, 2015 at 11:48:38AM +0100, Arnd Bergmann wrote: > On Tuesday 03 November 2015 10:12:17 Lee Jones wrote: > > > > > > I think a 'buswidth=<16>;' property in addition to 'compatible="syscon"' > > > is more in line with what other subsystems do. > > > > Perfect. > > > > Just to clarify: I just checked the other DT bindings and it should > actually be "bus-width", not "buswidth". Actually, I need the set the three following values of regmap_config: reg_bits, reg_stride, and val_bits. I had the following mapping in mind: @@ -69,6 +70,18 @@ static struct syscon *of_syscon_register(struct device_node *np) else if (of_property_read_bool(np, "little-endian")) syscon_config.val_format_endian = REGMAP_ENDIAN_LITTLE; + ret = of_property_read_u32(np, "reg-bits", &val); + if (!ret) + syscon_config.reg_bits = val; + + ret = of_property_read_u32(np, "val-bits", &val); + if (!ret) + syscon_config.val_bits = val; + + ret = of_property_read_u32(np, "reg-stride", &val); + if (!ret) + syscon_config.reg_stride = val; + regmap = regmap_init_mmio(NULL, base, &syscon_config); if (IS_ERR(regmap)) { pr_err("regmap init failed\n"); Would you prefer other property names, like "reg-bus-width", "val-bus-width", and "reg-stride"? Should I prefix them with "syscon,"? Damien ^ permalink raw reply [flat|nested] 52+ messages in thread
* [PATCH v2 3/5] watchdog: ts4800: add driver for TS-4800 watchdog 2015-10-29 20:27 ` Damien Riegel @ 2015-10-29 20:27 ` Damien Riegel -1 siblings, 0 replies; 52+ messages in thread From: Damien Riegel @ 2015-10-29 20:27 UTC (permalink / raw) To: linux-kernel, linux-arm-kernel, linux-watchdog Cc: shawnguo, kernel, wim, robh+dt, sameo, lee.jones, dinh.linux, linux, kernel, Damien Riegel Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> --- .../devicetree/bindings/mfd/ts4800-syscon.txt | 8 + .../devicetree/bindings/watchdog/ts4800-wdt.txt | 12 ++ drivers/mfd/Kconfig | 1 + drivers/mfd/ts4800-syscon.c | 13 +- drivers/watchdog/Kconfig | 10 + drivers/watchdog/Makefile | 1 + drivers/watchdog/ts4800_wdt.c | 216 +++++++++++++++++++++ 7 files changed, 260 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt create mode 100644 drivers/watchdog/ts4800_wdt.c diff --git a/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt index 8dbc12c..8c0fd1d 100644 --- a/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt +++ b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt @@ -4,9 +4,17 @@ Required properties: - compatible : must be "ts,ts4800-syscon" - reg : physical base address and length of memory mapped region +The driver exposes following subdevices: +- a watchdog: see ../watchdog/ts4800-wdt.txt + Example: syscon@b0010000 { compatible = "ts,ts4800-syscon"; reg = <0xb0010000 0x3d>; + + wdt@e { + compatible = "ts,ts4800-wdt"; + offset = <0xe>; + }; }; diff --git a/Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt b/Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt new file mode 100644 index 0000000..a9305c2 --- /dev/null +++ b/Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt @@ -0,0 +1,12 @@ +Technologic Systems Watchdog + +Required properties: +- compatible : must be "ts,ts4800-wdt" +- offset : offset of the feed register from syscon base + +Example: + +wdt1: wdt@b0010000 { + compatible = "ts,ts4800-wdt"; + offset = <0xe>; +}; diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 8f03dce..95ba036 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -1304,6 +1304,7 @@ config MFD_TC6393XB config MFD_TS4800_SYSCON tristate "TS-4800 Syscon Support" + select MFD_CORE select REGMAP select REGMAP_MMIO help diff --git a/drivers/mfd/ts4800-syscon.c b/drivers/mfd/ts4800-syscon.c index 1e42e96..03b3b04a 100644 --- a/drivers/mfd/ts4800-syscon.c +++ b/drivers/mfd/ts4800-syscon.c @@ -24,6 +24,13 @@ #include <linux/mfd/ts4800-syscon.h> +static const struct mfd_cell ts4800_syscon_cells[] = { + { + .name = "ts4800-watchdog", + .of_compatible = "ts,ts4800-wdt", + }, +}; + static const struct regmap_config ts4800_regmap_config = { .reg_bits = 32, .reg_stride = 2, @@ -56,11 +63,15 @@ static int ts4800_syscon_probe(struct platform_device *pdev) platform_set_drvdata(pdev, syscon); - return 0; + return mfd_add_devices(&pdev->dev, -1, ts4800_syscon_cells, + ARRAY_SIZE(ts4800_syscon_cells), + NULL, 0, NULL); } static int ts4800_syscon_remove(struct platform_device *pdev) { + mfd_remove_devices(&pdev->dev); + return 0; } diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 241fafd..aaa42b8 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -417,6 +417,16 @@ config NUC900_WATCHDOG To compile this driver as a module, choose M here: the module will be called nuc900_wdt. +config TS4800_WATCHDOG + tristate "TS-4800 Watchdog" + depends on OF + depends on MFD_TS4800_SYSCON + select WATCHDOG_CORE + help + Technologic Systems TS-4800 has watchdog timer implemented in + an external FPGA. Say Y here if you want to support for the + watchdog timer on TS-4800 board. + config TS72XX_WATCHDOG tristate "TS-72XX SBC Watchdog" depends on MACH_TS72XX diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index 59ea9a1..435fc93 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile @@ -52,6 +52,7 @@ obj-$(CONFIG_RN5T618_WATCHDOG) += rn5t618_wdt.o obj-$(CONFIG_COH901327_WATCHDOG) += coh901327_wdt.o obj-$(CONFIG_STMP3XXX_RTC_WATCHDOG) += stmp3xxx_rtc_wdt.o obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o +obj-$(CONFIG_TS4800_WATCHDOG) += ts4800_wdt.o obj-$(CONFIG_TS72XX_WATCHDOG) += ts72xx_wdt.o obj-$(CONFIG_IMX2_WDT) += imx2_wdt.o obj-$(CONFIG_UX500_WATCHDOG) += ux500_wdt.o diff --git a/drivers/watchdog/ts4800_wdt.c b/drivers/watchdog/ts4800_wdt.c new file mode 100644 index 0000000..9b9e638 --- /dev/null +++ b/drivers/watchdog/ts4800_wdt.c @@ -0,0 +1,216 @@ +/* + * ts4800_wdt.c - Watchdog driver for TS-4800 based boards + * + * Copyright (c) 2015 - Savoir-faire Linux + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/watchdog.h> +#include <linux/platform_device.h> +#include <linux/io.h> +#include <linux/of.h> +#include <linux/mfd/ts4800-syscon.h> + +static bool nowayout = WATCHDOG_NOWAYOUT; +module_param(nowayout, bool, 0); +MODULE_PARM_DESC(nowayout, + "Watchdog cannot be stopped once started (default=" + __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); + + +/* possible feed values */ +#define TS4800_WDT_FEED_2S 0x1 +#define TS4800_WDT_FEED_10S 0x2 +#define TS4800_WDT_DISABLE 0x3 + + +struct ts4800_wdt { + struct watchdog_device wdd; + struct regmap *regmap; + u32 feed_offset; + u16 feed_val; +}; + +/* + * TS-4800 supports the following timeout values: + * + * value desc + * --------------------- + * 0 feed for 338ms + * 1 feed for 2.706s + * 2 feed for 10.824s + * 3 disable watchdog + * + * Keep the regmap/timeout map ordered by timeout + */ +static const struct { + const int timeout; + const int regval; +} ts4800_wdt_map[] = { + { 2, TS4800_WDT_FEED_2S }, + { 10, TS4800_WDT_FEED_10S }, +}; + +static int timeout_to_regval(struct watchdog_device *wdd, int new_timeout) +{ + int i; + + new_timeout = clamp_val(new_timeout, + wdd->min_timeout, wdd->max_timeout); + + for (i = 0; i < ARRAY_SIZE(ts4800_wdt_map); i++) { + if (ts4800_wdt_map[i].timeout >= new_timeout) + return ts4800_wdt_map[i].timeout; + } + + return -EINVAL; +} + +static void ts4800_write_feed(struct ts4800_wdt *wdt, u16 val) +{ + regmap_write(wdt->regmap, wdt->feed_offset, val); +} + +static int ts4800_wdt_ping(struct watchdog_device *wdd) +{ + struct ts4800_wdt *wdt = watchdog_get_drvdata(wdd); + + ts4800_write_feed(wdt, wdt->feed_val); + return 0; +} + +static int ts4800_wdt_stop(struct watchdog_device *wdd) +{ + struct ts4800_wdt *wdt = watchdog_get_drvdata(wdd); + + ts4800_write_feed(wdt, TS4800_WDT_DISABLE); + return 0; +} + +static int ts4800_wdt_set_timeout(struct watchdog_device *wdd, + unsigned int new_timeout) +{ + struct ts4800_wdt *wdt = watchdog_get_drvdata(wdd); + int val = timeout_to_regval(wdd, new_timeout); + + if (val < 0) + return val; + + wdt->feed_val = (u16) val; + + return 0; +} + +static const struct watchdog_ops ts4800_wdt_ops = { + .owner = THIS_MODULE, + /* + * pinging the watchdog enables it, so use same function + * for pinging and starting the watchdog + */ + .start = ts4800_wdt_ping, + .stop = ts4800_wdt_stop, + .ping = ts4800_wdt_ping, + .set_timeout = ts4800_wdt_set_timeout, +}; + +static const struct watchdog_info ts4800_wdt_info = { + .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING, + .identity = "TS-4800 Watchdog", +}; + +static int ts4800_wdt_probe(struct platform_device *pdev) +{ + int max_timeout_index = ARRAY_SIZE(ts4800_wdt_map) - 1; + struct device_node *np = pdev->dev.of_node; + struct ts4800_syscon *syscon; + struct watchdog_device *wdd; + struct ts4800_wdt *wdt; + u32 offset; + int ret; + + ret = of_property_read_u32(np, "offset", &offset); + if (ret) { + dev_err(&pdev->dev, "An offset must be provided\n"); + return -EINVAL; + } + + /* allocate memory for watchdog struct */ + wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL); + if (!wdt) + return -ENOMEM; + + /* set regmap and offset to know where to write */ + syscon = dev_get_drvdata(pdev->dev.parent); + wdt->regmap = syscon->regmap; + wdt->feed_offset = offset; + + /* Initialize struct watchdog_device */ + wdd = &wdt->wdd; + wdd->info = &ts4800_wdt_info; + wdd->ops = &ts4800_wdt_ops; + wdd->min_timeout = ts4800_wdt_map[0].timeout; + wdd->max_timeout = ts4800_wdt_map[max_timeout_index].timeout; + wdd->timeout = wdd->max_timeout; + wdt->feed_val = ts4800_wdt_map[max_timeout_index].regval; + + watchdog_set_drvdata(wdd, wdt); + watchdog_set_nowayout(wdd, nowayout); + + /* + * Must be called after watchdog_set_drvdata to dereference a valid + * pointer. The feed register is write-only, so it is not possible to + * determine if watchdog is already started or not. Disable it to be in + * a known state. + */ + ts4800_wdt_stop(wdd); + + ret = watchdog_register_device(wdd); + if (ret) { + dev_err(&pdev->dev, + "failed to register watchdog device\n"); + return ret; + } + + platform_set_drvdata(pdev, wdt); + + dev_info(&pdev->dev, + "initialized (timeout = %d sec, nowayout = %d)\n", + wdd->timeout, nowayout); + + return 0; +} + +static int ts4800_wdt_remove(struct platform_device *pdev) +{ + struct ts4800_wdt *wdt = platform_get_drvdata(pdev); + + watchdog_unregister_device(&wdt->wdd); + + return 0; +} + +static const struct of_device_id ts4800_wdt_of_match[] = { + { .compatible = "ts,ts4800-wdt", }, + { }, +}; +MODULE_DEVICE_TABLE(of, ts4800_wdt_of_match); + +static struct platform_driver ts4800_wdt_driver = { + .probe = ts4800_wdt_probe, + .remove = ts4800_wdt_remove, + .driver = { + .name = "ts4800_wdt", + .of_match_table = ts4800_wdt_of_match, + }, +}; + +module_platform_driver(ts4800_wdt_driver); + +MODULE_AUTHOR("Damien Riegel <damien.riegel@savoirfairelinux.com>"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:ts4800_wdt"); -- 2.5.0 ^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v2 3/5] watchdog: ts4800: add driver for TS-4800 watchdog @ 2015-10-29 20:27 ` Damien Riegel 0 siblings, 0 replies; 52+ messages in thread From: Damien Riegel @ 2015-10-29 20:27 UTC (permalink / raw) To: linux-arm-kernel Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> --- .../devicetree/bindings/mfd/ts4800-syscon.txt | 8 + .../devicetree/bindings/watchdog/ts4800-wdt.txt | 12 ++ drivers/mfd/Kconfig | 1 + drivers/mfd/ts4800-syscon.c | 13 +- drivers/watchdog/Kconfig | 10 + drivers/watchdog/Makefile | 1 + drivers/watchdog/ts4800_wdt.c | 216 +++++++++++++++++++++ 7 files changed, 260 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt create mode 100644 drivers/watchdog/ts4800_wdt.c diff --git a/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt index 8dbc12c..8c0fd1d 100644 --- a/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt +++ b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt @@ -4,9 +4,17 @@ Required properties: - compatible : must be "ts,ts4800-syscon" - reg : physical base address and length of memory mapped region +The driver exposes following subdevices: +- a watchdog: see ../watchdog/ts4800-wdt.txt + Example: syscon at b0010000 { compatible = "ts,ts4800-syscon"; reg = <0xb0010000 0x3d>; + + wdt at e { + compatible = "ts,ts4800-wdt"; + offset = <0xe>; + }; }; diff --git a/Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt b/Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt new file mode 100644 index 0000000..a9305c2 --- /dev/null +++ b/Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt @@ -0,0 +1,12 @@ +Technologic Systems Watchdog + +Required properties: +- compatible : must be "ts,ts4800-wdt" +- offset : offset of the feed register from syscon base + +Example: + +wdt1: wdt at b0010000 { + compatible = "ts,ts4800-wdt"; + offset = <0xe>; +}; diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 8f03dce..95ba036 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -1304,6 +1304,7 @@ config MFD_TC6393XB config MFD_TS4800_SYSCON tristate "TS-4800 Syscon Support" + select MFD_CORE select REGMAP select REGMAP_MMIO help diff --git a/drivers/mfd/ts4800-syscon.c b/drivers/mfd/ts4800-syscon.c index 1e42e96..03b3b04a 100644 --- a/drivers/mfd/ts4800-syscon.c +++ b/drivers/mfd/ts4800-syscon.c @@ -24,6 +24,13 @@ #include <linux/mfd/ts4800-syscon.h> +static const struct mfd_cell ts4800_syscon_cells[] = { + { + .name = "ts4800-watchdog", + .of_compatible = "ts,ts4800-wdt", + }, +}; + static const struct regmap_config ts4800_regmap_config = { .reg_bits = 32, .reg_stride = 2, @@ -56,11 +63,15 @@ static int ts4800_syscon_probe(struct platform_device *pdev) platform_set_drvdata(pdev, syscon); - return 0; + return mfd_add_devices(&pdev->dev, -1, ts4800_syscon_cells, + ARRAY_SIZE(ts4800_syscon_cells), + NULL, 0, NULL); } static int ts4800_syscon_remove(struct platform_device *pdev) { + mfd_remove_devices(&pdev->dev); + return 0; } diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 241fafd..aaa42b8 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -417,6 +417,16 @@ config NUC900_WATCHDOG To compile this driver as a module, choose M here: the module will be called nuc900_wdt. +config TS4800_WATCHDOG + tristate "TS-4800 Watchdog" + depends on OF + depends on MFD_TS4800_SYSCON + select WATCHDOG_CORE + help + Technologic Systems TS-4800 has watchdog timer implemented in + an external FPGA. Say Y here if you want to support for the + watchdog timer on TS-4800 board. + config TS72XX_WATCHDOG tristate "TS-72XX SBC Watchdog" depends on MACH_TS72XX diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index 59ea9a1..435fc93 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile @@ -52,6 +52,7 @@ obj-$(CONFIG_RN5T618_WATCHDOG) += rn5t618_wdt.o obj-$(CONFIG_COH901327_WATCHDOG) += coh901327_wdt.o obj-$(CONFIG_STMP3XXX_RTC_WATCHDOG) += stmp3xxx_rtc_wdt.o obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o +obj-$(CONFIG_TS4800_WATCHDOG) += ts4800_wdt.o obj-$(CONFIG_TS72XX_WATCHDOG) += ts72xx_wdt.o obj-$(CONFIG_IMX2_WDT) += imx2_wdt.o obj-$(CONFIG_UX500_WATCHDOG) += ux500_wdt.o diff --git a/drivers/watchdog/ts4800_wdt.c b/drivers/watchdog/ts4800_wdt.c new file mode 100644 index 0000000..9b9e638 --- /dev/null +++ b/drivers/watchdog/ts4800_wdt.c @@ -0,0 +1,216 @@ +/* + * ts4800_wdt.c - Watchdog driver for TS-4800 based boards + * + * Copyright (c) 2015 - Savoir-faire Linux + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/watchdog.h> +#include <linux/platform_device.h> +#include <linux/io.h> +#include <linux/of.h> +#include <linux/mfd/ts4800-syscon.h> + +static bool nowayout = WATCHDOG_NOWAYOUT; +module_param(nowayout, bool, 0); +MODULE_PARM_DESC(nowayout, + "Watchdog cannot be stopped once started (default=" + __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); + + +/* possible feed values */ +#define TS4800_WDT_FEED_2S 0x1 +#define TS4800_WDT_FEED_10S 0x2 +#define TS4800_WDT_DISABLE 0x3 + + +struct ts4800_wdt { + struct watchdog_device wdd; + struct regmap *regmap; + u32 feed_offset; + u16 feed_val; +}; + +/* + * TS-4800 supports the following timeout values: + * + * value desc + * --------------------- + * 0 feed for 338ms + * 1 feed for 2.706s + * 2 feed for 10.824s + * 3 disable watchdog + * + * Keep the regmap/timeout map ordered by timeout + */ +static const struct { + const int timeout; + const int regval; +} ts4800_wdt_map[] = { + { 2, TS4800_WDT_FEED_2S }, + { 10, TS4800_WDT_FEED_10S }, +}; + +static int timeout_to_regval(struct watchdog_device *wdd, int new_timeout) +{ + int i; + + new_timeout = clamp_val(new_timeout, + wdd->min_timeout, wdd->max_timeout); + + for (i = 0; i < ARRAY_SIZE(ts4800_wdt_map); i++) { + if (ts4800_wdt_map[i].timeout >= new_timeout) + return ts4800_wdt_map[i].timeout; + } + + return -EINVAL; +} + +static void ts4800_write_feed(struct ts4800_wdt *wdt, u16 val) +{ + regmap_write(wdt->regmap, wdt->feed_offset, val); +} + +static int ts4800_wdt_ping(struct watchdog_device *wdd) +{ + struct ts4800_wdt *wdt = watchdog_get_drvdata(wdd); + + ts4800_write_feed(wdt, wdt->feed_val); + return 0; +} + +static int ts4800_wdt_stop(struct watchdog_device *wdd) +{ + struct ts4800_wdt *wdt = watchdog_get_drvdata(wdd); + + ts4800_write_feed(wdt, TS4800_WDT_DISABLE); + return 0; +} + +static int ts4800_wdt_set_timeout(struct watchdog_device *wdd, + unsigned int new_timeout) +{ + struct ts4800_wdt *wdt = watchdog_get_drvdata(wdd); + int val = timeout_to_regval(wdd, new_timeout); + + if (val < 0) + return val; + + wdt->feed_val = (u16) val; + + return 0; +} + +static const struct watchdog_ops ts4800_wdt_ops = { + .owner = THIS_MODULE, + /* + * pinging the watchdog enables it, so use same function + * for pinging and starting the watchdog + */ + .start = ts4800_wdt_ping, + .stop = ts4800_wdt_stop, + .ping = ts4800_wdt_ping, + .set_timeout = ts4800_wdt_set_timeout, +}; + +static const struct watchdog_info ts4800_wdt_info = { + .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING, + .identity = "TS-4800 Watchdog", +}; + +static int ts4800_wdt_probe(struct platform_device *pdev) +{ + int max_timeout_index = ARRAY_SIZE(ts4800_wdt_map) - 1; + struct device_node *np = pdev->dev.of_node; + struct ts4800_syscon *syscon; + struct watchdog_device *wdd; + struct ts4800_wdt *wdt; + u32 offset; + int ret; + + ret = of_property_read_u32(np, "offset", &offset); + if (ret) { + dev_err(&pdev->dev, "An offset must be provided\n"); + return -EINVAL; + } + + /* allocate memory for watchdog struct */ + wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL); + if (!wdt) + return -ENOMEM; + + /* set regmap and offset to know where to write */ + syscon = dev_get_drvdata(pdev->dev.parent); + wdt->regmap = syscon->regmap; + wdt->feed_offset = offset; + + /* Initialize struct watchdog_device */ + wdd = &wdt->wdd; + wdd->info = &ts4800_wdt_info; + wdd->ops = &ts4800_wdt_ops; + wdd->min_timeout = ts4800_wdt_map[0].timeout; + wdd->max_timeout = ts4800_wdt_map[max_timeout_index].timeout; + wdd->timeout = wdd->max_timeout; + wdt->feed_val = ts4800_wdt_map[max_timeout_index].regval; + + watchdog_set_drvdata(wdd, wdt); + watchdog_set_nowayout(wdd, nowayout); + + /* + * Must be called after watchdog_set_drvdata to dereference a valid + * pointer. The feed register is write-only, so it is not possible to + * determine if watchdog is already started or not. Disable it to be in + * a known state. + */ + ts4800_wdt_stop(wdd); + + ret = watchdog_register_device(wdd); + if (ret) { + dev_err(&pdev->dev, + "failed to register watchdog device\n"); + return ret; + } + + platform_set_drvdata(pdev, wdt); + + dev_info(&pdev->dev, + "initialized (timeout = %d sec, nowayout = %d)\n", + wdd->timeout, nowayout); + + return 0; +} + +static int ts4800_wdt_remove(struct platform_device *pdev) +{ + struct ts4800_wdt *wdt = platform_get_drvdata(pdev); + + watchdog_unregister_device(&wdt->wdd); + + return 0; +} + +static const struct of_device_id ts4800_wdt_of_match[] = { + { .compatible = "ts,ts4800-wdt", }, + { }, +}; +MODULE_DEVICE_TABLE(of, ts4800_wdt_of_match); + +static struct platform_driver ts4800_wdt_driver = { + .probe = ts4800_wdt_probe, + .remove = ts4800_wdt_remove, + .driver = { + .name = "ts4800_wdt", + .of_match_table = ts4800_wdt_of_match, + }, +}; + +module_platform_driver(ts4800_wdt_driver); + +MODULE_AUTHOR("Damien Riegel <damien.riegel@savoirfairelinux.com>"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:ts4800_wdt"); -- 2.5.0 ^ permalink raw reply related [flat|nested] 52+ messages in thread
* Re: [PATCH v2 3/5] watchdog: ts4800: add driver for TS-4800 watchdog 2015-10-29 20:27 ` Damien Riegel (?) @ 2015-10-30 17:28 ` Lee Jones -1 siblings, 0 replies; 52+ messages in thread From: Lee Jones @ 2015-10-30 17:28 UTC (permalink / raw) To: Damien Riegel Cc: linux-kernel, linux-arm-kernel, linux-watchdog, shawnguo, kernel, wim, robh+dt, sameo, dinh.linux, linux, kernel Where is your change-log? I have no idea what the intention of this patch is. > Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> > --- > .../devicetree/bindings/mfd/ts4800-syscon.txt | 8 + > .../devicetree/bindings/watchdog/ts4800-wdt.txt | 12 ++ These should be in a seperate patch. > drivers/mfd/Kconfig | 1 + > drivers/mfd/ts4800-syscon.c | 13 +- > drivers/watchdog/Kconfig | 10 + > drivers/watchdog/Makefile | 1 + > drivers/watchdog/ts4800_wdt.c | 216 +++++++++++++++++++++ > 7 files changed, 260 insertions(+), 1 deletion(-) > create mode 100644 Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt > create mode 100644 drivers/watchdog/ts4800_wdt.c > > diff --git a/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > index 8dbc12c..8c0fd1d 100644 > --- a/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > +++ b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > @@ -4,9 +4,17 @@ Required properties: > - compatible : must be "ts,ts4800-syscon" > - reg : physical base address and length of memory mapped region > > +The driver exposes following subdevices: > +- a watchdog: see ../watchdog/ts4800-wdt.txt > + > Example: > > syscon@b0010000 { > compatible = "ts,ts4800-syscon"; > reg = <0xb0010000 0x3d>; > + > + wdt@e { > + compatible = "ts,ts4800-wdt"; > + offset = <0xe>; > + }; > }; > diff --git a/Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt b/Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt > new file mode 100644 > index 0000000..a9305c2 > --- /dev/null > +++ b/Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt > @@ -0,0 +1,12 @@ > +Technologic Systems Watchdog > + > +Required properties: > +- compatible : must be "ts,ts4800-wdt" > +- offset : offset of the feed register from syscon base > + > +Example: > + > +wdt1: wdt@b0010000 { > + compatible = "ts,ts4800-wdt"; > + offset = <0xe>; > +}; > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig > index 8f03dce..95ba036 100644 > --- a/drivers/mfd/Kconfig > +++ b/drivers/mfd/Kconfig > @@ -1304,6 +1304,7 @@ config MFD_TC6393XB > > config MFD_TS4800_SYSCON > tristate "TS-4800 Syscon Support" > + select MFD_CORE > select REGMAP > select REGMAP_MMIO > help This change is orthogonal and has not place in this patch. > diff --git a/drivers/mfd/ts4800-syscon.c b/drivers/mfd/ts4800-syscon.c > index 1e42e96..03b3b04a 100644 > --- a/drivers/mfd/ts4800-syscon.c > +++ b/drivers/mfd/ts4800-syscon.c > @@ -24,6 +24,13 @@ > #include <linux/mfd/ts4800-syscon.h> > > > +static const struct mfd_cell ts4800_syscon_cells[] = { > + { > + .name = "ts4800-watchdog", > + .of_compatible = "ts,ts4800-wdt", > + }, > +}; > + > static const struct regmap_config ts4800_regmap_config = { > .reg_bits = 32, > .reg_stride = 2, > @@ -56,11 +63,15 @@ static int ts4800_syscon_probe(struct platform_device *pdev) > > platform_set_drvdata(pdev, syscon); > > - return 0; > + return mfd_add_devices(&pdev->dev, -1, ts4800_syscon_cells, > + ARRAY_SIZE(ts4800_syscon_cells), > + NULL, 0, NULL); > } > > static int ts4800_syscon_remove(struct platform_device *pdev) > { > + mfd_remove_devices(&pdev->dev); > + > return 0; > } > > diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig > index 241fafd..aaa42b8 100644 > --- a/drivers/watchdog/Kconfig > +++ b/drivers/watchdog/Kconfig > @@ -417,6 +417,16 @@ config NUC900_WATCHDOG > To compile this driver as a module, choose M here: the > module will be called nuc900_wdt. > > +config TS4800_WATCHDOG > + tristate "TS-4800 Watchdog" > + depends on OF > + depends on MFD_TS4800_SYSCON > + select WATCHDOG_CORE > + help > + Technologic Systems TS-4800 has watchdog timer implemented in > + an external FPGA. Say Y here if you want to support for the > + watchdog timer on TS-4800 board. > + > config TS72XX_WATCHDOG > tristate "TS-72XX SBC Watchdog" > depends on MACH_TS72XX > diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile > index 59ea9a1..435fc93 100644 > --- a/drivers/watchdog/Makefile > +++ b/drivers/watchdog/Makefile > @@ -52,6 +52,7 @@ obj-$(CONFIG_RN5T618_WATCHDOG) += rn5t618_wdt.o > obj-$(CONFIG_COH901327_WATCHDOG) += coh901327_wdt.o > obj-$(CONFIG_STMP3XXX_RTC_WATCHDOG) += stmp3xxx_rtc_wdt.o > obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o > +obj-$(CONFIG_TS4800_WATCHDOG) += ts4800_wdt.o > obj-$(CONFIG_TS72XX_WATCHDOG) += ts72xx_wdt.o > obj-$(CONFIG_IMX2_WDT) += imx2_wdt.o > obj-$(CONFIG_UX500_WATCHDOG) += ux500_wdt.o > diff --git a/drivers/watchdog/ts4800_wdt.c b/drivers/watchdog/ts4800_wdt.c > new file mode 100644 > index 0000000..9b9e638 > --- /dev/null > +++ b/drivers/watchdog/ts4800_wdt.c > @@ -0,0 +1,216 @@ > +/* > + * ts4800_wdt.c - Watchdog driver for TS-4800 based boards > + * > + * Copyright (c) 2015 - Savoir-faire Linux > + * > + * This file is licensed under the terms of the GNU General Public > + * License version 2. This program is licensed "as is" without any > + * warranty of any kind, whether express or implied. > + */ > + > +#include <linux/module.h> > +#include <linux/kernel.h> > +#include <linux/watchdog.h> > +#include <linux/platform_device.h> > +#include <linux/io.h> > +#include <linux/of.h> > +#include <linux/mfd/ts4800-syscon.h> > + > +static bool nowayout = WATCHDOG_NOWAYOUT; > +module_param(nowayout, bool, 0); > +MODULE_PARM_DESC(nowayout, > + "Watchdog cannot be stopped once started (default=" > + __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); > + > + > +/* possible feed values */ > +#define TS4800_WDT_FEED_2S 0x1 > +#define TS4800_WDT_FEED_10S 0x2 > +#define TS4800_WDT_DISABLE 0x3 > + > + > +struct ts4800_wdt { > + struct watchdog_device wdd; > + struct regmap *regmap; > + u32 feed_offset; > + u16 feed_val; > +}; > + > +/* > + * TS-4800 supports the following timeout values: > + * > + * value desc > + * --------------------- > + * 0 feed for 338ms > + * 1 feed for 2.706s > + * 2 feed for 10.824s > + * 3 disable watchdog > + * > + * Keep the regmap/timeout map ordered by timeout > + */ > +static const struct { > + const int timeout; > + const int regval; > +} ts4800_wdt_map[] = { > + { 2, TS4800_WDT_FEED_2S }, > + { 10, TS4800_WDT_FEED_10S }, > +}; > + > +static int timeout_to_regval(struct watchdog_device *wdd, int new_timeout) > +{ > + int i; > + > + new_timeout = clamp_val(new_timeout, > + wdd->min_timeout, wdd->max_timeout); > + > + for (i = 0; i < ARRAY_SIZE(ts4800_wdt_map); i++) { > + if (ts4800_wdt_map[i].timeout >= new_timeout) > + return ts4800_wdt_map[i].timeout; > + } > + > + return -EINVAL; > +} > + > +static void ts4800_write_feed(struct ts4800_wdt *wdt, u16 val) > +{ > + regmap_write(wdt->regmap, wdt->feed_offset, val); > +} > + > +static int ts4800_wdt_ping(struct watchdog_device *wdd) > +{ > + struct ts4800_wdt *wdt = watchdog_get_drvdata(wdd); > + > + ts4800_write_feed(wdt, wdt->feed_val); > + return 0; > +} > + > +static int ts4800_wdt_stop(struct watchdog_device *wdd) > +{ > + struct ts4800_wdt *wdt = watchdog_get_drvdata(wdd); > + > + ts4800_write_feed(wdt, TS4800_WDT_DISABLE); > + return 0; > +} > + > +static int ts4800_wdt_set_timeout(struct watchdog_device *wdd, > + unsigned int new_timeout) > +{ > + struct ts4800_wdt *wdt = watchdog_get_drvdata(wdd); > + int val = timeout_to_regval(wdd, new_timeout); > + > + if (val < 0) > + return val; > + > + wdt->feed_val = (u16) val; > + > + return 0; > +} > + > +static const struct watchdog_ops ts4800_wdt_ops = { > + .owner = THIS_MODULE, > + /* > + * pinging the watchdog enables it, so use same function > + * for pinging and starting the watchdog > + */ > + .start = ts4800_wdt_ping, > + .stop = ts4800_wdt_stop, > + .ping = ts4800_wdt_ping, > + .set_timeout = ts4800_wdt_set_timeout, > +}; > + > +static const struct watchdog_info ts4800_wdt_info = { > + .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING, > + .identity = "TS-4800 Watchdog", > +}; > + > +static int ts4800_wdt_probe(struct platform_device *pdev) > +{ > + int max_timeout_index = ARRAY_SIZE(ts4800_wdt_map) - 1; > + struct device_node *np = pdev->dev.of_node; > + struct ts4800_syscon *syscon; > + struct watchdog_device *wdd; > + struct ts4800_wdt *wdt; > + u32 offset; > + int ret; > + > + ret = of_property_read_u32(np, "offset", &offset); > + if (ret) { > + dev_err(&pdev->dev, "An offset must be provided\n"); > + return -EINVAL; > + } > + > + /* allocate memory for watchdog struct */ > + wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL); > + if (!wdt) > + return -ENOMEM; > + > + /* set regmap and offset to know where to write */ > + syscon = dev_get_drvdata(pdev->dev.parent); > + wdt->regmap = syscon->regmap; > + wdt->feed_offset = offset; > + > + /* Initialize struct watchdog_device */ > + wdd = &wdt->wdd; > + wdd->info = &ts4800_wdt_info; > + wdd->ops = &ts4800_wdt_ops; > + wdd->min_timeout = ts4800_wdt_map[0].timeout; > + wdd->max_timeout = ts4800_wdt_map[max_timeout_index].timeout; > + wdd->timeout = wdd->max_timeout; > + wdt->feed_val = ts4800_wdt_map[max_timeout_index].regval; > + > + watchdog_set_drvdata(wdd, wdt); > + watchdog_set_nowayout(wdd, nowayout); > + > + /* > + * Must be called after watchdog_set_drvdata to dereference a valid > + * pointer. The feed register is write-only, so it is not possible to > + * determine if watchdog is already started or not. Disable it to be in > + * a known state. > + */ > + ts4800_wdt_stop(wdd); > + > + ret = watchdog_register_device(wdd); > + if (ret) { > + dev_err(&pdev->dev, > + "failed to register watchdog device\n"); > + return ret; > + } > + > + platform_set_drvdata(pdev, wdt); > + > + dev_info(&pdev->dev, > + "initialized (timeout = %d sec, nowayout = %d)\n", > + wdd->timeout, nowayout); > + > + return 0; > +} > + > +static int ts4800_wdt_remove(struct platform_device *pdev) > +{ > + struct ts4800_wdt *wdt = platform_get_drvdata(pdev); > + > + watchdog_unregister_device(&wdt->wdd); > + > + return 0; > +} > + > +static const struct of_device_id ts4800_wdt_of_match[] = { > + { .compatible = "ts,ts4800-wdt", }, > + { }, > +}; > +MODULE_DEVICE_TABLE(of, ts4800_wdt_of_match); > + > +static struct platform_driver ts4800_wdt_driver = { > + .probe = ts4800_wdt_probe, > + .remove = ts4800_wdt_remove, > + .driver = { > + .name = "ts4800_wdt", > + .of_match_table = ts4800_wdt_of_match, > + }, > +}; > + > +module_platform_driver(ts4800_wdt_driver); > + > +MODULE_AUTHOR("Damien Riegel <damien.riegel@savoirfairelinux.com>"); > +MODULE_LICENSE("GPL"); > +MODULE_ALIAS("platform:ts4800_wdt"); -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog -- To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v2 3/5] watchdog: ts4800: add driver for TS-4800 watchdog @ 2015-10-30 17:28 ` Lee Jones 0 siblings, 0 replies; 52+ messages in thread From: Lee Jones @ 2015-10-30 17:28 UTC (permalink / raw) To: Damien Riegel Cc: linux-kernel, linux-arm-kernel, linux-watchdog, shawnguo, kernel, wim, robh+dt, sameo, dinh.linux, linux, kernel Where is your change-log? I have no idea what the intention of this patch is. > Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> > --- > .../devicetree/bindings/mfd/ts4800-syscon.txt | 8 + > .../devicetree/bindings/watchdog/ts4800-wdt.txt | 12 ++ These should be in a seperate patch. > drivers/mfd/Kconfig | 1 + > drivers/mfd/ts4800-syscon.c | 13 +- > drivers/watchdog/Kconfig | 10 + > drivers/watchdog/Makefile | 1 + > drivers/watchdog/ts4800_wdt.c | 216 +++++++++++++++++++++ > 7 files changed, 260 insertions(+), 1 deletion(-) > create mode 100644 Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt > create mode 100644 drivers/watchdog/ts4800_wdt.c > > diff --git a/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > index 8dbc12c..8c0fd1d 100644 > --- a/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > +++ b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > @@ -4,9 +4,17 @@ Required properties: > - compatible : must be "ts,ts4800-syscon" > - reg : physical base address and length of memory mapped region > > +The driver exposes following subdevices: > +- a watchdog: see ../watchdog/ts4800-wdt.txt > + > Example: > > syscon@b0010000 { > compatible = "ts,ts4800-syscon"; > reg = <0xb0010000 0x3d>; > + > + wdt@e { > + compatible = "ts,ts4800-wdt"; > + offset = <0xe>; > + }; > }; > diff --git a/Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt b/Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt > new file mode 100644 > index 0000000..a9305c2 > --- /dev/null > +++ b/Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt > @@ -0,0 +1,12 @@ > +Technologic Systems Watchdog > + > +Required properties: > +- compatible : must be "ts,ts4800-wdt" > +- offset : offset of the feed register from syscon base > + > +Example: > + > +wdt1: wdt@b0010000 { > + compatible = "ts,ts4800-wdt"; > + offset = <0xe>; > +}; > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig > index 8f03dce..95ba036 100644 > --- a/drivers/mfd/Kconfig > +++ b/drivers/mfd/Kconfig > @@ -1304,6 +1304,7 @@ config MFD_TC6393XB > > config MFD_TS4800_SYSCON > tristate "TS-4800 Syscon Support" > + select MFD_CORE > select REGMAP > select REGMAP_MMIO > help This change is orthogonal and has not place in this patch. > diff --git a/drivers/mfd/ts4800-syscon.c b/drivers/mfd/ts4800-syscon.c > index 1e42e96..03b3b04a 100644 > --- a/drivers/mfd/ts4800-syscon.c > +++ b/drivers/mfd/ts4800-syscon.c > @@ -24,6 +24,13 @@ > #include <linux/mfd/ts4800-syscon.h> > > > +static const struct mfd_cell ts4800_syscon_cells[] = { > + { > + .name = "ts4800-watchdog", > + .of_compatible = "ts,ts4800-wdt", > + }, > +}; > + > static const struct regmap_config ts4800_regmap_config = { > .reg_bits = 32, > .reg_stride = 2, > @@ -56,11 +63,15 @@ static int ts4800_syscon_probe(struct platform_device *pdev) > > platform_set_drvdata(pdev, syscon); > > - return 0; > + return mfd_add_devices(&pdev->dev, -1, ts4800_syscon_cells, > + ARRAY_SIZE(ts4800_syscon_cells), > + NULL, 0, NULL); > } > > static int ts4800_syscon_remove(struct platform_device *pdev) > { > + mfd_remove_devices(&pdev->dev); > + > return 0; > } > > diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig > index 241fafd..aaa42b8 100644 > --- a/drivers/watchdog/Kconfig > +++ b/drivers/watchdog/Kconfig > @@ -417,6 +417,16 @@ config NUC900_WATCHDOG > To compile this driver as a module, choose M here: the > module will be called nuc900_wdt. > > +config TS4800_WATCHDOG > + tristate "TS-4800 Watchdog" > + depends on OF > + depends on MFD_TS4800_SYSCON > + select WATCHDOG_CORE > + help > + Technologic Systems TS-4800 has watchdog timer implemented in > + an external FPGA. Say Y here if you want to support for the > + watchdog timer on TS-4800 board. > + > config TS72XX_WATCHDOG > tristate "TS-72XX SBC Watchdog" > depends on MACH_TS72XX > diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile > index 59ea9a1..435fc93 100644 > --- a/drivers/watchdog/Makefile > +++ b/drivers/watchdog/Makefile > @@ -52,6 +52,7 @@ obj-$(CONFIG_RN5T618_WATCHDOG) += rn5t618_wdt.o > obj-$(CONFIG_COH901327_WATCHDOG) += coh901327_wdt.o > obj-$(CONFIG_STMP3XXX_RTC_WATCHDOG) += stmp3xxx_rtc_wdt.o > obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o > +obj-$(CONFIG_TS4800_WATCHDOG) += ts4800_wdt.o > obj-$(CONFIG_TS72XX_WATCHDOG) += ts72xx_wdt.o > obj-$(CONFIG_IMX2_WDT) += imx2_wdt.o > obj-$(CONFIG_UX500_WATCHDOG) += ux500_wdt.o > diff --git a/drivers/watchdog/ts4800_wdt.c b/drivers/watchdog/ts4800_wdt.c > new file mode 100644 > index 0000000..9b9e638 > --- /dev/null > +++ b/drivers/watchdog/ts4800_wdt.c > @@ -0,0 +1,216 @@ > +/* > + * ts4800_wdt.c - Watchdog driver for TS-4800 based boards > + * > + * Copyright (c) 2015 - Savoir-faire Linux > + * > + * This file is licensed under the terms of the GNU General Public > + * License version 2. This program is licensed "as is" without any > + * warranty of any kind, whether express or implied. > + */ > + > +#include <linux/module.h> > +#include <linux/kernel.h> > +#include <linux/watchdog.h> > +#include <linux/platform_device.h> > +#include <linux/io.h> > +#include <linux/of.h> > +#include <linux/mfd/ts4800-syscon.h> > + > +static bool nowayout = WATCHDOG_NOWAYOUT; > +module_param(nowayout, bool, 0); > +MODULE_PARM_DESC(nowayout, > + "Watchdog cannot be stopped once started (default=" > + __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); > + > + > +/* possible feed values */ > +#define TS4800_WDT_FEED_2S 0x1 > +#define TS4800_WDT_FEED_10S 0x2 > +#define TS4800_WDT_DISABLE 0x3 > + > + > +struct ts4800_wdt { > + struct watchdog_device wdd; > + struct regmap *regmap; > + u32 feed_offset; > + u16 feed_val; > +}; > + > +/* > + * TS-4800 supports the following timeout values: > + * > + * value desc > + * --------------------- > + * 0 feed for 338ms > + * 1 feed for 2.706s > + * 2 feed for 10.824s > + * 3 disable watchdog > + * > + * Keep the regmap/timeout map ordered by timeout > + */ > +static const struct { > + const int timeout; > + const int regval; > +} ts4800_wdt_map[] = { > + { 2, TS4800_WDT_FEED_2S }, > + { 10, TS4800_WDT_FEED_10S }, > +}; > + > +static int timeout_to_regval(struct watchdog_device *wdd, int new_timeout) > +{ > + int i; > + > + new_timeout = clamp_val(new_timeout, > + wdd->min_timeout, wdd->max_timeout); > + > + for (i = 0; i < ARRAY_SIZE(ts4800_wdt_map); i++) { > + if (ts4800_wdt_map[i].timeout >= new_timeout) > + return ts4800_wdt_map[i].timeout; > + } > + > + return -EINVAL; > +} > + > +static void ts4800_write_feed(struct ts4800_wdt *wdt, u16 val) > +{ > + regmap_write(wdt->regmap, wdt->feed_offset, val); > +} > + > +static int ts4800_wdt_ping(struct watchdog_device *wdd) > +{ > + struct ts4800_wdt *wdt = watchdog_get_drvdata(wdd); > + > + ts4800_write_feed(wdt, wdt->feed_val); > + return 0; > +} > + > +static int ts4800_wdt_stop(struct watchdog_device *wdd) > +{ > + struct ts4800_wdt *wdt = watchdog_get_drvdata(wdd); > + > + ts4800_write_feed(wdt, TS4800_WDT_DISABLE); > + return 0; > +} > + > +static int ts4800_wdt_set_timeout(struct watchdog_device *wdd, > + unsigned int new_timeout) > +{ > + struct ts4800_wdt *wdt = watchdog_get_drvdata(wdd); > + int val = timeout_to_regval(wdd, new_timeout); > + > + if (val < 0) > + return val; > + > + wdt->feed_val = (u16) val; > + > + return 0; > +} > + > +static const struct watchdog_ops ts4800_wdt_ops = { > + .owner = THIS_MODULE, > + /* > + * pinging the watchdog enables it, so use same function > + * for pinging and starting the watchdog > + */ > + .start = ts4800_wdt_ping, > + .stop = ts4800_wdt_stop, > + .ping = ts4800_wdt_ping, > + .set_timeout = ts4800_wdt_set_timeout, > +}; > + > +static const struct watchdog_info ts4800_wdt_info = { > + .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING, > + .identity = "TS-4800 Watchdog", > +}; > + > +static int ts4800_wdt_probe(struct platform_device *pdev) > +{ > + int max_timeout_index = ARRAY_SIZE(ts4800_wdt_map) - 1; > + struct device_node *np = pdev->dev.of_node; > + struct ts4800_syscon *syscon; > + struct watchdog_device *wdd; > + struct ts4800_wdt *wdt; > + u32 offset; > + int ret; > + > + ret = of_property_read_u32(np, "offset", &offset); > + if (ret) { > + dev_err(&pdev->dev, "An offset must be provided\n"); > + return -EINVAL; > + } > + > + /* allocate memory for watchdog struct */ > + wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL); > + if (!wdt) > + return -ENOMEM; > + > + /* set regmap and offset to know where to write */ > + syscon = dev_get_drvdata(pdev->dev.parent); > + wdt->regmap = syscon->regmap; > + wdt->feed_offset = offset; > + > + /* Initialize struct watchdog_device */ > + wdd = &wdt->wdd; > + wdd->info = &ts4800_wdt_info; > + wdd->ops = &ts4800_wdt_ops; > + wdd->min_timeout = ts4800_wdt_map[0].timeout; > + wdd->max_timeout = ts4800_wdt_map[max_timeout_index].timeout; > + wdd->timeout = wdd->max_timeout; > + wdt->feed_val = ts4800_wdt_map[max_timeout_index].regval; > + > + watchdog_set_drvdata(wdd, wdt); > + watchdog_set_nowayout(wdd, nowayout); > + > + /* > + * Must be called after watchdog_set_drvdata to dereference a valid > + * pointer. The feed register is write-only, so it is not possible to > + * determine if watchdog is already started or not. Disable it to be in > + * a known state. > + */ > + ts4800_wdt_stop(wdd); > + > + ret = watchdog_register_device(wdd); > + if (ret) { > + dev_err(&pdev->dev, > + "failed to register watchdog device\n"); > + return ret; > + } > + > + platform_set_drvdata(pdev, wdt); > + > + dev_info(&pdev->dev, > + "initialized (timeout = %d sec, nowayout = %d)\n", > + wdd->timeout, nowayout); > + > + return 0; > +} > + > +static int ts4800_wdt_remove(struct platform_device *pdev) > +{ > + struct ts4800_wdt *wdt = platform_get_drvdata(pdev); > + > + watchdog_unregister_device(&wdt->wdd); > + > + return 0; > +} > + > +static const struct of_device_id ts4800_wdt_of_match[] = { > + { .compatible = "ts,ts4800-wdt", }, > + { }, > +}; > +MODULE_DEVICE_TABLE(of, ts4800_wdt_of_match); > + > +static struct platform_driver ts4800_wdt_driver = { > + .probe = ts4800_wdt_probe, > + .remove = ts4800_wdt_remove, > + .driver = { > + .name = "ts4800_wdt", > + .of_match_table = ts4800_wdt_of_match, > + }, > +}; > + > +module_platform_driver(ts4800_wdt_driver); > + > +MODULE_AUTHOR("Damien Riegel <damien.riegel@savoirfairelinux.com>"); > +MODULE_LICENSE("GPL"); > +MODULE_ALIAS("platform:ts4800_wdt"); -- 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] 52+ messages in thread
* [PATCH v2 3/5] watchdog: ts4800: add driver for TS-4800 watchdog @ 2015-10-30 17:28 ` Lee Jones 0 siblings, 0 replies; 52+ messages in thread From: Lee Jones @ 2015-10-30 17:28 UTC (permalink / raw) To: linux-arm-kernel Where is your change-log? I have no idea what the intention of this patch is. > Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> > --- > .../devicetree/bindings/mfd/ts4800-syscon.txt | 8 + > .../devicetree/bindings/watchdog/ts4800-wdt.txt | 12 ++ These should be in a seperate patch. > drivers/mfd/Kconfig | 1 + > drivers/mfd/ts4800-syscon.c | 13 +- > drivers/watchdog/Kconfig | 10 + > drivers/watchdog/Makefile | 1 + > drivers/watchdog/ts4800_wdt.c | 216 +++++++++++++++++++++ > 7 files changed, 260 insertions(+), 1 deletion(-) > create mode 100644 Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt > create mode 100644 drivers/watchdog/ts4800_wdt.c > > diff --git a/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > index 8dbc12c..8c0fd1d 100644 > --- a/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > +++ b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > @@ -4,9 +4,17 @@ Required properties: > - compatible : must be "ts,ts4800-syscon" > - reg : physical base address and length of memory mapped region > > +The driver exposes following subdevices: > +- a watchdog: see ../watchdog/ts4800-wdt.txt > + > Example: > > syscon at b0010000 { > compatible = "ts,ts4800-syscon"; > reg = <0xb0010000 0x3d>; > + > + wdt at e { > + compatible = "ts,ts4800-wdt"; > + offset = <0xe>; > + }; > }; > diff --git a/Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt b/Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt > new file mode 100644 > index 0000000..a9305c2 > --- /dev/null > +++ b/Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt > @@ -0,0 +1,12 @@ > +Technologic Systems Watchdog > + > +Required properties: > +- compatible : must be "ts,ts4800-wdt" > +- offset : offset of the feed register from syscon base > + > +Example: > + > +wdt1: wdt at b0010000 { > + compatible = "ts,ts4800-wdt"; > + offset = <0xe>; > +}; > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig > index 8f03dce..95ba036 100644 > --- a/drivers/mfd/Kconfig > +++ b/drivers/mfd/Kconfig > @@ -1304,6 +1304,7 @@ config MFD_TC6393XB > > config MFD_TS4800_SYSCON > tristate "TS-4800 Syscon Support" > + select MFD_CORE > select REGMAP > select REGMAP_MMIO > help This change is orthogonal and has not place in this patch. > diff --git a/drivers/mfd/ts4800-syscon.c b/drivers/mfd/ts4800-syscon.c > index 1e42e96..03b3b04a 100644 > --- a/drivers/mfd/ts4800-syscon.c > +++ b/drivers/mfd/ts4800-syscon.c > @@ -24,6 +24,13 @@ > #include <linux/mfd/ts4800-syscon.h> > > > +static const struct mfd_cell ts4800_syscon_cells[] = { > + { > + .name = "ts4800-watchdog", > + .of_compatible = "ts,ts4800-wdt", > + }, > +}; > + > static const struct regmap_config ts4800_regmap_config = { > .reg_bits = 32, > .reg_stride = 2, > @@ -56,11 +63,15 @@ static int ts4800_syscon_probe(struct platform_device *pdev) > > platform_set_drvdata(pdev, syscon); > > - return 0; > + return mfd_add_devices(&pdev->dev, -1, ts4800_syscon_cells, > + ARRAY_SIZE(ts4800_syscon_cells), > + NULL, 0, NULL); > } > > static int ts4800_syscon_remove(struct platform_device *pdev) > { > + mfd_remove_devices(&pdev->dev); > + > return 0; > } > > diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig > index 241fafd..aaa42b8 100644 > --- a/drivers/watchdog/Kconfig > +++ b/drivers/watchdog/Kconfig > @@ -417,6 +417,16 @@ config NUC900_WATCHDOG > To compile this driver as a module, choose M here: the > module will be called nuc900_wdt. > > +config TS4800_WATCHDOG > + tristate "TS-4800 Watchdog" > + depends on OF > + depends on MFD_TS4800_SYSCON > + select WATCHDOG_CORE > + help > + Technologic Systems TS-4800 has watchdog timer implemented in > + an external FPGA. Say Y here if you want to support for the > + watchdog timer on TS-4800 board. > + > config TS72XX_WATCHDOG > tristate "TS-72XX SBC Watchdog" > depends on MACH_TS72XX > diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile > index 59ea9a1..435fc93 100644 > --- a/drivers/watchdog/Makefile > +++ b/drivers/watchdog/Makefile > @@ -52,6 +52,7 @@ obj-$(CONFIG_RN5T618_WATCHDOG) += rn5t618_wdt.o > obj-$(CONFIG_COH901327_WATCHDOG) += coh901327_wdt.o > obj-$(CONFIG_STMP3XXX_RTC_WATCHDOG) += stmp3xxx_rtc_wdt.o > obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o > +obj-$(CONFIG_TS4800_WATCHDOG) += ts4800_wdt.o > obj-$(CONFIG_TS72XX_WATCHDOG) += ts72xx_wdt.o > obj-$(CONFIG_IMX2_WDT) += imx2_wdt.o > obj-$(CONFIG_UX500_WATCHDOG) += ux500_wdt.o > diff --git a/drivers/watchdog/ts4800_wdt.c b/drivers/watchdog/ts4800_wdt.c > new file mode 100644 > index 0000000..9b9e638 > --- /dev/null > +++ b/drivers/watchdog/ts4800_wdt.c > @@ -0,0 +1,216 @@ > +/* > + * ts4800_wdt.c - Watchdog driver for TS-4800 based boards > + * > + * Copyright (c) 2015 - Savoir-faire Linux > + * > + * This file is licensed under the terms of the GNU General Public > + * License version 2. This program is licensed "as is" without any > + * warranty of any kind, whether express or implied. > + */ > + > +#include <linux/module.h> > +#include <linux/kernel.h> > +#include <linux/watchdog.h> > +#include <linux/platform_device.h> > +#include <linux/io.h> > +#include <linux/of.h> > +#include <linux/mfd/ts4800-syscon.h> > + > +static bool nowayout = WATCHDOG_NOWAYOUT; > +module_param(nowayout, bool, 0); > +MODULE_PARM_DESC(nowayout, > + "Watchdog cannot be stopped once started (default=" > + __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); > + > + > +/* possible feed values */ > +#define TS4800_WDT_FEED_2S 0x1 > +#define TS4800_WDT_FEED_10S 0x2 > +#define TS4800_WDT_DISABLE 0x3 > + > + > +struct ts4800_wdt { > + struct watchdog_device wdd; > + struct regmap *regmap; > + u32 feed_offset; > + u16 feed_val; > +}; > + > +/* > + * TS-4800 supports the following timeout values: > + * > + * value desc > + * --------------------- > + * 0 feed for 338ms > + * 1 feed for 2.706s > + * 2 feed for 10.824s > + * 3 disable watchdog > + * > + * Keep the regmap/timeout map ordered by timeout > + */ > +static const struct { > + const int timeout; > + const int regval; > +} ts4800_wdt_map[] = { > + { 2, TS4800_WDT_FEED_2S }, > + { 10, TS4800_WDT_FEED_10S }, > +}; > + > +static int timeout_to_regval(struct watchdog_device *wdd, int new_timeout) > +{ > + int i; > + > + new_timeout = clamp_val(new_timeout, > + wdd->min_timeout, wdd->max_timeout); > + > + for (i = 0; i < ARRAY_SIZE(ts4800_wdt_map); i++) { > + if (ts4800_wdt_map[i].timeout >= new_timeout) > + return ts4800_wdt_map[i].timeout; > + } > + > + return -EINVAL; > +} > + > +static void ts4800_write_feed(struct ts4800_wdt *wdt, u16 val) > +{ > + regmap_write(wdt->regmap, wdt->feed_offset, val); > +} > + > +static int ts4800_wdt_ping(struct watchdog_device *wdd) > +{ > + struct ts4800_wdt *wdt = watchdog_get_drvdata(wdd); > + > + ts4800_write_feed(wdt, wdt->feed_val); > + return 0; > +} > + > +static int ts4800_wdt_stop(struct watchdog_device *wdd) > +{ > + struct ts4800_wdt *wdt = watchdog_get_drvdata(wdd); > + > + ts4800_write_feed(wdt, TS4800_WDT_DISABLE); > + return 0; > +} > + > +static int ts4800_wdt_set_timeout(struct watchdog_device *wdd, > + unsigned int new_timeout) > +{ > + struct ts4800_wdt *wdt = watchdog_get_drvdata(wdd); > + int val = timeout_to_regval(wdd, new_timeout); > + > + if (val < 0) > + return val; > + > + wdt->feed_val = (u16) val; > + > + return 0; > +} > + > +static const struct watchdog_ops ts4800_wdt_ops = { > + .owner = THIS_MODULE, > + /* > + * pinging the watchdog enables it, so use same function > + * for pinging and starting the watchdog > + */ > + .start = ts4800_wdt_ping, > + .stop = ts4800_wdt_stop, > + .ping = ts4800_wdt_ping, > + .set_timeout = ts4800_wdt_set_timeout, > +}; > + > +static const struct watchdog_info ts4800_wdt_info = { > + .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING, > + .identity = "TS-4800 Watchdog", > +}; > + > +static int ts4800_wdt_probe(struct platform_device *pdev) > +{ > + int max_timeout_index = ARRAY_SIZE(ts4800_wdt_map) - 1; > + struct device_node *np = pdev->dev.of_node; > + struct ts4800_syscon *syscon; > + struct watchdog_device *wdd; > + struct ts4800_wdt *wdt; > + u32 offset; > + int ret; > + > + ret = of_property_read_u32(np, "offset", &offset); > + if (ret) { > + dev_err(&pdev->dev, "An offset must be provided\n"); > + return -EINVAL; > + } > + > + /* allocate memory for watchdog struct */ > + wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL); > + if (!wdt) > + return -ENOMEM; > + > + /* set regmap and offset to know where to write */ > + syscon = dev_get_drvdata(pdev->dev.parent); > + wdt->regmap = syscon->regmap; > + wdt->feed_offset = offset; > + > + /* Initialize struct watchdog_device */ > + wdd = &wdt->wdd; > + wdd->info = &ts4800_wdt_info; > + wdd->ops = &ts4800_wdt_ops; > + wdd->min_timeout = ts4800_wdt_map[0].timeout; > + wdd->max_timeout = ts4800_wdt_map[max_timeout_index].timeout; > + wdd->timeout = wdd->max_timeout; > + wdt->feed_val = ts4800_wdt_map[max_timeout_index].regval; > + > + watchdog_set_drvdata(wdd, wdt); > + watchdog_set_nowayout(wdd, nowayout); > + > + /* > + * Must be called after watchdog_set_drvdata to dereference a valid > + * pointer. The feed register is write-only, so it is not possible to > + * determine if watchdog is already started or not. Disable it to be in > + * a known state. > + */ > + ts4800_wdt_stop(wdd); > + > + ret = watchdog_register_device(wdd); > + if (ret) { > + dev_err(&pdev->dev, > + "failed to register watchdog device\n"); > + return ret; > + } > + > + platform_set_drvdata(pdev, wdt); > + > + dev_info(&pdev->dev, > + "initialized (timeout = %d sec, nowayout = %d)\n", > + wdd->timeout, nowayout); > + > + return 0; > +} > + > +static int ts4800_wdt_remove(struct platform_device *pdev) > +{ > + struct ts4800_wdt *wdt = platform_get_drvdata(pdev); > + > + watchdog_unregister_device(&wdt->wdd); > + > + return 0; > +} > + > +static const struct of_device_id ts4800_wdt_of_match[] = { > + { .compatible = "ts,ts4800-wdt", }, > + { }, > +}; > +MODULE_DEVICE_TABLE(of, ts4800_wdt_of_match); > + > +static struct platform_driver ts4800_wdt_driver = { > + .probe = ts4800_wdt_probe, > + .remove = ts4800_wdt_remove, > + .driver = { > + .name = "ts4800_wdt", > + .of_match_table = ts4800_wdt_of_match, > + }, > +}; > + > +module_platform_driver(ts4800_wdt_driver); > + > +MODULE_AUTHOR("Damien Riegel <damien.riegel@savoirfairelinux.com>"); > +MODULE_LICENSE("GPL"); > +MODULE_ALIAS("platform:ts4800_wdt"); -- 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] 52+ messages in thread
* Re: [PATCH v2 3/5] watchdog: ts4800: add driver for TS-4800 watchdog 2015-10-30 17:28 ` Lee Jones (?) @ 2015-10-30 17:52 ` Lee Jones -1 siblings, 0 replies; 52+ messages in thread From: Lee Jones @ 2015-10-30 17:52 UTC (permalink / raw) To: Damien Riegel Cc: linux-kernel, linux-arm-kernel, linux-watchdog, shawnguo, kernel, wim, robh+dt, sameo, dinh.linux, linux, kernel <whoops, I fat fingered the keyboard and sent this too early> > Where is your change-log? > > I have no idea what the intention of this patch is. FYI, the reason I left editing and subsequently sent by mistake was that I had to jump out to look at the subject in order to find the aim of this patch. > > Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> > > --- > > .../devicetree/bindings/mfd/ts4800-syscon.txt | 8 + > > .../devicetree/bindings/watchdog/ts4800-wdt.txt | 12 ++ > > These should be in a seperate patch. > > > drivers/mfd/Kconfig | 1 + > > drivers/mfd/ts4800-syscon.c | 13 +- > > drivers/watchdog/Kconfig | 10 + > > drivers/watchdog/Makefile | 1 + > > drivers/watchdog/ts4800_wdt.c | 216 +++++++++++++++++++++ > > 7 files changed, 260 insertions(+), 1 deletion(-) > > create mode 100644 Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt > > create mode 100644 drivers/watchdog/ts4800_wdt.c > > > > diff --git a/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > > index 8dbc12c..8c0fd1d 100644 > > --- a/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > > +++ b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > > @@ -4,9 +4,17 @@ Required properties: > > - compatible : must be "ts,ts4800-syscon" > > - reg : physical base address and length of memory mapped region > > > > +The driver exposes following subdevices: s/exposes/registers/ > > +- a watchdog: see ../watchdog/ts4800-wdt.txt Remove the 'a'. > > Example: > > > > syscon@b0010000 { > > compatible = "ts,ts4800-syscon"; > > reg = <0xb0010000 0x3d>; > > + > > + wdt@e { > > + compatible = "ts,ts4800-wdt"; > > + offset = <0xe>; > > + }; > > }; > > diff --git a/Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt b/Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt > > new file mode 100644 > > index 0000000..a9305c2 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt > > @@ -0,0 +1,12 @@ > > +Technologic Systems Watchdog > > + > > +Required properties: > > +- compatible : must be "ts,ts4800-wdt" > > +- offset : offset of the feed register from syscon base What's a 'feed' register? Also, 'offset' is a generic property that is undocumented in this context. *If* there is no other generic interface to achieve whatever it is you're trying to achieve, then you probably want a vendor specific property. However, I'm pretty sure there will be other means. Does the 'feed' register change from platform to platform? > > +Example: > > + > > +wdt1: wdt@b0010000 { > > + compatible = "ts,ts4800-wdt"; > > + offset = <0xe>; Why don't you have a 'reg' property? > > +}; > > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig > > index 8f03dce..95ba036 100644 > > --- a/drivers/mfd/Kconfig > > +++ b/drivers/mfd/Kconfig > > @@ -1304,6 +1304,7 @@ config MFD_TC6393XB > > > > config MFD_TS4800_SYSCON > > tristate "TS-4800 Syscon Support" > > + select MFD_CORE > > select REGMAP > > select REGMAP_MMIO > > help > > This change is orthogonal and has not place in this patch. Meaning all of your drviers/mfd changes. > > diff --git a/drivers/mfd/ts4800-syscon.c b/drivers/mfd/ts4800-syscon.c > > index 1e42e96..03b3b04a 100644 > > --- a/drivers/mfd/ts4800-syscon.c > > +++ b/drivers/mfd/ts4800-syscon.c > > @@ -24,6 +24,13 @@ > > #include <linux/mfd/ts4800-syscon.h> > > > > > > +static const struct mfd_cell ts4800_syscon_cells[] = { > > + { > > + .name = "ts4800-watchdog", > > + .of_compatible = "ts,ts4800-wdt", > > + }, > > +}; > > + > > static const struct regmap_config ts4800_regmap_config = { > > .reg_bits = 32, > > .reg_stride = 2, > > @@ -56,11 +63,15 @@ static int ts4800_syscon_probe(struct platform_device *pdev) > > > > platform_set_drvdata(pdev, syscon); > > > > - return 0; > > + return mfd_add_devices(&pdev->dev, -1, ts4800_syscon_cells, Please use the correct #define instead of -1. > > + ARRAY_SIZE(ts4800_syscon_cells), > > + NULL, 0, NULL); > > } > > > > static int ts4800_syscon_remove(struct platform_device *pdev) > > { > > + mfd_remove_devices(&pdev->dev); > > + > > return 0; > > } > > > > diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig > > index 241fafd..aaa42b8 100644 > > --- a/drivers/watchdog/Kconfig > > +++ b/drivers/watchdog/Kconfig > > @@ -417,6 +417,16 @@ config NUC900_WATCHDOG > > To compile this driver as a module, choose M here: the > > module will be called nuc900_wdt. > > > > +config TS4800_WATCHDOG > > + tristate "TS-4800 Watchdog" > > + depends on OF > > + depends on MFD_TS4800_SYSCON > > + select WATCHDOG_CORE > > + help > > + Technologic Systems TS-4800 has watchdog timer implemented in > > + an external FPGA. Say Y here if you want to support for the > > + watchdog timer on TS-4800 board. > > + > > config TS72XX_WATCHDOG > > tristate "TS-72XX SBC Watchdog" > > depends on MACH_TS72XX > > diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile > > index 59ea9a1..435fc93 100644 > > --- a/drivers/watchdog/Makefile > > +++ b/drivers/watchdog/Makefile > > @@ -52,6 +52,7 @@ obj-$(CONFIG_RN5T618_WATCHDOG) += rn5t618_wdt.o > > obj-$(CONFIG_COH901327_WATCHDOG) += coh901327_wdt.o > > obj-$(CONFIG_STMP3XXX_RTC_WATCHDOG) += stmp3xxx_rtc_wdt.o > > obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o > > +obj-$(CONFIG_TS4800_WATCHDOG) += ts4800_wdt.o > > obj-$(CONFIG_TS72XX_WATCHDOG) += ts72xx_wdt.o > > obj-$(CONFIG_IMX2_WDT) += imx2_wdt.o > > obj-$(CONFIG_UX500_WATCHDOG) += ux500_wdt.o > > diff --git a/drivers/watchdog/ts4800_wdt.c b/drivers/watchdog/ts4800_wdt.c > > new file mode 100644 > > index 0000000..9b9e638 > > --- /dev/null > > +++ b/drivers/watchdog/ts4800_wdt.c > > @@ -0,0 +1,216 @@ > > +/* > > + * ts4800_wdt.c - Watchdog driver for TS-4800 based boards Not sure what Wim's view are, but it's usually better *not* to put filenames in C files. > > + * Copyright (c) 2015 - Savoir-faire Linux > > + * > > + * This file is licensed under the terms of the GNU General Public > > + * License version 2. This program is licensed "as is" without any > > + * warranty of any kind, whether express or implied. > > + */ > > + > > +#include <linux/module.h> > > +#include <linux/kernel.h> > > +#include <linux/watchdog.h> > > +#include <linux/platform_device.h> > > +#include <linux/io.h> > > +#include <linux/of.h> > > +#include <linux/mfd/ts4800-syscon.h> Alphabetical. > > +static bool nowayout = WATCHDOG_NOWAYOUT; > > +module_param(nowayout, bool, 0); > > +MODULE_PARM_DESC(nowayout, > > + "Watchdog cannot be stopped once started (default=" > > + __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); > > + > > + Superfluous '\n'. > > +/* possible feed values */ > > +#define TS4800_WDT_FEED_2S 0x1 > > +#define TS4800_WDT_FEED_10S 0x2 > > +#define TS4800_WDT_DISABLE 0x3 Nit: Tabbing. Alignment. > > + > > + Superfluous '\n'. [...] > > +MODULE_AUTHOR("Damien Riegel <damien.riegel@savoirfairelinux.com>"); > > +MODULE_LICENSE("GPL"); GPL v2 > > +MODULE_ALIAS("platform:ts4800_wdt"); > -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog -- To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 52+ messages in thread
* Re: [PATCH v2 3/5] watchdog: ts4800: add driver for TS-4800 watchdog @ 2015-10-30 17:52 ` Lee Jones 0 siblings, 0 replies; 52+ messages in thread From: Lee Jones @ 2015-10-30 17:52 UTC (permalink / raw) To: Damien Riegel Cc: linux-kernel, linux-arm-kernel, linux-watchdog, shawnguo, kernel, wim, robh+dt, sameo, dinh.linux, linux, kernel <whoops, I fat fingered the keyboard and sent this too early> > Where is your change-log? > > I have no idea what the intention of this patch is. FYI, the reason I left editing and subsequently sent by mistake was that I had to jump out to look at the subject in order to find the aim of this patch. > > Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> > > --- > > .../devicetree/bindings/mfd/ts4800-syscon.txt | 8 + > > .../devicetree/bindings/watchdog/ts4800-wdt.txt | 12 ++ > > These should be in a seperate patch. > > > drivers/mfd/Kconfig | 1 + > > drivers/mfd/ts4800-syscon.c | 13 +- > > drivers/watchdog/Kconfig | 10 + > > drivers/watchdog/Makefile | 1 + > > drivers/watchdog/ts4800_wdt.c | 216 +++++++++++++++++++++ > > 7 files changed, 260 insertions(+), 1 deletion(-) > > create mode 100644 Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt > > create mode 100644 drivers/watchdog/ts4800_wdt.c > > > > diff --git a/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > > index 8dbc12c..8c0fd1d 100644 > > --- a/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > > +++ b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > > @@ -4,9 +4,17 @@ Required properties: > > - compatible : must be "ts,ts4800-syscon" > > - reg : physical base address and length of memory mapped region > > > > +The driver exposes following subdevices: s/exposes/registers/ > > +- a watchdog: see ../watchdog/ts4800-wdt.txt Remove the 'a'. > > Example: > > > > syscon@b0010000 { > > compatible = "ts,ts4800-syscon"; > > reg = <0xb0010000 0x3d>; > > + > > + wdt@e { > > + compatible = "ts,ts4800-wdt"; > > + offset = <0xe>; > > + }; > > }; > > diff --git a/Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt b/Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt > > new file mode 100644 > > index 0000000..a9305c2 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt > > @@ -0,0 +1,12 @@ > > +Technologic Systems Watchdog > > + > > +Required properties: > > +- compatible : must be "ts,ts4800-wdt" > > +- offset : offset of the feed register from syscon base What's a 'feed' register? Also, 'offset' is a generic property that is undocumented in this context. *If* there is no other generic interface to achieve whatever it is you're trying to achieve, then you probably want a vendor specific property. However, I'm pretty sure there will be other means. Does the 'feed' register change from platform to platform? > > +Example: > > + > > +wdt1: wdt@b0010000 { > > + compatible = "ts,ts4800-wdt"; > > + offset = <0xe>; Why don't you have a 'reg' property? > > +}; > > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig > > index 8f03dce..95ba036 100644 > > --- a/drivers/mfd/Kconfig > > +++ b/drivers/mfd/Kconfig > > @@ -1304,6 +1304,7 @@ config MFD_TC6393XB > > > > config MFD_TS4800_SYSCON > > tristate "TS-4800 Syscon Support" > > + select MFD_CORE > > select REGMAP > > select REGMAP_MMIO > > help > > This change is orthogonal and has not place in this patch. Meaning all of your drviers/mfd changes. > > diff --git a/drivers/mfd/ts4800-syscon.c b/drivers/mfd/ts4800-syscon.c > > index 1e42e96..03b3b04a 100644 > > --- a/drivers/mfd/ts4800-syscon.c > > +++ b/drivers/mfd/ts4800-syscon.c > > @@ -24,6 +24,13 @@ > > #include <linux/mfd/ts4800-syscon.h> > > > > > > +static const struct mfd_cell ts4800_syscon_cells[] = { > > + { > > + .name = "ts4800-watchdog", > > + .of_compatible = "ts,ts4800-wdt", > > + }, > > +}; > > + > > static const struct regmap_config ts4800_regmap_config = { > > .reg_bits = 32, > > .reg_stride = 2, > > @@ -56,11 +63,15 @@ static int ts4800_syscon_probe(struct platform_device *pdev) > > > > platform_set_drvdata(pdev, syscon); > > > > - return 0; > > + return mfd_add_devices(&pdev->dev, -1, ts4800_syscon_cells, Please use the correct #define instead of -1. > > + ARRAY_SIZE(ts4800_syscon_cells), > > + NULL, 0, NULL); > > } > > > > static int ts4800_syscon_remove(struct platform_device *pdev) > > { > > + mfd_remove_devices(&pdev->dev); > > + > > return 0; > > } > > > > diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig > > index 241fafd..aaa42b8 100644 > > --- a/drivers/watchdog/Kconfig > > +++ b/drivers/watchdog/Kconfig > > @@ -417,6 +417,16 @@ config NUC900_WATCHDOG > > To compile this driver as a module, choose M here: the > > module will be called nuc900_wdt. > > > > +config TS4800_WATCHDOG > > + tristate "TS-4800 Watchdog" > > + depends on OF > > + depends on MFD_TS4800_SYSCON > > + select WATCHDOG_CORE > > + help > > + Technologic Systems TS-4800 has watchdog timer implemented in > > + an external FPGA. Say Y here if you want to support for the > > + watchdog timer on TS-4800 board. > > + > > config TS72XX_WATCHDOG > > tristate "TS-72XX SBC Watchdog" > > depends on MACH_TS72XX > > diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile > > index 59ea9a1..435fc93 100644 > > --- a/drivers/watchdog/Makefile > > +++ b/drivers/watchdog/Makefile > > @@ -52,6 +52,7 @@ obj-$(CONFIG_RN5T618_WATCHDOG) += rn5t618_wdt.o > > obj-$(CONFIG_COH901327_WATCHDOG) += coh901327_wdt.o > > obj-$(CONFIG_STMP3XXX_RTC_WATCHDOG) += stmp3xxx_rtc_wdt.o > > obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o > > +obj-$(CONFIG_TS4800_WATCHDOG) += ts4800_wdt.o > > obj-$(CONFIG_TS72XX_WATCHDOG) += ts72xx_wdt.o > > obj-$(CONFIG_IMX2_WDT) += imx2_wdt.o > > obj-$(CONFIG_UX500_WATCHDOG) += ux500_wdt.o > > diff --git a/drivers/watchdog/ts4800_wdt.c b/drivers/watchdog/ts4800_wdt.c > > new file mode 100644 > > index 0000000..9b9e638 > > --- /dev/null > > +++ b/drivers/watchdog/ts4800_wdt.c > > @@ -0,0 +1,216 @@ > > +/* > > + * ts4800_wdt.c - Watchdog driver for TS-4800 based boards Not sure what Wim's view are, but it's usually better *not* to put filenames in C files. > > + * Copyright (c) 2015 - Savoir-faire Linux > > + * > > + * This file is licensed under the terms of the GNU General Public > > + * License version 2. This program is licensed "as is" without any > > + * warranty of any kind, whether express or implied. > > + */ > > + > > +#include <linux/module.h> > > +#include <linux/kernel.h> > > +#include <linux/watchdog.h> > > +#include <linux/platform_device.h> > > +#include <linux/io.h> > > +#include <linux/of.h> > > +#include <linux/mfd/ts4800-syscon.h> Alphabetical. > > +static bool nowayout = WATCHDOG_NOWAYOUT; > > +module_param(nowayout, bool, 0); > > +MODULE_PARM_DESC(nowayout, > > + "Watchdog cannot be stopped once started (default=" > > + __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); > > + > > + Superfluous '\n'. > > +/* possible feed values */ > > +#define TS4800_WDT_FEED_2S 0x1 > > +#define TS4800_WDT_FEED_10S 0x2 > > +#define TS4800_WDT_DISABLE 0x3 Nit: Tabbing. Alignment. > > + > > + Superfluous '\n'. [...] > > +MODULE_AUTHOR("Damien Riegel <damien.riegel@savoirfairelinux.com>"); > > +MODULE_LICENSE("GPL"); GPL v2 > > +MODULE_ALIAS("platform:ts4800_wdt"); > -- 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] 52+ messages in thread
* [PATCH v2 3/5] watchdog: ts4800: add driver for TS-4800 watchdog @ 2015-10-30 17:52 ` Lee Jones 0 siblings, 0 replies; 52+ messages in thread From: Lee Jones @ 2015-10-30 17:52 UTC (permalink / raw) To: linux-arm-kernel <whoops, I fat fingered the keyboard and sent this too early> > Where is your change-log? > > I have no idea what the intention of this patch is. FYI, the reason I left editing and subsequently sent by mistake was that I had to jump out to look at the subject in order to find the aim of this patch. > > Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> > > --- > > .../devicetree/bindings/mfd/ts4800-syscon.txt | 8 + > > .../devicetree/bindings/watchdog/ts4800-wdt.txt | 12 ++ > > These should be in a seperate patch. > > > drivers/mfd/Kconfig | 1 + > > drivers/mfd/ts4800-syscon.c | 13 +- > > drivers/watchdog/Kconfig | 10 + > > drivers/watchdog/Makefile | 1 + > > drivers/watchdog/ts4800_wdt.c | 216 +++++++++++++++++++++ > > 7 files changed, 260 insertions(+), 1 deletion(-) > > create mode 100644 Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt > > create mode 100644 drivers/watchdog/ts4800_wdt.c > > > > diff --git a/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > > index 8dbc12c..8c0fd1d 100644 > > --- a/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > > +++ b/Documentation/devicetree/bindings/mfd/ts4800-syscon.txt > > @@ -4,9 +4,17 @@ Required properties: > > - compatible : must be "ts,ts4800-syscon" > > - reg : physical base address and length of memory mapped region > > > > +The driver exposes following subdevices: s/exposes/registers/ > > +- a watchdog: see ../watchdog/ts4800-wdt.txt Remove the 'a'. > > Example: > > > > syscon at b0010000 { > > compatible = "ts,ts4800-syscon"; > > reg = <0xb0010000 0x3d>; > > + > > + wdt at e { > > + compatible = "ts,ts4800-wdt"; > > + offset = <0xe>; > > + }; > > }; > > diff --git a/Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt b/Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt > > new file mode 100644 > > index 0000000..a9305c2 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt > > @@ -0,0 +1,12 @@ > > +Technologic Systems Watchdog > > + > > +Required properties: > > +- compatible : must be "ts,ts4800-wdt" > > +- offset : offset of the feed register from syscon base What's a 'feed' register? Also, 'offset' is a generic property that is undocumented in this context. *If* there is no other generic interface to achieve whatever it is you're trying to achieve, then you probably want a vendor specific property. However, I'm pretty sure there will be other means. Does the 'feed' register change from platform to platform? > > +Example: > > + > > +wdt1: wdt at b0010000 { > > + compatible = "ts,ts4800-wdt"; > > + offset = <0xe>; Why don't you have a 'reg' property? > > +}; > > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig > > index 8f03dce..95ba036 100644 > > --- a/drivers/mfd/Kconfig > > +++ b/drivers/mfd/Kconfig > > @@ -1304,6 +1304,7 @@ config MFD_TC6393XB > > > > config MFD_TS4800_SYSCON > > tristate "TS-4800 Syscon Support" > > + select MFD_CORE > > select REGMAP > > select REGMAP_MMIO > > help > > This change is orthogonal and has not place in this patch. Meaning all of your drviers/mfd changes. > > diff --git a/drivers/mfd/ts4800-syscon.c b/drivers/mfd/ts4800-syscon.c > > index 1e42e96..03b3b04a 100644 > > --- a/drivers/mfd/ts4800-syscon.c > > +++ b/drivers/mfd/ts4800-syscon.c > > @@ -24,6 +24,13 @@ > > #include <linux/mfd/ts4800-syscon.h> > > > > > > +static const struct mfd_cell ts4800_syscon_cells[] = { > > + { > > + .name = "ts4800-watchdog", > > + .of_compatible = "ts,ts4800-wdt", > > + }, > > +}; > > + > > static const struct regmap_config ts4800_regmap_config = { > > .reg_bits = 32, > > .reg_stride = 2, > > @@ -56,11 +63,15 @@ static int ts4800_syscon_probe(struct platform_device *pdev) > > > > platform_set_drvdata(pdev, syscon); > > > > - return 0; > > + return mfd_add_devices(&pdev->dev, -1, ts4800_syscon_cells, Please use the correct #define instead of -1. > > + ARRAY_SIZE(ts4800_syscon_cells), > > + NULL, 0, NULL); > > } > > > > static int ts4800_syscon_remove(struct platform_device *pdev) > > { > > + mfd_remove_devices(&pdev->dev); > > + > > return 0; > > } > > > > diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig > > index 241fafd..aaa42b8 100644 > > --- a/drivers/watchdog/Kconfig > > +++ b/drivers/watchdog/Kconfig > > @@ -417,6 +417,16 @@ config NUC900_WATCHDOG > > To compile this driver as a module, choose M here: the > > module will be called nuc900_wdt. > > > > +config TS4800_WATCHDOG > > + tristate "TS-4800 Watchdog" > > + depends on OF > > + depends on MFD_TS4800_SYSCON > > + select WATCHDOG_CORE > > + help > > + Technologic Systems TS-4800 has watchdog timer implemented in > > + an external FPGA. Say Y here if you want to support for the > > + watchdog timer on TS-4800 board. > > + > > config TS72XX_WATCHDOG > > tristate "TS-72XX SBC Watchdog" > > depends on MACH_TS72XX > > diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile > > index 59ea9a1..435fc93 100644 > > --- a/drivers/watchdog/Makefile > > +++ b/drivers/watchdog/Makefile > > @@ -52,6 +52,7 @@ obj-$(CONFIG_RN5T618_WATCHDOG) += rn5t618_wdt.o > > obj-$(CONFIG_COH901327_WATCHDOG) += coh901327_wdt.o > > obj-$(CONFIG_STMP3XXX_RTC_WATCHDOG) += stmp3xxx_rtc_wdt.o > > obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o > > +obj-$(CONFIG_TS4800_WATCHDOG) += ts4800_wdt.o > > obj-$(CONFIG_TS72XX_WATCHDOG) += ts72xx_wdt.o > > obj-$(CONFIG_IMX2_WDT) += imx2_wdt.o > > obj-$(CONFIG_UX500_WATCHDOG) += ux500_wdt.o > > diff --git a/drivers/watchdog/ts4800_wdt.c b/drivers/watchdog/ts4800_wdt.c > > new file mode 100644 > > index 0000000..9b9e638 > > --- /dev/null > > +++ b/drivers/watchdog/ts4800_wdt.c > > @@ -0,0 +1,216 @@ > > +/* > > + * ts4800_wdt.c - Watchdog driver for TS-4800 based boards Not sure what Wim's view are, but it's usually better *not* to put filenames in C files. > > + * Copyright (c) 2015 - Savoir-faire Linux > > + * > > + * This file is licensed under the terms of the GNU General Public > > + * License version 2. This program is licensed "as is" without any > > + * warranty of any kind, whether express or implied. > > + */ > > + > > +#include <linux/module.h> > > +#include <linux/kernel.h> > > +#include <linux/watchdog.h> > > +#include <linux/platform_device.h> > > +#include <linux/io.h> > > +#include <linux/of.h> > > +#include <linux/mfd/ts4800-syscon.h> Alphabetical. > > +static bool nowayout = WATCHDOG_NOWAYOUT; > > +module_param(nowayout, bool, 0); > > +MODULE_PARM_DESC(nowayout, > > + "Watchdog cannot be stopped once started (default=" > > + __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); > > + > > + Superfluous '\n'. > > +/* possible feed values */ > > +#define TS4800_WDT_FEED_2S 0x1 > > +#define TS4800_WDT_FEED_10S 0x2 > > +#define TS4800_WDT_DISABLE 0x3 Nit: Tabbing. Alignment. > > + > > + Superfluous '\n'. [...] > > +MODULE_AUTHOR("Damien Riegel <damien.riegel@savoirfairelinux.com>"); > > +MODULE_LICENSE("GPL"); GPL v2 > > +MODULE_ALIAS("platform:ts4800_wdt"); > -- 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] 52+ messages in thread
* [PATCH v2 4/5] ARM: imx_v6_v7_defconfig: add TS-4800 watchdog and syscon 2015-10-29 20:27 ` Damien Riegel @ 2015-10-29 20:27 ` Damien Riegel -1 siblings, 0 replies; 52+ messages in thread From: Damien Riegel @ 2015-10-29 20:27 UTC (permalink / raw) To: linux-kernel, linux-arm-kernel, linux-watchdog Cc: shawnguo, kernel, wim, robh+dt, sameo, lee.jones, dinh.linux, linux, kernel, Damien Riegel Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> --- arch/arm/configs/imx_v6_v7_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig index b47863d..7adc8b7 100644 --- a/arch/arm/configs/imx_v6_v7_defconfig +++ b/arch/arm/configs/imx_v6_v7_defconfig @@ -190,11 +190,13 @@ CONFIG_THERMAL=y CONFIG_CPU_THERMAL=y CONFIG_IMX_THERMAL=y CONFIG_WATCHDOG=y +CONFIG_TS4800_WATCHDOG=y CONFIG_IMX2_WDT=y CONFIG_MFD_DA9052_I2C=y CONFIG_MFD_MC13XXX_SPI=y CONFIG_MFD_MC13XXX_I2C=y CONFIG_MFD_STMPE=y +CONFIG_MFD_TS4800_SYSCON=y CONFIG_REGULATOR=y CONFIG_REGULATOR_FIXED_VOLTAGE=y CONFIG_REGULATOR_ANATOP=y -- 2.5.0 ^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v2 4/5] ARM: imx_v6_v7_defconfig: add TS-4800 watchdog and syscon @ 2015-10-29 20:27 ` Damien Riegel 0 siblings, 0 replies; 52+ messages in thread From: Damien Riegel @ 2015-10-29 20:27 UTC (permalink / raw) To: linux-arm-kernel Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> --- arch/arm/configs/imx_v6_v7_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig index b47863d..7adc8b7 100644 --- a/arch/arm/configs/imx_v6_v7_defconfig +++ b/arch/arm/configs/imx_v6_v7_defconfig @@ -190,11 +190,13 @@ CONFIG_THERMAL=y CONFIG_CPU_THERMAL=y CONFIG_IMX_THERMAL=y CONFIG_WATCHDOG=y +CONFIG_TS4800_WATCHDOG=y CONFIG_IMX2_WDT=y CONFIG_MFD_DA9052_I2C=y CONFIG_MFD_MC13XXX_SPI=y CONFIG_MFD_MC13XXX_I2C=y CONFIG_MFD_STMPE=y +CONFIG_MFD_TS4800_SYSCON=y CONFIG_REGULATOR=y CONFIG_REGULATOR_FIXED_VOLTAGE=y CONFIG_REGULATOR_ANATOP=y -- 2.5.0 ^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v2 5/5] ARM: dts: TS-4800: add basic device tree 2015-10-29 20:27 ` Damien Riegel @ 2015-10-29 20:27 ` Damien Riegel -1 siblings, 0 replies; 52+ messages in thread From: Damien Riegel @ 2015-10-29 20:27 UTC (permalink / raw) To: linux-kernel, linux-arm-kernel, linux-watchdog Cc: shawnguo, kernel, wim, robh+dt, sameo, lee.jones, dinh.linux, linux, kernel, Damien Riegel This device tree adds support for TS-4800 by Technologic Systems. This board is based on MX51-babbage, but there are some subtle differences in the pins used, and there is an additional FPGA that is memory-mapped. More details here: http://wiki.embeddedarm.com/wiki/TS-4800 Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> --- Documentation/devicetree/bindings/arm/ts.txt | 6 + arch/arm/boot/dts/Makefile | 3 +- arch/arm/boot/dts/imx51-ts4800.dts | 192 +++++++++++++++++++++++++++ 3 files changed, 200 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/arm/ts.txt create mode 100644 arch/arm/boot/dts/imx51-ts4800.dts diff --git a/Documentation/devicetree/bindings/arm/ts.txt b/Documentation/devicetree/bindings/arm/ts.txt new file mode 100644 index 0000000..1b01651 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/ts.txt @@ -0,0 +1,6 @@ +Technologic Systems Platforms Device Tree Bindings +-------------------------------------------------- + +TS-4800 board +Required root node properties: + - compatible = "ts,imx51-ts4800", "fsl,imx51"; diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 246473a..541829a 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -254,7 +254,8 @@ dtb-$(CONFIG_SOC_IMX51) += \ imx51-apf51dev.dtb \ imx51-babbage.dtb \ imx51-digi-connectcore-jsk.dtb \ - imx51-eukrea-mbimxsd51-baseboard.dtb + imx51-eukrea-mbimxsd51-baseboard.dtb \ + imx51-ts4800.dtb dtb-$(CONFIG_SOC_IMX53) += \ imx53-ard.dtb \ imx53-m53evk.dtb \ diff --git a/arch/arm/boot/dts/imx51-ts4800.dts b/arch/arm/boot/dts/imx51-ts4800.dts new file mode 100644 index 0000000..a25ba21 --- /dev/null +++ b/arch/arm/boot/dts/imx51-ts4800.dts @@ -0,0 +1,192 @@ +/* + * Copyright 2011 Freescale Semiconductor, Inc. + * Copyright 2011 Linaro Ltd. + * Copyright 2015 Savoir-faire Linux + * + * The code contained herein is licensed under the GNU General Public + * License. You may obtain a copy of the GNU General Public License + * Version 2 or later at the following locations: + * + * This device tree is based on imx51-babbage.dts + * + * http://www.opensource.org/licenses/gpl-license.html + * http://www.gnu.org/copyleft/gpl.html + */ + +/dts-v1/; +#include "imx51.dtsi" + +/ { + model = "Technologic Systems TS4800"; + compatible = "ts,imx51-ts4800", "fsl,imx51"; + + chosen { + stdout-path = &uart1; + }; + + memory { + reg = <0x90000000 0x10000000>; + }; + + soc { + fpga { + #address-cells = <1>; + #size-cells = <1>; + compatible = "simple-bus"; + reg = <0xb0000000 0x1d000>; + ranges; + + syscon@b0010000 { + compatible = "ts,ts4800-syscon"; + reg = <0xb0010000 0x3d>; + + wdt@e { + compatible = "ts,ts4800-wdt"; + offset = <0xe>; + }; + }; + + }; + }; + + clocks { + ckih1 { + clock-frequency = <22579200>; + }; + + ckih2 { + clock-frequency = <24576000>; + }; + }; +}; + +&esdhc1 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_esdhc1>; + cd-gpios = <&gpio1 0 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>; + status = "okay"; +}; + +&fec { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_fec>; + phy-mode = "mii"; + phy-reset-gpios = <&gpio2 14 GPIO_ACTIVE_LOW>; + phy-reset-duration = <1>; + status = "okay"; +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_uart1>; + status = "okay"; +}; + +&uart2 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_uart2>; + status = "okay"; +}; + +&uart3 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_uart3>; + status = "okay"; +}; + +&i2c2 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c2>; + status = "okay"; + + rtc: m41t00@68 { + compatible = "stm,m41t00"; + reg = <0x68>; + }; +}; + + +&iomuxc { + imx51-ts4800 { + + pinctrl_ecspi1: ecspi1grp { + fsl,pins = < + MX51_PAD_CSPI1_MISO__ECSPI1_MISO 0x185 + MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI 0x185 + MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK 0x185 + MX51_PAD_CSPI1_SS0__GPIO4_24 0x85 /* CS0 */ + >; + }; + + pinctrl_esdhc1: esdhc1grp { + fsl,pins = < + MX51_PAD_SD1_CMD__SD1_CMD 0x400020d5 + MX51_PAD_SD1_CLK__SD1_CLK 0x20d5 + MX51_PAD_SD1_DATA0__SD1_DATA0 0x20d5 + MX51_PAD_SD1_DATA1__SD1_DATA1 0x20d5 + MX51_PAD_SD1_DATA2__SD1_DATA2 0x20d5 + MX51_PAD_SD1_DATA3__SD1_DATA3 0x20d5 + MX51_PAD_GPIO1_0__GPIO1_0 0x100 + MX51_PAD_GPIO1_1__GPIO1_1 0x100 + >; + }; + + pinctrl_fec: fecgrp { + fsl,pins = < + MX51_PAD_EIM_EB2__FEC_MDIO 0x000001f5 + MX51_PAD_EIM_EB3__FEC_RDATA1 0x00000085 + MX51_PAD_EIM_CS2__FEC_RDATA2 0x00000085 + MX51_PAD_EIM_CS3__FEC_RDATA3 0x00000085 + MX51_PAD_EIM_CS4__FEC_RX_ER 0x00000180 + MX51_PAD_EIM_CS5__FEC_CRS 0x00000180 + MX51_PAD_DISP2_DAT10__FEC_COL 0x00000180 + MX51_PAD_DISP2_DAT11__FEC_RX_CLK 0x00000180 + MX51_PAD_DISP2_DAT14__FEC_RDATA0 0x00002180 + MX51_PAD_DISP2_DAT15__FEC_TDATA0 0x00002004 + MX51_PAD_NANDF_CS2__FEC_TX_ER 0x00002004 + MX51_PAD_DI2_PIN2__FEC_MDC 0x00002004 + MX51_PAD_DISP2_DAT6__FEC_TDATA1 0x00002004 + MX51_PAD_DISP2_DAT7__FEC_TDATA2 0x00002004 + MX51_PAD_DISP2_DAT8__FEC_TDATA3 0x00002004 + MX51_PAD_DISP2_DAT9__FEC_TX_EN 0x00002004 + MX51_PAD_DISP2_DAT13__FEC_TX_CLK 0x00002180 + MX51_PAD_DISP2_DAT12__FEC_RX_DV 0x000020a4 + MX51_PAD_EIM_A20__GPIO2_14 0x00000085 /* Phy Reset */ + >; + }; + + pinctrl_i2c2: i2c2grp { + fsl,pins = < + MX51_PAD_KEY_COL4__I2C2_SCL 0x400001ed + MX51_PAD_KEY_COL5__I2C2_SDA 0x400001ed + >; + }; + + pinctrl_uart1: uart1grp { + fsl,pins = < + MX51_PAD_UART1_RXD__UART1_RXD 0x1c5 + MX51_PAD_UART1_TXD__UART1_TXD 0x1c5 + MX51_PAD_UART1_RTS__UART1_RTS 0x1c5 + MX51_PAD_UART1_CTS__UART1_CTS 0x1c5 + >; + }; + + pinctrl_uart2: uart2grp { + fsl,pins = < + MX51_PAD_UART2_RXD__UART2_RXD 0x1c5 + MX51_PAD_UART2_TXD__UART2_TXD 0x1c5 + >; + }; + + pinctrl_uart3: uart3grp { + fsl,pins = < + MX51_PAD_EIM_D25__UART3_RXD 0x1c5 + MX51_PAD_EIM_D26__UART3_TXD 0x1c5 + MX51_PAD_EIM_D27__UART3_RTS 0x1c5 + MX51_PAD_EIM_D24__UART3_CTS 0x1c5 + >; + }; + + }; +}; -- 2.5.0 ^ permalink raw reply related [flat|nested] 52+ messages in thread
* [PATCH v2 5/5] ARM: dts: TS-4800: add basic device tree @ 2015-10-29 20:27 ` Damien Riegel 0 siblings, 0 replies; 52+ messages in thread From: Damien Riegel @ 2015-10-29 20:27 UTC (permalink / raw) To: linux-arm-kernel This device tree adds support for TS-4800 by Technologic Systems. This board is based on MX51-babbage, but there are some subtle differences in the pins used, and there is an additional FPGA that is memory-mapped. More details here: http://wiki.embeddedarm.com/wiki/TS-4800 Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> --- Documentation/devicetree/bindings/arm/ts.txt | 6 + arch/arm/boot/dts/Makefile | 3 +- arch/arm/boot/dts/imx51-ts4800.dts | 192 +++++++++++++++++++++++++++ 3 files changed, 200 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/arm/ts.txt create mode 100644 arch/arm/boot/dts/imx51-ts4800.dts diff --git a/Documentation/devicetree/bindings/arm/ts.txt b/Documentation/devicetree/bindings/arm/ts.txt new file mode 100644 index 0000000..1b01651 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/ts.txt @@ -0,0 +1,6 @@ +Technologic Systems Platforms Device Tree Bindings +-------------------------------------------------- + +TS-4800 board +Required root node properties: + - compatible = "ts,imx51-ts4800", "fsl,imx51"; diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 246473a..541829a 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -254,7 +254,8 @@ dtb-$(CONFIG_SOC_IMX51) += \ imx51-apf51dev.dtb \ imx51-babbage.dtb \ imx51-digi-connectcore-jsk.dtb \ - imx51-eukrea-mbimxsd51-baseboard.dtb + imx51-eukrea-mbimxsd51-baseboard.dtb \ + imx51-ts4800.dtb dtb-$(CONFIG_SOC_IMX53) += \ imx53-ard.dtb \ imx53-m53evk.dtb \ diff --git a/arch/arm/boot/dts/imx51-ts4800.dts b/arch/arm/boot/dts/imx51-ts4800.dts new file mode 100644 index 0000000..a25ba21 --- /dev/null +++ b/arch/arm/boot/dts/imx51-ts4800.dts @@ -0,0 +1,192 @@ +/* + * Copyright 2011 Freescale Semiconductor, Inc. + * Copyright 2011 Linaro Ltd. + * Copyright 2015 Savoir-faire Linux + * + * The code contained herein is licensed under the GNU General Public + * License. You may obtain a copy of the GNU General Public License + * Version 2 or later at the following locations: + * + * This device tree is based on imx51-babbage.dts + * + * http://www.opensource.org/licenses/gpl-license.html + * http://www.gnu.org/copyleft/gpl.html + */ + +/dts-v1/; +#include "imx51.dtsi" + +/ { + model = "Technologic Systems TS4800"; + compatible = "ts,imx51-ts4800", "fsl,imx51"; + + chosen { + stdout-path = &uart1; + }; + + memory { + reg = <0x90000000 0x10000000>; + }; + + soc { + fpga { + #address-cells = <1>; + #size-cells = <1>; + compatible = "simple-bus"; + reg = <0xb0000000 0x1d000>; + ranges; + + syscon at b0010000 { + compatible = "ts,ts4800-syscon"; + reg = <0xb0010000 0x3d>; + + wdt at e { + compatible = "ts,ts4800-wdt"; + offset = <0xe>; + }; + }; + + }; + }; + + clocks { + ckih1 { + clock-frequency = <22579200>; + }; + + ckih2 { + clock-frequency = <24576000>; + }; + }; +}; + +&esdhc1 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_esdhc1>; + cd-gpios = <&gpio1 0 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>; + status = "okay"; +}; + +&fec { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_fec>; + phy-mode = "mii"; + phy-reset-gpios = <&gpio2 14 GPIO_ACTIVE_LOW>; + phy-reset-duration = <1>; + status = "okay"; +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_uart1>; + status = "okay"; +}; + +&uart2 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_uart2>; + status = "okay"; +}; + +&uart3 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_uart3>; + status = "okay"; +}; + +&i2c2 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c2>; + status = "okay"; + + rtc: m41t00 at 68 { + compatible = "stm,m41t00"; + reg = <0x68>; + }; +}; + + +&iomuxc { + imx51-ts4800 { + + pinctrl_ecspi1: ecspi1grp { + fsl,pins = < + MX51_PAD_CSPI1_MISO__ECSPI1_MISO 0x185 + MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI 0x185 + MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK 0x185 + MX51_PAD_CSPI1_SS0__GPIO4_24 0x85 /* CS0 */ + >; + }; + + pinctrl_esdhc1: esdhc1grp { + fsl,pins = < + MX51_PAD_SD1_CMD__SD1_CMD 0x400020d5 + MX51_PAD_SD1_CLK__SD1_CLK 0x20d5 + MX51_PAD_SD1_DATA0__SD1_DATA0 0x20d5 + MX51_PAD_SD1_DATA1__SD1_DATA1 0x20d5 + MX51_PAD_SD1_DATA2__SD1_DATA2 0x20d5 + MX51_PAD_SD1_DATA3__SD1_DATA3 0x20d5 + MX51_PAD_GPIO1_0__GPIO1_0 0x100 + MX51_PAD_GPIO1_1__GPIO1_1 0x100 + >; + }; + + pinctrl_fec: fecgrp { + fsl,pins = < + MX51_PAD_EIM_EB2__FEC_MDIO 0x000001f5 + MX51_PAD_EIM_EB3__FEC_RDATA1 0x00000085 + MX51_PAD_EIM_CS2__FEC_RDATA2 0x00000085 + MX51_PAD_EIM_CS3__FEC_RDATA3 0x00000085 + MX51_PAD_EIM_CS4__FEC_RX_ER 0x00000180 + MX51_PAD_EIM_CS5__FEC_CRS 0x00000180 + MX51_PAD_DISP2_DAT10__FEC_COL 0x00000180 + MX51_PAD_DISP2_DAT11__FEC_RX_CLK 0x00000180 + MX51_PAD_DISP2_DAT14__FEC_RDATA0 0x00002180 + MX51_PAD_DISP2_DAT15__FEC_TDATA0 0x00002004 + MX51_PAD_NANDF_CS2__FEC_TX_ER 0x00002004 + MX51_PAD_DI2_PIN2__FEC_MDC 0x00002004 + MX51_PAD_DISP2_DAT6__FEC_TDATA1 0x00002004 + MX51_PAD_DISP2_DAT7__FEC_TDATA2 0x00002004 + MX51_PAD_DISP2_DAT8__FEC_TDATA3 0x00002004 + MX51_PAD_DISP2_DAT9__FEC_TX_EN 0x00002004 + MX51_PAD_DISP2_DAT13__FEC_TX_CLK 0x00002180 + MX51_PAD_DISP2_DAT12__FEC_RX_DV 0x000020a4 + MX51_PAD_EIM_A20__GPIO2_14 0x00000085 /* Phy Reset */ + >; + }; + + pinctrl_i2c2: i2c2grp { + fsl,pins = < + MX51_PAD_KEY_COL4__I2C2_SCL 0x400001ed + MX51_PAD_KEY_COL5__I2C2_SDA 0x400001ed + >; + }; + + pinctrl_uart1: uart1grp { + fsl,pins = < + MX51_PAD_UART1_RXD__UART1_RXD 0x1c5 + MX51_PAD_UART1_TXD__UART1_TXD 0x1c5 + MX51_PAD_UART1_RTS__UART1_RTS 0x1c5 + MX51_PAD_UART1_CTS__UART1_CTS 0x1c5 + >; + }; + + pinctrl_uart2: uart2grp { + fsl,pins = < + MX51_PAD_UART2_RXD__UART2_RXD 0x1c5 + MX51_PAD_UART2_TXD__UART2_TXD 0x1c5 + >; + }; + + pinctrl_uart3: uart3grp { + fsl,pins = < + MX51_PAD_EIM_D25__UART3_RXD 0x1c5 + MX51_PAD_EIM_D26__UART3_TXD 0x1c5 + MX51_PAD_EIM_D27__UART3_RTS 0x1c5 + MX51_PAD_EIM_D24__UART3_CTS 0x1c5 + >; + }; + + }; +}; -- 2.5.0 ^ permalink raw reply related [flat|nested] 52+ messages in thread
end of thread, other threads:[~2015-11-03 14:36 UTC | newest] Thread overview: 52+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-10-29 20:27 [PATCH v2 0/5] Add board support for TS-4800 Damien Riegel 2015-10-29 20:27 ` Damien Riegel 2015-10-29 20:27 ` [PATCH v2 1/5] of: add vendor prefix for Technologic Systems Damien Riegel 2015-10-29 20:27 ` Damien Riegel 2015-10-30 18:04 ` Lee Jones 2015-10-30 18:04 ` Lee Jones 2015-10-30 18:04 ` Lee Jones 2015-10-30 19:58 ` Damien Riegel 2015-10-30 19:58 ` Damien Riegel 2015-11-02 9:13 ` Lee Jones 2015-11-02 9:13 ` Lee Jones 2015-11-02 9:13 ` Lee Jones 2015-10-29 20:27 ` [PATCH v2 2/5] mfd: ts4800-syscon: add driver for TS-4800 syscon Damien Riegel 2015-10-29 20:27 ` Damien Riegel 2015-10-30 17:56 ` Lee Jones 2015-10-30 17:56 ` Lee Jones 2015-10-30 17:56 ` Lee Jones 2015-10-30 20:08 ` Damien Riegel 2015-10-30 20:08 ` Damien Riegel 2015-10-30 20:08 ` Damien Riegel 2015-11-02 9:12 ` Lee Jones 2015-11-02 9:12 ` Lee Jones 2015-11-02 9:12 ` Lee Jones 2015-11-02 18:13 ` Damien Riegel 2015-11-02 18:13 ` Damien Riegel 2015-11-03 8:38 ` Lee Jones 2015-11-03 8:38 ` Lee Jones 2015-11-03 8:38 ` Lee Jones 2015-11-03 8:39 ` Lee Jones 2015-11-03 8:39 ` Lee Jones 2015-11-03 8:39 ` Lee Jones 2015-11-03 8:40 ` Arnd Bergmann 2015-11-03 8:40 ` Arnd Bergmann 2015-11-03 10:12 ` Lee Jones 2015-11-03 10:12 ` Lee Jones 2015-11-03 10:12 ` Lee Jones 2015-11-03 10:48 ` Arnd Bergmann 2015-11-03 10:48 ` Arnd Bergmann 2015-11-03 14:36 ` Damien Riegel 2015-11-03 14:36 ` Damien Riegel 2015-10-29 20:27 ` [PATCH v2 3/5] watchdog: ts4800: add driver for TS-4800 watchdog Damien Riegel 2015-10-29 20:27 ` Damien Riegel 2015-10-30 17:28 ` Lee Jones 2015-10-30 17:28 ` Lee Jones 2015-10-30 17:28 ` Lee Jones 2015-10-30 17:52 ` Lee Jones 2015-10-30 17:52 ` Lee Jones 2015-10-30 17:52 ` Lee Jones 2015-10-29 20:27 ` [PATCH v2 4/5] ARM: imx_v6_v7_defconfig: add TS-4800 watchdog and syscon Damien Riegel 2015-10-29 20:27 ` Damien Riegel 2015-10-29 20:27 ` [PATCH v2 5/5] ARM: dts: TS-4800: add basic device tree Damien Riegel 2015-10-29 20:27 ` Damien Riegel
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.