From patchwork Mon Jan 27 18:53:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Darwin Rambo X-Patchwork-Id: 23751 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f72.google.com (mail-oa0-f72.google.com [209.85.219.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2A6F320143 for ; Mon, 27 Jan 2014 18:58:29 +0000 (UTC) Received: by mail-oa0-f72.google.com with SMTP id i4sf25788514oah.7 for ; Mon, 27 Jan 2014 10:58:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:content-type :content-transfer-encoding; bh=39JXDNZy39vrQ6y0YHDqFUuycprjzcVNrygtaSOgOQ8=; b=CEQMs6IhakCg0uP7epS0+hlHLKF6wCQvvhldIKUiEN2jzyz1M+p97sZVlb60SYTLAH Ab0d2SvAZgP76UNknnNgR5Dx5wF5symORWnKDavni4UQIDUxyVVkAMWrEZDQHmwHjFRz B5mXIwhqclZi41+mTd3T7r0z2Wx2On35dv5NB7qxOsZvyKpSsPm6qRS59u+vHrgWZceL MsUYoUmMVY+vyO8d4fuLvMPmxrGAeZqy94HtSY+0b4DQTEvJ4bQsJ0Slt40d+A0yoffL KxBI80Vudb3Y8rtx6DFN2t6d7xA8RPxPmpQJtSg77U0diY4kNB9kuHE9iEnEkvWozbYM qWpQ== X-Gm-Message-State: ALoCoQlyTR6RRZumxADX5HgmsGnqwRtWBg2S0pWZ+mfMSB7TtPyQlqaJvu8RP/PW7unAyPv+30OZ X-Received: by 10.50.112.10 with SMTP id im10mr9823359igb.1.1390849108316; Mon, 27 Jan 2014 10:58:28 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.88.203 with SMTP id t69ls1447435qgd.87.gmail; Mon, 27 Jan 2014 10:58:28 -0800 (PST) X-Received: by 10.220.164.80 with SMTP id d16mr16517472vcy.15.1390849108152; Mon, 27 Jan 2014 10:58:28 -0800 (PST) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id we7si5445241vcb.7.2014.01.27.10.58.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 27 Jan 2014 10:58:28 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.178 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.178; Received: by mail-vc0-f178.google.com with SMTP id ik5so3705669vcb.37 for ; Mon, 27 Jan 2014 10:58:28 -0800 (PST) X-Received: by 10.221.40.10 with SMTP id to10mr1224563vcb.22.1390849107569; Mon, 27 Jan 2014 10:58:27 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.174.196 with SMTP id u4csp151411vcz; Mon, 27 Jan 2014 10:58:26 -0800 (PST) X-Received: by 10.204.167.193 with SMTP id r1mr2622891bky.99.1390849106472; Mon, 27 Jan 2014 10:58:26 -0800 (PST) Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id kr4si15402989bkb.313.2014.01.27.10.58.25 for ; Mon, 27 Jan 2014 10:58:26 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) client-ip=85.214.87.163; Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5FD564B0B6; Mon, 27 Jan 2014 19:58:25 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 376RHDJmQQcj; Mon, 27 Jan 2014 19:58:25 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 930EA4B0C8; Mon, 27 Jan 2014 19:58:20 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4D3924B0F7 for ; Mon, 27 Jan 2014 19:58:12 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Z2kRmq8KBrjL for ; Mon, 27 Jan 2014 19:58:06 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-gw1-out.broadcom.com (mail-gw1-out.broadcom.com [216.31.210.62]) by theia.denx.de (Postfix) with ESMTP id 17A9F4B0B7 for ; Mon, 27 Jan 2014 19:57:59 +0100 (CET) X-IronPort-AV: E=Sophos;i="4.95,730,1384329600"; d="scan'208";a="11725685" Received: from irvexchcas08.broadcom.com (HELO IRVEXCHCAS08.corp.ad.broadcom.com) ([10.9.208.57]) by mail-gw1-out.broadcom.com with ESMTP; 27 Jan 2014 11:19:46 -0800 Received: from IRVEXCHSMTP1.corp.ad.broadcom.com (10.9.207.51) by IRVEXCHCAS08.corp.ad.broadcom.com (10.9.208.57) with Microsoft SMTP Server (TLS) id 14.1.438.0; Mon, 27 Jan 2014 10:57:58 -0800 Received: from mail-irva-13.broadcom.com (10.10.10.20) by IRVEXCHSMTP1.corp.ad.broadcom.com (10.9.207.51) with Microsoft SMTP Server id 14.1.438.0; Mon, 27 Jan 2014 10:57:58 -0800 Received: from mail.broadcom.com (dhcp-rmna-vpn-80.ric.broadcom.com [10.136.253.80]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id 0A740246A3; Mon, 27 Jan 2014 10:57:57 -0800 (PST) From: Darwin Rambo To: Date: Mon, 27 Jan 2014 10:53:25 -0800 Message-ID: <1390848810-7227-2-git-send-email-drambo@broadcom.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1390848810-7227-1-git-send-email-drambo@broadcom.com> References: <1390848810-7227-1-git-send-email-drambo@broadcom.com> MIME-Version: 1.0 Cc: Darwin Rambo Subject: [U-Boot] [PATCH 1/6] arch: kona: Initial commit of kona-common architecture code X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: drambo@broadcom.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.178 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 The Kona architecture is present on a number of Broadcom mobile SoCs including the bcm281xx family of chips. Signed-off-by: Darwin Rambo Reviewed-by: Steve Rae Reviewed-by: Tim Kryger --- arch/arm/cpu/armv7/Makefile | 1 + arch/arm/cpu/armv7/kona-common/Makefile | 10 ++++++++ arch/arm/cpu/armv7/kona-common/clk-stubs.c | 22 +++++++++++++++++ arch/arm/cpu/armv7/kona-common/hwinit-common.c | 18 ++++++++++++++ arch/arm/cpu/armv7/kona-common/lowlevel_init.S | 15 ++++++++++++ arch/arm/cpu/armv7/kona-common/proc.c | 20 +++++++++++++++ arch/arm/include/asm/kona-common/clk.h | 31 ++++++++++++++++++++++++ arch/arm/include/asm/kona-common/misc.h | 20 +++++++++++++++ 8 files changed, 137 insertions(+) create mode 100644 arch/arm/cpu/armv7/kona-common/Makefile create mode 100644 arch/arm/cpu/armv7/kona-common/clk-stubs.c create mode 100644 arch/arm/cpu/armv7/kona-common/hwinit-common.c create mode 100644 arch/arm/cpu/armv7/kona-common/lowlevel_init.S create mode 100644 arch/arm/cpu/armv7/kona-common/proc.c create mode 100644 arch/arm/include/asm/kona-common/clk.h create mode 100644 arch/arm/include/asm/kona-common/misc.h diff --git a/arch/arm/cpu/armv7/Makefile b/arch/arm/cpu/armv7/Makefile index 0467d00..119ebb3 100644 --- a/arch/arm/cpu/armv7/Makefile +++ b/arch/arm/cpu/armv7/Makefile @@ -23,6 +23,7 @@ obj-y += nonsec_virt.o obj-y += virt-v7.o endif +obj-$(CONFIG_KONA) += kona-common/ obj-$(CONFIG_OMAP_COMMON) += omap-common/ obj-$(CONFIG_TEGRA) += tegra-common/ diff --git a/arch/arm/cpu/armv7/kona-common/Makefile b/arch/arm/cpu/armv7/kona-common/Makefile new file mode 100644 index 0000000..9a7c167 --- /dev/null +++ b/arch/arm/cpu/armv7/kona-common/Makefile @@ -0,0 +1,10 @@ +# +# Copyright 2013 Broadcom Corporation. All rights reserved. +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += clk-stubs.o +obj-y += hwinit-common.o +obj-y += proc.o +obj-y += lowlevel_init.o diff --git a/arch/arm/cpu/armv7/kona-common/clk-stubs.c b/arch/arm/cpu/armv7/kona-common/clk-stubs.c new file mode 100644 index 0000000..dd3ce34 --- /dev/null +++ b/arch/arm/cpu/armv7/kona-common/clk-stubs.c @@ -0,0 +1,22 @@ +/***************************************************************************** +* +* Copyright 2013 Broadcom Corporation. All rights reserved. +* +* SPDX-License-Identifier: GPL-2.0+ +* +*****************************************************************************/ + +#include + +/* + * These weak functions are available to kona architectures that don't + * require clock enables from the driver code. + */ +int __weak clk_sdio_enable(void *base, u32 rate, u32 *actual_ratep) +{ + return 0; +} +int __weak clk_bsc_enable(void *base, u32 rate, u32 *actual_ratep) +{ + return 0; +} diff --git a/arch/arm/cpu/armv7/kona-common/hwinit-common.c b/arch/arm/cpu/armv7/kona-common/hwinit-common.c new file mode 100644 index 0000000..5d6b131 --- /dev/null +++ b/arch/arm/cpu/armv7/kona-common/hwinit-common.c @@ -0,0 +1,18 @@ +/***************************************************************************** +* +* Copyright 2013 Broadcom Corporation. All rights reserved. +* +* SPDX-License-Identifier: GPL-2.0+ +* +*****************************************************************************/ + +#include +#include + +#ifndef CONFIG_SYS_DCACHE_OFF +void enable_caches(void) +{ + /* Enable D-cache. I-cache is already enabled in start.S */ + dcache_enable(); +} +#endif diff --git a/arch/arm/cpu/armv7/kona-common/lowlevel_init.S b/arch/arm/cpu/armv7/kona-common/lowlevel_init.S new file mode 100644 index 0000000..a03afcc --- /dev/null +++ b/arch/arm/cpu/armv7/kona-common/lowlevel_init.S @@ -0,0 +1,15 @@ +/***************************************************************************** +* +* Copyright 2013 Broadcom Corporation. All rights reserved. +* +* SPDX-License-Identifier: GPL-2.0+ +* +*****************************************************************************/ + +//#include +//#include +//#include + +.globl lowlevel_init +lowlevel_init: + mov pc, lr diff --git a/arch/arm/cpu/armv7/kona-common/proc.c b/arch/arm/cpu/armv7/kona-common/proc.c new file mode 100644 index 0000000..92fb39b --- /dev/null +++ b/arch/arm/cpu/armv7/kona-common/proc.c @@ -0,0 +1,20 @@ +/***************************************************************************** +* +* Copyright 2013 Broadcom Corporation. All rights reserved. +* +* SPDX-License-Identifier: GPL-2.0+ +* +*****************************************************************************/ + +#include +#include +#include +#include + +void do_proc_wfe(int forever) +{ + do { + asm volatile ("wfe @ wait for event\n"); + /*printf("wake up from wfe\n"); */ + } while (forever); +} diff --git a/arch/arm/include/asm/kona-common/clk.h b/arch/arm/include/asm/kona-common/clk.h new file mode 100644 index 0000000..c26c6a4 --- /dev/null +++ b/arch/arm/include/asm/kona-common/clk.h @@ -0,0 +1,31 @@ +/***************************************************************************** +* +* Copyright 2013 Broadcom Corporation. All rights reserved. +* +* SPDX-License-Identifier: GPL-2.0+ +* +*****************************************************************************/ + +/* This API file is loosely based on u-boot/drivers/video/ipu.h and linux */ + +#ifndef __KONA_COMMON_CLK_H +#define __KONA_COMMON_CLK_H + +#include + +struct clk; + +/* Only implement required functions for your specific architecture */ +int clk_init(void); +struct clk *clk_get(const char *id); +int clk_enable(struct clk *clk); +void clk_disable(struct clk *clk); +unsigned long clk_get_rate(struct clk *clk); +long clk_round_rate(struct clk *clk, unsigned long rate); +int clk_set_rate(struct clk *clk, unsigned long rate); +int clk_set_parent(struct clk *clk, struct clk *parent); +struct clk *clk_get_parent(struct clk *clk); +int clk_sdio_enable(void *base, u32 rate, u32 *actual_ratep); +int clk_bsc_enable(void *base); + +#endif diff --git a/arch/arm/include/asm/kona-common/misc.h b/arch/arm/include/asm/kona-common/misc.h new file mode 100644 index 0000000..8506bbc --- /dev/null +++ b/arch/arm/include/asm/kona-common/misc.h @@ -0,0 +1,20 @@ +/***************************************************************************** +* +* Copyright 2013 Broadcom Corporation. All rights reserved. +* +* SPDX-License-Identifier: GPL-2.0+ +* +*****************************************************************************/ + +#ifndef __KONA_COMMON_MISC_H +#define __KONA_COMMON_MISC_H + +#include + +void hw_watchdog_disable(void); +int kona_sdhci_init(int dev_index, u32 min_clk, u32 quirks); +int kona_i2c_init(unsigned int dev_idx, unsigned long base_addr); + +void proc_on_wfi(void); + +#endif