[OpenWrt-Devel] Watchdog support for AR531x and potential lockup
Hello ! OpenWrt already support watchdog for some Atheros devices (newer ar2315), but still lack support for older ar531x. This topic already opened here: https://lists.openwrt.org/pipermail/openwrt-devel/2008-April/002039.html but without any response from devs. Hope today someone will answer :) I also found potential lockup involving WDT for those devices (have DWL-2100AP based ar2313a in my disposal for experiments) 1. Watchdog timer always decrement until zero, it cant be stopped at all. 2. Misc watchdog interrupt _always_ generated if timer is zero, does not matter contents of CTRL register ! Flag in ISR register always set if wdt timer equal zero. 3. Misc wdt interrupt flag in ISR can't be cleared until timer set to some non-zero value ! Unfortunately code in current ar2315-wtd set timer to zero, with followed eternal loop because ISR flag can't be cleared and interrupt routine always called again and again (if not masked). I added support for older ar531x (actually the same, but registers swapped, so platform device now contain 2 mem resources instead of 1) and add ability to turn hardware reset on during load (wdt without hardware reset seems useless for me). Those patches for code checking only, they not supposed to be committed ! If all ok I can create separated patches, because now watchdog support exist in 100-board.patch (platform device) and 130-watchdog.patch. --- ar5312.c.old2014-10-09 20:24:22.0 +0400 +++ ar5312.c2014-10-12 14:12:19.299881573 +0400 @@ -49,9 +49,10 @@ do_IRQ(AR5312_MISC_IRQ_AHB_PROC); else if ((ar231x_misc_intrs AR5312_ISR_UART0)) do_IRQ(AR5312_MISC_IRQ_UART0); - else if (ar231x_misc_intrs AR5312_ISR_WD) + else if (ar231x_misc_intrs AR5312_ISR_WD) { do_IRQ(AR5312_MISC_IRQ_WATCHDOG); - else + ar231x_write_reg(AR5312_ISR, AR5312_ISR_WD); + } else do_IRQ(AR5312_MISC_IRQ_NONE); } @@ -255,6 +256,31 @@ }; #endif +static struct resource ar5312_wdt_res[] = { + { + .flags = IORESOURCE_MEM, + .start = AR5312_WD_TIMER, + .end = AR5312_WD_TIMER + 4 - 1, + }, + { + .flags = IORESOURCE_MEM, + .start = AR5312_WD_CTRL, + .end = AR5312_WD_CTRL + 4 - 1, + }, + { + .flags = IORESOURCE_IRQ, + .start = AR5312_MISC_IRQ_WATCHDOG, + .end = AR5312_MISC_IRQ_WATCHDOG, + } +}; + +static struct platform_device ar5312_wdt = { + .id = 0, + .name = ar231x-wdt, + .resource = ar5312_wdt_res, + .num_resources = ARRAY_SIZE(ar5312_wdt_res) +}; + /* * NB: This mapping size is larger than the actual flash size, * but this shouldn't be a problem here, because the flash @@ -327,6 +353,7 @@ } platform_device_register(ar5312_physmap_flash); + platform_device_register(ar5312_wdt); #ifdef CONFIG_LEDS_GPIO ar5312_leds[0].gpio = config-sys_led_gpio; --- ar2315.c.old2014-10-09 20:24:22.0 +0400 +++ ar2315.c2014-10-11 11:46:09.598278049 +0400 @@ -335,7 +335,12 @@ { .flags = IORESOURCE_MEM, .start = AR2315_WD, - .end = AR2315_WD + 8 - 1, + .end = AR2315_WD + 4 - 1, + }, + { + .flags = IORESOURCE_MEM, + .start = AR2315_WDC, + .end = AR2315_WDC + 4 - 1, }, { .flags = IORESOURCE_IRQ, @@ -346,7 +351,7 @@ static struct platform_device ar2315_wdt = { .id = 0, - .name = ar2315-wdt, + .name = ar231x-wdt, .resource = ar2315_wdt_res, .num_resources = ARRAY_SIZE(ar2315_wdt_res) }; --- ar2315-wtd.c2014-10-09 20:24:22.745638862 +0400 +++ ar231x-wdt.c2014-10-12 14:11:37.463673909 +0400 @@ -32,62 +32,71 @@ #include linux/io.h #include linux/uaccess.h -#define DRIVER_NAMEar2315-wdt +#define DRIVER_NAMEar231x-wdt #define CLOCK_RATE 4000 #define HEARTBEAT(x) (x 1 || x 90 ? 20 : x) -#define WDT_REG_TIMER 0x00 -#define WDT_REG_CTRL 0x04 +// comment this line if does not want WDT started during boot +//#define WDT_START_ON_BOOT #define WDT_CTRL_ACT_NONE 0x /* No action */ #define WDT_CTRL_ACT_NMI 0x0001 /* NMI on watchdog */ #define WDT_CTRL_ACT_RESET 0x0002 /* reset on watchdog */ -static int wdt_timeout = 20; +#define WDT_CTRL_ACTIONWDT_CTRL_ACT_RESET + +static int wdt_timeout = 60; static int started; static int in_use; -static void __iomem *wdt_base; +static void __iomem *wdt_timer_reg; +static void __iomem *wdt_ctrl_reg; -static inline void ar2315_wdt_wr(unsigned reg, u32 val) +static inline void ar231x_wdt_wr_timer(u32 val) { - iowrite32(val, wdt_base + reg); + iowrite32(val, wdt_timer_reg); +} + +static inline void
Re: [OpenWrt-Devel] Watchdog support for AR531x and potential lockup
Hello ! 1. Watchdog timer always decrement until zero, it cant be stopped at all. SR Yep, same for AR2315+ SoCs. And if interrupt acknowledged by writing SR one to ISR, then the timer starts counting again from 0x and SR generates another one interrupt. Not for ar531x, timer does not overlapping zero on those devices even if ISR flag cleared, and, actually, produce next interrupt. So, setting timer to 0x does not harm both platforms. SR Hardware reset doesn't work on AR2315 since hw bug and cause freeze if SR issued by watchdog. See details in AR2315 reset routine in SR arch/mips/ar231x/ar2315.c I tested hw reset on ar531x, and it works. Are you tested it ? Comments in ar2315_restart function are about different situation, not watchdog reset. SR I would like to propose use different device id strings (e.g. SR ar2315-watchdog and ar5312-watchdog) to distinguish SoCs models. This SR would help to solve several issues: SR - twisted registers (passing adjacent registers via different SR resources seems a bit odd), Why ? +4-4 address play looks worse for me :) Who cares how registers placed in address map, if we can use two pointers for them ? :) SR - possibility of hardware reset, SR - detection of watchdog clock frequency, since according to Axel Gembe SR patch DWL-2100AP's watchdog timer ticks at 48MHz. Well, interrupt generated each 96 second on my DWL-2100AP, 0x/96 resulting in 44Mhz clock. 40 MHz - 107 seconds timeout 48 Mhz - 89 seconds 60 sec limit should be enough. For me watchdog routines should be as simple as possible, without bells and whistles because of their life-critical status. -- Sergey mailto:d...@bittu.org.ru ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] New gstreamer packages
Hello ! SB the oldpackages feed is unsupported and will not be updated any more. SB If you want to submit packages or adopt packages from oldpackages which SB are not there yet please go to SB https://github.com/openwrt/packages and SB make a pull request there. I wondering why drop so many working packages even if they not maintained anymore. Multimedia part now have 2 items, instead of ~30 in oldpackages. Thanks for the answer, but I does not interested to be maintainer (as listed in README). -- Sergey mailto:d...@bittu.org.ru ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] New gstreamer packages
Hello ! I created several new gstreamer module packages (v4l2 for example), they update makefiles and add some patches. But now I confused with paths, after update gstreamer was moved to the oldpackages directory. Which path patch should contain ? -- Sergey mailto:d...@bittu.org.ru ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [Patch][Resend] Support for BMP085 pressure sensor
Hello ! JC Sergey can you send the patch with git send-email please ? I'm sorry, but git on my ubuntu buildbox seems to not support send-email command, thunderbird wrap strings and windows client on main pc replace tabs to spaces :) Just tryed to send from freebsd box using simple mail, hope it works. -- С уважением, Sergey mailto:d...@bittu.org.ru ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [Patch][Resend] Kernel patch for BMP085 support
Hello ! JG this patch is currently missing: JG a) a proper changelog JG b) a Signed-off-by JG c) proper patch headers for the individual patches. JG See https://dev.openwrt.org/wiki/SubmittingPatches regarding a) and b), and JG https://dev.openwrt.org/browser/trunk/target/linux/generic/PATCHES regarding c) Thanks for your answer. For c) I used 259-regmap_dynamic.patch as a sample, does not found any headers in this file. Actually changes are self-descriptive, patch is so big because I added all used kernel versions except 3.3 (no spi module here, i2c only). I already contacted drivers/misc maintainer about applying this little bugfix to the kernel itself (but he still does not reply). And sorry, I can't add Signed-off line because it require my real name, but I does not want it (From is not real name too). Feel free to use patch as-is, or I can resend with description. Without it kernel will fail to link because of main part of the driver code always compiled built-in. Sergey mailto:d...@bittu.org.ru ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [Patch] Support for BMP085 pressure sensor
Hello ! Bosch Sensortec is one of most popular pressure sensors for building home weather stations, its cheap and easy to use. I decided to add two packages for each bus type because device usually have only one barometer and we does no need to waste firmware space for unused bus. Tested on trunk, ar71xx (ML2030) with kernel 3.10, i2c only (due absent of spi version), but I added patch files for all current kernels. === --- a/target/linux/generic/patches-3.6/263-bmp085_dynamic.patch 1970-01-01 04:00:00.0 +0400 +++ b/target/linux/generic/patches-3.6/263-bmp085_dynamic.patch 2014-06-08 14:42:38.0 +0400 @@ -0,0 +1,11 @@ +--- a/drivers/misc/Kconfig 2014-04-03 23:01:22.0 +0400 b/drivers/misc/Kconfig 2014-06-08 14:40:09.129048438 +0400 +@@ -453,7 +453,7 @@ + still useful. + + config BMP085 +- bool ++ tristate BMP085 digital pressure sensor generic support + depends on SYSFS + + config BMP085_I2C --- a/target/linux/generic/patches-3.8/263-bmp085_dynamic.patch 1970-01-01 04:00:00.0 +0400 +++ b/target/linux/generic/patches-3.8/263-bmp085_dynamic.patch 2014-06-08 14:42:38.0 +0400 @@ -0,0 +1,11 @@ +--- a/drivers/misc/Kconfig 2014-04-03 23:01:22.0 +0400 b/drivers/misc/Kconfig 2014-06-08 14:40:09.129048438 +0400 +@@ -443,7 +443,7 @@ + still useful. + + config BMP085 +- bool ++ tristate BMP085 digital pressure sensor generic support + depends on SYSFS + + config BMP085_I2C --- a/target/linux/generic/patches-3.9/263-bmp085_dynamic.patch 1970-01-01 04:00:00.0 +0400 +++ b/target/linux/generic/patches-3.9/263-bmp085_dynamic.patch 2014-06-08 14:42:38.0 +0400 @@ -0,0 +1,11 @@ +--- a/drivers/misc/Kconfig 2014-04-03 23:01:22.0 +0400 b/drivers/misc/Kconfig 2014-06-08 14:40:09.129048438 +0400 +@@ -443,7 +443,7 @@ + still useful. + + config BMP085 +- bool ++ tristate BMP085 digital pressure sensor generic support + depends on SYSFS + + config BMP085_I2C --- a/target/linux/generic/patches-3.10/263-bmp085_dynamic.patch 1970-01-01 04:00:00.0 +0400 +++ b/target/linux/generic/patches-3.10/263-bmp085_dynamic.patch 2014-06-08 14:42:38.0 +0400 @@ -0,0 +1,11 @@ +--- a/drivers/misc/Kconfig 2014-04-03 23:01:22.0 +0400 b/drivers/misc/Kconfig 2014-06-08 14:40:09.129048438 +0400 +@@ -451,7 +451,7 @@ + still useful. + + config BMP085 +- bool ++ tristate BMP085 digital pressure sensor generic support + depends on SYSFS + + config BMP085_I2C --- a/target/linux/generic/patches-3.12/263-bmp085_dynamic.patch 1970-01-01 04:00:00.0 +0400 +++ b/target/linux/generic/patches-3.12/263-bmp085_dynamic.patch 2014-06-08 14:42:38.0 +0400 @@ -0,0 +1,11 @@ +--- a/drivers/misc/Kconfig 2014-04-03 23:01:22.0 +0400 b/drivers/misc/Kconfig 2014-06-08 14:40:09.129048438 +0400 +@@ -451,7 +451,7 @@ + still useful. + + config BMP085 +- bool ++ tristate BMP085 digital pressure sensor generic support + depends on SYSFS + + config BMP085_I2C --- a/target/linux/generic/patches-3.13/263-bmp085_dynamic.patch 1970-01-01 04:00:00.0 +0400 +++ b/target/linux/generic/patches-3.13/263-bmp085_dynamic.patch 2014-06-08 14:42:38.0 +0400 @@ -0,0 +1,11 @@ +--- a/drivers/misc/Kconfig 2014-04-03 23:01:22.0 +0400 b/drivers/misc/Kconfig 2014-06-08 14:40:09.129048438 +0400 +@@ -438,7 +438,7 @@ + still useful. + + config BMP085 +- bool ++ tristate BMP085 digital pressure sensor generic support + depends on SYSFS + + config BMP085_I2C --- a/target/linux/generic/patches-3.14/263-bmp085_dynamic.patch 1970-01-01 04:00:00.0 +0400 +++ b/target/linux/generic/patches-3.14/263-bmp085_dynamic.patch 2014-06-08 14:42:38.0 +0400 @@ -0,0 +1,11 @@ +--- a/drivers/misc/Kconfig 2014-04-03 23:01:22.0 +0400 b/drivers/misc/Kconfig 2014-06-08 14:40:09.129048438 +0400 +@@ -438,7 +438,7 @@ + still useful. + + config BMP085 +- bool ++ tristate BMP085 digital pressure sensor generic support + depends on SYSFS + + config BMP085_I2C --- a/package/kernel/linux/modules/other.mk 2014-05-30 13:53:34.0 +0400 +++ b/package/kernel/linux/modules/other.mk 2014-06-08 16:47:48.315028290 +0400 @@ -698,6 +698,43 @@ $(eval $(call KernelPackage,regmap)) +define KernelPackage/bmp085-i2c + SUBMENU:=$(OTHER_MENU) + TITLE:=BMP085 digital pressure sensor on I2C + KCONFIG:=CONFIG_BMP085_I2C \ + CONFIG_BMP085 + DEPENDS:=+kmod-regmap + FILES:= \ + $(LINUX_DIR)/drivers/misc/bmp085-i2c.ko \ + $(LINUX_DIR)/drivers/misc/bmp085.ko + AUTOLOAD:=$(call AutoLoad,55,bmp085 bmp085-i2c) +endef + +define KernelPackage/bmp085-i2c/description +
[OpenWrt-Devel] [Patch][Resend] Support for BMP085 pressure sensor
Hello ! Here is the v2 of the patch, with suggestions from John Crispin. Three packages (one main and two for i2c/spi) selected using submenu. Kernel patch separated from other.mk part, possibly we will have it included in linux kernel. === --- a/package/kernel/linux/modules/other.mk 2014-06-29 15:21:39.359850523 +0400 +++ b/package/kernel/linux/modules/other.mk 2014-06-29 15:17:27.0 +0400 @@ -698,6 +698,54 @@ $(eval $(call KernelPackage,regmap)) + +define KernelPackage/bmp085 + SUBMENU:=$(OTHER_MENU) + TITLE:=BMP085 digital pressure sensor + KCONFIG:=CONFIG_BMP085 + DEPENDS:=+kmod-regmap + FILES:= \ + $(LINUX_DIR)/drivers/misc/bmp085.ko +endef + +define KernelPackage/bmp085/description + Kernel module for BOSCH Sensortec pressure sensor generic support +endef + +$(eval $(call KernelPackage,bmp085)) + +define KernelPackage/bmp085-i2c + SUBMENU:=$(OTHER_MENU) + TITLE:=BMP085 sensor on I2C bus + KCONFIG:=CONFIG_BMP085_I2C + FILES:= \ + $(LINUX_DIR)/drivers/misc/bmp085-i2c.ko + DEPENDS:=kmod-bmp085 + AUTOLOAD:=$(call AutoProbe,bmp085-i2c) +endef + +define KernelPackage/bmp085-i2c/description + Kernel module for BOSCH Sensortec pressure sensor on I2C bus +endef + +$(eval $(call KernelPackage,bmp085-i2c)) + +define KernelPackage/bmp085-spi + SUBMENU:=$(OTHER_MENU) + TITLE:=BMP085 sensor on SPI bus + KCONFIG:=CONFIG_BMP085_SPI + FILES:= \ + $(LINUX_DIR)/drivers/misc/bmp085-spi.ko + DEPENDS:=kmod-bmp085 + AUTOLOAD:=$(call AutoProbe,bmp085-spi) +endef + +define KernelPackage/bmp085-spi/description + Kernel module for BOSCH Sensortec pressure sensor on SPI bus +endef + +$(eval $(call KernelPackage,bmp085-spi)) + define KernelPackage/ikconfig SUBMENU:=$(OTHER_MENU) TITLE:=Kernel configuration via /proc/config.gz === Kernel part, adapted for OpenWRT, if someone want to compile now. Actually its only replace bool with tristate. === --- a/target/linux/generic/patches-3.6/263-bmp085_dynamic.patch 1970-01-01 04:00:00.0 +0400 +++ b/target/linux/generic/patches-3.6/263-bmp085_dynamic.patch 2014-06-08 14:42:38.0 +0400 @@ -0,0 +1,11 @@ +--- a/drivers/misc/Kconfig 2014-04-03 23:01:22.0 +0400 b/drivers/misc/Kconfig 2014-06-08 14:40:09.129048438 +0400 +@@ -453,7 +453,7 @@ + still useful. + + config BMP085 +- bool ++ tristate BMP085 digital pressure sensor generic support + depends on SYSFS + + config BMP085_I2C --- a/target/linux/generic/patches-3.8/263-bmp085_dynamic.patch 1970-01-01 04:00:00.0 +0400 +++ b/target/linux/generic/patches-3.8/263-bmp085_dynamic.patch 2014-06-08 14:42:38.0 +0400 @@ -0,0 +1,11 @@ +--- a/drivers/misc/Kconfig 2014-04-03 23:01:22.0 +0400 b/drivers/misc/Kconfig 2014-06-08 14:40:09.129048438 +0400 +@@ -443,7 +443,7 @@ + still useful. + + config BMP085 +- bool ++ tristate BMP085 digital pressure sensor generic support + depends on SYSFS + + config BMP085_I2C --- a/target/linux/generic/patches-3.9/263-bmp085_dynamic.patch 1970-01-01 04:00:00.0 +0400 +++ b/target/linux/generic/patches-3.9/263-bmp085_dynamic.patch 2014-06-08 14:42:38.0 +0400 @@ -0,0 +1,11 @@ +--- a/drivers/misc/Kconfig 2014-04-03 23:01:22.0 +0400 b/drivers/misc/Kconfig 2014-06-08 14:40:09.129048438 +0400 +@@ -443,7 +443,7 @@ + still useful. + + config BMP085 +- bool ++ tristate BMP085 digital pressure sensor generic support + depends on SYSFS + + config BMP085_I2C --- a/target/linux/generic/patches-3.10/263-bmp085_dynamic.patch 1970-01-01 04:00:00.0 +0400 +++ b/target/linux/generic/patches-3.10/263-bmp085_dynamic.patch 2014-06-08 14:42:38.0 +0400 @@ -0,0 +1,11 @@ +--- a/drivers/misc/Kconfig 2014-04-03 23:01:22.0 +0400 b/drivers/misc/Kconfig 2014-06-08 14:40:09.129048438 +0400 +@@ -451,7 +451,7 @@ + still useful. + + config BMP085 +- bool ++ tristate BMP085 digital pressure sensor generic support + depends on SYSFS + + config BMP085_I2C --- a/target/linux/generic/patches-3.12/263-bmp085_dynamic.patch 1970-01-01 04:00:00.0 +0400 +++ b/target/linux/generic/patches-3.12/263-bmp085_dynamic.patch 2014-06-08 14:42:38.0 +0400 @@ -0,0 +1,11 @@ +--- a/drivers/misc/Kconfig 2014-04-03 23:01:22.0 +0400 b/drivers/misc/Kconfig 2014-06-08 14:40:09.129048438 +0400 +@@ -451,7 +451,7 @@ + still useful. + + config BMP085 +- bool ++ tristate BMP085 digital pressure sensor generic support + depends on SYSFS + + config BMP085_I2C --- a/target/linux/generic/patches-3.13/263-bmp085_dynamic.patch 1970-01-01 04:00:00.0 +0400 +++ b/target/linux/generic/patches-3.13/263-bmp085_dynamic.patch