From: Sergei Shtylyov <sshtylyov@mvista.com>
To: Manuel Lauss <manuel.lauss@googlemail.com>
Cc: Ralf Baechle <ralf@linux-mips.org>,
Linux-MIPS <linux-mips@linux-mips.org>
Subject: Re: [PATCH 1/3] MIPS: Alchemy: db1200: improve PB1200 detection.
Date: Thu, 17 Nov 2011 15:48:00 +0400 [thread overview]
Message-ID: <4EC4F470.4090605@mvista.com> (raw)
In-Reply-To: <1321458148-7894-1-git-send-email-manuel.lauss@googlemail.com>
Hello.
On 16-11-2011 19:42, Manuel Lauss wrote:
> The PB1200 has the CPLD located at an address which on the DB1200 is
> RAM; reading the Board-ID sometimes results in a PB1200 being detected
> instead (especially during reboots after long uptimes).
> On the other hand, the address of the DB1200's CPLD is hosting Flash
> chips on the PB1200. Test for the DB1200 first and additionally do a
> quick write-test to the hexleds register to make sure we're writing
> to the CPLD.
> Signed-off-by: Manuel Lauss<manuel.lauss@googlemail.com>
> ---
> Applies on top of the other patches queued for 3.3
> arch/mips/alchemy/devboards/db1200.c | 30 ++++++++++++++++++++++--------
> 1 files changed, 22 insertions(+), 8 deletions(-)
> 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?
WBR, Sergei
next prev parent reply other threads:[~2011-11-17 11:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-16 15:42 [PATCH 1/3] MIPS: Alchemy: db1200: improve PB1200 detection Manuel Lauss
2011-11-16 15:42 ` [PATCH 2/3] MIPS: Alchemy: update cpu-feature-overrides Manuel Lauss
2011-11-16 17:05 ` Ralf Baechle
2011-11-16 15:42 ` [PATCH 3/3] MIPS: Alchemy: fix PCI PM Manuel Lauss
2011-11-16 17:05 ` Ralf Baechle
2011-11-16 17:05 ` [PATCH 1/3] MIPS: Alchemy: db1200: improve PB1200 detection Ralf Baechle
2011-11-17 11:48 ` Sergei Shtylyov [this message]
2011-11-17 11:59 ` Manuel Lauss
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4EC4F470.4090605@mvista.com \
--to=sshtylyov@mvista.com \
--cc=linux-mips@linux-mips.org \
--cc=manuel.lauss@googlemail.com \
--cc=ralf@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.