diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-23 16:31:31 -0700 | 
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-23 16:31:31 -0700 | 
| commit | f01b9b73f57f4f92d39bba0d9aa4a38f318212df (patch) | |
| tree | b815a4477af34f7f6c61dff0c04db6cb975cdd55 /arch/arm/mach-mvebu/system-controller.c | |
| parent | fde75430278130505cac21997cd9f90b7bb2670a (diff) | |
| parent | 66314223aa5e862c9d1d068cb7186b4fd58ebeaa (diff) | |
| download | olio-linux-3.10-f01b9b73f57f4f92d39bba0d9aa4a38f318212df.tar.xz olio-linux-3.10-f01b9b73f57f4f92d39bba0d9aa4a38f318212df.zip  | |
Merge tag 'newsoc' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull support for three new arm SoC types from Arnd Bergmann:
 - The mvebu platform includes Marvell's Armada XP and Armada 370 chips,
   made by the mvebu business unit inside of Marvell.  Since the same
   group also made the older but similar platforms we call "orion5x",
   "kirkwood", "mv78xx0" and "dove", we plan to move all of them into
   the mach-mvebu directory in the future.
 - socfpga is Altera's platform based on Cortex-A9 cores and a lot of
   FPGA space.  This is similar to the Xilinx zynq platform we already
   support.  The code is particularly clean, which is helped by the fact
   that the hardware doesn't do much besides the parts that are expected
   to get added in the FPGA.
 - The OMAP subarchitecture gains support for the latest generation, the
   OMAP5 based on the new Cortex-A15 core.  Support is rather
   rudimentary for now, but will be extended in the future.
* tag 'newsoc' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (25 commits)
  ARM: socfpga: initial support for Altera's SOCFPGA platform
  arm: mvebu: generate DTBs for supported SoCs
  ARM: mvebu: MPIC: read number of interrupts from control register
  arm: mach-mvebu: add entry to MAINTAINERS
  arm: mach-mvebu: add compilation/configuration change
  arm: mach-mvebu: add defconfig
  arm: mach-mvebu: add documentation for new device tree bindings
  arm: mach-mvebu: add support for Armada 370 and Armada XP with DT
  arm: mach-mvebu: add source files
  arm: mach-mvebu: add header
  clocksource: time-armada-370-xp: Marvell Armada 370/XP SoC timer driver
  ARM: Kconfig update to support additional GPIOs in OMAP5
  ARM: OMAP5: Add the build support
  arm/dts: OMAP5: Add omap5 dts files
  ARM: OMAP5: board-generic: Add device tree support
  ARM: omap2+: board-generic: clean up the irq data from board file
  ARM: OMAP5: Add SMP support
  ARM: OMAP5: Add the WakeupGen IP updates
  ARM: OMAP5: l3: Add l3 error handler support for omap5
  ARM: OMAP5: gpmc: Update gpmc_init()
  ...
Conflicts:
	Documentation/devicetree/bindings/arm/omap/omap.txt
	arch/arm/mach-omap2/Makefile
	drivers/clocksource/Kconfig
	drivers/clocksource/Makefile
Diffstat (limited to 'arch/arm/mach-mvebu/system-controller.c')
| -rw-r--r-- | arch/arm/mach-mvebu/system-controller.c | 105 | 
1 files changed, 105 insertions, 0 deletions
diff --git a/arch/arm/mach-mvebu/system-controller.c b/arch/arm/mach-mvebu/system-controller.c new file mode 100644 index 00000000000..b8079df8c98 --- /dev/null +++ b/arch/arm/mach-mvebu/system-controller.c @@ -0,0 +1,105 @@ +/* + * System controller support for Armada 370 and XP platforms. + * + * Copyright (C) 2012 Marvell + * + * Lior Amsalem <alior@marvell.com> + * Gregory CLEMENT <gregory.clement@free-electrons.com> + * Thomas Petazzoni <thomas.petazzoni@free-electrons.com> + * + * This file is licensed under the terms of the GNU General Public + * License version 2.  This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + * + * The Armada 370 and Armada XP SoCs both have a range of + * miscellaneous registers, that do not belong to a particular device, + * but rather provide system-level features. This basic + * system-controller driver provides a device tree binding for those + * registers, and implements utility functions offering various + * features related to those registers. + * + * For now, the feature set is limited to restarting the platform by a + * soft-reset, but it might be extended in the future. + */ + +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/of_address.h> +#include <linux/io.h> + +static void __iomem *system_controller_base; + +struct mvebu_system_controller { +	u32 rstoutn_mask_offset; +	u32 system_soft_reset_offset; + +	u32 rstoutn_mask_reset_out_en; +	u32 system_soft_reset; +}; +static struct mvebu_system_controller *mvebu_sc; + +const struct mvebu_system_controller armada_370_xp_system_controller = { +	.rstoutn_mask_offset = 0x60, +	.system_soft_reset_offset = 0x64, +	.rstoutn_mask_reset_out_en = 0x1, +	.system_soft_reset = 0x1, +}; + +const struct mvebu_system_controller orion_system_controller = { +	.rstoutn_mask_offset = 0x108, +	.system_soft_reset_offset = 0x10c, +	.rstoutn_mask_reset_out_en = 0x4, +	.system_soft_reset = 0x1, +}; + +static struct of_device_id of_system_controller_table[] = { +	{ +		.compatible = "marvell,orion-system-controller", +		.data = (void *) &orion_system_controller, +	}, { +		.compatible = "marvell,armada-370-xp-system-controller", +		.data = (void *) &armada_370_xp_system_controller, +	}, +	{ /* end of list */ }, +}; + +void mvebu_restart(char mode, const char *cmd) +{ +	if (!system_controller_base) { +		pr_err("Cannot restart, system-controller not available: check the device tree\n"); +	} else { +		/* +		 * Enable soft reset to assert RSTOUTn. +		 */ +		writel(mvebu_sc->rstoutn_mask_reset_out_en, +			system_controller_base + +			mvebu_sc->rstoutn_mask_offset); +		/* +		 * Assert soft reset. +		 */ +		writel(mvebu_sc->system_soft_reset, +			system_controller_base + +			mvebu_sc->system_soft_reset_offset); +	} + +	while (1) +		; +} + +static int __init mvebu_system_controller_init(void) +{ +	struct device_node *np; + +	np = of_find_matching_node(NULL, of_system_controller_table); +	if (np) { +		const struct of_device_id *match = +		    of_match_node(of_system_controller_table, np); +		BUG_ON(!match); +		system_controller_base = of_iomap(np, 0); +		mvebu_sc = (struct mvebu_system_controller *)match->data; +	} + +	return 0; +} + +arch_initcall(mvebu_system_controller_init);  |