fixup-ddb5477.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. *
  3. * BRIEF MODULE DESCRIPTION
  4. * Board specific pci fixups.
  5. *
  6. * Copyright 2001, 2002, 2003 MontaVista Software Inc.
  7. * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU General Public License as published by the
  11. * Free Software Foundation; either version 2 of the License, or (at your
  12. * option) any later version.
  13. *
  14. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  15. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  16. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
  17. * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  18. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  19. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  20. * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  21. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  23. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. *
  25. * You should have received a copy of the GNU General Public License along
  26. * with this program; if not, write to the Free Software Foundation, Inc.,
  27. * 675 Mass Ave, Cambridge, MA 02139, USA.
  28. */
  29. #include <linux/types.h>
  30. #include <linux/pci.h>
  31. #include <linux/kernel.h>
  32. #include <linux/init.h>
  33. static void ddb5477_fixup(struct pci_dev *dev)
  34. {
  35. u8 old;
  36. printk(KERN_NOTICE "Enabling ALI M1533/35 PS2 keyboard/mouse.\n");
  37. pci_read_config_byte(dev, 0x41, &old);
  38. pci_write_config_byte(dev, 0x41, old | 0xd0);
  39. }
  40. DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533,
  41. ddb5477_fixup);
  42. DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1535,
  43. ddb5477_fixup);
  44. /*
  45. * Fixup baseboard AMD chip so that tx does not underflow.
  46. * bcr_18 |= 0x0800
  47. * This sets NOUFLO bit which makes tx not start until whole pkt
  48. * is fetched to the chip.
  49. */
  50. #define PCNET32_WIO_RDP 0x10
  51. #define PCNET32_WIO_RAP 0x12
  52. #define PCNET32_WIO_RESET 0x14
  53. #define PCNET32_WIO_BDP 0x16
  54. static void ddb5477_amd_lance_fixup(struct pci_dev *dev)
  55. {
  56. unsigned long ioaddr;
  57. u16 temp;
  58. ioaddr = pci_resource_start(dev, 0);
  59. inw(ioaddr + PCNET32_WIO_RESET); /* reset chip */
  60. /* bcr_18 |= 0x0800 */
  61. outw(18, ioaddr + PCNET32_WIO_RAP);
  62. temp = inw(ioaddr + PCNET32_WIO_BDP);
  63. temp |= 0x0800;
  64. outw(18, ioaddr + PCNET32_WIO_RAP);
  65. outw(temp, ioaddr + PCNET32_WIO_BDP);
  66. }
  67. DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_LANCE,
  68. ddb5477_amd_lance_fixup);