3 * John Clemens <clemens@mclx.com>, Mission Critical Linux, Inc.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25 * mpsc.c - driver for console over the MPSC.
30 #include <asm/cache.h>
35 DECLARE_GLOBAL_DATA_PTR;
37 int (*mpsc_putchar)(char ch) = mpsc_putchar_early;
39 static volatile unsigned int *rx_desc_base=NULL;
40 static unsigned int rx_desc_index=0;
41 static volatile unsigned int *tx_desc_base=NULL;
42 static unsigned int tx_desc_index=0;
44 /* local function declarations */
45 static int galmpsc_connect(int channel, int connect);
46 static int galmpsc_route_serial(int channel, int connect);
47 static int galmpsc_route_rx_clock(int channel, int brg);
48 static int galmpsc_route_tx_clock(int channel, int brg);
49 static int galmpsc_write_config_regs(int mpsc, int mode);
50 static int galmpsc_config_channel_regs(int mpsc);
51 static int galmpsc_set_char_length(int mpsc, int value);
52 static int galmpsc_set_stop_bit_length(int mpsc, int value);
53 static int galmpsc_set_parity(int mpsc, int value);
54 static int galmpsc_enter_hunt(int mpsc);
55 static int galmpsc_set_brkcnt(int mpsc, int value);
56 static int galmpsc_set_tcschar(int mpsc, int value);
57 static int galmpsc_set_snoop(int mpsc, int value);
58 static int galmpsc_shutdown(int mpsc);
60 static int galsdma_set_RFT(int channel);
61 static int galsdma_set_SFM(int channel);
62 static int galsdma_set_rxle(int channel);
63 static int galsdma_set_txle(int channel);
64 static int galsdma_set_burstsize(int channel, unsigned int value);
65 static int galsdma_set_RC(int channel, unsigned int value);
67 static int galbrg_set_CDV(int channel, int value);
68 static int galbrg_enable(int channel);
69 static int galbrg_disable(int channel);
70 static int galbrg_set_clksrc(int channel, int value);
71 static int galbrg_set_CUV(int channel, int value);
73 static void galsdma_enable_rx(void);
75 /* static int galbrg_reset(int channel); */
77 #define SOFTWARE_CACHE_MANAGEMENT
79 #ifdef SOFTWARE_CACHE_MANAGEMENT
80 #define FLUSH_DCACHE(a,b) if(dcache_status()){clean_dcache_range((u32)(a),(u32)(b));}
81 #define FLUSH_AND_INVALIDATE_DCACHE(a,b) if(dcache_status()){flush_dcache_range((u32)(a),(u32)(b));}
82 #define INVALIDATE_DCACHE(a,b) if(dcache_status()){invalidate_dcache_range((u32)(a),(u32)(b));}
84 #define FLUSH_DCACHE(a,b)
85 #define FLUSH_AND_INVALIDATE_DCACHE(a,b)
86 #define INVALIDATE_DCACHE(a,b)
90 /* GT64240A errata: cant read MPSC/BRG registers... so make mirrors in ram for read/modify write */
91 #define MIRROR_HACK ((struct _tag_mirror_hack *)&(gd->mirror_hack[0]))
93 #define GT_REG_WRITE_MIRROR_G(a,d) {MIRROR_HACK->a ## _M = d; GT_REG_WRITE(a,d);}
94 #define GTREGREAD_MIRROR_G(a) (MIRROR_HACK->a ## _M)
96 #define GT_REG_WRITE_MIRROR(a,i,g,d) {MIRROR_HACK->a ## _M[i] = d; GT_REG_WRITE(a + (i*g),d);}
97 #define GTREGREAD_MIRROR(a,i,g) (MIRROR_HACK->a ## _M[i])
99 /* make sure this isn't bigger than 16 long words (u-boot.h) */
100 struct _tag_mirror_hack {
101 unsigned GALMPSC_PROTOCONF_REG_M[2]; /* 8008 */
102 unsigned GALMPSC_CHANNELREG_1_M[2]; /* 800c */
103 unsigned GALMPSC_CHANNELREG_2_M[2]; /* 8010 */
104 unsigned GALBRG_0_CONFREG_M[2]; /* b200 */
106 unsigned GALMPSC_ROUTING_REGISTER_M; /* b400 */
107 unsigned GALMPSC_RxC_ROUTE_M; /* b404 */
108 unsigned GALMPSC_TxC_ROUTE_M; /* b408 */
110 unsigned int baudrate; /* current baudrate, for tsc delay calc */
113 /* static struct _tag_mirror_hack *mh = NULL; */
115 /* special function for running out of flash. doesn't modify any
116 * global variables [josh] */
118 mpsc_putchar_early(char ch)
121 int temp=GTREGREAD_MIRROR(GALMPSC_CHANNELREG_2,mpsc,GALMPSC_REG_GAP);
122 galmpsc_set_tcschar(mpsc,ch);
123 GT_REG_WRITE(GALMPSC_CHANNELREG_2+(mpsc*GALMPSC_REG_GAP), temp|0x200);
125 #define MAGIC_FACTOR (10*1000000)
127 udelay(MAGIC_FACTOR / MIRROR_HACK->baudrate);
131 /* This is used after relocation, see serial.c and mpsc_init2 */
133 mpsc_putchar_sdma(char ch)
135 volatile unsigned int *p;
139 /* align the descriptor */
141 memset((void *)p, 0, 8 * sizeof(unsigned int));
143 /* fill one 64 bit buffer */
144 /* word swap, pad with 0 */
146 p[5] = (unsigned int)ch; /* x */
148 /* CHANGED completely according to GT64260A dox - NTL */
149 p[0] = 0x00010001; /* 0 */
150 p[1] = DESC_OWNER | DESC_FIRST | DESC_LAST; /* 4 */
152 p[3] = (unsigned int)&p[4]; /* c */
155 p[9] = DESC_FIRST | DESC_LAST;
156 p[10] = (unsigned int)&p[0];
157 p[11] = (unsigned int)&p[12];
160 FLUSH_DCACHE(&p[0], &p[8]);
162 GT_REG_WRITE(GALSDMA_0_CUR_TX_PTR+(CHANNEL*GALSDMA_REG_DIFF),
163 (unsigned int)&p[0]);
164 GT_REG_WRITE(GALSDMA_0_FIR_TX_PTR+(CHANNEL*GALSDMA_REG_DIFF),
165 (unsigned int)&p[0]);
167 temp = GTREGREAD(GALSDMA_0_COM_REG+(CHANNEL*GALSDMA_REG_DIFF));
168 temp |= (TX_DEMAND | TX_STOP);
169 GT_REG_WRITE(GALSDMA_0_COM_REG+(CHANNEL*GALSDMA_REG_DIFF), temp);
171 INVALIDATE_DCACHE(&p[1], &p[2]);
173 while(p[1] & DESC_OWNER) {
175 INVALIDATE_DCACHE(&p[1], &p[2]);
181 char mpsc_getchar (void)
183 static unsigned int done = 0;
185 unsigned int len = 0, idx = 0, temp;
187 volatile unsigned int *p;
191 p = &rx_desc_base[rx_desc_index * 8];
193 INVALIDATE_DCACHE (&p[0], &p[1]);
194 /* Wait for character */
195 while (p[1] & DESC_OWNER) {
197 INVALIDATE_DCACHE (&p[0], &p[1]);
200 /* Handle error case */
201 if (p[1] & (1 << 15)) {
202 printf ("oops, error: %08x\n", p[1]);
204 temp = GTREGREAD_MIRROR (GALMPSC_CHANNELREG_2,
205 CHANNEL, GALMPSC_REG_GAP);
207 GT_REG_WRITE_MIRROR (GALMPSC_CHANNELREG_2, CHANNEL,
208 GALMPSC_REG_GAP, temp);
210 /* Can't poll on abort bit, so we just wait. */
213 galsdma_enable_rx ();
216 /* Number of bytes left in this descriptor */
229 INVALIDATE_DCACHE (&p[idx], &p[idx + 1]);
235 /* this descriptor has more bytes still
236 * shift down the char we just read, and leave the
237 * buffer in place for the next time around
239 p[idx] = p[idx] >> 8;
240 FLUSH_DCACHE (&p[idx], &p[idx + 1]);
244 /* nothing left in this descriptor.
247 p[1] = DESC_OWNER | DESC_FIRST | DESC_LAST;
249 FLUSH_DCACHE (&p[0], &p[1]);
250 /* Next descriptor */
251 rx_desc_index = (rx_desc_index + 1) % RX_DESC;
254 } while (len == 0); /* galileo bug.. len might be zero */
262 volatile unsigned int *p = &rx_desc_base[rx_desc_index*8];
264 INVALIDATE_DCACHE(&p[1], &p[2]);
266 if (p[1] & DESC_OWNER) return 0;
273 memset(MIRROR_HACK, 0, sizeof(struct _tag_mirror_hack));
274 MIRROR_HACK->GALMPSC_ROUTING_REGISTER_M=0x3fffffff;
277 galbrg_set_baudrate(CHANNEL, baud);
278 #if defined(CONFIG_ZUMA_V2) || defined(CONFIG_P3G4)
279 galbrg_set_clksrc(CHANNEL,0x8); /* connect TCLK -> BRG */
281 galbrg_set_clksrc(CHANNEL,0);
283 galbrg_set_CUV(CHANNEL, 0);
284 galbrg_enable(CHANNEL);
286 /* Set up clock routing */
287 galmpsc_connect(CHANNEL, GALMPSC_CONNECT);
288 galmpsc_route_serial(CHANNEL, GALMPSC_CONNECT);
289 galmpsc_route_rx_clock(CHANNEL, CHANNEL);
290 galmpsc_route_tx_clock(CHANNEL, CHANNEL);
292 /* reset MPSC state */
293 galmpsc_shutdown(CHANNEL);
296 galsdma_set_burstsize(CHANNEL, L1_CACHE_BYTES/8); /* in 64 bit words (8 bytes) */
297 galsdma_set_txle(CHANNEL);
298 galsdma_set_rxle(CHANNEL);
299 galsdma_set_RC(CHANNEL, 0xf);
300 galsdma_set_SFM(CHANNEL);
301 galsdma_set_RFT(CHANNEL);
304 galmpsc_write_config_regs(CHANNEL, GALMPSC_UART);
305 galmpsc_config_channel_regs(CHANNEL);
306 galmpsc_set_char_length(CHANNEL, GALMPSC_CHAR_LENGTH_8); /* 8 */
307 galmpsc_set_parity(CHANNEL, GALMPSC_PARITY_NONE); /* N */
308 galmpsc_set_stop_bit_length(CHANNEL, GALMPSC_STOP_BITS_1); /* 1 */
310 /* COMM_MPSC CONFIG */
311 #ifdef SOFTWARE_CACHE_MANAGEMENT
312 galmpsc_set_snoop(CHANNEL, 0); /* disable snoop */
314 galmpsc_set_snoop(CHANNEL, 1); /* enable snoop */
325 mpsc_putchar = mpsc_putchar_sdma;
328 rx_desc_base = (unsigned int *)malloc(((RX_DESC+1)*8) *
329 sizeof(unsigned int));
331 /* align descriptors */
332 rx_desc_base = (unsigned int *)
333 (((unsigned int)rx_desc_base+32) & 0xFFFFFFF0);
337 memset((void *)rx_desc_base, 0, (RX_DESC*8)*sizeof(unsigned int));
339 for (i = 0; i < RX_DESC; i++) {
340 rx_desc_base[i*8 + 3] = (unsigned int)&rx_desc_base[i*8 + 4]; /* Buffer */
341 rx_desc_base[i*8 + 2] = (unsigned int)&rx_desc_base[(i+1)*8]; /* Next descriptor */
342 rx_desc_base[i*8 + 1] = DESC_OWNER | DESC_FIRST | DESC_LAST; /* Command & control */
343 rx_desc_base[i*8] = 0x00100000;
345 rx_desc_base[(i-1)*8 + 2] = (unsigned int)&rx_desc_base[0];
347 FLUSH_DCACHE(&rx_desc_base[0], &rx_desc_base[RX_DESC*8]);
348 GT_REG_WRITE(GALSDMA_0_CUR_RX_PTR+(CHANNEL*GALSDMA_REG_DIFF),
349 (unsigned int)&rx_desc_base[0]);
352 tx_desc_base = (unsigned int *)malloc(((TX_DESC+1)*8) *
353 sizeof(unsigned int));
355 /* align descriptors */
356 tx_desc_base = (unsigned int *)
357 (((unsigned int)tx_desc_base+32) & 0xFFFFFFF0);
361 memset((void *)tx_desc_base, 0, (TX_DESC*8)*sizeof(unsigned int));
363 for (i = 0; i < TX_DESC; i++) {
364 tx_desc_base[i*8 + 5] = (unsigned int)0x23232323;
365 tx_desc_base[i*8 + 4] = (unsigned int)0x23232323;
366 tx_desc_base[i*8 + 3] = (unsigned int)&tx_desc_base[i*8 + 4];
367 tx_desc_base[i*8 + 2] = (unsigned int)&tx_desc_base[(i+1)*8];
368 tx_desc_base[i*8 + 1] = DESC_OWNER | DESC_FIRST | DESC_LAST;
370 /* set sbytecnt and shadow byte cnt to 1 */
371 tx_desc_base[i*8] = 0x00010001;
373 tx_desc_base[(i-1)*8 + 2] = (unsigned int)&tx_desc_base[0];
375 FLUSH_DCACHE(&tx_desc_base[0], &tx_desc_base[TX_DESC*8]);
385 galbrg_set_baudrate(int channel, int rate)
389 galbrg_disable(channel);
391 #if defined(CONFIG_ZUMA_V2) || defined(CONFIG_P3G4)
393 clock = (CONFIG_SYS_BUS_CLK/(16*rate)) - 1;
395 clock = (3686400/(16*rate)) - 1;
398 galbrg_set_CDV(channel, clock);
400 galbrg_enable(channel);
402 MIRROR_HACK->baudrate = rate;
407 /* ------------------------------------------------------------------ */
409 /* Below are all the private functions that no one else needs */
412 galbrg_set_CDV(int channel, int value)
416 temp = GTREGREAD_MIRROR(GALBRG_0_CONFREG, channel, GALBRG_REG_GAP);
418 temp |= (value & 0x0000FFFF);
419 GT_REG_WRITE_MIRROR(GALBRG_0_CONFREG,channel,GALBRG_REG_GAP, temp);
425 galbrg_enable(int channel)
429 temp = GTREGREAD_MIRROR(GALBRG_0_CONFREG, channel, GALBRG_REG_GAP);
431 GT_REG_WRITE_MIRROR(GALBRG_0_CONFREG, channel, GALBRG_REG_GAP,temp);
437 galbrg_disable(int channel)
441 temp = GTREGREAD_MIRROR(GALBRG_0_CONFREG, channel, GALBRG_REG_GAP);
443 GT_REG_WRITE_MIRROR(GALBRG_0_CONFREG, channel, GALBRG_REG_GAP,temp);
449 galbrg_set_clksrc(int channel, int value)
453 temp = GTREGREAD_MIRROR(GALBRG_0_CONFREG,channel, GALBRG_REG_GAP);
455 temp |= (value << 18);
456 GT_REG_WRITE_MIRROR(GALBRG_0_CONFREG,channel, GALBRG_REG_GAP,temp);
462 galbrg_set_CUV(int channel, int value)
464 GT_REG_WRITE(GALBRG_0_BTREG + (channel * GALBRG_REG_GAP), value);
471 galbrg_reset(int channel)
475 temp = GTREGREAD(GALBRG_0_CONFREG + (channel * GALBRG_REG_GAP));
477 GT_REG_WRITE(GALBRG_0_CONFREG + (channel * GALBRG_REG_GAP), temp);
484 galsdma_set_RFT(int channel)
488 temp = GTREGREAD(GALSDMA_0_CONF_REG+(channel*GALSDMA_REG_DIFF));
490 GT_REG_WRITE(GALSDMA_0_CONF_REG+(channel*GALSDMA_REG_DIFF), temp);
496 galsdma_set_SFM(int channel)
500 temp = GTREGREAD(GALSDMA_0_CONF_REG+(channel*GALSDMA_REG_DIFF));
502 GT_REG_WRITE(GALSDMA_0_CONF_REG+(channel*GALSDMA_REG_DIFF), temp);
508 galsdma_set_rxle(int channel)
512 temp = GTREGREAD(GALSDMA_0_CONF_REG+(channel*GALSDMA_REG_DIFF));
514 GT_REG_WRITE(GALSDMA_0_CONF_REG+(channel*GALSDMA_REG_DIFF), temp);
520 galsdma_set_txle(int channel)
524 temp = GTREGREAD(GALSDMA_0_CONF_REG+(channel*GALSDMA_REG_DIFF));
526 GT_REG_WRITE(GALSDMA_0_CONF_REG+(channel*GALSDMA_REG_DIFF), temp);
532 galsdma_set_RC(int channel, unsigned int value)
536 temp = GTREGREAD(GALSDMA_0_CONF_REG+(channel*GALSDMA_REG_DIFF));
538 temp |= (value << 2);
539 GT_REG_WRITE(GALSDMA_0_CONF_REG+(channel*GALSDMA_REG_DIFF), temp);
545 galsdma_set_burstsize(int channel, unsigned int value)
549 temp = GTREGREAD(GALSDMA_0_CONF_REG+(channel*GALSDMA_REG_DIFF));
553 GT_REG_WRITE(GALSDMA_0_CONF_REG+(channel*GALSDMA_REG_DIFF),
554 (temp | (0x3 << 12)));
558 GT_REG_WRITE(GALSDMA_0_CONF_REG+(channel*GALSDMA_REG_DIFF),
559 (temp | (0x2 << 12)));
563 GT_REG_WRITE(GALSDMA_0_CONF_REG+(channel*GALSDMA_REG_DIFF),
564 (temp | (0x1 << 12)));
568 GT_REG_WRITE(GALSDMA_0_CONF_REG+(channel*GALSDMA_REG_DIFF),
569 (temp | (0x0 << 12)));
581 galmpsc_connect(int channel, int connect)
585 temp = GTREGREAD_MIRROR_G(GALMPSC_ROUTING_REGISTER);
587 if ((channel == 0) && connect)
589 else if ((channel == 1) && connect)
590 temp &= ~(0x00000007 << 6);
591 else if ((channel == 0) && !connect)
594 temp |= (0x00000007 << 6);
596 /* Just in case... */
599 GT_REG_WRITE_MIRROR_G(GALMPSC_ROUTING_REGISTER, temp);
605 galmpsc_route_serial(int channel, int connect)
609 temp = GTREGREAD(GALMPSC_SERIAL_MULTIPLEX);
611 if ((channel == 0) && connect)
613 else if ((channel == 1) && connect)
615 else if ((channel == 0) && !connect)
620 GT_REG_WRITE(GALMPSC_SERIAL_MULTIPLEX,temp);
626 galmpsc_route_rx_clock(int channel, int brg)
630 temp = GTREGREAD_MIRROR_G(GALMPSC_RxC_ROUTE);
637 GT_REG_WRITE_MIRROR_G(GALMPSC_RxC_ROUTE,temp);
643 galmpsc_route_tx_clock(int channel, int brg)
647 temp = GTREGREAD_MIRROR_G(GALMPSC_TxC_ROUTE);
654 GT_REG_WRITE_MIRROR_G(GALMPSC_TxC_ROUTE,temp);
660 galmpsc_write_config_regs(int mpsc, int mode)
662 if (mode == GALMPSC_UART) {
663 /* Main config reg Low (Null modem, Enable Tx/Rx, UART mode) */
664 GT_REG_WRITE(GALMPSC_MCONF_LOW + (mpsc*GALMPSC_REG_GAP),
667 /* Main config reg High (32x Rx/Tx clock mode, width=8bits */
668 GT_REG_WRITE(GALMPSC_MCONF_HIGH +(mpsc*GALMPSC_REG_GAP),
672 /* 0000 0010 0000 0000 */
675 /* 0000 0011 1111 1000 */
683 galmpsc_config_channel_regs(int mpsc)
685 GT_REG_WRITE_MIRROR(GALMPSC_CHANNELREG_1,mpsc,GALMPSC_REG_GAP, 0);
686 GT_REG_WRITE_MIRROR(GALMPSC_CHANNELREG_2,mpsc,GALMPSC_REG_GAP, 0);
687 GT_REG_WRITE(GALMPSC_CHANNELREG_3+(mpsc*GALMPSC_REG_GAP), 1);
688 GT_REG_WRITE(GALMPSC_CHANNELREG_4+(mpsc*GALMPSC_REG_GAP), 0);
689 GT_REG_WRITE(GALMPSC_CHANNELREG_5+(mpsc*GALMPSC_REG_GAP), 0);
690 GT_REG_WRITE(GALMPSC_CHANNELREG_6+(mpsc*GALMPSC_REG_GAP), 0);
691 GT_REG_WRITE(GALMPSC_CHANNELREG_7+(mpsc*GALMPSC_REG_GAP), 0);
692 GT_REG_WRITE(GALMPSC_CHANNELREG_8+(mpsc*GALMPSC_REG_GAP), 0);
693 GT_REG_WRITE(GALMPSC_CHANNELREG_9+(mpsc*GALMPSC_REG_GAP), 0);
694 GT_REG_WRITE(GALMPSC_CHANNELREG_10+(mpsc*GALMPSC_REG_GAP), 0);
696 galmpsc_set_brkcnt(mpsc, 0x3);
697 galmpsc_set_tcschar(mpsc, 0xab);
703 galmpsc_set_brkcnt(int mpsc, int value)
707 temp = GTREGREAD_MIRROR(GALMPSC_CHANNELREG_1,mpsc,GALMPSC_REG_GAP);
709 temp |= (value << 16);
710 GT_REG_WRITE_MIRROR(GALMPSC_CHANNELREG_1,mpsc,GALMPSC_REG_GAP, temp);
716 galmpsc_set_tcschar(int mpsc, int value)
720 temp = GTREGREAD_MIRROR(GALMPSC_CHANNELREG_1,mpsc,GALMPSC_REG_GAP);
723 GT_REG_WRITE_MIRROR(GALMPSC_CHANNELREG_1,mpsc,GALMPSC_REG_GAP, temp);
729 galmpsc_set_char_length(int mpsc, int value)
733 temp = GTREGREAD_MIRROR(GALMPSC_PROTOCONF_REG,mpsc,GALMPSC_REG_GAP);
735 temp |= (value << 12);
736 GT_REG_WRITE_MIRROR(GALMPSC_PROTOCONF_REG,mpsc,GALMPSC_REG_GAP, temp);
742 galmpsc_set_stop_bit_length(int mpsc, int value)
746 temp = GTREGREAD_MIRROR(GALMPSC_PROTOCONF_REG,mpsc,GALMPSC_REG_GAP);
747 temp |= (value << 14);
748 GT_REG_WRITE_MIRROR(GALMPSC_PROTOCONF_REG,mpsc,GALMPSC_REG_GAP,temp);
754 galmpsc_set_parity(int mpsc, int value)
758 temp = GTREGREAD_MIRROR(GALMPSC_CHANNELREG_2,mpsc,GALMPSC_REG_GAP);
761 temp |= ((value << 18) | (value << 2));
762 temp |= ((value << 17) | (value << 1));
767 GT_REG_WRITE_MIRROR(GALMPSC_CHANNELREG_2,mpsc,GALMPSC_REG_GAP, temp);
773 galmpsc_enter_hunt(int mpsc)
777 temp = GTREGREAD_MIRROR(GALMPSC_CHANNELREG_2,mpsc,GALMPSC_REG_GAP);
779 GT_REG_WRITE_MIRROR(GALMPSC_CHANNELREG_2,mpsc,GALMPSC_REG_GAP, temp);
781 /* Should Poll on Enter Hunt bit, but the register is write-only */
782 /* errata suggests pausing 100 system cycles */
790 galmpsc_shutdown(int mpsc)
795 /* cause RX abort (clears RX) */
796 temp = GTREGREAD_MIRROR(GALMPSC_CHANNELREG_2,mpsc,GALMPSC_REG_GAP);
797 temp |= MPSC_RX_ABORT | MPSC_TX_ABORT;
798 temp &= ~MPSC_ENTER_HUNT;
799 GT_REG_WRITE_MIRROR(GALMPSC_CHANNELREG_2,mpsc,GALMPSC_REG_GAP,temp);
802 GT_REG_WRITE(GALSDMA_0_COM_REG + CHANNEL * GALSDMA_REG_DIFF, 0);
803 GT_REG_WRITE(GALSDMA_0_COM_REG + CHANNEL * GALSDMA_REG_DIFF,
804 SDMA_TX_ABORT | SDMA_RX_ABORT);
806 /* shut down the MPSC */
807 GT_REG_WRITE(GALMPSC_MCONF_LOW, 0);
808 GT_REG_WRITE(GALMPSC_MCONF_HIGH, 0);
809 GT_REG_WRITE_MIRROR(GALMPSC_PROTOCONF_REG, mpsc, GALMPSC_REG_GAP,0);
813 /* shut down the sdma engines. */
814 /* reset config to default */
815 GT_REG_WRITE(GALSDMA_0_CONF_REG + CHANNEL * GALSDMA_REG_DIFF,
820 /* clear the SDMA current and first TX and RX pointers */
821 GT_REG_WRITE(GALSDMA_0_CUR_RX_PTR + CHANNEL * GALSDMA_REG_DIFF, 0);
822 GT_REG_WRITE(GALSDMA_0_CUR_TX_PTR + CHANNEL * GALSDMA_REG_DIFF, 0);
823 GT_REG_WRITE(GALSDMA_0_FIR_TX_PTR + CHANNEL * GALSDMA_REG_DIFF, 0);
831 galsdma_enable_rx(void)
835 /* Enable RX processing */
836 temp = GTREGREAD(GALSDMA_0_COM_REG+(CHANNEL*GALSDMA_REG_DIFF));
838 GT_REG_WRITE(GALSDMA_0_COM_REG+(CHANNEL*GALSDMA_REG_DIFF), temp);
840 galmpsc_enter_hunt(CHANNEL);
844 galmpsc_set_snoop(int mpsc, int value)
846 int reg = mpsc ? MPSC_1_ADDRESS_CONTROL_LOW : MPSC_0_ADDRESS_CONTROL_LOW;
847 int temp=GTREGREAD(reg);
849 temp |= (1<< 6) | (1<<14) | (1<<22) | (1<<30);
851 temp &= ~((1<< 6) | (1<<14) | (1<<22) | (1<<30));
852 GT_REG_WRITE(reg, temp);