Skip to contentSkip to conversation

Add basic support for Telechips TCC8xxx SoCs

PATCH Superseded Hans J. Koch 2 participants 20 messages Mar 25, 2010 – Mar 27, 2010

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add basic support for Telechips TCC8xxx SoCs

This is v2 of my patch series to introduce basic support for Telechips TCC8xxx SoCs. It addresses the issues found after v1. They're all in [PATCH 5/7] (mapping of DTCM and SDRAM). I threw out both mappings. They've got no users right now, and the datasheet is not very clear about the DTCM. I need to get more information from Telechips and run my own tests.

Please review.

Thanks,
Hans

#2 lore raw

PATCH v2 1/7 Introduce plat-tcc

Review

Quoted 4 lines · Hans J. Koch
(quoted diff) +4 -0
+#define __virt_to_bus(x)	__virt_to_phys(x)
+#define __bus_to_virt(x)	__phys_to_virt(x)
+#define __pfn_to_bus(x)		__pfn_to_phys(x)
+#define __bus_to_pfn(x)		__phys_to_pfn(x)

You don't need to define any of these.

Quoted 6 lines
arch/arm/plat-tcc/include/mach/vmalloc.h new file +0 -0
new file mode 100644
index 0000000..9635303

arch/arm/plat-tcc/include/mach/vmalloc.h line 10

Quoted 10 lines
arch/arm/plat-tcc/include/mach/vmalloc.h new file +10 -0
@@ -0,0 +1,11 @@
+/*
+ * Author: <[email protected]>
+ * Created: June 10, 2008
+ *
+ * Copyright (C) 2000 Russell King.
+ * Copyright (C) 2008-2009 Telechips
+ *
+ * Licensed under the terms of the GPL v2.
+ */
+#define VMALLOC_END	  (PAGE_OFFSET + 0x10000000)

Base address of IO rather than something dependent on PAGE_OFFSET?

Quoted 7 lines
arch/arm/plat-tcc/include/mach/vmalloc.h new file +1 -0
+
arch/arm/plat-tcc/system.c new file +0 -0
new file mode 100644
index 0000000..1a33ced

arch/arm/plat-tcc/system.c line 10

Quoted 10 lines
arch/arm/plat-tcc/system.c new file +10 -0
@@ -0,0 +1,24 @@
+/*
+ * System functions for Telechips TCCxxxx SoCs
+ *
+ * Copyright (C) Hans J. Koch <[email protected]>
+ *
+ * Licensed under the terms of the GPL v2.
+ *
+ */
+
+#include <asm/io.h>

linux/io.h ?

Quoted 22 lines
arch/arm/plat-tcc/system.c new file +14 -0
+#include <mach/tcc8k-regs.h>
+
+/* System reboot */
+void plat_tcc_reboot(void)
+{
+	/* Make sure clocks are on */
+	__raw_writel(0xffffffff, CKC_BASE + BCLKCTR0_OFFS);
+
+	/* Enable watchdog reset */
+	__raw_writel(0x49, TIMER_BASE + TWDCFG_OFFS);
+	/* Wait for reset */
+	unreachable();
+}
+
Signature · 7 lines
1.6.3.3


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#3 lore raw

PATCH v2 1/7 Introduce plat-tcc

Quoted 7 lines · Russell King - ARM Linux

Review

Quoted 4 lines · Hans J. Koch
(quoted diff) +4 -0
+#define __virt_to_bus(x)	__virt_to_phys(x)
+#define __bus_to_virt(x)	__phys_to_virt(x)
+#define __pfn_to_bus(x)		__pfn_to_phys(x)
+#define __bus_to_pfn(x)		__phys_to_pfn(x)

You don't need to define any of these.

Right. Removed.

Quoted 11 lines
Quoted 11 lines
arch/arm/plat-tcc/include/mach/vmalloc.h new file +4 -0
new file mode 100644
index 0000000..9635303
@@ -0,0 +1,11 @@
+/*
+ * Author: <[email protected]>
+ * Created: June 10, 2008
+ *
Quoted 8 lines

arch/arm/plat-tcc/include/mach/vmalloc.h line 10

Quoted 6 lines
arch/arm/plat-tcc/include/mach/vmalloc.h new file +6 -0
+ * Copyright (C) 2000 Russell King.
+ * Copyright (C) 2008-2009 Telechips
+ *
+ * Licensed under the terms of the GPL v2.
+ */
+#define VMALLOC_END	  (PAGE_OFFSET + 0x10000000)

