From 3dd0dcbe9dc5c116df96989c42a062951b644e04 Mon Sep 17 00:00:00 2001 From: Vitaly Bordug Date: Thu, 21 Sep 2006 17:27:15 +0400 Subject: cpm_uart: make it possible to utilize from powerpc Driver core has been updated to make use of the new powerpc OF-inspired platform devices, yet keeping compatibility to the vast board list from ppc. Signed-off-by: Vitaly Bordug --- include/asm-ppc/fs_pd.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 include/asm-ppc/fs_pd.h (limited to 'include/asm-ppc') diff --git a/include/asm-ppc/fs_pd.h b/include/asm-ppc/fs_pd.h new file mode 100644 index 000000000000..eed777834121 --- /dev/null +++ b/include/asm-ppc/fs_pd.h @@ -0,0 +1,32 @@ +/* + * Platform information definitions. + * + * 2006 (c) MontaVista Software, Inc. + * Vitaly Bordug + * + * This file is licensed under the terms of the GNU General Public License + * version 2. This program is licensed "as is" without any warranty of any + * kind, whether express or implied. + */ + +#ifndef FS_PD_H +#define FS_PD_H + +static inline int uart_baudrate(void) +{ + int baud; + bd_t *bd = (bd_t *) __res; + + if (bd->bi_baudrate) + baud = bd->bi_baudrate; + else + baud = -1; + return baud; +} + +static inline int uart_clock(void) +{ + return (((bd_t *) __res)->bi_intfreq); +} + +#endif -- cgit v1.2.3 From b0c110b4f19b226dcc9f7805759bf17f8ef4dca4 Mon Sep 17 00:00:00 2001 From: Vitaly Bordug Date: Thu, 21 Sep 2006 22:18:53 +0400 Subject: POWERPC: Move generic cpm2 stuff to powerpc This moves the cpm2 common code and PIC stuff to the powerpc. Most of the files were just copied from ppc/, with minor tuning to make it compile, and, subsequently, work. Signed-off-by: Vitaly Bordug --- include/asm-ppc/cpm2.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include/asm-ppc') diff --git a/include/asm-ppc/cpm2.h b/include/asm-ppc/cpm2.h index f6a7ff04ffe5..876974e5412f 100644 --- a/include/asm-ppc/cpm2.h +++ b/include/asm-ppc/cpm2.h @@ -42,6 +42,8 @@ #define CPM_CR_IDMA4_SBLOCK (0x17) #define CPM_CR_MCC1_SBLOCK (0x1c) +#define CPM_CR_FCC_SBLOCK(x) (x + 0x10) + #define CPM_CR_SCC1_PAGE (0x00) #define CPM_CR_SCC2_PAGE (0x01) #define CPM_CR_SCC3_PAGE (0x02) @@ -62,6 +64,8 @@ #define CPM_CR_MCC1_PAGE (0x07) #define CPM_CR_MCC2_PAGE (0x08) +#define CPM_CR_FCC_PAGE(x) (x + 0x04) + /* Some opcodes (there are more...later) */ #define CPM_CR_INIT_TRX ((ushort)0x0000) @@ -1186,7 +1190,7 @@ typedef struct im_idma { #define FCC_MEM_OFFSET(x) (CPM_FCC_SPECIAL_BASE + (x*128)) #define FCC1_MEM_OFFSET FCC_MEM_OFFSET(0) #define FCC2_MEM_OFFSET FCC_MEM_OFFSET(1) -#define FCC2_MEM_OFFSET FCC_MEM_OFFSET(2) +#define FCC3_MEM_OFFSET FCC_MEM_OFFSET(2) #endif /* __CPM2__ */ #endif /* __KERNEL__ */ -- cgit v1.2.3 From fc8e50e349aa722d9f97ed9ba30e324ede8fa408 Mon Sep 17 00:00:00 2001 From: Vitaly Bordug Date: Thu, 21 Sep 2006 22:37:58 +0400 Subject: POWERPC: Get rid of remapping the whole immr The stuff below cleans up the code attempting to remap the whole cpm2_immr early, as well as places happily assuming that fact. This is more like the 2.4 legacy stuff, and is at least confusing and unclear now. To keep the world comfortable, a new mechanism is introduced: before accessing specific immr register/register set, one needs to map it, using cpm2_map(), for instance, access to CPM command register will look like volatile cpm_cpm2_t *cp = cpm2_map(im_cpm); keeping the code clear, yet without "already defined somewhere" cpm2_immr. So far, unmapping code is not implemented, but it's not a big deal to add it, if the whole idea makes sense. Signed-off-by: Vitaly Bordug --- include/asm-ppc/cpm2.h | 4 ++++ include/asm-ppc/fs_pd.h | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'include/asm-ppc') diff --git a/include/asm-ppc/cpm2.h b/include/asm-ppc/cpm2.h index 876974e5412f..bd6623aed383 100644 --- a/include/asm-ppc/cpm2.h +++ b/include/asm-ppc/cpm2.h @@ -177,6 +177,10 @@ typedef struct cpm_buf_desc { #define PROFF_I2C_BASE ((uint)0x8afc) #define PROFF_IDMA4_BASE ((uint)0x8afe) +#define PROFF_SCC_SIZE ((uint)0x100) +#define PROFF_FCC_SIZE ((uint)0x100) +#define PROFF_SMC_SIZE ((uint)64) + /* The SMCs are relocated to any of the first eight DPRAM pages. * We will fix these at the first locations of DPRAM, until we * get some microcode patches :-). diff --git a/include/asm-ppc/fs_pd.h b/include/asm-ppc/fs_pd.h index eed777834121..8691327653af 100644 --- a/include/asm-ppc/fs_pd.h +++ b/include/asm-ppc/fs_pd.h @@ -29,4 +29,8 @@ static inline int uart_clock(void) return (((bd_t *) __res)->bi_intfreq); } +#define cpm2_map(member) (&cpm2_immr->member) +#define cpm2_map_size(member, size) (&cpm2_immr->member) +#define cpm2_unmap(addr) do {} while(0) + #endif -- cgit v1.2.3 From d3465c921f79cfef0a4a8ceeeef9a3721bbbb57d Mon Sep 17 00:00:00 2001 From: Vitaly Bordug Date: Thu, 21 Sep 2006 22:38:05 +0400 Subject: POWERPC: overhaul with cpm2_map mechanism Incorporating the new way of cpm2 immr access, introduced in the previous patch, into CPM2 peripheral devices (fs_enet and cpm_uart). Both ppc and powerpc approved working( real actions taken in powerpc only, ppc just has a wrapper to keep init stuff consistent). Signed-off-by: Vitaly Bordug --- include/asm-ppc/cpm2.h | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'include/asm-ppc') diff --git a/include/asm-ppc/cpm2.h b/include/asm-ppc/cpm2.h index bd6623aed383..220cc2debe08 100644 --- a/include/asm-ppc/cpm2.h +++ b/include/asm-ppc/cpm2.h @@ -1196,5 +1196,58 @@ typedef struct im_idma { #define FCC2_MEM_OFFSET FCC_MEM_OFFSET(1) #define FCC3_MEM_OFFSET FCC_MEM_OFFSET(2) +/* Clocks and GRG's */ + +enum cpm_clk_dir { + CPM_CLK_RX, + CPM_CLK_TX, + CPM_CLK_RTX +}; + +enum cpm_clk_target { + CPM_CLK_SCC1, + CPM_CLK_SCC2, + CPM_CLK_SCC3, + CPM_CLK_SCC4, + CPM_CLK_FCC1, + CPM_CLK_FCC2, + CPM_CLK_FCC3 +}; + +enum cpm_clk { + CPM_CLK_NONE = 0, + CPM_BRG1, /* Baud Rate Generator 1 */ + CPM_BRG2, /* Baud Rate Generator 2 */ + CPM_BRG3, /* Baud Rate Generator 3 */ + CPM_BRG4, /* Baud Rate Generator 4 */ + CPM_BRG5, /* Baud Rate Generator 5 */ + CPM_BRG6, /* Baud Rate Generator 6 */ + CPM_BRG7, /* Baud Rate Generator 7 */ + CPM_BRG8, /* Baud Rate Generator 8 */ + CPM_CLK1, /* Clock 1 */ + CPM_CLK2, /* Clock 2 */ + CPM_CLK3, /* Clock 3 */ + CPM_CLK4, /* Clock 4 */ + CPM_CLK5, /* Clock 5 */ + CPM_CLK6, /* Clock 6 */ + CPM_CLK7, /* Clock 7 */ + CPM_CLK8, /* Clock 8 */ + CPM_CLK9, /* Clock 9 */ + CPM_CLK10, /* Clock 10 */ + CPM_CLK11, /* Clock 11 */ + CPM_CLK12, /* Clock 12 */ + CPM_CLK13, /* Clock 13 */ + CPM_CLK14, /* Clock 14 */ + CPM_CLK15, /* Clock 15 */ + CPM_CLK16, /* Clock 16 */ + CPM_CLK17, /* Clock 17 */ + CPM_CLK18, /* Clock 18 */ + CPM_CLK19, /* Clock 19 */ + CPM_CLK20, /* Clock 20 */ + CPM_CLK_DUMMY +}; + +extern int cpm2_clk_setup(enum cpm_clk_target target, int clock, int mode); + #endif /* __CPM2__ */ #endif /* __KERNEL__ */ -- cgit v1.2.3 From 5e980823581682d1566e7b5089cf827ddd5f3c94 Mon Sep 17 00:00:00 2001 From: Li Yang Date: Fri, 29 Sep 2006 18:15:52 +0800 Subject: [POWERPC] Fix rheap alignment problem Honor alignment parameter in the rheap allocator. This is needed by qe_lib. Remove compile warning. Signed-off-by: Pantelis Antoniou Signed-off-by: Li Yang Acked-by: Kumar Galak Signed-off-by: Paul Mackerras --- include/asm-ppc/rheap.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/asm-ppc') diff --git a/include/asm-ppc/rheap.h b/include/asm-ppc/rheap.h index e6ca1f67cedc..65b93225a778 100644 --- a/include/asm-ppc/rheap.h +++ b/include/asm-ppc/rheap.h @@ -62,6 +62,10 @@ extern int rh_attach_region(rh_info_t * info, void *start, int size); /* Detach a free region */ extern void *rh_detach_region(rh_info_t * info, void *start, int size); +/* Allocate the given size from the remote heap (with alignment) */ +extern void *rh_alloc_align(rh_info_t * info, int size, int alignment, + const char *owner); + /* Allocate the given size from the remote heap */ extern void *rh_alloc(rh_info_t * info, int size, const char *owner); -- cgit v1.2.3