Skip to content

Commit

Permalink
Merge tag 'metag-for-v3.11' of git://git.kernel.org/pub/scm/linux/ker…
Browse files Browse the repository at this point in the history
…nel/git/jhogan/metag

Pull Metag architecture changes from James Hogan:
 - Infrastructure and DT files for TZ1090 SoC (pin control drivers
   already merged via pinctrl tree).
 - Panic on boot instead of just warning if cache aliasing possible.
 - Various SMP/hotplug fixes.
 - Various other randconfig/sparse fixes.

* tag 'metag-for-v3.11' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/metag: (24 commits)
  metag: move EXPORT_SYMBOL(csum_partial) to metag_ksyms.c
  metag: cpu hotplug: route_irq: preserve irq mask
  metag: kick: add missing irq_enter/exit to kick_handler()
  metag: smp: don't spin waiting for CPU to start
  metag: smp: enable irqs after set_cpu_online
  metag: use clear_tasks_mm_cpumask()
  metag: tz1090: select and instantiate pinctrl-tz1090-pdc
  metag: tz1090: select and instantiate pinctrl-tz1090
  metag: don't check for cache aliasing on smp cpu boot
  metag: panic if cache aliasing possible
  metag: *.dts: include using preprocessor
  metag: add <dt-bindings/> symlink
  metag/.gitignore: Extend the *.dtb pattern to match the dtb.S files
  metag/traps: include setup.h for the per_cpu_trap_init declaration
  metag/traps: Mark die() as __noreturn to match the declaration.
  metag/processor.h: Add missing cpuinfo_op declaration.
  metag/setup: Restrict scope for the capabilities variable
  metag/mm/cache: Restrict scope for metag_lnkget_probe
  metag/asm/irq.h: Declare init_IRQ
  metag/kernel/irq.c: Declare root_domain as static
  ...
  • Loading branch information
torvalds committed Jul 6, 2013
2 parents 16984ce + c20eb0f commit 7644a44
Show file tree
Hide file tree
Showing 27 changed files with 276 additions and 52 deletions.
30 changes: 30 additions & 0 deletions Documentation/devicetree/bindings/metag/meta.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
* Meta Processor Binding

This binding specifies what properties must be available in the device tree
representation of a Meta Processor Core, which is the root node in the tree.

Required properties:

- compatible: Specifies the compatibility list for the Meta processor.
The type shall be <string> and the value shall include "img,meta".

Optional properties:

- clocks: Clock consumer specifiers as described in
Documentation/devicetree/bindings/clock/clock-bindings.txt

- clock-names: Clock consumer names as described in
Documentation/devicetree/bindings/clock/clock-bindings.txt.

Clocks are identified by name. Valid clocks are:

- "core": The Meta core clock from which the Meta timers are derived.

* Examples

/ {
compatible = "toumaz,tz1090", "img,meta";

clocks = <&meta_core_clk>;
clock-names = "core";
};
1 change: 1 addition & 0 deletions Documentation/devicetree/bindings/vendor-prefixes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ snps Synopsys, Inc.
st STMicroelectronics
ste ST-Ericsson
stericsson ST-Ericsson
toumaz Toumaz
ti Texas Instruments
toshiba Toshiba Corporation
v3 V3 Semiconductor
Expand Down
12 changes: 12 additions & 0 deletions arch/metag/Kconfig.soc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ config META21_FPGA
help
This is a Meta 2.1 FPGA bitstream, just a bare CPU.

config SOC_TZ1090
bool "Toumaz Xenif TZ1090 SoC (Comet)"
select METAG_LNKGET_AROUND_CACHE
select METAG_META21
select METAG_SMP_WRITE_REORDERING
select PINCTRL
select PINCTRL_TZ1090
select PINCTRL_TZ1090_PDC
help
This is a Toumaz Technology Xenif TZ1090 (A.K.A. Comet) SoC containing
a 2-threaded HTP.

endchoice

menu "SoC configuration"
Expand Down
2 changes: 1 addition & 1 deletion arch/metag/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ checkflags-$(CONFIG_METAG_META12) += -DMETAC_1_2
checkflags-$(CONFIG_METAG_META21) += -DMETAC_2_1
CHECKFLAGS += -D__metag__ $(checkflags-y)

KBUILD_DEFCONFIG := meta2_defconfig
KBUILD_DEFCONFIG := tz1090_defconfig

sflags-$(CONFIG_METAG_META12) += -mmetac=1.2
ifeq ($(CONFIG_METAG_META12),y)
Expand Down
2 changes: 1 addition & 1 deletion arch/metag/boot/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
vmlinux*
uImage*
ramdisk.*
*.dtb
*.dtb*
2 changes: 2 additions & 0 deletions arch/metag/boot/dts/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
dtb-y += skeleton.dtb
dtb-y += tz1090_generic.dtb

# Built-in dtb
builtindtb-y := skeleton
builtindtb-$(CONFIG_SOC_TZ1090) := tz1090_generic

