sbawe: fix memory detection part 2

The patch "sbawe: fix memory detection" fixed detection
for memoryless SB32 cards but broke detection of memory
above 512KB. This patch fixes the regression.

The patch has been tested on the SB32 card (CT3670) with
0MB, 2MB and 8MB memory installed.

Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>

authored by Krzysztof Helt and committed by Jaroslav Kysela edf12b4a 1cb4f624

+7 -4
+7 -4
sound/isa/sb/emu8000.c
··· 377 static void __devinit 378 size_dram(struct snd_emu8000 *emu) 379 { 380 - int i, size; 381 382 if (emu->dram_checked) 383 return; 384 385 size = 0; 386 387 /* write out a magic number */ 388 snd_emu8000_dma_chan(emu, 0, EMU8000_RAM_WRITE); ··· 393 snd_emu8000_init_fm(emu); /* This must really be here and not 2 lines back even */ 394 395 while (size < EMU8000_MAX_DRAM) { 396 397 /* Write a unique data on the test address. 398 * if the address is out of range, the data is written on ··· 417 if (EMU8000_SMLD_READ(emu) != UNIQUE_ID2) 418 break; /* no memory at this address */ 419 420 - size += 512 * 1024; /* increment 512kbytes */ 421 422 snd_emu8000_read_wait(emu); 423 ··· 445 snd_emu8000_dma_chan(emu, 1, EMU8000_RAM_CLOSE); 446 447 snd_printdd("EMU8000 [0x%lx]: %d Kb on-board memory detected\n", 448 - emu->port1, size/1024); 449 450 - emu->mem_size = size; 451 emu->dram_checked = 1; 452 } 453
··· 377 static void __devinit 378 size_dram(struct snd_emu8000 *emu) 379 { 380 + int i, size, detected_size; 381 382 if (emu->dram_checked) 383 return; 384 385 size = 0; 386 + detected_size = 0; 387 388 /* write out a magic number */ 389 snd_emu8000_dma_chan(emu, 0, EMU8000_RAM_WRITE); ··· 392 snd_emu8000_init_fm(emu); /* This must really be here and not 2 lines back even */ 393 394 while (size < EMU8000_MAX_DRAM) { 395 + 396 + size += 512 * 1024; /* increment 512kbytes */ 397 398 /* Write a unique data on the test address. 399 * if the address is out of range, the data is written on ··· 414 if (EMU8000_SMLD_READ(emu) != UNIQUE_ID2) 415 break; /* no memory at this address */ 416 417 + detected_size = size; 418 419 snd_emu8000_read_wait(emu); 420 ··· 442 snd_emu8000_dma_chan(emu, 1, EMU8000_RAM_CLOSE); 443 444 snd_printdd("EMU8000 [0x%lx]: %d Kb on-board memory detected\n", 445 + emu->port1, detected_size/1024); 446 447 + emu->mem_size = detected_size; 448 emu->dram_checked = 1; 449 } 450