Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

watchdog: imx2_wdt: adds big endianness support.

This watchdog driver will be working on IMX2+, Vybrid, LS1, LS2+
platforms, and will be in different endianness mode in those SoCs:

SoCs WDT endian mode
------------------------------------
IMX2+ LE
Vybird LE
LS1 BE
LS2 LE

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>

authored by

Xiubo Li and committed by
Wim Van Sebroeck
f728f4bf 2cdf25bb

+12
+5
Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.txt
··· 5 5 - reg : Should contain WDT registers location and length 6 6 - interrupts : Should contain WDT interrupt 7 7 8 + Optional property: 9 + - big-endian: If present the watchdog device's registers are implemented 10 + in big endian mode, otherwise in little mode. 11 + 8 12 Examples: 9 13 10 14 wdt@73f98000 { 11 15 compatible = "fsl,imx51-wdt", "fsl,imx21-wdt"; 12 16 reg = <0x73f98000 0x4000>; 13 17 interrupts = <58>; 18 + big-endian; 14 19 };
+7
drivers/watchdog/imx2_wdt.c
··· 28 28 #include <linux/kernel.h> 29 29 #include <linux/module.h> 30 30 #include <linux/moduleparam.h> 31 + #include <linux/of_address.h> 31 32 #include <linux/platform_device.h> 32 33 #include <linux/regmap.h> 33 34 #include <linux/timer.h> ··· 191 190 192 191 static int __init imx2_wdt_probe(struct platform_device *pdev) 193 192 { 193 + struct device_node *np = pdev->dev.of_node; 194 194 struct imx2_wdt_device *wdev; 195 195 struct watchdog_device *wdog; 196 196 struct resource *res; 197 197 void __iomem *base; 198 + bool big_endian; 198 199 int ret; 199 200 u32 val; 200 201 201 202 wdev = devm_kzalloc(&pdev->dev, sizeof(*wdev), GFP_KERNEL); 202 203 if (!wdev) 203 204 return -ENOMEM; 205 + 206 + big_endian = of_property_read_bool(np, "big-endian"); 207 + if (big_endian) 208 + imx2_wdt_regmap_config.val_format_endian = REGMAP_ENDIAN_BIG; 204 209 205 210 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 206 211 base = devm_ioremap_resource(&pdev->dev, res);