Merge branch 'sh/stable-updates'
authorPaul Mundt <lethal@linux-sh.org>
Mon, 26 Apr 2010 07:08:27 +0000 (16:08 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Mon, 26 Apr 2010 07:08:27 +0000 (16:08 +0900)
Conflicts:
arch/sh/kernel/dwarf.c
drivers/dma/shdma.c

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
85 files changed:
arch/sh/Kconfig
arch/sh/boards/mach-sdk7786/setup.c
arch/sh/boot/compressed/Makefile
arch/sh/boot/compressed/head_32.S
arch/sh/include/asm/cache.h
arch/sh/include/asm/clkdev.h [new file with mode: 0644]
arch/sh/include/asm/clock.h
arch/sh/include/asm/dmaengine.h
arch/sh/include/asm/hw_breakpoint.h
arch/sh/include/asm/irq.h
arch/sh/include/asm/page.h
arch/sh/include/asm/processor.h
arch/sh/include/asm/processor_32.h
arch/sh/include/asm/siu.h
arch/sh/include/cpu-sh4/cpu/dma-register.h
arch/sh/include/cpu-sh4/cpu/mmu_context.h
arch/sh/include/mach-sdk7786/mach/fpga.h
arch/sh/kernel/Makefile
arch/sh/kernel/clkdev.c [new file with mode: 0644]
arch/sh/kernel/cpu/clock-cpg.c
arch/sh/kernel/cpu/clock.c
arch/sh/kernel/cpu/init.c
arch/sh/kernel/cpu/sh2/probe.c
arch/sh/kernel/cpu/sh2/setup-sh7619.c
arch/sh/kernel/cpu/sh2a/probe.c
arch/sh/kernel/cpu/sh2a/setup-mxg.c
arch/sh/kernel/cpu/sh2a/setup-sh7201.c
arch/sh/kernel/cpu/sh2a/setup-sh7203.c
arch/sh/kernel/cpu/sh2a/setup-sh7206.c
arch/sh/kernel/cpu/sh3/probe.c
arch/sh/kernel/cpu/sh3/setup-sh7705.c
arch/sh/kernel/cpu/sh3/setup-sh770x.c
arch/sh/kernel/cpu/sh3/setup-sh7710.c
arch/sh/kernel/cpu/sh3/setup-sh7720.c
arch/sh/kernel/cpu/sh4/probe.c
arch/sh/kernel/cpu/sh4/setup-sh4-202.c
arch/sh/kernel/cpu/sh4/setup-sh7750.c
arch/sh/kernel/cpu/sh4/setup-sh7760.c
arch/sh/kernel/cpu/sh4a/clock-sh7343.c
arch/sh/kernel/cpu/sh4a/clock-sh7366.c
arch/sh/kernel/cpu/sh4a/clock-sh7722.c
arch/sh/kernel/cpu/sh4a/clock-sh7723.c
arch/sh/kernel/cpu/sh4a/clock-sh7724.c
arch/sh/kernel/cpu/sh4a/clock-sh7785.c
arch/sh/kernel/cpu/sh4a/clock-sh7786.c
arch/sh/kernel/cpu/sh4a/setup-sh7343.c
arch/sh/kernel/cpu/sh4a/setup-sh7366.c
arch/sh/kernel/cpu/sh4a/setup-sh7722.c
arch/sh/kernel/cpu/sh4a/setup-sh7723.c
arch/sh/kernel/cpu/sh4a/setup-sh7724.c
arch/sh/kernel/cpu/sh4a/setup-sh7757.c
arch/sh/kernel/cpu/sh4a/setup-sh7763.c
arch/sh/kernel/cpu/sh4a/setup-sh7770.c
arch/sh/kernel/cpu/sh4a/setup-sh7780.c
arch/sh/kernel/cpu/sh4a/setup-sh7785.c
arch/sh/kernel/cpu/sh4a/setup-sh7786.c
arch/sh/kernel/cpu/sh4a/setup-shx3.c
arch/sh/kernel/cpu/sh4a/smp-shx3.c
arch/sh/kernel/cpu/sh5/probe.c
arch/sh/kernel/cpu/sh5/setup-sh5.c
arch/sh/kernel/dwarf.c
arch/sh/kernel/head_32.S
arch/sh/kernel/hw_breakpoint.c
arch/sh/kernel/irq.c
arch/sh/kernel/process.c
arch/sh/mm/Makefile
arch/sh/mm/cache-shx3.c [new file with mode: 0644]
arch/sh/mm/cache.c
arch/sh/mm/fault_32.c
arch/sh/mm/pmb.c
arch/sh/mm/tlb-debugfs.c [new file with mode: 0644]
arch/sh/mm/tlbflush_64.c
drivers/base/platform.c
drivers/clocksource/sh_cmt.c
drivers/clocksource/sh_mtu2.c
drivers/clocksource/sh_tmu.c
drivers/dma/shdma.c
drivers/dma/shdma.h
drivers/serial/sh-sci.c
drivers/sh/Kconfig [new file with mode: 0644]
drivers/sh/intc.c
include/linux/device.h
include/linux/serial_sci.h
include/linux/sh_dma.h [new file with mode: 0644]
include/linux/sh_intc.h

index 8d90564..ba86bfb 100644 (file)
@@ -732,6 +732,8 @@ config GUSA_RB
          LLSC, this should be more efficient than the other alternative of
          disabling interrupts around the atomic sequence.
 
+source "drivers/sh/Kconfig"
+
 endmenu
 
 menu "Boot options"
index f094ea2..0c057a9 100644 (file)
@@ -165,6 +165,19 @@ static void sdk7786_restart(char *cmd)
        fpga_write_reg(0xa5a5, SRSTR);
 }
 
+static void sdk7786_power_off(void)
+{
+       fpga_write_reg(fpga_read_reg(PWRCR) | PWRCR_PDWNREQ, PWRCR);
+
+       /*
+        * It can take up to 20us for the R8C to do its job, back off and
+        * wait a bit until we've been shut off. Even though newer FPGA
+        * versions don't set the ACK bit, the latency issue remains.
+        */
+       while ((fpga_read_reg(PWRCR) & PWRCR_PDWNACK) == 0)
+               cpu_sleep();
+}
+
 /* Initialize the board */
 static void __init sdk7786_setup(char **cmdline_p)
 {
@@ -175,6 +188,7 @@ static void __init sdk7786_setup(char **cmdline_p)
        pr_info("\tPCB revision:\t%d\n", fpga_read_reg(PCBRR) & 0xf);
 
        machine_ops.restart = sdk7786_restart;
+       pm_power_off = sdk7786_power_off;
 }
 
 /*
index 5d660b9..cfa5a08 100644 (file)
@@ -14,10 +14,16 @@ OBJECTS = $(obj)/head_$(BITS).o $(obj)/misc.o $(obj)/cache.o
 #
 # IMAGE_OFFSET is the load offset of the compression loader
 #
+ifeq ($(CONFIG_32BIT),y)
+IMAGE_OFFSET   := $(shell /bin/bash -c 'printf "0x%08x" \
+                    $$[$(CONFIG_MEMORY_START)  + \
+                       $(CONFIG_BOOT_LINK_OFFSET)]')
+else
 IMAGE_OFFSET   := $(shell /bin/bash -c 'printf "0x%08x" \
                     $$[$(CONFIG_PAGE_OFFSET)  + \
                        $(KERNEL_MEMORY) + \
                        $(CONFIG_BOOT_LINK_OFFSET)]')
+endif
 
 LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
 
index 02a3093..200c1d4 100644 (file)
@@ -97,7 +97,11 @@ init_stack_addr:
 decompress_kernel_addr:
        .long   decompress_kernel
 kernel_start_addr:
+#ifdef CONFIG_32BIT
+       .long   ___pa(_text+PAGE_SIZE)
+#else
        .long   _text+PAGE_SIZE
+#endif
 
        .align  9
 fake_headers_as_bzImage:
index 02df18e..e461d67 100644 (file)
@@ -38,14 +38,10 @@ struct cache_info {
         * 2. those in the physical page number.
         */
        unsigned int alias_mask;
-
        unsigned int n_aliases;         /* Number of aliases */
 
        unsigned long flags;
 };
-
-int __init detect_cpu_and_cache_system(void);
-
 #endif /* __ASSEMBLY__ */
 #endif /* __KERNEL__ */
 #endif /* __ASM_SH_CACHE_H */
diff --git a/arch/sh/include/asm/clkdev.h b/arch/sh/include/asm/clkdev.h
new file mode 100644 (file)
index 0000000..5645f35
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ *  arch/sh/include/asm/clkdev.h
+ *
+ * Cloned from arch/arm/include/asm/clkdev.h:
+ *
+ *  Copyright (C) 2008 Russell King.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Helper for the clk API to assist looking up a struct clk.
+ */
+#ifndef __ASM_CLKDEV_H
+#define __ASM_CLKDEV_H
+
+struct clk;
+
+struct clk_lookup {
+       struct list_head        node;
+       const char              *dev_id;
+       const char              *con_id;
+       struct clk              *clk;
+};
+
+struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id,
+       const char *dev_fmt, ...);
+
+void clkdev_add(struct clk_lookup *cl);
+void clkdev_drop(struct clk_lookup *cl);
+
+void clkdev_add_table(struct clk_lookup *, size_t);
+int clk_add_alias(const char *, const char *, char *, struct device *);
+
+#endif
index 11da4c5..4b19179 100644 (file)
@@ -45,13 +45,6 @@ struct clk {
        struct cpufreq_frequency_table *freq_table;
 };
 
-struct clk_lookup {
-       struct list_head        node;
-       const char              *dev_id;
-       const char              *con_id;
-       struct clk              *clk;
-};
-
 #define CLK_ENABLE_ON_INIT     (1 << 0)
 
 /* Should be defined by processor-specific code */
index bf2f30c..2a02b61 100644 (file)
 #ifndef ASM_DMAENGINE_H
 #define ASM_DMAENGINE_H
 
-#include <linux/dmaengine.h>
-#include <linux/list.h>
+#include <linux/sh_dma.h>
 
-#include <asm/dma-register.h>
-
-#define SH_DMAC_MAX_CHANNELS   6
-
-enum sh_dmae_slave_chan_id {
+enum {
        SHDMA_SLAVE_SCIF0_TX,
        SHDMA_SLAVE_SCIF0_RX,
        SHDMA_SLAVE_SCIF1_TX,
@@ -34,60 +29,6 @@ enum sh_dmae_slave_chan_id {
        SHDMA_SLAVE_SIUA_RX,
        SHDMA_SLAVE_SIUB_TX,
        SHDMA_SLAVE_SIUB_RX,
-       SHDMA_SLAVE_NUMBER,     /* Must stay last */
-};
-
-struct sh_dmae_slave_config {
-       enum sh_dmae_slave_chan_id      slave_id;
-       dma_addr_t                      addr;
-       u32                             chcr;
-       char                            mid_rid;
-};
-
-struct sh_dmae_channel {
-       unsigned int    offset;
-       unsigned int    dmars;
-       unsigned int    dmars_bit;
-};
-
-struct sh_dmae_pdata {
-       struct sh_dmae_slave_config *slave;
-       int slave_num;
-       struct sh_dmae_channel *channel;
-       int channel_num;
-       unsigned int ts_low_shift;
-       unsigned int ts_low_mask;
-       unsigned int ts_high_shift;
-       unsigned int ts_high_mask;
-       unsigned int *ts_shift;
-       int ts_shift_num;
-       u16 dmaor_init;
-};
-
-struct device;
-
-/* Used by slave DMA clients to request DMA to/from a specific peripheral */
-struct sh_dmae_slave {
-       enum sh_dmae_slave_chan_id      slave_id; /* Set by the platform */
-       struct device                   *dma_dev; /* Set by the platform */
-       struct sh_dmae_slave_config     *config;  /* Set by the driver */
-};
-
-struct sh_dmae_regs {
-       u32 sar; /* SAR / source address */
-       u32 dar; /* DAR / destination address */
-       u32 tcr; /* TCR / transfer count */
-};
-
-struct sh_desc {
-       struct sh_dmae_regs hw;
-       struct list_head node;
-       struct dma_async_tx_descriptor async_tx;
-       enum dma_data_direction direction;
-       dma_cookie_t cookie;
-       size_t partial;
-       int chunks;
-       int mark;
 };
 
 #endif
index 965dd78..1c388c1 100644 (file)
@@ -56,7 +56,6 @@ extern int hw_breakpoint_exceptions_notify(struct notifier_block *unused,
 int arch_install_hw_breakpoint(struct perf_event *bp);
 void arch_uninstall_hw_breakpoint(struct perf_event *bp);
 void hw_breakpoint_pmu_read(struct perf_event *bp);
-void hw_breakpoint_pmu_unthrottle(struct perf_event *bp);
 
 extern void arch_fill_perf_breakpoint(struct perf_event *bp);
 extern int register_sh_ubc(struct sh_ubc *);
index df8e150..99c593b 100644 (file)
 #define NR_IRQS                        256
 #define NR_IRQS_LEGACY         8       /* Legacy external IRQ0-7 */
 
+/*
+ * This is a special IRQ number for indicating that no IRQ has been
+ * triggered and to simply ignore the IRQ dispatch. This is a special
+ * case that can happen with IRQ auto-distribution when multiple CPUs
+ * are woken up and signalled in parallel.
+ */
+#define NO_IRQ_IGNORE          ((unsigned int)-1)
+
 /*
  * Convert back and forth between INTEVT and IRQ values.
  */
@@ -53,6 +61,14 @@ extern void irq_ctx_exit(int cpu);
 # define irq_ctx_exit(cpu) do { } while (0)
 #endif
 
+#ifdef CONFIG_INTC_BALANCING
+extern unsigned int irq_lookup(unsigned int irq);
+extern void irq_finish(unsigned int irq);
+#else
+#define irq_lookup(irq)                (irq)
+#define irq_finish(irq)                do { } while (0)
+#endif
+
 #include <asm-generic/irq.h>
 #ifdef CONFIG_CPU_SH5
 #include <cpu/irq.h>
index d71feb3..0152c04 100644 (file)
@@ -128,13 +128,18 @@ typedef struct page *pgtable_t;
  * added or subtracted as required.
  */
 #ifdef CONFIG_PMB
-#define __pa(x)        ((unsigned long)(x)-PAGE_OFFSET+__MEMORY_START)
-#define __va(x)        ((void *)((unsigned long)(x)+PAGE_OFFSET-__MEMORY_START))
+#define ___pa(x)       ((x)-PAGE_OFFSET+__MEMORY_START)
+#define ___va(x)       ((x)+PAGE_OFFSET-__MEMORY_START)
 #else
-#define __pa(x)        ((unsigned long)(x)-PAGE_OFFSET)
-#define __va(x)        ((void *)((unsigned long)(x)+PAGE_OFFSET))
+#define ___pa(x)       ((x)-PAGE_OFFSET)
+#define ___va(x)       ((x)+PAGE_OFFSET)
 #endif
 
+#ifndef __ASSEMBLY__
+#define __pa(x)                ___pa((unsigned long)x)
+#define __va(x)                (void *)___va((unsigned long)x)
+#endif /* !__ASSEMBLY__ */
+
 #ifdef CONFIG_UNCACHED_MAPPING
 #define UNCAC_ADDR(addr)       ((addr) - PAGE_OFFSET + uncached_start)
 #define CAC_ADDR(addr)         ((addr) - uncached_start + PAGE_OFFSET)
index 9605e06..26b3f02 100644 (file)
@@ -102,6 +102,9 @@ struct task_struct;
 
 extern struct pt_regs fake_swapper_regs;
 
+extern void cpu_init(void);
+extern void cpu_probe(void);
+
 /* arch/sh/kernel/process.c */
 extern unsigned int xstate_size;
 extern void free_thread_xstate(struct task_struct *);
index 572b4eb..61a445d 100644 (file)
@@ -27,8 +27,6 @@
 #define CCN_CVR                0xff000040
 #define CCN_PRR                0xff000044
 
-asmlinkage void __init sh_cpu_init(void);
-
 /*
  * User space process size: 2GB.
  *
index f1b1e69..e8d4142 100644 (file)
@@ -17,10 +17,10 @@ struct device;
 
 struct siu_platform {
        struct device *dma_dev;
-       enum sh_dmae_slave_chan_id dma_slave_tx_a;
-       enum sh_dmae_slave_chan_id dma_slave_rx_a;
-       enum sh_dmae_slave_chan_id dma_slave_tx_b;
-       enum sh_dmae_slave_chan_id dma_slave_rx_b;
+       unsigned int dma_slave_tx_a;
+       unsigned int dma_slave_rx_a;
+       unsigned int dma_slave_tx_b;
+       unsigned int dma_slave_rx_b;
 };
 
 #endif /* ASM_SIU_H */
index de23595..9a6125e 100644 (file)
@@ -23,7 +23,8 @@
 #define CHCR_TS_HIGH_MASK      0
 #define CHCR_TS_HIGH_SHIFT     0
 #elif defined(CONFIG_CPU_SUBTYPE_SH7722) || \
-       defined(CONFIG_CPU_SUBTYPE_SH7724)
+       defined(CONFIG_CPU_SUBTYPE_SH7724) || \
+       defined(CONFIG_CPU_SUBTYPE_SH7786)
 #define CHCR_TS_LOW_MASK       0x00000018
 #define CHCR_TS_LOW_SHIFT      3
 #define CHCR_TS_HIGH_MASK      0x00300000
index 5963124..e46ec70 100644 (file)
 
 #define MMUCR          0xFF000010      /* MMU Control Register */
 
+#define MMU_TLB_ENTRY_SHIFT    8
+
 #define MMU_ITLB_ADDRESS_ARRAY  0xF2000000
 #define MMU_ITLB_ADDRESS_ARRAY2        0xF2800000
+#define MMU_ITLB_DATA_ARRAY    0xF3000000
+#define MMU_ITLB_DATA_ARRAY2   0xF3800000
+
 #define MMU_UTLB_ADDRESS_ARRAY 0xF6000000
 #define MMU_UTLB_ADDRESS_ARRAY2        0xF6800000
+#define MMU_UTLB_DATA_ARRAY    0xF7000000
+#define MMU_UTLB_DATA_ARRAY2   0xF7800000
 #define MMU_PAGE_ASSOC_BIT     0x80
 
-#define MMUCR_TI               (1<<2)
+#ifdef CONFIG_MMU
+#define MMUCR_AT               (1 << 0)
+#else
+#define MMUCR_AT               (0)
+#endif
+
+#define MMUCR_TI               (1 << 2)
 
 #define MMUCR_URB              0x00FC0000
 #define MMUCR_URB_SHIFT                18
@@ -58,7 +71,8 @@
 #endif
 
 #define MMU_NTLB_ENTRIES       64
-#define MMU_CONTROL_INIT       (0x05|MMUCR_SQMD|MMUCR_ME|MMUCR_SE|MMUCR_AEX)
+#define MMU_CONTROL_INIT       (MMUCR_AT | MMUCR_TI | MMUCR_SQMD | \
+                                MMUCR_ME | MMUCR_SE | MMUCR_AEX)
 
 #define TRA    0xff000020
 #define EXPEVT 0xff000024
index 2120d67..416b621 100644 (file)
 #define  SCBR_I2CCEN   BIT(1)  /* CPU I2C master enable */
 
 #define PWRCR          0x1a0
+#define  PWRCR_SCISEL0 BIT(0)
+#define  PWRCR_SCISEL1 BIT(1)
+#define  PWRCR_SCIEN   BIT(2)  /* Serial port enable */
+#define  PWRCR_PDWNACK BIT(5)  /* Power down acknowledge */
+#define  PWRCR_PDWNREQ BIT(7)  /* Power down request */
+#define  PWRCR_INT2    BIT(11) /* INT2 connection to power manager */
+#define  PWRCR_BUPINIT BIT(13) /* DDR backup initialize */
+#define  PWRCR_BKPRST  BIT(15) /* Backup power reset */
+
 #define SPCBR          0x1b0
 #define SPICR          0x1c0
 #define SPIDR          0x1d0
index 02fd3ae..650b92f 100644 (file)
@@ -11,7 +11,7 @@ endif
 
 CFLAGS_REMOVE_return_address.o = -pg
 
-obj-y  := debugtraps.o dma-nommu.o dumpstack.o                         \
+obj-y  := clkdev.o debugtraps.o dma-nommu.o dumpstack.o                \
           idle.o io.o io_generic.o irq.o                               \
           irq_$(BITS).o machvec.o nmi_debug.o process.o                \
           process_$(BITS).o ptrace_$(BITS).o                           \
diff --git a/arch/sh/kernel/clkdev.c b/arch/sh/kernel/clkdev.c
new file mode 100644 (file)
index 0000000..defdd6e
--- /dev/null
@@ -0,0 +1,169 @@
+/*
+ * arch/sh/kernel/clkdev.c
+ *
+ * Cloned from arch/arm/common/clkdev.c:
+ *
+ *  Copyright (C) 2008 Russell King.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Helper for the clk API to assist looking up a struct clk.
+ */
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/device.h>
+#include <linux/list.h>
+#include <linux/errno.h>
+#include <linux/err.h>
+#include <linux/string.h>
+#include <linux/mutex.h>
+#include <linux/clk.h>
+#include <linux/slab.h>
+#include <linux/bootmem.h>
+#include <linux/mm.h>
+#include <asm/clock.h>
+#include <asm/clkdev.h>
+
+static LIST_HEAD(clocks);
+static DEFINE_MUTEX(clocks_mutex);
+
+/*
+ * Find the correct struct clk for the device and connection ID.
+ * We do slightly fuzzy matching here:
+ *  An entry with a NULL ID is assumed to be a wildcard.
+ *  If an entry has a device ID, it must match
+ *  If an entry has a connection ID, it must match
+ * Then we take the most specific entry - with the following
+ * order of precidence: dev+con > dev only > con only.
+ */
+static struct clk *clk_find(const char *dev_id, const char *con_id)
+{
+       struct clk_lookup *p;
+       struct clk *clk = NULL;
+       int match, best = 0;
+
+       list_for_each_entry(p, &clocks, node) {
+               match = 0;
+               if (p->dev_id) {
+                       if (!dev_id || strcmp(p->dev_id, dev_id))
+                               continue;
+                       match += 2;
+               }
+               if (p->con_id) {
+                       if (!con_id || strcmp(p->con_id, con_id))
+                               continue;
+                       match += 1;
+               }
+               if (match == 0)
+                       continue;
+
+               if (match > best) {
+                       clk = p->clk;
+                       best = match;
+               }
+       }
+       return clk;
+}
+
+struct clk *clk_get_sys(const char *dev_id, const char *con_id)
+{
+       struct clk *clk;
+
+       mutex_lock(&clocks_mutex);
+       clk = clk_find(dev_id, con_id);
+       mutex_unlock(&clocks_mutex);
+
+       return clk ? clk : ERR_PTR(-ENOENT);
+}
+EXPORT_SYMBOL(clk_get_sys);
+
+void clkdev_add(struct clk_lookup *cl)
+{
+       mutex_lock(&clocks_mutex);
+       list_add_tail(&cl->node, &clocks);
+       mutex_unlock(&clocks_mutex);
+}
+EXPORT_SYMBOL(clkdev_add);
+
+void __init clkdev_add_table(struct clk_lookup *cl, size_t num)
+{
+       mutex_lock(&clocks_mutex);
+       while (num--) {
+               list_add_tail(&cl->node, &clocks);
+               cl++;
+       }
+       mutex_unlock(&clocks_mutex);
+}
+
+#define MAX_DEV_ID     20
+#define MAX_CON_ID     16
+
+struct clk_lookup_alloc {
+       struct clk_lookup cl;
+       char    dev_id[MAX_DEV_ID];
+       char    con_id[MAX_CON_ID];
+};
+
+struct clk_lookup * __init_refok
+clkdev_alloc(struct clk *clk, const char *con_id, const char *dev_fmt, ...)
+{
+       struct clk_lookup_alloc *cla;
+
+       if (!slab_is_available())
+               cla = alloc_bootmem_low_pages(sizeof(*cla));
+       else
+               cla = kzalloc(sizeof(*cla), GFP_KERNEL);
+
+       if (!cla)
+               return NULL;
+
+       cla->cl.clk = clk;
+       if (con_id) {
+               strlcpy(cla->con_id, con_id, sizeof(cla->con_id));
+               cla->cl.con_id = cla->con_id;
+       }
+
+       if (dev_fmt) {
+               va_list ap;
+
+               va_start(ap, dev_fmt);
+               vscnprintf(cla->dev_id, sizeof(cla->dev_id), dev_fmt, ap);
+               cla->cl.dev_id = cla->dev_id;
+               va_end(ap);
+       }
+
+       return &cla->cl;
+}
+EXPORT_SYMBOL(clkdev_alloc);
+
+int clk_add_alias(const char *alias, const char *alias_dev_name, char *id,
+       struct device *dev)
+{
+       struct clk *r = clk_get(dev, id);
+       struct clk_lookup *l;
+
+       if (IS_ERR(r))
+               return PTR_ERR(r);
+
+       l = clkdev_alloc(r, alias, alias_dev_name);
+       clk_put(r);
+       if (!l)
+               return -ENODEV;
+       clkdev_add(l);
+       return 0;
+}
+EXPORT_SYMBOL(clk_add_alias);
+
+/*
+ * clkdev_drop - remove a clock dynamically allocated
+ */
+void clkdev_drop(struct clk_lookup *cl)
+{
+       mutex_lock(&clocks_mutex);
+       list_del(&cl->node);
+       mutex_unlock(&clocks_mutex);
+       kfree(cl);
+}
+EXPORT_SYMBOL(clkdev_drop);
index eed5eaf..17a73ad 100644 (file)
@@ -338,6 +338,11 @@ int __init __deprecated cpg_clk_init(void)
                        ret |= clk_register(clk);
        }
 
+       clk_add_alias("tmu_fck", NULL, "peripheral_clk", NULL);
+       clk_add_alias("mtu2_fck", NULL, "peripheral_clk", NULL);
+       clk_add_alias("cmt_fck", NULL, "peripheral_clk", NULL);
+       clk_add_alias("sci_ick", NULL, "peripheral_clk", NULL);
+
        return ret;
 }
 
index e9fa1bf..9ded1bc 100644 (file)
  *
  *  Modified for omap shared clock framework by Tony Lindgren <tony@atomide.com>
  *
- *  With clkdev bits:
- *
- *     Copyright (C) 2008 Russell King.
- *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
@@ -30,6 +26,7 @@
 #include <linux/platform_device.h>
 #include <linux/debugfs.h>
 #include <linux/cpufreq.h>
+#include <linux/clk.h>
 #include <asm/clock.h>
 #include <asm/machvec.h>
 
@@ -397,56 +394,6 @@ long clk_round_rate(struct clk *clk, unsigned long rate)
 }
 EXPORT_SYMBOL_GPL(clk_round_rate);
 
-/*
- * Find the correct struct clk for the device and connection ID.
- * We do slightly fuzzy matching here:
- *  An entry with a NULL ID is assumed to be a wildcard.
- *  If an entry has a device ID, it must match
- *  If an entry has a connection ID, it must match
- * Then we take the most specific entry - with the following
- * order of precedence: dev+con > dev only > con only.
- */
-static struct clk *clk_find(const char *dev_id, const char *con_id)
-{
-       struct clk_lookup *p;
-       struct clk *clk = NULL;
-       int match, best = 0;
-
-       list_for_each_entry(p, &clock_list, node) {
-               match = 0;
-               if (p->dev_id) {
-                       if (!dev_id || strcmp(p->dev_id, dev_id))
-                               continue;
-                       match += 2;
-               }
-               if (p->con_id) {
-                       if (!con_id || strcmp(p->con_id, con_id))
-                               continue;
-                       match += 1;
-               }
-               if (match == 0)
-                       continue;
-
-               if (match > best) {
-                       clk = p->clk;
-                       best = match;
-               }
-       }
-       return clk;
-}
-
-struct clk *clk_get_sys(const char *dev_id, const char *con_id)
-{
-       struct clk *clk;
-
-       mutex_lock(&clock_list_sem);
-       clk = clk_find(dev_id, con_id);
-       mutex_unlock(&clock_list_sem);
-
-       return clk ? clk : ERR_PTR(-ENOENT);
-}
-EXPORT_SYMBOL_GPL(clk_get_sys);
-
 /*
  * Returns a clock. Note that we first try to use device id on the bus
  * and clock name. If this fails, we try to use clock name only.
index c736422..9766106 100644 (file)
@@ -43,9 +43,9 @@
  * peripherals (nofpu, nodsp, and so forth).
  */
 #define onchip_setup(x)                                        \
