devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Jonathan Richardson <jonathar@broadcom.com>
Cc: Christian Daudt <bcm@fixthebug.org>,
	Matt Porter <mporter@linaro.org>,
	Russell King <linux@arm.linux.org.uk>,
	Mike Turquette <mturquette@linaro.org>,
	Rob Herring <robh+dt@kernel.org>, Pawel Moll <Pawel.Moll@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	JD Zheng <jdzheng@broadcom.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"bcm-kernel-feedback-list@broadcom.com"
	<bcm-kernel-feedback-list@broadcom.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Scott Branden <sbranden@broadcom.com>,
	Ray Jui <rjui@broadcom.com>
Subject: Re: [PATCH 1/6] ARM: cygnus: Initial support for Broadcom Cygnus SoC
Date: Wed, 17 Sep 2014 01:00:19 +0100	[thread overview]
Message-ID: <20140917000018.GI14191@leverpostej> (raw)
In-Reply-To: <1410897497-27527-2-git-send-email-jonathar@broadcom.com>

On Tue, Sep 16, 2014 at 08:58:12PM +0100, Jonathan Richardson wrote:
> Adds initial support for the Cygnus SoC based on Broadcom’s iProc series.
> 
> Reviewed-by: Ray Jui <rjui@broadcom.com>
> Reviewed-by: Desmond Liu <desmondl@broadcom.com>
> Reviewed-by: JD (Jiandong) Zheng <jdzheng@broadcom.com>
> Tested-by: Jonathan Richardson <jonathar@broadcom.com>
> Signed-off-by: Jonathan Richardson <jonathar@broadcom.com>
> ---
>  arch/arm/mach-bcm/Kconfig            |   34 +++++++
>  arch/arm/mach-bcm/Makefile           |    3 +
>  arch/arm/mach-bcm/board_bcm_cygnus.c |  166 ++++++++++++++++++++++++++++++++++

Is Cygnus an SoC or a board?

>  3 files changed, 203 insertions(+)
>  create mode 100644 arch/arm/mach-bcm/board_bcm_cygnus.c
> 
> diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig
> index fc93800..58e0f20 100644
> --- a/arch/arm/mach-bcm/Kconfig
> +++ b/arch/arm/mach-bcm/Kconfig
> @@ -5,6 +5,40 @@ menuconfig ARCH_BCM
>  
>  if ARCH_BCM
>  
> +config ARCH_BCM_IPROC
> +	bool "Broadcom ARMv7 iProc boards" if ARCH_MULTI_V7
> +	select ARM_GIC
> +	select CACHE_L2X0
> +	select HAVE_ARM_SCU if SMP

I didn't spot any SMP code in this series.

> +	select HAVE_ARM_TWD if LOCAL_TIMERS
> +	select HAVE_CLK
> +	select CLKSRC_OF
> +	select CLKSRC_MMIO
> +	select LOCAL_TIMERS if SMP
> +	select GENERIC_CLOCKEVENTS_BUILD

You don't need to select this.

