Re: [PATCH 1/3] MIPS: Alchemy: db1200: improve PB1200 detection.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 17, 2011 at 12:48 PM, Sergei Shtylyov <sshtylyov@xxxxxxxxxx> wrote:
> Hello.

>> diff --git a/arch/mips/alchemy/devboards/db1200.c
>> b/arch/mips/alchemy/devboards/db1200.c
>> index 1181241..6721991 100644
>> --- a/arch/mips/alchemy/devboards/db1200.c
>> +++ b/arch/mips/alchemy/devboards/db1200.c
>> @@ -66,19 +66,33 @@ static int __init detect_board(void)
>>  {
>>        int bid;
>>
>> -       /* try the PB1200 first */
>> +       /* try the DB1200 first */
>> +       bcsr_init(DB1200_BCSR_PHYS_ADDR,
>> +                 DB1200_BCSR_PHYS_ADDR + DB1200_BCSR_HEXLED_OFS);
>> +       if (BCSR_WHOAMI_DB1200 ==
>> BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI))) {
>> +               unsigned short t = bcsr_read(BCSR_HEXLEDS);
>> +               bcsr_write(BCSR_HEXLEDS, ~t);
>> +               if (bcsr_read(BCSR_HEXLEDS) != t) {
>> +                       bcsr_write(BCSR_HEXLEDS, t);
>> +                       return 0;
>> +               }
>> +       }
>> +
>> +       /* okay, try the PB1200 then */
>>        bcsr_init(PB1200_BCSR_PHYS_ADDR,
>>                  PB1200_BCSR_PHYS_ADDR + PB1200_BCSR_HEXLED_OFS);
>>        bid = BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI));
>>        if ((bid == BCSR_WHOAMI_PB1200_DDR1) ||
>> -           (bid == BCSR_WHOAMI_PB1200_DDR2))
>> -               return 0;
>> +           (bid == BCSR_WHOAMI_PB1200_DDR2)) {
>> +               unsigned short t = bcsr_read(BCSR_HEXLEDS);
>> +               bcsr_write(BCSR_HEXLEDS, ~t);
>> +               if (bcsr_read(BCSR_HEXLEDS) != t) {
>> +                       bcsr_write(BCSR_HEXLEDS, t);
>> +                       return 0;
>> +               }
>
>   Isn't it worth putting the repetitive code into a subroutine?

If another Au1200-based reference board with similar hw design crops
up, maybe.   The lines saved now however seemed not worth the effort.

Manuel



[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux