diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-14 16:42:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-14 16:42:43 -0400 |
commit | 2cf4d4514d5b43c1f3b64bd0ec8b9853bde8f1dc (patch) | |
tree | e35a625496acc6ac852846d40b8851186b9d1ac4 /arch/arm/plat-stmp3xxx/include | |
parent | 44b7532b8b464f606053562400719c9c21276037 (diff) | |
parent | ce53895a5d24e0ee19fb92f56c17323fb4c9ab27 (diff) |
Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm: (417 commits)
MAINTAINERS: EB110ATX is not ebsa110
MAINTAINERS: update Eric Miao's email address and status
fb: add support of LCD display controller on pxa168/910 (base layer)
[ARM] 5552/1: ep93xx get_uart_rate(): use EP93XX_SYSCON_PWRCNT and EP93XX_SYSCON_PWRCN
[ARM] pxa/sharpsl_pm: zaurus needs generic pxa suspend/resume routines
[ARM] 5544/1: Trust PrimeCell resource sizes
[ARM] pxa/sharpsl_pm: cleanup of gpio-related code.
[ARM] pxa/sharpsl_pm: drop set_irq_type calls
[ARM] pxa/sharpsl_pm: merge pxa-specific code into generic one
[ARM] pxa/sharpsl_pm: merge the two sharpsl_pm.c since it's now pxa specific
[ARM] sa1100: remove unused collie_pm.c
[ARM] pxa: fix the conflicting non-static declarations of global_gpios[]
[ARM] 5550/1: Add default configure file for w90p910 platform
[ARM] 5549/1: Add clock api for w90p910 platform.
[ARM] 5548/1: Add gpio api for w90p910 platform
[ARM] 5551/1: Add multi-function pin api for w90p910 platform.
[ARM] Make ARM_VIC_NR depend on ARM_VIC
[ARM] 5546/1: ARM PL022 SSP/SPI driver v3
ARM: OMAP4: SMP: Update defconfig for OMAP4430
ARM: OMAP4: SMP: Enable SMP support for OMAP4430
...
Diffstat (limited to 'arch/arm/plat-stmp3xxx/include')
18 files changed, 822 insertions, 0 deletions
diff --git a/arch/arm/plat-stmp3xxx/include/mach/clkdev.h b/arch/arm/plat-stmp3xxx/include/mach/clkdev.h new file mode 100644 index 000000000000..f9c39772d7c5 --- /dev/null +++ b/arch/arm/plat-stmp3xxx/include/mach/clkdev.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /* | ||
2 | * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | ||
3 | * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. | ||
4 | * | ||
5 | * The code contained herein is licensed under the GNU General Public | ||
6 | * License. You may obtain a copy of the GNU General Public License | ||
7 | * Version 2 or later at the following locations: | ||
8 | * | ||
9 | * http://www.opensource.org/licenses/gpl-license.html | ||
10 | * http://www.gnu.org/copyleft/gpl.html | ||
11 | */ | ||
12 | #ifndef __ASM_MACH_CLKDEV_H | ||
13 | #define __ASM_MACH_CLKDEV_H | ||
14 | |||
15 | #define __clk_get(clk) ({ 1; }) | ||
16 | #define __clk_put(clk) do { } while (0) | ||
17 | |||
18 | #endif | ||
diff --git a/arch/arm/plat-stmp3xxx/include/mach/cputype.h b/arch/arm/plat-stmp3xxx/include/mach/cputype.h new file mode 100644 index 000000000000..b4e205b95f2c --- /dev/null +++ b/arch/arm/plat-stmp3xxx/include/mach/cputype.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | * Freescale STMP37XX/STMP378X CPU type detection | ||
3 | * | ||
4 | * Embedded Alley Solutions, Inc <source@embeddedalley.com> | ||
5 | * | ||
6 | * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | ||
7 | * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. | ||
8 | */ | ||
9 | |||
10 | /* | ||
11 | * The code contained herein is licensed under the GNU General Public | ||
12 | * License. You may obtain a copy of the GNU General Public License | ||
13 | * Version 2 or later at the following locations: | ||
14 | * | ||
15 | * http://www.opensource.org/licenses/gpl-license.html | ||
16 | * http://www.gnu.org/copyleft/gpl.html | ||
17 | */ | ||
18 | #ifndef __ASM_PLAT_CPU_H | ||
19 | #define __ASM_PLAT_CPU_H | ||
20 | |||
21 | #ifdef CONFIG_ARCH_STMP37XX | ||
22 | #define cpu_is_stmp37xx() (1) | ||
23 | #else | ||
24 | #define cpu_is_stmp37xx() (0) | ||
25 | #endif | ||
26 | |||
27 | #ifdef CONFIG_ARCH_STMP378X | ||
28 | #define cpu_is_stmp378x() (1) | ||
29 | #else | ||
30 | #define cpu_is_stmp378x() (0) | ||
31 | #endif | ||
32 | |||
33 | #endif /* __ASM_PLAT_CPU_H */ | ||
diff --git a/arch/arm/plat-stmp3xxx/include/mach/debug-macro.S b/arch/arm/plat-stmp3xxx/include/mach/debug-macro.S new file mode 100644 index 000000000000..fb3b969bf0a2 --- /dev/null +++ b/arch/arm/plat-stmp3xxx/include/mach/debug-macro.S | |||
@@ -0,0 +1,42 @@ | |||
1 | /* | ||
2 | * Debugging macro include header | ||
3 | * | ||
4 | * Embedded Alley Solutions, Inc <source@embeddedalley.com> | ||
5 | * | ||
6 | * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | ||
7 | * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. | ||
8 | */ | ||
9 | |||
10 | /* | ||
11 | * The code contained herein is licensed under the GNU General Public | ||
12 | * License. You may obtain a copy of the GNU General Public License | ||
13 | * Version 2 or later at the following locations: | ||
14 | * | ||
15 | * http://www.opensource.org/licenses/gpl-license.html | ||
16 | * http://www.gnu.org/copyleft/gpl.html | ||
17 | */ | ||
18 | |||
19 | .macro addruart,rx | ||
20 | mrc p15, 0, \rx, c1, c0 | ||
21 | tst \rx, #1 @ MMU enabled? | ||
22 | moveq \rx, #0x80000000 @ physical base address | ||
23 | addeq \rx, \rx, #0x00070000 | ||
24 | movne \rx, #0xf0000000 @ virtual base | ||
25 | addne \rx, \rx, #0x00070000 | ||
26 | .endm | ||
27 | |||
28 | .macro senduart,rd,rx | ||
29 | strb \rd, [\rx, #0] @ data register at 0 | ||
30 | .endm | ||
31 | |||
32 | .macro waituart,rd,rx | ||
33 | 1001: ldr \rd, [\rx, #0x18] @ UARTFLG | ||
34 | tst \rd, #1 << 5 @ UARTFLGUTXFF - 1 when full | ||
35 | bne 1001b | ||
36 | .endm | ||
37 | |||
38 | .macro busyuart,rd,rx | ||
39 | 1001: ldr \rd, [\rx, #0x18] @ UARTFLG | ||
40 | tst \rd, #1 << 3 @ UARTFLGUBUSY - 1 when busy | ||
41 | bne 1001b | ||
42 | .endm | ||
diff --git a/arch/arm/plat-stmp3xxx/include/mach/dma.h b/arch/arm/plat-stmp3xxx/include/mach/dma.h new file mode 100644 index 000000000000..7c58557c6766 --- /dev/null +++ b/arch/arm/plat-stmp3xxx/include/mach/dma.h | |||
@@ -0,0 +1,153 @@ | |||
1 | /* | ||
2 | * Freescale STMP37XX/STMP378X DMA helper interface | ||
3 | * | ||
4 | * Embedded Alley Solutions, Inc <source@embeddedalley.com> | ||
5 | * | ||
6 | * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | ||
7 | * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. | ||
8 | */ | ||
9 | |||
10 | /* | ||
11 | * The code contained herein is licensed under the GNU General Public | ||
12 | * License. You may obtain a copy of the GNU General Public License | ||
13 | * Version 2 or later at the following locations: | ||
14 | * | ||
15 | * http://www.opensource.org/licenses/gpl-license.html | ||
16 | * http://www.gnu.org/copyleft/gpl.html | ||
17 | */ | ||
18 | #ifndef __ASM_PLAT_STMP3XXX_DMA_H | ||
19 | #define __ASM_PLAT_STMP3XXX_DMA_H | ||
20 | |||
21 | #include <linux/platform_device.h> | ||
22 | #include <linux/dmapool.h> | ||
23 | |||
24 | #if !defined(MAX_PIO_WORDS) | ||
25 | #define MAX_PIO_WORDS (15) | ||
26 | #endif | ||
27 | |||
28 | #define STMP3XXX_BUS_APBH 0 | ||
29 | #define STMP3XXX_BUS_APBX 1 | ||
30 | #define STMP3XXX_DMA_MAX_CHANNEL 16 | ||
31 | #define STMP3XXX_DMA_BUS(dma) ((dma) / 16) | ||
32 | #define STMP3XXX_DMA_CHANNEL(dma) ((dma) % 16) | ||
33 | #define STMP3XXX_DMA(channel, bus) ((bus) * 16 + (channel)) | ||
34 | #define MAX_DMA_ADDRESS 0xffffffff | ||
35 | #define MAX_DMA_CHANNELS 32 | ||
36 | |||
37 | struct stmp3xxx_dma_command { | ||
38 | u32 next; | ||
39 | u32 cmd; | ||
40 | union { | ||
41 | u32 buf_ptr; | ||
42 | u32 alternate; | ||
43 | }; | ||
44 | u32 pio_words[MAX_PIO_WORDS]; | ||
45 | }; | ||
46 | |||
47 | struct stmp3xxx_dma_descriptor { | ||
48 | struct stmp3xxx_dma_command *command; | ||
49 | dma_addr_t handle; | ||
50 | |||
51 | /* The virtual address of the buffer pointer */ | ||
52 | void *virtual_buf_ptr; | ||
53 | /* The next descriptor in a the DMA chain (optional) */ | ||
54 | struct stmp3xxx_dma_descriptor *next_descr; | ||
55 | }; | ||
56 | |||
57 | struct stmp37xx_circ_dma_chain { | ||
58 | unsigned total_count; | ||
59 | struct stmp3xxx_dma_descriptor *chain; | ||
60 | |||
61 | unsigned free_index; | ||
62 | unsigned free_count; | ||
63 | unsigned active_index; | ||
64 | unsigned active_count; | ||
65 | unsigned cooked_index; | ||
66 | unsigned cooked_count; | ||
67 | |||
68 | int bus; | ||
69 | unsigned channel; | ||
70 | }; | ||
71 | |||
72 | static inline struct stmp3xxx_dma_descriptor | ||
73 | *stmp3xxx_dma_circ_get_free_head(struct stmp37xx_circ_dma_chain *chain) | ||
74 | { | ||
75 | return &(chain->chain[chain->free_index]); | ||
76 | } | ||
77 | |||
78 | static inline struct stmp3xxx_dma_descriptor | ||
79 | *stmp3xxx_dma_circ_get_cooked_head(struct stmp37xx_circ_dma_chain *chain) | ||
80 | { | ||
81 | return &(chain->chain[chain->cooked_index]); | ||
82 | } | ||
83 | |||
84 | int stmp3xxx_dma_request(int ch, struct device *dev, const char *name); | ||
85 | int stmp3xxx_dma_release(int ch); | ||
86 | int stmp3xxx_dma_allocate_command(int ch, | ||
87 | struct stmp3xxx_dma_descriptor *descriptor); | ||
88 | int stmp3xxx_dma_free_command(int ch, | ||
89 | struct stmp3xxx_dma_descriptor *descriptor); | ||
90 | void stmp3xxx_dma_continue(int channel, u32 semaphore); | ||
91 | void stmp3xxx_dma_go(int ch, struct stmp3xxx_dma_descriptor *head, | ||
92 | u32 semaphore); | ||
93 | int stmp3xxx_dma_running(int ch); | ||
94 | int stmp3xxx_dma_make_chain(int ch, struct stmp37xx_circ_dma_chain *chain, | ||
95 | struct stmp3xxx_dma_descriptor descriptors[], | ||
96 | unsigned items); | ||
97 | void stmp3xxx_dma_free_chain(struct stmp37xx_circ_dma_chain *chain); | ||
98 | void stmp37xx_circ_clear_chain(struct stmp37xx_circ_dma_chain *chain); | ||
99 | void stmp37xx_circ_advance_free(struct stmp37xx_circ_dma_chain *chain, | ||
100 | unsigned count); | ||
101 | void stmp37xx_circ_advance_active(struct stmp37xx_circ_dma_chain *chain, | ||
102 | unsigned count); | ||
103 | unsigned stmp37xx_circ_advance_cooked(struct stmp37xx_circ_dma_chain *chain); | ||
104 | int stmp3xxx_dma_read_semaphore(int ch); | ||
105 | void stmp3xxx_dma_init(void); | ||
106 | void stmp3xxx_dma_set_alt_target(int ch, int target); | ||
107 | void stmp3xxx_dma_suspend(void); | ||
108 | void stmp3xxx_dma_resume(void); | ||
109 | |||
110 | /* | ||
111 | * STMP37xx and STMP378x have different DMA control | ||
112 | * registers layout | ||
113 | */ | ||
114 | |||
115 | void stmp3xxx_arch_dma_freeze(int ch); | ||
116 | void stmp3xxx_arch_dma_unfreeze(int ch); | ||
117 | void stmp3xxx_arch_dma_reset_channel(int ch); | ||
118 | void stmp3xxx_arch_dma_enable_interrupt(int ch); | ||
119 | void stmp3xxx_arch_dma_clear_interrupt(int ch); | ||
120 | int stmp3xxx_arch_dma_is_interrupt(int ch); | ||
121 | |||
122 | static inline void stmp3xxx_dma_reset_channel(int ch) | ||
123 | { | ||
124 | stmp3xxx_arch_dma_reset_channel(ch); | ||
125 | } | ||
126 | |||
127 | |||
128 | static inline void stmp3xxx_dma_freeze(int ch) | ||
129 | { | ||
130 | stmp3xxx_arch_dma_freeze(ch); | ||
131 | } | ||
132 | |||
133 | static inline void stmp3xxx_dma_unfreeze(int ch) | ||
134 | { | ||
135 | stmp3xxx_arch_dma_unfreeze(ch); | ||
136 | } | ||
137 | |||
138 | static inline void stmp3xxx_dma_enable_interrupt(int ch) | ||
139 | { | ||
140 | stmp3xxx_arch_dma_enable_interrupt(ch); | ||
141 | } | ||
142 | |||
143 | static inline void stmp3xxx_dma_clear_interrupt(int ch) | ||
144 | { | ||
145 | stmp3xxx_arch_dma_clear_interrupt(ch); | ||
146 | } | ||
147 | |||
148 | static inline int stmp3xxx_dma_is_interrupt(int ch) | ||
149 | { | ||
150 | return stmp3xxx_arch_dma_is_interrupt(ch); | ||
151 | } | ||
152 | |||
153 | #endif /* __ASM_PLAT_STMP3XXX_DMA_H */ | ||
diff --git a/arch/arm/plat-stmp3xxx/include/mach/gpio.h b/arch/arm/plat-stmp3xxx/include/mach/gpio.h new file mode 100644 index 000000000000..a8b579256170 --- /dev/null +++ b/arch/arm/plat-stmp3xxx/include/mach/gpio.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /* | ||
2 | * Freescale STMP37XX/STMP378X GPIO interface | ||
3 | * | ||
4 | * Embedded Alley Solutions, Inc <source@embeddedalley.com> | ||
5 | * | ||
6 | * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | ||
7 | * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. | ||
8 | */ | ||
9 | |||
10 | /* | ||
11 | * The code contained herein is licensed under the GNU General Public | ||
12 | * License. You may obtain a copy of the GNU General Public License | ||
13 | * Version 2 or later at the following locations: | ||
14 | * | ||
15 | * http://www.opensource.org/licenses/gpl-license.html | ||
16 | * http://www.gnu.org/copyleft/gpl.html | ||
17 | */ | ||
18 | #ifndef __ASM_PLAT_GPIO_H | ||
19 | #define __ASM_PLAT_GPIO_H | ||
20 | |||
21 | #define ARCH_NR_GPIOS (32 * 3) | ||
22 | #define gpio_to_irq(gpio) __gpio_to_irq(gpio) | ||
23 | #define gpio_get_value(gpio) __gpio_get_value(gpio) | ||
24 | #define gpio_set_value(gpio, value) __gpio_set_value(gpio, value) | ||
25 | |||
26 | #include <asm-generic/gpio.h> | ||
27 | |||
28 | #endif /* __ASM_PLAT_GPIO_H */ | ||
diff --git a/arch/arm/plat-stmp3xxx/include/mach/gpmi.h b/arch/arm/plat-stmp3xxx/include/mach/gpmi.h new file mode 100644 index 000000000000..e166432910ad --- /dev/null +++ b/arch/arm/plat-stmp3xxx/include/mach/gpmi.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef __MACH_GPMI_H | ||
2 | |||
3 | #include <linux/mtd/partitions.h> | ||
4 | #include <mach/regs-gpmi.h> | ||
5 | |||
6 | struct gpmi_platform_data { | ||
7 | void *pins; | ||
8 | int nr_parts; | ||
9 | struct mtd_partition *parts; | ||
10 | const char *part_types[]; | ||
11 | }; | ||
12 | #endif | ||
diff --git a/arch/arm/plat-stmp3xxx/include/mach/hardware.h b/arch/arm/plat-stmp3xxx/include/mach/hardware.h new file mode 100644 index 000000000000..47b8978405bc --- /dev/null +++ b/arch/arm/plat-stmp3xxx/include/mach/hardware.h | |||
@@ -0,0 +1,32 @@ | |||
1 | /* | ||
2 | * This file contains the hardware definitions of the Freescale STMP3XXX | ||
3 | * | ||
4 | * Copyright (C) 2005 Sigmatel Inc | ||
5 | * | ||
6 | * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | ||
7 | * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. | ||
8 | */ | ||
9 | |||
10 | /* | ||
11 | * The code contained herein is licensed under the GNU General Public | ||
12 | * License. You may obtain a copy of the GNU General Public License | ||
13 | * Version 2 or later at the following locations: | ||
14 | * | ||
15 | * http://www.opensource.org/licenses/gpl-license.html | ||
16 | * http://www.gnu.org/copyleft/gpl.html | ||
17 | */ | ||
18 | #ifndef __ASM_ARCH_HARDWARE_H | ||
19 | #define __ASM_ARCH_HARDWARE_H | ||
20 | |||
21 | /* | ||
22 | * Where in virtual memory the IO devices (timers, system controllers | ||
23 | * and so on) | ||
24 | */ | ||
25 | #define IO_BASE 0xF0000000 /* VA of IO */ | ||
26 | #define IO_SIZE 0x00100000 /* How much? */ | ||
27 | #define IO_START 0x80000000 /* PA of IO */ | ||
28 | |||
29 | /* macro to get at IO space when running virtually */ | ||
30 | #define IO_ADDRESS(x) (((x) & 0x000fffff) | IO_BASE) | ||
31 | |||
32 | #endif | ||
diff --git a/arch/arm/plat-stmp3xxx/include/mach/io.h b/arch/arm/plat-stmp3xxx/include/mach/io.h new file mode 100644 index 000000000000..d08b1b7f3d1c --- /dev/null +++ b/arch/arm/plat-stmp3xxx/include/mach/io.h | |||
@@ -0,0 +1,25 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2005 Sigmatel Inc | ||
3 | * | ||
4 | * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | ||
5 | * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. | ||
6 | */ | ||
7 | |||
8 | /* | ||
9 | * The code contained herein is licensed under the GNU General Public | ||
10 | * License. You may obtain a copy of the GNU General Public License | ||
11 | * Version 2 or later at the following locations: | ||
12 | * | ||
13 | * http://www.opensource.org/licenses/gpl-license.html | ||
14 | * http://www.gnu.org/copyleft/gpl.html | ||
15 | */ | ||
16 | #ifndef __ASM_ARM_ARCH_IO_H | ||
17 | #define __ASM_ARM_ARCH_IO_H | ||
18 | |||
19 | #define IO_SPACE_LIMIT 0xffffffff | ||
20 | |||
21 | #define __io(a) __typesafe_io(a) | ||
22 | #define __mem_pci(a) (a) | ||
23 | #define __mem_isa(a) (a) | ||
24 | |||
25 | #endif | ||
diff --git a/arch/arm/plat-stmp3xxx/include/mach/memory.h b/arch/arm/plat-stmp3xxx/include/mach/memory.h new file mode 100644 index 000000000000..7b875a07a1a7 --- /dev/null +++ b/arch/arm/plat-stmp3xxx/include/mach/memory.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | ||
3 | * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. | ||
4 | */ | ||
5 | |||
6 | /* | ||
7 | * The code contained herein is licensed under the GNU General Public | ||
8 | * License. You may obtain a copy of the GNU General Public License | ||
9 | * Version 2 or later at the following locations: | ||
10 | * | ||
11 | * http://www.opensource.org/licenses/gpl-license.html | ||
12 | * http://www.gnu.org/copyleft/gpl.html | ||
13 | */ | ||
14 | #ifndef __ASM_ARCH_MEMORY_H | ||
15 | #define __ASM_ARCH_MEMORY_H | ||
16 | |||
17 | /* | ||
18 | * Physical DRAM offset. | ||
19 | */ | ||
20 | #define PHYS_OFFSET UL(0x40000000) | ||
21 | |||
22 | #endif | ||
diff --git a/arch/arm/plat-stmp3xxx/include/mach/mmc.h b/arch/arm/plat-stmp3xxx/include/mach/mmc.h new file mode 100644 index 000000000000..ba81e1543761 --- /dev/null +++ b/arch/arm/plat-stmp3xxx/include/mach/mmc.h | |||
@@ -0,0 +1,14 @@ | |||
1 | #ifndef _MACH_MMC_H | ||
2 | #define _MACH_MMC_H | ||
3 | |||
4 | #include <mach/regs-ssp.h> | ||
5 | |||
6 | struct stmp3xxxmmc_platform_data { | ||
7 | int (*get_wp)(void); | ||
8 | unsigned long (*setclock)(void __iomem *base, unsigned long); | ||
9 | void (*cmd_pullup)(int); | ||
10 | int (*hw_init)(void); | ||
11 | void (*hw_release)(void); | ||
12 | }; | ||
13 | |||
14 | #endif | ||
diff --git a/arch/arm/plat-stmp3xxx/include/mach/pinmux.h b/arch/arm/plat-stmp3xxx/include/mach/pinmux.h new file mode 100644 index 000000000000..cc5af82279ad --- /dev/null +++ b/arch/arm/plat-stmp3xxx/include/mach/pinmux.h | |||
@@ -0,0 +1,157 @@ | |||
1 | /* | ||
2 | * Freescale STMP37XX/STMP378X Pin Multiplexing | ||
3 | * | ||
4 | * Author: Vladislav Buzov <vbuzov@embeddedalley.com> | ||
5 | * | ||
6 | * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | ||
7 | * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. | ||
8 | */ | ||
9 | |||
10 | /* | ||
11 | * The code contained herein is licensed under the GNU General Public | ||
12 | * License. You may obtain a copy of the GNU General Public License | ||
13 | * Version 2 or later at the following locations: | ||
14 | * | ||
15 | * http://www.opensource.org/licenses/gpl-license.html | ||
16 | * http://www.gnu.org/copyleft/gpl.html | ||
17 | */ | ||
18 | #ifndef __PINMUX_H | ||
19 | #define __PINMUX_H | ||
20 | |||
21 | #include <linux/spinlock.h> | ||
22 | #include <linux/types.h> | ||
23 | #include <linux/gpio.h> | ||
24 | #include <asm-generic/gpio.h> | ||
25 | |||
26 | /* Pin definitions */ | ||
27 | #include "pins.h" | ||
28 | #include <mach/pins.h> | ||
29 | |||
30 | /* | ||
31 | * Each pin may be routed up to four different HW interfaces | ||
32 | * including GPIO | ||
33 | */ | ||
34 | enum pin_fun { | ||
35 | PIN_FUN1 = 0, | ||
36 | PIN_FUN2, | ||
37 | PIN_FUN3, | ||
38 | PIN_GPIO, | ||
39 | }; | ||
40 | |||
41 | /* | ||
42 | * Each pin may have different output drive strength in range from | ||
43 | * 4mA to 20mA. The most common case is 4, 8 and 12 mA strengths. | ||
44 | */ | ||
45 | enum pin_strength { | ||
46 | PIN_4MA = 0, | ||
47 | PIN_8MA, | ||
48 | PIN_12MA, | ||
49 | PIN_16MA, | ||
50 | PIN_20MA, | ||
51 | }; | ||
52 | |||
53 | /* | ||
54 | * Each pin can be programmed for 1.8V or 3.3V | ||
55 | */ | ||
56 | enum pin_voltage { | ||
57 | PIN_1_8V = 0, | ||
58 | PIN_3_3V, | ||
59 | }; | ||
60 | |||
61 | /* | ||
62 | * Structure to define a group of pins and their parameters | ||
63 | */ | ||
64 | struct pin_desc { | ||
65 | unsigned id; | ||
66 | enum pin_fun fun; | ||
67 | enum pin_strength strength; | ||
68 | enum pin_voltage voltage; | ||
69 | unsigned pullup:1; | ||
70 | }; | ||
71 | |||
72 | struct pin_group { | ||
73 | struct pin_desc *pins; | ||
74 | int nr_pins; | ||
75 | }; | ||
76 | |||
77 | /* Set pin drive strength */ | ||
78 | void stmp3xxx_pin_strength(unsigned id, enum pin_strength strength, | ||
79 | const char *label); | ||
80 | |||
81 | /* Set pin voltage */ | ||
82 | void stmp3xxx_pin_voltage(unsigned id, enum pin_voltage voltage, | ||
83 | const char *label); | ||
84 | |||
85 | /* Enable pull-up resistor for a pin */ | ||
86 | void stmp3xxx_pin_pullup(unsigned id, int enable, const char *label); | ||
87 | |||
88 | /* | ||
89 | * Request a pin ownership, only one module (identified by @label) | ||
90 | * may own a pin. | ||
91 | */ | ||
92 | int stmp3xxx_request_pin(unsigned id, enum pin_fun fun, const char *label); | ||
93 | |||
94 | /* Release pin */ | ||
95 | void stmp3xxx_release_pin(unsigned id, const char *label); | ||
96 | |||
97 | void stmp3xxx_set_pin_type(unsigned id, enum pin_fun fun); | ||
98 | |||
99 | /* | ||
100 | * Each bank is associated with a number of registers to control | ||
101 | * pin function, drive strength, voltage and pull-up reigster. The | ||
102 | * number of registers of a given type depends on the number of bits | ||
103 | * describin particular pin. | ||
104 | */ | ||
105 | #define HW_MUXSEL_NUM 2 /* registers per bank */ | ||
106 | #define HW_MUXSEL_PIN_LEN 2 /* bits per pin */ | ||
107 | #define HW_MUXSEL_PIN_NUM 16 /* pins per register */ | ||
108 | #define HW_MUXSEL_PINFUN_MASK 0x3 /* pin function mask */ | ||
109 | #define HW_MUXSEL_PINFUN_NUM 4 /* four options for a pin */ | ||
110 | |||
111 | #define HW_DRIVE_NUM 4 /* registers per bank */ | ||
112 | #define HW_DRIVE_PIN_LEN 4 /* bits per pin */ | ||
113 | #define HW_DRIVE_PIN_NUM 8 /* pins per register */ | ||
114 | #define HW_DRIVE_PINDRV_MASK 0x3 /* pin strength mask - 2 bits */ | ||
115 | #define HW_DRIVE_PINDRV_NUM 5 /* five possible strength values */ | ||
116 | #define HW_DRIVE_PINV_MASK 0x4 /* pin voltage mask - 1 bit */ | ||
117 | |||
118 | |||
119 | struct stmp3xxx_pinmux_bank { | ||
120 | struct gpio_chip chip; | ||
121 | |||
122 | /* Pins allocation map */ | ||
123 | unsigned long pin_map; | ||
124 | |||
125 | /* Pin owner names */ | ||
126 | const char *pin_labels[32]; | ||
127 | |||
128 | /* Bank registers */ | ||
129 | void __iomem *hw_muxsel[HW_MUXSEL_NUM]; | ||
130 | void __iomem *hw_drive[HW_DRIVE_NUM]; | ||
131 | void __iomem *hw_pull; | ||
132 | |||
133 | void __iomem *pin2irq, | ||
134 | *irqlevel, | ||
135 | *irqpolarity, | ||
136 | *irqen, | ||
137 | *irqstat; | ||
138 | |||
139 | /* HW MUXSEL register function bit values */ | ||
140 | u8 functions[HW_MUXSEL_PINFUN_NUM]; | ||
141 | |||
142 | /* | ||
143 | * HW DRIVE register strength bit values: | ||
144 | * 0xff - requested strength is not supported for this bank | ||
145 | */ | ||
146 | u8 strengths[HW_DRIVE_PINDRV_NUM]; | ||
147 | |||
148 | /* GPIO things */ | ||
149 | void __iomem *hw_gpio_in, | ||
150 | *hw_gpio_out, | ||
151 | *hw_gpio_doe; | ||
152 | int irq, virq; | ||
153 | }; | ||
154 | |||
155 | int __init stmp3xxx_pinmux_init(int virtual_irq_start); | ||
156 | |||
157 | #endif /* __PINMUX_H */ | ||
diff --git a/arch/arm/plat-stmp3xxx/include/mach/pins.h b/arch/arm/plat-stmp3xxx/include/mach/pins.h new file mode 100644 index 000000000000..c573318e1caa --- /dev/null +++ b/arch/arm/plat-stmp3xxx/include/mach/pins.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* | ||
2 | * Freescale STMP37XX/STMP378X Pin multiplexing interface definitions | ||
3 | * | ||
4 | * Author: Vladislav Buzov <vbuzov@embeddedalley.com> | ||
5 | * | ||
6 | * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | ||
7 | * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. | ||
8 | */ | ||
9 | |||
10 | /* | ||
11 | * The code contained herein is licensed under the GNU General Public | ||
12 | * License. You may obtain a copy of the GNU General Public License | ||
13 | * Version 2 or later at the following locations: | ||
14 | * | ||
15 | * http://www.opensource.org/licenses/gpl-license.html | ||
16 | * http://www.gnu.org/copyleft/gpl.html | ||
17 | */ | ||
18 | #ifndef __ASM_PLAT_PINS_H | ||
19 | #define __ASM_PLAT_PINS_H | ||
20 | |||
21 | #define STMP3XXX_PINID(bank, pin) (bank * 32 + pin) | ||
22 | #define STMP3XXX_PINID_TO_BANK(pinid) (pinid / 32) | ||
23 | #define STMP3XXX_PINID_TO_PINNUM(pinid) (pinid % 32) | ||
24 | |||
25 | /* | ||
26 | * Special invalid pin identificator to show a pin doesn't exist | ||
27 | */ | ||
28 | #define PINID_NO_PIN STMP3XXX_PINID(0xFF, 0xFF) | ||
29 | |||
30 | #endif /* __ASM_PLAT_PINS_H */ | ||
diff --git a/arch/arm/plat-stmp3xxx/include/mach/platform.h b/arch/arm/plat-stmp3xxx/include/mach/platform.h new file mode 100644 index 000000000000..7007ddaa91eb --- /dev/null +++ b/arch/arm/plat-stmp3xxx/include/mach/platform.h | |||
@@ -0,0 +1,68 @@ | |||
1 | /* | ||
2 | * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | ||
3 | * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. | ||
4 | */ | ||
5 | |||
6 | /* | ||
7 | * The code contained herein is licensed under the GNU General Public | ||
8 | * License. You may obtain a copy of the GNU General Public License | ||
9 | * Version 2 or later at the following locations: | ||
10 | * | ||
11 | * http://www.opensource.org/licenses/gpl-license.html | ||
12 | * http://www.gnu.org/copyleft/gpl.html | ||
13 | */ | ||
14 | #ifndef __ASM_PLAT_PLATFORM_H | ||
15 | #define __ASM_PLAT_PLATFORM_H | ||
16 | |||
17 | #ifndef __ASSEMBLER__ | ||
18 | #include <linux/io.h> | ||
19 | #endif | ||
20 | #include <asm/sizes.h> | ||
21 | |||
22 | /* Virtual address where registers are mapped */ | ||
23 | #define STMP3XXX_REGS_PHBASE 0x80000000 | ||
24 | #ifdef __ASSEMBLER__ | ||
25 | #define STMP3XXX_REGS_BASE 0xF0000000 | ||
26 | #else | ||
27 | #define STMP3XXX_REGS_BASE (void __iomem *)0xF0000000 | ||
28 | #endif | ||
29 | #define STMP3XXX_REGS_SIZE SZ_1M | ||
30 | |||
31 | /* Virtual address where OCRAM is mapped */ | ||
32 | #define STMP3XXX_OCRAM_PHBASE 0x00000000 | ||
33 | #ifdef __ASSEMBLER__ | ||
34 | #define STMP3XXX_OCRAM_BASE 0xf1000000 | ||
35 | #else | ||
36 | #define STMP3XXX_OCRAM_BASE (void __iomem *)0xf1000000 | ||
37 | #endif | ||
38 | #define STMP3XXX_OCRAM_SIZE (32 * SZ_1K) | ||
39 | |||
40 | #ifdef CONFIG_ARCH_STMP37XX | ||
41 | #define IRQ_PRIORITY_REG_RD HW_ICOLL_PRIORITYn_RD | ||
42 | #define IRQ_PRIORITY_REG_WR HW_ICOLL_PRIORITYn_WR | ||
43 | #endif | ||
44 | |||
45 | #ifdef CONFIG_ARCH_STMP378X | ||
46 | #define IRQ_PRIORITY_REG_RD HW_ICOLL_INTERRUPTn_RD | ||
47 | #define IRQ_PRIORITY_REG_WR HW_ICOLL_INTERRUPTn_WR | ||
48 | #endif | ||
49 | |||
50 | #define HW_STMP3XXX_SET 0x04 | ||
51 | #define HW_STMP3XXX_CLR 0x08 | ||
52 | #define HW_STMP3XXX_TOG 0x0c | ||
53 | |||
54 | #ifndef __ASSEMBLER__ | ||
55 | static inline void stmp3xxx_clearl(u32 v, void __iomem *r) | ||
56 | { | ||
57 | __raw_writel(v, r + HW_STMP3XXX_CLR); | ||
58 | } | ||
59 | |||
60 | static inline void stmp3xxx_setl(u32 v, void __iomem *r) | ||
61 | { | ||
62 | __raw_writel(v, r + HW_STMP3XXX_SET); | ||
63 | } | ||
64 | #endif | ||
65 | |||
66 | #define BF(value, field) (((value) << BP_##field) & BM_##field) | ||
67 | |||
68 | #endif /* __ASM_ARCH_PLATFORM_H */ | ||
diff --git a/arch/arm/plat-stmp3xxx/include/mach/stmp3xxx.h b/arch/arm/plat-stmp3xxx/include/mach/stmp3xxx.h new file mode 100644 index 000000000000..2e300feaa4cf --- /dev/null +++ b/arch/arm/plat-stmp3xxx/include/mach/stmp3xxx.h | |||
@@ -0,0 +1,54 @@ | |||
1 | /* | ||
2 | * Freescale STMP37XX/STMP378X core structure and function declarations | ||
3 | * | ||
4 | * Embedded Alley Solutions, Inc <source@embeddedalley.com> | ||
5 | * | ||
6 | * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | ||
7 | * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. | ||
8 | */ | ||
9 | |||
10 | /* | ||
11 | * The code contained herein is licensed under the GNU General Public | ||
12 | * License. You may obtain a copy of the GNU General Public License | ||
13 | * Version 2 or later at the following locations: | ||
14 | * | ||
15 | * http://www.opensource.org/licenses/gpl-license.html | ||
16 | * http://www.gnu.org/copyleft/gpl.html | ||
17 | */ | ||
18 | #ifndef __ASM_PLAT_STMP3XXX_H | ||
19 | #define __ASM_PLAT_STMP3XXX_H | ||
20 | |||
21 | #include <linux/irq.h> | ||
22 | |||
23 | extern struct sys_timer stmp3xxx_timer; | ||
24 | |||
25 | void stmp3xxx_init_irq(struct irq_chip *chip); | ||
26 | void stmp3xxx_init(void); | ||
27 | int stmp3xxx_reset_block(void __iomem *hwreg, int just_enable); | ||
28 | extern struct platform_device stmp3xxx_dbguart, | ||
29 | stmp3xxx_appuart, | ||
30 | stmp3xxx_watchdog, | ||
31 | stmp3xxx_touchscreen, | ||
32 | stmp3xxx_keyboard, | ||
33 | stmp3xxx_gpmi, | ||
34 | stmp3xxx_mmc, | ||
35 | stmp3xxx_udc, | ||
36 | stmp3xxx_ehci, | ||
37 | stmp3xxx_rtc, | ||
38 | stmp3xxx_spi1, | ||
39 | stmp3xxx_spi2, | ||
40 | stmp3xxx_backlight, | ||
41 | stmp3xxx_rotdec, | ||
42 | stmp3xxx_dcp, | ||
43 | stmp3xxx_dcp_bootstream, | ||
44 | stmp3xxx_persistent, | ||
45 | stmp3xxx_framebuffer, | ||
46 | stmp3xxx_battery; | ||
47 | int stmp3xxx_ssp1_device_register(void); | ||
48 | int stmp3xxx_ssp2_device_register(void); | ||
49 | |||
50 | struct pin_group; | ||
51 | void stmp3xxx_release_pin_group(struct pin_group *pin_group, const char *label); | ||
52 | int stmp3xxx_request_pin_group(struct pin_group *pin_group, const char *label); | ||
53 | |||
54 | #endif /* __ASM_PLAT_STMP3XXX_H */ | ||
diff --git a/arch/arm/plat-stmp3xxx/include/mach/system.h b/arch/arm/plat-stmp3xxx/include/mach/system.h new file mode 100644 index 000000000000..28a988889319 --- /dev/null +++ b/arch/arm/plat-stmp3xxx/include/mach/system.h | |||
@@ -0,0 +1,49 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2005 Sigmatel Inc | ||
3 | * | ||
4 | * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | ||
5 | * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. | ||
6 | */ | ||
7 | |||
8 | /* | ||
9 | * The code contained herein is licensed under the GNU General Public | ||
10 | * License. You may obtain a copy of the GNU General Public License | ||
11 | * Version 2 or later at the following locations: | ||
12 | * | ||
13 | * http://www.opensource.org/licenses/gpl-license.html | ||
14 | * http://www.gnu.org/copyleft/gpl.html | ||
15 | */ | ||
16 | #ifndef __ASM_ARCH_SYSTEM_H | ||
17 | #define __ASM_ARCH_SYSTEM_H | ||
18 | |||
19 | #include <asm/proc-fns.h> | ||
20 | #include <mach/platform.h> | ||
21 | #include <mach/regs-clkctrl.h> | ||
22 | #include <mach/regs-power.h> | ||
23 | |||
24 | static inline void arch_idle(void) | ||
25 | { | ||
26 | /* | ||
27 | * This should do all the clock switching | ||
28 | * and wait for interrupt tricks | ||
29 | */ | ||
30 | |||
31 | cpu_do_idle(); | ||
32 | } | ||
33 | |||
34 | static inline void arch_reset(char mode, const char *cmd) | ||
35 | { | ||
36 | /* Set BATTCHRG to default value */ | ||
37 | __raw_writel(0x00010000, REGS_POWER_BASE + HW_POWER_CHARGE); | ||
38 | |||
39 | /* Set MINPWR to default value */ | ||
40 | __raw_writel(0, REGS_POWER_BASE + HW_POWER_MINPWR); | ||
41 | |||
42 | /* Reset digital side of chip (but not power or RTC) */ | ||
43 | __raw_writel(BM_CLKCTRL_RESET_DIG, | ||
44 | REGS_CLKCTRL_BASE + HW_CLKCTRL_RESET); | ||
45 | |||
46 | /* Should not return */ | ||
47 | } | ||
48 | |||
49 | #endif | ||
diff --git a/arch/arm/plat-stmp3xxx/include/mach/timex.h b/arch/arm/plat-stmp3xxx/include/mach/timex.h new file mode 100644 index 000000000000..3373985d7a8e --- /dev/null +++ b/arch/arm/plat-stmp3xxx/include/mach/timex.h | |||
@@ -0,0 +1,20 @@ | |||
1 | /* | ||
2 | * Copyright (C) 1999 ARM Limited | ||
3 | * | ||
4 | * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | ||
5 | * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. | ||
6 | */ | ||
7 | |||
8 | /* | ||
9 | * The code contained herein is licensed under the GNU General Public | ||
10 | * License. You may obtain a copy of the GNU General Public License | ||
11 | * Version 2 or later at the following locations: | ||
12 | * | ||
13 | * http://www.opensource.org/licenses/gpl-license.html | ||
14 | * http://www.gnu.org/copyleft/gpl.html | ||
15 | */ | ||
16 | |||
17 | /* | ||
18 | * System time clock is sourced from the 32k clock | ||
19 | */ | ||
20 | #define CLOCK_TICK_RATE (32768) | ||
diff --git a/arch/arm/plat-stmp3xxx/include/mach/uncompress.h b/arch/arm/plat-stmp3xxx/include/mach/uncompress.h new file mode 100644 index 000000000000..f79f5ee56cd4 --- /dev/null +++ b/arch/arm/plat-stmp3xxx/include/mach/uncompress.h | |||
@@ -0,0 +1,53 @@ | |||
1 | /* | ||
2 | * | ||
3 | * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | ||
4 | * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. | ||
5 | */ | ||
6 | |||
7 | /* | ||
8 | * The code contained herein is licensed under the GNU General Public | ||
9 | * License. You may obtain a copy of the GNU General Public License | ||
10 | * Version 2 or later at the following locations: | ||
11 | * | ||
12 | * http://www.opensource.org/licenses/gpl-license.html | ||
13 | * http://www.gnu.org/copyleft/gpl.html | ||
14 | */ | ||
15 | #ifndef __ASM_PLAT_UNCOMPRESS_H | ||
16 | #define __ASM_PLAT_UNCOMPRESS_H | ||
17 | |||
18 | /* | ||
19 | * Register includes are for when the MMU enabled; we need to define our | ||
20 | * own stuff here for pre-MMU use | ||
21 | */ | ||
22 | #define UARTDBG_BASE 0x80070000 | ||
23 | #define UART(c) (((volatile unsigned *)UARTDBG_BASE)[c]) | ||
24 | |||
25 | /* | ||
26 | * This does not append a newline | ||
27 | */ | ||
28 | static void putc(char c) | ||
29 | { | ||
30 | /* Wait for TX fifo empty */ | ||
31 | while ((UART(6) & (1<<7)) == 0) | ||
32 | continue; | ||
33 | |||
34 | /* Write byte */ | ||
35 | UART(0) = c; | ||
36 | |||
37 | /* Wait for last bit to exit the UART */ | ||
38 | while (UART(6) & (1<<3)) | ||
39 | continue; | ||
40 | } | ||
41 | |||
42 | static void flush(void) | ||
43 | { | ||
44 | } | ||
45 | |||
46 | /* | ||
47 | * nothing to do | ||
48 | */ | ||
49 | #define arch_decomp_setup() | ||
50 | |||
51 | #define arch_decomp_wdog() | ||
52 | |||
53 | #endif /* __ASM_PLAT_UNCOMPRESS_H */ | ||
diff --git a/arch/arm/plat-stmp3xxx/include/mach/vmalloc.h b/arch/arm/plat-stmp3xxx/include/mach/vmalloc.h new file mode 100644 index 000000000000..541b880c1863 --- /dev/null +++ b/arch/arm/plat-stmp3xxx/include/mach/vmalloc.h | |||
@@ -0,0 +1,12 @@ | |||
1 | /* | ||
2 | * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | ||
3 | * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. | ||
4 | * | ||
5 | * The code contained herein is licensed under the GNU General Public | ||
6 | * License. You may obtain a copy of the GNU General Public License | ||
7 | * Version 2 or later at the following locations: | ||
8 | * | ||
9 | * http://www.opensource.org/licenses/gpl-license.html | ||
10 | * http://www.gnu.org/copyleft/gpl.html | ||
11 | */ | ||
12 | #define VMALLOC_END (0xF0000000) | ||