2 * (C) 2003 Linux Networx
4 #include <console/console.h>
5 #include <device/device.h>
6 #include <device/pci.h>
7 #include <device/pci_ids.h>
8 #include <device/pci_ops.h>
17 VAL3 = (1 << 31), /* VAL bit for byte 3 */
18 VAL2 = (1 << 23), /* VAL bit for byte 2 */
19 VAL1 = (1 << 15), /* VAL bit for byte 1 */
20 VAL0 = (1 << 7), /* VAL bit for byte 0 */
25 ASF_INIT_DONE_ALIAS = (1 << 29),
30 VL_TAG_DEL = (1 << 18),
34 FORCE_FULL_DUPLEX = (1 << 12),
35 FORCE_LINK_STATUS = (1 << 11),
39 RESET_PHY_PULSE = (1 << 2),
41 PHY_RST_POL = (1 << 0),
44 static void nic_init(struct device *dev)
46 struct southbridge_amd_amd8111_config *conf;
47 struct resource *resource;
50 conf = dev->chip_info;
51 resource = find_resource(dev, PCI_BASE_ADDRESS_0);
52 mmio = resource->base;
55 printk_debug("Reseting PHY... ");
56 if (conf->phy_lowreset) {
57 write32((mmio + CMD3), VAL0 | PHY_RST_POL | RESET_PHY);
59 write32((mmio + CMD3), VAL0 | RESET_PHY);
62 write32((mmio + CMD3), RESET_PHY);
63 printk_debug("Done\n");
66 static void lpci_set_subsystem(device_t dev, unsigned vendor, unsigned device)
68 pci_write_config32(dev, 0xc8,
69 ((device & 0xffff) << 16) | (vendor & 0xffff));
72 static struct pci_operations lops_pci = {
73 .set_subsystem = lpci_set_subsystem,
76 static struct device_operations nic_ops = {
77 .read_resources = pci_dev_read_resources,
78 .set_resources = pci_dev_set_resources,
79 .enable_resources = pci_dev_enable_resources,
82 .enable = amd8111_enable,
86 static const struct pci_driver nic_driver __pci_driver = {
88 .vendor = PCI_VENDOR_ID_AMD,
89 .device = PCI_DEVICE_ID_AMD_8111_NIC,