From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Warren Date: Mon, 09 Apr 2012 15:09:39 -0600 Subject: [U-Boot] [PATCH v3 10/23] tegra: Add tegra_get_chip_type() to detect SKU In-Reply-To: <1333408743-28720-11-git-send-email-sjg@chromium.org> References: <1333408743-28720-1-git-send-email-sjg@chromium.org> <1333408743-28720-11-git-send-email-sjg@chromium.org> Message-ID: <4F835013.4020109@wwwdotorg.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 04/02/2012 05:18 PM, Simon Glass wrote: > We want to know which type of chip we are running on - the Tegra > family has several SKUs. This can be determined by reading a > fuse register, so add this function to ap20. > > Signed-off-by: Simon Glass > Acked-by: Stephen Warren > --- > Changes in v2: > - Add check of undocumented values in hidrev register > diff --git a/arch/arm/cpu/armv7/tegra2/ap20.c b/arch/arm/cpu/armv7/tegra2/ap20.c > +int tegra_get_chip_type(void) > +{ > + struct apb_misc_gp_ctlr *gp; > + struct fuse_regs *fuse = (struct fuse_regs *)TEGRA2_FUSE_BASE; > + uint tegra_sku_id, rev; > + > + /* > + * This is undocumented, Chip ID is bits 15:8 of the register > + * APB_MISC + 0x804, and has value 0x20 for Tegra20, 0x30 for > + * Tegra30 > + */ > + gp = (struct apb_misc_gp_ctlr *)TEGRA2_APB_MISC_GP_BASE; > + rev = (readl(&gp->hidrev) & HIDREV_CHIPID_MASK) >> HIDREV_CHIPID_SHIFT; That's not entirely true; the register and its fields are documented in the TRM. The values of the CHIPID field itself are indeed not documented.