rk30: add vmac support
author黄涛 <huangtao@rock-chips.com>
Mon, 7 May 2012 12:22:42 +0000 (20:22 +0800)
committer黄涛 <huangtao@rock-chips.com>
Mon, 7 May 2012 12:24:16 +0000 (20:24 +0800)
arch/arm/mach-rk29/include/mach/board.h
arch/arm/mach-rk30/clock_data.c
arch/arm/mach-rk30/common.c
arch/arm/mach-rk30/devices.c
arch/arm/mach-rk30/include/mach/board.h
arch/arm/plat-rk/include/plat/board.h

index 515b09c7f06209baf94a9812b063ecf809ba7f8b..722f7a94e1c081b06aecc8928aebd26a11e1a8a6 100755 (executable)
@@ -70,14 +70,6 @@ struct rk29_button_light_info{
        int (*io_deinit)(void);
 };
 
-/*vmac*/
-struct rk29_vmac_platform_data {
-       int (*vmac_register_set)(void);
-       int (*rmii_io_init)(void);
-       int (*rmii_io_deinit)(void);
-    int (*rmii_power_control)(int enable);
-};
-
 #define INVALID_GPIO        -1
 
 
index e9e10049a556e8bc5ac229e1aeb664873f841fe8..8d37b035b03a250b7d006804cc281bef48c07acd 100755 (executable)
@@ -2637,7 +2637,7 @@ static struct clk_lookup clks[] = {
        CLK1(pclk_timer2),
 
        CLK(NULL, "rmii_clkin", &rmii_clkin),
-       CLK1(mac_pll_div),
+       CLK(NULL, "mac_ref_div", &clk_mac_pll_div), // compatible with rk29
        CLK1(mac_ref),
        CLK1(mii_tx),
        CLK1(hsadc_pll_div),
index b85115b34117e06f1c88dfdda59ee3d9dd4f75bc..381da22b1fd0699af0b3ca694b1ca96d8b7473a7 100755 (executable)
 
 static void __init rk30_cpu_axi_init(void)
 {
-       writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x0088);
-       writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x0108);
-       writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x0188);
-       writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x0388);
-       writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x4008);
-       writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x5008);
-       writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x6008);
-       writel_relaxed(0xa, RK30_CPU_AXI_BUS_BASE + 0x7008);
-       writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x7088);
-       writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x7108);
-       writel_relaxed(0xa, RK30_CPU_AXI_BUS_BASE + 0x7188);
-       writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x7208);
-       writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x7288);
-       writel_relaxed(0x3f, RK30_CPU_AXI_BUS_BASE + 0x0014);
+       writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x0088);    // cpu0
+       writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x0108);    // dmac1
+       writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x0188);    // cpu1r
+       writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x0388);    // cpu1w
+#ifdef CONFIG_RK29_VMAC
+       writel_relaxed(0xa, RK30_CPU_AXI_BUS_BASE + 0x4008);    // peri
+#else
+       writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x4008);    // peri
+#endif
+       writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x5008);    // gpu
+       writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x6008);    // vpu
+       writel_relaxed(0xa, RK30_CPU_AXI_BUS_BASE + 0x7008);    // lcdc0
+       writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x7088);    // cif0
+       writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x7108);    // ipp
+       writel_relaxed(0xa, RK30_CPU_AXI_BUS_BASE + 0x7188);    // lcdc1
+       writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x7208);    // cif1
+       writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x7288);    // rga
+       writel_relaxed(0x3f, RK30_CPU_AXI_BUS_BASE + 0x0014);   // memory scheduler read latency
        dsb();
 }
 
-
 #define L2_LY_SP_OFF (0)
 #define L2_LY_SP_MSK (0x7)
 
index 57937c0976d8bfeaf3e38f5ab3eb9886b5e3ec79..852ded9a79aa5dea14d2782eea3e2a4fd1bac081 100755 (executable)
@@ -847,7 +847,6 @@ static struct platform_device device_rga = {
 };
 #endif
 
