forked from Minki/linux
mvebu fixes for v3.9 round 3
- Kirkwood - a couple of small fixes for the Iomega ix2-200 board (ether and led) - mvebu - allow GPIO button to work on Mirabox when running SMP -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iQEcBAABAgAGBQJRZZxwAAoJEAi3KVZQDZAerwcIAKR1xRKuagtXvfij+xfVVRQ6 1G645hTIthFXmNiEeo3Y/mswHhVooZvu8SWh3o3J2Wsbnzeh+ch6jTsl+g6Tnb3E KmRFU0mcalRmsyYsh4PH9nDi8/oWyP+i3ZytgfcMlsSPNiE+Ek35NdTTWMLCTT8V MkGysVc8MWoOmMf47mNboy5UUUTXRdnSUJSjv1ubrsTK33LT7Ii9Ce+eoNvpvF+5 +6RenfRMzRSwkZf9AaCRPAhXISQKbMAwz6lKGo2GGAW+73Z+JclXXmiCfQ8pWie2 pfyqiEYigZFqe6Ly5BUtGoVfDjmOLDs+ATTUDOlOj0uaEc7pOwwKoAtpVRdck24= =yK1f -----END PGP SIGNATURE----- Merge tag 'tags/mvebu_fixes_for_v3.9_round3' into mvebu/dt pulling in mvebu branches which changes armada*.dts? files for LPAE changes mvebu fixes for v3.9 round 3 - Kirkwood - a couple of small fixes for the Iomega ix2-200 board (ether and led) - mvebu - allow GPIO button to work on Mirabox when running SMP
This commit is contained in:
commit
3c76a8a95d
@ -556,7 +556,6 @@ config ARCH_IXP4XX
|
||||
config ARCH_DOVE
|
||||
bool "Marvell Dove"
|
||||
select ARCH_REQUIRE_GPIOLIB
|
||||
select COMMON_CLK_DOVE
|
||||
select CPU_V7
|
||||
select GENERIC_CLOCKEVENTS
|
||||
select MIGHT_HAVE_PCI
|
||||
|
@ -91,7 +91,7 @@
|
||||
};
|
||||
|
||||
mvsdio@d00d4000 {
|
||||
pinctrl-0 = <&sdio_pins2>;
|
||||
pinctrl-0 = <&sdio_pins3>;
|
||||
pinctrl-names = "default";
|
||||
status = "okay";
|
||||
/*
|
||||
|
@ -64,6 +64,14 @@
|
||||
status = "okay";
|
||||
/* No CD or WP GPIOs */
|
||||
};
|
||||
|
||||
usb@d0050000 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
usb@d0051000 {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
gpio-keys {
|
||||
|
@ -31,7 +31,6 @@
|
||||
mpic: interrupt-controller@d0020000 {
|
||||
compatible = "marvell,mpic";
|
||||
#interrupt-cells = <1>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
interrupt-controller;
|
||||
};
|
||||
@ -54,7 +53,7 @@
|
||||
reg = <0xd0012000 0x100>;
|
||||
reg-shift = <2>;
|
||||
interrupts = <41>;
|
||||
reg-io-width = <4>;
|
||||
reg-io-width = <1>;
|
||||
status = "disabled";
|
||||
};
|
||||
serial@d0012100 {
|
||||
@ -62,7 +61,7 @@
|
||||
reg = <0xd0012100 0x100>;
|
||||
reg-shift = <2>;
|
||||
interrupts = <42>;
|
||||
reg-io-width = <4>;
|
||||
reg-io-width = <1>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
|
@ -59,6 +59,12 @@
|
||||
"mpp50", "mpp51", "mpp52";
|
||||
marvell,function = "sd0";
|
||||
};
|
||||
|
||||
sdio_pins3: sdio-pins3 {
|
||||
marvell,pins = "mpp48", "mpp49", "mpp50",
|
||||
"mpp51", "mpp52", "mpp53";
|
||||
marvell,function = "sd0";
|
||||
};
|
||||
};
|
||||
|
||||
gpio0: gpio@d0018100 {
|
||||
|
@ -46,7 +46,7 @@
|
||||
reg = <0xd0012200 0x100>;
|
||||
reg-shift = <2>;
|
||||
interrupts = <43>;
|
||||
reg-io-width = <4>;
|
||||
reg-io-width = <1>;
|
||||
status = "disabled";
|
||||
};
|
||||
serial@d0012300 {
|
||||
@ -54,7 +54,7 @@
|
||||
reg = <0xd0012300 0x100>;
|
||||
reg-shift = <2>;
|
||||
interrupts = <44>;
|
||||
reg-io-width = <4>;
|
||||
reg-io-width = <1>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
|
@ -202,6 +202,11 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
rtc@d8500 {
|
||||
compatible = "marvell,orion-rtc";
|
||||
reg = <0xd8500 0x20>;
|
||||
};
|
||||
|
||||
crypto: crypto@30000 {
|
||||
compatible = "marvell,orion-crypto";
|
||||
reg = <0x30000 0x10000>,
|
||||
|
@ -42,12 +42,10 @@
|
||||
|
||||
ocp@f1000000 {
|
||||
serial@12000 {
|
||||
clock-frequency = <166666667>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
serial@12100 {
|
||||
clock-frequency = <166666667>;
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
@ -50,7 +50,6 @@
|
||||
};
|
||||
};
|
||||
serial@12000 {
|
||||
clock-frequency = <200000000>;
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
@ -37,7 +37,6 @@
|
||||
};
|
||||
};
|
||||
serial@12000 {
|
||||
clock-frequency = <200000000>;
|
||||
status = "ok";
|
||||
};
|
||||
|
||||
|
@ -38,7 +38,6 @@
|
||||
};
|
||||
};
|
||||
serial@12000 {
|
||||
clock-frequency = <200000000>;
|
||||
status = "ok";
|
||||
};
|
||||
|
||||
|
@ -73,11 +73,11 @@
|
||||
};
|
||||
};
|
||||
serial@12000 {
|
||||
clock-frequency = <200000000>;
|
||||
status = "ok";
|
||||
};
|
||||
|
||||
nand@3000000 {
|
||||
chip-delay = <40>;
|
||||
status = "okay";
|
||||
|
||||
partition@0 {
|
||||
|
@ -51,7 +51,6 @@
|
||||
};
|
||||
};
|
||||
serial@12000 {
|
||||
clock-frequency = <200000000>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
|
@ -78,7 +78,6 @@
|
||||
};
|
||||
};
|
||||
serial@12000 {
|
||||
clock-frequency = <200000000>;
|
||||
status = "ok";
|
||||
};
|
||||
|
||||
|
@ -96,11 +96,11 @@
|
||||
marvell,function = "gpio";
|
||||
};
|
||||
pmx_led_rebuild_brt_ctrl_1: pmx-led-rebuild-brt-ctrl-1 {
|
||||
marvell,pins = "mpp44";
|
||||
marvell,pins = "mpp46";
|
||||
marvell,function = "gpio";
|
||||
};
|
||||
pmx_led_rebuild_brt_ctrl_2: pmx-led-rebuild-brt-ctrl-2 {
|
||||
marvell,pins = "mpp45";
|
||||
marvell,pins = "mpp47";
|
||||
marvell,function = "gpio";
|
||||
};
|
||||
|
||||
@ -115,7 +115,6 @@
|
||||
};
|
||||
|
||||
serial@12000 {
|
||||
clock-frequency = <200000000>;
|
||||
status = "ok";
|
||||
};
|
||||
|
||||
@ -158,14 +157,14 @@
|
||||
gpios = <&gpio0 16 0>;
|
||||
linux,default-trigger = "default-on";
|
||||
};
|
||||
health_led1 {
|
||||
rebuild_led {
|
||||
label = "status:white:rebuild_led";
|
||||
gpios = <&gpio1 4 0>;
|
||||
};
|
||||
health_led {
|
||||
label = "status:red:health_led";
|
||||
gpios = <&gpio1 5 0>;
|
||||
};
|
||||
health_led2 {
|
||||
label = "status:white:health_led";
|
||||
gpios = <&gpio1 4 0>;
|
||||
};
|
||||
backup_led {
|
||||
label = "status:blue:backup_led";
|
||||
gpios = <&gpio0 15 0>;
|
||||
|
@ -34,7 +34,6 @@
|
||||
};
|
||||
|
||||
serial@12000 {
|
||||
clock-frequency = <200000000>;
|
||||
status = "ok";
|
||||
};
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
ocp@f1000000 {
|
||||
serial@12000 {
|
||||
clock-frequency = <166666667>;
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
ocp@f1000000 {
|
||||
serial@12000 {
|
||||
clock-frequency = <200000000>;
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
@ -90,7 +90,6 @@
|
||||
};
|
||||
|
||||
serial@12000 {
|
||||
clock-frequency = <200000000>;
|
||||
status = "ok";
|
||||
};
|
||||
|
||||
|
@ -23,7 +23,6 @@
|
||||
};
|
||||
|
||||
serial@12000 {
|
||||
clock-frequency = <166666667>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
|
@ -117,7 +117,6 @@
|
||||
};
|
||||
|
||||
serial@12000 {
|
||||
clock-frequency = <200000000>;
|
||||
status = "ok";
|
||||
};
|
||||
|
||||
|
@ -18,12 +18,10 @@
|
||||
|
||||
ocp@f1000000 {
|
||||
serial@12000 {
|
||||
clock-frequency = <200000000>;
|
||||
status = "ok";
|
||||
};
|
||||
|
||||
serial@12100 {
|
||||
clock-frequency = <200000000>;
|
||||
status = "ok";
|
||||
};
|
||||
|
||||
|
@ -108,7 +108,6 @@
|
||||
};
|
||||
|
||||
serial@12000 {
|
||||
clock-frequency = <200000000>;
|
||||
status = "ok";
|
||||
};
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
interrupt-controller;
|
||||
#interrupt-cells = <2>;
|
||||
interrupts = <35>, <36>, <37>, <38>;
|
||||
clocks = <&gate_clk 7>;
|
||||
};
|
||||
|
||||
gpio1: gpio@10140 {
|
||||
@ -49,6 +50,7 @@
|
||||
interrupt-controller;
|
||||
#interrupt-cells = <2>;
|
||||
interrupts = <39>, <40>, <41>;
|
||||
clocks = <&gate_clk 7>;
|
||||
};
|
||||
|
||||
serial@12000 {
|
||||
@ -57,7 +59,6 @@
|
||||
reg-shift = <2>;
|
||||
interrupts = <33>;
|
||||
clocks = <&gate_clk 7>;
|
||||
/* set clock-frequency in board dts */
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@ -67,7 +68,6 @@
|
||||
reg-shift = <2>;
|
||||
interrupts = <34>;
|
||||
clocks = <&gate_clk 7>;
|
||||
/* set clock-frequency in board dts */
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@ -75,6 +75,7 @@
|
||||
compatible = "marvell,kirkwood-rtc", "marvell,orion-rtc";
|
||||
reg = <0x10300 0x20>;
|
||||
interrupts = <53>;
|
||||
clocks = <&gate_clk 7>;
|
||||
};
|
||||
|
||||
spi@10600 {
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
/ {
|
||||
model = "LaCie Ethernet Disk mini V2";
|
||||
compatible = "lacie,ethernet-disk-mini-v2", "marvell-orion5x-88f5182", "marvell,orion5x";
|
||||
compatible = "lacie,ethernet-disk-mini-v2", "marvell,orion5x-88f5182", "marvell,orion5x";
|
||||
|
||||
memory {
|
||||
reg = <0x00000000 0x4000000>; /* 64 MB */
|
||||
|
@ -13,6 +13,9 @@
|
||||
compatible = "marvell,orion5x";
|
||||
interrupt-parent = <&intc>;
|
||||
|
||||
aliases {
|
||||
gpio0 = &gpio0;
|
||||
};
|
||||
intc: interrupt-controller {
|
||||
compatible = "marvell,orion-intc", "marvell,intc";
|
||||
interrupt-controller;
|
||||
@ -32,7 +35,9 @@
|
||||
#gpio-cells = <2>;
|
||||
gpio-controller;
|
||||
reg = <0x10100 0x40>;
|
||||
ngpio = <32>;
|
||||
ngpios = <32>;
|
||||
interrupt-controller;
|
||||
#interrupt-cells = <2>;
|
||||
interrupts = <6>, <7>, <8>, <9>;
|
||||
};
|
||||
|
||||
@ -124,7 +129,7 @@
|
||||
reg = <0x90000 0x10000>,
|
||||
<0xf2200000 0x800>;
|
||||
reg-names = "regs", "sram";
|
||||
interrupts = <22>;
|
||||
interrupts = <28>;
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
@ -41,16 +41,12 @@ static void __init kirkwood_legacy_clk_init(void)
|
||||
|
||||
struct device_node *np = of_find_compatible_node(
|
||||
NULL, NULL, "marvell,kirkwood-gating-clock");
|
||||
|
||||
struct of_phandle_args clkspec;
|
||||
struct clk *clk;
|
||||
|
||||
clkspec.np = np;
|
||||
clkspec.args_count = 1;
|
||||
|
||||
clkspec.args[0] = CGC_BIT_GE0;
|
||||
orion_clkdev_add(NULL, "mv643xx_eth_port.0",
|
||||
of_clk_get_from_provider(&clkspec));
|
||||
|
||||
clkspec.args[0] = CGC_BIT_PEX0;
|
||||
orion_clkdev_add("0", "pcie",
|
||||
of_clk_get_from_provider(&clkspec));
|
||||
@ -59,9 +55,24 @@ static void __init kirkwood_legacy_clk_init(void)
|
||||
orion_clkdev_add("1", "pcie",
|
||||
of_clk_get_from_provider(&clkspec));
|
||||
|
||||
clkspec.args[0] = CGC_BIT_GE1;
|
||||
orion_clkdev_add(NULL, "mv643xx_eth_port.1",
|
||||
clkspec.args[0] = CGC_BIT_SDIO;
|
||||
orion_clkdev_add(NULL, "mvsdio",
|
||||
of_clk_get_from_provider(&clkspec));
|
||||
|
||||
/*
|
||||
* The ethernet interfaces forget the MAC address assigned by
|
||||
* u-boot if the clocks are turned off. Until proper DT support
|
||||
* is available we always enable them for now.
|
||||
*/
|
||||
clkspec.args[0] = CGC_BIT_GE0;
|
||||
clk = of_clk_get_from_provider(&clkspec);
|
||||
orion_clkdev_add(NULL, "mv643xx_eth_port.0", clk);
|
||||
clk_prepare_enable(clk);
|
||||
|
||||
clkspec.args[0] = CGC_BIT_GE1;
|
||||
clk = of_clk_get_from_provider(&clkspec);
|
||||
orion_clkdev_add(NULL, "mv643xx_eth_port.1", clk);
|
||||
clk_prepare_enable(clk);
|
||||
}
|
||||
|
||||
static void __init kirkwood_of_clk_init(void)
|
||||
|
@ -20,10 +20,15 @@ static struct mv643xx_eth_platform_data iomega_ix2_200_ge00_data = {
|
||||
.duplex = DUPLEX_FULL,
|
||||
};
|
||||
|
||||
static struct mv643xx_eth_platform_data iomega_ix2_200_ge01_data = {
|
||||
.phy_addr = MV643XX_ETH_PHY_ADDR(11),
|
||||
};
|
||||
|
||||
void __init iomega_ix2_200_init(void)
|
||||
{
|
||||
/*
|
||||
* Basic setup. Needs to be called early.
|
||||
*/
|
||||
kirkwood_ge01_init(&iomega_ix2_200_ge00_data);
|
||||
kirkwood_ge00_init(&iomega_ix2_200_ge00_data);
|
||||
kirkwood_ge01_init(&iomega_ix2_200_ge01_data);
|
||||
}
|
||||
|
@ -53,6 +53,8 @@ static struct mv_sata_platform_data guruplug_sata_data = {
|
||||
|
||||
static struct mvsdio_platform_data guruplug_mvsdio_data = {
|
||||
/* unfortunately the CD signal has not been connected */
|
||||
.gpio_card_detect = -1,
|
||||
.gpio_write_protect = -1,
|
||||
};
|
||||
|
||||
static struct gpio_led guruplug_led_pins[] = {
|
||||
|
@ -55,6 +55,7 @@ static struct mv_sata_platform_data openrd_sata_data = {
|
||||
|
||||
static struct mvsdio_platform_data openrd_mvsdio_data = {
|
||||
.gpio_card_detect = 29, /* MPP29 used as SD card detect */
|
||||
.gpio_write_protect = -1,
|
||||
};
|
||||
|
||||
static unsigned int openrd_mpp_config[] __initdata = {
|
||||
|
@ -69,6 +69,7 @@ static struct mv_sata_platform_data rd88f6281_sata_data = {
|
||||
|
||||
static struct mvsdio_platform_data rd88f6281_mvsdio_data = {
|
||||
.gpio_card_detect = 28,
|
||||
.gpio_write_protect = -1,
|
||||
};
|
||||
|
||||
static unsigned int rd88f6281_mpp_config[] __initdata = {
|
||||
|
@ -44,6 +44,8 @@
|
||||
|
||||
#define ARMADA_370_XP_MAX_PER_CPU_IRQS (28)
|
||||
|
||||
#define ARMADA_370_XP_TIMER0_PER_CPU_IRQ (5)
|
||||
|
||||
#define ACTIVE_DOORBELLS (8)
|
||||
|
||||
static DEFINE_RAW_SPINLOCK(irq_controller_lock);
|
||||
@ -59,36 +61,26 @@ static struct irq_domain *armada_370_xp_mpic_domain;
|
||||
*/
|
||||
static void armada_370_xp_irq_mask(struct irq_data *d)
|
||||
{
|
||||
#ifdef CONFIG_SMP
|
||||
irq_hw_number_t hwirq = irqd_to_hwirq(d);
|
||||
|
||||
if (hwirq > ARMADA_370_XP_MAX_PER_CPU_IRQS)
|
||||
if (hwirq != ARMADA_370_XP_TIMER0_PER_CPU_IRQ)
|
||||
writel(hwirq, main_int_base +
|
||||
ARMADA_370_XP_INT_CLEAR_ENABLE_OFFS);
|
||||
else
|
||||
writel(hwirq, per_cpu_int_base +
|
||||
ARMADA_370_XP_INT_SET_MASK_OFFS);
|
||||
#else
|
||||
writel(irqd_to_hwirq(d),
|
||||
per_cpu_int_base + ARMADA_370_XP_INT_SET_MASK_OFFS);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void armada_370_xp_irq_unmask(struct irq_data *d)
|
||||
{
|
||||
#ifdef CONFIG_SMP
|
||||
irq_hw_number_t hwirq = irqd_to_hwirq(d);
|
||||
|
||||
if (hwirq > ARMADA_370_XP_MAX_PER_CPU_IRQS)
|
||||
if (hwirq != ARMADA_370_XP_TIMER0_PER_CPU_IRQ)
|
||||
writel(hwirq, main_int_base +
|
||||
ARMADA_370_XP_INT_SET_ENABLE_OFFS);
|
||||
else
|
||||
writel(hwirq, per_cpu_int_base +
|
||||
ARMADA_370_XP_INT_CLEAR_MASK_OFFS);
|
||||
#else
|
||||
writel(irqd_to_hwirq(d),
|
||||
per_cpu_int_base + ARMADA_370_XP_INT_CLEAR_MASK_OFFS);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
@ -144,10 +136,14 @@ static int armada_370_xp_mpic_irq_map(struct irq_domain *h,
|
||||
unsigned int virq, irq_hw_number_t hw)
|
||||
{
|
||||
armada_370_xp_irq_mask(irq_get_irq_data(virq));
|
||||
writel(hw, main_int_base + ARMADA_370_XP_INT_SET_ENABLE_OFFS);
|
||||
if (hw != ARMADA_370_XP_TIMER0_PER_CPU_IRQ)
|
||||
writel(hw, per_cpu_int_base +
|
||||
ARMADA_370_XP_INT_CLEAR_MASK_OFFS);
|
||||
else
|
||||
writel(hw, main_int_base + ARMADA_370_XP_INT_SET_ENABLE_OFFS);
|
||||
irq_set_status_flags(virq, IRQ_LEVEL);
|
||||
|
||||
if (hw < ARMADA_370_XP_MAX_PER_CPU_IRQS) {
|
||||
if (hw == ARMADA_370_XP_TIMER0_PER_CPU_IRQ) {
|
||||
irq_set_percpu_devid(virq);
|
||||
irq_set_chip_and_handler(virq, &armada_370_xp_irq_chip,
|
||||
handle_percpu_devid_irq);
|
||||
|
@ -157,9 +157,12 @@ void __init orion_setup_cpu_mbus_target(const struct orion_addr_map_cfg *cfg,
|
||||
u32 size = readl(ddr_window_cpu_base + DDR_SIZE_CS_OFF(i));
|
||||
|
||||
/*
|
||||
* Chip select enabled?
|
||||
* We only take care of entries for which the chip
|
||||
* select is enabled, and that don't have high base
|
||||
* address bits set (devices can only access the first
|
||||
* 32 bits of the memory).
|
||||
*/
|
||||
if (size & 1) {
|
||||
if ((size & 1) && !(base & 0xF)) {
|
||||
struct mbus_dram_window *w;
|
||||
|
||||
w = &orion_mbus_dram_info.cs[cs++];
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include <linux/io.h>
|
||||
#include <linux/of_irq.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/pinctrl/consumer.h>
|
||||
|
||||
/*
|
||||
@ -496,6 +497,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
|
||||
struct resource *res;
|
||||
struct irq_chip_generic *gc;
|
||||
struct irq_chip_type *ct;
|
||||
struct clk *clk;
|
||||
unsigned int ngpios;
|
||||
int soc_variant;
|
||||
int i, cpu, id;
|
||||
@ -529,6 +531,11 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
|
||||
return id;
|
||||
}
|
||||
|
||||
clk = devm_clk_get(&pdev->dev, NULL);
|
||||
/* Not all SoCs require a clock.*/
|
||||
if (!IS_ERR(clk))
|
||||
clk_prepare_enable(clk);
|
||||
|
||||
mvchip->soc_variant = soc_variant;
|
||||
mvchip->chip.label = dev_name(&pdev->dev);
|
||||
mvchip->chip.dev = &pdev->dev;
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
@ -41,6 +42,7 @@ struct rtc_plat_data {
|
||||
struct rtc_device *rtc;
|
||||
void __iomem *ioaddr;
|
||||
int irq;
|
||||
struct clk *clk;
|
||||
};
|
||||
|
||||
static int mv_rtc_set_time(struct device *dev, struct rtc_time *tm)
|
||||
@ -221,6 +223,7 @@ static int mv_rtc_probe(struct platform_device *pdev)
|
||||
struct rtc_plat_data *pdata;
|
||||
resource_size_t size;
|
||||
u32 rtc_time;
|
||||
int ret = 0;
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (!res)
|
||||
@ -239,11 +242,17 @@ static int mv_rtc_probe(struct platform_device *pdev)
|
||||
if (!pdata->ioaddr)
|
||||
return -ENOMEM;
|
||||
|
||||
pdata->clk = devm_clk_get(&pdev->dev, NULL);
|
||||
/* Not all SoCs require a clock.*/
|
||||
if (!IS_ERR(pdata->clk))
|
||||
clk_prepare_enable(pdata->clk);
|
||||
|
||||
/* make sure the 24 hours mode is enabled */
|
||||
rtc_time = readl(pdata->ioaddr + RTC_TIME_REG_OFFS);
|
||||
if (rtc_time & RTC_HOURS_12H_MODE) {
|
||||
dev_err(&pdev->dev, "24 Hours mode not supported.\n");
|
||||
return -EINVAL;
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* make sure it is actually functional */
|
||||
@ -252,7 +261,8 @@ static int mv_rtc_probe(struct platform_device *pdev)
|
||||
rtc_time = readl(pdata->ioaddr + RTC_TIME_REG_OFFS);
|
||||
if (rtc_time == 0x01000000) {
|
||||
dev_err(&pdev->dev, "internal RTC not ticking\n");
|
||||
return -ENODEV;
|
||||
ret = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
@ -268,8 +278,10 @@ static int mv_rtc_probe(struct platform_device *pdev)
|
||||
} else
|
||||
pdata->rtc = rtc_device_register(pdev->name, &pdev->dev,
|
||||
&mv_rtc_ops, THIS_MODULE);
|
||||
if (IS_ERR(pdata->rtc))
|
||||
return PTR_ERR(pdata->rtc);
|
||||
if (IS_ERR(pdata->rtc)) {
|
||||
ret = PTR_ERR(pdata->rtc);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (pdata->irq >= 0) {
|
||||
writel(0, pdata->ioaddr + RTC_ALARM_INTERRUPT_MASK_REG_OFFS);
|
||||
@ -282,6 +294,11 @@ static int mv_rtc_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
return 0;
|
||||
out:
|
||||
if (!IS_ERR(pdata->clk))
|
||||
clk_disable_unprepare(pdata->clk);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __exit mv_rtc_remove(struct platform_device *pdev)
|
||||
@ -292,6 +309,9 @@ static int __exit mv_rtc_remove(struct platform_device *pdev)
|
||||
device_init_wakeup(&pdev->dev, 0);
|
||||
|
||||
rtc_device_unregister(pdata->rtc);
|
||||
if (!IS_ERR(pdata->clk))
|
||||
clk_disable_unprepare(pdata->clk);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user