From patchwork Thu Feb 28 07:19:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 15134 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 0825C23E2E for ; Thu, 28 Feb 2013 07:19:51 +0000 (UTC) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by fiordland.canonical.com (Postfix) with ESMTP id B243DA18E2F for ; Thu, 28 Feb 2013 07:19:50 +0000 (UTC) Received: by mail-vc0-f182.google.com with SMTP id fl17so997237vcb.27 for ; Wed, 27 Feb 2013 23:19:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=AmHsKP3XI6ZccPFy0MfXOT0EmU2K1W35HyBp+EXZc1k=; b=ad+YNiJLHEzhXz/N5LKRdmi3QF0bYaflrvNBDm3HWEacV+GKXCSaq41zG1YP2I4uko bYdHC1JvrGPfn0G676ETLmFBtwrp5XZao7B84w6RhjiubJrAMAKSxxOAaHenIywQLb1U vyZNssRdPQutGJeSzLmOhteBbcd/xNUH86ZzlDi4fdymYnNr9bZHQjD1McfCKBEDxqNv es2VuouoM9LVwB7A1ZHgye6D9kdSGkTnmNyFt0V0QEwxX2jjbtxhp2qwE9t5bgNrcuCr 6F4+TTAimbpKVEdmN67PPyVirpMgts+Hu29MUG/7nfTZhm3yJ4VjH0n3rHPd9yLQOS2X GBWA== X-Received: by 10.220.149.82 with SMTP id s18mr2130654vcv.14.1362035990095; Wed, 27 Feb 2013 23:19:50 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.145.101 with SMTP id st5csp210878veb; Wed, 27 Feb 2013 23:19:49 -0800 (PST) X-Received: by 10.68.226.228 with SMTP id rv4mr7702069pbc.118.1362035989136; Wed, 27 Feb 2013 23:19:49 -0800 (PST) Received: from mail-da0-f43.google.com (mail-da0-f43.google.com [209.85.210.43]) by mx.google.com with ESMTPS id k6si7867455pay.312.2013.02.27.23.19.48 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 27 Feb 2013 23:19:49 -0800 (PST) Received-SPF: neutral (google.com: 209.85.210.43 is neither permitted nor denied by best guess record for domain of haojian.zhuang@linaro.org) client-ip=209.85.210.43; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.43 is neither permitted nor denied by best guess record for domain of haojian.zhuang@linaro.org) smtp.mail=haojian.zhuang@linaro.org Received: by mail-da0-f43.google.com with SMTP id u36so728170dak.30 for ; Wed, 27 Feb 2013 23:19:48 -0800 (PST) X-Received: by 10.68.244.162 with SMTP id xh2mr7643605pbc.55.1362035988731; Wed, 27 Feb 2013 23:19:48 -0800 (PST) Received: from localhost.localdomain ([140.206.155.71]) by mx.google.com with ESMTPS id k7sm8255069paz.13.2013.02.27.23.19.44 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 27 Feb 2013 23:19:47 -0800 (PST) From: Haojian Zhuang To: jone.lixin@huawei.com, arnd@arndb.de, olof@lixom.net, linux-arm-kernel@lists.infradead.org Cc: patches@linaro.org, Haojian Zhuang Subject: [PATCH 3/7] ARM: hs: add board support with device tree Date: Thu, 28 Feb 2013 15:19:22 +0800 Message-Id: <1362035966-17628-3-git-send-email-haojian.zhuang@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1362035966-17628-1-git-send-email-haojian.zhuang@linaro.org> References: <1362035966-17628-1-git-send-email-haojian.zhuang@linaro.org> X-Gm-Message-State: ALoCoQl/it1q23qqBlh7NjNReqz4y7DogQKchm2pyIuP7R8NdNLSVlj4Xj9npSNHc5MT+atMan49 Add board support with device tree for Hisilicon Hi36xx/Hi37xx platform. Signed-off-by: Haojian Zhuang --- arch/arm/Kconfig | 2 ++ arch/arm/Makefile | 1 + arch/arm/mach-hs/Kconfig | 23 +++++++++++++ arch/arm/mach-hs/Makefile | 5 +++ arch/arm/mach-hs/hs-dt.c | 83 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 114 insertions(+) create mode 100644 arch/arm/mach-hs/Kconfig create mode 100644 arch/arm/mach-hs/Makefile create mode 100644 arch/arm/mach-hs/hs-dt.c diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index dedf02b..dfe70aa 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1055,6 +1055,8 @@ source "arch/arm/mach-h720x/Kconfig" source "arch/arm/mach-highbank/Kconfig" +source "arch/arm/mach-hs/Kconfig" + source "arch/arm/mach-integrator/Kconfig" source "arch/arm/mach-iop32x/Kconfig" diff --git a/arch/arm/Makefile b/arch/arm/Makefile index ee4605f..08a913b 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -149,6 +149,7 @@ machine-$(CONFIG_ARCH_EP93XX) += ep93xx machine-$(CONFIG_ARCH_GEMINI) += gemini machine-$(CONFIG_ARCH_H720X) += h720x machine-$(CONFIG_ARCH_HIGHBANK) += highbank +machine-$(CONFIG_ARCH_HS) += hs machine-$(CONFIG_ARCH_INTEGRATOR) += integrator machine-$(CONFIG_ARCH_IOP13XX) += iop13xx machine-$(CONFIG_ARCH_IOP32X) += iop32x diff --git a/arch/arm/mach-hs/Kconfig b/arch/arm/mach-hs/Kconfig new file mode 100644 index 0000000..491c6da --- /dev/null +++ b/arch/arm/mach-hs/Kconfig @@ -0,0 +1,23 @@ +config ARCH_HS + bool "Hisilicon Hi36xx/Hi37xx family" if ARCH_MULTI_V7 + select ARM_AMBA + select ARM_GIC + select CACHE_L2X0 + select CACHE_PL310 + select PINCTRL + select PINCTRL_SINGLE + select SERIAL_AMBA_PL011 + select SERIAL_AMBA_PL011_CONSOLE + help + Support for Hisilicon Hi36xx/Hi37xx processor family + +if ARCH_HS + +config MACH_HS_DT + bool "Hisilicon Development Board" + default y + help + Say 'Y' here if you want to support the Hisilicon Development + Board. + +endif diff --git a/arch/arm/mach-hs/Makefile b/arch/arm/mach-hs/Makefile new file mode 100644 index 0000000..d79ecb5 --- /dev/null +++ b/arch/arm/mach-hs/Makefile @@ -0,0 +1,5 @@ +# +# Makefile for Hisilicon Hi36xx/Hi37xx processors line +# + +obj-$(CONFIG_MACH_HS_DT) += hs-dt.o diff --git a/arch/arm/mach-hs/hs-dt.c b/arch/arm/mach-hs/hs-dt.c new file mode 100644 index 0000000..813ebb0 --- /dev/null +++ b/arch/arm/mach-hs/hs-dt.c @@ -0,0 +1,83 @@ +/* + * (Hisilicon's Hi36xx/Hi37xx SoC based) flattened device tree enabled machine + * + * Copyright (c) 2012-2013 Hisilicon Ltd. + * Copyright (c) 2012-2013 Linaro Ltd. + * + * Author: Haojian Zhuang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. +*/ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +static struct of_device_id hs_timer_match[] __initdata = { + { .compatible = "arm,sp804", }, + {} +}; + +static struct clk_lookup sp804_lookup = { + .dev_id = "sp804", + .clk = NULL, +}; + +extern void __init hs_init_clocks(void); +static void __init hs_timer_init(void) +{ + struct device_node *node = NULL; + void __iomem *base; + int irq; + + hs_init_clocks(); + + node = of_find_matching_node(NULL, hs_timer_match); + WARN_ON(!node); + if (!node) { + pr_err("Failed to find sp804 timer\n"); + return; + } + base = of_iomap(node, 0); + WARN_ON(!base); + + /* timer0 is used as clock event, and timer1 is clock source. */ + irq = irq_of_parse_and_map(node, 0); + WARN_ON(!irq); + + sp804_lookup.clk = of_clk_get(node, 0); + clkdev_add(&sp804_lookup); + + sp804_clocksource_and_sched_clock_init(base + TIMER_2_BASE, "timer1"); + sp804_clockevents_init(base, irq, "timer0"); +} + +static void __init hs_init(void) +{ + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); +} + +static const char *hs_compat[] __initdata = { + "hisilicon,hi3620-hi4511", + NULL, +}; + +DT_MACHINE_START(HS_DT, "Hisilicon Hi36xx/Hi37xx (Flattened Device Tree)") + /* Maintainer: Haojian Zhuang */ + .map_io = debug_ll_io_init, + .init_irq = irqchip_init, + .init_time = hs_timer_init, + .init_machine = hs_init, + .dt_compat = hs_compat, +MACHINE_END