[coreboot] pc speaker and cs5536

Nikolay Petukhov nikolaypetukhov at gmail.com
Fri Mar 14 08:06:34 CET 2008


2008/3/13, Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>:
> Maybe call it from mainboard.c, but keep the function inside the cs5536
>  code.
>

Maybe then so.

diff -Nru coreboot-v2-3132/src/southbridge/amd/cs5536/chip.h
coreboot-v2-3132-beep/src/southbridge/amd/cs5536/chip.h
--- coreboot-v2-3132/src/southbridge/amd/cs5536/chip.h  2008-01-18
15:35:56.000000000 +0500
+++ coreboot-v2-3132-beep/src/southbridge/amd/cs5536/chip.h
2008-03-14 11:17:02.000000000 +0500
@@ -39,6 +39,7 @@
        unsigned char com2_enable;      /* enable COM2 */
        unsigned int com2_address;      /* e.g. 0x2F8 */
        unsigned int com2_irq;  /* e.g. 3 */
+       unsigned char speaker_enable;   /* enable speaker */
        unsigned int unwanted_vpci[MAX_UNWANTED_VPCI];  /* the
following allow you to disable unwanted virtualized PCI devices */

 };
diff -Nru coreboot-v2-3132/src/southbridge/amd/cs5536/cs5536.c
coreboot-v2-3132-beep/src/southbridge/amd/cs5536/cs5536.c
--- coreboot-v2-3132/src/southbridge/amd/cs5536/cs5536.c
2008-01-18 20:08:58.000000000 +0500
+++ coreboot-v2-3132-beep/src/southbridge/amd/cs5536/cs5536.c
2008-03-14 11:17:54.000000000 +0500
@@ -248,6 +248,26 @@
        isa_dma_init();
 }

+static void cs5536_enable_speaker(struct southbridge_amd_cs5536_config *sb)
+{
+       uint32_t gpio_addr;
+       device_t dev;
+
+       dev = dev_find_device(PCI_VENDOR_ID_AMD,
+                       PCI_DEVICE_ID_AMD_CS5536_ISA, 0);
+       gpio_addr = pci_read_config32(dev, PCI_BASE_ADDRESS_1);
+       gpio_addr &= ~1;        /* clear IO bit */
+
+       if (sb->speaker_enable) {
+
+               /* GPIO1 - BEEP */
+               /* Set: Output Enable  (0x4) */
+               outl(GPIOL_1_SET, gpio_addr + GPIOL_OUTPUT_ENABLE);
+               /* Set: OUTAUX1 Select (0x10) */
+               outl(GPIOL_1_SET, gpio_addr + GPIOL_OUT_AUX1_SELECT);
+       }
+}
+
 static void uarts_init(struct southbridge_amd_cs5536_config *sb)
 {
        msr_t msr;
@@ -580,6 +600,7 @@
        setup_i8259();
        lpc_init(sb);
        uarts_init(sb);
+       cs5536_enable_speaker(sb);

        if (sb->enable_gpio_int_route) {
                vrWrite((VRC_MISCELLANEOUS << 8) + PCI_INT_AB,

-- 
Nikolay




More information about the coreboot mailing list