-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ARM] 5466/1: Freescale STMP platform support [5/10]
Shared (platform) headers Signed-off-by: dmitry pervushin <dpervushin@embeddedalley.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
- Loading branch information
dmitry pervushin
authored and
Russell King
committed
Apr 27, 2009
1 parent
07d9714
commit e317872
Showing
17 changed files
with
951 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | ||
* Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. | ||
* | ||
* The code contained herein is licensed under the GNU General Public | ||
* License. You may obtain a copy of the GNU General Public License | ||
* Version 2 or later at the following locations: | ||
* | ||
* http://www.opensource.org/licenses/gpl-license.html | ||
* http://www.gnu.org/copyleft/gpl.html | ||
*/ | ||
#ifndef __ASM_MACH_CLKDEV_H | ||
#define __ASM_MACH_CLKDEV_H | ||
|
||
#define __clk_get(clk) ({ 1; }) | ||
#define __clk_put(clk) do { } while (0) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Freescale STMP37XX/STMP378X CPU type detection | ||
* | ||
* Embedded Alley Solutions, Inc <source@embeddedalley.com> | ||
* | ||
* Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | ||
* Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. | ||
*/ | ||
|
||
/* | ||
* The code contained herein is licensed under the GNU General Public | ||
* License. You may obtain a copy of the GNU General Public License | ||
* Version 2 or later at the following locations: | ||
* | ||
* http://www.opensource.org/licenses/gpl-license.html | ||
* http://www.gnu.org/copyleft/gpl.html | ||
*/ | ||
#ifndef __ASM_PLAT_CPU_H | ||
#define __ASM_PLAT_CPU_H | ||
|
||
#ifdef CONFIG_ARCH_STMP37XX | ||
#define cpu_is_stmp37xx() (1) | ||
#else | ||
#define cpu_is_stmp37xx() (0) | ||
#endif | ||
|
||
#ifdef CONFIG_ARCH_STMP378X | ||
#define cpu_is_stmp378x() (1) | ||
#else | ||
#define cpu_is_stmp378x() (0) | ||
#endif | ||
|
||
#endif /* __ASM_PLAT_CPU_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Debugging macro include header | ||
* | ||
* Embedded Alley Solutions, Inc <source@embeddedalley.com> | ||
* | ||
* Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | ||
* Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. | ||
*/ | ||
|
||
/* | ||
* The code contained herein is licensed under the GNU General Public | ||
* License. You may obtain a copy of the GNU General Public License | ||
* Version 2 or later at the following locations: | ||
* | ||
* http://www.opensource.org/licenses/gpl-license.html | ||
* http://www.gnu.org/copyleft/gpl.html | ||
*/ | ||
|
||
.macro addruart,rx | ||
mrc p15, 0, \rx, c1, c0 | ||
tst \rx, #1 @ MMU enabled? | ||
moveq \rx, #0x80000000 @ physical base address | ||
addeq \rx, \rx, #0x00070000 | ||
movne \rx, #0xf0000000 @ virtual base | ||
addne \rx, \rx, #0x00070000 | ||
.endm | ||
|
||
.macro senduart,rd,rx | ||
strb \rd, [\rx, #0] @ data register at 0 | ||
.endm | ||
|
||
.macro waituart,rd,rx | ||
1001: ldr \rd, [\rx, #0x18] @ UARTFLG | ||
tst \rd, #1 << 5 @ UARTFLGUTXFF - 1 when full | ||
bne 1001b | ||
.endm | ||
|
||
.macro busyuart,rd,rx | ||
1001: ldr \rd, [\rx, #0x18] @ UARTFLG | ||
tst \rd, #1 << 3 @ UARTFLGUBUSY - 1 when busy | ||
bne 1001b | ||
.endm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
/* | ||
* Freescale STMP37XX/STMP378X DMA helper interface | ||
* | ||
* Embedded Alley Solutions, Inc <source@embeddedalley.com> | ||
* | ||
* Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | ||
* Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. | ||
*/ | ||
|
||
/* | ||
* The code contained herein is licensed under the GNU General Public | ||
* License. You may obtain a copy of the GNU General Public License | ||
* Version 2 or later at the following locations: | ||
* | ||
* http://www.opensource.org/licenses/gpl-license.html | ||
* http://www.gnu.org/copyleft/gpl.html | ||
*/ | ||
#ifndef __ASM_PLAT_STMP3XXX_DMA_H | ||
#define __ASM_PLAT_STMP3XXX_DMA_H | ||
|
||
#include <linux/platform_device.h> | ||
#include <linux/dmapool.h> | ||
|
||
#if !defined(MAX_PIO_WORDS) | ||
#define MAX_PIO_WORDS (15) | ||
#endif | ||
|
||
#define STMP3XXX_BUS_APBH 0 | ||
#define STMP3XXX_BUS_APBX 1 | ||
#define STMP3XXX_DMA_MAX_CHANNEL 16 | ||
|
||
|
||
#define STMP3xxx_DMA(channel, bus) ((bus) * 16 + (channel)) | ||
|
||
#define MAX_DMA_ADDRESS 0xffffffff | ||
|
||
#define MAX_DMA_CHANNELS 32 | ||
|
||
struct stmp3xxx_dma_command { | ||
u32 next; | ||
u32 cmd; | ||
union { | ||
u32 buf_ptr; | ||
u32 alternate; | ||
}; | ||
u32 pio_words[MAX_PIO_WORDS]; | ||
}; | ||
|
||
struct stmp3xxx_dma_descriptor { | ||
struct stmp3xxx_dma_command *command; | ||
dma_addr_t handle; | ||
|
||
/* The virtual address of the buffer pointer */ | ||
void *virtual_buf_ptr; | ||
/* The next descriptor in a the DMA chain (optional) */ | ||
struct stmp3xxx_dma_descriptor *next_descr; | ||
}; | ||
|
||
struct stmp37xx_circ_dma_chain { | ||
unsigned total_count; | ||
struct stmp3xxx_dma_descriptor *chain; | ||
|
||
unsigned free_index; | ||
unsigned free_count; | ||
unsigned active_index; | ||
unsigned active_count; | ||
unsigned cooked_index; | ||
unsigned cooked_count; | ||
|
||
int bus; | ||
unsigned channel; | ||
}; | ||
|
||
static inline struct stmp3xxx_dma_descriptor | ||
*stmp3xxx_dma_circ_get_free_head(struct stmp37xx_circ_dma_chain *chain) | ||
{ | ||
return &(chain->chain[chain->free_index]); | ||
} | ||
|
||
static inline struct stmp3xxx_dma_descriptor | ||
*stmp3xxx_dma_circ_get_cooked_head(struct stmp37xx_circ_dma_chain *chain) | ||
{ | ||
return &(chain->chain[chain->cooked_index]); | ||
} | ||
|
||
int stmp3xxx_dma_request(int ch, struct device *dev, const char *name); | ||
int stmp3xxx_dma_release(int ch); | ||
int stmp3xxx_dma_allocate_command(int ch, | ||
struct stmp3xxx_dma_descriptor *descriptor); | ||
int stmp3xxx_dma_free_command(int ch, | ||
struct stmp3xxx_dma_descriptor *descriptor); | ||
void stmp3xxx_dma_continue(int channel, u32 semaphore); | ||
void stmp3xxx_dma_go(int ch, struct stmp3xxx_dma_descriptor *head, | ||
u32 semaphore); | ||
int stmp3xxx_dma_running(int ch); | ||
int stmp3xxx_dma_make_chain(int ch, struct stmp37xx_circ_dma_chain *chain, | ||
struct stmp3xxx_dma_descriptor descriptors[], | ||
unsigned items); | ||
void stmp3xxx_dma_free_chain(struct stmp37xx_circ_dma_chain *chain); | ||
void stmp37xx_circ_clear_chain(struct stmp37xx_circ_dma_chain *chain); | ||
void stmp37xx_circ_advance_free(struct stmp37xx_circ_dma_chain *chain, | ||
unsigned count); | ||
void stmp37xx_circ_advance_active(struct stmp37xx_circ_dma_chain *chain, | ||
unsigned count); | ||
unsigned stmp37xx_circ_advance_cooked(struct stmp37xx_circ_dma_chain *chain); | ||
int stmp3xxx_dma_read_semaphore(int ch); | ||
void stmp3xxx_dma_init(void); | ||
void stmp3xxx_dma_set_alt_target(int ch, int target); | ||
void stmp3xxx_dma_suspend(void); | ||
void stmp3xxx_dma_resume(void); | ||
|
||
/* | ||
* STMP37xx and STMP378x have different DMA control | ||
* registers layout | ||
*/ | ||
|
||
void stmp3xxx_arch_dma_freeze(int ch); | ||
void stmp3xxx_arch_dma_unfreeze(int ch); | ||
void stmp3xxx_arch_dma_reset_channel(int ch); | ||
void stmp3xxx_arch_dma_enable_interrupt(int ch); | ||
void stmp3xxx_arch_dma_clear_interrupt(int ch); | ||
int stmp3xxx_arch_dma_is_interrupt(int ch); | ||
|
||
static inline void stmp3xxx_dma_reset_channel(int ch) | ||
{ | ||
stmp3xxx_arch_dma_reset_channel(ch); | ||
} | ||
|
||
|
||
static inline void stmp3xxx_dma_freeze(int ch) | ||
{ | ||
stmp3xxx_arch_dma_freeze(ch); | ||
} | ||
|
||
static inline void stmp3xxx_dma_unfreeze(int ch) | ||
{ | ||
stmp3xxx_arch_dma_unfreeze(ch); | ||
} | ||
|
||
static inline void stmp3xxx_dma_enable_interrupt(int ch) | ||
{ | ||
stmp3xxx_arch_dma_enable_interrupt(ch); | ||
} | ||
|
||
static inline void stmp3xxx_dma_clear_interrupt(int ch) | ||
{ | ||
stmp3xxx_arch_dma_clear_interrupt(ch); | ||
} | ||
|
||
static inline int stmp3xxx_dma_is_interrupt(int ch) | ||
{ | ||
return stmp3xxx_arch_dma_is_interrupt(ch); | ||
} | ||
|
||
#endif /* __ASM_PLAT_STMP3XXX_DMA_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Freescale STMP37XX/STMP378X GPIO interface | ||
* | ||
* Embedded Alley Solutions, Inc <source@embeddedalley.com> | ||
* | ||
* Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | ||
* Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. | ||
*/ | ||
|
||
/* | ||
* The code contained herein is licensed under the GNU General Public | ||
* License. You may obtain a copy of the GNU General Public License | ||
* Version 2 or later at the following locations: | ||
* | ||
* http://www.opensource.org/licenses/gpl-license.html | ||
* http://www.gnu.org/copyleft/gpl.html | ||
*/ | ||
#ifndef __ASM_PLAT_GPIO_H | ||
#define __ASM_PLAT_GPIO_H | ||
|
||
#define ARCH_NR_GPIOS (32 * 3) | ||
#define gpio_to_irq(gpio) __gpio_to_irq(gpio) | ||
#define gpio_get_value(gpio) __gpio_get_value(gpio) | ||
#define gpio_set_value(gpio, value) __gpio_set_value(gpio, value) | ||
|
||
#include <asm-generic/gpio.h> | ||
|
||
#endif /* __ASM_PLAT_GPIO_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* This file contains the hardware definitions of the Freescale STMP3XXX | ||
* | ||
* Copyright (C) 2005 Sigmatel Inc | ||
* | ||
* Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | ||
* Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. | ||
*/ | ||
|
||
/* | ||
* The code contained herein is licensed under the GNU General Public | ||
* License. You may obtain a copy of the GNU General Public License | ||
* Version 2 or later at the following locations: | ||
* | ||
* http://www.opensource.org/licenses/gpl-license.html | ||
* http://www.gnu.org/copyleft/gpl.html | ||
*/ | ||
#ifndef __ASM_ARCH_HARDWARE_H | ||
#define __ASM_ARCH_HARDWARE_H | ||
|
||
/* | ||
* Where in virtual memory the IO devices (timers, system controllers | ||
* and so on) | ||
*/ | ||
#define IO_BASE 0xF0000000 /* VA of IO */ | ||
#define IO_SIZE 0x00100000 /* How much? */ | ||
#define IO_START 0x80000000 /* PA of IO */ | ||
|
||
/* macro to get at IO space when running virtually */ | ||
#define IO_ADDRESS(x) (((x) & 0x000fffff) | IO_BASE) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright (C) 2005 Sigmatel Inc | ||
* | ||
* Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | ||
* Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. | ||
*/ | ||
|
||
/* | ||
* The code contained herein is licensed under the GNU General Public | ||
* License. You may obtain a copy of the GNU General Public License | ||
* Version 2 or later at the following locations: | ||
* | ||
* http://www.opensource.org/licenses/gpl-license.html | ||
* http://www.gnu.org/copyleft/gpl.html | ||
*/ | ||
#ifndef __ASM_ARM_ARCH_IO_H | ||
#define __ASM_ARM_ARCH_IO_H | ||
|
||
#define IO_SPACE_LIMIT 0xffffffff | ||
|
||
#define __io(a) __typesafe_io(a) | ||
#define __mem_pci(a) (a) | ||
#define __mem_isa(a) (a) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | ||
* Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. | ||
*/ | ||
|
||
/* | ||
* The code contained herein is licensed under the GNU General Public | ||
* License. You may obtain a copy of the GNU General Public License | ||
* Version 2 or later at the following locations: | ||
* | ||
* http://www.opensource.org/licenses/gpl-license.html | ||
* http://www.gnu.org/copyleft/gpl.html | ||
*/ | ||
#ifndef __ASM_ARCH_MEMORY_H | ||
#define __ASM_ARCH_MEMORY_H | ||
|
||
/* | ||
* Physical DRAM offset. | ||
*/ | ||
#define PHYS_OFFSET UL(0x40000000) | ||
|
||
#endif |
Oops, something went wrong.