Skip to contentSkip to conversation

Fix relative includes for omaps introduced by recent clean-up

PATCH In review Tony Lindgren 5 participants 24 messages Oct 30, 2012 – Nov 12, 2012

Subsystems (10)
lore
Share & tools
lore

Tony Lindgren

author maintainer
#0 lore raw

cover Fix relative includes for omaps introduced by recent clean-up

Hi all,

As discussed on this list, here are fixes to get rid of the relative includes for omap that got introduced with the recent clean-up.

This is based on what I have queued up in the omap-for-v3.8/cleanup-headers branch at commit 986bfa5c.

Note that this series introduces few new plat/*.h files. However, those files will not be used by the drivers:

sram.h
i2c.h
counter-32k.h
debug-devices.h

We still want to remove the remaining problem plat headers as they are wrongly shared between drivers and core omap code:

iommu2.h
iommu.h
iopgtable.h
iovmm.h
mailbox.h
omap-serial.h
prcm.h
vram.h

These headers will not work for omap2+ drivers when we have CONFIG_MULTIPLATFORM set.

Regards,

Tony

---

Tony Lindgren (11):
ARM: OMAP: Split sram.h to local headers and minimal shared header
ARM: OMAP: Introduce common omap_map_sram() and omap_sram_reset()
ARM: OMAP: Move omap1 specific code to local sram.c
ARM: OMAP: Move omap2+ specific parts of sram.c to mach-omap2
ARM: OMAP: Make plat-omap/i2c.c port checks local
ARM: OMAP: Fix relative includes for shared i2c.h file
ARM: OMAP: Move omap-pm-noop.c local to mach-omap2
ARM: OMAP: Remove plat-omap/common.h
ARM: OMAP: Fix relative includes for debug-devices.h
ARM: OMAP: Remove cpu_is_omap usage from plat-omap/dma.c
ARM: OMAP1: Remove relative includes

 arch/arm/mach-omap1/Makefile                       |    3 
 arch/arm/mach-omap1/clock.c                        |    3 
 arch/arm/mach-omap1/clock_data.c                   |    3 
 arch/arm/mach-omap1/common.h                       |    3 
 arch/arm/mach-omap1/devices.c                      |    3 
 arch/arm/mach-omap1/dma.c                          |    3 
 arch/arm/mach-omap1/i2c.c                          |    5 
 arch/arm/mach-omap1/include/mach/entry-macro.S     |    2 
 arch/arm/mach-omap1/include/mach/hardware.h        |    5 
 arch/arm/mach-omap1/include/mach/memory.h          |    2 
 arch/arm/mach-omap1/include/mach/soc.h             |  229 +++++++++++++
 arch/arm/mach-omap1/iomap.h                        |    3 
 arch/arm/mach-omap1/pm.c                           |    4 
 arch/arm/mach-omap1/sleep.S                        |    2 
 arch/arm/mach-omap1/soc.h                          |  229 -------------
 arch/arm/mach-omap1/sram-init.c                    |   76 ++++
 arch/arm/mach-omap1/sram.h                         |    7 
 arch/arm/mach-omap1/timer32k.c                     |    1 
 arch/arm/mach-omap2/Makefile                       |    3 
 arch/arm/mach-omap2/board-h4.c                     |    2 
 arch/arm/mach-omap2/clkt2xxx_dpllcore.c            |    3 
 arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c       |    3 
 arch/arm/mach-omap2/clkt34xx_dpll3m2.c             |    3 
 arch/arm/mach-omap2/cm33xx.c                       |    2 
 arch/arm/mach-omap2/common.h                       |    5 
 arch/arm/mach-omap2/dma.c                          |    3 
 arch/arm/mach-omap2/i2c.c                          |   16 +
 arch/arm/mach-omap2/i2c.h                          |    2 
 arch/arm/mach-omap2/io.c                           |    3 
 arch/arm/mach-omap2/omap-pm-noop.c                 |    4 
 arch/arm/mach-omap2/omap4-common.c                 |    2 
 .../mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c |    2 
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c         |    2 
 arch/arm/mach-omap2/pm24xx.c                       |    5 
 arch/arm/mach-omap2/pm34xx.c                       |    4 
 arch/arm/mach-omap2/prm33xx.c                      |    2 
 arch/arm/mach-omap2/prm_common.c                   |    1 
 arch/arm/mach-omap2/sdrc.c                         |    2 
 arch/arm/mach-omap2/sdrc2xxx.c                     |    3 
 arch/arm/mach-omap2/sleep34xx.S                    |    3 
 arch/arm/mach-omap2/sram.c                         |  305 +++++++++++++++++
 arch/arm/mach-omap2/sram.h                         |   26 -
 arch/arm/mach-omap2/timer.c                        |    3 
 arch/arm/plat-omap/Makefile                        |    1 
 arch/arm/plat-omap/common.c                        |    1 
 arch/arm/plat-omap/common.h                        |   36 --
 arch/arm/plat-omap/counter_32k.c                   |    2 
 arch/arm/plat-omap/debug-devices.c                 |    2 
 arch/arm/plat-omap/dma.c                           |  108 +++---
 arch/arm/plat-omap/dmtimer.c                       |   17 +
 arch/arm/plat-omap/i2c.c                           |   30 --
 arch/arm/plat-omap/include/plat-omap/dma-omap.h    |   19 +
 arch/arm/plat-omap/include/plat/counter-32k.h      |    1 
 arch/arm/plat-omap/include/plat/debug-devices.h    |    7 
 arch/arm/plat-omap/include/plat/dmtimer.h          |    2 
 arch/arm/plat-omap/include/plat/i2c.h              |    0 
 arch/arm/plat-omap/include/plat/sram.h             |   16 +
 arch/arm/plat-omap/sram.c                          |  366 ++------------------
 drivers/dma/omap-dma.c                             |    6 
 59 files changed, 815 insertions(+), 791 deletions(-)
 create mode 100644 arch/arm/mach-omap1/include/mach/soc.h
 create mode 100644 arch/arm/mach-omap1/sram-init.c
 create mode 100644 arch/arm/mach-omap1/sram.h
 rename arch/arm/{plat-omap/omap-pm-noop.c => mach-omap2/omap-pm-noop.c} (99%)
 create mode 100644 arch/arm/mach-omap2/sram.c
 rename arch/arm/{plat-omap/sram.h => mach-omap2/sram.h} (79%)
 delete mode 100644 arch/arm/plat-omap/common.h
 create mode 100644 arch/arm/plat-omap/include/plat/counter-32k.h
 rename arch/arm/{mach-omap2/debug-devices.h => plat-omap/include/plat/debug-devices.h} (54%)
 rename arch/arm/plat-omap/{i2c.h => include/plat/i2c.h} (100%)
 create mode 100644 arch/arm/plat-omap/include/plat/sram.h
Signature · 1 line
Signature
author maintainer
#1 lore raw

PATCH 1/11 ARM: OMAP: Split sram.h to local headers and minimal shared header

Most of the defines are specific to omap1 and omap2+, and should be in the local headers. Only minimal function prototypes need to be shared.

As discussed on linux-arm-kernel, we want to avoid relative includes for the arch/arm/*omap* shared code:

http://www.spinics.net/lists/linux-omap/msg80520.html

So this patch re-adds a minimal plat/sram.h.

The new plat/sram.h must not be included from drivers, that will break build for omap2+ CONFIG_MULTIPLATFORM.

Note that this patch temporarily adds two more
relative includes; Those will be removed in the
following patch.

---
 arch/arm/mach-omap1/clock.c                  |    3 +--
 arch/arm/mach-omap1/clock_data.c             |    3 +--
 arch/arm/mach-omap1/devices.c                |    3 +--
 arch/arm/mach-omap1/pm.c                     |    4 ++--
 arch/arm/mach-omap1/sram.h                   |    7 +++++++
 arch/arm/mach-omap2/clkt2xxx_dpllcore.c      |    3 +--
 arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c |    3 +--
 arch/arm/mach-omap2/clkt34xx_dpll3m2.c       |    3 +--
 arch/arm/mach-omap2/io.c                     |    3 +--
 arch/arm/mach-omap2/omap4-common.c           |    2 --
 arch/arm/mach-omap2/pm24xx.c                 |    5 +++--
 arch/arm/mach-omap2/pm34xx.c                 |    4 ++--
 arch/arm/mach-omap2/sdrc.c                   |    2 --
 arch/arm/mach-omap2/sdrc2xxx.c               |    3 +--
 arch/arm/mach-omap2/sleep34xx.S              |    3 +--
 arch/arm/mach-omap2/sram.h                   |   26 +-------------------------
 arch/arm/plat-omap/include/plat/sram.h       |   12 ++++++++++++
 arch/arm/plat-omap/sram.c                    |    5 +++--
 18 files changed, 39 insertions(+), 55 deletions(-)
 create mode 100644 arch/arm/mach-omap1/sram.h
 rename arch/arm/{plat-omap/sram.h => mach-omap2/sram.h} (79%)
 create mode 100644 arch/arm/plat-omap/include/plat/sram.h
arch/arm/mach-omap1/clock.c +1 -2
index 931f3f6..4f5fd4a 100644
@@ -24,12 +24,11 @@
 
 #include <mach/hardware.h>
 
-#include "../plat-omap/sram.h"
-
 #include "soc.h"
 #include "iomap.h"
 #include "clock.h"
 #include "opp.h"
+#include "sram.h"
 
 __u32 arm_idlect1_mask;
 struct clk *api_ck_p, *ck_dpll1_p, *ck_ref_p;
arch/arm/mach-omap1/clock_data.c +1 -2
index 28aea55..cb7c6ae 100644
@@ -27,10 +27,9 @@
 #include <mach/hardware.h>
 #include <mach/usb.h>   /* for OTG_BASE */
 
-#include "../plat-omap/sram.h"
-
 #include "iomap.h"
 #include "clock.h"
+#include "sram.h"
 
 /* Some ARM_IDLECT1 bit shifts - used in struct arm_idlect1_clk */
 #define IDL_CLKOUT_ARM_SHIFT			12
arch/arm/mach-omap1/devices.c +1 -2
index 645668e..7155ed8 100644
@@ -26,12 +26,11 @@
 #include <mach/camera.h>
 #include <mach/hardware.h>
 
-#include "../plat-omap/sram.h"
-
 #include "common.h"
 #include "clock.h"
 #include "dma.h"
 #include "mmc.h"
+#include "sram.h"
 
 #if defined(CONFIG_SND_SOC) || defined(CONFIG_SND_SOC_MODULE)
 
arch/arm/mach-omap1/pm.c +2 -2
index b2c2328..66d663a 100644
@@ -44,6 +44,7 @@
 #include <linux/io.h>
 #include <linux/atomic.h>
 
+#include <asm/fncpy.h>
 #include <asm/system_misc.h>
 #include <asm/irq.h>
 #include <asm/mach/time.h>
@@ -56,11 +57,10 @@
 
 #include <mach/irqs.h>
 
-#include "../plat-omap/sram.h"
-
 #include "iomap.h"
 #include "clock.h"
 #include "pm.h"
+#include "sram.h"
 
 static unsigned int arm_sleep_save[ARM_SLEEP_SAVE_SIZE];
 static unsigned short dsp_sleep_save[DSP_SLEEP_SAVE_SIZE];
