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

Merge tag 'mvebu-drivers-3.15-2' of git://git.infradead.org/linux-mvebu into next/drivers

Merge "mvebu drivers for v3.15" from Jason Cooper:

pull request #1:

- mvebu mbus
- use of_find_matching_node_and_match

- rtc
- use PTR_ERR_OR_ZERO in isl12057
- work around issue in mv where date returned is 2038

- kirkwood -> mach-mvebu
- various Kconfig oneliners to allow building kirkwood in -mvebu/

pull request #2:

- reset
- re-use qnap-poweroff driver for Synology NASs

* tag 'mvebu-drivers-3.15-2' of git://git.infradead.org/linux-mvebu:
Power: Reset: Generalize qnap-poweroff to work on Synology devices.
drivers: Enable building of Kirkwood drivers for mach-mvebu
rtc: mv: reset date if after year 2038
rtc: isl12057: use PTR_ERR_OR_ZERO to fix coccinelle warnings
bus: mvebu-mbus: make use of of_find_matching_node_and_match

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

+62 -26
+4 -1
Documentation/devicetree/bindings/power_supply/qnap-poweroff.txt
··· 6 6 microcontroller to turn the power off. This driver adds a handler to 7 7 pm_power_off which is called to turn the power off. 8 8 9 + Synology NAS devices use a similar scheme, but a different baud rate, 10 + 9600, and a different character, '1'. 11 + 9 12 Required Properties: 10 - - compatible: Should be "qnap,power-off" 13 + - compatible: Should be "qnap,power-off" or "synology,power-off" 11 14 12 15 - reg: Address and length of the register set for UART1 13 16 - clocks: tclk clock
+1 -2
drivers/bus/mvebu-mbus.c
··· 890 890 const __be32 *prop; 891 891 int ret; 892 892 893 - np = of_find_matching_node(NULL, of_mvebu_mbus_ids); 893 + np = of_find_matching_node_and_match(NULL, of_mvebu_mbus_ids, &of_id); 894 894 if (!np) { 895 895 pr_err("could not find a matching SoC family\n"); 896 896 return -ENODEV; 897 897 } 898 898 899 - of_id = of_match_node(of_mvebu_mbus_ids, np); 900 899 mbus_state.soc = of_id->data; 901 900 902 901 prop = of_get_property(np, "controller", NULL);
+1 -1
drivers/cpufreq/Kconfig.arm
··· 113 113 If in doubt, say Y. 114 114 115 115 config ARM_KIRKWOOD_CPUFREQ 116 - def_bool ARCH_KIRKWOOD && OF 116 + def_bool MACH_KIRKWOOD 117 117 help 118 118 This adds the CPUFreq driver for Marvell Kirkwood 119 119 SoCs.
+1 -1
drivers/cpuidle/Kconfig.arm
··· 22 22 23 23 config ARM_KIRKWOOD_CPUIDLE 24 24 bool "CPU Idle Driver for Marvell Kirkwood SoCs" 25 - depends on ARCH_KIRKWOOD 25 + depends on ARCH_KIRKWOOD || MACH_KIRKWOOD 26 26 help 27 27 This adds the CPU Idle driver for Marvell Kirkwood SoCs. 28 28
+2 -2
drivers/leds/Kconfig
··· 421 421 config LEDS_NS2 422 422 tristate "LED support for Network Space v2 GPIO LEDs" 423 423 depends on LEDS_CLASS 424 - depends on ARCH_KIRKWOOD 424 + depends on ARCH_KIRKWOOD || MACH_KIRKWOOD 425 425 default y 426 426 help 427 427 This option enable support for the dual-GPIO LED found on the ··· 431 431 config LEDS_NETXBIG 432 432 tristate "LED support for Big Network series LEDs" 433 433 depends on LEDS_CLASS 434 - depends on ARCH_KIRKWOOD 434 + depends on ARCH_KIRKWOOD || MACH_KIRKWOOD 435 435 default y 436 436 help 437 437 This option enable support for LEDs found on the LaCie 2Big
+1 -1
drivers/phy/Kconfig
··· 24 24 25 25 config PHY_MVEBU_SATA 26 26 def_bool y 27 - depends on ARCH_KIRKWOOD || ARCH_DOVE 27 + depends on ARCH_KIRKWOOD || ARCH_DOVE || MACH_KIRKWOOD 28 28 depends on OF 29 29 select GENERIC_PHY 30 30
+37 -12
drivers/power/reset/qnap-poweroff.c
··· 1 1 /* 2 - * QNAP Turbo NAS Board power off 2 + * QNAP Turbo NAS Board power off. Can also be used on Synology devices. 3 3 * 4 4 * Copyright (C) 2012 Andrew Lunn <andrew@lunn.ch> 5 5 * ··· 25 25 26 26 #define UART1_REG(x) (base + ((UART_##x) << 2)) 27 27 28 + struct power_off_cfg { 29 + u32 baud; 30 + char cmd; 31 + }; 32 + 33 + static const struct power_off_cfg qnap_power_off_cfg = { 34 + .baud = 19200, 35 + .cmd = 'A', 36 + }; 37 + 38 + static const struct power_off_cfg synology_power_off_cfg = { 39 + .baud = 9600, 40 + .cmd = '1', 41 + }; 42 + 43 + static const struct of_device_id qnap_power_off_of_match_table[] = { 44 + { .compatible = "qnap,power-off", 45 + .data = &qnap_power_off_cfg, 46 + }, 47 + { .compatible = "synology,power-off", 48 + .data = &synology_power_off_cfg, 49 + }, 50 + {} 51 + }; 52 + MODULE_DEVICE_TABLE(of, qnap_power_off_of_match_table); 53 + 28 54 static void __iomem *base; 29 55 static unsigned long tclk; 56 + static const struct power_off_cfg *cfg; 30 57 31 58 static void qnap_power_off(void) 32 59 { 33 - /* 19200 baud divisor */ 34 - const unsigned divisor = ((tclk + (8 * 19200)) / (16 * 19200)); 60 + const unsigned divisor = ((tclk + (8 * cfg->baud)) / (16 * cfg->baud)); 35 61 36 62 pr_err("%s: triggering power-off...\n", __func__); 37 63 38 - /* hijack UART1 and reset into sane state (19200,8n1) */ 64 + /* hijack UART1 and reset into sane state */ 39 65 writel(0x83, UART1_REG(LCR)); 40 66 writel(divisor & 0xff, UART1_REG(DLL)); 41 67 writel((divisor >> 8) & 0xff, UART1_REG(DLM)); ··· 70 44 writel(0x00, UART1_REG(FCR)); 71 45 writel(0x00, UART1_REG(MCR)); 72 46 73 - /* send the power-off command 'A' to PIC */ 74 - writel('A', UART1_REG(TX)); 47 + /* send the power-off command to PIC */ 48 + writel(cfg->cmd, UART1_REG(TX)); 75 49 } 76 50 77 51 static int qnap_power_off_probe(struct platform_device *pdev) 78 52 { 53 + struct device_node *np = pdev->dev.of_node; 79 54 struct resource *res; 80 55 struct clk *clk; 81 56 char symname[KSYM_NAME_LEN]; 57 + 58 + const struct of_device_id *match = 59 + of_match_node(qnap_power_off_of_match_table, np); 60 + cfg = match->data; 82 61 83 62 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 84 63 if (!res) { ··· 124 93 pm_power_off = NULL; 125 94 return 0; 126 95 } 127 - 128 - static const struct of_device_id qnap_power_off_of_match_table[] = { 129 - { .compatible = "qnap,power-off", }, 130 - {} 131 - }; 132 - MODULE_DEVICE_TABLE(of, qnap_power_off_of_match_table); 133 96 134 97 static struct platform_driver qnap_power_off_driver = { 135 98 .probe = qnap_power_off_probe,
+1 -4
drivers/rtc/rtc-isl12057.c
··· 275 275 dev_set_drvdata(dev, data); 276 276 277 277 rtc = devm_rtc_device_register(dev, DRV_NAME, &rtc_ops, THIS_MODULE); 278 - if (IS_ERR(rtc)) 279 - return PTR_ERR(rtc); 280 - 281 - return 0; 278 + return PTR_ERR_OR_ZERO(rtc); 282 279 } 283 280 284 281 #ifdef CONFIG_OF
+12
drivers/rtc/rtc-mv.c
··· 222 222 struct resource *res; 223 223 struct rtc_plat_data *pdata; 224 224 u32 rtc_time; 225 + u32 rtc_date; 225 226 int ret = 0; 226 227 227 228 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); ··· 256 255 ret = -ENODEV; 257 256 goto out; 258 257 } 258 + } 259 + 260 + /* 261 + * A date after January 19th, 2038 does not fit on 32 bits and 262 + * will confuse the kernel and userspace. Reset to a sane date 263 + * (January 1st, 2013) if we're after 2038. 264 + */ 265 + rtc_date = readl(pdata->ioaddr + RTC_DATE_REG_OFFS); 266 + if (bcd2bin((rtc_date >> RTC_YEAR_OFFS) & 0xff) >= 38) { 267 + dev_info(&pdev->dev, "invalid RTC date, resetting to January 1st, 2013\n"); 268 + writel(0x130101, pdata->ioaddr + RTC_DATE_REG_OFFS); 259 269 } 260 270 261 271 pdata->irq = platform_get_irq(pdev, 0);
+1 -1
drivers/thermal/Kconfig
··· 142 142 143 143 config KIRKWOOD_THERMAL 144 144 tristate "Temperature sensor on Marvell Kirkwood SoCs" 145 - depends on ARCH_KIRKWOOD 145 + depends on ARCH_KIRKWOOD || MACH_KIRKWOOD 146 146 depends on OF 147 147 help 148 148 Support for the Kirkwood thermal sensor driver into the Linux thermal
+1 -1
sound/soc/kirkwood/Kconfig
··· 1 1 config SND_KIRKWOOD_SOC 2 2 tristate "SoC Audio for the Marvell Kirkwood and Dove chips" 3 - depends on ARCH_KIRKWOOD || ARCH_DOVE || COMPILE_TEST 3 + depends on ARCH_KIRKWOOD || ARCH_DOVE || MACH_KIRKWOOD || COMPILE_TEST 4 4 help 5 5 Say Y or M if you want to add support for codecs attached to 6 6 the Kirkwood I2S interface. You will also need to select the