printk_foo -> printk(BIOS_FOO, ...)
[coreboot.git] / src / southbridge / amd / sb600 / sb600_hda.c
index 4c17c04bbbc4f9e86b273a559a63fe77041347a9..3ba1fe910ec90c6998e1ca700ae56522b3c78841 100644 (file)
 #define   HDA_ICII_BUSY (1 << 0)
 #define   HDA_ICII_VALID  (1 << 1)
 
-static int set_bits(u8 * port, u32 mask, u32 val)
+static int set_bits(u32 port, u32 mask, u32 val)
 {
        u32 dword;
        int count;
 
        /* Write (val & ~mask) to port */
        val &= mask;
-       dword = readl(port);
+       dword = read32(port);
        dword &= ~mask;
        dword |= val;
-       writel(dword, port);
+       write32(port, dword);
 
        /* Wait for readback of register to
         * match what was just written to it
@@ -49,7 +49,7 @@ static int set_bits(u8 * port, u32 mask, u32 val)
        do {
                /* Wait 1ms based on BKDG wait time */
                mdelay(1);
-               dword = readl(port);
+               dword = read32(port);
                dword &= mask;
        } while ((dword != val) && --count);
 
@@ -59,7 +59,7 @@ static int set_bits(u8 * port, u32 mask, u32 val)
        return 0;
 }
 
-static u32 codec_detect(u8 * base)
+static u32 codec_detect(u32 base)
 {
        u32 dword;
 
@@ -75,7 +75,7 @@ static u32 codec_detect(u8 * base)
        mdelay(1);
 
        /* Read in Codec location (BAR + 0xe)[3..0]*/
-       dword = readl(base + 0xe);
+       dword = read32(base + 0xe);
        dword &= 0x0F;
        if (!dword)
                goto no_codec;
@@ -86,7 +86,7 @@ no_codec:
        /* Codec Not found */
        /* Put HDA back in reset (BAR + 0x8) [0] */
        set_bits(base + 0x08, 1, 0);
-       printk_debug("No codec!\n");
+       printk(BIOS_DEBUG, "No codec!\n");
        return 0;
 }
 
@@ -156,9 +156,9 @@ static u32 find_verb(u32 viddid, u32 ** verb)
        device_t azalia_dev = dev_find_slot(0, PCI_DEVFN(0x14, 2));
        struct southbridge_amd_sb600_config *cfg =
            (struct southbridge_amd_sb600_config *)azalia_dev->chip_info;
-       printk_debug("Dev=%s\n", dev_path(azalia_dev));
-       printk_debug("Default viddid=%x\n", cfg->hda_viddid);
-       printk_debug("Reading viddid=%x\n", viddid);
+       printk(BIOS_DEBUG, "Dev=%s\n", dev_path(azalia_dev));
+       printk(BIOS_DEBUG, "Default viddid=%x\n", cfg->hda_viddid);
+       printk(BIOS_DEBUG, "Reading viddid=%x\n", viddid);
        if (!cfg)
                return 0;
        if (viddid != cfg->hda_viddid)
@@ -172,7 +172,7 @@ static u32 find_verb(u32 viddid, u32 ** verb)
  *  no response would imply that the codec is non-operative
  */
 
-static int wait_for_ready(u8 *base)
+static int wait_for_ready(u32 base)
 {
        /* Use a 50 usec timeout - the Linux kernel uses the
         * same duration */
@@ -180,7 +180,7 @@ static int wait_for_ready(u8 *base)
        int timeout = 50;
 
        while(timeout--) {
-               u32 dword=readl(base +  HDA_ICII_REG);
+               u32 dword=read32(base +  HDA_ICII_REG);
                if (!(dword & HDA_ICII_BUSY))
                        return 0;
                udelay(1);
@@ -195,14 +195,14 @@ static int wait_for_ready(u8 *base)
  *  is non-operative
  */
 
-static int wait_for_valid(u8 *base)
+static int wait_for_valid(u32 base)
 {
        /* Use a 50 usec timeout - the Linux kernel uses the
         * same duration */
 
        int timeout = 50;
        while(timeout--) {
-               u32 dword = readl(base + HDA_ICII_REG);
+               u32 dword = read32(base + HDA_ICII_REG);
                if ((dword & (HDA_ICII_VALID | HDA_ICII_BUSY)) ==
                        HDA_ICII_VALID)
                        return 0;
@@ -212,7 +212,7 @@ static int wait_for_valid(u8 *base)
        return 1;
 }
 
-static void codec_init(u8 * base, int addr)
+static void codec_init(u32 base, int addr)
 {
        u32 dword;
        u32 *verb;
@@ -224,37 +224,37 @@ static void codec_init(u8 * base, int addr)
                return;
 
        dword = (addr << 28) | 0x000f0000;
-       writel(dword, base + 0x60);
+       write32(base + 0x60, dword);
 
        if (wait_for_valid(base) == -1)
                return;
 
-       dword = readl(base + 0x64);
+       dword = read32(base + 0x64);
 
        /* 2 */
-       printk_debug("codec viddid: %08x\n", dword);
+       printk(BIOS_DEBUG, "codec viddid: %08x\n", dword);
        verb_size = find_verb(dword, &verb);
 
        if (!verb_size) {
-               printk_debug("No verb!\n");
+               printk(BIOS_DEBUG, "No verb!\n");
                return;
        }
 
-       printk_debug("verb_size: %d\n", verb_size);
+       printk(BIOS_DEBUG, "verb_size: %d\n", verb_size);
        /* 3 */
        for (i = 0; i < verb_size; i++) {
                if (wait_for_ready(base) == -1)
                        return;
 
-               writel(verb[i], base + 0x60);
+               write32(base + 0x60, verb[i]);
 
                if (wait_for_valid(base) == -1)
                        return;
        }
-       printk_debug("verb loaded!\n");
+       printk(BIOS_DEBUG, "verb loaded!\n");
 }
 
-static void codecs_init(u8 * base, u32 codec_mask)
+static void codecs_init(u32 base, u32 codec_mask)
 {
        int i;
        for (i = 2; i >= 0; i--) {
@@ -267,7 +267,7 @@ static void hda_init(struct device *dev)
 {
        u8 byte;
        u32 dword;
-       u8 *base;
+       u32 base;
        struct resource *res;
        u32 codec_mask;
        device_t sm_dev;
@@ -301,12 +301,12 @@ static void hda_init(struct device *dev)
        if (!res)
                return;
 
-       base = (u8 *) ((u32)res->base);
-       printk_debug("base = %p\n", base);
+       base = ((u32)res->base);
+       printk(BIOS_DEBUG, "base = 0x%x\n", base);
        codec_mask = codec_detect(base);
 
        if (codec_mask) {
-               printk_debug("codec_mask = %02x\n", codec_mask);
+               printk(BIOS_DEBUG, "codec_mask = %02x\n", codec_mask);
                codecs_init(base, codec_mask);
        }
 }
@@ -325,7 +325,7 @@ static struct device_operations hda_audio_ops = {
        .ops_pci = &lops_pci,
 };
 
-static struct pci_driver hdaaudio_driver __pci_driver = {
+static const struct pci_driver hdaaudio_driver __pci_driver = {
        .ops = &hda_audio_ops,
        .vendor = PCI_VENDOR_ID_ATI,
        .device = PCI_DEVICE_ID_ATI_SB600_HDA,