Commit 4a31c08d authored by Linus Torvalds's avatar Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6: (26 commits)
  sh: Convert sh to use read/update_persistent_clock
  sh: Move PMB debugfs entry initialization to later stage
  sh: Fix up flush_cache_vmap() on SMP.
  sh: fix up MMU reset with variable PMB mapping sizes.
  sh: establish PMB mappings for NUMA nodes.
  sh: check for existing mappings for bolted PMB entries.
  sh: fixed virt/phys mapping helpers for PMB.
  sh: make pmb iomapping configurable.
  sh: reworked dynamic PMB mapping.
  sh: Fix up cpumask_of_pcibus() for the NUMA build.
  serial: sh-sci: Tidy up build warnings.
  sh: Fix up ctrl_read/write stragglers in migor setup.
  serial: sh-sci: Add DMA support.
  dmaengine: shdma: extend .device_terminate_all() to record partial transfer
  sh: merge sh7722 and sh7724 DMA register definitions
  sh: activate runtime PM for dmaengine on sh7722 and sh7724
  dmaengine: shdma: add runtime PM support.
  dmaengine: shdma: separate DMA headers.
  dmaengine: shdma: convert to platform device resources
  dmaengine: shdma: fix DMA error handling.
  ...
parents 2ddb3b15 0272282f
...@@ -419,6 +419,9 @@ static struct i2c_board_info migor_i2c_devices[] = { ...@@ -419,6 +419,9 @@ static struct i2c_board_info migor_i2c_devices[] = {
I2C_BOARD_INFO("migor_ts", 0x51), I2C_BOARD_INFO("migor_ts", 0x51),
.irq = 38, /* IRQ6 */ .irq = 38, /* IRQ6 */
}, },
{
I2C_BOARD_INFO("wm8978", 0x1a),
},
}; };
static struct i2c_board_info migor_i2c_camera[] = { static struct i2c_board_info migor_i2c_camera[] = {
...@@ -619,6 +622,19 @@ static int __init migor_devices_setup(void) ...@@ -619,6 +622,19 @@ static int __init migor_devices_setup(void)
platform_resource_setup_memory(&migor_ceu_device, "ceu", 4 << 20); platform_resource_setup_memory(&migor_ceu_device, "ceu", 4 << 20);
/* SIU: Port B */
gpio_request(GPIO_FN_SIUBOLR, NULL);
gpio_request(GPIO_FN_SIUBOBT, NULL);
gpio_request(GPIO_FN_SIUBISLD, NULL);
gpio_request(GPIO_FN_SIUBOSLD, NULL);
gpio_request(GPIO_FN_SIUMCKB, NULL);
/*
* The original driver sets SIUB OLR/OBT, ILR/IBT, and SIUA OLR/OBT to
* output. Need only SIUB, set to output for master mode (table 34.2)
*/
__raw_writew(__raw_readw(PORT_MSELCRA) | 1, PORT_MSELCRA);
i2c_register_board_info(0, migor_i2c_devices, i2c_register_board_info(0, migor_i2c_devices,
ARRAY_SIZE(migor_i2c_devices)); ARRAY_SIZE(migor_i2c_devices));
......
...@@ -5,7 +5,7 @@ int cache_control(unsigned int command) ...@@ -5,7 +5,7 @@ int cache_control(unsigned int command)
for (i = 0; i < (32 * 1024); i += 32) { for (i = 0; i < (32 * 1024); i += 32) {
(void)*p; (void)*p;
p += (32 / sizeof (int)); p += (32 / sizeof(int));
} }
return 0; return 0;
......
...@@ -86,8 +86,8 @@ extern void copy_from_user_page(struct vm_area_struct *vma, ...@@ -86,8 +86,8 @@ extern void copy_from_user_page(struct vm_area_struct *vma,
struct page *page, unsigned long vaddr, void *dst, const void *src, struct page *page, unsigned long vaddr, void *dst, const void *src,
unsigned long len); unsigned long len);
#define flush_cache_vmap(start, end) flush_cache_all() #define flush_cache_vmap(start, end) local_flush_cache_all(NULL)
#define flush_cache_vunmap(start, end) flush_cache_all() #define flush_cache_vunmap(start, end) local_flush_cache_all(NULL)
#define flush_dcache_mmap_lock(mapping) do { } while (0) #define flush_dcache_mmap_lock(mapping) do { } while (0)
#define flush_dcache_mmap_unlock(mapping) do { } while (0) #define flush_dcache_mmap_unlock(mapping) do { } while (0)
......
/*
* Common header for the legacy SH DMA driver and the new dmaengine driver
*
* extracted from arch/sh/include/asm/dma-sh.h:
*
* Copyright (C) 2000 Takashi YOSHII
* Copyright (C) 2003 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.
*/
#ifndef DMA_REGISTER_H
#define DMA_REGISTER_H
/* 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
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
#ifndef __DMA_SH_H #ifndef __DMA_SH_H
#define __DMA_SH_H #define __DMA_SH_H
#include <asm/dma.h> #include <asm/dma-register.h>
#include <cpu/dma-register.h>
#include <cpu/dma.h> #include <cpu/dma.h>
/* DMAOR contorl: The DMAOR access size is different by CPU.*/ /* DMAOR contorl: The DMAOR access size is different by CPU.*/
...@@ -53,34 +54,6 @@ static int dmte_irq_map[] __maybe_unused = { ...@@ -53,34 +54,6 @@ static int dmte_irq_map[] __maybe_unused = {
#endif #endif
}; };
/* 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
/* DMAOR definitions */
#define DMAOR_AE 0x00000004
#define DMAOR_NMIF 0x00000002
#define DMAOR_DME 0x00000001
/* /*
* Define the default configuration for dual address memory-memory transfer. * Define the default configuration for dual address memory-memory transfer.
* The 0x400 value represents auto-request, external->external. * The 0x400 value represents auto-request, external->external.
...@@ -111,61 +84,4 @@ static u32 dma_base_addr[] __maybe_unused = { ...@@ -111,61 +84,4 @@ static u32 dma_base_addr[] __maybe_unused = {
#endif #endif
}; };
/* DMA register */
#define SAR 0x00
#define DAR 0x04
#define TCR 0x08
#define CHCR 0x0C
#define DMAOR 0x40
/*
* for dma engine
*
* SuperH DMA mode
*/
#define SHDMA_MIX_IRQ (1 << 1)
#define SHDMA_DMAOR1 (1 << 2)
#define SHDMA_DMAE1 (1 << 3)
enum sh_dmae_slave_chan_id {
SHDMA_SLAVE_SCIF0_TX,
SHDMA_SLAVE_SCIF0_RX,
SHDMA_SLAVE_SCIF1_TX,
SHDMA_SLAVE_SCIF1_RX,
SHDMA_SLAVE_SCIF2_TX,
SHDMA_SLAVE_SCIF2_RX,
SHDMA_SLAVE_SCIF3_TX,
SHDMA_SLAVE_SCIF3_RX,
SHDMA_SLAVE_SCIF4_TX,
SHDMA_SLAVE_SCIF4_RX,
SHDMA_SLAVE_SCIF5_TX,
SHDMA_SLAVE_SCIF5_RX,
SHDMA_SLAVE_SIUA_TX,
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_pdata {
unsigned int mode;
struct sh_dmae_slave_config *config;
int config_num;
};
struct device;
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 */
};
#endif /* __DMA_SH_H */ #endif /* __DMA_SH_H */
/*
* 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 ASM_DMAENGINE_H
#define ASM_DMAENGINE_H
#include <linux/dmaengine.h>
#include <linux/list.h>
#include <asm/dma-register.h>
#define SH_DMAC_MAX_CHANNELS 6
enum sh_dmae_slave_chan_id {
SHDMA_SLAVE_SCIF0_TX,
SHDMA_SLAVE_SCIF0_RX,
SHDMA_SLAVE_SCIF1_TX,
SHDMA_SLAVE_SCIF1_RX,
SHDMA_SLAVE_SCIF2_TX,
SHDMA_SLAVE_SCIF2_RX,
SHDMA_SLAVE_SCIF3_TX,
SHDMA_SLAVE_SCIF3_RX,
SHDMA_SLAVE_SCIF4_TX,
SHDMA_SLAVE_SCIF4_RX,
SHDMA_SLAVE_SCIF5_TX,
SHDMA_SLAVE_SCIF5_RX,
SHDMA_SLAVE_SIUA_TX,
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
...@@ -291,21 +291,21 @@ unsigned long long poke_real_address_q(unsigned long long addr, ...@@ -291,21 +291,21 @@ unsigned long long poke_real_address_q(unsigned long long addr,
* doesn't exist, so everything must go through page tables. * doesn't exist, so everything must go through page tables.
*/ */
#ifdef CONFIG_MMU #ifdef CONFIG_MMU
void __iomem *__ioremap_caller(unsigned long offset, unsigned long size, void __iomem *__ioremap_caller(phys_addr_t offset, unsigned long size,
pgprot_t prot, void *caller); pgprot_t prot, void *caller);
void __iounmap(void __iomem *addr); void __iounmap(void __iomem *addr);
static inline void __iomem * static inline void __iomem *
__ioremap(unsigned long offset, unsigned long size, pgprot_t prot) __ioremap(phys_addr_t offset, unsigned long size, pgprot_t prot)
{ {
return __ioremap_caller(offset, size, prot, __builtin_return_address(0)); return __ioremap_caller(offset, size, prot, __builtin_return_address(0));
} }
static inline void __iomem * static inline void __iomem *
__ioremap_29bit(unsigned long offset, unsigned long size, pgprot_t prot) __ioremap_29bit(phys_addr_t offset, unsigned long size, pgprot_t prot)
{ {
#ifdef CONFIG_29BIT #ifdef CONFIG_29BIT
unsigned long last_addr = offset + size - 1; phys_addr_t last_addr = offset + size - 1;
/* /*
* For P1 and P2 space this is trivial, as everything is already * For P1 and P2 space this is trivial, as everything is already
...@@ -329,7 +329,7 @@ __ioremap_29bit(unsigned long offset, unsigned long size, pgprot_t prot) ...@@ -329,7 +329,7 @@ __ioremap_29bit(unsigned long offset, unsigned long size, pgprot_t prot)
} }
static inline void __iomem * static inline void __iomem *
__ioremap_mode(unsigned long offset, unsigned long size, pgprot_t prot) __ioremap_mode(phys_addr_t offset, unsigned long size, pgprot_t prot)
{ {
void __iomem *ret; void __iomem *ret;
...@@ -349,35 +349,32 @@ __ioremap_mode(unsigned long offset, unsigned long size, pgprot_t prot) ...@@ -349,35 +349,32 @@ __ioremap_mode(unsigned long offset, unsigned long size, pgprot_t prot)
#define __iounmap(addr) do { } while (0) #define __iounmap(addr) do { } while (0)
#endif /* CONFIG_MMU */ #endif /* CONFIG_MMU */
static inline void __iomem * static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size)
ioremap(unsigned long offset, unsigned long size)
{ {
return __ioremap_mode(offset, size, PAGE_KERNEL_NOCACHE); return __ioremap_mode(offset, size, PAGE_KERNEL_NOCACHE);
} }
static inline void __iomem * static inline void __iomem *
ioremap_cache(unsigned long offset, unsigned long size) ioremap_cache(phys_addr_t offset, unsigned long size)
{ {
return __ioremap_mode(offset, size, PAGE_KERNEL); return __ioremap_mode(offset, size, PAGE_KERNEL);
} }
#ifdef CONFIG_HAVE_IOREMAP_PROT #ifdef CONFIG_HAVE_IOREMAP_PROT
static inline void __iomem * static inline void __iomem *
ioremap_prot(resource_size_t offset, unsigned long size, unsigned long flags) ioremap_prot(phys_addr_t offset, unsigned long size, unsigned long flags)
{ {
return __ioremap_mode(offset, size, __pgprot(flags)); return __ioremap_mode(offset, size, __pgprot(flags));
} }
#endif #endif
#ifdef CONFIG_IOREMAP_FIXED #ifdef CONFIG_IOREMAP_FIXED
extern void __iomem *ioremap_fixed(resource_size_t, unsigned long, extern void __iomem *ioremap_fixed(phys_addr_t, unsigned long, pgprot_t);
unsigned long, pgprot_t);
extern int iounmap_fixed(void __iomem *); extern int iounmap_fixed(void __iomem *);
extern void ioremap_fixed_init(void); extern void ioremap_fixed_init(void);
#else #else
static inline void __iomem * static inline void __iomem *
ioremap_fixed(resource_size_t phys_addr, unsigned long offset, ioremap_fixed(phys_addr_t phys_addr, unsigned long size, pgprot_t prot)
unsigned long size, pgprot_t prot)
{ {
BUG(); BUG();
return NULL; return NULL;
......
...@@ -55,19 +55,29 @@ typedef struct { ...@@ -55,19 +55,29 @@ typedef struct {
#ifdef CONFIG_PMB #ifdef CONFIG_PMB
/* arch/sh/mm/pmb.c */ /* arch/sh/mm/pmb.c */
long pmb_remap(unsigned long virt, unsigned long phys,
unsigned long size, pgprot_t prot);
void pmb_unmap(unsigned long addr);
void pmb_init(void);
bool __in_29bit_mode(void); bool __in_29bit_mode(void);
void pmb_init(void);
int pmb_bolt_mapping(unsigned long virt, phys_addr_t phys,
unsigned long size, pgprot_t prot);
void __iomem *pmb_remap_caller(phys_addr_t phys, unsigned long size,
pgprot_t prot, void *caller);
int pmb_unmap(void __iomem *addr);
#else #else
static inline long pmb_remap(unsigned long virt, unsigned long phys,
unsigned long size, pgprot_t prot) static inline void __iomem *
pmb_remap_caller(phys_addr_t phys, unsigned long size,
pgprot_t prot, void *caller)
{
return NULL;
}
static inline int pmb_unmap(void __iomem *addr)
{ {
return -EINVAL; return -EINVAL;
} }
#define pmb_unmap(addr) do { } while (0)
#define pmb_init(addr) do { } while (0) #define pmb_init(addr) do { } while (0)
#ifdef CONFIG_29BIT #ifdef CONFIG_29BIT
...@@ -77,6 +87,13 @@ static inline long pmb_remap(unsigned long virt, unsigned long phys, ...@@ -77,6 +87,13 @@ static inline long pmb_remap(unsigned long virt, unsigned long phys,
#endif #endif
#endif /* CONFIG_PMB */ #endif /* CONFIG_PMB */
static inline void __iomem *
pmb_remap(phys_addr_t phys, unsigned long size, pgprot_t prot)
{
return pmb_remap_caller(phys, size, prot, __builtin_return_address(0));
}
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#endif /* __MMU_H */ #endif /* __MMU_H */
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#ifndef ASM_SIU_H #ifndef ASM_SIU_H
#define ASM_SIU_H #define ASM_SIU_H
#include <asm/dma-sh.h> #include <asm/dmaengine.h>
struct device; struct device;
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#define pcibus_to_node(bus) ((void)(bus), -1) #define pcibus_to_node(bus) ((void)(bus), -1)
#define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \ #define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \
CPU_MASK_ALL_PTR : \ cpu_all_mask : \
cpumask_of_node(pcibus_to_node(bus))) cpumask_of_node(pcibus_to_node(bus)))
#endif #endif
......
/*
* SH3 CPU-specific DMA definitions, used by both DMA drivers
*
* 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 CPU_DMA_REGISTER_H
#define CPU_DMA_REGISTER_H
#define CHCR_TS_LOW_MASK 0x18
#define CHCR_TS_LOW_SHIFT 3
#define CHCR_TS_HIGH_MASK 0
#define CHCR_TS_HIGH_SHIFT 0
#define DMAOR_INIT DMAOR_DME
/*
* The SuperH DMAC supports a number of transmit sizes, we list them here,
* with their respective values as they appear in the CHCR registers.
*/
enum {
XMIT_SZ_8BIT,
XMIT_SZ_16BIT,
XMIT_SZ_32BIT,
XMIT_SZ_128BIT,
};
/* log2(size / 8) - used to calculate number of transfers */
#define TS_SHIFT { \
[XMIT_SZ_8BIT] = 0, \
[XMIT_SZ_16BIT] = 1, \
[XMIT_SZ_32BIT] = 2, \
[XMIT_SZ_128BIT] = 4, \
}
#define TS_INDEX2VAL(i) (((i) & 3) << CHCR_TS_LOW_SHIFT)
#endif
...@@ -20,31 +20,4 @@ ...@@ -20,31 +20,4 @@
#define TS_32 0x00000010 #define TS_32 0x00000010
#define TS_128 0x00000018 #define TS_128 0x00000018
#define CHCR_TS_LOW_MASK 0x18
#define CHCR_TS_LOW_SHIFT 3
#define CHCR_TS_HIGH_MASK 0
#define CHCR_TS_HIGH_SHIFT 0
#define DMAOR_INIT DMAOR_DME
/*
* The SuperH DMAC supports a number of transmit sizes, we list them here,
* with their respective values as they appear in the CHCR registers.
*/
enum {
XMIT_SZ_8BIT,
XMIT_SZ_16BIT,
XMIT_SZ_32BIT,
XMIT_SZ_128BIT,
};
#define TS_SHIFT { \
[XMIT_SZ_8BIT] = 0, \
[XMIT_SZ_16BIT] = 1, \
[XMIT_SZ_32BIT] = 2, \
[XMIT_SZ_128BIT] = 4, \
}
#define TS_INDEX2VAL(i) (((i) & 3) << CHCR_TS_LOW_SHIFT)
#endif /* __ASM_CPU_SH3_DMA_H */ #endif /* __ASM_CPU_SH3_DMA_H */
/*
* SH4 CPU-specific DMA definitions, used by both DMA drivers
*
* 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 CPU_DMA_REGISTER_H
#define CPU_DMA_REGISTER_H
/* SH7751/7760/7780 DMA IRQ sources */
#ifdef CONFIG_CPU_SH4A
#define DMAOR_INIT DMAOR_DME
#if defined(CONFIG_CPU_SUBTYPE_SH7343) || \
defined(CONFIG_CPU_SUBTYPE_SH7730)
#define CHCR_TS_LOW_MASK 0x00000018
#define CHCR_TS_LOW_SHIFT 3
#define CHCR_TS_HIGH_MASK 0
#define CHCR_TS_HIGH_SHIFT 0
#elif defined(CONFIG_CPU_SUBTYPE_SH7722) || \
defined(CONFIG_CPU_SUBTYPE_SH7724)
#define CHCR_TS_LOW_MASK 0x00000018
#define CHCR_TS_LOW_SHIFT 3
#define CHCR_TS_HIGH_MASK 0x00300000
#define CHCR_TS_HIGH_SHIFT (20 - 2) /* 2 bits for shifted low TS */
#elif defined(CONFIG_CPU_SUBTYPE_SH7763) || \
defined(CONFIG_CPU_SUBTYPE_SH7764)
#define CHCR_TS_LOW_MASK 0x00000018
#define CHCR_TS_LOW_SHIFT 3
#define CHCR_TS_HIGH_MASK 0
#define CHCR_TS_HIGH_SHIFT 0
#elif defined(CONFIG_CPU_SUBTYPE_SH7723)
#define CHCR_TS_LOW_MASK 0x00000018
#define CHCR_TS_LOW_SHIFT 3
#define CHCR_TS_HIGH_MASK 0
#define CHCR_TS_HIGH_SHIFT 0
#elif defined(CONFIG_CPU_SUBTYPE_SH7780)
#define CHCR_TS_LOW_MASK 0x00000018
#define CHCR_TS_LOW_SHIFT 3
#define CHCR_TS_HIGH_MASK 0
#define CHCR_TS_HIGH_SHIFT 0
#else /* SH7785 */
#define CHCR_TS_LOW_MASK 0x00000018
#define CHCR_TS_LOW_SHIFT 3
#define CHCR_TS_HIGH_MASK 0
#define CHCR_TS_HIGH_SHIFT 0
#endif
/* Transmit sizes and respective CHCR register values */
enum {
XMIT_SZ_8BIT = 0,
XMIT_SZ_16BIT = 1,
XMIT_SZ_32BIT = 2,
XMIT_SZ_64BIT = 7,
XMIT_SZ_128BIT = 3,
XMIT_SZ_256BIT = 4,
XMIT_SZ_128BIT_BLK = 0xb,
XMIT_SZ_256BIT_BLK = 0xc,
};
/* log2(size / 8) - used to calculate number of transfers */
#define TS_SHIFT { \
[XMIT_SZ_8BIT] = 0, \
[XMIT_SZ_16BIT] = 1, \
[XMIT_SZ_32BIT] = 2, \
[XMIT_SZ_64BIT] = 3, \
[XMIT_SZ_128BIT] = 4, \
[XMIT_SZ_256BIT] = 5, \
[XMIT_SZ_128BIT_BLK] = 4, \
[XMIT_SZ_256BIT_BLK] = 5, \
}
#define TS_INDEX2VAL(i) ((((i) & 3) << CHCR_TS_LOW_SHIFT) | \
((((i) >> 2) & 3) << CHCR_TS_HIGH_SHIFT))
#else /* CONFIG_CPU_SH4A */
#define DMAOR_INIT (0x8000 | DMAOR_DME)
#define CHCR_TS_LOW_MASK 0x70
#define CHCR_TS_LOW_SHIFT 4
#define CHCR_TS_HIGH_MASK 0
#define CHCR_TS_HIGH_SHIFT 0
/* Transmit sizes and respective CHCR register values */
enum {
XMIT_SZ_8BIT = 1,
XMIT_SZ_16BIT = 2,
XMIT_SZ_32BIT = 3,
XMIT_SZ_64BIT = 0,
XMIT_SZ_256BIT = 4,
};
/* log2(size / 8) - used to calculate number of transfers */
#define TS_SHIFT { \
[XMIT_SZ_8BIT] = 0, \
[XMIT_SZ_16BIT] = 1, \
[XMIT_SZ_32BIT] = 2, \
[XMIT_SZ_64BIT] = 3, \
[XMIT_SZ_256BIT] = 5, \
}
#define TS_INDEX2VAL(i) (((i) & 7) << CHCR_TS_LOW_SHIFT)
#endif /* CONFIG_CPU_SH4A */
#endif
...@@ -8,20 +8,12 @@ ...@@ -8,20 +8,12 @@
#define DMAE0_IRQ 78 /* DMA Error IRQ*/ #define DMAE0_IRQ 78 /* DMA Error IRQ*/
#define SH_DMAC_BASE0 0xFE008020 #define SH_DMAC_BASE0 0xFE008020
#define SH_DMARS_BASE0 0xFE009000 #define SH_DMARS_BASE0 0xFE009000
#define CHCR_TS_LOW_MASK 0x00000018
#define CHCR_TS_LOW_SHIFT 3
#define CHCR_TS_HIGH_MASK 0
#define CHCR_TS_HIGH_SHIFT 0
#elif defined(CONFIG_CPU_SUBTYPE_SH7722) #elif defined(CONFIG_CPU_SUBTYPE_SH7722)
#define DMTE0_IRQ 48 #define DMTE0_IRQ 48
#define DMTE4_IRQ 76 #define DMTE4_IRQ 76
#define DMAE0_IRQ 78 /* DMA Error IRQ*/ #define DMAE0_IRQ 78 /* DMA Error IRQ*/
#define SH_DMAC_BASE0 0xFE008020 #define SH_DMAC_BASE0 0xFE008020
#define SH_DMARS_BASE0 0xFE009000 #define SH_DMARS_BASE0 0xFE009000
#define CHCR_TS_LOW_MASK 0x00000018
#define CHCR_TS_LOW_SHIFT 3
#define CHCR_TS_HIGH_MASK 0x00300000
#define CHCR_TS_HIGH_SHIFT 20
#elif defined(CONFIG_CPU_SUBTYPE_SH7763) || \ #elif defined(CONFIG_CPU_SUBTYPE_SH7763) || \
defined(CONFIG_CPU_SUBTYPE_SH7764) defined(CONFIG_CPU_SUBTYPE_SH7764)
#define DMTE0_IRQ 34 #define DMTE0_IRQ 34
...@@ -29,10 +21,6 @@ ...@@ -29,10 +21,6 @@
#define DMAE0_IRQ 38 #define DMAE0_IRQ 38
#define SH_DMAC_BASE0 0xFF608020 #define SH_DMAC_BASE0 0xFF608020
#define SH_DMARS_BASE0 0xFF609000 #define SH_DMARS_BASE0 0xFF609000
#define CHCR_TS_LOW_MASK 0x00000018
#define CHCR_TS_LOW_SHIFT 3
#define CHCR_TS_HIGH_MASK 0
#define CHCR_TS_HIGH_SHIFT 0
#elif defined(CONFIG_CPU_SUBTYPE_SH7723) #elif defined(CONFIG_CPU_SUBTYPE_SH7723)
#define DMTE0_IRQ 48 /* DMAC0A*/ #define DMTE0_IRQ 48 /* DMAC0A*/
#define DMTE4_IRQ 76 /* DMAC0B */ #define DMTE4_IRQ 76 /* DMAC0B */
...@@ -46,10 +34,6 @@ ...@@ -46,10 +34,6 @@
#define SH_DMAC_BASE0 0xFE008020 #define SH_DMAC_BASE0 0xFE008020
#define SH_DMAC_BASE1 0xFDC08020 #define SH_DMAC_BASE1 0xFDC08020
#define SH_DMARS_BASE0 0xFDC09000 #define SH_DMARS_BASE0 0xFDC09000
#define CHCR_TS_LOW_MASK 0x00000018
#define CHCR_TS_LOW_SHIFT 3
#define CHCR_TS_HIGH_MASK 0
#define CHCR_TS_HIGH_SHIFT 0
#elif defined(CONFIG_CPU_SUBTYPE_SH7724) #elif defined(CONFIG_CPU_SUBTYPE_SH7724)
#define DMTE0_IRQ 48 /* DMAC0A*/ #define DMTE0_IRQ 48 /* DMAC0A*/
#define DMTE4_IRQ 76 /* DMAC0B */ #define DMTE4_IRQ 76 /* DMAC0B */
...@@ -64,10 +48,6 @@ ...@@ -64,10 +48,6 @@
#define SH_DMAC_BASE1 0xFDC08020 #define SH_DMAC_BASE1 0xFDC08020
#define SH_DMARS_BASE0 0xFE009000 #define SH_DMARS_BASE0 0xFE009000
#define SH_DMARS_BASE1 0xFDC09000 #define SH_DMARS_BASE1 0xFDC09000
#define CHCR_TS_LOW_MASK 0x00000018
#define CHCR_TS_LOW_SHIFT 3
#define CHCR_TS_HIGH_MASK 0x00600000
#define CHCR_TS_HIGH_SHIFT 21
#elif defined(CONFIG_CPU_SUBTYPE_SH7780) #elif defined(CONFIG_CPU_SUBTYPE_SH7780)
#define DMTE0_IRQ 34 #define DMTE0_IRQ 34
#define DMTE4_IRQ 44 #define DMTE4_IRQ 44
...@@ -80,10 +60,6 @@ ...@@ -80,10 +60,6 @@
#define SH_DMAC_BASE0 0xFC808020 #define SH_DMAC_BASE0 0xFC808020
#define SH_DMAC_BASE1 0xFC818020 #define SH_DMAC_BASE1 0xFC818020
#define SH_DMARS_BASE0 0xFC809000 #define SH_DMARS_BASE0 0xFC809000
#define CHCR_TS_LOW_MASK 0x00000018
#define CHCR_TS_LOW_SHIFT 3
#define CHCR_TS_HIGH_MASK 0
#define CHCR_TS_HIGH_SHIFT 0
#else /* SH7785 */ #else /* SH7785 */
#define DMTE0_IRQ 33 #define DMTE0_IRQ 33
#define DMTE4_IRQ 37 #define DMTE4_IRQ 37
...@@ -97,10 +73,6 @@ ...@@ -97,10 +73,6 @@
#define SH_DMAC_BASE0 0xFC808020 #define SH_DMAC_BASE0 0xFC808020
#define SH_DMAC_BASE1 0xFCC08020 #define SH_DMAC_BASE1 0xFCC08020
#define SH_DMARS_BASE0 0xFC809000 #define SH_DMARS_BASE0 0xFC809000
#define CHCR_TS_LOW_MASK 0x00000018
#define CHCR_TS_LOW_SHIFT 3
#define CHCR_TS_HIGH_MASK 0
#define CHCR_TS_HIGH_SHIFT 0
#endif #endif
#define REQ_HE 0x000000C0 #define REQ_HE 0x000000C0
...@@ -108,38 +80,4 @@ ...@@ -108,38 +80,4 @@
#define REQ_LE 0x00000040 #define REQ_LE 0x00000040
#define TM_BURST 0x00000020 #define TM_BURST 0x00000020
/*
* The SuperH DMAC supports a number of transmit sizes, we list them here,
* with their respective values as they appear in the CHCR registers.
*
* Defaults to a 64-bit transfer size.
*/
enum {
XMIT_SZ_8BIT = 0,
XMIT_SZ_16BIT = 1,
XMIT_SZ_32BIT = 2,
XMIT_SZ_64BIT = 7,
XMIT_SZ_128BIT = 3,
XMIT_SZ_256BIT = 4,
XMIT_SZ_128BIT_BLK = 0xb,
XMIT_SZ_256BIT_BLK = 0xc,
};
/*
* The DMA count is defined as the number of bytes to transfer.
*/
#define TS_SHIFT { \
[XMIT_SZ_8BIT] = 0, \
[XMIT_SZ_16BIT] = 1, \
[XMIT_SZ_32BIT] = 2, \
[XMIT_SZ_64BIT] = 3, \
[XMIT_SZ_128BIT] = 4, \
[XMIT_SZ_256BIT] = 5, \
[XMIT_SZ_128BIT_BLK] = 4, \
[XMIT_SZ_256BIT_BLK] = 5, \
}
#define TS_INDEX2VAL(i) ((((i) & 3) << CHCR_TS_LOW_SHIFT) | \
((((i) >> 2) & 3) << CHCR_TS_HIGH_SHIFT))
#endif /* __ASM_SH_CPU_SH4_DMA_SH7780_H */ #endif /* __ASM_SH_CPU_SH4_DMA_SH7780_H */
...@@ -5,9 +5,8 @@ ...@@ -5,9 +5,8 @@
#ifdef CONFIG_CPU_SH4A #ifdef CONFIG_CPU_SH4A
#define DMAOR_INIT (DMAOR_DME)
#include <cpu/dma-sh4a.h> #include <cpu/dma-sh4a.h>
#else /* CONFIG_CPU_SH4A */ #else /* CONFIG_CPU_SH4A */
/* /*
* SH7750/SH7751/SH7760 * SH7750/SH7751/SH7760
...@@ -17,7 +16,6 @@ ...@@ -17,7 +16,6 @@
#define DMTE6_IRQ 46 #define DMTE6_IRQ 46
#define DMAE0_IRQ 38 #define DMAE0_IRQ 38
#define DMAOR_INIT (0x8000|DMAOR_DME)
#define SH_DMAC_BASE0 0xffa00000 #define SH_DMAC_BASE0 0xffa00000
#define SH_DMAC_BASE1 0xffa00070 #define SH_DMAC_BASE1 0xffa00070
/* Definitions for the SuperH DMAC */ /* Definitions for the SuperH DMAC */
...@@ -27,40 +25,8 @@ ...@@ -27,40 +25,8 @@
#define TS_32 0x00000030 #define TS_32 0x00000030
#define TS_64 0x00000000 #define TS_64 0x00000000
#define CHCR_TS_LOW_MASK 0x70
#define CHCR_TS_LOW_SHIFT 4
#define CHCR_TS_HIGH_MASK 0
#define CHCR_TS_HIGH_SHIFT 0
#define DMAOR_COD 0x00000008 #define DMAOR_COD 0x00000008
/*
* The SuperH DMAC supports a number of transmit sizes, we list them here,
* with their respective values as they appear in the CHCR registers.
*
* Defaults to a 64-bit transfer size.
*/
enum {
XMIT_SZ_8BIT = 1,
XMIT_SZ_16BIT = 2,
XMIT_SZ_32BIT = 3,
XMIT_SZ_64BIT = 0,
XMIT_SZ_256BIT = 4,
};
/*
* The DMA count is defined as the number of bytes to transfer.
*/
#define TS_SHIFT { \
[XMIT_SZ_8BIT] = 0, \
[XMIT_SZ_16BIT] = 1, \
[XMIT_SZ_32BIT] = 2, \
[XMIT_SZ_64BIT] = 3, \
[XMIT_SZ_256BIT] = 5, \
}
#define TS_INDEX2VAL(i) (((i) & 7) << CHCR_TS_LOW_SHIFT)
#endif #endif
#endif /* __ASM_CPU_SH4_DMA_H */ #endif /* __ASM_CPU_SH4_DMA_H */
#ifndef __ASM_SH_MIGOR_H #ifndef __ASM_SH_MIGOR_H
#define __ASM_SH_MIGOR_H #define __ASM_SH_MIGOR_H
#define PORT_MSELCRA 0xa4050180
#define PORT_MSELCRB 0xa4050182 #define PORT_MSELCRB 0xa4050182
#define BSC_CS4BCR 0xfec10010 #define BSC_CS4BCR 0xfec10010
#define BSC_CS6ABCR 0xfec1001c #define BSC_CS6ABCR 0xfec1001c
......
...@@ -7,19 +7,167 @@ ...@@ -7,19 +7,167 @@
* License. See the file "COPYING" in the main directory of this archive * License. See the file "COPYING" in the main directory of this archive
* for more details. * for more details.
*/ */
#include <linux/platform_device.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h>
#include <linux/platform_device.h>
#include <linux/serial.h> #include <linux/serial.h>
#include <linux/serial_sci.h> #include <linux/serial_sci.h>
#include <linux/mm.h> #include <linux/sh_timer.h>
#include <linux/uio_driver.h> #include <linux/uio_driver.h>
#include <linux/usb/m66592.h> #include <linux/usb/m66592.h>
#include <linux/sh_timer.h>
#include <asm/clock.h> #include <asm/clock.h>
#include <asm/dmaengine.h>
#include <asm/mmzone.h> #include <asm/mmzone.h>
#include <asm/dma-sh.h> #include <asm/siu.h>
#include <cpu/dma-register.h>
#include <cpu/sh7722.h> #include <cpu/sh7722.h>
static struct sh_dmae_slave_config sh7722_dmae_slaves[] = {
{
.slave_id = SHDMA_SLAVE_SCIF0_TX,
.addr = 0xffe0000c,
.chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
.mid_rid = 0x21,
}, {
.slave_id = SHDMA_SLAVE_SCIF0_RX,
.addr = 0xffe00014,
.chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
.mid_rid = 0x22,
}, {
.slave_id = SHDMA_SLAVE_SCIF1_TX,
.addr = 0xffe1000c,
.chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
.mid_rid = 0x25,
}, {
.slave_id = SHDMA_SLAVE_SCIF1_RX,
.addr = 0xffe10014,
.chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
.mid_rid = 0x26,
}, {
.slave_id = SHDMA_SLAVE_SCIF2_TX,
.addr = 0xffe2000c,
.chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
.mid_rid = 0x29,
}, {
.slave_id = SHDMA_SLAVE_SCIF2_RX,
.addr = 0xffe20014,
.chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
.mid_rid = 0x2a,
}, {
.slave_id = SHDMA_SLAVE_SIUA_TX,
.addr = 0xa454c098,
.chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT),
.mid_rid = 0xb1,
}, {
.slave_id = SHDMA_SLAVE_SIUA_RX,
.addr = 0xa454c090,
.chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT),
.mid_rid = 0xb2,
}, {
.slave_id = SHDMA_SLAVE_SIUB_TX,
.addr = 0xa454c09c,
.chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT),
.mid_rid = 0xb5,
}, {
.slave_id = SHDMA_SLAVE_SIUB_RX,
.addr = 0xa454c094,
.chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT),
.mid_rid = 0xb6,
},
};
static struct sh_dmae_channel sh7722_dmae_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 dma_platform_data = {
.slave = sh7722_dmae_slaves,
.slave_num = ARRAY_SIZE(sh7722_dmae_slaves),
.channel = sh7722_dmae_channels,
.channel_num = ARRAY_SIZE(sh7722_dmae_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 struct resource sh7722_dmae_resources[] = {
[0] = {
/* Channel registers and DMAOR */
.start = 0xfe008020,
.end = 0xfe00808f,
.flags = IORESOURCE_MEM,
},
[1] = {
/* DMARSx */
.start = 0xfe009000,
.end = 0xfe00900b,
.flags = IORESOURCE_MEM,
},
{
/* DMA error IRQ */
.start = 78,
.end = 78,
.flags = IORESOURCE_IRQ,
},
{
/* IRQ for channels 0-3 */
.start = 48,
.end = 51,
.flags = IORESOURCE_IRQ,
},
{
/* IRQ for channels 4-5 */
.start = 76,
.end = 77,
.flags = IORESOURCE_IRQ,
},
};
struct platform_device dma_device = {
.name = "sh-dma-engine",
.id = -1,
.resource = sh7722_dmae_resources,
.num_resources = ARRAY_SIZE(sh7722_dmae_resources),
.dev = {
.platform_data = &dma_platform_data,
},
.archdata = {
.hwblk_id = HWBLK_DMAC,
},
};
/* Serial */ /* Serial */
static struct plat_sci_port scif0_platform_data = { static struct plat_sci_port scif0_platform_data = {
.mapbase = 0xffe00000, .mapbase = 0xffe00000,
...@@ -388,15 +536,36 @@ static struct platform_device tmu2_device = { ...@@ -388,15 +536,36 @@ static struct platform_device tmu2_device = {
}, },
}; };
static struct sh_dmae_pdata dma_platform_data = { static struct siu_platform siu_platform_data = {
.mode = 0, .dma_dev = &dma_device.dev,
.dma_slave_tx_a = SHDMA_SLAVE_SIUA_TX,
.dma_slave_rx_a = SHDMA_SLAVE_SIUA_RX,
.dma_slave_tx_b = SHDMA_SLAVE_SIUB_TX,
.dma_slave_rx_b = SHDMA_SLAVE_SIUB_RX,
}; };
static struct platform_device dma_device = { static struct resource siu_resources[] = {
.name = "sh-dma-engine", [0] = {
.start = 0xa4540000,
.end = 0xa454c10f,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = 108,
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device siu_device = {
.name = "sh_siu",
.id = -1, .id = -1,
.dev = { .dev = {
.platform_data = &dma_platform_data, .platform_data = &siu_platform_data,
},
.resource = siu_resources,
.num_resources = ARRAY_SIZE(siu_resources),
.archdata = {
.hwblk_id = HWBLK_SIU,
}, },
}; };
...@@ -414,6 +583,7 @@ static struct platform_device *sh7722_devices[] __initdata = { ...@@ -414,6 +583,7 @@ static struct platform_device *sh7722_devices[] __initdata = {
&vpu_device, &vpu_device,
&veu_device, &veu_device,
&jpu_device, &jpu_device,
&siu_device,
&dma_device, &dma_device,
}; };
......
...@@ -21,22 +21,189 @@ ...@@ -21,22 +21,189 @@
#include <linux/sh_timer.h> #include <linux/sh_timer.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/notifier.h> #include <linux/notifier.h>
#include <asm/suspend.h> #include <asm/suspend.h>
#include <asm/clock.h> #include <asm/clock.h>
#include <asm/dma-sh.h> #include <asm/dmaengine.h>
#include <asm/mmzone.h> #include <asm/mmzone.h>
#include <cpu/dma-register.h>
#include <cpu/sh7724.h> #include <cpu/sh7724.h>
/* DMA */ /* DMA */
static struct sh_dmae_pdata dma_platform_data = { static struct sh_dmae_channel sh7724_dmae0_channels[] = {
.mode = SHDMA_DMAOR1, {
.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 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 struct sh_dmae_pdata dma1_platform_data = {
.channel = sh7724_dmae1_channels,
.channel_num = ARRAY_SIZE(sh7724_dmae1_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 sh7724_dmae0_resources[] = {
{
/* Channel registers and DMAOR */
.start = 0xfe008020,
.end = 0xfe00808f,
.flags = IORESOURCE_MEM,
},
{
/* DMARSx */
.start = 0xfe009000,
.end = 0xfe00900b,
.flags = IORESOURCE_MEM,
},
{
/* DMA error IRQ */
.start = 78,
.end = 78,
.flags = IORESOURCE_IRQ,
},
{
/* IRQ for channels 0-3 */
.start = 48,
.end = 51,
.flags = IORESOURCE_IRQ,
},
{
/* IRQ for channels 4-5 */
.start = 76,
.end = 77,
.flags = IORESOURCE_IRQ,
},
};
/* Resource order important! */
static struct resource sh7724_dmae1_resources[] = {
{
/* Channel registers and DMAOR */
.start = 0xfdc08020,
.end = 0xfdc0808f,
.flags = IORESOURCE_MEM,
},
{
/* DMARSx */
.start = 0xfdc09000,
.end = 0xfdc0900b,
.flags = IORESOURCE_MEM,
},
{
/* DMA error IRQ */
.start = 74,
.end = 74,
.flags = IORESOURCE_IRQ,
},
{
/* IRQ for channels 0-3 */
.start = 40,
.end = 43,
.flags = IORESOURCE_IRQ,
},
{
/* IRQ for channels 4-5 */
.start = 72,
.end = 73,
.flags = IORESOURCE_IRQ,
},
}; };
static struct platform_device dma_device = { static struct platform_device dma0_device = {
.name = "sh-dma-engine", .name = "sh-dma-engine",
.id = -1, .id = 0,
.resource = sh7724_dmae0_resources,
.num_resources = ARRAY_SIZE(sh7724_dmae0_resources),
.dev = {
.platform_data = &dma0_platform_data,
},
.archdata = {
.hwblk_id = HWBLK_DMAC0,
},
};
static struct platform_device dma1_device = {
.name = "sh-dma-engine",
.id = 1,
.resource = sh7724_dmae1_resources,
.num_resources = ARRAY_SIZE(sh7724_dmae1_resources),
.dev = { .dev = {
.platform_data = &dma_platform_data, .platform_data = &dma1_platform_data,
},
.archdata = {
.hwblk_id = HWBLK_DMAC1,
}, },
}; };
...@@ -663,7 +830,8 @@ static struct platform_device *sh7724_devices[] __initdata = { ...@@ -663,7 +830,8 @@ static struct platform_device *sh7724_devices[] __initdata = {
&tmu3_device, &tmu3_device,
&tmu4_device, &tmu4_device,
&tmu5_device, &tmu5_device,
&dma_device, &dma0_device,
&dma1_device,
&rtc_device, &rtc_device,
&iic0_device, &iic0_device,
&iic1_device, &iic1_device,
......
...@@ -13,7 +13,10 @@ ...@@ -13,7 +13,10 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/serial_sci.h> #include <linux/serial_sci.h>
#include <linux/sh_timer.h> #include <linux/sh_timer.h>
#include <asm/dma-sh.h>
#include <asm/dmaengine.h>
#include <cpu/dma-register.h>
static struct plat_sci_port scif0_platform_data = { static struct plat_sci_port scif0_platform_data = {
.mapbase = 0xffe00000, .mapbase = 0xffe00000,
...@@ -247,15 +250,131 @@ static struct platform_device rtc_device = { ...@@ -247,15 +250,131 @@ static struct platform_device rtc_device = {
.resource = rtc_resources, .resource = rtc_resources,
}; };
static struct sh_dmae_pdata dma_platform_data = { /* DMA */
.mode = (SHDMA_MIX_IRQ | SHDMA_DMAOR1), static struct sh_dmae_channel sh7780_dmae0_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 struct sh_dmae_channel sh7780_dmae1_channels[] = {
{
.offset = 0,
}, {
.offset = 0x10,
}, {
.offset = 0x20,
}, {
.offset = 0x30,
}, {
.offset = 0x50,
}, {
.offset = 0x60,
}
};
static unsigned int ts_shift[] = TS_SHIFT;
static struct sh_dmae_pdata dma0_platform_data = {
.channel = sh7780_dmae0_channels,
.channel_num = ARRAY_SIZE(sh7780_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 struct sh_dmae_pdata dma1_platform_data = {
.channel = sh7780_dmae1_channels,
.channel_num = ARRAY_SIZE(sh7780_dmae1_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 struct resource sh7780_dmae0_resources[] = {
[0] = {
/* Channel registers and DMAOR */
.start = 0xfc808020,
.end = 0xfc80808f,
.flags = IORESOURCE_MEM,
},
[1] = {
/* DMARSx */
.start = 0xfc809000,
.end = 0xfc80900b,
.flags = IORESOURCE_MEM,
},
{
/* Real DMA error IRQ is 38, and channel IRQs are 34-37, 44-45 */
.start = 34,
.end = 34,
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
},
};
static struct resource sh7780_dmae1_resources[] = {
[0] = {
/* Channel registers and DMAOR */
.start = 0xfc818020,
.end = 0xfc81808f,
.flags = IORESOURCE_MEM,
},
/* DMAC1 has no DMARS */
{
/* Real DMA error IRQ is 38, and channel IRQs are 46-47, 92-95 */
.start = 46,
.end = 46,
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
},
}; };
static struct platform_device dma_device = { static struct platform_device dma0_device = {
.name = "sh-dma-engine", .name = "sh-dma-engine",
.id = -1, .id = 0,
.resource = sh7780_dmae0_resources,
.num_resources = ARRAY_SIZE(sh7780_dmae0_resources),
.dev = {
.platform_data = &dma0_platform_data,
},
};
static struct platform_device dma1_device = {
.name = "sh-dma-engine",
.id = 1,
.resource = sh7780_dmae1_resources,
.num_resources = ARRAY_SIZE(sh7780_dmae1_resources),
.dev = { .dev = {
.platform_data = &dma_platform_data, .platform_data = &dma1_platform_data,
}, },
}; };
...@@ -269,7 +388,8 @@ static struct platform_device *sh7780_devices[] __initdata = { ...@@ -269,7 +388,8 @@ static struct platform_device *sh7780_devices[] __initdata = {
&tmu4_device, &tmu4_device,
&tmu5_device, &tmu5_device,
&rtc_device, &rtc_device,
&dma_device, &dma0_device,
&dma1_device,
}; };
static int __init sh7780_devices_setup(void) static int __init sh7780_devices_setup(void)
......
...@@ -14,9 +14,12 @@ ...@@ -14,9 +14,12 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/sh_timer.h> #include <linux/sh_timer.h>
#include <asm/dma-sh.h>
#include <asm/dmaengine.h>
#include <asm/mmzone.h> #include <asm/mmzone.h>
#include <cpu/dma-register.h>
static struct plat_sci_port scif0_platform_data = { static struct plat_sci_port scif0_platform_data = {
.mapbase = 0xffea0000, .mapbase = 0xffea0000,
.flags = UPF_BOOT_AUTOCONF, .flags = UPF_BOOT_AUTOCONF,
...@@ -295,15 +298,131 @@ static struct platform_device tmu5_device = { ...@@ -295,15 +298,131 @@ static struct platform_device tmu5_device = {
.num_resources = ARRAY_SIZE(tmu5_resources), .num_resources = ARRAY_SIZE(tmu5_resources),
}; };
static struct sh_dmae_pdata dma_platform_data = { /* DMA */
.mode = (SHDMA_MIX_IRQ | SHDMA_DMAOR1), static struct sh_dmae_channel sh7785_dmae0_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 struct sh_dmae_channel sh7785_dmae1_channels[] = {
{
.offset = 0,
}, {
.offset = 0x10,
}, {
.offset = 0x20,
}, {
.offset = 0x30,
}, {
.offset = 0x50,
}, {
.offset = 0x60,
}
};
static unsigned int ts_shift[] = TS_SHIFT;
static struct sh_dmae_pdata dma0_platform_data = {
.channel = sh7785_dmae0_channels,
.channel_num = ARRAY_SIZE(sh7785_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 struct platform_device dma_device = { static struct sh_dmae_pdata dma1_platform_data = {
.channel = sh7785_dmae1_channels,
.channel_num = ARRAY_SIZE(sh7785_dmae1_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 struct resource sh7785_dmae0_resources[] = {
[0] = {
/* Channel registers and DMAOR */
.start = 0xfc808020,
.end = 0xfc80808f,
.flags = IORESOURCE_MEM,
},
[1] = {
/* DMARSx */
.start = 0xfc809000,
.end = 0xfc80900b,
.flags = IORESOURCE_MEM,
},
{
/* Real DMA error IRQ is 39, and channel IRQs are 33-38 */
.start = 33,
.end = 33,
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
},
};
static struct resource sh7785_dmae1_resources[] = {
[0] = {
/* Channel registers and DMAOR */
.start = 0xfcc08020,
.end = 0xfcc0808f,
.flags = IORESOURCE_MEM,
},
/* DMAC1 has no DMARS */
{
/* Real DMA error IRQ is 58, and channel IRQs are 52-57 */
.start = 52,
.end = 52,
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
},
};
static struct platform_device dma0_device = {
.name = "sh-dma-engine",
.id = 0,
.resource = sh7785_dmae0_resources,
.num_resources = ARRAY_SIZE(sh7785_dmae0_resources),
.dev = {
.platform_data = &dma0_platform_data,
},
};
static struct platform_device dma1_device = {
.name = "sh-dma-engine", .name = "sh-dma-engine",
.id = -1, .id = 1,
.resource = sh7785_dmae1_resources,
.num_resources = ARRAY_SIZE(sh7785_dmae1_resources),
.dev = { .dev = {
.platform_data = &dma_platform_data, .platform_data = &dma1_platform_data,
}, },
}; };
...@@ -320,7 +439,8 @@ static struct platform_device *sh7785_devices[] __initdata = { ...@@ -320,7 +439,8 @@ static struct platform_device *sh7785_devices[] __initdata = {
&tmu3_device, &tmu3_device,
&tmu4_device, &tmu4_device,
&tmu5_device, &tmu5_device,
&dma_device, &dma0_device,
&dma1_device,
}; };
static int __init sh7785_devices_setup(void) static int __init sh7785_devices_setup(void)
......
...@@ -143,26 +143,6 @@ static int arch_check_va_in_kernelspace(unsigned long va, u8 hbp_len) ...@@ -143,26 +143,6 @@ static int arch_check_va_in_kernelspace(unsigned long va, u8 hbp_len)
return (va >= TASK_SIZE) && ((va + len - 1) >= TASK_SIZE); return (va >= TASK_SIZE) && ((va + len - 1) >= TASK_SIZE);
} }
/*
* Store a breakpoint's encoded address, length, and type.
*/
static int arch_store_info(struct perf_event *bp)
{
struct arch_hw_breakpoint *info = counter_arch_bp(bp);
/*
* User-space requests will always have the address field populated
* For kernel-addresses, either the address or symbol name can be
* specified.
*/
if (info->name)
info->address = (unsigned long)kallsyms_lookup_name(info->name);
if (info->address)
return 0;
return -EINVAL;
}
int arch_bp_generic_fields(int sh_len, int sh_type, int arch_bp_generic_fields(int sh_len, int sh_type,
int *gen_len, int *gen_type) int *gen_len, int *gen_type)
{ {
...@@ -276,10 +256,12 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp, ...@@ -276,10 +256,12 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp,
return ret; return ret;
} }
ret = arch_store_info(bp); /*
* For kernel-addresses, either the address or symbol name can be
if (ret < 0) * specified.
return ret; */
if (info->name)
info->address = (unsigned long)kallsyms_lookup_name(info->name);
/* /*
* Check that the low-order bits of the address are appropriate * Check that the low-order bits of the address are appropriate
......
...@@ -443,7 +443,7 @@ void __init setup_arch(char **cmdline_p) ...@@ -443,7 +443,7 @@ void __init setup_arch(char **cmdline_p)
nodes_clear(node_online_map); nodes_clear(node_online_map);
/* Setup bootmem with available RAM */ pmb_init();
lmb_init(); lmb_init();
setup_memory(); setup_memory();
sparse_init(); sparse_init();
...@@ -452,7 +452,6 @@ void __init setup_arch(char **cmdline_p) ...@@ -452,7 +452,6 @@ void __init setup_arch(char **cmdline_p)
conswitchp = &dummy_con; conswitchp = &dummy_con;
#endif #endif
paging_init(); paging_init();
pmb_init();
ioremap_fixed_init(); ioremap_fixed_init();
......
...@@ -39,12 +39,12 @@ static int null_rtc_set_time(const time_t secs) ...@@ -39,12 +39,12 @@ static int null_rtc_set_time(const time_t secs)
void (*rtc_sh_get_time)(struct timespec *) = null_rtc_get_time; void (*rtc_sh_get_time)(struct timespec *) = null_rtc_get_time;
int (*rtc_sh_set_time)(const time_t) = null_rtc_set_time; int (*rtc_sh_set_time)(const time_t) = null_rtc_set_time;
#ifdef CONFIG_GENERIC_CMOS_UPDATE
void read_persistent_clock(struct timespec *ts) void read_persistent_clock(struct timespec *ts)
{ {
rtc_sh_get_time(ts); rtc_sh_get_time(ts);
} }
#ifdef CONFIG_GENERIC_CMOS_UPDATE
int update_persistent_clock(struct timespec now) int update_persistent_clock(struct timespec now)
{ {
return rtc_sh_set_time(now.tv_sec); return rtc_sh_set_time(now.tv_sec);
...@@ -113,9 +113,5 @@ void __init time_init(void) ...@@ -113,9 +113,5 @@ void __init time_init(void)
hwblk_init(); hwblk_init();
clk_init(); clk_init();
rtc_sh_get_time(&xtime);
set_normalized_timespec(&wall_to_monotonic,
-xtime.tv_sec, -xtime.tv_nsec);
late_time_init = sh_late_time_init; late_time_init = sh_late_time_init;
} }
...@@ -17,8 +17,7 @@ struct DWstruct { ...@@ -17,8 +17,7 @@ struct DWstruct {
#error I feel sick. #error I feel sick.
#endif #endif
typedef union typedef union {
{
struct DWstruct s; struct DWstruct s;
long long ll; long long ll;
} DWunion; } DWunion;
......
...@@ -34,17 +34,32 @@ ...@@ -34,17 +34,32 @@
* caller shouldn't need to know that small detail. * caller shouldn't need to know that small detail.
*/ */
void __iomem * __init_refok void __iomem * __init_refok
__ioremap_caller(unsigned long phys_addr, unsigned long size, __ioremap_caller(phys_addr_t phys_addr, unsigned long size,
pgprot_t pgprot, void *caller) pgprot_t pgprot, void *caller)
{ {
struct vm_struct *area; struct vm_struct *area;
unsigned long offset, last_addr, addr, orig_addr; unsigned long offset, last_addr, addr, orig_addr;
void __iomem *mapped;
/* Don't allow wraparound or zero size */ /* Don't allow wraparound or zero size */
last_addr = phys_addr + size - 1; last_addr = phys_addr + size - 1;
if (!size || last_addr < phys_addr) if (!size || last_addr < phys_addr)
return NULL; return NULL;
/*
* If we can't yet use the regular approach, go the fixmap route.
*/
if (!mem_init_done)
return ioremap_fixed(phys_addr, size, pgprot);
/*
* First try to remap through the PMB.
* PMB entries are all pre-faulted.
*/
mapped = pmb_remap_caller(phys_addr, size, pgprot, caller);
if (mapped && !IS_ERR(mapped))
return mapped;
/* /*
* Mappings have to be page-aligned * Mappings have to be page-aligned
*/ */
...@@ -52,12 +67,6 @@ __ioremap_caller(unsigned long phys_addr, unsigned long size, ...@@ -52,12 +67,6 @@ __ioremap_caller(unsigned long phys_addr, unsigned long size,
phys_addr &= PAGE_MASK; phys_addr &= PAGE_MASK;
size = PAGE_ALIGN(last_addr+1) - phys_addr; size = PAGE_ALIGN(last_addr+1) - phys_addr;
/*
* If we can't yet use the regular approach, go the fixmap route.
*/
if (!mem_init_done)
return ioremap_fixed(phys_addr, offset, size, pgprot);
/* /*
* Ok, go for it.. * Ok, go for it..
*/ */
...@@ -67,29 +76,6 @@ __ioremap_caller(unsigned long phys_addr, unsigned long size, ...@@ -67,29 +76,6 @@ __ioremap_caller(unsigned long phys_addr, unsigned long size,
area->phys_addr = phys_addr; area->phys_addr = phys_addr;
orig_addr = addr = (unsigned long)area->addr; orig_addr = addr = (unsigned long)area->addr;
#ifdef CONFIG_PMB
/*
* First try to remap through the PMB once a valid VMA has been
* established. Smaller allocations (or the rest of the size
* remaining after a PMB mapping due to the size not being
* perfectly aligned on a PMB size boundary) are then mapped
* through the UTLB using conventional page tables.
*
* PMB entries are all pre-faulted.
*/
if (unlikely(phys_addr >= P1SEG)) {
unsigned long mapped;
mapped = pmb_remap(addr, phys_addr, size, pgprot);
if (likely(mapped)) {
addr += mapped;
phys_addr += mapped;
size -= mapped;
}
}
#endif
if (likely(size))
if (ioremap_page_range(addr, addr + size, phys_addr, pgprot)) { if (ioremap_page_range(addr, addr + size, phys_addr, pgprot)) {
vunmap((void *)orig_addr); vunmap((void *)orig_addr);
return NULL; return NULL;
...@@ -133,23 +119,11 @@ void __iounmap(void __iomem *addr) ...@@ -133,23 +119,11 @@ void __iounmap(void __iomem *addr)
if (iounmap_fixed(addr) == 0) if (iounmap_fixed(addr) == 0)
return; return;
#ifdef CONFIG_PMB
/* /*
* Purge any PMB entries that may have been established for this * If the PMB handled it, there's nothing else to do.
* mapping, then proceed with conventional VMA teardown.
*
* XXX: Note that due to the way that remove_vm_area() does
* matching of the resultant VMA, we aren't able to fast-forward
* the address past the PMB space until the end of the VMA where
* the page tables reside. As such, unmap_vm_area() will be
* forced to linearly scan over the area until it finds the page
* tables where PTEs that need to be unmapped actually reside,
* which is far from optimal. Perhaps we need to use a separate
* VMA for the PMB mappings?
* -- PFM.
*/ */
pmb_unmap(vaddr); if (pmb_unmap(addr) == 0)
#endif return;
p = remove_vm_area((void *)(vaddr & PAGE_MASK)); p = remove_vm_area((void *)(vaddr & PAGE_MASK));
if (!p) { if (!p) {
......
...@@ -45,14 +45,21 @@ void __init ioremap_fixed_init(void) ...@@ -45,14 +45,21 @@ void __init ioremap_fixed_init(void)
} }
void __init __iomem * void __init __iomem *
ioremap_fixed(resource_size_t phys_addr, unsigned long offset, ioremap_fixed(phys_addr_t phys_addr, unsigned long size, pgprot_t prot)
unsigned long size, pgprot_t prot)
{ {
enum fixed_addresses idx0, idx; enum fixed_addresses idx0, idx;
struct ioremap_map *map; struct ioremap_map *map;
unsigned int nrpages; unsigned int nrpages;
unsigned long offset;
int i, slot; int i, slot;
/*
* Mappings have to be page-aligned
*/
offset = phys_addr & ~PAGE_MASK;
phys_addr &= PAGE_MASK;
size = PAGE_ALIGN(phys_addr + size) - phys_addr;
slot = -1; slot = -1;
for (i = 0; i < FIX_N_IOREMAPS; i++) { for (i = 0; i < FIX_N_IOREMAPS; i++) {
map = &ioremap_maps[i]; map = &ioremap_maps[i];
......
...@@ -74,6 +74,9 @@ void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end) ...@@ -74,6 +74,9 @@ void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end)
start_pfn = start >> PAGE_SHIFT; start_pfn = start >> PAGE_SHIFT;
end_pfn = end >> PAGE_SHIFT; end_pfn = end >> PAGE_SHIFT;
pmb_bolt_mapping((unsigned long)__va(start), start, end - start,
PAGE_KERNEL);
lmb_add(start, end - start); lmb_add(start, end - start);
__add_active_range(nid, start_pfn, end_pfn); __add_active_range(nid, start_pfn, end_pfn);
......
This diff is collapsed.
This diff is collapsed.
...@@ -17,23 +17,9 @@ ...@@ -17,23 +17,9 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/list.h> #include <linux/list.h>
#define SH_DMA_TCR_MAX 0x00FFFFFF /* 16MB */ #include <asm/dmaengine.h>
struct sh_dmae_regs {
u32 sar; /* SAR / source address */
u32 dar; /* DAR / destination address */
u32 tcr; /* TCR / transfer count */
};
struct sh_desc { #define SH_DMA_TCR_MAX 0x00FFFFFF /* 16MB */
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;
int chunks;
int mark;
};
struct device; struct device;
...@@ -47,14 +33,18 @@ struct sh_dmae_chan { ...@@ -47,14 +33,18 @@ struct sh_dmae_chan {
struct tasklet_struct tasklet; /* Tasklet */ struct tasklet_struct tasklet; /* Tasklet */
int descs_allocated; /* desc count */ int descs_allocated; /* desc count */
int xmit_shift; /* log_2(bytes_per_xfer) */ int xmit_shift; /* log_2(bytes_per_xfer) */
int irq;
int id; /* Raw id of this channel */ int id; /* Raw id of this channel */
u32 __iomem *base;
char dev_id[16]; /* unique name per DMAC of channel */ char dev_id[16]; /* unique name per DMAC of channel */
}; };
struct sh_dmae_device { struct sh_dmae_device {
struct dma_device common; struct dma_device common;
struct sh_dmae_chan *chan[MAX_DMA_CHANNELS]; struct sh_dmae_chan *chan[SH_DMAC_MAX_CHANNELS];
struct sh_dmae_pdata pdata; struct sh_dmae_pdata *pdata;
u32 __iomem *chan_reg;
u16 __iomem *dmars;
}; };
#define to_sh_chan(chan) container_of(chan, struct sh_dmae_chan, common) #define to_sh_chan(chan) container_of(chan, struct sh_dmae_chan, common)
......
...@@ -1009,6 +1009,10 @@ config SERIAL_SH_SCI_CONSOLE ...@@ -1009,6 +1009,10 @@ config SERIAL_SH_SCI_CONSOLE
depends on SERIAL_SH_SCI=y depends on SERIAL_SH_SCI=y
select SERIAL_CORE_CONSOLE select SERIAL_CORE_CONSOLE
config SERIAL_SH_SCI_DMA
bool "DMA support"
depends on SERIAL_SH_SCI && SH_DMAE && EXPERIMENTAL
config SERIAL_PNX8XXX config SERIAL_PNX8XXX
bool "Enable PNX8XXX SoCs' UART Support" bool "Enable PNX8XXX SoCs' UART Support"
depends on MIPS && (SOC_PNX8550 || SOC_PNX833X) depends on MIPS && (SOC_PNX8550 || SOC_PNX833X)
......
This diff is collapsed.
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#define __LINUX_SERIAL_SCI_H #define __LINUX_SERIAL_SCI_H
#include <linux/serial_core.h> #include <linux/serial_core.h>
#include <asm/dmaengine.h>
/* /*
* Generic header for SuperH SCI(F) (used by sh/sh64/h8300 and related parts) * Generic header for SuperH SCI(F) (used by sh/sh64/h8300 and related parts)
...@@ -16,6 +17,8 @@ enum { ...@@ -16,6 +17,8 @@ enum {
SCIx_NR_IRQS, SCIx_NR_IRQS,
}; };
struct device;
/* /*
* Platform device specific platform_data struct * Platform device specific platform_data struct
*/ */
...@@ -26,6 +29,9 @@ struct plat_sci_port { ...@@ -26,6 +29,9 @@ struct plat_sci_port {
unsigned int type; /* SCI / SCIF / IRDA */ unsigned int type; /* SCI / SCIF / IRDA */
upf_t flags; /* UPF_* flags */ upf_t flags; /* UPF_* flags */
char *clk; /* clock string */ char *clk; /* clock string */
struct device *dma_dev;
enum sh_dmae_slave_chan_id dma_slave_tx;
enum sh_dmae_slave_chan_id dma_slave_rx;
}; };
#endif /* __LINUX_SERIAL_SCI_H */ #endif /* __LINUX_SERIAL_SCI_H */
...@@ -72,7 +72,7 @@ struct siu_firmware { ...@@ -72,7 +72,7 @@ struct siu_firmware {
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/io.h> #include <linux/io.h>
#include <asm/dma-sh.h> #include <asm/dmaengine.h>
#include <sound/core.h> #include <sound/core.h>
#include <sound/pcm.h> #include <sound/pcm.h>
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include <sound/pcm_params.h> #include <sound/pcm_params.h>
#include <sound/soc-dai.h> #include <sound/soc-dai.h>
#include <asm/dma-sh.h> #include <asm/dmaengine.h>
#include <asm/siu.h> #include <asm/siu.h>
#include "siu.h" #include "siu.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment