From patchwork Fri Feb 23 21:09:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 10239861 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4788D60390 for ; Fri, 23 Feb 2018 21:14:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34117299C0 for ; Fri, 23 Feb 2018 21:14:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 27238299C4; Fri, 23 Feb 2018 21:14:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9C17A299C0 for ; Fri, 23 Feb 2018 21:14:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=pYBY7axqHFuk0ILethQ4B7wvWCtoziJWpM7NsDJ5lLQ=; b=NO6Dzt2JmMUiIGwHLy5LqzMlaQ 0biTDiy9x8WbSlrxEKTqnIC7ORNaJF9BA0qRE3NGccOZvUSWXmt+Qs0ULHDGjuOVCpEeiEC4AuPh/ UganIC/lKnF7wFQmSrlJjXIaHxz+oSuhMGxQQGWPY7m6m326QWNmPb6bzk4Oo/FRcqGRBEN3EbINx Tn+szo2ynfwP5RsQS+YQweeUQuJRPPa8PY+JjBKTlfPHqzJx22pl/Gx+4k0ZW2E2NXiVPJ8isExPI q7xl9w5olC7xqzEciOOELF3m4CUmWYQ1yKtnPbdgbjO+0jLn6ujwmcIpFIPGV4srdZsNa5mM8lWYi mL+DZrjg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1epKfH-0004Gf-Hl; Fri, 23 Feb 2018 21:13:59 +0000 Received: from mail-qt0-x242.google.com ([2607:f8b0:400d:c0d::242]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1epKbU-00019A-4C for linux-arm-kernel@lists.infradead.org; Fri, 23 Feb 2018 21:10:21 +0000 Received: by mail-qt0-x242.google.com with SMTP id k13so12177483qtg.5 for ; Fri, 23 Feb 2018 13:09:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=v8P8mYb7KVpQTvBbAGl7l1RRTcejKQ4TtODObPu7HUg=; b=k6Y6//SXRNCes79xtEipWy4EhTxT8sSADqP4Gq53LqfWOmElok0frQvVJnAygIxAP2 qJI5wfNySFXRcj8Q3AQ1umyfaxoEOsvIWgJVWs8Fnwqyz2ES4iAeHpftbGPNhS1tgY/y DCwb2zwlXJZFOuNhIThPs79HxUN0VGV5XlpikDbHT+K0BrySmLBWS5J/v4PGlR5pA7N3 plSsd3XWe45RmMktBnxJQoyUemms8PcqPY3AMF+2OuZqHYUq/THYAeSTQi848aKB/MwR fovKXEIruKUJ7RcOvPrREnaLo5CqUla4GMtkhw4e1zR5nDh6aSVfsl2iJW6e6qLJDtEn HYWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=v8P8mYb7KVpQTvBbAGl7l1RRTcejKQ4TtODObPu7HUg=; b=XxKvuNl/38jKE3h9NjfvVnUSdMFiqUFrjCu9yLdJiepNsLiW6Z8aZ1dpOZrkGnIX60 dqFkIblajil27RWtERArfUVL2r3jejMjmG0fHcgEfCJDtuNoJB8y8D4/p/ClnNw64QLJ uHSfzlJmFCtpcaAgkYKYsjFxxVDmwQlWNZIaLeu5EF52y4vIM8u4x0UTN5mxS/bA5Ifv wS8ItWsz1dbbXXcHyN1AArm68C8xw/v5Fjmmz3dwVdWBSHbllq1pahTY34tT2Q3ZxCCJ G/Bi9Y9KKFJtxOlaaXI0y2cQi15k2EgBT47tGFSeSr0ckrBSZQwOQd75xJ+/mWYNJ79G sCxA== X-Gm-Message-State: APf1xPAZhGl5IlKxgtpx9XCr8oKFGRXx7i/dQndcSSQR391Gx8uimt18 VjUYdPgaoEh4OdsQKBre9s9K/tCk X-Google-Smtp-Source: AG47ELvy1SVwSixWGDL50b0ZAUgbx0OSAGeUsM6vD19+I4RwRFF1Es5M+5xsn/VtlNNAVVQztNAP8w== X-Received: by 10.200.81.146 with SMTP id c18mr4626534qtn.224.1519420192412; Fri, 23 Feb 2018 13:09:52 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id m13sm1912561qtf.31.2018.02.23.13.09.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Feb 2018 13:09:51 -0800 (PST) From: Florian Fainelli To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 4/4] ARM: brcmstb: Add support for the V7 memory map Date: Fri, 23 Feb 2018 13:09:23 -0800 Message-Id: <20180223210923.544-5-f.fainelli@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180223210923.544-1-f.fainelli@gmail.com> References: <20180223210923.544-1-f.fainelli@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180223_131004_296459_BDF67061 X-CRM114-Status: GOOD ( 14.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vladimir Murzin , Florian Fainelli , Greg Kroah-Hartman , Russell King , open list , Doug Berger , "maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE" , Gregory Fong , Philippe Ombredanne , Brian Norris MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Doug Berger The 7278 device is the first device that includes support for the V7 memory map developed for use in 64-bit architecture brcmstb devices. This map relocates the register physical offset from 0xF0000000 to 0x0000000008000000. Since the ARM PERIPHBASE value is also relocated in the V7 memory map we can use its value to determine whether this device uses the new V7 memory map and therefore where to look for the SUN_TOP_CTRL register used to identify the chip family. Signed-off-by: Doug Berger Signed-off-by: Florian Fainelli --- arch/arm/include/debug/brcmstb.S | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/debug/brcmstb.S b/arch/arm/include/debug/brcmstb.S index c826f15d2f80..0f580caa81e5 100644 --- a/arch/arm/include/debug/brcmstb.S +++ b/arch/arm/include/debug/brcmstb.S @@ -11,20 +11,25 @@ * GNU General Public License for more details. */ #include +#include /* Physical register offset and virtual register offset */ #define REG_PHYS_BASE 0xf0000000 +#define REG_PHYS_BASE_V7 0x08000000 #define REG_VIRT_BASE 0xfc000000 #define REG_PHYS_ADDR(x) ((x) + REG_PHYS_BASE) +#define REG_PHYS_ADDR_V7(x) ((x) + REG_PHYS_BASE_V7) /* Product id can be read from here */ #define SUN_TOP_CTRL_BASE REG_PHYS_ADDR(0x404000) +#define SUN_TOP_CTRL_BASE_V7 REG_PHYS_ADDR_V7(0x404000) #define UARTA_3390 REG_PHYS_ADDR(0x40a900) #define UARTA_7250 REG_PHYS_ADDR(0x40b400) #define UARTA_7260 REG_PHYS_ADDR(0x40c000) #define UARTA_7268 UARTA_7260 #define UARTA_7271 UARTA_7268 +#define UARTA_7278 REG_PHYS_ADDR_V7(0x40c000) #define UARTA_7364 REG_PHYS_ADDR(0x40b000) #define UARTA_7366 UARTA_7364 #define UARTA_74371 REG_PHYS_ADDR(0x406b00) @@ -55,8 +60,21 @@ mov \rv, #0 @ yes; record init is done str \rv, [\tmp] + /* Check for V7 memory map if B53 */ + mrc p15, 0, \rv, c0, c0, 0 @ get Main ID register + ldr \rp, =ARM_CPU_PART_MASK + and \rv, \rv, \rp + ldr \rp, =ARM_CPU_PART_BRAHMA_B53 @ check for B53 CPU + cmp \rv, \rp + bne 10f + + /* if PERIPHBASE doesn't overlap REG_PHYS_BASE use V7 map */ + mrc p15, 1, \rv, c15, c3, 0 @ get PERIPHBASE from CBAR + ands \rv, \rv, #REG_PHYS_BASE + ldreq \rp, =SUN_TOP_CTRL_BASE_V7 + /* Check SUN_TOP_CTRL base */ - ldr \rp, =SUN_TOP_CTRL_BASE @ load SUN_TOP_CTRL PA +10: ldrne \rp, =SUN_TOP_CTRL_BASE @ load SUN_TOP_CTRL PA ldr \rv, [\rp, #0] @ get register contents ARM_BE8( rev \rv, \rv ) and \rv, \rv, #0xffffff00 @ strip revision bits [7:0] @@ -72,6 +90,7 @@ ARM_BE8( rev \rv, \rv ) 27: checkuart(\rp, \rv, 0x07437100, 74371) 28: checkuart(\rp, \rv, 0x74390000, 7439) 29: checkuart(\rp, \rv, 0x74450000, 7445) +30: checkuart(\rp, \rv, 0x72780000, 7278) /* No valid UART found */ 90: mov \rp, #0