> +	select GENERIC_CLOCKEVENTS
> +	select ARM_GLOBAL_TIMER
> +	select ARCH_REQUIRE_GPIOLIB
> +	select ARM_AMBA
> +	select PINCTRL
> +	select DEBUG_UART_8250
> +	help
> +	  This enables support for systems based on Broadcom IPROC architected SoCs.
> +	  The IPROC complex contains one or more ARM CPUs along with common
> +	  core periperals. Application specific SoCs are created by adding a
> +	  uArchitecture containing peripherals outside of the IPROC complex.
> +	  Currently supported SoCs are Cygnus.
> +
> +menu "iProc SoC based Machine types"
> +	depends on ARCH_BCM_IPROC
> +
> +	config ARCH_BCM_CYGNUS
> +		bool "Support Broadcom Cygnus board"
> +		select USB_ARCH_HAS_EHCI if USB_SUPPORT
> +		help
> +		  Support for Broadcom Cygnus SoC.
> +endmenu
> +
>  config ARCH_BCM_MOBILE
>  	bool "Broadcom Mobile SoC Support" if ARCH_MULTI_V7
>  	select ARCH_REQUIRE_GPIOLIB
> diff --git a/arch/arm/mach-bcm/Makefile b/arch/arm/mach-bcm/Makefile
> index b19a396..dd14a10 100644
> --- a/arch/arm/mach-bcm/Makefile
> +++ b/arch/arm/mach-bcm/Makefile
> @@ -10,6 +10,9 @@
>  # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>  # GNU General Public License for more details.
>  
> +# Cygnus
> +obj-$(CONFIG_ARCH_BCM_CYGNUS) +=  board_bcm_cygnus.o
> +
>  # BCM281XX
>  obj-$(CONFIG_ARCH_BCM_281XX)	+= board_bcm281xx.o
>  
> diff --git a/arch/arm/mach-bcm/board_bcm_cygnus.c b/arch/arm/mach-bcm/board_bcm_cygnus.c
> new file mode 100644
> index 0000000..d67555a
> --- /dev/null
> +++ b/arch/arm/mach-bcm/board_bcm_cygnus.c
> @@ -0,0 +1,166 @@
> +/*
> + * Copyright 2014 Broadcom Corporation.  All rights reserved.
> + *
> + * Unless you and Broadcom execute a separate written software license
> + * agreement governing use of this software, this software is licensed to you
> + * under the terms of the GNU General Public License version 2, available at
> + * http://www.broadcom.com/licenses/GPLv2.php (the "GPL").

Why don't we point at the gnu.org copy as we do elsewhere?

> + */
> +
> +#include <linux/of_address.h>
> +#include <linux/of_platform.h>
> +#include <linux/clocksource.h>
> +#include <linux/clk-provider.h>
> +#include <linux/delay.h>
> +#include <asm/mach/arch.h>
> +#include <asm/mach/map.h>
> +#include <asm/proc-fns.h>
> +#include <asm/hardware/cache-l2x0.h>
> +
> +#define CRMU_MAIL_BOX1      0x03024028

Please don't hard code addresses in board files.

> +#define CRMU_SOFT_RESET_CMD 0xFFFFFFFF
> +
> +/* CRU_RESET register */
> +static void * __iomem crmu_mail_box1_reg;
> +
> +#ifdef CONFIG_NEON
> +
> +#define CRU_BASE                  0x1800e000

Another hard coded address that needs to go.

