Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752645AbcDRQ7T (ORCPT ); Mon, 18 Apr 2016 12:59:19 -0400 Received: from mail-lf0-f48.google.com ([209.85.215.48]:32923 "EHLO mail-lf0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751548AbcDRQ7S (ORCPT ); Mon, 18 Apr 2016 12:59:18 -0400 Subject: Re: [PATCH] mips: pistachio: Determine SoC revision during boot To: James Hartley , Ralf Baechle , Andrew Bresticker , Jonas Gorski , James Hogan References: <1460989489-30469-1-git-send-email-james.hartley@imgtec.com> Cc: linux-mips@linux-mips.org, linux-kernel@vger.kernel.org, Ionela Voinescu From: Sergei Shtylyov Organization: Cogent Embedded Message-ID: <57151260.1060300@cogentembedded.com> Date: Mon, 18 Apr 2016 19:59:12 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: <1460989489-30469-1-git-send-email-james.hartley@imgtec.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1340 Lines: 49 Hello. On 04/18/2016 05:24 PM, James Hartley wrote: > Now that there are different revisions of the Pistachio SoC > in circulation, add this information to the boot log to make > it easier for users to determine which hardware they have. > > Signed-off-by: James Hartley > Signed-off-by: Ionela Voinescu > > diff --git a/arch/mips/pistachio/init.c b/arch/mips/pistachio/init.c > index 96ba2cc..48f8755 100644 > --- a/arch/mips/pistachio/init.c > +++ b/arch/mips/pistachio/init.c [...] > @@ -24,9 +26,28 @@ > #include > #include > > +/* > + * Core revision register decoding > + * Bits 23 to 20: Major rev > + * Bits 15 to 8: Minor rev > + * Bits 7 to 0: Maintenance rev > + */ > +#define PISTACHIO_CORE_REV_REG 0xB81483D0 > +#define PISTACHIO_CORE_REV_A1 0x00100006 > +#define PISTACHIO_CORE_REV_B0 0x00100106 > + > const char *get_system_type(void) > { > - return "IMG Pistachio SoC"; > + u32 core_rev; > + > + core_rev = __raw_readl((const void *)PISTACHIO_CORE_REV_REG); > + > + if (core_rev == PISTACHIO_CORE_REV_B0) > + return "IMG Pistachio SoC (B0)"; > + else if (core_rev == PISTACHIO_CORE_REV_A1) > + return "IMG_Pistachio SoC (A1)"; > + else > + return "IMG_Pistachio SoC"; How about the *switch* instead? [...] MBR, Sergei