Beispiel #1
0
static void
console_write_direct(struct console *co, const char *buf, unsigned int len)
{
	int i;
	reg_ser_r_stat_din stat;
	reg_ser_rw_tr_dma_en tr_dma_en, old;

	/* Switch to manual mode */
	tr_dma_en = old = REG_RD (ser, port->instance, rw_tr_dma_en);
	if (tr_dma_en.en == regk_ser_yes) {
		tr_dma_en.en = regk_ser_no;
		REG_WR(ser, port->instance, rw_tr_dma_en, tr_dma_en);
	}

	/* Send data */
	for (i = 0; i < len; i++) {
		/* LF -> CRLF */
		if (buf[i] == '\n') {
			do {
				stat = REG_RD (ser, port->instance, r_stat_din);
			} while (!stat.tr_rdy);
			REG_WR_INT (ser, port->instance, rw_dout, '\r');
		}
		/* Wait until transmitter is ready and send.*/
		do {
			stat = REG_RD (ser, port->instance, r_stat_din);
		} while (!stat.tr_rdy);
		REG_WR_INT (ser, port->instance, rw_dout, buf[i]);
	}

	/* Restore mode */
	if (tr_dma_en.en != old.en)
		REG_WR(ser, port->instance, rw_tr_dma_en, old);
}
int crisv32_arbiter_watch(unsigned long start, unsigned long size,
			  unsigned long clients, unsigned long accesses,
			  watch_callback *cb)
{
	int i;

	crisv32_arbiter_init();

	if (start > 0x80000000) {
		printk(KERN_ERR "Arbiter: %lX doesn't look like a "
			"physical address", start);
		return -EFAULT;
	}

	spin_lock(&arbiter_lock);

	for (i = 0; i < NUMBER_OF_BP; i++) {
		if (!watches[i].used) {
			reg_marb_rw_intr_mask intr_mask =
			    REG_RD(marb, regi_marb, rw_intr_mask);

			watches[i].used = 1;
			watches[i].start = start;
			watches[i].end = start + size;
			watches[i].cb = cb;

			REG_WR_INT(marb_bp, watches[i].instance, rw_first_addr,
				   watches[i].start);
			REG_WR_INT(marb_bp, watches[i].instance, rw_last_addr,
				   watches[i].end);
			REG_WR_INT(marb_bp, watches[i].instance, rw_op,
				   accesses);
			REG_WR_INT(marb_bp, watches[i].instance, rw_clients,
				   clients);

			if (i == 0)
				intr_mask.bp0 = regk_marb_yes;
			else if (i == 1)
				intr_mask.bp1 = regk_marb_yes;
			else if (i == 2)
				intr_mask.bp2 = regk_marb_yes;
			else if (i == 3)
				intr_mask.bp3 = regk_marb_yes;

			REG_WR(marb, regi_marb, rw_intr_mask, intr_mask);
			spin_unlock(&arbiter_lock);

			return i;
		}
	}
	spin_unlock(&arbiter_lock);
	return -ENOMEM;
}
Beispiel #3
0
/* Use polling to put a single character to the kernel debug port */
void
putDebugChar(int val)
{
	reg_ser_r_stat_din stat;
	do {
		stat = REG_RD(ser, kgdb_port->instance, r_stat_din);
	} while (!stat.tr_rdy);
	REG_WR_INT(ser, kgdb_port->instance, rw_dout, val);
}
Beispiel #4
0
static void etraxfs_uart_put_poll_char(struct uart_port *port,
					unsigned char c)
{
	reg_ser_r_stat_din stat;
	struct uart_cris_port *up = (struct uart_cris_port *)port;

	do {
		stat = REG_RD(ser, up->regi_ser, r_stat_din);
	} while (!stat.tr_rdy);
	REG_WR_INT(ser, up->regi_ser, rw_dout, c);
}
Beispiel #5
0
static void
cris_console_write(struct console *co, const char *s, unsigned int count)
{
	struct uart_cris_port *up;
	int i;
	reg_ser_r_stat_din stat;
	reg_ser_rw_tr_dma_en tr_dma_en, old;

	up = etraxfs_uart_ports[co->index];

	if (!up)
		return;

	/* Switch to manual mode. */
	tr_dma_en = old = REG_RD(ser, up->regi_ser, rw_tr_dma_en);
	if (tr_dma_en.en == regk_ser_yes) {
		tr_dma_en.en = regk_ser_no;
		REG_WR(ser, up->regi_ser, rw_tr_dma_en, tr_dma_en);
	}

	/* Send data. */
	for (i = 0; i < count; i++) {
		/* LF -> CRLF */
		if (s[i] == '\n') {
			do {
				stat = REG_RD(ser, up->regi_ser, r_stat_din);
			} while (!stat.tr_rdy);
			REG_WR_INT(ser, up->regi_ser, rw_dout, '\r');
		}
		/* Wait until transmitter is ready and send. */
		do {
			stat = REG_RD(ser, up->regi_ser, r_stat_din);
		} while (!stat.tr_rdy);
		REG_WR_INT(ser, up->regi_ser, rw_dout, s[i]);
	}

	/* Restore mode. */
	if (tr_dma_en.en != old.en)
		REG_WR(ser, up->regi_ser, rw_tr_dma_en, old);
}
Beispiel #6
0
int
crisv32_pinmux_init(void)
{
    static int initialized;

    if (!initialized) {
        initialized = 1;
        REG_WR_INT(pinmux, regi_pinmux, rw_hwprot, 0);
        crisv32_pinmux_alloc(PORT_A, 0, 31, pinmux_gpio);
        crisv32_pinmux_alloc(PORT_B, 0, 31, pinmux_gpio);
        crisv32_pinmux_alloc(PORT_C, 0, 15, pinmux_gpio);
    }

    return 0;
}
Beispiel #7
0
int crisv32_pinmux_init(void)
{
    static int initialized;

    if (!initialized) {
        reg_pinmux_rw_pa pa = REG_RD(pinmux, regi_pinmux, rw_pa);
        initialized = 1;
        REG_WR_INT(pinmux, regi_pinmux, rw_hwprot, 0);
        pa.pa0 = pa.pa1 = pa.pa2 = pa.pa3 =
            pa.pa4 = pa.pa5 = pa.pa6 = pa.pa7 = regk_pinmux_yes;
        REG_WR(pinmux, regi_pinmux, rw_pa, pa);
        crisv32_pinmux_alloc(PORT_B, 0, PORT_PINS - 1, pinmux_gpio);
        crisv32_pinmux_alloc(PORT_C, 0, PORT_PINS - 1, pinmux_gpio);
        crisv32_pinmux_alloc(PORT_D, 0, PORT_PINS - 1, pinmux_gpio);
        crisv32_pinmux_alloc(PORT_E, 0, PORT_PINS - 1, pinmux_gpio);
    }

    return 0;
}