* spi devices
* author: cmc@rock-chips.com
*****************************************************************************************/
+
+#define BIT_EMAC_SPEED (1 << 10)
+static int rk29_vmac_speed_switch(int speed)
+{
+ printk("%s--speed=%d\n", __FUNCTION__, speed);
+ if (10 == speed) {
+ writel(readl(RK29_GRF_BASE + 0xbc) & (~BIT_EMAC_SPEED), RK29_GRF_BASE + 0xbc);
+ } else {
+ writel(readl(RK29_GRF_BASE + 0xbc) | BIT_EMAC_SPEED, RK29_GRF_BASE + 0xbc);
+ }
+}
+
static int rk29_vmac_register_set(void)
{
//config rk29 vmac as rmii, 100MHz
return 0;
}
+#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 {
+ writel_relaxed(readl_relaxed(RK30_GRF_BASE + GRF_SOC_CON1) | ( BIT_EMAC_SPEED), RK30_GRF_BASE + GRF_SOC_CON1);
+ }
+}
+
struct rk29_vmac_platform_data board_vmac_data = {
.vmac_register_set = rk30_vmac_register_set,
.rmii_io_init = rk30_rmii_io_init,
.rmii_io_deinit = rk30_rmii_io_deinit,
.rmii_power_control = rk30_rmii_power_control,
+ .rmii_speed_switch = rk29_vmac_speed_switch,
};
int (*rmii_io_init)(void);
int (*rmii_io_deinit)(void);
int (*rmii_power_control)(int enable);
+ int(*rmii_speed_switch)(int speed);
};
#define BOOT_MODE_NORMAL 0
struct phy_device *phydev = ap->phy_dev;\r
unsigned long flags;\r
int report_change = 0;\r
+ struct rk29_vmac_platform_data *pdata = ap->pdev->dev.platform_data;\r
\r
spin_lock_irqsave(&ap->lock, flags);\r
\r
report_change = 1;\r
}\r
\r
+ if (pdata && pdata->rmii_speed_switch)\r
+ pdata->rmii_speed_switch(phydev->speed);\r
+\r
if (phydev->link != ap->link) {\r
ap->link = phydev->link;\r
report_change = 1;\r
spin_lock_irqsave(&ap->lock, flags);\r
\r
promisc = !!(dev->flags & IFF_PROMISC);\r
- reg = vmac_readl(ap, ENABLE);\r
+ reg = vmac_readl(ap, CONTROL);\r
if (promisc != !!(reg & PROM_MASK)) {\r
reg ^= PROM_MASK;\r
- vmac_writel(ap, reg, ENABLE);\r
+ vmac_writel(ap, reg, CONTROL);\r
}\r
\r
if (dev->flags & IFF_ALLMULTI)\r