arch/arm/mach-omap1/sram.h new file +7 -0
new file mode 100644
index 0000000..d5a6c83
@@ -0,0 +1,7 @@
+#include <plat/sram.h>
+
+extern void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl);
+
+/* Do not use these */
+extern void omap1_sram_reprogram_clock(u32 ckctl, u32 dpllctl);
+extern unsigned long omap1_sram_reprogram_clock_sz;
arch/arm/mach-omap2/clkt2xxx_dpllcore.c +1 -2
index 3432f91..0d2f14c 100644
@@ -25,14 +25,13 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 
-#include "../plat-omap/sram.h"
-
 #include "clock.h"
 #include "clock2xxx.h"
 #include "opp2xxx.h"
 #include "cm2xxx_3xxx.h"
 #include "cm-regbits-24xx.h"
 #include "sdrc.h"
+#include "sram.h"
 
 /* #define DOWN_VARIABLE_DPLL 1 */		/* Experimental */
 
arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c +1 -2
index c66276b..a38ebb2 100644
@@ -33,8 +33,6 @@
 #include <linux/cpufreq.h>
 #include <linux/slab.h>
 
-#include "../plat-omap/sram.h"
-
 #include "soc.h"
 #include "clock.h"
 #include "clock2xxx.h"
@@ -42,6 +40,7 @@
 #include "cm2xxx_3xxx.h"
 #include "cm-regbits-24xx.h"
 #include "sdrc.h"
+#include "sram.h"
 
 const struct prcm_config *curr_prcm_set;
 const struct prcm_config *rate_table;
arch/arm/mach-omap2/clkt34xx_dpll3m2.c +1 -2
index 5510d92..6cf298e 100644
@@ -21,12 +21,11 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 
-#include "../plat-omap/sram.h"
-
 #include "clock.h"
 #include "clock3xxx.h"
 #include "clock34xx.h"
 #include "sdrc.h"
+#include "sram.h"
 
 #define CYCLES_PER_MHZ			1000000
 
arch/arm/mach-omap2/io.c +1 -2
index 4fadc78..814f699 100644
@@ -27,8 +27,6 @@
 
 #include <plat-omap/dma-omap.h>
 
-#include "../plat-omap/sram.h"
-
 #include "omap_hwmod.h"
 #include "soc.h"
 #include "iomap.h"
@@ -43,6 +41,7 @@
 #include "omap-pm.h"
 #include "sdrc.h"
 #include "serial.h"
+#include "sram.h"
 
 /*
  * The machine specific code may provide the extra mapping besides the
arch/arm/mach-omap2/omap4-common.c +0 -2
index d25845c..8a7fc04 100644
@@ -25,8 +25,6 @@
 #include <asm/mach/map.h>
 #include <asm/memblock.h>
 
-#include "../plat-omap/sram.h"
-
 #include "omap-wakeupgen.h"
 #include "soc.h"
 #include "common.h"
arch/arm/mach-omap2/pm24xx.c +3 -2
index 6d17e044..9a2f559 100644
@@ -31,6 +31,8 @@
 #include <linux/gpio.h>
 #include <linux/platform_data/gpio-omap.h>
 
+#include <asm/fncpy.h>
+
 #include <asm/mach/time.h>
 #include <asm/mach/irq.h>
 #include <asm/mach-types.h>
@@ -38,8 +40,6 @@
 
 #include <plat-omap/dma-omap.h>
 
-#include "../plat-omap/sram.h"
-
 #include "soc.h"
 #include "common.h"
 #include "clock.h"
@@ -48,6 +48,7 @@
 #include "cm2xxx_3xxx.h"
 #include "cm-regbits-24xx.h"
 #include "sdrc.h"
+#include "sram.h"
 #include "pm.h"
 #include "control.h"
 #include "powerdomain.h"
arch/arm/mach-omap2/pm34xx.c +2 -2
index 160fa25..4c85762 100644
@@ -32,6 +32,7 @@
 
 #include <trace/events/power.h>
 
+#include <asm/fncpy.h>
 #include <asm/suspend.h>
 #include <asm/system_misc.h>
 
@@ -40,8 +41,6 @@
 #include <plat/prcm.h>
 #include <plat-omap/dma-omap.h>
 
-#include "../plat-omap/sram.h"
-
 #include "soc.h"
 #include "common.h"
 #include "cm2xxx_3xxx.h"
@@ -52,6 +51,7 @@
 #include "prm2xxx_3xxx.h"
 #include "pm.h"
 #include "sdrc.h"
+#include "sram.h"
 #include "control.h"
 
 /* pm34xx errata defined in pm.h */
arch/arm/mach-omap2/sdrc.c +0 -2
index 94d4082..c64ee19 100644
@@ -23,8 +23,6 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 
-#include "../plat-omap/sram.h"
-
 #include "common.h"
 #include "clock.h"
 #include "sdrc.h"
arch/arm/mach-omap2/sdrc2xxx.c +1 -2
index 3b8bfdf..20cc950 100644
@@ -24,14 +24,13 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 
-#include "../plat-omap/sram.h"
-
 #include "soc.h"
 #include "iomap.h"
 #include "common.h"
 #include "prm2xxx_3xxx.h"
 #include "clock.h"
 #include "sdrc.h"
+#include "sram.h"
 
 /* Memory timing, DLL mode flags */
 #define M_DDR		1
arch/arm/mach-omap2/sleep34xx.S +1 -2
index 75afe11..7046c3c 100644
@@ -26,13 +26,12 @@
 
 #include <asm/assembler.h>
 
-#include "../plat-omap/sram.h"
-
 #include "omap34xx.h"
 #include "iomap.h"
 #include "cm2xxx_3xxx.h"
 #include "prm2xxx_3xxx.h"
 #include "sdrc.h"
+#include "sram.h"
 #include "control.h"
 
 /*
arch/arm/mach-omap2/sram.h renamed from arch/arm/plat-omap/sram.h +1 -25
similarity index 79%
rename from arch/arm/plat-omap/sram.h
rename to arch/arm/mach-omap2/sram.h
index cefda2e..ca7277c 100644
@@ -1,6 +1,4 @@
 /*
- * arch/arm/plat-omap/include/mach/sram.h
- *
  * Interface for functions that need to be run in internal SRAM
  *
  * This program is free software; you can redistribute it and/or modify
@@ -8,26 +6,8 @@
  * published by the Free Software Foundation.
  */
 
-#ifndef __ARCH_ARM_OMAP_SRAM_H
-#define __ARCH_ARM_OMAP_SRAM_H
-
 #ifndef __ASSEMBLY__
-#include <asm/fncpy.h>
-
-int __init omap_sram_init(void);
-
-extern void *omap_sram_push_address(unsigned long size);
-
-/* Macro to push a function to the internal SRAM, using the fncpy API */
-#define omap_sram_push(funcp, size) ({				\
-	typeof(&(funcp)) _res = NULL;				\
-	void *_sram_address = omap_sram_push_address(size);	\
-	if (_sram_address)					\
-		_res = fncpy(_sram_address, &(funcp), size);	\
-	_res;							\
-})
-
-extern void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl);
+#include <plat/sram.h>
 
 extern void omap2_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
 				u32 base_cs, u32 force_unlock);
@@ -44,9 +24,6 @@ extern u32 omap3_configure_core_dpll(
 extern void omap3_sram_restore_context(void);
 
 /* Do not use these */
-extern void omap1_sram_reprogram_clock(u32 ckctl, u32 dpllctl);
-extern unsigned long omap1_sram_reprogram_clock_sz;
-
 extern void omap24xx_sram_reprogram_clock(u32 ckctl, u32 dpllctl);
 extern unsigned long omap24xx_sram_reprogram_clock_sz;
 
@@ -104,4 +81,3 @@ static inline void omap_push_sram_idle(void) {}
 #define OMAP4_SRAM_PA		0x40300000
 #endif
 #define AM33XX_SRAM_PA		0x40300000
-#endif
arch/arm/plat-omap/include/plat/sram.h new file +12 -0
new file mode 100644
index 0000000..c60025a
@@ -0,0 +1,12 @@
+int omap_sram_init(void);
+
+extern void *omap_sram_push_address(unsigned long size);
+
+/* Macro to push a function to the internal SRAM, using the fncpy API */
+#define omap_sram_push(funcp, size) ({				\
+	typeof(&(funcp)) _res = NULL;				\
+	void *_sram_address = omap_sram_push_address(size);	\
+	if (_sram_address)					\
+		_res = fncpy(_sram_address, &(funcp), size);	\
+	_res;							\
+})
arch/arm/plat-omap/sram.c +3 -2
index 70dcc22..3372929 100644
@@ -20,15 +20,16 @@
 #include <linux/init.h>
 #include <linux/io.h>
 
+#include <asm/fncpy.h>
 #include <asm/tlb.h>
 #include <asm/cacheflush.h>
 
 #include <asm/mach/map.h>
 
 #include "../mach-omap1/soc.h"
+#include "../mach-omap1/sram.h"
 #include "../mach-omap2/soc.h"
-
-#include "sram.h"
+#include "../mach-omap2/sram.h"
 
 /* XXX These "sideways" includes will disappear when sram.c becomes a driver */
 #include "../mach-omap2/iomap.h"
author maintainer
#2 lore raw

PATCH 2/11 ARM: OMAP: Introduce common omap_map_sram() and omap_sram_reset()

In reply to Tony Lindgren

This will allow us to separate out omap1 and omap2+ specific code in the later patches.

---
 arch/arm/plat-omap/include/plat/sram.h |    4 ++
 arch/arm/plat-omap/sram.c              |   64 +++++++++++++++++++++-----------
 2 files changed, 46 insertions(+), 22 deletions(-)
arch/arm/plat-omap/include/plat/sram.h +4 -0
index c60025a..ba45250 100644
@@ -1,5 +1,9 @@
 int omap_sram_init(void);
 
+void omap_map_sram(unsigned long start, unsigned long size,
+			unsigned long skip, int cached);
+void omap_sram_reset(void);
+
 extern void *omap_sram_push_address(unsigned long size);
 
 /* Macro to push a function to the internal SRAM, using the fncpy API */
arch/arm/plat-omap/sram.c +42 -22

97 lines not on this page · raw message

author maintainer
#3 lore raw

PATCH 3/11 ARM: OMAP: Move omap1 specific code to local sram.c

In reply to Tony Lindgren

Let's make the omap1 specific parts private to mach-omap1. These should not be in the shared code.

---
 arch/arm/mach-omap1/Makefile    |    3 +-
 arch/arm/mach-omap1/sram-init.c |   76 +++++++++++++++++++++++++++++++++++++++
 arch/arm/plat-omap/sram.c       |   49 ++-----------------------
 3 files changed, 81 insertions(+), 47 deletions(-)
 create mode 100644 arch/arm/mach-omap1/sram-init.c
arch/arm/mach-omap1/Makefile +2 -1
index cd169c3..f0e69cb 100644
@@ -3,7 +3,8 @@
 #
 
 # Common support
-obj-y := io.o id.o sram.o time.o irq.o mux.o flash.o serial.o devices.o dma.o
+obj-y := io.o id.o sram-init.o sram.o time.o irq.o mux.o flash.o \
+	 serial.o devices.o dma.o
 obj-y += clock.o clock_data.o opp_data.o reset.o pm_bus.o timer.o
 
 ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),)
arch/arm/mach-omap1/sram-init.c new file +76 -0