ifneq ($(CONFIG_METAG_BUILTIN_DTB_NAME),"")
builtindtb-y := $(patsubst "%",%,$(CONFIG_METAG_BUILTIN_DTB_NAME))
Expand Down
1 change: 1 addition & 0 deletions arch/metag/boot/dts/include/dt-bindings
2 changes: 1 addition & 1 deletion arch/metag/boot/dts/skeleton.dts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
*/
/dts-v1/;

/include/ "skeleton.dtsi"
#include "skeleton.dtsi"
41 changes: 41 additions & 0 deletions arch/metag/boot/dts/tz1090.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (C) 2012 Imagination Technologies Ltd.
*
* 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 "skeleton.dtsi"

/ {
compatible = "toumaz,tz1090", "img,meta";

interrupt-parent = <&intc>;

intc: interrupt-controller {
compatible = "img,meta-intc";
interrupt-controller;
#interrupt-cells = <2>;
num-banks = <2>;
};

soc {
compatible = "simple-bus";
#address-cells = <1>;
#size-cells = <1>;
ranges;

pinctrl: pinctrl@02005800 {
#gpio-range-cells = <3>;
compatible = "img,tz1090-pinctrl";
reg = <0x02005800 0xe4>;
};

pdc_pinctrl: pinctrl@02006500 {
#gpio-range-cells = <3>;
compatible = "img,tz1090-pdc-pinctrl";
reg = <0x02006500 0x100>;
};
};
};
10 changes: 10 additions & 0 deletions arch/metag/boot/dts/tz1090_generic.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Copyright (C) 2012 Imagination Technologies Ltd.
*
* 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.
*/
/dts-v1/;

#include "tz1090.dtsi"
42 changes: 42 additions & 0 deletions arch/metag/configs/tz1090_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# CONFIG_LOCALVERSION_AUTO is not set
# CONFIG_SWAP is not set
CONFIG_SYSVIPC=y
CONFIG_SYSFS_DEPRECATED=y
CONFIG_SYSFS_DEPRECATED_V2=y
CONFIG_KALLSYMS_ALL=y
# CONFIG_ELF_CORE is not set
CONFIG_SLAB=y
# CONFIG_BLK_DEV_BSG is not set
CONFIG_PARTITION_ADVANCED=y
# CONFIG_MSDOS_PARTITION is not set
# CONFIG_IOSCHED_DEADLINE is not set
# CONFIG_IOSCHED_CFQ is not set
CONFIG_FLATMEM_MANUAL=y
CONFIG_SOC_TZ1090=y
CONFIG_METAG_HALT_ON_PANIC=y
# CONFIG_METAG_FPU is not set
CONFIG_METAG_DA=y
CONFIG_HZ_100=y
CONFIG_DEVTMPFS=y
# CONFIG_STANDALONE is not set
# CONFIG_PREVENT_FIRMWARE_BUILD is not set
# CONFIG_FW_LOADER is not set
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=1
CONFIG_BLK_DEV_RAM_SIZE=16384
# CONFIG_INPUT is not set
# CONFIG_SERIO is not set
# CONFIG_VT is not set
# CONFIG_LEGACY_PTYS is not set
CONFIG_DA_TTY=y
CONFIG_DA_CONSOLE=y
# CONFIG_DEVKMEM is not set
# CONFIG_HW_RANDOM is not set
CONFIG_GPIOLIB=y
# CONFIG_HWMON is not set
# CONFIG_USB_SUPPORT is not set
# CONFIG_DNOTIFY is not set
CONFIG_TMPFS=y
# CONFIG_MISC_FILESYSTEMS is not set
# CONFIG_SCHED_DEBUG is not set
CONFIG_DEBUG_INFO=y
4 changes: 2 additions & 2 deletions arch/metag/include/asm/bug.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
struct pt_regs;

extern const char *trap_name(int trapno);
extern void die(const char *str, struct pt_regs *regs, long err,
unsigned long addr) __attribute__ ((noreturn));
extern void __noreturn die(const char *str, struct pt_regs *regs, long err,
unsigned long addr);

#endif
8 changes: 8 additions & 0 deletions arch/metag/include/asm/clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,21 @@
* core frequency will be determined like this:
* Meta 1: based on loops_per_jiffy.
* Meta 2: (EXPAND_TIMER_DIV + 1) MHz.
* If a "core" clock is provided by the device tree, it
* will override this function.
*/
struct meta_clock_desc {
unsigned long (*get_core_freq)(void);
};

extern struct meta_clock_desc _meta_clock;

/*
* Perform platform clock initialisation, reading clocks from device tree etc.
* Only accessible during boot.
*/
void init_metag_clocks(void);

