Merge tag 'imx-cleanup-3.18' of git://git.kernel.org/pub/scm/linux/kernel/git/shawngu...
authorOlof Johansson <olof@lixom.net>
Wed, 24 Sep 2014 18:20:48 +0000 (11:20 -0700)
committerOlof Johansson <olof@lixom.net>
Wed, 24 Sep 2014 18:21:01 +0000 (11:21 -0700)
Merge "ARM: imx: cleanup for 3.18" from Shawn Guo:

The i.MX cleanup for 3.18:
 - Reomve a few i.MX27 and i.MX1 board files
 - Remove imx_scu_standby_enable() since core code handles scu
   standby now
 - Remove unnecessary iomux declaration
 - Remove useless sound card property from vf610-twr dts

* tag 'imx-cleanup-3.18' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux:
  ARM: imx: Remove mach-mxt_td60 board file
  ARM: i.MX: Remove i.MX1 ADS board support
  ARM: dts: vf610-twr: remove useless property for sound card.
  ARM: imx: remove imx_scu_standby_enable()
  ARM: i.MX: Remove Phytec i.MX27 PCM038/PCM970 board files
  ARM: i.MX: Remove mach-cpuimx27sd board file
  ARM: imx: iomux: Do not export symbol without public declaration

Signed-off-by: Olof Johansson <olof@lixom.net>
37 files changed:
arch/arm/Kconfig
arch/arm/mach-at91/Kconfig
arch/arm/mach-at91/Kconfig.non_dt
arch/arm/mach-at91/Makefile
arch/arm/mach-at91/board-dt-rm9200.c
arch/arm/mach-at91/board-dt-sam9.c
arch/arm/mach-at91/board-dt-sama5.c
arch/arm/mach-at91/irq.c
arch/arm/mach-at91/pm.c
arch/arm/mach-at91/setup.c
arch/arm/mach-clps711x/common.c
arch/arm/mach-clps711x/common.h
arch/arm/mach-msm/board-mahimahi.c [deleted file]
arch/arm/mach-msm/board-msm7x30.c
arch/arm/mach-msm/board-trout-gpio.c
arch/arm/mach-msm/board-trout.c
arch/arm/mach-msm/io.c
arch/arm/mach-orion5x/dns323-setup.c
arch/arm/mach-orion5x/terastation_pro2-setup.c
arch/arm/mach-orion5x/ts209-setup.c
arch/arm/mach-orion5x/ts409-setup.c
arch/arm/mach-orion5x/ts78xx-setup.c
arch/arm/mach-shmobile/Kconfig
arch/arm/mach-shmobile/Makefile
arch/arm/mach-shmobile/board-armadillo800eva.c
arch/arm/mach-shmobile/board-mackerel.c
arch/arm/mach-shmobile/pm-r8a7740.c
arch/arm/mach-shmobile/pm-rcar.c
arch/arm/mach-shmobile/pm-rmobile.c
arch/arm/mach-shmobile/pm-rmobile.h
arch/arm/mach-shmobile/setup-r8a7740.c
arch/arm/mach-shmobile/setup-sh7372.c
arch/arm/mach-sunxi/sunxi.c
drivers/clocksource/tcb_clksrc.c
drivers/misc/atmel_tclib.c
drivers/pwm/pwm-atmel-tcb.c
include/linux/atmel_tc.h

index 32cbbd5659023cffe04faf6c97eb7ee5be196585..314bdf1163f972699e6210e0a0e9b4e5202a5c6b 100644 (file)
@@ -650,6 +650,7 @@ config ARCH_SHMOBILE_LEGACY
        select ARCH_SHMOBILE
        select ARM_PATCH_PHYS_VIRT if MMU
        select CLKDEV_LOOKUP
+       select CPU_V7
        select GENERIC_CLOCKEVENTS
        select HAVE_ARM_SCU if SMP
        select HAVE_ARM_TWD if SMP
@@ -660,6 +661,7 @@ config ARCH_SHMOBILE_LEGACY
        select NO_IOPORT_MAP
        select PINCTRL
        select PM_GENERIC_DOMAINS if PM
+       select SH_CLK_CPG
        select SPARSE_IRQ
        help
          Support for Renesas ARM SoC platforms using a non-multiplatform
index 6cc6f7aebdaea65004409a84fa1a7913a67c1bbb..dd28e1fedbdce67ac24269cedbb6e6558b67f6a2 100644 (file)
@@ -28,6 +28,11 @@ config OLD_CLK_AT91
        bool
        default AT91_PMC_UNIT && AT91_USE_OLD_CLK
 
+config OLD_IRQ_AT91
+       bool
+       select MULTI_IRQ_HANDLER
+       select SPARSE_IRQ
+
 config AT91_SAM9_ALT_RESET
        bool
        default !ARCH_AT91X40
@@ -45,18 +50,16 @@ config HAVE_AT91_SMD
 config SOC_AT91SAM9
        bool
        select AT91_SAM9_TIME
+       select ATMEL_AIC_IRQ if !OLD_IRQ_AT91
        select CPU_ARM926T
        select GENERIC_CLOCKEVENTS
-       select MULTI_IRQ_HANDLER
-       select SPARSE_IRQ
 
 config SOC_SAMA5
        bool
        select AT91_SAM9_TIME
+       select ATMEL_AIC5_IRQ
        select CPU_V7
        select GENERIC_CLOCKEVENTS
-       select MULTI_IRQ_HANDLER
-       select SPARSE_IRQ
        select USE_OF
 
 menu "Atmel AT91 System-on-Chip"
@@ -70,8 +73,7 @@ config ARCH_AT91X40
        depends on !MMU
        select CPU_ARM7TDMI
        select ARCH_USES_GETTIMEOFFSET
-       select MULTI_IRQ_HANDLER
-       select SPARSE_IRQ
+       select OLD_IRQ_AT91
 
        help
          Select this if you are using one of Atmel's AT91X40 SoC.
@@ -108,11 +110,10 @@ endif
 if SOC_SAM_V4_V5
 config SOC_AT91RM9200
        bool "AT91RM9200"
+       select ATMEL_AIC_IRQ if !OLD_IRQ_AT91
        select CPU_ARM920T
        select GENERIC_CLOCKEVENTS
        select HAVE_AT91_DBGU0
-       select MULTI_IRQ_HANDLER
-       select SPARSE_IRQ
        select HAVE_AT91_USB_CLK
 
 config SOC_AT91SAM9260
index 44ace320d2e107ee27a755d82f339996dae81c17..b774c3d3c632a5f8146e4fa7f8a542a14f96ac1b 100644 (file)
@@ -14,31 +14,37 @@ config ARCH_AT91RM9200
        bool "AT91RM9200"
        select SOC_AT91RM9200
        select AT91_USE_OLD_CLK
+       select OLD_IRQ_AT91
 
 config ARCH_AT91SAM9260
        bool "AT91SAM9260 or AT91SAM9XE or AT91SAM9G20"
        select SOC_AT91SAM9260
        select AT91_USE_OLD_CLK
+       select OLD_IRQ_AT91
 
 config ARCH_AT91SAM9261
        bool "AT91SAM9261 or AT91SAM9G10"
        select SOC_AT91SAM9261
        select AT91_USE_OLD_CLK
+       select OLD_IRQ_AT91
 
 config ARCH_AT91SAM9263
        bool "AT91SAM9263"
        select SOC_AT91SAM9263
        select AT91_USE_OLD_CLK
+       select OLD_IRQ_AT91
 
 config ARCH_AT91SAM9RL
        bool "AT91SAM9RL"
        select SOC_AT91SAM9RL
        select AT91_USE_OLD_CLK
+       select OLD_IRQ_AT91
 
 config ARCH_AT91SAM9G45
        bool "AT91SAM9G45"
        select SOC_AT91SAM9G45
        select AT91_USE_OLD_CLK
+       select OLD_IRQ_AT91
 
 endchoice
 
index 78e9cec282f451c6e17c03845107087bb7ae0892..d972fd67de831784b2915514f2dba8807befd33f 100644 (file)
@@ -2,11 +2,12 @@
 # Makefile for the linux kernel.
 #
 
-obj-y          := irq.o gpio.o setup.o sysirq_mask.o
+obj-y          := gpio.o setup.o sysirq_mask.o
 obj-m          :=
 obj-n          :=
 obj-           :=
 
+obj-$(CONFIG_OLD_IRQ_AT91)     += irq.o
 obj-$(CONFIG_OLD_CLK_AT91)     += clock.o
 obj-$(CONFIG_AT91_SAM9_ALT_RESET) += at91sam9_alt_reset.o
 obj-$(CONFIG_AT91_SAM9G45_RESET) += at91sam9g45_reset.o
index 3a185faee795b589725bffd222e2299eac5cffc3..61ea214456643ef1e505f15aebd525e53fc5227d 100644 (file)
 #include "at91_aic.h"
 #include "generic.h"
 
