Skip to contentSkip to conversation

TI816X: Update common omap platform files

PATCH Superseded Hemant Pedanekar 2 participants 3 messages Aug 11, 2010 – Oct 19, 2010

Subsystems (3)

v2 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 2/6 TI816X: Update common omap platform files

This patch updates the common platform files with TI816X specific additions.

Also adds new files for TI816X modules base addresseses and irq definitions.

Note that we statically map L4 Slow region as it contains Control Module, INTC and PRCM along with timer module registers.

---
 arch/arm/mach-omap2/include/mach/entry-macro.S |   44 ++++++++-
 arch/arm/plat-omap/common.c                    |   20 ++++
 arch/arm/plat-omap/include/plat/clkdev_omap.h  |    1 +
 arch/arm/plat-omap/include/plat/clock.h        |    1 +
 arch/arm/plat-omap/include/plat/common.h       |    1 +
 arch/arm/plat-omap/include/plat/control.h      |   23 ++++
 arch/arm/plat-omap/include/plat/hardware.h     |    1 +
 arch/arm/plat-omap/include/plat/io.h           |   20 ++++
 arch/arm/plat-omap/include/plat/irqs-ti816x.h  |  128 ++++++++++++++++++++++++
 arch/arm/plat-omap/include/plat/irqs.h         |    3 +
 arch/arm/plat-omap/include/plat/serial.h       |    5 +
 arch/arm/plat-omap/include/plat/ti816x.h       |   40 ++++++++
 arch/arm/plat-omap/io.c                        |    7 ++
 13 files changed, 291 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/plat-omap/include/plat/irqs-ti816x.h
 create mode 100644 arch/arm/plat-omap/include/plat/ti816x.h
arch/arm/mach-omap2/include/mach/entry-macro.S +41 -3
index 50fd749..c277bb3 100644
@@ -34,7 +34,7 @@
 		.endm
 
 /*
- * Unoptimized irq functions for multi-omap2, 3 and 4
+ * Unoptimized irq functions for multi-omap2, 3, 4 and ti816x
  */
 
 #ifdef MULTI_OMAP2
@@ -57,7 +57,8 @@ omap_irq_base:	.word	0
 		mrc	p15, 0, \tmp, c0, c0, 0	@ get processor revision
 		and	\tmp, \tmp, #0x000000f0	@ check cortex 8 or 9
 		cmp	\tmp, #0x00000080	@ cortex A-8?
-		beq	3400f			@ found A-8 so it's omap34xx
+		beq	3400f			@ found A-8 so it's omap34xx or
+						@ ti816x
 		cmp	\tmp, #0x00000090	@ cortex A-9?
 		beq	4400f			@ found A-9 so it's omap44xx
 2400:		ldr	\base, =OMAP2_IRQ_BASE
@@ -80,7 +81,7 @@ omap_irq_base:	.word	0
 		tst	\base, #0x100		@ gic address?
 		bne	4401f			@ found gic
 