-//#ifdef CONFIG_RK29_IPP
 static struct resource resource_ipp[] = {
        [0] = {
                .start = RK30_IPP_PHYS,
@@ -867,7 +866,6 @@ static struct platform_device device_ipp = {
        .num_resources  = ARRAY_SIZE(resource_ipp),
        .resource       = resource_ipp,
 };
-//#endif
 
 #ifdef CONFIG_SND_RK29_SOC_I2S
 #ifdef CONFIG_SND_RK29_SOC_I2S_8CH
@@ -983,6 +981,7 @@ static void __init rk30_init_i2s(void)
 #endif
        platform_device_register(&device_pcm);
 }
+
 #ifdef CONFIG_USB20_OTG
 /*DWC_OTG*/
 static struct resource usb20_otg_resource[] = {
@@ -1100,7 +1099,33 @@ static void __init rk30_init_sdmmc(void)
 #endif
 }
 
-extern int rk29sdk_wifi_bt_gpio_control_init(void);
+#ifdef CONFIG_RK29_VMAC
+static u64 eth_dmamask = DMA_BIT_MASK(32);
+static struct resource resources_vmac[] = {
+       [0] = {
+               .start  = RK30_MAC_PHYS,
+               .end    = RK30_MAC_PHYS + RK30_MAC_SIZE - 1,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = IRQ_MAC,
+               .end    = IRQ_MAC,
+               .flags  = IORESOURCE_IRQ,
+       }
+};
+
+static struct platform_device device_vmac = {
+       .name           = "rk29 vmac",
+       .id             = 0,
+       .dev = {
+               .dma_mask               = &eth_dmamask,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+               .platform_data          = &board_vmac_data,
+       },
+       .num_resources  = ARRAY_SIZE(resources_vmac),
+       .resource       = resources_vmac,
+};
+#endif
 
 static int __init rk30_init_devices(void)
 {
@@ -1123,9 +1148,7 @@ static int __init rk30_init_devices(void)
 #ifdef CONFIG_RGA_RK30
        platform_device_register(&device_rga);
 #endif
-//#ifdef CONFIG_RK29_IPP
        platform_device_register(&device_ipp);
-//#endif
 #ifdef CONFIG_LCDC0_RK30
        platform_device_register(&device_lcdc0);
 #endif
@@ -1144,6 +1167,9 @@ static int __init rk30_init_devices(void)
        rk_serial_debug_init(DEBUG_UART_BASE, IRQ_UART0 + CONFIG_RK_DEBUG_UART, IRQ_UART_SIGNAL, -1);
 #endif
        rk30_init_i2s();
+#ifdef CONFIG_RK29_VMAC
+       platform_device_register(&device_vmac);
+#endif
 
        return 0;
 }
index 962b856f89ee04fac2eba535cc17eecc74fb3b61..a03686db380c555017bb6c18eee5b820a5f08da9 100755 (executable)
@@ -56,6 +56,7 @@ extern struct rk29_sdmmc_platform_data default_sdmmc0_data;
 extern struct rk29_sdmmc_platform_data default_sdmmc1_data;
 
 extern struct i2c_gpio_platform_data default_i2c_gpio_data; 
+extern struct rk29_vmac_platform_data board_vmac_data;
 
 void __init rk30_map_common_io(void);
 void __init rk30_init_irq(void);
index 5d69a91e1932f0611f5e3b3077410d953338ba2d..44a502521ad56a162fbf6e04f5418a1164447f03 100755 (executable)
@@ -127,6 +127,14 @@ struct rk29_gpio_expander_info {
        unsigned int pin_value; //GPIO_HIGH or GPIO_LOW
 };
 
+/*vmac*/
+struct rk29_vmac_platform_data {
+       int (*vmac_register_set)(void);
+       int (*rmii_io_init)(void);
+       int (*rmii_io_deinit)(void);
+       int (*rmii_power_control)(int enable);
+};
+
 #define BOOT_MODE_NORMAL               0
 #define BOOT_MODE_FACTORY2             1
 #define BOOT_MODE_RECOVERY             2