76 lines not on this page · raw message

arch/arm/plat-omap/sram.c +3 -46

87 lines not on this page · raw message

author maintainer
#4 lore raw

PATCH 4/11 ARM: OMAP: Move omap2+ specific parts of sram.c to mach-omap2

In reply to Tony Lindgren

Let's make the omap2+ specific parts private to mach-omap2.

This leaves just a minimal shared code into plat-omap like it should be.

---
 arch/arm/mach-omap2/Makefile |    2 
 arch/arm/mach-omap2/sram.c   |  305 ++++++++++++++++++++++++++++++++++++++++++
 arch/arm/plat-omap/sram.c    |  288 ----------------------------------------
 3 files changed, 306 insertions(+), 289 deletions(-)
 create mode 100644 arch/arm/mach-omap2/sram.c
arch/arm/mach-omap2/Makefile +1 -1
index 46d9071..e3de5d4 100644
@@ -5,7 +5,7 @@
 # Common support
 obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer.o pm.o \
 	 common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o \
-	 omap_device.o
+	 omap_device.o sram.o
 
 # INTCPS IP block support - XXX should be moved to drivers/
 obj-$(CONFIG_ARCH_OMAP2)		+= irq.o
arch/arm/mach-omap2/sram.c new file +305 -0

305 lines not on this page · raw message

arch/arm/plat-omap/sram.c +0 -288

305 lines not on this page · raw message

author maintainer
#5 lore raw

PATCH 4/11 ARM: OMAP: Move omap2+ specific parts of sram.c to mach-omap2

Quoted 4 lines · Tony Lindgren

Let's make the omap2+ specific parts private to mach-omap2.

This leaves just a minimal shared code into plat-omap like it should be.

Found an error with make randconfig if we have CONFIG_OMAP4_ERRATA_I688 enabled, I'll fold in the following fix to this patch.

Regards,

Tony

arch/arm/mach-omap2/omap4-common.c +1 -0
@@ -32,6 +32,7 @@
 #include "hsmmc.h"
 #include "omap4-sar-layout.h"
 #include "omap-secure.h"
+#include "sram.h"
 
 #ifdef CONFIG_CACHE_L2X0
 static void __iomem *l2cache_base;
author maintainer
#6 lore raw

PATCH 5/11 ARM: OMAP: Make plat-omap/i2c.c port checks local

In reply to Tony Lindgren

The common code should not have any omap1 or omap2+ specific code, and should not need to call the cpu_is_omap macros.

The only remaining user for cpu_is_omap macros is omap_i2c_nr_ports(). Let's make those checks in the omap specific implementation of omap_i2c_add_bus() instead in order to remove cpu_is_omap usage from the common code.

---
 arch/arm/mach-omap1/i2c.c |    3 +++
 arch/arm/mach-omap2/i2c.c |   16 ++++++++++++++++
 arch/arm/plat-omap/i2c.c  |   26 +++-----------------------
 3 files changed, 22 insertions(+), 23 deletions(-)
arch/arm/mach-omap1/i2c.c +3 -0
index 32bcbb8..54097a2 100644
@@ -54,6 +54,9 @@ int __init omap_i2c_add_bus(struct omap_i2c_bus_platform_data *pdata,
 	struct platform_device *pdev;
 	struct resource *res;
 
+	if (bus_id > 1)
+		return -EINVAL;
+
 	omap1_i2c_mux_pins(bus_id);
 
 	pdev = &omap_i2c_devices[bus_id - 1];
arch/arm/mach-omap2/i2c.c +16 -0
index ad55b94..4e63097 100644
@@ -109,6 +109,19 @@ int omap_i2c_reset(struct omap_hwmod *oh)
 	return 0;
 }
 
