rk2928: uart init
authorkfx <kfx@rock-chips.com>
Wed, 11 Jul 2012 10:43:53 +0000 (18:43 +0800)
committerkfx <kfx@rock-chips.com>
Wed, 11 Jul 2012 10:43:53 +0000 (18:43 +0800)
arch/arm/mach-rk2928/board-rk2928-fpga.c
arch/arm/mach-rk2928/devices.c
drivers/tty/serial/Kconfig

index 74e21a4631ad8c278ff916878ef23f45f3e5b064..ed5b66e9303fab32edb35b20b085c90e79173a61 100644 (file)
@@ -78,6 +78,19 @@ static struct clk_lookup clks[] = {
        CLK("rk30_i2c.3", "i2c", &xin24m),
        CLK("rk29xx_spim.0", "spi", &xin24m),
        CLK("rk29xx_spim.1", "spi", &xin24m),
+
+        CLK("rk_serial.0", "uart_div", &xin24m),
+       CLK("rk_serial.0", "uart_frac_div", &xin24m),
+       CLK("rk_serial.0", "uart", &xin24m),
+       CLK("rk_serial.0", "pclk_uart", &xin24m),
+       CLK("rk_serial.1", "uart_div", &xin24m),
+       CLK("rk_serial.1", "uart_frac_div", &xin24m),
+       CLK("rk_serial.1", "uart", &xin24m),
+       CLK("rk_serial.1", "pclk_uart", &xin24m),
+       CLK("rk_serial.2", "uart_div", &xin24m),
+       CLK("rk_serial.2", "uart_frac_div", &xin24m),
+       CLK("rk_serial.2", "uart", &xin24m),
+       CLK("rk_serial.2", "pclk_uart", &xin24m),
 };
 
 void __init rk30_clock_init(void)
index 88c89c446b7e7640a4549e3c5ffbe6868906c64c..112f302cd6a0ed291b3ff8f143e2b80d00d04193 100755 (executable)
@@ -102,6 +102,85 @@ static void __init rk2928_init_dma(void)
 {
        platform_add_devices(rk2928_dmacs, ARRAY_SIZE(rk2928_dmacs));
 }
+
+#ifdef CONFIG_UART0_RK29
+static struct resource resources_uart0[] = {
+       {
+               .start  = IRQ_UART0,
+               .end    = IRQ_UART0,
+               .flags  = IORESOURCE_IRQ,
+       },
+       {
+               .start  = RK2928_UART0_PHYS,
+               .end    = RK2928_UART0_PHYS + RK2928_UART0_SIZE - 1,
+               .flags  = IORESOURCE_MEM,
+       },
+};
+
+static struct platform_device device_uart0 = {
+       .name   = "rk_serial",
+       .id     = 0,
+       .num_resources  = ARRAY_SIZE(resources_uart0),
+       .resource       = resources_uart0,
+};
+#endif
+
+#ifdef CONFIG_UART1_RK29
+static struct resource resources_uart1[] = {
+       {
+               .start  = IRQ_UART1,
+               .end    = IRQ_UART1,
+               .flags  = IORESOURCE_IRQ,
+       },
+       {
+               .start  = RK2928_UART1_PHYS,
+               .end    = RK2928_UART1_PHYS + RK2928_UART1_SIZE - 1,
+               .flags  = IORESOURCE_MEM,
+       },
+};
+
+static struct platform_device device_uart1 = {
+       .name   = "rk_serial",
+       .id     = 1,
+       .num_resources  = ARRAY_SIZE(resources_uart1),
+       .resource       = resources_uart1,
+};
+#endif
+
+#ifdef CONFIG_UART2_RK29
+static struct resource resources_uart2[] = {
+       {
+               .start  = IRQ_UART2,
+               .end    = IRQ_UART2,
+               .flags  = IORESOURCE_IRQ,
+       },
+       {
+               .start  = RK2928_UART2_PHYS,
+               .end    = RK2928_UART2_PHYS + RK2928_UART2_SIZE - 1,
+               .flags  = IORESOURCE_MEM,
+       },
+};
+
+static struct platform_device device_uart2 = {
+       .name   = "rk_serial",
+       .id     = 2,
+       .num_resources  = ARRAY_SIZE(resources_uart2),
+       .resource       = resources_uart2,
+};
+#endif
+
+static void __init rk2928_init_uart(void)
+{
+#ifdef CONFIG_UART0_RK29
+       platform_device_register(&device_uart0);
+#endif
+#ifdef CONFIG_UART1_RK29
+       platform_device_register(&device_uart1);
+#endif
+#ifdef CONFIG_UART2_RK29
+       platform_device_register(&device_uart2);
+#endif
+}
 // i2c
 #ifdef CONFIG_I2C0_CONTROLLER_RK29
 #define I2C0_ADAP_TYPE  I2C_RK29_ADAP
@@ -414,6 +493,7 @@ static void __init rk2928_init_spim(void)
 static int __init rk2928_init_devices(void)
 {
        rk2928_init_dma();
+       rk2928_init_uart();
        rk2928_init_i2c();
        rk2928_init_spim();
 #if defined(CONFIG_FIQ_DEBUGGER) && defined(DEBUG_UART_PHYS)
index 4763420c6a4af57a62a14b9177b7096c1cb20ca4..3405977f4d43b72c7498ded8b53debf0c5eae4ef 100644 (file)
@@ -1555,7 +1555,7 @@ config UART2_DMA_RK29
 
 config UART3_RK29
        bool "Serial port 3 support"
-       depends on SERIAL_RK29
+       depends on SERIAL_RK29 && !ARCH_RK2928
 
 config UART3_CTS_RTS_RK29
        bool "Serial port 3 CTS/RTS support"