rk3188 sdk: add ethernet
authorwuhao <wuhao@wuhao@rock-chips.com>
Wed, 3 Apr 2013 04:52:58 +0000 (12:52 +0800)
committerwuhao <wuhao@wuhao@rock-chips.com>
Wed, 3 Apr 2013 04:52:58 +0000 (12:52 +0800)
arch/arm/mach-rk3188/board-rk3188-sdk-vmac.c
arch/arm/mach-rk3188/board-rk3188-sdk.c

index 8e33b363f1f2b9e56d54e07435915d576a1bc57a..18bd9589dfe71cb93b78d373c17d843f833eca9c 100644 (file)
@@ -1,3 +1,6 @@
+#define grf_readl(offset)      readl_relaxed(RK30_GRF_BASE + offset)
+#define grf_writel(v, offset)  do { writel_relaxed(v, RK30_GRF_BASE + offset); dsb(); } while (0)
+
 static int rk30_vmac_register_set(void)
 {
        //config rk30 vmac as rmii
@@ -8,6 +11,7 @@ static int rk30_vmac_register_set(void)
 static int rk30_rmii_io_init(void)
 {
        int err;
+       printk("enter %s ",__func__);
        iomux_set(GPIO0_C0);//power pwr
        iomux_set(GPIO3_D2);//int
        
@@ -23,6 +27,9 @@ static int rk30_rmii_io_init(void)
        iomux_set(RMII_TXEN);
        iomux_set(RMII_CLKOUT);
 
+       //rk3188 gpio3 and sdio drive strength , 
+      grf_writel(0x0f<16|0x0f,GRF_IO_CON3);
+      
        //phy power gpio
        err = gpio_request(PHY_PWR_EN_GPIO, "phy_power_en");
        if (err) {
@@ -32,12 +39,14 @@ static int rk30_rmii_io_init(void)
        //phy power down
        gpio_direction_output(PHY_PWR_EN_GPIO, !PHY_PWR_EN_VALUE);
        gpio_set_value(PHY_PWR_EN_GPIO, !PHY_PWR_EN_VALUE);
+
        return 0;
 }
 
 static int rk30_rmii_io_deinit(void)
 {
        //phy power down
+       printk("enter %s ",__func__);
        gpio_direction_output(PHY_PWR_EN_GPIO, !PHY_PWR_EN_VALUE);
        gpio_set_value(PHY_PWR_EN_GPIO, !PHY_PWR_EN_VALUE);
        //free
@@ -47,6 +56,7 @@ static int rk30_rmii_io_deinit(void)
 
 static int rk30_rmii_power_control(int enable)
 {
+      printk("enter %s ,enable = %d ",__func__,enable);
        if (enable) {
                //enable phy power
                printk("power on phy\n");
@@ -67,6 +77,8 @@ static int rk30_rmii_power_control(int enable)
        
                gpio_direction_output(PHY_PWR_EN_GPIO, PHY_PWR_EN_VALUE);
                gpio_set_value(PHY_PWR_EN_GPIO, PHY_PWR_EN_VALUE);
+
+               //gpio reset            
        }else {
                gpio_direction_output(PHY_PWR_EN_GPIO, !PHY_PWR_EN_VALUE);
                gpio_set_value(PHY_PWR_EN_GPIO, !PHY_PWR_EN_VALUE);
@@ -77,7 +89,6 @@ static int rk30_rmii_power_control(int enable)
 #define BIT_EMAC_SPEED      (1 << 1)
 static int rk29_vmac_speed_switch(int speed)
 {
-       printk("%s--speed=%d\n", __FUNCTION__, speed);
        if (10 == speed) {
            writel_relaxed(readl_relaxed(RK30_GRF_BASE + GRF_SOC_CON1) & (~BIT_EMAC_SPEED), RK30_GRF_BASE + GRF_SOC_CON1);
        } else {
index d5ee0e0c7427375bf0698dbc7033fae9da985b87..82d5087446ba74eb07bfd1c39d816f263d206098 100644 (file)
@@ -1173,8 +1173,10 @@ struct platform_device pwm_regulator_device[1] = {
 #endif
 
 #ifdef CONFIG_RK29_VMAC
-#define PHY_PWR_EN_GPIO        RK30_PIN1_PD6
+#define PHY_PWR_EN_GPIO        RK30_PIN0_PC0
+#define PHY_PWR_EN_VALUE   GPIO_HIGH
 #include "board-rk3188-sdk-vmac.c"
+
 #endif
 
 #ifdef CONFIG_RFKILL_RK