On 11/18/2009 06:15 PM, Larry Finger wrote:
> On 11/18/2009 08:34 AM, Oncaphillis wrote:
>    
>> The first ioread16 actually succeeds, only the second one fails.
>> My lspci -vnn tells me that the memory is:
>>
>> Memory at 57100000 (64-bit, non-prefetchable) [size=16K]
>>
>> Could it be that one has to make a ioread32 here since the
>> memory is 64-bit ? I remember very very remotely that
>> in older days it was impossible or even forbidden to read
>> data from addresses which are not a multiple of 2/4/8 what
>> so ever. But that was pre-PCI.
>>      
> As long as a 16-bit read is aligned on an even address, it should be OK;
> however, to check completely, please try this patch:
>
> Index: wireless-testing/drivers/ssb/pci.c
> ===================================================================
> --- wireless-testing.orig/drivers/ssb/pci.c
> +++ wireless-testing/drivers/ssb/pci.c
> @@ -251,10 +251,16 @@ static int sprom_check_crc(const u16 *sp
>   static int sprom_do_read(struct ssb_bus *bus, u16 *sprom)
>   {
>       int i;
> +     u32 buf;
>
> -     for (i = 0; i<  bus->sprom_size; i++)
> -             sprom[i] = ioread16(bus->mmio + SSB_SPROM_BASE + (i * 2));
> -
> +     printk(KERN_INFO "ssb: Entering %s\n", __func__);
> +     for (i = 0; i<  bus->sprom_size; i = i + 2) {
> +             buf = ioread32(bus->mmio + SSB_SPROM_BASE + (i * 2));
> +             printk(KERN_INFO "ssb: Read 0x%.8X from SPROM\n", buf);
> +             sprom[i] = buf&  0x0000FFFF;
> +             sprom[i+1] = (buf>>  16)&  0x0000FFFF;
> +     }
> +     printk(KERN_INFO "ssb: Leaving %s\n", __func__);
>       return 0;
>   }
>
>
>    
I already tried something similar. Unfortunately I can not report in detail
  right now since I've once again killed my kernel and my acer stands at 
home.
  I'll give more details in a couple of hours -- but the punch line is:

  (1) if I transform the series of ioread16 into a series of ioread32 
the loop
      runs through giving me a CRC error afterwards.
  (2) I tried to compensate for different endianess by doing this:

      u32 *my_buff = (u32 *)spromm;
      u32 dw;

        for (i = 0; i<  bus->sprom_size/2; i = i++) {
                dw = ioread32(bus->mmio + SSB_SPROM_BASE + (i * 4));
                 my_buff[i] = (dw<<  16) | (dw>>  16);
        }

      Is there something fishy in that approach ? I'm really not a
      hardware hacker. Still get a CRC error.

  (3) My next approach was to do a initial ioread16 on the index 0. And
      do the given loop afterwards including an output of read double words.
      But it seems under these conditions the ioread32 fails too, since I
      can't reach my laptop anymore.

  Sebastian




> Larry
>
>    

_______________________________________________
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev

Reply via email to