Base address of IO rather than something dependent on PAGE_OFFSET?

Fixed.

Quoted 12 lines
Quoted 12 lines
arch/arm/plat-tcc/include/mach/vmalloc.h new file +1 -0
+
arch/arm/plat-tcc/system.c new file +4 -0
new file mode 100644
index 0000000..1a33ced
@@ -0,0 +1,24 @@
+/*
+ * System functions for Telechips TCCxxxx SoCs
+ *
+ * Copyright (C) Hans J. Koch <[email protected]>
Quoted 8 lines

arch/arm/plat-tcc/system.c line 10

Quoted 6 lines
arch/arm/plat-tcc/system.c new file +6 -0
+ *
+ * Licensed under the terms of the GPL v2.
+ *
+ */
+
+#include <asm/io.h>

linux/io.h ?

OK.

Thanks,
Hans

#5 lore raw

PATCH v2 2/7 Add clock framework for plat-tcc

Review

Quoted 2 lines · Hans J. Koch
(quoted diff) +2 -0
+#define BCLKCTR0	(void __iomem *)(CKC_BASE + BCLKCTR0_OFFS)
+#define BCLKCTR1	(void __iomem *)(CKC_BASE + BCLKCTR1_OFFS)

If you define CKC_BASE to have type 'void __iomem *' then all these cases go away.

Review

Quoted 1 line
(quoted diff) +1 -0
+	reg = __raw_readl(CKC_BASE + CLKCTRL_OFFS);

And this won't warn in the future.

#6 lore raw

PATCH v2 2/7 Add clock framework for plat-tcc

Quoted 6 lines · Russell King - ARM Linux

Review

Quoted 2 lines · Hans J. Koch
(quoted diff) +2 -0
+#define BCLKCTR0	(void __iomem *)(CKC_BASE + BCLKCTR0_OFFS)
+#define BCLKCTR1	(void __iomem *)(CKC_BASE + BCLKCTR1_OFFS)

If you define CKC_BASE to have type 'void __iomem *' then all these cases go away.

Done.

Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +1 -0
+	reg = __raw_readl(CKC_BASE + CLKCTRL_OFFS);

And this won't warn in the future.

Right :)

Thanks,
Hans

#8 lore raw

PATCH v2 3/7 Introduce plat-tcc irq framework

Review

Quoted 9 lines · Hans J. Koch
(quoted diff) +9 -0
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/sched.h>
+#include <linux/interrupt.h>
+#include <linux/ptrace.h>
+
+#include <asm/irq.h>
+#include <asm/mach/irq.h>
+#include <asm/io.h>

linux/io.h

#9 lore raw

PATCH v2 3/7 Introduce plat-tcc irq framework

Quoted 12 lines · Russell King - ARM Linux

Review

Quoted 9 lines · Hans J. Koch
(quoted diff) +9 -0
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/sched.h>
+#include <linux/interrupt.h>
+#include <linux/ptrace.h>
+
+#include <asm/irq.h>
+#include <asm/mach/irq.h>
+#include <asm/io.h>

linux/io.h

Yep, and <linux/sched.h>, <linux/interrupt.h>, and <linux/ptrace.h> are not needed at all. Fixed.

Thanks,
Hans

#11 lore raw

PATCH v2 4/7 Add TCC8xxx system timer

Quoted 14 lines · Hans J. Koch
arch/arm/mach-tcc8k/time.c new file +8 -0
new file mode 100644
index 0000000..db0a6da
@@ -0,0 +1,150 @@
+/*
+ * TCC8000 system timer setup
+ *
+ * (C) 2009 Hans J. Koch <[email protected]>
+ *
+ * Licensed under the terms of the GPL version 2.
+ *
+ */

arch/arm/mach-tcc8k/time.c line 18

Quoted 10 lines
arch/arm/mach-tcc8k/time.c new file +10 -0
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/spinlock.h>
+#include <linux/irq.h>
+#include <linux/clk.h>
+#include <linux/clockchips.h>
+
+#include <asm/io.h>

linux/io.h

arch/arm/mach-tcc8k/time.c line 25

