Example #1
0
static void
mv_twsi_cal_baud_rate(const uint32_t target, struct mv_twsi_baud_rate *rate)
{
	uint32_t clk, cur, diff, diff0;
	int m, n, m0, n0;

	/* Calculate baud rate. */
	m0 = n0 = 4;	/* Default values on reset */
	diff0 = 0xffffffff;
	clk = get_tclk();

	for (n = 0; n < 8; n++) {
		for (m = 0; m < 16; m++) {
			cur = TWSI_BAUD_RATE_RAW(clk,m,n);
			diff = ABSSUB(target, cur);
			if (diff < diff0) {
				m0 = m;
				n0 = n;
				diff0 = diff;
			}
		}
	}
	rate->raw = TWSI_BAUD_RATE_RAW(clk, m0, n0);
	rate->param = TWSI_BAUD_RATE_PARAM(m0, n0);
	rate->m = m0;
	rate->n = n0;
}
Example #2
0
static void __init clk_init(void)
{
	tclk = clk_register_fixed_rate(NULL, "tclk", NULL, CLK_IS_ROOT,
				       get_tclk());

	orion_clkdev_init(tclk);
}
void __init dove_init(void)
{
	int tclk;

	tclk = get_tclk();

	printk(KERN_INFO "Dove 88AP510 SoC, ");
	printk(KERN_INFO "TCLK = %dMHz\n", (tclk + 499999) / 1000000);

#ifdef CONFIG_CACHE_TAUROS2
	tauros2_init();
#endif
	dove_setup_cpu_mbus();

	dove_ge00_shared_data.t_clk = tclk;
	dove_uart0_data[0].uartclk = tclk;
	dove_uart1_data[0].uartclk = tclk;
	dove_uart2_data[0].uartclk = tclk;
	dove_uart3_data[0].uartclk = tclk;
	dove_spi0_data.tclk = tclk;
	dove_spi1_data.tclk = tclk;

	/* internal devices that every board has */
	dove_rtc_init();
	dove_xor0_init();
	dove_xor1_init();
}
int
uart_cpu_getdev(int devtype, struct uart_devinfo *di)
{
	struct uart_class *class = &uart_ns8250_class;

	/*
	 * If env specification for UART exists it takes precedence:
	 * hw.uart.console="mm:0xf1012000" or similar
	 */
	if (uart_getenv(devtype, di, class) == 0)
		return (0);
	/*
	 * Fall back to default UART0 console settings
	 */
	di->ops = uart_getops(class);
	di->bas.chan = 0;
	di->bas.bst = obio_tag;
	if (bus_space_map(di->bas.bst, MV_UART0_BASE, MV_UART_SIZE,
	    0, &di->bas.bsh) != 0)
		return (ENXIO);

	di->baudrate = 0;
	di->bas.regshft = 2;
	di->bas.rclk = get_tclk();
	di->databits = 8;
	di->stopbits = 1;
	di->parity = UART_PARITY_NONE;
	uart_bus_space_mem = obio_tag;
	uart_bus_space_io = NULL;

	return (0);
}
Example #5
0
void __init dove_init(void)
{
	printk(KERN_INFO "Dove 88AP510 SoC, ");
	printk(KERN_INFO "TCLK = %dMHz\n", (get_tclk() + 499999) / 1000000);

#ifdef CONFIG_CACHE_TAUROS2
	tauros2_init();
#endif
	dove_setup_cpu_mbus();

	/* Setup root of clk tree */
	clk_init();

	/* internal devices that every board has */
	dove_rtc_init();
	dove_xor0_init();
	dove_xor1_init();
}
Example #6
0
static void __init dove_timer_init(void)
{
	orion_time_init(BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR,
			IRQ_DOVE_BRIDGE, get_tclk());
}
Example #7
0
/*****************************************************************************
 * GE00
 ****************************************************************************/
void __init dove_ge00_init(struct mv643xx_eth_platform_data *eth_data)
{
    orion_ge00_init(eth_data,
                    DOVE_GE00_PHYS_BASE, IRQ_DOVE_GE00_SUM,
                    0, get_tclk());
}
Example #8
0
void __init dove_spi1_init(void)
{
    orion_spi_1_init(DOVE_SPI1_PHYS_BASE, get_tclk());
}
Example #9
0
/*****************************************************************************
 * SPI
 ****************************************************************************/
void __init dove_spi0_init(void)
{
    orion_spi_init(DOVE_SPI0_PHYS_BASE, get_tclk());
}
Example #10
0
/*****************************************************************************
 * UART3
 ****************************************************************************/
void __init dove_uart3_init(void)
{
    orion_uart3_init(DOVE_UART3_VIRT_BASE, DOVE_UART3_PHYS_BASE,
                     IRQ_DOVE_UART_3, get_tclk());
}
Example #11
0
/*****************************************************************************
 * UART2
 ****************************************************************************/
void __init dove_uart2_init(void)
{
    orion_uart2_init(DOVE_UART2_VIRT_BASE, DOVE_UART2_PHYS_BASE,
                     IRQ_DOVE_UART_2, get_tclk());
}
Example #12
0
/*****************************************************************************
 * UART1
 ****************************************************************************/
void __init dove_uart1_init(void)
{
    orion_uart1_init(DOVE_UART1_VIRT_BASE, DOVE_UART1_PHYS_BASE,
                     IRQ_DOVE_UART_1, get_tclk());
}
Example #13
0
/*****************************************************************************
 * UART0
 ****************************************************************************/
void __init dove_uart0_init(void)
{
    orion_uart0_init(DOVE_UART0_VIRT_BASE, DOVE_UART0_PHYS_BASE,
                     IRQ_DOVE_UART_0, get_tclk());
}
Example #14
0
/*****************************************************************************
 * GE00
 ****************************************************************************/
void __init dove_ge00_init(struct mv643xx_eth_platform_data *eth_data)
{
	orion_ge00_init(eth_data, &dove_mbus_dram_info,
			DOVE_GE00_PHYS_BASE, IRQ_DOVE_GE00_SUM,
			0, get_tclk(), 1600);
}
static void dove_timer_init(void)
{
	orion_time_init(IRQ_DOVE_BRIDGE, get_tclk());
}