[coreboot-gerrit] New patch to review for coreboot: 545b6db Enable Azalia support for M4A785T-M

Denis Carikli (GNUtoo@no-log.org) gerrit at coreboot.org
Thu May 23 13:08:15 CEST 2013


Denis Carikli (GNUtoo at no-log.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3042

-gerrit

commit 545b6db5208bb4de3e8eabffff347a9f2c411e14
Author: Denis 'GNUtoo' Carikli <GNUtoo at no-log.org>
Date:   Mon Apr 8 19:31:09 2013 +0200

    Enable Azalia support for M4A785T-M
    
    Note that /sys/class/sound/hwC0D0/init_pin_configs isn't changed yet,
      for an unknown reason.
    
    Note that the linux kernel sometimes crashes at boot like that:
    [   18.007292] Kernel panic - not syncing: Fatal exception in interrupt
    [   18.013706] ------------[ cut here ]------------
    [   18.018363] WARNING: at arch/x86/kernel/smp.c:123 native_smp_send_reschedule+0x4b/0x50()
    [   18.026480] Hardware name: M4A785T-M
    [   18.030099] Modules linked in: snd_hda_intel(+) agpgart snd_hda_codec snd_hwdep i2c_algo_bit psmouse acpi_cpufreq
    mperf r8169 sp5100_tco k10temp evdev i2c_piix4 pcspkr snd_pcm serio_raw shpchp mii fan i2c_core kvm_amd
    snd_page_alloc kvm snd_timer snd pci_hotplug processor button thermal soundcore microcode nfs lockd sunrpc fscache
    ext4 crc16 jbd2 mbcache sha256_generic cbc dm_crypt dm_mod hid_generic usbhid hid sr_mod cdrom sd_mod ata_generic
    pata_acpi ahci pata_atiixp libahci ehci_pci ohci_hcd ehci_hcd libata usbcore usb_common scsi_mod
    [   18.081300] Pid: 0, comm: swapper/1 Tainted: G      D      3.8.5-1-LIBRE-PAE #1
    [   18.088642] Call Trace:
    [   18.091140]  [<c103bf52>] warn_slowpath_common+0x72/0xa0
    [   18.096494]  [<c1024bdb>] ? native_smp_send_reschedule+0x4b/0x50
    [   18.102537]  [<c1024bdb>] ? native_smp_send_reschedule+0x4b/0x50
    [   18.108580]  [<c103bfa2>] warn_slowpath_null+0x22/0x30
    [   18.113761]  [<c1024bdb>] native_smp_send_reschedule+0x4b/0x50
    [   18.119633]  [<c1078996>] trigger_load_balance+0x166/0x200
    [   18.125159]  [<c106c6b9>] scheduler_tick+0xd9/0x100
    [   18.130078]  [<c104bf9a>] update_process_times+0x5a/0x70
    [   18.135432]  [<c1093f3d>] tick_sched_handle.isra.10+0x2d/0x70
    [   18.141213]  [<c1094060>] tick_sched_timer+0x40/0x70
    [   18.146213]  [<c1060320>] ? __remove_hrtimer+0x40/0xa0
    [   18.151392]  [<c10603ef>] __run_hrtimer+0x6f/0x200
    [   18.156219]  [<c1094020>] ? tick_nohz_handler+0xa0/0xa0
    [   18.161485]  [<c1061177>] hrtimer_interrupt+0xe7/0x270
    [   18.166665]  [<c106259a>] ? up+0x2a/0x40
    [   18.170632]  [<c1414869>] smp_apic_timer_interrupt+0x59/0x8d
    [   18.176326]  [<c140e0d4>] apic_timer_interrupt+0x34/0x3c
    [   18.181681]  [<c1406da5>] ? panic+0x144/0x181
    [   18.186081]  [<c140eb55>] oops_end+0xc5/0xd0
    [   18.190390]  [<c1406805>] no_context+0x1bf/0x1c7
    [   18.195053]  [<c1024bca>] ? native_smp_send_reschedule+0x3a/0x50
    [   18.201097]  [<c1406b20>] __bad_area_nosemaphore+0x134/0x13c
    [   18.206796]  [<c106b4c8>] ? ttwu_do_wakeup+0x28/0x140
    [   18.211887]  [<c10681e6>] ? ttwu_stat+0x76/0x100
    [   18.216540]  [<c1410d80>] ? __do_page_fault+0x540/0x540
    [   18.221798]  [<c1406b3f>] bad_area_nosemaphore+0x17/0x19
    [   18.227150]  [<c1410ba5>] __do_page_fault+0x365/0x540
    [   18.232249]  [<f88265e9>] ? ata_scsi_qc_complete+0x59/0x3c0 [libata]
    [   18.238635]  [<c1065215>] ? __wake_up_common+0x45/0x70
    [   18.243813]  [<c1410d80>] ? __do_page_fault+0x540/0x540
    [   18.249080]  [<c1410d8d>] do_page_fault+0xd/0x10
    [   18.253733]  [<c140e33b>] error_code+0x67/0x6c
    [   18.258219]  [<f93e557b>] ? snd_hda_queue_unsol_event+0x1b/0xc0 [snd_hda_codec]
    [   18.265575]  [<f94e0880>] azx_update_rirb+0xb0/0x100 [snd_hda_intel]
    [   18.271958]  [<c12ef4c1>] ? i8042_interrupt+0x181/0x360
    [   18.277217]  [<c12c595d>] ? add_interrupt_randomness+0x12d/0x150
    [   18.283265]  [<f94e2847>] azx_interrupt+0xc7/0x190 [snd_hda_intel]
    [   18.289478]  [<c10b7fac>] handle_irq_event_percpu+0x4c/0x220
    [   18.295174]  [<c10b81ba>] handle_irq_event+0x3a/0x60
    [   18.300181]  [<c10bac20>] ? unmask_irq+0x30/0x30
    [   18.304833]  [<c10bac6e>] handle_fasteoi_irq+0x4e/0xd0
    [   18.310002]  <IRQ>  [<c1414792>] ? do_IRQ+0x42/0xc0
    [   18.315021]  [<c10441ac>] ? irq_exit+0x5c/0xa0
    [   18.319505]  [<c1414673>] ? common_interrupt+0x33/0x38
    [   18.324685]  [<c102e725>] ? native_safe_halt+0x5/0x10
    [   18.329779]  [<c100a496>] ? default_idle+0x46/0x210
    [   18.334697]  [<c100b356>] ? cpu_idle+0xb6/0x100
    [   18.339266]  [<c140258f>] ? start_secondary+0x27f/0x284
    [   18.344528] ---[ end trace 508707ff0c539fc6 ]---
    
    Change-Id: Ibfdeb5c3afdf35870e9adaa0a01729bb0e27465d
    Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at no-log.org>
---
 src/mainboard/asus/m4a785-m/hda.h       | 38 +++++++++++++++++++++++++++++++++
 src/mainboard/asus/m4a785-m/mainboard.c | 31 +++++++++++++++++++++++++++
 2 files changed, 69 insertions(+)

diff --git a/src/mainboard/asus/m4a785-m/hda.h b/src/mainboard/asus/m4a785-m/hda.h
new file mode 100644
index 0000000..235f8ba
--- /dev/null
+++ b/src/mainboard/asus/m4a785-m/hda.h
@@ -0,0 +1,38 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2011 Denis 'GNUtoo' Carikli <GNUtoo at no-log.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef M4A785T_M_HDA_H
+#define M4A785T_M_HDA_H
+static CODECENTRY m4a785t_m_codec_vt1708s[] = /* VIA VT1708S */
+{
+	{0x19, 0x01011012},
+	{0x1a, 0x01a19036},
+	{0x1b, 0x0181303e},
+	{0x1c, 0x01014010},
+	{0x1d, 0x0221401f},
+	{0x1e, 0x02a19038},
+	{0x1f, 0x503701f7},
+	{0x20, 0x074311f0},
+	{0x21, 0x074521f0},
+	{0x22, 0x01016011},
+	{0x23, 0x01012014},
+	{0xff, 0xffffffff} /* end of table */
+};
+#endif
diff --git a/src/mainboard/asus/m4a785-m/mainboard.c b/src/mainboard/asus/m4a785-m/mainboard.c
index b1154ab..6c893c7 100644
--- a/src/mainboard/asus/m4a785-m/mainboard.c
+++ b/src/mainboard/asus/m4a785-m/mainboard.c
@@ -25,7 +25,11 @@
 #include <cpu/amd/mtrr.h>
 #include <device/pci_def.h>
 #include "southbridge/amd/sb700/sb700.h"
+#include "southbridge/amd/sb700/hda.h"
 #include "southbridge/amd/sb700/smbus.h"
+#if CONFIG_BOARD_ASUS_M4A785TM
+#include "hda.h"
+#endif
 
 #define ADT7461_ADDRESS 0x4C
 #define ARA_ADDRESS     0x0C /* Alert Response Address */
@@ -186,6 +190,30 @@ static void set_thermal_config(void)
 	 */
 }
 