-		/* Handle omap2 and omap3 */
+		/* Handle omap2, omap3 and ti816x */
 		ldr	\irqnr, [\base, #0x98] /* IRQ pending reg 1 */
 		cmp	\irqnr, #0x0
 		bne	9998f
@@ -89,6 +90,14 @@ omap_irq_base:	.word	0
 		bne	9998f
 		ldr	\irqnr, [\base, #0xd8] /* IRQ pending reg 3 */
 		cmp	\irqnr, #0x0
+		bne	9998f
+
+		/*
+		 * ti816x has additional IRQ pending register. Checking this
+		 * register on omap2 & omap3 has no effect (read as 0).
+		 */
+		ldr	\irqnr, [\base, #0xf8] /* IRQ pending reg 4 */
+		cmp	\irqnr, #0x0
 9998:
 		ldrne	\irqnr, [\base, #INTCPS_SIR_IRQ_OFFSET]
 		and	\irqnr, \irqnr, #ACTIVEIRQ_MASK /* Clear spurious bits */
@@ -139,6 +148,35 @@ omap_irq_base:	.word	0
 		.endm
 #endif
 
+/*
+ * Optimized irq functions for ti816x
+ */
+
+#ifdef CONFIG_ARCH_TI816X
+		.macro  get_irqnr_preamble, base, tmp
+		ldr	\base, =OMAP3_IRQ_BASE
+		.endm
+
+		/* Check the pending interrupts. Note that base already set */
+		.macro	get_irqnr_and_base, irqnr, irqstat, base, tmp
+		ldr	\irqnr, [\base, #0x98] /* IRQ pending reg 1 */
+		cmp	\irqnr, #0x0
+		bne	9999f
+		ldr	\irqnr, [\base, #0xb8] /* IRQ pending reg 2 */
+		cmp	\irqnr, #0x0
+		bne	9999f
+		ldr	\irqnr, [\base, #0xd8] /* IRQ pending reg 3 */
+		cmp	\irqnr, #0x0
+		bne	9999f
+		ldr	\irqnr, [\base, #0xf8] /* IRQ pending reg 4 */
+		cmp	\irqnr, #0x0
+9999:
+		ldrne	\irqnr, [\base, #INTCPS_SIR_IRQ_OFFSET]
+		and	\irqnr, \irqnr, #ACTIVEIRQ_MASK
+
+		.endm
+#endif
+
 
 #ifdef CONFIG_ARCH_OMAP4
 
arch/arm/plat-omap/common.c +20 -0
index 3008e71..e972fbf 100644
@@ -355,3 +355,23 @@ void __init omap2_set_globals_443x(void)
 }
 #endif
 
+#if defined(CONFIG_ARCH_TI816X)
+static struct omap_globals ti816x_globals = {
+	.class	= TI816X_CLASS,
+	.tap	= TI816X_L4_SLOW_IO_ADDRESS(TI816X_SCM_BASE),
+	.ctrl	= TI816X_CTRL_BASE,
+	.prm	= TI816X_PRCM_BASE,
+	.cm	= TI816X_PRCM_BASE,
+	.uart1_phys	= TI816X_UART1_BASE,
+	.uart2_phys	= TI816X_UART2_BASE,
+	.uart3_phys	= TI816X_UART3_BASE,
+};
+
+void __init omap2_set_globals_ti816x(void)
+{
+	omap2_set_globals_tap(&ti816x_globals);
+	omap2_set_globals_control(&ti816x_globals);
+	omap2_set_globals_prcm(&ti816x_globals);
+	omap2_set_globals_uart(&ti816x_globals);
+}
+#endif
arch/arm/plat-omap/include/plat/clkdev_omap.h +1 -0
index bb937f3..9ac1997 100644
@@ -40,6 +40,7 @@ struct omap_clk {
 #define CK_3517		(1 << 11)
 #define CK_36XX		(1 << 12)	/* OMAP36xx/37xx-specific clocks */
 #define CK_443X		(1 << 13)
+#define CK_TI816X	(1 << 14)
 
 #define CK_AM35XX	(CK_3505 | CK_3517)	/* all Sitara AM35xx */
 
arch/arm/plat-omap/include/plat/clock.h +1 -0
index fef4696..8c508b5 100644
@@ -53,6 +53,7 @@ struct clkops {
 #define RATE_IN_3430ES2		(1 << 3)	/* 3430ES2 rates only */
 #define RATE_IN_36XX		(1 << 4)
 #define RATE_IN_4430		(1 << 5)
+#define RATE_IN_TI816X		(1 << 6)
 
 #define RATE_IN_24XX		(RATE_IN_242X | RATE_IN_243X)
 #define RATE_IN_3430ES2PLUS	(RATE_IN_3430ES2 | RATE_IN_36XX)
arch/arm/plat-omap/include/plat/common.h +1 -0
index 9776b41..2c4881c 100644
@@ -60,6 +60,7 @@ void omap2_set_globals_242x(void);
 void omap2_set_globals_243x(void);
 void omap2_set_globals_3xxx(void);
 void omap2_set_globals_443x(void);
+void omap2_set_globals_ti816x(void);
 
 /* These get called from omap2_set_globals_xxxx(), do not call these */
 void omap2_set_globals_tap(struct omap_globals *);
arch/arm/plat-omap/include/plat/control.h +23 -0
index 131bf40..9070385 100644
@@ -215,6 +215,24 @@
  * that should be added.
  */
 
+/* TI816X spefic control submodules */
+#define TI816X_CONTROL_OCPCONF		0x000
+#define TI816X_CONTROL_DEVBOOT		0x040
+#define TI816X_CONTROL_DEVCONF		0x600
+
+/* TI816X CONTROL_DEVBOOT register offsets */
+#define TI816X_CONTROL_STATUS		(TI816X_CONTROL_DEVBOOT + 0x000)
+#define TI816X_CONTROL_BOOTSTAT		(TI816X_CONTROL_DEVBOOT + 0x004)
+
+/* TI816X CONTROL_DEVCONF register offsets */
+#define TI816X_CONTROL_DEVICE_ID	(TI816X_CONTROL_DEVCONF + 0x000)
+#define TI816X_CONTROL_MAC_ID0_LO	(TI816X_CONTROL_DEVCONF + 0x030)
+#define TI816X_CONTROL_MAC_ID0_HI	(TI816X_CONTROL_DEVCONF + 0x034)
+#define TI816X_CONTROL_MAC_ID1_LO	(TI816X_CONTROL_DEVCONF + 0x038)
+#define TI816X_CONTROL_MAC_ID1_HI	(TI816X_CONTROL_DEVCONF + 0x03c)
+#define TI816X_CONTROL_PCIE_CFG		(TI816X_CONTROL_DEVCONF + 0x040)
+/* TODO: Add other ti816x registers... */
+
 /*
  * Control module register bit defines - these should eventually go into
  * their own regbits file.  Some of these will be complicated, depending
@@ -314,6 +332,11 @@
 #define AM35XX_HECC_SW_RST		BIT(3)
 #define AM35XX_VPFE_PCLK_SW_RST		BIT(4)
 
+/* TI816X CONTROL_PCIE_CFG bits */
+#define TI816X_PCIE_DEVTYPE_SHIFT	0
+#define TI816X_PCIE_DEVTYPE_MASK	(0x3 << 0)
+#define TI816X_PCIE_DEVTYPE_RC		(0x2 << 0)
+
 /*
  * CONTROL OMAP STATUS register to identify OMAP3 features
  */
arch/arm/plat-omap/include/plat/hardware.h +1 -0
index d5b26ad..e87efe1 100644
@@ -286,5 +286,6 @@
 #include <plat/omap24xx.h>
 #include <plat/omap34xx.h>
 #include <plat/omap44xx.h>
+#include <plat/ti816x.h>
 
 #endif	/* __ASM_ARCH_OMAP_HARDWARE_H */
arch/arm/plat-omap/include/plat/io.h +20 -0
index 128b549..587a7b8 100644
@@ -82,6 +82,9 @@
 #define OMAP2_EMU_IO_OFFSET		0xaa800000	/* Emulation */
 #define OMAP2_EMU_IO_ADDRESS(pa)	IOMEM((pa) + OMAP2_EMU_IO_OFFSET)
 
+#define TI816X_L4_SLOW_IO_OFFSET	0xb2000000
+#define TI816X_L4_SLOW_IO_ADDRESS(pa)	IOMEM((pa) + TI816X_L4_SLOW_IO_OFFSET)
+
 /*
  * ----------------------------------------------------------------------------
  * Omap1 specific IO mapping
@@ -235,6 +238,15 @@
 						/* 0x4e000000 --> 0xfd300000 */
 #define OMAP44XX_DMM_VIRT	(OMAP44XX_DMM_PHYS + OMAP4_L3_PER_IO_OFFSET)
 #define OMAP44XX_DMM_SIZE	SZ_1M
+
+/*
+ * TI816X Specific I/O Mapping
+ */
+#define L4_SLOW_TI816X_PHYS	L4_SLOW_TI816X_BASE
+						/* 0x48000000 --> 0xd8000000 */
+#define L4_SLOW_TI816X_VIRT	(L4_SLOW_TI816X_PHYS + TI816X_L4_SLOW_IO_OFFSET)
+#define L4_SLOW_TI816X_SIZE	SZ_4M
+
 /*
  * ----------------------------------------------------------------------------
  * Omap specific register access
@@ -291,6 +303,14 @@ static inline void omap44xx_map_common_io(void)
 }
 #endif
 
+#ifdef CONFIG_ARCH_TI816X
+extern void ti816x_map_common_io(void);
+#else
+static inline void ti816x_map_common_io(void)
+{
+}
+#endif
+
 extern void omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
 				 struct omap_sdrc_params *sdrc_cs1);
 
arch/arm/plat-omap/include/plat/irqs-ti816x.h new file +128 -0

128 lines not on this page · raw message

arch/arm/plat-omap/include/plat/irqs.h +3 -0
index c01d9f0..0cda749 100644
@@ -31,6 +31,9 @@
 /* All OMAP4 specific defines are moved to irqs-44xx.h */
 #include "irqs-44xx.h"
 
+/* All TI816X specific defines are in irqs-ti816x.h */
+#include "irqs-ti816x.h"
+
 /*
  * IRQ numbers for interrupt handler 1
  *
arch/arm/plat-omap/include/plat/serial.h +5 -0
index 19145f5..ad8d0d8 100644
@@ -51,6 +51,11 @@
 #define OMAP4_UART3_BASE	0x48020000
 #define OMAP4_UART4_BASE	0x4806e000
 
+/* TI816X serial ports */
+#define TI816X_UART1_BASE	0x48020000
+#define TI816X_UART2_BASE	0x48022000
+#define TI816X_UART3_BASE	0x48024000
+
 /* External port on Zoom2/3 */
 #define ZOOM_UART_BASE		0x10000000
 #define ZOOM_UART_VIRT		0xfa400000
arch/arm/plat-omap/include/plat/ti816x.h new file +40 -0
new file mode 100644
index 0000000..43335c3
@@ -0,0 +1,40 @@
+/*
+ * This file contains the address data for various ti816x modules.
+ *
+ * Copyright (C) 2010 Texas Instruments, Inc. - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __ASM_ARCH_TI816X_H
+#define __ASM_ARCH_TI816X_H
+
+#define L3_TI816X_BASE		0x44000000
+#define L4_FAST_TI816X_BASE	0x4a000000
+#define L4_SLOW_TI816X_BASE	0x48000000
+
+#define TI816X_SCM_BASE		0x48140000
+#define TI816X_CTRL_BASE	TI816X_SCM_BASE
+#define TI816X_PRCM_BASE	0x48180000
+
+#define TI816X_ARM_INTC_BASE	0x48200000
+
+#define TI816X_GPMC_BASE	0x50000000
+
+#define TI816X_USBSS_BASE	0x47400000
+#define TI816X_USBSS_LEN	0xFFF
+#define TI816X_USB0_BASE	0x47401000
+#define TI816X_USB1_BASE	0x47401800
+#define TI816X_USB_CPPIDMA_BASE	0x47402000
+#define TI816X_USB_CPPIDMA_LEN	0x5FFF
+
+#define TI816X_SATA_BASE	0x4A140000
+
+#endif /* __ASM_ARCH_TI816X_H */
arch/arm/plat-omap/io.c +7 -0
index b0078cf..4119130 100644
@@ -124,6 +124,13 @@ void __iomem *omap_ioremap(unsigned long p, size_t size, unsigned int type)
 			return XLATE(p, L4_EMU_44XX_PHYS, L4_EMU_44XX_VIRT);
 	}
 #endif
+#ifdef CONFIG_ARCH_TI816X
+	if (cpu_is_ti816x()) {
+		if (BETWEEN(p, L4_SLOW_TI816X_PHYS, L4_SLOW_TI816X_SIZE))
+			return XLATE(p, L4_SLOW_TI816X_PHYS,
+					L4_SLOW_TI816X_VIRT);
+	}
+#endif
 	return __arm_ioremap_caller(p, size, type, __builtin_return_address(0));
 }
 EXPORT_SYMBOL(omap_ioremap);
Signature · 1 line
1.6.2.4
maintainer
#1 lore raw
Quoted 4 lines · Hemant Pedanekar
arch/arm/plat-omap/include/plat/serial.h +0 -0
@@ -51,6 +51,11 @@
 #define OMAP4_UART3_BASE	0x48020000

arch/arm/plat-omap/include/plat/serial.h line 61

Quoted 10 lines
arch/arm/plat-omap/include/plat/serial.h +5 -0
 #define OMAP4_UART4_BASE	0x4806e000
 
+/* TI816X serial ports */
+#define TI816X_UART1_BASE	0x48020000
+#define TI816X_UART2_BASE	0x48022000
+#define TI816X_UART3_BASE	0x48024000
+
 /* External port on Zoom2/3 */
 #define ZOOM_UART_BASE		0x10000000
 #define ZOOM_UART_VIRT		0xfa400000

These defines should get added by the serial port patch in the series, currently 6/6.

Tony

#2 lore raw

Tony Lindgren wrote on Friday, September 17, 2010 4:01 AM:

Quoted 19 lines · Hemant Pedanekar
Quoted 4 lines
arch/arm/plat-omap/include/plat/serial.h +0 -0
@@ -51,6 +51,11 @@
 #define OMAP4_UART3_BASE	0x48020000

arch/arm/plat-omap/include/plat/serial.h line 61

Quoted 10 lines
arch/arm/plat-omap/include/plat/serial.h +5 -0
 #define OMAP4_UART4_BASE	0x4806e000
 
+/* TI816X serial ports */
+#define TI816X_UART1_BASE	0x48020000
+#define TI816X_UART2_BASE	0x48022000
+#define TI816X_UART3_BASE	0x48024000
+
 /* External port on Zoom2/3 */
 #define ZOOM_UART_BASE		0x10000000
 #define ZOOM_UART_VIRT		0xfa400000

These defines should get added by the serial port patch in the series, currently 6/6.

Quoted 1 line

Tony

I have included them here because the common.c (part of this patch) requires UART base addresses in ti816x_globals while the same serial.h file is also part of patch 6 where TI816XUART definitions are used for LL DEBUG.

Thanks
-
Hemant