Quoted 7 lines
arch/arm/mach-tcc8k/time.c new file +7 -0
+#include <asm/mach/time.h>
+
+#include <mach/tcc8k-regs.h>
+#include <mach/irqs.h>
+
+static void __iomem *timer_base;
+static struct clock_event_device clockevent_tcc;

You don't need this.

arch/arm/mach-tcc8k/time.c line 26

Quoted 1 line
arch/arm/mach-tcc8k/time.c new file +1 -0
+static enum clock_event_mode clockevent_mode = CLOCK_EVT_MODE_UNUSED;

Do you need to keep this state around?

Quoted 42 lines
arch/arm/mach-tcc8k/time.c new file +42 -0
+
+static cycle_t tcc_get_cycles(struct clocksource *cs)
+{
+	return __raw_readl(timer_base + TC32MCNT_OFFS);
+}
+
+static struct clocksource clocksource_tcc = {
+	.name		= "tcc_tc32",
+	.rating		= 200,
+	.read		= tcc_get_cycles,
+	.mask		= CLOCKSOURCE_MASK(32),
+	.shift		= 28,
+	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
+};
+
+static int tcc_set_next_event(unsigned long evt,
+			      struct clock_event_device *unused)
+{
+	unsigned long reg = __raw_readl(timer_base + TC32MCNT_OFFS);
+
+	__raw_writel(reg + evt, timer_base + TC32CMP0_OFFS);
+	return 0;
+}
+
+static void tcc_set_mode(enum clock_event_mode mode,
+				struct clock_event_device *evt)
+{
+	unsigned long tc32irq;
+
+	clockevent_mode = mode;
+
+	switch (mode) {
+	case CLOCK_EVT_MODE_ONESHOT:
+		tc32irq = __raw_readl(timer_base + TC32IRQ_OFFS);
+		tc32irq |= TC32IRQ_IRQEN0;
+		__raw_writel(tc32irq, timer_base + TC32IRQ_OFFS);
+		break;
+	case CLOCK_EVT_MODE_SHUTDOWN:
+	case CLOCK_EVT_MODE_UNUSED:
+		tc32irq = __raw_readl(timer_base + TC32IRQ_OFFS);
+		tc32irq &= ~TC32IRQ_IRQEN0;
+		__raw_writel(tc32irq, timer_base + TC32IRQ_OFFS);

arch/arm/mach-tcc8k/time.c line 78

Quoted 10 lines
arch/arm/mach-tcc8k/time.c new file +10 -0
+		break;
+	case CLOCK_EVT_MODE_PERIODIC:
+	case CLOCK_EVT_MODE_RESUME:
+		break;
+	}
+}
+
+static irqreturn_t tcc8k_timer_interrupt(int irq, void *dev_id)
+{
+	struct clock_event_device *evt = &clockevent_tcc;

Change this to:

	struct clock_event_device *evt = dev_id;
Quoted 13 lines
arch/arm/mach-tcc8k/time.c new file +13 -0
+
+	/* Acknowledge TC32 interrupt by reading TC32IRQ */
+	__raw_readl(timer_base + TC32IRQ_OFFS);
+
+	evt->event_handler(evt);
+
+	return IRQ_HANDLED;
+}
+
+static struct irqaction tcc8k_timer_irq = {
+	.name		= "TC32_timer",
+	.flags		= IRQF_DISABLED | IRQF_TIMER,
+	.handler	= tcc8k_timer_interrupt,

arch/arm/mach-tcc8k/time.c line 101

Quoted 10 lines
arch/arm/mach-tcc8k/time.c new file +10 -0
+};
+
+static struct clock_event_device clockevent_tcc = {
+	.name		= "tcc_timer1",
+	.features	= CLOCK_EVT_FEAT_ONESHOT,
+	.shift		= 32,
+	.set_mode	= tcc_set_mode,
+	.set_next_event	= tcc_set_next_event,
+	.rating		= 200,
+};

And add:
static struct irqaction tcc8k_timer_irq = {
.name = "TC32_timer",
.flags = IRQF_DISABLED | IRQF_TIMER,
.handler = tcc8k_timer_interrupt,
+ .dev_id = &clockevent_tcc,
};

#12 lore raw

PATCH v2 4/7 Add TCC8xxx system timer