-
-static const struct of_device_id irq_of_match[] __initconst = {
-       { .compatible = "atmel,at91rm9200-aic", .data = at91_aic_of_init },
-       { /*sentinel*/ }
-};
-
-static void __init at91rm9200_dt_init_irq(void)
-{
-       of_irq_init(irq_of_match);
-}
-
 static const char *at91rm9200_dt_board_compat[] __initdata = {
        "atmel,at91rm9200",
        NULL
@@ -43,8 +32,6 @@ static const char *at91rm9200_dt_board_compat[] __initdata = {
 DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200 (Device Tree)")
        .init_time      = at91rm9200_timer_init,
        .map_io         = at91_map_io,
-       .handle_irq     = at91_aic_handle_irq,
        .init_early     = at91rm9200_dt_initialize,
-       .init_irq       = at91rm9200_dt_init_irq,
        .dt_compat      = at91rm9200_dt_board_compat,
 MACHINE_END
index 575b0be66ca8958028c656e3289b26368fb401a4..dfa8d48146fe57d93c6c522f1ca36cf32a1df565 100644 (file)
@@ -34,17 +34,6 @@ static void __init sam9_dt_timer_init(void)
        at91sam926x_pit_init();
 }
 
-static const struct of_device_id irq_of_match[] __initconst = {
-
-       { .compatible = "atmel,at91rm9200-aic", .data = at91_aic_of_init },
-       { /*sentinel*/ }
-};
-
-static void __init at91_dt_init_irq(void)
-{
-       of_irq_init(irq_of_match);
-}
-
 static const char *at91_dt_board_compat[] __initdata = {
        "atmel,at91sam9",
        NULL
@@ -54,8 +43,6 @@ DT_MACHINE_START(at91sam_dt, "Atmel AT91SAM (Device Tree)")
        /* Maintainer: Atmel */
        .init_time      = sam9_dt_timer_init,
        .map_io         = at91_map_io,
-       .handle_irq     = at91_aic_handle_irq,
        .init_early     = at91_dt_initialize,
-       .init_irq       = at91_dt_init_irq,
        .dt_compat      = at91_dt_board_compat,
 MACHINE_END
index 075ec0576adaf8b3d5b234a1aad729cb9aaeced7..d6fe04bcaabd3ba5a688955b86ea1b270a8a25ab 100644 (file)
@@ -35,17 +35,6 @@ static void __init sama5_dt_timer_init(void)
        at91sam926x_pit_init();
 }
 
-static const struct of_device_id irq_of_match[] __initconst = {
-
-       { .compatible = "atmel,sama5d3-aic", .data = at91_aic5_of_init },
-       { /*sentinel*/ }
-};
-
-static void __init at91_dt_init_irq(void)
-{
-       of_irq_init(irq_of_match);
-}
-
 static int ksz9021rn_phy_fixup(struct phy_device *phy)
 {
        int value;
@@ -82,9 +71,7 @@ DT_MACHINE_START(sama5_dt, "Atmel SAMA5 (Device Tree)")
        /* Maintainer: Atmel */
        .init_time      = sama5_dt_timer_init,
        .map_io         = at91_map_io,
-       .handle_irq     = at91_aic5_handle_irq,
        .init_early     = at91_dt_initialize,
-       .init_irq       = at91_dt_init_irq,
        .init_machine   = sama5_dt_device_init,
        .dt_compat      = sama5_dt_board_compat,
 MACHINE_END
index 3d192c5aee665e60b24e5fae09171e6315b32b19..cdb3ec9efd2ba291ee8ce928abaf7fdf838dcce7 100644 (file)
@@ -48,11 +48,6 @@ void __iomem *at91_aic_base;
 static struct irq_domain *at91_aic_domain;
 static struct device_node *at91_aic_np;
 static unsigned int n_irqs = NR_AIC_IRQS;
-static unsigned long at91_aic_caps = 0;
-
-/* AIC5 introduces a Source Select Register */
-#define AT91_AIC_CAP_AIC5      (1 << 0)
-#define has_aic5()             (at91_aic_caps & AT91_AIC_CAP_AIC5)
 
 #ifdef CONFIG_PM
 
@@ -92,50 +87,14 @@ static int at91_aic_set_wake(struct irq_data *d, unsigned value)
 
 void at91_irq_suspend(void)
 {
-       int bit = -1;
-
-       if (has_aic5()) {
-               /* disable enabled irqs */
-               while ((bit = find_next_bit(backups, n_irqs, bit + 1)) < n_irqs) {
-                       at91_aic_write(AT91_AIC5_SSR,
-                                      bit & AT91_AIC5_INTSEL_MSK);
-                       at91_aic_write(AT91_AIC5_IDCR, 1);
-               }
-               /* enable wakeup irqs */
-               bit = -1;
-               while ((bit = find_next_bit(wakeups, n_irqs, bit + 1)) < n_irqs) {
-                       at91_aic_write(AT91_AIC5_SSR,
-                                      bit & AT91_AIC5_INTSEL_MSK);
-                       at91_aic_write(AT91_AIC5_IECR, 1);
-               }
-       } else {
-               at91_aic_write(AT91_AIC_IDCR, *backups);
-               at91_aic_write(AT91_AIC_IECR, *wakeups);
-       }
+       at91_aic_write(AT91_AIC_IDCR, *backups);
+       at91_aic_write(AT91_AIC_IECR, *wakeups);
 }
 
 void at91_irq_resume(void)
 {
-       int bit = -1;
-
-       if (has_aic5()) {
-               /* disable wakeup irqs */
-               while ((bit = find_next_bit(wakeups, n_irqs, bit + 1)) < n_irqs) {
-                       at91_aic_write(AT91_AIC5_SSR,
-                                      bit & AT91_AIC5_INTSEL_MSK);
-                       at91_aic_write(AT91_AIC5_IDCR, 1);
-               }
-               /* enable irqs disabled for suspend */
-               bit = -1;
-               while ((bit = find_next_bit(backups, n_irqs, bit + 1)) < n_irqs) {
-                       at91_aic_write(AT91_AIC5_SSR,
-                                      bit & AT91_AIC5_INTSEL_MSK);
-                       at91_aic_write(AT91_AIC5_IECR, 1);
-               }
-       } else {
-               at91_aic_write(AT91_AIC_IDCR, *wakeups);
-               at91_aic_write(AT91_AIC_IECR, *backups);
-       }
+       at91_aic_write(AT91_AIC_IDCR, *wakeups);
+       at91_aic_write(AT91_AIC_IECR, *backups);
 }
 
 #else
@@ -169,21 +128,6 @@ at91_aic_handle_irq(struct pt_regs *regs)
                handle_IRQ(irqnr, regs);
 }
 
-asmlinkage void __exception_irq_entry
-at91_aic5_handle_irq(struct pt_regs *regs)
-{
-       u32 irqnr;
-       u32 irqstat;
-
-       irqnr = at91_aic_read(AT91_AIC5_IVR);
-       irqstat = at91_aic_read(AT91_AIC5_ISR);
-
-       if (!irqstat)
-               at91_aic_write(AT91_AIC5_EOICR, 0);
-       else
-               handle_IRQ(irqnr, regs);
-}
-
 static void at91_aic_mask_irq(struct irq_data *d)
 {
        /* Disable interrupt on AIC */
@@ -192,15 +136,6 @@ static void at91_aic_mask_irq(struct irq_data *d)
        clear_backup(d->hwirq);
 }
 
-static void __maybe_unused at91_aic5_mask_irq(struct irq_data *d)
-{
-       /* Disable interrupt on AIC5 */
-       at91_aic_write(AT91_AIC5_SSR, d->hwirq & AT91_AIC5_INTSEL_MSK);
-       at91_aic_write(AT91_AIC5_IDCR, 1);
-       /* Update ISR cache */
-       clear_backup(d->hwirq);
-}
-
 static void at91_aic_unmask_irq(struct irq_data *d)
 {
        /* Enable interrupt on AIC */
@@ -209,15 +144,6 @@ static void at91_aic_unmask_irq(struct irq_data *d)
        set_backup(d->hwirq);
 }
 
-static void __maybe_unused at91_aic5_unmask_irq(struct irq_data *d)
-{
-       /* Enable interrupt on AIC5 */
-       at91_aic_write(AT91_AIC5_SSR, d->hwirq & AT91_AIC5_INTSEL_MSK);
-       at91_aic_write(AT91_AIC5_IECR, 1);
-       /* Update ISR cache */
-       set_backup(d->hwirq);
-}
-
 static void at91_aic_eoi(struct irq_data *d)
 {
        /*
@@ -227,11 +153,6 @@ static void at91_aic_eoi(struct irq_data *d)
        at91_aic_write(AT91_AIC_EOICR, 0);
 }
 
-static void __maybe_unused at91_aic5_eoi(struct irq_data *d)
-{
-       at91_aic_write(AT91_AIC5_EOICR, 0);
-}
-
 static unsigned long *at91_extern_irq;
 
 u32 at91_get_extern_irq(void)
@@ -282,16 +203,8 @@ static int at91_aic_set_type(struct irq_data *d, unsigned type)
        if (srctype < 0)
                return srctype;
 
-       if (has_aic5()) {
-               at91_aic_write(AT91_AIC5_SSR,
-                              d->hwirq & AT91_AIC5_INTSEL_MSK);
-               smr = at91_aic_read(AT91_AIC5_SMR) & ~AT91_AIC_SRCTYPE;
-               at91_aic_write(AT91_AIC5_SMR, smr | srctype);
-       } else {
-               smr = at91_aic_read(AT91_AIC_SMR(d->hwirq))
-                     & ~AT91_AIC_SRCTYPE;
-               at91_aic_write(AT91_AIC_SMR(d->hwirq), smr | srctype);
-       }
+       smr = at91_aic_read(AT91_AIC_SMR(d->hwirq)) & ~AT91_AIC_SRCTYPE;
+       at91_aic_write(AT91_AIC_SMR(d->hwirq), smr | srctype);
 
        return 0;
 }
@@ -331,177 +244,6 @@ static void __init at91_aic_hw_init(unsigned int spu_vector)
        at91_aic_write(AT91_AIC_ICCR, 0xFFFFFFFF);
 }
 
-static void __init __maybe_unused at91_aic5_hw_init(unsigned int spu_vector)
-{
-       int i;
-
-       /*
-        * Perform 8 End Of Interrupt Command to make sure AIC
-        * will not Lock out nIRQ
-        */
-       for (i = 0; i < 8; i++)
-               at91_aic_write(AT91_AIC5_EOICR, 0);
-
-       /*
-        * Spurious Interrupt ID in Spurious Vector Register.
-        * When there is no current interrupt, the IRQ Vector Register
-        * reads the value stored in AIC_SPU
-        */
-       at91_aic_write(AT91_AIC5_SPU, spu_vector);
-
-       /* No debugging in AIC: Debug (Protect) Control Register */
-       at91_aic_write(AT91_AIC5_DCR, 0);
-
-       /* Disable and clear all interrupts initially */
-       for (i = 0; i < n_irqs; i++) {
-               at91_aic_write(AT91_AIC5_SSR, i & AT91_AIC5_INTSEL_MSK);
-               at91_aic_write(AT91_AIC5_IDCR, 1);
-               at91_aic_write(AT91_AIC5_ICCR, 1);
-       }
-}
-
-#if defined(CONFIG_OF)
-static unsigned int *at91_aic_irq_priorities;
-
-static int at91_aic_irq_map(struct irq_domain *h, unsigned int virq,
-                                                       irq_hw_number_t hw)
-{
-       /* Put virq number in Source Vector Register */
-       at91_aic_write(AT91_AIC_SVR(hw), virq);
-
-       /* Active Low interrupt, with priority */
-       at91_aic_write(AT91_AIC_SMR(hw),
-                      AT91_AIC_SRCTYPE_LOW | at91_aic_irq_priorities[hw]);
-
-       irq_set_chip_and_handler(virq, &at91_aic_chip, handle_fasteoi_irq);
-       set_irq_flags(virq, IRQF_VALID | IRQF_PROBE);
-
-       return 0;
-}
-
-static int at91_aic5_irq_map(struct irq_domain *h, unsigned int virq,
-               irq_hw_number_t hw)
-{
-       at91_aic_write(AT91_AIC5_SSR, hw & AT91_AIC5_INTSEL_MSK);
-
-       /* Put virq number in Source Vector Register */
-       at91_aic_write(AT91_AIC5_SVR, virq);
-
-       /* Active Low interrupt, with priority */
-       at91_aic_write(AT91_AIC5_SMR,
-                      AT91_AIC_SRCTYPE_LOW | at91_aic_irq_priorities[hw]);
-
-       irq_set_chip_and_handler(virq, &at91_aic_chip, handle_fasteoi_irq);
-       set_irq_flags(virq, IRQF_VALID | IRQF_PROBE);
-
-       return 0;
-}
-
-static int at91_aic_irq_domain_xlate(struct irq_domain *d, struct device_node *ctrlr,
-                               const u32 *intspec, unsigned int intsize,
-                               irq_hw_number_t *out_hwirq, unsigned int *out_type)
-{
-       if (WARN_ON(intsize < 3))
-               return -EINVAL;
-       if (WARN_ON(intspec[0] >= n_irqs))
-               return -EINVAL;
-       if (WARN_ON((intspec[2] < AT91_AIC_IRQ_MIN_PRIORITY)
-                   || (intspec[2] > AT91_AIC_IRQ_MAX_PRIORITY)))
-               return -EINVAL;
-
-       *out_hwirq = intspec[0];
-       *out_type = intspec[1] & IRQ_TYPE_SENSE_MASK;
-       at91_aic_irq_priorities[*out_hwirq] = intspec[2];
-
-       return 0;
-}
-
-static struct irq_domain_ops at91_aic_irq_ops = {
-       .map    = at91_aic_irq_map,
-       .xlate  = at91_aic_irq_domain_xlate,
-};
-
-int __init at91_aic_of_common_init(struct device_node *node,
-                                   struct device_node *parent)
-{
-       struct property *prop;
-       const __be32 *p;
-       u32 val;
-
-       at91_extern_irq = kzalloc(BITS_TO_LONGS(n_irqs)
-                                 * sizeof(*at91_extern_irq), GFP_KERNEL);
-       if (!at91_extern_irq)
-               return -ENOMEM;
-
-       if (at91_aic_pm_init()) {
-               kfree(at91_extern_irq);
-               return -ENOMEM;
-       }
-
-       at91_aic_irq_priorities = kzalloc(n_irqs
-                                         * sizeof(*at91_aic_irq_priorities),
-                                         GFP_KERNEL);
-       if (!at91_aic_irq_priorities)
-               return -ENOMEM;
-
-       at91_aic_base = of_iomap(node, 0);
-       at91_aic_np = node;
-
-       at91_aic_domain = irq_domain_add_linear(at91_aic_np, n_irqs,
-                                               &at91_aic_irq_ops, NULL);
-       if (!at91_aic_domain)
-               panic("Unable to add AIC irq domain (DT)\n");
-
-       of_property_for_each_u32(node, "atmel,external-irqs", prop, p, val) {
-               if (val >= n_irqs)
-                       pr_warn("AIC: external irq %d >= %d skip it\n",
-                               val, n_irqs);
-               else
-                       set_bit(val, at91_extern_irq);
-       }
-
-       irq_set_default_host(at91_aic_domain);
-
-       return 0;
-}
-
-int __init at91_aic_of_init(struct device_node *node,
-                                    struct device_node *parent)
-{
-       int err;
-
-       err = at91_aic_of_common_init(node, parent);
-       if (err)
-               return err;
-
-       at91_aic_hw_init(n_irqs);
-
-       return 0;
-}
-
-int __init at91_aic5_of_init(struct device_node *node,
-                                    struct device_node *parent)
-{
-       int err;
-
-       at91_aic_caps |= AT91_AIC_CAP_AIC5;
-       n_irqs = NR_AIC5_IRQS;
-       at91_aic_chip.irq_ack           = at91_aic5_mask_irq;
-       at91_aic_chip.irq_mask          = at91_aic5_mask_irq;
-       at91_aic_chip.irq_unmask        = at91_aic5_unmask_irq;
-       at91_aic_chip.irq_eoi           = at91_aic5_eoi;
-       at91_aic_irq_ops.map            = at91_aic5_irq_map;
-
-       err = at91_aic_of_common_init(node, parent);
-       if (err)
-               return err;
-
-       at91_aic5_hw_init(n_irqs);
-
-       return 0;
-}
-#endif
-
 /*
  * Initialize the AIC interrupt controller.
  */
index e95554532987e431ae509d47aa8f4f0dc70833e6..5920373809c52dd5195200e99171f16ce1647bcb 100644 (file)
@@ -206,16 +206,19 @@ static int at91_pm_enter(suspend_state_t state)
                at91_pinctrl_gpio_suspend();
        else
                at91_gpio_suspend();
-       at91_irq_suspend();
 
-       pr_debug("AT91: PM - wake mask %08x, pm state %d\n",
-                       /* remember all the always-wake irqs */
-                       (at91_pmc_read(AT91_PMC_PCSR)
-                                       | (1 << AT91_ID_FIQ)
-                                       | (1 << AT91_ID_SYS)
-                                       | (at91_get_extern_irq()))
-                               & at91_aic_read(AT91_AIC_IMR),
-                       state);
+       if (IS_ENABLED(CONFIG_OLD_IRQ_AT91) && at91_aic_base) {
+               at91_irq_suspend();
+
+               pr_debug("AT91: PM - wake mask %08x, pm state %d\n",
+                               /* remember all the always-wake irqs */
+                               (at91_pmc_read(AT91_PMC_PCSR)
+                                               | (1 << AT91_ID_FIQ)
+                                               | (1 << AT91_ID_SYS)
+                                               | (at91_get_extern_irq()))
+                                       & at91_aic_read(AT91_AIC_IMR),
+                               state);
+       }
 
        switch (state) {
                /*
@@ -280,12 +283,17 @@ static int at91_pm_enter(suspend_state_t state)
                        goto error;
        }
 
-       pr_debug("AT91: PM - wakeup %08x\n",
-                       at91_aic_read(AT91_AIC_IPR) & at91_aic_read(AT91_AIC_IMR));
+       if (IS_ENABLED(CONFIG_OLD_IRQ_AT91) && at91_aic_base)
+               pr_debug("AT91: PM - wakeup %08x\n",
+                        at91_aic_read(AT91_AIC_IPR) &
+                        at91_aic_read(AT91_AIC_IMR));
 
 error:
        target_state = PM_SUSPEND_ON;
-       at91_irq_resume();
+
+       if (IS_ENABLED(CONFIG_OLD_IRQ_AT91) && at91_aic_base)
+               at91_irq_resume();
+
        if (of_have_populated_dt())
                at91_pinctrl_gpio_resume();
        else
index f7a07a58ebb6aa10da5f9aae0dac80bd745d1e15..0bf893a574f984ec7844eb0626e9ed90dee389ce 100644 (file)
@@ -49,7 +49,8 @@ void __init at91_init_irq_default(void)
 void __init at91_init_interrupts(unsigned int *priority)
 {
        /* Initialize the AIC interrupt controller */
-       at91_aic_init(priority, at91_boot_soc.extern_irq);
+       if (IS_ENABLED(CONFIG_OLD_IRQ_AT91))
+               at91_aic_init(priority, at91_boot_soc.extern_irq);
 
        /* Enable GPIO interrupts */
        at91_gpio_irq_setup();
index 2a6323b157824410fa6f6d165d7f81724c999f90..671acc5a32823c0caed2bce69cce25dc6b98000c 100644 (file)
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#include <linux/io.h>
+
 #include <linux/init.h>
 #include <linux/sizes.h>
-#include <linux/interrupt.h>
-#include <linux/irq.h>
-#include <linux/clk.h>
-#include <linux/clkdev.h>
-#include <linux/clockchips.h>
-#include <linux/clocksource.h>
-#include <linux/clk-provider.h>
-#include <linux/sched_clock.h>
 
 #include <asm/mach/map.h>
-#include <asm/mach/time.h>
 #include <asm/system_misc.h>
 
 #include <mach/hardware.h>
 
 #include "common.h"
 
-static struct clk *clk_pll, *clk_bus, *clk_uart, *clk_timerl, *clk_timerh,
-                 *clk_tint, *clk_spi;
-
 /*
  * This maps the generic CLPS711x registers
  */
@@ -64,129 +52,11 @@ void __init clps711x_init_irq(void)
        clps711x_intc_init(CLPS711X_PHYS_BASE, SZ_16K);
 }
 
-static u64 notrace clps711x_sched_clock_read(void)
-{
-       return ~readw_relaxed(CLPS711X_VIRT_BASE + TC1D);
-}
-
-static void clps711x_clockevent_set_mode(enum clock_event_mode mode,
-                                        struct clock_event_device *evt)
-{
-       disable_irq(IRQ_TC2OI);
-
-       switch (mode) {
-       case CLOCK_EVT_MODE_PERIODIC:
-               enable_irq(IRQ_TC2OI);
-               break;
-       case CLOCK_EVT_MODE_ONESHOT:
-               /* Not supported */
-       case CLOCK_EVT_MODE_SHUTDOWN:
-       case CLOCK_EVT_MODE_UNUSED:
-       case CLOCK_EVT_MODE_RESUME:
-               /* Left event sources disabled, no more interrupts appear */
-               break;
-       }
-}
-
-static struct clock_event_device clockevent_clps711x = {
-       .name           = "clps711x-clockevent",
-       .rating         = 300,
-       .features       = CLOCK_EVT_FEAT_PERIODIC,
-       .set_mode       = clps711x_clockevent_set_mode,
-};
-
-static irqreturn_t clps711x_timer_interrupt(int irq, void *dev_id)
-{
-       clockevent_clps711x.event_handler(&clockevent_clps711x);
-
-       return IRQ_HANDLED;
-}
-
-static struct irqaction clps711x_timer_irq = {
-       .name           = "clps711x-timer",
-       .flags          = IRQF_TIMER | IRQF_IRQPOLL,
-       .handler        = clps711x_timer_interrupt,
-};
-
-static void add_fixed_clk(struct clk *clk, const char *name, int rate)
-{
-       clk = clk_register_fixed_rate(NULL, name, NULL, CLK_IS_ROOT, rate);
-       clk_register_clkdev(clk, name, NULL);
-}
-
 void __init clps711x_timer_init(void)
 {
-       int osc, ext, pll, cpu, bus, timl, timh, uart, spi;
-       u32 tmp;
-
-       osc = 3686400;
-       ext = 13000000;
-
-       tmp = clps_readl(PLLR) >> 24;
-       if (tmp)
-               pll = (osc * tmp) / 2;
-       else
-               pll = 73728000; /* Default value */
-
-       tmp = clps_readl(SYSFLG2);
-       if (tmp & SYSFLG2_CKMODE) {
-               cpu = ext;
-               bus = cpu;
-               spi = 135400;
-               pll = 0;
-       } else {
-               cpu = pll;
-               if (cpu >= 36864000)
-                       bus = cpu / 2;
-               else
-                       bus = 36864000 / 2;
-               spi = cpu / 576;
-       }
-
-       uart = bus / 10;
-
-       if (tmp & SYSFLG2_CKMODE) {
-               tmp = clps_readl(SYSCON2);
-               if (tmp & SYSCON2_OSTB)
-                       timh = ext / 26;
-               else
-                       timh = 541440;
-       } else
-               timh = DIV_ROUND_CLOSEST(cpu, 144);
-
-       timl = DIV_ROUND_CLOSEST(timh, 256);
-
-       /* All clocks are fixed */
-       add_fixed_clk(clk_pll, "pll", pll);
-       add_fixed_clk(clk_bus, "bus", bus);
-       add_fixed_clk(clk_uart, "uart", uart);
-       add_fixed_clk(clk_timerl, "timer_lf", timl);
-       add_fixed_clk(clk_timerh, "timer_hf", timh);
-       add_fixed_clk(clk_tint, "tint", 64);
-       add_fixed_clk(clk_spi, "spi", spi);
-
-       pr_info("CPU frequency set at %i Hz.\n", cpu);
-
-       /* Start Timer1 in free running mode (Low frequency) */
-       tmp = clps_readl(SYSCON1) & ~(SYSCON1_TC1S | SYSCON1_TC1M);
-       clps_writel(tmp, SYSCON1);
-
-       sched_clock_register(clps711x_sched_clock_read, 16, timl);
-
-       clocksource_mmio_init(CLPS711X_VIRT_BASE + TC1D,
-                             "clps711x_clocksource", timl, 300, 16,
-                             clocksource_mmio_readw_down);
-
-       /* Set Timer2 prescaler */
-       clps_writew(DIV_ROUND_CLOSEST(timh, HZ), TC2D);
-
-       /* Start Timer2 in prescale mode (High frequency)*/
-       tmp = clps_readl(SYSCON1) | SYSCON1_TC2M | SYSCON1_TC2S;
-       clps_writel(tmp, SYSCON1);
-
-       clockevents_config_and_register(&clockevent_clps711x, timh, 0, 0);
-
-       setup_irq(IRQ_TC2OI, &clps711x_timer_irq);
+       clps711x_clk_init(CLPS711X_VIRT_BASE);
+       clps711x_clksrc_init(CLPS711X_VIRT_BASE + TC1D,
+                            CLPS711X_VIRT_BASE + TC2D, IRQ_TC2OI);
 }
 
 void clps711x_restart(enum reboot_mode mode, const char *cmd)
index f8818996389840c3ae952b9b2743e83cd109f8f0..370200b263339dc1d9f3d806fc62b9fb33fe06a2 100644 (file)
@@ -16,3 +16,8 @@ extern void clps711x_restart(enum reboot_mode mode, const char *cmd);
 
 /* drivers/irqchip/irq-clps711x.c */
 void clps711x_intc_init(phys_addr_t, resource_size_t);
+/* drivers/clk/clk-clps711x.c */
+void clps711x_clk_init(void __iomem *base);
+/* drivers/clocksource/clps711x-timer.c */
+void clps711x_clksrc_init(void __iomem *tc1_base, void __iomem *tc2_base,
+                         unsigned int irq);
diff --git a/arch/arm/mach-msm/board-mahimahi.c b/arch/arm/mach-msm/board-mahimahi.c
deleted file mode 100644 (file)
index 873c3ca..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/* linux/arch/arm/mach-msm/board-mahimahi.c
- *
- * Copyright (C) 2009 Google, Inc.
- * Copyright (C) 2009 HTC Corporation.
- * Author: Dima Zavin <dima@android.com>
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/delay.h>
-#include <linux/gpio.h>
-#include <linux/init.h>
-#include <linux/input.h>
-#include <linux/io.h>
-#include <linux/kernel.h>
-#include <linux/platform_device.h>
-#include <linux/memblock.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/setup.h>
-
-#include <mach/hardware.h>
-
-#include "board-mahimahi.h"
-#include "devices.h"
-#include "proc_comm.h"
-#include "common.h"
-
-static uint debug_uart;
-
-module_param_named(debug_uart, debug_uart, uint, 0);
-
-static struct platform_device *devices[] __initdata = {
-#if !defined(CONFIG_MSM_SERIAL_DEBUGGER)
-       &msm_device_uart1,
-#endif
-       &msm_device_uart_dm1,
-       &msm_device_nand,
-};
-
-static void __init mahimahi_init(void)
-{
-       platform_add_devices(devices, ARRAY_SIZE(devices));
-}
-
-static void __init mahimahi_fixup(struct tag *tags, char **cmdline)
-{
-       memblock_add(PHYS_OFFSET, 219*SZ_1M);
-       memblock_add(MSM_HIGHMEM_BASE, MSM_HIGHMEM_SIZE);
-}
-
-static void __init mahimahi_map_io(void)
-{
-       msm_map_common_io();
-       msm_clock_init();
-}
-
-static void __init mahimahi_init_late(void)
-{
-       smd_debugfs_init();
-}
-
-void msm_timer_init(void);
-
-MACHINE_START(MAHIMAHI, "mahimahi")
-       .atag_offset    = 0x100,
-       .fixup          = mahimahi_fixup,
-       .map_io         = mahimahi_map_io,
-       .init_irq       = msm_init_irq,
-       .init_machine   = mahimahi_init,
-       .init_late      = mahimahi_init_late,
-       .init_time      = msm_timer_init,
-MACHINE_END
index 245884319d2e30edc28fd00ee5e3e512ef4cf4f8..8f5ecdc4f3ce39a4def36c02bc4f23cebf0c3dee 100644 (file)
@@ -124,7 +124,7 @@ struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = {
 static struct platform_device *devices[] __initdata = {
        &msm_clock_7x30,
        &msm_device_gpio_7x30,
-#if defined(CONFIG_SERIAL_MSM) || defined(CONFIG_MSM_SERIAL_DEBUGGER)
+#if defined(CONFIG_SERIAL_MSM)
         &msm_device_uart2,
 #endif
        &msm_device_smd,
index 2c25050209ceddd98a280c30d7525b60bc3fc344..722ad63b7edc2570f3783ad518c96283216d95ed 100644 (file)
@@ -94,7 +94,7 @@ static int trout_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
        }
 
 static struct msm_gpio_chip msm_gpio_banks[] = {
-#if defined(CONFIG_MSM_DEBUG_UART1)
+#if defined(CONFIG_DEBUG_MSM_UART) && (CONFIG_DEBUG_UART_PHYS == 0xa9a00000)
        /* H2W pins <-> UART1 */
        TROUT_GPIO_BANK("MISC2", 0x00,   TROUT_GPIO_MISC2_BASE, 0x40),
 #else
index f72b07de215276a6f87804e27a1ad8e5cbddcdec..ba3edd3a46cbc6400bb2c7a89adb0a48ee5d58ce 100644 (file)
@@ -88,7 +88,7 @@ static void __init trout_map_io(void)
        msm_map_common_io();
        iotable_init(trout_io_desc, ARRAY_SIZE(trout_io_desc));
 
-#ifdef CONFIG_MSM_DEBUG_UART3
+#if defined(CONFIG_DEBUG_MSM_UART) && (CONFIG_DEBUG_UART_PHYS == 0xa9c00000)
        /* route UART3 to the "H2W" extended usb connector */
        writeb(0x80, TROUT_CPLD_BASE + 0x00);
 #endif
index 34e09474636ddeead9dbec440f9991ea54b04e53..b042dca1f6333c8b102c6d089e1897cb92b5ecc3 100644 (file)
@@ -57,8 +57,7 @@ static struct map_desc msm_io_desc[] __initdata = {
                .length =   MSM_SHARED_RAM_SIZE,
                .type =     MT_DEVICE,
        },
-#if defined(CONFIG_DEBUG_MSM_UART1) || defined(CONFIG_DEBUG_MSM_UART2) || \
-               defined(CONFIG_DEBUG_MSM_UART3)
+#if defined(CONFIG_DEBUG_MSM_UART)
        {
                /* Must be last: virtual and pfn filled in by debug_ll_addr() */
                .length = SZ_4K,
@@ -76,8 +75,7 @@ void __init msm_map_common_io(void)
         * pages are peripheral interface or not.
         */
        asm("mcr p15, 0, %0, c15, c2, 4" : : "r" (0));
-#if defined(CONFIG_DEBUG_MSM_UART1) || defined(CONFIG_DEBUG_MSM_UART2) || \
-               defined(CONFIG_DEBUG_MSM_UART3)
+#if defined(CONFIG_DEBUG_MSM_UART)
 #ifdef CONFIG_MMU
        debug_ll_addr(&msm_io_desc[size - 1].pfn,
                      &msm_io_desc[size - 1].virtual);
index 56edeab17b68dedf77f538fd5fdb1d2465598dab..09d2a26985da7b3758a35f15075a92d7e90e214e 100644 (file)
@@ -550,7 +550,7 @@ static int __init dns323_identify_rev(void)
                        break;
        }
        if (i >= 1000) {
-               pr_warning("DNS-323: Timeout accessing PHY, assuming rev B1\n");
+               pr_warn("DNS-323: Timeout accessing PHY, assuming rev B1\n");
                return DNS323_REV_B1;
        }
        writel((3 << 21)        /* phy ID reg */ |
@@ -562,7 +562,7 @@ static int __init dns323_identify_rev(void)
                        break;
        }
        if (i >= 1000) {
-               pr_warning("DNS-323: Timeout reading PHY, assuming rev B1\n");
+               pr_warn("DNS-323: Timeout reading PHY, assuming rev B1\n");
                return DNS323_REV_B1;
        }
        pr_debug("DNS-323: Ethernet PHY ID 0x%x\n", reg & 0xffff);
@@ -577,8 +577,8 @@ static int __init dns323_identify_rev(void)
        case 0x0e10: /* MV88E1118 */
                return DNS323_REV_C1;
        default:
-               pr_warning("DNS-323: Unknown PHY ID 0x%04x, assuming rev B1\n",
-                          reg & 0xffff);
+               pr_warn("DNS-323: Unknown PHY ID 0x%04x, assuming rev B1\n",
+                       reg & 0xffff);
        }
        return DNS323_REV_B1;
 }