+static int __init omap_i2c_nr_ports(void)
+{
+	int ports = 0;
+
+	if (cpu_is_omap24xx())
+		ports = 2;
+	else if (cpu_is_omap34xx())
+		ports = 3;
+	else if (cpu_is_omap44xx())
+		ports = 4;
+	return ports;
+}
+
 static const char name[] = "omap_i2c";
 
 int __init omap_i2c_add_bus(struct omap_i2c_bus_platform_data *i2c_pdata,
@@ -121,6 +134,9 @@ int __init omap_i2c_add_bus(struct omap_i2c_bus_platform_data *i2c_pdata,
 	struct omap_i2c_bus_platform_data *pdata;
 	struct omap_i2c_dev_attr *dev_attr;
 
+	if (bus_id > omap_i2c_nr_ports())
+		return -EINVAL;
+
 	omap2_i2c_mux_pins(bus_id);
 
 	l = snprintf(oh_name, MAX_OMAP_I2C_HWMOD_NAME_LEN, "i2c%d", bus_id);
arch/arm/plat-omap/i2c.c +3 -23
index be6deb7..d094273 100644
@@ -33,9 +33,6 @@
 
 #include <mach/irqs.h>
 
-#include "../mach-omap1/soc.h"
-#include "../mach-omap2/soc.h"
-
 #include "i2c.h"
 
 #define OMAP_I2C_MAX_CONTROLLERS 4
@@ -43,22 +40,6 @@ static struct omap_i2c_bus_platform_data i2c_pdata[OMAP_I2C_MAX_CONTROLLERS];
 
 #define OMAP_I2C_CMDLINE_SETUP	(BIT(31))
 
-static int __init omap_i2c_nr_ports(void)
-{
-	int ports = 0;
-
-	if (cpu_class_is_omap1())
-		ports = 1;
-	else if (cpu_is_omap24xx())
-		ports = 2;
-	else if (cpu_is_omap34xx())
-		ports = 3;
-	else if (cpu_is_omap44xx())
-		ports = 4;
-
-	return ports;
-}
-
 /**
  * omap_i2c_bus_setup - Process command line options for the I2C bus speed
  * @str: String of options
@@ -72,12 +53,11 @@ static int __init omap_i2c_nr_ports(void)
  */
 static int __init omap_i2c_bus_setup(char *str)
 {
-	int ports;
 	int ints[3];
 
-	ports = omap_i2c_nr_ports();
 	get_options(str, 3, ints);
-	if (ints[0] < 2 || ints[1] < 1 || ints[1] > ports)
+	if (ints[0] < 2 || ints[1] < 1 ||
+			ints[1] > OMAP_I2C_MAX_CONTROLLERS)
 		return 0;
 	i2c_pdata[ints[1] - 1].clkrate = ints[2];
 	i2c_pdata[ints[1] - 1].clkrate |= OMAP_I2C_CMDLINE_SETUP;
@@ -122,7 +102,7 @@ int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
 {
 	int err;
 
-	BUG_ON(bus_id < 1 || bus_id > omap_i2c_nr_ports());
+	BUG_ON(bus_id < 1 || bus_id > OMAP_I2C_MAX_CONTROLLERS);
 
 	if (info) {
 		err = i2c_register_board_info(bus_id, info, len);
author maintainer
#7 lore raw

PATCH 6/11 ARM: OMAP: Fix relative includes for shared i2c.h file

In reply to Tony Lindgren

As discussed on linux-arm-kernel, we want to avoid relative includes for the arch/arm/*omap* shared code:

http://www.spinics.net/lists/linux-omap/msg80520.html

To fix this for the shared i2c.h, let's re-introduce a minimal plat/i2c.h.

Note that drivers must not use this header as it will break build for omap2+ CONFIG_MULTIPLATFORM builds.

---
 arch/arm/mach-omap1/common.h          |    2 +-
 arch/arm/mach-omap1/i2c.c             |    2 +-
 arch/arm/mach-omap2/i2c.h             |    2 +-
 arch/arm/plat-omap/i2c.c              |    4 ++--
 arch/arm/plat-omap/include/plat/i2c.h |    0 
 5 files changed, 5 insertions(+), 5 deletions(-)
 rename arch/arm/plat-omap/{i2c.h => include/plat/i2c.h} (100%)
arch/arm/mach-omap1/common.h +1 -1
index 26e19d3..3d40f6e 100644
@@ -30,7 +30,7 @@
 #include <linux/mtd/mtd.h>
 #include <linux/i2c-omap.h>
 
-#include "../plat-omap/i2c.h"
+#include <plat/i2c.h>
 
 #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
 void omap7xx_map_io(void);
arch/arm/mach-omap1/i2c.c +1 -1
index 54097a2..faca808 100644
@@ -23,7 +23,7 @@
 #include <mach/mux.h>
 #include "soc.h"
 
-#include "../plat-omap/i2c.h"
+#include <plat/i2c.h>
 
 #define OMAP_I2C_SIZE		0x3f
 #define OMAP1_I2C_BASE		0xfffb3800
arch/arm/mach-omap2/i2c.h +1 -1
index 81dbb99..42b6f2e 100644
@@ -19,7 +19,7 @@
  *
  */
 
-#include "../plat-omap/i2c.h"
+#include <plat/i2c.h>
 
 #ifndef __MACH_OMAP2_I2C_H
 #define __MACH_OMAP2_I2C_H
arch/arm/plat-omap/i2c.c +2 -2
index d094273..4645dd4 100644
@@ -31,9 +31,9 @@
 #include <linux/err.h>
 #include <linux/clk.h>
 
-#include <mach/irqs.h>
+#include <plat/i2c.h>
 
-#include "i2c.h"
+#include <mach/irqs.h>
 
 #define OMAP_I2C_MAX_CONTROLLERS 4
 static struct omap_i2c_bus_platform_data i2c_pdata[OMAP_I2C_MAX_CONTROLLERS];
arch/arm/plat-omap/include/plat/i2c.h renamed from arch/arm/plat-omap/i2c.h +0 -0
similarity index 100%
rename from arch/arm/plat-omap/i2c.h
rename to arch/arm/plat-omap/include/plat/i2c.h
author maintainer
#8 lore raw

PATCH 7/11 ARM: OMAP: Move omap-pm-noop.c local to mach-omap2

In reply to Tony Lindgren

This code should be private to mach-omap2.

The only use for it in for omap1 has been in dmtimer.c to check for context loss. However, omap1 does not lose context during idle, so the code is not needed. Further, omap1 timer has OMAP_TIMER_ALWON set, so omap1 was not hitting omap_pm_get_dev_context_loss_count() test.

Cc Jon Hunter <[email protected]>
Cc Kevin Hilman <[email protected]>
---
 arch/arm/mach-omap2/Makefile              |    1 +
 arch/arm/mach-omap2/omap-pm-noop.c        |    4 ++--
 arch/arm/mach-omap2/timer.c               |    2 ++
 arch/arm/plat-omap/Makefile               |    1 -
 arch/arm/plat-omap/dmtimer.c              |   17 ++++++++++-------
 arch/arm/plat-omap/include/plat/dmtimer.h |    2 ++
 6 files changed, 17 insertions(+), 10 deletions(-)
 rename arch/arm/{plat-omap/omap-pm-noop.c => mach-omap2/omap-pm-noop.c} (99%)
arch/arm/mach-omap2/Makefile +1 -0
index e3de5d4..b118ed5 100644
@@ -70,6 +70,7 @@ obj-$(CONFIG_ARCH_OMAP4)		+= pm44xx.o omap-mpuss-lowpower.o
 obj-$(CONFIG_ARCH_OMAP4)		+= sleep44xx.o
 obj-$(CONFIG_SOC_OMAP5)			+= omap-mpuss-lowpower.o sleep44xx.o
 obj-$(CONFIG_PM_DEBUG)			+= pm-debug.o
+obj-$(CONFIG_OMAP_PM_NOOP)		+= omap-pm-noop.o
 
 obj-$(CONFIG_POWER_AVS_OMAP)		+= sr_device.o
 obj-$(CONFIG_POWER_AVS_OMAP_CLASS3)	+= smartreflex-class3.o
arch/arm/mach-omap2/omap-pm-noop.c renamed from arch/arm/plat-omap/omap-pm-noop.c +2 -2
similarity index 99%
rename from arch/arm/plat-omap/omap-pm-noop.c
rename to arch/arm/mach-omap2/omap-pm-noop.c
index 198685b..6a3be2b 100644
@@ -22,8 +22,8 @@
 #include <linux/device.h>
 #include <linux/platform_device.h>
 
-#include "../mach-omap2/omap_device.h"
-#include "../mach-omap2/omap-pm.h"
+#include "omap_device.h"
+#include "omap-pm.h"
 
 static bool off_mode_enabled;
 static int dummy_context_loss_counter;
arch/arm/mach-omap2/timer.c +2 -0
index 565e575..95e4478 100644
@@ -559,6 +559,8 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
 	if (timer_dev_attr)
 		pdata->timer_capability = timer_dev_attr->timer_capability;
 
+	pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count;
+
 	pdev = omap_device_build(name, id, oh, pdata, sizeof(*pdata),
 				 NULL, 0, 0);
 
arch/arm/plat-omap/Makefile +0 -1
index 4bd0ace..50da9bf 100644
@@ -19,4 +19,3 @@ obj-y += $(i2c-omap-m) $(i2c-omap-y)
 # OMAP mailbox framework
 obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox.o
 
-obj-$(CONFIG_OMAP_PM_NOOP) += omap-pm-noop.o
arch/arm/plat-omap/dmtimer.c +10 -7
index 4a0b30a..9a0bbc4 100644
@@ -45,8 +45,6 @@
 
 #include <mach/hardware.h>
 
-#include "../mach-omap2/omap-pm.h"
-
 static u32 omap_reserved_systimers;
 static LIST_HEAD(omap_timer_list);
 static DEFINE_SPINLOCK(dm_timer_lock);
@@ -349,7 +347,8 @@ int omap_dm_timer_start(struct omap_dm_timer *timer)
 	omap_dm_timer_enable(timer);
 
 	if (!(timer->capability & OMAP_TIMER_ALWON)) {
-		if (omap_pm_get_dev_context_loss_count(&timer->pdev->dev) !=
+		if (timer->get_context_loss_count &&
+			timer->get_context_loss_count(&timer->pdev->dev) !=
 				timer->ctx_loss_count)
 			omap_timer_restore_context(timer);
 	}
@@ -378,9 +377,11 @@ int omap_dm_timer_stop(struct omap_dm_timer *timer)
 
 	__omap_dm_timer_stop(timer, timer->posted, rate);
 
-	if (!(timer->capability & OMAP_TIMER_ALWON))
-		timer->ctx_loss_count =
-			omap_pm_get_dev_context_loss_count(&timer->pdev->dev);
+	if (!(timer->capability & OMAP_TIMER_ALWON)) {
+		if (timer->get_context_loss_count)
+			timer->ctx_loss_count =
+				timer->get_context_loss_count(&timer->pdev->dev);
+	}
 
 	/*
 	 * Since the register values are computed and written within
@@ -496,7 +497,8 @@ int omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload,
 	omap_dm_timer_enable(timer);
 
 	if (!(timer->capability & OMAP_TIMER_ALWON)) {
-		if (omap_pm_get_dev_context_loss_count(&timer->pdev->dev) !=
+		if (timer->get_context_loss_count &&
+			timer->get_context_loss_count(&timer->pdev->dev) !=
 				timer->ctx_loss_count)
 			omap_timer_restore_context(timer);
 	}
@@ -730,6 +732,7 @@ static int __devinit omap_dm_timer_probe(struct platform_device *pdev)
 	timer->reserved = omap_dm_timer_reserved_systimer(timer->id);
 	timer->pdev = pdev;
 	timer->capability = pdata->timer_capability;
+	timer->get_context_loss_count = pdata->get_context_loss_count;
 
 	/* Skip pm_runtime_enable for OMAP1 */
 	if (!(timer->capability & OMAP_TIMER_NEEDS_RESET)) {
arch/arm/plat-omap/include/plat/dmtimer.h +2 -0
index 85868e9..3f5b9cf 100644
@@ -94,6 +94,7 @@ struct dmtimer_platform_data {
 	/* set_timer_src - Only used for OMAP1 devices */
 	int (*set_timer_src)(struct platform_device *pdev, int source);
 	u32 timer_capability;
+	int (*get_context_loss_count)(struct device *);
 };
 
 int omap_dm_timer_reserve_systimer(int id);
@@ -263,6 +264,7 @@ struct omap_dm_timer {
 	unsigned reserved:1;
 	unsigned posted:1;
 	struct timer_regs context;
+	int (*get_context_loss_count)(struct device *);
 	int ctx_loss_count;
 	int revision;
 	u32 capability;
author maintainer
#9 lore raw

PATCH 7/11 ARM: OMAP: Move omap-pm-noop.c local to mach-omap2

Quoted 8 lines · Tony Lindgren

This code should be private to mach-omap2.

The only use for it in for omap1 has been in dmtimer.c to check for context loss. However, omap1 does not lose context during idle, so the code is not needed. Further, omap1 timer has OMAP_TIMER_ALWON set, so omap1 was not hitting omap_pm_get_dev_context_loss_count() test.

Noticed one issue with my test compiles in the
omap-for-v3.8/cleanup-headers branch that can be
fixed along with this patch.

drivers/media/platform/omap3isp/ispvideo.c +0 -1
@@ -36,7 +36,6 @@
 #include <media/v4l2-ioctl.h>
 #include <plat/iommu.h>
 #include <plat/iovmm.h>
-#include <plat/omap-pm.h>
 
 #include "ispvideo.h"
 #include "isp.h"

I'll fold that into this patch.

Regards,

Tony

Quoted 146 lines
Cc Jon Hunter <[email protected]>
Cc Kevin Hilman <[email protected]>
---
 arch/arm/mach-omap2/Makefile              |    1 +
 arch/arm/mach-omap2/omap-pm-noop.c        |    4 ++--
 arch/arm/mach-omap2/timer.c               |    2 ++
 arch/arm/plat-omap/Makefile               |    1 -
 arch/arm/plat-omap/dmtimer.c              |   17 ++++++++++-------
 arch/arm/plat-omap/include/plat/dmtimer.h |    2 ++
 6 files changed, 17 insertions(+), 10 deletions(-)
 rename arch/arm/{plat-omap/omap-pm-noop.c => mach-omap2/omap-pm-noop.c} (99%)
arch/arm/mach-omap2/Makefile +1 -0
index e3de5d4..b118ed5 100644
@@ -70,6 +70,7 @@ obj-$(CONFIG_ARCH_OMAP4)		+= pm44xx.o omap-mpuss-lowpower.o
 obj-$(CONFIG_ARCH_OMAP4)		+= sleep44xx.o
 obj-$(CONFIG_SOC_OMAP5)			+= omap-mpuss-lowpower.o sleep44xx.o
 obj-$(CONFIG_PM_DEBUG)			+= pm-debug.o
+obj-$(CONFIG_OMAP_PM_NOOP)		+= omap-pm-noop.o
 
 obj-$(CONFIG_POWER_AVS_OMAP)		+= sr_device.o
 obj-$(CONFIG_POWER_AVS_OMAP_CLASS3)	+= smartreflex-class3.o
arch/arm/mach-omap2/omap-pm-noop.c renamed from arch/arm/plat-omap/omap-pm-noop.c +2 -2
similarity index 99%
rename from arch/arm/plat-omap/omap-pm-noop.c
rename to arch/arm/mach-omap2/omap-pm-noop.c
index 198685b..6a3be2b 100644
@@ -22,8 +22,8 @@
 #include <linux/device.h>
 #include <linux/platform_device.h>
 
-#include "../mach-omap2/omap_device.h"
-#include "../mach-omap2/omap-pm.h"
+#include "omap_device.h"
+#include "omap-pm.h"
 
 static bool off_mode_enabled;
 static int dummy_context_loss_counter;
arch/arm/mach-omap2/timer.c +2 -0
index 565e575..95e4478 100644
@@ -559,6 +559,8 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
 	if (timer_dev_attr)
 		pdata->timer_capability = timer_dev_attr->timer_capability;
 
+	pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count;
+
 	pdev = omap_device_build(name, id, oh, pdata, sizeof(*pdata),
 				 NULL, 0, 0);
 
arch/arm/plat-omap/Makefile +0 -1
index 4bd0ace..50da9bf 100644
@@ -19,4 +19,3 @@ obj-y += $(i2c-omap-m) $(i2c-omap-y)
 # OMAP mailbox framework
 obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox.o
 
-obj-$(CONFIG_OMAP_PM_NOOP) += omap-pm-noop.o
arch/arm/plat-omap/dmtimer.c +10 -7
index 4a0b30a..9a0bbc4 100644
@@ -45,8 +45,6 @@
 
 #include <mach/hardware.h>
 
-#include "../mach-omap2/omap-pm.h"
-
 static u32 omap_reserved_systimers;
 static LIST_HEAD(omap_timer_list);
 static DEFINE_SPINLOCK(dm_timer_lock);
@@ -349,7 +347,8 @@ int omap_dm_timer_start(struct omap_dm_timer *timer)
 	omap_dm_timer_enable(timer);
 
 	if (!(timer->capability & OMAP_TIMER_ALWON)) {
-		if (omap_pm_get_dev_context_loss_count(&timer->pdev->dev) !=
+		if (timer->get_context_loss_count &&
+			timer->get_context_loss_count(&timer->pdev->dev) !=
 				timer->ctx_loss_count)
 			omap_timer_restore_context(timer);
 	}
@@ -378,9 +377,11 @@ int omap_dm_timer_stop(struct omap_dm_timer *timer)
 
 	__omap_dm_timer_stop(timer, timer->posted, rate);
 
-	if (!(timer->capability & OMAP_TIMER_ALWON))
-		timer->ctx_loss_count =
-			omap_pm_get_dev_context_loss_count(&timer->pdev->dev);
+	if (!(timer->capability & OMAP_TIMER_ALWON)) {
+		if (timer->get_context_loss_count)
+			timer->ctx_loss_count =
+				timer->get_context_loss_count(&timer->pdev->dev);
+	}
 
 	/*
 	 * Since the register values are computed and written within
@@ -496,7 +497,8 @@ int omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload,
 	omap_dm_timer_enable(timer);
 
 	if (!(timer->capability & OMAP_TIMER_ALWON)) {
-		if (omap_pm_get_dev_context_loss_count(&timer->pdev->dev) !=
+		if (timer->get_context_loss_count &&
+			timer->get_context_loss_count(&timer->pdev->dev) !=
 				timer->ctx_loss_count)
 			omap_timer_restore_context(timer);
 	}
@@ -730,6 +732,7 @@ static int __devinit omap_dm_timer_probe(struct platform_device *pdev)
 	timer->reserved = omap_dm_timer_reserved_systimer(timer->id);
 	timer->pdev = pdev;
 	timer->capability = pdata->timer_capability;
+	timer->get_context_loss_count = pdata->get_context_loss_count;
 
 	/* Skip pm_runtime_enable for OMAP1 */
 	if (!(timer->capability & OMAP_TIMER_NEEDS_RESET)) {
arch/arm/plat-omap/include/plat/dmtimer.h +2 -1
index 85868e9..3f5b9cf 100644
@@ -94,6 +94,7 @@ struct dmtimer_platform_data {
 	/* set_timer_src - Only used for OMAP1 devices */
 	int (*set_timer_src)(struct platform_device *pdev, int source);
 	u32 timer_capability;
+	int (*get_context_loss_count)(struct device *);
 };
 
 int omap_dm_timer_reserve_systimer(int id);
@@ -263,6 +264,7 @@ struct omap_dm_timer {
 	unsigned reserved:1;
 	unsigned posted:1;
 	struct timer_regs context;
+	int (*get_context_loss_count)(struct device *);
 	int ctx_loss_count;
 	int revision;
 	u32 capability;
 
--

To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#10 lore raw

PATCH 7/11 ARM: OMAP: Move omap-pm-noop.c local to mach-omap2

Hi Tony,

Quoted 17 lines · On Wednesday 31 October 2012 13:58:50 Tony Lindgren wrote:
Quoted 8 lines · Tony Lindgren

This code should be private to mach-omap2.

The only use for it in for omap1 has been in dmtimer.c to check for context loss. However, omap1 does not lose context during idle, so the code is not needed. Further, omap1 timer has OMAP_TIMER_ALWON set, so omap1 was not hitting omap_pm_get_dev_context_loss_count() test.

Noticed one issue with my test compiles in the
omap-for-v3.8/cleanup-headers branch that can be
fixed along with this patch.

drivers/media/platform/omap3isp/ispvideo.c line 39

Quoted 4 lines
drivers/media/platform/omap3isp/ispvideo.c +0 -1
@@ -36,7 +36,6 @@
 #include <media/v4l2-ioctl.h>
 #include <plat/iommu.h>
 #include <plat/iovmm.h>
-#include <plat/omap-pm.h>

The reason this was included was to call omap_pm_set_min_bus_tput() in earlier versions of the driver. We'll have to discuss what to replace that with, but that's another topic.

Quoted 166 lines
drivers/media/platform/omap3isp/ispvideo.c +0 -0
 #include "ispvideo.h"
 #include "isp.h"
 

I'll fold that into this patch.

Regards,

Tony

Quoted 157 lines
Cc Jon Hunter <[email protected]>
Cc Kevin Hilman <[email protected]>

---

 arch/arm/mach-omap2/Makefile              |    1 +
 arch/arm/mach-omap2/omap-pm-noop.c        |    4 ++--
 arch/arm/mach-omap2/timer.c               |    2 ++
 arch/arm/plat-omap/Makefile               |    1 -
 arch/arm/plat-omap/dmtimer.c              |   17 ++++++++++-------
 arch/arm/plat-omap/include/plat/dmtimer.h |    2 ++
 6 files changed, 17 insertions(+), 10 deletions(-)
 rename arch/arm/{plat-omap/omap-pm-noop.c => mach-omap2/omap-pm-noop.c}

(99%)>

arch/arm/mach-omap2/Makefile +0 -0
index e3de5d4..b118ed5 100644
@@ -70,6 +70,7 @@ obj-$(CONFIG_ARCH_OMAP4)		+= pm44xx.o

omap-mpuss-lowpower.o>
obj-$(CONFIG_ARCH_OMAP4) += sleep44xx.o
obj-$(CONFIG_SOC_OMAP5) += omap-mpuss-lowpower.o sleep44xx.o
obj-$(CONFIG_PM_DEBUG) += pm-debug.o

arch/arm/mach-omap2/Makefile +1 -0
+obj-$(CONFIG_OMAP_PM_NOOP)		+= omap-pm-noop.o
 
 obj-$(CONFIG_POWER_AVS_OMAP)		+= sr_device.o
 obj-$(CONFIG_POWER_AVS_OMAP_CLASS3)	+= smartreflex-class3.o
(quoted diff) +0 -0

b/arch/arm/mach-omap2/omap-pm-noop.c similarity index 99% rename from arch/arm/plat-omap/omap-pm-noop.c rename to arch/arm/mach-omap2/omap-pm-noop.c index 198685b..6a3be2b 100644

arch/arm/mach-omap2/omap-pm-noop.c renamed from arch/arm/plat-omap/omap-pm-noop.c +2 -2
@@ -22,8 +22,8 @@
 
 #include <linux/device.h>
 #include <linux/platform_device.h>
 
-#include "../mach-omap2/omap_device.h"
-#include "../mach-omap2/omap-pm.h"
+#include "omap_device.h"
+#include "omap-pm.h"
 
 static bool off_mode_enabled;

static int dummy_context_loss_counter;

arch/arm/mach-omap2/timer.c +2 -0
index 565e575..95e4478 100644
@@ -559,6 +559,8 @@ static int __init omap_timer_init(struct omap_hwmod
 *oh, void *unused)> 
 	if (timer_dev_attr)
 
 		pdata->timer_capability = timer_dev_attr->timer_capability;
 
+	pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count;
+
 
arch/arm/mach-omap2/timer.c +0 -0
 	pdev = omap_device_build(name, id, oh, pdata, sizeof(*pdata),
 
 				 NULL, 0, 0);
arch/arm/plat-omap/Makefile +0 -1
index 4bd0ace..50da9bf 100644
@@ -19,4 +19,3 @@ obj-y += $(i2c-omap-m) $(i2c-omap-y)
 
 # OMAP mailbox framework
 obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox.o
 
-obj-$(CONFIG_OMAP_PM_NOOP) += omap-pm-noop.o
arch/arm/plat-omap/dmtimer.c +0 -2
index 4a0b30a..9a0bbc4 100644
@@ -45,8 +45,6 @@
 
 #include <mach/hardware.h>
 
-#include "../mach-omap2/omap-pm.h"
-
 
 static u32 omap_reserved_systimers;
 static LIST_HEAD(omap_timer_list);

static DEFINE_SPINLOCK(dm_timer_lock);

arch/arm/plat-omap/dmtimer.c +2 -1
@@ -349,7 +347,8 @@ int omap_dm_timer_start(struct omap_dm_timer *timer)
 
 	omap_dm_timer_enable(timer);
 
 	if (!(timer->capability & OMAP_TIMER_ALWON)) {
 
-		if (omap_pm_get_dev_context_loss_count(&timer->pdev->dev) !=
+		if (timer->get_context_loss_count &&
+			timer->get_context_loss_count(&timer->pdev->dev) !=
 
arch/arm/plat-omap/dmtimer.c +5 -3
 				timer->ctx_loss_count)
 
 			omap_timer_restore_context(timer);
 
 	}
@@ -378,9 +377,11 @@ int omap_dm_timer_stop(struct omap_dm_timer *timer)
 
 	__omap_dm_timer_stop(timer, timer->posted, rate);
 
-	if (!(timer->capability & OMAP_TIMER_ALWON))
-		timer->ctx_loss_count =
-			omap_pm_get_dev_context_loss_count(&timer->pdev->dev);
+	if (!(timer->capability & OMAP_TIMER_ALWON)) {
+		if (timer->get_context_loss_count)
+			timer->ctx_loss_count =
+				timer->get_context_loss_count(&timer->pdev->dev);
+	}
 
 	/*
 
arch/arm/plat-omap/dmtimer.c +2 -1
 	 * Since the register values are computed and written within
@@ -496,7 +497,8 @@ int omap_dm_timer_set_load_start(struct omap_dm_timer
 *timer, int autoreload,> 
 	omap_dm_timer_enable(timer);
 
 	if (!(timer->capability & OMAP_TIMER_ALWON)) {
 
-		if (omap_pm_get_dev_context_loss_count(&timer->pdev->dev) !=
+		if (timer->get_context_loss_count &&
+			timer->get_context_loss_count(&timer->pdev->dev) !=
 
arch/arm/plat-omap/dmtimer.c +0 -0
 				timer->ctx_loss_count)
 
 			omap_timer_restore_context(timer);
 
 	}
@@ -730,6 +732,7 @@ static int __devinit omap_dm_timer_probe(struct

platform_device *pdev)>

arch/arm/plat-omap/dmtimer.c +1 -0
 	timer->reserved = omap_dm_timer_reserved_systimer(timer->id);
 	timer->pdev = pdev;
 	timer->capability = pdata->timer_capability;
 
+	timer->get_context_loss_count = pdata->get_context_loss_count;
 
 	/* Skip pm_runtime_enable for OMAP1 */
 	if (!(timer->capability & OMAP_TIMER_NEEDS_RESET)) {
(quoted diff) +0 -0

b/arch/arm/plat-omap/include/plat/dmtimer.h index 85868e9..3f5b9cf 100644

arch/arm/plat-omap/include/plat/dmtimer.h +0 -0
@@ -94,6 +94,7 @@ struct dmtimer_platform_data {
 
Quoted 5 lines

arch/arm/plat-omap/include/plat/dmtimer.h struct dmtimer_platform_data { · line 99

Quoted 5 lines
arch/arm/plat-omap/include/plat/dmtimer.h +1 -0
 	/* set_timer_src - Only used for OMAP1 devices */
 	int (*set_timer_src)(struct platform_device *pdev, int source);
 	u32 timer_capability;
 
+	int (*get_context_loss_count)(struct device *);

That's a step forward for the common zImage, but one step backward for DT support :-) I'm fine with this for now, but do you already have an idea on how to solve that ?

Quoted 16 lines
Quoted 16 lines
arch/arm/plat-omap/include/plat/dmtimer.h +0 -0
 };

int omap_dm_timer_reserve_systimer(int id);

arch/arm/plat-omap/include/plat/dmtimer.h +1 -0
@@ -263,6 +264,7 @@ struct omap_dm_timer {
 
 	unsigned reserved:1;
 	unsigned posted:1;
 	struct timer_regs context;
 
+	int (*get_context_loss_count)(struct device *);
 
arch/arm/plat-omap/include/plat/dmtimer.h +0 -0
 	int ctx_loss_count;
 	int revision;
 	u32 capability;
Signature · 3 lines
Regards,

Laurent Pinchart
author maintainer
#11 lore raw

PATCH 7/11 ARM: OMAP: Move omap-pm-noop.c local to mach-omap2

Quoted 17 lines · Laurent Pinchart

Hi Tony,

Quoted 14 lines · On Wednesday 31 October 2012 13:58:50 Tony Lindgren wrote:
Quoted 8 lines · Tony Lindgren

This code should be private to mach-omap2.

The only use for it in for omap1 has been in dmtimer.c to check for context loss. However, omap1 does not lose context during idle, so the code is not needed. Further, omap1 timer has OMAP_TIMER_ALWON set, so omap1 was not hitting omap_pm_get_dev_context_loss_count() test.

Noticed one issue with my test compiles in the
omap-for-v3.8/cleanup-headers branch that can be
fixed along with this patch.

Quoted 11 lines

drivers/media/platform/omap3isp/ispvideo.c line 39

Quoted 7 lines
drivers/media/platform/omap3isp/ispvideo.c +0 -1
@@ -36,7 +36,6 @@
 #include <media/v4l2-ioctl.h>
 #include <plat/iommu.h>
 #include <plat/iovmm.h>
-#include <plat/omap-pm.h>

The reason this was included was to call omap_pm_set_min_bus_tput() in earlier versions of the driver. We'll have to discuss what to replace that with, but that's another topic.

OK thanks.

Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
(quoted diff) +0 -0
@@ -730,6 +732,7 @@ static int __devinit omap_dm_timer_probe(struct

platform_device *pdev)>

(quoted diff) +1 -0
 	timer->reserved = omap_dm_timer_reserved_systimer(timer->id);
 	timer->pdev = pdev;
 	timer->capability = pdata->timer_capability;
 
+	timer->get_context_loss_count = pdata->get_context_loss_count;
 
 	/* Skip pm_runtime_enable for OMAP1 */
 	if (!(timer->capability & OMAP_TIMER_NEEDS_RESET)) {
(quoted diff) +0 -0

b/arch/arm/plat-omap/include/plat/dmtimer.h index 85868e9..3f5b9cf 100644

arch/arm/plat-omap/include/plat/dmtimer.h +0 -0
@@ -94,6 +94,7 @@ struct dmtimer_platform_data {
 
 	/* set_timer_src - Only used for OMAP1 devices */
 	int (*set_timer_src)(struct platform_device *pdev, int source);
 	u32 timer_capability;
 
Quoted 5 lines
Quoted 1 line

arch/arm/plat-omap/include/plat/dmtimer.h struct dmtimer_platform_data { · line 99

Quoted 1 line
arch/arm/plat-omap/include/plat/dmtimer.h +1 -0
+	int (*get_context_loss_count)(struct device *);

That's a step forward for the common zImage, but one step backward for DT support :-) I'm fine with this for now, but do you already have an idea on how to solve that ?

When it's converted to be a device driver, it can do it using runtime PM calls.

Regards,

Tony

#12 lore raw

PATCH 7/11 ARM: OMAP: Move omap-pm-noop.c local to mach-omap2

Quoted 53 lines · Tony Lindgren
Quoted 17 lines · Laurent Pinchart

Hi Tony,

Quoted 14 lines · On Wednesday 31 October 2012 13:58:50 Tony Lindgren wrote:
Quoted 8 lines · Tony Lindgren

This code should be private to mach-omap2.

The only use for it in for omap1 has been in dmtimer.c to check for context loss. However, omap1 does not lose context during idle, so the code is not needed. Further, omap1 timer has OMAP_TIMER_ALWON set, so omap1 was not hitting omap_pm_get_dev_context_loss_count() test.

Noticed one issue with my test compiles in the
omap-for-v3.8/cleanup-headers branch that can be
fixed along with this patch.

Quoted 11 lines

drivers/media/platform/omap3isp/ispvideo.c line 39

Quoted 7 lines
drivers/media/platform/omap3isp/ispvideo.c +0 -1
@@ -36,7 +36,6 @@
 #include <media/v4l2-ioctl.h>
 #include <plat/iommu.h>
 #include <plat/iovmm.h>
-#include <plat/omap-pm.h>

The reason this was included was to call omap_pm_set_min_bus_tput() in earlier versions of the driver. We'll have to discuss what to replace that with, but that's another topic.

OK thanks.

Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
(quoted diff) +0 -0
@@ -730,6 +732,7 @@ static int __devinit omap_dm_timer_probe(struct

platform_device *pdev)>

(quoted diff) +1 -0
 	timer->reserved = omap_dm_timer_reserved_systimer(timer->id);
 	timer->pdev = pdev;
 	timer->capability = pdata->timer_capability;
 
+	timer->get_context_loss_count = pdata->get_context_loss_count;
 
 	/* Skip pm_runtime_enable for OMAP1 */
 	if (!(timer->capability & OMAP_TIMER_NEEDS_RESET)) {
(quoted diff) +0 -0

b/arch/arm/plat-omap/include/plat/dmtimer.h index 85868e9..3f5b9cf 100644

arch/arm/plat-omap/include/plat/dmtimer.h +0 -0
@@ -94,6 +94,7 @@ struct dmtimer_platform_data {
 
 	/* set_timer_src - Only used for OMAP1 devices */
 	int (*set_timer_src)(struct platform_device *pdev, int source);
 	u32 timer_capability;
 
Quoted 8 lines
Quoted 5 lines
Quoted 1 line

arch/arm/plat-omap/include/plat/dmtimer.h struct dmtimer_platform_data { · line 99

Quoted 1 line
arch/arm/plat-omap/include/plat/dmtimer.h +1 -0
+	int (*get_context_loss_count)(struct device *);

That's a step forward for the common zImage, but one step backward for DT support :-) I'm fine with this for now, but do you already have an idea on how to solve that ?

When it's converted to be a device driver, it can do it using runtime PM calls.

I am not sure if you are referring to runtime pm callbacks here, but if so I am not sure I follow. Drivers such as dmtimer and gpio that are using runtime pm are still dependent on OMAP specific APIs (such as omap_pm_get_dev_context_loss_count()) for determining if the context was lost between suspending and resuming the device. So I am not sure how runtime pm solves this.

Speaking with Rob Herring, one solution for DT would be using bus notifiers to populate such function pointers when a device is added. Given that there are a few devices using this architecture specific API for context loss I am wondering if we can do something generic in omap_device.c for DT.

Cheers
Jon

author maintainer
#13 lore raw

PATCH 7/11 ARM: OMAP: Move omap-pm-noop.c local to mach-omap2

Quoted 11 lines · Jon Hunter
Quoted 3 lines · Tony Lindgren

When it's converted to be a device driver, it can do it using runtime PM calls.

I am not sure if you are referring to runtime pm callbacks here, but if so I am not sure I follow. Drivers such as dmtimer and gpio that are using runtime pm are still dependent on OMAP specific APIs (such as omap_pm_get_dev_context_loss_count()) for determining if the context was lost between suspending and resuming the device. So I am not sure how runtime pm solves this.

Ah right.

Quoted 5 lines

Speaking with Rob Herring, one solution for DT would be using bus notifiers to populate such function pointers when a device is added. Given that there are a few devices using this architecture specific API for context loss I am wondering if we can do something generic in omap_device.c for DT.

Sounds good to me.

Regards,

Tony

author maintainer
#14 lore raw

PATCH 8/11 ARM: OMAP: Remove plat-omap/common.h

In reply to Tony Lindgren

Most of the prototypes in plat-omap/common.h are not common to omap1 and omap2+, they are local to omap2+ and should not be in plat-omap/common.h.

The only shared function prototype in this file is omap_init_clocksource_32k(), let's put that into counter-32k.h.

Note that the new plat/counter-32k.h must not be included from drivers, that will break omap2+ build for CONFIG_MULTIPLATFORM.

---
 arch/arm/mach-omap1/common.h                       |    1 -
 arch/arm/mach-omap1/timer32k.c                     |    1 +
 arch/arm/mach-omap2/cm33xx.c                       |    2 -
 arch/arm/mach-omap2/common.h                       |    5 ++-
 .../mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c |    2 -
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c         |    2 -
 arch/arm/mach-omap2/prm33xx.c                      |    2 -
 arch/arm/mach-omap2/prm_common.c                   |    1 -
 arch/arm/mach-omap2/timer.c                        |    1 +
 arch/arm/plat-omap/common.c                        |    1 -
 arch/arm/plat-omap/common.h                        |   36 --------------------
 arch/arm/plat-omap/counter_32k.c                   |    2 -
 arch/arm/plat-omap/include/plat/counter-32k.h      |    1 +
 13 files changed, 6 insertions(+), 51 deletions(-)
 delete mode 100644 arch/arm/plat-omap/common.h
 create mode 100644 arch/arm/plat-omap/include/plat/counter-32k.h
arch/arm/mach-omap1/common.h +0 -1
index 3d40f6e..fc8c944 100644
@@ -26,7 +26,6 @@
 #ifndef __ARCH_ARM_MACH_OMAP1_COMMON_H
 #define __ARCH_ARM_MACH_OMAP1_COMMON_H
 
-#include "../plat-omap/common.h"
 #include <linux/mtd/mtd.h>
 #include <linux/i2c-omap.h>
 
arch/arm/mach-omap1/timer32k.c +1 -0
index 7452954..8936819 100644
@@ -50,6 +50,7 @@
 #include <asm/mach/irq.h>
 #include <asm/mach/time.h>
 
+#include <plat/counter-32k.h>
 #include <plat/dmtimer.h>
 
 #include <mach/hardware.h>
arch/arm/mach-omap2/cm33xx.c +0 -2
index b4938ab..ed8dcaf 100644
@@ -22,8 +22,6 @@
 #include <linux/err.h>
 #include <linux/io.h>
 
-#include "../plat-omap/common.h"
-
 #include "cm.h"
 #include "cm33xx.h"
 #include "cm-regbits-34xx.h"
arch/arm/mach-omap2/common.h +3 -2
index c925c80..426fcfc 100644
@@ -34,8 +34,6 @@
 
 #include <asm/proc-fns.h>
 
-#include "../plat-omap/common.h"
-
 #include "i2c.h"
 #include "serial.h"
 
@@ -345,5 +343,8 @@ struct omap2_hsmmc_info;
 extern int omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers);
 extern void omap_reserve(void);
 
+struct omap_hwmod;
+extern int omap_dss_reset(struct omap_hwmod *);
+
 #endif /* __ASSEMBLER__ */
 #endif /* __ARCH_ARM_MACH_OMAP2PLUS_COMMON_H */
arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c +0 -2
index 05c6a59..40d6c93 100644
@@ -12,8 +12,6 @@
 
 #include <plat-omap/dma-omap.h>
 
-#include "../plat-omap/common.h"
-
 #include "omap_hwmod.h"
 #include "hdq1w.h"
 
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +0 -2
index 5b9be73..7a61328 100644
@@ -30,8 +30,6 @@
 #include <plat/dmtimer.h>
 #include <plat/iommu.h>
 
-#include "../plat-omap/common.h"
-
 #include "omap_hwmod.h"
 #include "omap_hwmod_common_data.h"
 #include "cm1_44xx.h"
arch/arm/mach-omap2/prm33xx.c +0 -2
index 624ade5..0d8abb5 100644
@@ -19,8 +19,6 @@
 #include <linux/err.h>
 #include <linux/io.h>
 
-#include "../plat-omap/common.h"
-
 #include "common.h"
 #include "prm33xx.h"
 #include "prm-regbits-33xx.h"
arch/arm/mach-omap2/prm_common.c +0 -1
index 6fabbd8..3442227 100644
@@ -24,7 +24,6 @@
 #include <linux/interrupt.h>
 #include <linux/slab.h>
 
-#include "../plat-omap/common.h"
 #include <plat/prcm.h>
 
 #include "prm2xxx_3xxx.h"
arch/arm/mach-omap2/timer.c +1 -0
index 95e4478..c5bc2cb 100644
@@ -45,6 +45,7 @@
 #include <asm/arch_timer.h>
 #include "omap_hwmod.h"
 #include "omap_device.h"
+#include <plat/counter-32k.h>
 #include <plat/dmtimer.h>
 #include "omap-pm.h"
 
arch/arm/plat-omap/common.c +0 -1
index a1555e0..bf6cd80 100644
@@ -16,7 +16,6 @@
 #include <linux/io.h>
 #include <linux/dma-mapping.h>
 
-#include "common.h"
 #include <plat-omap/dma-omap.h>
 
 void __init omap_init_consistent_dma_size(void)
arch/arm/plat-omap/common.h deleted +0 -36
deleted file mode 100644
index 8ae0542..0000000
@@ -1,36 +0,0 @@
-/*
- * Header for shared OMAP code in plat-omap.
- *
- * 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; either version 2 of the License, or (at your
- * option) any later version.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
- * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * You should have received a copy of the  GNU General Public License along
- * with this program; if not, write  to the Free Software Foundation, Inc.,
- * 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef __ARCH_ARM_MACH_OMAP_COMMON_H
-#define __ARCH_ARM_MACH_OMAP_COMMON_H
-
-extern int __init omap_init_clocksource_32k(void __iomem *vbase);
-
-extern void __init omap_check_revision(void);
-
-extern void omap_reserve(void);
-struct omap_hwmod;
-extern int omap_dss_reset(struct omap_hwmod *);
-
-#endif /* __ARCH_ARM_MACH_OMAP_COMMON_H */
arch/arm/plat-omap/counter_32k.c +0 -2
index 66bf3f9..f3771cd 100644
@@ -22,8 +22,6 @@
 #include <asm/mach/time.h>
 #include <asm/sched_clock.h>
 
-#include "common.h"
-
 /* OMAP2_32KSYNCNT_CR_OFF: offset of 32ksync counter register */
 #define OMAP2_32KSYNCNT_REV_OFF		0x0
 #define OMAP2_32KSYNCNT_REV_SCHEME	(0x3 << 30)
arch/arm/plat-omap/include/plat/counter-32k.h new file +1 -0
new file mode 100644
index 0000000..da000d4
@@ -0,0 +1 @@
+int omap_init_clocksource_32k(void __iomem *vbase);
author maintainer
#15 lore raw

PATCH 9/11 ARM: OMAP: Fix relative includes for debug-devices.h

In reply to Tony Lindgren

As discussed on linux-arm-kernel, we want to avoid relative includes for the arch/arm/*omap* shared code:

http://www.spinics.net/lists/linux-omap/msg80520.html

Let's add plat/debug-devices.h for debug_card_init() to fix the relative includes.

Note that drivers must not use this header as it will break build for omap2+ CONFIG_MULTIPLATFORM builds.

---
 arch/arm/mach-omap2/board-h4.c                  |    2 +-
 arch/arm/plat-omap/debug-devices.c              |    2 +-
 arch/arm/plat-omap/include/plat/debug-devices.h |    7 -------
 3 files changed, 2 insertions(+), 9 deletions(-)
 rename arch/arm/{mach-omap2/debug-devices.h => plat-omap/include/plat/debug-devices.h} (54%)
arch/arm/mach-omap2/board-h4.c +1 -1
index bd11b0a..8668c72 100644
@@ -33,7 +33,7 @@
 #include <asm/mach/map.h>
 
 #include <plat-omap/dma-omap.h>
-#include "debug-devices.h"
+#include <plat/debug-devices.h>
 
 #include <video/omapdss.h>
 #include <video/omap-panel-generic-dpi.h>
arch/arm/plat-omap/debug-devices.c +1 -1
index 5a4678e..b49be51 100644
@@ -16,7 +16,7 @@
 #include <linux/smc91x.h>
 
 #include <mach/hardware.h>
-#include "../mach-omap2/debug-devices.h"
+#include <plat/debug-devices.h>
 
 /* Many OMAP development platforms reuse the same "debug board"; these
  * platforms include H2, H3, H4, and Perseus2.
arch/arm/plat-omap/include/plat/debug-devices.h renamed from arch/arm/mach-omap2/debug-devices.h +0 -7
similarity index 54%
rename from arch/arm/mach-omap2/debug-devices.h
rename to arch/arm/plat-omap/include/plat/debug-devices.h
index a4edbd2..8fc4287 100644
@@ -1,9 +1,2 @@
-#ifndef _OMAP_DEBUG_DEVICES_H
-#define _OMAP_DEBUG_DEVICES_H
-
-#include <linux/types.h>
-
 /* for TI reference platforms sharing the same debug card */
 extern int debug_card_init(u32 addr, unsigned gpio);
-
-#endif
maintainer
#16 lore raw

PATCH 9/11 ARM: OMAP: Fix relative includes for debug-devices.h

Quoted 5 lines · Tony Lindgren

As discussed on linux-arm-kernel, we want to avoid relative includes for the arch/arm/*omap* shared code:

http://www.spinics.net/lists/linux-omap/msg80520.html

Quoted 8 lines

Let's add plat/debug-devices.h for debug_card_init() to fix the relative includes.

Note that drivers must not use this header as it will break build for omap2+ CONFIG_MULTIPLATFORM builds.

Looks fine to me; the original patch didn't use relative include paths. At some point the debug card device code should be moved into drivers/ as we discussed...

- Paul

author maintainer
#17 lore raw

PATCH 10/11 ARM: OMAP: Remove cpu_is_omap usage from plat-omap/dma.c

In reply to Tony Lindgren

This code will be eventually in drivers, and for the code in the drivers we don't want to have any cpu_is_omap usage. Those macros should be private to arch/arm/mach-omap1 and arch/arm/mach-omap2.

To fix this, let's move the define for dma_omap2plus() to dma-omap.h, and use the existing dma_attr passed in the platform_data as the revision registers are what they are.

Note that we can now also remove the relative includes introduced by the recent clean-up patches.

Cc Russell King <[email protected]>
Cc Vinod Koul <[email protected]>
Cc Lokesh Vutla <[email protected]>
---
 arch/arm/mach-omap1/dma.c                       |    3 +
 arch/arm/mach-omap2/dma.c                       |    3 +
 arch/arm/plat-omap/dma.c                        |  108 +++++++++++------------
 arch/arm/plat-omap/include/plat-omap/dma-omap.h |   19 +++-
 drivers/dma/omap-dma.c                          |    6 -
 5 files changed, 73 insertions(+), 66 deletions(-)
arch/arm/mach-omap1/dma.c +3 -0
index 71305c15..978aed8 100644
@@ -321,6 +321,9 @@ static int __init omap1_system_dma_init(void)
 		d->dev_caps = ENABLE_1510_MODE;
 	enable_1510_mode = d->dev_caps & ENABLE_1510_MODE;
 
+	if (cpu_is_omap16xx())
+		d->dev_caps = ENABLE_16XX_MODE;
+
 	d->dev_caps		|= SRC_PORT;
 	d->dev_caps		|= DST_PORT;
 	d->dev_caps		|= SRC_INDEX;
arch/arm/mach-omap2/dma.c +3 -0
index b1926cd..e5aba58 100644
@@ -276,6 +276,9 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
 		return -ENOMEM;
 	}
 
+	if (cpu_is_omap34xx() && (omap_type() != OMAP2_DEVICE_TYPE_GP))
+		d->dev_caps |= HS_CHANNELS_RESERVED;
+
 	/* Check the capabilities register for descriptor loading feature */
 	if (dma_read(CAPS_0, 0) & DMA_HAS_DESCRIPTOR_CAPS)
 		dma_common_ch_end = CCDN;
arch/arm/plat-omap/dma.c +52 -56

401 lines not on this page · raw message

arch/arm/plat-omap/include/plat-omap/dma-omap.h +15 -4
index 222be7e..f89886d 100644
@@ -130,10 +130,12 @@
 #define SRC_PORT			BIT(0x7)
 #define DST_PORT			BIT(0x8)
 #define SRC_INDEX			BIT(0x9)
-#define DST_INDEX			BIT(0xA)
-#define IS_BURST_ONLY4			BIT(0xB)
-#define CLEAR_CSR_ON_READ		BIT(0xC)
-#define IS_WORD_16			BIT(0xD)
+#define DST_INDEX			BIT(0xa)
+#define IS_BURST_ONLY4			BIT(0xb)
+#define CLEAR_CSR_ON_READ		BIT(0xc)
+#define IS_WORD_16			BIT(0xd)
+#define ENABLE_16XX_MODE		BIT(0xe)
+#define HS_CHANNELS_RESERVED		BIT(0xf)
 
 /* Defines for DMA Capabilities */
 #define DMA_HAS_TRANSPARENT_CAPS	(0x1 << 18)
@@ -270,6 +272,15 @@ struct omap_system_dma_plat_info {
 	u32 (*dma_read)(int reg, int lch);
 };
 
+#ifdef CONFIG_ARCH_OMAP2PLUS
+#define dma_omap2plus()	1
+#else
+#define dma_omap2plus()	0
+#endif
+#define dma_omap1()	(!dma_omap2plus())
+#define dma_omap15xx()	((dma_omap1() && (d->dev_caps & ENABLE_1510_MODE)))
+#define dma_omap16xx()	((dma_omap1() && (d->dev_caps & ENABLE_16XX_MODE)))
+
 extern void __init omap_init_consistent_dma_size(void);
 extern void omap_set_dma_priority(int lch, int dst_port, int priority);
 extern int omap_request_dma(int dev_id, const char *dev_name,
drivers/dma/omap-dma.c +0 -6
index 56d9253..7d35c23 100644
@@ -21,12 +21,6 @@
 
 #include <plat-omap/dma-omap.h>
 
-#ifdef CONFIG_ARCH_OMAP2PLUS
-#define dma_omap2plus()	1
-#else
-#define dma_omap2plus()	0
-#endif
-
 struct omap_dmadev {
 	struct dma_device ddev;
 	spinlock_t lock;
author maintainer
#18 lore raw

PATCH 11/11 ARM: OMAP1: Remove relative includes

In reply to Tony Lindgren

As discussed on linux-arm-kernel, we want to avoid relative includes for the arch/arm/*omap* code:

http://www.spinics.net/lists/linux-omap/msg80520.html

Note that eventually when the omap1 specific drivers are fixed to not use cpu_is_omap macros and not depend on mach/hardware.h, this patch can be reverted and these headers can be local. But since just fixing the drivers for omap2+ is already a big enough hassle, let's deal with that properly first.

---
 arch/arm/mach-omap1/include/mach/entry-macro.S |    2 
 arch/arm/mach-omap1/include/mach/hardware.h    |    5 -
 arch/arm/mach-omap1/include/mach/memory.h      |    2 
 arch/arm/mach-omap1/include/mach/soc.h         |  229 ++++++++++++++++++++++++
 arch/arm/mach-omap1/iomap.h                    |    3 
 arch/arm/mach-omap1/sleep.S                    |    2 
 arch/arm/mach-omap1/soc.h                      |  229 ------------------------
 7 files changed, 238 insertions(+), 234 deletions(-)
 create mode 100644 arch/arm/mach-omap1/include/mach/soc.h
arch/arm/mach-omap1/include/mach/entry-macro.S +0 -2
index 88f08ca..78a8c6c 100644
@@ -13,8 +13,6 @@
 #include <mach/hardware.h>
 #include <mach/irqs.h>
 
-#include "../../iomap.h"
-
 		.macro  get_irqnr_preamble, base, tmp
 		.endm
 
arch/arm/mach-omap1/include/mach/hardware.h +4 -1
index dc3237b..5875a50 100644
@@ -39,7 +39,7 @@
 #include <asm/sizes.h>
 #ifndef __ASSEMBLER__
 #include <asm/types.h>
-#include "../../mach-omap1/soc.h"
+#include <mach/soc.h>
 
 /*
  * NOTE: Please use ioremap + __raw_read/write where possible instead of these
@@ -72,6 +72,9 @@ static inline u32 omap_cs3_phys(void)
 
 #endif	/* ifndef __ASSEMBLER__ */
 
+#define OMAP1_IO_OFFSET		0x01000000	/* Virtual IO = 0xfefb0000 */
+#define OMAP1_IO_ADDRESS(pa)	IOMEM((pa) - OMAP1_IO_OFFSET)
+
 #include <mach/serial.h>
 
 /*
arch/arm/mach-omap1/include/mach/memory.h +1 -1
index 351ae4f..3c25305 100644
@@ -19,7 +19,7 @@
  * because of the strncmp().
  */
 #if defined(CONFIG_ARCH_OMAP15XX) && !defined(__ASSEMBLER__)
-#include "../../mach-omap1/soc.h"
+#include <mach/soc.h>
 
 /*
  * OMAP-1510 Local Bus address offset
arch/arm/mach-omap1/include/mach/soc.h new file +229 -0

229 lines not on this page · raw message

arch/arm/mach-omap1/iomap.h +0 -3
index 330c471..f4e2d7a 100644
@@ -22,9 +22,6 @@
  * 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#define OMAP1_IO_OFFSET		0x01000000	/* Virtual IO = 0xfefb0000 */
-#define OMAP1_IO_ADDRESS(pa)	IOMEM((pa) - OMAP1_IO_OFFSET)
-
 /*
  * ----------------------------------------------------------------------------
  * Omap1 specific IO mapping
arch/arm/mach-omap1/sleep.S +2 -0
index 0e62874..a908c51 100644
@@ -36,6 +36,8 @@
 
 #include <asm/assembler.h>
 
+#include <mach/hardware.h>
+
 #include "iomap.h"
 #include "pm.h"
 
arch/arm/mach-omap1/soc.h +2 -227

231 lines not on this page · raw message

author maintainer
#19 lore raw

PATCH 11/11 ARM: OMAP1: Remove relative includes

Quoted 11 lines · Tony Lindgren

As discussed on linux-arm-kernel, we want to avoid relative includes for the arch/arm/*omap* code:

http://www.spinics.net/lists/linux-omap/msg80520.html

Note that eventually when the omap1 specific drivers are fixed to not use cpu_is_omap macros and not depend on mach/hardware.h, this patch can be reverted and these headers can be local. But since just fixing the drivers for omap2+ is already a big enough hassle, let's deal with that properly first.

Forgot to change plat/cpu.h in this patch, will fold it into this patch as below.

Regards,

Tony

arch/arm/plat-omap/include/plat/cpu.h +1 -1
@@ -29,7 +29,7 @@
 #define __ASM_ARCH_OMAP_CPU_H
 
 #ifdef CONFIG_ARCH_OMAP1
-#include "../../mach-omap1/soc.h"
+#include <mach/soc.h>
 #endif
 
 #ifdef CONFIG_ARCH_OMAP2PLUS
author maintainer
#20 lore raw

[PATCH 12/11] ARM: OMAP: Fix relative includes for fpga.h

In reply to Tony Lindgren

As discussed on linux-arm-kernel, we want to avoid relative includes for the arch/arm/*omap* code:

http://www.spinics.net/lists/linux-omap/msg80520.html

Fix includes for fpga.h by making fpga.h local
to mach-omap1. The common code in plat-omap just
needs to know the struct h2p2_dbg_fpga, which can
be local to debug-leds.c.

This also fixes the braindead <../*.h> style includes that got accidentally added with search and replace during the cleanup.

---

Looks like my grepping missed few totally braindead includes I accidentally introduced, posting them as additional patches to this series.

arch/arm/mach-omap1/board-fsample.c +1 -1
index 8b5800a..e067f22 100644
@@ -30,13 +30,13 @@
 #include <mach/tc.h>
 #include <mach/mux.h>
 #include <mach/flash.h>
-#include <../plat-omap/fpga.h>
 #include <linux/platform_data/keypad-omap.h>
 
 #include <mach/hardware.h>
 
 #include "iomap.h"
 #include "common.h"
+#include "fpga.h"
 
 /* fsample is pretty close to p2-sample */
 
arch/arm/mach-omap1/board-innovator.c +0 -1
index c66334f..f8033fa 100644
@@ -33,7 +33,6 @@
 
 #include <mach/mux.h>
 #include <mach/flash.h>
-#include <../plat-omap/fpga.h>
 #include <mach/tc.h>
 #include <linux/platform_data/keypad-omap.h>
 
arch/arm/mach-omap1/board-perseus2.c +1 -1
index 030bd48..9a7e483 100644
@@ -30,13 +30,13 @@
 
 #include <mach/tc.h>
 #include <mach/mux.h>
-#include <../plat-omap/fpga.h>
 #include <mach/flash.h>
 
 #include <mach/hardware.h>
 
 #include "iomap.h"
 #include "common.h"
+#include "fpga.h"
 
 static const unsigned int p2_keymap[] = {
 	KEY(0, 0, KEY_UP),
arch/arm/mach-omap1/fpga.c +1 -2
index d940fac..8bd71b2 100644
@@ -27,12 +27,11 @@
 #include <asm/irq.h>
 #include <asm/mach/irq.h>
 
-#include <../plat-omap/fpga.h>
-
 #include <mach/hardware.h>
 
 #include "iomap.h"
 #include "common.h"
+#include "fpga.h"
 
 static void fpga_mask_irq(struct irq_data *d)
 {
arch/arm/mach-omap1/fpga.h new file +52 -0

52 lines not on this page · raw message

arch/arm/plat-omap/debug-leds.c +20 -3
index feca128..c43ea21 100644
@@ -17,16 +17,33 @@
 #include <linux/platform_data/gpio-omap.h>
 #include <linux/slab.h>
 
-#include <mach/hardware.h>
 #include <asm/mach-types.h>
 
-#include "fpga.h"
-
 /* Many OMAP development platforms reuse the same "debug board"; these
  * platforms include H2, H3, H4, and Perseus2.  There are 16 LEDs on the
  * debug board (all green), accessed through FPGA registers.
  */
 
+/* NOTE:  most boards don't have a static mapping for the FPGA ... */
+struct h2p2_dbg_fpga {
+	/* offset 0x00 */
+	u16		smc91x[8];
+	/* offset 0x10 */
+	u16		fpga_rev;
+	u16		board_rev;
+	u16		gpio_outputs;
+	u16		leds;
+	/* offset 0x18 */
+	u16		misc_inputs;
+	u16		lan_status;
+	u16		lan_reset;
+	u16		reserved0;
+	/* offset 0x20 */
+	u16		ps2_data;
+	u16		ps2_ctrl;
+	/* plus also 4 rs232 ports ... */
+};
+
 static struct h2p2_dbg_fpga __iomem *fpga;
 
 static u16 fpga_led_state;
arch/arm/plat-omap/fpga.h deleted +0 -74

74 lines not on this page · raw message

#21 lore raw

[PATCH 12/11] ARM: OMAP: Fix relative includes for fpga.h

Hi Tony,

After rebasing on top of your omap-for-v3.8/tmp-merge, I realized that this patch is generating a build break due to removal of the fpga.h include from debug-leds.c.

arch/arm/plat-omap/debug-leds.c: In function 'fpga_probe':
arch/arm/plat-omap/debug-leds.c:114:9: error: 'H2P2_DBG_FPGA_SIZE' undeclared (first use in this function) arch/arm/plat-omap/debug-leds.c:114:9: note: each undeclared identifier is reported only once for each function it appears in

It does not appear with the omap2plus_config but will appear if you enable the NEW_LEDS support that enable OMAP_DEBUG_LEDS.

I'm not sure why the size is still hard coded. In theory, assuming the resource is properly initialized, resource_size should be usable. The patch below is fixing that.

Regards,
Benoit

---

Quoted 1 line

From 81e1c3dddd1cd78b1f5a04983cf920b287764f11 Mon Sep 17 00:00:00 2001

From: Benoit Cousson <[email protected]>
Date: Mon, 12 Nov 2012 11:44:03 +0100
Subject: [PATCH] ARM: OMAP: debug-leds: Use resource_size instead of hard coded macro

The debug-leds driver should not rely on hard coded macro for the iomem size but use the resource size instead.

---
 arch/arm/plat-omap/debug-leds.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/plat-omap/debug-leds.c +1 -1
index c43ea21..aa7ebc6 100644
@@ -111,7 +111,7 @@ static int fpga_probe(struct platform_device *pdev)
 	if (!iomem)
 		return -ENODEV;
 
-	fpga = ioremap(iomem->start, H2P2_DBG_FPGA_SIZE);
+	fpga = ioremap(iomem->start, resource_size(iomem));
 	__raw_writew(0xff, &fpga->leds);
 
 	for (i = 0; i < ARRAY_SIZE(dbg_leds); i++) {
Signature · 1 line
1.7.0.4
author maintainer
#22 lore raw

[PATCH 12/11] ARM: OMAP: Fix relative includes for fpga.h

Quoted 4 lines · Benoit Cousson

Hi Tony,

After rebasing on top of your omap-for-v3.8/tmp-merge, I realized that this patch is generating a build break due to removal of the fpga.h include from debug-leds.c.

Quoted 8 lines

arch/arm/plat-omap/debug-leds.c: In function 'fpga_probe':
arch/arm/plat-omap/debug-leds.c:114:9: error: 'H2P2_DBG_FPGA_SIZE' undeclared (first use in this function) arch/arm/plat-omap/debug-leds.c:114:9: note: each undeclared identifier is reported only once for each function it appears in

It does not appear with the omap2plus_config but will appear if you enable the NEW_LEDS support that enable OMAP_DEBUG_LEDS.

I'm not sure why the size is still hard coded. In theory, assuming the resource is properly initialized, resource_size should be usable. The patch below is fixing that.

Thanks looks like I missed that one. Applying into omap-for-v3.8/cleanup-headers-prepare-multiplatform-v3.

Regards,

Tony

author maintainer
#23 lore raw

[PATCH 13/11] ARM: OMAP2+: Fix relative includes for serial.h

In reply to Tony Lindgren

As discussed on linux-arm-kernel, we want to avoid relative includes for the arch/arm/*omap* code:

http://www.spinics.net/lists/linux-omap/msg80520.html

Fix serial.h by moving it to mach/serial.h.

arch/arm/mach-omap2/include/mach/debug-macro.S +1 -1
index 4b5cbdf..cfaed13 100644
@@ -13,7 +13,7 @@
 
 #include <linux/serial_reg.h>
 
-#include <../mach-omap2/serial.h>
+#include <mach/serial.h>
 
 #define UART_OFFSET(addr)	((addr) & 0x00ffffff)
 
arch/arm/mach-omap2/include/mach/serial.h new file +103 -0

103 lines not on this page · raw message

arch/arm/mach-omap2/include/mach/uncompress.h +1 -1
index 28d1ec0..8e3546d 100644
@@ -23,7 +23,7 @@
 #include <asm/memory.h>
 #include <asm/mach-types.h>
 
-#include <../mach-omap2/serial.h>
+#include <mach/serial.h>
 
 #define MDR1_MODE_MASK			0x07
 
arch/arm/mach-omap2/serial.h +1 -112

113 lines not on this page · raw message