/*
* Set up the default clock, ensuring all callbacks are valid - only accessible
* during boot.
Expand Down
1 change: 1 addition & 0 deletions arch/metag/include/asm/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ struct pt_regs;

int tbisig_map(unsigned int hw);
extern void do_IRQ(int irq, struct pt_regs *regs);
extern void init_IRQ(void);

#ifdef CONFIG_METAG_SUSPEND_MEM
int traps_save_context(void);
Expand Down
2 changes: 2 additions & 0 deletions arch/metag/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,4 +199,6 @@ extern void (*soc_halt)(void);
extern void show_trace(struct task_struct *tsk, unsigned long *sp,
struct pt_regs *regs);

extern const struct seq_operations cpuinfo_op;

#endif
13 changes: 7 additions & 6 deletions arch/metag/kernel/cachepart.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,22 +100,23 @@ void check_for_cache_aliasing(int thread_id)
thread_cache_size =
get_thread_cache_size(cache_type, thread_id);
if (thread_cache_size < 0)
pr_emerg("Can't read %s cache size", \
pr_emerg("Can't read %s cache size\n",
cache_type ? "DCACHE" : "ICACHE");
else if (thread_cache_size == 0)
/* Cache is off. No need to check for aliasing */
continue;
if (thread_cache_size / CACHE_ASSOCIATIVITY > PAGE_SIZE) {
pr_emerg("Cache aliasing detected in %s on Thread %d",
pr_emerg("Potential cache aliasing detected in %s on Thread %d\n",
cache_type ? "DCACHE" : "ICACHE", thread_id);
pr_warn("Total %s size: %u bytes",
cache_type ? "DCACHE" : "ICACHE ",
pr_warn("Total %s size: %u bytes\n",
cache_type ? "DCACHE" : "ICACHE",
cache_type ? get_dcache_size()
: get_icache_size());
pr_warn("Thread %s size: %d bytes",
pr_warn("Thread %s size: %d bytes\n",
cache_type ? "CACHE" : "ICACHE",
thread_cache_size);
pr_warn("Page Size: %lu bytes", PAGE_SIZE);
pr_warn("Page Size: %lu bytes\n", PAGE_SIZE);
panic("Potential cache aliasing detected");
}
}
}
Expand Down
59 changes: 58 additions & 1 deletion arch/metag/kernel/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
* published by the Free Software Foundation.
*/

#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/of.h>

#include <asm/param.h>
#include <asm/clock.h>
Expand All @@ -34,8 +36,63 @@ static unsigned long get_core_freq_default(void)
#endif
}

static struct clk *clk_core;

/* Clk based get_core_freq callback. */
static unsigned long get_core_freq_clk(void)
{
return clk_get_rate(clk_core);
}

/**
* init_metag_core_clock() - Set up core clock from devicetree.
*
* Checks to see if a "core" clock is provided in the device tree, and overrides
* the get_core_freq callback to use it.
*/
static void __init init_metag_core_clock(void)
{
/*
* See if a core clock is provided by the devicetree (and
* registered by the init callback above).
*/
struct device_node *node;
node = of_find_compatible_node(NULL, NULL, "img,meta");
if (!node) {
pr_warn("%s: no compatible img,meta DT node found\n",
__func__);
return;
}

clk_core = of_clk_get_by_name(node, "core");
if (IS_ERR(clk_core)) {
pr_warn("%s: no core clock found in DT\n",
__func__);
return;
}

/*
* Override the core frequency callback to use
* this clk.
*/
_meta_clock.get_core_freq = get_core_freq_clk;
}

/**
* init_metag_clocks() - Set up clocks from devicetree.
*
* Set up important clocks from device tree. In particular any needed for clock
* sources.
*/
void __init init_metag_clocks(void)
{
init_metag_core_clock();

pr_info("Core clock frequency: %lu Hz\n", get_coreclock());
}

/**
* setup_meta_clocks() - Set up the Meta clock.
* setup_meta_clocks() - Early set up of the Meta clock.
* @desc: Clock descriptor usually provided by machine description
*
* Ensures all callbacks are valid.
Expand Down
7 changes: 4 additions & 3 deletions arch/metag/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ static union irq_ctx *hardirq_ctx[NR_CPUS] __read_mostly;
static union irq_ctx *softirq_ctx[NR_CPUS] __read_mostly;
#endif

struct irq_domain *root_domain;
static struct irq_domain *root_domain;

static unsigned int startup_meta_irq(struct irq_data *data)
{
Expand Down Expand Up @@ -279,11 +279,12 @@ static void route_irq(struct irq_data *data, unsigned int irq, unsigned int cpu)
{
struct irq_desc *desc = irq_to_desc(irq);
struct irq_chip *chip = irq_data_get_irq_chip(data);
unsigned long flags;

raw_spin_lock_irq(&desc->lock);
raw_spin_lock_irqsave(&desc->lock, flags);
if (chip->irq_set_affinity)
chip->irq_set_affinity(data, cpumask_of(cpu), false);
raw_spin_unlock_irq(&desc->lock);
raw_spin_unlock_irqrestore(&desc->lock, flags);
}

/*
Expand Down
Loading

0 comments on commit 7644a44

Please sign in to comment.