Quoted 19 lines · Russell King - ARM Linux
Quoted 18 lines · Hans J. Koch
arch/arm/mach-tcc8k/time.c new file +12 -0
new file mode 100644
index 0000000..db0a6da
@@ -0,0 +1,150 @@
+/*
+ * TCC8000 system timer setup
+ *
+ * (C) 2009 Hans J. Koch <[email protected]>
+ *
+ * Licensed under the terms of the GPL version 2.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
Quoted 8 lines

arch/arm/mach-tcc8k/time.c line 18

Quoted 6 lines
arch/arm/mach-tcc8k/time.c new file +6 -0
+#include <linux/spinlock.h>
+#include <linux/irq.h>
+#include <linux/clk.h>
+#include <linux/clockchips.h>
+
+#include <asm/io.h>

linux/io.h

OK.

Quoted 10 lines

arch/arm/mach-tcc8k/time.c line 25

Quoted 8 lines
arch/arm/mach-tcc8k/time.c new file +7 -0
+#include <asm/mach/time.h>
+
+#include <mach/tcc8k-regs.h>
+#include <mach/irqs.h>
+
+static void __iomem *timer_base;
+static struct clock_event_device clockevent_tcc;

You don't need this.

OK.

Quoted 4 lines

arch/arm/mach-tcc8k/time.c line 26

Quoted 2 lines
arch/arm/mach-tcc8k/time.c new file +1 -0
+static enum clock_event_mode clockevent_mode = CLOCK_EVT_MODE_UNUSED;

Do you need to keep this state around?

Not really. Removed.

Quoted 55 lines
Quoted 43 lines
arch/arm/mach-tcc8k/time.c new file +42 -0
+
+static cycle_t tcc_get_cycles(struct clocksource *cs)
+{
+	return __raw_readl(timer_base + TC32MCNT_OFFS);
+}
+
+static struct clocksource clocksource_tcc = {
+	.name		= "tcc_tc32",
+	.rating		= 200,
+	.read		= tcc_get_cycles,
+	.mask		= CLOCKSOURCE_MASK(32),
+	.shift		= 28,
+	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
+};
+
+static int tcc_set_next_event(unsigned long evt,
+			      struct clock_event_device *unused)
+{
+	unsigned long reg = __raw_readl(timer_base + TC32MCNT_OFFS);
+
+	__raw_writel(reg + evt, timer_base + TC32CMP0_OFFS);
+	return 0;
+}
+
+static void tcc_set_mode(enum clock_event_mode mode,
+				struct clock_event_device *evt)
+{
+	unsigned long tc32irq;
+
+	clockevent_mode = mode;
+
+	switch (mode) {
+	case CLOCK_EVT_MODE_ONESHOT:
+		tc32irq = __raw_readl(timer_base + TC32IRQ_OFFS);
+		tc32irq |= TC32IRQ_IRQEN0;
+		__raw_writel(tc32irq, timer_base + TC32IRQ_OFFS);
+		break;
+	case CLOCK_EVT_MODE_SHUTDOWN:
+	case CLOCK_EVT_MODE_UNUSED:
+		tc32irq = __raw_readl(timer_base + TC32IRQ_OFFS);
+		tc32irq &= ~TC32IRQ_IRQEN0;
+		__raw_writel(tc32irq, timer_base + TC32IRQ_OFFS);

arch/arm/mach-tcc8k/time.c line 78

Quoted 10 lines
arch/arm/mach-tcc8k/time.c new file +10 -0
+		break;
+	case CLOCK_EVT_MODE_PERIODIC:
+	case CLOCK_EVT_MODE_RESUME:
+		break;
+	}
+}
+
+static irqreturn_t tcc8k_timer_interrupt(int irq, void *dev_id)
+{
+	struct clock_event_device *evt = &clockevent_tcc;

Change this to:

Quoted 1 line
	struct clock_event_device *evt = dev_id;

Done.

Quoted 27 lines
Quoted 14 lines
arch/arm/mach-tcc8k/time.c new file +13 -0
+
+	/* Acknowledge TC32 interrupt by reading TC32IRQ */
+	__raw_readl(timer_base + TC32IRQ_OFFS);
+
+	evt->event_handler(evt);
+
+	return IRQ_HANDLED;
+}
+
+static struct irqaction tcc8k_timer_irq = {
+	.name		= "TC32_timer",
+	.flags		= IRQF_DISABLED | IRQF_TIMER,
+	.handler	= tcc8k_timer_interrupt,

arch/arm/mach-tcc8k/time.c line 101

Quoted 10 lines
arch/arm/mach-tcc8k/time.c new file +10 -0
+};
+
+static struct clock_event_device clockevent_tcc = {
+	.name		= "tcc_timer1",
+	.features	= CLOCK_EVT_FEAT_ONESHOT,
+	.shift		= 32,
+	.set_mode	= tcc_set_mode,
+	.set_next_event	= tcc_set_next_event,
+	.rating		= 200,
+};

