From: wuhao Date: Wed, 3 Apr 2013 04:52:58 +0000 (+0800) Subject: rk3188 sdk: add ethernet X-Git-Tag: firefly_0821_release~7298 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=aa275aaeb9c880d27f6492e4107998ebce6022df;p=firefly-linux-kernel-4.4.55.git rk3188 sdk: add ethernet --- diff --git a/arch/arm/mach-rk3188/board-rk3188-sdk-vmac.c b/arch/arm/mach-rk3188/board-rk3188-sdk-vmac.c index 8e33b363f1f2..18bd9589dfe7 100644 --- a/arch/arm/mach-rk3188/board-rk3188-sdk-vmac.c +++ b/arch/arm/mach-rk3188/board-rk3188-sdk-vmac.c @@ -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 { diff --git a/arch/arm/mach-rk3188/board-rk3188-sdk.c b/arch/arm/mach-rk3188/board-rk3188-sdk.c index d5ee0e0c7427..82d5087446ba 100644 --- a/arch/arm/mach-rk3188/board-rk3188-sdk.c +++ b/arch/arm/mach-rk3188/board-rk3188-sdk.c @@ -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