linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: James Hogan <james.hogan@mips.com>
Cc: Ralf Baechle <ralf@linux-mips.org>,
	linux-mips@linux-mips.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 09/13] MIPS: mscc: Add initial support for Microsemi MIPS SoCs
Date: Tue, 28 Nov 2017 17:53:59 +0100	[thread overview]
Message-ID: <20171128165359.GJ21126@piout.net> (raw)
In-Reply-To: <20171128160137.GF27409@jhogan-linux.mipstec.com>

On 28/11/2017 at 16:01:38 +0000, James Hogan wrote:
> Hi Alexandre,
> 
> On Tue, Nov 28, 2017 at 04:26:39PM +0100, Alexandre Belloni wrote:
> > Introduce support for the MIPS based Microsemi Ocelot SoCs.
> > As the plan is to have all SoCs supported only using device tree, the
> > mach directory is simply called mscc.
> 
> Nice. Have you considered adding this to the existing multiplatform
> "generic" platform? See for example commit b35565bb16a5 ("MIPS: generic:
> Add support for MIPSfpga") for the latest platform to be converted.
> 

I didn't because we are currently booting using an old redboot with its
own boot protocol and at boot, the register read by the sead3 code is
completely random (it actually matched once).

Do you consider that mandatory to get the platform upstream?

the plan is to switch to u-boot but we will definitively need to keep
supporting redboot.

> Cheers
> James
> 
> > 
> > Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> > ---
> >  arch/mips/Kbuild.platforms |   1 +
> >  arch/mips/Kconfig          |  24 ++++++++++
> >  arch/mips/mscc/Makefile    |  11 +++++
> >  arch/mips/mscc/Platform    |  12 +++++
> >  arch/mips/mscc/setup.c     | 106 +++++++++++++++++++++++++++++++++++++++++++++
> >  5 files changed, 154 insertions(+)
> >  create mode 100644 arch/mips/mscc/Makefile
> >  create mode 100644 arch/mips/mscc/Platform
> >  create mode 100644 arch/mips/mscc/setup.c
> > 
> > diff --git a/arch/mips/Kbuild.platforms b/arch/mips/Kbuild.platforms
> > index ac7ad54f984f..b3b2f8dc91db 100644
> > --- a/arch/mips/Kbuild.platforms
> > +++ b/arch/mips/Kbuild.platforms
> > @@ -18,6 +18,7 @@ platforms += lantiq
> >  platforms += lasat
> >  platforms += loongson32
> >  platforms += loongson64
> > +platforms += mscc
> >  platforms += mti-malta
> >  platforms += netlogic
> >  platforms += paravirt
> > diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> > index 350a990fc719..a9db028a0338 100644
> > --- a/arch/mips/Kconfig
> > +++ b/arch/mips/Kconfig
> > @@ -527,6 +527,30 @@ config MIPS_MALTA
> >  	  This enables support for the MIPS Technologies Malta evaluation
> >  	  board.
> >  
> > +config MSCC_OCELOT
> > +	bool "Microsemi Ocelot architecture"
> > +	select BOOT_RAW
> > +	select CEVT_R4K
> > +	select CSRC_R4K
> > +	select IRQ_MIPS_CPU
> > +	select DMA_NONCOHERENT
> > +	select SYS_HAS_CPU_MIPS32_R2
> > +	select SYS_SUPPORTS_32BIT_KERNEL
> > +	select SYS_SUPPORTS_BIG_ENDIAN
> > +	select SYS_SUPPORTS_LITTLE_ENDIAN
> > +	select SYS_HAS_EARLY_PRINTK
> > +	select USE_GENERIC_EARLY_PRINTK_8250
> > +	select MSCC_OCELOT_IRQ
> > +	select PINCTRL
> > +	select GPIOLIB
> > +	select COMMON_CLK
> > +	select USE_OF
> > +	select BUILTIN_DTB
> > +	select LIBFDT
> > +	help
> > +	  This enables support for the Microsemi Ocelot architecture.
> > +	  It builds a generic DT-based kernel image.
> > +
> >  config MACH_PIC32
> >  	bool "Microchip PIC32 Family"
> >  	help
> > diff --git a/arch/mips/mscc/Makefile b/arch/mips/mscc/Makefile
> > new file mode 100644
> > index 000000000000..c96b13546730
> > --- /dev/null
> > +++ b/arch/mips/mscc/Makefile
> > @@ -0,0 +1,11 @@
> > +# SPDX-License-Identifier: (GPL-2.0 OR MIT)
> > +#
> > +# Microsemi MIPS SoC support
> > +#
> > +# License: Dual MIT/GPL
> > +# Copyright (c) 2017 Microsemi Corporation
> > +
> > +#
> > +# Makefile for the Microsemi MIPS SoCs
> > +#
> > +obj-y := setup.o
> > diff --git a/arch/mips/mscc/Platform b/arch/mips/mscc/Platform
> > new file mode 100644
> > index 000000000000..9ae874c8f136
> > --- /dev/null
> > +++ b/arch/mips/mscc/Platform
> > @@ -0,0 +1,12 @@
> > +# SPDX-License-Identifier: (GPL-2.0 OR MIT)
> > +#
> > +# Microsemi MIPS SoC support
> > +#
> > +# License: Dual MIT/GPL
> > +# Copyright (c) 2017 Microsemi Corporation
> > +
> > +#
> > +# Microsemi Ocelot board(s)
> > +#
> > +platform-$(CONFIG_MSCC_OCELOT) += mscc/
> > +load-$(CONFIG_MSCC_OCELOT)	 += 0x80100000
> > diff --git a/arch/mips/mscc/setup.c b/arch/mips/mscc/setup.c
> > new file mode 100644
> > index 000000000000..77803edd7bfd
> > --- /dev/null
> > +++ b/arch/mips/mscc/setup.c
> > @@ -0,0 +1,106 @@
> > +// SPDX-License-Identifier: (GPL-2.0 OR MIT)
> > +/*
> > + * Microsemi MIPS SoC support
> > + *
> > + * License: Dual MIT/GPL
> > + * Copyright (c) 2017 Microsemi Corporation
> > + */
> > +#include <linux/delay.h>
> > +#include <linux/export.h>
> > +#include <linux/init.h>
> > +#include <linux/irq.h>
> > +#include <linux/irqchip.h>
> > +#include <linux/libfdt.h>
> > +#include <linux/of_fdt.h>
> > +#include <linux/of_platform.h>
> > +#include <linux/reboot.h>
> > +
> > +#include <asm/time.h>
> > +#include <asm/idle.h>
> > +#include <asm/prom.h>
> > +#include <asm/reboot.h>
> > +
> > +static void __init ocelot_earlyprintk_init(void)
> > +{
> > +	void __iomem *uart_base;
> > +
> > +	uart_base = ioremap_nocache(0x70100000, 0x0f);
> > +	setup_8250_early_printk_port((unsigned long)uart_base, 2, 50000);
> > +}
> > +
> > +void __init prom_init(void)
> > +{
> > +	/* Sanity check for defunct bootloader */
> > +	if (fw_arg0 < 10 && (fw_arg1 & 0xFFF00000) == 0x80000000) {
> > +		unsigned int prom_argc = fw_arg0;
> > +		const char **prom_argv = (const char **)fw_arg1;
> > +
> > +		if (prom_argc > 1 && strlen(prom_argv[1]) > 0)
> > +			/* ignore all built-in args if any f/w args given */
> > +			strcpy(arcs_cmdline, prom_argv[1]);
> > +	}
> > +}
> > +
> > +void __init prom_free_prom_memory(void)
> > +{
> > +}
> > +
> > +unsigned int get_c0_compare_int(void)
> > +{
> > +	return CP0_LEGACY_COMPARE_IRQ;
> > +}
> > +
> > +void __init plat_time_init(void)
> > +{
> > +	struct device_node *np;
> > +	u32 freq;
> > +
> > +	np = of_find_node_by_name(NULL, "cpus");
> > +	if (!np)
> > +		panic("missing 'cpus' DT node");
> > +	if (of_property_read_u32(np, "mips-hpt-frequency", &freq) < 0)
> > +		panic("missing 'mips-hpt-frequency' property");
> > +	of_node_put(np);
> > +
> > +	mips_hpt_frequency = freq;
> > +}
> > +
> > +void __init arch_init_irq(void)
> > +{
> > +	irqchip_init();
> > +}
> > +
> > +const char *get_system_type(void)
> > +{
> > +	return "Microsemi Ocelot";
> > +}
> > +
> > +static void __init ocelot_late_init(void)
> > +{
> > +	ocelot_earlyprintk_init();
> > +}
> > +
> > +extern void (*late_time_init)(void);
> > +
> > +void __init plat_mem_setup(void)
> > +{
> > +	/* This has to be done so late because ioremap needs to work */
> > +	late_time_init = ocelot_late_init;
> > +
> > +	__dt_setup_arch(__dtb_start);
> > +}
> > +
> > +void __init device_tree_init(void)
> > +{
> > +	if (!initial_boot_params)
> > +		return;
> > +
> > +	unflatten_and_copy_device_tree();
> > +}
> > +
> > +static int __init populate_machine(void)
> > +{
> > +	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
> > +	return 0;
> > +}
> > +arch_initcall(populate_machine);
> > -- 
> > 2.15.0
> > 
> > 



-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  reply	other threads:[~2017-11-28 16:54 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-28 15:26 [PATCH 00/13] MIPS: add support for the Microsemi MIPS SoCs Alexandre Belloni
2017-11-28 15:26 ` [PATCH 01/13] dt-bindings: Add vendor prefix for Microsemi Corporation Alexandre Belloni
2017-11-28 16:10   ` James Hogan
2017-11-28 16:22     ` Alexandre Belloni
2017-12-01  1:14       ` Rob Herring
2017-11-28 15:26 ` [PATCH 02/13] dt-bindings: interrupt-controller: Add binding for the Microsemi Ocelot interrupt controller Alexandre Belloni
2017-12-01  1:15   ` Rob Herring
2017-11-28 15:26 ` [PATCH 03/13] irqchip: Add a driver for the Microsemi Ocelot controller Alexandre Belloni
2017-11-28 15:26 ` [PATCH 04/13] dt-bindings: pinctrl: Add bindings for Microsemi Ocelot Alexandre Belloni
2017-12-01  1:16   ` Rob Herring
2017-11-28 15:26 ` [PATCH 05/13] pinctrl: Add Microsemi Ocelot SoC driver Alexandre Belloni
2017-11-28 15:26 ` [PATCH 06/13] dt-bindings: power: reset: Document ocelot-reset binding Alexandre Belloni
2017-12-01  1:54   ` Rob Herring
2017-11-28 15:26 ` [PATCH 07/13] power: reset: Add a driver for the Microsemi Ocelot reset Alexandre Belloni
2017-11-28 15:26 ` [PATCH 08/13] dt-bindings: mips: Add bindings for Microsemi SoCs Alexandre Belloni
2017-11-28 19:14   ` Florian Fainelli
2017-11-28 15:26 ` [PATCH 09/13] MIPS: mscc: Add initial support for Microsemi MIPS SoCs Alexandre Belloni
2017-11-28 16:01   ` James Hogan
2017-11-28 16:53     ` Alexandre Belloni [this message]
2017-11-28 17:31       ` James Hogan
2017-11-28 19:50         ` Paul Burton
2017-11-29 16:38           ` Alexandre Belloni
2018-01-17 23:58             ` James Hogan
2018-03-02 15:22               ` Alexandre Belloni
2017-11-28 15:26 ` [PATCH 10/13] MIPS: mscc: add ocelot dtsi Alexandre Belloni
2017-11-28 18:40   ` Florian Fainelli
2017-11-28 15:26 ` [PATCH 11/13] MIPS: mscc: add ocelot PCB123 device tree Alexandre Belloni
2017-11-28 15:26 ` [PATCH 12/13] MIPS: defconfigs: add a defconfig for Microsemi SoCs Alexandre Belloni
2017-11-28 15:26 ` [PATCH 13/13] MAINTAINERS: Add entry for Microsemi MIPS SoCs Alexandre Belloni
2017-11-28 15:34   ` Joe Perches
2017-11-28 15:44     ` Alexandre Belloni

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=20171128165359.GJ21126@piout.net \
    --to=alexandre.belloni@free-electrons.com \
    --cc=james.hogan@mips.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    /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).