And add:
static struct irqaction tcc8k_timer_irq = {

Review

Quoted 5 lines
(quoted diff) +1 -0
 	.name		= "TC32_timer",
 	.flags		= IRQF_DISABLED | IRQF_TIMER,
 	.handler	= tcc8k_timer_interrupt,
+	.dev_id		= &clockevent_tcc,
 };

OK, done.

Thanks,
Hans

#14 lore raw

PATCH v2 5/7 Basic IO mappings for mach-tcc8k

Review

Quoted 4 lines · Hans J. Koch
(quoted diff) +4 -0
+#include <linux/kernel.h>
+#include <linux/init.h>
+
+#include <asm/tlb.h>

You don't need asm/tlb.h in this file.

Review

Quoted 2 lines
(quoted diff) +2 -0
+#include <asm/mach/map.h>
+#include <asm/io.h>

linux/io.h

Quoted 5 lines
(quoted diff) +5 -0
+
+#include <mach/tcc8k-regs.h>
+
+/*
+ * The machine specific code may provide the extra mapping besides the

Review

Quoted 10 lines
(quoted diff) +10 -0
+ * default mapping provided here.
+ */
+static struct map_desc tcc8k_io_desc[] __initdata = {
+	{
+		.virtual	= CS1_BASE_VIRT,	/* CS1 (CS8900) */
+		.pfn		= __phys_to_pfn(CS1_BASE),
+		.length		= CS1_SIZE,
+		.type		= MT_DEVICE
+	},
+	{
	}, {

is more conventional and avoids using up valuable vertical screen realestate.

Quoted 54 lines
(quoted diff) +34 -0
+		.virtual	= AHB_PERI_BASE_VIRT,	/* AHB peripherals */
+		.pfn		= __phys_to_pfn(AHB_PERI_BASE),
+		.length		= AHB_PERI_SIZE,
+		.type		= MT_DEVICE
+	},
+	{
+		.virtual	= APB0_PERI_BASE_VIRT,	/* APB peripherals */
+		.pfn		= __phys_to_pfn(APB0_PERI_BASE),
+		.length		= APB0_PERI_SIZE,
+		.type		= MT_DEVICE
+	},
+	{
+		.virtual	= APB1_PERI_BASE_VIRT,	/* APB peripherals */
+		.pfn		= __phys_to_pfn(APB1_PERI_BASE),
+		.length		= APB1_PERI_SIZE,
+		.type		= MT_DEVICE
+	},
+	{
+		.virtual	= EXT_MEM_CTRL_BASE_VIRT, /* Ext. mem.contr. */
+		.pfn		= __phys_to_pfn(EXT_MEM_CTRL_BASE),
+		.length		= EXT_MEM_CTRL_SIZE,
+		.type		= MT_DEVICE
+	},
+};
+
+/*
+ * Maps common IO regions for tcc8k.
+ *
+ */
+void __init tcc8k_map_common_io(void)
+{
+	iotable_init(tcc8k_io_desc, ARRAY_SIZE(tcc8k_io_desc));
+}
+
arch/arm/plat-tcc/include/mach/io.h new file +14 -0
new file mode 100644
index 0000000..7d84370
@@ -0,0 +1,53 @@
+/*
+ * Based on:    linux/include/asm-arm/arch-sa1100/io.h
+ * Author : <[email protected]>
+ * Created: June 10, 2008
+ * Description: IO definitions for TCC8300 processors and boards
+ *
+ * Copyright (C) 1997-1999 Russell King
+ * Copyright (C) 2008-2009 Telechips
+ *
+ * Modifications for mainline (C) 2009 Hans J. Koch <[email protected]>
+ *
+ * Licensed under the terms of the GNU Public License version 2.
+ */
+

arch/arm/plat-tcc/include/mach/io.h line 24

