mvebu driver changes for v3.15 (incremental pull #2)

- reset
     - re-use qnap-poweroff driver for Synology NASs
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJTGe0/AAoJEP45WPkGe8Znj34QALuuN/yvOykT1/qNg7fdk+C4
 Qrqcyi164KtIR1GnjaxYsDDBovreFRMLDBLhrUJnGwsS3u5TnrnGvan955GZxQ8e
 86YWlyxzJodbwrD+yK6bPNra1qArwpIQ4q5xUF/fksxMU/dLMiG2wPYQasQb9pMW
 yqm3MySNsTinave6QdiTxRzoYBwCcf1ey+mCFSkR9aLXWCFxMuK36/jHQpq7trlP
 21jB4cz8qF4eYsVNuyjadR0o4g2p2zM7RxGgZrHFHXESD2jiTrHmMv8cwlEjVMre
 0Pqv+BKI5obcMrWzCpVA2v/OUzvhMFrk0LShQVio7NQ5WUNEKPspQ3dogjnlkZKj
 6Xcc9OEYRjnAZ8i2q5g0xWoxsTLlAbDzTfmzQ03YRYtRTOxBXr20CTT2omGdJJ17
 RzCYvfc7JhGPyOjglsTibJt2plNKhQd5AzkzJFwOmF/tQkAM3LpVgjnqe/Q2Ts5L
 5BU7xQlpB2qHJgK48rRuVcpw9aIZJXtcA89oa2ebuWT6D7dJjp9W3J4WhaFzwWGy
 dxLU3WrYyiXaLoJURSHW1FaukRecubYZL9GW3Va9iN6rUn46FCVyn7RrCfHVMIXA
 Eiw4DAH2sOP7Z6Iw8NfVaU3b8ntT4vCCD3FjV3ZmWtUTsqgxBy5GdjKG9WtglAr6
 YhQ8SPTt8vSzVlzfZ4Ug
 =j/ZI
 -----END PGP SIGNATURE-----

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>
This commit is contained in:
Arnd Bergmann 2014-03-17 11:14:34 +01:00
commit cda88c8be5
11 changed files with 62 additions and 26 deletions

View file

@ -6,8 +6,11 @@ Orion5x SoCs. Sending the character 'A', at 19200 baud, tells the
microcontroller to turn the power off. This driver adds a handler to
pm_power_off which is called to turn the power off.
Synology NAS devices use a similar scheme, but a different baud rate,
9600, and a different character, '1'.
Required Properties:
- compatible: Should be "qnap,power-off"
- compatible: Should be "qnap,power-off" or "synology,power-off"
- reg: Address and length of the register set for UART1
- clocks: tclk clock

View file

@ -890,13 +890,12 @@ int __init mvebu_mbus_dt_init(void)
const __be32 *prop;
int ret;
np = of_find_matching_node(NULL, of_mvebu_mbus_ids);
np = of_find_matching_node_and_match(NULL, of_mvebu_mbus_ids, &of_id);
if (!np) {
pr_err("could not find a matching SoC family\n");
return -ENODEV;
}
of_id = of_match_node(of_mvebu_mbus_ids, np);
mbus_state.soc = of_id->data;
prop = of_get_property(np, "controller", NULL);

View file

@ -113,7 +113,7 @@ config ARM_INTEGRATOR
If in doubt, say Y.
config ARM_KIRKWOOD_CPUFREQ
def_bool ARCH_KIRKWOOD && OF
def_bool MACH_KIRKWOOD
help
This adds the CPUFreq driver for Marvell Kirkwood
SoCs.

View file

@ -22,7 +22,7 @@ config ARM_HIGHBANK_CPUIDLE
config ARM_KIRKWOOD_CPUIDLE
bool "CPU Idle Driver for Marvell Kirkwood SoCs"
depends on ARCH_KIRKWOOD
depends on ARCH_KIRKWOOD || MACH_KIRKWOOD
help
This adds the CPU Idle driver for Marvell Kirkwood SoCs.

View file

@ -421,7 +421,7 @@ config LEDS_MC13783
config LEDS_NS2
tristate "LED support for Network Space v2 GPIO LEDs"
depends on LEDS_CLASS
depends on ARCH_KIRKWOOD
depends on ARCH_KIRKWOOD || MACH_KIRKWOOD
default y
help
This option enable support for the dual-GPIO LED found on the
@ -431,7 +431,7 @@ config LEDS_NS2
config LEDS_NETXBIG
tristate "LED support for Big Network series LEDs"
depends on LEDS_CLASS
depends on ARCH_KIRKWOOD
depends on ARCH_KIRKWOOD || MACH_KIRKWOOD
default y
help
This option enable support for LEDs found on the LaCie 2Big

View file

@ -24,7 +24,7 @@ config PHY_EXYNOS_MIPI_VIDEO
config PHY_MVEBU_SATA
def_bool y
depends on ARCH_KIRKWOOD || ARCH_DOVE
depends on ARCH_KIRKWOOD || ARCH_DOVE || MACH_KIRKWOOD
depends on OF
select GENERIC_PHY

View file

@ -1,5 +1,5 @@
/*
* QNAP Turbo NAS Board power off
* QNAP Turbo NAS Board power off. Can also be used on Synology devices.
*
* Copyright (C) 2012 Andrew Lunn <andrew@lunn.ch>
*
@ -25,17 +25,43 @@
#define UART1_REG(x) (base + ((UART_##x) << 2))
struct power_off_cfg {
u32 baud;
char cmd;
};
static const struct power_off_cfg qnap_power_off_cfg = {
.baud = 19200,
.cmd = 'A',
};
static const struct power_off_cfg synology_power_off_cfg = {
.baud = 9600,
.cmd = '1',
};
static const struct of_device_id qnap_power_off_of_match_table[] = {
{ .compatible = "qnap,power-off",
.data = &qnap_power_off_cfg,
},
{ .compatible = "synology,power-off",
.data = &synology_power_off_cfg,
},
{}
};
MODULE_DEVICE_TABLE(of, qnap_power_off_of_match_table);
static void __iomem *base;
static unsigned long tclk;
static const struct power_off_cfg *cfg;
static void qnap_power_off(void)
{
/* 19200 baud divisor */
const unsigned divisor = ((tclk + (8 * 19200)) / (16 * 19200));
const unsigned divisor = ((tclk + (8 * cfg->baud)) / (16 * cfg->baud));
pr_err("%s: triggering power-off...\n", __func__);
/* hijack UART1 and reset into sane state (19200,8n1) */
/* hijack UART1 and reset into sane state */
writel(0x83, UART1_REG(LCR));
writel(divisor & 0xff, UART1_REG(DLL));
writel((divisor >> 8) & 0xff, UART1_REG(DLM));
@ -44,16 +70,21 @@ static void qnap_power_off(void)
writel(0x00, UART1_REG(FCR));
writel(0x00, UART1_REG(MCR));
/* send the power-off command 'A' to PIC */
writel('A', UART1_REG(TX));
/* send the power-off command to PIC */
writel(cfg->cmd, UART1_REG(TX));
}
static int qnap_power_off_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
struct resource *res;
struct clk *clk;
char symname[KSYM_NAME_LEN];
const struct of_device_id *match =
of_match_node(qnap_power_off_of_match_table, np);
cfg = match->data;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
dev_err(&pdev->dev, "Missing resource");
@ -94,12 +125,6 @@ static int qnap_power_off_remove(struct platform_device *pdev)
return 0;
}
static const struct of_device_id qnap_power_off_of_match_table[] = {
{ .compatible = "qnap,power-off", },
{}
};
MODULE_DEVICE_TABLE(of, qnap_power_off_of_match_table);
static struct platform_driver qnap_power_off_driver = {
.probe = qnap_power_off_probe,
.remove = qnap_power_off_remove,

View file

@ -275,10 +275,7 @@ static int isl12057_probe(struct i2c_client *client,
dev_set_drvdata(dev, data);
rtc = devm_rtc_device_register(dev, DRV_NAME, &rtc_ops, THIS_MODULE);
if (IS_ERR(rtc))
return PTR_ERR(rtc);
return 0;
return PTR_ERR_OR_ZERO(rtc);
}
#ifdef CONFIG_OF

View file

@ -222,6 +222,7 @@ static int __init mv_rtc_probe(struct platform_device *pdev)
struct resource *res;
struct rtc_plat_data *pdata;
u32 rtc_time;
u32 rtc_date;
int ret = 0;
pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
@ -257,6 +258,17 @@ static int __init mv_rtc_probe(struct platform_device *pdev)
}
}
/*
* A date after January 19th, 2038 does not fit on 32 bits and
* will confuse the kernel and userspace. Reset to a sane date
* (January 1st, 2013) if we're after 2038.
*/
rtc_date = readl(pdata->ioaddr + RTC_DATE_REG_OFFS);
if (bcd2bin((rtc_date >> RTC_YEAR_OFFS) & 0xff) >= 38) {
dev_info(&pdev->dev, "invalid RTC date, resetting to January 1st, 2013\n");
writel(0x130101, pdata->ioaddr + RTC_DATE_REG_OFFS);
}
pdata->irq = platform_get_irq(pdev, 0);
platform_set_drvdata(pdev, pdata);

View file

@ -142,7 +142,7 @@ config RCAR_THERMAL
config KIRKWOOD_THERMAL
tristate "Temperature sensor on Marvell Kirkwood SoCs"
depends on ARCH_KIRKWOOD
depends on ARCH_KIRKWOOD || MACH_KIRKWOOD
depends on OF
help
Support for the Kirkwood thermal sensor driver into the Linux thermal

View file

@ -1,6 +1,6 @@
config SND_KIRKWOOD_SOC
tristate "SoC Audio for the Marvell Kirkwood and Dove chips"
depends on ARCH_KIRKWOOD || ARCH_DOVE || COMPILE_TEST
depends on ARCH_KIRKWOOD || ARCH_DOVE || MACH_KIRKWOOD || COMPILE_TEST
help
Say Y or M if you want to add support for codecs attached to
the Kirkwood I2S interface. You will also need to select the