index 6208d125c1b946602ce12977ca45607a264685f6..12086745c9fd915f1b22cb60e922e281a733b68d 100644 (file)
@@ -349,7 +349,7 @@ static void __init tsp2_init(void)
                        gpio_free(TSP2_RTC_GPIO);
        }
        if (tsp2_i2c_rtc.irq == 0)
-               pr_warning("tsp2_init: failed to get RTC IRQ\n");
+               pr_warn("tsp2_init: failed to get RTC IRQ\n");
        i2c_register_board_info(0, &tsp2_i2c_rtc, 1);
 
        /* register Terastation Pro II specific power-off method */
index 9136797addb271816579c78505bd06630397d4d4..c725b7cb98758ea748aea9b512cafe169e7169fd 100644 (file)
@@ -314,7 +314,7 @@ static void __init qnap_ts209_init(void)
                        gpio_free(TS209_RTC_GPIO);
        }
        if (qnap_ts209_i2c_rtc.irq == 0)
-               pr_warning("qnap_ts209_init: failed to get RTC IRQ\n");
+               pr_warn("qnap_ts209_init: failed to get RTC IRQ\n");
        i2c_register_board_info(0, &qnap_ts209_i2c_rtc, 1);
 
        /* register tsx09 specific power-off method */
index 5c079d312015c7762817a8dacf81674ff160a1a6..cf2ab531cabcf693781c71cce084145e3bb1ac1d 100644 (file)
@@ -302,7 +302,7 @@ static void __init qnap_ts409_init(void)
                        gpio_free(TS409_RTC_GPIO);
        }
        if (qnap_ts409_i2c_rtc.irq == 0)