Quoted 10 lines
arch/arm/plat-tcc/include/mach/io.h new file +10 -0
+#ifndef __ASM_ARM_ARCH_IO_H
+#define __ASM_ARM_ARCH_IO_H
+
+#define IO_SPACE_LIMIT 0xffffffff
+
+/*
+ * We don't actually have real ISA nor PCI buses, but there is so many
+ * drivers out there that might just work if we fake them...
+ */
+#define __io(a)			((void __iomem *)(PCIO_BASE + (a)))

#define __io(a) __typesafe_io(a)

please.

Quoted 8 lines
arch/arm/plat-tcc/include/mach/io.h new file +8 -0
+#define __mem_pci(a)		(a)
+
+/*
+ * ----------------------------------------------------------------------------
+ * I/O mapping
+ * ----------------------------------------------------------------------------
+ */
+

arch/arm/plat-tcc/include/mach/io.h line 42

Quoted 10 lines
arch/arm/plat-tcc/include/mach/io.h new file +10 -0
+#define PCIO_BASE	0
+
+/* Address Map of Internal Peripherials (Base 0x80000000) */
+#define IO_PHYS_A			0x80000000
+#define IO_OFFSET_A			0x70000000 /* Virtual IO = 0xF0000000 */
+#define IO_SIZE_A			0x100000
+#define IO_VIRT_A			(IO_PHYS + IO_OFFSET)
+#define IO_ADDRESS_A(pa)	((pa) + IO_OFFSET)
+#define IO_P2V_A(pa)		((pa) + IO_OFFSET)
+#define IO_V2P_A(va)		((va) - IO_OFFSET)

Where is IO_OFFSET defined?

arch/arm/plat-tcc/include/mach/io.h line 51

Quoted 9 lines
arch/arm/plat-tcc/include/mach/io.h new file +9 -0
+
+/* Address Map of Internal Peripherials (Base 0x90000000) */
+#define IO_PHYS_B			0x90000000
+#define IO_OFFSET_B			0x61000000 /* Virtual IO = 0xF1000000 */
+#define IO_SIZE_B			0x100000
+#define IO_VIRT_B			(IO_PHYS + IO_OFFSET)
+#define IO_ADDRESS_B(pa)	((pa) + IO_OFFSET)
+#define IO_P2V_B(pa)		((pa) + IO_OFFSET)
+#define IO_V2P_B(va)		((va) - IO_OFFSET)

Ditto. Would also be useful if they were typesafe.

#15 lore raw

PATCH v2 5/7 Basic IO mappings for mach-tcc8k

Quoted 7 lines · Russell King - ARM Linux

Review

Quoted 4 lines · Hans J. Koch
(quoted diff) +4 -0
+#include <linux/kernel.h>
+#include <linux/init.h>
+
+#include <asm/tlb.h>

You don't need asm/tlb.h in this file.

Removed.

Quoted 5 lines

Review

Quoted 3 lines
(quoted diff) +2 -0
+#include <asm/mach/map.h>
+#include <asm/io.h>

linux/io.h

OK.