+#if CONFIG_BOARD_ASUS_M4A785TM
+static void audio_setup(void)
+{
+	struct device *dev;
+	u8 dbPinRouting, dbChannelNum=0;
+	u32 bar0 = 0;
+
+	printk(BIOS_INFO, "Configuring Azalia\n");
+
+	/* find BAR 0 */
+	dev = dev_find_slot(0, PCI_DEVFN(0x14, 2));
+	bar0 = dev->resource_list[0].base;
+
+	dbPinRouting = pci_read_config8(dev_find_slot(0, PCI_DEVFN(0x14, 0)), 0xfc /* SB_SMBUS_REGFC */ );
+	do {
+		if ( ( !(dbPinRouting & 0x1 /* BIT0 */) ) && (dbPinRouting & 0x2 /* BIT1 */ ) )
+			azalia_set_config(m4a785t_m_codec_vt1708s, dbChannelNum, bar0);
+			dbPinRouting >>= 2;
+			dbChannelNum++;
+	} while (dbChannelNum != 4);
+	printk(BIOS_INFO, "Configuring Azalia DONE...\n");
+}
+#endif
+
 /*************************************************
 * enable the dedicated function in this board.
 * This function called early than rs780_enable.
@@ -197,6 +225,9 @@ static void mainboard_enable(device_t dev)
 	set_pcie_dereset();
 	/* get_ide_dma66(); */
 	set_thermal_config();
+#if CONFIG_BOARD_ASUS_M4A785TM
+	audio_setup();
+#endif
 }
 
 struct chip_operations mainboard_ops = {



More information about the coreboot-gerrit mailing list