コード例 #1
0
static int cpmac_mdio_reset(struct mii_bus *bus)
{
	ar7_device_reset(AR7_RESET_BIT_MDIO);
	cpmac_write(bus->priv, CPMAC_MDIO_CONTROL, MDIOC_ENABLE |
		    MDIOC_CLKDIV(ar7_cpmac_freq() / 2200000 - 1));
	return 0;
}
コード例 #2
0
ファイル: cpmac.c プロジェクト: 454053205/linux
static int cpmac_mdio_reset(struct mii_bus *bus)
{
	struct clk *cpmac_clk;

	cpmac_clk = clk_get(&bus->dev, "cpmac");
	if (IS_ERR(cpmac_clk)) {
		printk(KERN_ERR "unable to get cpmac clock\n");
		return -1;
	}
	ar7_device_reset(AR7_RESET_BIT_MDIO);
	cpmac_write(bus->priv, CPMAC_MDIO_CONTROL, MDIOC_ENABLE |
		    MDIOC_CLKDIV(clk_get_rate(cpmac_clk) / 2200000 - 1));
	return 0;
}
コード例 #3
0
ファイル: cpmac.bug2.absmin.c プロジェクト: thorstent/Liss
//static int cpmac_open(struct net_device *dev);
//
//static void cpmac_dump_regs(struct net_device *dev)
//{
//	int i;
//	struct cpmac_priv *priv = netdev_priv(dev);
//
//	for (i = 0; i < CPMAC_REG_END; i += 4) {
//		if (i % 16 == 0) {
//			if (i)
//				printk("\n");
//			printk("%s: reg[%p]:", dev->name, priv->regs + i);
//		}
//		printk(" %08x", cpmac_read(priv->regs, i));
//	}
//	printk("\n");
//}
//
//static void cpmac_dump_desc(struct net_device *dev, struct cpmac_desc *desc)
//{
//	int i;
//
//	printk("%s: desc[%p]:", dev->name, desc);
//	for (i = 0; i < sizeof(*desc) / 4; i++)
//		printk(" %08x", ((u32 *)desc)[i]);
//	printk("\n");
//}
//
//static void cpmac_dump_all_desc(struct net_device *dev)
//{
//	struct cpmac_priv *priv = netdev_priv(dev);
//	struct cpmac_desc *dump = priv->rx_head;
//
//	do {
//		cpmac_dump_desc(dev, dump);
//		dump = dump->next;
//	} while (dump != priv->rx_head);
//}
//
//static void cpmac_dump_skb(struct net_device *dev, struct sk_buff *skb)
//{
//	int i;
//
//	printk("%s: skb 0x%p, len=%d\n", dev->name, skb, skb->len);
//	for (i = 0; i < skb->len; i++) {
//		if (i % 16 == 0) {
//			if (i)
//				printk("\n");
//			printk("%s: data[%p]:", dev->name, skb->data + i);
//		}
//		printk(" %02x", ((u8 *)skb->data)[i]);
//	}
//	printk("\n");
//}
//
//static int cpmac_mdio_read(struct mii_bus *bus, int phy_id, int reg)
//{
//	u32 val;
//
//	while (cpmac_read(bus->priv, CPMAC_MDIO_ACCESS(0)) & MDIO_BUSY)
//		cpu_relax();
//	cpmac_write(bus->priv, CPMAC_MDIO_ACCESS(0), MDIO_BUSY | MDIO_REG(reg) |
//		    MDIO_PHY(phy_id));
//	while ((val = cpmac_read(bus->priv, CPMAC_MDIO_ACCESS(0))) & MDIO_BUSY)
//		cpu_relax();
//
//	return MDIO_DATA(val);
//}
//
//static int cpmac_mdio_write(struct mii_bus *bus, int phy_id,
//			    int reg, u16 val)
//{
//	while (cpmac_read(bus->priv, CPMAC_MDIO_ACCESS(0)) & MDIO_BUSY)
//		cpu_relax();
//	cpmac_write(bus->priv, CPMAC_MDIO_ACCESS(0), MDIO_BUSY | MDIO_WRITE |
//		    MDIO_REG(reg) | MDIO_PHY(phy_id) | MDIO_DATA(val));
//
//	return 0;
//}
//
static int cpmac_mdio_reset()
{
//	struct clk *cpmac_clk;

//	cpmac_clk = clk_get("cpmac");
//	if (IS_ERR(cpmac_clk)) {
//		pr_err("unable to get cpmac clock\n");
//		return -1;
//	}
	ar7_device_reset(AR7_RESET_BIT_MDIO);
	cpmac_write(CPMAC_MDIO_CONTROL, MDIOC_ENABLE |
		    MDIOC_CLKDIV(/*clk_get_rate(cpmac_clk)*/nondet / 2200000 - 1));

	return 0;
}