-static int x##_disabled __initdata = !cpu_has_##x;     \
+static int x##_disabled __cpuinitdata = !cpu_has_##x;  \
                                                        \
-static int __init x##_setup(char *opts)                        \
+static int __cpuinit x##_setup(char *opts)                     \
 {                                                      \
        x##_disabled = 1;                               \
        return 1;                                       \
@@ -59,7 +59,7 @@ onchip_setup(dsp);
 #define CPUOPM         0xff2f0000
 #define CPUOPM_RABD    (1 << 5)
 
-static void __init speculative_execution_init(void)
+static void __cpuinit speculative_execution_init(void)
 {
        /* Clear RABD */
        __raw_writel(__raw_readl(CPUOPM) & ~CPUOPM_RABD, CPUOPM);
@@ -78,7 +78,7 @@ static void __init speculative_execution_init(void)
 #define EXPMASK_BRDSSLP                (1 << 1)
 #define EXPMASK_MMCAW          (1 << 4)
 
-static void __init expmask_init(void)
+static void __cpuinit expmask_init(void)
 {
        unsigned long expmask = __raw_readl(EXPMASK);
 
@@ -217,7 +217,7 @@ static void detect_cache_shape(void)
                l2_cache_shape = -1; /* No S-cache */
 }
 
-static void __init fpu_init(void)
+static void __cpuinit fpu_init(void)
 {
        /* Disable the FPU */
        if (fpu_disabled && (current_cpu_data.flags & CPU_HAS_FPU)) {
@@ -230,7 +230,7 @@ static void __init fpu_init(void)
 }
 
 #ifdef CONFIG_SH_DSP
-static void __init release_dsp(void)
+static void __cpuinit release_dsp(void)
 {
        unsigned long sr;
 
@@ -244,7 +244,7 @@ static void __init release_dsp(void)
        );
 }
 
-static void __init dsp_init(void)
+static void __cpuinit dsp_init(void)
 {
        unsigned long sr;
 
@@ -276,11 +276,11 @@ static void __init dsp_init(void)
        release_dsp();
 }
 #else
-static inline void __init dsp_init(void) { }
+static inline void __cpuinit dsp_init(void) { }
 #endif /* CONFIG_SH_DSP */
 
 /**
- * sh_cpu_init
+ * cpu_init
  *
  * This is our initial entry point for each CPU, and is invoked on the
  * boot CPU prior to calling start_kernel(). For SMP, a combination of
@@ -293,14 +293,14 @@ static inline void __init dsp_init(void) { }
  * subtype and initial configuration will all be done.
  *
  * Each processor family is still responsible for doing its own probing
- * and cache configuration in detect_cpu_and_cache_system().
+ * and cache configuration in cpu_probe().
  */
-asmlinkage void __init sh_cpu_init(void)
+asmlinkage void __cpuinit cpu_init(void)
 {
        current_thread_info()->cpu = hard_smp_processor_id();
 
        /* First, probe the CPU */
-       detect_cpu_and_cache_system();
+       cpu_probe();
 
        if (current_cpu_data.type == CPU_SH_NONE)
                panic("Unknown CPU");
index 1db6d88..bab8e75 100644 (file)
@@ -13,7 +13,7 @@
 #include <asm/processor.h>
 #include <asm/cache.h>
 
-int __init detect_cpu_and_cache_system(void)
+void __cpuinit cpu_probe(void)
 {
 #if defined(CONFIG_CPU_SUBTYPE_SH7619)
        boot_cpu_data.type                      = CPU_SH7619;
@@ -30,7 +30,4 @@ int __init detect_cpu_and_cache_system(void)
        boot_cpu_data.dcache.flags |= SH_CACHE_COMBINED;
        boot_cpu_data.icache = boot_cpu_data.dcache;
        boot_cpu_data.family = CPU_FAMILY_SH2;
-
-       return 0;
 }
-
index 114c7ce..c363851 100644 (file)
@@ -128,17 +128,14 @@ static struct platform_device eth_device = {
 };
 
 static struct sh_timer_config cmt0_platform_data = {
-       .name = "CMT0",
        .channel_offset = 0x02,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
        .clockevent_rating = 125,
        .clocksource_rating = 0, /* disabled due to code generation issues */
 };
 
 static struct resource cmt0_resources[] = {
        [0] = {
-               .name   = "CMT0",
                .start  = 0xf84a0072,
                .end    = 0xf84a0077,
                .flags  = IORESOURCE_MEM,
@@ -160,17 +157,14 @@ static struct platform_device cmt0_device = {
 };
 
 static struct sh_timer_config cmt1_platform_data = {
-       .name = "CMT1",
        .channel_offset = 0x08,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
        .clockevent_rating = 125,
        .clocksource_rating = 0, /* disabled due to code generation issues */
 };
 
 static struct resource cmt1_resources[] = {
        [0] = {
-               .name   = "CMT1",
                .start  = 0xf84a0078,
                .end    = 0xf84a007d,
                .flags  = IORESOURCE_MEM,
index 6825d65..48e97a2 100644 (file)
@@ -13,7 +13,7 @@
 #include <asm/processor.h>
 #include <asm/cache.h>
 
-int __init detect_cpu_and_cache_system(void)
+void __cpuinit cpu_probe(void)
 {
        boot_cpu_data.family                    = CPU_FAMILY_SH2A;
 
@@ -51,6 +51,4 @@ int __init detect_cpu_and_cache_system(void)
         * on the cache info.
         */
        boot_cpu_data.icache            = boot_cpu_data.dcache;
-
-       return 0;
 }
index 8f669dc..6c96ea0 100644 (file)
@@ -115,16 +115,13 @@ static DECLARE_INTC_DESC(intc_desc, "mxg", vectors, groups,
                         mask_registers, prio_registers, NULL);
 
 static struct sh_timer_config mtu2_0_platform_data = {
-       .name = "MTU2_0",
        .channel_offset = -0x80,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
        .clockevent_rating = 200,
 };
 
 static struct resource mtu2_0_resources[] = {
        [0] = {
-               .name   = "MTU2_0",
                .start  = 0xff801300,
                .end    = 0xff801326,
                .flags  = IORESOURCE_MEM,
@@ -146,16 +143,13 @@ static struct platform_device mtu2_0_device = {
 };
 
 static struct sh_timer_config mtu2_1_platform_data = {
-       .name = "MTU2_1",
        .channel_offset = -0x100,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
        .clockevent_rating = 200,
 };
 
 static struct resource mtu2_1_resources[] = {
        [0] = {
-               .name   = "MTU2_1",
                .start  = 0xff801380,
                .end    = 0xff801390,
                .flags  = IORESOURCE_MEM,
@@ -177,16 +171,13 @@ static struct platform_device mtu2_1_device = {
 };
 
 static struct sh_timer_config mtu2_2_platform_data = {
-       .name = "MTU2_2",
        .channel_offset = 0x80,
        .timer_bit = 2,
-       .clk = "peripheral_clk",
        .clockevent_rating = 200,
 };
 
 static struct resource mtu2_2_resources[] = {
        [0] = {
-               .name   = "MTU2_2",
                .start  = 0xff801000,
                .end    = 0xff80100a,
                .flags  = IORESOURCE_MEM,
index 4ccfeb5..d08bf4c 100644 (file)
@@ -318,16 +318,13 @@ static struct platform_device rtc_device = {
 };
 
 static struct sh_timer_config mtu2_0_platform_data = {
-       .name = "MTU2_0",
        .channel_offset = -0x80,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
        .clockevent_rating = 200,
 };
 
 static struct resource mtu2_0_resources[] = {
        [0] = {
-               .name   = "MTU2_0",
                .start  = 0xfffe4300,
                .end    = 0xfffe4326,
                .flags  = IORESOURCE_MEM,
@@ -349,16 +346,13 @@ static struct platform_device mtu2_0_device = {
 };
 
 static struct sh_timer_config mtu2_1_platform_data = {
-       .name = "MTU2_1",
        .channel_offset = -0x100,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
        .clockevent_rating = 200,
 };
 
 static struct resource mtu2_1_resources[] = {
        [0] = {
-               .name   = "MTU2_1",
                .start  = 0xfffe4380,
                .end    = 0xfffe4390,
                .flags  = IORESOURCE_MEM,
@@ -380,16 +374,13 @@ static struct platform_device mtu2_1_device = {
 };
 
 static struct sh_timer_config mtu2_2_platform_data = {
-       .name = "MTU2_2",
        .channel_offset = 0x80,
        .timer_bit = 2,
-       .clk = "peripheral_clk",
        .clockevent_rating = 200,
 };
 
 static struct resource mtu2_2_resources[] = {
        [0] = {
-               .name   = "MTU2_2",
                .start  = 0xfffe4000,
                .end    = 0xfffe400a,
                .flags  = IORESOURCE_MEM,
index 3136966..832f401 100644 (file)
@@ -234,17 +234,14 @@ static struct platform_device scif3_device = {
 };
 
 static struct sh_timer_config cmt0_platform_data = {
-       .name = "CMT0",
        .channel_offset = 0x02,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
        .clockevent_rating = 125,
        .clocksource_rating = 0, /* disabled due to code generation issues */
 };
 
 static struct resource cmt0_resources[] = {
        [0] = {
-               .name   = "CMT0",
                .start  = 0xfffec002,
                .end    = 0xfffec007,
                .flags  = IORESOURCE_MEM,
@@ -266,17 +263,14 @@ static struct platform_device cmt0_device = {
 };
 
 static struct sh_timer_config cmt1_platform_data = {
-       .name = "CMT1",
        .channel_offset = 0x08,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
        .clockevent_rating = 125,
        .clocksource_rating = 0, /* disabled due to code generation issues */
 };
 
 static struct resource cmt1_resources[] = {
        [0] = {
-               .name   = "CMT1",
                .start  = 0xfffec008,
                .end    = 0xfffec00d,
                .flags  = IORESOURCE_MEM,
@@ -298,16 +292,13 @@ static struct platform_device cmt1_device = {
 };
 
 static struct sh_timer_config mtu2_0_platform_data = {
-       .name = "MTU2_0",
        .channel_offset = -0x80,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
        .clockevent_rating = 200,
 };
 
 static struct resource mtu2_0_resources[] = {
        [0] = {
-               .name   = "MTU2_0",
                .start  = 0xfffe4300,
                .end    = 0xfffe4326,
                .flags  = IORESOURCE_MEM,
@@ -329,16 +320,13 @@ static struct platform_device mtu2_0_device = {
 };
 
 static struct sh_timer_config mtu2_1_platform_data = {
-       .name = "MTU2_1",
        .channel_offset = -0x100,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
        .clockevent_rating = 200,
 };
 
 static struct resource mtu2_1_resources[] = {
        [0] = {
-               .name   = "MTU2_1",
                .start  = 0xfffe4380,
                .end    = 0xfffe4390,
                .flags  = IORESOURCE_MEM,
index 0648735..dc47b04 100644 (file)
@@ -194,17 +194,14 @@ static struct platform_device scif3_device = {
 };
 
 static struct sh_timer_config cmt0_platform_data = {
-       .name = "CMT0",
        .channel_offset = 0x02,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
        .clockevent_rating = 125,
        .clocksource_rating = 0, /* disabled due to code generation issues */
 };
 
 static struct resource cmt0_resources[] = {
        [0] = {
-               .name   = "CMT0",
                .start  = 0xfffec002,
                .end    = 0xfffec007,
                .flags  = IORESOURCE_MEM,
@@ -226,17 +223,14 @@ static struct platform_device cmt0_device = {
 };
 
 static struct sh_timer_config cmt1_platform_data = {
-       .name = "CMT1",
        .channel_offset = 0x08,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
        .clockevent_rating = 125,
        .clocksource_rating = 0, /* disabled due to code generation issues */
 };
 
 static struct resource cmt1_resources[] = {
        [0] = {
-               .name   = "CMT1",
                .start  = 0xfffec008,
                .end    = 0xfffec00d,
                .flags  = IORESOURCE_MEM,
@@ -258,16 +252,13 @@ static struct platform_device cmt1_device = {
 };
 
 static struct sh_timer_config mtu2_0_platform_data = {
-       .name = "MTU2_0",
        .channel_offset = -0x80,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
        .clockevent_rating = 200,
 };
 
 static struct resource mtu2_0_resources[] = {
        [0] = {
-               .name   = "MTU2_0",
                .start  = 0xfffe4300,
                .end    = 0xfffe4326,
                .flags  = IORESOURCE_MEM,
@@ -289,16 +280,13 @@ static struct platform_device mtu2_0_device = {
 };
 
 static struct sh_timer_config mtu2_1_platform_data = {
-       .name = "MTU2_1",
        .channel_offset = -0x100,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
        .clockevent_rating = 200,
 };
 
 static struct resource mtu2_1_resources[] = {
        [0] = {
-               .name   = "MTU2_1",
                .start  = 0xfffe4380,
                .end    = 0xfffe4390,
                .flags  = IORESOURCE_MEM,
@@ -320,16 +308,13 @@ static struct platform_device mtu2_1_device = {
 };
 
 static struct sh_timer_config mtu2_2_platform_data = {
-       .name = "MTU2_2",
        .channel_offset = 0x80,
        .timer_bit = 2,
-       .clk = "peripheral_clk",
        .clockevent_rating = 200,
 };
 
 static struct resource mtu2_2_resources[] = {
        [0] = {
-               .name   = "MTU2_2",
                .start  = 0xfffe4000,
                .end    = 0xfffe400a,
                .flags  = IORESOURCE_MEM,
index 295ec4c..bf23c32 100644 (file)
@@ -16,7 +16,7 @@
 #include <asm/cache.h>
 #include <asm/io.h>
 
-int detect_cpu_and_cache_system(void)
+void __cpuinit cpu_probe(void)
 {
        unsigned long addr0, addr1, data0, data1, data2, data3;
 
@@ -108,6 +108,4 @@ int detect_cpu_and_cache_system(void)
        boot_cpu_data.icache = boot_cpu_data.dcache;
 
        boot_cpu_data.family = CPU_FAMILY_SH3;
-
-       return 0;
 }
index 7b892d6..baadd7f 100644 (file)
@@ -124,16 +124,13 @@ static struct platform_device rtc_device = {
 };
 
 static struct sh_timer_config tmu0_platform_data = {
-       .name = "TMU0",
        .channel_offset = 0x02,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
        .clockevent_rating = 200,
 };
 
 static struct resource tmu0_resources[] = {
        [0] = {
-               .name   = "TMU0",
                .start  = 0xfffffe94,
                .end    = 0xfffffe9f,
                .flags  = IORESOURCE_MEM,
@@ -155,16 +152,13 @@ static struct platform_device tmu0_device = {
 };
 
 static struct sh_timer_config tmu1_platform_data = {
-       .name = "TMU1",
        .channel_offset = 0xe,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
        .clocksource_rating = 200,
 };
 
 static struct resource tmu1_resources[] = {
        [0] = {
-               .name   = "TMU1",
                .start  = 0xfffffea0,
                .end    = 0xfffffeab,
                .flags  = IORESOURCE_MEM,
@@ -186,15 +180,12 @@ static struct platform_device tmu1_device = {
 };
 
 static struct sh_timer_config tmu2_platform_data = {
-       .name = "TMU2",
        .channel_offset = 0x1a,
        .timer_bit = 2,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu2_resources[] = {
        [0] = {
-               .name   = "TMU2",
                .start  = 0xfffffeac,
                .end    = 0xfffffebb,
                .flags  = IORESOURCE_MEM,
index bc0c4f6..3cf8c8e 100644 (file)
@@ -157,16 +157,13 @@ static struct platform_device scif2_device = {
 #endif
 
 static struct sh_timer_config tmu0_platform_data = {
-       .name = "TMU0",
        .channel_offset = 0x02,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
        .clockevent_rating = 200,
 };
 
 static struct resource tmu0_resources[] = {
        [0] = {
-               .name   = "TMU0",
                .start  = 0xfffffe94,
                .end    = 0xfffffe9f,
                .flags  = IORESOURCE_MEM,
@@ -188,16 +185,13 @@ static struct platform_device tmu0_device = {
 };
 
 static struct sh_timer_config tmu1_platform_data = {
-       .name = "TMU1",
        .channel_offset = 0xe,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
        .clocksource_rating = 200,
 };
 
 static struct resource tmu1_resources[] = {
        [0] = {
-               .name   = "TMU1",
                .start  = 0xfffffea0,
                .end    = 0xfffffeab,
                .flags  = IORESOURCE_MEM,
@@ -219,15 +213,12 @@ static struct platform_device tmu1_device = {
 };
 
 static struct sh_timer_config tmu2_platform_data = {
-       .name = "TMU2",
        .channel_offset = 0x1a,
        .timer_bit = 2,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu2_resources[] = {
        [0] = {
-               .name   = "TMU2",
                .start  = 0xfffffeac,
                .end    = 0xfffffebb,
                .flags  = IORESOURCE_MEM,
index 0845a3a..b0c2fb4 100644 (file)
@@ -127,16 +127,13 @@ static struct platform_device scif1_device = {
 };
 
 static struct sh_timer_config tmu0_platform_data = {
-       .name = "TMU0",
        .channel_offset = 0x02,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
        .clockevent_rating = 200,
 };
 
 static struct resource tmu0_resources[] = {
        [0] = {
-               .name   = "TMU0",
                .start  = 0xa412fe94,
                .end    = 0xa412fe9f,
                .flags  = IORESOURCE_MEM,
@@ -158,16 +155,13 @@ static struct platform_device tmu0_device = {
 };
 
 static struct sh_timer_config tmu1_platform_data = {
-       .name = "TMU1",
        .channel_offset = 0xe,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
        .clocksource_rating = 200,
 };
 
 static struct resource tmu1_resources[] = {
        [0] = {
-               .name   = "TMU1",
                .start  = 0xa412fea0,
                .end    = 0xa412feab,
                .flags  = IORESOURCE_MEM,
@@ -189,15 +183,12 @@ static struct platform_device tmu1_device = {
 };
 
 static struct sh_timer_config tmu2_platform_data = {
-       .name = "TMU2",
        .channel_offset = 0x1a,
        .timer_bit = 2,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu2_resources[] = {
        [0] = {
-               .name   = "TMU2",
                .start  = 0xa412feac,
                .end    = 0xa412feb5,
                .flags  = IORESOURCE_MEM,
index a718a62..24b1713 100644 (file)
@@ -130,17 +130,14 @@ static struct platform_device usbf_device = {
 };
 
 static struct sh_timer_config cmt0_platform_data = {
-       .name = "CMT0",
        .channel_offset = 0x10,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
        .clockevent_rating = 125,
        .clocksource_rating = 125,
 };
 
 static struct resource cmt0_resources[] = {
        [0] = {
-               .name   = "CMT0",
                .start  = 0x044a0010,
                .end    = 0x044a001b,
                .flags  = IORESOURCE_MEM,
@@ -162,15 +159,12 @@ static struct platform_device cmt0_device = {
 };
 
 static struct sh_timer_config cmt1_platform_data = {
-       .name = "CMT1",
        .channel_offset = 0x20,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
 };
 
 static struct resource cmt1_resources[] = {
        [0] = {
-               .name   = "CMT1",
                .start  = 0x044a0020,
                .end    = 0x044a002b,
                .flags  = IORESOURCE_MEM,
@@ -192,15 +186,12 @@ static struct platform_device cmt1_device = {
 };
 
 static struct sh_timer_config cmt2_platform_data = {
-       .name = "CMT2",
        .channel_offset = 0x30,
        .timer_bit = 2,
-       .clk = "peripheral_clk",
 };
 
 static struct resource cmt2_resources[] = {
        [0] = {
-               .name   = "CMT2",
                .start  = 0x044a0030,
                .end    = 0x044a003b,
                .flags  = IORESOURCE_MEM,
@@ -222,15 +213,12 @@ static struct platform_device cmt2_device = {
 };
 
 static struct sh_timer_config cmt3_platform_data = {
-       .name = "CMT3",
        .channel_offset = 0x40,
        .timer_bit = 3,
-       .clk = "peripheral_clk",
 };
 
 static struct resource cmt3_resources[] = {
        [0] = {
-               .name   = "CMT3",
                .start  = 0x044a0040,
                .end    = 0x044a004b,
                .flags  = IORESOURCE_MEM,
@@ -252,15 +240,12 @@ static struct platform_device cmt3_device = {
 };
 
 static struct sh_timer_config cmt4_platform_data = {
-       .name = "CMT4",
        .channel_offset = 0x50,
        .timer_bit = 4,
-       .clk = "peripheral_clk",
 };
 
 static struct resource cmt4_resources[] = {
        [0] = {
-               .name   = "CMT4",
                .start  = 0x044a0050,
                .end    = 0x044a005b,
                .flags  = IORESOURCE_MEM,
@@ -282,16 +267,13 @@ static struct platform_device cmt4_device = {
 };
 
 static struct sh_timer_config tmu0_platform_data = {
-       .name = "TMU0",
        .channel_offset = 0x02,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
        .clockevent_rating = 200,
 };
 
 static struct resource tmu0_resources[] = {
        [0] = {
-               .name   = "TMU0",
                .start  = 0xa412fe94,
                .end    = 0xa412fe9f,
                .flags  = IORESOURCE_MEM,
@@ -313,16 +295,13 @@ static struct platform_device tmu0_device = {
 };
 
 static struct sh_timer_config tmu1_platform_data = {
-       .name = "TMU1",
        .channel_offset = 0xe,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
        .clocksource_rating = 200,
 };
 
 static struct resource tmu1_resources[] = {
        [0] = {
-               .name   = "TMU1",
                .start  = 0xa412fea0,
                .end    = 0xa412feab,
                .flags  = IORESOURCE_MEM,
@@ -344,15 +323,12 @@ static struct platform_device tmu1_device = {
 };
 
 static struct sh_timer_config tmu2_platform_data = {
-       .name = "TMU2",
        .channel_offset = 0x1a,
        .timer_bit = 2,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu2_resources[] = {
        [0] = {
-               .name   = "TMU2",
                .start  = 0xa412feac,
                .end    = 0xa412feb5,
                .flags  = IORESOURCE_MEM,
index 822977a..d180f16 100644 (file)
@@ -15,7 +15,7 @@
 #include <asm/processor.h>
 #include <asm/cache.h>
 
-int __init detect_cpu_and_cache_system(void)
+void __cpuinit cpu_probe(void)
 {
        unsigned long pvr, prr, cvr;
        unsigned long size;
@@ -251,6 +251,4 @@ int __init detect_cpu_and_cache_system(void)
                                 boot_cpu_data.scache.linesz);
                }
        }
-
-       return 0;
 }
index b9b7e10..e916b18 100644 (file)
@@ -31,16 +31,13 @@ static struct platform_device scif0_device = {
 };
 
 static struct sh_timer_config tmu0_platform_data = {
-       .name = "TMU0",
        .channel_offset = 0x04,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
        .clockevent_rating = 200,
 };
 
 static struct resource tmu0_resources[] = {
        [0] = {
-               .name   = "TMU0",
                .start  = 0xffd80008,
                .end    = 0xffd80013,
                .flags  = IORESOURCE_MEM,
@@ -62,16 +59,13 @@ static struct platform_device tmu0_device = {
 };
 
 static struct sh_timer_config tmu1_platform_data = {
-       .name = "TMU1",
        .channel_offset = 0x10,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
        .clocksource_rating = 200,
 };
 
 static struct resource tmu1_resources[] = {
        [0] = {
-               .name   = "TMU1",
                .start  = 0xffd80014,
                .end    = 0xffd8001f,
                .flags  = IORESOURCE_MEM,
@@ -93,15 +87,12 @@ static struct platform_device tmu1_device = {
 };
 
 static struct sh_timer_config tmu2_platform_data = {
-       .name = "TMU2",
        .channel_offset = 0x1c,
        .timer_bit = 2,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu2_resources[] = {
        [0] = {
-               .name   = "TMU2",
                .start  = 0xffd80020,
                .end    = 0xffd8002f,
                .flags  = IORESOURCE_MEM,
index ffd79e5..911d196 100644 (file)
@@ -66,16 +66,13 @@ static struct platform_device scif1_device = {
 };
 
 static struct sh_timer_config tmu0_platform_data = {
-       .name = "TMU0",
        .channel_offset = 0x04,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
        .clockevent_rating = 200,
 };
 
 static struct resource tmu0_resources[] = {
        [0] = {
-               .name   = "TMU0",
                .start  = 0xffd80008,
                .end    = 0xffd80013,
                .flags  = IORESOURCE_MEM,
@@ -97,16 +94,13 @@ static struct platform_device tmu0_device = {
 };
 
 static struct sh_timer_config tmu1_platform_data = {
-       .name = "TMU1",
        .channel_offset = 0x10,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
        .clocksource_rating = 200,
 };
 
 static struct resource tmu1_resources[] = {
        [0] = {
-               .name   = "TMU1",
                .start  = 0xffd80014,
                .end    = 0xffd8001f,
                .flags  = IORESOURCE_MEM,
@@ -128,15 +122,12 @@ static struct platform_device tmu1_device = {
 };
 
 static struct sh_timer_config tmu2_platform_data = {
-       .name = "TMU2",
        .channel_offset = 0x1c,
        .timer_bit = 2,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu2_resources[] = {
        [0] = {
-               .name   = "TMU2",
                .start  = 0xffd80020,
                .end    = 0xffd8002f,
                .flags  = IORESOURCE_MEM,
@@ -163,15 +154,12 @@ static struct platform_device tmu2_device = {
        defined(CONFIG_CPU_SUBTYPE_SH7751R)
 
 static struct sh_timer_config tmu3_platform_data = {
-       .name = "TMU3",
        .channel_offset = 0x04,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu3_resources[] = {
        [0] = {
-               .name   = "TMU3",
                .start  = 0xfe100008,
                .end    = 0xfe100013,
                .flags  = IORESOURCE_MEM,
@@ -193,15 +181,12 @@ static struct platform_device tmu3_device = {
 };
 
 static struct sh_timer_config tmu4_platform_data = {
-       .name = "TMU4",
        .channel_offset = 0x10,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu4_resources[] = {
        [0] = {
-               .name   = "TMU4",
                .start  = 0xfe100014,
                .end    = 0xfe10001f,
                .flags  = IORESOURCE_MEM,
index a16eb36..48ea8fe 100644 (file)
@@ -187,16 +187,13 @@ static struct platform_device scif3_device = {
 };
 
 static struct sh_timer_config tmu0_platform_data = {
-       .name = "TMU0",
        .channel_offset = 0x04,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
        .clockevent_rating = 200,
 };
 
 static struct resource tmu0_resources[] = {
        [0] = {
-               .name   = "TMU0",
                .start  = 0xffd80008,
                .end    = 0xffd80013,
                .flags  = IORESOURCE_MEM,
@@ -218,16 +215,13 @@ static struct platform_device tmu0_device = {
 };
 
 static struct sh_timer_config tmu1_platform_data = {
-       .name = "TMU1",
        .channel_offset = 0x10,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
        .clocksource_rating = 200,
 };
 
 static struct resource tmu1_resources[] = {
        [0] = {
-               .name   = "TMU1",
                .start  = 0xffd80014,
                .end    = 0xffd8001f,
                .flags  = IORESOURCE_MEM,
@@ -249,15 +243,12 @@ static struct platform_device tmu1_device = {
 };
 
 static struct sh_timer_config tmu2_platform_data = {
-       .name = "TMU2",
        .channel_offset = 0x1c,
        .timer_bit = 2,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu2_resources[] = {
        [0] = {
-               .name   = "TMU2",
                .start  = 0xffd80020,
                .end    = 0xffd8002f,
                .flags  = IORESOURCE_MEM,
index 2c16df3..a63cdca 100644 (file)
@@ -154,15 +154,15 @@ static struct clk mstp_clks[] = {
        MSTP("sh0", &div4_clks[DIV4_P], MSTPCR0, 20, 0),
        MSTP("hudi0", &div4_clks[DIV4_P], MSTPCR0, 19, 0),
        MSTP("ubc0", &div4_clks[DIV4_P], MSTPCR0, 17, 0),
-       MSTP("tmu0", &div4_clks[DIV4_P], MSTPCR0, 15, 0),
-       MSTP("cmt0", &r_clk, MSTPCR0, 14, 0),
+       MSTP("tmu_fck", &div4_clks[DIV4_P], MSTPCR0, 15, 0),
+       MSTP("cmt_fck", &r_clk, MSTPCR0, 14, 0),
        MSTP("rwdt0", &r_clk, MSTPCR0, 13, 0),
        MSTP("mfi0", &div4_clks[DIV4_P], MSTPCR0, 11, 0),
        MSTP("flctl0", &div4_clks[DIV4_P], MSTPCR0, 10, 0),
-       MSTP("scif0", &div4_clks[DIV4_P], MSTPCR0, 7, 0),
-       MSTP("scif1", &div4_clks[DIV4_P], MSTPCR0, 6, 0),
-       MSTP("scif2", &div4_clks[DIV4_P], MSTPCR0, 5, 0),
-       MSTP("scif3", &div4_clks[DIV4_P], MSTPCR0, 4, 0),
+       SH_CLK_MSTP32("sci_fck", 0, &div4_clks[DIV4_P], MSTPCR0, 7, 0),
+       SH_CLK_MSTP32("sci_fck", 1, &div4_clks[DIV4_P], MSTPCR0, 6, 0),
+       SH_CLK_MSTP32("sci_fck", 2, &div4_clks[DIV4_P], MSTPCR0, 5, 0),
+       SH_CLK_MSTP32("sci_fck", 3, &div4_clks[DIV4_P], MSTPCR0, 4, 0),
        MSTP("sio0", &div4_clks[DIV4_P], MSTPCR0, 3, 0),
        MSTP("siof0", &div4_clks[DIV4_P], MSTPCR0, 2, 0),
        MSTP("siof1", &div4_clks[DIV4_P], MSTPCR0, 1, 0),
index 91588d2..f99db94 100644 (file)
@@ -158,14 +158,14 @@ static struct clk mstp_clks[] = {
        MSTP("sh0", &div4_clks[DIV4_P], MSTPCR0, 20, 0),
        MSTP("hudi0", &div4_clks[DIV4_P], MSTPCR0, 19, 0),
        MSTP("ubc0", &div4_clks[DIV4_P], MSTPCR0, 17, 0),
-       MSTP("tmu0", &div4_clks[DIV4_P], MSTPCR0, 15, 0),
-       MSTP("cmt0", &r_clk, MSTPCR0, 14, 0),
+       MSTP("tmu_fck", &div4_clks[DIV4_P], MSTPCR0, 15, 0),
+       MSTP("cmt_fck", &r_clk, MSTPCR0, 14, 0),
        MSTP("rwdt0", &r_clk, MSTPCR0, 13, 0),
        MSTP("mfi0", &div4_clks[DIV4_P], MSTPCR0, 11, 0),
        MSTP("flctl0", &div4_clks[DIV4_P], MSTPCR0, 10, 0),
-       MSTP("scif0", &div4_clks[DIV4_P], MSTPCR0, 7, 0),
-       MSTP("scif1", &div4_clks[DIV4_P], MSTPCR0, 6, 0),
-       MSTP("scif2", &div4_clks[DIV4_P], MSTPCR0, 5, 0),
+       SH_CLK_MSTP32("sci_fck", 0, &div4_clks[DIV4_P], MSTPCR0, 7, 0),
+       SH_CLK_MSTP32("sci_fck", 1, &div4_clks[DIV4_P], MSTPCR0, 6, 0),
+       SH_CLK_MSTP32("sci_fck", 2, &div4_clks[DIV4_P], MSTPCR0, 5, 0),
        MSTP("msiof0", &div4_clks[DIV4_P], MSTPCR0, 2, 0),
        MSTP("sbr0", &div4_clks[DIV4_P], MSTPCR0, 1, 0),
 
index 15db6d5..107b200 100644 (file)
@@ -160,13 +160,13 @@ struct clk div6_clks[] = {
 static struct clk mstp_clks[] = {
        SH_HWBLK_CLK("uram0", -1, U_CLK, HWBLK_URAM, CLK_ENABLE_ON_INIT),
        SH_HWBLK_CLK("xymem0", -1, B_CLK, HWBLK_XYMEM, CLK_ENABLE_ON_INIT),
-       SH_HWBLK_CLK("tmu0", -1, P_CLK, HWBLK_TMU, 0),
-       SH_HWBLK_CLK("cmt0", -1, R_CLK, HWBLK_CMT, 0),
+       SH_HWBLK_CLK("tmu_fck", -1, P_CLK, HWBLK_TMU, 0),
+       SH_HWBLK_CLK("cmt_fck", -1, R_CLK, HWBLK_CMT, 0),
        SH_HWBLK_CLK("rwdt0", -1, R_CLK, HWBLK_RWDT, 0),
        SH_HWBLK_CLK("flctl0", -1, P_CLK, HWBLK_FLCTL, 0),
-       SH_HWBLK_CLK("scif0", -1, P_CLK, HWBLK_SCIF0, 0),
-       SH_HWBLK_CLK("scif1", -1, P_CLK, HWBLK_SCIF1, 0),
-       SH_HWBLK_CLK("scif2", -1, P_CLK, HWBLK_SCIF2, 0),
+       SH_HWBLK_CLK("sci_fck", 0, P_CLK, HWBLK_SCIF0, 0),
+       SH_HWBLK_CLK("sci_fck", 1, P_CLK, HWBLK_SCIF1, 0),
+       SH_HWBLK_CLK("sci_fck", 2, P_CLK, HWBLK_SCIF2, 0),
 
        SH_HWBLK_CLK("i2c0", -1, P_CLK, HWBLK_IIC, 0),
        SH_HWBLK_CLK("rtc0", -1, R_CLK, HWBLK_RTC, 0),
index 50babe0..fc86c88 100644 (file)
@@ -21,6 +21,8 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/io.h>
+#include <linux/clk.h>
+#include <asm/clkdev.h>
 #include <asm/clock.h>
 #include <asm/hwblk.h>
 #include <cpu/sh7723.h>
@@ -171,18 +173,18 @@ static struct clk mstp_clks[] = {
        SH_HWBLK_CLK("sh0", -1, SH_CLK, HWBLK_SHYWAY, CLK_ENABLE_ON_INIT),
        SH_HWBLK_CLK("hudi0", -1, P_CLK, HWBLK_HUDI, 0),
        SH_HWBLK_CLK("ubc0", -1, I_CLK, HWBLK_UBC, 0),
-       SH_HWBLK_CLK("tmu0", -1, P_CLK, HWBLK_TMU0, 0),
-       SH_HWBLK_CLK("cmt0", -1, R_CLK, HWBLK_CMT, 0),
+       SH_HWBLK_CLK("tmu012_fck", -1, P_CLK, HWBLK_TMU0, 0),
+       SH_HWBLK_CLK("cmt_fck", -1, R_CLK, HWBLK_CMT, 0),
        SH_HWBLK_CLK("rwdt0", -1, R_CLK, HWBLK_RWDT, 0),
        SH_HWBLK_CLK("dmac1", -1, B_CLK, HWBLK_DMAC1, 0),
-       SH_HWBLK_CLK("tmu1", -1, P_CLK, HWBLK_TMU1, 0),
+       SH_HWBLK_CLK("tmu345_fck", -1, P_CLK, HWBLK_TMU1, 0),
        SH_HWBLK_CLK("flctl0", -1, P_CLK, HWBLK_FLCTL, 0),
-       SH_HWBLK_CLK("scif0", -1, P_CLK, HWBLK_SCIF0, 0),
-       SH_HWBLK_CLK("scif1", -1, P_CLK, HWBLK_SCIF1, 0),
-       SH_HWBLK_CLK("scif2", -1, P_CLK, HWBLK_SCIF2, 0),
-       SH_HWBLK_CLK("scif3", -1, B_CLK, HWBLK_SCIF3, 0),
-       SH_HWBLK_CLK("scif4", -1, B_CLK, HWBLK_SCIF4, 0),
-       SH_HWBLK_CLK("scif5", -1, B_CLK, HWBLK_SCIF5, 0),
+       SH_HWBLK_CLK("sci_fck", 0, P_CLK, HWBLK_SCIF0, 0),
+       SH_HWBLK_CLK("sci_fck", 1, P_CLK, HWBLK_SCIF1, 0),
+       SH_HWBLK_CLK("sci_fck", 2, P_CLK, HWBLK_SCIF2, 0),
+       SH_HWBLK_CLK("sci_fck", 3, B_CLK, HWBLK_SCIF3, 0),
+       SH_HWBLK_CLK("sci_fck", 4, B_CLK, HWBLK_SCIF4, 0),
+       SH_HWBLK_CLK("sci_fck", 5, B_CLK, HWBLK_SCIF5, 0),
        SH_HWBLK_CLK("msiof0", -1, B_CLK, HWBLK_MSIOF0, 0),
        SH_HWBLK_CLK("msiof1", -1, B_CLK, HWBLK_MSIOF1, 0),
        SH_HWBLK_CLK("meram0", -1, SH_CLK, HWBLK_MERAM, 0),
@@ -211,6 +213,40 @@ static struct clk mstp_clks[] = {
        SH_HWBLK_CLK("lcdc0", -1, B_CLK, HWBLK_LCDC, 0),
 };
 
+static struct clk_lookup lookups[] = {
+       {
+               /* TMU0 */
+               .dev_id         = "sh_tmu.0",
+               .con_id         = "tmu_fck",
+               .clk            = &mstp_clks[11],       /* tmu012_fck */
+       }, {
+               /* TMU1 */
+               .dev_id         = "sh_tmu.1",
+               .con_id         = "tmu_fck",
+               .clk            = &mstp_clks[11],
+       }, {
+               /* TMU2 */
+               .dev_id         = "sh_tmu.2",
+               .con_id         = "tmu_fck",
+               .clk            = &mstp_clks[11],
+       }, {
+               /* TMU3 */
+               .dev_id         = "sh_tmu.3",
+               .con_id         = "tmu_fck",
+               .clk            = &mstp_clks[15],       /* tmu345_fck */
+       }, {
+               /* TMU4 */
+               .dev_id         = "sh_tmu.4",
+               .con_id         = "tmu_fck",
+               .clk            = &mstp_clks[15],
+       }, {
+               /* TMU5 */
+               .dev_id         = "sh_tmu.5",
+               .con_id         = "tmu_fck",
+               .clk            = &mstp_clks[15],
+       },
+};
+
 int __init arch_clk_init(void)
 {
        int k, ret = 0;
@@ -222,7 +258,9 @@ int __init arch_clk_init(void)
                pll_clk.parent = &extal_clk;
 
        for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
-               ret = clk_register(main_clks[k]);
+               ret |= clk_register(main_clks[k]);
+
+       clkdev_add_table(lookups, ARRAY_SIZE(lookups));
 
        if (!ret)
                ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table);
index 6707061..f1583a2 100644 (file)
@@ -21,6 +21,8 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/io.h>
+#include <linux/clk.h>
+#include <asm/clkdev.h>
 #include <asm/clock.h>
 #include <asm/hwblk.h>
 #include <cpu/sh7724.h>
@@ -189,17 +191,17 @@ static struct clk mstp_clks[] = {
        SH_HWBLK_CLK("sh0", -1, SH_CLK, HWBLK_SHYWAY, CLK_ENABLE_ON_INIT),
        SH_HWBLK_CLK("hudi0", -1, P_CLK, HWBLK_HUDI, 0),
        SH_HWBLK_CLK("ubc0", -1, I_CLK, HWBLK_UBC, 0),
-       SH_HWBLK_CLK("tmu0", -1, P_CLK, HWBLK_TMU0, 0),
-       SH_HWBLK_CLK("cmt0", -1, R_CLK, HWBLK_CMT, 0),
+       SH_HWBLK_CLK("tmu012_fck", -1, P_CLK, HWBLK_TMU0, 0),
+       SH_HWBLK_CLK("cmt_fck", -1, R_CLK, HWBLK_CMT, 0),
        SH_HWBLK_CLK("rwdt0", -1, R_CLK, HWBLK_RWDT, 0),
        SH_HWBLK_CLK("dmac1", -1, B_CLK, HWBLK_DMAC1, 0),
-       SH_HWBLK_CLK("tmu1", -1, P_CLK, HWBLK_TMU1, 0),
-       SH_HWBLK_CLK("scif0", -1, P_CLK, HWBLK_SCIF0, 0),
-       SH_HWBLK_CLK("scif1", -1, P_CLK, HWBLK_SCIF1, 0),
-       SH_HWBLK_CLK("scif2", -1, P_CLK, HWBLK_SCIF2, 0),
-       SH_HWBLK_CLK("scif3", -1, B_CLK, HWBLK_SCIF3, 0),
-       SH_HWBLK_CLK("scif4", -1, B_CLK, HWBLK_SCIF4, 0),
-       SH_HWBLK_CLK("scif5", -1, B_CLK, HWBLK_SCIF5, 0),
+       SH_HWBLK_CLK("tmu345_fck", -1, P_CLK, HWBLK_TMU1, 0),
+       SH_HWBLK_CLK("sci_fck", 0, P_CLK, HWBLK_SCIF0, 0),
+       SH_HWBLK_CLK("sci_fck", 1, P_CLK, HWBLK_SCIF1, 0),
+       SH_HWBLK_CLK("sci_fck", 2, P_CLK, HWBLK_SCIF2, 0),
+       SH_HWBLK_CLK("sci_fck", 3, B_CLK, HWBLK_SCIF3, 0),
+       SH_HWBLK_CLK("sci_fck", 4, B_CLK, HWBLK_SCIF4, 0),
+       SH_HWBLK_CLK("sci_fck", 5, B_CLK, HWBLK_SCIF5, 0),
        SH_HWBLK_CLK("msiof0", -1, B_CLK, HWBLK_MSIOF0, 0),
        SH_HWBLK_CLK("msiof1", -1, B_CLK, HWBLK_MSIOF1, 0),
 
@@ -233,6 +235,40 @@ static struct clk mstp_clks[] = {
        SH_HWBLK_CLK("lcdc0", -1, B_CLK, HWBLK_LCDC, 0),
 };
 
+static struct clk_lookup lookups[] = {
+       {
+               /* TMU0 */
+               .dev_id         = "sh_tmu.0",
+               .con_id         = "tmu_fck",
+               .clk            = &mstp_clks[12],       /* tmu012_fck */
+       }, {
+               /* TMU1 */
+               .dev_id         = "sh_tmu.1",
+               .con_id         = "tmu_fck",
+               .clk            = &mstp_clks[12],
+       }, {
+               /* TMU2 */
+               .dev_id         = "sh_tmu.2",
+               .con_id         = "tmu_fck",
+               .clk            = &mstp_clks[12],
+       }, {
+               /* TMU3 */
+               .dev_id         = "sh_tmu.3",
+               .con_id         = "tmu_fck",
+               .clk            = &mstp_clks[16],       /* tmu345_fck */
+       }, {
+               /* TMU4 */
+               .dev_id         = "sh_tmu.4",
+               .con_id         = "tmu_fck",
+               .clk            = &mstp_clks[16],
+       }, {
+               /* TMU5 */
+               .dev_id         = "sh_tmu.5",
+               .con_id         = "tmu_fck",
+               .clk            = &mstp_clks[16],
+       },
+};
+
 int __init arch_clk_init(void)
 {
        int k, ret = 0;
@@ -246,6 +282,8 @@ int __init arch_clk_init(void)
        for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
                ret = clk_register(main_clks[k]);
 
+       clkdev_add_table(lookups, ARRAY_SIZE(lookups));
+
        if (!ret)
                ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table);
 
index d997f0a..28de049 100644 (file)
@@ -3,7 +3,7 @@
  *
  * SH7785 support for the clock framework
  *
- *  Copyright (C) 2007 - 2009  Paul Mundt
+ *  Copyright (C) 2007 - 2010  Paul Mundt
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
@@ -14,6 +14,7 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/cpufreq.h>
+#include <asm/clkdev.h>
 #include <asm/clock.h>
 #include <asm/freq.h>
 #include <cpu/sh7785.h>
@@ -88,12 +89,12 @@ struct clk div4_clks[DIV4_NR] = {
 
 static struct clk mstp_clks[] = {
        /* MSTPCR0 */
-       SH_CLK_MSTP32("scif_fck", 5, &div4_clks[DIV4_P], MSTPCR0, 29, 0),
-       SH_CLK_MSTP32("scif_fck", 4, &div4_clks[DIV4_P], MSTPCR0, 28, 0),
-       SH_CLK_MSTP32("scif_fck", 3, &div4_clks[DIV4_P], MSTPCR0, 27, 0),
-       SH_CLK_MSTP32("scif_fck", 2, &div4_clks[DIV4_P], MSTPCR0, 26, 0),
-       SH_CLK_MSTP32("scif_fck", 1, &div4_clks[DIV4_P], MSTPCR0, 25, 0),
-       SH_CLK_MSTP32("scif_fck", 0, &div4_clks[DIV4_P], MSTPCR0, 24, 0),
+       SH_CLK_MSTP32("sci_fck", 5, &div4_clks[DIV4_P], MSTPCR0, 29, 0),
+       SH_CLK_MSTP32("sci_fck", 4, &div4_clks[DIV4_P], MSTPCR0, 28, 0),
+       SH_CLK_MSTP32("sci_fck", 3, &div4_clks[DIV4_P], MSTPCR0, 27, 0),
+       SH_CLK_MSTP32("sci_fck", 2, &div4_clks[DIV4_P], MSTPCR0, 26, 0),
+       SH_CLK_MSTP32("sci_fck", 1, &div4_clks[DIV4_P], MSTPCR0, 25, 0),
+       SH_CLK_MSTP32("sci_fck", 0, &div4_clks[DIV4_P], MSTPCR0, 24, 0),
        SH_CLK_MSTP32("ssi_fck", 1, &div4_clks[DIV4_P], MSTPCR0, 21, 0),
        SH_CLK_MSTP32("ssi_fck", 0, &div4_clks[DIV4_P], MSTPCR0, 20, 0),
        SH_CLK_MSTP32("hac_fck", 1, &div4_clks[DIV4_P], MSTPCR0, 17, 0),
@@ -113,12 +114,48 @@ static struct clk mstp_clks[] = {
        SH_CLK_MSTP32("gdta_fck", -1, NULL, MSTPCR1, 0, 0),
 };
 
+static struct clk_lookup lookups[] = {
+       {
+               /* TMU0 */
+               .dev_id         = "sh_tmu.0",
+               .con_id         = "tmu_fck",
+               .clk            = &mstp_clks[13],       /* tmu012_fck */
+       }, {
+               /* TMU1 */
+               .dev_id         = "sh_tmu.1",
+               .con_id         = "tmu_fck",
+               .clk            = &mstp_clks[13],
+       }, {
+               /* TMU2 */
+               .dev_id         = "sh_tmu.2",
+               .con_id         = "tmu_fck",
+               .clk            = &mstp_clks[13],
+       }, {
+               /* TMU3 */
+               .dev_id         = "sh_tmu.3",
+               .con_id         = "tmu_fck",
+               .clk            = &mstp_clks[12],       /* tmu345_fck */
+       }, {
+               /* TMU4 */
+               .dev_id         = "sh_tmu.4",
+               .con_id         = "tmu_fck",
+               .clk            = &mstp_clks[12],
+       }, {
+               /* TMU5 */
+               .dev_id         = "sh_tmu.5",
+               .con_id         = "tmu_fck",
+               .clk            = &mstp_clks[12],
+       },
+};
+
 int __init arch_clk_init(void)
 {
        int i, ret = 0;
 
        for (i = 0; i < ARRAY_SIZE(clks); i++)
                ret |= clk_register(clks[i]);
+       for (i = 0; i < ARRAY_SIZE(lookups); i++)
+               clkdev_add(&lookups[i]);
 
        if (!ret)
                ret = sh_clk_div4_register(div4_clks, ARRAY_SIZE(div4_clks),
index af69fd4..c4a84bb 100644 (file)
@@ -13,6 +13,8 @@
 #include <linux/kernel.h>
 #include <linux/clk.h>
 #include <linux/io.h>
+#include <linux/clk.h>
+#include <asm/clkdev.h>
 #include <asm/clock.h>
 #include <asm/freq.h>
 
@@ -87,12 +89,12 @@ struct clk div4_clks[DIV4_NR] = {
 
 static struct clk mstp_clks[] = {
        /* MSTPCR0 */
-       SH_CLK_MSTP32("scif_fck", 5, &div4_clks[DIV4_P], MSTPCR0, 29, 0),
-       SH_CLK_MSTP32("scif_fck", 4, &div4_clks[DIV4_P], MSTPCR0, 28, 0),
-       SH_CLK_MSTP32("scif_fck", 3, &div4_clks[DIV4_P], MSTPCR0, 27, 0),
-       SH_CLK_MSTP32("scif_fck", 2, &div4_clks[DIV4_P], MSTPCR0, 26, 0),
-       SH_CLK_MSTP32("scif_fck", 1, &div4_clks[DIV4_P], MSTPCR0, 25, 0),
-       SH_CLK_MSTP32("scif_fck", 0, &div4_clks[DIV4_P], MSTPCR0, 24, 0),
+       SH_CLK_MSTP32("sci_fck", 5, &div4_clks[DIV4_P], MSTPCR0, 29, 0),
+       SH_CLK_MSTP32("sci_fck", 4, &div4_clks[DIV4_P], MSTPCR0, 28, 0),
+       SH_CLK_MSTP32("sci_fck", 3, &div4_clks[DIV4_P], MSTPCR0, 27, 0),
+       SH_CLK_MSTP32("sci_fck", 2, &div4_clks[DIV4_P], MSTPCR0, 26, 0),
+       SH_CLK_MSTP32("sci_fck", 1, &div4_clks[DIV4_P], MSTPCR0, 25, 0),
+       SH_CLK_MSTP32("sci_fck", 0, &div4_clks[DIV4_P], MSTPCR0, 24, 0),
        SH_CLK_MSTP32("ssi_fck", 3, &div4_clks[DIV4_P], MSTPCR0, 23, 0),
        SH_CLK_MSTP32("ssi_fck", 2, &div4_clks[DIV4_P], MSTPCR0, 22, 0),
        SH_CLK_MSTP32("ssi_fck", 1, &div4_clks[DIV4_P], MSTPCR0, 21, 0),
@@ -120,12 +122,78 @@ static struct clk mstp_clks[] = {
        SH_CLK_MSTP32("ether_fck", -1, NULL, MSTPCR1, 2, 0),
 };
 
+static struct clk_lookup lookups[] = {
+       {
+               /* TMU0 */
+               .dev_id         = "sh_tmu.0",
+               .con_id         = "tmu_fck",
+               .clk            = &mstp_clks[17],       /* tmu012_fck */
+       }, {
+               /* TMU1 */
+               .dev_id         = "sh_tmu.1",
+               .con_id         = "tmu_fck",
+               .clk            = &mstp_clks[17],
+       }, {
+               /* TMU2 */
+               .dev_id         = "sh_tmu.2",
+               .con_id         = "tmu_fck",
+               .clk            = &mstp_clks[17],
+       }, {
+               /* TMU3 */
+               .dev_id         = "sh_tmu.3",
+               .con_id         = "tmu_fck",
+               .clk            = &mstp_clks[16],       /* tmu345_fck */
+       }, {
+               /* TMU4 */
+               .dev_id         = "sh_tmu.4",
+               .con_id         = "tmu_fck",
+               .clk            = &mstp_clks[16],
+       }, {
+               /* TMU5 */
+               .dev_id         = "sh_tmu.5",
+               .con_id         = "tmu_fck",
+               .clk            = &mstp_clks[16],
+       }, {
+               /* TMU6 */
+               .dev_id         = "sh_tmu.6",
+               .con_id         = "tmu_fck",
+               .clk            = &mstp_clks[15],       /* tmu678_fck */
+       }, {
+               /* TMU7 */
+               .dev_id         = "sh_tmu.7",
+               .con_id         = "tmu_fck",
+               .clk            = &mstp_clks[15],
+       }, {
+               /* TMU8 */
+               .dev_id         = "sh_tmu.8",
+               .con_id         = "tmu_fck",
+               .clk            = &mstp_clks[15],
+       }, {
+               /* TMU9 */
+               .dev_id         = "sh_tmu.9",
+               .con_id         = "tmu_fck",
+               .clk            = &mstp_clks[14],       /* tmu9_11_fck */
+       }, {
+               /* TMU10 */
+               .dev_id         = "sh_tmu.10",
+               .con_id         = "tmu_fck",
+               .clk            = &mstp_clks[14],
+       }, {
+               /* TMU11 */
+               .dev_id         = "sh_tmu.11",
+               .con_id         = "tmu_fck",
+               .clk            = &mstp_clks[14],
+       }
+};
+
 int __init arch_clk_init(void)
 {
        int i, ret = 0;
 
        for (i = 0; i < ARRAY_SIZE(clks); i++)
                ret |= clk_register(clks[i]);
+       for (i = 0; i < ARRAY_SIZE(lookups); i++)
+               clkdev_add(&lookups[i]);
 
        if (!ret)
                ret = sh_clk_div4_register(div4_clks, ARRAY_SIZE(div4_clks),
index 45eb1bf..3681caf 100644 (file)
@@ -21,7 +21,6 @@ static struct plat_sci_port scif0_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 80, 80, 80, 80 },
-       .clk            = "scif0",
 };
 
 static struct platform_device scif0_device = {
@@ -37,7 +36,6 @@ static struct plat_sci_port scif1_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 81, 81, 81, 81 },
-       .clk            = "scif1",
 };
 
 static struct platform_device scif1_device = {
@@ -53,7 +51,6 @@ static struct plat_sci_port scif2_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 82, 82, 82, 82 },
-       .clk            = "scif2",
 };
 
 static struct platform_device scif2_device = {
@@ -69,7 +66,6 @@ static struct plat_sci_port scif3_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 83, 83, 83, 83 },
-       .clk            = "scif3",
 };
 
 static struct platform_device scif3_device = {
@@ -207,17 +203,14 @@ static struct platform_device jpu_device = {
 };
 
 static struct sh_timer_config cmt_platform_data = {
-       .name = "CMT",
        .channel_offset = 0x60,
        .timer_bit = 5,
-       .clk = "cmt0",
        .clockevent_rating = 125,
        .clocksource_rating = 200,
 };
 
 static struct resource cmt_resources[] = {
        [0] = {
-               .name   = "CMT",
                .start  = 0x044a0060,
                .end    = 0x044a006b,
                .flags  = IORESOURCE_MEM,
@@ -239,16 +232,13 @@ static struct platform_device cmt_device = {
 };
 
 static struct sh_timer_config tmu0_platform_data = {
-       .name = "TMU0",
        .channel_offset = 0x04,
        .timer_bit = 0,
-       .clk = "tmu0",
        .clockevent_rating = 200,
 };
 
 static struct resource tmu0_resources[] = {
        [0] = {
-               .name   = "TMU0",
                .start  = 0xffd80008,
                .end    = 0xffd80013,
                .flags  = IORESOURCE_MEM,
@@ -270,16 +260,13 @@ static struct platform_device tmu0_device = {
 };
 
 static struct sh_timer_config tmu1_platform_data = {
-       .name = "TMU1",
        .channel_offset = 0x10,
        .timer_bit = 1,
-       .clk = "tmu0",
        .clocksource_rating = 200,
 };
 
 static struct resource tmu1_resources[] = {
        [0] = {
-               .name   = "TMU1",
                .start  = 0xffd80014,
                .end    = 0xffd8001f,
                .flags  = IORESOURCE_MEM,
@@ -301,15 +288,12 @@ static struct platform_device tmu1_device = {
 };
 
 static struct sh_timer_config tmu2_platform_data = {
-       .name = "TMU2",
        .channel_offset = 0x1c,
        .timer_bit = 2,
-       .clk = "tmu0",
 };
 
 static struct resource tmu2_resources[] = {
        [0] = {
-               .name   = "TMU2",
                .start  = 0xffd80020,
                .end    = 0xffd8002b,
                .flags  = IORESOURCE_MEM,
index c494c19..8dab9e1 100644 (file)
@@ -23,7 +23,6 @@ static struct plat_sci_port scif0_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 80, 80, 80, 80 },
-       .clk            = "scif0",
 };
 
 static struct platform_device scif0_device = {
@@ -169,17 +168,14 @@ static struct platform_device veu1_device = {
 };
 
 static struct sh_timer_config cmt_platform_data = {
-       .name = "CMT",
        .channel_offset = 0x60,
        .timer_bit = 5,
-       .clk = "cmt0",
        .clockevent_rating = 125,
        .clocksource_rating = 200,
 };
 
 static struct resource cmt_resources[] = {
        [0] = {
-               .name   = "CMT",
                .start  = 0x044a0060,
                .end    = 0x044a006b,
                .flags  = IORESOURCE_MEM,
@@ -201,16 +197,13 @@ static struct platform_device cmt_device = {
 };
 
 static struct sh_timer_config tmu0_platform_data = {
-       .name = "TMU0",
        .channel_offset = 0x04,
        .timer_bit = 0,
-       .clk = "tmu0",
        .clockevent_rating = 200,
 };
 
 static struct resource tmu0_resources[] = {
        [0] = {
-               .name   = "TMU0",
                .start  = 0xffd80008,
                .end    = 0xffd80013,
                .flags  = IORESOURCE_MEM,
@@ -232,16 +225,13 @@ static struct platform_device tmu0_device = {
 };
 
 static struct sh_timer_config tmu1_platform_data = {
-       .name = "TMU1",
        .channel_offset = 0x10,
        .timer_bit = 1,
-       .clk = "tmu0",
        .clocksource_rating = 200,
 };
 
 static struct resource tmu1_resources[] = {
        [0] = {
-               .name   = "TMU1",
                .start  = 0xffd80014,
                .end    = 0xffd8001f,
                .flags  = IORESOURCE_MEM,
@@ -263,15 +253,12 @@ static struct platform_device tmu1_device = {
 };
 
 static struct sh_timer_config tmu2_platform_data = {
-       .name = "TMU2",
        .channel_offset = 0x1c,
        .timer_bit = 2,
-       .clk = "tmu0",
 };
 
 static struct resource tmu2_resources[] = {
        [0] = {
-               .name   = "TMU2",
                .start  = 0xffd80020,
                .end    = 0xffd8002b,
                .flags  = IORESOURCE_MEM,
index fd7e363..24c6167 100644 (file)
@@ -24,7 +24,7 @@
 #include <cpu/dma-register.h>
 #include <cpu/sh7722.h>
 
-static struct sh_dmae_slave_config sh7722_dmae_slaves[] = {
+static const struct sh_dmae_slave_config sh7722_dmae_slaves[] = {
        {
                .slave_id       = SHDMA_SLAVE_SCIF0_TX,
                .addr           = 0xffe0000c,
@@ -78,7 +78,7 @@ static struct sh_dmae_slave_config sh7722_dmae_slaves[] = {
        },
 };
 
-static struct sh_dmae_channel sh7722_dmae_channels[] = {
+static const struct sh_dmae_channel sh7722_dmae_channels[] = {
        {
                .offset = 0,
                .dmars = 0,
@@ -106,7 +106,7 @@ static struct sh_dmae_channel sh7722_dmae_channels[] = {
        }
 };
 
-static unsigned int ts_shift[] = TS_SHIFT;
+static const unsigned int ts_shift[] = TS_SHIFT;
 
 static struct sh_dmae_pdata dma_platform_data = {
        .slave          = sh7722_dmae_slaves,
@@ -174,7 +174,6 @@ static struct plat_sci_port scif0_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 80, 80, 80, 80 },
-       .clk            = "scif0",
 };
 
 static struct platform_device scif0_device = {
@@ -190,7 +189,6 @@ static struct plat_sci_port scif1_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 81, 81, 81, 81 },
-       .clk            = "scif1",
 };
 
 static struct platform_device scif1_device = {
@@ -206,7 +204,6 @@ static struct plat_sci_port scif2_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 82, 82, 82, 82 },
-       .clk            = "scif2",
 };
 
 static struct platform_device scif2_device = {
@@ -401,17 +398,14 @@ static struct platform_device jpu_device = {
 };
 
 static struct sh_timer_config cmt_platform_data = {
-       .name = "CMT",
        .channel_offset = 0x60,
        .timer_bit = 5,
-       .clk = "cmt0",
        .clockevent_rating = 125,
        .clocksource_rating = 125,
 };
 
 static struct resource cmt_resources[] = {
        [0] = {
-               .name   = "CMT",
                .start  = 0x044a0060,
                .end    = 0x044a006b,
                .flags  = IORESOURCE_MEM,
@@ -436,16 +430,13 @@ static struct platform_device cmt_device = {
 };
 
 static struct sh_timer_config tmu0_platform_data = {
-       .name = "TMU0",
        .channel_offset = 0x04,
        .timer_bit = 0,
-       .clk = "tmu0",
        .clockevent_rating = 200,
 };
 
 static struct resource tmu0_resources[] = {
        [0] = {
-               .name   = "TMU0",
                .start  = 0xffd80008,
                .end    = 0xffd80013,
                .flags  = IORESOURCE_MEM,
@@ -470,16 +461,13 @@ static struct platform_device tmu0_device = {
 };
 
 static struct sh_timer_config tmu1_platform_data = {
-       .name = "TMU1",
        .channel_offset = 0x10,
        .timer_bit = 1,
-       .clk = "tmu0",
        .clocksource_rating = 200,
 };
 
 static struct resource tmu1_resources[] = {
        [0] = {
-               .name   = "TMU1",
                .start  = 0xffd80014,
                .end    = 0xffd8001f,
                .flags  = IORESOURCE_MEM,
@@ -504,15 +492,12 @@ static struct platform_device tmu1_device = {
 };
 
 static struct sh_timer_config tmu2_platform_data = {
-       .name = "TMU2",
        .channel_offset = 0x1c,
        .timer_bit = 2,
-       .clk = "tmu0",
 };
 
 static struct resource tmu2_resources[] = {
        [0] = {
-               .name   = "TMU2",
                .start  = 0xffd80020,
                .end    = 0xffd8002b,
                .flags  = IORESOURCE_MEM,
index 85c61f6..0eadefd 100644 (file)
@@ -26,7 +26,6 @@ static struct plat_sci_port scif0_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 80, 80, 80, 80 },
-       .clk            = "scif0",
 };
 
 static struct platform_device scif0_device = {
@@ -42,7 +41,6 @@ static struct plat_sci_port scif1_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 81, 81, 81, 81 },
-       .clk            = "scif1",
 };
 
 static struct platform_device scif1_device = {
@@ -58,7 +56,6 @@ static struct plat_sci_port scif2_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 82, 82, 82, 82 },
-       .clk            = "scif2",
 };
 
 static struct platform_device scif2_device = {
@@ -74,7 +71,6 @@ static struct plat_sci_port scif3_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIFA,
        .irqs           = { 56, 56, 56, 56 },
-       .clk            = "scif3",
 };
 
 static struct platform_device scif3_device = {
@@ -90,7 +86,6 @@ static struct plat_sci_port scif4_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIFA,
        .irqs           = { 88, 88, 88, 88 },
-       .clk            = "scif4",
 };
 
 static struct platform_device scif4_device = {
@@ -106,7 +101,6 @@ static struct plat_sci_port scif5_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIFA,
        .irqs           = { 109, 109, 109, 109 },
-       .clk            = "scif5",
 };
 
 static struct platform_device scif5_device = {
@@ -211,17 +205,14 @@ static struct platform_device veu1_device = {
 };
 
 static struct sh_timer_config cmt_platform_data = {
-       .name = "CMT",
        .channel_offset = 0x60,
        .timer_bit = 5,
-       .clk = "cmt0",
        .clockevent_rating = 125,
        .clocksource_rating = 125,
 };
 
 static struct resource cmt_resources[] = {
        [0] = {
-               .name   = "CMT",
                .start  = 0x044a0060,
                .end    = 0x044a006b,
                .flags  = IORESOURCE_MEM,
@@ -246,16 +237,13 @@ static struct platform_device cmt_device = {
 };
 
 static struct sh_timer_config tmu0_platform_data = {
-       .name = "TMU0",
        .channel_offset = 0x04,
        .timer_bit = 0,
-       .clk = "tmu0",
        .clockevent_rating = 200,
 };
 
 static struct resource tmu0_resources[] = {
        [0] = {
-               .name   = "TMU0",
                .start  = 0xffd80008,
                .end    = 0xffd80013,
                .flags  = IORESOURCE_MEM,
@@ -280,16 +268,13 @@ static struct platform_device tmu0_device = {
 };
 
 static struct sh_timer_config tmu1_platform_data = {
-       .name = "TMU1",
        .channel_offset = 0x10,
        .timer_bit = 1,
-       .clk = "tmu0",
        .clocksource_rating = 200,
 };
 
 static struct resource tmu1_resources[] = {
        [0] = {
-               .name   = "TMU1",
                .start  = 0xffd80014,
                .end    = 0xffd8001f,
                .flags  = IORESOURCE_MEM,
@@ -314,15 +299,12 @@ static struct platform_device tmu1_device = {
 };
 
 static struct sh_timer_config tmu2_platform_data = {
-       .name = "TMU2",
        .channel_offset = 0x1c,
        .timer_bit = 2,
-       .clk = "tmu0",
 };
 
 static struct resource tmu2_resources[] = {
        [0] = {
-               .name   = "TMU2",
                .start  = 0xffd80020,
                .end    = 0xffd8002b,
                .flags  = IORESOURCE_MEM,
@@ -347,15 +329,12 @@ static struct platform_device tmu2_device = {
 };
 
 static struct sh_timer_config tmu3_platform_data = {
-       .name = "TMU3",
        .channel_offset = 0x04,
        .timer_bit = 0,
-       .clk = "tmu1",
 };
 
 static struct resource tmu3_resources[] = {
        [0] = {
-               .name   = "TMU3",
                .start  = 0xffd90008,
                .end    = 0xffd90013,
                .flags  = IORESOURCE_MEM,
@@ -380,15 +359,12 @@ static struct platform_device tmu3_device = {
 };
 
 static struct sh_timer_config tmu4_platform_data = {
-       .name = "TMU4",
        .channel_offset = 0x10,
        .timer_bit = 1,
-       .clk = "tmu1",
 };
 
 static struct resource tmu4_resources[] = {
        [0] = {
-               .name   = "TMU4",
                .start  = 0xffd90014,
                .end    = 0xffd9001f,
                .flags  = IORESOURCE_MEM,
@@ -413,15 +389,12 @@ static struct platform_device tmu4_device = {
 };
 
 static struct sh_timer_config tmu5_platform_data = {
-       .name = "TMU5",
        .channel_offset = 0x1c,
        .timer_bit = 2,
-       .clk = "tmu1",
 };
 
 static struct resource tmu5_resources[] = {
        [0] = {
-               .name   = "TMU5",
                .start  = 0xffd90020,
                .end    = 0xffd9002b,
                .flags  = IORESOURCE_MEM,
index e7fa2a9..89fe16d 100644 (file)
@@ -31,7 +31,7 @@
 #include <cpu/sh7724.h>
 
 /* DMA */
-static struct sh_dmae_channel sh7724_dmae0_channels[] = {
+static const struct sh_dmae_channel sh7724_dmae_channels[] = {
        {
                .offset = 0,
                .dmars = 0,
@@ -59,51 +59,11 @@ static struct sh_dmae_channel sh7724_dmae0_channels[] = {
        }
 };
 
-static struct sh_dmae_channel sh7724_dmae1_channels[] = {
-       {
-               .offset = 0,
-               .dmars = 0,
-               .dmars_bit = 0,
-       }, {
-               .offset = 0x10,
-               .dmars = 0,
-               .dmars_bit = 8,
-       }, {
-               .offset = 0x20,
-               .dmars = 4,
-               .dmars_bit = 0,
-       }, {
-               .offset = 0x30,
-               .dmars = 4,
-               .dmars_bit = 8,
-       }, {
-               .offset = 0x50,
-               .dmars = 8,
-               .dmars_bit = 0,
-       }, {
-               .offset = 0x60,
-               .dmars = 8,
-               .dmars_bit = 8,
-       }
-};
-
-static unsigned int ts_shift[] = TS_SHIFT;
-
-static struct sh_dmae_pdata dma0_platform_data = {
-       .channel        = sh7724_dmae0_channels,
-       .channel_num    = ARRAY_SIZE(sh7724_dmae0_channels),
-       .ts_low_shift   = CHCR_TS_LOW_SHIFT,
-       .ts_low_mask    = CHCR_TS_LOW_MASK,
-       .ts_high_shift  = CHCR_TS_HIGH_SHIFT,
-       .ts_high_mask   = CHCR_TS_HIGH_MASK,
-       .ts_shift       = ts_shift,
-       .ts_shift_num   = ARRAY_SIZE(ts_shift),
-       .dmaor_init     = DMAOR_INIT,
-};
+static const unsigned int ts_shift[] = TS_SHIFT;
 
-static struct sh_dmae_pdata dma1_platform_data = {
-       .channel        = sh7724_dmae1_channels,
-       .channel_num    = ARRAY_SIZE(sh7724_dmae1_channels),
+static struct sh_dmae_pdata dma_platform_data = {
+       .channel        = sh7724_dmae_channels,
+       .channel_num    = ARRAY_SIZE(sh7724_dmae_channels),
        .ts_low_shift   = CHCR_TS_LOW_SHIFT,
        .ts_low_mask    = CHCR_TS_LOW_MASK,
        .ts_high_shift  = CHCR_TS_HIGH_SHIFT,
@@ -187,7 +147,7 @@ static struct platform_device dma0_device = {
        .resource       = sh7724_dmae0_resources,
        .num_resources  = ARRAY_SIZE(sh7724_dmae0_resources),
        .dev            = {
-               .platform_data  = &dma0_platform_data,
+               .platform_data  = &dma_platform_data,
        },
        .archdata = {
                .hwblk_id = HWBLK_DMAC0,
@@ -200,7 +160,7 @@ static struct platform_device dma1_device = {
        .resource       = sh7724_dmae1_resources,
        .num_resources  = ARRAY_SIZE(sh7724_dmae1_resources),
        .dev            = {
-               .platform_data  = &dma1_platform_data,
+               .platform_data  = &dma_platform_data,
        },
        .archdata = {
                .hwblk_id = HWBLK_DMAC1,
@@ -213,7 +173,6 @@ static struct plat_sci_port scif0_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 80, 80, 80, 80 },
-       .clk            = "scif0",
 };
 
 static struct platform_device scif0_device = {
@@ -229,7 +188,6 @@ static struct plat_sci_port scif1_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 81, 81, 81, 81 },
-       .clk            = "scif1",
 };
 
 static struct platform_device scif1_device = {
@@ -245,7 +203,6 @@ static struct plat_sci_port scif2_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 82, 82, 82, 82 },
-       .clk            = "scif2",
 };
 
 static struct platform_device scif2_device = {
@@ -261,7 +218,6 @@ static struct plat_sci_port scif3_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIFA,
        .irqs           = { 56, 56, 56, 56 },
-       .clk            = "scif3",
 };
 
 static struct platform_device scif3_device = {
@@ -277,7 +233,6 @@ static struct plat_sci_port scif4_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIFA,
        .irqs           = { 88, 88, 88, 88 },
-       .clk            = "scif4",
 };
 
 static struct platform_device scif4_device = {
@@ -293,7 +248,6 @@ static struct plat_sci_port scif5_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIFA,
        .irqs           = { 109, 109, 109, 109 },
-       .clk            = "scif5",
 };
 
 static struct platform_device scif5_device = {
@@ -485,17 +439,14 @@ static struct platform_device veu1_device = {
 };
 
 static struct sh_timer_config cmt_platform_data = {
-       .name = "CMT",
        .channel_offset = 0x60,
        .timer_bit = 5,
-       .clk = "cmt0",
        .clockevent_rating = 125,
        .clocksource_rating = 200,
 };
 
 static struct resource cmt_resources[] = {
        [0] = {
-               .name   = "CMT",
                .start  = 0x044a0060,
                .end    = 0x044a006b,
                .flags  = IORESOURCE_MEM,
@@ -520,16 +471,13 @@ static struct platform_device cmt_device = {
 };
 
 static struct sh_timer_config tmu0_platform_data = {
-       .name = "TMU0",
        .channel_offset = 0x04,
        .timer_bit = 0,
-       .clk = "tmu0",
        .clockevent_rating = 200,
 };
 
 static struct resource tmu0_resources[] = {
        [0] = {
-               .name   = "TMU0",
                .start  = 0xffd80008,
                .end    = 0xffd80013,
                .flags  = IORESOURCE_MEM,
@@ -554,16 +502,13 @@ static struct platform_device tmu0_device = {
 };
 
 static struct sh_timer_config tmu1_platform_data = {
-       .name = "TMU1",
        .channel_offset = 0x10,
        .timer_bit = 1,
-       .clk = "tmu0",
        .clocksource_rating = 200,
 };
 
 static struct resource tmu1_resources[] = {
        [0] = {
-               .name   = "TMU1",
                .start  = 0xffd80014,
                .end    = 0xffd8001f,
                .flags  = IORESOURCE_MEM,
@@ -588,15 +533,12 @@ static struct platform_device tmu1_device = {
 };
 
 static struct sh_timer_config tmu2_platform_data = {
-       .name = "TMU2",
        .channel_offset = 0x1c,
        .timer_bit = 2,
-       .clk = "tmu0",
 };
 
 static struct resource tmu2_resources[] = {
        [0] = {
-               .name   = "TMU2",
                .start  = 0xffd80020,
                .end    = 0xffd8002b,
                .flags  = IORESOURCE_MEM,
@@ -622,15 +564,12 @@ static struct platform_device tmu2_device = {
 
 
 static struct sh_timer_config tmu3_platform_data = {
-       .name = "TMU3",
        .channel_offset = 0x04,
        .timer_bit = 0,
-       .clk = "tmu1",
 };
 
 static struct resource tmu3_resources[] = {
        [0] = {
-               .name   = "TMU3",
                .start  = 0xffd90008,
                .end    = 0xffd90013,
                .flags  = IORESOURCE_MEM,
@@ -655,15 +594,12 @@ static struct platform_device tmu3_device = {
 };
 
 static struct sh_timer_config tmu4_platform_data = {
-       .name = "TMU4",
        .channel_offset = 0x10,
        .timer_bit = 1,
-       .clk = "tmu1",
 };
 
 static struct resource tmu4_resources[] = {
        [0] = {
-               .name   = "TMU4",
                .start  = 0xffd90014,
                .end    = 0xffd9001f,
                .flags  = IORESOURCE_MEM,
@@ -688,15 +624,12 @@ static struct platform_device tmu4_device = {
 };
 
 static struct sh_timer_config tmu5_platform_data = {
-       .name = "TMU5",
        .channel_offset = 0x1c,
        .timer_bit = 2,
-       .clk = "tmu1",
 };
 
 static struct resource tmu5_resources[] = {
        [0] = {
-               .name   = "TMU5",
                .start  = 0xffd90020,
                .end    = 0xffd9002b,
                .flags  = IORESOURCE_MEM,
index e75edf5..444aca9 100644 (file)
@@ -63,16 +63,13 @@ static struct platform_device scif4_device = {
 };
 
 static struct sh_timer_config tmu0_platform_data = {
-       .name = "TMU0",
        .channel_offset = 0x04,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
        .clockevent_rating = 200,
 };
 
 static struct resource tmu0_resources[] = {
        [0] = {
-               .name   = "TMU0",
                .start  = 0xfe430008,
                .end    = 0xfe430013,
                .flags  = IORESOURCE_MEM,
@@ -94,16 +91,13 @@ static struct platform_device tmu0_device = {
 };
 
 static struct sh_timer_config tmu1_platform_data = {
-       .name = "TMU1",
        .channel_offset = 0x10,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
        .clocksource_rating = 200,
 };
 
 static struct resource tmu1_resources[] = {
        [0] = {
-               .name   = "TMU1",
                .start  = 0xfe430014,
                .end    = 0xfe43001f,
                .flags  = IORESOURCE_MEM,
index 7f6b0a5..5b5f6b0 100644 (file)
@@ -131,16 +131,13 @@ static struct platform_device usbf_device = {
 };
 
 static struct sh_timer_config tmu0_platform_data = {
-       .name = "TMU0",
        .channel_offset = 0x04,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
        .clockevent_rating = 200,
 };
 
 static struct resource tmu0_resources[] = {
        [0] = {
-               .name   = "TMU0",
                .start  = 0xffd80008,
                .end    = 0xffd80013,
                .flags  = IORESOURCE_MEM,
@@ -162,16 +159,13 @@ static struct platform_device tmu0_device = {
 };
 
 static struct sh_timer_config tmu1_platform_data = {
-       .name = "TMU1",
        .channel_offset = 0x10,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
        .clocksource_rating = 200,
 };
 
 static struct resource tmu1_resources[] = {
        [0] = {
-               .name   = "TMU1",
                .start  = 0xffd80014,
                .end    = 0xffd8001f,
                .flags  = IORESOURCE_MEM,
@@ -193,15 +187,12 @@ static struct platform_device tmu1_device = {
 };
 
 static struct sh_timer_config tmu2_platform_data = {
-       .name = "TMU2",
        .channel_offset = 0x1c,
        .timer_bit = 2,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu2_resources[] = {
        [0] = {
-               .name   = "TMU2",
                .start  = 0xffd80020,
                .end    = 0xffd8002f,
                .flags  = IORESOURCE_MEM,
@@ -223,15 +214,12 @@ static struct platform_device tmu2_device = {
 };
 
 static struct sh_timer_config tmu3_platform_data = {
-       .name = "TMU3",
        .channel_offset = 0x04,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu3_resources[] = {
        [0] = {
-               .name   = "TMU3",
                .start  = 0xffd88008,
                .end    = 0xffd88013,
                .flags  = IORESOURCE_MEM,
@@ -253,15 +241,12 @@ static struct platform_device tmu3_device = {
 };
 
 static struct sh_timer_config tmu4_platform_data = {
-       .name = "TMU4",
        .channel_offset = 0x10,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu4_resources[] = {
        [0] = {
-               .name   = "TMU4",
                .start  = 0xffd88014,
                .end    = 0xffd8801f,
                .flags  = IORESOURCE_MEM,
@@ -283,15 +268,12 @@ static struct platform_device tmu4_device = {
 };
 
 static struct sh_timer_config tmu5_platform_data = {
-       .name = "TMU5",
        .channel_offset = 0x1c,
        .timer_bit = 2,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu5_resources[] = {
        [0] = {
-               .name   = "TMU5",
                .start  = 0xffd88020,
                .end    = 0xffd8802b,
                .flags  = IORESOURCE_MEM,
index 86d681e..7270d7f 100644 (file)
@@ -165,16 +165,13 @@ static struct platform_device scif9_device = {
 };
 
 static struct sh_timer_config tmu0_platform_data = {
-       .name = "TMU0",
        .channel_offset = 0x04,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
        .clockevent_rating = 200,
 };
 
 static struct resource tmu0_resources[] = {
        [0] = {
-               .name   = "TMU0",
                .start  = 0xffd80008,
                .end    = 0xffd80013,
                .flags  = IORESOURCE_MEM,
@@ -196,16 +193,13 @@ static struct platform_device tmu0_device = {
 };
 
 static struct sh_timer_config tmu1_platform_data = {
-       .name = "TMU1",
        .channel_offset = 0x10,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
        .clocksource_rating = 200,
 };
 
 static struct resource tmu1_resources[] = {
        [0] = {
-               .name   = "TMU1",
                .start  = 0xffd80014,
                .end    = 0xffd8001f,
                .flags  = IORESOURCE_MEM,
@@ -227,15 +221,12 @@ static struct platform_device tmu1_device = {
 };
 
 static struct sh_timer_config tmu2_platform_data = {
-       .name = "TMU2",
        .channel_offset = 0x1c,
        .timer_bit = 2,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu2_resources[] = {
        [0] = {
-               .name   = "TMU2",
                .start  = 0xffd80020,
                .end    = 0xffd8002f,
                .flags  = IORESOURCE_MEM,
@@ -257,15 +248,12 @@ static struct platform_device tmu2_device = {
 };
 
 static struct sh_timer_config tmu3_platform_data = {
-       .name = "TMU3",
        .channel_offset = 0x04,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu3_resources[] = {
        [0] = {
-               .name   = "TMU3",
                .start  = 0xffd81008,
                .end    = 0xffd81013,
                .flags  = IORESOURCE_MEM,
@@ -287,15 +275,12 @@ static struct platform_device tmu3_device = {
 };
 
 static struct sh_timer_config tmu4_platform_data = {
-       .name = "TMU4",
        .channel_offset = 0x10,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu4_resources[] = {
        [0] = {
-               .name   = "TMU4",
                .start  = 0xffd81014,
                .end    = 0xffd8101f,
                .flags  = IORESOURCE_MEM,
@@ -317,15 +302,12 @@ static struct platform_device tmu4_device = {
 };
 
 static struct sh_timer_config tmu5_platform_data = {
-       .name = "TMU5",
        .channel_offset = 0x1c,
        .timer_bit = 2,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu5_resources[] = {
        [0] = {
-               .name   = "TMU5",
                .start  = 0xffd81020,
                .end    = 0xffd8102f,
                .flags  = IORESOURCE_MEM,
@@ -347,15 +329,12 @@ static struct platform_device tmu5_device = {
 };
 
 static struct sh_timer_config tmu6_platform_data = {
-       .name = "TMU6",
        .channel_offset = 0x04,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu6_resources[] = {
        [0] = {
-               .name   = "TMU6",
                .start  = 0xffd82008,
                .end    = 0xffd82013,
                .flags  = IORESOURCE_MEM,
@@ -377,15 +356,12 @@ static struct platform_device tmu6_device = {
 };
 
 static struct sh_timer_config tmu7_platform_data = {
-       .name = "TMU7",
        .channel_offset = 0x10,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu7_resources[] = {
        [0] = {
-               .name   = "TMU7",
                .start  = 0xffd82014,
                .end    = 0xffd8201f,
                .flags  = IORESOURCE_MEM,
@@ -407,15 +383,12 @@ static struct platform_device tmu7_device = {
 };
 
 static struct sh_timer_config tmu8_platform_data = {
-       .name = "TMU8",
        .channel_offset = 0x1c,
        .timer_bit = 2,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu8_resources[] = {
        [0] = {
-               .name   = "TMU8",
                .start  = 0xffd82020,
                .end    = 0xffd8202b,
                .flags  = IORESOURCE_MEM,
index 02e792c..b12f537 100644 (file)
@@ -49,16 +49,13 @@ static struct platform_device scif1_device = {
 };
 
 static struct sh_timer_config tmu0_platform_data = {
-       .name = "TMU0",
        .channel_offset = 0x04,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
        .clockevent_rating = 200,
 };
 
 static struct resource tmu0_resources[] = {
        [0] = {
-               .name   = "TMU0",
                .start  = 0xffd80008,
                .end    = 0xffd80013,
                .flags  = IORESOURCE_MEM,
@@ -80,16 +77,13 @@ static struct platform_device tmu0_device = {
 };
 
 static struct sh_timer_config tmu1_platform_data = {
-       .name = "TMU1",
        .channel_offset = 0x10,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
        .clocksource_rating = 200,
 };
 
 static struct resource tmu1_resources[] = {
        [0] = {
-               .name   = "TMU1",
                .start  = 0xffd80014,
                .end    = 0xffd8001f,
                .flags  = IORESOURCE_MEM,
@@ -111,15 +105,12 @@ static struct platform_device tmu1_device = {
 };
 
 static struct sh_timer_config tmu2_platform_data = {
-       .name = "TMU2",
        .channel_offset = 0x1c,
        .timer_bit = 2,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu2_resources[] = {
        [0] = {
-               .name   = "TMU2",
                .start  = 0xffd80020,
                .end    = 0xffd8002f,
                .flags  = IORESOURCE_MEM,
@@ -141,15 +132,12 @@ static struct platform_device tmu2_device = {
 };
 
 static struct sh_timer_config tmu3_platform_data = {
-       .name = "TMU3",
        .channel_offset = 0x04,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu3_resources[] = {
        [0] = {
-               .name   = "TMU3",
                .start  = 0xffdc0008,
                .end    = 0xffdc0013,
                .flags  = IORESOURCE_MEM,
@@ -171,15 +159,12 @@ static struct platform_device tmu3_device = {
 };
 
 static struct sh_timer_config tmu4_platform_data = {
-       .name = "TMU4",
        .channel_offset = 0x10,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu4_resources[] = {
        [0] = {
-               .name   = "TMU4",
                .start  = 0xffdc0014,
                .end    = 0xffdc001f,
                .flags  = IORESOURCE_MEM,
@@ -201,15 +186,12 @@ static struct platform_device tmu4_device = {
 };
 
 static struct sh_timer_config tmu5_platform_data = {
-       .name = "TMU5",
        .channel_offset = 0x1c,
        .timer_bit = 2,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu5_resources[] = {
        [0] = {
-               .name   = "TMU5",
                .start  = 0xffdc0020,
                .end    = 0xffdc002b,
                .flags  = IORESOURCE_MEM,
@@ -251,7 +233,7 @@ static struct platform_device rtc_device = {
 };
 
 /* DMA */
-static struct sh_dmae_channel sh7780_dmae0_channels[] = {
+static const struct sh_dmae_channel sh7780_dmae0_channels[] = {
        {
                .offset = 0,
                .dmars = 0,
@@ -279,7 +261,7 @@ static struct sh_dmae_channel sh7780_dmae0_channels[] = {
        }
 };
 
-static struct sh_dmae_channel sh7780_dmae1_channels[] = {
+static const struct sh_dmae_channel sh7780_dmae1_channels[] = {
        {
                .offset = 0,
        }, {
@@ -295,7 +277,7 @@ static struct sh_dmae_channel sh7780_dmae1_channels[] = {
        }
 };
 
-static unsigned int ts_shift[] = TS_SHIFT;
+static const unsigned int ts_shift[] = TS_SHIFT;
 
 static struct sh_dmae_pdata dma0_platform_data = {
        .channel        = sh7780_dmae0_channels,
index 1fcd88b..f3e3ea0 100644 (file)
@@ -25,7 +25,6 @@ static struct plat_sci_port scif0_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 40, 40, 40, 40 },
-       .clk            = "scif_fck",
 };
 
 static struct platform_device scif0_device = {
@@ -41,7 +40,6 @@ static struct plat_sci_port scif1_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 44, 44, 44, 44 },
-       .clk            = "scif_fck",
 };
 
 static struct platform_device scif1_device = {
@@ -57,7 +55,6 @@ static struct plat_sci_port scif2_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 60, 60, 60, 60 },
-       .clk            = "scif_fck",
 };
 
 static struct platform_device scif2_device = {
@@ -73,7 +70,6 @@ static struct plat_sci_port scif3_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 61, 61, 61, 61 },
-       .clk            = "scif_fck",
 };
 
 static struct platform_device scif3_device = {
@@ -89,7 +85,6 @@ static struct plat_sci_port scif4_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 62, 62, 62, 62 },
-       .clk            = "scif_fck",
 };
 
 static struct platform_device scif4_device = {
@@ -105,7 +100,6 @@ static struct plat_sci_port scif5_platform_data = {
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .irqs           = { 63, 63, 63, 63 },
-       .clk            = "scif_fck",
 };
 
 static struct platform_device scif5_device = {
@@ -117,16 +111,13 @@ static struct platform_device scif5_device = {
 };
 
 static struct sh_timer_config tmu0_platform_data = {
-       .name = "TMU0",
        .channel_offset = 0x04,
        .timer_bit = 0,
-       .clk = "tmu012_fck",
        .clockevent_rating = 200,
 };
 
 static struct resource tmu0_resources[] = {
        [0] = {
-               .name   = "TMU0",
                .start  = 0xffd80008,
                .end    = 0xffd80013,
                .flags  = IORESOURCE_MEM,
@@ -148,16 +139,13 @@ static struct platform_device tmu0_device = {
 };
 
 static struct sh_timer_config tmu1_platform_data = {
-       .name = "TMU1",
        .channel_offset = 0x10,
        .timer_bit = 1,
-       .clk = "tmu012_fck",
        .clocksource_rating = 200,
 };
 
 static struct resource tmu1_resources[] = {
        [0] = {
-               .name   = "TMU1",
                .start  = 0xffd80014,
                .end    = 0xffd8001f,
                .flags  = IORESOURCE_MEM,
@@ -179,15 +167,12 @@ static struct platform_device tmu1_device = {
 };
 
 static struct sh_timer_config tmu2_platform_data = {
-       .name = "TMU2",
        .channel_offset = 0x1c,
        .timer_bit = 2,
-       .clk = "tmu012_fck",
 };
 
 static struct resource tmu2_resources[] = {
        [0] = {
-               .name   = "TMU2",
                .start  = 0xffd80020,
                .end    = 0xffd8002f,
                .flags  = IORESOURCE_MEM,
@@ -209,15 +194,12 @@ static struct platform_device tmu2_device = {
 };
 
 static struct sh_timer_config tmu3_platform_data = {
-       .name = "TMU3",
        .channel_offset = 0x04,
        .timer_bit = 0,
-       .clk = "tmu345_fck",
 };
 
 static struct resource tmu3_resources[] = {
        [0] = {
-               .name   = "TMU3",
                .start  = 0xffdc0008,
                .end    = 0xffdc0013,
                .flags  = IORESOURCE_MEM,
@@ -239,15 +221,12 @@ static struct platform_device tmu3_device = {
 };
 
 static struct sh_timer_config tmu4_platform_data = {
-       .name = "TMU4",
        .channel_offset = 0x10,
        .timer_bit = 1,
-       .clk = "tmu345_fck",
 };
 
 static struct resource tmu4_resources[] = {
        [0] = {
-               .name   = "TMU4",
                .start  = 0xffdc0014,
                .end    = 0xffdc001f,
                .flags  = IORESOURCE_MEM,
@@ -269,15 +248,12 @@ static struct platform_device tmu4_device = {
 };
 
 static struct sh_timer_config tmu5_platform_data = {
-       .name = "TMU5",
        .channel_offset = 0x1c,
        .timer_bit = 2,
-       .clk = "tmu345_fck",
 };
 
 static struct resource tmu5_resources[] = {
        [0] = {
-               .name   = "TMU5",
                .start  = 0xffdc0020,
                .end    = 0xffdc002b,
                .flags  = IORESOURCE_MEM,
@@ -299,7 +275,7 @@ static struct platform_device tmu5_device = {
 };
 
 /* DMA */
-static struct sh_dmae_channel sh7785_dmae0_channels[] = {
+static const struct sh_dmae_channel sh7785_dmae0_channels[] = {
        {
                .offset = 0,
                .dmars = 0,
@@ -327,7 +303,7 @@ static struct sh_dmae_channel sh7785_dmae0_channels[] = {
        }
 };
 
-static struct sh_dmae_channel sh7785_dmae1_channels[] = {
+static const struct sh_dmae_channel sh7785_dmae1_channels[] = {
        {
                .offset = 0,
        }, {
@@ -343,7 +319,7 @@ static struct sh_dmae_channel sh7785_dmae1_channels[] = {
        }
 };
 
-static unsigned int ts_shift[] = TS_SHIFT;
+static const unsigned int ts_shift[] = TS_SHIFT;
 
 static struct sh_dmae_pdata dma0_platform_data = {
        .channel        = sh7785_dmae0_channels,
index 7e58532..8165709 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * SH7786 Setup
  *
- * Copyright (C) 2009  Renesas Solutions Corp.
+ * Copyright (C) 2009 - 2010  Renesas Solutions Corp.
  * Kuninori Morimoto <morimoto.kuninori@renesas.com>
  * Paul Mundt <paul.mundt@renesas.com>
  *
 #include <linux/mm.h>
 #include <linux/dma-mapping.h>
 #include <linux/sh_timer.h>
+#include <linux/sh_intc.h>
+#include <cpu/dma-register.h>
 #include <asm/mmzone.h>
+#include <asm/dmaengine.h>
 
 static struct plat_sci_port scif0_platform_data = {
        .mapbase        = 0xffea0000,
@@ -117,16 +120,13 @@ static struct platform_device scif5_device = {
 };
 
 static struct sh_timer_config tmu0_platform_data = {
-       .name = "TMU0",
        .channel_offset = 0x04,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
        .clockevent_rating = 200,
 };
 
 static struct resource tmu0_resources[] = {
        [0] = {
-               .name   = "TMU0",
                .start  = 0xffd80008,
                .end    = 0xffd80013,
                .flags  = IORESOURCE_MEM,
@@ -148,16 +148,13 @@ static struct platform_device tmu0_device = {
 };
 
 static struct sh_timer_config tmu1_platform_data = {
-       .name = "TMU1",
        .channel_offset = 0x10,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
        .clocksource_rating = 200,
 };
 
 static struct resource tmu1_resources[] = {
        [0] = {
-               .name   = "TMU1",
                .start  = 0xffd80014,
                .end    = 0xffd8001f,
                .flags  = IORESOURCE_MEM,
@@ -179,15 +176,12 @@ static struct platform_device tmu1_device = {
 };
 
 static struct sh_timer_config tmu2_platform_data = {
-       .name = "TMU2",
        .channel_offset = 0x1c,
        .timer_bit = 2,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu2_resources[] = {
        [0] = {
-               .name   = "TMU2",
                .start  = 0xffd80020,
                .end    = 0xffd8002f,
                .flags  = IORESOURCE_MEM,
@@ -209,15 +203,12 @@ static struct platform_device tmu2_device = {
 };
 
 static struct sh_timer_config tmu3_platform_data = {
-       .name = "TMU3",
        .channel_offset = 0x04,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu3_resources[] = {
        [0] = {
-               .name   = "TMU3",
                .start  = 0xffda0008,
                .end    = 0xffda0013,
                .flags  = IORESOURCE_MEM,
@@ -239,15 +230,12 @@ static struct platform_device tmu3_device = {
 };
 
 static struct sh_timer_config tmu4_platform_data = {
-       .name = "TMU4",
        .channel_offset = 0x10,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu4_resources[] = {
        [0] = {
-               .name   = "TMU4",
                .start  = 0xffda0014,
                .end    = 0xffda001f,
                .flags  = IORESOURCE_MEM,
@@ -269,15 +257,12 @@ static struct platform_device tmu4_device = {
 };
 
 static struct sh_timer_config tmu5_platform_data = {
-       .name = "TMU5",
        .channel_offset = 0x1c,
        .timer_bit = 2,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu5_resources[] = {
        [0] = {
-               .name   = "TMU5",
                .start  = 0xffda0020,
                .end    = 0xffda002b,
                .flags  = IORESOURCE_MEM,
@@ -299,15 +284,12 @@ static struct platform_device tmu5_device = {
 };
 
 static struct sh_timer_config tmu6_platform_data = {
-       .name = "TMU6",
        .channel_offset = 0x04,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu6_resources[] = {
        [0] = {
-               .name   = "TMU6",
                .start  = 0xffdc0008,
                .end    = 0xffdc0013,
                .flags  = IORESOURCE_MEM,
@@ -329,15 +311,12 @@ static struct platform_device tmu6_device = {
 };
 
 static struct sh_timer_config tmu7_platform_data = {
-       .name = "TMU7",
        .channel_offset = 0x10,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu7_resources[] = {
        [0] = {
-               .name   = "TMU7",
                .start  = 0xffdc0014,
                .end    = 0xffdc001f,
                .flags  = IORESOURCE_MEM,
@@ -359,15 +338,12 @@ static struct platform_device tmu7_device = {
 };
 
 static struct sh_timer_config tmu8_platform_data = {
-       .name = "TMU8",
        .channel_offset = 0x1c,
        .timer_bit = 2,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu8_resources[] = {
        [0] = {
-               .name   = "TMU8",
                .start  = 0xffdc0020,
                .end    = 0xffdc002b,
                .flags  = IORESOURCE_MEM,
@@ -389,15 +365,12 @@ static struct platform_device tmu8_device = {
 };
 
 static struct sh_timer_config tmu9_platform_data = {
-       .name = "TMU9",
        .channel_offset = 0x04,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu9_resources[] = {
        [0] = {
-               .name   = "TMU9",
                .start  = 0xffde0008,
                .end    = 0xffde0013,
                .flags  = IORESOURCE_MEM,
@@ -419,15 +392,12 @@ static struct platform_device tmu9_device = {
 };
 
 static struct sh_timer_config tmu10_platform_data = {
-       .name = "TMU10",
        .channel_offset = 0x10,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu10_resources[] = {
        [0] = {
-               .name   = "TMU10",
                .start  = 0xffde0014,
                .end    = 0xffde001f,
                .flags  = IORESOURCE_MEM,
@@ -449,15 +419,12 @@ static struct platform_device tmu10_device = {
 };
 
 static struct sh_timer_config tmu11_platform_data = {
-       .name = "TMU11",
        .channel_offset = 0x1c,
        .timer_bit = 2,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu11_resources[] = {
        [0] = {
-               .name   = "TMU11",
                .start  = 0xffde0020,
                .end    = 0xffde002b,
                .flags  = IORESOURCE_MEM,
@@ -478,6 +445,83 @@ static struct platform_device tmu11_device = {
        .num_resources  = ARRAY_SIZE(tmu11_resources),
 };
 
+static const struct sh_dmae_channel dmac0_channels[] = {
+       {
+               .offset = 0,
+               .dmars = 0,
+               .dmars_bit = 0,
+       }, {
+               .offset = 0x10,
+               .dmars = 0,
+               .dmars_bit = 8,
+       }, {
+               .offset = 0x20,
+               .dmars = 4,
+               .dmars_bit = 0,
+       }, {
+               .offset = 0x30,
+               .dmars = 4,
+               .dmars_bit = 8,
+       }, {
+               .offset = 0x50,
+               .dmars = 8,
+               .dmars_bit = 0,
+       }, {
+               .offset = 0x60,
+               .dmars = 8,
+               .dmars_bit = 8,
+       }
+};
+
+static const unsigned int ts_shift[] = TS_SHIFT;
+
+static struct sh_dmae_pdata dma0_platform_data = {
+       .channel        = dmac0_channels,
+       .channel_num    = ARRAY_SIZE(dmac0_channels),
+       .ts_low_shift   = CHCR_TS_LOW_SHIFT,
+       .ts_low_mask    = CHCR_TS_LOW_MASK,
+       .ts_high_shift  = CHCR_TS_HIGH_SHIFT,
+       .ts_high_mask   = CHCR_TS_HIGH_MASK,
+       .ts_shift       = ts_shift,
+       .ts_shift_num   = ARRAY_SIZE(ts_shift),
+       .dmaor_init     = DMAOR_INIT,
+};
+
+/* Resource order important! */
+static struct resource dmac0_resources[] = {
+       {
+               /* Channel registers and DMAOR */
+               .start  = 0xfe008020,
+               .end    = 0xfe00808f,
+               .flags  = IORESOURCE_MEM,
+       }, {
+               /* DMARSx */
+               .start  = 0xfe009000,
+               .end    = 0xfe00900b,
+               .flags  = IORESOURCE_MEM,
+       }, {
+               /* DMA error IRQ */
+               .start  = evt2irq(0x5c0),
+               .end    = evt2irq(0x5c0),
+               .flags  = IORESOURCE_IRQ,
+       }, {
+               /* IRQ for channels 0-5 */
+               .start  = evt2irq(0x500),
+               .end    = evt2irq(0x5a0),
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device dma0_device = {
+       .name           = "sh-dma-engine",
+       .id             = 0,
+       .resource       = dmac0_resources,
+       .num_resources  = ARRAY_SIZE(dmac0_resources),
+       .dev            = {
+               .platform_data  = &dma0_platform_data,
+       },
+};
+
 static struct resource usb_ohci_resources[] = {
        [0] = {
                .start  = 0xffe70400,
@@ -525,10 +569,10 @@ static struct platform_device *sh7786_early_devices[] __initdata = {
 };
 
 static struct platform_device *sh7786_devices[] __initdata = {
+       &dma0_device,
        &usb_ohci_device,
 };
 
-
 /*
  * Please call this function if your platform board
  * use external clock for USB
@@ -536,6 +580,7 @@ static struct platform_device *sh7786_devices[] __initdata = {
 #define USBCTL0                0xffe70858
 #define CLOCK_MODE_MASK 0xffffff7f
 #define EXT_CLOCK_MODE  0x00000080
+
 void __init sh7786_usb_use_exclock(void)
 {
        u32 val = __raw_readl(USBCTL0) & CLOCK_MODE_MASK;
@@ -553,6 +598,7 @@ void __init sh7786_usb_use_exclock(void)
 #define PLL_ENB                0x00000002
 #define PHY_RST                0x00000004
 #define ACT_PLL_STATUS 0xc0000000
+
 static void __init sh7786_usb_setup(void)
 {
        int i = 1000000;
@@ -708,9 +754,19 @@ static struct intc_vect vectors[] __initdata = {
 #define INTMSK2                0xfe410068
 #define INTMSKCLR2     0xfe41006c
 
+#define INTDISTCR0     0xfe4100b0
+#define INTDISTCR1     0xfe4100b4
+#define INTACK         0xfe4100b8
+#define INTACKCLR      0xfe4100bc
+#define INT2DISTCR0    0xfe410900
+#define INT2DISTCR1    0xfe410904
+#define INT2DISTCR2    0xfe410908
+#define INT2DISTCR3    0xfe41090c
+
 static struct intc_mask_reg mask_registers[] __initdata = {
        { CnINTMSK0, CnINTMSKCLR0, 32,
-         { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
+         { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 },
+           INTC_SMP_BALANCING(INTDISTCR0) },
        { INTMSK2, INTMSKCLR2, 32,
          { IRL0_LLLL, IRL0_LLLH, IRL0_LLHL, IRL0_LLHH,
            IRL0_LHLL, IRL0_LHLH, IRL0_LHHL, IRL0_LHHH,
@@ -722,7 +778,8 @@ static struct intc_mask_reg mask_registers[] __initdata = {
            IRL4_HHLL, IRL4_HHLH, IRL4_HHHL, 0, } },
        { CnINT2MSKR0, CnINT2MSKCR0 , 32,
          { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-           0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, WDT } },
+           0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, WDT },
+           INTC_SMP_BALANCING(INT2DISTCR0) },
        { CnINT2MSKR1, CnINT2MSKCR1, 32,
          { TMU0_0, TMU0_1, TMU0_2, TMU0_3, TMU1_0, TMU1_1, TMU1_2, 0,
            DMAC0_0, DMAC0_1, DMAC0_2, DMAC0_3, DMAC0_4, DMAC0_5, DMAC0_6,
@@ -731,14 +788,14 @@ static struct intc_mask_reg mask_registers[] __initdata = {
            HPB_0, HPB_1, HPB_2,
            SCIF0_0, SCIF0_1, SCIF0_2, SCIF0_3,
            SCIF1,
-           TMU2, TMU3, 0, } },
+           TMU2, TMU3, 0, }, INTC_SMP_BALANCING(INT2DISTCR1) },
        { CnINT2MSKR2, CnINT2MSKCR2, 32,
          { 0, 0, SCIF2, SCIF3, SCIF4, SCIF5,
            Eth_0, Eth_1,
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            PCIeC0_0, PCIeC0_1, PCIeC0_2,
            PCIeC1_0, PCIeC1_1, PCIeC1_2,
-           USB, 0, 0 } },
+           USB, 0, 0 }, INTC_SMP_BALANCING(INT2DISTCR2) },
        { CnINT2MSKR3, CnINT2MSKCR3, 32,
          { 0, 0, 0, 0, 0, 0,
            I2C0, I2C1,
@@ -747,7 +804,7 @@ static struct intc_mask_reg mask_registers[] __initdata = {
            HAC0, HAC1,
            FLCTL, 0,
            HSPI, GPIO0, GPIO1, Thermal,
-           0, 0, 0, 0, 0, 0, 0, 0 } },
+           0, 0, 0, 0, 0, 0, 0, 0 }, INTC_SMP_BALANCING(INT2DISTCR3) },
 };
 
 static struct intc_prio_reg prio_registers[] __initdata = {
@@ -863,6 +920,19 @@ static DECLARE_INTC_DESC(intc_desc_irl4567, "sh7786-irl4567", vectors_irl4567,
 #define INTC_INTMSK2   INTMSK2
 #define INTC_INTMSKCLR1        CnINTMSKCLR1
 #define INTC_INTMSKCLR2        INTMSKCLR2
+#define INTC_USERIMASK 0xfe411000
+
+#ifdef CONFIG_INTC_BALANCING
+unsigned int irq_lookup(unsigned int irq)
+{
+       return __raw_readl(INTACK) & 1 ? irq : NO_IRQ_IGNORE;
+}
+
+void irq_finish(unsigned int irq)
+{
+       __raw_writel(irq2evt(irq), INTACKCLR);
+}
+#endif
 
 void __init plat_irq_setup(void)
 {
@@ -877,6 +947,7 @@ void __init plat_irq_setup(void)
        __raw_writel(__raw_readl(INTC_ICR0) & ~0x00c00000, INTC_ICR0);
 
        register_intc_controller(&intc_desc);
+       register_intc_userimask(INTC_USERIMASK);
 }
 
 void __init plat_irq_setup_pins(int mode)
index 780ba17..9158bc5 100644 (file)
@@ -70,16 +70,13 @@ static struct platform_device scif2_device = {
 };
 
 static struct sh_timer_config tmu0_platform_data = {
-       .name = "TMU0",
        .channel_offset = 0x04,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
        .clockevent_rating = 200,
 };
 
 static struct resource tmu0_resources[] = {
        [0] = {
-               .name   = "TMU0",
                .start  = 0xffc10008,
                .end    = 0xffc10013,
                .flags  = IORESOURCE_MEM,
@@ -101,16 +98,13 @@ static struct platform_device tmu0_device = {
 };
 
 static struct sh_timer_config tmu1_platform_data = {
-       .name = "TMU1",
        .channel_offset = 0x10,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
        .clocksource_rating = 200,
 };
 
 static struct resource tmu1_resources[] = {
        [0] = {
-               .name   = "TMU1",
                .start  = 0xffc10014,
                .end    = 0xffc1001f,
                .flags  = IORESOURCE_MEM,
@@ -132,15 +126,12 @@ static struct platform_device tmu1_device = {
 };
 
 static struct sh_timer_config tmu2_platform_data = {
-       .name = "TMU2",
        .channel_offset = 0x1c,
        .timer_bit = 2,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu2_resources[] = {
        [0] = {
-               .name   = "TMU2",
                .start  = 0xffc10020,
                .end    = 0xffc1002f,
                .flags  = IORESOURCE_MEM,
@@ -162,15 +153,12 @@ static struct platform_device tmu2_device = {
 };
 
 static struct sh_timer_config tmu3_platform_data = {
-       .name = "TMU3",
        .channel_offset = 0x04,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu3_resources[] = {
        [0] = {
-               .name   = "TMU3",
                .start  = 0xffc20008,
                .end    = 0xffc20013,
                .flags  = IORESOURCE_MEM,
@@ -192,15 +180,12 @@ static struct platform_device tmu3_device = {
 };
 
 static struct sh_timer_config tmu4_platform_data = {
-       .name = "TMU4",
        .channel_offset = 0x10,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu4_resources[] = {
        [0] = {
-               .name   = "TMU4",
                .start  = 0xffc20014,
                .end    = 0xffc2001f,
                .flags  = IORESOURCE_MEM,
@@ -222,15 +207,12 @@ static struct platform_device tmu4_device = {
 };
 
 static struct sh_timer_config tmu5_platform_data = {
-       .name = "TMU5",
        .channel_offset = 0x1c,
        .timer_bit = 2,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu5_resources[] = {
        [0] = {
-               .name   = "TMU5",
                .start  = 0xffc20020,
                .end    = 0xffc2002b,
                .flags  = IORESOURCE_MEM,
index 11bf4c1..c98b457 100644 (file)
@@ -72,8 +72,8 @@ void __init plat_prepare_cpus(unsigned int max_cpus)
        BUILD_BUG_ON(SMP_MSG_NR >= 8);
 
        for (i = 0; i < SMP_MSG_NR; i++)
-               request_irq(104 + i, ipi_interrupt_handler, IRQF_DISABLED,
-                           "IPI", (void *)(long)i);
+               request_irq(104 + i, ipi_interrupt_handler,
+                           IRQF_DISABLED | IRQF_PERCPU, "IPI", (void *)(long)i);
 }
 
 void plat_start_cpu(unsigned int cpu, unsigned long entry_point)
index 521d05b..9e88240 100644 (file)
@@ -17,7 +17,7 @@
 #include <asm/cache.h>
 #include <asm/tlb.h>
 
-int __init detect_cpu_and_cache_system(void)
+void __cpuinit cpu_probe(void)
 {
        unsigned long long cir;
 
@@ -72,6 +72,4 @@ int __init detect_cpu_and_cache_system(void)
 
        /* Setup some I/D TLB defaults */
        sh64_tlb_init();
-
-       return 0;
 }
index e7a3c1e..d910666 100644 (file)
@@ -68,16 +68,13 @@ static struct platform_device rtc_device = {
 #define TMU2_BASE      (TMU_BASE + 0x8 + (0xc * 0x2))
 
 static struct sh_timer_config tmu0_platform_data = {
-       .name = "TMU0",
        .channel_offset = 0x04,
        .timer_bit = 0,
-       .clk = "peripheral_clk",
        .clockevent_rating = 200,
 };
 
 static struct resource tmu0_resources[] = {
        [0] = {
-               .name   = "TMU0",
                .start  = TMU0_BASE,
                .end    = TMU0_BASE + 0xc - 1,
                .flags  = IORESOURCE_MEM,
@@ -99,16 +96,13 @@ static struct platform_device tmu0_device = {
 };
 
 static struct sh_timer_config tmu1_platform_data = {
-       .name = "TMU1",
        .channel_offset = 0x10,
        .timer_bit = 1,
-       .clk = "peripheral_clk",
        .clocksource_rating = 200,
 };
 
 static struct resource tmu1_resources[] = {
        [0] = {
-               .name   = "TMU1",
                .start  = TMU1_BASE,
                .end    = TMU1_BASE + 0xc - 1,
                .flags  = IORESOURCE_MEM,
@@ -130,15 +124,12 @@ static struct platform_device tmu1_device = {
 };
 
 static struct sh_timer_config tmu2_platform_data = {
-       .name = "TMU2",
        .channel_offset = 0x1c,
        .timer_bit = 2,
-       .clk = "peripheral_clk",
 };
 
 static struct resource tmu2_resources[] = {
        [0] = {
-               .name   = "TMU2",
                .start  = TMU2_BASE,
                .end    = TMU2_BASE + 0xc - 1,
                .flags  = IORESOURCE_MEM,
index a8234b2..5ec1d18 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/mm.h>
 #include <linux/elf.h>
 #include <linux/ftrace.h>
+#include <linux/module.h>
 #include <linux/slab.h>
 #include <asm/dwarf.h>
 #include <asm/unwinder.h>
index fe0b743..6e35f01 100644 (file)
@@ -131,6 +131,7 @@ ENTRY(_stext)
  *     r8 = scratch register
  *     r9 = scratch register
  *     r10 = number of PMB entries we've setup
+ *     r11 = scratch register
  */
 
        mov.l   .LMMUCR, r1     /* Flush the TLB */
@@ -167,8 +168,9 @@ ENTRY(_stext)
 
 .Lvalidate_existing_mappings:
 
+       mov.l   .LPMB_DATA_MASK, r11
        mov.l   @r7, r8
-       and     r0, r8
+       and     r11, r8
        cmp/eq  r0, r8          /* Check for valid __MEMORY_START mappings */
        bt      .Lpmb_done
 
@@ -335,12 +337,13 @@ ENTRY(stack_start)
 3:     .long   __bss_start
 4:     .long   _end
 5:     .long   start_kernel
-6:     .long   sh_cpu_init
+6:     .long   cpu_init
 7:     .long   init_thread_union
 
 #ifdef CONFIG_PMB
 .LPMB_ADDR:            .long   PMB_ADDR
 .LPMB_DATA:            .long   PMB_DATA
+.LPMB_DATA_MASK:       .long   PMB_PFN_MASK | PMB_V
 .LFIRST_ADDR_ENTRY:    .long   PAGE_OFFSET | PMB_V
 .LFIRST_DATA_ENTRY:    .long   __MEMORY_START | PMB_V
 .LMMUCR:               .long   MMUCR
index 675eea7..5499857 100644 (file)
@@ -425,11 +425,6 @@ void hw_breakpoint_pmu_read(struct perf_event *bp)
        /* TODO */
 }
 
-void hw_breakpoint_pmu_unthrottle(struct perf_event *bp)
-{
-       /* TODO */
-}
-
 int register_sh_ubc(struct sh_ubc *ubc)
 {
        /* Bail if it's already assigned */
index d2d41d0..f6a9319 100644 (file)
@@ -113,19 +113,14 @@ union irq_ctx {
 
 static union irq_ctx *hardirq_ctx[NR_CPUS] __read_mostly;
 static union irq_ctx *softirq_ctx[NR_CPUS] __read_mostly;
-#endif
 
-asmlinkage __irq_entry int do_IRQ(unsigned int irq, struct pt_regs *regs)
+static char softirq_stack[NR_CPUS * THREAD_SIZE] __page_aligned_bss;
+static char hardirq_stack[NR_CPUS * THREAD_SIZE] __page_aligned_bss;
+
+static inline void handle_one_irq(unsigned int irq)
 {
-       struct pt_regs *old_regs = set_irq_regs(regs);
-#ifdef CONFIG_IRQSTACKS
        union irq_ctx *curctx, *irqctx;
-#endif
-
-       irq_enter();
-       irq = irq_demux(irq);
 
-#ifdef CONFIG_IRQSTACKS
        curctx = (union irq_ctx *)current_thread_info();
        irqctx = hardirq_ctx[smp_processor_id()];
 
@@ -164,20 +159,9 @@ asmlinkage __irq_entry int do_IRQ(unsigned int irq, struct pt_regs *regs)
                          "r5", "r6", "r7", "r8", "t", "pr"
                );
        } else
-#endif
                generic_handle_irq(irq);
-
-       irq_exit();
-
-       set_irq_regs(old_regs);
-       return 1;
 }
 
-#ifdef CONFIG_IRQSTACKS
-static char softirq_stack[NR_CPUS * THREAD_SIZE] __page_aligned_bss;
-
-static char hardirq_stack[NR_CPUS * THREAD_SIZE] __page_aligned_bss;
-
 /*
  * allocate per-cpu stacks for hardirq and for softirq processing
  */
@@ -257,8 +241,33 @@ asmlinkage void do_softirq(void)
 
        local_irq_restore(flags);
 }
+#else
+static inline void handle_one_irq(unsigned int irq)
+{
+       generic_handle_irq(irq);
+}
 #endif
 
+asmlinkage __irq_entry int do_IRQ(unsigned int irq, struct pt_regs *regs)
+{
+       struct pt_regs *old_regs = set_irq_regs(regs);
+
+       irq_enter();
+
+       irq = irq_demux(irq_lookup(irq));
+
+       if (irq != NO_IRQ_IGNORE) {
+               handle_one_irq(irq);
+               irq_finish(irq);
+       }
+
+       irq_exit();
+
+       set_irq_regs(old_regs);
+
+       return IRQ_HANDLED;
+}
+
 void __init init_IRQ(void)
 {
        plat_irq_setup();
index 17f89aa..dcb126d 100644 (file)
@@ -90,7 +90,7 @@ void arch_task_cache_init(void)
 # define HAVE_SOFTFP   0
 #endif
 
-void init_thread_xstate(void)
+void __cpuinit init_thread_xstate(void)
 {
        if (boot_cpu_data.flags & CPU_HAS_FPU)
                xstate_size = sizeof(struct sh_fpu_hard_struct);
index 3dc8a8a..53f7c68 100644 (file)
@@ -10,6 +10,7 @@ cacheops-$(CONFIG_CPU_SH3)            := cache-sh3.o
 cacheops-$(CONFIG_CPU_SH4)             := cache-sh4.o flush-sh4.o
 cacheops-$(CONFIG_CPU_SH5)             := cache-sh5.o flush-sh4.o
 cacheops-$(CONFIG_SH7705_CACHE_32KB)   += cache-sh7705.o
+cacheops-$(CONFIG_CPU_SHX3)            += cache-shx3.o
 
 obj-y                  += $(cacheops-y)
 
@@ -18,13 +19,14 @@ mmu-$(CONFIG_MMU)   := extable_$(BITS).o fault_$(BITS).o \
                           ioremap.o kmap.o pgtable.o tlbflush_$(BITS).o
 
 obj-y                  += $(mmu-y)
-obj-$(CONFIG_DEBUG_FS) += asids-debugfs.o
 
-ifdef CONFIG_DEBUG_FS
-obj-$(CONFIG_CPU_SH4)  += cache-debugfs.o
+debugfs-y                      := asids-debugfs.o
+ifndef CONFIG_CACHE_OFF
+debugfs-$(CONFIG_CPU_SH4)      += cache-debugfs.o
 endif
 
 ifdef CONFIG_MMU
+debugfs-$(CONFIG_CPU_SH4)      += tlb-debugfs.o
 tlb-$(CONFIG_CPU_SH3)          := tlb-sh3.o
 tlb-$(CONFIG_CPU_SH4)          := tlb-sh4.o tlb-urb.o
 tlb-$(CONFIG_CPU_SH5)          := tlb-sh5.o
@@ -32,6 +34,7 @@ tlb-$(CONFIG_CPU_HAS_PTEAEX)  := tlb-pteaex.o tlb-urb.o
 obj-y                          += $(tlb-y)
 endif
 
+obj-$(CONFIG_DEBUG_FS)         += $(debugfs-y)
 obj-$(CONFIG_HUGETLB_PAGE)     += hugetlbpage.o
 obj-$(CONFIG_PMB)              += pmb.o
 obj-$(CONFIG_NUMA)             += numa.o
diff --git a/arch/sh/mm/cache-shx3.c b/arch/sh/mm/cache-shx3.c
new file mode 100644 (file)
index 0000000..c0adbee
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * arch/sh/mm/cache-shx3.c - SH-X3 optimized cache ops
+ *
+ * Copyright (C) 2010  Paul Mundt
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/io.h>
+#include <asm/cache.h>
+
+#define CCR_CACHE_SNM  0x40000         /* Hardware-assisted synonym avoidance */
+#define CCR_CACHE_IBE  0x1000000       /* ICBI broadcast */
+
+void __init shx3_cache_init(void)
+{
+       unsigned int ccr;
+
+       ccr = __raw_readl(CCR);
+
+       /*
+        * If we've got cache aliases, resolve them in hardware.
+        */
+       if (boot_cpu_data.dcache.n_aliases || boot_cpu_data.icache.n_aliases) {
+               ccr |= CCR_CACHE_SNM;
+
+               boot_cpu_data.icache.n_aliases = 0;
+               boot_cpu_data.dcache.n_aliases = 0;
+
+               pr_info("Enabling hardware synonym avoidance\n");
+       }
+
+#ifdef CONFIG_SMP
+       /*
+        * Broadcast I-cache block invalidations by default.
+        */
+       ccr |= CCR_CACHE_IBE;
+#endif
+
+       writel_uncached(ccr, CCR);
+}
index 0f4095d..ba401d1 100644 (file)
@@ -334,6 +334,13 @@ void __init cpu_cache_init(void)
                extern void __weak sh4_cache_init(void);
 
                sh4_cache_init();
+
+               if ((boot_cpu_data.type == CPU_SH7786) ||
+                   (boot_cpu_data.type == CPU_SHX3)) {
+                       extern void __weak shx3_cache_init(void);
+
+                       shx3_cache_init();
+               }
        }
 
        if (boot_cpu_data.family == CPU_FAMILY_SH5) {
index 8bf79e3..93c3447 100644 (file)
@@ -290,15 +290,10 @@ no_context:
  */
 out_of_memory:
        up_read(&mm->mmap_sem);
-       if (is_global_init(current)) {
-               yield();
-               down_read(&mm->mmap_sem);
-               goto survive;
-       }
-       printk("VM: killing process %s\n", tsk->comm);
-       if (user_mode(regs))
-               do_group_exit(SIGKILL);
-       goto no_context;
+       if (!user_mode(regs))
+               goto no_context;
+       pagefault_out_of_memory();
+       return;
 
 do_sigbus:
        up_read(&mm->mmap_sem);
index e43ec60..e9f5384 100644 (file)
@@ -680,7 +680,7 @@ static void __init pmb_merge(struct pmb_entry *head)
        /*
         * The merged page size must be valid.
         */
-       if (!pmb_size_valid(newsize))
+       if (!depth || !pmb_size_valid(newsize))
                return;
 
        head->flags &= ~PMB_SZ_MASK;
diff --git a/arch/sh/mm/tlb-debugfs.c b/arch/sh/mm/tlb-debugfs.c
new file mode 100644 (file)
index 0000000..229bf75
--- /dev/null
@@ -0,0 +1,179 @@
+/*
+ * arch/sh/mm/tlb-debugfs.c
+ *
+ * debugfs ops for SH-4 ITLB/UTLBs.
+ *
+ * Copyright (C) 2010  Matt Fleming
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/debugfs.h>
+#include <linux/seq_file.h>
+#include <asm/processor.h>
+#include <asm/mmu_context.h>
+#include <asm/tlbflush.h>
+
+enum tlb_type {
+       TLB_TYPE_ITLB,
+       TLB_TYPE_UTLB,
+};
+
+static struct {
+       int bits;
+       const char *size;
+} tlb_sizes[] = {
+       { 0x0, "  1KB" },
+       { 0x1, "  4KB" },
+       { 0x2, "  8KB" },
+       { 0x4, " 64KB" },
+       { 0x5, "256KB" },
+       { 0x7, "  1MB" },
+       { 0x8, "  4MB" },
+       { 0xc, " 64MB" },
+};
+
+static int tlb_seq_show(struct seq_file *file, void *iter)
+{
+       unsigned int tlb_type = (unsigned int)file->private;
+       unsigned long addr1, addr2, data1, data2;
+       unsigned long flags;
+       unsigned long mmucr;
+       unsigned int nentries, entry;
+       unsigned int urb;
+
+       mmucr = __raw_readl(MMUCR);
+       if ((mmucr & 0x1) == 0) {
+               seq_printf(file, "address translation disabled\n");
+               return 0;
+       }
+
+       if (tlb_type == TLB_TYPE_ITLB) {
+               addr1 = MMU_ITLB_ADDRESS_ARRAY;
+               addr2 = MMU_ITLB_ADDRESS_ARRAY2;
+               data1 = MMU_ITLB_DATA_ARRAY;
+               data2 = MMU_ITLB_DATA_ARRAY2;
+               nentries = 4;
+       } else {
+               addr1 = MMU_UTLB_ADDRESS_ARRAY;
+               addr2 = MMU_UTLB_ADDRESS_ARRAY2;
+               data1 = MMU_UTLB_DATA_ARRAY;
+               data2 = MMU_UTLB_DATA_ARRAY2;
+               nentries = 64;
+       }
+
+       local_irq_save(flags);
+       jump_to_uncached();
+
+       urb = (mmucr & MMUCR_URB) >> MMUCR_URB_SHIFT;
+
+       /* Make the "entry >= urb" test fail. */
+       if (urb == 0)
+               urb = MMUCR_URB_NENTRIES + 1;
+
+       if (tlb_type == TLB_TYPE_ITLB) {
+               addr1 = MMU_ITLB_ADDRESS_ARRAY;
+               addr2 = MMU_ITLB_ADDRESS_ARRAY2;
+               data1 = MMU_ITLB_DATA_ARRAY;
+               data2 = MMU_ITLB_DATA_ARRAY2;
+               nentries = 4;
+       } else {
+               addr1 = MMU_UTLB_ADDRESS_ARRAY;
+               addr2 = MMU_UTLB_ADDRESS_ARRAY2;
+               data1 = MMU_UTLB_DATA_ARRAY;
+               data2 = MMU_UTLB_DATA_ARRAY2;
+               nentries = 64;
+       }
+
+       seq_printf(file, "entry:     vpn        ppn     asid  size valid wired\n");
+
+       for (entry = 0; entry < nentries; entry++) {
+               unsigned long vpn, ppn, asid, size;
+               unsigned long valid;
+               unsigned long val;
+               const char *sz = "    ?";
+               int i;
+
+               val = __raw_readl(addr1 | (entry << MMU_TLB_ENTRY_SHIFT));
+               ctrl_barrier();
+               vpn = val & 0xfffffc00;
+               valid = val & 0x100;
+
+               val = __raw_readl(addr2 | (entry << MMU_TLB_ENTRY_SHIFT));
+               ctrl_barrier();
+               asid = val & MMU_CONTEXT_ASID_MASK;
+
+               val = __raw_readl(data1 | (entry << MMU_TLB_ENTRY_SHIFT));
+               ctrl_barrier();
+               ppn = (val & 0x0ffffc00) << 4;
+
+               val = __raw_readl(data2 | (entry << MMU_TLB_ENTRY_SHIFT));
+               ctrl_barrier();
+               size = (val & 0xf0) >> 4;
+
+               for (i = 0; i < ARRAY_SIZE(tlb_sizes); i++) {
+                       if (tlb_sizes[i].bits == size)
+                               break;
+               }
+
+               if (i != ARRAY_SIZE(tlb_sizes))
+                       sz = tlb_sizes[i].size;
+
+               seq_printf(file, "%2d:    0x%08lx 0x%08lx %5lu %s   %s     %s\n",
+                          entry, vpn, ppn, asid,
+                          sz, valid ? "V" : "-",
+                          (urb <= entry) ? "W" : "-");
+       }
+
+       back_to_cached();
+       local_irq_restore(flags);
+
+       return 0;
+}
+
+static int tlb_debugfs_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, tlb_seq_show, inode->i_private);
+}
+
+static const struct file_operations tlb_debugfs_fops = {
+       .owner          = THIS_MODULE,
+       .open           = tlb_debugfs_open,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+       .release        = single_release,
+};
+
+static int __init tlb_debugfs_init(void)
+{
+       struct dentry *itlb, *utlb;
+
+       itlb = debugfs_create_file("itlb", S_IRUSR, sh_debugfs_root,
+                                  (unsigned int *)TLB_TYPE_ITLB,
+                                  &tlb_debugfs_fops);
+       if (unlikely(!itlb))
+               return -ENOMEM;
+       if (IS_ERR(itlb))
+               return PTR_ERR(itlb);
+
+       utlb = debugfs_create_file("utlb", S_IRUSR, sh_debugfs_root,
+                                  (unsigned int *)TLB_TYPE_UTLB,
+                                  &tlb_debugfs_fops);
+       if (unlikely(!utlb)) {
+               debugfs_remove(itlb);
+               return -ENOMEM;
+       }
+
+       if (IS_ERR(utlb)) {
+               debugfs_remove(itlb);
+               return PTR_ERR(utlb);
+       }
+
+       return 0;
+}
+module_init(tlb_debugfs_init);
+
+MODULE_LICENSE("GPL v2");
index 706da1d..25bd64c 100644 (file)
@@ -294,22 +294,11 @@ no_context:
  * us unable to handle the page fault gracefully.
  */
 out_of_memory:
-       if (is_global_init(current)) {
-               panic("INIT out of memory\n");
-               yield();
-               goto survive;
-       }
-       printk("fault:Out of memory\n");
        up_read(&mm->mmap_sem);
-       if (is_global_init(current)) {
-               yield();
-               down_read(&mm->mmap_sem);
-               goto survive;
-       }
-       printk("VM: killing process %s\n", tsk->comm);
-       if (user_mode(regs))
-               do_group_exit(SIGKILL);
-       goto no_context;
+       if (!user_mode(regs))
+               goto no_context;
+       pagefault_out_of_memory();
+       return;
 
 do_sigbus:
        printk("fault:Do sigbus\n");
index 4b4b565..d10230a 100644 (file)
@@ -1254,6 +1254,26 @@ static int __init early_platform_driver_probe_id(char *class_str,
                }
 
                if (match) {
+                       /*
+                        * Set up a sensible init_name to enable
+                        * dev_name() and others to be used before the
+                        * rest of the driver core is initialized.
+                        */
+                       if (!match->dev.init_name) {
+                               if (match->id != -1)
+                                       match->dev.init_name =
+                                               kasprintf(GFP_KERNEL, "%s.%d",
+                                                         match->name,
+                                                         match->id);
+                               else
+                                       match->dev.init_name =
+                                               kasprintf(GFP_KERNEL, "%s",
+                                                         match->name);
+
+                               if (!match->dev.init_name)
+                                       return -ENOMEM;
+                       }
+
                        if (epdrv->pdrv->probe(match))
                                pr_warning("%s: unable to probe %s early.\n",
                                           class_str, match->name);
index 744f748..f6677cb 100644 (file)
@@ -150,13 +150,12 @@ static void sh_cmt_start_stop_ch(struct sh_cmt_priv *p, int start)
 
 static int sh_cmt_enable(struct sh_cmt_priv *p, unsigned long *rate)
 {
-       struct sh_timer_config *cfg = p->pdev->dev.platform_data;
        int ret;
 
        /* enable clock */
        ret = clk_enable(p->clk);
        if (ret) {
-               pr_err("sh_cmt: cannot enable clock \"%s\"\n", cfg->clk);
+               dev_err(&p->pdev->dev, "cannot enable clock\n");
                return ret;
        }
 
@@ -279,7 +278,7 @@ static void sh_cmt_clock_event_program_verify(struct sh_cmt_priv *p,
                        delay = 1;
 
                if (!delay)
-                       pr_warning("sh_cmt: too long delay\n");
+                       dev_warn(&p->pdev->dev, "too long delay\n");
 
        } while (delay);
 }
@@ -289,7 +288,7 @@ static void sh_cmt_set_next(struct sh_cmt_priv *p, unsigned long delta)
        unsigned long flags;
 
        if (delta > p->max_match_value)
-               pr_warning("sh_cmt: delta out of range\n");
+               dev_warn(&p->pdev->dev, "delta out of range\n");
 
        spin_lock_irqsave(&p->lock, flags);
        p->next_match_value = delta;
@@ -451,7 +450,7 @@ static int sh_cmt_register_clocksource(struct sh_cmt_priv *p,
        cs->resume = sh_cmt_clocksource_resume;
        cs->mask = CLOCKSOURCE_MASK(sizeof(unsigned long) * 8);
        cs->flags = CLOCK_SOURCE_IS_CONTINUOUS;
-       pr_info("sh_cmt: %s used as clock source\n", cs->name);
+       dev_info(&p->pdev->dev, "used as clock source\n");
        clocksource_register(cs);
        return 0;
 }
@@ -497,13 +496,11 @@ static void sh_cmt_clock_event_mode(enum clock_event_mode mode,
 
        switch (mode) {
        case CLOCK_EVT_MODE_PERIODIC:
-               pr_info("sh_cmt: %s used for periodic clock events\n",
-                       ced->name);
+               dev_info(&p->pdev->dev, "used for periodic clock events\n");
                sh_cmt_clock_event_start(p, 1);
                break;
        case CLOCK_EVT_MODE_ONESHOT:
-               pr_info("sh_cmt: %s used for oneshot clock events\n",
-                       ced->name);
+               dev_info(&p->pdev->dev, "used for oneshot clock events\n");
                sh_cmt_clock_event_start(p, 0);
                break;
        case CLOCK_EVT_MODE_SHUTDOWN:
@@ -544,7 +541,7 @@ static void sh_cmt_register_clockevent(struct sh_cmt_priv *p,
        ced->set_next_event = sh_cmt_clock_event_next;
        ced->set_mode = sh_cmt_clock_event_mode;
 
-       pr_info("sh_cmt: %s used for clock events\n", ced->name);
+       dev_info(&p->pdev->dev, "used for clock events\n");
        clockevents_register_device(ced);
 }
 
@@ -601,22 +598,27 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev)
        /* map memory, let mapbase point to our channel */
        p->mapbase = ioremap_nocache(res->start, resource_size(res));
        if (p->mapbase == NULL) {
-               pr_err("sh_cmt: failed to remap I/O memory\n");
+               dev_err(&p->pdev->dev, "failed to remap I/O memory\n");
                goto err0;
        }
 
        /* request irq using setup_irq() (too early for request_irq()) */
-       p->irqaction.name = cfg->name;
+       p->irqaction.name = dev_name(&p->pdev->dev);
        p->irqaction.handler = sh_cmt_interrupt;
        p->irqaction.dev_id = p;
-       p->irqaction.flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL;
+       p->irqaction.flags = IRQF_DISABLED | IRQF_TIMER | \
+                            IRQF_IRQPOLL  | IRQF_NOBALANCING;
 
        /* get hold of clock */
-       p->clk = clk_get(&p->pdev->dev, cfg->clk);
+       p->clk = clk_get(&p->pdev->dev, "cmt_fck");
        if (IS_ERR(p->clk)) {
-               pr_err("sh_cmt: cannot get clock \"%s\"\n", cfg->clk);
-               ret = PTR_ERR(p->clk);
-               goto err1;
+               dev_warn(&p->pdev->dev, "using deprecated clock lookup\n");
+               p->clk = clk_get(&p->pdev->dev, cfg->clk);
+               if (IS_ERR(p->clk)) {
+                       dev_err(&p->pdev->dev, "cannot get clock\n");
+                       ret = PTR_ERR(p->clk);
+                       goto err1;
+               }
        }
 
        if (resource_size(res) == 6) {
@@ -629,17 +631,17 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev)
                p->clear_bits = ~0xc000;
        }
 
-       ret = sh_cmt_register(p, cfg->name,
+       ret = sh_cmt_register(p, (char *)dev_name(&p->pdev->dev),
                              cfg->clockevent_rating,
                              cfg->clocksource_rating);
        if (ret) {
-               pr_err("sh_cmt: registration failed\n");
+               dev_err(&p->pdev->dev, "registration failed\n");
                goto err1;
        }
 
        ret = setup_irq(irq, &p->irqaction);
        if (ret) {
-               pr_err("sh_cmt: failed to request irq %d\n", irq);
+               dev_err(&p->pdev->dev, "failed to request irq %d\n", irq);
                goto err1;
        }
 
@@ -654,11 +656,10 @@ err0:
 static int __devinit sh_cmt_probe(struct platform_device *pdev)
 {
        struct sh_cmt_priv *p = platform_get_drvdata(pdev);
-       struct sh_timer_config *cfg = pdev->dev.platform_data;
        int ret;
 
        if (p) {
-               pr_info("sh_cmt: %s kept as earlytimer\n", cfg->name);
+               dev_info(&pdev->dev, "kept as earlytimer\n");
                return 0;
        }
 
index 5fb78bf..ef7a5be 100644 (file)
@@ -119,13 +119,12 @@ static void sh_mtu2_start_stop_ch(struct sh_mtu2_priv *p, int start)
 
 static int sh_mtu2_enable(struct sh_mtu2_priv *p)
 {
-       struct sh_timer_config *cfg = p->pdev->dev.platform_data;
        int ret;
 
        /* enable clock */
        ret = clk_enable(p->clk);
        if (ret) {
-               pr_err("sh_mtu2: cannot enable clock \"%s\"\n", cfg->clk);
+               dev_err(&p->pdev->dev, "cannot enable clock\n");
                return ret;
        }
 
@@ -194,8 +193,7 @@ static void sh_mtu2_clock_event_mode(enum clock_event_mode mode,
 
        switch (mode) {
        case CLOCK_EVT_MODE_PERIODIC:
-               pr_info("sh_mtu2: %s used for periodic clock events\n",
-                       ced->name);
+               dev_info(&p->pdev->dev, "used for periodic clock events\n");
                sh_mtu2_enable(p);
                break;
        case CLOCK_EVT_MODE_UNUSED:
@@ -222,13 +220,13 @@ static void sh_mtu2_register_clockevent(struct sh_mtu2_priv *p,
        ced->cpumask = cpumask_of(0);
        ced->set_mode = sh_mtu2_clock_event_mode;
 
-       pr_info("sh_mtu2: %s used for clock events\n", ced->name);
+       dev_info(&p->pdev->dev, "used for clock events\n");
        clockevents_register_device(ced);
 
        ret = setup_irq(p->irqaction.irq, &p->irqaction);
        if (ret) {
-               pr_err("sh_mtu2: failed to request irq %d\n",
-                      p->irqaction.irq);
+               dev_err(&p->pdev->dev, "failed to request irq %d\n",
+                       p->irqaction.irq);
                return;
        }
 }
@@ -274,26 +272,32 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev)
        /* map memory, let mapbase point to our channel */
        p->mapbase = ioremap_nocache(res->start, resource_size(res));
        if (p->mapbase == NULL) {
-               pr_err("sh_mtu2: failed to remap I/O memory\n");
+               dev_err(&p->pdev->dev, "failed to remap I/O memory\n");
                goto err0;
        }
 
        /* setup data for setup_irq() (too early for request_irq()) */
-       p->irqaction.name = cfg->name;
+       p->irqaction.name = dev_name(&p->pdev->dev);
        p->irqaction.handler = sh_mtu2_interrupt;
        p->irqaction.dev_id = p;
        p->irqaction.irq = irq;
-       p->irqaction.flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL;
+       p->irqaction.flags = IRQF_DISABLED | IRQF_TIMER | \
+                            IRQF_IRQPOLL  | IRQF_NOBALANCING;
 
        /* get hold of clock */
-       p->clk = clk_get(&p->pdev->dev, cfg->clk);
+       p->clk = clk_get(&p->pdev->dev, "mtu2_fck");
        if (IS_ERR(p->clk)) {
-               pr_err("sh_mtu2: cannot get clock \"%s\"\n", cfg->clk);
-               ret = PTR_ERR(p->clk);
-               goto err1;
+               dev_warn(&p->pdev->dev, "using deprecated clock lookup\n");
+               p->clk = clk_get(&p->pdev->dev, cfg->clk);
+               if (IS_ERR(p->clk)) {
+                       dev_err(&p->pdev->dev, "cannot get clock\n");
+                       ret = PTR_ERR(p->clk);
+                       goto err1;
+               }
        }
 
-       return sh_mtu2_register(p, cfg->name, cfg->clockevent_rating);
+       return sh_mtu2_register(p, (char *)dev_name(&p->pdev->dev),
+                               cfg->clockevent_rating);
  err1:
        iounmap(p->mapbase);
  err0:
@@ -303,11 +307,10 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev)
 static int __devinit sh_mtu2_probe(struct platform_device *pdev)
 {
        struct sh_mtu2_priv *p = platform_get_drvdata(pdev);
-       struct sh_timer_config *cfg = pdev->dev.platform_data;
        int ret;
 
        if (p) {
-               pr_info("sh_mtu2: %s kept as earlytimer\n", cfg->name);
+               dev_info(&pdev->dev, "kept as earlytimer\n");
                return 0;
        }
 
index fc9ff1e..8e44e14 100644 (file)
@@ -107,13 +107,12 @@ static void sh_tmu_start_stop_ch(struct sh_tmu_priv *p, int start)
 
 static int sh_tmu_enable(struct sh_tmu_priv *p)
 {
-       struct sh_timer_config *cfg = p->pdev->dev.platform_data;
        int ret;
 
        /* enable clock */
        ret = clk_enable(p->clk);
        if (ret) {
-               pr_err("sh_tmu: cannot enable clock \"%s\"\n", cfg->clk);
+               dev_err(&p->pdev->dev, "cannot enable clock\n");
                return ret;
        }
 
@@ -229,7 +228,7 @@ static int sh_tmu_register_clocksource(struct sh_tmu_priv *p,
        cs->disable = sh_tmu_clocksource_disable;
        cs->mask = CLOCKSOURCE_MASK(32);
        cs->flags = CLOCK_SOURCE_IS_CONTINUOUS;
-       pr_info("sh_tmu: %s used as clock source\n", cs->name);
+       dev_info(&p->pdev->dev, "used as clock source\n");
        clocksource_register(cs);
        return 0;
 }
@@ -277,13 +276,11 @@ static void sh_tmu_clock_event_mode(enum clock_event_mode mode,
 
        switch (mode) {
        case CLOCK_EVT_MODE_PERIODIC:
-               pr_info("sh_tmu: %s used for periodic clock events\n",
-                       ced->name);
+               dev_info(&p->pdev->dev, "used for periodic clock events\n");
                sh_tmu_clock_event_start(p, 1);
                break;
        case CLOCK_EVT_MODE_ONESHOT:
-               pr_info("sh_tmu: %s used for oneshot clock events\n",
-                       ced->name);
+               dev_info(&p->pdev->dev, "used for oneshot clock events\n");
                sh_tmu_clock_event_start(p, 0);
                break;
        case CLOCK_EVT_MODE_UNUSED:
@@ -324,13 +321,13 @@ static void sh_tmu_register_clockevent(struct sh_tmu_priv *p,
        ced->set_next_event = sh_tmu_clock_event_next;
        ced->set_mode = sh_tmu_clock_event_mode;
 
-       pr_info("sh_tmu: %s used for clock events\n", ced->name);
+       dev_info(&p->pdev->dev, "used for clock events\n");
        clockevents_register_device(ced);
 
        ret = setup_irq(p->irqaction.irq, &p->irqaction);
        if (ret) {
-               pr_err("sh_tmu: failed to request irq %d\n",
-                      p->irqaction.irq);
+               dev_err(&p->pdev->dev, "failed to request irq %d\n",
+                       p->irqaction.irq);
                return;
        }
 }
@@ -379,26 +376,31 @@ static int sh_tmu_setup(struct sh_tmu_priv *p, struct platform_device *pdev)
        /* map memory, let mapbase point to our channel */
        p->mapbase = ioremap_nocache(res->start, resource_size(res));
        if (p->mapbase == NULL) {
-               pr_err("sh_tmu: failed to remap I/O memory\n");
+               dev_err(&p->pdev->dev, "failed to remap I/O memory\n");
                goto err0;
        }
 
        /* setup data for setup_irq() (too early for request_irq()) */
-       p->irqaction.name = cfg->name;
+       p->irqaction.name = dev_name(&p->pdev->dev);
        p->irqaction.handler = sh_tmu_interrupt;
        p->irqaction.dev_id = p;
        p->irqaction.irq = irq;
-       p->irqaction.flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL;
+       p->irqaction.flags = IRQF_DISABLED | IRQF_TIMER | \
+                            IRQF_IRQPOLL  | IRQF_NOBALANCING;
 
        /* get hold of clock */
-       p->clk = clk_get(&p->pdev->dev, cfg->clk);
+       p->clk = clk_get(&p->pdev->dev, "tmu_fck");
        if (IS_ERR(p->clk)) {
-               pr_err("sh_tmu: cannot get clock \"%s\"\n", cfg->clk);
-               ret = PTR_ERR(p->clk);
-               goto err1;
+               dev_warn(&p->pdev->dev, "using deprecated clock lookup\n");
+               p->clk = clk_get(&p->pdev->dev, cfg->clk);
+               if (IS_ERR(p->clk)) {
+                       dev_err(&p->pdev->dev, "cannot get clock\n");
+                       ret = PTR_ERR(p->clk);
+                       goto err1;
+               }
        }
 
-       return sh_tmu_register(p, cfg->name,
+       return sh_tmu_register(p, (char *)dev_name(&p->pdev->dev),
                               cfg->clockevent_rating,
                               cfg->clocksource_rating);
  err1:
@@ -410,11 +412,10 @@ static int sh_tmu_setup(struct sh_tmu_priv *p, struct platform_device *pdev)
 static int __devinit sh_tmu_probe(struct platform_device *pdev)
 {
        struct sh_tmu_priv *p = platform_get_drvdata(pdev);
-       struct sh_timer_config *cfg = pdev->dev.platform_data;
        int ret;
 
        if (p) {
-               pr_info("sh_tmu: %s kept as earlytimer\n", cfg->name);
+               dev_info(&pdev->dev, "kept as earlytimer\n");
                return 0;
        }
 
index 6f25a20..323afef 100644 (file)
@@ -26,8 +26,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
-
-#include <asm/dmaengine.h>
+#include <linux/sh_dma.h>
 
 #include "shdma.h"
 
@@ -45,7 +44,7 @@ enum sh_dmae_desc_status {
 #define LOG2_DEFAULT_XFER_SIZE 2
 
 /* A bitmask with bits enough for enum sh_dmae_slave_chan_id */
-static unsigned long sh_dmae_slave_used[BITS_TO_LONGS(SHDMA_SLAVE_NUMBER)];
+static unsigned long sh_dmae_slave_used[BITS_TO_LONGS(SH_DMA_SLAVE_NUMBER)];
 
 static void sh_dmae_chan_ld_cleanup(struct sh_dmae_chan *sh_chan, bool all);
 
@@ -190,7 +189,7 @@ static int dmae_set_dmars(struct sh_dmae_chan *sh_chan, u16 val)
        struct sh_dmae_device *shdev = container_of(sh_chan->common.device,
                                                struct sh_dmae_device, common);
        struct sh_dmae_pdata *pdata = shdev->pdata;
-       struct sh_dmae_channel *chan_pdata = &pdata->channel[sh_chan->id];
+       const struct sh_dmae_channel *chan_pdata = &pdata->channel[sh_chan->id];
        u16 __iomem *addr = shdev->dmars + chan_pdata->dmars / sizeof(u16);
        int shift = chan_pdata->dmars_bit;
 
@@ -266,8 +265,8 @@ static struct sh_desc *sh_dmae_get_desc(struct sh_dmae_chan *sh_chan)
        return NULL;
 }
 
-static struct sh_dmae_slave_config *sh_dmae_find_slave(
-       struct sh_dmae_chan *sh_chan, enum sh_dmae_slave_chan_id slave_id)
+static const struct sh_dmae_slave_config *sh_dmae_find_slave(
+       struct sh_dmae_chan *sh_chan, struct sh_dmae_slave *param)
 {
        struct dma_device *dma_dev = sh_chan->common.device;
        struct sh_dmae_device *shdev = container_of(dma_dev,
@@ -275,11 +274,11 @@ static struct sh_dmae_slave_config *sh_dmae_find_slave(
        struct sh_dmae_pdata *pdata = shdev->pdata;
        int i;
 
-       if ((unsigned)slave_id >= SHDMA_SLAVE_NUMBER)
+       if (param->slave_id >= SH_DMA_SLAVE_NUMBER)
                return NULL;
 
        for (i = 0; i < pdata->slave_num; i++)
-               if (pdata->slave[i].slave_id == slave_id)
+               if (pdata->slave[i].slave_id == param->slave_id)
                        return pdata->slave + i;
 
        return NULL;
@@ -299,9 +298,9 @@ static int sh_dmae_alloc_chan_resources(struct dma_chan *chan)
         * never runs concurrently with itself or free_chan_resources.
         */
        if (param) {
-               struct sh_dmae_slave_config *cfg;
+               const struct sh_dmae_slave_config *cfg;
 
-               cfg = sh_dmae_find_slave(sh_chan, param->slave_id);
+               cfg = sh_dmae_find_slave(sh_chan, param);
                if (!cfg) {
                        ret = -EINVAL;
                        goto efindslave;
@@ -574,12 +573,14 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_slave_sg(
 {
        struct sh_dmae_slave *param;
        struct sh_dmae_chan *sh_chan;
+       dma_addr_t slave_addr;
 
        if (!chan)
                return NULL;
 
        sh_chan = to_sh_chan(chan);
        param = chan->private;
+       slave_addr = param->config->addr;
 
        /* Someone calling slave DMA on a public channel? */
        if (!param || !sg_len) {
@@ -592,7 +593,7 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_slave_sg(
         * if (param != NULL), this is a successfully requested slave channel,
         * therefore param->config != NULL too.
         */
-       return sh_dmae_prep_sg(sh_chan, sgl, sg_len, &param->config->addr,
+       return sh_dmae_prep_sg(sh_chan, sgl, sg_len, &slave_addr,
                               direction, flags);
 }
 
@@ -873,7 +874,7 @@ static int __devinit sh_dmae_chan_probe(struct sh_dmae_device *shdev, int id,
                                        int irq, unsigned long flags)
 {
        int err;
-       struct sh_dmae_channel *chan_pdata = &shdev->pdata->channel[id];
+       const struct sh_dmae_channel *chan_pdata = &shdev->pdata->channel[id];
        struct platform_device *pdev = to_platform_device(shdev->common.dev);
        struct sh_dmae_chan *new_sh_chan;
 
index 153609a..4021275 100644 (file)
@@ -17,8 +17,8 @@
 #include <linux/interrupt.h>
 #include <linux/list.h>
 
-#include <asm/dmaengine.h>
-
+#define SH_DMAC_MAX_CHANNELS 6
+#define SH_DMA_SLAVE_NUMBER 256
 #define SH_DMA_TCR_MAX 0x00FFFFFF      /* 16MB */
 
 struct device;
index 8eb094c..8d993c4 100644 (file)
@@ -83,16 +83,16 @@ struct sci_port {
 
        /* Interface clock */
        struct clk              *iclk;
-       /* Data clock */
-       struct clk              *dclk;
+       /* Function clock */
+       struct clk              *fclk;
 
        struct list_head        node;
        struct dma_chan                 *chan_tx;
        struct dma_chan                 *chan_rx;
 #ifdef CONFIG_SERIAL_SH_SCI_DMA
        struct device                   *dma_dev;
-       enum sh_dmae_slave_chan_id      slave_tx;
-       enum sh_dmae_slave_chan_id      slave_rx;
+       unsigned int                    slave_tx;
+       unsigned int                    slave_rx;
        struct dma_async_tx_descriptor  *desc_tx;
        struct dma_async_tx_descriptor  *desc_rx[2];
        dma_cookie_t                    cookie_tx;
@@ -107,6 +107,7 @@ struct sci_port {
        struct work_struct              work_tx;
        struct work_struct              work_rx;
        struct timer_list               rx_timer;
+       unsigned int                    rx_timeout;
 #endif
 };
 
@@ -674,22 +675,22 @@ static irqreturn_t sci_rx_interrupt(int irq, void *ptr)
        struct sci_port *s = to_sci_port(port);
 
        if (s->chan_rx) {
-               unsigned long tout;
                u16 scr = sci_in(port, SCSCR);
                u16 ssr = sci_in(port, SCxSR);
 
                /* Disable future Rx interrupts */
-               sci_out(port, SCSCR, scr & ~SCI_CTRL_FLAGS_RIE);
+               if (port->type == PORT_SCIFA) {
+                       disable_irq_nosync(irq);
+                       scr |= 0x4000;
+               } else {
+                       scr &= ~SCI_CTRL_FLAGS_RIE;
+               }
+               sci_out(port, SCSCR, scr);
                /* Clear current interrupt */
                sci_out(port, SCxSR, ssr & ~(1 | SCxSR_RDxF(port)));
-               /* Calculate delay for 1.5 DMA buffers */
-               tout = (port->timeout - HZ / 50) * s->buf_len_rx * 3 /
-                       port->fifosize / 2;
-               dev_dbg(port->dev, "Rx IRQ: setup timeout in %lu ms\n",
-                       tout * 1000 / HZ);
-               if (tout < 2)
-                       tout = 2;
-               mod_timer(&s->rx_timer, jiffies + tout);
+               dev_dbg(port->dev, "Rx IRQ %lu: setup t-out in %u jiffies\n",
+                       jiffies, s->rx_timeout);
+               mod_timer(&s->rx_timer, jiffies + s->rx_timeout);
 
                return IRQ_HANDLED;
        }
@@ -799,7 +800,7 @@ static int sci_notifier(struct notifier_block *self,
            (phase == CPUFREQ_RESUMECHANGE)) {
                spin_lock_irqsave(&priv->lock, flags);
                list_for_each_entry(sci_port, &priv->ports, node)
-                       sci_port->port.uartclk = clk_get_rate(sci_port->dclk);
+                       sci_port->port.uartclk = clk_get_rate(sci_port->iclk);
                spin_unlock_irqrestore(&priv->lock, flags);
        }
 
@@ -810,21 +811,17 @@ static void sci_clk_enable(struct uart_port *port)
 {
        struct sci_port *sci_port = to_sci_port(port);
 
-       clk_enable(sci_port->dclk);
-       sci_port->port.uartclk = clk_get_rate(sci_port->dclk);
-
-       if (sci_port->iclk)
-               clk_enable(sci_port->iclk);
+       clk_enable(sci_port->iclk);
+       sci_port->port.uartclk = clk_get_rate(sci_port->iclk);
+       clk_enable(sci_port->fclk);
 }
 
 static void sci_clk_disable(struct uart_port *port)
 {
        struct sci_port *sci_port = to_sci_port(port);
 
-       if (sci_port->iclk)
-               clk_disable(sci_port->iclk);
-
-       clk_disable(sci_port->dclk);
+       clk_disable(sci_port->fclk);
+       clk_disable(sci_port->iclk);
 }
 
 static int sci_request_irq(struct sci_port *port)
@@ -913,22 +910,26 @@ static void sci_dma_tx_complete(void *arg)
 
        spin_lock_irqsave(&port->lock, flags);
 
-       xmit->tail += s->sg_tx.length;
+       xmit->tail += sg_dma_len(&s->sg_tx);
        xmit->tail &= UART_XMIT_SIZE - 1;
 
-       port->icount.tx += s->sg_tx.length;
+       port->icount.tx += sg_dma_len(&s->sg_tx);
 
        async_tx_ack(s->desc_tx);
        s->cookie_tx = -EINVAL;
        s->desc_tx = NULL;
 
-       spin_unlock_irqrestore(&port->lock, flags);
-
        if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
                uart_write_wakeup(port);
 
-       if (uart_circ_chars_pending(xmit))
+       if (!uart_circ_empty(xmit)) {
                schedule_work(&s->work_tx);
+       } else if (port->type == PORT_SCIFA) {
+               u16 ctrl = sci_in(port, SCSCR);
+               sci_out(port, SCSCR, ctrl & ~SCI_CTRL_FLAGS_TIE);
+       }
+
+       spin_unlock_irqrestore(&port->lock, flags);
 }
 
 /* Locking: called with port lock held */
@@ -972,13 +973,13 @@ static void sci_dma_rx_complete(void *arg)
        unsigned long flags;
        int count;
 
-       dev_dbg(port->dev, "%s(%d)\n", __func__, port->line);
+       dev_dbg(port->dev, "%s(%d) active #%d\n", __func__, port->line, s->active_rx);
 
        spin_lock_irqsave(&port->lock, flags);
 
        count = sci_dma_rx_push(s, tty, s->buf_len_rx);
 
-       mod_timer(&s->rx_timer, jiffies + msecs_to_jiffies(5));
+       mod_timer(&s->rx_timer, jiffies + s->rx_timeout);
 
        spin_unlock_irqrestore(&port->lock, flags);
 
@@ -1050,6 +1051,8 @@ static void sci_submit_rx(struct sci_port *s)
                        sci_rx_dma_release(s, true);
                        return;
                }
+               dev_dbg(s->port.dev, "%s(): cookie %d to #%d\n", __func__,
+                       s->cookie_rx[i], i);
        }
 
        s->active_rx = s->cookie_rx[0];
@@ -1107,10 +1110,10 @@ static void work_fn_rx(struct work_struct *work)
                return;
        }
 
-       dev_dbg(port->dev, "%s: cookie %d #%d\n", __func__,
-               s->cookie_rx[new], new);
-
        s->active_rx = s->cookie_rx[!new];
+
+       dev_dbg(port->dev, "%s: cookie %d #%d, new active #%d\n", __func__,
+               s->cookie_rx[new], new, s->active_rx);
 }
 
 static void work_fn_tx(struct work_struct *work)
@@ -1131,14 +1134,13 @@ static void work_fn_tx(struct work_struct *work)
         */
        spin_lock_irq(&port->lock);
        sg->offset = xmit->tail & (UART_XMIT_SIZE - 1);
-       sg->dma_address = (sg_dma_address(sg) & ~(UART_XMIT_SIZE - 1)) +
+       sg_dma_address(sg) = (sg_dma_address(sg) & ~(UART_XMIT_SIZE - 1)) +
                sg->offset;
-       sg->length = min((int)CIRC_CNT(xmit->head, xmit->tail, UART_XMIT_SIZE),
+       sg_dma_len(sg) = min((int)CIRC_CNT(xmit->head, xmit->tail, UART_XMIT_SIZE),
                CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE));
-       sg->dma_length = sg->length;
        spin_unlock_irq(&port->lock);
 
-       BUG_ON(!sg->length);
+       BUG_ON(!sg_dma_len(sg));
 
        desc = chan->device->device_prep_slave_sg(chan,
                        sg, s->sg_len_tx, DMA_TO_DEVICE,
@@ -1173,23 +1175,28 @@ static void work_fn_tx(struct work_struct *work)
 
 static void sci_start_tx(struct uart_port *port)
 {
+       struct sci_port *s = to_sci_port(port);
        unsigned short ctrl;
 
 #ifdef CONFIG_SERIAL_SH_SCI_DMA
-       struct sci_port *s = to_sci_port(port);
-
-       if (s->chan_tx) {
-               if (!uart_circ_empty(&s->port.state->xmit) && s->cookie_tx < 0)
-                       schedule_work(&s->work_tx);
-
-               return;
+       if (port->type == PORT_SCIFA) {
+               u16 new, scr = sci_in(port, SCSCR);
+               if (s->chan_tx)
+                       new = scr | 0x8000;
+               else
+                       new = scr & ~0x8000;
+               if (new != scr)
+                       sci_out(port, SCSCR, new);
        }
+       if (s->chan_tx && !uart_circ_empty(&s->port.state->xmit) &&
+           s->cookie_tx < 0)
+               schedule_work(&s->work_tx);
 #endif
-
-       /* Set TIE (Transmit Interrupt Enable) bit in SCSCR */
-       ctrl = sci_in(port, SCSCR);
-       ctrl |= SCI_CTRL_FLAGS_TIE;
-       sci_out(port, SCSCR, ctrl);
+       if (!s->chan_tx || port->type == PORT_SCIFA) {
+               /* Set TIE (Transmit Interrupt Enable) bit in SCSCR */
+               ctrl = sci_in(port, SCSCR);
+               sci_out(port, SCSCR, ctrl | SCI_CTRL_FLAGS_TIE);
+       }
 }
 
 static void sci_stop_tx(struct uart_port *port)
@@ -1198,6 +1205,8 @@ static void sci_stop_tx(struct uart_port *port)
 
        /* Clear TIE (Transmit Interrupt Enable) bit in SCSCR */
        ctrl = sci_in(port, SCSCR);
+       if (port->type == PORT_SCIFA)
+               ctrl &= ~0x8000;
        ctrl &= ~SCI_CTRL_FLAGS_TIE;
        sci_out(port, SCSCR, ctrl);
 }
@@ -1208,6 +1217,8 @@ static void sci_start_rx(struct uart_port *port)
 
        /* Set RIE (Receive Interrupt Enable) bit in SCSCR */
        ctrl |= sci_in(port, SCSCR);
+       if (port->type == PORT_SCIFA)
+               ctrl &= ~0x4000;
        sci_out(port, SCSCR, ctrl);
 }
 
@@ -1217,6 +1228,8 @@ static void sci_stop_rx(struct uart_port *port)
 
        /* Clear RIE (Receive Interrupt Enable) bit in SCSCR */
        ctrl = sci_in(port, SCSCR);
+       if (port->type == PORT_SCIFA)
+               ctrl &= ~0x4000;
        ctrl &= ~(SCI_CTRL_FLAGS_RIE | SCI_CTRL_FLAGS_REIE);
        sci_out(port, SCSCR, ctrl);
 }
@@ -1251,8 +1264,12 @@ static void rx_timer_fn(unsigned long arg)
 {
        struct sci_port *s = (struct sci_port *)arg;
        struct uart_port *port = &s->port;
-
        u16 scr = sci_in(port, SCSCR);
+
+       if (port->type == PORT_SCIFA) {
+               scr &= ~0x4000;
+               enable_irq(s->irqs[1]);
+       }
        sci_out(port, SCSCR, scr | SCI_CTRL_FLAGS_RIE);
        dev_dbg(port->dev, "DMA Rx timed out\n");
        schedule_work(&s->work_rx);
@@ -1339,8 +1356,7 @@ static void sci_request_dma(struct uart_port *port)
                        sg_init_table(sg, 1);
                        sg_set_page(sg, virt_to_page(buf[i]), s->buf_len_rx,
                                    (int)buf[i] & ~PAGE_MASK);
-                       sg->dma_address = dma[i];
-                       sg->dma_length = sg->length;
+                       sg_dma_address(sg) = dma[i];
                }
 
                INIT_WORK(&s->work_rx, work_fn_rx);
@@ -1403,8 +1419,12 @@ static void sci_shutdown(struct uart_port *port)
 static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
                            struct ktermios *old)
 {
+#ifdef CONFIG_SERIAL_SH_SCI_DMA
+       struct sci_port *s = to_sci_port(port);
+#endif
        unsigned int status, baud, smr_val, max_baud;
        int t = -1;
+       u16 scfcr = 0;
 
        /*
         * earlyprintk comes here early on with port->uartclk set to zero.
@@ -1427,7 +1447,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
        sci_out(port, SCSCR, 0x00);     /* TE=0, RE=0, CKE1=0 */
 
        if (port->type != PORT_SCI)
-               sci_out(port, SCFCR, SCFCR_RFRST | SCFCR_TFRST);
+               sci_out(port, SCFCR, scfcr | SCFCR_RFRST | SCFCR_TFRST);
 
        smr_val = sci_in(port, SCSMR) & 3;
        if ((termios->c_cflag & CSIZE) == CS7)
@@ -1458,10 +1478,32 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
        }
 
        sci_init_pins(port, termios->c_cflag);
-       sci_out(port, SCFCR, (termios->c_cflag & CRTSCTS) ? SCFCR_MCE : 0);
+       sci_out(port, SCFCR, scfcr | ((termios->c_cflag & CRTSCTS) ? SCFCR_MCE : 0));
 
        sci_out(port, SCSCR, SCSCR_INIT(port));
 
+#ifdef CONFIG_SERIAL_SH_SCI_DMA
+       /*
+        * Calculate delay for 1.5 DMA buffers: see
+        * drivers/serial/serial_core.c::uart_update_timeout(). With 10 bits
+        * (CS8), 250Hz, 115200 baud and 64 bytes FIFO, the above function
+        * calculates 1 jiffie for the data plus 5 jiffies for the "slop(e)."
+        * Then below we calculate 3 jiffies (12ms) for 1.5 DMA buffers (3 FIFO
+        * sizes), but it has been found out experimentally, that this is not
+        * enough: the driver too often needlessly runs on a DMA timeout. 20ms
+        * as a minimum seem to work perfectly.
+        */
+       if (s->chan_rx) {
+               s->rx_timeout = (port->timeout - HZ / 50) * s->buf_len_rx * 3 /
+                       port->fifosize / 2;
+               dev_dbg(port->dev,
+                       "DMA Rx t-out %ums, tty t-out %u jiffies\n",
+                       s->rx_timeout * 1000 / HZ, port->timeout);
+               if (s->rx_timeout < msecs_to_jiffies(20))
+                       s->rx_timeout = msecs_to_jiffies(20);
+       }
+#endif
+
        if ((termios->c_cflag & CREAD) != 0)
                sci_start_rx(port);
 }
@@ -1553,10 +1595,10 @@ static struct uart_ops sci_uart_ops = {
 #endif
 };
 
-static void __devinit sci_init_single(struct platform_device *dev,
-                                     struct sci_port *sci_port,
-                                     unsigned int index,
-                                     struct plat_sci_port *p)
+static int __devinit sci_init_single(struct platform_device *dev,
+                                    struct sci_port *sci_port,
+                                    unsigned int index,
+                                    struct plat_sci_port *p)
 {
        struct uart_port *port = &sci_port->port;
 
@@ -1577,8 +1619,23 @@ static void __devinit sci_init_single(struct platform_device *dev,
        }
 
        if (dev) {
-               sci_port->iclk = p->clk ? clk_get(&dev->dev, p->clk) : NULL;
-               sci_port->dclk = clk_get(&dev->dev, "peripheral_clk");
+               sci_port->iclk = clk_get(&dev->dev, "sci_ick");
+               if (IS_ERR(sci_port->iclk)) {
+                       sci_port->iclk = clk_get(&dev->dev, "peripheral_clk");
+                       if (IS_ERR(sci_port->iclk)) {
+                               dev_err(&dev->dev, "can't get iclk\n");
+                               return PTR_ERR(sci_port->iclk);
+                       }
+               }
+
+               /*
+                * The function clock is optional, ignore it if we can't
+                * find it.
+                */
+               sci_port->fclk = clk_get(&dev->dev, "sci_fck");
+               if (IS_ERR(sci_port->fclk))
+                       sci_port->fclk = NULL;
+
                sci_port->enable = sci_clk_enable;
                sci_port->disable = sci_clk_disable;
                port->dev = &dev->dev;
@@ -1605,6 +1662,7 @@ static void __devinit sci_init_single(struct platform_device *dev,
 #endif
 
        memcpy(&sci_port->irqs, &p->irqs, sizeof(p->irqs));
+       return 0;
 }
 
 #ifdef CONFIG_SERIAL_SH_SCI_CONSOLE
@@ -1754,8 +1812,11 @@ static int sci_remove(struct platform_device *dev)
        cpufreq_unregister_notifier(&priv->clk_nb, CPUFREQ_TRANSITION_NOTIFIER);
 
        spin_lock_irqsave(&priv->lock, flags);
-       list_for_each_entry(p, &priv->ports, node)
+       list_for_each_entry(p, &priv->ports, node) {
                uart_remove_one_port(&sci_uart_driver, &p->port);
+               clk_put(p->iclk);
+               clk_put(p->fclk);
+       }
        spin_unlock_irqrestore(&priv->lock, flags);
 
        kfree(priv);
@@ -1781,7 +1842,9 @@ static int __devinit sci_probe_single(struct platform_device *dev,
                return 0;
        }
 
-       sci_init_single(dev, sciport, index, p);
+       ret = sci_init_single(dev, sciport, index, p);
+       if (ret)
+               return ret;
 
        ret = uart_add_one_port(&sci_uart_driver, &sciport->port);
        if (ret)
diff --git a/drivers/sh/Kconfig b/drivers/sh/Kconfig
new file mode 100644 (file)
index 0000000..a54de0b
--- /dev/null
@@ -0,0 +1,24 @@
+config INTC_USERIMASK
+       bool "Userspace interrupt masking support"
+       depends on ARCH_SHMOBILE || (SUPERH && CPU_SH4A)
+       help
+         This enables support for hardware-assisted userspace hardirq
+         masking.
+
+         SH-4A and newer interrupt blocks all support a special shadowed
+         page with all non-masking registers obscured when mapped in to
+         userspace. This is primarily for use by userspace device
+         drivers that are using special priority levels.
+
+         If in doubt, say N.
+
+config INTC_BALANCING
+       bool "Hardware IRQ balancing support"
+       depends on SMP && SUPERH && CPU_SUBTYPE_SH7786
+       help
+         This enables support for IRQ auto-distribution mode on SH-X3
+         SMP parts. All of the balancing and CPU wakeup decisions are
+         taken care of automatically by hardware for distributed
+         vectors.
+
+         If in doubt, say N.
index 94ad6bd..c585574 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/topology.h>
 #include <linux/bitmap.h>
 #include <linux/cpumask.h>
+#include <asm/sizes.h>
 
 #define _INTC_MK(fn, mode, addr_e, addr_d, width, shift) \
        ((shift) | ((width) << 5) | ((fn) << 9) | ((mode) << 13) | \
@@ -45,6 +46,12 @@ struct intc_handle_int {
        unsigned long handle;
 };
 
+struct intc_window {
+       phys_addr_t phys;
+       void __iomem *virt;
+       unsigned long size;
+};
+
 struct intc_desc_int {
        struct list_head list;
        struct sys_device sysdev;
@@ -58,6 +65,8 @@ struct intc_desc_int {
        unsigned int nr_prio;
        struct intc_handle_int *sense;
        unsigned int nr_sense;
+       struct intc_window *window;
+       unsigned int nr_windows;
        struct irq_chip chip;
 };
 
@@ -87,8 +96,12 @@ static DEFINE_SPINLOCK(vector_lock);
 #define SMP_NR(d, x) 1
 #endif
 
-static unsigned int intc_prio_level[NR_IRQS]; /* for now */
+static unsigned int intc_prio_level[NR_IRQS];  /* for now */
+static unsigned int default_prio_level = 2;    /* 2 - 16 */
 static unsigned long ack_handle[NR_IRQS];
+#ifdef CONFIG_INTC_BALANCING
+static unsigned long dist_handle[NR_IRQS];
+#endif
 
 static inline struct intc_desc_int *get_intc_desc(unsigned int irq)
 {
@@ -96,6 +109,47 @@ static inline struct intc_desc_int *get_intc_desc(unsigned int irq)
        return container_of(chip, struct intc_desc_int, chip);
 }
 
+static unsigned long intc_phys_to_virt(struct intc_desc_int *d,
+                                      unsigned long address)
+{
+       struct intc_window *window;
+       int k;
+
+       /* scan through physical windows and convert address */
+       for (k = 0; k < d->nr_windows; k++) {
+               window = d->window + k;
+
+               if (address < window->phys)
+                       continue;
+
+               if (address >= (window->phys + window->size))
+                       continue;
+
+               address -= window->phys;
+               address += (unsigned long)window->virt;
+
+               return address;
+       }
+
+       /* no windows defined, register must be 1:1 mapped virt:phys */
+       return address;
+}
+
+static unsigned int intc_get_reg(struct intc_desc_int *d, unsigned long address)
+{
+       unsigned int k;
+
+       address = intc_phys_to_virt(d, address);
+
+       for (k = 0; k < d->nr_reg; k++) {
+               if (d->reg[k] == address)
+                       return k;
+       }
+
+       BUG();
+       return 0;
+}
+
 static inline unsigned int set_field(unsigned int value,
                                     unsigned int field_value,
                                     unsigned int handle)
@@ -229,6 +283,85 @@ static void (*intc_disable_fns[])(unsigned long addr,
        [MODE_PCLR_REG] = intc_mode_field,
 };
 
+#ifdef CONFIG_INTC_BALANCING
+static inline void intc_balancing_enable(unsigned int irq)
+{
+       struct intc_desc_int *d = get_intc_desc(irq);
+       unsigned long handle = dist_handle[irq];
+       unsigned long addr;
+
+       if (irq_balancing_disabled(irq) || !handle)
+               return;
+
+       addr = INTC_REG(d, _INTC_ADDR_D(handle), 0);
+       intc_reg_fns[_INTC_FN(handle)](addr, handle, 1);
+}
+
+static inline void intc_balancing_disable(unsigned int irq)
+{
+       struct intc_desc_int *d = get_intc_desc(irq);
+       unsigned long handle = dist_handle[irq];
+       unsigned long addr;
+
+       if (irq_balancing_disabled(irq) || !handle)
+               return;
+
+       addr = INTC_REG(d, _INTC_ADDR_D(handle), 0);
+       intc_reg_fns[_INTC_FN(handle)](addr, handle, 0);
+}
+
+static unsigned int intc_dist_data(struct intc_desc *desc,
+                                  struct intc_desc_int *d,
+                                  intc_enum enum_id)
+{
+       struct intc_mask_reg *mr = desc->hw.mask_regs;
+       unsigned int i, j, fn, mode;
+       unsigned long reg_e, reg_d;
+
+       for (i = 0; mr && enum_id && i < desc->hw.nr_mask_regs; i++) {
+               mr = desc->hw.mask_regs + i;
+
+               /*
+                * Skip this entry if there's no auto-distribution
+                * register associated with it.
+                */
+               if (!mr->dist_reg)
+                       continue;
+
+               for (j = 0; j < ARRAY_SIZE(mr->enum_ids); j++) {
+                       if (mr->enum_ids[j] != enum_id)
+                               continue;
+
+                       fn = REG_FN_MODIFY_BASE;
+                       mode = MODE_ENABLE_REG;
+                       reg_e = mr->dist_reg;
+                       reg_d = mr->dist_reg;
+
+                       fn += (mr->reg_width >> 3) - 1;
+                       return _INTC_MK(fn, mode,
+                                       intc_get_reg(d, reg_e),
+                                       intc_get_reg(d, reg_d),
+                                       1,
+                                       (mr->reg_width - 1) - j);
+               }
+       }
+
+       /*
+        * It's possible we've gotten here with no distribution options
+        * available for the IRQ in question, so we just skip over those.
+        */
+       return 0;
+}
+#else
+static inline void intc_balancing_enable(unsigned int irq)
+{
+}
+
+static inline void intc_balancing_disable(unsigned int irq)
+{
+}
+#endif
+
 static inline void _intc_enable(unsigned int irq, unsigned long handle)
 {
        struct intc_desc_int *d = get_intc_desc(irq);
@@ -244,6 +377,8 @@ static inline void _intc_enable(unsigned int irq, unsigned long handle)
                intc_enable_fns[_INTC_MODE(handle)](addr, handle, intc_reg_fns\
                                                    [_INTC_FN(handle)], irq);
        }
+
+       intc_balancing_enable(irq);
 }
 
 static void intc_enable(unsigned int irq)
@@ -254,10 +389,12 @@ static void intc_enable(unsigned int irq)
 static void intc_disable(unsigned int irq)
 {
        struct intc_desc_int *d = get_intc_desc(irq);
-       unsigned long handle = (unsigned long) get_irq_chip_data(irq);
+       unsigned long handle = (unsigned long)get_irq_chip_data(irq);
        unsigned long addr;
        unsigned int cpu;
 
+       intc_balancing_disable(irq);
+
        for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_D(handle)); cpu++) {
 #ifdef CONFIG_SMP
                if (!cpumask_test_cpu(cpu, irq_to_desc(irq)->affinity))
@@ -336,8 +473,7 @@ static void intc_mask_ack(unsigned int irq)
 
        intc_disable(irq);
 
-       /* read register and write zero only to the assocaited bit */
-
+       /* read register and write zero only to the associated bit */
        if (handle) {
                addr = INTC_REG(d, _INTC_ADDR_D(handle), 0);
                switch (_INTC_FN(handle)) {
@@ -366,7 +502,8 @@ static struct intc_handle_int *intc_find_irq(struct intc_handle_int *hp,
 {
        int i;
 
-       /* this doesn't scale well, but...
+       /*
+        * this doesn't scale well, but...
         *
         * this function should only be used for cerain uncommon
         * operations such as intc_set_priority() and intc_set_sense()
@@ -377,7 +514,6 @@ static struct intc_handle_int *intc_find_irq(struct intc_handle_int *hp,
         * memory footprint down is to make sure the array is sorted
         * and then perform a bisect to lookup the irq.
         */
-
        for (i = 0; i < nr_hp; i++) {
                if ((hp + i)->irq != irq)
                        continue;
@@ -408,7 +544,6 @@ int intc_set_priority(unsigned int irq, unsigned int prio)
                 * primary masking method is using intc_prio_level[irq]
                 * priority level will be set during next enable()
                 */
-
                if (_INTC_FN(ihp->handle) != REG_FN_ERR)
                        _intc_enable(irq, ihp->handle);
        }
@@ -447,20 +582,6 @@ static int intc_set_sense(unsigned int irq, unsigned int type)
        return 0;
 }
 
-static unsigned int __init intc_get_reg(struct intc_desc_int *d,
-                                unsigned long address)
-{
-       unsigned int k;
-
-       for (k = 0; k < d->nr_reg; k++) {
-               if (d->reg[k] == address)
-                       return k;
-       }
-
-       BUG();
-       return 0;
-}
-
 static intc_enum __init intc_grp_id(struct intc_desc *desc,
                                    intc_enum enum_id)
 {
@@ -718,13 +839,14 @@ static void __init intc_register_irq(struct intc_desc *desc,
         */
        set_bit(irq, intc_irq_map);
 
-       /* Prefer single interrupt source bitmap over other combinations:
+       /*
+        * Prefer single interrupt source bitmap over other combinations:
+        *
         * 1. bitmap, single interrupt source
         * 2. priority, single interrupt source
         * 3. bitmap, multiple interrupt sources (groups)
         * 4. priority, multiple interrupt sources (groups)
         */
-
        data[0] = intc_mask_data(desc, d, enum_id, 0);
        data[1] = intc_prio_data(desc, d, enum_id, 0);
 
@@ -749,10 +871,11 @@ static void __init intc_register_irq(struct intc_desc *desc,
                                      handle_level_irq, "level");
        set_irq_chip_data(irq, (void *)data[primary]);
 
-       /* set priority level
+       /*
+        * set priority level
         * - this needs to be at least 2 for 5-bit priorities on 7780
         */
-       intc_prio_level[irq] = 2;
+       intc_prio_level[irq] = default_prio_level;
 
        /* enable secondary masking method if present */
        if (data[!primary])
@@ -769,7 +892,6 @@ static void __init intc_register_irq(struct intc_desc *desc,
                         * only secondary priority should access registers, so
                         * set _INTC_FN(h) = REG_FN_ERR for intc_set_priority()
                         */
-
                        hp->handle &= ~_INTC_MK(0x0f, 0, 0, 0, 0, 0);
                        hp->handle |= _INTC_MK(REG_FN_ERR, 0, 0, 0, 0, 0);
                }
@@ -790,6 +912,11 @@ static void __init intc_register_irq(struct intc_desc *desc,
        if (desc->hw.ack_regs)
                ack_handle[irq] = intc_ack_data(desc, d, enum_id);
 
+#ifdef CONFIG_INTC_BALANCING
+       if (desc->hw.mask_regs)
+               dist_handle[irq] = intc_dist_data(desc, d, enum_id);
+#endif
+
 #ifdef CONFIG_ARM
        set_irq_flags(irq, IRQF_VALID); /* Enable IRQ on ARM systems */
 #endif
@@ -801,6 +928,8 @@ static unsigned int __init save_reg(struct intc_desc_int *d,
                                    unsigned int smp)
 {
        if (value) {
+               value = intc_phys_to_virt(d, value);
+
                d->reg[cnt] = value;
 #ifdef CONFIG_SMP
                d->smp[cnt] = smp;
@@ -816,25 +945,59 @@ static void intc_redirect_irq(unsigned int irq, struct irq_desc *desc)
        generic_handle_irq((unsigned int)get_irq_data(irq));
 }
 
-void __init register_intc_controller(struct intc_desc *desc)
+int __init register_intc_controller(struct intc_desc *desc)
 {
        unsigned int i, k, smp;
        struct intc_hw_desc *hw = &desc->hw;
        struct intc_desc_int *d;
+       struct resource *res;
+
+       pr_info("intc: Registered controller '%s' with %u IRQs\n",
+               desc->name, hw->nr_vectors);
 
        d = kzalloc(sizeof(*d), GFP_NOWAIT);
+       if (!d)
+               goto err0;
 
        INIT_LIST_HEAD(&d->list);
        list_add(&d->list, &intc_list);
 
+       if (desc->num_resources) {
+               d->nr_windows = desc->num_resources;
+               d->window = kzalloc(d->nr_windows * sizeof(*d->window),
+                                   GFP_NOWAIT);
+               if (!d->window)
+                       goto err1;
+
+               for (k = 0; k < d->nr_windows; k++) {
+                       res = desc->resource + k;
+                       WARN_ON(resource_type(res) != IORESOURCE_MEM);
+                       d->window[k].phys = res->start;
+                       d->window[k].size = resource_size(res);
+                       d->window[k].virt = ioremap_nocache(res->start,
+                                                        resource_size(res));
+                       if (!d->window[k].virt)
+                               goto err2;
+               }
+       }
+
        d->nr_reg = hw->mask_regs ? hw->nr_mask_regs * 2 : 0;
+#ifdef CONFIG_INTC_BALANCING
+       if (d->nr_reg)
+               d->nr_reg += hw->nr_mask_regs;
+#endif
        d->nr_reg += hw->prio_regs ? hw->nr_prio_regs * 2 : 0;
        d->nr_reg += hw->sense_regs ? hw->nr_sense_regs : 0;
        d->nr_reg += hw->ack_regs ? hw->nr_ack_regs : 0;
 
        d->reg = kzalloc(d->nr_reg * sizeof(*d->reg), GFP_NOWAIT);
+       if (!d->reg)
+               goto err2;
+
 #ifdef CONFIG_SMP
        d->smp = kzalloc(d->nr_reg * sizeof(*d->smp), GFP_NOWAIT);
+       if (!d->smp)
+               goto err3;
 #endif
        k = 0;
 
@@ -843,12 +1006,17 @@ void __init register_intc_controller(struct intc_desc *desc)
                        smp = IS_SMP(hw->mask_regs[i]);
                        k += save_reg(d, k, hw->mask_regs[i].set_reg, smp);
                        k += save_reg(d, k, hw->mask_regs[i].clr_reg, smp);
+#ifdef CONFIG_INTC_BALANCING
+                       k += save_reg(d, k, hw->mask_regs[i].dist_reg, 0);
+#endif
                }
        }
 
        if (hw->prio_regs) {
                d->prio = kzalloc(hw->nr_vectors * sizeof(*d->prio),
                                  GFP_NOWAIT);
+               if (!d->prio)
+                       goto err4;
 
                for (i = 0; i < hw->nr_prio_regs; i++) {
                        smp = IS_SMP(hw->prio_regs[i]);
@@ -860,6 +1028,8 @@ void __init register_intc_controller(struct intc_desc *desc)
        if (hw->sense_regs) {
                d->sense = kzalloc(hw->nr_vectors * sizeof(*d->sense),
                                   GFP_NOWAIT);
+               if (!d->sense)
+                       goto err5;
 
                for (i = 0; i < hw->nr_sense_regs; i++)
                        k += save_reg(d, k, hw->sense_regs[i].reg, 0);
@@ -906,7 +1076,7 @@ void __init register_intc_controller(struct intc_desc *desc)
 
                irq_desc = irq_to_desc_alloc_node(irq, numa_node_id());
                if (unlikely(!irq_desc)) {
-                       pr_info("can't get irq_desc for %d\n", irq);
+                       pr_err("can't get irq_desc for %d\n", irq);
                        continue;
                }
 
@@ -926,7 +1096,7 @@ void __init register_intc_controller(struct intc_desc *desc)
                         */
                        irq_desc = irq_to_desc_alloc_node(irq2, numa_node_id());
                        if (unlikely(!irq_desc)) {
-                               pr_info("can't get irq_desc for %d\n", irq2);
+                               pr_err("can't get irq_desc for %d\n", irq2);
                                continue;
                        }
 
@@ -942,8 +1112,100 @@ void __init register_intc_controller(struct intc_desc *desc)
        /* enable bits matching force_enable after registering irqs */
        if (desc->force_enable)
                intc_enable_disable_enum(desc, d, desc->force_enable, 1);
+
+       return 0;
+err5:
+       kfree(d->prio);
+err4:
+#ifdef CONFIG_SMP
+       kfree(d->smp);
+err3:
+#endif
+       kfree(d->reg);
+err2:
+       for (k = 0; k < d->nr_windows; k++)
+               if (d->window[k].virt)
+                       iounmap(d->window[k].virt);
+
+       kfree(d->window);
+err1:
+       kfree(d);
+err0:
+       pr_err("unable to allocate INTC memory\n");
+
+       return -ENOMEM;
+}
+
+#ifdef CONFIG_INTC_USERIMASK
+static void __iomem *uimask;
+
+int register_intc_userimask(unsigned long addr)
+{
+       if (unlikely(uimask))
+               return -EBUSY;
+
+       uimask = ioremap_nocache(addr, SZ_4K);
+       if (unlikely(!uimask))
+               return -ENOMEM;
+
+       pr_info("intc: userimask support registered for levels 0 -> %d\n",
+               default_prio_level - 1);
+
+       return 0;
+}
+
+static ssize_t
+show_intc_userimask(struct sysdev_class *cls,
+                   struct sysdev_class_attribute *attr, char *buf)
+{
+       return sprintf(buf, "%d\n", (__raw_readl(uimask) >> 4) & 0xf);
+}
+
+static ssize_t
+store_intc_userimask(struct sysdev_class *cls,
+                    struct sysdev_class_attribute *attr,
+                    const char *buf, size_t count)
+{
+       unsigned long level;
+
+       level = simple_strtoul(buf, NULL, 10);
+
+       /*
+        * Minimal acceptable IRQ levels are in the 2 - 16 range, but
+        * these are chomped so as to not interfere with normal IRQs.
+        *
+        * Level 1 is a special case on some CPUs in that it's not
+        * directly settable, but given that USERIMASK cuts off below a
+        * certain level, we don't care about this limitation here.
+        * Level 0 on the other hand equates to user masking disabled.
+        *
+        * We use default_prio_level as a cut off so that only special
+        * case opt-in IRQs can be mangled.
+        */
+       if (level >= default_prio_level)
+               return -EINVAL;
+
+       __raw_writel(0xa5 << 24 | level << 4, uimask);
+
+       return count;
 }
 
+static SYSDEV_CLASS_ATTR(userimask, S_IRUSR | S_IWUSR,
+                        show_intc_userimask, store_intc_userimask);
+#endif
+
+static ssize_t
+show_intc_name(struct sys_device *dev, struct sysdev_attribute *attr, char *buf)
+{
+       struct intc_desc_int *d;
+
+       d = container_of(dev, struct intc_desc_int, sysdev);
+
+       return sprintf(buf, "%s\n", d->chip.name);
+}
+
+static SYSDEV_ATTR(name, S_IRUGO, show_intc_name, NULL);
+
 static int intc_suspend(struct sys_device *dev, pm_message_t state)
 {
        struct intc_desc_int *d;
@@ -1003,19 +1265,28 @@ static int __init register_intc_sysdevs(void)
        int id = 0;
 
        error = sysdev_class_register(&intc_sysdev_class);
+#ifdef CONFIG_INTC_USERIMASK
+       if (!error && uimask)
+               error = sysdev_class_create_file(&intc_sysdev_class,
+                                                &attr_userimask);
+#endif
        if (!error) {
                list_for_each_entry(d, &intc_list, list) {
                        d->sysdev.id = id;
                        d->sysdev.cls = &intc_sysdev_class;
                        error = sysdev_register(&d->sysdev);
+                       if (error == 0)
+                               error = sysdev_create_file(&d->sysdev,
+                                                          &attr_name);
                        if (error)
                                break;
+
                        id++;
                }
        }
 
        if (error)
-               pr_warning("intc: sysdev registration error\n");
+               pr_err("intc: sysdev registration error\n");
 
        return error;
 }
@@ -1048,7 +1319,7 @@ unsigned int create_irq_nr(unsigned int irq_want, int node)
 
        desc = irq_to_desc_alloc_node(new, node);
        if (unlikely(!desc)) {
-               pr_info("can't get irq_desc for %d\n", new);
+               pr_err("can't get irq_desc for %d\n", new);
                goto out_unlock;
        }
 
index 1821928..241b96b 100644 (file)
@@ -451,6 +451,10 @@ struct device {
 
 static inline const char *dev_name(const struct device *dev)
 {
+       /* Use the init name until the kobject becomes available */
+       if (dev->init_name)
+               return dev->init_name;
+
        return kobject_name(&dev->kobj);
 }
 
index 193d4bf..f5364a1 100644 (file)
@@ -33,8 +33,8 @@ struct plat_sci_port {
        char            *clk;                   /* clock string */
        struct device   *dma_dev;
 #ifdef CONFIG_SERIAL_SH_SCI_DMA
-       enum sh_dmae_slave_chan_id dma_slave_tx;
-       enum sh_dmae_slave_chan_id dma_slave_rx;
+       unsigned int dma_slave_tx;
+       unsigned int dma_slave_rx;
 #endif
 };
 
diff --git a/include/linux/sh_dma.h b/include/linux/sh_dma.h
new file mode 100644 (file)
index 0000000..b08cd4e
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ * Header for the new SH dmaengine driver
+ *
+ * Copyright (C) 2010 Guennadi Liakhovetski <g.liakhovetski@gmx.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef SH_DMA_H
+#define SH_DMA_H
+
+#include <linux/list.h>
+#include <linux/dmaengine.h>
+
+/* Used by slave DMA clients to request DMA to/from a specific peripheral */
+struct sh_dmae_slave {
+       unsigned int                    slave_id; /* Set by the platform */
+       struct device                   *dma_dev; /* Set by the platform */
+       const struct sh_dmae_slave_config       *config;  /* Set by the driver */
+};
+
+struct sh_dmae_regs {
+       u32 sar; /* SAR / source address */
+       u32 dar; /* DAR / destination address */
+       u32 tcr; /* TCR / transfer count */
+};
+
+struct sh_desc {
+       struct sh_dmae_regs hw;
+       struct list_head node;
+       struct dma_async_tx_descriptor async_tx;
+       enum dma_data_direction direction;
+       dma_cookie_t cookie;
+       size_t partial;
+       int chunks;
+       int mark;
+};
+
+struct sh_dmae_slave_config {
+       unsigned int                    slave_id;
+       dma_addr_t                      addr;
+       u32                             chcr;
+       char                            mid_rid;
+};
+
+struct sh_dmae_channel {
+       unsigned int    offset;
+       unsigned int    dmars;
+       unsigned int    dmars_bit;
+};
+
+struct sh_dmae_pdata {
+       const struct sh_dmae_slave_config *slave;
+       int slave_num;
+       const struct sh_dmae_channel *channel;
+       int channel_num;
+       unsigned int ts_low_shift;
+       unsigned int ts_low_mask;
+       unsigned int ts_high_shift;
+       unsigned int ts_high_mask;
+       const unsigned int *ts_shift;
+       int ts_shift_num;
+       u16 dmaor_init;
+};
+
+/* DMA register */
+#define SAR    0x00
+#define DAR    0x04
+#define TCR    0x08
+#define CHCR   0x0C
+#define DMAOR  0x40
+
+/* DMAOR definitions */
+#define DMAOR_AE       0x00000004
+#define DMAOR_NMIF     0x00000002
+#define DMAOR_DME      0x00000001
+
+/* Definitions for the SuperH DMAC */
+#define REQ_L  0x00000000
+#define REQ_E  0x00080000
+#define RACK_H 0x00000000
+#define RACK_L 0x00040000
+#define ACK_R  0x00000000
+#define ACK_W  0x00020000
+#define ACK_H  0x00000000
+#define ACK_L  0x00010000
+#define DM_INC 0x00004000
+#define DM_DEC 0x00008000
+#define DM_FIX 0x0000c000
+#define SM_INC 0x00001000
+#define SM_DEC 0x00002000
+#define SM_FIX 0x00003000
+#define RS_IN  0x00000200
+#define RS_OUT 0x00000300
+#define TS_BLK 0x00000040
+#define TM_BUR 0x00000020
+#define CHCR_DE        0x00000001
+#define CHCR_TE        0x00000002
+#define CHCR_IE        0x00000004
+
+#endif
index 51d288d..0d6cd38 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef __SH_INTC_H
 #define __SH_INTC_H
 
+#include <linux/ioport.h>
+
 typedef unsigned char intc_enum;
 
 struct intc_vect {
@@ -21,6 +23,9 @@ struct intc_group {
 struct intc_mask_reg {
        unsigned long set_reg, clr_reg, reg_width;
        intc_enum enum_ids[32];
+#ifdef CONFIG_INTC_BALANCING
+       unsigned long dist_reg;
+#endif
 #ifdef CONFIG_SMP
        unsigned long smp;
 #endif
@@ -39,8 +44,14 @@ struct intc_sense_reg {
        intc_enum enum_ids[16];
 };
 
+#ifdef CONFIG_INTC_BALANCING
+#define INTC_SMP_BALANCING(reg)        .dist_reg = (reg)
+#else
+#define INTC_SMP_BALANCING(reg)
+#endif
+
 #ifdef CONFIG_SMP
-#define INTC_SMP(stride, nr) .smp = (stride) | ((nr) << 8)
+#define INTC_SMP(stride, nr)   .smp = (stride) | ((nr) << 8)
 #else
 #define INTC_SMP(stride, nr)
 #endif
@@ -71,6 +82,8 @@ struct intc_hw_desc {
 
 struct intc_desc {
        char *name;
+       struct resource *resource;
+       unsigned int num_resources;
        intc_enum force_enable;
        intc_enum force_disable;
        struct intc_hw_desc hw;
@@ -92,9 +105,18 @@ struct intc_desc symbol __initdata = {                                      \
                           prio_regs, sense_regs, ack_regs),            \
 }
 
-void __init register_intc_controller(struct intc_desc *desc);
+int __init register_intc_controller(struct intc_desc *desc);
 int intc_set_priority(unsigned int irq, unsigned int prio);
 
+#ifdef CONFIG_INTC_USERIMASK
+int register_intc_userimask(unsigned long addr);
+#else
+static inline int register_intc_userimask(unsigned long addr)
+{
+       return 0;
+}
+#endif
+
 int reserve_irq_vector(unsigned int irq);
 void reserve_irq_legacy(void);