Quoted 19 lines
Quoted 6 lines
(quoted diff) +5 -0
+
+#include <mach/tcc8k-regs.h>
+
+/*
+ * The machine specific code may provide the extra mapping besides the

Review

Quoted 10 lines
(quoted diff) +10 -0
+ * default mapping provided here.
+ */
+static struct map_desc tcc8k_io_desc[] __initdata = {
+	{
+		.virtual	= CS1_BASE_VIRT,	/* CS1 (CS8900) */
+		.pfn		= __phys_to_pfn(CS1_BASE),
+		.length		= CS1_SIZE,
+		.type		= MT_DEVICE
+	},
+	{
	}, {
Quoted 2 lines

is more conventional and avoids using up valuable vertical screen realestate.

Right, fixed.

Quoted 68 lines
Quoted 55 lines
(quoted diff) +34 -0
+		.virtual	= AHB_PERI_BASE_VIRT,	/* AHB peripherals */
+		.pfn		= __phys_to_pfn(AHB_PERI_BASE),
+		.length		= AHB_PERI_SIZE,
+		.type		= MT_DEVICE
+	},
+	{
+		.virtual	= APB0_PERI_BASE_VIRT,	/* APB peripherals */
+		.pfn		= __phys_to_pfn(APB0_PERI_BASE),
+		.length		= APB0_PERI_SIZE,
+		.type		= MT_DEVICE
+	},
+	{
+		.virtual	= APB1_PERI_BASE_VIRT,	/* APB peripherals */
+		.pfn		= __phys_to_pfn(APB1_PERI_BASE),
+		.length		= APB1_PERI_SIZE,
+		.type		= MT_DEVICE
+	},
+	{
+		.virtual	= EXT_MEM_CTRL_BASE_VIRT, /* Ext. mem.contr. */
+		.pfn		= __phys_to_pfn(EXT_MEM_CTRL_BASE),
+		.length		= EXT_MEM_CTRL_SIZE,
+		.type		= MT_DEVICE
+	},
+};
+
+/*
+ * Maps common IO regions for tcc8k.
+ *
+ */
+void __init tcc8k_map_common_io(void)
+{
+	iotable_init(tcc8k_io_desc, ARRAY_SIZE(tcc8k_io_desc));
+}
+
arch/arm/plat-tcc/include/mach/io.h new file +14 -0
new file mode 100644
index 0000000..7d84370
@@ -0,0 +1,53 @@
+/*
+ * Based on:    linux/include/asm-arm/arch-sa1100/io.h
+ * Author : <[email protected]>
+ * Created: June 10, 2008
+ * Description: IO definitions for TCC8300 processors and boards
+ *
+ * Copyright (C) 1997-1999 Russell King
+ * Copyright (C) 2008-2009 Telechips
+ *
+ * Modifications for mainline (C) 2009 Hans J. Koch <[email protected]>
+ *
+ * Licensed under the terms of the GNU Public License version 2.
+ */
+

arch/arm/plat-tcc/include/mach/io.h line 24

Quoted 10 lines
arch/arm/plat-tcc/include/mach/io.h new file +10 -0
+#ifndef __ASM_ARM_ARCH_IO_H
+#define __ASM_ARM_ARCH_IO_H
+
+#define IO_SPACE_LIMIT 0xffffffff
+
+/*
+ * We don't actually have real ISA nor PCI buses, but there is so many
+ * drivers out there that might just work if we fake them...
+ */
+#define __io(a)			((void __iomem *)(PCIO_BASE + (a)))

#define __io(a) __typesafe_io(a)

Quoted 1 line

please.

OK.

Quoted 13 lines
Quoted 13 lines
arch/arm/plat-tcc/include/mach/io.h new file +12 -0
+#define __mem_pci(a)		(a)
+
+/*
+ * ----------------------------------------------------------------------------
+ * I/O mapping
+ * ----------------------------------------------------------------------------
+ */
+
+#define PCIO_BASE	0
+
+/* Address Map of Internal Peripherials (Base 0x80000000) */
+#define IO_PHYS_A			0x80000000
Quoted 8 lines

arch/arm/plat-tcc/include/mach/io.h line 42

Quoted 6 lines
arch/arm/plat-tcc/include/mach/io.h new file +6 -0
+#define IO_OFFSET_A			0x70000000 /* Virtual IO = 0xF0000000 */
+#define IO_SIZE_A			0x100000
+#define IO_VIRT_A			(IO_PHYS + IO_OFFSET)
+#define IO_ADDRESS_A(pa)	((pa) + IO_OFFSET)
+#define IO_P2V_A(pa)		((pa) + IO_OFFSET)
+#define IO_V2P_A(va)		((va) - IO_OFFSET)

Where is IO_OFFSET defined?

Nowhere. Actually, none of these #define IO_* is needed at all. Removed.

Thanks,
Hans

#17 lore raw

PATCH v2 6/7 Add common platform devices for TCC8xxx SoCs

Review

Quoted 7 lines · Hans J. Koch
(quoted diff) +7 -0
+#include <linux/init.h>
+#include <linux/dma-mapping.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+
+#include <asm/io.h>

linux/io.h

#18 lore raw

PATCH v2 6/7 Add common platform devices for TCC8xxx SoCs

Quoted 10 lines · Russell King - ARM Linux

Review

Quoted 7 lines · Hans J. Koch
(quoted diff) +7 -0
+#include <linux/init.h>
+#include <linux/dma-mapping.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+
+#include <asm/io.h>

linux/io.h

OK.

Thanks,
Hans