> +#define CRU_SIZE                  0x34
> +#define CRU_CONTROL_OFFSET        0x0
> +#define CRU_PWRDWN_EN_OFFSET      0x4
> +#define CRU_PWRDWN_STATUS_OFFSET  0x8
> +#define CRU_NEON0_HW_RESET  6
> +#define CRU_CLAMP_ON_NEON0  20
> +#define CRU_PWRONIN_NEON0   21
> +#define CRU_PWRONOUT_NEON0  21
> +#define CRU_PWROKIN_NEON0   22
> +#define CRU_PWROKOUT_NEON0  22
> +#define CRU_STATUS_DELAY_NS 500
> +#define CRU_MAX_RETRY_COUNT 10
> +#define CRU_RETRY_INTVL_US  1
> +
> +/* Power up the NEON/VFPv3 block. */
> +static void bcm_cygnus_powerup_neon(void)
> +{
> +	void * __iomem cru_base = ioremap_nocache(CRU_BASE, CRU_SIZE);

Why not plain ioremap?

> +	u32 reg, i;
> +
> +	BUG_ON(!cru_base);

This seems a little extreme. Can;t we continue without NEON?

> +
> +	/* De-assert the neon hardware block reset */
> +	reg = readl(cru_base + CRU_CONTROL_OFFSET);
> +	reg &= ~(1 << CRU_NEON0_HW_RESET);
> +	writel(reg, cru_base + CRU_CONTROL_OFFSET);
> +
> +	/* Assert the power ON register bit */
> +	reg = readl(cru_base + CRU_PWRDWN_EN_OFFSET);
> +	reg |= (1 << CRU_PWRONIN_NEON0);
> +	writel(reg, cru_base + CRU_PWRDWN_EN_OFFSET);
> +
> +	/*
> +	 * Wait up to 10 usec in 1 usec increments for the
> +	 * status register to acknowledge the power ON assert
> +	 */
> +	for (i = 0; i < CRU_MAX_RETRY_COUNT; i++) {
> +		reg = readl(cru_base + CRU_PWRDWN_STATUS_OFFSET);
> +		if (reg & CRU_PWRONOUT_NEON0)
> +			break;
> +
> +		udelay(CRU_RETRY_INTVL_US);
> +	}
> +
> +	if (i == CRU_MAX_RETRY_COUNT)
> +		panic("NEON power ON register not acknowledged\n");

We can't just disable NEON if we fail to enable the HW block?

[...]

> +static void __init bcm_cygnus_timer_init(void)
> +{
> +	/* Initialize all clocks declared in device tree */
> +	of_clk_init(NULL);
> +
> +	clocksource_of_init();
> +}

If you take a look at time_init in arch/arm/kernel/time.c you'll see
this is redundant.

Get rid of this.

> +
> +static void __init bcm_cygnus_init(void)
> +{
> +	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
> +
> +	l2x0_of_init(0, ~0UL);
> +
> +	crmu_mail_box1_reg = ioremap_nocache(CRMU_MAIL_BOX1, SZ_4);

Why not plain ioremap?

> +	BUG_ON(!crmu_mail_box1_reg);

We only use this for reboot later on, so do we need to blow up so
spectacularly in this case?

> +
> +#ifdef CONFIG_NEON
> +	bcm_cygnus_powerup_neon();
> +#endif
> +}
> +
> +/*
> + * Reset the system
> + */
> +void bcm_cygnus_restart(enum reboot_mode mode, const char *cmd)
> +{
> +	/* Send reset command to M0 via Mailbox. */
> +	writel(CRMU_SOFT_RESET_CMD, crmu_mail_box1_reg);
> +	iounmap(crmu_mail_box1_reg);
> +
> +	/* Wait for M0 to reset the chip. */
> +	while (1)
> +		cpu_do_idle();
> +}

This doesn't have to live in the machine descriptor. It could be a
separate driver.

Thanks,
Mark.

  reply	other threads:[~2014-09-17  0:00 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Jonathan Richardson <jonathar@broadcom.com>
2014-09-23 21:17 ` [PATCH v2 0/6] Add initial support for Broadcom Cygnus SoC Jonathan Richardson
2014-09-23 21:17   ` [PATCH v2 1/6] ARM: cygnus: Initial " Jonathan Richardson
2014-09-23 21:17   ` [PATCH v2 2/6] clk: Clock driver " Jonathan Richardson
2014-09-23 21:17   ` [PATCH v2 3/6] dt-bindings: Document Broadcom Cygnus SoC and clock driver Jonathan Richardson
2014-09-23 21:17   ` [PATCH v2 5/6] ARM: cygnus defconfig : Initial defconfig for Broadcom Cygnus SoC Jonathan Richardson
2014-09-23 21:17   ` [PATCH v2 6/6] MAINTAINERS: Entry for Cygnus/iproc arm architecture and clock drivers Jonathan Richardson
     [not found]   ` <1411507057-14771-1-git-send-email-jonathar-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2014-09-23 21:17     ` [PATCH v2 4/6] ARM: dts: Enable Broadcom Cygnus SoC Jonathan Richardson
2014-09-25 21:04     ` [PATCH v2 0/6] Add initial support for " Scott Branden
     [not found]       ` <54248344.5030308-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2014-09-25 21:22         ` Florian Fainelli
     [not found]           ` <54248791.9060805-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-09-26  0:14             ` Florian Fainelli
     [not found]               ` <5424AFD2.2070406-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-09-26  0:28                 ` Jonathan Richardson
     [not found]                   ` <5424B335.6000602-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2014-09-26  0:34                     ` Florian Fainelli
2014-12-18  1:59 ` [PATCH 0/2] Add support for Broadcom iProc touchscreen Jonathan Richardson
     [not found]   ` <1418867992-3550-1-git-send-email-jonathar-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2014-12-18  1:59     ` [PATCH 1/2] Input: touchscreen-iproc: Add Broadcom iProc touchscreen driver Jonathan Richardson
2014-12-18  2:14       ` Joe Perches
2014-12-19 19:51         ` Jonathan Richardson
2014-12-19 19:56           ` Dmitry Torokhov
2014-12-18  1:59   ` [PATCH 2/2] Input: touchscreen-iproc: add device tree bindings Jonathan Richardson
2014-12-19 22:17 ` [PATCH v2 0/2] Add support for Broadcom iProc touchscreen Jonathan Richardson
2014-12-19 22:17   ` [PATCH v2 1/2] Input: touchscreen-iproc: Add Broadcom iProc touchscreen driver Jonathan Richardson
2015-01-15  1:02     ` Dmitry Torokhov
2015-01-15  5:44       ` Scott Branden
2015-01-15  6:07         ` Dmitry Torokhov
2015-01-15 19:51           ` Jonathan Richardson
2015-02-11 18:45             ` Jonathan Richardson
     [not found]               ` <54DBA34E.8090400-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2015-02-24 23:18                 ` Dmitry Torokhov
2015-02-27  1:02                   ` Jonathan Richardson
     [not found]     ` <1419027470-7969-2-git-send-email-jonathar-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2014-12-19 22:26       ` Joe Perches
2014-12-19 23:03         ` Jonathan Richardson
2015-01-01  0:55           ` Jonathan Richardson
2015-01-15  1:08           ` Florian Fainelli
2015-01-15 19:19             ` Jonathan Richardson
2015-02-24 23:29       ` Dmitry Torokhov
2015-03-02 19:13         ` Jonathan Richardson
2014-12-19 22:17   ` [PATCH v2 2/2] Input: touchscreen-iproc: add device tree bindings Jonathan Richardson
     [not found] ` <Jonathan Richardson <jonathar-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2014-09-16 19:58   ` [PATCH 0/6] Add initial support for Broadcom Cygnus SoC Jonathan Richardson
2014-09-16 19:58     ` [PATCH 1/6] ARM: cygnus: Initial " Jonathan Richardson
2014-09-17  0:00       ` Mark Rutland [this message]
2014-09-18 23:33         ` Jonathan Richardson
2014-09-16 19:58     ` [PATCH 3/6] dt-bindings: Document Broadcom Cygnus SoC and clock driver Jonathan Richardson
2014-09-16 19:58     ` [PATCH 4/6] ARM: dts: Enable Broadcom Cygnus SoC Jonathan Richardson
2014-09-16 19:58     ` [PATCH 5/6] ARM: cygnus defconfig : Initial defconfig for " Jonathan Richardson
2014-09-16 19:58     ` [PATCH 6/6] MAINTAINERS: Entry for Cygnus/iproc arm architecture and clock drivers Jonathan Richardson
     [not found]     ` <1410897497-27527-1-git-send-email-jonathar-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2014-09-16 19:58       ` [PATCH 2/6] clk: Clock driver support for Broadcom Cygnus SoC Jonathan Richardson
     [not found]         ` <1410897497-27527-3-git-send-email-jonathar-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2014-09-17  0:47           ` Mark Rutland
2014-09-18 23:43             ` Jonathan Richardson
2014-09-18 22:31       ` [PATCH 0/6] Add initial " Hauke Mehrtens
2014-09-18 22:39         ` Florian Fainelli
     [not found]           ` <541B5F16.6030005-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
2014-09-18 22:54             ` Hauke Mehrtens
2014-09-19  0:58               ` Scott Branden
2015-02-24 19:13   ` [PATCH 0/1] Enable Broadcom Cygnus BCM958305K Jonathan Richardson
     [not found]     ` <1424805191-10675-1-git-send-email-jonathar-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2015-02-24 19:13       ` [PATCH 1/1] ARM: dts: " Jonathan Richardson
2015-02-25 19:04   ` [PATCH 0/1] Synopsis 8250 serial port driver fix Jonathan Richardson
2015-02-25 19:04     ` [PATCH 1/1] serial: 8250_dw: Fix get_mctrl behaviour Jonathan Richardson
2015-02-25 19:21       ` Arnd Bergmann
2015-02-25 20:00         ` Jonathan Richardson
2015-02-25 20:07           ` Arnd Bergmann
2015-03-02 22:41   ` [PATCH RESEND 0/1] Enable Broadcom Cygnus BCM958305K Jonathan Richardson
2015-03-02 22:41     ` [PATCH RESEND 1/1] ARM: dts: " Jonathan Richardson
     [not found]       ` <1425336070-3414-2-git-send-email-jonathar-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2015-03-02 23:45         ` Florian Fainelli
2015-03-12 17:45   ` [PATCH v4 0/2] Add support for Broadcom iProc touchscreen Jonathan Richardson
2015-03-12 17:45     ` [PATCH v4 1/2] Input: touchscreen-iproc: Add Broadcom iProc touchscreen driver Jonathan Richardson
2015-03-12 17:59       ` Joe Perches
     [not found]         ` <1426183169.2742.10.camel-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
2015-03-12 22:44           ` Jonathan Richardson
2015-03-12 17:45     ` [PATCH v4 2/2] Input: touchscreen-iproc: add device tree bindings Jonathan Richardson
2015-02-27  0:35 ` [PATCH v2 0/1] Synopsis 8250 serial port driver fix Jonathan Richardson
2015-02-27  0:35   ` [PATCH v2 1/1] serial: 8250_dw: Fix get_mctrl behaviour Jonathan Richardson
2015-03-09 18:40     ` Dmitry Torokhov
     [not found]       ` <CAE_wzQ-43+oGAmyJ_cgso1XfnCYFGVczPvePG++x=povcAPOdA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-09 18:51         ` Jonathan Richardson
2015-03-11  1:17 ` [PATCH v3 0/2] Add support for Broadcom iProc touchscreen Jonathan Richardson
     [not found]   ` <1426036669-21659-1-git-send-email-jonathar-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2015-03-11  1:17     ` [PATCH v3 1/2] Input: touchscreen-iproc: Add Broadcom iProc touchscreen driver Jonathan Richardson
2015-03-11  9:46       ` Paul Bolle
2015-03-11 17:05         ` Jonathan Richardson
2015-03-11  1:17   ` [PATCH v3 2/2] Input: touchscreen-iproc: add device tree bindings Jonathan Richardson
     [not found] <Scott Branden <sbranden@broadcom.com>
2014-10-08  5:26 ` [PATCH V3 0/6] Add initial support for Broadcom Cygnus SoC Scott Branden
2014-10-08  5:27   ` [PATCH 1/6] ARM: cygnus: Initial " Scott Branden
2014-10-08  8:11     ` Russell King - ARM Linux
     [not found]       ` <20141008081112.GB5182-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2014-10-08 11:17         ` Scott Branden
2014-10-08 11:41           ` Russell King - ARM Linux
     [not found]     ` <1412746025-11998-2-git-send-email-sbranden-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2014-10-08  7:54       ` Arnd Bergmann
2014-10-08 12:27         ` Scott Branden
2014-10-08 13:28           ` Arnd Bergmann
2014-10-08 16:27             ` Scott Branden
     [not found]               ` <543565DC.8010704-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2014-10-08 18:12                 ` Arnd Bergmann
2014-10-08 18:45                   ` Scott Branden
2014-10-08 22:16                   ` Scott Branden
2014-10-09  7:32                     ` Arnd Bergmann
2014-10-08 13:10       ` Rob Herring
     [not found]         ` <CAL_JsqKD6F5xcUQx8T++uDK2zaqTneRwU+2yR7RMj==ArwcLcA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-10-08 16:34           ` Scott Branden

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140917000018.GI14191@leverpostej \
    --to=mark.rutland@arm.com \
    --cc=Pawel.Moll@arm.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=bcm@fixthebug.org \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=jdzheng@broadcom.com \
    --cc=jonathar@broadcom.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mporter@linaro.org \
    --cc=mturquette@linaro.org \
    --cc=rjui@broadcom.com \
    --cc=robh+dt@kernel.org \
    --cc=sbranden@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).