ARM: OMAP: resolve some warnings
Subsystems (9)
v4 cover ARM: OMAP: resolve some warnings
This is the latest version of the OMAP warnings cleanup series. This version fixes most of the warnings with arch/arm/mach-omap1, arch/arm/mach-omap2, and arch/arm/plat-omap. It also fixes some bugs discovered in the process.
Boot-tested on 5912OSK, N800, 35xx BeagleBoard, 37xx EVM, and 4430 Pandaboard. Build-tested on the configs listed below, which are available from git://git.pwsan.com/omap_kconfigs.
This series is also available from git://git.pwsan.com/linux-2.6
in the branch 'sparse_cppcheck_cleanup_3.5'.
Felipe, one of the patches in this branch touches drivers/usb/host/ohci-omap.c - could you ack it for me if you are okay with the change?
- Paul
---
object size (delta in bytes from v3.4-rc2):
text data bss total kernel
-84 +24 0 -60 5912osk_testconfig/vmlinux -100 -8 0 -108 n800_multi_omap2xxx/vmlinux -68 -8 0 -76 n800_testconfig/vmlinux -224 +56 -32 -200 omap1_defconfig/vmlinux -148 +32 0 -116 omap2_4_testconfig/vmlinux -212 0 0 -212 omap2plus_defconfig/vmlinux -148 0 0 -148 omap2plus_no_pm/vmlinux -152 0 0 -152 omap3_4_testconfig/vmlinux -100 -8 0 -108 omap3_testconfig/vmlinux
-188 -24 -64 -276 omap4_testconfig/vmlinux
Paul Walmsley (12):
ARM: OMAP2+: declare file-local functions as static
ARM: OMAP: add includes for missing prototypes
ARM: OMAP1: OCPI: move to mach-omap1/
ARM: OMAP1: OHCI: use platform_data fn ptr to enable OCPI bus
ARM: OMAP2+: GPMC: resolve type-conversion warning from sparse
ARM: OMAP: fix 'using plain integer as NULL pointer' sparse warnings
ARM: OMAP: OCM RAM: use memset_io() when clearing SRAM
ARM: OMAP: DMA: use constant array maximum, drop some LCD DMA code
ARM: OMAP: USB: remove unnecessary sideways include
ARM: OMAP1: board files: deduplicate and clean some NAND-related code
ARM: OMAP1: DMTIMER: fix broken timer clock source selection
ARM: OMAP2+: clean up some cppcheck warnings
arch/arm/mach-omap1/Makefile | 13 ++++++---
arch/arm/mach-omap1/ams-delta-fiq.c | 2 +
arch/arm/mach-omap1/board-fsample.c | 16 +----------
arch/arm/mach-omap1/board-h2.c | 17 +----------
arch/arm/mach-omap1/board-h3.c | 16 +----------
arch/arm/mach-omap1/board-nand.c | 39 ++++++++++++++++++++++++++
arch/arm/mach-omap1/board-palmz71.c | 4 +--
arch/arm/mach-omap1/board-perseus2.c | 16 +----------
arch/arm/mach-omap1/clock.c | 3 +-
arch/arm/mach-omap1/common.h | 11 +++++++
arch/arm/mach-omap1/fpga.c | 2 +
arch/arm/mach-omap1/id.c | 2 +
arch/arm/mach-omap1/io.c | 3 +-
arch/arm/mach-omap1/irq.c | 2 +
arch/arm/mach-omap1/lcd_dma.c | 7 +----
arch/arm/mach-omap1/ocpi.c | 7 +++--
arch/arm/mach-omap1/pm.c | 9 +++---
arch/arm/mach-omap1/reset.c | 2 +
arch/arm/mach-omap1/timer.c | 7 ++---
arch/arm/mach-omap1/usb.c | 3 ++
arch/arm/mach-omap2/am35xx-emac.c | 37 +++++++++++--------------
arch/arm/mach-omap2/board-omap3evm.c | 8 +++--
arch/arm/mach-omap2/board-omap4panda.c | 8 +++--
arch/arm/mach-omap2/board-rx51-peripherals.c | 4 +--
arch/arm/mach-omap2/board-zoom-display.c | 1 +
arch/arm/mach-omap2/common.h | 2 -
arch/arm/mach-omap2/devices.c | 7 ++---
arch/arm/mach-omap2/gpio.c | 2 +
arch/arm/mach-omap2/gpmc-onenand.c | 3 +-
arch/arm/mach-omap2/gpmc.c | 3 +-
arch/arm/mach-omap2/hwspinlock.c | 2 +
arch/arm/mach-omap2/io.c | 1 +
arch/arm/mach-omap2/irq.c | 3 +-
arch/arm/mach-omap2/mux.c | 2 +
arch/arm/mach-omap2/omap-secure.c | 1 +
arch/arm/mach-omap2/omap-wakeupgen.c | 2 +
arch/arm/mach-omap2/pm24xx.c | 3 --
arch/arm/mach-omap2/pm34xx.c | 10 ++-----
arch/arm/mach-omap2/prm_common.c | 4 ++-
arch/arm/mach-omap2/serial.c | 2 +
arch/arm/mach-omap2/usb-tusb6010.c | 2 +
arch/arm/plat-omap/Makefile | 3 --
arch/arm/plat-omap/common.c | 1 +
arch/arm/plat-omap/dma.c | 13 +++++++--
arch/arm/plat-omap/dmtimer.c | 3 +-
arch/arm/plat-omap/include/plat/board.h | 2 +
arch/arm/plat-omap/include/plat/common.h | 2 +
arch/arm/plat-omap/include/plat/dma.h | 1 +
arch/arm/plat-omap/include/plat/dmtimer.h | 4 +--
arch/arm/plat-omap/omap_device.c | 2 -
arch/arm/plat-omap/sram.c | 4 +--
arch/arm/plat-omap/usb.c | 4 ---
drivers/usb/host/ohci-omap.c | 5 ++-
53 files changed, 165 insertions(+), 167 deletions(-)
create mode 100644 arch/arm/mach-omap1/board-nand.c
rename arch/arm/{plat-omap/ocpi.c => mach-omap1/ocpi.c} (93%)PATCH v4 1/12 ARM: OMAP2+: declare file-local functions as static
Several function declarations used only in the files in which they're declared should include the static keyboard, but don't:
arch/arm/mach-omap2/serial.c:248:6: warning: symbol 'cmdline_find_option' was not declared. Should it be static? arch/arm/mach-omap2/omap-wakeupgen.c:259:6: warning: symbol 'irq_sar_clear' was not declared. Should it be static? arch/arm/mach-omap2/board-rx51-peripherals.c:878:27: warning: symbol 'rx51_vibra_data' was not declared. Should it be static? arch/arm/mach-omap2/board-rx51-peripherals.c:882:27: warning: symbol 'rx51_audio_data' was not declared. Should it be static? arch/arm/mach-omap2/board-omap4panda.c:201:29: warning: symbol 'omap_panda_wlan_data' was not declared. Should it be static? arch/arm/mach-omap2/board-omap4panda.c:393:24: warning: symbol 'omap4_panda_dvi_device' was not declared. Should it be static? arch/arm/mach-omap2/board-omap4panda.c:403:12: warning: symbol 'omap4_panda_dvi_init' was not declared. Should it be static? arch/arm/mach-omap2/board-omap4panda.c:464:6: warning: symbol 'omap4_panda_display_init' was not declared. Should it be static? arch/arm/mach-omap2/hsmmc.c:434:6: warning: symbol 'omap_init_hsmmc' was not declared. Should it be static? arch/arm/mach-omap2/hwspinlock.c:31:12: warning: symbol 'hwspinlocks_init' was not declared. Should it be static? arch/arm/mach-omap1/timer.c:58:12: warning: symbol 'omap1_dm_timer_init' was not declared. Should it be static? arch/arm/mach-omap1/fpga.c:90:6: warning: symbol 'innovator_fpga_IRQ_demux' was not declared. Should it be static?
Mark all of these as static.
--- arch/arm/mach-omap1/fpga.c | 2 +- arch/arm/mach-omap1/timer.c | 3 +-- arch/arm/mach-omap2/board-omap4panda.c | 8 ++++---- arch/arm/mach-omap2/board-rx51-peripherals.c | 4 ++-- arch/arm/mach-omap2/hwspinlock.c | 2 +- arch/arm/mach-omap2/omap-wakeupgen.c | 2 +- arch/arm/mach-omap2/serial.c | 2 +- 7 files changed, 11 insertions(+), 12 deletions(-)
arch/arm/mach-omap1/fpga.c +1 -1
@@ -87,7 +87,7 @@ static void fpga_mask_ack_irq(struct irq_data *d)fpga_ack_irq (d); } -void innovator_fpga_IRQ_demux (unsigned int irq,struct irq_desc *desc) +static void innovator_fpga_IRQ_demux (unsigned int irq,struct irq_desc *desc) {u32 stat;int fpga_irq;
arch/arm/mach-omap1/timer.c +1 -2
@@ -54,8 +54,7 @@ static int omap1_dm_timer_set_src(struct platform_device *pdev,return 0 ; } - -int __init omap1_dm_timer_init (void ) +static int __init omap1_dm_timer_init (void ) {int i;int ret;
arch/arm/mach-omap2/board-omap4panda.c +4 -4
@@ -230,7 +230,7 @@ static struct platform_device omap_vwlan_device = { }, }; -struct wl12xx_platform_data omap_panda_wlan_data__initdata = { +static struct wl12xx_platform_data omap_panda_wlan_data__initdata = {/* PANDA ref clock is 38.4 MHz */ .board_ref_clock =2 , };
@@ -439,7 +439,7 @@ static struct panel_dvi_platform_data omap4_dvi_panel = { .i2c_bus_num = 3, }; -struct omap_dss_device omap4_panda_dvi_device = { +static struct omap_dss_device omap4_panda_dvi_device = { .type =OMAP_DISPLAY_TYPE_DPI , .name ="dvi" , .driver_name ="dvi" ,
@@ -449,7 +449,7 @@ struct omap_dss_device omap4_panda_dvi_device = { .channel = OMAP_DSS_CHANNEL_LCD2, }; -int __init omap4_panda_dvi_init (void ) +static int __init omap4_panda_dvi_init (void ) {int r;
@@ -510,7 +510,7 @@ static struct omap_dss_board_info omap4_panda_dss_data = { .default_device = &omap4_panda_dvi_device, }; -void __init omap4_panda_display_init (void ) +static void __init omap4_panda_display_init (void ) {int r;
arch/arm/mach-omap2/board-rx51-peripherals.c +2 -2
@@ -872,11 +872,11 @@ static struct twl4030_power_data rx51_t2scripts_data __initdata = { .resource_config = twl4030_rconfig, }; -struct twl4030_vibra_data rx51_vibra_data__initdata = { +static struct twl4030_vibra_data rx51_vibra_data__initdata = { .coexist =0 , }; -struct twl4030_audio_data rx51_audio_data__initdata = { +static struct twl4030_audio_data rx51_audio_data__initdata = { .audio_mclk =26000000 , .vibra = &rx51_vibra_data, };
arch/arm/mach-omap2/hwspinlock.c +1 -1
@@ -28,7 +28,7 @@ static struct hwspinlock_pdata omap_hwspinlock_pdata __initdata = { .base_id = 0, }; -int __init hwspinlocks_init (void ) +static int __init hwspinlocks_init (void ) {int retval =0 ;struct omap_hwmod *oh;
arch/arm/mach-omap2/omap-wakeupgen.c +1 -1
@@ -259,7 +259,7 @@ static void irq_save_context(void)/* * Clear WakeupGen SAR backup status. */ -void irq_sar_clear (void ) +static void irq_sar_clear (void ) {u32 val; val =__raw_readl (sar_base +SAR_BACKUP_STATUS_OFFSET );
arch/arm/mach-omap2/serial.c +1 -1
@@ -243,7 +243,7 @@ static void omap_serial_fill_default_pads(struct omap_board_data *bdata)static void omap_serial_fill_default_pads (struct omap_board_data *bdata) {}#endif -char *cmdline_find_option (char *str) +static char *cmdline_find_option (char *str) {extern char *saved_command_line;
PATCH v4 1/12 ARM: OMAP2+: declare file-local functions as static
Quoted 2 lines · Paul Walmsley
Several function declarations used only in the files in which they're declared should include the static keyboard, but don't:
^^^ ???
The patch looks good otherwise,
PATCH v4 1/12 ARM: OMAP2+: declare file-local functions as static
Quoted 4 lines · Arnd Bergmann
Quoted 2 lines · Paul Walmsley
Several function declarations used only in the files in which they're declared should include the static keyboard, but don't:
^^^ ???
Heh, should have read "keyword".
Quoted 3 lines
The patch looks good otherwise,
Acked-by Arnd Bergmann <[email protected]>
Thanks for the comment, ack added.
- Paul
PATCH v4 2/12 ARM: OMAP: add includes for missing prototypes
In reply to Paul WalmsleySeveral C files in arch/arm/mach-omap* and arch/arm/plat-omap declare functions that are used by other files, but don't include the header file where the prototype is declared. This results in the following warnings from sparse:
arch/arm/mach-omap2/irq.c:114:5: warning: symbol 'omap_irq_pending' was not declared. Should it be static? arch/arm/mach-omap2/irq.c:186:13: warning: symbol 'omap2_init_irq' was not declared. Should it be static? arch/arm/mach-omap2/irq.c:191:13: warning: symbol 'omap3_init_irq' was not declared. Should it be static? arch/arm/mach-omap2/irq.c:196:13: warning: symbol 'ti81xx_init_irq' was not declared. Should it be static? arch/arm/mach-omap2/irq.c:233:39: warning: symbol 'omap2_intc_handle_irq' was not declared. Should it be static? arch/arm/mach-omap2/irq.c:242:6: warning: symbol 'omap_intc_save_context' was not declared. Should it be static? arch/arm/mach-omap2/irq.c:265:6: warning: symbol 'omap_intc_restore_context' was not declared. Should it be static? arch/arm/mach-omap2/irq.c:291:6: warning: symbol 'omap3_intc_suspend' was not declared. Should it be static? arch/arm/mach-omap2/irq.c:297:6: warning: symbol 'omap3_intc_prepare_idle' was not declared. Should it be static? arch/arm/mach-omap2/irq.c:306:6: warning: symbol 'omap3_intc_resume_idle' was not declared. Should it be static? arch/arm/mach-omap2/irq.c:312:39: warning: symbol 'omap3_intc_handle_irq' was not declared. Should it be static? arch/arm/mach-omap2/omap-secure.c:59:12: warning: symbol 'omap_secure_ram_reserve_memblock' was not declared. Should it be static? arch/arm/mach-omap2/board-zoom-display.c:133:13: warning: symbol 'zoom_display_init' was not declared. Should it be static? arch/arm/plat-omap/common.c:73:13: warning: symbol 'omap_init_consistent_dma_size' was not declared. Should it be static? arch/arm/mach-omap1/irq.c:61:5: warning: symbol 'omap_irq_flags' was not declared. Should it be static? arch/arm/mach-omap1/irq.c:179:13: warning: symbol 'omap1_init_irq' was not declared. Should it be static? arch/arm/mach-omap1/reset.c:11:6: warning: symbol 'omap1_restart' was not declared. Should it be static?
Fix by including the appropriate header files.
--- arch/arm/mach-omap1/common.h | 5 ++++- arch/arm/mach-omap1/id.c | 2 ++ arch/arm/mach-omap1/io.c | 3 +-- arch/arm/mach-omap1/irq.c | 2 ++ arch/arm/mach-omap1/reset.c | 2 ++ arch/arm/mach-omap2/board-zoom-display.c | 1 + arch/arm/mach-omap2/common.h | 2 -- arch/arm/mach-omap2/io.c | 1 + arch/arm/mach-omap2/irq.c | 1 + arch/arm/mach-omap2/omap-secure.c | 1 + arch/arm/plat-omap/common.c | 1 + arch/arm/plat-omap/include/plat/common.h | 2 ++ arch/arm/plat-omap/include/plat/dma.h | 1 + 13 files changed, 19 insertions(+), 5 deletions(-)
arch/arm/mach-omap1/common.h +4 -1
@@ -56,8 +56,11 @@ void omap1_init_early(void);void omap1_init_irq (void );void omap1_restart (char ,const char *); +extern void __init omap_check_revision (void ); +extern struct sys_timer omap1_timer;extern bool omap_32k_timer_init (void ); -extern void __init omap_init_consistent_dma_size (void ); + +extern u32 omap_irq_flags;#endif /* __ARCH_ARM_MACH_OMAP1_COMMON_H */
arch/arm/mach-omap1/id.c +2 -0
@@ -21,6 +21,8 @@#include <mach/hardware.h> +#include "common.h" +#define OMAP_DIE_ID_0 0xfffe1800#define OMAP_DIE_ID_1 0xfffe1804#define OMAP_PRODUCTION_ID_0 0xfffe2000
arch/arm/mach-omap1/io.c +1 -2
@@ -18,13 +18,12 @@#include <plat/mux.h> #include <plat/tc.h> +#include <plat/dma.h> #include "iomap.h" #include "common.h" #include "clock.h" -extern void omap_check_revision (void ); -/* * The machine specific code may provide the extra mapping besides the * default mapping provided here.
arch/arm/mach-omap1/irq.c +2 -0
@@ -49,6 +49,8 @@#include <mach/hardware.h> +#include "common.h" +#define IRQ_BANK (irq) ((irq) >> 5)#define IRQ_BIT (irq) ((irq) & 0x1f)
arch/arm/mach-omap1/reset.c +2 -0
@@ -8,6 +8,8 @@#include <mach/hardware.h> +#include "common.h" +void omap1_restart (char mode,const char *cmd) {/*
arch/arm/mach-omap2/board-zoom-display.c +1 -0
@@ -16,6 +16,7 @@#include <linux/spi/spi.h> #include <plat/mcspi.h> #include <video/omapdss.h> +#include <mach/board-zoom.h> #define LCD_PANEL_RESET_GPIO_PROD 96#define LCD_PANEL_RESET_GPIO_PILOT 55
arch/arm/mach-omap2/common.h +0 -2
@@ -134,8 +134,6 @@ void omap4_map_io(void);void ti81xx_map_io (void );void omap_barriers_init (void ); -extern void __init omap_init_consistent_dma_size (void ); -/** * omap_test_timeout - busy-loop, testing a condition * @cond: condition to test until it evaluates to true
arch/arm/mach-omap2/io.c +1 -0
@@ -31,6 +31,7 @@#include <plat/omap-pm.h> #include <plat/omap_hwmod.h> #include <plat/multi.h> +#include <plat/dma.h> #include "iomap.h" #include "voltage.h"
arch/arm/mach-omap2/irq.c +1 -0
@@ -25,6 +25,7 @@#include <mach/hardware.h> #include "iomap.h" +#include "common.h" /* selected INTC register offsets */
arch/arm/mach-omap2/omap-secure.c +1 -0
@@ -18,6 +18,7 @@#include <asm/cacheflush.h> #include <asm/memblock.h> +#include <plat/omap-secure.h> #include <mach/omap-secure.h> static phys_addr_t omap_secure_memblock_base;
arch/arm/plat-omap/common.c +1 -0
@@ -20,6 +20,7 @@#include <plat/board.h> #include <plat/vram.h> #include <plat/dsp.h> +#include <plat/dma.h> #include <plat/omap-secure.h>
arch/arm/plat-omap/include/plat/common.h +2 -0
@@ -32,6 +32,8 @@extern int __init omap_init_clocksource_32k (void ); +extern void __init omap_check_revision (void ); +extern void omap_reserve (void );extern int omap_dss_reset (struct omap_hwmod *);
arch/arm/plat-omap/include/plat/dma.h +1 -0
@@ -442,6 +442,7 @@ struct omap_system_dma_plat_info {u32 (*dma_read)(int reg,int lch); }; +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, void (*callback)(int lch, u16 ch_status, void *data),
PATCH v4 3/12 ARM: OMAP1: OCPI: move to mach-omap1/
In reply to Paul WalmsleyMove the OMAP1 OCPI "bus" code to arch/arm/mach-omap1, since it is only used on OMAP1 devices. In the long term, it probably makes sense to move the OCPI bus code to somewhere under drivers/.
---
arch/arm/mach-omap1/Makefile | 3 +++
arch/arm/mach-omap1/common.h | 2 ++
arch/arm/mach-omap1/ocpi.c | 7 +++++--
arch/arm/plat-omap/Makefile | 3 ---
4 files changed, 10 insertions(+), 5 deletions(-)
rename arch/arm/{plat-omap/ocpi.c => mach-omap1/ocpi.c} (93%)arch/arm/mach-omap1/Makefile +3 -0
@@ -12,6 +12,9 @@ endif obj-$(CONFIG_OMAP_32K_TIMER) += timer32k.o +# OCPI interconnect support for 1710, 1610 and 5912 +obj-$(CONFIG_ARCH_OMAP16XX) += ocpi.o + # Power Management obj-$(CONFIG_PM) += pm.o sleep.o
arch/arm/mach-omap1/common.h +2 -0
@@ -63,4 +63,6 @@ extern bool omap_32k_timer_init(void);extern u32 omap_irq_flags; +extern int ocpi_enable (void ); +#endif /* __ARCH_ARM_MACH_OMAP1_COMMON_H */
arch/arm/mach-omap1/ocpi.c renamed from arch/arm/plat-omap/ocpi.c +5 -2
@@ -4,6 +4,7 @@* Minimal OCP bus support for omap16xx * * Copyright (C) 2003 - 2005 Nokia Corporation +* Copyright (C) 2012 Texas Instruments, Inc. * Written by Tony Lindgren <[email protected]> * * Modified for clock framework by Paul Mundt <[email protected]>.
@@ -35,6 +36,8 @@#include <mach/hardware.h> +#include "common.h" +#define OCPI_BASE 0xfffec320#define OCPI_FAULT (OCPI_BASE + 0x00)#define OCPI_CMD_FAULT (OCPI_BASE + 0x04)
@@ -64,7 +67,7 @@ int ocpi_enable(void)/* Enable access for OHCI in OCPI */ val =omap_readl (OCPI_PROT ); val &= ~0xff ; -//val &= (1 << 0); /* Allow access only to EMIFS */ +/* val &= (1 << 0); Allow access only to EMIFS */ omap_writel (val,OCPI_PROT ); val =omap_readl (OCPI_SEC );
@@ -86,7 +89,7 @@ static int __init omap_ocpi_init(void)clk_enable (ocpi_ck);ocpi_enable (); -printk ("OMAP OCPI interconnect driver loaded\n" ); +pr_info ("OMAP OCPI interconnect driver loaded\n" );return 0 ; }
arch/arm/plat-omap/Makefile +0 -3
@@ -9,9 +9,6 @@ obj-m := obj-n := obj- := -# OCPI interconnect support for 1710, 1610 and 5912 -obj-$(CONFIG_ARCH_OMAP16XX) += ocpi.o - # omap_device support (OMAP2+ only@the moment) obj-$(CONFIG_ARCH_OMAP2) += omap_device.o obj-$(CONFIG_ARCH_OMAP3) += omap_device.o
PATCH v4 4/12 ARM: OMAP1: OHCI: use platform_data fn ptr to enable OCPI bus
In reply to Paul WalmsleyThe OMAP1 OHCI driver needs to enable the OCPI IP block before it can work. Previously, the driver was simply calling a symbol defined in the OMAP platform code, but this is incorrect: drivers should be fully decoupled from platform and architecture code.
So instead, modify the driver to call through a platform_data function pointer instead. We skip any DT aspect, since OMAP1 is not scheduled to be converted to DT in the near future.
This resolves the following sparse warning:
It also gets rid of a cpu_is_omap16xx() call in a driver.
In the long term, it probably makes sense to move the OCPI bus code to somewhere under drivers/. This should avoid the whole platform_data/DT issue with this function.
Also interesting is that drivers/usb/host/ohci-nxp.c contains a stub for ocpi_enable() - perhaps the NXP chips use a similar OCPI IP block?
--- arch/arm/mach-omap1/usb.c | 3 +++ arch/arm/plat-omap/include/plat/board.h | 2 ++ drivers/usb/host/ohci-omap.c | 5 +++-- 3 files changed, 8 insertions(+), 2 deletions(-)
arch/arm/mach-omap1/usb.c +3 -0
@@ -29,6 +29,8 @@#include <plat/mux.h> #include <plat/usb.h> +#include "common.h" +/* These routines should handle the standard chip-specific modes * for usb0/1/2 ports, covering basic mux and transceiver setup. *
@@ -138,6 +140,7 @@ static inline void ohci_device_init(struct omap_usb_config *pdata)if (cpu_is_omap7xx ()) ohci_resources[1 ].start =INT_7XX_USB_HHC_1 ; pdata->ohci_device = &ohci_device; + pdata->ocpi_enable = &ocpi_enable; }#else
arch/arm/plat-omap/include/plat/board.h +2 -0
@@ -91,6 +91,8 @@ struct omap_usb_config {u32 (*usb0_init)(unsigned nwires,unsigned is_device);u32 (*usb1_init)(unsigned nwires);u32 (*usb2_init)(unsigned nwires,unsigned alt_pingroup); + +int (*ocpi_enable)(void ); };struct omap_lcd_config {
drivers/usb/host/ohci-omap.c +3 -2
@@ -205,8 +205,9 @@ static int ohci_omap_init(struct usb_hcd *hcd) need_transceiver = need_transceiver ||machine_is_omap_h2 () ||machine_is_omap_h3 (); -if (cpu_is_omap16xx ()) -ocpi_enable (); +/* XXX OMAP16xx only */ +if (config->ocpi_enable) + config->ocpi_enable ();#ifdef CONFIG_USB_OTG if (need_transceiver) {
PATCH v4 4/12 ARM: OMAP1: OHCI: use platform_data fn ptr to enable OCPI bus
Quoted 2 lines · Paul Walmsley
Also interesting is that
drivers/usb/host/ohci-nxp.ccontains a stub forocpi_enable()- perhaps the NXP chips use a similar OCPI IP block?
I'd rather suspect a copy-paste error here since ocpi_enable() is unused in ohci-nxp.c and the extern declaration looks like an incomplete but intended removal.
Will probably just remove this reference in my DT patchset.
Roland
PATCH v4 4/12 ARM: OMAP1: OHCI: use platform_data fn ptr to enable OCPI bus
Quoted 9 lines · Roland Stigge
Quoted 2 lines · Paul Walmsley
Also interesting is that
drivers/usb/host/ohci-nxp.ccontains a stub forocpi_enable()- perhaps the NXP chips use a similar OCPI IP block?I'd rather suspect a copy-paste error here since
ocpi_enable()is unused inohci-nxp.cand the extern declaration looks like an incomplete but intended removal.Will probably just remove this reference in my DT patchset.
Thanks, will drop the comment from the patch description.
- Paul
PATCH v4 4/12 ARM: OMAP1: OHCI: use platform_data fn ptr to enable OCPI bus
In reply to Paul WalmsleyHi,
+Alan Stern
Quoted 17 lines · Paul Walmsley
The OMAP1 OHCI driver needs to enable the OCPI IP block before it can work. Previously, the driver was simply calling a symbol defined in the OMAP platform code, but this is incorrect: drivers should be fully decoupled from platform and architecture code.
So instead, modify the driver to call through a
platform_datafunction pointer instead. We skip any DT aspect, since OMAP1 is not scheduled to be converted to DT in the near future.This resolves the following sparse warning:
It also gets rid of a
cpu_is_omap16xx()call in a driver.In the long term, it probably makes sense to move the OCPI bus code to somewhere under
drivers/. This should avoid the whole platform_data/DT issue with this function.
Quoted 7 lines
Also interesting is that
drivers/usb/host/ohci-nxp.ccontains a stub forocpi_enable()- perhaps the NXP chips use a similar OCPI IP block?Signed-off-by Paul Walmsley <[email protected]>Cc Roland Stigge <[email protected]>Cc Felipe Balbi <[email protected]>Cc Anand Gadiyar <[email protected]>
FWIW:
ideally ocpi.c would be a platform_driver
Quoted 58 lines
--- arch/arm/mach-omap1/usb.c | 3 +++ arch/arm/plat-omap/include/plat/board.h | 2 ++ drivers/usb/host/ohci-omap.c | 5 +++-- 3 files changed, 8 insertions(+), 2 deletions(-)arch/arm/mach-omap1/usb.c +3
-0@@ -29,6 +29,8 @@#include <plat/mux.h> #include <plat/usb.h> +#include "common.h" +/* These routines should handle the standard chip-specific modes * for usb0/1/2 ports, covering basic mux and transceiver setup. * @@ -138,6 +140,7 @@ static inline void ohci_device_init(struct omap_usb_config *pdata)if (cpu_is_omap7xx ()) ohci_resources[1 ].start =INT_7XX_USB_HHC_1 ; pdata->ohci_device = &ohci_device; + pdata->ocpi_enable = &ocpi_enable; }#else arch/arm/plat-omap/include/plat/board.h +2
-0@@ -91,6 +91,8 @@ struct omap_usb_config {u32 (*usb0_init)(unsigned nwires,unsigned is_device);u32 (*usb1_init)(unsigned nwires);u32 (*usb2_init)(unsigned nwires,unsigned alt_pingroup); + +int (*ocpi_enable)(void ); };struct omap_lcd_config {drivers/usb/host/ohci-omap.c +3
-2@@ -205,8 +205,9 @@ static int ohci_omap_init(struct usb_hcd *hcd) need_transceiver = need_transceiver ||machine_is_omap_h2 () ||machine_is_omap_h3 (); -if (cpu_is_omap16xx ()) -ocpi_enable (); +/* XXX OMAP16xx only */ +if (config->ocpi_enable) + config->ocpi_enable ();#ifdef CONFIG_USB_OTG if (need_transceiver) {
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120411/4a7eb5da/attachment-0001.sig>
PATCH v4 4/12 ARM: OMAP1: OHCI: use platform_data fn ptr to enable OCPI bus
Hi Felipe,
Quoted 1 line · Felipe Balbi
Acked-by Felipe Balbi <[email protected]>
Thanks, ack added.
Quoted 1 line
ideally
ocpi.cwould be aplatform_driver
Agreed.
- Paul
PATCH v4 5/12 ARM: OMAP2+: GPMC: resolve type-conversion warning from sparse
In reply to Paul Walmsleyarch/arm/mach-omap2/gpmc.c passes a return value from ioremap() as the fifth argument to request_irq() without casting it. This causes sparse to generate the following warning:
arch/arm/mach-omap2/gpmc.c:759:63: warning: incorrect type in argument 5 (different address spaces)arch/arm/mach-omap2/gpmc.c:759:63: expected void *devarch/arm/mach-omap2/gpmc.c:759:63: got void [noderef] <asn:2>*static [toplevel] [assigned] gpmc_base
It turns out that it's not necessary to pass this. gpmc_base is a file-scoped static variable, the ISR is located in the same file ... and the ISR doesn't even touch the passed-in variable. So, just replace it with NULL in request_irq().
--- arch/arm/mach-omap2/gpmc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm/mach-omap2/gpmc.c +1 -2
@@ -755,8 +755,7 @@ static int __init gpmc_init(void) irq++; } - ret =request_irq (gpmc_irq, - gpmc_handle_irq,IRQF_SHARED ,"gpmc" , gpmc_base); + ret =request_irq (gpmc_irq, gpmc_handle_irq,IRQF_SHARED ,"gpmc" ,NULL );if (ret)pr_err ("gpmc: irq-%d could not claim: err %d\n" , gpmc_irq, ret);
PATCH v4 6/12 ARM: OMAP: fix 'using plain integer as NULL pointer' sparse warnings
In reply to Paul Walmsleysparse warns when 0 is passed to a function expecting a pointer argument. Resolve these warnings by replacing the 0 with NULL.
arch/arm/plat-omap/include/plat/dmtimer.h:319:34: warning: Using plain integer as NULL pointer arch/arm/plat-omap/include/plat/dmtimer.h:324:35: warning: Using plain integer as NULL pointer arch/arm/mach-omap2/irq.c:294:22: warning: Using plain integer as NULL pointer arch/arm/mach-omap1/board-palmz71.c:292:50: warning: Using plain integer as NULL pointer arch/arm/mach-omap1/board-palmz71.c:295:73: warning: Using plain integer as NULL pointer arch/arm/mach-omap1/ams-delta-fiq.c:105:63: warning: Using plain integer as NULL pointer
--- arch/arm/mach-omap1/ams-delta-fiq.c | 2 +- arch/arm/mach-omap1/board-palmz71.c | 4 ++-- arch/arm/mach-omap2/irq.c | 2 +- arch/arm/plat-omap/include/plat/dmtimer.h | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-)
arch/arm/mach-omap1/ams-delta-fiq.c +1 -1
@@ -102,7 +102,7 @@ void __init ams_delta_init_fiq(void) } retval =request_irq (INT_DEFERRED_FIQ , deferred_fiq, -IRQ_TYPE_EDGE_RISING ,"deferred_fiq" ,0 ); +IRQ_TYPE_EDGE_RISING ,"deferred_fiq" ,NULL );if (retval <0 ) {pr_err ("Failed to get deferred_fiq IRQ, ret=%d\n" , retval);release_fiq (&fh);
arch/arm/mach-omap1/board-palmz71.c +2 -2
@@ -289,10 +289,10 @@ palmz71_gpio_setup(int early)gpio_direction_input (PALMZ71_USBDETECT_GPIO );if (request_irq (gpio_to_irq (PALMZ71_USBDETECT_GPIO ), palmz71_powercable,IRQF_SAMPLE_RANDOM , -"palmz71-cable" ,0 )) +"palmz71-cable" ,NULL ))printk (KERN_ERR "IRQ request for power cable failed!\n" ); -palmz71_powercable (gpio_to_irq (PALMZ71_USBDETECT_GPIO ),0 ); +palmz71_powercable (gpio_to_irq (PALMZ71_USBDETECT_GPIO ),NULL ); } }
arch/arm/mach-omap2/irq.c +1 -1
@@ -335,7 +335,7 @@ void omap_intc_restore_context(void)void omap3_intc_suspend (void ) {/* A pending interrupt would prevent OMAP from entering suspend */ -omap_ack_irq (0 ); +omap_ack_irq (NULL ); }void omap3_intc_prepare_idle (void )
arch/arm/plat-omap/include/plat/dmtimer.h +2 -2
@@ -316,12 +316,12 @@ static inline void __omap_dm_timer_init_regs(struct omap_dm_timer *timer)OMAP_TIMER_V1_SYS_STAT_OFFSET ; timer->irq_stat = timer->io_base +OMAP_TIMER_V1_STAT_OFFSET ; timer->irq_ena = timer->io_base +OMAP_TIMER_V1_INT_EN_OFFSET ; - timer->irq_dis =0 ; + timer->irq_dis =NULL ; timer->pend = timer->io_base + _OMAP_TIMER_WRITE_PEND_OFFSET; timer->func_base = timer->io_base; }else { timer->revision =2 ; - timer->sys_stat =0 ; + timer->sys_stat =NULL ; timer->irq_stat = timer->io_base +OMAP_TIMER_V2_IRQSTATUS ; timer->irq_ena = timer->io_base +OMAP_TIMER_V2_IRQENABLE_SET ; timer->irq_dis = timer->io_base +OMAP_TIMER_V2_IRQENABLE_CLR ;
PATCH v4 7/12 ARM: OMAP: OCM RAM: use memset_io() when clearing SRAM
In reply to Paul WalmsleyWe currently treat the OCM RAM memory as memory that hangs off an I/O bus, so use memset_io() to clear it rather than memset(). This also takes care of this sparse warning:
arch/arm/plat-omap/sram.c:199:9: warning: cast removes address space of expression
There is still one SRAM-related sparse warning, but it appears that fixing it correctly will take some time and thought.
N.B., at some point, the OCM RAM IP block interface code should probably be reimplemented as an MTD device or something similar under drivers/.
--- arch/arm/plat-omap/sram.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/plat-omap/sram.c +2 -2
@@ -196,8 +196,8 @@ static void __init omap_map_sram(void)* Looks like we need to preserve some bootloader code at the * beginning of SRAM for jumping to flash for reboot to work... */ -memset ((void *)omap_sram_base +SRAM_BOOTLOADER_SZ ,0 , - omap_sram_size -SRAM_BOOTLOADER_SZ ); +memset_io (omap_sram_base +SRAM_BOOTLOADER_SZ ,0 , + omap_sram_size -SRAM_BOOTLOADER_SZ ); }/*
PATCH v4 8/12 ARM: OMAP: DMA: use constant array maximum, drop some LCD DMA code
In reply to Paul Walmsleygcc can apparently handle stack-allocated arrays that use a dynamic variable as the array maximum. Rather than using a mutable quantity, simply use a constant maximum possible size. To me, code clarity is improved; and it also avoids the following sparse warnings:
arch/arm/plat-omap/dma.c:886:40: error: bad constant expression arch/arm/plat-omap/dma.c:892:17: error: cannot size expression arch/arm/plat-omap/dma.c:970:40: error: bad constant expression arch/arm/plat-omap/dma.c:972:17: error: cannot size expression
Also drop some dead code from the OMAP1 LCD DMA code:
arch/arm/mach-omap1/lcd_dma.c:80:6: warning: symbol 'omap_set_lcd_dma_src_port' was not declared. Should it be static?
--- arch/arm/mach-omap1/lcd_dma.c | 5 ----- arch/arm/plat-omap/dma.c | 13 +++++++++++-- 2 files changed, 11 insertions(+), 7 deletions(-)
arch/arm/mach-omap1/lcd_dma.c +0 -5
@@ -77,11 +77,6 @@ void omap_set_lcd_dma_b1(unsigned long addr, u16 fb_xres, u16 fb_yres, }EXPORT_SYMBOL (omap_set_lcd_dma_b1); -void omap_set_lcd_dma_src_port (int port) -{ - lcd_dma.src_port = port; -} -void omap_set_lcd_dma_ext_controller (int external) { lcd_dma.ext_ctrl = external;
arch/arm/plat-omap/dma.c +11 -2
@@ -41,6 +41,15 @@#include <plat/tc.h> +/* +* MAX_LOGICAL_DMA_CH_COUNT: the maximum number of logical DMA +* channels that an instance of the SDMA IP block can support. Used +* to size arrays. (The actual maximum on a particular SoC may be less +* than this -- for example, OMAP1 SDMA instances only support 17 logical +* DMA channels.) +*/ +#define MAX_LOGICAL_DMA_CH_COUNT 32 +#undef DEBUG#ifndef CONFIG_ARCH_OMAP1
@@ -883,7 +892,7 @@ void omap_start_dma(int lch)if (!omap_dma_in_1510_mode () && dma_chan[lch].next_lch !=-1 ) {int next_lch, cur_lch; -char dma_chan_link_map[dma_lch_count]; +char dma_chan_link_map[MAX_LOGICAL_DMA_CH_COUNT ]; dma_chan_link_map[lch] =1 ;/* Set the link register of the first channel */
@@ -967,7 +976,7 @@ void omap_stop_dma(int lch)if (!omap_dma_in_1510_mode () && dma_chan[lch].next_lch !=-1 ) {int next_lch, cur_lch = lch; -char dma_chan_link_map[dma_lch_count]; +char dma_chan_link_map[MAX_LOGICAL_DMA_CH_COUNT ];memset (dma_chan_link_map,0 ,sizeof (dma_chan_link_map)); do {
PATCH v4 9/12 ARM: OMAP: USB: remove unnecessary sideways include
In reply to Paul WalmsleyRemove the include of mach-omap2/common.h from plat-omap/usb.c. It appears to be unneeded. Removing it also resolves the sparse warning:
arch/arm/plat-omap/../mach-omap2/common.h:183:12: warning: symbol 'omap_intc_of_init' was not declared. Should it be static?
--- arch/arm/plat-omap/usb.c | 2 -- 1 file changed, 2 deletions(-)
arch/arm/plat-omap/usb.c +0 -2
@@ -31,8 +31,6 @@#include <mach/hardware.h> -#include "../mach-omap2/common.h" -#ifdef CONFIG_ARCH_OMAP_OTG void __init
PATCH v4 10/12 ARM: OMAP1: board files: deduplicate and clean some NAND-related code
In reply to Paul WalmsleyThe H2, H3, Perseus2, and FSample board files all contain the same duplicated code to handle NAND commands. That code is missing some casts around conversions from unsigned long to void __iomem *.
Consolidate the duplicated code into a new file, arch/arm/mach-omap1/board-nand.c. Resolve the sparse warnings by adding appropriate casts:
arch/arm/mach-omap1/board-h2.c:193:9: warning: incorrect type in argument 1 (different base types)arch/arm/mach-omap1/board-h2.c:193:9: expected void const volatile [noderef] <asn:2>*<noident>arch/arm/mach-omap1/board-h2.c:193:9: got unsigned longarch/arm/mach-omap1/board-perseus2.c:157:9: warning: incorrect type in argument 1 (different base types)arch/arm/mach-omap1/board-perseus2.c:157:9: expected void const volatile [noderef] <asn:2>*<noident>arch/arm/mach-omap1/board-perseus2.c:157:9: got unsigned longarch/arm/mach-omap1/board-fsample.c:199:9: warning: incorrect type in argument 1 (different base types)arch/arm/mach-omap1/board-fsample.c:199:9: expected void const volatile [noderef] <asn:2>*<noident>arch/arm/mach-omap1/board-fsample.c:199:9: got unsigned longarch/arm/mach-omap1/board-h3.c:195:9: warning: incorrect type in argument 1 (different base types)arch/arm/mach-omap1/board-h3.c:195:9: expected void const volatile [noderef] <asn:2>*<noident>arch/arm/mach-omap1/board-h3.c:195:9: got unsigned long
--- arch/arm/mach-omap1/Makefile | 10 +++++---- arch/arm/mach-omap1/board-fsample.c | 16 +------------- arch/arm/mach-omap1/board-h2.c | 17 +-------------- arch/arm/mach-omap1/board-h3.c | 16 +------------- arch/arm/mach-omap1/board-nand.c | 39 ++++++++++++++++++++++++++++++++++ arch/arm/mach-omap1/board-perseus2.c | 16 +------------- arch/arm/mach-omap1/common.h | 4 +++ 7 files changed, 53 insertions(+), 65 deletions(-) create mode 100644 arch/arm/mach-omap1/board-nand.c
arch/arm/mach-omap1/Makefile +6 -4
@@ -31,13 +31,15 @@ usb-fs-$(CONFIG_USB) := usb.o obj-y += $(usb-fs-m) $(usb-fs-y) # Specific board support -obj-$(CONFIG_MACH_OMAP_H2) += board-h2.o board-h2-mmc.o +obj-$(CONFIG_MACH_OMAP_H2) += board-h2.o board-h2-mmc.o \ + board-nand.o obj-$(CONFIG_MACH_OMAP_INNOVATOR) += board-innovator.o obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o -obj-$(CONFIG_MACH_OMAP_PERSEUS2) += board-perseus2.o -obj-$(CONFIG_MACH_OMAP_FSAMPLE) += board-fsample.o +obj-$(CONFIG_MACH_OMAP_PERSEUS2) += board-perseus2.o board-nand.o +obj-$(CONFIG_MACH_OMAP_FSAMPLE) += board-fsample.o board-nand.o obj-$(CONFIG_MACH_OMAP_OSK) += board-osk.o -obj-$(CONFIG_MACH_OMAP_H3) += board-h3.o board-h3-mmc.o +obj-$(CONFIG_MACH_OMAP_H3) += board-h3.o board-h3-mmc.o \ + board-nand.o obj-$(CONFIG_MACH_VOICEBLUE) += board-voiceblue.o obj-$(CONFIG_MACH_OMAP_PALMTE) += board-palmte.o obj-$(CONFIG_MACH_OMAP_PALMZ71) += board-palmz71.o
arch/arm/mach-omap1/board-fsample.c +1 -15
@@ -185,20 +185,6 @@ static struct platform_device nor_device = { .resource = &nor_resource, }; -static void nand_cmd_ctl (struct mtd_info *mtd,int cmd,unsigned int ctrl) -{ -struct nand_chip *this = mtd->priv; -unsigned long mask; - -if (cmd ==NAND_CMD_NONE ) -return ; - - mask = (ctrl &NAND_CLE ) ?0x02 :0 ; -if (ctrl &NAND_ALE ) - mask |=0x04 ; -writeb (cmd, (unsigned long )this->IO_ADDR_W | mask); -} -#define FSAMPLE_NAND_RB_GPIO_PIN 62static int nand_dev_ready (struct mtd_info *mtd)
@@ -216,7 +202,7 @@ static struct platform_nand_data nand_data = { .part_probe_types = part_probes, }, .ctrl = { - .cmd_ctrl = nand_cmd_ctl, + .cmd_ctrl = omap1_nand_cmd_ctl, .dev_ready = nand_dev_ready, }, };
arch/arm/mach-omap1/board-h2.c +1 -16
@@ -179,20 +179,6 @@ static struct mtd_partition h2_nand_partitions[] = { }, }; -static void h2_nand_cmd_ctl (struct mtd_info *mtd,int cmd,unsigned int ctrl) -{ -struct nand_chip *this = mtd->priv; -unsigned long mask; - -if (cmd ==NAND_CMD_NONE ) -return ; - - mask = (ctrl &NAND_CLE ) ?0x02 :0 ; -if (ctrl &NAND_ALE ) - mask |=0x04 ; -writeb (cmd, (unsigned long )this->IO_ADDR_W | mask); -} -#define H2_NAND_RB_GPIO_PIN 62static int h2_nand_dev_ready (struct mtd_info *mtd)
@@ -212,9 +198,8 @@ static struct platform_nand_data h2_nand_platdata = { .part_probe_types = h2_part_probes, }, .ctrl = { - .cmd_ctrl = h2_nand_cmd_ctl, + .cmd_ctrl = omap1_nand_cmd_ctl, .dev_ready = h2_nand_dev_ready, - }, };
arch/arm/mach-omap1/board-h3.c +1 -15
@@ -181,20 +181,6 @@ static struct mtd_partition nand_partitions[] = { }, }; -static void nand_cmd_ctl (struct mtd_info *mtd,int cmd,unsigned int ctrl) -{ -struct nand_chip *this = mtd->priv; -unsigned long mask; - -if (cmd ==NAND_CMD_NONE ) -return ; - - mask = (ctrl &NAND_CLE ) ?0x02 :0 ; -if (ctrl &NAND_ALE ) - mask |=0x04 ; -writeb (cmd, (unsigned long )this->IO_ADDR_W | mask); -} -#define H3_NAND_RB_GPIO_PIN 10static int nand_dev_ready (struct mtd_info *mtd)
@@ -214,7 +200,7 @@ static struct platform_nand_data nand_platdata = { .part_probe_types = part_probes, }, .ctrl = { - .cmd_ctrl = nand_cmd_ctl, + .cmd_ctrl = omap1_nand_cmd_ctl, .dev_ready = nand_dev_ready, },
arch/arm/mach-omap1/board-nand.c new file +39 -0
@@ -0,0 +1,39 @@ +/* +* linux/arch/arm/mach-omap1/board-nand.c +* +* Common OMAP1 board NAND code +* +* Copyright (C) 2004, 2012 Texas Instruments, Inc. +* Copyright (C) 2002 MontaVista Software, Inc. +* Copyright (C) 2001 RidgeRun, Inc. +* Author: RidgeRun, Inc. +* Greg Lonnon (glonnon at ridgerun.com) or info at ridgerun.com +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ +#include <linux/kernel.h> +#include <linux/io.h> +#include <linux/mtd/mtd.h> +#include <linux/mtd/nand.h> + +#include "common.h" + +void omap1_nand_cmd_ctl (struct mtd_info *mtd,int cmd,unsigned int ctrl) +{ +struct nand_chip *this = mtd->priv; +unsigned long mask; + +if (cmd ==NAND_CMD_NONE ) +return ; + + mask = (ctrl &NAND_CLE ) ?0x02 :0 ; +if (ctrl &NAND_ALE ) + mask |=0x04 ; + + mask |= (unsigned long )this->IO_ADDR_W; + +writeb (cmd, (void __iomem *)mask); +} +
arch/arm/mach-omap1/board-perseus2.c +1 -15
@@ -143,20 +143,6 @@ static struct platform_device nor_device = { .resource = &nor_resource, }; -static void nand_cmd_ctl (struct mtd_info *mtd,int cmd,unsigned int ctrl) -{ -struct nand_chip *this = mtd->priv; -unsigned long mask; - -if (cmd ==NAND_CMD_NONE ) -return ; - - mask = (ctrl &NAND_CLE ) ?0x02 :0 ; -if (ctrl &NAND_ALE ) - mask |=0x04 ; -writeb (cmd, (unsigned long )this->IO_ADDR_W | mask); -} -#define P2_NAND_RB_GPIO_PIN 62static int nand_dev_ready (struct mtd_info *mtd)
@@ -174,7 +160,7 @@ static struct platform_nand_data nand_data = { .part_probe_types = part_probes, }, .ctrl = { - .cmd_ctrl = nand_cmd_ctl, + .cmd_ctrl = omap1_nand_cmd_ctl, .dev_ready = nand_dev_ready, }, };
arch/arm/mach-omap1/common.h +4 -0
@@ -27,6 +27,7 @@#define __ARCH_ARM_MACH_OMAP1_COMMON_H#include <plat/common.h> +#include <linux/mtd/mtd.h> #if defined(CONFIG_ARCH_OMAP730 ) || defined(CONFIG_ARCH_OMAP850 )void omap7xx_map_io (void );
@@ -58,6 +59,9 @@ void omap1_restart(char, const char *);extern void __init omap_check_revision (void ); +extern void omap1_nand_cmd_ctl (struct mtd_info *mtd,int cmd, +unsigned int ctrl); +extern struct sys_timer omap1_timer;extern bool omap_32k_timer_init (void );
PATCH v4 10/12 ARM: OMAP1: board files: deduplicate and clean some NAND-related code
Quoted 6 lines · Paul Walmsley
arch/arm/mach-omap1/board-nand.c new file +6
-0+void omap1_nand_cmd_ctl (struct mtd_info *mtd,int cmd,unsigned int ctrl) +{ +struct nand_chip *this = mtd->priv; +unsigned long mask; + +if (cmd ==NAND_CMD_NONE )
arch/arm/mach-omap1/board-nand.c line 38
Quoted 10 lines
arch/arm/mach-omap1/board-nand.c new file +10
-0+return ; + + mask = (ctrl &NAND_CLE ) ?0x02 :0 ; +if (ctrl &NAND_ALE ) + mask |=0x04 ; + + mask |= (unsigned long )this->IO_ADDR_W; + +writeb (cmd, (void __iomem *)mask); +}
IO_ADDR_W is always a page aligned pointer AFAICT, so you can actually remove both casts and make it more readable at the same time by writing the last two lines as
writeb(cmd, this->IO_ADDR_W + mask); Arnd
PATCH v4 10/12 ARM: OMAP1: board files: deduplicate and clean some NAND-related code
Quoted 22 lines · Arnd Bergmann
Quoted 6 lines · Paul Walmsley
arch/arm/mach-omap1/board-nand.c new file +6
-0+void omap1_nand_cmd_ctl (struct mtd_info *mtd,int cmd,unsigned int ctrl) +{ +struct nand_chip *this = mtd->priv; +unsigned long mask; + +if (cmd ==NAND_CMD_NONE )arch/arm/mach-omap1/board-nand.c line 38
Quoted 10 lines
arch/arm/mach-omap1/board-nand.c new file +10
-0+return ; + + mask = (ctrl &NAND_CLE ) ?0x02 :0 ; +if (ctrl &NAND_ALE ) + mask |=0x04 ; + + mask |= (unsigned long )this->IO_ADDR_W; + +writeb (cmd, (void __iomem *)mask); +}
IO_ADDR_Wis always a page aligned pointer AFAICT, so you can actually remove both casts and make it more readable at the same time by writing the last two lines as
Quoted 1 line
writeb(cmd, this->IO_ADDR_W + mask);
Thanks, patch updated.
- Paul
PATCH v4 11/12 ARM: OMAP1: DMTIMER: fix broken timer clock source selection
In reply to Paul WalmsleyDMTIMER source selection on OMAP1 is broken. omap1_dm_timer_set_src() tries to use __raw_{read,write}l() to read from and write to physical addresses, but those functions take virtual addresses.
sparse caught this:
arch/arm/mach-omap1/timer.c:50:13: warning: incorrect type in argument 1 (different base types)arch/arm/mach-omap1/timer.c:50:13: expected void const volatile [noderef] <asn:2>*<noident>arch/arm/mach-omap1/timer.c:50:13: got unsigned intarch/arm/mach-omap1/timer.c:52:9: warning: incorrect type in argument 1 (different base types)arch/arm/mach-omap1/timer.c:52:9: expected void const volatile [noderef] <asn:2>*<noident>arch/arm/mach-omap1/timer.c:52:9: got unsigned int
Fix by using omap_{read,writel}(), just like the other users of the MOD_CONF_CTRL_1 register in the OMAP1 codebase. Of course, in the long term, removing omap_{read,write}l() is the appropriate thing to do; but this will take some work to do this cleanly.
--- arch/arm/mach-omap1/timer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-omap1/timer.c +2 -2
@@ -47,9 +47,9 @@ static int omap1_dm_timer_set_src(struct platform_device *pdev,int n = (pdev->id -1 ) <<1 ;u32 l; - l =__raw_readl (MOD_CONF_CTRL_1 ) & ~(0x03 << n); + l =omap_readl (MOD_CONF_CTRL_1 ) & ~(0x03 << n); l |= source << n; -__raw_writel (l,MOD_CONF_CTRL_1 ); +omap_writel (l,MOD_CONF_CTRL_1 );return 0 ; }
Tony Lindgren
maintainerPATCH v4 11/12 ARM: OMAP1: DMTIMER: fix broken timer clock source selection
Quoted 13 lines · Paul Walmsley
DMTIMER source selection on OMAP1 is broken.
omap1_dm_timer_set_src()tries to use __raw_{read,write}l() to read from and write to physical addresses, but those functions take virtual addresses.sparse caught this:
arch/arm/mach-omap1/timer.c:50:13: warning: incorrect type in argument 1 (different base types)arch/arm/mach-omap1/timer.c:50:13: expected void const volatile [noderef] <asn:2>*<noident>arch/arm/mach-omap1/timer.c:50:13: got unsigned intarch/arm/mach-omap1/timer.c:52:9: warning: incorrect type in argument 1 (different base types)arch/arm/mach-omap1/timer.c:52:9: expected void const volatile [noderef] <asn:2>*<noident>arch/arm/mach-omap1/timer.c:52:9: got unsigned int
Quoted 7 lines
Fix by using omap_{read,writel}(), just like the other users of the
MOD_CONF_CTRL_1register in the OMAP1 codebase. Of course, in the long term, removing omap_{read,write}l() is the appropriate thing to do; but this will take some work to do this cleanly.Signed-off-by Paul Walmsley <[email protected]>Cc Tarun Kanti DebBarma <[email protected]>
Uhh looks like this was caused by commit 97933d6 (ARM: OMAP1: dmtimer: conversion to platform devices) moving code and changing it :(
I'll pick this to fixes.
Tony
Quoted 26 lines
--- arch/arm/mach-omap1/timer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/arm/mach-omap1/timer.c +2
-3@@ -47,9 +47,9 @@ static int omap1_dm_timer_set_src(struct platform_device *pdev,int n = (pdev->id -1 ) <<1 ;u32 l; - l =__raw_readl (MOD_CONF_CTRL_1 ) & ~(0x03 << n); + l =omap_readl (MOD_CONF_CTRL_1 ) & ~(0x03 << n); l |= source << n; -__raw_writel (l,MOD_CONF_CTRL_1 ); +omap_writel (l,MOD_CONF_CTRL_1 );return 0 ; } --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
PATCH v4 11/12 ARM: OMAP1: DMTIMER: fix broken timer clock source selection
Quoted 4 lines · Tony Lindgren
Uhh looks like this was caused by commit 97933d6 (ARM: OMAP1: dmtimer: conversion to platform devices) moving code and changing it :(
I'll pick this to fixes.
Sounds good, will drop this from my series and send a new pull request.
- Paul