-               pr_warning("qnap_ts409_init: failed to get RTC IRQ\n");
+               pr_warn("qnap_ts409_init: failed to get RTC IRQ\n");
        i2c_register_board_info(0, &qnap_ts409_i2c_rtc, 1);
        platform_device_register(&ts409_leds);
 
index db16dae441e252607bcb2d13f6e172b7410cc19d..1b704d35cf5b2922959ede312995777f510996c7 100644 (file)
@@ -403,8 +403,8 @@ static void ts78xx_fpga_supports(void)
                /* enable devices if magic matches */
                switch ((ts78xx_fpga.id >> 8) & 0xffffff) {
                case TS7800_FPGA_MAGIC:
-                       pr_warning("unrecognised FPGA revision 0x%.2x\n",
-                                       ts78xx_fpga.id & 0xff);
+                       pr_warn("unrecognised FPGA revision 0x%.2x\n",
+                               ts78xx_fpga.id & 0xff);
                        ts78xx_fpga.supports.ts_rtc.present = 1;
                        ts78xx_fpga.supports.ts_nand.present = 1;
                        ts78xx_fpga.supports.ts_rng.present = 1;
index 1e6c51c7c2d5694d0581603f355bb6e4fbc16108..efc49dabbf2fc7f4d4da053fd0121363c13e2cc2 100644 (file)
@@ -1,6 +1,30 @@
 config ARCH_SHMOBILE
        bool
 
+config PM_RCAR
+       bool
+
+config PM_RMOBILE
+       bool
+
+config ARCH_RCAR_GEN1
+       bool
+       select PM_RCAR if PM || SMP
+       select RENESAS_INTC_IRQPIN
+       select SYS_SUPPORTS_SH_TMU
+
+config ARCH_RCAR_GEN2
+       bool
+       select PM_RCAR if PM || SMP
+       select RENESAS_IRQC
+       select SYS_SUPPORTS_SH_CMT
+
+config ARCH_RMOBILE
+       bool
+       select PM_RMOBILE if PM && !ARCH_SHMOBILE_MULTI
+       select SYS_SUPPORTS_SH_CMT
+       select SYS_SUPPORTS_SH_TMU
+
 menuconfig ARCH_SHMOBILE_MULTI
        bool "Renesas ARM SoCs" if ARCH_MULTI_V7
        depends on MMU
@@ -28,18 +52,15 @@ config ARCH_R7S72100
 
 config ARCH_R8A7779
        bool "R-Car H1 (R8A77790)"
-       select RENESAS_INTC_IRQPIN
-       select SYS_SUPPORTS_SH_TMU
+       select ARCH_RCAR_GEN1
 
 config ARCH_R8A7790
        bool "R-Car H2 (R8A77900)"
-       select RENESAS_IRQC
-       select SYS_SUPPORTS_SH_CMT
+       select ARCH_RCAR_GEN2
 
 config ARCH_R8A7791
-       bool "R-Car M2 (R8A77910)"
-       select RENESAS_IRQC
-       select SYS_SUPPORTS_SH_CMT
+       bool "R-Car M2-W (R8A77910)"
+       select ARCH_RCAR_GEN2
 
 comment "Renesas ARM SoCs Board Type"
 
@@ -71,84 +92,60 @@ comment "Renesas ARM SoCs System Type"
 
 config ARCH_SH7372
        bool "SH-Mobile AP4 (SH7372)"
+       select ARCH_RMOBILE
        select ARCH_WANT_OPTIONAL_GPIOLIB
        select ARM_CPU_SUSPEND if PM || CPU_IDLE
-       select CPU_V7
-       select SH_CLK_CPG
        select SH_INTC
-       select SYS_SUPPORTS_SH_CMT
-       select SYS_SUPPORTS_SH_TMU
 
 config ARCH_SH73A0
        bool "SH-Mobile AG5 (R8A73A00)"
+       select ARCH_RMOBILE
        select ARCH_WANT_OPTIONAL_GPIOLIB
        select ARM_GIC
-       select CPU_V7
        select I2C
-       select SH_CLK_CPG
        select SH_INTC
        select RENESAS_INTC_IRQPIN
-       select SYS_SUPPORTS_SH_CMT
-       select SYS_SUPPORTS_SH_TMU
 
 config ARCH_R8A73A4
        bool "R-Mobile APE6 (R8A73A40)"
+       select ARCH_RMOBILE
        select ARCH_WANT_OPTIONAL_GPIOLIB
        select ARM_GIC
-       select CPU_V7
-       select SH_CLK_CPG
        select RENESAS_IRQC
-       select SYS_SUPPORTS_SH_CMT
-       select SYS_SUPPORTS_SH_TMU
 
 config ARCH_R8A7740
        bool "R-Mobile A1 (R8A77400)"
+       select ARCH_RMOBILE
        select ARCH_WANT_OPTIONAL_GPIOLIB
        select ARM_GIC
-       select CPU_V7
-       select SH_CLK_CPG
        select RENESAS_INTC_IRQPIN
-       select SYS_SUPPORTS_SH_CMT
-       select SYS_SUPPORTS_SH_TMU
 
 config ARCH_R8A7778
        bool "R-Car M1A (R8A77781)"
+       select ARCH_RCAR_GEN1
        select ARCH_WANT_OPTIONAL_GPIOLIB
-       select CPU_V7
-       select SH_CLK_CPG
        select ARM_GIC
-       select SYS_SUPPORTS_SH_TMU
-       select RENESAS_INTC_IRQPIN
 
 config ARCH_R8A7779
        bool "R-Car H1 (R8A77790)"
+       select ARCH_RCAR_GEN1
        select ARCH_WANT_OPTIONAL_GPIOLIB
        select ARM_GIC
-       select CPU_V7
-       select SH_CLK_CPG
-       select RENESAS_INTC_IRQPIN
-       select SYS_SUPPORTS_SH_TMU
 
 config ARCH_R8A7790
        bool "R-Car H2 (R8A77900)"
+       select ARCH_RCAR_GEN2
        select ARCH_WANT_OPTIONAL_GPIOLIB
        select ARM_GIC
-       select CPU_V7
        select MIGHT_HAVE_PCI
-       select SH_CLK_CPG
-       select RENESAS_IRQC
-       select SYS_SUPPORTS_SH_CMT
        select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE
 
 config ARCH_R8A7791
-       bool "R-Car M2 (R8A77910)"
+       bool "R-Car M2-W (R8A77910)"
+       select ARCH_RCAR_GEN2
        select ARCH_WANT_OPTIONAL_GPIOLIB
        select ARM_GIC
-       select CPU_V7
        select MIGHT_HAVE_PCI
-       select SH_CLK_CPG
-       select RENESAS_IRQC
-       select SYS_SUPPORTS_SH_CMT
        select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE
 
 config ARCH_R7S72100
index fe3878a1a69a04a063ac7c4c129d93d0193ff987..7b259ce60bebbbdc912f6f6c937ca48d9c127863 100644 (file)
@@ -8,15 +8,14 @@ ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/arch/arm/mach-shmobile/incl
 obj-y                          := timer.o console.o
 
 # CPU objects
-obj-$(CONFIG_ARCH_SH7372)      += setup-sh7372.o intc-sh7372.o
-obj-$(CONFIG_ARCH_SH73A0)      += setup-sh73a0.o intc-sh73a0.o
+obj-$(CONFIG_ARCH_SH7372)      += setup-sh7372.o intc-sh7372.o pm-sh7372.o
+obj-$(CONFIG_ARCH_SH73A0)      += setup-sh73a0.o intc-sh73a0.o pm-sh73a0.o
 obj-$(CONFIG_ARCH_R8A73A4)     += setup-r8a73a4.o
-obj-$(CONFIG_ARCH_R8A7740)     += setup-r8a7740.o
+obj-$(CONFIG_ARCH_R8A7740)     += setup-r8a7740.o pm-r8a7740.o
 obj-$(CONFIG_ARCH_R8A7778)     += setup-r8a7778.o
-obj-$(CONFIG_ARCH_R8A7779)     += setup-r8a7779.o
-obj-$(CONFIG_ARCH_R8A7790)     += setup-r8a7790.o
-obj-$(CONFIG_ARCH_R8A7790)     += setup-r8a7790.o setup-rcar-gen2.o
-obj-$(CONFIG_ARCH_R8A7791)     += setup-r8a7791.o setup-rcar-gen2.o
+obj-$(CONFIG_ARCH_R8A7779)     += setup-r8a7779.o pm-r8a7779.o
+obj-$(CONFIG_ARCH_R8A7790)     += setup-r8a7790.o pm-r8a7790.o
+obj-$(CONFIG_ARCH_R8A7791)     += setup-r8a7791.o pm-r8a7791.o
 obj-$(CONFIG_ARCH_EMEV2)       += setup-emev2.o
 obj-$(CONFIG_ARCH_R7S72100)    += setup-r7s72100.o
 
@@ -36,8 +35,9 @@ endif
 
 # CPU reset vector handling objects
 cpu-y                          := platsmp.o headsmp.o
-cpu-$(CONFIG_ARCH_R8A7790)     += platsmp-apmu.o
-cpu-$(CONFIG_ARCH_R8A7791)     += platsmp-apmu.o
+
+# Shared SoC family objects
+obj-$(CONFIG_ARCH_RCAR_GEN2)   += setup-rcar-gen2.o platsmp-apmu.o $(cpu-y)
 
 # SMP objects
 smp-y                          := $(cpu-y)
@@ -51,15 +51,11 @@ smp-$(CONFIG_ARCH_EMEV2)    += smp-emev2.o headsmp-scu.o platsmp-scu.o
 obj-$(CONFIG_SUSPEND)          += suspend.o
 obj-$(CONFIG_CPU_IDLE)         += cpuidle.o
 obj-$(CONFIG_CPU_FREQ)         += cpufreq.o
-obj-$(CONFIG_ARCH_SH7372)      += pm-sh7372.o sleep-sh7372.o pm-rmobile.o
-obj-$(CONFIG_ARCH_SH73A0)      += pm-sh73a0.o
-obj-$(CONFIG_ARCH_R8A7740)     += pm-r8a7740.o pm-rmobile.o
-obj-$(CONFIG_ARCH_R8A7779)     += pm-r8a7779.o pm-rcar.o
-obj-$(CONFIG_ARCH_R8A7790)     += pm-r8a7790.o pm-rcar.o $(cpu-y)
-obj-$(CONFIG_ARCH_R8A7791)     += pm-r8a7791.o pm-rcar.o $(cpu-y)
+obj-$(CONFIG_PM_RCAR)          += pm-rcar.o
+obj-$(CONFIG_PM_RMOBILE)       += pm-rmobile.o
 
-# IRQ objects
-obj-$(CONFIG_ARCH_SH7372)      += entry-intc.o
+# special sh7372 handling for IRQ objects and low level sleep code
+obj-$(CONFIG_ARCH_SH7372)      += entry-intc.o sleep-sh7372.o
 
 # Board objects
 ifdef CONFIG_ARCH_SHMOBILE_MULTI
index 6dbaad611a92897020b7aa4cc9cbe28933934922..e709835344038a5a1fbace09bcf68d554c27aa8b 100644 (file)
@@ -1231,6 +1231,10 @@ clock_error:
 #define GPIO_PORT8CR   IOMEM(0xe6050008)
 static void __init eva_init(void)
 {
+       static struct pm_domain_device domain_devices[] __initdata = {
+               { "A4LC", &lcdc0_device },
+               { "A4LC", &hdmi_lcdc_device },
+       };
        struct platform_device *usb = NULL;
 
        regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
@@ -1316,8 +1320,8 @@ static void __init eva_init(void)
        platform_add_devices(eva_devices,
                             ARRAY_SIZE(eva_devices));
 
-       rmobile_add_device_to_domain("A4LC", &lcdc0_device);
-       rmobile_add_device_to_domain("A4LC", &hdmi_lcdc_device);
+       rmobile_add_devices_to_domains(domain_devices,
+                                      ARRAY_SIZE(domain_devices));
        if (usb)
                rmobile_add_device_to_domain("A3SP", usb);
 
index 79f448e93abbfbad9908b1e18604ea83f446c65e..d47b2623267b971d55726b1e97fc7e85f9b0f79f 100644 (file)
@@ -1420,7 +1420,7 @@ static const struct pinctrl_map mackerel_pinctrl_map[] = {
 #define USCCR1         IOMEM(0xE6058144)
 static void __init mackerel_init(void)
 {
-       struct pm_domain_device domain_devices[] = {
+       static struct pm_domain_device domain_devices[] __initdata = {
                { "A4LC", &lcdc_device, },
                { "A4LC", &hdmi_lcdc_device, },
                { "A4LC", &meram_device, },
index a0d44d537fa0bc87327e662cf74e3e8de0a02be0..3d507149a6c423bc588c129d70f21610b9d2f4ae 100644 (file)
@@ -34,23 +34,21 @@ static int r8a7740_pd_a3sp_suspend(void)
 
 static struct rmobile_pm_domain r8a7740_pm_domains[] = {
        {
+               .genpd.name     = "A4LC",
+               .bit_shift      = 1,
+       }, {
                .genpd.name     = "A4S",
                .bit_shift      = 10,
                .gov            = &pm_domain_always_on_gov,
                .no_debug       = true,
                .suspend        = r8a7740_pd_a4s_suspend,
-       },
-       {
+       }, {
                .genpd.name     = "A3SP",
                .bit_shift      = 11,
                .gov            = &pm_domain_always_on_gov,
                .no_debug       = true,
                .suspend        = r8a7740_pd_a3sp_suspend,
        },
-       {
-               .genpd.name     = "A4LC",
-               .bit_shift      = 1,
-       },
 };
 
 void __init r8a7740_init_pm_domains(void)
index 34b8a5674f85e9d9c7437be76f243026269b2857..00022ee56f80dc3075e59a6a93e05acb09a38c80 100644 (file)
@@ -31,8 +31,6 @@
 #define SYSCISR_RETRIES 1000
 #define SYSCISR_DELAY_US 1
 
-#if defined(CONFIG_PM) || defined(CONFIG_SMP)
-
 static void __iomem *rcar_sysc_base;
 static DEFINE_SPINLOCK(rcar_sysc_lock); /* SMP CPUs + I/O devices */
 
@@ -137,5 +135,3 @@ void __iomem *rcar_sysc_init(phys_addr_t base)
 
        return rcar_sysc_base;
 }
-
-#endif /* CONFIG_PM || CONFIG_SMP */
index ebdd16e94a84f5d674f691edfc99e6712d7cee28..a88079af7914afe0db35514b558d13e952c36e88 100644 (file)
@@ -27,7 +27,6 @@
 #define PSTR_RETRIES   100
 #define PSTR_DELAY_US  10
 
-#ifdef CONFIG_PM
 static int rmobile_pd_power_down(struct generic_pm_domain *genpd)
 {
        struct rmobile_pm_domain *rmobile_pd = to_rmobile_pd(genpd);
@@ -151,4 +150,3 @@ void rmobile_add_devices_to_domains(struct pm_domain_device data[],
                rmobile_add_device_to_domain_td(data[j].domain_name,
                                                data[j].pdev, &latencies);
 }
-#endif /* CONFIG_PM */
index 690553a06887897a6c29ffb396ba60bafb29be8e..8f66b343162b041145241429c766d4fefec88c71 100644 (file)
@@ -36,7 +36,7 @@ struct pm_domain_device {
        struct platform_device *pdev;
 };
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_RMOBILE
 extern void rmobile_init_domains(struct rmobile_pm_domain domains[], int num);
 extern void rmobile_add_device_to_domain_td(const char *domain_name,
                                            struct platform_device *pdev,
@@ -58,6 +58,6 @@ extern void rmobile_add_devices_to_domains(struct pm_domain_device data[],
 
 static inline void rmobile_add_devices_to_domains(struct pm_domain_device d[],
                                                  int size) {}
-#endif /* CONFIG_PM */
+#endif /* CONFIG_PM_RMOBILE */
 
 #endif /* PM_RMOBILE_H */
index 3d5eacaba3e6109db5e033ed362af7f987ec40de..30df532fcaa02b2be8b455423e08828f8db5a2d6 100644 (file)
@@ -747,6 +747,19 @@ static void r8a7740_i2c_workaround(struct platform_device *pdev)
 
 void __init r8a7740_add_standard_devices(void)
 {
+       static struct pm_domain_device domain_devices[] __initdata = {
+               { "A3SP", &scif0_device },
+               { "A3SP", &scif1_device },
+               { "A3SP", &scif2_device },
+               { "A3SP", &scif3_device },
+               { "A3SP", &scif4_device },
+               { "A3SP", &scif5_device },
+               { "A3SP", &scif6_device },
+               { "A3SP", &scif7_device },
+               { "A3SP", &scif8_device },
+               { "A3SP", &i2c1_device },
+       };
+
        /* I2C work-around */
        r8a7740_i2c_workaround(&i2c0_device);
        r8a7740_i2c_workaround(&i2c1_device);
@@ -762,17 +775,8 @@ void __init r8a7740_add_standard_devices(void)
                             ARRAY_SIZE(r8a7740_late_devices));
 
        /* add devices to PM domain  */
-
-       rmobile_add_device_to_domain("A3SP",    &scif0_device);
-       rmobile_add_device_to_domain("A3SP",    &scif1_device);
-       rmobile_add_device_to_domain("A3SP",    &scif2_device);
-       rmobile_add_device_to_domain("A3SP",    &scif3_device);
-       rmobile_add_device_to_domain("A3SP",    &scif4_device);
-       rmobile_add_device_to_domain("A3SP",    &scif5_device);
-       rmobile_add_device_to_domain("A3SP",    &scif6_device);
-       rmobile_add_device_to_domain("A3SP",    &scif7_device);
-       rmobile_add_device_to_domain("A3SP",    &scif8_device);
-       rmobile_add_device_to_domain("A3SP",    &i2c1_device);
+       rmobile_add_devices_to_domains(domain_devices,
+                                      ARRAY_SIZE(domain_devices));
 }
 
 void __init r8a7740_add_early_devices(void)
index 9cdfcdfd38fc4b6625a96f1515e7ce0e9834f988..a04fa5fd00fd430d5ab1dba67dad94cba6e6224f 100644 (file)
@@ -927,7 +927,7 @@ static struct platform_device *sh7372_late_devices[] __initdata = {
 
 void __init sh7372_add_standard_devices(void)
 {
-       struct pm_domain_device domain_devices[] = {
+       static struct pm_domain_device domain_devices[] __initdata = {
                { "A3RV", &vpu_device, },
                { "A4MP", &spu0_device, },
                { "A4MP", &spu1_device, },
index 42d4753683ce6857fb118d256f13c81f88e6063b..d7598aeed803c149c9b5a8dda30fc5363e6c7190 100644 (file)
 
 #include <linux/clk-provider.h>
 #include <linux/clocksource.h>
-#include <linux/delay.h>
-#include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/of_address.h>
-#include <linux/of_irq.h>
-#include <linux/of_platform.h>
-#include <linux/io.h>
-#include <linux/reboot.h>
 
 #include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/system_misc.h>
-
-#define SUN4I_WATCHDOG_CTRL_REG                0x00
-#define SUN4I_WATCHDOG_CTRL_RESTART            BIT(0)
-#define SUN4I_WATCHDOG_MODE_REG                0x04
-#define SUN4I_WATCHDOG_MODE_ENABLE             BIT(0)
-#define SUN4I_WATCHDOG_MODE_RESET_ENABLE       BIT(1)
-
-#define SUN6I_WATCHDOG1_IRQ_REG                0x00
-#define SUN6I_WATCHDOG1_CTRL_REG       0x10
-#define SUN6I_WATCHDOG1_CTRL_RESTART           BIT(0)
-#define SUN6I_WATCHDOG1_CONFIG_REG     0x14
-#define SUN6I_WATCHDOG1_CONFIG_RESTART         BIT(0)
-#define SUN6I_WATCHDOG1_CONFIG_IRQ             BIT(1)
-#define SUN6I_WATCHDOG1_MODE_REG       0x18
-#define SUN6I_WATCHDOG1_MODE_ENABLE            BIT(0)
-
-static void __iomem *wdt_base;
-
-static void sun4i_restart(enum reboot_mode mode, const char *cmd)
-{
-       if (!wdt_base)
-               return;
-
-       /* Enable timer and set reset bit in the watchdog */
-       writel(SUN4I_WATCHDOG_MODE_ENABLE | SUN4I_WATCHDOG_MODE_RESET_ENABLE,
-              wdt_base + SUN4I_WATCHDOG_MODE_REG);
-
-       /*
-        * Restart the watchdog. The default (and lowest) interval
-        * value for the watchdog is 0.5s.
-        */
-       writel(SUN4I_WATCHDOG_CTRL_RESTART, wdt_base + SUN4I_WATCHDOG_CTRL_REG);
-
-       while (1) {
-               mdelay(5);
-               writel(SUN4I_WATCHDOG_MODE_ENABLE | SUN4I_WATCHDOG_MODE_RESET_ENABLE,
-                      wdt_base + SUN4I_WATCHDOG_MODE_REG);
-       }
-}
-
-static struct of_device_id sunxi_restart_ids[] = {
-       { .compatible = "allwinner,sun4i-a10-wdt" },
-       { /*sentinel*/ }
-};
-
-static void sunxi_setup_restart(void)
-{
-       struct device_node *np;
-
-       np = of_find_matching_node(NULL, sunxi_restart_ids);
-       if (WARN(!np, "unable to setup watchdog restart"))
-               return;
-
-       wdt_base = of_iomap(np, 0);
-       WARN(!wdt_base, "failed to map watchdog base address");
-}
-
-static void __init sunxi_dt_init(void)
-{
-       sunxi_setup_restart();
-
-       of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
-}
 
 static const char * const sunxi_board_dt_compat[] = {
        "allwinner,sun4i-a10",
@@ -96,9 +24,7 @@ static const char * const sunxi_board_dt_compat[] = {
 };
 
 DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)")
-       .init_machine   = sunxi_dt_init,
        .dt_compat      = sunxi_board_dt_compat,
-       .restart        = sun4i_restart,
 MACHINE_END
 
 static const char * const sun6i_board_dt_compat[] = {
@@ -126,9 +52,7 @@ static const char * const sun7i_board_dt_compat[] = {
 };
 
 DT_MACHINE_START(SUN7I_DT, "Allwinner sun7i (A20) Family")
-       .init_machine   = sunxi_dt_init,
        .dt_compat      = sun7i_board_dt_compat,
-       .restart        = sun4i_restart,
 MACHINE_END
 
 static const char * const sun8i_board_dt_compat[] = {
index a8d7ea14f1835b3d8c6d45e20937051fd79f7cbb..8bdbc45c6dad2a04c3863c753df6afb3bca54d04 100644 (file)
@@ -178,12 +178,6 @@ static irqreturn_t ch2_irq(int irq, void *handle)
        return IRQ_NONE;
 }
 
-static struct irqaction tc_irqaction = {
-       .name           = "tc_clkevt",
-       .flags          = IRQF_TIMER,
-       .handler        = ch2_irq,
-};
-
 static int __init setup_clkevents(struct atmel_tc *tc, int clk32k_divisor_idx)
 {
        int ret;
@@ -198,15 +192,16 @@ static int __init setup_clkevents(struct atmel_tc *tc, int clk32k_divisor_idx)
 
        clkevt.regs = tc->regs;
        clkevt.clk = t2_clk;
-       tc_irqaction.dev_id = &clkevt;
 
        timer_clock = clk32k_divisor_idx;
 
        clkevt.clkevt.cpumask = cpumask_of(0);
 
-       ret = setup_irq(irq, &tc_irqaction);
-       if (ret)
+       ret = request_irq(irq, ch2_irq, IRQF_TIMER, "tc_clkevt", &clkevt);
+       if (ret) {
+               clk_disable_unprepare(t2_clk);
                return ret;
+       }
 
        clockevents_config_and_register(&clkevt.clkevt, 32768, 1, 0xffff);
 
@@ -279,7 +274,7 @@ static int __init tcb_clksrc_init(void)
        int i;
        int ret;
 
-       tc = atmel_tc_alloc(CONFIG_ATMEL_TCB_CLKSRC_BLOCK, clksrc.name);
+       tc = atmel_tc_alloc(CONFIG_ATMEL_TCB_CLKSRC_BLOCK);
        if (!tc) {
                pr_debug("can't alloc TC for clocksource\n");
                return -ENODEV;
index c8d8e38d0d8ae6dc47cc0d85b581388896ae5361..0ca05c3ec8d68ac78d5268b8accca776647d12c0 100644 (file)
@@ -35,60 +35,31 @@ static LIST_HEAD(tc_list);
 /**
  * atmel_tc_alloc - allocate a specified TC block
  * @block: which block to allocate
- * @name: name to be associated with the iomem resource
  *
  * Caller allocates a block.  If it is available, a pointer to a
  * pre-initialized struct atmel_tc is returned. The caller can access
  * the registers directly through the "regs" field.
  */
-struct atmel_tc *atmel_tc_alloc(unsigned block, const char *name)
+struct atmel_tc *atmel_tc_alloc(unsigned block)
 {
        struct atmel_tc         *tc;
        struct platform_device  *pdev = NULL;
-       struct resource         *r;
-       size_t                  size;
 
        spin_lock(&tc_list_lock);
        list_for_each_entry(tc, &tc_list, node) {
-               if (tc->pdev->dev.of_node) {
-                       if (of_alias_get_id(tc->pdev->dev.of_node, "tcb")
-                                       == block) {
-                               pdev = tc->pdev;
-                               break;
-                       }
-               } else if (tc->pdev->id == block) {
+               if (tc->allocated)
+                       continue;
+
+               if ((tc->pdev->dev.of_node && tc->id == block) ||
+                   (tc->pdev->id == block)) {
                        pdev = tc->pdev;
+                       tc->allocated = true;
                        break;
                }
        }
-
-       if (!pdev || tc->iomem)
-               goto fail;
-
-       r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (!r)
-               goto fail;
-
-       size = resource_size(r);
-       r = request_mem_region(r->start, size, name);
-       if (!r)
-               goto fail;
-
-       tc->regs = ioremap(r->start, size);
-       if (!tc->regs)
-               goto fail_ioremap;
-
-       tc->iomem = r;
-
-out:
        spin_unlock(&tc_list_lock);
-       return tc;
 
-fail_ioremap:
-       release_mem_region(r->start, size);
-fail:
-       tc = NULL;
-       goto out;
+       return pdev ? tc : NULL;
 }
 EXPORT_SYMBOL_GPL(atmel_tc_alloc);
 
@@ -96,19 +67,14 @@ EXPORT_SYMBOL_GPL(atmel_tc_alloc);
  * atmel_tc_free - release a specified TC block
  * @tc: Timer/counter block that was returned by atmel_tc_alloc()
  *
- * This reverses the effect of atmel_tc_alloc(), unmapping the I/O
- * registers, invalidating the resource returned by that routine and
- * making the TC available to other drivers.
+ * This reverses the effect of atmel_tc_alloc(), invalidating the resource
+ * returned by that routine and making the TC available to other drivers.
  */
 void atmel_tc_free(struct atmel_tc *tc)
 {
        spin_lock(&tc_list_lock);
-       if (tc->regs) {
-               iounmap(tc->regs);
-               release_mem_region(tc->iomem->start, resource_size(tc->iomem));
-               tc->regs = NULL;
-               tc->iomem = NULL;
-       }
+       if (tc->allocated)
+               tc->allocated = false;
        spin_unlock(&tc_list_lock);
 }
 EXPORT_SYMBOL_GPL(atmel_tc_free);
@@ -142,25 +108,27 @@ static int __init tc_probe(struct platform_device *pdev)
        struct atmel_tc *tc;
        struct clk      *clk;
        int             irq;
-
-       if (!platform_get_resource(pdev, IORESOURCE_MEM, 0))
-               return -EINVAL;
+       struct resource *r;
+       unsigned int    i;
 
        irq = platform_get_irq(pdev, 0);
        if (irq < 0)
                return -EINVAL;
 
-       tc = kzalloc(sizeof(struct atmel_tc), GFP_KERNEL);
+       tc = devm_kzalloc(&pdev->dev, sizeof(struct atmel_tc), GFP_KERNEL);
        if (!tc)
                return -ENOMEM;
 
        tc->pdev = pdev;
 
-       clk = clk_get(&pdev->dev, "t0_clk");
-       if (IS_ERR(clk)) {
-               kfree(tc);
-               return -EINVAL;
-       }
+       clk = devm_clk_get(&pdev->dev, "t0_clk");
+       if (IS_ERR(clk))
+               return PTR_ERR(clk);
+
+       r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       tc->regs = devm_ioremap_resource(&pdev->dev, r);
+       if (IS_ERR(tc->regs))
+               return PTR_ERR(tc->regs);
 
        /* Now take SoC information if available */
        if (pdev->dev.of_node) {
@@ -168,13 +136,17 @@ static int __init tc_probe(struct platform_device *pdev)
                match = of_match_node(atmel_tcb_dt_ids, pdev->dev.of_node);
                if (match)
                        tc->tcb_config = match->data;
+
+               tc->id = of_alias_get_id(tc->pdev->dev.of_node, "tcb");
+       } else {
+               tc->id = pdev->id;
        }
 
        tc->clk[0] = clk;
-       tc->clk[1] = clk_get(&pdev->dev, "t1_clk");
+       tc->clk[1] = devm_clk_get(&pdev->dev, "t1_clk");
        if (IS_ERR(tc->clk[1]))
                tc->clk[1] = clk;
-       tc->clk[2] = clk_get(&pdev->dev, "t2_clk");
+       tc->clk[2] = devm_clk_get(&pdev->dev, "t2_clk");
        if (IS_ERR(tc->clk[2]))
                tc->clk[2] = clk;
 
@@ -186,18 +158,33 @@ static int __init tc_probe(struct platform_device *pdev)
        if (tc->irq[2] < 0)
                tc->irq[2] = irq;
 
+       for (i = 0; i < 3; i++)
+               writel(ATMEL_TC_ALL_IRQ, tc->regs + ATMEL_TC_REG(i, IDR));
+
        spin_lock(&tc_list_lock);
        list_add_tail(&tc->node, &tc_list);
        spin_unlock(&tc_list_lock);
 
+       platform_set_drvdata(pdev, tc);
+
        return 0;
 }
 
+static void tc_shutdown(struct platform_device *pdev)
+{
+       int i;
+       struct atmel_tc *tc = platform_get_drvdata(pdev);
+
+       for (i = 0; i < 3; i++)
+               writel(ATMEL_TC_ALL_IRQ, tc->regs + ATMEL_TC_REG(i, IDR));
+}
+
 static struct platform_driver tc_driver = {
        .driver = {
                .name   = "atmel_tcb",
                .of_match_table = of_match_ptr(atmel_tcb_dt_ids),
        },
+       .shutdown = tc_shutdown,
 };
 
 static int __init tc_init(void)
index f3dcd02390f1b5da7d9cf43d3b053d3e6840bc0f..d56e5b7174313761698290a90d8646f1d5d600aa 100644 (file)
@@ -379,7 +379,7 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev)
                return err;
        }
 
-       tc = atmel_tc_alloc(tcblock, "tcb-pwm");
+       tc = atmel_tc_alloc(tcblock);
        if (tc == NULL) {
                dev_err(&pdev->dev, "failed to allocate Timer Counter Block\n");
                return -ENOMEM;
index 89a931babecf86ebbf95c6a0e8b648840d06ad06..b87c1c7c242a7eea1eff286b3f292e5fa8ccd2d4 100644 (file)
@@ -44,12 +44,13 @@ struct atmel_tcb_config {
 /**
  * struct atmel_tc - information about a Timer/Counter Block
  * @pdev: physical device
- * @iomem: resource associated with the I/O register
  * @regs: mapping through which the I/O registers can be accessed
+ * @id: block id
  * @tcb_config: configuration data from SoC
  * @irq: irq for each of the three channels
  * @clk: internal clock source for each of the three channels
  * @node: list node, for tclib internal use
+ * @allocated: if already used, for tclib internal use
  *
  * On some platforms, each TC channel has its own clocks and IRQs,
  * while on others, all TC channels share the same clock and IRQ.
@@ -61,15 +62,16 @@ struct atmel_tcb_config {
  */
 struct atmel_tc {
        struct platform_device  *pdev;
-       struct resource         *iomem;
        void __iomem            *regs;
+       int                     id;
        const struct atmel_tcb_config *tcb_config;
        int                     irq[3];
        struct clk              *clk[3];
        struct list_head        node;
+       bool                    allocated;
 };
 
-extern struct atmel_tc *atmel_tc_alloc(unsigned block, const char *name);
+extern struct atmel_tc *atmel_tc_alloc(unsigned block);
 extern void atmel_tc_free(struct atmel_tc *tc);
 
 /* platform-specific ATMEL_TC_TIMER_CLOCKx divisors (0 means 32KiHz) */
@@ -258,5 +260,10 @@ extern const u8 atmel_tc_divisors[5];
 #define     ATMEL_TC_LDRAS     (1 <<  5)       /* RA loading */
 #define     ATMEL_TC_LDRBS     (1 <<  6)       /* RB loading */
 #define     ATMEL_TC_ETRGS     (1 <<  7)       /* external trigger */
+#define     ATMEL_TC_ALL_IRQ   (ATMEL_TC_COVFS | ATMEL_TC_LOVRS | \
+                                ATMEL_TC_CPAS | ATMEL_TC_CPBS | \
+                                ATMEL_TC_CPCS | ATMEL_TC_LDRAS | \
+                                ATMEL_TC_LDRBS | ATMEL_TC_ETRGS) \
+                                /* all IRQs */
 
 #endif