linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 00/18] ARM: msm multiplatform support
@ 2015-03-04 19:32 Arnd Bergmann
  2015-03-04 19:32 ` [RFC PATCH 01/18] serial: remove obsolete msm_serial_hs driver Arnd Bergmann
                   ` (21 more replies)
  0 siblings, 22 replies; 36+ messages in thread
From: Arnd Bergmann @ 2015-03-04 19:32 UTC (permalink / raw)
  To: linux-arm-kernel

This is my final piece of the puzzle for ARMv6/v7 multiplatform
support. In combination with the other patches that are now
at git://kernel.org/pub/scm/linux/kernel/git/arnd/playground.git
multiplatform-4.0-rc2 and the at91 and shmobile parts from other
developers, you can now build one kernel that includes all 
ARMv6 and ARMv7 targets we support in Linux.

Since mach-msm has seen very few updates over the last years,
it was more work to get to this point than the others, and
some patches are more of a band-aid than a proper solution.
Still, I think that each patch in the series is an improvement
over the status-quo and I really want to see the last one
merged into 4.1 and it depends on all the other ones.

Stephen Boyd mentioned on IRC that he has been workin on
a similar series, and I'm more than happy to replace some
of this work with patches that he has done, as long as we
can still have the full multiplatform support for 4.1.

Since a lot of the patches are nontrivial and I have not
been able to test any of this, I'm posting it as an RFC,
but I'm also very interested in people testing it.

	Arnd

Arnd Bergmann (18):
  serial: remove obsolete msm_serial_hs driver
  mmc: msm: move data mover into mmc driver
  mmc: msm: pass dmov resources via device
  mmc: msm: move clk-reset logic to platform
  ARM: msm: fix qsd8x50 rev.a support
  ARM: msm: fix mach/msm_iomap.h inclusions
  ARM: msm: fix sirc code for multiplatform
  ARM: msm: fix gpiomux config for multiplatform
  ARM: msm: fix vic irqchip for multiplatform
  gpio: move msm-v1 driver to mach-msm
  clocksource: qcom: make mach-msm and mach-qcom coexist
  ARM: msm: make smd behave like a normal driver
  ARM: msm: rename conflicting symbols
  ARM: msm: pass gpio irq range as resource
  ARM: msm: clean up irq handling
  ARM: msm: make msm_smd.h global
  ARM: msm: make all header files local
  ARM: msm: enable multiplatform support

 arch/arm/Kconfig                                   |   12 -
 arch/arm/configs/msm_defconfig                     |    7 +
 arch/arm/mach-msm/Kconfig                          |   91 +-
 arch/arm/mach-msm/Makefile                         |   11 +-
 arch/arm/mach-msm/board-halibut.c                  |   31 +-
 arch/arm/mach-msm/board-msm7x30.c                  |   98 +-
 arch/arm/mach-msm/board-qsd8x50.c                  |  138 +-
 arch/arm/mach-msm/board-sapphire.c                 |   17 +-
 arch/arm/mach-msm/board-trout-gpio.c               |    7 +-
 arch/arm/mach-msm/board-trout-mmc.c                |   33 +-
 arch/arm/mach-msm/board-trout-panel.c              |    8 +-
 arch/arm/mach-msm/board-trout.c                    |   26 +-
 arch/arm/mach-msm/board-trout.h                    |    2 +-
 arch/arm/mach-msm/{include/mach => }/clk.h         |    0
 arch/arm/mach-msm/clock-pcom.c                     |    5 +-
 arch/arm/mach-msm/clock.c                          |    2 +-
 arch/arm/mach-msm/clock.h                          |    2 +-
 arch/arm/mach-msm/common.h                         |   16 +-
 arch/arm/mach-msm/devices-msm7x00.c                |  169 +-
 arch/arm/mach-msm/devices-msm7x30.c                |   78 +-
 arch/arm/mach-msm/devices-qsd8x50.c                |  152 +-
 arch/arm/mach-msm/devices.h                        |   67 +-
 arch/arm/mach-msm/dma.c                            |  298 ----
 {drivers/gpio => arch/arm/mach-msm}/gpio-msm-v1.c  |   33 +-
 arch/arm/mach-msm/gpiomux-8x50.c                   |    2 +-
 arch/arm/mach-msm/gpiomux-v1.h                     |    9 +-
 arch/arm/mach-msm/gpiomux.c                        |   18 +-
 arch/arm/mach-msm/gpiomux.h                        |   10 +-
 arch/arm/mach-msm/include/mach/dma.h               |  151 --
 arch/arm/mach-msm/include/mach/entry-macro.S       |   36 -
 arch/arm/mach-msm/include/mach/hardware.h          |   18 -
 arch/arm/mach-msm/include/mach/irqs.h              |   37 -
 arch/arm/mach-msm/include/mach/sirc.h              |   98 -
 arch/arm/mach-msm/io.c                             |  161 --
 arch/arm/mach-msm/irq-vic.c                        |  146 +-
 arch/arm/mach-msm/irq.c                            |   29 +-
 arch/arm/mach-msm/{include/mach => }/irqs-7x00.h   |    3 +
 arch/arm/mach-msm/{include/mach => }/irqs-7x30.h   |    2 +
 arch/arm/mach-msm/{include/mach => }/irqs-8x50.h   |   42 +
 arch/arm/mach-msm/last_radio_log.c                 |    1 -
 arch/arm/mach-msm/{include/mach => }/msm_gpiomux.h |    0
 .../mach-msm/{include/mach => }/msm_iomap-7x00.h   |    5 +-
 .../mach-msm/{include/mach => }/msm_iomap-7x30.h   |    2 -
 .../mach-msm/{include/mach => }/msm_iomap-8x50.h   |   12 +-
 arch/arm/mach-msm/{include/mach => }/msm_iomap.h   |   24 +-
 arch/arm/mach-msm/proc_comm.c                      |   12 +-
 arch/arm/mach-msm/proc_comm.h                      |    2 +
 arch/arm/mach-msm/sirc.c                           |   44 +-
 arch/arm/mach-msm/sirc.h                           |   34 +
 arch/arm/mach-msm/smd.c                            |  135 +-
 arch/arm/mach-msm/smd_debug.c                      |  143 +-
 arch/arm/mach-msm/smd_private.h                    |   67 +-
 arch/arm/mach-msm/vreg.c                           |    2 +-
 arch/arm/mach-msm/{include/mach => }/vreg.h        |    0
 drivers/char/msm_smd_pkt.c                         |    2 +-
 drivers/clocksource/qcom-timer.c                   |    3 +-
 drivers/gpio/Kconfig                               |    8 -
 drivers/gpio/Makefile                              |    1 -
 drivers/mmc/host/msm_sdcc.c                        |  384 +++-
 drivers/tty/serial/Kconfig                         |   12 -
 drivers/tty/serial/msm_serial_hs.c                 | 1874 --------------------
 drivers/tty/serial/msm_smd_tty.c                   |    2 +-
 .../include/mach => include/linux}/msm_smd.h       |    0
 include/linux/platform_data/mmc-msm_sdcc.h         |    3 +
 include/linux/platform_data/msm_serial_hs.h        |   49 -
 65 files changed, 1419 insertions(+), 3467 deletions(-)
 rename arch/arm/mach-msm/{include/mach => }/clk.h (100%)
 delete mode 100644 arch/arm/mach-msm/dma.c
 rename {drivers/gpio => arch/arm/mach-msm}/gpio-msm-v1.c (97%)
 delete mode 100644 arch/arm/mach-msm/include/mach/dma.h
 delete mode 100644 arch/arm/mach-msm/include/mach/entry-macro.S
 delete mode 100644 arch/arm/mach-msm/include/mach/hardware.h
 delete mode 100644 arch/arm/mach-msm/include/mach/irqs.h
 delete mode 100644 arch/arm/mach-msm/include/mach/sirc.h
 delete mode 100644 arch/arm/mach-msm/io.c
 rename arch/arm/mach-msm/{include/mach => }/irqs-7x00.h (94%)
 rename arch/arm/mach-msm/{include/mach => }/irqs-7x30.h (98%)
 rename arch/arm/mach-msm/{include/mach => }/irqs-8x50.h (59%)
 rename arch/arm/mach-msm/{include/mach => }/msm_gpiomux.h (100%)
 rename arch/arm/mach-msm/{include/mach => }/msm_iomap-7x00.h (95%)
 rename arch/arm/mach-msm/{include/mach => }/msm_iomap-7x30.h (97%)
 rename arch/arm/mach-msm/{include/mach => }/msm_iomap-8x50.h (93%)
 rename arch/arm/mach-msm/{include/mach => }/msm_iomap.h (74%)
 create mode 100644 arch/arm/mach-msm/sirc.h
 rename arch/arm/mach-msm/{include/mach => }/vreg.h (100%)
 delete mode 100644 drivers/tty/serial/msm_serial_hs.c
 rename {arch/arm/mach-msm/include/mach => include/linux}/msm_smd.h (100%)
 delete mode 100644 include/linux/platform_data/msm_serial_hs.h

-- 
2.1.0.rc2

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC PATCH 01/18] serial: remove obsolete msm_serial_hs driver
  2015-03-04 19:32 [RFC PATCH 00/18] ARM: msm multiplatform support Arnd Bergmann
@ 2015-03-04 19:32 ` Arnd Bergmann
  2015-03-04 20:03   ` Paul Bolle
  2015-03-04 19:32 ` [RFC PATCH 02/18] mmc: msm: move data mover into mmc driver Arnd Bergmann
                   ` (20 subsequent siblings)
  21 siblings, 1 reply; 36+ messages in thread
From: Arnd Bergmann @ 2015-03-04 19:32 UTC (permalink / raw)
  To: linux-arm-kernel

Linux currently has two drivers for the same hardware: msm_serial
and msm_serial_hs. Only the former is being actively maintained,
and the latter is not used by any in-tree board files, so we
can safely remove it.

Signed-off-by: Arnd Bergmann <arnd@arnd.de>
---
 drivers/tty/serial/Kconfig                  |   12 -
 drivers/tty/serial/msm_serial_hs.c          | 1874 ---------------------------
 include/linux/platform_data/msm_serial_hs.h |   49 -
 3 files changed, 1935 deletions(-)
 delete mode 100644 drivers/tty/serial/msm_serial_hs.c
 delete mode 100644 include/linux/platform_data/msm_serial_hs.h

diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index d2501f01cd03..965c80f9fc50 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -1063,18 +1063,6 @@ config SERIAL_MSM_CONSOLE
 	select SERIAL_CORE_CONSOLE
 	select SERIAL_EARLYCON
 
-config SERIAL_MSM_HS
-	tristate "MSM UART High Speed: Serial Driver"
-	depends on ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50
-	select SERIAL_CORE
-	help
-	  If you have a machine based on MSM family of SoCs, you
-	  can enable its onboard high speed serial port by enabling
-	  this option.
-
-	  Choose M here to compile it as a module. The module will be
-	  called msm_serial_hs.
-
 config SERIAL_VT8500
 	bool "VIA VT8500 on-chip serial port support"
 	depends on ARCH_VT8500
diff --git a/drivers/tty/serial/msm_serial_hs.c b/drivers/tty/serial/msm_serial_hs.c
deleted file mode 100644
index 62da8534ba75..000000000000
--- a/drivers/tty/serial/msm_serial_hs.c
+++ /dev/null
@@ -1,1874 +0,0 @@
-/*
- * MSM 7k/8k High speed uart driver
- *
- * Copyright (c) 2007-2011, Code Aurora Forum. All rights reserved.
- * Copyright (c) 2008 Google Inc.
- * Modified: Nick Pelly <npelly@google.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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details.
- *
- * Has optional support for uart power management independent of linux
- * suspend/resume:
- *
- * RX wakeup.
- * UART wakeup can be triggered by RX activity (using a wakeup GPIO on the
- * UART RX pin). This should only be used if there is not a wakeup
- * GPIO on the UART CTS, and the first RX byte is known (for example, with the
- * Bluetooth Texas Instruments HCILL protocol), since the first RX byte will
- * always be lost. RTS will be asserted even while the UART is off in this mode
- * of operation. See msm_serial_hs_platform_data.rx_wakeup_irq.
- */
-
-#include <linux/module.h>
-
-#include <linux/serial.h>
-#include <linux/serial_core.h>
-#include <linux/tty.h>
-#include <linux/tty_flip.h>
-#include <linux/slab.h>
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/irq.h>
-#include <linux/io.h>
-#include <linux/ioport.h>
-#include <linux/kernel.h>
-#include <linux/timer.h>
-#include <linux/clk.h>
-#include <linux/platform_device.h>
-#include <linux/pm_runtime.h>
-#include <linux/dma-mapping.h>
-#include <linux/dmapool.h>
-#include <linux/wait.h>
-#include <linux/workqueue.h>
-
-#include <linux/atomic.h>
-#include <asm/irq.h>
-
-#include <mach/hardware.h>
-#include <mach/dma.h>
-#include <linux/platform_data/msm_serial_hs.h>
-
-/* HSUART Registers */
-#define UARTDM_MR1_ADDR 0x0
-#define UARTDM_MR2_ADDR 0x4
-
-/* Data Mover result codes */
-#define RSLT_FIFO_CNTR_BMSK (0xE << 28)
-#define RSLT_VLD            BIT(1)
-
-/* write only register */
-#define UARTDM_CSR_ADDR 0x8
-#define UARTDM_CSR_115200 0xFF
-#define UARTDM_CSR_57600  0xEE
-#define UARTDM_CSR_38400  0xDD
-#define UARTDM_CSR_28800  0xCC
-#define UARTDM_CSR_19200  0xBB
-#define UARTDM_CSR_14400  0xAA
-#define UARTDM_CSR_9600   0x99
-#define UARTDM_CSR_7200   0x88
-#define UARTDM_CSR_4800   0x77
-#define UARTDM_CSR_3600   0x66
-#define UARTDM_CSR_2400   0x55
-#define UARTDM_CSR_1200   0x44
-#define UARTDM_CSR_600    0x33
-#define UARTDM_CSR_300    0x22
-#define UARTDM_CSR_150    0x11
-#define UARTDM_CSR_75     0x00
-
-/* write only register */
-#define UARTDM_TF_ADDR 0x70
-#define UARTDM_TF2_ADDR 0x74
-#define UARTDM_TF3_ADDR 0x78
-#define UARTDM_TF4_ADDR 0x7C
-
-/* write only register */
-#define UARTDM_CR_ADDR 0x10
-#define UARTDM_IMR_ADDR 0x14
-
-#define UARTDM_IPR_ADDR 0x18
-#define UARTDM_TFWR_ADDR 0x1c
-#define UARTDM_RFWR_ADDR 0x20
-#define UARTDM_HCR_ADDR 0x24
-#define UARTDM_DMRX_ADDR 0x34
-#define UARTDM_IRDA_ADDR 0x38
-#define UARTDM_DMEN_ADDR 0x3c
-
-/* UART_DM_NO_CHARS_FOR_TX */
-#define UARTDM_NCF_TX_ADDR 0x40
-
-#define UARTDM_BADR_ADDR 0x44
-
-#define UARTDM_SIM_CFG_ADDR 0x80
-/* Read Only register */
-#define UARTDM_SR_ADDR 0x8
-
-/* Read Only register */
-#define UARTDM_RF_ADDR  0x70
-#define UARTDM_RF2_ADDR 0x74
-#define UARTDM_RF3_ADDR 0x78
-#define UARTDM_RF4_ADDR 0x7C
-
-/* Read Only register */
-#define UARTDM_MISR_ADDR 0x10
-
-/* Read Only register */
-#define UARTDM_ISR_ADDR 0x14
-#define UARTDM_RX_TOTAL_SNAP_ADDR 0x38
-
-#define UARTDM_RXFS_ADDR 0x50
-
-/* Register field Mask Mapping */
-#define UARTDM_SR_PAR_FRAME_BMSK        BIT(5)
-#define UARTDM_SR_OVERRUN_BMSK          BIT(4)
-#define UARTDM_SR_TXEMT_BMSK            BIT(3)
-#define UARTDM_SR_TXRDY_BMSK            BIT(2)
-#define UARTDM_SR_RXRDY_BMSK            BIT(0)
-
-#define UARTDM_CR_TX_DISABLE_BMSK       BIT(3)
-#define UARTDM_CR_RX_DISABLE_BMSK       BIT(1)
-#define UARTDM_CR_TX_EN_BMSK            BIT(2)
-#define UARTDM_CR_RX_EN_BMSK            BIT(0)
-
-/* UARTDM_CR channel_comman bit value (register field is bits 8:4) */
-#define RESET_RX                0x10
-#define RESET_TX                0x20
-#define RESET_ERROR_STATUS      0x30
-#define RESET_BREAK_INT         0x40
-#define START_BREAK             0x50
-#define STOP_BREAK              0x60
-#define RESET_CTS               0x70
-#define RESET_STALE_INT         0x80
-#define RFR_LOW                 0xD0
-#define RFR_HIGH                0xE0
-#define CR_PROTECTION_EN        0x100
-#define STALE_EVENT_ENABLE      0x500
-#define STALE_EVENT_DISABLE     0x600
-#define FORCE_STALE_EVENT       0x400
-#define CLEAR_TX_READY          0x300
-#define RESET_TX_ERROR          0x800
-#define RESET_TX_DONE           0x810
-
-#define UARTDM_MR1_AUTO_RFR_LEVEL1_BMSK 0xffffff00
-#define UARTDM_MR1_AUTO_RFR_LEVEL0_BMSK 0x3f
-#define UARTDM_MR1_CTS_CTL_BMSK 0x40
-#define UARTDM_MR1_RX_RDY_CTL_BMSK 0x80
-
-#define UARTDM_MR2_ERROR_MODE_BMSK 0x40
-#define UARTDM_MR2_BITS_PER_CHAR_BMSK 0x30
-
-/* bits per character configuration */
-#define FIVE_BPC  (0 << 4)
-#define SIX_BPC   (1 << 4)
-#define SEVEN_BPC (2 << 4)
-#define EIGHT_BPC (3 << 4)
-
-#define UARTDM_MR2_STOP_BIT_LEN_BMSK 0xc
-#define STOP_BIT_ONE (1 << 2)
-#define STOP_BIT_TWO (3 << 2)
-
-#define UARTDM_MR2_PARITY_MODE_BMSK 0x3
-
-/* Parity configuration */
-#define NO_PARITY 0x0
-#define EVEN_PARITY 0x1
-#define ODD_PARITY 0x2
-#define SPACE_PARITY 0x3
-
-#define UARTDM_IPR_STALE_TIMEOUT_MSB_BMSK 0xffffff80
-#define UARTDM_IPR_STALE_LSB_BMSK 0x1f
-
-/* These can be used for both ISR and IMR register */
-#define UARTDM_ISR_TX_READY_BMSK        BIT(7)
-#define UARTDM_ISR_CURRENT_CTS_BMSK     BIT(6)
-#define UARTDM_ISR_DELTA_CTS_BMSK       BIT(5)
-#define UARTDM_ISR_RXLEV_BMSK           BIT(4)
-#define UARTDM_ISR_RXSTALE_BMSK         BIT(3)
-#define UARTDM_ISR_RXBREAK_BMSK         BIT(2)
-#define UARTDM_ISR_RXHUNT_BMSK          BIT(1)
-#define UARTDM_ISR_TXLEV_BMSK           BIT(0)
-
-/* Field definitions for UART_DM_DMEN*/
-#define UARTDM_TX_DM_EN_BMSK 0x1
-#define UARTDM_RX_DM_EN_BMSK 0x2
-
-#define UART_FIFOSIZE 64
-#define UARTCLK 7372800
-
-/* Rx DMA request states */
-enum flush_reason {
-	FLUSH_NONE,
-	FLUSH_DATA_READY,
-	FLUSH_DATA_INVALID,  /* values after this indicate invalid data */
-	FLUSH_IGNORE = FLUSH_DATA_INVALID,
-	FLUSH_STOP,
-	FLUSH_SHUTDOWN,
-};
-
-/* UART clock states */
-enum msm_hs_clk_states_e {
-	MSM_HS_CLK_PORT_OFF,     /* port not in use */
-	MSM_HS_CLK_OFF,          /* clock disabled */
-	MSM_HS_CLK_REQUEST_OFF,  /* disable after TX and RX flushed */
-	MSM_HS_CLK_ON,           /* clock enabled */
-};
-
-/* Track the forced RXSTALE flush during clock off sequence.
- * These states are only valid during MSM_HS_CLK_REQUEST_OFF */
-enum msm_hs_clk_req_off_state_e {
-	CLK_REQ_OFF_START,
-	CLK_REQ_OFF_RXSTALE_ISSUED,
-	CLK_REQ_OFF_FLUSH_ISSUED,
-	CLK_REQ_OFF_RXSTALE_FLUSHED,
-};
-
-/**
- * struct msm_hs_tx
- * @tx_ready_int_en: ok to dma more tx?
- * @dma_in_flight: tx dma in progress
- * @xfer: top level DMA command pointer structure
- * @command_ptr: third level command struct pointer
- * @command_ptr_ptr: second level command list struct pointer
- * @mapped_cmd_ptr: DMA view of third level command struct
- * @mapped_cmd_ptr_ptr: DMA view of second level command list struct
- * @tx_count: number of bytes to transfer in DMA transfer
- * @dma_base: DMA view of UART xmit buffer
- *
- * This structure describes a single Tx DMA transaction. MSM DMA
- * commands have two levels of indirection. The top level command
- * ptr points to a list of command ptr which in turn points to a
- * single DMA 'command'. In our case each Tx transaction consists
- * of a single second level pointer pointing to a 'box type' command.
- */
-struct msm_hs_tx {
-	unsigned int tx_ready_int_en;
-	unsigned int dma_in_flight;
-	struct msm_dmov_cmd xfer;
-	dmov_box *command_ptr;
-	u32 *command_ptr_ptr;
-	dma_addr_t mapped_cmd_ptr;
-	dma_addr_t mapped_cmd_ptr_ptr;
-	int tx_count;
-	dma_addr_t dma_base;
-};
-
-/**
- * struct msm_hs_rx
- * @flush: Rx DMA request state
- * @xfer: top level DMA command pointer structure
- * @cmdptr_dmaaddr: DMA view of second level command structure
- * @command_ptr: third level DMA command pointer structure
- * @command_ptr_ptr: second level DMA command list pointer
- * @mapped_cmd_ptr: DMA view of the third level command structure
- * @wait: wait for DMA completion before shutdown
- * @buffer: destination buffer for RX DMA
- * @rbuffer: DMA view of buffer
- * @pool: dma pool out of which coherent rx buffer is allocated
- * @tty_work: private work-queue for tty flip buffer push task
- *
- * This structure describes a single Rx DMA transaction. Rx DMA
- * transactions use box mode DMA commands.
- */
-struct msm_hs_rx {
-	enum flush_reason flush;
-	struct msm_dmov_cmd xfer;
-	dma_addr_t cmdptr_dmaaddr;
-	dmov_box *command_ptr;
-	u32 *command_ptr_ptr;
-	dma_addr_t mapped_cmd_ptr;
-	wait_queue_head_t wait;
-	dma_addr_t rbuffer;
-	unsigned char *buffer;
-	struct dma_pool *pool;
-	struct work_struct tty_work;
-};
-
-/**
- * struct msm_hs_rx_wakeup
- * @irq: IRQ line to be configured as interrupt source on Rx activity
- * @ignore: boolean value. 1 = ignore the wakeup interrupt
- * @rx_to_inject: extra character to be inserted to Rx tty on wakeup
- * @inject_rx: 1 = insert rx_to_inject. 0 = do not insert extra character
- *
- * This is an optional structure required for UART Rx GPIO IRQ based
- * wakeup from low power state. UART wakeup can be triggered by RX activity
- * (using a wakeup GPIO on the UART RX pin). This should only be used if
- * there is not a wakeup GPIO on the UART CTS, and the first RX byte is
- * known (eg., with the Bluetooth Texas Instruments HCILL protocol),
- * since the first RX byte will always be lost. RTS will be asserted even
- * while the UART is clocked off in this mode of operation.
- */
-struct msm_hs_rx_wakeup {
-	int irq;  /* < 0 indicates low power wakeup disabled */
-	unsigned char ignore;
-	unsigned char inject_rx;
-	char rx_to_inject;
-};
-
-/**
- * struct msm_hs_port
- * @uport: embedded uart port structure
- * @imr_reg: shadow value of UARTDM_IMR
- * @clk: uart input clock handle
- * @tx: Tx transaction related data structure
- * @rx: Rx transaction related data structure
- * @dma_tx_channel: Tx DMA command channel
- * @dma_rx_channel Rx DMA command channel
- * @dma_tx_crci: Tx channel rate control interface number
- * @dma_rx_crci: Rx channel rate control interface number
- * @clk_off_timer: Timer to poll DMA event completion before clock off
- * @clk_off_delay: clk_off_timer poll interval
- * @clk_state: overall clock state
- * @clk_req_off_state: post flush clock states
- * @rx_wakeup: optional rx_wakeup feature related data
- * @exit_lpm_cb: optional callback to exit low power mode
- *
- * Low level serial port structure.
- */
-struct msm_hs_port {
-	struct uart_port uport;
-	unsigned long imr_reg;
-	struct clk *clk;
-	struct msm_hs_tx tx;
-	struct msm_hs_rx rx;
-
-	int dma_tx_channel;
-	int dma_rx_channel;
-	int dma_tx_crci;
-	int dma_rx_crci;
-
-	struct hrtimer clk_off_timer;
-	ktime_t clk_off_delay;
-	enum msm_hs_clk_states_e clk_state;
-	enum msm_hs_clk_req_off_state_e clk_req_off_state;
-
-	struct msm_hs_rx_wakeup rx_wakeup;
-	void (*exit_lpm_cb)(struct uart_port *);
-};
-
-#define MSM_UARTDM_BURST_SIZE 16   /* DM burst size (in bytes) */
-#define UARTDM_TX_BUF_SIZE UART_XMIT_SIZE
-#define UARTDM_RX_BUF_SIZE 512
-
-#define UARTDM_NR 2
-
-static struct msm_hs_port q_uart_port[UARTDM_NR];
-static struct platform_driver msm_serial_hs_platform_driver;
-static struct uart_driver msm_hs_driver;
-static struct uart_ops msm_hs_ops;
-static struct workqueue_struct *msm_hs_workqueue;
-
-#define UARTDM_TO_MSM(uart_port) \
-	container_of((uart_port), struct msm_hs_port, uport)
-
-static unsigned int use_low_power_rx_wakeup(struct msm_hs_port
-						   *msm_uport)
-{
-	return (msm_uport->rx_wakeup.irq >= 0);
-}
-
-static unsigned int msm_hs_read(struct uart_port *uport,
-				       unsigned int offset)
-{
-	return ioread32(uport->membase + offset);
-}
-
-static void msm_hs_write(struct uart_port *uport, unsigned int offset,
-				 unsigned int value)
-{
-	iowrite32(value, uport->membase + offset);
-}
-
-static void msm_hs_release_port(struct uart_port *port)
-{
-	iounmap(port->membase);
-}
-
-static int msm_hs_request_port(struct uart_port *port)
-{
-	port->membase = ioremap(port->mapbase, PAGE_SIZE);
-	if (unlikely(!port->membase))
-		return -ENOMEM;
-
-	/* configure the CR Protection to Enable */
-	msm_hs_write(port, UARTDM_CR_ADDR, CR_PROTECTION_EN);
-	return 0;
-}
-
-static int msm_hs_remove(struct platform_device *pdev)
-{
-
-	struct msm_hs_port *msm_uport;
-	struct device *dev;
-
-	if (pdev->id < 0 || pdev->id >= UARTDM_NR) {
-		printk(KERN_ERR "Invalid plaform device ID = %d\n", pdev->id);
-		return -EINVAL;
-	}
-
-	msm_uport = &q_uart_port[pdev->id];
-	dev = msm_uport->uport.dev;
-
-	dma_unmap_single(dev, msm_uport->rx.mapped_cmd_ptr, sizeof(dmov_box),
-			 DMA_TO_DEVICE);
-	dma_pool_free(msm_uport->rx.pool, msm_uport->rx.buffer,
-		      msm_uport->rx.rbuffer);
-	dma_pool_destroy(msm_uport->rx.pool);
-
-	dma_unmap_single(dev, msm_uport->rx.cmdptr_dmaaddr, sizeof(u32),
-			 DMA_TO_DEVICE);
-	dma_unmap_single(dev, msm_uport->tx.mapped_cmd_ptr_ptr, sizeof(u32),
-			 DMA_TO_DEVICE);
-	dma_unmap_single(dev, msm_uport->tx.mapped_cmd_ptr, sizeof(dmov_box),
-			 DMA_TO_DEVICE);
-
-	uart_remove_one_port(&msm_hs_driver, &msm_uport->uport);
-	clk_put(msm_uport->clk);
-
-	/* Free the tx resources */
-	kfree(msm_uport->tx.command_ptr);
-	kfree(msm_uport->tx.command_ptr_ptr);
-
-	/* Free the rx resources */
-	kfree(msm_uport->rx.command_ptr);
-	kfree(msm_uport->rx.command_ptr_ptr);
-
-	iounmap(msm_uport->uport.membase);
-
-	return 0;
-}
-
-static int msm_hs_init_clk_locked(struct uart_port *uport)
-{
-	int ret;
-	struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
-
-	ret = clk_enable(msm_uport->clk);
-	if (ret) {
-		printk(KERN_ERR "Error could not turn on UART clk\n");
-		return ret;
-	}
-
-	/* Set up the MREG/NREG/DREG/MNDREG */
-	ret = clk_set_rate(msm_uport->clk, uport->uartclk);
-	if (ret) {
-		printk(KERN_WARNING "Error setting clock rate on UART\n");
-		clk_disable(msm_uport->clk);
-		return ret;
-	}
-
-	msm_uport->clk_state = MSM_HS_CLK_ON;
-	return 0;
-}
-
-/* Enable and Disable clocks  (Used for power management) */
-static void msm_hs_pm(struct uart_port *uport, unsigned int state,
-		      unsigned int oldstate)
-{
-	struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
-
-	if (use_low_power_rx_wakeup(msm_uport) ||
-	    msm_uport->exit_lpm_cb)
-		return;  /* ignore linux PM states,
-			    use msm_hs_request_clock API */
-
-	switch (state) {
-	case 0:
-		clk_enable(msm_uport->clk);
-		break;
-	case 3:
-		clk_disable(msm_uport->clk);
-		break;
-	default:
-		dev_err(uport->dev, "msm_serial: Unknown PM state %d\n",
-			state);
-	}
-}
-
-/*
- * programs the UARTDM_CSR register with correct bit rates
- *
- * Interrupts should be disabled before we are called, as
- * we modify Set Baud rate
- * Set receive stale interrupt level, dependent on Bit Rate
- * Goal is to have around 8 ms before indicate stale.
- * roundup (((Bit Rate * .008) / 10) + 1
- */
-static void msm_hs_set_bps_locked(struct uart_port *uport,
-				  unsigned int bps)
-{
-	unsigned long rxstale;
-	unsigned long data;
-	struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
-
-	switch (bps) {
-	case 300:
-		msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_75);
-		rxstale = 1;
-		break;
-	case 600:
-		msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_150);
-		rxstale = 1;
-		break;
-	case 1200:
-		msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_300);
-		rxstale = 1;
-		break;
-	case 2400:
-		msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_600);
-		rxstale = 1;
-		break;
-	case 4800:
-		msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_1200);
-		rxstale = 1;
-		break;
-	case 9600:
-		msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_2400);
-		rxstale = 2;
-		break;
-	case 14400:
-		msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_3600);
-		rxstale = 3;
-		break;
-	case 19200:
-		msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_4800);
-		rxstale = 4;
-		break;
-	case 28800:
-		msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_7200);
-		rxstale = 6;
-		break;
-	case 38400:
-		msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_9600);
-		rxstale = 8;
-		break;
-	case 57600:
-		msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_14400);
-		rxstale = 16;
-		break;
-	case 76800:
-		msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_19200);
-		rxstale = 16;
-		break;
-	case 115200:
-		msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_28800);
-		rxstale = 31;
-		break;
-	case 230400:
-		msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_57600);
-		rxstale = 31;
-		break;
-	case 460800:
-		msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_115200);
-		rxstale = 31;
-		break;
-	case 4000000:
-	case 3686400:
-	case 3200000:
-	case 3500000:
-	case 3000000:
-	case 2500000:
-	case 1500000:
-	case 1152000:
-	case 1000000:
-	case 921600:
-		msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_115200);
-		rxstale = 31;
-		break;
-	default:
-		msm_hs_write(uport, UARTDM_CSR_ADDR, UARTDM_CSR_2400);
-		/* default to 9600 */
-		bps = 9600;
-		rxstale = 2;
-		break;
-	}
-	if (bps > 460800)
-		uport->uartclk = bps * 16;
-	else
-		uport->uartclk = UARTCLK;
-
-	if (clk_set_rate(msm_uport->clk, uport->uartclk)) {
-		printk(KERN_WARNING "Error setting clock rate on UART\n");
-		return;
-	}
-
-	data = rxstale & UARTDM_IPR_STALE_LSB_BMSK;
-	data |= UARTDM_IPR_STALE_TIMEOUT_MSB_BMSK & (rxstale << 2);
-
-	msm_hs_write(uport, UARTDM_IPR_ADDR, data);
-}
-
-/*
- * termios :  new ktermios
- * oldtermios:  old ktermios previous setting
- *
- * Configure the serial port
- */
-static void msm_hs_set_termios(struct uart_port *uport,
-			       struct ktermios *termios,
-			       struct ktermios *oldtermios)
-{
-	unsigned int bps;
-	unsigned long data;
-	unsigned long flags;
-	unsigned int c_cflag = termios->c_cflag;
-	struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
-
-	spin_lock_irqsave(&uport->lock, flags);
-	clk_enable(msm_uport->clk);
-
-	/* 300 is the minimum baud support by the driver  */
-	bps = uart_get_baud_rate(uport, termios, oldtermios, 200, 4000000);
-
-	/* Temporary remapping  200 BAUD to 3.2 mbps */
-	if (bps == 200)
-		bps = 3200000;
-
-	msm_hs_set_bps_locked(uport, bps);
-
-	data = msm_hs_read(uport, UARTDM_MR2_ADDR);
-	data &= ~UARTDM_MR2_PARITY_MODE_BMSK;
-	/* set parity */
-	if (PARENB == (c_cflag & PARENB)) {
-		if (PARODD == (c_cflag & PARODD))
-			data |= ODD_PARITY;
-		else if (CMSPAR == (c_cflag & CMSPAR))
-			data |= SPACE_PARITY;
-		else
-			data |= EVEN_PARITY;
-	}
-
-	/* Set bits per char */
-	data &= ~UARTDM_MR2_BITS_PER_CHAR_BMSK;
-
-	switch (c_cflag & CSIZE) {
-	case CS5:
-		data |= FIVE_BPC;
-		break;
-	case CS6:
-		data |= SIX_BPC;
-		break;
-	case CS7:
-		data |= SEVEN_BPC;
-		break;
-	default:
-		data |= EIGHT_BPC;
-		break;
-	}
-	/* stop bits */
-	if (c_cflag & CSTOPB) {
-		data |= STOP_BIT_TWO;
-	} else {
-		/* otherwise 1 stop bit */
-		data |= STOP_BIT_ONE;
-	}
-	data |= UARTDM_MR2_ERROR_MODE_BMSK;
-	/* write parity/bits per char/stop bit configuration */
-	msm_hs_write(uport, UARTDM_MR2_ADDR, data);
-
-	/* Configure HW flow control */
-	data = msm_hs_read(uport, UARTDM_MR1_ADDR);
-
-	data &= ~(UARTDM_MR1_CTS_CTL_BMSK | UARTDM_MR1_RX_RDY_CTL_BMSK);
-
-	if (c_cflag & CRTSCTS) {
-		data |= UARTDM_MR1_CTS_CTL_BMSK;
-		data |= UARTDM_MR1_RX_RDY_CTL_BMSK;
-	}
-
-	msm_hs_write(uport, UARTDM_MR1_ADDR, data);
-
-	uport->ignore_status_mask = termios->c_iflag & INPCK;
-	uport->ignore_status_mask |= termios->c_iflag & IGNPAR;
-	uport->read_status_mask = (termios->c_cflag & CREAD);
-
-	msm_hs_write(uport, UARTDM_IMR_ADDR, 0);
-
-	/* Set Transmit software time out */
-	uart_update_timeout(uport, c_cflag, bps);
-
-	msm_hs_write(uport, UARTDM_CR_ADDR, RESET_RX);
-	msm_hs_write(uport, UARTDM_CR_ADDR, RESET_TX);
-
-	if (msm_uport->rx.flush == FLUSH_NONE) {
-		msm_uport->rx.flush = FLUSH_IGNORE;
-		msm_dmov_stop_cmd(msm_uport->dma_rx_channel, NULL, 1);
-	}
-
-	msm_hs_write(uport, UARTDM_IMR_ADDR, msm_uport->imr_reg);
-
-	clk_disable(msm_uport->clk);
-	spin_unlock_irqrestore(&uport->lock, flags);
-}
-
-/*
- *  Standard API, Transmitter
- *  Any character in the transmit shift register is sent
- */
-static unsigned int msm_hs_tx_empty(struct uart_port *uport)
-{
-	unsigned int data;
-	unsigned int ret = 0;
-	struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
-
-	clk_enable(msm_uport->clk);
-
-	data = msm_hs_read(uport, UARTDM_SR_ADDR);
-	if (data & UARTDM_SR_TXEMT_BMSK)
-		ret = TIOCSER_TEMT;
-
-	clk_disable(msm_uport->clk);
-
-	return ret;
-}
-
-/*
- *  Standard API, Stop transmitter.
- *  Any character in the transmit shift register is sent as
- *  well as the current data mover transfer .
- */
-static void msm_hs_stop_tx_locked(struct uart_port *uport)
-{
-	struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
-
-	msm_uport->tx.tx_ready_int_en = 0;
-}
-
-/*
- *  Standard API, Stop receiver as soon as possible.
- *
- *  Function immediately terminates the operation of the
- *  channel receiver and any incoming characters are lost. None
- *  of the receiver status bits are affected by this command and
- *  characters that are already in the receive FIFO there.
- */
-static void msm_hs_stop_rx_locked(struct uart_port *uport)
-{
-	struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
-	unsigned int data;
-
-	clk_enable(msm_uport->clk);
-
-	/* disable dlink */
-	data = msm_hs_read(uport, UARTDM_DMEN_ADDR);
-	data &= ~UARTDM_RX_DM_EN_BMSK;
-	msm_hs_write(uport, UARTDM_DMEN_ADDR, data);
-
-	/* Disable the receiver */
-	if (msm_uport->rx.flush == FLUSH_NONE)
-		msm_dmov_stop_cmd(msm_uport->dma_rx_channel, NULL, 1);
-
-	if (msm_uport->rx.flush != FLUSH_SHUTDOWN)
-		msm_uport->rx.flush = FLUSH_STOP;
-
-	clk_disable(msm_uport->clk);
-}
-
-/*  Transmit the next chunk of data */
-static void msm_hs_submit_tx_locked(struct uart_port *uport)
-{
-	int left;
-	int tx_count;
-	dma_addr_t src_addr;
-	struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
-	struct msm_hs_tx *tx = &msm_uport->tx;
-	struct circ_buf *tx_buf = &msm_uport->uport.state->xmit;
-
-	if (uart_circ_empty(tx_buf) || uport->state->port.tty->stopped) {
-		msm_hs_stop_tx_locked(uport);
-		return;
-	}
-
-	tx->dma_in_flight = 1;
-
-	tx_count = uart_circ_chars_pending(tx_buf);
-
-	if (UARTDM_TX_BUF_SIZE < tx_count)
-		tx_count = UARTDM_TX_BUF_SIZE;
-
-	left = UART_XMIT_SIZE - tx_buf->tail;
-
-	if (tx_count > left)
-		tx_count = left;
-
-	src_addr = tx->dma_base + tx_buf->tail;
-	dma_sync_single_for_device(uport->dev, src_addr, tx_count,
-				   DMA_TO_DEVICE);
-
-	tx->command_ptr->num_rows = (((tx_count + 15) >> 4) << 16) |
-				     ((tx_count + 15) >> 4);
-	tx->command_ptr->src_row_addr = src_addr;
-
-	dma_sync_single_for_device(uport->dev, tx->mapped_cmd_ptr,
-				   sizeof(dmov_box), DMA_TO_DEVICE);
-
-	*tx->command_ptr_ptr = CMD_PTR_LP | DMOV_CMD_ADDR(tx->mapped_cmd_ptr);
-
-	dma_sync_single_for_device(uport->dev, tx->mapped_cmd_ptr_ptr,
-				   sizeof(u32), DMA_TO_DEVICE);
-
-	/* Save tx_count to use in Callback */
-	tx->tx_count = tx_count;
-	msm_hs_write(uport, UARTDM_NCF_TX_ADDR, tx_count);
-
-	/* Disable the tx_ready interrupt */
-	msm_uport->imr_reg &= ~UARTDM_ISR_TX_READY_BMSK;
-	msm_hs_write(uport, UARTDM_IMR_ADDR, msm_uport->imr_reg);
-	msm_dmov_enqueue_cmd(msm_uport->dma_tx_channel, &tx->xfer);
-}
-
-/* Start to receive the next chunk of data */
-static void msm_hs_start_rx_locked(struct uart_port *uport)
-{
-	struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
-
-	msm_hs_write(uport, UARTDM_CR_ADDR, RESET_STALE_INT);
-	msm_hs_write(uport, UARTDM_DMRX_ADDR, UARTDM_RX_BUF_SIZE);
-	msm_hs_write(uport, UARTDM_CR_ADDR, STALE_EVENT_ENABLE);
-	msm_uport->imr_reg |= UARTDM_ISR_RXLEV_BMSK;
-	msm_hs_write(uport, UARTDM_IMR_ADDR, msm_uport->imr_reg);
-
-	msm_uport->rx.flush = FLUSH_NONE;
-	msm_dmov_enqueue_cmd(msm_uport->dma_rx_channel, &msm_uport->rx.xfer);
-
-	/* might have finished RX and be ready to clock off */
-	hrtimer_start(&msm_uport->clk_off_timer, msm_uport->clk_off_delay,
-			HRTIMER_MODE_REL);
-}
-
-/* Enable the transmitter Interrupt */
-static void msm_hs_start_tx_locked(struct uart_port *uport)
-{
-	struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
-
-	clk_enable(msm_uport->clk);
-
-	if (msm_uport->exit_lpm_cb)
-		msm_uport->exit_lpm_cb(uport);
-
-	if (msm_uport->tx.tx_ready_int_en == 0) {
-		msm_uport->tx.tx_ready_int_en = 1;
-		msm_hs_submit_tx_locked(uport);
-	}
-
-	clk_disable(msm_uport->clk);
-}
-
-/*
- *  This routine is called when we are done with a DMA transfer
- *
- *  This routine is registered with Data mover when we set
- *  up a Data Mover transfer. It is called from Data mover ISR
- *  when the DMA transfer is done.
- */
-static void msm_hs_dmov_tx_callback(struct msm_dmov_cmd *cmd_ptr,
-					unsigned int result,
-					struct msm_dmov_errdata *err)
-{
-	unsigned long flags;
-	struct msm_hs_port *msm_uport;
-
-	/* DMA did not finish properly */
-	WARN_ON((((result & RSLT_FIFO_CNTR_BMSK) >> 28) == 1) &&
-		!(result & RSLT_VLD));
-
-	msm_uport = container_of(cmd_ptr, struct msm_hs_port, tx.xfer);
-
-	spin_lock_irqsave(&msm_uport->uport.lock, flags);
-	clk_enable(msm_uport->clk);
-
-	msm_uport->imr_reg |= UARTDM_ISR_TX_READY_BMSK;
-	msm_hs_write(&msm_uport->uport, UARTDM_IMR_ADDR, msm_uport->imr_reg);
-
-	clk_disable(msm_uport->clk);
-	spin_unlock_irqrestore(&msm_uport->uport.lock, flags);
-}
-
-/*
- * This routine is called when we are done with a DMA transfer or the
- * a flush has been sent to the data mover driver.
- *
- * This routine is registered with Data mover when we set up a Data Mover
- *  transfer. It is called from Data mover ISR when the DMA transfer is done.
- */
-static void msm_hs_dmov_rx_callback(struct msm_dmov_cmd *cmd_ptr,
-					unsigned int result,
-					struct msm_dmov_errdata *err)
-{
-	int retval;
-	int rx_count;
-	unsigned long status;
-	unsigned int error_f = 0;
-	unsigned long flags;
-	unsigned int flush;
-	struct tty_port *port;
-	struct uart_port *uport;
-	struct msm_hs_port *msm_uport;
-
-	msm_uport = container_of(cmd_ptr, struct msm_hs_port, rx.xfer);
-	uport = &msm_uport->uport;
-
-	spin_lock_irqsave(&uport->lock, flags);
-	clk_enable(msm_uport->clk);
-
-	port = &uport->state->port;
-
-	msm_hs_write(uport, UARTDM_CR_ADDR, STALE_EVENT_DISABLE);
-
-	status = msm_hs_read(uport, UARTDM_SR_ADDR);
-
-	/* overflow is not connect to data in a FIFO */
-	if (unlikely((status & UARTDM_SR_OVERRUN_BMSK) &&
-		     (uport->read_status_mask & CREAD))) {
-		tty_insert_flip_char(port, 0, TTY_OVERRUN);
-		uport->icount.buf_overrun++;
-		error_f = 1;
-	}
-
-	if (!(uport->ignore_status_mask & INPCK))
-		status = status & ~(UARTDM_SR_PAR_FRAME_BMSK);
-
-	if (unlikely(status & UARTDM_SR_PAR_FRAME_BMSK)) {
-		/* Can not tell difference between parity & frame error */
-		uport->icount.parity++;
-		error_f = 1;
-		if (uport->ignore_status_mask & IGNPAR)
-			tty_insert_flip_char(port, 0, TTY_PARITY);
-	}
-
-	if (error_f)
-		msm_hs_write(uport, UARTDM_CR_ADDR, RESET_ERROR_STATUS);
-
-	if (msm_uport->clk_req_off_state == CLK_REQ_OFF_FLUSH_ISSUED)
-		msm_uport->clk_req_off_state = CLK_REQ_OFF_RXSTALE_FLUSHED;
-
-	flush = msm_uport->rx.flush;
-	if (flush == FLUSH_IGNORE)
-		msm_hs_start_rx_locked(uport);
-	if (flush == FLUSH_STOP)
-		msm_uport->rx.flush = FLUSH_SHUTDOWN;
-	if (flush >= FLUSH_DATA_INVALID)
-		goto out;
-
-	rx_count = msm_hs_read(uport, UARTDM_RX_TOTAL_SNAP_ADDR);
-
-	if (0 != (uport->read_status_mask & CREAD)) {
-		retval = tty_insert_flip_string(port, msm_uport->rx.buffer,
-						rx_count);
-		BUG_ON(retval != rx_count);
-	}
-
-	msm_hs_start_rx_locked(uport);
-
-out:
-	clk_disable(msm_uport->clk);
-
-	spin_unlock_irqrestore(&uport->lock, flags);
-
-	if (flush < FLUSH_DATA_INVALID)
-		queue_work(msm_hs_workqueue, &msm_uport->rx.tty_work);
-}
-
-static void msm_hs_tty_flip_buffer_work(struct work_struct *work)
-{
-	struct msm_hs_port *msm_uport =
-			container_of(work, struct msm_hs_port, rx.tty_work);
-
-	tty_flip_buffer_push(&msm_uport->uport.state->port);
-}
-
-/*
- *  Standard API, Current states of modem control inputs
- *
- * Since CTS can be handled entirely by HARDWARE we always
- * indicate clear to send and count on the TX FIFO to block when
- * it fills up.
- *
- * - TIOCM_DCD
- * - TIOCM_CTS
- * - TIOCM_DSR
- * - TIOCM_RI
- *  (Unsupported) DCD and DSR will return them high. RI will return low.
- */
-static unsigned int msm_hs_get_mctrl_locked(struct uart_port *uport)
-{
-	return TIOCM_DSR | TIOCM_CAR | TIOCM_CTS;
-}
-
-/*
- * True enables UART auto RFR, which indicates we are ready for data if the RX
- * buffer is not full. False disables auto RFR, and deasserts RFR to indicate
- * we are not ready for data. Must be called with UART clock on.
- */
-static void set_rfr_locked(struct uart_port *uport, int auto_rfr)
-{
-	unsigned int data;
-
-	data = msm_hs_read(uport, UARTDM_MR1_ADDR);
-
-	if (auto_rfr) {
-		/* enable auto ready-for-receiving */
-		data |= UARTDM_MR1_RX_RDY_CTL_BMSK;
-		msm_hs_write(uport, UARTDM_MR1_ADDR, data);
-	} else {
-		/* disable auto ready-for-receiving */
-		data &= ~UARTDM_MR1_RX_RDY_CTL_BMSK;
-		msm_hs_write(uport, UARTDM_MR1_ADDR, data);
-		/* RFR is active low, set high */
-		msm_hs_write(uport, UARTDM_CR_ADDR, RFR_HIGH);
-	}
-}
-
-/*
- *  Standard API, used to set or clear RFR
- */
-static void msm_hs_set_mctrl_locked(struct uart_port *uport,
-				    unsigned int mctrl)
-{
-	unsigned int auto_rfr;
-	struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
-
-	clk_enable(msm_uport->clk);
-
-	auto_rfr = TIOCM_RTS & mctrl ? 1 : 0;
-	set_rfr_locked(uport, auto_rfr);
-
-	clk_disable(msm_uport->clk);
-}
-
-/* Standard API, Enable modem status (CTS) interrupt  */
-static void msm_hs_enable_ms_locked(struct uart_port *uport)
-{
-	struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
-
-	clk_enable(msm_uport->clk);
-
-	/* Enable DELTA_CTS Interrupt */
-	msm_uport->imr_reg |= UARTDM_ISR_DELTA_CTS_BMSK;
-	msm_hs_write(uport, UARTDM_IMR_ADDR, msm_uport->imr_reg);
-
-	clk_disable(msm_uport->clk);
-
-}
-
-/*
- *  Standard API, Break Signal
- *
- * Control the transmission of a break signal. ctl eq 0 => break
- * signal terminate ctl ne 0 => start break signal
- */
-static void msm_hs_break_ctl(struct uart_port *uport, int ctl)
-{
-	struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
-
-	clk_enable(msm_uport->clk);
-	msm_hs_write(uport, UARTDM_CR_ADDR, ctl ? START_BREAK : STOP_BREAK);
-	clk_disable(msm_uport->clk);
-}
-
-static void msm_hs_config_port(struct uart_port *uport, int cfg_flags)
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(&uport->lock, flags);
-	if (cfg_flags & UART_CONFIG_TYPE) {
-		uport->type = PORT_MSM;
-		msm_hs_request_port(uport);
-	}
-	spin_unlock_irqrestore(&uport->lock, flags);
-}
-
-/*  Handle CTS changes (Called from interrupt handler) */
-static void msm_hs_handle_delta_cts_locked(struct uart_port *uport)
-{
-	struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
-
-	clk_enable(msm_uport->clk);
-
-	/* clear interrupt */
-	msm_hs_write(uport, UARTDM_CR_ADDR, RESET_CTS);
-	uport->icount.cts++;
-
-	clk_disable(msm_uport->clk);
-
-	/* clear the IOCTL TIOCMIWAIT if called */
-	wake_up_interruptible(&uport->state->port.delta_msr_wait);
-}
-
-/* check if the TX path is flushed, and if so clock off
- * returns 0 did not clock off, need to retry (still sending final byte)
- *        -1 did not clock off, do not retry
- *         1 if we clocked off
- */
-static int msm_hs_check_clock_off_locked(struct uart_port *uport)
-{
-	unsigned long sr_status;
-	struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
-	struct circ_buf *tx_buf = &uport->state->xmit;
-
-	/* Cancel if tx tty buffer is not empty, dma is in flight,
-	 * or tx fifo is not empty, or rx fifo is not empty */
-	if (msm_uport->clk_state != MSM_HS_CLK_REQUEST_OFF ||
-	    !uart_circ_empty(tx_buf) || msm_uport->tx.dma_in_flight ||
-	    (msm_uport->imr_reg & UARTDM_ISR_TXLEV_BMSK) ||
-	    !(msm_uport->imr_reg & UARTDM_ISR_RXLEV_BMSK))  {
-		return -1;
-	}
-
-	/* Make sure the uart is finished with the last byte */
-	sr_status = msm_hs_read(uport, UARTDM_SR_ADDR);
-	if (!(sr_status & UARTDM_SR_TXEMT_BMSK))
-		return 0;  /* retry */
-
-	/* Make sure forced RXSTALE flush complete */
-	switch (msm_uport->clk_req_off_state) {
-	case CLK_REQ_OFF_START:
-		msm_uport->clk_req_off_state = CLK_REQ_OFF_RXSTALE_ISSUED;
-		msm_hs_write(uport, UARTDM_CR_ADDR, FORCE_STALE_EVENT);
-		return 0;  /* RXSTALE flush not complete - retry */
-	case CLK_REQ_OFF_RXSTALE_ISSUED:
-	case CLK_REQ_OFF_FLUSH_ISSUED:
-		return 0;  /* RXSTALE flush not complete - retry */
-	case CLK_REQ_OFF_RXSTALE_FLUSHED:
-		break;  /* continue */
-	}
-
-	if (msm_uport->rx.flush != FLUSH_SHUTDOWN) {
-		if (msm_uport->rx.flush == FLUSH_NONE)
-			msm_hs_stop_rx_locked(uport);
-		return 0;  /* come back later to really clock off */
-	}
-
-	/* we really want to clock off */
-	clk_disable(msm_uport->clk);
-	msm_uport->clk_state = MSM_HS_CLK_OFF;
-
-	if (use_low_power_rx_wakeup(msm_uport)) {
-		msm_uport->rx_wakeup.ignore = 1;
-		enable_irq(msm_uport->rx_wakeup.irq);
-	}
-	return 1;
-}
-
-static enum hrtimer_restart msm_hs_clk_off_retry(struct hrtimer *timer)
-{
-	unsigned long flags;
-	int ret = HRTIMER_NORESTART;
-	struct msm_hs_port *msm_uport = container_of(timer, struct msm_hs_port,
-						     clk_off_timer);
-	struct uart_port *uport = &msm_uport->uport;
-
-	spin_lock_irqsave(&uport->lock, flags);
-
-	if (!msm_hs_check_clock_off_locked(uport)) {
-		hrtimer_forward_now(timer, msm_uport->clk_off_delay);
-		ret = HRTIMER_RESTART;
-	}
-
-	spin_unlock_irqrestore(&uport->lock, flags);
-
-	return ret;
-}
-
-static irqreturn_t msm_hs_isr(int irq, void *dev)
-{
-	unsigned long flags;
-	unsigned long isr_status;
-	struct msm_hs_port *msm_uport = dev;
-	struct uart_port *uport = &msm_uport->uport;
-	struct circ_buf *tx_buf = &uport->state->xmit;
-	struct msm_hs_tx *tx = &msm_uport->tx;
-	struct msm_hs_rx *rx = &msm_uport->rx;
-
-	spin_lock_irqsave(&uport->lock, flags);
-
-	isr_status = msm_hs_read(uport, UARTDM_MISR_ADDR);
-
-	/* Uart RX starting */
-	if (isr_status & UARTDM_ISR_RXLEV_BMSK) {
-		msm_uport->imr_reg &= ~UARTDM_ISR_RXLEV_BMSK;
-		msm_hs_write(uport, UARTDM_IMR_ADDR, msm_uport->imr_reg);
-	}
-	/* Stale rx interrupt */
-	if (isr_status & UARTDM_ISR_RXSTALE_BMSK) {
-		msm_hs_write(uport, UARTDM_CR_ADDR, STALE_EVENT_DISABLE);
-		msm_hs_write(uport, UARTDM_CR_ADDR, RESET_STALE_INT);
-
-		if (msm_uport->clk_req_off_state == CLK_REQ_OFF_RXSTALE_ISSUED)
-			msm_uport->clk_req_off_state =
-					CLK_REQ_OFF_FLUSH_ISSUED;
-		if (rx->flush == FLUSH_NONE) {
-			rx->flush = FLUSH_DATA_READY;
-			msm_dmov_stop_cmd(msm_uport->dma_rx_channel, NULL, 1);
-		}
-	}
-	/* tx ready interrupt */
-	if (isr_status & UARTDM_ISR_TX_READY_BMSK) {
-		/* Clear  TX Ready */
-		msm_hs_write(uport, UARTDM_CR_ADDR, CLEAR_TX_READY);
-
-		if (msm_uport->clk_state == MSM_HS_CLK_REQUEST_OFF) {
-			msm_uport->imr_reg |= UARTDM_ISR_TXLEV_BMSK;
-			msm_hs_write(uport, UARTDM_IMR_ADDR,
-				     msm_uport->imr_reg);
-		}
-
-		/* Complete DMA TX transactions and submit new transactions */
-		tx_buf->tail = (tx_buf->tail + tx->tx_count) & ~UART_XMIT_SIZE;
-
-		tx->dma_in_flight = 0;
-
-		uport->icount.tx += tx->tx_count;
-		if (tx->tx_ready_int_en)
-			msm_hs_submit_tx_locked(uport);
-
-		if (uart_circ_chars_pending(tx_buf) < WAKEUP_CHARS)
-			uart_write_wakeup(uport);
-	}
-	if (isr_status & UARTDM_ISR_TXLEV_BMSK) {
-		/* TX FIFO is empty */
-		msm_uport->imr_reg &= ~UARTDM_ISR_TXLEV_BMSK;
-		msm_hs_write(uport, UARTDM_IMR_ADDR, msm_uport->imr_reg);
-		if (!msm_hs_check_clock_off_locked(uport))
-			hrtimer_start(&msm_uport->clk_off_timer,
-				      msm_uport->clk_off_delay,
-				      HRTIMER_MODE_REL);
-	}
-
-	/* Change in CTS interrupt */
-	if (isr_status & UARTDM_ISR_DELTA_CTS_BMSK)
-		msm_hs_handle_delta_cts_locked(uport);
-
-	spin_unlock_irqrestore(&uport->lock, flags);
-
-	return IRQ_HANDLED;
-}
-
-void msm_hs_request_clock_off_locked(struct uart_port *uport)
-{
-	struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
-
-	if (msm_uport->clk_state == MSM_HS_CLK_ON) {
-		msm_uport->clk_state = MSM_HS_CLK_REQUEST_OFF;
-		msm_uport->clk_req_off_state = CLK_REQ_OFF_START;
-		if (!use_low_power_rx_wakeup(msm_uport))
-			set_rfr_locked(uport, 0);
-		msm_uport->imr_reg |= UARTDM_ISR_TXLEV_BMSK;
-		msm_hs_write(uport, UARTDM_IMR_ADDR, msm_uport->imr_reg);
-	}
-}
-
-/**
- * msm_hs_request_clock_off - request to (i.e. asynchronously) turn off uart
- * clock once pending TX is flushed and Rx DMA command is terminated.
- * @uport: uart_port structure for the device instance.
- *
- * This functions puts the device into a partially active low power mode. It
- * waits to complete all pending tx transactions, flushes ongoing Rx DMA
- * command and terminates UART side Rx transaction, puts UART HW in non DMA
- * mode and then clocks off the device. A client calls this when no UART
- * data is expected. msm_request_clock_on() must be called before any further
- * UART can be sent or received.
- */
-void msm_hs_request_clock_off(struct uart_port *uport)
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(&uport->lock, flags);
-	msm_hs_request_clock_off_locked(uport);
-	spin_unlock_irqrestore(&uport->lock, flags);
-}
-
-void msm_hs_request_clock_on_locked(struct uart_port *uport)
-{
-	struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
-	unsigned int data;
-
-	switch (msm_uport->clk_state) {
-	case MSM_HS_CLK_OFF:
-		clk_enable(msm_uport->clk);
-		disable_irq_nosync(msm_uport->rx_wakeup.irq);
-		/* fall-through */
-	case MSM_HS_CLK_REQUEST_OFF:
-		if (msm_uport->rx.flush == FLUSH_STOP ||
-		    msm_uport->rx.flush == FLUSH_SHUTDOWN) {
-			msm_hs_write(uport, UARTDM_CR_ADDR, RESET_RX);
-			data = msm_hs_read(uport, UARTDM_DMEN_ADDR);
-			data |= UARTDM_RX_DM_EN_BMSK;
-			msm_hs_write(uport, UARTDM_DMEN_ADDR, data);
-		}
-		hrtimer_try_to_cancel(&msm_uport->clk_off_timer);
-		if (msm_uport->rx.flush == FLUSH_SHUTDOWN)
-			msm_hs_start_rx_locked(uport);
-		if (!use_low_power_rx_wakeup(msm_uport))
-			set_rfr_locked(uport, 1);
-		if (msm_uport->rx.flush == FLUSH_STOP)
-			msm_uport->rx.flush = FLUSH_IGNORE;
-		msm_uport->clk_state = MSM_HS_CLK_ON;
-		break;
-	case MSM_HS_CLK_ON:
-		break;
-	case MSM_HS_CLK_PORT_OFF:
-		break;
-	}
-}
-
-/**
- * msm_hs_request_clock_on - Switch the device from partially active low
- * power mode to fully active (i.e. clock on) mode.
- * @uport: uart_port structure for the device.
- *
- * This function switches on the input clock, puts UART HW into DMA mode
- * and enqueues an Rx DMA command if the device was in partially active
- * mode. It has no effect if called with the device in inactive state.
- */
-void msm_hs_request_clock_on(struct uart_port *uport)
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(&uport->lock, flags);
-	msm_hs_request_clock_on_locked(uport);
-	spin_unlock_irqrestore(&uport->lock, flags);
-}
-
-static irqreturn_t msm_hs_rx_wakeup_isr(int irq, void *dev)
-{
-	unsigned int wakeup = 0;
-	unsigned long flags;
-	struct msm_hs_port *msm_uport = dev;
-	struct uart_port *uport = &msm_uport->uport;
-
-	spin_lock_irqsave(&uport->lock, flags);
-	if (msm_uport->clk_state == MSM_HS_CLK_OFF) {
-		/* ignore the first irq - it is a pending irq that occurred
-		 * before enable_irq() */
-		if (msm_uport->rx_wakeup.ignore)
-			msm_uport->rx_wakeup.ignore = 0;
-		else
-			wakeup = 1;
-	}
-
-	if (wakeup) {
-		/* the uart was clocked off during an rx, wake up and
-		 * optionally inject char into tty rx */
-		msm_hs_request_clock_on_locked(uport);
-		if (msm_uport->rx_wakeup.inject_rx) {
-			tty_insert_flip_char(&uport->state->port,
-					     msm_uport->rx_wakeup.rx_to_inject,
-					     TTY_NORMAL);
-			queue_work(msm_hs_workqueue, &msm_uport->rx.tty_work);
-		}
-	}
-
-	spin_unlock_irqrestore(&uport->lock, flags);
-
-	return IRQ_HANDLED;
-}
-
-static const char *msm_hs_type(struct uart_port *port)
-{
-	return (port->type == PORT_MSM) ? "MSM_HS_UART" : NULL;
-}
-
-/* Called when port is opened */
-static int msm_hs_startup(struct uart_port *uport)
-{
-	int ret;
-	int rfr_level;
-	unsigned long flags;
-	unsigned int data;
-	struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
-	struct circ_buf *tx_buf = &uport->state->xmit;
-	struct msm_hs_tx *tx = &msm_uport->tx;
-	struct msm_hs_rx *rx = &msm_uport->rx;
-
-	rfr_level = uport->fifosize;
-	if (rfr_level > 16)
-		rfr_level -= 16;
-
-	tx->dma_base = dma_map_single(uport->dev, tx_buf->buf, UART_XMIT_SIZE,
-				      DMA_TO_DEVICE);
-
-	/* do not let tty layer execute RX in global workqueue, use a
-	 * dedicated workqueue managed by this driver */
-	uport->state->port.low_latency = 1;
-
-	/* turn on uart clk */
-	ret = msm_hs_init_clk_locked(uport);
-	if (unlikely(ret)) {
-		printk(KERN_ERR "Turning uartclk failed!\n");
-		goto err_msm_hs_init_clk;
-	}
-
-	/* Set auto RFR Level */
-	data = msm_hs_read(uport, UARTDM_MR1_ADDR);
-	data &= ~UARTDM_MR1_AUTO_RFR_LEVEL1_BMSK;
-	data &= ~UARTDM_MR1_AUTO_RFR_LEVEL0_BMSK;
-	data |= (UARTDM_MR1_AUTO_RFR_LEVEL1_BMSK & (rfr_level << 2));
-	data |= (UARTDM_MR1_AUTO_RFR_LEVEL0_BMSK & rfr_level);
-	msm_hs_write(uport, UARTDM_MR1_ADDR, data);
-
-	/* Make sure RXSTALE count is non-zero */
-	data = msm_hs_read(uport, UARTDM_IPR_ADDR);
-	if (!data) {
-		data |= 0x1f & UARTDM_IPR_STALE_LSB_BMSK;
-		msm_hs_write(uport, UARTDM_IPR_ADDR, data);
-	}
-
-	/* Enable Data Mover Mode */
-	data = UARTDM_TX_DM_EN_BMSK | UARTDM_RX_DM_EN_BMSK;
-	msm_hs_write(uport, UARTDM_DMEN_ADDR, data);
-
-	/* Reset TX */
-	msm_hs_write(uport, UARTDM_CR_ADDR, RESET_TX);
-	msm_hs_write(uport, UARTDM_CR_ADDR, RESET_RX);
-	msm_hs_write(uport, UARTDM_CR_ADDR, RESET_ERROR_STATUS);
-	msm_hs_write(uport, UARTDM_CR_ADDR, RESET_BREAK_INT);
-	msm_hs_write(uport, UARTDM_CR_ADDR, RESET_STALE_INT);
-	msm_hs_write(uport, UARTDM_CR_ADDR, RESET_CTS);
-	msm_hs_write(uport, UARTDM_CR_ADDR, RFR_LOW);
-	/* Turn on Uart Receiver */
-	msm_hs_write(uport, UARTDM_CR_ADDR, UARTDM_CR_RX_EN_BMSK);
-
-	/* Turn on Uart Transmitter */
-	msm_hs_write(uport, UARTDM_CR_ADDR, UARTDM_CR_TX_EN_BMSK);
-
-	/* Initialize the tx */
-	tx->tx_ready_int_en = 0;
-	tx->dma_in_flight = 0;
-
-	tx->xfer.complete_func = msm_hs_dmov_tx_callback;
-	tx->xfer.execute_func = NULL;
-
-	tx->command_ptr->cmd = CMD_LC |
-	    CMD_DST_CRCI(msm_uport->dma_tx_crci) | CMD_MODE_BOX;
-
-	tx->command_ptr->src_dst_len = (MSM_UARTDM_BURST_SIZE << 16)
-					   | (MSM_UARTDM_BURST_SIZE);
-
-	tx->command_ptr->row_offset = (MSM_UARTDM_BURST_SIZE << 16);
-
-	tx->command_ptr->dst_row_addr =
-	    msm_uport->uport.mapbase + UARTDM_TF_ADDR;
-
-
-	/* Turn on Uart Receive */
-	rx->xfer.complete_func = msm_hs_dmov_rx_callback;
-	rx->xfer.execute_func = NULL;
-
-	rx->command_ptr->cmd = CMD_LC |
-	    CMD_SRC_CRCI(msm_uport->dma_rx_crci) | CMD_MODE_BOX;
-
-	rx->command_ptr->src_dst_len = (MSM_UARTDM_BURST_SIZE << 16)
-					   | (MSM_UARTDM_BURST_SIZE);
-	rx->command_ptr->row_offset =  MSM_UARTDM_BURST_SIZE;
-	rx->command_ptr->src_row_addr = uport->mapbase + UARTDM_RF_ADDR;
-
-
-	msm_uport->imr_reg |= UARTDM_ISR_RXSTALE_BMSK;
-	/* Enable reading the current CTS, no harm even if CTS is ignored */
-	msm_uport->imr_reg |= UARTDM_ISR_CURRENT_CTS_BMSK;
-
-	msm_hs_write(uport, UARTDM_TFWR_ADDR, 0);  /* TXLEV on empty TX fifo */
-
-
-	ret = request_irq(uport->irq, msm_hs_isr, IRQF_TRIGGER_HIGH,
-			  "msm_hs_uart", msm_uport);
-	if (unlikely(ret)) {
-		printk(KERN_ERR "Request msm_hs_uart IRQ failed!\n");
-		goto err_request_irq;
-	}
-	if (use_low_power_rx_wakeup(msm_uport)) {
-		ret = request_irq(msm_uport->rx_wakeup.irq,
-				  msm_hs_rx_wakeup_isr,
-				  IRQF_TRIGGER_FALLING,
-				  "msm_hs_rx_wakeup", msm_uport);
-		if (unlikely(ret)) {
-			printk(KERN_ERR "Request msm_hs_rx_wakeup IRQ failed!\n");
-			free_irq(uport->irq, msm_uport);
-			goto err_request_irq;
-		}
-		disable_irq(msm_uport->rx_wakeup.irq);
-	}
-
-	spin_lock_irqsave(&uport->lock, flags);
-
-	msm_hs_write(uport, UARTDM_RFWR_ADDR, 0);
-	msm_hs_start_rx_locked(uport);
-
-	spin_unlock_irqrestore(&uport->lock, flags);
-	ret = pm_runtime_set_active(uport->dev);
-	if (ret)
-		dev_err(uport->dev, "set active error:%d\n", ret);
-	pm_runtime_enable(uport->dev);
-
-	return 0;
-
-err_request_irq:
-err_msm_hs_init_clk:
-	dma_unmap_single(uport->dev, tx->dma_base,
-				UART_XMIT_SIZE, DMA_TO_DEVICE);
-	return ret;
-}
-
-/* Initialize tx and rx data structures */
-static int uartdm_init_port(struct uart_port *uport)
-{
-	int ret = 0;
-	struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
-	struct msm_hs_tx *tx = &msm_uport->tx;
-	struct msm_hs_rx *rx = &msm_uport->rx;
-
-	/* Allocate the command pointer. Needs to be 64 bit aligned */
-	tx->command_ptr = kmalloc(sizeof(dmov_box), GFP_KERNEL | __GFP_DMA);
-	if (!tx->command_ptr)
-		return -ENOMEM;
-
-	tx->command_ptr_ptr = kmalloc(sizeof(u32), GFP_KERNEL | __GFP_DMA);
-	if (!tx->command_ptr_ptr) {
-		ret = -ENOMEM;
-		goto err_tx_command_ptr_ptr;
-	}
-
-	tx->mapped_cmd_ptr = dma_map_single(uport->dev, tx->command_ptr,
-					    sizeof(dmov_box), DMA_TO_DEVICE);
-	tx->mapped_cmd_ptr_ptr = dma_map_single(uport->dev,
-						tx->command_ptr_ptr,
-						sizeof(u32), DMA_TO_DEVICE);
-	tx->xfer.cmdptr = DMOV_CMD_ADDR(tx->mapped_cmd_ptr_ptr);
-
-	init_waitqueue_head(&rx->wait);
-
-	rx->pool = dma_pool_create("rx_buffer_pool", uport->dev,
-				   UARTDM_RX_BUF_SIZE, 16, 0);
-	if (!rx->pool) {
-		pr_err("%s(): cannot allocate rx_buffer_pool", __func__);
-		ret = -ENOMEM;
-		goto err_dma_pool_create;
-	}
-
-	rx->buffer = dma_pool_alloc(rx->pool, GFP_KERNEL, &rx->rbuffer);
-	if (!rx->buffer) {
-		pr_err("%s(): cannot allocate rx->buffer", __func__);
-		ret = -ENOMEM;
-		goto err_dma_pool_alloc;
-	}
-
-	/* Allocate the command pointer. Needs to be 64 bit aligned */
-	rx->command_ptr = kmalloc(sizeof(dmov_box), GFP_KERNEL | __GFP_DMA);
-	if (!rx->command_ptr) {
-		pr_err("%s(): cannot allocate rx->command_ptr", __func__);
-		ret = -ENOMEM;
-		goto err_rx_command_ptr;
-	}
-
-	rx->command_ptr_ptr = kmalloc(sizeof(u32), GFP_KERNEL | __GFP_DMA);
-	if (!rx->command_ptr_ptr) {
-		pr_err("%s(): cannot allocate rx->command_ptr_ptr", __func__);
-		ret = -ENOMEM;
-		goto err_rx_command_ptr_ptr;
-	}
-
-	rx->command_ptr->num_rows = ((UARTDM_RX_BUF_SIZE >> 4) << 16) |
-					 (UARTDM_RX_BUF_SIZE >> 4);
-
-	rx->command_ptr->dst_row_addr = rx->rbuffer;
-
-	rx->mapped_cmd_ptr = dma_map_single(uport->dev, rx->command_ptr,
-					    sizeof(dmov_box), DMA_TO_DEVICE);
-
-	*rx->command_ptr_ptr = CMD_PTR_LP | DMOV_CMD_ADDR(rx->mapped_cmd_ptr);
-
-	rx->cmdptr_dmaaddr = dma_map_single(uport->dev, rx->command_ptr_ptr,
-					    sizeof(u32), DMA_TO_DEVICE);
-	rx->xfer.cmdptr = DMOV_CMD_ADDR(rx->cmdptr_dmaaddr);
-
-	INIT_WORK(&rx->tty_work, msm_hs_tty_flip_buffer_work);
-
-	return ret;
-
-err_rx_command_ptr_ptr:
-	kfree(rx->command_ptr);
-err_rx_command_ptr:
-	dma_pool_free(msm_uport->rx.pool, msm_uport->rx.buffer,
-						msm_uport->rx.rbuffer);
-err_dma_pool_alloc:
-	dma_pool_destroy(msm_uport->rx.pool);
-err_dma_pool_create:
-	dma_unmap_single(uport->dev, msm_uport->tx.mapped_cmd_ptr_ptr,
-				sizeof(u32), DMA_TO_DEVICE);
-	dma_unmap_single(uport->dev, msm_uport->tx.mapped_cmd_ptr,
-				sizeof(dmov_box), DMA_TO_DEVICE);
-	kfree(msm_uport->tx.command_ptr_ptr);
-err_tx_command_ptr_ptr:
-	kfree(msm_uport->tx.command_ptr);
-	return ret;
-}
-
-static int msm_hs_probe(struct platform_device *pdev)
-{
-	int ret;
-	struct uart_port *uport;
-	struct msm_hs_port *msm_uport;
-	struct resource *resource;
-	const struct msm_serial_hs_platform_data *pdata =
-						dev_get_platdata(&pdev->dev);
-
-	if (pdev->id < 0 || pdev->id >= UARTDM_NR) {
-		printk(KERN_ERR "Invalid plaform device ID = %d\n", pdev->id);
-		return -EINVAL;
-	}
-
-	msm_uport = &q_uart_port[pdev->id];
-	uport = &msm_uport->uport;
-
-	uport->dev = &pdev->dev;
-
-	resource = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (unlikely(!resource))
-		return -ENXIO;
-
-	uport->mapbase = resource->start;
-	uport->irq = platform_get_irq(pdev, 0);
-	if (unlikely(uport->irq < 0))
-		return -ENXIO;
-
-	if (unlikely(irq_set_irq_wake(uport->irq, 1)))
-		return -ENXIO;
-
-	if (pdata == NULL || pdata->rx_wakeup_irq < 0)
-		msm_uport->rx_wakeup.irq = -1;
-	else {
-		msm_uport->rx_wakeup.irq = pdata->rx_wakeup_irq;
-		msm_uport->rx_wakeup.ignore = 1;
-		msm_uport->rx_wakeup.inject_rx = pdata->inject_rx_on_wakeup;
-		msm_uport->rx_wakeup.rx_to_inject = pdata->rx_to_inject;
-
-		if (unlikely(msm_uport->rx_wakeup.irq < 0))
-			return -ENXIO;
-
-		if (unlikely(irq_set_irq_wake(msm_uport->rx_wakeup.irq, 1)))
-			return -ENXIO;
-	}
-
-	if (pdata == NULL)
-		msm_uport->exit_lpm_cb = NULL;
-	else
-		msm_uport->exit_lpm_cb = pdata->exit_lpm_cb;
-
-	resource = platform_get_resource_byname(pdev, IORESOURCE_DMA,
-						"uartdm_channels");
-	if (unlikely(!resource))
-		return -ENXIO;
-
-	msm_uport->dma_tx_channel = resource->start;
-	msm_uport->dma_rx_channel = resource->end;
-
-	resource = platform_get_resource_byname(pdev, IORESOURCE_DMA,
-						"uartdm_crci");
-	if (unlikely(!resource))
-		return -ENXIO;
-
-	msm_uport->dma_tx_crci = resource->start;
-	msm_uport->dma_rx_crci = resource->end;
-
-	uport->iotype = UPIO_MEM;
-	uport->fifosize = UART_FIFOSIZE;
-	uport->ops = &msm_hs_ops;
-	uport->flags = UPF_BOOT_AUTOCONF;
-	uport->uartclk = UARTCLK;
-	msm_uport->imr_reg = 0x0;
-	msm_uport->clk = clk_get(&pdev->dev, "uartdm_clk");
-	if (IS_ERR(msm_uport->clk))
-		return PTR_ERR(msm_uport->clk);
-
-	ret = uartdm_init_port(uport);
-	if (unlikely(ret))
-		return ret;
-
-	msm_uport->clk_state = MSM_HS_CLK_PORT_OFF;
-	hrtimer_init(&msm_uport->clk_off_timer, CLOCK_MONOTONIC,
-		     HRTIMER_MODE_REL);
-	msm_uport->clk_off_timer.function = msm_hs_clk_off_retry;
-	msm_uport->clk_off_delay = ktime_set(0, 1000000);  /* 1ms */
-
-	uport->line = pdev->id;
-	return uart_add_one_port(&msm_hs_driver, uport);
-}
-
-static int __init msm_serial_hs_init(void)
-{
-	int ret, i;
-
-	/* Init all UARTS as non-configured */
-	for (i = 0; i < UARTDM_NR; i++)
-		q_uart_port[i].uport.type = PORT_UNKNOWN;
-
-	msm_hs_workqueue = create_singlethread_workqueue("msm_serial_hs");
-	if (unlikely(!msm_hs_workqueue))
-		return -ENOMEM;
-
-	ret = uart_register_driver(&msm_hs_driver);
-	if (unlikely(ret)) {
-		printk(KERN_ERR "%s failed to load\n", __func__);
-		goto err_uart_register_driver;
-	}
-
-	ret = platform_driver_register(&msm_serial_hs_platform_driver);
-	if (ret) {
-		printk(KERN_ERR "%s failed to load\n", __func__);
-		goto err_platform_driver_register;
-	}
-
-	return ret;
-
-err_platform_driver_register:
-	uart_unregister_driver(&msm_hs_driver);
-err_uart_register_driver:
-	destroy_workqueue(msm_hs_workqueue);
-	return ret;
-}
-module_init(msm_serial_hs_init);
-
-/*
- *  Called by the upper layer when port is closed.
- *     - Disables the port
- *     - Unhook the ISR
- */
-static void msm_hs_shutdown(struct uart_port *uport)
-{
-	unsigned long flags;
-	struct msm_hs_port *msm_uport = UARTDM_TO_MSM(uport);
-
-	BUG_ON(msm_uport->rx.flush < FLUSH_STOP);
-
-	spin_lock_irqsave(&uport->lock, flags);
-	clk_enable(msm_uport->clk);
-
-	/* Disable the transmitter */
-	msm_hs_write(uport, UARTDM_CR_ADDR, UARTDM_CR_TX_DISABLE_BMSK);
-	/* Disable the receiver */
-	msm_hs_write(uport, UARTDM_CR_ADDR, UARTDM_CR_RX_DISABLE_BMSK);
-
-	pm_runtime_disable(uport->dev);
-	pm_runtime_set_suspended(uport->dev);
-
-	/* Free the interrupt */
-	free_irq(uport->irq, msm_uport);
-	if (use_low_power_rx_wakeup(msm_uport))
-		free_irq(msm_uport->rx_wakeup.irq, msm_uport);
-
-	msm_uport->imr_reg = 0;
-	msm_hs_write(uport, UARTDM_IMR_ADDR, msm_uport->imr_reg);
-
-	wait_event(msm_uport->rx.wait, msm_uport->rx.flush == FLUSH_SHUTDOWN);
-
-	clk_disable(msm_uport->clk);  /* to balance local clk_enable() */
-	if (msm_uport->clk_state != MSM_HS_CLK_OFF)
-		clk_disable(msm_uport->clk);  /* to balance clk_state */
-	msm_uport->clk_state = MSM_HS_CLK_PORT_OFF;
-
-	dma_unmap_single(uport->dev, msm_uport->tx.dma_base,
-			 UART_XMIT_SIZE, DMA_TO_DEVICE);
-
-	spin_unlock_irqrestore(&uport->lock, flags);
-
-	if (cancel_work_sync(&msm_uport->rx.tty_work))
-		msm_hs_tty_flip_buffer_work(&msm_uport->rx.tty_work);
-}
-
-static void __exit msm_serial_hs_exit(void)
-{
-	flush_workqueue(msm_hs_workqueue);
-	destroy_workqueue(msm_hs_workqueue);
-	platform_driver_unregister(&msm_serial_hs_platform_driver);
-	uart_unregister_driver(&msm_hs_driver);
-}
-module_exit(msm_serial_hs_exit);
-
-#ifdef CONFIG_PM
-static int msm_hs_runtime_idle(struct device *dev)
-{
-	/*
-	 * returning success from idle results in runtime suspend to be
-	 * called
-	 */
-	return 0;
-}
-
-static int msm_hs_runtime_resume(struct device *dev)
-{
-	struct platform_device *pdev = container_of(dev, struct
-						    platform_device, dev);
-	struct msm_hs_port *msm_uport = &q_uart_port[pdev->id];
-
-	msm_hs_request_clock_on(&msm_uport->uport);
-	return 0;
-}
-
-static int msm_hs_runtime_suspend(struct device *dev)
-{
-	struct platform_device *pdev = container_of(dev, struct
-						    platform_device, dev);
-	struct msm_hs_port *msm_uport = &q_uart_port[pdev->id];
-
-	msm_hs_request_clock_off(&msm_uport->uport);
-	return 0;
-}
-#else
-#define msm_hs_runtime_idle NULL
-#define msm_hs_runtime_resume NULL
-#define msm_hs_runtime_suspend NULL
-#endif
-
-static const struct dev_pm_ops msm_hs_dev_pm_ops = {
-	.runtime_suspend = msm_hs_runtime_suspend,
-	.runtime_resume  = msm_hs_runtime_resume,
-	.runtime_idle    = msm_hs_runtime_idle,
-};
-
-static struct platform_driver msm_serial_hs_platform_driver = {
-	.probe = msm_hs_probe,
-	.remove = msm_hs_remove,
-	.driver = {
-		.name = "msm_serial_hs",
-		.pm   = &msm_hs_dev_pm_ops,
-	},
-};
-
-static struct uart_driver msm_hs_driver = {
-	.owner = THIS_MODULE,
-	.driver_name = "msm_serial_hs",
-	.dev_name = "ttyHS",
-	.nr = UARTDM_NR,
-	.cons = 0,
-};
-
-static struct uart_ops msm_hs_ops = {
-	.tx_empty = msm_hs_tx_empty,
-	.set_mctrl = msm_hs_set_mctrl_locked,
-	.get_mctrl = msm_hs_get_mctrl_locked,
-	.stop_tx = msm_hs_stop_tx_locked,
-	.start_tx = msm_hs_start_tx_locked,
-	.stop_rx = msm_hs_stop_rx_locked,
-	.enable_ms = msm_hs_enable_ms_locked,
-	.break_ctl = msm_hs_break_ctl,
-	.startup = msm_hs_startup,
-	.shutdown = msm_hs_shutdown,
-	.set_termios = msm_hs_set_termios,
-	.pm = msm_hs_pm,
-	.type = msm_hs_type,
-	.config_port = msm_hs_config_port,
-	.release_port = msm_hs_release_port,
-	.request_port = msm_hs_request_port,
-};
-
-MODULE_DESCRIPTION("High Speed UART Driver for the MSM chipset");
-MODULE_VERSION("1.2");
-MODULE_LICENSE("GPL v2");
diff --git a/include/linux/platform_data/msm_serial_hs.h b/include/linux/platform_data/msm_serial_hs.h
deleted file mode 100644
index 98a2046f8b31..000000000000
--- a/include/linux/platform_data/msm_serial_hs.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2008 Google, Inc.
- * Author: Nick Pelly <npelly@google.com>
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef __ASM_ARCH_MSM_SERIAL_HS_H
-#define __ASM_ARCH_MSM_SERIAL_HS_H
-
-#include <linux/serial_core.h>
-
-/* API to request the uart clock off or on for low power management
- * Clients should call request_clock_off() when no uart data is expected,
- * and must call request_clock_on() before any further uart data can be
- * received. */
-extern void msm_hs_request_clock_off(struct uart_port *uport);
-extern void msm_hs_request_clock_on(struct uart_port *uport);
-
-/**
- * struct msm_serial_hs_platform_data
- * @rx_wakeup_irq: Rx activity irq
- * @rx_to_inject: extra character to be inserted to Rx tty on wakeup
- * @inject_rx: 1 = insert rx_to_inject. 0 = do not insert extra character
- * @exit_lpm_cb: function called before every Tx transaction
- *
- * This is an optional structure required for UART Rx GPIO IRQ based
- * wakeup from low power state. UART wakeup can be triggered by RX activity
- * (using a wakeup GPIO on the UART RX pin). This should only be used if
- * there is not a wakeup GPIO on the UART CTS, and the first RX byte is
- * known (eg., with the Bluetooth Texas Instruments HCILL protocol),
- * since the first RX byte will always be lost. RTS will be asserted even
- * while the UART is clocked off in this mode of operation.
- */
-struct msm_serial_hs_platform_data {
-	int rx_wakeup_irq;
-	unsigned char inject_rx_on_wakeup;
-	char rx_to_inject;
-	void (*exit_lpm_cb)(struct uart_port *);
-};
-
-#endif
-- 
2.1.0.rc2

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RFC PATCH 02/18] mmc: msm: move data mover into mmc driver
  2015-03-04 19:32 [RFC PATCH 00/18] ARM: msm multiplatform support Arnd Bergmann
  2015-03-04 19:32 ` [RFC PATCH 01/18] serial: remove obsolete msm_serial_hs driver Arnd Bergmann
@ 2015-03-04 19:32 ` Arnd Bergmann
  2015-03-13 13:14   ` Ulf Hansson
  2015-03-04 19:32 ` [RFC PATCH 03/18] mmc: msm: pass dmov resources via device Arnd Bergmann
                   ` (19 subsequent siblings)
  21 siblings, 1 reply; 36+ messages in thread
From: Arnd Bergmann @ 2015-03-04 19:32 UTC (permalink / raw)
  To: linux-arm-kernel

The msm_sdcc driver is the only user of the proprietary msm
data mover interface. In order to simplify the multiplatform
conversion, this patch moves the entire data mover code into
the mmc driver.

If against our expectations any other drivers should be added
in the future that use the same data mover, the best approach
would be to convert this code into a dmaengine driver and use
the generic interfaces for that.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-msm/Makefile           |   6 +-
 arch/arm/mach-msm/board-msm7x30.c    |   1 -
 arch/arm/mach-msm/devices-msm7x30.c  |   1 -
 arch/arm/mach-msm/devices-qsd8x50.c  |   1 -
 arch/arm/mach-msm/dma.c              | 298 -----------------------------
 arch/arm/mach-msm/include/mach/dma.h | 151 ---------------
 drivers/mmc/host/msm_sdcc.c          | 360 ++++++++++++++++++++++++++++++++++-
 7 files changed, 362 insertions(+), 456 deletions(-)
 delete mode 100644 arch/arm/mach-msm/dma.c
 delete mode 100644 arch/arm/mach-msm/include/mach/dma.h

diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile
index 27c078a568df..2fb46dc0ead8 100644
--- a/arch/arm/mach-msm/Makefile
+++ b/arch/arm/mach-msm/Makefile
@@ -7,9 +7,9 @@ obj-$(CONFIG_ARCH_QSD8X50) += sirc.o
 
 obj-$(CONFIG_MSM_PROC_COMM) += proc_comm.o clock-pcom.o vreg.o
 
-obj-$(CONFIG_ARCH_MSM7X00A) += dma.o io.o
-obj-$(CONFIG_ARCH_MSM7X30) += dma.o io.o
-obj-$(CONFIG_ARCH_QSD8X50) += dma.o io.o
+obj-$(CONFIG_ARCH_MSM7X00A) += io.o
+obj-$(CONFIG_ARCH_MSM7X30) += io.o
+obj-$(CONFIG_ARCH_QSD8X50) += io.o
 
 obj-$(CONFIG_MSM_SMD) += smd.o smd_debug.o
 obj-$(CONFIG_MSM_SMD) += last_radio_log.o
diff --git a/arch/arm/mach-msm/board-msm7x30.c b/arch/arm/mach-msm/board-msm7x30.c
index 8f5ecdc4f3ce..44a5bdbf0ee7 100644
--- a/arch/arm/mach-msm/board-msm7x30.c
+++ b/arch/arm/mach-msm/board-msm7x30.c
@@ -32,7 +32,6 @@
 
 #include <mach/clk.h>
 #include <mach/msm_iomap.h>
-#include <mach/dma.h>
 
 #include <mach/vreg.h>
 #include "devices.h"
diff --git a/arch/arm/mach-msm/devices-msm7x30.c b/arch/arm/mach-msm/devices-msm7x30.c
index c15ea8ab20a7..5a0705b55321 100644
--- a/arch/arm/mach-msm/devices-msm7x30.c
+++ b/arch/arm/mach-msm/devices-msm7x30.c
@@ -20,7 +20,6 @@
 #include <linux/clkdev.h>
 #include <mach/irqs.h>
 #include <mach/msm_iomap.h>
-#include <mach/dma.h>
 
 #include "devices.h"
 #include "smd_private.h"
diff --git a/arch/arm/mach-msm/devices-qsd8x50.c b/arch/arm/mach-msm/devices-qsd8x50.c
index 9e1e9ce07b1a..dfc884521fc1 100644
--- a/arch/arm/mach-msm/devices-qsd8x50.c
+++ b/arch/arm/mach-msm/devices-qsd8x50.c
@@ -20,7 +20,6 @@
 
 #include <mach/irqs.h>
 #include <mach/msm_iomap.h>
-#include <mach/dma.h>
 
 #include "devices.h"
 #include "common.h"
diff --git a/arch/arm/mach-msm/dma.c b/arch/arm/mach-msm/dma.c
deleted file mode 100644
index fb9762464718..000000000000
--- a/arch/arm/mach-msm/dma.c
+++ /dev/null
@@ -1,298 +0,0 @@
-/* linux/arch/arm/mach-msm/dma.c
- *
- * Copyright (C) 2007 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/clk.h>
-#include <linux/err.h>
-#include <linux/io.h>
-#include <linux/interrupt.h>
-#include <linux/completion.h>
-#include <linux/module.h>
-#include <mach/dma.h>
-#include <mach/msm_iomap.h>
-
-#define MSM_DMOV_CHANNEL_COUNT 16
-
-#define DMOV_SD0(off, ch) (MSM_DMOV_BASE + 0x0000 + (off) + ((ch) << 2))
-#define DMOV_SD1(off, ch) (MSM_DMOV_BASE + 0x0400 + (off) + ((ch) << 2))
-#define DMOV_SD2(off, ch) (MSM_DMOV_BASE + 0x0800 + (off) + ((ch) << 2))
-#define DMOV_SD3(off, ch) (MSM_DMOV_BASE + 0x0C00 + (off) + ((ch) << 2))
-
-#if defined(CONFIG_ARCH_MSM7X30)
-#define DMOV_SD_AARM DMOV_SD2
-#else
-#define DMOV_SD_AARM DMOV_SD3
-#endif
-
-#define DMOV_CMD_PTR(ch)      DMOV_SD_AARM(0x000, ch)
-#define DMOV_RSLT(ch)         DMOV_SD_AARM(0x040, ch)
-#define DMOV_FLUSH0(ch)       DMOV_SD_AARM(0x080, ch)
-#define DMOV_FLUSH1(ch)       DMOV_SD_AARM(0x0C0, ch)
-#define DMOV_FLUSH2(ch)       DMOV_SD_AARM(0x100, ch)
-#define DMOV_FLUSH3(ch)       DMOV_SD_AARM(0x140, ch)
-#define DMOV_FLUSH4(ch)       DMOV_SD_AARM(0x180, ch)
-#define DMOV_FLUSH5(ch)       DMOV_SD_AARM(0x1C0, ch)
-
-#define DMOV_STATUS(ch)       DMOV_SD_AARM(0x200, ch)
-#define DMOV_ISR              DMOV_SD_AARM(0x380, 0)
-
-#define DMOV_CONFIG(ch)       DMOV_SD_AARM(0x300, ch)
-
-enum {
-	MSM_DMOV_PRINT_ERRORS = 1,
-	MSM_DMOV_PRINT_IO = 2,
-	MSM_DMOV_PRINT_FLOW = 4
-};
-
-static DEFINE_SPINLOCK(msm_dmov_lock);
-static struct clk *msm_dmov_clk;
-static unsigned int channel_active;
-static struct list_head ready_commands[MSM_DMOV_CHANNEL_COUNT];
-static struct list_head active_commands[MSM_DMOV_CHANNEL_COUNT];
-unsigned int msm_dmov_print_mask = MSM_DMOV_PRINT_ERRORS;
-
-#define MSM_DMOV_DPRINTF(mask, format, args...) \
-	do { \
-		if ((mask) & msm_dmov_print_mask) \
-			printk(KERN_ERR format, args); \
-	} while (0)
-#define PRINT_ERROR(format, args...) \
-	MSM_DMOV_DPRINTF(MSM_DMOV_PRINT_ERRORS, format, args);
-#define PRINT_IO(format, args...) \
-	MSM_DMOV_DPRINTF(MSM_DMOV_PRINT_IO, format, args);
-#define PRINT_FLOW(format, args...) \
-	MSM_DMOV_DPRINTF(MSM_DMOV_PRINT_FLOW, format, args);
-
-void msm_dmov_stop_cmd(unsigned id, struct msm_dmov_cmd *cmd, int graceful)
-{
-	writel((graceful << 31), DMOV_FLUSH0(id));
-}
-EXPORT_SYMBOL_GPL(msm_dmov_stop_cmd);
-
-void msm_dmov_enqueue_cmd(unsigned id, struct msm_dmov_cmd *cmd)
-{
-	unsigned long irq_flags;
-	unsigned int status;
-
-	spin_lock_irqsave(&msm_dmov_lock, irq_flags);
-	if (!channel_active)
-		clk_enable(msm_dmov_clk);
-	dsb();
-	status = readl(DMOV_STATUS(id));
-	if (list_empty(&ready_commands[id]) &&
-		(status & DMOV_STATUS_CMD_PTR_RDY)) {
-#if 0
-		if (list_empty(&active_commands[id])) {
-			PRINT_FLOW("msm_dmov_enqueue_cmd(%d), enable interrupt\n", id);
-			writel(DMOV_CONFIG_IRQ_EN, DMOV_CONFIG(id));
-		}
-#endif
-		if (cmd->execute_func)
-			cmd->execute_func(cmd);
-		PRINT_IO("msm_dmov_enqueue_cmd(%d), start command, status %x\n", id, status);
-		list_add_tail(&cmd->list, &active_commands[id]);
-		if (!channel_active)
-			enable_irq(INT_ADM_AARM);
-		channel_active |= 1U << id;
-		writel(cmd->cmdptr, DMOV_CMD_PTR(id));
-	} else {
-		if (!channel_active)
-			clk_disable(msm_dmov_clk);
-		if (list_empty(&active_commands[id]))
-			PRINT_ERROR("msm_dmov_enqueue_cmd(%d), error datamover stalled, status %x\n", id, status);
-
-		PRINT_IO("msm_dmov_enqueue_cmd(%d), enqueue command, status %x\n", id, status);
-		list_add_tail(&cmd->list, &ready_commands[id]);
-	}
-	spin_unlock_irqrestore(&msm_dmov_lock, irq_flags);
-}
-EXPORT_SYMBOL_GPL(msm_dmov_enqueue_cmd);
-
-struct msm_dmov_exec_cmdptr_cmd {
-	struct msm_dmov_cmd dmov_cmd;
-	struct completion complete;
-	unsigned id;
-	unsigned int result;
-	struct msm_dmov_errdata err;
-};
-
-static void
-dmov_exec_cmdptr_complete_func(struct msm_dmov_cmd *_cmd,
-			       unsigned int result,
-			       struct msm_dmov_errdata *err)
-{
-	struct msm_dmov_exec_cmdptr_cmd *cmd = container_of(_cmd, struct msm_dmov_exec_cmdptr_cmd, dmov_cmd);
-	cmd->result = result;
-	if (result != 0x80000002 && err)
-		memcpy(&cmd->err, err, sizeof(struct msm_dmov_errdata));
-
-	complete(&cmd->complete);
-}
-
-int msm_dmov_exec_cmd(unsigned id, unsigned int cmdptr)
-{
-	struct msm_dmov_exec_cmdptr_cmd cmd;
-
-	PRINT_FLOW("dmov_exec_cmdptr(%d, %x)\n", id, cmdptr);
-
-	cmd.dmov_cmd.cmdptr = cmdptr;
-	cmd.dmov_cmd.complete_func = dmov_exec_cmdptr_complete_func;
-	cmd.dmov_cmd.execute_func = NULL;
-	cmd.id = id;
-	init_completion(&cmd.complete);
-
-	msm_dmov_enqueue_cmd(id, &cmd.dmov_cmd);
-	wait_for_completion(&cmd.complete);
-
-	if (cmd.result != 0x80000002) {
-		PRINT_ERROR("dmov_exec_cmdptr(%d): ERROR, result: %x\n", id, cmd.result);
-		PRINT_ERROR("dmov_exec_cmdptr(%d):  flush: %x %x %x %x\n",
-			id, cmd.err.flush[0], cmd.err.flush[1], cmd.err.flush[2], cmd.err.flush[3]);
-		return -EIO;
-	}
-	PRINT_FLOW("dmov_exec_cmdptr(%d, %x) done\n", id, cmdptr);
-	return 0;
-}
-
-
-static irqreturn_t msm_datamover_irq_handler(int irq, void *dev_id)
-{
-	unsigned int int_status, mask, id;
-	unsigned long irq_flags;
-	unsigned int ch_status;
-	unsigned int ch_result;
-	struct msm_dmov_cmd *cmd;
-
-	spin_lock_irqsave(&msm_dmov_lock, irq_flags);
-
-	int_status = readl(DMOV_ISR); /* read and clear interrupt */
-	PRINT_FLOW("msm_datamover_irq_handler: DMOV_ISR %x\n", int_status);
-
-	while (int_status) {
-		mask = int_status & -int_status;
-		id = fls(mask) - 1;
-		PRINT_FLOW("msm_datamover_irq_handler %08x %08x id %d\n", int_status, mask, id);
-		int_status &= ~mask;
-		ch_status = readl(DMOV_STATUS(id));
-		if (!(ch_status & DMOV_STATUS_RSLT_VALID)) {
-			PRINT_FLOW("msm_datamover_irq_handler id %d, result not valid %x\n", id, ch_status);
-			continue;
-		}
-		do {
-			ch_result = readl(DMOV_RSLT(id));
-			if (list_empty(&active_commands[id])) {
-				PRINT_ERROR("msm_datamover_irq_handler id %d, got result "
-					"with no active command, status %x, result %x\n",
-					id, ch_status, ch_result);
-				cmd = NULL;
-			} else
-				cmd = list_entry(active_commands[id].next, typeof(*cmd), list);
-			PRINT_FLOW("msm_datamover_irq_handler id %d, status %x, result %x\n", id, ch_status, ch_result);
-			if (ch_result & DMOV_RSLT_DONE) {
-				PRINT_FLOW("msm_datamover_irq_handler id %d, status %x\n",
-					id, ch_status);
-				PRINT_IO("msm_datamover_irq_handler id %d, got result "
-					"for %p, result %x\n", id, cmd, ch_result);
-				if (cmd) {
-					list_del(&cmd->list);
-					dsb();
-					cmd->complete_func(cmd, ch_result, NULL);
-				}
-			}
-			if (ch_result & DMOV_RSLT_FLUSH) {
-				struct msm_dmov_errdata errdata;
-
-				errdata.flush[0] = readl(DMOV_FLUSH0(id));
-				errdata.flush[1] = readl(DMOV_FLUSH1(id));
-				errdata.flush[2] = readl(DMOV_FLUSH2(id));
-				errdata.flush[3] = readl(DMOV_FLUSH3(id));
-				errdata.flush[4] = readl(DMOV_FLUSH4(id));
-				errdata.flush[5] = readl(DMOV_FLUSH5(id));
-				PRINT_FLOW("msm_datamover_irq_handler id %d, status %x\n", id, ch_status);
-				PRINT_FLOW("msm_datamover_irq_handler id %d, flush, result %x, flush0 %x\n", id, ch_result, errdata.flush[0]);
-				if (cmd) {
-					list_del(&cmd->list);
-					dsb();
-					cmd->complete_func(cmd, ch_result, &errdata);
-				}
-			}
-			if (ch_result & DMOV_RSLT_ERROR) {
-				struct msm_dmov_errdata errdata;
-
-				errdata.flush[0] = readl(DMOV_FLUSH0(id));
-				errdata.flush[1] = readl(DMOV_FLUSH1(id));
-				errdata.flush[2] = readl(DMOV_FLUSH2(id));
-				errdata.flush[3] = readl(DMOV_FLUSH3(id));
-				errdata.flush[4] = readl(DMOV_FLUSH4(id));
-				errdata.flush[5] = readl(DMOV_FLUSH5(id));
-
-				PRINT_ERROR("msm_datamover_irq_handler id %d, status %x\n", id, ch_status);
-				PRINT_ERROR("msm_datamover_irq_handler id %d, error, result %x, flush0 %x\n", id, ch_result, errdata.flush[0]);
-				if (cmd) {
-					list_del(&cmd->list);
-					dsb();
-					cmd->complete_func(cmd, ch_result, &errdata);
-				}
-				/* this does not seem to work, once we get an error */
-				/* the datamover will no longer accept commands */
-				writel(0, DMOV_FLUSH0(id));
-			}
-			ch_status = readl(DMOV_STATUS(id));
-			PRINT_FLOW("msm_datamover_irq_handler id %d, status %x\n", id, ch_status);
-			if ((ch_status & DMOV_STATUS_CMD_PTR_RDY) && !list_empty(&ready_commands[id])) {
-				cmd = list_entry(ready_commands[id].next, typeof(*cmd), list);
-				list_move_tail(&cmd->list, &active_commands[id]);
-				if (cmd->execute_func)
-					cmd->execute_func(cmd);
-				PRINT_FLOW("msm_datamover_irq_handler id %d, start command\n", id);
-				writel(cmd->cmdptr, DMOV_CMD_PTR(id));
-			}
-		} while (ch_status & DMOV_STATUS_RSLT_VALID);
-		if (list_empty(&active_commands[id]) && list_empty(&ready_commands[id]))
-			channel_active &= ~(1U << id);
-		PRINT_FLOW("msm_datamover_irq_handler id %d, status %x\n", id, ch_status);
-	}
-
-	if (!channel_active) {
-		disable_irq_nosync(INT_ADM_AARM);
-		clk_disable(msm_dmov_clk);
-	}
-
-	spin_unlock_irqrestore(&msm_dmov_lock, irq_flags);
-	return IRQ_HANDLED;
-}
-
-static int __init msm_init_datamover(void)
-{
-	int i;
-	int ret;
-	struct clk *clk;
-
-	for (i = 0; i < MSM_DMOV_CHANNEL_COUNT; i++) {
-		INIT_LIST_HEAD(&ready_commands[i]);
-		INIT_LIST_HEAD(&active_commands[i]);
-		writel(DMOV_CONFIG_IRQ_EN | DMOV_CONFIG_FORCE_TOP_PTR_RSLT | DMOV_CONFIG_FORCE_FLUSH_RSLT, DMOV_CONFIG(i));
-	}
-	clk = clk_get(NULL, "adm_clk");
-	if (IS_ERR(clk))
-		return PTR_ERR(clk);
-	clk_prepare(clk);
-	msm_dmov_clk = clk;
-	ret = request_irq(INT_ADM_AARM, msm_datamover_irq_handler, 0, "msmdatamover", NULL);
-	if (ret)
-		return ret;
-	disable_irq(INT_ADM_AARM);
-	return 0;
-}
-module_init(msm_init_datamover);
diff --git a/arch/arm/mach-msm/include/mach/dma.h b/arch/arm/mach-msm/include/mach/dma.h
deleted file mode 100644
index a72d48d42342..000000000000
--- a/arch/arm/mach-msm/include/mach/dma.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/* linux/include/asm-arm/arch-msm/dma.h
- *
- * Copyright (C) 2007 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef __ASM_ARCH_MSM_DMA_H
-
-#include <linux/list.h>
-
-struct msm_dmov_errdata {
-	uint32_t flush[6];
-};
-
-struct msm_dmov_cmd {
-	struct list_head list;
-	unsigned int cmdptr;
-	void (*complete_func)(struct msm_dmov_cmd *cmd,
-			      unsigned int result,
-			      struct msm_dmov_errdata *err);
-	void (*execute_func)(struct msm_dmov_cmd *cmd);
-	void *data;
-};
-
-#ifndef CONFIG_ARCH_MSM8X60
-void msm_dmov_enqueue_cmd(unsigned id, struct msm_dmov_cmd *cmd);
-void msm_dmov_stop_cmd(unsigned id, struct msm_dmov_cmd *cmd, int graceful);
-int msm_dmov_exec_cmd(unsigned id, unsigned int cmdptr);
-#else
-static inline
-void msm_dmov_enqueue_cmd(unsigned id, struct msm_dmov_cmd *cmd) { }
-static inline
-void msm_dmov_stop_cmd(unsigned id, struct msm_dmov_cmd *cmd, int graceful) { }
-static inline
-int msm_dmov_exec_cmd(unsigned id, unsigned int cmdptr) { return -EIO; }
-#endif
-
-#define DMOV_CMD_LIST         (0 << 29) /* does not work */
-#define DMOV_CMD_PTR_LIST     (1 << 29) /* works */
-#define DMOV_CMD_INPUT_CFG    (2 << 29) /* untested */
-#define DMOV_CMD_OUTPUT_CFG   (3 << 29) /* untested */
-#define DMOV_CMD_ADDR(addr)   ((addr) >> 3)
-
-#define DMOV_RSLT_VALID       (1 << 31) /* 0 == host has empties result fifo */
-#define DMOV_RSLT_ERROR       (1 << 3)
-#define DMOV_RSLT_FLUSH       (1 << 2)
-#define DMOV_RSLT_DONE        (1 << 1)  /* top pointer done */
-#define DMOV_RSLT_USER        (1 << 0)  /* command with FR force result */
-
-#define DMOV_STATUS_RSLT_COUNT(n)    (((n) >> 29))
-#define DMOV_STATUS_CMD_COUNT(n)     (((n) >> 27) & 3)
-#define DMOV_STATUS_RSLT_VALID       (1 << 1)
-#define DMOV_STATUS_CMD_PTR_RDY      (1 << 0)
-
-#define DMOV_CONFIG_FORCE_TOP_PTR_RSLT (1 << 2)
-#define DMOV_CONFIG_FORCE_FLUSH_RSLT   (1 << 1)
-#define DMOV_CONFIG_IRQ_EN             (1 << 0)
-
-/* channel assignments */
-
-#define DMOV_NAND_CHAN        7
-#define DMOV_NAND_CRCI_CMD    5
-#define DMOV_NAND_CRCI_DATA   4
-
-#define DMOV_SDC1_CHAN        8
-#define DMOV_SDC1_CRCI        6
-
-#define DMOV_SDC2_CHAN        8
-#define DMOV_SDC2_CRCI        7
-
-#define DMOV_TSIF_CHAN        10
-#define DMOV_TSIF_CRCI        10
-
-#define DMOV_USB_CHAN         11
-
-/* no client rate control ifc (eg, ram) */
-#define DMOV_NONE_CRCI        0
-
-
-/* If the CMD_PTR register has CMD_PTR_LIST selected, the data mover
- * is going to walk a list of 32bit pointers as described below.  Each
- * pointer points to a *array* of dmov_s, etc structs.  The last pointer
- * in the list is marked with CMD_PTR_LP.  The last struct in each array
- * is marked with CMD_LC (see below).
- */
-#define CMD_PTR_ADDR(addr)  ((addr) >> 3)
-#define CMD_PTR_LP          (1 << 31) /* last pointer */
-#define CMD_PTR_PT          (3 << 29) /* ? */
-
-/* Single Item Mode */
-typedef struct {
-	unsigned cmd;
-	unsigned src;
-	unsigned dst;
-	unsigned len;
-} dmov_s;
-
-/* Scatter/Gather Mode */
-typedef struct {
-	unsigned cmd;
-	unsigned src_dscr;
-	unsigned dst_dscr;
-	unsigned _reserved;
-} dmov_sg;
-
-/* Box mode */
-typedef struct {
-	uint32_t cmd;
-	uint32_t src_row_addr;
-	uint32_t dst_row_addr;
-	uint32_t src_dst_len;
-	uint32_t num_rows;
-	uint32_t row_offset;
-} dmov_box;
-
-/* bits for the cmd field of the above structures */
-
-#define CMD_LC      (1 << 31)  /* last command */
-#define CMD_FR      (1 << 22)  /* force result -- does not work? */
-#define CMD_OCU     (1 << 21)  /* other channel unblock */
-#define CMD_OCB     (1 << 20)  /* other channel block */
-#define CMD_TCB     (1 << 19)  /* ? */
-#define CMD_DAH     (1 << 18)  /* destination address hold -- does not work?*/
-#define CMD_SAH     (1 << 17)  /* source address hold -- does not work? */
-
-#define CMD_MODE_SINGLE     (0 << 0) /* dmov_s structure used */
-#define CMD_MODE_SG         (1 << 0) /* untested */
-#define CMD_MODE_IND_SG     (2 << 0) /* untested */
-#define CMD_MODE_BOX        (3 << 0) /* untested */
-
-#define CMD_DST_SWAP_BYTES  (1 << 14) /* exchange each byte n with byte n+1 */
-#define CMD_DST_SWAP_SHORTS (1 << 15) /* exchange each short n with short n+1 */
-#define CMD_DST_SWAP_WORDS  (1 << 16) /* exchange each word n with word n+1 */
-
-#define CMD_SRC_SWAP_BYTES  (1 << 11) /* exchange each byte n with byte n+1 */
-#define CMD_SRC_SWAP_SHORTS (1 << 12) /* exchange each short n with short n+1 */
-#define CMD_SRC_SWAP_WORDS  (1 << 13) /* exchange each word n with word n+1 */
-
-#define CMD_DST_CRCI(n)     (((n) & 15) << 7)
-#define CMD_SRC_CRCI(n)     (((n) & 15) << 3)
-
-#endif
diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c
index 90c60fd4ff6e..83dc4e5d9963 100644
--- a/drivers/mmc/host/msm_sdcc.c
+++ b/drivers/mmc/host/msm_sdcc.c
@@ -15,6 +15,7 @@
  *
  */
 
+#include <linux/completion.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/init.h>
@@ -24,6 +25,7 @@
 #include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/highmem.h>
+#include <linux/list.h>
 #include <linux/log2.h>
 #include <linux/mmc/host.h>
 #include <linux/mmc/card.h>
@@ -43,9 +45,365 @@
 #include <asm/sizes.h>
 
 #include <linux/platform_data/mmc-msm_sdcc.h>
-#include <mach/dma.h>
+#include <mach/msm_iomap.h>
 #include <mach/clk.h>
 
+/* data mover definitions */
+
+struct msm_dmov_errdata {
+	uint32_t flush[6];
+};
+
+struct msm_dmov_cmd {
+	struct list_head list;
+	unsigned int cmdptr;
+	void (*complete_func)(struct msm_dmov_cmd *cmd,
+			      unsigned int result,
+			      struct msm_dmov_errdata *err);
+	void (*execute_func)(struct msm_dmov_cmd *cmd);
+	void *data;
+};
+
+#define DMOV_CMD_LIST         (0 << 29) /* does not work */
+#define DMOV_CMD_PTR_LIST     (1 << 29) /* works */
+#define DMOV_CMD_INPUT_CFG    (2 << 29) /* untested */
+#define DMOV_CMD_OUTPUT_CFG   (3 << 29) /* untested */
+#define DMOV_CMD_ADDR(addr)   ((addr) >> 3)
+
+#define DMOV_RSLT_VALID       (1 << 31) /* 0 == host has empties result fifo */
+#define DMOV_RSLT_ERROR       (1 << 3)
+#define DMOV_RSLT_FLUSH       (1 << 2)
+#define DMOV_RSLT_DONE        (1 << 1)  /* top pointer done */
+#define DMOV_RSLT_USER        (1 << 0)  /* command with FR force result */
+
+#define DMOV_STATUS_RSLT_COUNT(n)    (((n) >> 29))
+#define DMOV_STATUS_CMD_COUNT(n)     (((n) >> 27) & 3)
+#define DMOV_STATUS_RSLT_VALID       (1 << 1)
+#define DMOV_STATUS_CMD_PTR_RDY      (1 << 0)
+
+#define DMOV_CONFIG_FORCE_TOP_PTR_RSLT (1 << 2)
+#define DMOV_CONFIG_FORCE_FLUSH_RSLT   (1 << 1)
+#define DMOV_CONFIG_IRQ_EN             (1 << 0)
+
+/* channel assignments */
+
+#define DMOV_NAND_CHAN        7
+#define DMOV_NAND_CRCI_CMD    5
+#define DMOV_NAND_CRCI_DATA   4
+
+#define DMOV_SDC1_CHAN        8
+#define DMOV_SDC1_CRCI        6
+
+#define DMOV_SDC2_CHAN        8
+#define DMOV_SDC2_CRCI        7
+
+#define DMOV_TSIF_CHAN        10
+#define DMOV_TSIF_CRCI        10
+
+#define DMOV_USB_CHAN         11
+
+/* no client rate control ifc (eg, ram) */
+#define DMOV_NONE_CRCI        0
+
+
+/* If the CMD_PTR register has CMD_PTR_LIST selected, the data mover
+ * is going to walk a list of 32bit pointers as described below.  Each
+ * pointer points to a *array* of dmov_s, etc structs.  The last pointer
+ * in the list is marked with CMD_PTR_LP.  The last struct in each array
+ * is marked with CMD_LC (see below).
+ */
+#define CMD_PTR_ADDR(addr)  ((addr) >> 3)
+#define CMD_PTR_LP          (1 << 31) /* last pointer */
+#define CMD_PTR_PT          (3 << 29) /* ? */
+
+/* Single Item Mode */
+typedef struct {
+	unsigned cmd;
+	unsigned src;
+	unsigned dst;
+	unsigned len;
+} dmov_s;
+
+/* Scatter/Gather Mode */
+typedef struct {
+	unsigned cmd;
+	unsigned src_dscr;
+	unsigned dst_dscr;
+	unsigned _reserved;
+} dmov_sg;
+
+/* Box mode */
+typedef struct {
+	uint32_t cmd;
+	uint32_t src_row_addr;
+	uint32_t dst_row_addr;
+	uint32_t src_dst_len;
+	uint32_t num_rows;
+	uint32_t row_offset;
+} dmov_box;
+
+/* bits for the cmd field of the above structures */
+
+#define CMD_LC      (1 << 31)  /* last command */
+#define CMD_FR      (1 << 22)  /* force result -- does not work? */
+#define CMD_OCU     (1 << 21)  /* other channel unblock */
+#define CMD_OCB     (1 << 20)  /* other channel block */
+#define CMD_TCB     (1 << 19)  /* ? */
+#define CMD_DAH     (1 << 18)  /* destination address hold -- does not work?*/
+#define CMD_SAH     (1 << 17)  /* source address hold -- does not work? */
+
+#define CMD_MODE_SINGLE     (0 << 0) /* dmov_s structure used */
+#define CMD_MODE_SG         (1 << 0) /* untested */
+#define CMD_MODE_IND_SG     (2 << 0) /* untested */
+#define CMD_MODE_BOX        (3 << 0) /* untested */
+
+#define CMD_DST_SWAP_BYTES  (1 << 14) /* exchange each byte n with byte n+1 */
+#define CMD_DST_SWAP_SHORTS (1 << 15) /* exchange each short n with short n+1 */
+#define CMD_DST_SWAP_WORDS  (1 << 16) /* exchange each word n with word n+1 */
+
+#define CMD_SRC_SWAP_BYTES  (1 << 11) /* exchange each byte n with byte n+1 */
+#define CMD_SRC_SWAP_SHORTS (1 << 12) /* exchange each short n with short n+1 */
+#define CMD_SRC_SWAP_WORDS  (1 << 13) /* exchange each word n with word n+1 */
+
+#define CMD_DST_CRCI(n)     (((n) & 15) << 7)
+#define CMD_SRC_CRCI(n)     (((n) & 15) << 3)
+
+#define MSM_DMOV_CHANNEL_COUNT 16
+
+#define DMOV_SD0(off, ch) (MSM_DMOV_BASE + 0x0000 + (off) + ((ch) << 2))
+#define DMOV_SD1(off, ch) (MSM_DMOV_BASE + 0x0400 + (off) + ((ch) << 2))
+#define DMOV_SD2(off, ch) (MSM_DMOV_BASE + 0x0800 + (off) + ((ch) << 2))
+#define DMOV_SD3(off, ch) (MSM_DMOV_BASE + 0x0C00 + (off) + ((ch) << 2))
+
+#if defined(CONFIG_ARCH_MSM7X30)
+#define DMOV_SD_AARM DMOV_SD2
+#else
+#define DMOV_SD_AARM DMOV_SD3
+#endif
+
+#define DMOV_CMD_PTR(ch)      DMOV_SD_AARM(0x000, ch)
+#define DMOV_RSLT(ch)         DMOV_SD_AARM(0x040, ch)
+#define DMOV_FLUSH0(ch)       DMOV_SD_AARM(0x080, ch)
+#define DMOV_FLUSH1(ch)       DMOV_SD_AARM(0x0C0, ch)
+#define DMOV_FLUSH2(ch)       DMOV_SD_AARM(0x100, ch)
+#define DMOV_FLUSH3(ch)       DMOV_SD_AARM(0x140, ch)
+#define DMOV_FLUSH4(ch)       DMOV_SD_AARM(0x180, ch)
+#define DMOV_FLUSH5(ch)       DMOV_SD_AARM(0x1C0, ch)
+
+#define DMOV_STATUS(ch)       DMOV_SD_AARM(0x200, ch)
+#define DMOV_ISR              DMOV_SD_AARM(0x380, 0)
+
+#define DMOV_CONFIG(ch)       DMOV_SD_AARM(0x300, ch)
+
+enum {
+	MSM_DMOV_PRINT_ERRORS = 1,
+	MSM_DMOV_PRINT_IO = 2,
+	MSM_DMOV_PRINT_FLOW = 4
+};
+
+static DEFINE_SPINLOCK(msm_dmov_lock);
+static struct clk *msm_dmov_clk;
+static unsigned int channel_active;
+static struct list_head ready_commands[MSM_DMOV_CHANNEL_COUNT];
+static struct list_head active_commands[MSM_DMOV_CHANNEL_COUNT];
+static const unsigned int msm_dmov_print_mask = MSM_DMOV_PRINT_ERRORS;
+
+#define MSM_DMOV_DPRINTF(mask, format, args...) \
+	do { \
+		if ((mask) & msm_dmov_print_mask) \
+			printk(KERN_ERR format, args); \
+	} while (0)
+#define PRINT_ERROR(format, args...) \
+	MSM_DMOV_DPRINTF(MSM_DMOV_PRINT_ERRORS, format, args);
+#define PRINT_IO(format, args...) \
+	MSM_DMOV_DPRINTF(MSM_DMOV_PRINT_IO, format, args);
+#define PRINT_FLOW(format, args...) \
+	MSM_DMOV_DPRINTF(MSM_DMOV_PRINT_FLOW, format, args);
+
+static void msm_dmov_stop_cmd(unsigned id, struct msm_dmov_cmd *cmd, int graceful)
+{
+	writel((graceful << 31), DMOV_FLUSH0(id));
+}
+
+static void msm_dmov_enqueue_cmd(unsigned id, struct msm_dmov_cmd *cmd)
+{
+	unsigned long irq_flags;
+	unsigned int status;
+
+	spin_lock_irqsave(&msm_dmov_lock, irq_flags);
+	if (!channel_active)
+		clk_enable(msm_dmov_clk);
+	dsb();
+	status = readl(DMOV_STATUS(id));
+	if (list_empty(&ready_commands[id]) &&
+		(status & DMOV_STATUS_CMD_PTR_RDY)) {
+#if 0
+		if (list_empty(&active_commands[id])) {
+			PRINT_FLOW("msm_dmov_enqueue_cmd(%d), enable interrupt\n", id);
+			writel(DMOV_CONFIG_IRQ_EN, DMOV_CONFIG(id));
+		}
+#endif
+		if (cmd->execute_func)
+			cmd->execute_func(cmd);
+		PRINT_IO("msm_dmov_enqueue_cmd(%d), start command, status %x\n", id, status);
+		list_add_tail(&cmd->list, &active_commands[id]);
+		if (!channel_active)
+			enable_irq(INT_ADM_AARM);
+		channel_active |= 1U << id;
+		writel(cmd->cmdptr, DMOV_CMD_PTR(id));
+	} else {
+		if (!channel_active)
+			clk_disable(msm_dmov_clk);
+		if (list_empty(&active_commands[id]))
+			PRINT_ERROR("msm_dmov_enqueue_cmd(%d), error datamover stalled, status %x\n", id, status);
+
+		PRINT_IO("msm_dmov_enqueue_cmd(%d), enqueue command, status %x\n", id, status);
+		list_add_tail(&cmd->list, &ready_commands[id]);
+	}
+	spin_unlock_irqrestore(&msm_dmov_lock, irq_flags);
+}
+
+struct msm_dmov_exec_cmdptr_cmd {
+	struct msm_dmov_cmd dmov_cmd;
+	struct completion complete;
+	unsigned id;
+	unsigned int result;
+	struct msm_dmov_errdata err;
+};
+
+static irqreturn_t msm_datamover_irq_handler(int irq, void *dev_id)
+{
+	unsigned int int_status, mask, id;
+	unsigned long irq_flags;
+	unsigned int ch_status;
+	unsigned int ch_result;
+	struct msm_dmov_cmd *cmd;
+
+	spin_lock_irqsave(&msm_dmov_lock, irq_flags);
+
+	int_status = readl(DMOV_ISR); /* read and clear interrupt */
+	PRINT_FLOW("msm_datamover_irq_handler: DMOV_ISR %x\n", int_status);
+
+	while (int_status) {
+		mask = int_status & -int_status;
+		id = fls(mask) - 1;
+		PRINT_FLOW("msm_datamover_irq_handler %08x %08x id %d\n", int_status, mask, id);
+		int_status &= ~mask;
+		ch_status = readl(DMOV_STATUS(id));
+		if (!(ch_status & DMOV_STATUS_RSLT_VALID)) {
+			PRINT_FLOW("msm_datamover_irq_handler id %d, result not valid %x\n", id, ch_status);
+			continue;
+		}
+		do {
+			ch_result = readl(DMOV_RSLT(id));
+			if (list_empty(&active_commands[id])) {
+				PRINT_ERROR("msm_datamover_irq_handler id %d, got result "
+					"with no active command, status %x, result %x\n",
+					id, ch_status, ch_result);
+				cmd = NULL;
+			} else
+				cmd = list_entry(active_commands[id].next, typeof(*cmd), list);
+			PRINT_FLOW("msm_datamover_irq_handler id %d, status %x, result %x\n", id, ch_status, ch_result);
+			if (ch_result & DMOV_RSLT_DONE) {
+				PRINT_FLOW("msm_datamover_irq_handler id %d, status %x\n",
+					id, ch_status);
+				PRINT_IO("msm_datamover_irq_handler id %d, got result "
+					"for %p, result %x\n", id, cmd, ch_result);
+				if (cmd) {
+					list_del(&cmd->list);
+					dsb();
+					cmd->complete_func(cmd, ch_result, NULL);
+				}
+			}
+			if (ch_result & DMOV_RSLT_FLUSH) {
+				struct msm_dmov_errdata errdata;
+
+				errdata.flush[0] = readl(DMOV_FLUSH0(id));
+				errdata.flush[1] = readl(DMOV_FLUSH1(id));
+				errdata.flush[2] = readl(DMOV_FLUSH2(id));
+				errdata.flush[3] = readl(DMOV_FLUSH3(id));
+				errdata.flush[4] = readl(DMOV_FLUSH4(id));
+				errdata.flush[5] = readl(DMOV_FLUSH5(id));
+				PRINT_FLOW("msm_datamover_irq_handler id %d, status %x\n", id, ch_status);
+				PRINT_FLOW("msm_datamover_irq_handler id %d, flush, result %x, flush0 %x\n", id, ch_result, errdata.flush[0]);
+				if (cmd) {
+					list_del(&cmd->list);
+					dsb();
+					cmd->complete_func(cmd, ch_result, &errdata);
+				}
+			}
+			if (ch_result & DMOV_RSLT_ERROR) {
+				struct msm_dmov_errdata errdata;
+
+				errdata.flush[0] = readl(DMOV_FLUSH0(id));
+				errdata.flush[1] = readl(DMOV_FLUSH1(id));
+				errdata.flush[2] = readl(DMOV_FLUSH2(id));
+				errdata.flush[3] = readl(DMOV_FLUSH3(id));
+				errdata.flush[4] = readl(DMOV_FLUSH4(id));
+				errdata.flush[5] = readl(DMOV_FLUSH5(id));
+
+				PRINT_ERROR("msm_datamover_irq_handler id %d, status %x\n", id, ch_status);
+				PRINT_ERROR("msm_datamover_irq_handler id %d, error, result %x, flush0 %x\n", id, ch_result, errdata.flush[0]);
+				if (cmd) {
+					list_del(&cmd->list);
+					dsb();
+					cmd->complete_func(cmd, ch_result, &errdata);
+				}
+				/* this does not seem to work, once we get an error */
+				/* the datamover will no longer accept commands */
+				writel(0, DMOV_FLUSH0(id));
+			}
+			ch_status = readl(DMOV_STATUS(id));
+			PRINT_FLOW("msm_datamover_irq_handler id %d, status %x\n", id, ch_status);
+			if ((ch_status & DMOV_STATUS_CMD_PTR_RDY) && !list_empty(&ready_commands[id])) {
+				cmd = list_entry(ready_commands[id].next, typeof(*cmd), list);
+				list_move_tail(&cmd->list, &active_commands[id]);
+				if (cmd->execute_func)
+					cmd->execute_func(cmd);
+				PRINT_FLOW("msm_datamover_irq_handler id %d, start command\n", id);
+				writel(cmd->cmdptr, DMOV_CMD_PTR(id));
+			}
+		} while (ch_status & DMOV_STATUS_RSLT_VALID);
+		if (list_empty(&active_commands[id]) && list_empty(&ready_commands[id]))
+			channel_active &= ~(1U << id);
+		PRINT_FLOW("msm_datamover_irq_handler id %d, status %x\n", id, ch_status);
+	}
+
+	if (!channel_active) {
+		disable_irq_nosync(INT_ADM_AARM);
+		clk_disable(msm_dmov_clk);
+	}
+
+	spin_unlock_irqrestore(&msm_dmov_lock, irq_flags);
+	return IRQ_HANDLED;
+}
+
+static int __init msm_init_datamover(void)
+{
+	int i;
+	int ret;
+	struct clk *clk;
+
+	for (i = 0; i < MSM_DMOV_CHANNEL_COUNT; i++) {
+		INIT_LIST_HEAD(&ready_commands[i]);
+		INIT_LIST_HEAD(&active_commands[i]);
+		writel(DMOV_CONFIG_IRQ_EN | DMOV_CONFIG_FORCE_TOP_PTR_RSLT | DMOV_CONFIG_FORCE_FLUSH_RSLT, DMOV_CONFIG(i));
+	}
+	clk = clk_get(NULL, "adm_clk");
+	if (IS_ERR(clk))
+		return PTR_ERR(clk);
+	clk_prepare(clk);
+	msm_dmov_clk = clk;
+	ret = request_irq(INT_ADM_AARM, msm_datamover_irq_handler, 0, "msmdatamover", NULL);
+	if (ret)
+		return ret;
+	disable_irq(INT_ADM_AARM);
+	return 0;
+}
+module_init(msm_init_datamover);
+
+/* now the actual SD card driver */
+
 #include "msm_sdcc.h"
 
 #define DRIVER_NAME "msm-sdcc"
-- 
2.1.0.rc2

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RFC PATCH 03/18] mmc: msm: pass dmov resources via device
  2015-03-04 19:32 [RFC PATCH 00/18] ARM: msm multiplatform support Arnd Bergmann
  2015-03-04 19:32 ` [RFC PATCH 01/18] serial: remove obsolete msm_serial_hs driver Arnd Bergmann
  2015-03-04 19:32 ` [RFC PATCH 02/18] mmc: msm: move data mover into mmc driver Arnd Bergmann
@ 2015-03-04 19:32 ` Arnd Bergmann
  2015-03-13 13:15   ` Ulf Hansson
  2015-03-04 19:32 ` [RFC PATCH 04/18] mmc: msm: move clk-reset logic to platform Arnd Bergmann
                   ` (18 subsequent siblings)
  21 siblings, 1 reply; 36+ messages in thread
From: Arnd Bergmann @ 2015-03-04 19:32 UTC (permalink / raw)
  To: linux-arm-kernel

The data mover code that got moved here from arch/arm was not
using the device model at all. This tries to retrofit it
passing the irq and mmio address using resources.

The approach is a little half-baked, but it still seems better
than the original code. One problem now is that the resources
are not getting cleaned up properly. Instead of doing something
that I can't test myself, I just disable module unloading to
avoid having to rewrite more than necessary.

It's unclear whether this works with multiple sdcc devices.
What I know is that no platform in the kernel registers more
than one at the moment, and I suspect that trying to use more
than one was already broken. If it was working previously,
it most likely keeps working, and it's unlikely that we will
see new users of this driver that require more than one
device.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-msm/devices-msm7x00.c | 44 +++++++++++++++++++++++++++++++++++
 arch/arm/mach-msm/devices-qsd8x50.c | 44 +++++++++++++++++++++++++++++++++++
 drivers/mmc/host/msm_sdcc.c         | 46 ++++++++++++++++++++++---------------
 3 files changed, 115 insertions(+), 19 deletions(-)

diff --git a/arch/arm/mach-msm/devices-msm7x00.c b/arch/arm/mach-msm/devices-msm7x00.c
index d83404d4b328..aa3feeb96414 100644
--- a/arch/arm/mach-msm/devices-msm7x00.c
+++ b/arch/arm/mach-msm/devices-msm7x00.c
@@ -211,6 +211,17 @@ static struct resource resources_sdc1[] = {
 		.name	= "status_irq"
 	},
 	{
+		.start	= INT_ADM_AARM,
+		.end	= INT_ADM_AARM,
+		.flags	= IORESOURCE_IRQ,
+		.name	= "dmov_irq",
+	},
+	{
+		.start	= MSM_DMOV_PHYS + (3 * 0x400),
+		.end	= MSM_DMOV_PHYS + (4 * 0x400) - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
 		.start	= 8,
 		.end	= 8,
 		.flags	= IORESOURCE_DMA,
@@ -234,6 +245,17 @@ static struct resource resources_sdc2[] = {
 		.name	= "status_irq"
 	},
 	{
+		.start	= INT_ADM_AARM,
+		.end	= INT_ADM_AARM,
+		.flags	= IORESOURCE_IRQ,
+		.name	= "dmov_irq",
+	},
+	{
+		.start	= MSM_DMOV_PHYS + (3 * 0x400),
+		.end	= MSM_DMOV_PHYS + (4 * 0x400) - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
 		.start	= 8,
 		.end	= 8,
 		.flags	= IORESOURCE_DMA,
@@ -257,6 +279,17 @@ static struct resource resources_sdc3[] = {
 		.name	= "status_irq"
 	},
 	{
+		.start	= INT_ADM_AARM,
+		.end	= INT_ADM_AARM,
+		.flags	= IORESOURCE_IRQ,
+		.name	= "dmov_irq",
+	},
+	{
+		.start	= MSM_DMOV_PHYS + (3 * 0x400),
+		.end	= MSM_DMOV_PHYS + (4 * 0x400) - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
 		.start	= 8,
 		.end	= 8,
 		.flags	= IORESOURCE_DMA,
@@ -280,6 +313,17 @@ static struct resource resources_sdc4[] = {
 		.name	= "status_irq"
 	},
 	{
+		.start	= INT_ADM_AARM,
+		.end	= INT_ADM_AARM,
+		.flags	= IORESOURCE_IRQ,
+		.name	= "dmov_irq",
+	},
+	{
+		.start	= MSM_DMOV_PHYS + (3 * 0x400),
+		.end	= MSM_DMOV_PHYS + (4 * 0x400) - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
 		.start	= 8,
 		.end	= 8,
 		.flags	= IORESOURCE_DMA,
diff --git a/arch/arm/mach-msm/devices-qsd8x50.c b/arch/arm/mach-msm/devices-qsd8x50.c
index dfc884521fc1..6db025cef825 100644
--- a/arch/arm/mach-msm/devices-qsd8x50.c
+++ b/arch/arm/mach-msm/devices-qsd8x50.c
@@ -175,6 +175,17 @@ static struct resource resources_sdc1[] = {
 		.name	= "status_irq"
 	},
 	{
+		.start	= INT_ADM_AARM,
+		.end	= INT_ADM_AARM,
+		.flags	= IORESOURCE_IRQ,
+		.name	= "dmov_irq",
+	},
+	{
+		.start	= MSM_DMOV_PHYS + (3 * 0x400),
+		.end	= MSM_DMOV_PHYS + (4 * 0x400) - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
 		.start	= 8,
 		.end	= 8,
 		.flags	= IORESOURCE_DMA,
@@ -198,6 +209,17 @@ static struct resource resources_sdc2[] = {
 		.name	= "status_irq"
 	},
 	{
+		.start	= INT_ADM_AARM,
+		.end	= INT_ADM_AARM,
+		.flags	= IORESOURCE_IRQ,
+		.name	= "dmov_irq",
+	},
+	{
+		.start	= MSM_DMOV_PHYS + (3 * 0x400),
+		.end	= MSM_DMOV_PHYS + (4 * 0x400) - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
 		.start	= 8,
 		.end	= 8,
 		.flags	= IORESOURCE_DMA,
@@ -221,6 +243,17 @@ static struct resource resources_sdc3[] = {
 		.name	= "status_irq"
 	},
 	{
+		.start	= INT_ADM_AARM,
+		.end	= INT_ADM_AARM,
+		.flags	= IORESOURCE_IRQ,
+		.name	= "dmov_irq",
+	},
+	{
+		.start	= MSM_DMOV_PHYS + (3 * 0x400),
+		.end	= MSM_DMOV_PHYS + (4 * 0x400) - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
 		.start	= 8,
 		.end	= 8,
 		.flags	= IORESOURCE_DMA,
@@ -244,6 +277,17 @@ static struct resource resources_sdc4[] = {
 		.name	= "status_irq"
 	},
 	{
+		.start	= INT_ADM_AARM,
+		.end	= INT_ADM_AARM,
+		.flags	= IORESOURCE_IRQ,
+		.name	= "dmov_irq",
+	},
+	{
+		.start	= MSM_DMOV_PHYS + (3 * 0x400),
+		.end	= MSM_DMOV_PHYS + (4 * 0x400) - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
 		.start	= 8,
 		.end	= 8,
 		.flags	= IORESOURCE_DMA,
diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c
index 83dc4e5d9963..3002e377e9f7 100644
--- a/drivers/mmc/host/msm_sdcc.c
+++ b/drivers/mmc/host/msm_sdcc.c
@@ -45,7 +45,6 @@
 #include <asm/sizes.h>
 
 #include <linux/platform_data/mmc-msm_sdcc.h>
-#include <mach/msm_iomap.h>
 #include <mach/clk.h>
 
 /* data mover definitions */
@@ -170,16 +169,7 @@ typedef struct {
 
 #define MSM_DMOV_CHANNEL_COUNT 16
 
-#define DMOV_SD0(off, ch) (MSM_DMOV_BASE + 0x0000 + (off) + ((ch) << 2))
-#define DMOV_SD1(off, ch) (MSM_DMOV_BASE + 0x0400 + (off) + ((ch) << 2))
-#define DMOV_SD2(off, ch) (MSM_DMOV_BASE + 0x0800 + (off) + ((ch) << 2))
-#define DMOV_SD3(off, ch) (MSM_DMOV_BASE + 0x0C00 + (off) + ((ch) << 2))
-
-#if defined(CONFIG_ARCH_MSM7X30)
-#define DMOV_SD_AARM DMOV_SD2
-#else
-#define DMOV_SD_AARM DMOV_SD3
-#endif
+#define DMOV_SD_AARM(off, ch) (msm_dmov_base + (off) + ((ch) << 2))
 
 #define DMOV_CMD_PTR(ch)      DMOV_SD_AARM(0x000, ch)
 #define DMOV_RSLT(ch)         DMOV_SD_AARM(0x040, ch)
@@ -203,6 +193,8 @@ enum {
 
 static DEFINE_SPINLOCK(msm_dmov_lock);
 static struct clk *msm_dmov_clk;
+static int msm_dmov_irq;
+static void __iomem *msm_dmov_base;
 static unsigned int channel_active;
 static struct list_head ready_commands[MSM_DMOV_CHANNEL_COUNT];
 static struct list_head active_commands[MSM_DMOV_CHANNEL_COUNT];
@@ -248,7 +240,7 @@ static void msm_dmov_enqueue_cmd(unsigned id, struct msm_dmov_cmd *cmd)
 		PRINT_IO("msm_dmov_enqueue_cmd(%d), start command, status %x\n", id, status);
 		list_add_tail(&cmd->list, &active_commands[id]);
 		if (!channel_active)
-			enable_irq(INT_ADM_AARM);
+			enable_irq(msm_dmov_irq);
 		channel_active |= 1U << id;
 		writel(cmd->cmdptr, DMOV_CMD_PTR(id));
 	} else {
@@ -370,7 +362,7 @@ static irqreturn_t msm_datamover_irq_handler(int irq, void *dev_id)
 	}
 
 	if (!channel_active) {
-		disable_irq_nosync(INT_ADM_AARM);
+		disable_irq_nosync(msm_dmov_irq);
 		clk_disable(msm_dmov_clk);
 	}
 
@@ -378,12 +370,18 @@ static irqreturn_t msm_datamover_irq_handler(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-static int __init msm_init_datamover(void)
+static int msm_init_datamover(int irq, resource_size_t phys)
 {
 	int i;
 	int ret;
 	struct clk *clk;
 
+	if (msm_dmov_irq || msm_dmov_base)
+		return -EBUSY;
+
+	msm_dmov_irq = irq;
+	msm_dmov_base = ioremap(phys, 0x400);
+
 	for (i = 0; i < MSM_DMOV_CHANNEL_COUNT; i++) {
 		INIT_LIST_HEAD(&ready_commands[i]);
 		INIT_LIST_HEAD(&active_commands[i]);
@@ -394,13 +392,12 @@ static int __init msm_init_datamover(void)
 		return PTR_ERR(clk);
 	clk_prepare(clk);
 	msm_dmov_clk = clk;
-	ret = request_irq(INT_ADM_AARM, msm_datamover_irq_handler, 0, "msmdatamover", NULL);
+	ret = request_irq(msm_dmov_irq, msm_datamover_irq_handler, 0, "msmdatamover", NULL);
 	if (ret)
 		return ret;
-	disable_irq(INT_ADM_AARM);
+	disable_irq(msm_dmov_irq);
 	return 0;
 }
-module_init(msm_init_datamover);
 
 /* now the actual SD card driver */
 
@@ -1529,8 +1526,10 @@ msmsdcc_probe(struct platform_device *pdev)
 	struct mmc_host *mmc;
 	struct resource *cmd_irqres = NULL;
 	struct resource *stat_irqres = NULL;
+	struct resource *dmov_irqres = NULL;
 	struct resource *memres = NULL;
 	struct resource *dmares = NULL;
+	struct resource *dmovres = NULL;
 	int ret;
 
 	/* must have platform data */
@@ -1549,17 +1548,22 @@ msmsdcc_probe(struct platform_device *pdev)
 	}
 
 	memres = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	dmovres = platform_get_resource(pdev, IORESOURCE_MEM, 1);
 	dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
 	cmd_irqres = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
 						  "cmd_irq");
 	stat_irqres = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
 						   "status_irq");
+	dmov_irqres = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
+						   "dmov_irq");
 
-	if (!cmd_irqres || !memres) {
+	if (!cmd_irqres || !memres || !dmov_irqres || !dmovres) {
 		pr_err("%s: Invalid resource\n", __func__);
 		return -ENXIO;
 	}
 
+	msm_init_datamover(dmov_irqres->start, dmovres->start);
+
 	/*
 	 * Setup our host structure
 	 */
@@ -1826,7 +1830,11 @@ static struct platform_driver msmsdcc_driver = {
 	},
 };
 
-module_platform_driver(msmsdcc_driver);
+static int __init msmsdcc_init(void)
+{
+	return platform_driver_register(&msmsdcc_driver);
+}
+module_init(msmsdcc_init);
 
 MODULE_DESCRIPTION("Qualcomm MSM 7X00A Multimedia Card Interface driver");
 MODULE_LICENSE("GPL");
-- 
2.1.0.rc2

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RFC PATCH 04/18] mmc: msm: move clk-reset logic to platform
  2015-03-04 19:32 [RFC PATCH 00/18] ARM: msm multiplatform support Arnd Bergmann
                   ` (2 preceding siblings ...)
  2015-03-04 19:32 ` [RFC PATCH 03/18] mmc: msm: pass dmov resources via device Arnd Bergmann
@ 2015-03-04 19:32 ` Arnd Bergmann
  2015-03-13 13:15   ` Ulf Hansson
  2015-03-04 19:32 ` [RFC PATCH 05/18] ARM: msm: fix qsd8x50 rev.a support Arnd Bergmann
                   ` (17 subsequent siblings)
  21 siblings, 1 reply; 36+ messages in thread
From: Arnd Bergmann @ 2015-03-04 19:32 UTC (permalink / raw)
  To: linux-arm-kernel

There is no generic interface for resetting a clock, and
creating a reset driver for msm seems overkill, so this
moves the reset logic from the msm_sdcc driver into
a platform_data callback that calls into the clock driver.

This follows the model that is used for all other devices
on the msm platform that require a clk reset.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-msm/board-qsd8x50.c          | 18 +++++++++++++++++-
 arch/arm/mach-msm/board-trout-mmc.c        | 18 ++++++++++++++++++
 arch/arm/mach-msm/clock.c                  |  2 +-
 drivers/mmc/host/msm_sdcc.c                | 12 ++----------
 include/linux/platform_data/mmc-msm_sdcc.h |  3 +++
 5 files changed, 41 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c
index 4c748616ef47..9676a73683d2 100644
--- a/arch/arm/mach-msm/board-qsd8x50.c
+++ b/arch/arm/mach-msm/board-qsd8x50.c
@@ -180,6 +180,21 @@ static uint32_t msm_sdcc_setup_power(struct device *dv, unsigned int vdd)
 	return 0;
 }
 
+static void msm_sdcc_clk_reset(struct clk *clk)
+{
+	int ret;
+
+	ret = clk_reset(clk, CLK_RESET_ASSERT);
+	if (ret)
+		pr_err("sdcc clock assert failed at %lu Hz with err %d\n",
+			clk_get_rate(clk), ret);
+
+	ret = clk_reset(clk, CLK_RESET_DEASSERT);
+	if (ret)
+	        pr_err("sdcc clock deassert failed at %lu Hz with err %d\n",
+			clk_get_rate(clk), ret);
+}
+
 static struct msm_mmc_gpio_data sdc1_gpio = {
 	.gpio = sdc1_gpio_cfg,
 	.size = ARRAY_SIZE(sdc1_gpio_cfg),
@@ -188,7 +203,8 @@ static struct msm_mmc_gpio_data sdc1_gpio = {
 static struct msm_mmc_platform_data qsd8x50_sdc1_data = {
 	.ocr_mask	= MMC_VDD_27_28 | MMC_VDD_28_29,
 	.translate_vdd	= msm_sdcc_setup_power,
-	.gpio_data = &sdc1_gpio,
+	.gpio_data	= &sdc1_gpio,
+	.clk_reset	= msm_sdcc_clk_reset,
 };
 
 static void __init qsd8x50_init_mmc(void)
diff --git a/arch/arm/mach-msm/board-trout-mmc.c b/arch/arm/mach-msm/board-trout-mmc.c
index 3723e55819d6..2474bba71c8b 100644
--- a/arch/arm/mach-msm/board-trout-mmc.c
+++ b/arch/arm/mach-msm/board-trout-mmc.c
@@ -2,6 +2,7 @@
 ** Author: Brian Swetland <swetland@google.com>
 */
 #include <linux/gpio.h>
+#include <linux/clk.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -14,6 +15,7 @@
 #include <asm/io.h>
 
 #include <mach/vreg.h>
+#include <mach/clk.h>
 
 #include <linux/platform_data/mmc-msm_sdcc.h>
 
@@ -154,6 +156,21 @@ static unsigned int trout_sdslot_status(struct device *dev)
 	return (!status);
 }
 
+static void trout_sdcc_clk_reset(struct clk *clk)
+{
+	int ret;
+
+	ret = clk_reset(clk, CLK_RESET_ASSERT);
+	if (ret)
+		pr_err("sdcc clock assert failed at %lu Hz with err %d\n",
+			clk_get_rate(clk), ret);
+
+	ret = clk_reset(clk, CLK_RESET_DEASSERT);
+	if (ret)
+	        pr_err("sdcc clock deassert failed at %lu Hz with err %d\n",
+			clk_get_rate(clk), ret);
+}
+
 #define TROUT_MMC_VDD	MMC_VDD_165_195 | MMC_VDD_20_21 | MMC_VDD_21_22 \
 			| MMC_VDD_22_23 | MMC_VDD_23_24 | MMC_VDD_24_25 \
 			| MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 \
@@ -163,6 +180,7 @@ static struct msm_mmc_platform_data trout_sdslot_data = {
 	.ocr_mask	= TROUT_MMC_VDD,
 	.status		= trout_sdslot_status,
 	.translate_vdd	= trout_sdslot_switchvdd,
+	.clk_reset	= trout_sdcc_clk_reset,
 };
 
 int __init trout_init_mmc(unsigned int sys_rev)
diff --git a/arch/arm/mach-msm/clock.c b/arch/arm/mach-msm/clock.c
index 35ea02b52483..0b59ad5eb557 100644
--- a/arch/arm/mach-msm/clock.c
+++ b/arch/arm/mach-msm/clock.c
@@ -23,6 +23,6 @@ int clk_reset(struct clk *clk, enum clk_reset_action action)
 {
 	struct clk_hw *hw = __clk_get_hw(clk);
 	struct msm_clk *m = to_msm_clk(hw);
+
 	return m->reset(hw, action);
 }
-EXPORT_SYMBOL(clk_reset);
diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c
index 3002e377e9f7..be5b9b3b3843 100644
--- a/drivers/mmc/host/msm_sdcc.c
+++ b/drivers/mmc/host/msm_sdcc.c
@@ -45,7 +45,6 @@
 #include <asm/sizes.h>
 
 #include <linux/platform_data/mmc-msm_sdcc.h>
-#include <mach/clk.h>
 
 /* data mover definitions */
 
@@ -493,15 +492,8 @@ static void msmsdcc_reset_and_restore(struct msmsdcc_host *host)
 	mci_mask0 = readl(host->base + MMCIMASK0);
 
 	/* Reset the controller */
-	ret = clk_reset(host->clk, CLK_RESET_ASSERT);
-	if (ret)
-		pr_err("%s: Clock assert failed at %u Hz with err %d\n",
-				mmc_hostname(host->mmc), host->clk_rate, ret);
-
-	ret = clk_reset(host->clk, CLK_RESET_DEASSERT);
-	if (ret)
-		pr_err("%s: Clock deassert failed at %u Hz with err %d\n",
-				mmc_hostname(host->mmc), host->clk_rate, ret);
+	if (host->plat->clk_reset)
+		host->plat->clk_reset(host->clk);
 
 	pr_info("%s: Controller has been re-initialiazed\n",
 			mmc_hostname(host->mmc));
diff --git a/include/linux/platform_data/mmc-msm_sdcc.h b/include/linux/platform_data/mmc-msm_sdcc.h
index 55aa873c9396..6f1821a4bf93 100644
--- a/include/linux/platform_data/mmc-msm_sdcc.h
+++ b/include/linux/platform_data/mmc-msm_sdcc.h
@@ -15,6 +15,8 @@ struct msm_mmc_gpio_data {
 	u8 size;
 };
 
+struct clk;
+
 struct msm_mmc_platform_data {
 	unsigned int ocr_mask;			/* available voltages */
 	u32 (*translate_vdd)(struct device *, unsigned int);
@@ -22,6 +24,7 @@ struct msm_mmc_platform_data {
 	int (*register_status_notify)(void (*callback)(int card_present, void *dev_id), void *dev_id);
 	struct msm_mmc_gpio_data *gpio_data;
 	void (*init_card)(struct mmc_card *card);
+	void (*clk_reset)(struct clk *clk);
 };
 
 #endif
-- 
2.1.0.rc2

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RFC PATCH 05/18] ARM: msm: fix qsd8x50 rev.a support
  2015-03-04 19:32 [RFC PATCH 00/18] ARM: msm multiplatform support Arnd Bergmann
                   ` (3 preceding siblings ...)
  2015-03-04 19:32 ` [RFC PATCH 04/18] mmc: msm: move clk-reset logic to platform Arnd Bergmann
@ 2015-03-04 19:32 ` Arnd Bergmann
  2015-03-04 19:33 ` [RFC PATCH 06/18] ARM: msm: fix mach/msm_iomap.h inclusions Arnd Bergmann
                   ` (16 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnd Bergmann @ 2015-03-04 19:32 UTC (permalink / raw)
  To: linux-arm-kernel

The MSM_SMI_BASE variable was accidentally declared inside
of an #ifdef, which makes it depend on a Kconfig symbol,
and incompatible between multiple machines that may
coexist in the kernel.

This fixes the problem by duplicating the qsd8x50_io_desc
for the two revisions.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-msm/board-qsd8x50.c               |  9 ++-------
 arch/arm/mach-msm/common.h                      |  1 +
 arch/arm/mach-msm/include/mach/msm_iomap-8x50.h | 11 ++++-------
 arch/arm/mach-msm/io.c                          | 23 ++++++++++++++++++++++-
 4 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c
index 9676a73683d2..58c7ab45c1d4 100644
--- a/arch/arm/mach-msm/board-qsd8x50.c
+++ b/arch/arm/mach-msm/board-qsd8x50.c
@@ -220,11 +220,6 @@ static void __init qsd8x50_init_mmc(void)
 	msm_add_sdcc(1, &qsd8x50_sdc1_data, 0, 0);
 }
 
-static void __init qsd8x50_map_io(void)
-{
-	msm_map_qsd8x50_io();
-}
-
 static void __init qsd8x50_init_irq(void)
 {
 	msm_init_irq();
@@ -247,7 +242,7 @@ static void __init qsd8x50_init_late(void)
 
 MACHINE_START(QSD8X50_SURF, "QCT QSD8X50 SURF")
 	.atag_offset = 0x100,
-	.map_io = qsd8x50_map_io,
+	.map_io = msm_map_qsd8x50_io,
 	.init_irq = qsd8x50_init_irq,
 	.init_machine = qsd8x50_init,
 	.init_late = qsd8x50_init_late,
@@ -256,7 +251,7 @@ MACHINE_END
 
 MACHINE_START(QSD8X50A_ST1_5, "QCT QSD8X50A ST1.5")
 	.atag_offset = 0x100,
-	.map_io = qsd8x50_map_io,
+	.map_io = msm_map_qsd8x50_io_rev_a,
 	.init_irq = qsd8x50_init_irq,
 	.init_machine = qsd8x50_init,
 	.init_late = qsd8x50_init_late,
diff --git a/arch/arm/mach-msm/common.h b/arch/arm/mach-msm/common.h
index 572479a3c7be..8267f6402325 100644
--- a/arch/arm/mach-msm/common.h
+++ b/arch/arm/mach-msm/common.h
@@ -18,6 +18,7 @@ extern void qsd8x50_timer_init(void);
 
 extern void msm_map_common_io(void);
 extern void msm_map_msm7x30_io(void);
+extern void msm_map_qsd8x50_io_rev_a(void);
 extern void msm_map_qsd8x50_io(void);
 
 extern void __iomem *__msm_ioremap_caller(phys_addr_t phys_addr, size_t size,
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h b/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h
index 0faa894729b7..f9f4a9ccb747 100644
--- a/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h
+++ b/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h
@@ -64,14 +64,11 @@
 #define MSM_SCPLL_PHYS        0xA8800000
 #define MSM_SCPLL_SIZE        SZ_4K
 
-#ifdef CONFIG_MSM_SOC_REV_A
-#define MSM_SMI_BASE 0xE0000000
-#else
-#define MSM_SMI_BASE 0x00000000
-#endif
+#define MSM_SMI_BASE_REV_A 0xE0000000
+#define MSM_SMI_BASE_REV_OTHER 0x00000000
 
-#define MSM_SHARED_RAM_BASE   IOMEM(0xE0100000)
-#define MSM_SHARED_RAM_PHYS (MSM_SMI_BASE + 0x00100000)
+#define MSM_SHARED_RAM_PHYS_REV_A (MSM_SMI_BASE_REV_A + 0x00100000)
+#define MSM_SHARED_RAM_PHYS_REV_OTHER (MSM_SMI_BASE_REV_OTHER + 0x00100000)
 #define MSM_SHARED_RAM_SIZE   SZ_1M
 
 #define MSM_UART1_PHYS        0xA9A00000
diff --git a/arch/arm/mach-msm/io.c b/arch/arm/mach-msm/io.c
index b042dca1f633..ea7dc16fbb13 100644
--- a/arch/arm/mach-msm/io.c
+++ b/arch/arm/mach-msm/io.c
@@ -98,9 +98,12 @@ static struct map_desc qsd8x50_io_desc[] __initdata = {
 	MSM_DEVICE(SCPLL),
 	MSM_DEVICE(AD5),
 	MSM_DEVICE(MDC),
+};
+
+static struct map_desc qsd8x50_io_desc_rev_other[] __initdata = {
 	{
 		.virtual =  (unsigned long) MSM_SHARED_RAM_BASE,
-		.pfn = __phys_to_pfn(MSM_SHARED_RAM_PHYS),
+		.pfn = __phys_to_pfn(MSM_SHARED_RAM_PHYS_REV_OTHER),
 		.length =   MSM_SHARED_RAM_SIZE,
 		.type =     MT_DEVICE,
 	},
@@ -110,7 +113,25 @@ void __init msm_map_qsd8x50_io(void)
 {
 	debug_ll_io_init();
 	iotable_init(qsd8x50_io_desc, ARRAY_SIZE(qsd8x50_io_desc));
+	iotable_init(qsd8x50_io_desc_rev_other, ARRAY_SIZE(qsd8x50_io_desc_rev_other));
+}
+#ifdef CONFIG_MSM_SOC_REV_A
+static struct map_desc qsd8x50_io_desc_rev_a[] __initdata = {
+	{
+		.virtual =  (unsigned long) MSM_SHARED_RAM_BASE,
+		.pfn = __phys_to_pfn(MSM_SHARED_RAM_PHYS_REV_A),
+		.length =   MSM_SHARED_RAM_SIZE,
+		.type =     MT_DEVICE,
+	},
+};
+
+void __init msm_map_qsd8x50_io_rev_a(void)
+{
+	debug_ll_io_init();
+	iotable_init(qsd8x50_io_desc, ARRAY_SIZE(qsd8x50_io_desc));
+	iotable_init(qsd8x50_io_desc_rev_a, ARRAY_SIZE(qsd8x50_io_desc_rev_a));
 }
+#endif /* CONFIG_MSM_SOC_REV_A */
 #endif /* CONFIG_ARCH_QSD8X50 */
 
 #ifdef CONFIG_ARCH_MSM7X30
-- 
2.1.0.rc2

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RFC PATCH 06/18] ARM: msm: fix mach/msm_iomap.h inclusions
  2015-03-04 19:32 [RFC PATCH 00/18] ARM: msm multiplatform support Arnd Bergmann
                   ` (4 preceding siblings ...)
  2015-03-04 19:32 ` [RFC PATCH 05/18] ARM: msm: fix qsd8x50 rev.a support Arnd Bergmann
@ 2015-03-04 19:33 ` Arnd Bergmann
  2015-03-04 19:33 ` [RFC PATCH 07/18] ARM: msm: fix sirc code for multiplatform Arnd Bergmann
                   ` (15 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnd Bergmann @ 2015-03-04 19:33 UTC (permalink / raw)
  To: linux-arm-kernel

The mach/msm_iomap.h header is broken for files that need to
be built for multiple SoCs, because it includes mutually
exclusive headers for each variant.

This removes the #ifdef and the multiplexer and includes the
correct files in all places directly. To do this, we also have
to split up the io.c file and move the contents into the per-soc
files.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-msm/Makefile                      |   4 -
 arch/arm/mach-msm/board-halibut.c               |   2 +-
 arch/arm/mach-msm/board-msm7x30.c               |   2 +-
 arch/arm/mach-msm/board-trout.c                 |   2 +-
 arch/arm/mach-msm/devices-msm7x00.c             |  58 ++++++++
 arch/arm/mach-msm/devices-msm7x30.c             |  31 +++-
 arch/arm/mach-msm/devices-qsd8x50.c             |  48 +++++++
 arch/arm/mach-msm/include/mach/msm_iomap-7x00.h |   2 -
 arch/arm/mach-msm/include/mach/msm_iomap-7x30.h |   2 -
 arch/arm/mach-msm/include/mach/msm_iomap-8x50.h |   1 -
 arch/arm/mach-msm/include/mach/msm_iomap.h      |  24 ++--
 arch/arm/mach-msm/io.c                          | 182 ------------------------
 12 files changed, 154 insertions(+), 204 deletions(-)
 delete mode 100644 arch/arm/mach-msm/io.c

diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile
index 2fb46dc0ead8..bab22a179c47 100644
--- a/arch/arm/mach-msm/Makefile
+++ b/arch/arm/mach-msm/Makefile
@@ -7,10 +7,6 @@ obj-$(CONFIG_ARCH_QSD8X50) += sirc.o
 
 obj-$(CONFIG_MSM_PROC_COMM) += proc_comm.o clock-pcom.o vreg.o
 
-obj-$(CONFIG_ARCH_MSM7X00A) += io.o
-obj-$(CONFIG_ARCH_MSM7X30) += io.o
-obj-$(CONFIG_ARCH_QSD8X50) += io.o
-
 obj-$(CONFIG_MSM_SMD) += smd.o smd_debug.o
 obj-$(CONFIG_MSM_SMD) += last_radio_log.o
 
diff --git a/arch/arm/mach-msm/board-halibut.c b/arch/arm/mach-msm/board-halibut.c
index 61bfe584a9d7..1b62427ad5ed 100644
--- a/arch/arm/mach-msm/board-halibut.c
+++ b/arch/arm/mach-msm/board-halibut.c
@@ -29,7 +29,7 @@
 #include <asm/setup.h>
 
 #include <mach/irqs.h>
-#include <mach/msm_iomap.h>
+#include <mach/msm_iomap-7x00.h>
 
 #include <linux/mtd/nand.h>
 #include <linux/mtd/partitions.h>
diff --git a/arch/arm/mach-msm/board-msm7x30.c b/arch/arm/mach-msm/board-msm7x30.c
index 44a5bdbf0ee7..e19109f69096 100644
--- a/arch/arm/mach-msm/board-msm7x30.c
+++ b/arch/arm/mach-msm/board-msm7x30.c
@@ -31,7 +31,7 @@
 #include <asm/setup.h>
 
 #include <mach/clk.h>
-#include <mach/msm_iomap.h>
+#include <mach/msm_iomap-7x30.h>
 
 #include <mach/vreg.h>
 #include "devices.h"
diff --git a/arch/arm/mach-msm/board-trout.c b/arch/arm/mach-msm/board-trout.c
index ba3edd3a46cb..7c1b06fa9a76 100644
--- a/arch/arm/mach-msm/board-trout.c
+++ b/arch/arm/mach-msm/board-trout.c
@@ -28,7 +28,7 @@
 #include <asm/setup.h>
 
 #include <mach/hardware.h>
-#include <mach/msm_iomap.h>
+#include <mach/msm_iomap-7x00.h>
 
 #include "devices.h"
 #include "board-trout.h"
diff --git a/arch/arm/mach-msm/devices-msm7x00.c b/arch/arm/mach-msm/devices-msm7x00.c
index aa3feeb96414..dc0ea895568b 100644
--- a/arch/arm/mach-msm/devices-msm7x00.c
+++ b/arch/arm/mach-msm/devices-msm7x00.c
@@ -16,9 +16,11 @@
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 #include <linux/clkdev.h>
+#include <asm/mach/map.h>
 
 #include <mach/irqs.h>
 #include <mach/msm_iomap.h>
+#include <mach/msm_iomap-7x00.h>
 #include "devices.h"
 
 #include <asm/mach/flash.h>
@@ -29,6 +31,62 @@
 #include "clock-pcom.h"
 #include <linux/platform_data/mmc-msm_sdcc.h>
 
+static struct map_desc msm_io_desc[] __initdata = {
+	MSM_DEVICE_TYPE(VIC, MT_DEVICE_NONSHARED),
+	MSM_CHIP_DEVICE_TYPE(CSR, MSM7X00, MT_DEVICE_NONSHARED),
+	MSM_DEVICE_TYPE(DMOV, MT_DEVICE_NONSHARED),
+	MSM_CHIP_DEVICE_TYPE(GPIO1, MSM7X00, MT_DEVICE_NONSHARED),
+	MSM_CHIP_DEVICE_TYPE(GPIO2, MSM7X00, MT_DEVICE_NONSHARED),
+	MSM_DEVICE_TYPE(CLK_CTL, MT_DEVICE_NONSHARED),
+	{
+		.virtual =  (unsigned long) MSM_SHARED_RAM_BASE,
+		.pfn = __phys_to_pfn(MSM_SHARED_RAM_PHYS),
+		.length =   MSM_SHARED_RAM_SIZE,
+		.type =     MT_DEVICE,
+	},
+#if defined(CONFIG_DEBUG_MSM_UART)
+	{
+		/* Must be last: virtual and pfn filled in by debug_ll_addr() */
+		.length = SZ_4K,
+		.type = MT_DEVICE_NONSHARED,
+	}
+#endif
+};
+
+void __init msm_map_common_io(void)
+{
+	size_t size = ARRAY_SIZE(msm_io_desc);
+
+	/* Make sure the peripheral register window is closed, since
+	 * we will use PTE flags (TEX[1]=1,B=0,C=1) to determine which
+	 * pages are peripheral interface or not.
+	 */
+	asm("mcr p15, 0, %0, c15, c2, 4" : : "r" (0));
+#if defined(CONFIG_DEBUG_MSM_UART)
+#ifdef CONFIG_MMU
+	debug_ll_addr(&msm_io_desc[size - 1].pfn,
+		      &msm_io_desc[size - 1].virtual);
+#endif
+	msm_io_desc[size - 1].pfn = __phys_to_pfn(msm_io_desc[size - 1].pfn);
+#endif
+	iotable_init(msm_io_desc, size);
+}
+
+void __iomem *__msm_ioremap_caller(phys_addr_t phys_addr, size_t size,
+				   unsigned int mtype, void *caller)
+{
+	if (mtype == MT_DEVICE) {
+		/* The peripherals in the 88000000 - D0000000 range
+		 * are only accessible by type MT_DEVICE_NONSHARED.
+		 * Adjust mtype as necessary to make this "just work."
+		 */
+		if ((phys_addr >= 0x88000000) && (phys_addr < 0xD0000000))
+			mtype = MT_DEVICE_NONSHARED;
+	}
+
+	return __arm_ioremap_caller(phys_addr, size, mtype, caller);
+}
+
 static struct resource msm_gpio_resources[] = {
 	{
 		.start	= 32 + 0,
diff --git a/arch/arm/mach-msm/devices-msm7x30.c b/arch/arm/mach-msm/devices-msm7x30.c
index 5a0705b55321..824e0d86b93f 100644
--- a/arch/arm/mach-msm/devices-msm7x30.c
+++ b/arch/arm/mach-msm/devices-msm7x30.c
@@ -18,8 +18,9 @@
 
 #include <linux/dma-mapping.h>
 #include <linux/clkdev.h>
+#include <asm/mach/map.h>
 #include <mach/irqs.h>
-#include <mach/msm_iomap.h>
+#include <mach/msm_iomap-7x30.h>
 
 #include "devices.h"
 #include "smd_private.h"
@@ -32,6 +33,34 @@
 
 #include <linux/platform_data/mmc-msm_sdcc.h>
 
+static struct map_desc msm7x30_io_desc[] __initdata = {
+	MSM_DEVICE(VIC),
+	MSM_CHIP_DEVICE(CSR, MSM7X30),
+	MSM_DEVICE(DMOV),
+	MSM_CHIP_DEVICE(GPIO1, MSM7X30),
+	MSM_CHIP_DEVICE(GPIO2, MSM7X30),
+	MSM_DEVICE(CLK_CTL),
+	MSM_DEVICE(CLK_CTL_SH2),
+	MSM_DEVICE(AD5),
+	MSM_DEVICE(MDC),
+	MSM_DEVICE(ACC),
+	MSM_DEVICE(SAW),
+	MSM_DEVICE(GCC),
+	MSM_DEVICE(TCSR),
+	{
+		.virtual =  (unsigned long) MSM_SHARED_RAM_BASE,
+		.pfn = __phys_to_pfn(MSM_SHARED_RAM_PHYS),
+		.length =   MSM_SHARED_RAM_SIZE,
+		.type =     MT_DEVICE,
+	},
+};
+
+void __init msm_map_msm7x30_io(void)
+{
+	debug_ll_io_init();
+	iotable_init(msm7x30_io_desc, ARRAY_SIZE(msm7x30_io_desc));
+}
+
 static struct resource msm_gpio_resources[] = {
 	{
 		.start	= 32 + 18,
diff --git a/arch/arm/mach-msm/devices-qsd8x50.c b/arch/arm/mach-msm/devices-qsd8x50.c
index 6db025cef825..f80a8efee126 100644
--- a/arch/arm/mach-msm/devices-qsd8x50.c
+++ b/arch/arm/mach-msm/devices-qsd8x50.c
@@ -17,9 +17,11 @@
 #include <linux/platform_device.h>
 #include <linux/clkdev.h>
 #include <linux/dma-mapping.h>
+#include <asm/mach/map.h>
 
 #include <mach/irqs.h>
 #include <mach/msm_iomap.h>
+#include <mach/msm_iomap-8x50.h>
 
 #include "devices.h"
 #include "common.h"
@@ -30,6 +32,52 @@
 #include "clock.h"
 #include "clock-pcom.h"
 
+static struct map_desc qsd8x50_io_desc[] __initdata = {
+	MSM_DEVICE(VIC),
+	MSM_CHIP_DEVICE(CSR, QSD8X50),
+	MSM_DEVICE(DMOV),
+	MSM_CHIP_DEVICE(GPIO1, QSD8X50),
+	MSM_CHIP_DEVICE(GPIO2, QSD8X50),
+	MSM_DEVICE(CLK_CTL),
+	MSM_DEVICE(SIRC),
+	MSM_DEVICE(SCPLL),
+	MSM_DEVICE(AD5),
+	MSM_DEVICE(MDC),
+};
+
+static struct map_desc qsd8x50_io_desc_rev_other[] __initdata = {
+	{
+		.virtual =  (unsigned long) MSM_SHARED_RAM_BASE,
+		.pfn = __phys_to_pfn(MSM_SHARED_RAM_PHYS_REV_OTHER),
+		.length =   MSM_SHARED_RAM_SIZE,
+		.type =     MT_DEVICE,
+	},
+};
+
+void __init msm_map_qsd8x50_io(void)
+{
+	debug_ll_io_init();
+	iotable_init(qsd8x50_io_desc, ARRAY_SIZE(qsd8x50_io_desc));
+	iotable_init(qsd8x50_io_desc_rev_other, ARRAY_SIZE(qsd8x50_io_desc_rev_other));
+}
+#ifdef CONFIG_MSM_SOC_REV_A
+static struct map_desc qsd8x50_io_desc_rev_a[] __initdata = {
+	{
+		.virtual =  (unsigned long) MSM_SHARED_RAM_BASE,
+		.pfn = __phys_to_pfn(MSM_SHARED_RAM_PHYS_REV_A),
+		.length =   MSM_SHARED_RAM_SIZE,
+		.type =     MT_DEVICE,
+	},
+};
+
+void __init msm_map_qsd8x50_io_rev_a(void)
+{
+	debug_ll_io_init();
+	iotable_init(qsd8x50_io_desc, ARRAY_SIZE(qsd8x50_io_desc));
+	iotable_init(qsd8x50_io_desc_rev_a, ARRAY_SIZE(qsd8x50_io_desc_rev_a));
+}
+#endif /* CONFIG_MSM_SOC_REV_A */
+
 static struct resource msm_gpio_resources[] = {
 	{
 		.start	= 64 + 165 + 9,
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-7x00.h b/arch/arm/mach-msm/include/mach/msm_iomap-7x00.h
index 67dc0e98b958..27c7f5c0e708 100644
--- a/arch/arm/mach-msm/include/mach/msm_iomap-7x00.h
+++ b/arch/arm/mach-msm/include/mach/msm_iomap-7x00.h
@@ -38,7 +38,6 @@
  *
  */
 
-#define MSM_VIC_BASE          IOMEM(0xE0000000)
 #define MSM_VIC_PHYS          0xC0000000
 #define MSM_VIC_SIZE          SZ_4K
 
@@ -59,7 +58,6 @@
 #define MSM_CLK_CTL_PHYS      0xA8600000
 #define MSM_CLK_CTL_SIZE      SZ_4K
 
-#define MSM_SHARED_RAM_BASE   IOMEM(0xE0100000)
 #define MSM_SHARED_RAM_PHYS   0x01F00000
 #define MSM_SHARED_RAM_SIZE   SZ_1M
 
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-7x30.h b/arch/arm/mach-msm/include/mach/msm_iomap-7x30.h
index 198202c267c8..759a20a093c9 100644
--- a/arch/arm/mach-msm/include/mach/msm_iomap-7x30.h
+++ b/arch/arm/mach-msm/include/mach/msm_iomap-7x30.h
@@ -35,7 +35,6 @@
  *
  */
 
-#define MSM_VIC_BASE          IOMEM(0xE0000000)
 #define MSM_VIC_PHYS          0xC0080000
 #define MSM_VIC_SIZE          SZ_4K
 
@@ -76,7 +75,6 @@
 #define MSM_TCSR_PHYS	      0xAB600000
 #define MSM_TCSR_SIZE	      SZ_4K
 
-#define MSM_SHARED_RAM_BASE   IOMEM(0xE0100000)
 #define MSM_SHARED_RAM_PHYS   0x00100000
 #define MSM_SHARED_RAM_SIZE   SZ_1M
 
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h b/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h
index f9f4a9ccb747..f7b7f44341f5 100644
--- a/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h
+++ b/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h
@@ -35,7 +35,6 @@
  *
  */
 
-#define MSM_VIC_BASE          IOMEM(0xE0000000)
 #define MSM_VIC_PHYS          0xAC000000
 #define MSM_VIC_SIZE          SZ_4K
 
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap.h b/arch/arm/mach-msm/include/mach/msm_iomap.h
index 0e4f49157684..5f3c43e417dd 100644
--- a/arch/arm/mach-msm/include/mach/msm_iomap.h
+++ b/arch/arm/mach-msm/include/mach/msm_iomap.h
@@ -25,6 +25,19 @@
 
 #include <asm/sizes.h>
 
+#define MSM_CHIP_DEVICE_TYPE(name, chip, mem_type) {			      \
+		.virtual = (unsigned long) MSM_##name##_BASE, \
+		.pfn = __phys_to_pfn(chip##_##name##_PHYS), \
+		.length = chip##_##name##_SIZE, \
+		.type = mem_type, \
+	 }
+
+#define MSM_DEVICE_TYPE(name, mem_type) \
+		MSM_CHIP_DEVICE_TYPE(name, MSM, mem_type)
+#define MSM_CHIP_DEVICE(name, chip) \
+		MSM_CHIP_DEVICE_TYPE(name, chip, MT_DEVICE)
+#define MSM_DEVICE(name) MSM_CHIP_DEVICE(name, MSM)
+
 /* Physical base address and size of peripherals.
  * Ordered by the virtual base addresses they will be mapped at.
  *
@@ -37,17 +50,10 @@
  *
  */
 
-#if defined(CONFIG_ARCH_MSM7X30)
-#include "msm_iomap-7x30.h"
-#elif defined(CONFIG_ARCH_QSD8X50)
-#include "msm_iomap-8x50.h"
-#else
-#include "msm_iomap-7x00.h"
-#endif
-
 /* Virtual addresses shared across all MSM targets. */
+#define MSM_VIC_BASE		IOMEM(0xE0000000)
 #define MSM_CSR_BASE		IOMEM(0xE0001000)
 #define MSM_GPIO1_BASE		IOMEM(0xE0003000)
 #define MSM_GPIO2_BASE		IOMEM(0xE0004000)
-
+#define MSM_SHARED_RAM_BASE	IOMEM(0xE0100000)
 #endif
diff --git a/arch/arm/mach-msm/io.c b/arch/arm/mach-msm/io.c
deleted file mode 100644
index ea7dc16fbb13..000000000000
--- a/arch/arm/mach-msm/io.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/* arch/arm/mach-msm/io.c
- *
- * MSM7K, QSD io support
- *
- * Copyright (C) 2007 Google, Inc.
- * Copyright (c) 2008-2011, Code Aurora Forum. All rights reserved.
- * Author: Brian Swetland <swetland@google.com>
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/kernel.h>
-#include <linux/bug.h>
-#include <linux/init.h>
-#include <linux/io.h>
-#include <linux/export.h>
-
-#include <mach/hardware.h>
-#include <asm/page.h>
-#include <mach/msm_iomap.h>
-#include <asm/mach/map.h>
-
-#include "common.h"
-
-#define MSM_CHIP_DEVICE_TYPE(name, chip, mem_type) {			      \
-		.virtual = (unsigned long) MSM_##name##_BASE, \
-		.pfn = __phys_to_pfn(chip##_##name##_PHYS), \
-		.length = chip##_##name##_SIZE, \
-		.type = mem_type, \
-	 }
-
-#define MSM_DEVICE_TYPE(name, mem_type) \
-		MSM_CHIP_DEVICE_TYPE(name, MSM, mem_type)
-#define MSM_CHIP_DEVICE(name, chip) \
-		MSM_CHIP_DEVICE_TYPE(name, chip, MT_DEVICE)
-#define MSM_DEVICE(name) MSM_CHIP_DEVICE(name, MSM)
-
-#if defined(CONFIG_ARCH_MSM7X00A)
-static struct map_desc msm_io_desc[] __initdata = {
-	MSM_DEVICE_TYPE(VIC, MT_DEVICE_NONSHARED),
-	MSM_CHIP_DEVICE_TYPE(CSR, MSM7X00, MT_DEVICE_NONSHARED),
-	MSM_DEVICE_TYPE(DMOV, MT_DEVICE_NONSHARED),
-	MSM_CHIP_DEVICE_TYPE(GPIO1, MSM7X00, MT_DEVICE_NONSHARED),
-	MSM_CHIP_DEVICE_TYPE(GPIO2, MSM7X00, MT_DEVICE_NONSHARED),
-	MSM_DEVICE_TYPE(CLK_CTL, MT_DEVICE_NONSHARED),
-	{
-		.virtual =  (unsigned long) MSM_SHARED_RAM_BASE,
-		.pfn = __phys_to_pfn(MSM_SHARED_RAM_PHYS),
-		.length =   MSM_SHARED_RAM_SIZE,
-		.type =     MT_DEVICE,
-	},
-#if defined(CONFIG_DEBUG_MSM_UART)
-	{
-		/* Must be last: virtual and pfn filled in by debug_ll_addr() */
-		.length = SZ_4K,
-		.type = MT_DEVICE_NONSHARED,
-	}
-#endif
-};
-
-void __init msm_map_common_io(void)
-{
-	size_t size = ARRAY_SIZE(msm_io_desc);
-
-	/* Make sure the peripheral register window is closed, since
-	 * we will use PTE flags (TEX[1]=1,B=0,C=1) to determine which
-	 * pages are peripheral interface or not.
-	 */
-	asm("mcr p15, 0, %0, c15, c2, 4" : : "r" (0));
-#if defined(CONFIG_DEBUG_MSM_UART)
-#ifdef CONFIG_MMU
-	debug_ll_addr(&msm_io_desc[size - 1].pfn,
-		      &msm_io_desc[size - 1].virtual);
-#endif
-	msm_io_desc[size - 1].pfn = __phys_to_pfn(msm_io_desc[size - 1].pfn);
-#endif
-	iotable_init(msm_io_desc, size);
-}
-#endif
-
-#ifdef CONFIG_ARCH_QSD8X50
-static struct map_desc qsd8x50_io_desc[] __initdata = {
-	MSM_DEVICE(VIC),
-	MSM_CHIP_DEVICE(CSR, QSD8X50),
-	MSM_DEVICE(DMOV),
-	MSM_CHIP_DEVICE(GPIO1, QSD8X50),
-	MSM_CHIP_DEVICE(GPIO2, QSD8X50),
-	MSM_DEVICE(CLK_CTL),
-	MSM_DEVICE(SIRC),
-	MSM_DEVICE(SCPLL),
-	MSM_DEVICE(AD5),
-	MSM_DEVICE(MDC),
-};
-
-static struct map_desc qsd8x50_io_desc_rev_other[] __initdata = {
-	{
-		.virtual =  (unsigned long) MSM_SHARED_RAM_BASE,
-		.pfn = __phys_to_pfn(MSM_SHARED_RAM_PHYS_REV_OTHER),
-		.length =   MSM_SHARED_RAM_SIZE,
-		.type =     MT_DEVICE,
-	},
-};
-
-void __init msm_map_qsd8x50_io(void)
-{
-	debug_ll_io_init();
-	iotable_init(qsd8x50_io_desc, ARRAY_SIZE(qsd8x50_io_desc));
-	iotable_init(qsd8x50_io_desc_rev_other, ARRAY_SIZE(qsd8x50_io_desc_rev_other));
-}
-#ifdef CONFIG_MSM_SOC_REV_A
-static struct map_desc qsd8x50_io_desc_rev_a[] __initdata = {
-	{
-		.virtual =  (unsigned long) MSM_SHARED_RAM_BASE,
-		.pfn = __phys_to_pfn(MSM_SHARED_RAM_PHYS_REV_A),
-		.length =   MSM_SHARED_RAM_SIZE,
-		.type =     MT_DEVICE,
-	},
-};
-
-void __init msm_map_qsd8x50_io_rev_a(void)
-{
-	debug_ll_io_init();
-	iotable_init(qsd8x50_io_desc, ARRAY_SIZE(qsd8x50_io_desc));
-	iotable_init(qsd8x50_io_desc_rev_a, ARRAY_SIZE(qsd8x50_io_desc_rev_a));
-}
-#endif /* CONFIG_MSM_SOC_REV_A */
-#endif /* CONFIG_ARCH_QSD8X50 */
-
-#ifdef CONFIG_ARCH_MSM7X30
-static struct map_desc msm7x30_io_desc[] __initdata = {
-	MSM_DEVICE(VIC),
-	MSM_CHIP_DEVICE(CSR, MSM7X30),
-	MSM_DEVICE(DMOV),
-	MSM_CHIP_DEVICE(GPIO1, MSM7X30),
-	MSM_CHIP_DEVICE(GPIO2, MSM7X30),
-	MSM_DEVICE(CLK_CTL),
-	MSM_DEVICE(CLK_CTL_SH2),
-	MSM_DEVICE(AD5),
-	MSM_DEVICE(MDC),
-	MSM_DEVICE(ACC),
-	MSM_DEVICE(SAW),
-	MSM_DEVICE(GCC),
-	MSM_DEVICE(TCSR),
-	{
-		.virtual =  (unsigned long) MSM_SHARED_RAM_BASE,
-		.pfn = __phys_to_pfn(MSM_SHARED_RAM_PHYS),
-		.length =   MSM_SHARED_RAM_SIZE,
-		.type =     MT_DEVICE,
-	},
-};
-
-void __init msm_map_msm7x30_io(void)
-{
-	debug_ll_io_init();
-	iotable_init(msm7x30_io_desc, ARRAY_SIZE(msm7x30_io_desc));
-}
-#endif /* CONFIG_ARCH_MSM7X30 */
-
-#ifdef CONFIG_ARCH_MSM7X00A
-void __iomem *__msm_ioremap_caller(phys_addr_t phys_addr, size_t size,
-				   unsigned int mtype, void *caller)
-{
-	if (mtype == MT_DEVICE) {
-		/* The peripherals in the 88000000 - D0000000 range
-		 * are only accessible by type MT_DEVICE_NONSHARED.
-		 * Adjust mtype as necessary to make this "just work."
-		 */
-		if ((phys_addr >= 0x88000000) && (phys_addr < 0xD0000000))
-			mtype = MT_DEVICE_NONSHARED;
-	}
-
-	return __arm_ioremap_caller(phys_addr, size, mtype, caller);
-}
-#endif
-- 
2.1.0.rc2

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RFC PATCH 07/18] ARM: msm: fix sirc code for multiplatform
  2015-03-04 19:32 [RFC PATCH 00/18] ARM: msm multiplatform support Arnd Bergmann
                   ` (5 preceding siblings ...)
  2015-03-04 19:33 ` [RFC PATCH 06/18] ARM: msm: fix mach/msm_iomap.h inclusions Arnd Bergmann
@ 2015-03-04 19:33 ` Arnd Bergmann
  2015-03-04 19:33 ` [RFC PATCH 08/18] ARM: msm: fix gpiomux config " Arnd Bergmann
                   ` (14 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnd Bergmann @ 2015-03-04 19:33 UTC (permalink / raw)
  To: linux-arm-kernel

The sirc irchip driver hardcodes interrupts for a particular
revision of the qsd8x50 chip, which breaks building a single
binary for multiple revisions.

This reorganizes the code to move this decision to the board
code and makes the irq range runtime dependent.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-msm/board-qsd8x50.c          | 12 +++++-
 arch/arm/mach-msm/include/mach/irqs-8x50.h | 40 ++++++++++++++++++
 arch/arm/mach-msm/include/mach/sirc.h      | 66 +-----------------------------
 arch/arm/mach-msm/sirc.c                   | 43 ++++++++++++++-----
 4 files changed, 83 insertions(+), 78 deletions(-)

diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c
index 58c7ab45c1d4..24f4ae061f79 100644
--- a/arch/arm/mach-msm/board-qsd8x50.c
+++ b/arch/arm/mach-msm/board-qsd8x50.c
@@ -223,7 +223,7 @@ static void __init qsd8x50_init_mmc(void)
 static void __init qsd8x50_init_irq(void)
 {
 	msm_init_irq();
-	msm_init_sirc();
+	msm_init_sirc(FIRST_SIRC_IRQ, NR_SIRC_IRQS_REV_OTHER, INT_SIRC_0);
 }
 
 static void __init qsd8x50_init(void)
@@ -249,11 +249,19 @@ MACHINE_START(QSD8X50_SURF, "QCT QSD8X50 SURF")
 	.init_time	= qsd8x50_timer_init,
 MACHINE_END
 
+#ifdef CONFIG_MSM_SOC_REV_A
+static void __init qsd8x50_init_irq_rev_a(void)
+{
+	msm_init_irq();
+	msm_init_sirc(FIRST_SIRC_IRQ, NR_SIRC_IRQS_REV_A, INT_SIRC_0);
+}
+
 MACHINE_START(QSD8X50A_ST1_5, "QCT QSD8X50A ST1.5")
 	.atag_offset = 0x100,
 	.map_io = msm_map_qsd8x50_io_rev_a,
-	.init_irq = qsd8x50_init_irq,
+	.init_irq = qsd8x50_init_irq_rev_a,
 	.init_machine = qsd8x50_init,
 	.init_late = qsd8x50_init_late,
 	.init_time	= qsd8x50_timer_init,
 MACHINE_END
+#endif
diff --git a/arch/arm/mach-msm/include/mach/irqs-8x50.h b/arch/arm/mach-msm/include/mach/irqs-8x50.h
index 26adbe0e9406..9a6036119a8d 100644
--- a/arch/arm/mach-msm/include/mach/irqs-8x50.h
+++ b/arch/arm/mach-msm/include/mach/irqs-8x50.h
@@ -85,4 +85,44 @@
 #define NR_MSM_IRQS 64
 #define NR_BOARD_IRQS 64
 
+/*
+ * Secondary interrupt controller interrupts
+ */
+
+#define FIRST_SIRC_IRQ (NR_MSM_IRQS + NR_GPIO_IRQS)
+
+#define INT_UART1                     (FIRST_SIRC_IRQ + 0)
+#define INT_UART2                     (FIRST_SIRC_IRQ + 1)
+#define INT_UART3                     (FIRST_SIRC_IRQ + 2)
+#define INT_UART1_RX                  (FIRST_SIRC_IRQ + 3)
+#define INT_UART2_RX                  (FIRST_SIRC_IRQ + 4)
+#define INT_UART3_RX                  (FIRST_SIRC_IRQ + 5)
+#define INT_SPI_INPUT                 (FIRST_SIRC_IRQ + 6)
+#define INT_SPI_OUTPUT                (FIRST_SIRC_IRQ + 7)
+#define INT_SPI_ERROR                 (FIRST_SIRC_IRQ + 8)
+#define INT_GPIO_GROUP1               (FIRST_SIRC_IRQ + 9)
+#define INT_GPIO_GROUP2               (FIRST_SIRC_IRQ + 10)
+#define INT_GPIO_GROUP1_SECURE        (FIRST_SIRC_IRQ + 11)
+#define INT_GPIO_GROUP2_SECURE        (FIRST_SIRC_IRQ + 12)
+#define INT_AVS_SVIC                  (FIRST_SIRC_IRQ + 13)
+#define INT_AVS_REQ_UP                (FIRST_SIRC_IRQ + 14)
+#define INT_AVS_REQ_DOWN              (FIRST_SIRC_IRQ + 15)
+#define INT_PBUS_ERR                  (FIRST_SIRC_IRQ + 16)
+#define INT_AXI_ERR                   (FIRST_SIRC_IRQ + 17)
+#define INT_SMI_ERR                   (FIRST_SIRC_IRQ + 18)
+#define INT_EBI1_ERR                  (FIRST_SIRC_IRQ + 19)
+#define INT_IMEM_ERR                  (FIRST_SIRC_IRQ + 20)
+#define INT_TEMP_SENSOR               (FIRST_SIRC_IRQ + 21)
+#define INT_TV_ENC                    (FIRST_SIRC_IRQ + 22)
+#define INT_GRP2D                     (FIRST_SIRC_IRQ + 23)
+#define INT_GSBI_QUP                  (FIRST_SIRC_IRQ + 24)
+#define INT_SC_ACG                    (FIRST_SIRC_IRQ + 25)
+#define INT_WDT0                      (FIRST_SIRC_IRQ + 26)
+#define INT_WDT1                      (FIRST_SIRC_IRQ + 27)
+
+#define NR_SIRC_IRQS_REV_A		28
+#define NR_SIRC_IRQS_REV_OTHER		23
+
+#define LAST_SIRC_IRQ                 (FIRST_SIRC_IRQ + NR_SIRC_IRQS - 1)
+
 #endif
diff --git a/arch/arm/mach-msm/include/mach/sirc.h b/arch/arm/mach-msm/include/mach/sirc.h
index ef55868a5b8a..622555ddd2fd 100644
--- a/arch/arm/mach-msm/include/mach/sirc.h
+++ b/arch/arm/mach-msm/include/mach/sirc.h
@@ -27,72 +27,8 @@ struct sirc_cascade_regs {
 	unsigned int    cascade_irq;
 };
 
-void msm_init_sirc(void);
+void msm_init_sirc(int first, int nr_irqs, int cascade);
 void msm_sirc_enter_sleep(void);
 void msm_sirc_exit_sleep(void);
 
-#if defined(CONFIG_ARCH_MSM_SCORPION)
-
-#include <mach/msm_iomap.h>
-
-/*
- * Secondary interrupt controller interrupts
- */
-
-#define FIRST_SIRC_IRQ (NR_MSM_IRQS + NR_GPIO_IRQS)
-
-#define INT_UART1                     (FIRST_SIRC_IRQ + 0)
-#define INT_UART2                     (FIRST_SIRC_IRQ + 1)
-#define INT_UART3                     (FIRST_SIRC_IRQ + 2)
-#define INT_UART1_RX                  (FIRST_SIRC_IRQ + 3)
-#define INT_UART2_RX                  (FIRST_SIRC_IRQ + 4)
-#define INT_UART3_RX                  (FIRST_SIRC_IRQ + 5)
-#define INT_SPI_INPUT                 (FIRST_SIRC_IRQ + 6)
-#define INT_SPI_OUTPUT                (FIRST_SIRC_IRQ + 7)
-#define INT_SPI_ERROR                 (FIRST_SIRC_IRQ + 8)
-#define INT_GPIO_GROUP1               (FIRST_SIRC_IRQ + 9)
-#define INT_GPIO_GROUP2               (FIRST_SIRC_IRQ + 10)
-#define INT_GPIO_GROUP1_SECURE        (FIRST_SIRC_IRQ + 11)
-#define INT_GPIO_GROUP2_SECURE        (FIRST_SIRC_IRQ + 12)
-#define INT_AVS_SVIC                  (FIRST_SIRC_IRQ + 13)
-#define INT_AVS_REQ_UP                (FIRST_SIRC_IRQ + 14)
-#define INT_AVS_REQ_DOWN              (FIRST_SIRC_IRQ + 15)
-#define INT_PBUS_ERR                  (FIRST_SIRC_IRQ + 16)
-#define INT_AXI_ERR                   (FIRST_SIRC_IRQ + 17)
-#define INT_SMI_ERR                   (FIRST_SIRC_IRQ + 18)
-#define INT_EBI1_ERR                  (FIRST_SIRC_IRQ + 19)
-#define INT_IMEM_ERR                  (FIRST_SIRC_IRQ + 20)
-#define INT_TEMP_SENSOR               (FIRST_SIRC_IRQ + 21)
-#define INT_TV_ENC                    (FIRST_SIRC_IRQ + 22)
-#define INT_GRP2D                     (FIRST_SIRC_IRQ + 23)
-#define INT_GSBI_QUP                  (FIRST_SIRC_IRQ + 24)
-#define INT_SC_ACG                    (FIRST_SIRC_IRQ + 25)
-#define INT_WDT0                      (FIRST_SIRC_IRQ + 26)
-#define INT_WDT1                      (FIRST_SIRC_IRQ + 27)
-
-#if defined(CONFIG_MSM_SOC_REV_A)
-#define NR_SIRC_IRQS                  28
-#define SIRC_MASK                     0x0FFFFFFF
-#else
-#define NR_SIRC_IRQS                  23
-#define SIRC_MASK                     0x007FFFFF
-#endif
-
-#define LAST_SIRC_IRQ                 (FIRST_SIRC_IRQ + NR_SIRC_IRQS - 1)
-
-#define SPSS_SIRC_INT_SELECT          (MSM_SIRC_BASE + 0x00)
-#define SPSS_SIRC_INT_ENABLE          (MSM_SIRC_BASE + 0x04)
-#define SPSS_SIRC_INT_ENABLE_CLEAR    (MSM_SIRC_BASE + 0x08)
-#define SPSS_SIRC_INT_ENABLE_SET      (MSM_SIRC_BASE + 0x0C)
-#define SPSS_SIRC_INT_TYPE            (MSM_SIRC_BASE + 0x10)
-#define SPSS_SIRC_INT_POLARITY        (MSM_SIRC_BASE + 0x14)
-#define SPSS_SIRC_SECURITY            (MSM_SIRC_BASE + 0x18)
-#define SPSS_SIRC_IRQ_STATUS          (MSM_SIRC_BASE + 0x1C)
-#define SPSS_SIRC_IRQ1_STATUS         (MSM_SIRC_BASE + 0x20)
-#define SPSS_SIRC_RAW_STATUS          (MSM_SIRC_BASE + 0x24)
-#define SPSS_SIRC_INT_CLEAR           (MSM_SIRC_BASE + 0x28)
-#define SPSS_SIRC_SOFT_INT            (MSM_SIRC_BASE + 0x2C)
-
-#endif
-
 #endif
diff --git a/arch/arm/mach-msm/sirc.c b/arch/arm/mach-msm/sirc.c
index 689e78c95f38..bfef62c0e8dc 100644
--- a/arch/arm/mach-msm/sirc.c
+++ b/arch/arm/mach-msm/sirc.c
@@ -20,9 +20,27 @@
 #include <linux/irq.h>
 #include <linux/interrupt.h>
 #include <asm/irq.h>
+#include <mach/msm_iomap-8x50.h>
+#include <mach/sirc.h>
+
+#define SPSS_SIRC_INT_SELECT          (MSM_SIRC_BASE + 0x00)
+#define SPSS_SIRC_INT_ENABLE          (MSM_SIRC_BASE + 0x04)
+#define SPSS_SIRC_INT_ENABLE_CLEAR    (MSM_SIRC_BASE + 0x08)
+#define SPSS_SIRC_INT_ENABLE_SET      (MSM_SIRC_BASE + 0x0C)
+#define SPSS_SIRC_INT_TYPE            (MSM_SIRC_BASE + 0x10)
+#define SPSS_SIRC_INT_POLARITY        (MSM_SIRC_BASE + 0x14)
+#define SPSS_SIRC_SECURITY            (MSM_SIRC_BASE + 0x18)
+#define SPSS_SIRC_IRQ_STATUS          (MSM_SIRC_BASE + 0x1C)
+#define SPSS_SIRC_IRQ1_STATUS         (MSM_SIRC_BASE + 0x20)
+#define SPSS_SIRC_RAW_STATUS          (MSM_SIRC_BASE + 0x24)
+#define SPSS_SIRC_INT_CLEAR           (MSM_SIRC_BASE + 0x28)
+#define SPSS_SIRC_SOFT_INT            (MSM_SIRC_BASE + 0x2C)
 
 static unsigned int int_enable;
 static unsigned int wake_enable;
+static int first_sirc_irq;
+static int nr_sirc_irqs;
+static int sirc_mask;
 
 static struct sirc_regs_t sirc_regs = {
 	.int_enable       = SPSS_SIRC_INT_ENABLE,
@@ -36,7 +54,6 @@ static struct sirc_regs_t sirc_regs = {
 static struct sirc_cascade_regs sirc_reg_table[] = {
 	{
 		.int_status  = SPSS_SIRC_IRQ_STATUS,
-		.cascade_irq = INT_SIRC_0,
 	}
 };
 
@@ -46,7 +63,7 @@ static void sirc_irq_mask(struct irq_data *d)
 {
 	unsigned int mask;
 
-	mask = 1 << (d->irq - FIRST_SIRC_IRQ);
+	mask = 1 << (d->irq - first_sirc_irq);
 	writel(mask, sirc_regs.int_enable_clear);
 	int_enable &= ~mask;
 	return;
@@ -58,7 +75,7 @@ static void sirc_irq_unmask(struct irq_data *d)
 {
 	unsigned int mask;
 
-	mask = 1 << (d->irq - FIRST_SIRC_IRQ);
+	mask = 1 << (d->irq - first_sirc_irq);
 	writel(mask, sirc_regs.int_enable_set);
 	int_enable |= mask;
 	return;
@@ -68,7 +85,7 @@ static void sirc_irq_ack(struct irq_data *d)
 {
 	unsigned int mask;
 
-	mask = 1 << (d->irq - FIRST_SIRC_IRQ);
+	mask = 1 << (d->irq - first_sirc_irq);
 	writel(mask, sirc_regs.int_clear);
 	return;
 }
@@ -78,7 +95,7 @@ static int sirc_irq_set_wake(struct irq_data *d, unsigned int on)
 	unsigned int mask;
 
 	/* Used to set the interrupt enable mask during power collapse. */
-	mask = 1 << (d->irq - FIRST_SIRC_IRQ);
+	mask = 1 << (d->irq - first_sirc_irq);
 	if (on)
 		wake_enable |= mask;
 	else
@@ -92,7 +109,7 @@ static int sirc_irq_set_type(struct irq_data *d, unsigned int flow_type)
 	unsigned int mask;
 	unsigned int val;
 
-	mask = 1 << (d->irq - FIRST_SIRC_IRQ);
+	mask = 1 << (d->irq - first_sirc_irq);
 	val = readl(sirc_regs.int_polarity);
 
 	if (flow_type & (IRQF_TRIGGER_LOW | IRQF_TRIGGER_FALLING))
@@ -128,15 +145,15 @@ static void sirc_irq_handler(unsigned int irq, struct irq_desc *desc)
 		reg++;
 
 	status = readl(sirc_reg_table[reg].int_status);
-	status &= SIRC_MASK;
+	status &= sirc_mask;
 	if (status == 0)
 		return;
 
 	for (sirq = 0;
-	     (sirq < NR_SIRC_IRQS) && ((status & (1U << sirq)) == 0);
+	     (sirq < nr_sirc_irqs) && ((status & (1U << sirq)) == 0);
 	     sirq++)
 		;
-	generic_handle_irq(sirq+FIRST_SIRC_IRQ);
+	generic_handle_irq(sirq+first_sirc_irq);
 
 	desc->irq_data.chip->irq_ack(&desc->irq_data);
 }
@@ -150,14 +167,18 @@ static struct irq_chip sirc_irq_chip = {
 	.irq_set_type  = sirc_irq_set_type,
 };
 
-void __init msm_init_sirc(void)
+void __init msm_init_sirc(int first, int count, int cascade)
 {
 	int i;
 
 	int_enable = 0;
 	wake_enable = 0;
+	first_sirc_irq = first;
+	nr_sirc_irqs = count;
+	sirc_mask = (1 << count) - 1;
+	sirc_reg_table[0].cascade_irq = cascade;
 
-	for (i = FIRST_SIRC_IRQ; i < LAST_SIRC_IRQ; i++) {
+	for (i = first; i < first + count; i++) {
 		irq_set_chip_and_handler(i, &sirc_irq_chip, handle_edge_irq);
 		set_irq_flags(i, IRQF_VALID);
 	}
-- 
2.1.0.rc2

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RFC PATCH 08/18] ARM: msm: fix gpiomux config for multiplatform
  2015-03-04 19:32 [RFC PATCH 00/18] ARM: msm multiplatform support Arnd Bergmann
                   ` (6 preceding siblings ...)
  2015-03-04 19:33 ` [RFC PATCH 07/18] ARM: msm: fix sirc code for multiplatform Arnd Bergmann
@ 2015-03-04 19:33 ` Arnd Bergmann
  2015-03-04 19:33 ` [RFC PATCH 09/18] ARM: msm: fix vic irqchip " Arnd Bergmann
                   ` (13 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnd Bergmann @ 2015-03-04 19:33 UTC (permalink / raw)
  To: linux-arm-kernel

The msm gpiomux code uses a global symbol for configuration
that has multiple definitions, and a size that depends on
the SoC that is configured. Both of these are broken
when dealing with a kernel that enables more than one soc,
so we have to pass the data at boot time.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-msm/board-msm7x30.c |  4 +++-
 arch/arm/mach-msm/board-qsd8x50.c |  3 +++
 arch/arm/mach-msm/gpiomux-8x50.c  |  2 +-
 arch/arm/mach-msm/gpiomux-v1.h    |  9 ++-------
 arch/arm/mach-msm/gpiomux.c       | 18 +++++++++---------
 arch/arm/mach-msm/gpiomux.h       |  8 +++++++-
 drivers/gpio/gpio-msm-v1.c        | 16 +++++++++++-----
 7 files changed, 36 insertions(+), 24 deletions(-)

diff --git a/arch/arm/mach-msm/board-msm7x30.c b/arch/arm/mach-msm/board-msm7x30.c
index e19109f69096..a964e3e3724d 100644
--- a/arch/arm/mach-msm/board-msm7x30.c
+++ b/arch/arm/mach-msm/board-msm7x30.c
@@ -99,7 +99,7 @@ static struct msm_otg_platform_data msm_otg_pdata = {
 	.phy_clk_reset		= hsusb_phy_clk_reset,
 };
 
-struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = {
+static struct msm_gpiomux_config msm7x30_gpiomux_configs[MSM7X30_GPIOMUX_NGPIOS] = {
 #ifdef CONFIG_SERIAL_MSM_CONSOLE
 	[49] = { /* UART2 RFR */
 		.suspended = GPIOMUX_DRV_2MA | GPIOMUX_PULL_DOWN |
@@ -139,6 +139,8 @@ static void __init msm7x30_init_irq(void)
 
 static void __init msm7x30_init(void)
 {
+	gpiomux_init(msm7x30_gpiomux_configs,
+		     ARRAY_SIZE(msm7x30_gpiomux_configs));
 	msm_device_otg.dev.platform_data = &msm_otg_pdata;
 	msm_device_hsusb.dev.parent = &msm_device_otg.dev;
 	msm_device_hsusb_host.dev.parent = &msm_device_otg.dev;
diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c
index 24f4ae061f79..259ea05c41b9 100644
--- a/arch/arm/mach-msm/board-qsd8x50.c
+++ b/arch/arm/mach-msm/board-qsd8x50.c
@@ -36,6 +36,7 @@
 
 #include "devices.h"
 #include "common.h"
+#include "gpiomux.h"
 
 static const resource_size_t qsd8x50_surf_smc91x_base __initconst = 0x70000300;
 static const unsigned        qsd8x50_surf_smc91x_gpio __initconst = 156;
@@ -228,6 +229,8 @@ static void __init qsd8x50_init_irq(void)
 
 static void __init qsd8x50_init(void)
 {
+	gpiomux_init(qsd8x50_gpiomux_configs,
+		     ARRAY_SIZE(qsd8x50_gpiomux_configs));
 	msm_device_otg.dev.platform_data = &msm_otg_pdata;
 	msm_device_hsusb.dev.parent = &msm_device_otg.dev;
 	msm_device_hsusb_host.dev.parent = &msm_device_otg.dev;
diff --git a/arch/arm/mach-msm/gpiomux-8x50.c b/arch/arm/mach-msm/gpiomux-8x50.c
index f7a4ea593c95..6851342ec049 100644
--- a/arch/arm/mach-msm/gpiomux-8x50.c
+++ b/arch/arm/mach-msm/gpiomux-8x50.c
@@ -29,7 +29,7 @@
 #define SDC1_SUSPEND_CONFIG (GPIOMUX_VALID | GPIOMUX_PULL_DOWN\
 				| GPIOMUX_FUNC_GPIO | GPIOMUX_DRV_2MA)
 
-struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = {
+struct msm_gpiomux_config qsd8x50_gpiomux_configs[QSD8X50_GPIOMUX_NGPIOS] = {
 	[86] = { /* UART3 RX */
 		.suspended = GPIOMUX_DRV_2MA | GPIOMUX_PULL_DOWN |
 			     GPIOMUX_FUNC_1 | GPIOMUX_VALID,
diff --git a/arch/arm/mach-msm/gpiomux-v1.h b/arch/arm/mach-msm/gpiomux-v1.h
index 71d86feba450..733c11aa7707 100644
--- a/arch/arm/mach-msm/gpiomux-v1.h
+++ b/arch/arm/mach-msm/gpiomux-v1.h
@@ -17,13 +17,8 @@
 #ifndef __ARCH_ARM_MACH_MSM_GPIOMUX_V1_H
 #define __ARCH_ARM_MACH_MSM_GPIOMUX_V1_H
 
-#if defined(CONFIG_ARCH_MSM7X30)
-#define GPIOMUX_NGPIOS 182
-#elif defined(CONFIG_ARCH_QSD8X50)
-#define GPIOMUX_NGPIOS 165
-#else
-#define GPIOMUX_NGPIOS 133
-#endif
+#define MSM7X30_GPIOMUX_NGPIOS 182
+#define QSD8X50_GPIOMUX_NGPIOS 165
 
 typedef u32 gpiomux_config_t;
 
diff --git a/arch/arm/mach-msm/gpiomux.c b/arch/arm/mach-msm/gpiomux.c
index 2b8e2d217082..768de1a05a56 100644
--- a/arch/arm/mach-msm/gpiomux.c
+++ b/arch/arm/mach-msm/gpiomux.c
@@ -20,6 +20,8 @@
 #include "proc_comm.h"
 
 static DEFINE_SPINLOCK(gpiomux_lock);
+static int gpiomux_ngpios;
+static struct msm_gpiomux_config *msm_gpiomux_configs;
 
 static void __msm_gpiomux_write(unsigned gpio, gpiomux_config_t val)
 {
@@ -43,7 +45,7 @@ int msm_gpiomux_write(unsigned gpio,
 	unsigned long irq_flags;
 	gpiomux_config_t setting;
 
-	if (gpio >= GPIOMUX_NGPIOS)
+	if (gpio >= gpiomux_ngpios)
 		return -EINVAL;
 
 	spin_lock_irqsave(&gpiomux_lock, irq_flags);
@@ -61,14 +63,13 @@ int msm_gpiomux_write(unsigned gpio,
 	spin_unlock_irqrestore(&gpiomux_lock, irq_flags);
 	return 0;
 }
-EXPORT_SYMBOL(msm_gpiomux_write);
 
 int msm_gpiomux_get(unsigned gpio)
 {
 	struct msm_gpiomux_config *cfg = msm_gpiomux_configs + gpio;
 	unsigned long irq_flags;
 
-	if (gpio >= GPIOMUX_NGPIOS)
+	if (gpio >= gpiomux_ngpios)
 		return -EINVAL;
 
 	spin_lock_irqsave(&gpiomux_lock, irq_flags);
@@ -77,14 +78,13 @@ int msm_gpiomux_get(unsigned gpio)
 	spin_unlock_irqrestore(&gpiomux_lock, irq_flags);
 	return 0;
 }
-EXPORT_SYMBOL(msm_gpiomux_get);
 
 int msm_gpiomux_put(unsigned gpio)
 {
 	struct msm_gpiomux_config *cfg = msm_gpiomux_configs + gpio;
 	unsigned long irq_flags;
 
-	if (gpio >= GPIOMUX_NGPIOS)
+	if (gpio >= gpiomux_ngpios)
 		return -EINVAL;
 
 	spin_lock_irqsave(&gpiomux_lock, irq_flags);
@@ -94,13 +94,14 @@ int msm_gpiomux_put(unsigned gpio)
 	spin_unlock_irqrestore(&gpiomux_lock, irq_flags);
 	return 0;
 }
-EXPORT_SYMBOL(msm_gpiomux_put);
 
-static int __init gpiomux_init(void)
+int __init gpiomux_init(struct msm_gpiomux_config *config, unsigned int ngpios)
 {
 	unsigned n;
+	msm_gpiomux_configs = config;
+	gpiomux_ngpios = ngpios;
 
-	for (n = 0; n < GPIOMUX_NGPIOS; ++n) {
+	for (n = 0; n < gpiomux_ngpios; ++n) {
 		msm_gpiomux_configs[n].ref = 0;
 		if (!(msm_gpiomux_configs[n].suspended & GPIOMUX_VALID))
 			continue;
@@ -108,4 +109,3 @@ static int __init gpiomux_init(void)
 	}
 	return 0;
 }
-postcore_initcall(gpiomux_init);
diff --git a/arch/arm/mach-msm/gpiomux.h b/arch/arm/mach-msm/gpiomux.h
index 4410d7766f93..cdc1578d1e73 100644
--- a/arch/arm/mach-msm/gpiomux.h
+++ b/arch/arm/mach-msm/gpiomux.h
@@ -65,7 +65,7 @@ enum {
  * of that flag will prevent the configuration from being applied
  * during state transitions.
  */
-extern struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS];
+extern struct msm_gpiomux_config qsd8x50_gpiomux_configs[QSD8X50_GPIOMUX_NGPIOS];
 
 /* Install a new configuration to the gpio line.  To avoid overwriting
  * a configuration, leave the VALID bit out.
@@ -73,6 +73,8 @@ extern struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS];
 int msm_gpiomux_write(unsigned gpio,
 		      gpiomux_config_t active,
 		      gpiomux_config_t suspended);
+
+int gpiomux_init(struct msm_gpiomux_config *config, unsigned int ngpios);
 #else
 static inline int msm_gpiomux_write(unsigned gpio,
 				    gpiomux_config_t active,
@@ -80,5 +82,9 @@ static inline int msm_gpiomux_write(unsigned gpio,
 {
 	return -ENOSYS;
 }
+int gpiomux_init(struct msm_gpiomux_config *config, unsigned int ngpios)
+{
+	return 0;
+}
 #endif
 #endif
diff --git a/drivers/gpio/gpio-msm-v1.c b/drivers/gpio/gpio-msm-v1.c
index edf285e26667..589115c1faa2 100644
--- a/drivers/gpio/gpio-msm-v1.c
+++ b/drivers/gpio/gpio-msm-v1.c
@@ -328,8 +328,11 @@ struct msm_gpio_chip {
 struct msm_gpio_initdata {
 	struct msm_gpio_chip *chips;
 	int count;
+	bool mux;
 };
 
+static bool msm_gpio_mux;
+
 static void msm_gpio_writel(struct msm_gpio_chip *chip, u32 val,
 			    enum msm_gpio_reg reg)
 {
@@ -446,20 +449,19 @@ static int msm_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
 	return MSM_GPIO_TO_INT(chip->base + offset);
 }
 
-#ifdef CONFIG_MSM_GPIOMUX
 static int msm_gpio_request(struct gpio_chip *chip, unsigned offset)
 {
+	if (!IS_ENABLED(CONFIG_MSM_GPIOMUX) || !msm_gpio_mux)
+		return 0;
 	return msm_gpiomux_get(chip->base + offset);
 }
 
 static void msm_gpio_free(struct gpio_chip *chip, unsigned offset)
 {
+	if (!IS_ENABLED(CONFIG_MSM_GPIOMUX) || !msm_gpio_mux)
+		return;
 	msm_gpiomux_put(chip->base + offset);
 }
-#else
-#define msm_gpio_request NULL
-#define msm_gpio_free NULL
-#endif
 
 static struct msm_gpio_chip *msm_gpio_chips;
 static int msm_gpio_count;
@@ -476,6 +478,7 @@ static struct msm_gpio_chip msm_gpio_chips_msm7x01[] = {
 static struct msm_gpio_initdata msm_gpio_7x01_init = {
 	.chips = msm_gpio_chips_msm7x01,
 	.count = ARRAY_SIZE(msm_gpio_chips_msm7x01),
+	.mux = false,
 };
 
 static struct msm_gpio_chip msm_gpio_chips_msm7x30[] = {
@@ -492,6 +495,7 @@ static struct msm_gpio_chip msm_gpio_chips_msm7x30[] = {
 static struct msm_gpio_initdata msm_gpio_7x30_init = {
 	.chips = msm_gpio_chips_msm7x30,
 	.count = ARRAY_SIZE(msm_gpio_chips_msm7x30),
+	.mux = true,
 };
 
 static struct msm_gpio_chip msm_gpio_chips_qsd8x50[] = {
@@ -508,6 +512,7 @@ static struct msm_gpio_chip msm_gpio_chips_qsd8x50[] = {
 static struct msm_gpio_initdata msm_gpio_8x50_init = {
 	.chips = msm_gpio_chips_qsd8x50,
 	.count = ARRAY_SIZE(msm_gpio_chips_qsd8x50),
+	.mux = true,
 };
 
 static void msm_gpio_irq_ack(struct irq_data *d)
@@ -643,6 +648,7 @@ static int gpio_msm_v1_probe(struct platform_device *pdev)
 	data = (struct msm_gpio_initdata *)dev_id->driver_data;
 	msm_gpio_chips = data->chips;
 	msm_gpio_count = data->count;
+	msm_gpio_mux = data->mux;
 
 	irq1 = platform_get_irq(pdev, 0);
 	if (irq1 < 0)
-- 
2.1.0.rc2

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RFC PATCH 09/18] ARM: msm: fix vic irqchip for multiplatform
  2015-03-04 19:32 [RFC PATCH 00/18] ARM: msm multiplatform support Arnd Bergmann
                   ` (7 preceding siblings ...)
  2015-03-04 19:33 ` [RFC PATCH 08/18] ARM: msm: fix gpiomux config " Arnd Bergmann
@ 2015-03-04 19:33 ` Arnd Bergmann
  2015-03-04 19:33 ` [RFC PATCH 10/18] gpio: move msm-v1 driver to mach-msm Arnd Bergmann
                   ` (12 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnd Bergmann @ 2015-03-04 19:33 UTC (permalink / raw)
  To: linux-arm-kernel

The vic code is common between msm7x30 and qsd8x50, but has
minor differences in the number of registers and the mapping
between interrupt numbers and smsm numbers.

This moves the differences out to the soc-specific files so the
vic implementation can be shared.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-msm/board-msm7x30.c |  55 +++++++++++++++++-
 arch/arm/mach-msm/board-qsd8x50.c |  59 ++++++++++++++++++-
 arch/arm/mach-msm/common.h        |   1 +
 arch/arm/mach-msm/irq-vic.c       | 117 +++++---------------------------------
 4 files changed, 125 insertions(+), 107 deletions(-)

diff --git a/arch/arm/mach-msm/board-msm7x30.c b/arch/arm/mach-msm/board-msm7x30.c
index a964e3e3724d..4718a661306e 100644
--- a/arch/arm/mach-msm/board-msm7x30.c
+++ b/arch/arm/mach-msm/board-msm7x30.c
@@ -31,6 +31,7 @@
 #include <asm/setup.h>
 
 #include <mach/clk.h>
+#include <mach/irqs-7x30.h>
 #include <mach/msm_iomap-7x30.h>
 
 #include <mach/vreg.h>
@@ -132,9 +133,61 @@ static struct platform_device *devices[] __initdata = {
 	&msm_device_hsusb_host,
 };
 
+#define SMSM_FAKE_IRQ (0xff)
+static uint8_t msm_irq_to_smsm[NR_IRQS] = {
+	[INT_MDDI_EXT] = 1,
+	[INT_MDDI_PRI] = 2,
+	[INT_MDDI_CLIENT] = 3,
+	[INT_USB_OTG] = 4,
+
+	[INT_PWB_I2C] = 5,
+	[INT_SDC1_0] = 6,
+	[INT_SDC1_1] = 7,
+	[INT_SDC2_0] = 8,
+
+	[INT_SDC2_1] = 9,
+	[INT_ADSP_A9_A11] = 10,
+	[INT_UART1] = 11,
+	[INT_UART2] = 12,
+
+	[INT_UART3] = 13,
+	[INT_UART1_RX] = 14,
+	[INT_UART2_RX] = 15,
+	[INT_UART3_RX] = 16,
+
+	[INT_UART1DM_IRQ] = 17,
+	[INT_UART1DM_RX] = 18,
+	[INT_KEYSENSE] = 19,
+
+	[INT_NAND_WR_ER_DONE] = 21,
+	[INT_NAND_OP_DONE] = 22,
+	[INT_TCHSCRN1] = 23,
+	[INT_TCHSCRN2] = 24,
+
+	[INT_TCHSCRN_SSBI] = 25,
+	[INT_USB_HS] = 26,
+	[INT_UART2DM_RX] = 27,
+	[INT_UART2DM_IRQ] = 28,
+
+	[INT_SDC4_1] = 29,
+	[INT_SDC4_0] = 30,
+	[INT_SDC3_1] = 31,
+	[INT_SDC3_0] = 32,
+
+	/* fake wakeup interrupts */
+	[INT_GPIO_GROUP1] = SMSM_FAKE_IRQ,
+	[INT_GPIO_GROUP2] = SMSM_FAKE_IRQ,
+	[INT_A9_M2A_0] = SMSM_FAKE_IRQ,
+	[INT_A9_M2A_1] = SMSM_FAKE_IRQ,
+	[INT_A9_M2A_5] = SMSM_FAKE_IRQ,
+	[INT_GP_TIMER_EXP] = SMSM_FAKE_IRQ,
+	[INT_DEBUG_TIMER_EXP] = SMSM_FAKE_IRQ,
+	[INT_ADSP_A11] = SMSM_FAKE_IRQ,
+};
+
 static void __init msm7x30_init_irq(void)
 {
-	msm_init_irq();
+	msm_init_vic(msm_irq_to_smsm, 4);
 }
 
 static void __init msm7x30_init(void)
diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c
index 259ea05c41b9..ff458806785b 100644
--- a/arch/arm/mach-msm/board-qsd8x50.c
+++ b/arch/arm/mach-msm/board-qsd8x50.c
@@ -221,9 +221,64 @@ static void __init qsd8x50_init_mmc(void)
 	msm_add_sdcc(1, &qsd8x50_sdc1_data, 0, 0);
 }
 
+#define SMSM_FAKE_IRQ (0xff)
+static uint8_t msm_irq_to_smsm[NR_IRQS] = {
+	[INT_MDDI_EXT] = 1,
+	[INT_MDDI_PRI] = 2,
+	[INT_MDDI_CLIENT] = 3,
+	[INT_USB_OTG] = 4,
+
+	[INT_PWB_I2C] = 5,
+	[INT_SDC1_0] = 6,
+	[INT_SDC1_1] = 7,
+	[INT_SDC2_0] = 8,
+
+	[INT_SDC2_1] = 9,
+	[INT_ADSP_A9_A11] = 10,
+	[INT_UART1] = 11,
+	[INT_UART2] = 12,
+
+	[INT_UART3] = 13,
+	[INT_UART1_RX] = 14,
+	[INT_UART2_RX] = 15,
+	[INT_UART3_RX] = 16,
+
+	[INT_UART1DM_IRQ] = 17,
+	[INT_UART1DM_RX] = 18,
+	[INT_KEYSENSE] = 19,
+	[INT_AD_HSSD] = 20,
+
+	[INT_NAND_WR_ER_DONE] = 21,
+	[INT_NAND_OP_DONE] = 22,
+	[INT_TCHSCRN1] = 23,
+	[INT_TCHSCRN2] = 24,
+
+	[INT_TCHSCRN_SSBI] = 25,
+	[INT_USB_HS] = 26,
+	[INT_UART2DM_RX] = 27,
+	[INT_UART2DM_IRQ] = 28,
+
+	[INT_SDC4_1] = 29,
+	[INT_SDC4_0] = 30,
+	[INT_SDC3_1] = 31,
+	[INT_SDC3_0] = 32,
+
+	/* fake wakeup interrupts */
+	[INT_GPIO_GROUP1] = SMSM_FAKE_IRQ,
+	[INT_GPIO_GROUP2] = SMSM_FAKE_IRQ,
+	[INT_A9_M2A_0] = SMSM_FAKE_IRQ,
+	[INT_A9_M2A_1] = SMSM_FAKE_IRQ,
+	[INT_A9_M2A_5] = SMSM_FAKE_IRQ,
+	[INT_GP_TIMER_EXP] = SMSM_FAKE_IRQ,
+	[INT_DEBUG_TIMER_EXP] = SMSM_FAKE_IRQ,
+	[INT_ADSP_A11] = SMSM_FAKE_IRQ,
+	[INT_SIRC_0] = SMSM_FAKE_IRQ,
+	[INT_SIRC_1] = SMSM_FAKE_IRQ,
+};
+
 static void __init qsd8x50_init_irq(void)
 {
-	msm_init_irq();
+	msm_init_vic(msm_irq_to_smsm, 2);
 	msm_init_sirc(FIRST_SIRC_IRQ, NR_SIRC_IRQS_REV_OTHER, INT_SIRC_0);
 }
 
@@ -255,7 +310,7 @@ MACHINE_END
 #ifdef CONFIG_MSM_SOC_REV_A
 static void __init qsd8x50_init_irq_rev_a(void)
 {
-	msm_init_irq();
+	msm_init_vic(msm_irq_to_smsm, 2);
 	msm_init_sirc(FIRST_SIRC_IRQ, NR_SIRC_IRQS_REV_A, INT_SIRC_0);
 }
 
diff --git a/arch/arm/mach-msm/common.h b/arch/arm/mach-msm/common.h
index 8267f6402325..7e4ddfdf4fe8 100644
--- a/arch/arm/mach-msm/common.h
+++ b/arch/arm/mach-msm/common.h
@@ -28,6 +28,7 @@ struct msm_mmc_platform_data;
 
 extern void msm_add_devices(void);
 extern void msm_init_irq(void);
+extern void msm_init_vic(uint8_t *irq_to_smsm, int nr);
 extern void msm_init_gpio(void);
 extern int msm_add_sdcc(unsigned int controller,
 			struct msm_mmc_platform_data *plat,
diff --git a/arch/arm/mach-msm/irq-vic.c b/arch/arm/mach-msm/irq-vic.c
index 1b54f807c2d0..33a52f570dae 100644
--- a/arch/arm/mach-msm/irq-vic.c
+++ b/arch/arm/mach-msm/irq-vic.c
@@ -71,15 +71,9 @@ module_param_named(debug_mask, msm_irq_debug_mask, int,
 #define VIC_INT_POLARITY3   VIC_REG(0x005C)  /* 1: NEG, 0: POS */
 #define VIC_NO_PEND_VAL     VIC_REG(0x0060)
 
-#if defined(CONFIG_ARCH_MSM_SCORPION)
 #define VIC_NO_PEND_VAL_FIQ VIC_REG(0x0064)
 #define VIC_INT_MASTEREN    VIC_REG(0x0068)  /* 1: IRQ, 2: FIQ     */
 #define VIC_CONFIG          VIC_REG(0x006C)  /* 1: USE SC VIC */
-#else
-#define VIC_INT_MASTEREN    VIC_REG(0x0064)  /* 1: IRQ, 2: FIQ     */
-#define VIC_PROTECTION      VIC_REG(0x006C)  /* 1: ENABLE          */
-#define VIC_CONFIG          VIC_REG(0x0068)  /* 1: USE ARM1136 VIC */
-#endif
 
 #define VIC_IRQ_STATUS0     VIC_REG(0x0080)
 #define VIC_IRQ_STATUS1     VIC_REG(0x0084)
@@ -105,7 +99,6 @@ module_param_named(debug_mask, msm_irq_debug_mask, int,
 #define VIC_IRQ_VEC_PEND_RD VIC_REG(0x00D4)  /* pending vector addr */
 #define VIC_IRQ_VEC_WR      VIC_REG(0x00D8)
 
-#if defined(CONFIG_ARCH_MSM_SCORPION)
 #define VIC_FIQ_VEC_RD      VIC_REG(0x00DC)
 #define VIC_FIQ_VEC_PEND_RD VIC_REG(0x00E0)
 #define VIC_FIQ_VEC_WR      VIC_REG(0x00E4)
@@ -115,40 +108,11 @@ module_param_named(debug_mask, msm_irq_debug_mask, int,
 #define VIC_FIQ_IN_STACK    VIC_REG(0x00F4)
 #define VIC_TEST_BUS_SEL    VIC_REG(0x00F8)
 #define VIC_IRQ_CTRL_CONFIG VIC_REG(0x00FC)
-#else
-#define VIC_IRQ_IN_SERVICE  VIC_REG(0x00E0)
-#define VIC_IRQ_IN_STACK    VIC_REG(0x00E4)
-#define VIC_TEST_BUS_SEL    VIC_REG(0x00E8)
-#endif
 
 #define VIC_VECTPRIORITY(n) VIC_REG(0x0200+((n) * 4))
 #define VIC_VECTADDR(n)     VIC_REG(0x0400+((n) * 4))
 
-#if defined(CONFIG_ARCH_MSM7X30)
-#define VIC_NUM_REGS	    4
-#else
-#define VIC_NUM_REGS	    2
-#endif
-
-#if VIC_NUM_REGS == 2
-#define DPRINT_REGS(base_reg, format, ...)	      			\
-	printk(KERN_INFO format " %x %x\n", ##__VA_ARGS__,		\
-			readl(base_reg ## 0), readl(base_reg ## 1))
-#define DPRINT_ARRAY(array, format, ...)				\
-	printk(KERN_INFO format " %x %x\n", ##__VA_ARGS__,		\
-			array[0], array[1])
-#elif VIC_NUM_REGS == 4
-#define DPRINT_REGS(base_reg, format, ...) \
-	printk(KERN_INFO format " %x %x %x %x\n", ##__VA_ARGS__,	\
-			readl(base_reg ## 0), readl(base_reg ## 1),	\
-			readl(base_reg ## 2), readl(base_reg ## 3))
-#define DPRINT_ARRAY(array, format, ...)				\
-	printk(KERN_INFO format " %x %x %x %x\n", ##__VA_ARGS__,	\
-			array[0], array[1],				\
-			array[2], array[3])
-#else
-#error "VIC_NUM_REGS set to illegal value"
-#endif
+#define VIC_MAX_REGS	    4
 
 static uint32_t msm_irq_smsm_wake_enable[2];
 static struct {
@@ -156,73 +120,17 @@ static struct {
 	uint32_t int_type;
 	uint32_t int_polarity;
 	uint32_t int_select;
-} msm_irq_shadow_reg[VIC_NUM_REGS];
-static uint32_t msm_irq_idle_disable[VIC_NUM_REGS];
+} msm_irq_shadow_reg[VIC_MAX_REGS];
+static uint32_t msm_irq_idle_disable[VIC_MAX_REGS];
 
 #define SMSM_FAKE_IRQ (0xff)
-static uint8_t msm_irq_to_smsm[NR_IRQS] = {
-	[INT_MDDI_EXT] = 1,
-	[INT_MDDI_PRI] = 2,
-	[INT_MDDI_CLIENT] = 3,
-	[INT_USB_OTG] = 4,
-
-	[INT_PWB_I2C] = 5,
-	[INT_SDC1_0] = 6,
-	[INT_SDC1_1] = 7,
-	[INT_SDC2_0] = 8,
-
-	[INT_SDC2_1] = 9,
-	[INT_ADSP_A9_A11] = 10,
-	[INT_UART1] = 11,
-	[INT_UART2] = 12,
-
-	[INT_UART3] = 13,
-	[INT_UART1_RX] = 14,
-	[INT_UART2_RX] = 15,
-	[INT_UART3_RX] = 16,
-
-	[INT_UART1DM_IRQ] = 17,
-	[INT_UART1DM_RX] = 18,
-	[INT_KEYSENSE] = 19,
-#if !defined(CONFIG_ARCH_MSM7X30)
-	[INT_AD_HSSD] = 20,
-#endif
-
-	[INT_NAND_WR_ER_DONE] = 21,
-	[INT_NAND_OP_DONE] = 22,
-	[INT_TCHSCRN1] = 23,
-	[INT_TCHSCRN2] = 24,
-
-	[INT_TCHSCRN_SSBI] = 25,
-	[INT_USB_HS] = 26,
-	[INT_UART2DM_RX] = 27,
-	[INT_UART2DM_IRQ] = 28,
-
-	[INT_SDC4_1] = 29,
-	[INT_SDC4_0] = 30,
-	[INT_SDC3_1] = 31,
-	[INT_SDC3_0] = 32,
-
-	/* fake wakeup interrupts */
-	[INT_GPIO_GROUP1] = SMSM_FAKE_IRQ,
-	[INT_GPIO_GROUP2] = SMSM_FAKE_IRQ,
-	[INT_A9_M2A_0] = SMSM_FAKE_IRQ,
-	[INT_A9_M2A_1] = SMSM_FAKE_IRQ,
-	[INT_A9_M2A_5] = SMSM_FAKE_IRQ,
-	[INT_GP_TIMER_EXP] = SMSM_FAKE_IRQ,
-	[INT_DEBUG_TIMER_EXP] = SMSM_FAKE_IRQ,
-	[INT_ADSP_A11] = SMSM_FAKE_IRQ,
-#ifdef CONFIG_ARCH_QSD8X50
-	[INT_SIRC_0] = SMSM_FAKE_IRQ,
-	[INT_SIRC_1] = SMSM_FAKE_IRQ,
-#endif
-};
+static uint8_t *msm_irq_to_smsm;
 
-static inline void msm_irq_write_all_regs(void __iomem *base, unsigned int val)
+static inline void msm_irq_write_all_regs(void __iomem *base, unsigned int val, int num)
 {
 	int i;
 
-	for (i = 0; i < VIC_NUM_REGS; i++)
+	for (i = 0; i < num; i++)
 		writel(val, base + (i * 4));
 }
 
@@ -334,21 +242,22 @@ static struct irq_chip msm_irq_chip = {
 	.irq_set_type  = msm_irq_set_type,
 };
 
-void __init msm_init_irq(void)
+void __init msm_init_vic(uint8_t *irq_to_smsm, int nr)
 {
 	unsigned n;
+	msm_irq_to_smsm = irq_to_smsm;
 
 	/* select level interrupts */
-	msm_irq_write_all_regs(VIC_INT_TYPE0, 0);
+	msm_irq_write_all_regs(VIC_INT_TYPE0, 0, nr / 32);
 
 	/* select highlevel interrupts */
-	msm_irq_write_all_regs(VIC_INT_POLARITY0, 0);
+	msm_irq_write_all_regs(VIC_INT_POLARITY0, 0, nr / 32);
 
 	/* select IRQ for all INTs */
-	msm_irq_write_all_regs(VIC_INT_SELECT0, 0);
+	msm_irq_write_all_regs(VIC_INT_SELECT0, 0, nr / 32);
 
 	/* disable all INTs */
-	msm_irq_write_all_regs(VIC_INT_EN0, 0);
+	msm_irq_write_all_regs(VIC_INT_EN0, 0, nr / 32);
 
 	/* don't use vic */
 	writel(0, VIC_CONFIG);
@@ -356,7 +265,7 @@ void __init msm_init_irq(void)
 	/* enable interrupt controller */
 	writel(3, VIC_INT_MASTEREN);
 
-	for (n = 0; n < NR_MSM_IRQS; n++) {
+	for (n = 0; n < nr; n++) {
 		irq_set_chip_and_handler(n, &msm_irq_chip, handle_level_irq);
 		set_irq_flags(n, IRQF_VALID);
 	}
-- 
2.1.0.rc2

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RFC PATCH 10/18] gpio: move msm-v1 driver to mach-msm
  2015-03-04 19:32 [RFC PATCH 00/18] ARM: msm multiplatform support Arnd Bergmann
                   ` (8 preceding siblings ...)
  2015-03-04 19:33 ` [RFC PATCH 09/18] ARM: msm: fix vic irqchip " Arnd Bergmann
@ 2015-03-04 19:33 ` Arnd Bergmann
  2015-03-09 16:10   ` Linus Walleij
  2015-03-04 19:33 ` [RFC PATCH 11/18] clocksource: qcom: make mach-msm and mach-qcom coexist Arnd Bergmann
                   ` (11 subsequent siblings)
  21 siblings, 1 reply; 36+ messages in thread
From: Arnd Bergmann @ 2015-03-04 19:33 UTC (permalink / raw)
  To: linux-arm-kernel

The msm gpio driver uses the gpiomux infrastructure that
relies on platform specific internals. We should really
use a proper pinmux driver here, but for now, the easiest
solution is to move it into mach-msm to get rid of the
header file dependency.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-msm/Makefile                        | 2 ++
 {drivers/gpio => arch/arm/mach-msm}/gpio-msm-v1.c | 0
 drivers/gpio/Kconfig                              | 8 --------
 drivers/gpio/Makefile                             | 1 -
 4 files changed, 2 insertions(+), 9 deletions(-)
 rename {drivers/gpio => arch/arm/mach-msm}/gpio-msm-v1.c (100%)

diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile
index bab22a179c47..eb0fa4bf7f36 100644
--- a/arch/arm/mach-msm/Makefile
+++ b/arch/arm/mach-msm/Makefile
@@ -7,6 +7,8 @@ obj-$(CONFIG_ARCH_QSD8X50) += sirc.o
 
 obj-$(CONFIG_MSM_PROC_COMM) += proc_comm.o clock-pcom.o vreg.o
 
+obj-$(CONFIG_ARCH_MSM) += gpio-msm-v1.o
+
 obj-$(CONFIG_MSM_SMD) += smd.o smd_debug.o
 obj-$(CONFIG_MSM_SMD) += last_radio_log.o
 
diff --git a/drivers/gpio/gpio-msm-v1.c b/arch/arm/mach-msm/gpio-msm-v1.c
similarity index 100%
rename from drivers/gpio/gpio-msm-v1.c
rename to arch/arm/mach-msm/gpio-msm-v1.c
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 2ebc124e1217..00c489f31d9d 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -223,14 +223,6 @@ config GPIO_MPC8XXX
 	  Say Y here if you're going to use hardware that connects to the
 	  MPC512x/831x/834x/837x/8572/8610 GPIOs.
 
-config GPIO_MSM_V1
-	tristate "Qualcomm MSM GPIO v1"
-	depends on GPIOLIB && ARCH_MSM && (ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50)
-	help
-	  Say yes here to support the GPIO interface on ARM v6 based
-	  Qualcomm MSM chips.  Most of the pins on the MSM can be
-	  selected for GPIO, and are controlled by this driver.
-
 config GPIO_MSM_V2
 	tristate "Qualcomm MSM GPIO v2"
 	depends on GPIOLIB && OF && ARCH_QCOM
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 0e48e5d89d63..b2fb21036655 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -58,7 +58,6 @@ obj-$(CONFIG_GPIO_MOXART)	+= gpio-moxart.o
 obj-$(CONFIG_GPIO_MPC5200)	+= gpio-mpc5200.o
 obj-$(CONFIG_GPIO_MPC8XXX)	+= gpio-mpc8xxx.o
 obj-$(CONFIG_GPIO_MSIC)		+= gpio-msic.o
-obj-$(CONFIG_GPIO_MSM_V1)	+= gpio-msm-v1.o
 obj-$(CONFIG_GPIO_MSM_V2)	+= gpio-msm-v2.o
 obj-$(CONFIG_GPIO_MVEBU)        += gpio-mvebu.o
 obj-$(CONFIG_GPIO_MXC)		+= gpio-mxc.o
-- 
2.1.0.rc2

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RFC PATCH 11/18] clocksource: qcom: make mach-msm and mach-qcom coexist
  2015-03-04 19:32 [RFC PATCH 00/18] ARM: msm multiplatform support Arnd Bergmann
                   ` (9 preceding siblings ...)
  2015-03-04 19:33 ` [RFC PATCH 10/18] gpio: move msm-v1 driver to mach-msm Arnd Bergmann
@ 2015-03-04 19:33 ` Arnd Bergmann
  2015-03-04 19:33 ` [RFC PATCH 12/18] ARM: msm: make smd behave like a normal driver Arnd Bergmann
                   ` (10 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnd Bergmann @ 2015-03-04 19:33 UTC (permalink / raw)
  To: linux-arm-kernel

The driver uses #if/#else to decide which initialization code
should be used, which of course breaks if we have both in
the same kernel.

This changes the #else path to check for ARCH_MSM.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/clocksource/qcom-timer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clocksource/qcom-timer.c b/drivers/clocksource/qcom-timer.c
index 098c542e5c53..48c8df62f49a 100644
--- a/drivers/clocksource/qcom-timer.c
+++ b/drivers/clocksource/qcom-timer.c
@@ -285,8 +285,9 @@ static void __init msm_dt_timer_init(struct device_node *np)
 }
 CLOCKSOURCE_OF_DECLARE(kpss_timer, "qcom,kpss-timer", msm_dt_timer_init);
 CLOCKSOURCE_OF_DECLARE(scss_timer, "qcom,scss-timer", msm_dt_timer_init);
-#else
+#endif
 
+#ifdef CONFIG_ARCH_MSM
 static int __init msm_timer_map(phys_addr_t addr, u32 event, u32 source,
 				u32 sts)
 {
-- 
2.1.0.rc2

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RFC PATCH 12/18] ARM: msm: make smd behave like a normal driver
  2015-03-04 19:32 [RFC PATCH 00/18] ARM: msm multiplatform support Arnd Bergmann
                   ` (10 preceding siblings ...)
  2015-03-04 19:33 ` [RFC PATCH 11/18] clocksource: qcom: make mach-msm and mach-qcom coexist Arnd Bergmann
@ 2015-03-04 19:33 ` Arnd Bergmann
  2015-03-04 19:33 ` [RFC PATCH 13/18] ARM: msm: rename conflicting symbols Arnd Bergmann
                   ` (9 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnd Bergmann @ 2015-03-04 19:33 UTC (permalink / raw)
  To: linux-arm-kernel

The smd driver is registered as a platform driver with a probe
function, but hardcodes soc-specific interrupts and other settings
at compile-time, which gets in the way of reusing the same driver
on multiple machines.

This changes all compile-time configuration in the smd driver
to runtime configuration from platform device resources and
the platform device id, like we do for other drivers.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-msm/Makefile          |   5 +-
 arch/arm/mach-msm/board-halibut.c   |   6 --
 arch/arm/mach-msm/board-msm7x30.c   |   8 ---
 arch/arm/mach-msm/board-qsd8x50.c   |   7 --
 arch/arm/mach-msm/board-sapphire.c  |   6 --
 arch/arm/mach-msm/board-trout.c     |   6 --
 arch/arm/mach-msm/common.h          |   6 --
 arch/arm/mach-msm/devices-msm7x00.c |  11 ++-
 arch/arm/mach-msm/devices-msm7x30.c |  18 ++++-
 arch/arm/mach-msm/devices-qsd8x50.c |  11 ++-
 arch/arm/mach-msm/last_radio_log.c  |   1 -
 arch/arm/mach-msm/proc_comm.c       |  10 +--
 arch/arm/mach-msm/proc_comm.h       |   2 +
 arch/arm/mach-msm/smd.c             | 127 ++++++++++++++++----------------
 arch/arm/mach-msm/smd_debug.c       | 140 ++++++++++++------------------------
 arch/arm/mach-msm/smd_private.h     |  65 +++++++----------
 16 files changed, 173 insertions(+), 256 deletions(-)

diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile
index eb0fa4bf7f36..59ef46a881ea 100644
--- a/arch/arm/mach-msm/Makefile
+++ b/arch/arm/mach-msm/Makefile
@@ -9,8 +9,9 @@ obj-$(CONFIG_MSM_PROC_COMM) += proc_comm.o clock-pcom.o vreg.o
 
 obj-$(CONFIG_ARCH_MSM) += gpio-msm-v1.o
 
-obj-$(CONFIG_MSM_SMD) += smd.o smd_debug.o
-obj-$(CONFIG_MSM_SMD) += last_radio_log.o
+obj-$(CONFIG_MSM_SMD) += msm-smd.o
+msm-smd-y += smd.o last_radio_log.o
+msm-smd-$(CONFIG_DEBUG_FS) += smd_debug.o
 
 obj-$(CONFIG_MACH_TROUT) += board-trout.o board-trout-gpio.o board-trout-mmc.o devices-msm7x00.o
 obj-$(CONFIG_MACH_TROUT) += board-trout.o board-trout-gpio.o board-trout-mmc.o board-trout-panel.o devices-msm7x00.o
diff --git a/arch/arm/mach-msm/board-halibut.c b/arch/arm/mach-msm/board-halibut.c
index 1b62427ad5ed..1b6d64196631 100644
--- a/arch/arm/mach-msm/board-halibut.c
+++ b/arch/arm/mach-msm/board-halibut.c
@@ -88,17 +88,11 @@ static void __init halibut_map_io(void)
 	msm_map_common_io();
 }
 
-static void __init halibut_init_late(void)
-{
-	smd_debugfs_init();
-}
-
 MACHINE_START(HALIBUT, "Halibut Board (QCT SURF7200A)")
 	.atag_offset	= 0x100,
 	.map_io		= halibut_map_io,
 	.init_early	= halibut_init_early,
 	.init_irq	= halibut_init_irq,
 	.init_machine	= halibut_init,
-	.init_late	= halibut_init_late,
 	.init_time	= msm7x01_timer_init,
 MACHINE_END
diff --git a/arch/arm/mach-msm/board-msm7x30.c b/arch/arm/mach-msm/board-msm7x30.c
index 4718a661306e..295d7c03e53f 100644
--- a/arch/arm/mach-msm/board-msm7x30.c
+++ b/arch/arm/mach-msm/board-msm7x30.c
@@ -206,11 +206,6 @@ static void __init msm7x30_map_io(void)
 	msm_map_msm7x30_io();
 }
 
-static void __init msm7x30_init_late(void)
-{
-	smd_debugfs_init();
-}
-
 MACHINE_START(MSM7X30_SURF, "QCT MSM7X30 SURF")
 	.atag_offset = 0x100,
 	.fixup = msm7x30_fixup,
@@ -218,7 +213,6 @@ MACHINE_START(MSM7X30_SURF, "QCT MSM7X30 SURF")
 	.map_io = msm7x30_map_io,
 	.init_irq = msm7x30_init_irq,
 	.init_machine = msm7x30_init,
-	.init_late = msm7x30_init_late,
 	.init_time	= msm7x30_timer_init,
 MACHINE_END
 
@@ -229,7 +223,6 @@ MACHINE_START(MSM7X30_FFA, "QCT MSM7X30 FFA")
 	.map_io = msm7x30_map_io,
 	.init_irq = msm7x30_init_irq,
 	.init_machine = msm7x30_init,
-	.init_late = msm7x30_init_late,
 	.init_time	= msm7x30_timer_init,
 MACHINE_END
 
@@ -240,6 +233,5 @@ MACHINE_START(MSM7X30_FLUID, "QCT MSM7X30 FLUID")
 	.map_io = msm7x30_map_io,
 	.init_irq = msm7x30_init_irq,
 	.init_machine = msm7x30_init,
-	.init_late = msm7x30_init_late,
 	.init_time	= msm7x30_timer_init,
 MACHINE_END
diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c
index ff458806785b..7bd36b9908c8 100644
--- a/arch/arm/mach-msm/board-qsd8x50.c
+++ b/arch/arm/mach-msm/board-qsd8x50.c
@@ -293,17 +293,11 @@ static void __init qsd8x50_init(void)
 	qsd8x50_init_mmc();
 }
 
-static void __init qsd8x50_init_late(void)
-{
-	smd_debugfs_init();
-}
-
 MACHINE_START(QSD8X50_SURF, "QCT QSD8X50 SURF")
 	.atag_offset = 0x100,
 	.map_io = msm_map_qsd8x50_io,
 	.init_irq = qsd8x50_init_irq,
 	.init_machine = qsd8x50_init,
-	.init_late = qsd8x50_init_late,
 	.init_time	= qsd8x50_timer_init,
 MACHINE_END
 
@@ -319,7 +313,6 @@ MACHINE_START(QSD8X50A_ST1_5, "QCT QSD8X50A ST1.5")
 	.map_io = msm_map_qsd8x50_io_rev_a,
 	.init_irq = qsd8x50_init_irq_rev_a,
 	.init_machine = qsd8x50_init,
-	.init_late = qsd8x50_init_late,
 	.init_time	= qsd8x50_timer_init,
 MACHINE_END
 #endif
diff --git a/arch/arm/mach-msm/board-sapphire.c b/arch/arm/mach-msm/board-sapphire.c
index e50967926dcd..e3aa71e839f4 100644
--- a/arch/arm/mach-msm/board-sapphire.c
+++ b/arch/arm/mach-msm/board-sapphire.c
@@ -97,11 +97,6 @@ static void __init sapphire_map_io(void)
 	msm_clock_init();
 }
 
-static void __init sapphire_init_late(void)
-{
-	smd_debugfs_init();
-}
-
 MACHINE_START(SAPPHIRE, "sapphire")
 /* Maintainer: Brian Swetland <swetland@google.com> */
 	.atag_offset    = 0x100,
@@ -109,6 +104,5 @@ MACHINE_START(SAPPHIRE, "sapphire")
 	.map_io         = sapphire_map_io,
 	.init_irq       = sapphire_init_irq,
 	.init_machine   = sapphire_init,
-	.init_late      = sapphire_init_late,
 	.init_time	= msm_timer_init,
 MACHINE_END
diff --git a/arch/arm/mach-msm/board-trout.c b/arch/arm/mach-msm/board-trout.c
index 7c1b06fa9a76..e1c6e8528150 100644
--- a/arch/arm/mach-msm/board-trout.c
+++ b/arch/arm/mach-msm/board-trout.c
@@ -94,11 +94,6 @@ static void __init trout_map_io(void)
 #endif
 }
 
-static void __init trout_init_late(void)
-{
-	smd_debugfs_init();
-}
-
 MACHINE_START(TROUT, "HTC Dream")
 	.atag_offset	= 0x100,
 	.fixup		= trout_fixup,
@@ -106,6 +101,5 @@ MACHINE_START(TROUT, "HTC Dream")
 	.init_early	= trout_init_early,
 	.init_irq	= trout_init_irq,
 	.init_machine	= trout_init,
-	.init_late	= trout_init_late,
 	.init_time	= msm7x01_timer_init,
 MACHINE_END
diff --git a/arch/arm/mach-msm/common.h b/arch/arm/mach-msm/common.h
index 7e4ddfdf4fe8..3c5214057657 100644
--- a/arch/arm/mach-msm/common.h
+++ b/arch/arm/mach-msm/common.h
@@ -34,10 +34,4 @@ extern int msm_add_sdcc(unsigned int controller,
 			struct msm_mmc_platform_data *plat,
 			unsigned int stat_irq, unsigned long stat_irq_flags);
 
-#if defined(CONFIG_MSM_SMD) && defined(CONFIG_DEBUG_FS)
-extern int smd_debugfs_init(void);
-#else
-static inline int smd_debugfs_init(void) { return 0; }
-#endif
-
 #endif
diff --git a/arch/arm/mach-msm/devices-msm7x00.c b/arch/arm/mach-msm/devices-msm7x00.c
index dc0ea895568b..1bac32b690cf 100644
--- a/arch/arm/mach-msm/devices-msm7x00.c
+++ b/arch/arm/mach-msm/devices-msm7x00.c
@@ -247,9 +247,16 @@ struct platform_device msm_device_nand = {
 	},
 };
 
+static struct resource resources_smd[] = {
+	DEFINE_RES_IRQ(INT_A9_M2A_0),
+	DEFINE_RES_IRQ(INT_A9_M2A_5),
+};
+
 struct platform_device msm_device_smd = {
-	.name	= "msm_smd",
-	.id	= -1,
+	.name		= "msm7x00_smd",
+	.id		= -1,
+	.num_resources	= ARRAY_SIZE(resources_smd),
+	.resource	= resources_smd,
 };
 
 static struct resource resources_sdc1[] = {
diff --git a/arch/arm/mach-msm/devices-msm7x30.c b/arch/arm/mach-msm/devices-msm7x30.c
index 824e0d86b93f..f4ff40caac27 100644
--- a/arch/arm/mach-msm/devices-msm7x30.c
+++ b/arch/arm/mach-msm/devices-msm7x30.c
@@ -30,6 +30,7 @@
 
 #include "clock.h"
 #include "clock-pcom.h"
+#include "proc_comm.h"
 
 #include <linux/platform_data/mmc-msm_sdcc.h>
 
@@ -55,10 +56,16 @@ static struct map_desc msm7x30_io_desc[] __initdata = {
 	},
 };
 
+static void msm_a2m_int_msm7x00(uint32_t irq)
+{
+	writel(1 << irq, MSM_GCC_BASE + 0x8);
+}
+
 void __init msm_map_msm7x30_io(void)
 {
 	debug_ll_io_init();
 	iotable_init(msm7x30_io_desc, ARRAY_SIZE(msm7x30_io_desc));
+	msm_a2m_int = msm_a2m_int_msm7x00;
 }
 
 static struct resource msm_gpio_resources[] = {
@@ -113,9 +120,16 @@ struct platform_device msm_device_uart2 = {
 	.resource	= resources_uart2,
 };
 
+static struct resource resources_smd[] = {
+	DEFINE_RES_IRQ(INT_A9_M2A_0),
+	DEFINE_RES_IRQ(INT_A9_M2A_5),
+};
+
 struct platform_device msm_device_smd = {
-	.name   = "msm_smd",
-	.id     = -1,
+	.name   	= "msm_smd",
+	.id     	= -1,
+	.num_resources	= ARRAY_SIZE(resources_smd),
+	.resource	= resources_smd,
 };
 
 static struct resource resources_otg[] = {
diff --git a/arch/arm/mach-msm/devices-qsd8x50.c b/arch/arm/mach-msm/devices-qsd8x50.c
index f80a8efee126..5dcf17a24d70 100644
--- a/arch/arm/mach-msm/devices-qsd8x50.c
+++ b/arch/arm/mach-msm/devices-qsd8x50.c
@@ -130,9 +130,16 @@ struct platform_device msm_device_uart3 = {
 	.resource	= resources_uart3,
 };
 
+static struct resource resources_smd[] = {
+	DEFINE_RES_IRQ(INT_A9_M2A_0),
+	DEFINE_RES_IRQ(INT_A9_M2A_5),
+};
+
 struct platform_device msm_device_smd = {
-	.name   = "msm_smd",
-	.id     = -1,
+	.name		= "msm_smd",
+	.id		= -1,
+	.num_resources	= ARRAY_SIZE(resources_smd),
+	.resource	= resources_smd,
 };
 
 static struct resource resources_otg[] = {
diff --git a/arch/arm/mach-msm/last_radio_log.c b/arch/arm/mach-msm/last_radio_log.c
index 9c392a29fc7e..7fd9fbde2025 100644
--- a/arch/arm/mach-msm/last_radio_log.c
+++ b/arch/arm/mach-msm/last_radio_log.c
@@ -68,4 +68,3 @@ void msm_init_last_radio_log(struct module *owner)
 	last_radio_log_fops.owner = owner;
 	proc_set_size(entry, radio_log_size);
 }
-EXPORT_SYMBOL(msm_init_last_radio_log);
diff --git a/arch/arm/mach-msm/proc_comm.c b/arch/arm/mach-msm/proc_comm.c
index 507f5ca80697..f79f57d7a0dd 100644
--- a/arch/arm/mach-msm/proc_comm.c
+++ b/arch/arm/mach-msm/proc_comm.c
@@ -22,14 +22,14 @@
 
 #include "proc_comm.h"
 
-static inline void msm_a2m_int(uint32_t irq)
+/* msm7x00 uses a different method and needs to override
+ * this function
+ */
+static void msm_a2m_int_scorpion(uint32_t irq)
 {
-#if defined(CONFIG_ARCH_MSM7X30)
-	writel(1 << irq, MSM_GCC_BASE + 0x8);
-#else
 	writel(1, MSM_CSR_BASE + 0x400 + (irq * 4));
-#endif
 }
+void (*msm_a2m_int)(uint32_t irq) = msm_a2m_int_scorpion;
 
 static inline void notify_other_proc_comm(void)
 {
diff --git a/arch/arm/mach-msm/proc_comm.h b/arch/arm/mach-msm/proc_comm.h
index e8d043a0e990..a0224327e8c7 100644
--- a/arch/arm/mach-msm/proc_comm.h
+++ b/arch/arm/mach-msm/proc_comm.h
@@ -255,4 +255,6 @@ enum {
 int msm_proc_comm(unsigned cmd, unsigned *data1, unsigned *data2);
 void proc_comm_boot_wait(void);
 
+extern void (*msm_a2m_int)(uint32_t irq);
+
 #endif
diff --git a/arch/arm/mach-msm/smd.c b/arch/arm/mach-msm/smd.c
index 7550f5a08956..b87f183a86c5 100644
--- a/arch/arm/mach-msm/smd.c
+++ b/arch/arm/mach-msm/smd.c
@@ -34,9 +34,21 @@
 #include "smd_private.h"
 #include "proc_comm.h"
 
-#if defined(CONFIG_ARCH_QSD8X50)
-#define CONFIG_QDSP6 1
-#endif
+enum msm_smd_version {
+	SMD_MSM7X00,
+	SMD_MSM7X30,
+	SMD_QSD8X50,
+} smd_version;
+
+#define SMSM_STATE_APPS (smd_version == SMD_MSM7X00 ? \
+	MSM7X00_SMSM_STATE_APPS : SCORPION_SMSM_STATE_APPS)
+
+#define SMSM_STATE_MODEM (smd_version == SMD_MSM7X00 ? \
+	MSM7X00_SMSM_STATE_MODEM : SCORPION_SMSM_STATE_MODEM)
+
+#define SMSM_STATE_COUNT \
+	(MSM7X00_SMSM_STATE_COUNT > SCORPION_SMSM_STATE_COUNT ? \
+	 MSM7X00_SMSM_STATE_COUNT : SCORPION_SMSM_STATE_COUNT)
 
 #define MODULE_NAME "msm_smd"
 
@@ -67,9 +79,8 @@ static unsigned last_heap_free = 0xffffffff;
 static inline void notify_other_smsm(void)
 {
 	msm_a2m_int(5);
-#ifdef CONFIG_QDSP6
-	msm_a2m_int(8);
-#endif
+	if (smd_version == SMD_QSD8X50)
+		msm_a2m_int(8);
 }
 
 static inline void notify_modem_smd(void)
@@ -374,13 +385,11 @@ static irqreturn_t smd_modem_irq_handler(int irq, void *data)
 	return IRQ_HANDLED;
 }
 
-#if defined(CONFIG_QDSP6)
 static irqreturn_t smd_dsp_irq_handler(int irq, void *data)
 {
 	handle_smd_irq(&smd_ch_list_dsp, notify_dsp_smd);
 	return IRQ_HANDLED;
 }
-#endif
 
 static void smd_fake_irq_handler(unsigned long arg)
 {
@@ -553,6 +562,7 @@ static int smd_packet_read(smd_channel_t *ch, void *data, int len)
 static int smd_alloc_channel(const char *name, uint32_t cid, uint32_t type)
 {
 	struct smd_channel *ch;
+	int ret;
 
 	ch = kzalloc(sizeof(struct smd_channel), GFP_KERNEL);
 	if (ch == 0) {
@@ -561,7 +571,12 @@ static int smd_alloc_channel(const char *name, uint32_t cid, uint32_t type)
 	}
 	ch->n = cid;
 
-	if (_smd_alloc_channel(ch)) {
+	if (smd_version == SMD_MSM7X00)
+		ret = _smd_alloc_channel_pkg3(ch);
+	else
+		ret = _smd_alloc_channel_pkg4(ch);
+
+	if (ret) {
 		kfree(ch);
 		return -1;
 	}
@@ -892,48 +907,12 @@ uint32_t smsm_get_state(enum smsm_state_item item)
 	return rv;
 }
 
-#ifdef CONFIG_ARCH_MSM_SCORPION
-
-int smsm_set_sleep_duration(uint32_t delay)
-{
-	struct msm_dem_slave_data *ptr;
-
-	ptr = smem_find(SMEM_APPS_DEM_SLAVE_DATA, sizeof(*ptr));
-	if (ptr == NULL) {
-		pr_err("smsm_set_sleep_duration <SM NO APPS_DEM_SLAVE_DATA>\n");
-		return -EIO;
-	}
-	if (msm_smd_debug_mask & MSM_SMSM_DEBUG)
-		pr_info("smsm_set_sleep_duration %d -> %d\n",
-		       ptr->sleep_time, delay);
-	ptr->sleep_time = delay;
-	return 0;
-}
-
-#else
-
-int smsm_set_sleep_duration(uint32_t delay)
-{
-	uint32_t *ptr;
-
-	ptr = smem_find(SMEM_SMSM_SLEEP_DELAY, sizeof(*ptr));
-	if (ptr == NULL) {
-		pr_err("smsm_set_sleep_duration <SM NO SLEEP_DELAY>\n");
-		return -EIO;
-	}
-	if (msm_smd_debug_mask & MSM_SMSM_DEBUG)
-		pr_info("smsm_set_sleep_duration %d -> %d\n",
-		       *ptr, delay);
-	*ptr = delay;
-	return 0;
-}
-
-#endif
-
-int smd_core_init(void)
+static int smd_core_init(int version, int irq_a9_m2a_0, int irq_a9_m2a_5, int irq_adsp_a11)
 {
 	int r;
 
+	smd_version = version;
+
 	/* wait for essential items to be initialized */
 	for (;;) {
 		unsigned size;
@@ -947,33 +926,33 @@ int smd_core_init(void)
 
 	smd_info.ready = 1;
 
-	r = request_irq(INT_A9_M2A_0, smd_modem_irq_handler,
+	r = request_irq(irq_a9_m2a_0, smd_modem_irq_handler,
 			IRQF_TRIGGER_RISING, "smd_dev", 0);
 	if (r < 0)
 		return r;
-	r = enable_irq_wake(INT_A9_M2A_0);
+	r = enable_irq_wake(irq_a9_m2a_0);
 	if (r < 0)
 		pr_err("smd_core_init: enable_irq_wake failed for A9_M2A_0\n");
 
-	r = request_irq(INT_A9_M2A_5, smsm_irq_handler,
+	r = request_irq(irq_a9_m2a_5, smsm_irq_handler,
 			IRQF_TRIGGER_RISING, "smsm_dev", 0);
 	if (r < 0) {
-		free_irq(INT_A9_M2A_0, 0);
+		free_irq(irq_a9_m2a_0, 0);
 		return r;
 	}
-	r = enable_irq_wake(INT_A9_M2A_5);
+	r = enable_irq_wake(irq_a9_m2a_5);
 	if (r < 0)
 		pr_err("smd_core_init: enable_irq_wake failed for A9_M2A_5\n");
 
-#if defined(CONFIG_QDSP6)
-	r = request_irq(INT_ADSP_A11, smd_dsp_irq_handler,
-			IRQF_TRIGGER_RISING, "smd_dsp", 0);
-	if (r < 0) {
-		free_irq(INT_A9_M2A_0, 0);
-		free_irq(INT_A9_M2A_5, 0);
-		return r;
+	if (smd_version == SMD_QSD8X50) {
+		r = request_irq(irq_adsp_a11, smd_dsp_irq_handler,
+				IRQF_TRIGGER_RISING, "smd_dsp", 0);
+		if (r < 0) {
+			free_irq(irq_a9_m2a_0, 0);
+			free_irq(irq_a9_m2a_5, 0);
+			return r;
+		}
 	}
-#endif
 
 	/* check for any SMD channels that may already exist */
 	do_smd_probe();
@@ -981,15 +960,16 @@ int smd_core_init(void)
 	/* indicate that we're up and running */
 	smsm_change_state(SMSM_STATE_APPS,
 			  ~0, SMSM_INIT | SMSM_SMDINIT | SMSM_RPCINIT | SMSM_RUN);
-#ifdef CONFIG_ARCH_MSM_SCORPION
-	smsm_change_state(SMSM_STATE_APPS_DEM, ~0, 0);
-#endif
+	if (smd_version != SMD_MSM7X00)
+		smsm_change_state(SCORPION_SMSM_STATE_APPS_DEM, ~0, 0);
 
 	return 0;
 }
 
 static int msm_smd_probe(struct platform_device *pdev)
 {
+	int ret;
+
 	/*
 	 * If we haven't waited for the ARM9 to boot up till now,
 	 * then we need to wait here. Otherwise this should just
@@ -999,9 +979,14 @@ static int msm_smd_probe(struct platform_device *pdev)
 
 	INIT_WORK(&probe_work, smd_channel_probe_worker);
 
-	if (smd_core_init()) {
+	ret = smd_core_init(pdev->id_entry->driver_data,
+			    platform_get_irq(pdev, 0),
+			    platform_get_irq(pdev, 1),
+			    platform_get_irq(pdev, 2));
+
+	if (ret) {
 		pr_err("smd_core_init() failed\n");
-		return -1;
+		return ret;
 	}
 
 	do_smd_probe();
@@ -1010,13 +995,23 @@ static int msm_smd_probe(struct platform_device *pdev)
 
 	msm_init_last_radio_log(THIS_MODULE);
 
+	smd_debugfs_init(pdev->id_entry->driver_data != SMD_MSM7X00);
+
 	smd_initialized = 1;
 
 	return 0;
 }
 
+struct platform_device_id msm_smd_id_table[] = {
+	{ "msm7x00_smd", SMD_MSM7X00 },
+	{ "msm7x30_smd", SMD_MSM7X00 },
+	{ "qsd8x50_smd", SMD_QSD8X50 },
+	{}
+};
+
 static struct platform_driver msm_smd_driver = {
 	.probe = msm_smd_probe,
+	.id_table = msm_smd_id_table,
 	.driver = {
 		.name = MODULE_NAME,
 	},
diff --git a/arch/arm/mach-msm/smd_debug.c b/arch/arm/mach-msm/smd_debug.c
index 8056b3e5590f..daffcc9e802d 100644
--- a/arch/arm/mach-msm/smd_debug.c
+++ b/arch/arm/mach-msm/smd_debug.c
@@ -21,8 +21,6 @@
 
 #include "smd_private.h"
 
-#if defined(CONFIG_DEBUG_FS)
-
 static char *chstate(unsigned n)
 {
 	switch (n) {
@@ -76,33 +74,56 @@ static int dump_ch(char *buf, int max, struct smd_channel *ch)
 		);
 }
 
-static int debug_read_stat(char *buf, int max)
+static int debug_read_stat_common(char *buf, int max)
 {
 	char *msg;
-	int i = 0;
 
 	msg = smem_find(ID_DIAG_ERR_MSG, SZ_DIAG_ERR_MSG);
+	if (!msg)
+		return 0;
+
+	msg[SZ_DIAG_ERR_MSG - 1] = 0;
+	return scnprintf(buf, max, "diag: '%s'\n", msg);
+}
+
+static int debug_read_stat_msm7x00(char *buf, int max)
+{
+	int i = 0;
+
+	if (raw_smsm_get_state(MSM7X00_SMSM_STATE_MODEM) & SMSM_RESET)
+		i += scnprintf(buf + i, max - i,
+			       "smsm: ARM9 HAS CRASHED\n");
+
+	i += scnprintf(buf + i, max - i, "smsm: a9: %08x a11: %08x\n",
+		       raw_smsm_get_state(MSM7X00_SMSM_STATE_MODEM),
+		       raw_smsm_get_state(MSM7X00_SMSM_STATE_APPS));
+
+	i += debug_read_stat_common(buf + i, max - i);
+
+	return i;
+}
+
+static int debug_read_stat_scorpion(char *buf, int max)
+{
+	int i = 0;
 
-	if (raw_smsm_get_state(SMSM_STATE_MODEM) & SMSM_RESET)
+	if (raw_smsm_get_state(SCORPION_SMSM_STATE_MODEM) & SMSM_RESET)
 		i += scnprintf(buf + i, max - i,
 			       "smsm: ARM9 HAS CRASHED\n");
 
 	i += scnprintf(buf + i, max - i, "smsm: a9: %08x a11: %08x\n",
-		       raw_smsm_get_state(SMSM_STATE_MODEM),
-		       raw_smsm_get_state(SMSM_STATE_APPS));
-#ifdef CONFIG_ARCH_MSM_SCORPION
+		       raw_smsm_get_state(SCORPION_SMSM_STATE_MODEM),
+		       raw_smsm_get_state(SCORPION_SMSM_STATE_APPS));
 	i += scnprintf(buf + i, max - i, "smsm dem: apps: %08x modem: %08x "
 		       "qdsp6: %08x power: %08x time: %08x\n",
-		       raw_smsm_get_state(SMSM_STATE_APPS_DEM),
-		       raw_smsm_get_state(SMSM_STATE_MODEM_DEM),
-		       raw_smsm_get_state(SMSM_STATE_QDSP6_DEM),
-		       raw_smsm_get_state(SMSM_STATE_POWER_MASTER_DEM),
-		       raw_smsm_get_state(SMSM_STATE_TIME_MASTER_DEM));
-#endif
-	if (msg) {
-		msg[SZ_DIAG_ERR_MSG - 1] = 0;
-		i += scnprintf(buf + i, max - i, "diag: '%s'\n", msg);
-	}
+		       raw_smsm_get_state(SCORPION_SMSM_STATE_APPS_DEM),
+		       raw_smsm_get_state(SCORPION_SMSM_STATE_MODEM_DEM),
+		       raw_smsm_get_state(SCORPION_SMSM_STATE_QDSP6_DEM),
+		       raw_smsm_get_state(SCORPION_SMSM_STATE_POWER_MASTER_DEM),
+		       raw_smsm_get_state(SCORPION_SMSM_STATE_TIME_MASTER_DEM));
+
+	i += debug_read_stat_common(buf + i, max - i);
+
 	return i;
 }
 
@@ -216,7 +237,7 @@ static void debug_create(const char *name, umode_t mode,
 	debugfs_create_file(name, mode, dent, fill, &debug_ops);
 }
 
-int __init smd_debugfs_init(void)
+int smd_debugfs_init(bool is_scorpion)
 {
 	struct dentry *dent;
 
@@ -225,7 +246,10 @@ int __init smd_debugfs_init(void)
 		return 1;
 
 	debug_create("ch", 0444, dent, debug_read_ch);
-	debug_create("stat", 0444, dent, debug_read_stat);
+	if (is_scorpion)
+		debug_create("stat", 0444, dent, debug_read_stat_scorpion);
+	else
+		debug_create("stat", 0444, dent, debug_read_stat_msm7x00);
 	debug_create("mem", 0444, dent, debug_read_mem);
 	debug_create("version", 0444, dent, debug_read_version);
 	debug_create("tbl", 0444, dent, debug_read_alloc_tbl);
@@ -233,79 +257,3 @@ int __init smd_debugfs_init(void)
 
 	return 0;
 }
-
-#endif
-
-
-#define MAX_NUM_SLEEP_CLIENTS		64
-#define MAX_SLEEP_NAME_LEN		8
-
-#define NUM_GPIO_INT_REGISTERS		6
-#define GPIO_SMEM_NUM_GROUPS		2
-#define GPIO_SMEM_MAX_PC_INTERRUPTS	8
-
-struct tramp_gpio_save {
-	unsigned int enable;
-	unsigned int detect;
-	unsigned int polarity;
-};
-
-struct tramp_gpio_smem {
-	uint16_t num_fired[GPIO_SMEM_NUM_GROUPS];
-	uint16_t fired[GPIO_SMEM_NUM_GROUPS][GPIO_SMEM_MAX_PC_INTERRUPTS];
-	uint32_t enabled[NUM_GPIO_INT_REGISTERS];
-	uint32_t detection[NUM_GPIO_INT_REGISTERS];
-	uint32_t polarity[NUM_GPIO_INT_REGISTERS];
-};
-
-
-void smsm_print_sleep_info(void)
-{
-	unsigned long flags;
-	uint32_t *ptr;
-#ifndef CONFIG_ARCH_MSM_SCORPION
-	struct tramp_gpio_smem *gpio;
-	struct smsm_interrupt_info *int_info;
-#endif
-
-
-	spin_lock_irqsave(&smem_lock, flags);
-
-	ptr = smem_alloc(SMEM_SMSM_SLEEP_DELAY, sizeof(*ptr));
-	if (ptr)
-		pr_info("SMEM_SMSM_SLEEP_DELAY: %x\n", *ptr);
-
-	ptr = smem_alloc(SMEM_SMSM_LIMIT_SLEEP, sizeof(*ptr));
-	if (ptr)
-		pr_info("SMEM_SMSM_LIMIT_SLEEP: %x\n", *ptr);
-
-	ptr = smem_alloc(SMEM_SLEEP_POWER_COLLAPSE_DISABLED, sizeof(*ptr));
-	if (ptr)
-		pr_info("SMEM_SLEEP_POWER_COLLAPSE_DISABLED: %x\n", *ptr);
-
-#ifndef CONFIG_ARCH_MSM_SCORPION
-	int_info = smem_alloc(SMEM_SMSM_INT_INFO, sizeof(*int_info));
-	if (int_info)
-		pr_info("SMEM_SMSM_INT_INFO %x %x %x\n",
-			int_info->interrupt_mask,
-			int_info->pending_interrupts,
-			int_info->wakeup_reason);
-
-	gpio = smem_alloc(SMEM_GPIO_INT, sizeof(*gpio));
-	if (gpio) {
-		int i;
-		for (i = 0; i < NUM_GPIO_INT_REGISTERS; i++)
-			pr_info("SMEM_GPIO_INT: %d: e %x d %x p %x\n",
-				i, gpio->enabled[i], gpio->detection[i],
-				gpio->polarity[i]);
-
-		for (i = 0; i < GPIO_SMEM_NUM_GROUPS; i++)
-			pr_info("SMEM_GPIO_INT: %d: f %d: %d %d...\n",
-				i, gpio->num_fired[i], gpio->fired[i][0],
-				gpio->fired[i][1]);
-	}
-#else
-#endif
-	spin_unlock_irqrestore(&smem_lock, flags);
-}
-
diff --git a/arch/arm/mach-msm/smd_private.h b/arch/arm/mach-msm/smd_private.h
index 727bfe68aa9b..50f7b7d22023 100644
--- a/arch/arm/mach-msm/smd_private.h
+++ b/arch/arm/mach-msm/smd_private.h
@@ -64,15 +64,14 @@ struct smem_shared {
 #define SMSM_V1_SIZE		(sizeof(unsigned) * 8)
 #define SMSM_V2_SIZE		(sizeof(unsigned) * 4)
 
-#ifdef CONFIG_MSM_SMD_PKG3
-struct smsm_interrupt_info {
+struct smsm_interrupt_info_pkg3 {
 	uint32_t interrupt_mask;
 	uint32_t pending_interrupts;
 	uint32_t wakeup_reason;
 };
-#else
+
 #define DEM_MAX_PORT_NAME_LEN (20)
-struct msm_dem_slave_data {
+struct msm_dem_slave_data_pkg4 {
 	uint32_t sleep_time;
 	uint32_t interrupt_mask;
 	uint32_t resources_used;
@@ -85,7 +84,6 @@ struct msm_dem_slave_data {
 	char     smd_port_name[DEM_MAX_PORT_NAME_LEN];
 	uint32_t reserved2;
 };
-#endif
 
 #define SZ_DIAG_ERR_MSG 0xC8
 #define ID_DIAG_ERR_MSG SMEM_DIAG_ERR_MESSAGE
@@ -126,30 +124,24 @@ struct msm_dem_slave_data {
 #define SMSM_WKUP_REASON_ALARM	0x00000010
 #define SMSM_WKUP_REASON_RESET	0x00000020
 
-#ifdef CONFIG_ARCH_MSM7X00A
-enum smsm_state_item {
-	SMSM_STATE_APPS = 1,
-	SMSM_STATE_MODEM = 3,
-	SMSM_STATE_COUNT,
-};
-#else
 enum smsm_state_item {
-	SMSM_STATE_APPS,
-	SMSM_STATE_MODEM,
-	SMSM_STATE_HEXAGON,
-	SMSM_STATE_APPS_DEM,
-	SMSM_STATE_MODEM_DEM,
-	SMSM_STATE_QDSP6_DEM,
-	SMSM_STATE_POWER_MASTER_DEM,
-	SMSM_STATE_TIME_MASTER_DEM,
-	SMSM_STATE_COUNT,
+	MSM7X00_SMSM_STATE_APPS = 1,
+	MSM7X00_SMSM_STATE_MODEM = 3,
+	MSM7X00_SMSM_STATE_COUNT,
+	SCORPION_SMSM_STATE_APPS = 0,
+	SCORPION_SMSM_STATE_MODEM,
+	SCORPION_SMSM_STATE_HEXAGON,
+	SCORPION_SMSM_STATE_APPS_DEM,
+	SCORPION_SMSM_STATE_MODEM_DEM,
+	SCORPION_SMSM_STATE_QDSP6_DEM,
+	SCORPION_SMSM_STATE_POWER_MASTER_DEM,
+	SCORPION_SMSM_STATE_TIME_MASTER_DEM,
+	SCORPION_SMSM_STATE_COUNT,
 };
-#endif
 
 void *smem_alloc(unsigned id, unsigned size);
 int smsm_change_state(enum smsm_state_item item, uint32_t clear_mask, uint32_t set_mask);
 uint32_t smsm_get_state(enum smsm_state_item item);
-int smsm_set_sleep_duration(uint32_t delay);
 void smsm_print_sleep_info(void);
 
 #define SMEM_NUM_SMD_CHANNELS        64
@@ -335,12 +327,17 @@ uint32_t raw_smsm_get_state(enum smsm_state_item item);
 
 extern void msm_init_last_radio_log(struct module *);
 
-#ifdef CONFIG_MSM_SMD_PKG3
+#if defined(CONFIG_MSM_SMD) && defined(CONFIG_DEBUG_FS)
+extern int smd_debugfs_init(bool);
+#else
+static inline int smd_debugfs_init(bool is_scorpion) { return 0; }
+#endif
+
 /*
  * This allocator assumes an SMD Package v3 which only exists on
  * MSM7x00 SoC's.
  */
-static inline int _smd_alloc_channel(struct smd_channel *ch)
+static inline int _smd_alloc_channel_pkg3(struct smd_channel *ch)
 {
 	struct smd_shared_v1 *shared1;
 
@@ -356,12 +353,12 @@ static inline int _smd_alloc_channel(struct smd_channel *ch)
 	ch->fifo_size = SMD_BUF_SIZE;
 	return 0;
 }
-#else
+
 /*
  * This allocator assumes an SMD Package v4, the most common
  * and the default.
  */
-static inline int _smd_alloc_channel(struct smd_channel *ch)
+static inline int _smd_alloc_channel_pkg4(struct smd_channel *ch)
 {
 	struct smd_shared_v2 *shared2;
 	void *buffer;
@@ -385,19 +382,5 @@ static inline int _smd_alloc_channel(struct smd_channel *ch)
 	ch->fifo_size = buffer_sz;
 	return 0;
 }
-#endif /* CONFIG_MSM_SMD_PKG3 */
-
-#if defined(CONFIG_ARCH_MSM7X30)
-static inline void msm_a2m_int(uint32_t irq)
-{
-	writel(1 << irq, MSM_GCC_BASE + 0x8);
-}
-#else
-static inline void msm_a2m_int(uint32_t irq)
-{
-	writel(1, MSM_CSR_BASE + 0x400 + (irq * 4));
-}
-#endif /* CONFIG_ARCH_MSM7X30 */
-
 
 #endif
-- 
2.1.0.rc2

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RFC PATCH 13/18] ARM: msm: rename conflicting symbols
  2015-03-04 19:32 [RFC PATCH 00/18] ARM: msm multiplatform support Arnd Bergmann
                   ` (11 preceding siblings ...)
  2015-03-04 19:33 ` [RFC PATCH 12/18] ARM: msm: make smd behave like a normal driver Arnd Bergmann
@ 2015-03-04 19:33 ` Arnd Bergmann
  2015-03-04 19:33 ` [RFC PATCH 14/18] ARM: msm: pass gpio irq range as resource Arnd Bergmann
                   ` (8 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnd Bergmann @ 2015-03-04 19:33 UTC (permalink / raw)
  To: linux-arm-kernel

Each MSM SoC implementation defines the same set of platform device
structures to be used by the respective board file. Linking them
together fails because of conflicting symbols, so we need to
rename them by adding the name of the soc as the prefix.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-msm/board-halibut.c     | 12 +++----
 arch/arm/mach-msm/board-msm7x30.c     | 18 +++++-----
 arch/arm/mach-msm/board-qsd8x50.c     | 20 +++++------
 arch/arm/mach-msm/board-trout-mmc.c   |  4 +--
 arch/arm/mach-msm/board-trout-panel.c |  6 ++--
 arch/arm/mach-msm/board-trout.c       | 12 +++----
 arch/arm/mach-msm/common.h            | 10 ++++--
 arch/arm/mach-msm/devices-msm7x00.c   | 40 ++++++++++-----------
 arch/arm/mach-msm/devices-msm7x30.c   | 12 +++----
 arch/arm/mach-msm/devices-qsd8x50.c   | 30 ++++++++--------
 arch/arm/mach-msm/devices.h           | 67 ++++++++++++++++++++---------------
 11 files changed, 122 insertions(+), 109 deletions(-)

diff --git a/arch/arm/mach-msm/board-halibut.c b/arch/arm/mach-msm/board-halibut.c
index 1b6d64196631..106a2fd23017 100644
--- a/arch/arm/mach-msm/board-halibut.c
+++ b/arch/arm/mach-msm/board-halibut.c
@@ -59,12 +59,12 @@ static struct platform_device smc91x_device = {
 
 static struct platform_device *devices[] __initdata = {
 	&msm_clock_7x01a,
-	&msm_device_gpio_7201,
-	&msm_device_uart3,
-	&msm_device_smd,
-	&msm_device_nand,
-	&msm_device_hsusb,
-	&msm_device_i2c,
+	&msm7x00_device_gpio_7201,
+	&msm7x00_device_uart3,
+	&msm7x00_device_smd,
+	&msm7x00_device_nand,
+	&msm7x00_device_hsusb,
+	&msm7x00_device_i2c,
 	&smc91x_device,
 };
 
diff --git a/arch/arm/mach-msm/board-msm7x30.c b/arch/arm/mach-msm/board-msm7x30.c
index 295d7c03e53f..95e0cdde23a7 100644
--- a/arch/arm/mach-msm/board-msm7x30.c
+++ b/arch/arm/mach-msm/board-msm7x30.c
@@ -123,14 +123,14 @@ static struct msm_gpiomux_config msm7x30_gpiomux_configs[MSM7X30_GPIOMUX_NGPIOS]
 
 static struct platform_device *devices[] __initdata = {
 	&msm_clock_7x30,
-	&msm_device_gpio_7x30,
+	&msm7x30_device_gpio_7x30,
 #if defined(CONFIG_SERIAL_MSM)
-        &msm_device_uart2,
+        &msm7x30_device_uart2,
 #endif
-	&msm_device_smd,
-	&msm_device_otg,
-	&msm_device_hsusb,
-	&msm_device_hsusb_host,
+	&msm7x30_device_smd,
+	&msm7x30_device_otg,
+	&msm7x30_device_hsusb,
+	&msm7x30_device_hsusb_host,
 };
 
 #define SMSM_FAKE_IRQ (0xff)
@@ -194,9 +194,9 @@ static void __init msm7x30_init(void)
 {
 	gpiomux_init(msm7x30_gpiomux_configs,
 		     ARRAY_SIZE(msm7x30_gpiomux_configs));
-	msm_device_otg.dev.platform_data = &msm_otg_pdata;
-	msm_device_hsusb.dev.parent = &msm_device_otg.dev;
-	msm_device_hsusb_host.dev.parent = &msm_device_otg.dev;
+	msm7x30_device_otg.dev.platform_data = &msm_otg_pdata;
+	msm7x30_device_hsusb.dev.parent = &msm7x30_device_otg.dev;
+	msm7x30_device_hsusb_host.dev.parent = &msm7x30_device_otg.dev;
 
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 }
diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c
index 7bd36b9908c8..9b7cd93541f9 100644
--- a/arch/arm/mach-msm/board-qsd8x50.c
+++ b/arch/arm/mach-msm/board-qsd8x50.c
@@ -125,12 +125,12 @@ static struct msm_otg_platform_data msm_otg_pdata = {
 
 static struct platform_device *devices[] __initdata = {
 	&msm_clock_8x50,
-	&msm_device_gpio_8x50,
-	&msm_device_uart3,
-	&msm_device_smd,
-	&msm_device_otg,
-	&msm_device_hsusb,
-	&msm_device_hsusb_host,
+	&qsd8x50_device_gpio_8x50,
+	&qsd8x50_device_uart3,
+	&qsd8x50_device_smd,
+	&qsd8x50_device_otg,
+	&qsd8x50_device_hsusb,
+	&qsd8x50_device_hsusb_host,
 };
 
 static struct msm_mmc_gpio sdc1_gpio_cfg[] = {
@@ -218,7 +218,7 @@ static void __init qsd8x50_init_mmc(void)
 		return;
 	}
 
-	msm_add_sdcc(1, &qsd8x50_sdc1_data, 0, 0);
+	qsd8x50_add_sdcc(1, &qsd8x50_sdc1_data, 0, 0);
 }
 
 #define SMSM_FAKE_IRQ (0xff)
@@ -286,9 +286,9 @@ static void __init qsd8x50_init(void)
 {
 	gpiomux_init(qsd8x50_gpiomux_configs,
 		     ARRAY_SIZE(qsd8x50_gpiomux_configs));
-	msm_device_otg.dev.platform_data = &msm_otg_pdata;
-	msm_device_hsusb.dev.parent = &msm_device_otg.dev;
-	msm_device_hsusb_host.dev.parent = &msm_device_otg.dev;
+	qsd8x50_device_otg.dev.platform_data = &msm_otg_pdata;
+	qsd8x50_device_hsusb.dev.parent = &qsd8x50_device_otg.dev;
+	qsd8x50_device_hsusb_host.dev.parent = &qsd8x50_device_otg.dev;
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 	qsd8x50_init_mmc();
 }
diff --git a/arch/arm/mach-msm/board-trout-mmc.c b/arch/arm/mach-msm/board-trout-mmc.c
index 2474bba71c8b..608d86b171c4 100644
--- a/arch/arm/mach-msm/board-trout-mmc.c
+++ b/arch/arm/mach-msm/board-trout-mmc.c
@@ -194,8 +194,8 @@ int __init trout_init_mmc(unsigned int sys_rev)
 	irq_set_irq_wake(TROUT_GPIO_TO_INT(TROUT_GPIO_SDMC_CD_N), 1);
 
 	if (!opt_disable_sdcard)
-		msm_add_sdcc(2, &trout_sdslot_data,
-			     TROUT_GPIO_TO_INT(TROUT_GPIO_SDMC_CD_N), 0);
+		msm7x00_add_sdcc(2, &trout_sdslot_data,
+				 TROUT_GPIO_TO_INT(TROUT_GPIO_SDMC_CD_N), 0);
 	else
 		printk(KERN_INFO "trout: SD-Card interface disabled\n");
 	return 0;
diff --git a/arch/arm/mach-msm/board-trout-panel.c b/arch/arm/mach-msm/board-trout-panel.c
index 77b0a26f897f..e06c4f309fda 100644
--- a/arch/arm/mach-msm/board-trout-panel.c
+++ b/arch/arm/mach-msm/board-trout-panel.c
@@ -282,11 +282,11 @@ int __init trout_init_panel(void)
 			pr_err("trout_init_panel: set clock rate failed\n");
 	}
 
-	rc = platform_device_register(&msm_device_mdp);
+	rc = platform_device_register(&msm7x00_device_mdp);
 	if (rc)
 		return rc;
-	msm_device_mddi0.dev.platform_data = &mddi_pdata;
-	return platform_device_register(&msm_device_mddi0);
+	msm7x00_device_mddi0.dev.platform_data = &mddi_pdata;
+	return platform_device_register(&msm7x00_device_mddi0);
 }
 
 device_initcall(trout_init_panel);
diff --git a/arch/arm/mach-msm/board-trout.c b/arch/arm/mach-msm/board-trout.c
index e1c6e8528150..9737e43a2887 100644
--- a/arch/arm/mach-msm/board-trout.c
+++ b/arch/arm/mach-msm/board-trout.c
@@ -38,12 +38,12 @@ extern int trout_init_mmc(unsigned int);
 
 static struct platform_device *devices[] __initdata = {
 	&msm_clock_7x01a,
-	&msm_device_gpio_7201,
-	&msm_device_uart3,
-	&msm_device_smd,
-	&msm_device_nand,
-	&msm_device_hsusb,
-	&msm_device_i2c,
+	&msm7x00_device_gpio_7201,
+	&msm7x00_device_uart3,
+	&msm7x00_device_smd,
+	&msm7x00_device_nand,
+	&msm7x00_device_hsusb,
+	&msm7x00_device_i2c,
 };
 
 static void __init trout_init_early(void)
diff --git a/arch/arm/mach-msm/common.h b/arch/arm/mach-msm/common.h
index 3c5214057657..1e7d3e0518fe 100644
--- a/arch/arm/mach-msm/common.h
+++ b/arch/arm/mach-msm/common.h
@@ -30,8 +30,12 @@ extern void msm_add_devices(void);
 extern void msm_init_irq(void);
 extern void msm_init_vic(uint8_t *irq_to_smsm, int nr);
 extern void msm_init_gpio(void);
-extern int msm_add_sdcc(unsigned int controller,
-			struct msm_mmc_platform_data *plat,
-			unsigned int stat_irq, unsigned long stat_irq_flags);
+extern int msm7x00_add_sdcc(unsigned int controller,
+			    struct msm_mmc_platform_data *plat,
+			    unsigned int stat_irq, unsigned long stat_irq_flags);
+
+extern int qsd8x50_add_sdcc(unsigned int controller,
+			    struct msm_mmc_platform_data *plat,
+			    unsigned int stat_irq, unsigned long stat_irq_flags);
 
 #endif
diff --git a/arch/arm/mach-msm/devices-msm7x00.c b/arch/arm/mach-msm/devices-msm7x00.c
index 1bac32b690cf..b7308e7a301b 100644
--- a/arch/arm/mach-msm/devices-msm7x00.c
+++ b/arch/arm/mach-msm/devices-msm7x00.c
@@ -112,7 +112,7 @@ static struct resource msm_gpio_resources[] = {
 	},
 };
 
-struct platform_device msm_device_gpio_7201 = {
+struct platform_device msm7x00_device_gpio_7201 = {
 	.name	= "gpio-msm-7201",
 	.num_resources	= ARRAY_SIZE(msm_gpio_resources),
 	.resource	= msm_gpio_resources,
@@ -160,21 +160,21 @@ static struct resource resources_uart3[] = {
 	},
 };
 
-struct platform_device msm_device_uart1 = {
+struct platform_device msm7x00_device_uart1 = {
 	.name	= "msm_serial",
 	.id	= 0,
 	.num_resources	= ARRAY_SIZE(resources_uart1),
 	.resource	= resources_uart1,
 };
 
-struct platform_device msm_device_uart2 = {
+struct platform_device msm7x00_device_uart2 = {
 	.name	= "msm_serial",
 	.id	= 1,
 	.num_resources	= ARRAY_SIZE(resources_uart2),
 	.resource	= resources_uart2,
 };
 
-struct platform_device msm_device_uart3 = {
+struct platform_device msm7x00_device_uart3 = {
 	.name	= "msm_serial",
 	.id	= 2,
 	.num_resources	= ARRAY_SIZE(resources_uart3),
@@ -194,7 +194,7 @@ static struct resource resources_i2c[] = {
 	},
 };
 
-struct platform_device msm_device_i2c = {
+struct platform_device msm7x00_device_i2c = {
 	.name		= "msm_i2c",
 	.id		= 0,
 	.num_resources	= ARRAY_SIZE(resources_i2c),
@@ -214,7 +214,7 @@ static struct resource resources_hsusb[] = {
 	},
 };
 
-struct platform_device msm_device_hsusb = {
+struct platform_device msm7x00_device_hsusb = {
 	.name		= "msm_hsusb",
 	.id		= -1,
 	.num_resources	= ARRAY_SIZE(resources_hsusb),
@@ -237,7 +237,7 @@ static struct resource resources_nand[] = {
 	},
 };
 
-struct platform_device msm_device_nand = {
+struct platform_device msm7x00_device_nand = {
 	.name		= "msm_nand",
 	.id		= -1,
 	.num_resources	= ARRAY_SIZE(resources_nand),
@@ -252,7 +252,7 @@ static struct resource resources_smd[] = {
 	DEFINE_RES_IRQ(INT_A9_M2A_5),
 };
 
-struct platform_device msm_device_smd = {
+struct platform_device msm7x00_device_smd = {
 	.name		= "msm7x00_smd",
 	.id		= -1,
 	.num_resources	= ARRAY_SIZE(resources_smd),
@@ -395,7 +395,7 @@ static struct resource resources_sdc4[] = {
 	},
 };
 
-struct platform_device msm_device_sdc1 = {
+struct platform_device msm7x00_device_sdc1 = {
 	.name		= "msm_sdcc",
 	.id		= 1,
 	.num_resources	= ARRAY_SIZE(resources_sdc1),
@@ -405,7 +405,7 @@ struct platform_device msm_device_sdc1 = {
 	},
 };
 
-struct platform_device msm_device_sdc2 = {
+struct platform_device msm7x00_device_sdc2 = {
 	.name		= "msm_sdcc",
 	.id		= 2,
 	.num_resources	= ARRAY_SIZE(resources_sdc2),
@@ -415,7 +415,7 @@ struct platform_device msm_device_sdc2 = {
 	},
 };
 
-struct platform_device msm_device_sdc3 = {
+struct platform_device msm7x00_device_sdc3 = {
 	.name		= "msm_sdcc",
 	.id		= 3,
 	.num_resources	= ARRAY_SIZE(resources_sdc3),
@@ -425,7 +425,7 @@ struct platform_device msm_device_sdc3 = {
 	},
 };
 
-struct platform_device msm_device_sdc4 = {
+struct platform_device msm7x00_device_sdc4 = {
 	.name		= "msm_sdcc",
 	.id		= 4,
 	.num_resources	= ARRAY_SIZE(resources_sdc4),
@@ -436,13 +436,13 @@ struct platform_device msm_device_sdc4 = {
 };
 
 static struct platform_device *msm_sdcc_devices[] __initdata = {
-	&msm_device_sdc1,
-	&msm_device_sdc2,
-	&msm_device_sdc3,
-	&msm_device_sdc4,
+	&msm7x00_device_sdc1,
+	&msm7x00_device_sdc2,
+	&msm7x00_device_sdc3,
+	&msm7x00_device_sdc4,
 };
 
-int __init msm_add_sdcc(unsigned int controller,
+int __init msm7x00_add_sdcc(unsigned int controller,
 			struct msm_mmc_platform_data *plat,
 			unsigned int stat_irq, unsigned long stat_irq_flags)
 {
@@ -493,7 +493,7 @@ static struct resource resources_mddi1[] = {
 	},
 };
 
-struct platform_device msm_device_mddi0 = {
+struct platform_device msm7x00_device_mddi0 = {
 	.name = "msm_mddi",
 	.id = 0,
 	.num_resources = ARRAY_SIZE(resources_mddi0),
@@ -503,7 +503,7 @@ struct platform_device msm_device_mddi0 = {
 	},
 };
 
-struct platform_device msm_device_mddi1 = {
+struct platform_device msm7x00_device_mddi1 = {
 	.name = "msm_mddi",
 	.id = 1,
 	.num_resources = ARRAY_SIZE(resources_mddi1),
@@ -527,7 +527,7 @@ static struct resource resources_mdp[] = {
 	},
 };
 
-struct platform_device msm_device_mdp = {
+struct platform_device msm7x00_device_mdp = {
 	.name = "msm_mdp",
 	.id = 0,
 	.num_resources = ARRAY_SIZE(resources_mdp),
diff --git a/arch/arm/mach-msm/devices-msm7x30.c b/arch/arm/mach-msm/devices-msm7x30.c
index f4ff40caac27..2d36c54b9523 100644
--- a/arch/arm/mach-msm/devices-msm7x30.c
+++ b/arch/arm/mach-msm/devices-msm7x30.c
@@ -93,7 +93,7 @@ static struct resource msm_gpio_resources[] = {
 	},
 };
 
-struct platform_device msm_device_gpio_7x30 = {
+struct platform_device msm7x30_device_gpio_7x30 = {
 	.name	= "gpio-msm-7x30",
 	.num_resources	= ARRAY_SIZE(msm_gpio_resources),
 	.resource	= msm_gpio_resources,
@@ -113,7 +113,7 @@ static struct resource resources_uart2[] = {
 	},
 };
 
-struct platform_device msm_device_uart2 = {
+struct platform_device msm7x30_device_uart2 = {
 	.name	= "msm_serial",
 	.id	= 1,
 	.num_resources	= ARRAY_SIZE(resources_uart2),
@@ -125,7 +125,7 @@ static struct resource resources_smd[] = {
 	DEFINE_RES_IRQ(INT_A9_M2A_5),
 };
 
-struct platform_device msm_device_smd = {
+struct platform_device msm7x30_device_smd = {
 	.name   	= "msm_smd",
 	.id     	= -1,
 	.num_resources	= ARRAY_SIZE(resources_smd),
@@ -145,7 +145,7 @@ static struct resource resources_otg[] = {
 	},
 };
 
-struct platform_device msm_device_otg = {
+struct platform_device msm7x30_device_otg = {
 	.name		= "msm_otg",
 	.id		= -1,
 	.num_resources	= ARRAY_SIZE(resources_otg),
@@ -168,7 +168,7 @@ static struct resource resources_hsusb[] = {
 	},
 };
 
-struct platform_device msm_device_hsusb = {
+struct platform_device msm7x30_device_hsusb = {
 	.name		= "msm_hsusb",
 	.id		= -1,
 	.num_resources	= ARRAY_SIZE(resources_hsusb),
@@ -192,7 +192,7 @@ static struct resource resources_hsusb_host[] = {
 	},
 };
 
-struct platform_device msm_device_hsusb_host = {
+struct platform_device msm7x30_device_hsusb_host = {
 	.name		= "msm_hsusb_host",
 	.id		= -1,
 	.num_resources	= ARRAY_SIZE(resources_hsusb_host),
diff --git a/arch/arm/mach-msm/devices-qsd8x50.c b/arch/arm/mach-msm/devices-qsd8x50.c
index 5dcf17a24d70..5f280467f207 100644
--- a/arch/arm/mach-msm/devices-qsd8x50.c
+++ b/arch/arm/mach-msm/devices-qsd8x50.c
@@ -103,7 +103,7 @@ static struct resource msm_gpio_resources[] = {
 	},
 };
 
-struct platform_device msm_device_gpio_8x50 = {
+struct platform_device qsd8x50_device_gpio_8x50 = {
 	.name	= "gpio-msm-8x50",
 	.num_resources	= ARRAY_SIZE(msm_gpio_resources),
 	.resource	= msm_gpio_resources,
@@ -123,7 +123,7 @@ static struct resource resources_uart3[] = {
 	},
 };
 
-struct platform_device msm_device_uart3 = {
+struct platform_device qsd8x50_device_uart3 = {
 	.name	= "msm_serial",
 	.id	= 2,
 	.num_resources	= ARRAY_SIZE(resources_uart3),
@@ -135,7 +135,7 @@ static struct resource resources_smd[] = {
 	DEFINE_RES_IRQ(INT_A9_M2A_5),
 };
 
-struct platform_device msm_device_smd = {
+struct platform_device qsd8x50_device_smd = {
 	.name		= "msm_smd",
 	.id		= -1,
 	.num_resources	= ARRAY_SIZE(resources_smd),
@@ -155,7 +155,7 @@ static struct resource resources_otg[] = {
 	},
 };
 
-struct platform_device msm_device_otg = {
+struct platform_device qsd8x50_device_otg = {
 	.name		= "msm_otg",
 	.id		= -1,
 	.num_resources	= ARRAY_SIZE(resources_otg),
@@ -178,7 +178,7 @@ static struct resource resources_hsusb[] = {
 	},
 };
 
-struct platform_device msm_device_hsusb = {
+struct platform_device qsd8x50_device_hsusb = {
 	.name		= "msm_hsusb",
 	.id		= -1,
 	.num_resources	= ARRAY_SIZE(resources_hsusb),
@@ -202,7 +202,7 @@ static struct resource resources_hsusb_host[] = {
 	},
 };
 
-struct platform_device msm_device_hsusb_host = {
+struct platform_device qsd8x50_device_hsusb_host = {
 	.name		= "msm_hsusb_host",
 	.id		= -1,
 	.num_resources	= ARRAY_SIZE(resources_hsusb_host),
@@ -349,7 +349,7 @@ static struct resource resources_sdc4[] = {
 	},
 };
 
-struct platform_device msm_device_sdc1 = {
+struct platform_device qsd8x50_device_sdc1 = {
 	.name		= "msm_sdcc",
 	.id		= 1,
 	.num_resources	= ARRAY_SIZE(resources_sdc1),
@@ -359,7 +359,7 @@ struct platform_device msm_device_sdc1 = {
 	},
 };
 
-struct platform_device msm_device_sdc2 = {
+struct platform_device qsd8x50_device_sdc2 = {
 	.name		= "msm_sdcc",
 	.id		= 2,
 	.num_resources	= ARRAY_SIZE(resources_sdc2),
@@ -369,7 +369,7 @@ struct platform_device msm_device_sdc2 = {
 	},
 };
 
-struct platform_device msm_device_sdc3 = {
+struct platform_device qsd8x50_device_sdc3 = {
 	.name		= "msm_sdcc",
 	.id		= 3,
 	.num_resources	= ARRAY_SIZE(resources_sdc3),
@@ -379,7 +379,7 @@ struct platform_device msm_device_sdc3 = {
 	},
 };
 
-struct platform_device msm_device_sdc4 = {
+struct platform_device qsd8x50_device_sdc4 = {
 	.name		= "msm_sdcc",
 	.id		= 4,
 	.num_resources	= ARRAY_SIZE(resources_sdc4),
@@ -390,13 +390,13 @@ struct platform_device msm_device_sdc4 = {
 };
 
 static struct platform_device *msm_sdcc_devices[] __initdata = {
-	&msm_device_sdc1,
-	&msm_device_sdc2,
-	&msm_device_sdc3,
-	&msm_device_sdc4,
+	&qsd8x50_device_sdc1,
+	&qsd8x50_device_sdc2,
+	&qsd8x50_device_sdc3,
+	&qsd8x50_device_sdc4,
 };
 
-int __init msm_add_sdcc(unsigned int controller,
+int __init qsd8x50_add_sdcc(unsigned int controller,
 			struct msm_mmc_platform_data *plat,
 			unsigned int stat_irq, unsigned long stat_irq_flags)
 {
diff --git a/arch/arm/mach-msm/devices.h b/arch/arm/mach-msm/devices.h
index dccefad9f9b9..81d86b32647a 100644
--- a/arch/arm/mach-msm/devices.h
+++ b/arch/arm/mach-msm/devices.h
@@ -16,35 +16,44 @@
 #ifndef __ARCH_ARM_MACH_MSM_DEVICES_H
 #define __ARCH_ARM_MACH_MSM_DEVICES_H
 
-extern struct platform_device msm_device_gpio_7201;
-extern struct platform_device msm_device_gpio_7x30;
-extern struct platform_device msm_device_gpio_8x50;
-
-extern struct platform_device msm_device_uart1;
-extern struct platform_device msm_device_uart2;
-extern struct platform_device msm_device_uart3;
-
-extern struct platform_device msm8960_device_uart_gsbi2;
-extern struct platform_device msm8960_device_uart_gsbi5;
-
-extern struct platform_device msm_device_sdc1;
-extern struct platform_device msm_device_sdc2;
-extern struct platform_device msm_device_sdc3;
-extern struct platform_device msm_device_sdc4;
-
-extern struct platform_device msm_device_hsusb;
-extern struct platform_device msm_device_otg;
-extern struct platform_device msm_device_hsusb_host;
-
-extern struct platform_device msm_device_i2c;
-
-extern struct platform_device msm_device_smd;
-
-extern struct platform_device msm_device_nand;
-
-extern struct platform_device msm_device_mddi0;
-extern struct platform_device msm_device_mddi1;
-extern struct platform_device msm_device_mdp;
+extern struct platform_device msm7x00_device_gpio_7201;
+extern struct platform_device msm7x30_device_gpio_7x30;
+extern struct platform_device qsd8x50_device_gpio_8x50;
+
+extern struct platform_device msm7x00_device_uart1;
+extern struct platform_device msm7x00_device_uart2;
+extern struct platform_device msm7x00_device_uart3;
+extern struct platform_device msm7x30_device_uart2;
+extern struct platform_device qsd8x50_device_uart3;
+
+extern struct platform_device msm7x00_device_sdc1;
+extern struct platform_device msm7x00_device_sdc2;
+extern struct platform_device msm7x00_device_sdc3;
+extern struct platform_device msm7x00_device_sdc4;
+extern struct platform_device qsd8x50_device_sdc1;
+extern struct platform_device qsd8x50_device_sdc2;
+extern struct platform_device qsd8x50_device_sdc3;
+extern struct platform_device qsd8x50_device_sdc4;
+
+extern struct platform_device msm7x00_device_hsusb;
+extern struct platform_device msm7x30_device_hsusb;
+extern struct platform_device msm7x30_device_otg;
+extern struct platform_device msm7x30_device_hsusb_host;
+extern struct platform_device qsd8x50_device_hsusb;
+extern struct platform_device qsd8x50_device_otg;
+extern struct platform_device qsd8x50_device_hsusb_host;
+
+extern struct platform_device msm7x00_device_i2c;
+
+extern struct platform_device msm7x00_device_nand;
+
+extern struct platform_device msm7x00_device_smd;
+extern struct platform_device msm7x30_device_smd;
+extern struct platform_device qsd8x50_device_smd;
+
+extern struct platform_device msm7x00_device_mddi0;
+extern struct platform_device msm7x00_device_mddi1;
+extern struct platform_device msm7x00_device_mdp;
 
 extern struct platform_device msm_clock_7x01a;
 extern struct platform_device msm_clock_7x30;
-- 
2.1.0.rc2

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RFC PATCH 14/18] ARM: msm: pass gpio irq range as resource
  2015-03-04 19:32 [RFC PATCH 00/18] ARM: msm multiplatform support Arnd Bergmann
                   ` (12 preceding siblings ...)
  2015-03-04 19:33 ` [RFC PATCH 13/18] ARM: msm: rename conflicting symbols Arnd Bergmann
@ 2015-03-04 19:33 ` Arnd Bergmann
  2015-03-04 19:33 ` [RFC PATCH 15/18] ARM: msm: clean up irq handling Arnd Bergmann
                   ` (7 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnd Bergmann @ 2015-03-04 19:33 UTC (permalink / raw)
  To: linux-arm-kernel

The IRQ numbers that are used by the gpio driver are hardware
specific, and since this driver does not use irq domains, we
have to pass them as platform resources in order to perform
gpio configuration at runtime.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-msm/devices-msm7x00.c |  5 +++++
 arch/arm/mach-msm/devices-msm7x30.c |  5 +++++
 arch/arm/mach-msm/devices-qsd8x50.c |  5 +++++
 arch/arm/mach-msm/gpio-msm-v1.c     | 15 +++++++++------
 4 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-msm/devices-msm7x00.c b/arch/arm/mach-msm/devices-msm7x00.c
index b7308e7a301b..38c16313f433 100644
--- a/arch/arm/mach-msm/devices-msm7x00.c
+++ b/arch/arm/mach-msm/devices-msm7x00.c
@@ -99,6 +99,11 @@ static struct resource msm_gpio_resources[] = {
 		.flags	= IORESOURCE_IRQ,
 	},
 	{
+		.start	= NR_MSM_IRQS,
+		.end	= NR_MSM_IRQS + NR_GPIO_IRQS - 1,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
 		.start	= 0xa9200800,
 		.end	= 0xa9200800 + SZ_4K - 1,
 		.flags	= IORESOURCE_MEM,
diff --git a/arch/arm/mach-msm/devices-msm7x30.c b/arch/arm/mach-msm/devices-msm7x30.c
index 2d36c54b9523..197d2b8afa20 100644
--- a/arch/arm/mach-msm/devices-msm7x30.c
+++ b/arch/arm/mach-msm/devices-msm7x30.c
@@ -80,6 +80,11 @@ static struct resource msm_gpio_resources[] = {
 		.flags	= IORESOURCE_IRQ,
 	},
 	{
+		.start	= NR_MSM_IRQS,
+		.end	= NR_MSM_IRQS + NR_GPIO_IRQS - 1,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
 		.start	= 0xac001000,
 		.end	= 0xac001000 + SZ_4K - 1,
 		.flags	= IORESOURCE_MEM,
diff --git a/arch/arm/mach-msm/devices-qsd8x50.c b/arch/arm/mach-msm/devices-qsd8x50.c
index 5f280467f207..3fd28b702591 100644
--- a/arch/arm/mach-msm/devices-qsd8x50.c
+++ b/arch/arm/mach-msm/devices-qsd8x50.c
@@ -90,6 +90,11 @@ static struct resource msm_gpio_resources[] = {
 		.flags	= IORESOURCE_IRQ,
 	},
 	{
+		.start	= NR_MSM_IRQS,
+		.end	= NR_MSM_IRQS + NR_GPIO_IRQS - 1,
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
 		.start	= 0xa9000800,
 		.end	= 0xa9000800 + SZ_4K - 1,
 		.flags	= IORESOURCE_MEM,
diff --git a/arch/arm/mach-msm/gpio-msm-v1.c b/arch/arm/mach-msm/gpio-msm-v1.c
index 589115c1faa2..2700f9bda455 100644
--- a/arch/arm/mach-msm/gpio-msm-v1.c
+++ b/arch/arm/mach-msm/gpio-msm-v1.c
@@ -274,7 +274,7 @@
 #define MSM7X30_GPIO_INT_STATUS_6	MSM_GPIO1_REG(0xE0)
 #define MSM7X30_GPIO_INT_STATUS_7	MSM_GPIO1_REG(0x234)
 
-#define FIRST_GPIO_IRQ MSM_GPIO_TO_INT(0)
+static int msm_gpio_first_irq;
 
 #define MSM_GPIO_BANK(soc, bank, first, last)				\
 	{								\
@@ -446,7 +446,7 @@ static void msm_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 
 static int msm_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
 {
-	return MSM_GPIO_TO_INT(chip->base + offset);
+	return chip->base + offset - msm_gpio_first_irq;
 }
 
 static int msm_gpio_request(struct gpio_chip *chip, unsigned offset)
@@ -618,9 +618,9 @@ static void msm_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
 			j = fls(mask) - 1;
 			/* printk("%s %08x %08x bit %d gpio %d irq %d\n",
 				__func__, v, m, j, msm_chip->chip.start + j,
-				FIRST_GPIO_IRQ + msm_chip->chip.start + j); */
+				msm_gpio_first_irq + msm_chip->chip.start + j); */
 			val &= ~mask;
-			generic_handle_irq(FIRST_GPIO_IRQ +
+			generic_handle_irq(msm_gpio_first_irq +
 					   msm_chip->chip.base + j);
 		}
 	}
@@ -668,8 +668,11 @@ static int gpio_msm_v1_probe(struct platform_device *pdev)
 	if (IS_ERR(base2))
 		return PTR_ERR(base2);
 
-	for (i = FIRST_GPIO_IRQ; i < FIRST_GPIO_IRQ + NR_GPIO_IRQS; i++) {
-		if (i - FIRST_GPIO_IRQ >=
+	res = platform_get_resource(pdev, IORESOURCE_IRQ, 2);
+	msm_gpio_first_irq = res->start;
+
+	for (i = msm_gpio_first_irq; i <= res->end; i++) {
+		if (i - msm_gpio_first_irq >=
 			msm_gpio_chips[j].chip.base +
 			msm_gpio_chips[j].chip.ngpio)
 			j++;
-- 
2.1.0.rc2

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RFC PATCH 15/18] ARM: msm: clean up irq handling
  2015-03-04 19:32 [RFC PATCH 00/18] ARM: msm multiplatform support Arnd Bergmann
                   ` (13 preceding siblings ...)
  2015-03-04 19:33 ` [RFC PATCH 14/18] ARM: msm: pass gpio irq range as resource Arnd Bergmann
@ 2015-03-04 19:33 ` Arnd Bergmann
  2015-03-04 19:33 ` [RFC PATCH 16/18] ARM: msm: make msm_smd.h global Arnd Bergmann
                   ` (6 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnd Bergmann @ 2015-03-04 19:33 UTC (permalink / raw)
  To: linux-arm-kernel

As a preparation for multiplatform support, we need to
enable SPARSE_IRQ and MULTI_IRQ_HANDLER, as well as removing
the shared mach/irqs.h file.

This replaces all uses of the irqs.h header with proper
soc-specific versions.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/Kconfig                             |  2 ++
 arch/arm/mach-msm/board-halibut.c            |  7 +++---
 arch/arm/mach-msm/board-msm7x30.c            |  5 +++-
 arch/arm/mach-msm/board-qsd8x50.c            |  5 ++--
 arch/arm/mach-msm/board-trout-gpio.c         |  7 +++---
 arch/arm/mach-msm/board-trout-mmc.c          |  1 +
 arch/arm/mach-msm/board-trout.c              |  2 ++
 arch/arm/mach-msm/devices-msm7x00.c          |  2 +-
 arch/arm/mach-msm/devices-msm7x30.c          |  2 +-
 arch/arm/mach-msm/devices-qsd8x50.c          |  2 +-
 arch/arm/mach-msm/include/mach/entry-macro.S | 36 ---------------------------
 arch/arm/mach-msm/include/mach/irqs-7x00.h   |  3 +++
 arch/arm/mach-msm/include/mach/irqs-7x30.h   |  2 ++
 arch/arm/mach-msm/include/mach/irqs-8x50.h   |  2 ++
 arch/arm/mach-msm/include/mach/irqs.h        | 37 ----------------------------
 arch/arm/mach-msm/irq-vic.c                  | 24 ++++++++++++++++++
 arch/arm/mach-msm/irq.c                      | 25 +++++++++++++++++++
 17 files changed, 79 insertions(+), 85 deletions(-)
 delete mode 100644 arch/arm/mach-msm/include/mach/entry-macro.S
 delete mode 100644 arch/arm/mach-msm/include/mach/irqs.h

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 78f561c32eab..ef94bccbe137 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -559,6 +559,8 @@ config ARCH_MSM
 	select ARCH_REQUIRE_GPIOLIB
 	select COMMON_CLK
 	select GENERIC_CLOCKEVENTS
+	select MULTI_IRQ_HANDLER
+	select SPARSE_IRQ
 	help
 	  Support for Qualcomm MSM/QSD based systems.  This runs on the
 	  apps processor of the MSM/QSD and depends on a shared memory
diff --git a/arch/arm/mach-msm/board-halibut.c b/arch/arm/mach-msm/board-halibut.c
index 106a2fd23017..15fd63e88018 100644
--- a/arch/arm/mach-msm/board-halibut.c
+++ b/arch/arm/mach-msm/board-halibut.c
@@ -28,7 +28,7 @@
 #include <asm/mach/flash.h>
 #include <asm/setup.h>
 
-#include <mach/irqs.h>
+#include <mach/irqs-7x00.h>
 #include <mach/msm_iomap-7x00.h>
 
 #include <linux/mtd/nand.h>
@@ -44,8 +44,8 @@ static struct resource smc91x_resources[] = {
 		.flags	= IORESOURCE_MEM,
 	},
 	[1] = {
-		.start	= MSM_GPIO_TO_INT(49),
-		.end	= MSM_GPIO_TO_INT(49),
+		.start	= MSM7X00_GPIO_TO_INT(49),
+		.end	= MSM7X00_GPIO_TO_INT(49),
 		.flags	= IORESOURCE_IRQ,
 	},
 };
@@ -90,6 +90,7 @@ static void __init halibut_map_io(void)
 
 MACHINE_START(HALIBUT, "Halibut Board (QCT SURF7200A)")
 	.atag_offset	= 0x100,
+	.nr_irqs	= MSM7X00_NR_IRQS,
 	.map_io		= halibut_map_io,
 	.init_early	= halibut_init_early,
 	.init_irq	= halibut_init_irq,
diff --git a/arch/arm/mach-msm/board-msm7x30.c b/arch/arm/mach-msm/board-msm7x30.c
index 95e0cdde23a7..e0eb8cf9c53c 100644
--- a/arch/arm/mach-msm/board-msm7x30.c
+++ b/arch/arm/mach-msm/board-msm7x30.c
@@ -134,7 +134,7 @@ static struct platform_device *devices[] __initdata = {
 };
 
 #define SMSM_FAKE_IRQ (0xff)
-static uint8_t msm_irq_to_smsm[NR_IRQS] = {
+static uint8_t msm_irq_to_smsm[MSM7X30_NR_IRQS] = {
 	[INT_MDDI_EXT] = 1,
 	[INT_MDDI_PRI] = 2,
 	[INT_MDDI_CLIENT] = 3,
@@ -208,6 +208,7 @@ static void __init msm7x30_map_io(void)
 
 MACHINE_START(MSM7X30_SURF, "QCT MSM7X30 SURF")
 	.atag_offset = 0x100,
+	.nr_irqs = MSM7X30_NR_IRQS,
 	.fixup = msm7x30_fixup,
 	.reserve = msm7x30_reserve,
 	.map_io = msm7x30_map_io,
@@ -218,6 +219,7 @@ MACHINE_END
 
 MACHINE_START(MSM7X30_FFA, "QCT MSM7X30 FFA")
 	.atag_offset = 0x100,
+	.nr_irqs = MSM7X30_NR_IRQS,
 	.fixup = msm7x30_fixup,
 	.reserve = msm7x30_reserve,
 	.map_io = msm7x30_map_io,
@@ -228,6 +230,7 @@ MACHINE_END
 
 MACHINE_START(MSM7X30_FLUID, "QCT MSM7X30 FLUID")
 	.atag_offset = 0x100,
+	.nr_irqs = MSM7X30_NR_IRQS,
 	.fixup = msm7x30_fixup,
 	.reserve = msm7x30_reserve,
 	.map_io = msm7x30_map_io,
diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c
index 9b7cd93541f9..14c3c240fc44 100644
--- a/arch/arm/mach-msm/board-qsd8x50.c
+++ b/arch/arm/mach-msm/board-qsd8x50.c
@@ -28,7 +28,7 @@
 #include <asm/io.h>
 #include <asm/setup.h>
 
-#include <mach/irqs.h>
+#include <mach/irqs-8x50.h>
 #include <mach/sirc.h>
 #include <mach/vreg.h>
 #include <mach/clk.h>
@@ -222,7 +222,7 @@ static void __init qsd8x50_init_mmc(void)
 }
 
 #define SMSM_FAKE_IRQ (0xff)
-static uint8_t msm_irq_to_smsm[NR_IRQS] = {
+static uint8_t msm_irq_to_smsm[QSD8X50_NR_IRQS] = {
 	[INT_MDDI_EXT] = 1,
 	[INT_MDDI_PRI] = 2,
 	[INT_MDDI_CLIENT] = 3,
@@ -310,6 +310,7 @@ static void __init qsd8x50_init_irq_rev_a(void)
 
 MACHINE_START(QSD8X50A_ST1_5, "QCT QSD8X50A ST1.5")
 	.atag_offset = 0x100,
+	.nr_irqs = QSD8X50_NR_IRQS,
 	.map_io = msm_map_qsd8x50_io_rev_a,
 	.init_irq = qsd8x50_init_irq_rev_a,
 	.init_machine = qsd8x50_init,
diff --git a/arch/arm/mach-msm/board-trout-gpio.c b/arch/arm/mach-msm/board-trout-gpio.c
index 722ad63b7edc..4daf7816c736 100644
--- a/arch/arm/mach-msm/board-trout-gpio.c
+++ b/arch/arm/mach-msm/board-trout-gpio.c
@@ -18,6 +18,7 @@
 #include <linux/interrupt.h>
 #include <linux/gpio.h>
 
+#include <mach/irqs-7x00.h>
 #include "board-trout.h"
 
 static uint8_t trout_int_mask[2] = {
@@ -222,9 +223,9 @@ int __init trout_init_gpio(void)
 	for (i = 0; i < ARRAY_SIZE(msm_gpio_banks); i++)
 		gpiochip_add(&msm_gpio_banks[i].chip);
 
-	irq_set_irq_type(MSM_GPIO_TO_INT(17), IRQF_TRIGGER_HIGH);
-	irq_set_chained_handler(MSM_GPIO_TO_INT(17), trout_gpio_irq_handler);
-	irq_set_irq_wake(MSM_GPIO_TO_INT(17), 1);
+	irq_set_irq_type(MSM7X00_GPIO_TO_INT(17), IRQF_TRIGGER_HIGH);
+	irq_set_chained_handler(MSM7X00_GPIO_TO_INT(17), trout_gpio_irq_handler);
+	irq_set_irq_wake(MSM7X00_GPIO_TO_INT(17), 1);
 
 	return 0;
 }
diff --git a/arch/arm/mach-msm/board-trout-mmc.c b/arch/arm/mach-msm/board-trout-mmc.c
index 608d86b171c4..334de79de87e 100644
--- a/arch/arm/mach-msm/board-trout-mmc.c
+++ b/arch/arm/mach-msm/board-trout-mmc.c
@@ -16,6 +16,7 @@
 
 #include <mach/vreg.h>
 #include <mach/clk.h>
+#include <mach/irqs-7x00.h>
 
 #include <linux/platform_data/mmc-msm_sdcc.h>
 
diff --git a/arch/arm/mach-msm/board-trout.c b/arch/arm/mach-msm/board-trout.c
index 9737e43a2887..16a2f8912d3b 100644
--- a/arch/arm/mach-msm/board-trout.c
+++ b/arch/arm/mach-msm/board-trout.c
@@ -28,6 +28,7 @@
 #include <asm/setup.h>
 
 #include <mach/hardware.h>
+#include <mach/irqs-7x00.h>
 #include <mach/msm_iomap-7x00.h>
 
 #include "devices.h"
@@ -96,6 +97,7 @@ static void __init trout_map_io(void)
 
 MACHINE_START(TROUT, "HTC Dream")
 	.atag_offset	= 0x100,
+	.nr_irqs	= MSM7X00_NR_IRQS,
 	.fixup		= trout_fixup,
 	.map_io		= trout_map_io,
 	.init_early	= trout_init_early,
diff --git a/arch/arm/mach-msm/devices-msm7x00.c b/arch/arm/mach-msm/devices-msm7x00.c
index 38c16313f433..84bd323aff5e 100644
--- a/arch/arm/mach-msm/devices-msm7x00.c
+++ b/arch/arm/mach-msm/devices-msm7x00.c
@@ -18,7 +18,7 @@
 #include <linux/clkdev.h>
 #include <asm/mach/map.h>
 
-#include <mach/irqs.h>
+#include <mach/irqs-7x00.h>
 #include <mach/msm_iomap.h>
 #include <mach/msm_iomap-7x00.h>
 #include "devices.h"
diff --git a/arch/arm/mach-msm/devices-msm7x30.c b/arch/arm/mach-msm/devices-msm7x30.c
index 197d2b8afa20..0094278f24d2 100644
--- a/arch/arm/mach-msm/devices-msm7x30.c
+++ b/arch/arm/mach-msm/devices-msm7x30.c
@@ -19,7 +19,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/clkdev.h>
 #include <asm/mach/map.h>
-#include <mach/irqs.h>
+#include <mach/irqs-7x30.h>
 #include <mach/msm_iomap-7x30.h>
 
 #include "devices.h"
diff --git a/arch/arm/mach-msm/devices-qsd8x50.c b/arch/arm/mach-msm/devices-qsd8x50.c
index 3fd28b702591..e96c1e6a36e3 100644
--- a/arch/arm/mach-msm/devices-qsd8x50.c
+++ b/arch/arm/mach-msm/devices-qsd8x50.c
@@ -19,7 +19,7 @@
 #include <linux/dma-mapping.h>
 #include <asm/mach/map.h>
 
-#include <mach/irqs.h>
+#include <mach/irqs-8x50.h>
 #include <mach/msm_iomap.h>
 #include <mach/msm_iomap-8x50.h>
 
diff --git a/arch/arm/mach-msm/include/mach/entry-macro.S b/arch/arm/mach-msm/include/mach/entry-macro.S
deleted file mode 100644
index f2ae9087f654..000000000000
--- a/arch/arm/mach-msm/include/mach/entry-macro.S
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- *
- */
-
-#if !defined(CONFIG_ARM_GIC)
-#include <mach/msm_iomap.h>
-
-	.macro	get_irqnr_preamble, base, tmp
-	@ enable imprecise aborts
-	cpsie	a
-	mov	\base, #MSM_VIC_BASE
-	.endm
-
-	.macro	get_irqnr_and_base, irqnr, irqstat, base, tmp
-	@ 0xD0 has irq# or old irq# if the irq has been handled
-	@ 0xD4 has irq# or -1 if none pending *but* if you just
-	@ read 0xD4 you never get the first irq for some reason
-	ldr	\irqnr, [\base, #0xD0]
-	ldr	\irqnr, [\base, #0xD4]
-	cmp	\irqnr, #0xffffffff
-	.endm
-#endif
diff --git a/arch/arm/mach-msm/include/mach/irqs-7x00.h b/arch/arm/mach-msm/include/mach/irqs-7x00.h
index f1fe70612fe9..43effda6d46d 100644
--- a/arch/arm/mach-msm/include/mach/irqs-7x00.h
+++ b/arch/arm/mach-msm/include/mach/irqs-7x00.h
@@ -71,5 +71,8 @@
 #define NR_MSM_IRQS 64
 #define NR_GPIO_IRQS 122
 #define NR_BOARD_IRQS 64
+#define MSM7X00_NR_IRQS (NR_MSM_IRQS + NR_GPIO_IRQS + NR_BOARD_IRQS)
+
+#define MSM7X00_GPIO_TO_INT(n) (NR_MSM_IRQS + (n))
 
 #endif
diff --git a/arch/arm/mach-msm/include/mach/irqs-7x30.h b/arch/arm/mach-msm/include/mach/irqs-7x30.h
index 1f15902655fd..d2d9febf6d64 100644
--- a/arch/arm/mach-msm/include/mach/irqs-7x30.h
+++ b/arch/arm/mach-msm/include/mach/irqs-7x30.h
@@ -150,4 +150,6 @@
 				NR_PMIC8058_MISC_IRQS)
 #define NR_BOARD_IRQS		NR_PMIC8058_IRQS
 
+#define MSM7X30_NR_IRQS (NR_MSM_IRQS + NR_GPIO_IRQS + NR_BOARD_IRQS)
+
 #endif /* __ASM_ARCH_MSM_IRQS_7X30_H */
diff --git a/arch/arm/mach-msm/include/mach/irqs-8x50.h b/arch/arm/mach-msm/include/mach/irqs-8x50.h
index 9a6036119a8d..2761ecb86aab 100644
--- a/arch/arm/mach-msm/include/mach/irqs-8x50.h
+++ b/arch/arm/mach-msm/include/mach/irqs-8x50.h
@@ -85,6 +85,8 @@
 #define NR_MSM_IRQS 64
 #define NR_BOARD_IRQS 64
 
+#define QSD8X50_NR_IRQS (NR_MSM_IRQS + NR_GPIO_IRQS + NR_BOARD_IRQS)
+
 /*
  * Secondary interrupt controller interrupts
  */
diff --git a/arch/arm/mach-msm/include/mach/irqs.h b/arch/arm/mach-msm/include/mach/irqs.h
deleted file mode 100644
index 164d355c96ea..000000000000
--- a/arch/arm/mach-msm/include/mach/irqs.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2007 Google, Inc.
- * Copyright (c) 2008-2010, Code Aurora Forum. All rights reserved.
- * Author: Brian Swetland <swetland@google.com>
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef __ASM_ARCH_MSM_IRQS_H
-#define __ASM_ARCH_MSM_IRQS_H
-
-#define MSM_IRQ_BIT(irq)     (1 << ((irq) & 31))
-
-#if defined(CONFIG_ARCH_MSM7X30)
-#include "irqs-7x30.h"
-#elif defined(CONFIG_ARCH_QSD8X50)
-#include "irqs-8x50.h"
-#include "sirc.h"
-#elif defined(CONFIG_ARCH_MSM_ARM11)
-#include "irqs-7x00.h"
-#else
-#error "Unknown architecture specification"
-#endif
-
-#define NR_IRQS (NR_MSM_IRQS + NR_GPIO_IRQS + NR_BOARD_IRQS)
-#define MSM_GPIO_TO_INT(n) (NR_MSM_IRQS + (n))
-#define MSM_INT_TO_REG(base, irq) (base + irq / 32)
-
-#endif
diff --git a/arch/arm/mach-msm/irq-vic.c b/arch/arm/mach-msm/irq-vic.c
index 33a52f570dae..55a39cdaf3f8 100644
--- a/arch/arm/mach-msm/irq-vic.c
+++ b/arch/arm/mach-msm/irq-vic.c
@@ -22,6 +22,7 @@
 #include <linux/irq.h>
 #include <linux/io.h>
 
+#include <asm/exception.h>
 #include <asm/cacheflush.h>
 
 #include <mach/hardware.h>
@@ -242,11 +243,34 @@ static struct irq_chip msm_irq_chip = {
 	.irq_set_type  = msm_irq_set_type,
 };
 
+static void __exception_irq_entry msm_vic_handle_irq(struct pt_regs *regs)
+{
+	int irq;
+
+	do {
+		/*
+		 * 0xD0 has irq# or old irq# if the irq has been handled
+		 * 0xD4 has irq# or -1 if none pending *but* if you just
+		 * read 0xD4 you never get the first irq for some reason
+		 */
+		irq = readl(VIC_IRQ_VEC_RD);
+		irq = readl(VIC_IRQ_VEC_PEND_RD);
+
+		if (irq == -1)
+			break;
+
+		generic_handle_irq(irq);
+	} while (1);
+}
+
 void __init msm_init_vic(uint8_t *irq_to_smsm, int nr)
 {
 	unsigned n;
 	msm_irq_to_smsm = irq_to_smsm;
 
+	/* set entry point */
+	set_handle_irq(msm_vic_handle_irq);
+
 	/* select level interrupts */
 	msm_irq_write_all_regs(VIC_INT_TYPE0, 0, nr / 32);
 
diff --git a/arch/arm/mach-msm/irq.c b/arch/arm/mach-msm/irq.c
index ea514be390c6..6b1a918c7592 100644
--- a/arch/arm/mach-msm/irq.c
+++ b/arch/arm/mach-msm/irq.c
@@ -21,7 +21,9 @@
 #include <linux/timer.h>
 #include <linux/irq.h>
 #include <linux/io.h>
+#include <asm/exception.h>
 
+#include <mach/irqs-7x00.h>
 #include <mach/hardware.h>
 
 #include <mach/msm_iomap.h>
@@ -118,10 +120,33 @@ static struct irq_chip msm_irq_chip = {
 	.irq_set_type  = msm_irq_set_type,
 };
 
+static void __exception_irq_entry msm_handle_irq(struct pt_regs *regs)
+{
+	int irq;
+
+	do {
+		/*
+		 * 0xD0 has irq# or old irq# if the irq has been handled
+		 * 0xD4 has irq# or -1 if none pending *but* if you just
+		 * read 0xD4 you never get the first irq for some reason
+		 */
+		irq = readl(VIC_IRQ_VEC_RD);
+		irq = readl(VIC_IRQ_VEC_PEND_RD);
+
+		if (irq == -1)
+			break;
+
+		generic_handle_irq(irq);
+	} while (1);
+}
+
 void __init msm_init_irq(void)
 {
 	unsigned n;
 
+	/* set entry point */
+	set_handle_irq(msm_handle_irq);
+
 	/* select level interrupts */
 	writel(0, VIC_INT_TYPE0);
 	writel(0, VIC_INT_TYPE1);
-- 
2.1.0.rc2

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RFC PATCH 16/18] ARM: msm: make msm_smd.h global
  2015-03-04 19:32 [RFC PATCH 00/18] ARM: msm multiplatform support Arnd Bergmann
                   ` (14 preceding siblings ...)
  2015-03-04 19:33 ` [RFC PATCH 15/18] ARM: msm: clean up irq handling Arnd Bergmann
@ 2015-03-04 19:33 ` Arnd Bergmann
  2015-03-04 19:33 ` [RFC PATCH 17/18] ARM: msm: make all header files local Arnd Bergmann
                   ` (5 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnd Bergmann @ 2015-03-04 19:33 UTC (permalink / raw)
  To: linux-arm-kernel

This is one of several approaches to the problem of this
header file not being visible on ARCH_MULTIPLATFORM otherwise.

Signed-off-by: Arnd Bergmann <arnd@arnd@arndb.de>
---
 arch/arm/mach-msm/smd.c                                     | 6 +++---
 drivers/char/msm_smd_pkt.c                                  | 2 +-
 drivers/tty/serial/msm_smd_tty.c                            | 2 +-
 {arch/arm/mach-msm/include/mach => include/linux}/msm_smd.h | 0
 4 files changed, 5 insertions(+), 5 deletions(-)
 rename {arch/arm/mach-msm/include/mach => include/linux}/msm_smd.h (100%)

diff --git a/arch/arm/mach-msm/smd.c b/arch/arm/mach-msm/smd.c
index b87f183a86c5..b50b495ab281 100644
--- a/arch/arm/mach-msm/smd.c
+++ b/arch/arm/mach-msm/smd.c
@@ -29,7 +29,7 @@
 #include <linux/debugfs.h>
 #include <linux/delay.h>
 
-#include <mach/msm_smd.h>
+#include <linux/msm_smd.h>
 
 #include "smd_private.h"
 #include "proc_comm.h"
@@ -59,14 +59,14 @@ enum {
 
 static int msm_smd_debug_mask;
 
-struct shared_info {
+struct msm_smd_shared_info {
 	int ready;
 	void __iomem *state;
 };
 
 static unsigned dummy_state[SMSM_STATE_COUNT];
 
-static struct shared_info smd_info = {
+static struct msm_smd_shared_info smd_info = {
 	/* FIXME: not a real __iomem pointer */
 	.state = &dummy_state,
 };
diff --git a/drivers/char/msm_smd_pkt.c b/drivers/char/msm_smd_pkt.c
index ba82a06d9684..2ee28ed77791 100644
--- a/drivers/char/msm_smd_pkt.c
+++ b/drivers/char/msm_smd_pkt.c
@@ -31,7 +31,7 @@
 #include <linux/workqueue.h>
 #include <linux/poll.h>
 
-#include <mach/msm_smd.h>
+#include <linux/msm_smd.h>
 
 #define NUM_SMD_PKT_PORTS 9
 #define DEVICE_NAME "smdpkt"
diff --git a/drivers/tty/serial/msm_smd_tty.c b/drivers/tty/serial/msm_smd_tty.c
index 1238ac370bff..246b81c316c0 100644
--- a/drivers/tty/serial/msm_smd_tty.c
+++ b/drivers/tty/serial/msm_smd_tty.c
@@ -24,7 +24,7 @@
 #include <linux/tty_driver.h>
 #include <linux/tty_flip.h>
 
-#include <mach/msm_smd.h>
+#include <linux/msm_smd.h>
 
 #define MAX_SMD_TTYS 32
 
diff --git a/arch/arm/mach-msm/include/mach/msm_smd.h b/include/linux/msm_smd.h
similarity index 100%
rename from arch/arm/mach-msm/include/mach/msm_smd.h
rename to include/linux/msm_smd.h
-- 
2.1.0.rc2

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RFC PATCH 17/18] ARM: msm: make all header files local
  2015-03-04 19:32 [RFC PATCH 00/18] ARM: msm multiplatform support Arnd Bergmann
                   ` (15 preceding siblings ...)
  2015-03-04 19:33 ` [RFC PATCH 16/18] ARM: msm: make msm_smd.h global Arnd Bergmann
@ 2015-03-04 19:33 ` Arnd Bergmann
  2015-03-04 19:33 ` [RFC PATCH 18/18] ARM: msm: enable multiplatform support Arnd Bergmann
                   ` (4 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnd Bergmann @ 2015-03-04 19:33 UTC (permalink / raw)
  To: linux-arm-kernel

Nothing outside of mach-msm includes the headers any more,
so we can simply move them all into the main platform
directory for msm.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-msm/board-halibut.c                     |  8 +++-----
 arch/arm/mach-msm/board-msm7x30.c                     | 11 +++++------
 arch/arm/mach-msm/board-qsd8x50.c                     | 13 ++++++-------
 arch/arm/mach-msm/board-sapphire.c                    | 11 ++++-------
 arch/arm/mach-msm/board-trout-gpio.c                  |  2 +-
 arch/arm/mach-msm/board-trout-mmc.c                   | 14 +++++---------
 arch/arm/mach-msm/board-trout-panel.c                 |  2 +-
 arch/arm/mach-msm/board-trout.c                       |  8 +++-----
 arch/arm/mach-msm/board-trout.h                       |  2 +-
 arch/arm/mach-msm/{include/mach => }/clk.h            |  0
 arch/arm/mach-msm/clock-pcom.c                        |  5 ++---
 arch/arm/mach-msm/clock.h                             |  2 +-
 arch/arm/mach-msm/devices-msm7x00.c                   | 13 ++++++-------
 arch/arm/mach-msm/devices-msm7x30.c                   | 19 ++++++++-----------
 arch/arm/mach-msm/devices-qsd8x50.c                   | 17 +++++++----------
 arch/arm/mach-msm/gpio-msm-v1.c                       |  2 +-
 arch/arm/mach-msm/gpiomux.h                           |  2 +-
 arch/arm/mach-msm/include/mach/hardware.h             | 18 ------------------
 arch/arm/mach-msm/irq-vic.c                           |  5 +----
 arch/arm/mach-msm/irq.c                               |  6 ++----
 arch/arm/mach-msm/{include/mach => }/irqs-7x00.h      |  0
 arch/arm/mach-msm/{include/mach => }/irqs-7x30.h      |  0
 arch/arm/mach-msm/{include/mach => }/irqs-8x50.h      |  0
 arch/arm/mach-msm/{include/mach => }/msm_gpiomux.h    |  0
 arch/arm/mach-msm/{include/mach => }/msm_iomap-7x00.h |  3 +--
 arch/arm/mach-msm/{include/mach => }/msm_iomap-7x30.h |  0
 arch/arm/mach-msm/{include/mach => }/msm_iomap-8x50.h |  0
 arch/arm/mach-msm/{include/mach => }/msm_iomap.h      |  0
 arch/arm/mach-msm/proc_comm.c                         |  2 +-
 arch/arm/mach-msm/sirc.c                              |  5 +++--
 arch/arm/mach-msm/{include/mach => }/sirc.h           |  0
 arch/arm/mach-msm/smd.c                               |  2 +-
 arch/arm/mach-msm/smd_debug.c                         |  3 +--
 arch/arm/mach-msm/smd_private.h                       |  2 +-
 arch/arm/mach-msm/vreg.c                              |  2 +-
 arch/arm/mach-msm/{include/mach => }/vreg.h           |  0
 36 files changed, 67 insertions(+), 112 deletions(-)
 rename arch/arm/mach-msm/{include/mach => }/clk.h (100%)
 delete mode 100644 arch/arm/mach-msm/include/mach/hardware.h
 rename arch/arm/mach-msm/{include/mach => }/irqs-7x00.h (100%)
 rename arch/arm/mach-msm/{include/mach => }/irqs-7x30.h (100%)
 rename arch/arm/mach-msm/{include/mach => }/irqs-8x50.h (100%)
 rename arch/arm/mach-msm/{include/mach => }/msm_gpiomux.h (100%)
 rename arch/arm/mach-msm/{include/mach => }/msm_iomap-7x00.h (98%)
 rename arch/arm/mach-msm/{include/mach => }/msm_iomap-7x30.h (100%)
 rename arch/arm/mach-msm/{include/mach => }/msm_iomap-8x50.h (100%)
 rename arch/arm/mach-msm/{include/mach => }/msm_iomap.h (100%)
 rename arch/arm/mach-msm/{include/mach => }/sirc.h (100%)
 rename arch/arm/mach-msm/{include/mach => }/vreg.h (100%)

diff --git a/arch/arm/mach-msm/board-halibut.c b/arch/arm/mach-msm/board-halibut.c
index 15fd63e88018..04f6822b05c1 100644
--- a/arch/arm/mach-msm/board-halibut.c
+++ b/arch/arm/mach-msm/board-halibut.c
@@ -21,21 +21,19 @@
 #include <linux/io.h>
 #include <linux/delay.h>
 
-#include <mach/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <asm/mach/flash.h>
 #include <asm/setup.h>
 
-#include <mach/irqs-7x00.h>
-#include <mach/msm_iomap-7x00.h>
-
 #include <linux/mtd/nand.h>
 #include <linux/mtd/partitions.h>
 
-#include "devices.h"
 #include "common.h"
+#include "devices.h"
+#include "irqs-7x00.h"
+#include "msm_iomap-7x00.h"
 
 static struct resource smc91x_resources[] = {
 	[0] = {
diff --git a/arch/arm/mach-msm/board-msm7x30.c b/arch/arm/mach-msm/board-msm7x30.c
index e0eb8cf9c53c..d9223e5eaccc 100644
--- a/arch/arm/mach-msm/board-msm7x30.c
+++ b/arch/arm/mach-msm/board-msm7x30.c
@@ -30,15 +30,14 @@
 #include <asm/memory.h>
 #include <asm/setup.h>
 
-#include <mach/clk.h>
-#include <mach/irqs-7x30.h>
-#include <mach/msm_iomap-7x30.h>
-
-#include <mach/vreg.h>
+#include "clk.h"
+#include "common.h"
 #include "devices.h"
 #include "gpiomux.h"
+#include "irqs-7x30.h"
+#include "msm_iomap-7x30.h"
 #include "proc_comm.h"
-#include "common.h"
+#include "vreg.h"
 
 static void __init msm7x30_fixup(struct tag *tag, char **cmdline)
 {
diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c
index 14c3c240fc44..4d467a51f259 100644
--- a/arch/arm/mach-msm/board-qsd8x50.c
+++ b/arch/arm/mach-msm/board-qsd8x50.c
@@ -17,6 +17,7 @@
 #include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/irq.h>
+#include <linux/platform_data/mmc-msm_sdcc.h>
 #include <linux/platform_device.h>
 #include <linux/delay.h>
 #include <linux/usb/msm_hsusb.h>
@@ -28,15 +29,13 @@
 #include <asm/io.h>
 #include <asm/setup.h>
 
-#include <mach/irqs-8x50.h>
-#include <mach/sirc.h>
-#include <mach/vreg.h>
-#include <mach/clk.h>
-#include <linux/platform_data/mmc-msm_sdcc.h>
-
-#include "devices.h"
+#include "clk.h"
 #include "common.h"
+#include "devices.h"
 #include "gpiomux.h"
+#include "irqs-8x50.h"
+#include "sirc.h"
+#include "vreg.h"
 
 static const resource_size_t qsd8x50_surf_smc91x_base __initconst = 0x70000300;
 static const unsigned        qsd8x50_surf_smc91x_gpio __initconst = 156;
diff --git a/arch/arm/mach-msm/board-sapphire.c b/arch/arm/mach-msm/board-sapphire.c
index e3aa71e839f4..5cd3056e3497 100644
--- a/arch/arm/mach-msm/board-sapphire.c
+++ b/arch/arm/mach-msm/board-sapphire.c
@@ -19,16 +19,12 @@
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/device.h>
-
 #include <linux/delay.h>
 
-#include <mach/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <asm/mach/flash.h>
-#include <mach/vreg.h>
-
 #include <asm/io.h>
 #include <asm/delay.h>
 #include <asm/setup.h>
@@ -37,11 +33,12 @@
 #include <linux/mtd/partitions.h>
 #include <linux/memblock.h>
 
-#include "gpio_chip.h"
 #include "board-sapphire.h"
-#include "proc_comm.h"
-#include "devices.h"
 #include "common.h"
+#include "devices.h"
+#include "gpio_chip.h"
+#include "proc_comm.h"
+#include "vreg.h"
 
 void msm_init_irq(void);
 void msm_init_gpio(void);
diff --git a/arch/arm/mach-msm/board-trout-gpio.c b/arch/arm/mach-msm/board-trout-gpio.c
index 4daf7816c736..d8e75a4e2a44 100644
--- a/arch/arm/mach-msm/board-trout-gpio.c
+++ b/arch/arm/mach-msm/board-trout-gpio.c
@@ -18,8 +18,8 @@
 #include <linux/interrupt.h>
 #include <linux/gpio.h>
 
-#include <mach/irqs-7x00.h>
 #include "board-trout.h"
+#include "irqs-7x00.h"
 
 static uint8_t trout_int_mask[2] = {
 	[0] = 0xff, /* mask all interrupts */
diff --git a/arch/arm/mach-msm/board-trout-mmc.c b/arch/arm/mach-msm/board-trout-mmc.c
index 334de79de87e..382dcd166707 100644
--- a/arch/arm/mach-msm/board-trout-mmc.c
+++ b/arch/arm/mach-msm/board-trout-mmc.c
@@ -5,6 +5,7 @@
 #include <linux/clk.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/platform_data/mmc-msm_sdcc.h>
 #include <linux/platform_device.h>
 #include <linux/delay.h>
 #include <linux/mmc/host.h>
@@ -14,17 +15,12 @@
 
 #include <asm/io.h>
 
-#include <mach/vreg.h>
-#include <mach/clk.h>
-#include <mach/irqs-7x00.h>
-
-#include <linux/platform_data/mmc-msm_sdcc.h>
-
-#include "devices.h"
-
 #include "board-trout.h"
-
+#include "clk.h"
+#include "devices.h"
+#include "irqs-7x00.h"
 #include "proc_comm.h"
+#include "vreg.h"
 
 #define DEBUG_SDSLOT_VDD 1
 
diff --git a/arch/arm/mach-msm/board-trout-panel.c b/arch/arm/mach-msm/board-trout-panel.c
index e06c4f309fda..3e5961787271 100644
--- a/arch/arm/mach-msm/board-trout-panel.c
+++ b/arch/arm/mach-msm/board-trout-panel.c
@@ -14,12 +14,12 @@
 #include <asm/system_info.h>
 
 #include <linux/platform_data/video-msm_fb.h>
-#include <mach/vreg.h>
 
 #include "board-trout.h"
 #include "proc_comm.h"
 #include "clock-pcom.h"
 #include "devices.h"
+#include "vreg.h"
 
 #define TROUT_DEFAULT_BACKLIGHT_BRIGHTNESS 255
 
diff --git a/arch/arm/mach-msm/board-trout.c b/arch/arm/mach-msm/board-trout.c
index 16a2f8912d3b..d3e3840e7366 100644
--- a/arch/arm/mach-msm/board-trout.c
+++ b/arch/arm/mach-msm/board-trout.c
@@ -27,13 +27,11 @@
 #include <asm/mach/map.h>
 #include <asm/setup.h>
 
-#include <mach/hardware.h>
-#include <mach/irqs-7x00.h>
-#include <mach/msm_iomap-7x00.h>
-
-#include "devices.h"
 #include "board-trout.h"
 #include "common.h"
+#include "devices.h"
+#include "irqs-7x00.h"
+#include "msm_iomap-7x00.h"
 
 extern int trout_init_mmc(unsigned int);
 
diff --git a/arch/arm/mach-msm/board-trout.h b/arch/arm/mach-msm/board-trout.h
index adb757abbb92..fc96b09cfaee 100644
--- a/arch/arm/mach-msm/board-trout.h
+++ b/arch/arm/mach-msm/board-trout.h
@@ -41,7 +41,7 @@
 #endif
 
 #define DECLARE_MSM_IOMAP
-#include <mach/msm_iomap.h>
+#include "msm_iomap.h"
 
 #define TROUT_4_BALL_UP_0     1
 #define TROUT_4_BALL_LEFT_0   18
diff --git a/arch/arm/mach-msm/include/mach/clk.h b/arch/arm/mach-msm/clk.h
similarity index 100%
rename from arch/arm/mach-msm/include/mach/clk.h
rename to arch/arm/mach-msm/clk.h
diff --git a/arch/arm/mach-msm/clock-pcom.c b/arch/arm/mach-msm/clock-pcom.c
index f5b69d736ee5..a1a926790873 100644
--- a/arch/arm/mach-msm/clock-pcom.c
+++ b/arch/arm/mach-msm/clock-pcom.c
@@ -20,11 +20,10 @@
 #include <linux/clk-provider.h>
 #include <linux/clkdev.h>
 
-#include <mach/clk.h>
-
-#include "proc_comm.h"
+#include "clk.h"
 #include "clock.h"
 #include "clock-pcom.h"
+#include "proc_comm.h"
 
 struct clk_pcom {
 	unsigned id;
diff --git a/arch/arm/mach-msm/clock.h b/arch/arm/mach-msm/clock.h
index 42d29dd7aafc..a49837da79dd 100644
--- a/arch/arm/mach-msm/clock.h
+++ b/arch/arm/mach-msm/clock.h
@@ -18,7 +18,7 @@
 #define __ARCH_ARM_MACH_MSM_CLOCK_H
 
 #include <linux/clk-provider.h>
-#include <mach/clk.h>
+#include "clk.h"
 
 #define CLK_FIRST_AVAILABLE_FLAG	0x00000100
 #define CLKFLAG_AUTO_OFF		0x00000200
diff --git a/arch/arm/mach-msm/devices-msm7x00.c b/arch/arm/mach-msm/devices-msm7x00.c
index 84bd323aff5e..e08f00338fd4 100644
--- a/arch/arm/mach-msm/devices-msm7x00.c
+++ b/arch/arm/mach-msm/devices-msm7x00.c
@@ -14,22 +14,21 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/platform_data/mmc-msm_sdcc.h>
 #include <linux/platform_device.h>
 #include <linux/clkdev.h>
 #include <asm/mach/map.h>
 
-#include <mach/irqs-7x00.h>
-#include <mach/msm_iomap.h>
-#include <mach/msm_iomap-7x00.h>
-#include "devices.h"
-
 #include <asm/mach/flash.h>
 #include <linux/mtd/nand.h>
 #include <linux/mtd/partitions.h>
 
-#include "clock.h"
 #include "clock-pcom.h"
-#include <linux/platform_data/mmc-msm_sdcc.h>
+#include "clock.h"
+#include "devices.h"
+#include "irqs-7x00.h"
+#include "msm_iomap-7x00.h"
+#include "msm_iomap.h"
 
 static struct map_desc msm_io_desc[] __initdata = {
 	MSM_DEVICE_TYPE(VIC, MT_DEVICE_NONSHARED),
diff --git a/arch/arm/mach-msm/devices-msm7x30.c b/arch/arm/mach-msm/devices-msm7x30.c
index 0094278f24d2..f88db1d3f36a 100644
--- a/arch/arm/mach-msm/devices-msm7x30.c
+++ b/arch/arm/mach-msm/devices-msm7x30.c
@@ -14,25 +14,22 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/platform_data/mmc-msm_sdcc.h>
 #include <linux/platform_device.h>
-
 #include <linux/dma-mapping.h>
 #include <linux/clkdev.h>
-#include <asm/mach/map.h>
-#include <mach/irqs-7x30.h>
-#include <mach/msm_iomap-7x30.h>
-
-#include "devices.h"
-#include "smd_private.h"
-#include "common.h"
 
+#include <asm/mach/map.h>
 #include <asm/mach/flash.h>
 
-#include "clock.h"
 #include "clock-pcom.h"
+#include "clock.h"
+#include "common.h"
+#include "devices.h"
+#include "irqs-7x30.h"
+#include "msm_iomap-7x30.h"
 #include "proc_comm.h"
-
-#include <linux/platform_data/mmc-msm_sdcc.h>
+#include "smd_private.h"
 
 static struct map_desc msm7x30_io_desc[] __initdata = {
 	MSM_DEVICE(VIC),
diff --git a/arch/arm/mach-msm/devices-qsd8x50.c b/arch/arm/mach-msm/devices-qsd8x50.c
index e96c1e6a36e3..bfec5b8f7071 100644
--- a/arch/arm/mach-msm/devices-qsd8x50.c
+++ b/arch/arm/mach-msm/devices-qsd8x50.c
@@ -14,23 +14,20 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/platform_data/mmc-msm_sdcc.h>
 #include <linux/platform_device.h>
 #include <linux/clkdev.h>
 #include <linux/dma-mapping.h>
 #include <asm/mach/map.h>
-
-#include <mach/irqs-8x50.h>
-#include <mach/msm_iomap.h>
-#include <mach/msm_iomap-8x50.h>
-
-#include "devices.h"
-#include "common.h"
-
 #include <asm/mach/flash.h>
 
-#include <linux/platform_data/mmc-msm_sdcc.h>
-#include "clock.h"
 #include "clock-pcom.h"
+#include "clock.h"
+#include "common.h"
+#include "devices.h"
+#include "irqs-8x50.h"
+#include "msm_iomap-8x50.h"
+#include "msm_iomap.h"
 
 static struct map_desc qsd8x50_io_desc[] __initdata = {
 	MSM_DEVICE(VIC),
diff --git a/arch/arm/mach-msm/gpio-msm-v1.c b/arch/arm/mach-msm/gpio-msm-v1.c
index 2700f9bda455..e90cdbf391ab 100644
--- a/arch/arm/mach-msm/gpio-msm-v1.c
+++ b/arch/arm/mach-msm/gpio-msm-v1.c
@@ -23,7 +23,7 @@
 #include <linux/platform_device.h>
 #include <linux/err.h>
 
-#include <mach/msm_gpiomux.h>
+#include "msm_gpiomux.h"
 
 /* see 80-VA736-2 Rev C pp 695-751
 **
diff --git a/arch/arm/mach-msm/gpiomux.h b/arch/arm/mach-msm/gpiomux.h
index cdc1578d1e73..fbb3bb969547 100644
--- a/arch/arm/mach-msm/gpiomux.h
+++ b/arch/arm/mach-msm/gpiomux.h
@@ -19,7 +19,7 @@
 
 #include <linux/bitops.h>
 #include <linux/errno.h>
-#include <mach/msm_gpiomux.h>
+#include "msm_gpiomux.h"
 #include "gpiomux-v1.h"
 
 /**
diff --git a/arch/arm/mach-msm/include/mach/hardware.h b/arch/arm/mach-msm/include/mach/hardware.h
deleted file mode 100644
index 2d126091ae41..000000000000
--- a/arch/arm/mach-msm/include/mach/hardware.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* arch/arm/mach-msm/include/mach/hardware.h
- *
- * Copyright (C) 2007 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef __ASM_ARCH_MSM_HARDWARE_H
-
-#endif
diff --git a/arch/arm/mach-msm/irq-vic.c b/arch/arm/mach-msm/irq-vic.c
index 55a39cdaf3f8..5c8d0f2715e0 100644
--- a/arch/arm/mach-msm/irq-vic.c
+++ b/arch/arm/mach-msm/irq-vic.c
@@ -25,10 +25,7 @@
 #include <asm/exception.h>
 #include <asm/cacheflush.h>
 
-#include <mach/hardware.h>
-
-#include <mach/msm_iomap.h>
-
+#include "msm_iomap.h"
 #include "smd_private.h"
 
 enum {
diff --git a/arch/arm/mach-msm/irq.c b/arch/arm/mach-msm/irq.c
index 6b1a918c7592..fe51a2cf9d6d 100644
--- a/arch/arm/mach-msm/irq.c
+++ b/arch/arm/mach-msm/irq.c
@@ -23,10 +23,8 @@
 #include <linux/io.h>
 #include <asm/exception.h>
 
-#include <mach/irqs-7x00.h>
-#include <mach/hardware.h>
-
-#include <mach/msm_iomap.h>
+#include "irqs-7x00.h"
+#include "msm_iomap.h"
 
 #define VIC_REG(off) (MSM_VIC_BASE + (off))
 
diff --git a/arch/arm/mach-msm/include/mach/irqs-7x00.h b/arch/arm/mach-msm/irqs-7x00.h
similarity index 100%
rename from arch/arm/mach-msm/include/mach/irqs-7x00.h
rename to arch/arm/mach-msm/irqs-7x00.h
diff --git a/arch/arm/mach-msm/include/mach/irqs-7x30.h b/arch/arm/mach-msm/irqs-7x30.h
similarity index 100%
rename from arch/arm/mach-msm/include/mach/irqs-7x30.h
rename to arch/arm/mach-msm/irqs-7x30.h
diff --git a/arch/arm/mach-msm/include/mach/irqs-8x50.h b/arch/arm/mach-msm/irqs-8x50.h
similarity index 100%
rename from arch/arm/mach-msm/include/mach/irqs-8x50.h
rename to arch/arm/mach-msm/irqs-8x50.h
diff --git a/arch/arm/mach-msm/include/mach/msm_gpiomux.h b/arch/arm/mach-msm/msm_gpiomux.h
similarity index 100%
rename from arch/arm/mach-msm/include/mach/msm_gpiomux.h
rename to arch/arm/mach-msm/msm_gpiomux.h
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-7x00.h b/arch/arm/mach-msm/msm_iomap-7x00.h
similarity index 98%
rename from arch/arm/mach-msm/include/mach/msm_iomap-7x00.h
rename to arch/arm/mach-msm/msm_iomap-7x00.h
index 27c7f5c0e708..058612bb23bf 100644
--- a/arch/arm/mach-msm/include/mach/msm_iomap-7x00.h
+++ b/arch/arm/mach-msm/msm_iomap-7x00.h
@@ -1,5 +1,4 @@
-/* arch/arm/mach-msm/include/mach/msm_iomap.h
- *
+/*
  * Copyright (C) 2007 Google, Inc.
  * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
  * Author: Brian Swetland <swetland@google.com>
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-7x30.h b/arch/arm/mach-msm/msm_iomap-7x30.h
similarity index 100%
rename from arch/arm/mach-msm/include/mach/msm_iomap-7x30.h
rename to arch/arm/mach-msm/msm_iomap-7x30.h
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h b/arch/arm/mach-msm/msm_iomap-8x50.h
similarity index 100%
rename from arch/arm/mach-msm/include/mach/msm_iomap-8x50.h
rename to arch/arm/mach-msm/msm_iomap-8x50.h
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap.h b/arch/arm/mach-msm/msm_iomap.h
similarity index 100%
rename from arch/arm/mach-msm/include/mach/msm_iomap.h
rename to arch/arm/mach-msm/msm_iomap.h
diff --git a/arch/arm/mach-msm/proc_comm.c b/arch/arm/mach-msm/proc_comm.c
index f79f57d7a0dd..44788f346b1b 100644
--- a/arch/arm/mach-msm/proc_comm.c
+++ b/arch/arm/mach-msm/proc_comm.c
@@ -18,8 +18,8 @@
 #include <linux/errno.h>
 #include <linux/io.h>
 #include <linux/spinlock.h>
-#include <mach/msm_iomap.h>
 
+#include "msm_iomap.h"
 #include "proc_comm.h"
 
 /* msm7x00 uses a different method and needs to override
diff --git a/arch/arm/mach-msm/sirc.c b/arch/arm/mach-msm/sirc.c
index bfef62c0e8dc..60b305918097 100644
--- a/arch/arm/mach-msm/sirc.c
+++ b/arch/arm/mach-msm/sirc.c
@@ -20,8 +20,9 @@
 #include <linux/irq.h>
 #include <linux/interrupt.h>
 #include <asm/irq.h>
-#include <mach/msm_iomap-8x50.h>
-#include <mach/sirc.h>
+
+#include "msm_iomap-8x50.h"
+#include "sirc.h"
 
 #define SPSS_SIRC_INT_SELECT          (MSM_SIRC_BASE + 0x00)
 #define SPSS_SIRC_INT_ENABLE          (MSM_SIRC_BASE + 0x04)
diff --git a/arch/arm/mach-msm/include/mach/sirc.h b/arch/arm/mach-msm/sirc.h
similarity index 100%
rename from arch/arm/mach-msm/include/mach/sirc.h
rename to arch/arm/mach-msm/sirc.h
diff --git a/arch/arm/mach-msm/smd.c b/arch/arm/mach-msm/smd.c
index b50b495ab281..54fb5703809e 100644
--- a/arch/arm/mach-msm/smd.c
+++ b/arch/arm/mach-msm/smd.c
@@ -31,8 +31,8 @@
 
 #include <linux/msm_smd.h>
 
-#include "smd_private.h"
 #include "proc_comm.h"
+#include "smd_private.h"
 
 enum msm_smd_version {
 	SMD_MSM7X00,
diff --git a/arch/arm/mach-msm/smd_debug.c b/arch/arm/mach-msm/smd_debug.c
index daffcc9e802d..e81ff1224f63 100644
--- a/arch/arm/mach-msm/smd_debug.c
+++ b/arch/arm/mach-msm/smd_debug.c
@@ -17,8 +17,7 @@
 #include <linux/debugfs.h>
 #include <linux/list.h>
 
-#include <mach/msm_iomap.h>
-
+#include "msm_iomap.h"
 #include "smd_private.h"
 
 static char *chstate(unsigned n)
diff --git a/arch/arm/mach-msm/smd_private.h b/arch/arm/mach-msm/smd_private.h
index 50f7b7d22023..7f88fa61f487 100644
--- a/arch/arm/mach-msm/smd_private.h
+++ b/arch/arm/mach-msm/smd_private.h
@@ -21,7 +21,7 @@
 #include <linux/list.h>
 #include <linux/io.h>
 
-#include <mach/msm_iomap.h>
+#include "msm_iomap.h"
 
 struct smem_heap_info {
 	unsigned initialized;
diff --git a/arch/arm/mach-msm/vreg.c b/arch/arm/mach-msm/vreg.c
index bd66ed04d6dc..c947c8180b85 100644
--- a/arch/arm/mach-msm/vreg.c
+++ b/arch/arm/mach-msm/vreg.c
@@ -21,9 +21,9 @@
 #include <linux/debugfs.h>
 #include <linux/module.h>
 #include <linux/string.h>
-#include <mach/vreg.h>
 
 #include "proc_comm.h"
+#include "vreg.h"
 
 struct vreg {
 	const char *name;
diff --git a/arch/arm/mach-msm/include/mach/vreg.h b/arch/arm/mach-msm/vreg.h
similarity index 100%
rename from arch/arm/mach-msm/include/mach/vreg.h
rename to arch/arm/mach-msm/vreg.h
-- 
2.1.0.rc2

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RFC PATCH 18/18] ARM: msm: enable multiplatform support
  2015-03-04 19:32 [RFC PATCH 00/18] ARM: msm multiplatform support Arnd Bergmann
                   ` (16 preceding siblings ...)
  2015-03-04 19:33 ` [RFC PATCH 17/18] ARM: msm: make all header files local Arnd Bergmann
@ 2015-03-04 19:33 ` Arnd Bergmann
  2015-03-04 20:31 ` [RFC PATCH 00/18] ARM: msm " Paul Bolle
                   ` (3 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnd Bergmann @ 2015-03-04 19:33 UTC (permalink / raw)
  To: linux-arm-kernel

All prerequisites are complete now, so we can finally move
msm into multiplatform. This also rearranges the Kconfig file
for msm to look more like the other platforms, and we enable
all msm boards in the msm_defconfig file.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/Kconfig               | 14 -------
 arch/arm/configs/msm_defconfig |  7 ++++
 arch/arm/mach-msm/Kconfig      | 91 ++++++++++++++----------------------------
 arch/arm/mach-msm/Makefile     |  2 +
 4 files changed, 40 insertions(+), 74 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index ef94bccbe137..8d2a0ba7cb05 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -554,20 +554,6 @@ config ARCH_PXA
 	help
 	  Support for Intel/Marvell's PXA2xx/PXA3xx processor line.
 
-config ARCH_MSM
-	bool "Qualcomm MSM (non-multiplatform)"
-	select ARCH_REQUIRE_GPIOLIB
-	select COMMON_CLK
-	select GENERIC_CLOCKEVENTS
-	select MULTI_IRQ_HANDLER
-	select SPARSE_IRQ
-	help
-	  Support for Qualcomm MSM/QSD based systems.  This runs on the
-	  apps processor of the MSM/QSD and depends on a shared memory
-	  interface to the modem processor which runs the baseband
-	  stack and controls some vital subsystems
-	  (clock and power control, etc).
-
 config ARCH_SHMOBILE_LEGACY
 	bool "Renesas ARM SoCs (non-multiplatform)"
 	select ARCH_SHMOBILE
diff --git a/arch/arm/configs/msm_defconfig b/arch/arm/configs/msm_defconfig
index dd18c9e527d6..6d1e5830e081 100644
--- a/arch/arm/configs/msm_defconfig
+++ b/arch/arm/configs/msm_defconfig
@@ -17,7 +17,14 @@ CONFIG_MODULE_UNLOAD=y
 CONFIG_MODULE_FORCE_UNLOAD=y
 CONFIG_MODVERSIONS=y
 CONFIG_PARTITION_ADVANCED=y
+CONFIG_ARCH_MULTI_V6=y
+CONFIG_ARCH_MULTI_V7=y
 CONFIG_ARCH_MSM=y
+CONFIG_MACH_HALIBUT=y
+CONFIG_MACH_TROUT=y
+CONFIG_MACH_MSM7X30_SURF=y
+CONFIG_MACH_QSD8X50_SURF=y
+CONFIG_MACH_QSD8X50A_ST1_5=y
 CONFIG_PREEMPT=y
 CONFIG_AEABI=y
 CONFIG_HIGHMEM=y
diff --git a/arch/arm/mach-msm/Kconfig b/arch/arm/mach-msm/Kconfig
index a6b50e62a495..9ae3e59c0fdc 100644
--- a/arch/arm/mach-msm/Kconfig
+++ b/arch/arm/mach-msm/Kconfig
@@ -1,109 +1,81 @@
-if ARCH_MSM
+menuconfig ARCH_MSM
+	bool "Qualcomm MSM (legacy)"
+	depends on ARCH_MULTI_V6 || ARCH_MULTI_V7
+	select ARCH_REQUIRE_GPIOLIB
+	select CLKSRC_QCOM
+	select MSM_PROC_COMM
+	select MSM_SMD
+	help
+	  Support for Qualcomm MSM/QSD based systems.  This runs on the
+	  apps processor of the MSM/QSD and depends on a shared memory
+	  interface to the modem processor which runs the baseband
+	  stack and controls some vital subsystems
+	  (clock and power control, etc).
 
-choice
-	prompt "Qualcomm MSM SoC Type"
-	default ARCH_MSM7X00A
-	depends on ARCH_MSM
+if ARCH_MSM
 
 config ARCH_MSM7X00A
-	bool "MSM7x00A / MSM7x01A"
-	select ARCH_MSM_ARM11
-	select CPU_V6
-	select GPIO_MSM_V1
-	select MACH_TROUT if !MACH_HALIBUT
-	select MSM_PROC_COMM
-	select MSM_SMD
-	select CLKSRC_QCOM
-	select MSM_SMD_PKG3
+	bool
 
 config ARCH_MSM7X30
-	bool "MSM7x30"
-	select ARCH_MSM_SCORPION
-	select CPU_V7
-	select GPIO_MSM_V1
-	select MACH_MSM7X30_SURF # if !
+	bool
 	select MSM_GPIOMUX
-	select MSM_PROC_COMM
-	select MSM_SMD
-	select CLKSRC_QCOM
 	select MSM_VIC
 
 config ARCH_QSD8X50
-	bool "QSD8X50"
-	select ARCH_MSM_SCORPION
-	select CPU_V7
-	select GPIO_MSM_V1
-	select MACH_QSD8X50_SURF if !MACH_QSD8X50A_ST1_5
+	bool
 	select MSM_GPIOMUX
-	select MSM_PROC_COMM
-	select MSM_SMD
-	select CLKSRC_QCOM
 	select MSM_VIC
 
-endchoice
-
 config MSM_SOC_REV_A
 	bool
 
-config  ARCH_MSM_ARM11
+config MSM_VIC
 	bool
 
-config  ARCH_MSM_SCORPION
+config MSM_PROC_COMM
 	bool
 
-config  MSM_VIC
+config MSM_SMD
 	bool
 
-menu "Qualcomm MSM Board Type"
-	depends on ARCH_MSM
+config MSM_GPIOMUX
+	bool
 
 config MACH_HALIBUT
-	depends on ARCH_MSM
-	depends on ARCH_MSM7X00A
+	depends on ARCH_MULTI_V6
+	select ARCH_MSM7X00A
 	bool "Halibut Board (QCT SURF7201A)"
 	help
 	  Support for the Qualcomm SURF7201A eval board.
 
 config MACH_TROUT
-	depends on ARCH_MSM
-	depends on ARCH_MSM7X00A
+	depends on ARCH_MULTI_V6
+	select ARCH_MSM7X00A
 	bool "HTC Dream (aka trout)"
 	help
 	  Support for the HTC Dream, T-Mobile G1, Android ADP1 devices.
 
 config MACH_MSM7X30_SURF
-	depends on ARCH_MSM7X30
+	depends on ARCH_MULTI_V7
+	select ARCH_MSM7X30
 	bool "MSM7x30 SURF"
 	help
 	  Support for the Qualcomm MSM7x30 SURF eval board.
 
 config MACH_QSD8X50_SURF
-	depends on ARCH_QSD8X50
+	depends on ARCH_MULTI_V7
+	select ARCH_QSD8X50
 	bool "QSD8x50 SURF"
 	help
 	  Support for the Qualcomm QSD8x50 SURF eval board.
 
 config MACH_QSD8X50A_ST1_5
-	depends on ARCH_QSD8X50
+	depends on ARCH_MULTI_V7
+	select ARCH_QSD8X50
 	bool "QSD8x50A ST1.5"
 	select MSM_SOC_REV_A
 	help
 	  Support for the Qualcomm ST1.5.
 
-endmenu
-
-config MSM_SMD_PKG3
-	bool
-
-config MSM_PROC_COMM
-	bool
-
-config MSM_SMD
-	bool
-
-config MSM_GPIOMUX
-	bool
-	help
-	  Support for MSM V1 TLMM GPIOMUX architecture.
-
 endif
diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile
index 59ef46a881ea..d0f74d2d5be4 100644
--- a/arch/arm/mach-msm/Makefile
+++ b/arch/arm/mach-msm/Makefile
@@ -1,3 +1,5 @@
+ccflags-$(CONFIG_ARCH_MULTIPLATFORM) += -I$(srctree)/$(src)/include
+
 obj-$(CONFIG_MSM_PROC_COMM) += clock.o
 
 obj-$(CONFIG_MSM_VIC) += irq-vic.o
-- 
2.1.0.rc2

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RFC PATCH 01/18] serial: remove obsolete msm_serial_hs driver
  2015-03-04 19:32 ` [RFC PATCH 01/18] serial: remove obsolete msm_serial_hs driver Arnd Bergmann
@ 2015-03-04 20:03   ` Paul Bolle
  2015-03-04 20:07     ` Paul Bolle
  0 siblings, 1 reply; 36+ messages in thread
From: Paul Bolle @ 2015-03-04 20:03 UTC (permalink / raw)
  To: linux-arm-kernel

Arnd Bergmann schreef op wo 04-03-2015 om 20:32 [+0100]:
> Linux currently has two drivers for the same hardware: msm_serial
> and msm_serial_hs. Only the former is being actively maintained,
> and the latter is not used by any in-tree board files, so we
> can safely remove it.
> 
> Signed-off-by: Arnd Bergmann <arnd@arnd.de>
> ---
>  drivers/tty/serial/Kconfig                  |   12 -
>  drivers/tty/serial/msm_serial_hs.c          | 1874 ---------------------------

I haven't even bothered to check, but in a diff stat like this one
expects a line like
    drivers/tty/serial/Makefile               |     1 -

here. Is that expectation correct?

>  include/linux/platform_data/msm_serial_hs.h |   49 -
>  3 files changed, 1935 deletions(-)
>  delete mode 100644 drivers/tty/serial/msm_serial_hs.c
>  delete mode 100644 include/linux/platform_data/msm_serial_hs.h


Paul Bolle

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC PATCH 01/18] serial: remove obsolete msm_serial_hs driver
  2015-03-04 20:03   ` Paul Bolle
@ 2015-03-04 20:07     ` Paul Bolle
  2015-03-04 20:38       ` Arnd Bergmann
  0 siblings, 1 reply; 36+ messages in thread
From: Paul Bolle @ 2015-03-04 20:07 UTC (permalink / raw)
  To: linux-arm-kernel

Paul Bolle schreef op wo 04-03-2015 om 21:03 [+0100]:
> Arnd Bergmann schreef op wo 04-03-2015 om 20:32 [+0100]:
> > Linux currently has two drivers for the same hardware: msm_serial
> > and msm_serial_hs. Only the former is being actively maintained,
> > and the latter is not used by any in-tree board files, so we
> > can safely remove it.
> > 
> > Signed-off-by: Arnd Bergmann <arnd@arnd.de>
> > ---
> >  drivers/tty/serial/Kconfig                  |   12 -
> >  drivers/tty/serial/msm_serial_hs.c          | 1874 ---------------------------
> 
> I haven't even bothered to check, but in a diff stat like this one
> expects a line like
>     drivers/tty/serial/Makefile               |     1 -
> 
> here. Is that expectation correct?
> 
> >  include/linux/platform_data/msm_serial_hs.h |   49 -
> >  3 files changed, 1935 deletions(-)
> >  delete mode 100644 drivers/tty/serial/msm_serial_hs.c
> >  delete mode 100644 include/linux/platform_data/msm_serial_hs.h

Please note that your own email address is
    arnd at arndb.de

(I fixed up the Cc list for this message. And I don't do smilies.)


Paul Bolle

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC PATCH 00/18] ARM: msm multiplatform support
  2015-03-04 19:32 [RFC PATCH 00/18] ARM: msm multiplatform support Arnd Bergmann
                   ` (17 preceding siblings ...)
  2015-03-04 19:33 ` [RFC PATCH 18/18] ARM: msm: enable multiplatform support Arnd Bergmann
@ 2015-03-04 20:31 ` Paul Bolle
  2015-03-04 20:35   ` Arnd Bergmann
  2015-03-04 22:11 ` dwalker at fifo99.com
                   ` (2 subsequent siblings)
  21 siblings, 1 reply; 36+ messages in thread
From: Paul Bolle @ 2015-03-04 20:31 UTC (permalink / raw)
  To: linux-arm-kernel

Arnd Bergmann schreef op wo 04-03-2015 om 20:32 [+0100]:
>  arch/arm/mach-msm/board-sapphire.c                 |   17 +-

Please be aware that board-sapphire.c isn't actually wired into the
build system _at all_. It never has been (see
https://lkml.org/lkml/2014/5/14/634 ). There's another thread were the
submitter of this file basically refuses to remove this file, if memory
serves me right.

I try not to use colorful language on the net. Perhaps I wouldn't have
to bother you now if I would have used such language last year.

You touch board-sapphire.c in 12/18 and 17/18. That was a waste of your
time, however small. Should I submit a separate patch to remove it or do
you prefer to fold such a patch into this series?


Paul Bolle

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC PATCH 00/18] ARM: msm multiplatform support
  2015-03-04 20:31 ` [RFC PATCH 00/18] ARM: msm " Paul Bolle
@ 2015-03-04 20:35   ` Arnd Bergmann
  2015-03-04 21:09     ` Paul Bolle
  0 siblings, 1 reply; 36+ messages in thread
From: Arnd Bergmann @ 2015-03-04 20:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 04 March 2015 21:31:32 Paul Bolle wrote:
> Arnd Bergmann schreef op wo 04-03-2015 om 20:32 [+0100]:
> >  arch/arm/mach-msm/board-sapphire.c                 |   17 +-
> 
> Please be aware that board-sapphire.c isn't actually wired into the
> build system _at all_. It never has been (see
> https://lkml.org/lkml/2014/5/14/634 ). There's another thread were the
> submitter of this file basically refuses to remove this file, if memory
> serves me right.
> 
> I try not to use colorful language on the net. Perhaps I wouldn't have
> to bother you now if I would have used such language last year.

I noticed this, but since it was not standing in the way of what I tried
to do, I did not do anything about it here.
 
> You touch board-sapphire.c in 12/18 and 17/18. That was a waste of your
> time, however small. Should I submit a separate patch to remove it or do
> you prefer to fold such a patch into this series?

The patch would be appreciated, but I'd keep it separate from this series.
I saw a lot of things in need of cleanup in the files I touched here,
but refused the temptation, in order to get something done and not
start something controversial.

	Arnd

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC PATCH 01/18] serial: remove obsolete msm_serial_hs driver
  2015-03-04 20:07     ` Paul Bolle
@ 2015-03-04 20:38       ` Arnd Bergmann
  0 siblings, 0 replies; 36+ messages in thread
From: Arnd Bergmann @ 2015-03-04 20:38 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 04 March 2015 21:07:21 Paul Bolle wrote:
> Paul Bolle schreef op wo 04-03-2015 om 21:03 [+0100]:
> > Arnd Bergmann schreef op wo 04-03-2015 om 20:32 [+0100]:
> > > Linux currently has two drivers for the same hardware: msm_serial
> > > and msm_serial_hs. Only the former is being actively maintained,
> > > and the latter is not used by any in-tree board files, so we
> > > can safely remove it.
> > > 
> > > Signed-off-by: Arnd Bergmann <arnd@arnd.de>
> > > ---
> > >  drivers/tty/serial/Kconfig                  |   12 -
> > >  drivers/tty/serial/msm_serial_hs.c          | 1874 ---------------------------
> > 
> > I haven't even bothered to check, but in a diff stat like this one
> > expects a line like
> >     drivers/tty/serial/Makefile               |     1 -
> > 
> > here. Is that expectation correct?
> > 
> > >  include/linux/platform_data/msm_serial_hs.h |   49 -
> > >  3 files changed, 1935 deletions(-)
> > >  delete mode 100644 drivers/tty/serial/msm_serial_hs.c
> > >  delete mode 100644 include/linux/platform_data/msm_serial_hs.h
> 
> Please note that your own email address is
>     arnd at arndb.de
> 
> (I fixed up the Cc list for this message. And I don't do smilies.)
> 

You are obviously right on both issues, I'll fix them up.

Thanks a lot!

	Arnd

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC PATCH 00/18] ARM: msm multiplatform support
  2015-03-04 20:35   ` Arnd Bergmann
@ 2015-03-04 21:09     ` Paul Bolle
  2015-03-04 21:14       ` Paul Bolle
  0 siblings, 1 reply; 36+ messages in thread
From: Paul Bolle @ 2015-03-04 21:09 UTC (permalink / raw)
  To: linux-arm-kernel

[Added Michal and kbuild.]

Arnd Bergmann schreef op wo 04-03-2015 om 21:35 [+0100]:
> On Wednesday 04 March 2015 21:31:32 Paul Bolle wrote:
> > Arnd Bergmann schreef op wo 04-03-2015 om 20:32 [+0100]:
> > >  arch/arm/mach-msm/board-sapphire.c                 |   17 +-
> > 
> > Please be aware that board-sapphire.c isn't actually wired into the
> > build system _at all_. It never has been (see
> > https://lkml.org/lkml/2014/5/14/634 ). There's another thread were the
> > submitter of this file basically refuses to remove this file, if memory
> > serves me right.
> > 
> > I try not to use colorful language on the net. Perhaps I wouldn't have
> > to bother you now if I would have used such language last year.
> 
> I noticed this, but since it was not standing in the way of what I tried
> to do, I did not do anything about it here.
>  
> > You touch board-sapphire.c in 12/18 and 17/18. That was a waste of your
> > time, however small. Should I submit a separate patch to remove it or do
> > you prefer to fold such a patch into this series?
> 
> The patch would be appreciated, but I'd keep it separate from this series.
> I saw a lot of things in need of cleanup in the files I touched here,
> but refused the temptation, in order to get something done and not
> start something controversial.

I'll resubmit my trivial patch once this series hits linux-next. Feel
free to prod me if I forget.


Paul Bolle

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC PATCH 00/18] ARM: msm multiplatform support
  2015-03-04 21:09     ` Paul Bolle
@ 2015-03-04 21:14       ` Paul Bolle
  0 siblings, 0 replies; 36+ messages in thread
From: Paul Bolle @ 2015-03-04 21:14 UTC (permalink / raw)
  To: linux-arm-kernel

Paul Bolle schreef op wo 04-03-2015 om 22:09 [+0100]:
> [Added Michal and kbuild.]

That I planned to do before deleting most of my draft. I should have
deleted that line too.


Paul Bolle

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC PATCH 00/18] ARM: msm multiplatform support
  2015-03-04 19:32 [RFC PATCH 00/18] ARM: msm multiplatform support Arnd Bergmann
                   ` (18 preceding siblings ...)
  2015-03-04 20:31 ` [RFC PATCH 00/18] ARM: msm " Paul Bolle
@ 2015-03-04 22:11 ` dwalker at fifo99.com
  2015-03-04 22:30   ` Arnd Bergmann
  2015-03-05 16:40 ` Ulf Hansson
  2015-03-07  3:12 ` dwalker at fifo99.com
  21 siblings, 1 reply; 36+ messages in thread
From: dwalker at fifo99.com @ 2015-03-04 22:11 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Mar 04, 2015 at 08:32:54PM +0100, Arnd Bergmann wrote:
> This is my final piece of the puzzle for ARMv6/v7 multiplatform
> support. In combination with the other patches that are now
> at git://kernel.org/pub/scm/linux/kernel/git/arnd/playground.git
> multiplatform-4.0-rc2 and the at91 and shmobile parts from other
> developers, you can now build one kernel that includes all 
> ARMv6 and ARMv7 targets we support in Linux.
> 
> Since mach-msm has seen very few updates over the last years,
> it was more work to get to this point than the others, and
> some patches are more of a band-aid than a proper solution.
> Still, I think that each patch in the series is an improvement
> over the status-quo and I really want to see the last one
> merged into 4.1 and it depends on all the other ones.
> 
> Stephen Boyd mentioned on IRC that he has been workin on
> a similar series, and I'm more than happy to replace some
> of this work with patches that he has done, as long as we
> can still have the full multiplatform support for 4.1.
> 
> Since a lot of the patches are nontrivial and I have not
> been able to test any of this, I'm posting it as an RFC,
> but I'm also very interested in people testing it.

Didn't look at it in great detail (I will eventually), but it looks like your just
cleaning things up .. Is that accurate ?

Daniel

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC PATCH 00/18] ARM: msm multiplatform support
  2015-03-04 22:11 ` dwalker at fifo99.com
@ 2015-03-04 22:30   ` Arnd Bergmann
  0 siblings, 0 replies; 36+ messages in thread
From: Arnd Bergmann @ 2015-03-04 22:30 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 04 March 2015 22:11:41 dwalker at fifo99.com wrote:
> On Wed, Mar 04, 2015 at 08:32:54PM +0100, Arnd Bergmann wrote:
> > This is my final piece of the puzzle for ARMv6/v7 multiplatform
> > support. In combination with the other patches that are now
> > at git://kernel.org/pub/scm/linux/kernel/git/arnd/playground.git
> > multiplatform-4.0-rc2 and the at91 and shmobile parts from other
> > developers, you can now build one kernel that includes all 
> > ARMv6 and ARMv7 targets we support in Linux.
> > 
> > Since mach-msm has seen very few updates over the last years,
> > it was more work to get to this point than the others, and
> > some patches are more of a band-aid than a proper solution.
> > Still, I think that each patch in the series is an improvement
> > over the status-quo and I really want to see the last one
> > merged into 4.1 and it depends on all the other ones.
> > 
> > Stephen Boyd mentioned on IRC that he has been workin on
> > a similar series, and I'm more than happy to replace some
> > of this work with patches that he has done, as long as we
> > can still have the full multiplatform support for 4.1.
> > 
> > Since a lot of the patches are nontrivial and I have not
> > been able to test any of this, I'm posting it as an RFC,
> > but I'm also very interested in people testing it.
> 
> Didn't look at it in great detail (I will eventually), but it looks like your just
> cleaning things up .. Is that accurate ?

Yes: if I did everything right, there should be no functional
changes. Most of the work was converting compile-time conditionals
into runtime conditionals, to ensure that things work when we
enable all options at once.

	Arnd

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC PATCH 00/18] ARM: msm multiplatform support
  2015-03-04 19:32 [RFC PATCH 00/18] ARM: msm multiplatform support Arnd Bergmann
                   ` (19 preceding siblings ...)
  2015-03-04 22:11 ` dwalker at fifo99.com
@ 2015-03-05 16:40 ` Ulf Hansson
  2015-03-08 22:52   ` Arnd Bergmann
  2015-03-07  3:12 ` dwalker at fifo99.com
  21 siblings, 1 reply; 36+ messages in thread
From: Ulf Hansson @ 2015-03-05 16:40 UTC (permalink / raw)
  To: linux-arm-kernel

On 4 March 2015 at 20:32, Arnd Bergmann <arnd@arndb.de> wrote:
> This is my final piece of the puzzle for ARMv6/v7 multiplatform
> support. In combination with the other patches that are now
> at git://kernel.org/pub/scm/linux/kernel/git/arnd/playground.git
> multiplatform-4.0-rc2 and the at91 and shmobile parts from other
> developers, you can now build one kernel that includes all
> ARMv6 and ARMv7 targets we support in Linux.
>
> Since mach-msm has seen very few updates over the last years,
> it was more work to get to this point than the others, and
> some patches are more of a band-aid than a proper solution.
> Still, I think that each patch in the series is an improvement
> over the status-quo and I really want to see the last one
> merged into 4.1 and it depends on all the other ones.
>
> Stephen Boyd mentioned on IRC that he has been workin on
> a similar series, and I'm more than happy to replace some
> of this work with patches that he has done, as long as we
> can still have the full multiplatform support for 4.1.
>
> Since a lot of the patches are nontrivial and I have not
> been able to test any of this, I'm posting it as an RFC,
> but I'm also very interested in people testing it.
>
>         Arnd
>
> Arnd Bergmann (18):
>   serial: remove obsolete msm_serial_hs driver
>   mmc: msm: move data mover into mmc driver
>   mmc: msm: pass dmov resources via device
>   mmc: msm: move clk-reset logic to platform
>   ARM: msm: fix qsd8x50 rev.a support
>   ARM: msm: fix mach/msm_iomap.h inclusions
>   ARM: msm: fix sirc code for multiplatform
>   ARM: msm: fix gpiomux config for multiplatform
>   ARM: msm: fix vic irqchip for multiplatform
>   gpio: move msm-v1 driver to mach-msm
>   clocksource: qcom: make mach-msm and mach-qcom coexist
>   ARM: msm: make smd behave like a normal driver
>   ARM: msm: rename conflicting symbols
>   ARM: msm: pass gpio irq range as resource
>   ARM: msm: clean up irq handling
>   ARM: msm: make msm_smd.h global
>   ARM: msm: make all header files local
>   ARM: msm: enable multiplatform support
>
>  arch/arm/Kconfig                                   |   12 -
>  arch/arm/configs/msm_defconfig                     |    7 +
>  arch/arm/mach-msm/Kconfig                          |   91 +-
>  arch/arm/mach-msm/Makefile                         |   11 +-
>  arch/arm/mach-msm/board-halibut.c                  |   31 +-
>  arch/arm/mach-msm/board-msm7x30.c                  |   98 +-
>  arch/arm/mach-msm/board-qsd8x50.c                  |  138 +-
>  arch/arm/mach-msm/board-sapphire.c                 |   17 +-
>  arch/arm/mach-msm/board-trout-gpio.c               |    7 +-
>  arch/arm/mach-msm/board-trout-mmc.c                |   33 +-
>  arch/arm/mach-msm/board-trout-panel.c              |    8 +-
>  arch/arm/mach-msm/board-trout.c                    |   26 +-
>  arch/arm/mach-msm/board-trout.h                    |    2 +-
>  arch/arm/mach-msm/{include/mach => }/clk.h         |    0
>  arch/arm/mach-msm/clock-pcom.c                     |    5 +-
>  arch/arm/mach-msm/clock.c                          |    2 +-
>  arch/arm/mach-msm/clock.h                          |    2 +-
>  arch/arm/mach-msm/common.h                         |   16 +-
>  arch/arm/mach-msm/devices-msm7x00.c                |  169 +-
>  arch/arm/mach-msm/devices-msm7x30.c                |   78 +-
>  arch/arm/mach-msm/devices-qsd8x50.c                |  152 +-
>  arch/arm/mach-msm/devices.h                        |   67 +-
>  arch/arm/mach-msm/dma.c                            |  298 ----
>  {drivers/gpio => arch/arm/mach-msm}/gpio-msm-v1.c  |   33 +-
>  arch/arm/mach-msm/gpiomux-8x50.c                   |    2 +-
>  arch/arm/mach-msm/gpiomux-v1.h                     |    9 +-
>  arch/arm/mach-msm/gpiomux.c                        |   18 +-
>  arch/arm/mach-msm/gpiomux.h                        |   10 +-
>  arch/arm/mach-msm/include/mach/dma.h               |  151 --
>  arch/arm/mach-msm/include/mach/entry-macro.S       |   36 -
>  arch/arm/mach-msm/include/mach/hardware.h          |   18 -
>  arch/arm/mach-msm/include/mach/irqs.h              |   37 -
>  arch/arm/mach-msm/include/mach/sirc.h              |   98 -
>  arch/arm/mach-msm/io.c                             |  161 --
>  arch/arm/mach-msm/irq-vic.c                        |  146 +-
>  arch/arm/mach-msm/irq.c                            |   29 +-
>  arch/arm/mach-msm/{include/mach => }/irqs-7x00.h   |    3 +
>  arch/arm/mach-msm/{include/mach => }/irqs-7x30.h   |    2 +
>  arch/arm/mach-msm/{include/mach => }/irqs-8x50.h   |   42 +
>  arch/arm/mach-msm/last_radio_log.c                 |    1 -
>  arch/arm/mach-msm/{include/mach => }/msm_gpiomux.h |    0
>  .../mach-msm/{include/mach => }/msm_iomap-7x00.h   |    5 +-
>  .../mach-msm/{include/mach => }/msm_iomap-7x30.h   |    2 -
>  .../mach-msm/{include/mach => }/msm_iomap-8x50.h   |   12 +-
>  arch/arm/mach-msm/{include/mach => }/msm_iomap.h   |   24 +-
>  arch/arm/mach-msm/proc_comm.c                      |   12 +-
>  arch/arm/mach-msm/proc_comm.h                      |    2 +
>  arch/arm/mach-msm/sirc.c                           |   44 +-
>  arch/arm/mach-msm/sirc.h                           |   34 +
>  arch/arm/mach-msm/smd.c                            |  135 +-
>  arch/arm/mach-msm/smd_debug.c                      |  143 +-
>  arch/arm/mach-msm/smd_private.h                    |   67 +-
>  arch/arm/mach-msm/vreg.c                           |    2 +-
>  arch/arm/mach-msm/{include/mach => }/vreg.h        |    0
>  drivers/char/msm_smd_pkt.c                         |    2 +-
>  drivers/clocksource/qcom-timer.c                   |    3 +-
>  drivers/gpio/Kconfig                               |    8 -
>  drivers/gpio/Makefile                              |    1 -
>  drivers/mmc/host/msm_sdcc.c                        |  384 +++-

The goal from my side is to entirely remove this mmc driver and
instead convert to use the mmci host driver.

If I understand correctly, the current big blocker to reach that goal
is the DMA driver, since it's not converted to the DMA engine API? Do
you know if that's a correct statement?

Anyway, I suppose this patchset can be considered as step in the right
direction, even if I don't like to take patches for the msm_sdcc.c.

Kind regards
Uffe

>  drivers/tty/serial/Kconfig                         |   12 -
>  drivers/tty/serial/msm_serial_hs.c                 | 1874 --------------------
>  drivers/tty/serial/msm_smd_tty.c                   |    2 +-
>  .../include/mach => include/linux}/msm_smd.h       |    0
>  include/linux/platform_data/mmc-msm_sdcc.h         |    3 +
>  include/linux/platform_data/msm_serial_hs.h        |   49 -
>  65 files changed, 1419 insertions(+), 3467 deletions(-)
>  rename arch/arm/mach-msm/{include/mach => }/clk.h (100%)
>  delete mode 100644 arch/arm/mach-msm/dma.c
>  rename {drivers/gpio => arch/arm/mach-msm}/gpio-msm-v1.c (97%)
>  delete mode 100644 arch/arm/mach-msm/include/mach/dma.h
>  delete mode 100644 arch/arm/mach-msm/include/mach/entry-macro.S
>  delete mode 100644 arch/arm/mach-msm/include/mach/hardware.h
>  delete mode 100644 arch/arm/mach-msm/include/mach/irqs.h
>  delete mode 100644 arch/arm/mach-msm/include/mach/sirc.h
>  delete mode 100644 arch/arm/mach-msm/io.c
>  rename arch/arm/mach-msm/{include/mach => }/irqs-7x00.h (94%)
>  rename arch/arm/mach-msm/{include/mach => }/irqs-7x30.h (98%)
>  rename arch/arm/mach-msm/{include/mach => }/irqs-8x50.h (59%)
>  rename arch/arm/mach-msm/{include/mach => }/msm_gpiomux.h (100%)
>  rename arch/arm/mach-msm/{include/mach => }/msm_iomap-7x00.h (95%)
>  rename arch/arm/mach-msm/{include/mach => }/msm_iomap-7x30.h (97%)
>  rename arch/arm/mach-msm/{include/mach => }/msm_iomap-8x50.h (93%)
>  rename arch/arm/mach-msm/{include/mach => }/msm_iomap.h (74%)
>  create mode 100644 arch/arm/mach-msm/sirc.h
>  rename arch/arm/mach-msm/{include/mach => }/vreg.h (100%)
>  delete mode 100644 drivers/tty/serial/msm_serial_hs.c
>  rename {arch/arm/mach-msm/include/mach => include/linux}/msm_smd.h (100%)
>  delete mode 100644 include/linux/platform_data/msm_serial_hs.h
>
> --
> 2.1.0.rc2
>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC PATCH 00/18] ARM: msm multiplatform support
  2015-03-04 19:32 [RFC PATCH 00/18] ARM: msm multiplatform support Arnd Bergmann
                   ` (20 preceding siblings ...)
  2015-03-05 16:40 ` Ulf Hansson
@ 2015-03-07  3:12 ` dwalker at fifo99.com
  2015-03-12 16:27   ` Arnd Bergmann
  21 siblings, 1 reply; 36+ messages in thread
From: dwalker at fifo99.com @ 2015-03-07  3:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Mar 04, 2015 at 08:32:54PM +0100, Arnd Bergmann wrote:
> This is my final piece of the puzzle for ARMv6/v7 multiplatform
> support. In combination with the other patches that are now
> at git://kernel.org/pub/scm/linux/kernel/git/arnd/playground.git
> multiplatform-4.0-rc2 and the at91 and shmobile parts from other
> developers, you can now build one kernel that includes all 
> ARMv6 and ARMv7 targets we support in Linux.
> 
> Since mach-msm has seen very few updates over the last years,
> it was more work to get to this point than the others, and
> some patches are more of a band-aid than a proper solution.
> Still, I think that each patch in the series is an improvement
> over the status-quo and I really want to see the last one
> merged into 4.1 and it depends on all the other ones.
> 
> Stephen Boyd mentioned on IRC that he has been workin on
> a similar series, and I'm more than happy to replace some
> of this work with patches that he has done, as long as we
> can still have the full multiplatform support for 4.1.
> 
> Since a lot of the patches are nontrivial and I have not
> been able to test any of this, I'm posting it as an RFC,
> but I'm also very interested in people testing it.
> 

I think I would support deleting mach-msm at this point. I did work
on adding device tree support last year, but lost my motivation. It
seems like the community has a tendency to attack things that
are "old" and mach-msm seems like a constant whipping horse. I don't
have plans for mach-msm., Qualcomm never cared about the remaining platforms
and Google never cared either. I have no reason to care about it anymore.

If someone out there still wants the code I'm game to start actively maintaining
it, now that it's clear David and Bryan have completely walked away. Baring someone
coming forward it seems no one else is actively using it.

Daniel

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC PATCH 00/18] ARM: msm multiplatform support
  2015-03-05 16:40 ` Ulf Hansson
@ 2015-03-08 22:52   ` Arnd Bergmann
  0 siblings, 0 replies; 36+ messages in thread
From: Arnd Bergmann @ 2015-03-08 22:52 UTC (permalink / raw)
  To: linux-arm-kernel

On Thursday 05 March 2015 17:40:18 Ulf Hansson wrote:
> The goal from my side is to entirely remove this mmc driver and
> instead convert to use the mmci host driver.
> 
> If I understand correctly, the current big blocker to reach that goal
> is the DMA driver, since it's not converted to the DMA engine API? Do
> you know if that's a correct statement?

Yes, I think that is correct. As I wrote in the patch description,
after we remove the serial-hs driver, msm_sdcc is the only user of the
private MSM DMA API.

I wasn't aware that this device is compatible with mmci, but that
certainly simplifies things.

> Anyway, I suppose this patchset can be considered as step in the right
> direction, even if I don't like to take patches for the msm_sdcc.c.

Ok.

	Arnd

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC PATCH 10/18] gpio: move msm-v1 driver to mach-msm
  2015-03-04 19:33 ` [RFC PATCH 10/18] gpio: move msm-v1 driver to mach-msm Arnd Bergmann
@ 2015-03-09 16:10   ` Linus Walleij
  0 siblings, 0 replies; 36+ messages in thread
From: Linus Walleij @ 2015-03-09 16:10 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Mar 4, 2015 at 8:33 PM, Arnd Bergmann <arnd@arndb.de> wrote:

> The msm gpio driver uses the gpiomux infrastructure that
> relies on platform specific internals. We should really
> use a proper pinmux driver here, but for now, the easiest
> solution is to move it into mach-msm to get rid of the
> header file dependency.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC PATCH 00/18] ARM: msm multiplatform support
  2015-03-07  3:12 ` dwalker at fifo99.com
@ 2015-03-12 16:27   ` Arnd Bergmann
  0 siblings, 0 replies; 36+ messages in thread
From: Arnd Bergmann @ 2015-03-12 16:27 UTC (permalink / raw)
  To: linux-arm-kernel

On Saturday 07 March 2015 03:12:12 dwalker at fifo99.com wrote:
> On Wed, Mar 04, 2015 at 08:32:54PM +0100, Arnd Bergmann wrote:
> > This is my final piece of the puzzle for ARMv6/v7 multiplatform
> > support. In combination with the other patches that are now
> > at git://kernel.org/pub/scm/linux/kernel/git/arnd/playground.git
> > multiplatform-4.0-rc2 and the at91 and shmobile parts from other
> > developers, you can now build one kernel that includes all 
> > ARMv6 and ARMv7 targets we support in Linux.
> > 
> > Since mach-msm has seen very few updates over the last years,
> > it was more work to get to this point than the others, and
> > some patches are more of a band-aid than a proper solution.
> > Still, I think that each patch in the series is an improvement
> > over the status-quo and I really want to see the last one
> > merged into 4.1 and it depends on all the other ones.
> > 
> > Stephen Boyd mentioned on IRC that he has been workin on
> > a similar series, and I'm more than happy to replace some
> > of this work with patches that he has done, as long as we
> > can still have the full multiplatform support for 4.1.
> > 
> > Since a lot of the patches are nontrivial and I have not
> > been able to test any of this, I'm posting it as an RFC,
> > but I'm also very interested in people testing it.
> > 
> 
> I think I would support deleting mach-msm at this point. I did work
> on adding device tree support last year, but lost my motivation. It
> seems like the community has a tendency to attack things that
> are "old" and mach-msm seems like a constant whipping horse. I don't
> have plans for mach-msm., Qualcomm never cared about the remaining platforms
> and Google never cared either. I have no reason to care about it anymore.
> 
> If someone out there still wants the code I'm game to start actively maintaining
> it, now that it's clear David and Bryan have completely walked away. Baring someone
> coming forward it seems no one else is actively using it.

I'd like to first get my patch series merged and have that in the kernel
for one release, so we can start with this as a base if we decide to
revive it. I'm definitely fine with removing it in the following
merge window, but I'd leave that up to you.

	Arnd

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC PATCH 02/18] mmc: msm: move data mover into mmc driver
  2015-03-04 19:32 ` [RFC PATCH 02/18] mmc: msm: move data mover into mmc driver Arnd Bergmann
@ 2015-03-13 13:14   ` Ulf Hansson
  0 siblings, 0 replies; 36+ messages in thread
From: Ulf Hansson @ 2015-03-13 13:14 UTC (permalink / raw)
  To: linux-arm-kernel

On 4 March 2015 at 20:32, Arnd Bergmann <arnd@arndb.de> wrote:
> The msm_sdcc driver is the only user of the proprietary msm
> data mover interface. In order to simplify the multiplatform
> conversion, this patch moves the entire data mover code into
> the mmc driver.
>
> If against our expectations any other drivers should be added
> in the future that use the same data mover, the best approach
> would be to convert this code into a dmaengine driver and use
> the generic interfaces for that.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: Ulf Hansson <ulf.hansson@linaro.org>

> ---
>  arch/arm/mach-msm/Makefile           |   6 +-
>  arch/arm/mach-msm/board-msm7x30.c    |   1 -
>  arch/arm/mach-msm/devices-msm7x30.c  |   1 -
>  arch/arm/mach-msm/devices-qsd8x50.c  |   1 -
>  arch/arm/mach-msm/dma.c              | 298 -----------------------------
>  arch/arm/mach-msm/include/mach/dma.h | 151 ---------------
>  drivers/mmc/host/msm_sdcc.c          | 360 ++++++++++++++++++++++++++++++++++-
>  7 files changed, 362 insertions(+), 456 deletions(-)
>  delete mode 100644 arch/arm/mach-msm/dma.c
>  delete mode 100644 arch/arm/mach-msm/include/mach/dma.h
>
> diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile
> index 27c078a568df..2fb46dc0ead8 100644
> --- a/arch/arm/mach-msm/Makefile
> +++ b/arch/arm/mach-msm/Makefile
> @@ -7,9 +7,9 @@ obj-$(CONFIG_ARCH_QSD8X50) += sirc.o
>
>  obj-$(CONFIG_MSM_PROC_COMM) += proc_comm.o clock-pcom.o vreg.o
>
> -obj-$(CONFIG_ARCH_MSM7X00A) += dma.o io.o
> -obj-$(CONFIG_ARCH_MSM7X30) += dma.o io.o
> -obj-$(CONFIG_ARCH_QSD8X50) += dma.o io.o
> +obj-$(CONFIG_ARCH_MSM7X00A) += io.o
> +obj-$(CONFIG_ARCH_MSM7X30) += io.o
> +obj-$(CONFIG_ARCH_QSD8X50) += io.o
>
>  obj-$(CONFIG_MSM_SMD) += smd.o smd_debug.o
>  obj-$(CONFIG_MSM_SMD) += last_radio_log.o
> diff --git a/arch/arm/mach-msm/board-msm7x30.c b/arch/arm/mach-msm/board-msm7x30.c
> index 8f5ecdc4f3ce..44a5bdbf0ee7 100644
> --- a/arch/arm/mach-msm/board-msm7x30.c
> +++ b/arch/arm/mach-msm/board-msm7x30.c
> @@ -32,7 +32,6 @@
>
>  #include <mach/clk.h>
>  #include <mach/msm_iomap.h>
> -#include <mach/dma.h>
>
>  #include <mach/vreg.h>
>  #include "devices.h"
> diff --git a/arch/arm/mach-msm/devices-msm7x30.c b/arch/arm/mach-msm/devices-msm7x30.c
> index c15ea8ab20a7..5a0705b55321 100644
> --- a/arch/arm/mach-msm/devices-msm7x30.c
> +++ b/arch/arm/mach-msm/devices-msm7x30.c
> @@ -20,7 +20,6 @@
>  #include <linux/clkdev.h>
>  #include <mach/irqs.h>
>  #include <mach/msm_iomap.h>
> -#include <mach/dma.h>
>
>  #include "devices.h"
>  #include "smd_private.h"
> diff --git a/arch/arm/mach-msm/devices-qsd8x50.c b/arch/arm/mach-msm/devices-qsd8x50.c
> index 9e1e9ce07b1a..dfc884521fc1 100644
> --- a/arch/arm/mach-msm/devices-qsd8x50.c
> +++ b/arch/arm/mach-msm/devices-qsd8x50.c
> @@ -20,7 +20,6 @@
>
>  #include <mach/irqs.h>
>  #include <mach/msm_iomap.h>
> -#include <mach/dma.h>
>
>  #include "devices.h"
>  #include "common.h"
> diff --git a/arch/arm/mach-msm/dma.c b/arch/arm/mach-msm/dma.c
> deleted file mode 100644
> index fb9762464718..000000000000
> --- a/arch/arm/mach-msm/dma.c
> +++ /dev/null
> @@ -1,298 +0,0 @@
> -/* linux/arch/arm/mach-msm/dma.c
> - *
> - * Copyright (C) 2007 Google, Inc.
> - *
> - * This software is licensed under the terms of the GNU General Public
> - * License version 2, as published by the Free Software Foundation, and
> - * may be copied, distributed, and modified under those terms.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - */
> -
> -#include <linux/clk.h>
> -#include <linux/err.h>
> -#include <linux/io.h>
> -#include <linux/interrupt.h>
> -#include <linux/completion.h>
> -#include <linux/module.h>
> -#include <mach/dma.h>
> -#include <mach/msm_iomap.h>
> -
> -#define MSM_DMOV_CHANNEL_COUNT 16
> -
> -#define DMOV_SD0(off, ch) (MSM_DMOV_BASE + 0x0000 + (off) + ((ch) << 2))
> -#define DMOV_SD1(off, ch) (MSM_DMOV_BASE + 0x0400 + (off) + ((ch) << 2))
> -#define DMOV_SD2(off, ch) (MSM_DMOV_BASE + 0x0800 + (off) + ((ch) << 2))
> -#define DMOV_SD3(off, ch) (MSM_DMOV_BASE + 0x0C00 + (off) + ((ch) << 2))
> -
> -#if defined(CONFIG_ARCH_MSM7X30)
> -#define DMOV_SD_AARM DMOV_SD2
> -#else
> -#define DMOV_SD_AARM DMOV_SD3
> -#endif
> -
> -#define DMOV_CMD_PTR(ch)      DMOV_SD_AARM(0x000, ch)
> -#define DMOV_RSLT(ch)         DMOV_SD_AARM(0x040, ch)
> -#define DMOV_FLUSH0(ch)       DMOV_SD_AARM(0x080, ch)
> -#define DMOV_FLUSH1(ch)       DMOV_SD_AARM(0x0C0, ch)
> -#define DMOV_FLUSH2(ch)       DMOV_SD_AARM(0x100, ch)
> -#define DMOV_FLUSH3(ch)       DMOV_SD_AARM(0x140, ch)
> -#define DMOV_FLUSH4(ch)       DMOV_SD_AARM(0x180, ch)
> -#define DMOV_FLUSH5(ch)       DMOV_SD_AARM(0x1C0, ch)
> -
> -#define DMOV_STATUS(ch)       DMOV_SD_AARM(0x200, ch)
> -#define DMOV_ISR              DMOV_SD_AARM(0x380, 0)
> -
> -#define DMOV_CONFIG(ch)       DMOV_SD_AARM(0x300, ch)
> -
> -enum {
> -       MSM_DMOV_PRINT_ERRORS = 1,
> -       MSM_DMOV_PRINT_IO = 2,
> -       MSM_DMOV_PRINT_FLOW = 4
> -};
> -
> -static DEFINE_SPINLOCK(msm_dmov_lock);
> -static struct clk *msm_dmov_clk;
> -static unsigned int channel_active;
> -static struct list_head ready_commands[MSM_DMOV_CHANNEL_COUNT];
> -static struct list_head active_commands[MSM_DMOV_CHANNEL_COUNT];
> -unsigned int msm_dmov_print_mask = MSM_DMOV_PRINT_ERRORS;
> -
> -#define MSM_DMOV_DPRINTF(mask, format, args...) \
> -       do { \
> -               if ((mask) & msm_dmov_print_mask) \
> -                       printk(KERN_ERR format, args); \
> -       } while (0)
> -#define PRINT_ERROR(format, args...) \
> -       MSM_DMOV_DPRINTF(MSM_DMOV_PRINT_ERRORS, format, args);
> -#define PRINT_IO(format, args...) \
> -       MSM_DMOV_DPRINTF(MSM_DMOV_PRINT_IO, format, args);
> -#define PRINT_FLOW(format, args...) \
> -       MSM_DMOV_DPRINTF(MSM_DMOV_PRINT_FLOW, format, args);
> -
> -void msm_dmov_stop_cmd(unsigned id, struct msm_dmov_cmd *cmd, int graceful)
> -{
> -       writel((graceful << 31), DMOV_FLUSH0(id));
> -}
> -EXPORT_SYMBOL_GPL(msm_dmov_stop_cmd);
> -
> -void msm_dmov_enqueue_cmd(unsigned id, struct msm_dmov_cmd *cmd)
> -{
> -       unsigned long irq_flags;
> -       unsigned int status;
> -
> -       spin_lock_irqsave(&msm_dmov_lock, irq_flags);
> -       if (!channel_active)
> -               clk_enable(msm_dmov_clk);
> -       dsb();
> -       status = readl(DMOV_STATUS(id));
> -       if (list_empty(&ready_commands[id]) &&
> -               (status & DMOV_STATUS_CMD_PTR_RDY)) {
> -#if 0
> -               if (list_empty(&active_commands[id])) {
> -                       PRINT_FLOW("msm_dmov_enqueue_cmd(%d), enable interrupt\n", id);
> -                       writel(DMOV_CONFIG_IRQ_EN, DMOV_CONFIG(id));
> -               }
> -#endif
> -               if (cmd->execute_func)
> -                       cmd->execute_func(cmd);
> -               PRINT_IO("msm_dmov_enqueue_cmd(%d), start command, status %x\n", id, status);
> -               list_add_tail(&cmd->list, &active_commands[id]);
> -               if (!channel_active)
> -                       enable_irq(INT_ADM_AARM);
> -               channel_active |= 1U << id;
> -               writel(cmd->cmdptr, DMOV_CMD_PTR(id));
> -       } else {
> -               if (!channel_active)
> -                       clk_disable(msm_dmov_clk);
> -               if (list_empty(&active_commands[id]))
> -                       PRINT_ERROR("msm_dmov_enqueue_cmd(%d), error datamover stalled, status %x\n", id, status);
> -
> -               PRINT_IO("msm_dmov_enqueue_cmd(%d), enqueue command, status %x\n", id, status);
> -               list_add_tail(&cmd->list, &ready_commands[id]);
> -       }
> -       spin_unlock_irqrestore(&msm_dmov_lock, irq_flags);
> -}
> -EXPORT_SYMBOL_GPL(msm_dmov_enqueue_cmd);
> -
> -struct msm_dmov_exec_cmdptr_cmd {
> -       struct msm_dmov_cmd dmov_cmd;
> -       struct completion complete;
> -       unsigned id;
> -       unsigned int result;
> -       struct msm_dmov_errdata err;
> -};
> -
> -static void
> -dmov_exec_cmdptr_complete_func(struct msm_dmov_cmd *_cmd,
> -                              unsigned int result,
> -                              struct msm_dmov_errdata *err)
> -{
> -       struct msm_dmov_exec_cmdptr_cmd *cmd = container_of(_cmd, struct msm_dmov_exec_cmdptr_cmd, dmov_cmd);
> -       cmd->result = result;
> -       if (result != 0x80000002 && err)
> -               memcpy(&cmd->err, err, sizeof(struct msm_dmov_errdata));
> -
> -       complete(&cmd->complete);
> -}
> -
> -int msm_dmov_exec_cmd(unsigned id, unsigned int cmdptr)
> -{
> -       struct msm_dmov_exec_cmdptr_cmd cmd;
> -
> -       PRINT_FLOW("dmov_exec_cmdptr(%d, %x)\n", id, cmdptr);
> -
> -       cmd.dmov_cmd.cmdptr = cmdptr;
> -       cmd.dmov_cmd.complete_func = dmov_exec_cmdptr_complete_func;
> -       cmd.dmov_cmd.execute_func = NULL;
> -       cmd.id = id;
> -       init_completion(&cmd.complete);
> -
> -       msm_dmov_enqueue_cmd(id, &cmd.dmov_cmd);
> -       wait_for_completion(&cmd.complete);
> -
> -       if (cmd.result != 0x80000002) {
> -               PRINT_ERROR("dmov_exec_cmdptr(%d): ERROR, result: %x\n", id, cmd.result);
> -               PRINT_ERROR("dmov_exec_cmdptr(%d):  flush: %x %x %x %x\n",
> -                       id, cmd.err.flush[0], cmd.err.flush[1], cmd.err.flush[2], cmd.err.flush[3]);
> -               return -EIO;
> -       }
> -       PRINT_FLOW("dmov_exec_cmdptr(%d, %x) done\n", id, cmdptr);
> -       return 0;
> -}
> -
> -
> -static irqreturn_t msm_datamover_irq_handler(int irq, void *dev_id)
> -{
> -       unsigned int int_status, mask, id;
> -       unsigned long irq_flags;
> -       unsigned int ch_status;
> -       unsigned int ch_result;
> -       struct msm_dmov_cmd *cmd;
> -
> -       spin_lock_irqsave(&msm_dmov_lock, irq_flags);
> -
> -       int_status = readl(DMOV_ISR); /* read and clear interrupt */
> -       PRINT_FLOW("msm_datamover_irq_handler: DMOV_ISR %x\n", int_status);
> -
> -       while (int_status) {
> -               mask = int_status & -int_status;
> -               id = fls(mask) - 1;
> -               PRINT_FLOW("msm_datamover_irq_handler %08x %08x id %d\n", int_status, mask, id);
> -               int_status &= ~mask;
> -               ch_status = readl(DMOV_STATUS(id));
> -               if (!(ch_status & DMOV_STATUS_RSLT_VALID)) {
> -                       PRINT_FLOW("msm_datamover_irq_handler id %d, result not valid %x\n", id, ch_status);
> -                       continue;
> -               }
> -               do {
> -                       ch_result = readl(DMOV_RSLT(id));
> -                       if (list_empty(&active_commands[id])) {
> -                               PRINT_ERROR("msm_datamover_irq_handler id %d, got result "
> -                                       "with no active command, status %x, result %x\n",
> -                                       id, ch_status, ch_result);
> -                               cmd = NULL;
> -                       } else
> -                               cmd = list_entry(active_commands[id].next, typeof(*cmd), list);
> -                       PRINT_FLOW("msm_datamover_irq_handler id %d, status %x, result %x\n", id, ch_status, ch_result);
> -                       if (ch_result & DMOV_RSLT_DONE) {
> -                               PRINT_FLOW("msm_datamover_irq_handler id %d, status %x\n",
> -                                       id, ch_status);
> -                               PRINT_IO("msm_datamover_irq_handler id %d, got result "
> -                                       "for %p, result %x\n", id, cmd, ch_result);
> -                               if (cmd) {
> -                                       list_del(&cmd->list);
> -                                       dsb();
> -                                       cmd->complete_func(cmd, ch_result, NULL);
> -                               }
> -                       }
> -                       if (ch_result & DMOV_RSLT_FLUSH) {
> -                               struct msm_dmov_errdata errdata;
> -
> -                               errdata.flush[0] = readl(DMOV_FLUSH0(id));
> -                               errdata.flush[1] = readl(DMOV_FLUSH1(id));
> -                               errdata.flush[2] = readl(DMOV_FLUSH2(id));
> -                               errdata.flush[3] = readl(DMOV_FLUSH3(id));
> -                               errdata.flush[4] = readl(DMOV_FLUSH4(id));
> -                               errdata.flush[5] = readl(DMOV_FLUSH5(id));
> -                               PRINT_FLOW("msm_datamover_irq_handler id %d, status %x\n", id, ch_status);
> -                               PRINT_FLOW("msm_datamover_irq_handler id %d, flush, result %x, flush0 %x\n", id, ch_result, errdata.flush[0]);
> -                               if (cmd) {
> -                                       list_del(&cmd->list);
> -                                       dsb();
> -                                       cmd->complete_func(cmd, ch_result, &errdata);
> -                               }
> -                       }
> -                       if (ch_result & DMOV_RSLT_ERROR) {
> -                               struct msm_dmov_errdata errdata;
> -
> -                               errdata.flush[0] = readl(DMOV_FLUSH0(id));
> -                               errdata.flush[1] = readl(DMOV_FLUSH1(id));
> -                               errdata.flush[2] = readl(DMOV_FLUSH2(id));
> -                               errdata.flush[3] = readl(DMOV_FLUSH3(id));
> -                               errdata.flush[4] = readl(DMOV_FLUSH4(id));
> -                               errdata.flush[5] = readl(DMOV_FLUSH5(id));
> -
> -                               PRINT_ERROR("msm_datamover_irq_handler id %d, status %x\n", id, ch_status);
> -                               PRINT_ERROR("msm_datamover_irq_handler id %d, error, result %x, flush0 %x\n", id, ch_result, errdata.flush[0]);
> -                               if (cmd) {
> -                                       list_del(&cmd->list);
> -                                       dsb();
> -                                       cmd->complete_func(cmd, ch_result, &errdata);
> -                               }
> -                               /* this does not seem to work, once we get an error */
> -                               /* the datamover will no longer accept commands */
> -                               writel(0, DMOV_FLUSH0(id));
> -                       }
> -                       ch_status = readl(DMOV_STATUS(id));
> -                       PRINT_FLOW("msm_datamover_irq_handler id %d, status %x\n", id, ch_status);
> -                       if ((ch_status & DMOV_STATUS_CMD_PTR_RDY) && !list_empty(&ready_commands[id])) {
> -                               cmd = list_entry(ready_commands[id].next, typeof(*cmd), list);
> -                               list_move_tail(&cmd->list, &active_commands[id]);
> -                               if (cmd->execute_func)
> -                                       cmd->execute_func(cmd);
> -                               PRINT_FLOW("msm_datamover_irq_handler id %d, start command\n", id);
> -                               writel(cmd->cmdptr, DMOV_CMD_PTR(id));
> -                       }
> -               } while (ch_status & DMOV_STATUS_RSLT_VALID);
> -               if (list_empty(&active_commands[id]) && list_empty(&ready_commands[id]))
> -                       channel_active &= ~(1U << id);
> -               PRINT_FLOW("msm_datamover_irq_handler id %d, status %x\n", id, ch_status);
> -       }
> -
> -       if (!channel_active) {
> -               disable_irq_nosync(INT_ADM_AARM);
> -               clk_disable(msm_dmov_clk);
> -       }
> -
> -       spin_unlock_irqrestore(&msm_dmov_lock, irq_flags);
> -       return IRQ_HANDLED;
> -}
> -
> -static int __init msm_init_datamover(void)
> -{
> -       int i;
> -       int ret;
> -       struct clk *clk;
> -
> -       for (i = 0; i < MSM_DMOV_CHANNEL_COUNT; i++) {
> -               INIT_LIST_HEAD(&ready_commands[i]);
> -               INIT_LIST_HEAD(&active_commands[i]);
> -               writel(DMOV_CONFIG_IRQ_EN | DMOV_CONFIG_FORCE_TOP_PTR_RSLT | DMOV_CONFIG_FORCE_FLUSH_RSLT, DMOV_CONFIG(i));
> -       }
> -       clk = clk_get(NULL, "adm_clk");
> -       if (IS_ERR(clk))
> -               return PTR_ERR(clk);
> -       clk_prepare(clk);
> -       msm_dmov_clk = clk;
> -       ret = request_irq(INT_ADM_AARM, msm_datamover_irq_handler, 0, "msmdatamover", NULL);
> -       if (ret)
> -               return ret;
> -       disable_irq(INT_ADM_AARM);
> -       return 0;
> -}
> -module_init(msm_init_datamover);
> diff --git a/arch/arm/mach-msm/include/mach/dma.h b/arch/arm/mach-msm/include/mach/dma.h
> deleted file mode 100644
> index a72d48d42342..000000000000
> --- a/arch/arm/mach-msm/include/mach/dma.h
> +++ /dev/null
> @@ -1,151 +0,0 @@
> -/* linux/include/asm-arm/arch-msm/dma.h
> - *
> - * Copyright (C) 2007 Google, Inc.
> - *
> - * This software is licensed under the terms of the GNU General Public
> - * License version 2, as published by the Free Software Foundation, and
> - * may be copied, distributed, and modified under those terms.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - */
> -
> -#ifndef __ASM_ARCH_MSM_DMA_H
> -
> -#include <linux/list.h>
> -
> -struct msm_dmov_errdata {
> -       uint32_t flush[6];
> -};
> -
> -struct msm_dmov_cmd {
> -       struct list_head list;
> -       unsigned int cmdptr;
> -       void (*complete_func)(struct msm_dmov_cmd *cmd,
> -                             unsigned int result,
> -                             struct msm_dmov_errdata *err);
> -       void (*execute_func)(struct msm_dmov_cmd *cmd);
> -       void *data;
> -};
> -
> -#ifndef CONFIG_ARCH_MSM8X60
> -void msm_dmov_enqueue_cmd(unsigned id, struct msm_dmov_cmd *cmd);
> -void msm_dmov_stop_cmd(unsigned id, struct msm_dmov_cmd *cmd, int graceful);
> -int msm_dmov_exec_cmd(unsigned id, unsigned int cmdptr);
> -#else
> -static inline
> -void msm_dmov_enqueue_cmd(unsigned id, struct msm_dmov_cmd *cmd) { }
> -static inline
> -void msm_dmov_stop_cmd(unsigned id, struct msm_dmov_cmd *cmd, int graceful) { }
> -static inline
> -int msm_dmov_exec_cmd(unsigned id, unsigned int cmdptr) { return -EIO; }
> -#endif
> -
> -#define DMOV_CMD_LIST         (0 << 29) /* does not work */
> -#define DMOV_CMD_PTR_LIST     (1 << 29) /* works */
> -#define DMOV_CMD_INPUT_CFG    (2 << 29) /* untested */
> -#define DMOV_CMD_OUTPUT_CFG   (3 << 29) /* untested */
> -#define DMOV_CMD_ADDR(addr)   ((addr) >> 3)
> -
> -#define DMOV_RSLT_VALID       (1 << 31) /* 0 == host has empties result fifo */
> -#define DMOV_RSLT_ERROR       (1 << 3)
> -#define DMOV_RSLT_FLUSH       (1 << 2)
> -#define DMOV_RSLT_DONE        (1 << 1)  /* top pointer done */
> -#define DMOV_RSLT_USER        (1 << 0)  /* command with FR force result */
> -
> -#define DMOV_STATUS_RSLT_COUNT(n)    (((n) >> 29))
> -#define DMOV_STATUS_CMD_COUNT(n)     (((n) >> 27) & 3)
> -#define DMOV_STATUS_RSLT_VALID       (1 << 1)
> -#define DMOV_STATUS_CMD_PTR_RDY      (1 << 0)
> -
> -#define DMOV_CONFIG_FORCE_TOP_PTR_RSLT (1 << 2)
> -#define DMOV_CONFIG_FORCE_FLUSH_RSLT   (1 << 1)
> -#define DMOV_CONFIG_IRQ_EN             (1 << 0)
> -
> -/* channel assignments */
> -
> -#define DMOV_NAND_CHAN        7
> -#define DMOV_NAND_CRCI_CMD    5
> -#define DMOV_NAND_CRCI_DATA   4
> -
> -#define DMOV_SDC1_CHAN        8
> -#define DMOV_SDC1_CRCI        6
> -
> -#define DMOV_SDC2_CHAN        8
> -#define DMOV_SDC2_CRCI        7
> -
> -#define DMOV_TSIF_CHAN        10
> -#define DMOV_TSIF_CRCI        10
> -
> -#define DMOV_USB_CHAN         11
> -
> -/* no client rate control ifc (eg, ram) */
> -#define DMOV_NONE_CRCI        0
> -
> -
> -/* If the CMD_PTR register has CMD_PTR_LIST selected, the data mover
> - * is going to walk a list of 32bit pointers as described below.  Each
> - * pointer points to a *array* of dmov_s, etc structs.  The last pointer
> - * in the list is marked with CMD_PTR_LP.  The last struct in each array
> - * is marked with CMD_LC (see below).
> - */
> -#define CMD_PTR_ADDR(addr)  ((addr) >> 3)
> -#define CMD_PTR_LP          (1 << 31) /* last pointer */
> -#define CMD_PTR_PT          (3 << 29) /* ? */
> -
> -/* Single Item Mode */
> -typedef struct {
> -       unsigned cmd;
> -       unsigned src;
> -       unsigned dst;
> -       unsigned len;
> -} dmov_s;
> -
> -/* Scatter/Gather Mode */
> -typedef struct {
> -       unsigned cmd;
> -       unsigned src_dscr;
> -       unsigned dst_dscr;
> -       unsigned _reserved;
> -} dmov_sg;
> -
> -/* Box mode */
> -typedef struct {
> -       uint32_t cmd;
> -       uint32_t src_row_addr;
> -       uint32_t dst_row_addr;
> -       uint32_t src_dst_len;
> -       uint32_t num_rows;
> -       uint32_t row_offset;
> -} dmov_box;
> -
> -/* bits for the cmd field of the above structures */
> -
> -#define CMD_LC      (1 << 31)  /* last command */
> -#define CMD_FR      (1 << 22)  /* force result -- does not work? */
> -#define CMD_OCU     (1 << 21)  /* other channel unblock */
> -#define CMD_OCB     (1 << 20)  /* other channel block */
> -#define CMD_TCB     (1 << 19)  /* ? */
> -#define CMD_DAH     (1 << 18)  /* destination address hold -- does not work?*/
> -#define CMD_SAH     (1 << 17)  /* source address hold -- does not work? */
> -
> -#define CMD_MODE_SINGLE     (0 << 0) /* dmov_s structure used */
> -#define CMD_MODE_SG         (1 << 0) /* untested */
> -#define CMD_MODE_IND_SG     (2 << 0) /* untested */
> -#define CMD_MODE_BOX        (3 << 0) /* untested */
> -
> -#define CMD_DST_SWAP_BYTES  (1 << 14) /* exchange each byte n with byte n+1 */
> -#define CMD_DST_SWAP_SHORTS (1 << 15) /* exchange each short n with short n+1 */
> -#define CMD_DST_SWAP_WORDS  (1 << 16) /* exchange each word n with word n+1 */
> -
> -#define CMD_SRC_SWAP_BYTES  (1 << 11) /* exchange each byte n with byte n+1 */
> -#define CMD_SRC_SWAP_SHORTS (1 << 12) /* exchange each short n with short n+1 */
> -#define CMD_SRC_SWAP_WORDS  (1 << 13) /* exchange each word n with word n+1 */
> -
> -#define CMD_DST_CRCI(n)     (((n) & 15) << 7)
> -#define CMD_SRC_CRCI(n)     (((n) & 15) << 3)
> -
> -#endif
> diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c
> index 90c60fd4ff6e..83dc4e5d9963 100644
> --- a/drivers/mmc/host/msm_sdcc.c
> +++ b/drivers/mmc/host/msm_sdcc.c
> @@ -15,6 +15,7 @@
>   *
>   */
>
> +#include <linux/completion.h>
>  #include <linux/module.h>
>  #include <linux/moduleparam.h>
>  #include <linux/init.h>
> @@ -24,6 +25,7 @@
>  #include <linux/delay.h>
>  #include <linux/err.h>
>  #include <linux/highmem.h>
> +#include <linux/list.h>
>  #include <linux/log2.h>
>  #include <linux/mmc/host.h>
>  #include <linux/mmc/card.h>
> @@ -43,9 +45,365 @@
>  #include <asm/sizes.h>
>
>  #include <linux/platform_data/mmc-msm_sdcc.h>
> -#include <mach/dma.h>
> +#include <mach/msm_iomap.h>
>  #include <mach/clk.h>
>
> +/* data mover definitions */
> +
> +struct msm_dmov_errdata {
> +       uint32_t flush[6];
> +};
> +
> +struct msm_dmov_cmd {
> +       struct list_head list;
> +       unsigned int cmdptr;
> +       void (*complete_func)(struct msm_dmov_cmd *cmd,
> +                             unsigned int result,
> +                             struct msm_dmov_errdata *err);
> +       void (*execute_func)(struct msm_dmov_cmd *cmd);
> +       void *data;
> +};
> +
> +#define DMOV_CMD_LIST         (0 << 29) /* does not work */
> +#define DMOV_CMD_PTR_LIST     (1 << 29) /* works */
> +#define DMOV_CMD_INPUT_CFG    (2 << 29) /* untested */
> +#define DMOV_CMD_OUTPUT_CFG   (3 << 29) /* untested */
> +#define DMOV_CMD_ADDR(addr)   ((addr) >> 3)
> +
> +#define DMOV_RSLT_VALID       (1 << 31) /* 0 == host has empties result fifo */
> +#define DMOV_RSLT_ERROR       (1 << 3)
> +#define DMOV_RSLT_FLUSH       (1 << 2)
> +#define DMOV_RSLT_DONE        (1 << 1)  /* top pointer done */
> +#define DMOV_RSLT_USER        (1 << 0)  /* command with FR force result */
> +
> +#define DMOV_STATUS_RSLT_COUNT(n)    (((n) >> 29))
> +#define DMOV_STATUS_CMD_COUNT(n)     (((n) >> 27) & 3)
> +#define DMOV_STATUS_RSLT_VALID       (1 << 1)
> +#define DMOV_STATUS_CMD_PTR_RDY      (1 << 0)
> +
> +#define DMOV_CONFIG_FORCE_TOP_PTR_RSLT (1 << 2)
> +#define DMOV_CONFIG_FORCE_FLUSH_RSLT   (1 << 1)
> +#define DMOV_CONFIG_IRQ_EN             (1 << 0)
> +
> +/* channel assignments */
> +
> +#define DMOV_NAND_CHAN        7
> +#define DMOV_NAND_CRCI_CMD    5
> +#define DMOV_NAND_CRCI_DATA   4
> +
> +#define DMOV_SDC1_CHAN        8
> +#define DMOV_SDC1_CRCI        6
> +
> +#define DMOV_SDC2_CHAN        8
> +#define DMOV_SDC2_CRCI        7
> +
> +#define DMOV_TSIF_CHAN        10
> +#define DMOV_TSIF_CRCI        10
> +
> +#define DMOV_USB_CHAN         11
> +
> +/* no client rate control ifc (eg, ram) */
> +#define DMOV_NONE_CRCI        0
> +
> +
> +/* If the CMD_PTR register has CMD_PTR_LIST selected, the data mover
> + * is going to walk a list of 32bit pointers as described below.  Each
> + * pointer points to a *array* of dmov_s, etc structs.  The last pointer
> + * in the list is marked with CMD_PTR_LP.  The last struct in each array
> + * is marked with CMD_LC (see below).
> + */
> +#define CMD_PTR_ADDR(addr)  ((addr) >> 3)
> +#define CMD_PTR_LP          (1 << 31) /* last pointer */
> +#define CMD_PTR_PT          (3 << 29) /* ? */
> +
> +/* Single Item Mode */
> +typedef struct {
> +       unsigned cmd;
> +       unsigned src;
> +       unsigned dst;
> +       unsigned len;
> +} dmov_s;
> +
> +/* Scatter/Gather Mode */
> +typedef struct {
> +       unsigned cmd;
> +       unsigned src_dscr;
> +       unsigned dst_dscr;
> +       unsigned _reserved;
> +} dmov_sg;
> +
> +/* Box mode */
> +typedef struct {
> +       uint32_t cmd;
> +       uint32_t src_row_addr;
> +       uint32_t dst_row_addr;
> +       uint32_t src_dst_len;
> +       uint32_t num_rows;
> +       uint32_t row_offset;
> +} dmov_box;
> +
> +/* bits for the cmd field of the above structures */
> +
> +#define CMD_LC      (1 << 31)  /* last command */
> +#define CMD_FR      (1 << 22)  /* force result -- does not work? */
> +#define CMD_OCU     (1 << 21)  /* other channel unblock */
> +#define CMD_OCB     (1 << 20)  /* other channel block */
> +#define CMD_TCB     (1 << 19)  /* ? */
> +#define CMD_DAH     (1 << 18)  /* destination address hold -- does not work?*/
> +#define CMD_SAH     (1 << 17)  /* source address hold -- does not work? */
> +
> +#define CMD_MODE_SINGLE     (0 << 0) /* dmov_s structure used */
> +#define CMD_MODE_SG         (1 << 0) /* untested */
> +#define CMD_MODE_IND_SG     (2 << 0) /* untested */
> +#define CMD_MODE_BOX        (3 << 0) /* untested */
> +
> +#define CMD_DST_SWAP_BYTES  (1 << 14) /* exchange each byte n with byte n+1 */
> +#define CMD_DST_SWAP_SHORTS (1 << 15) /* exchange each short n with short n+1 */
> +#define CMD_DST_SWAP_WORDS  (1 << 16) /* exchange each word n with word n+1 */
> +
> +#define CMD_SRC_SWAP_BYTES  (1 << 11) /* exchange each byte n with byte n+1 */
> +#define CMD_SRC_SWAP_SHORTS (1 << 12) /* exchange each short n with short n+1 */
> +#define CMD_SRC_SWAP_WORDS  (1 << 13) /* exchange each word n with word n+1 */
> +
> +#define CMD_DST_CRCI(n)     (((n) & 15) << 7)
> +#define CMD_SRC_CRCI(n)     (((n) & 15) << 3)
> +
> +#define MSM_DMOV_CHANNEL_COUNT 16
> +
> +#define DMOV_SD0(off, ch) (MSM_DMOV_BASE + 0x0000 + (off) + ((ch) << 2))
> +#define DMOV_SD1(off, ch) (MSM_DMOV_BASE + 0x0400 + (off) + ((ch) << 2))
> +#define DMOV_SD2(off, ch) (MSM_DMOV_BASE + 0x0800 + (off) + ((ch) << 2))
> +#define DMOV_SD3(off, ch) (MSM_DMOV_BASE + 0x0C00 + (off) + ((ch) << 2))
> +
> +#if defined(CONFIG_ARCH_MSM7X30)
> +#define DMOV_SD_AARM DMOV_SD2
> +#else
> +#define DMOV_SD_AARM DMOV_SD3
> +#endif
> +
> +#define DMOV_CMD_PTR(ch)      DMOV_SD_AARM(0x000, ch)
> +#define DMOV_RSLT(ch)         DMOV_SD_AARM(0x040, ch)
> +#define DMOV_FLUSH0(ch)       DMOV_SD_AARM(0x080, ch)
> +#define DMOV_FLUSH1(ch)       DMOV_SD_AARM(0x0C0, ch)
> +#define DMOV_FLUSH2(ch)       DMOV_SD_AARM(0x100, ch)
> +#define DMOV_FLUSH3(ch)       DMOV_SD_AARM(0x140, ch)
> +#define DMOV_FLUSH4(ch)       DMOV_SD_AARM(0x180, ch)
> +#define DMOV_FLUSH5(ch)       DMOV_SD_AARM(0x1C0, ch)
> +
> +#define DMOV_STATUS(ch)       DMOV_SD_AARM(0x200, ch)
> +#define DMOV_ISR              DMOV_SD_AARM(0x380, 0)
> +
> +#define DMOV_CONFIG(ch)       DMOV_SD_AARM(0x300, ch)
> +
> +enum {
> +       MSM_DMOV_PRINT_ERRORS = 1,
> +       MSM_DMOV_PRINT_IO = 2,
> +       MSM_DMOV_PRINT_FLOW = 4
> +};
> +
> +static DEFINE_SPINLOCK(msm_dmov_lock);
> +static struct clk *msm_dmov_clk;
> +static unsigned int channel_active;
> +static struct list_head ready_commands[MSM_DMOV_CHANNEL_COUNT];
> +static struct list_head active_commands[MSM_DMOV_CHANNEL_COUNT];
> +static const unsigned int msm_dmov_print_mask = MSM_DMOV_PRINT_ERRORS;
> +
> +#define MSM_DMOV_DPRINTF(mask, format, args...) \
> +       do { \
> +               if ((mask) & msm_dmov_print_mask) \
> +                       printk(KERN_ERR format, args); \
> +       } while (0)
> +#define PRINT_ERROR(format, args...) \
> +       MSM_DMOV_DPRINTF(MSM_DMOV_PRINT_ERRORS, format, args);
> +#define PRINT_IO(format, args...) \
> +       MSM_DMOV_DPRINTF(MSM_DMOV_PRINT_IO, format, args);
> +#define PRINT_FLOW(format, args...) \
> +       MSM_DMOV_DPRINTF(MSM_DMOV_PRINT_FLOW, format, args);
> +
> +static void msm_dmov_stop_cmd(unsigned id, struct msm_dmov_cmd *cmd, int graceful)
> +{
> +       writel((graceful << 31), DMOV_FLUSH0(id));
> +}
> +
> +static void msm_dmov_enqueue_cmd(unsigned id, struct msm_dmov_cmd *cmd)
> +{
> +       unsigned long irq_flags;
> +       unsigned int status;
> +
> +       spin_lock_irqsave(&msm_dmov_lock, irq_flags);
> +       if (!channel_active)
> +               clk_enable(msm_dmov_clk);
> +       dsb();
> +       status = readl(DMOV_STATUS(id));
> +       if (list_empty(&ready_commands[id]) &&
> +               (status & DMOV_STATUS_CMD_PTR_RDY)) {
> +#if 0
> +               if (list_empty(&active_commands[id])) {
> +                       PRINT_FLOW("msm_dmov_enqueue_cmd(%d), enable interrupt\n", id);
> +                       writel(DMOV_CONFIG_IRQ_EN, DMOV_CONFIG(id));
> +               }
> +#endif
> +               if (cmd->execute_func)
> +                       cmd->execute_func(cmd);
> +               PRINT_IO("msm_dmov_enqueue_cmd(%d), start command, status %x\n", id, status);
> +               list_add_tail(&cmd->list, &active_commands[id]);
> +               if (!channel_active)
> +                       enable_irq(INT_ADM_AARM);
> +               channel_active |= 1U << id;
> +               writel(cmd->cmdptr, DMOV_CMD_PTR(id));
> +       } else {
> +               if (!channel_active)
> +                       clk_disable(msm_dmov_clk);
> +               if (list_empty(&active_commands[id]))
> +                       PRINT_ERROR("msm_dmov_enqueue_cmd(%d), error datamover stalled, status %x\n", id, status);
> +
> +               PRINT_IO("msm_dmov_enqueue_cmd(%d), enqueue command, status %x\n", id, status);
> +               list_add_tail(&cmd->list, &ready_commands[id]);
> +       }
> +       spin_unlock_irqrestore(&msm_dmov_lock, irq_flags);
> +}
> +
> +struct msm_dmov_exec_cmdptr_cmd {
> +       struct msm_dmov_cmd dmov_cmd;
> +       struct completion complete;
> +       unsigned id;
> +       unsigned int result;
> +       struct msm_dmov_errdata err;
> +};
> +
> +static irqreturn_t msm_datamover_irq_handler(int irq, void *dev_id)
> +{
> +       unsigned int int_status, mask, id;
> +       unsigned long irq_flags;
> +       unsigned int ch_status;
> +       unsigned int ch_result;
> +       struct msm_dmov_cmd *cmd;
> +
> +       spin_lock_irqsave(&msm_dmov_lock, irq_flags);
> +
> +       int_status = readl(DMOV_ISR); /* read and clear interrupt */
> +       PRINT_FLOW("msm_datamover_irq_handler: DMOV_ISR %x\n", int_status);
> +
> +       while (int_status) {
> +               mask = int_status & -int_status;
> +               id = fls(mask) - 1;
> +               PRINT_FLOW("msm_datamover_irq_handler %08x %08x id %d\n", int_status, mask, id);
> +               int_status &= ~mask;
> +               ch_status = readl(DMOV_STATUS(id));
> +               if (!(ch_status & DMOV_STATUS_RSLT_VALID)) {
> +                       PRINT_FLOW("msm_datamover_irq_handler id %d, result not valid %x\n", id, ch_status);
> +                       continue;
> +               }
> +               do {
> +                       ch_result = readl(DMOV_RSLT(id));
> +                       if (list_empty(&active_commands[id])) {
> +                               PRINT_ERROR("msm_datamover_irq_handler id %d, got result "
> +                                       "with no active command, status %x, result %x\n",
> +                                       id, ch_status, ch_result);
> +                               cmd = NULL;
> +                       } else
> +                               cmd = list_entry(active_commands[id].next, typeof(*cmd), list);
> +                       PRINT_FLOW("msm_datamover_irq_handler id %d, status %x, result %x\n", id, ch_status, ch_result);
> +                       if (ch_result & DMOV_RSLT_DONE) {
> +                               PRINT_FLOW("msm_datamover_irq_handler id %d, status %x\n",
> +                                       id, ch_status);
> +                               PRINT_IO("msm_datamover_irq_handler id %d, got result "
> +                                       "for %p, result %x\n", id, cmd, ch_result);
> +                               if (cmd) {
> +                                       list_del(&cmd->list);
> +                                       dsb();
> +                                       cmd->complete_func(cmd, ch_result, NULL);
> +                               }
> +                       }
> +                       if (ch_result & DMOV_RSLT_FLUSH) {
> +                               struct msm_dmov_errdata errdata;
> +
> +                               errdata.flush[0] = readl(DMOV_FLUSH0(id));
> +                               errdata.flush[1] = readl(DMOV_FLUSH1(id));
> +                               errdata.flush[2] = readl(DMOV_FLUSH2(id));
> +                               errdata.flush[3] = readl(DMOV_FLUSH3(id));
> +                               errdata.flush[4] = readl(DMOV_FLUSH4(id));
> +                               errdata.flush[5] = readl(DMOV_FLUSH5(id));
> +                               PRINT_FLOW("msm_datamover_irq_handler id %d, status %x\n", id, ch_status);
> +                               PRINT_FLOW("msm_datamover_irq_handler id %d, flush, result %x, flush0 %x\n", id, ch_result, errdata.flush[0]);
> +                               if (cmd) {
> +                                       list_del(&cmd->list);
> +                                       dsb();
> +                                       cmd->complete_func(cmd, ch_result, &errdata);
> +                               }
> +                       }
> +                       if (ch_result & DMOV_RSLT_ERROR) {
> +                               struct msm_dmov_errdata errdata;
> +
> +                               errdata.flush[0] = readl(DMOV_FLUSH0(id));
> +                               errdata.flush[1] = readl(DMOV_FLUSH1(id));
> +                               errdata.flush[2] = readl(DMOV_FLUSH2(id));
> +                               errdata.flush[3] = readl(DMOV_FLUSH3(id));
> +                               errdata.flush[4] = readl(DMOV_FLUSH4(id));
> +                               errdata.flush[5] = readl(DMOV_FLUSH5(id));
> +
> +                               PRINT_ERROR("msm_datamover_irq_handler id %d, status %x\n", id, ch_status);
> +                               PRINT_ERROR("msm_datamover_irq_handler id %d, error, result %x, flush0 %x\n", id, ch_result, errdata.flush[0]);
> +                               if (cmd) {
> +                                       list_del(&cmd->list);
> +                                       dsb();
> +                                       cmd->complete_func(cmd, ch_result, &errdata);
> +                               }
> +                               /* this does not seem to work, once we get an error */
> +                               /* the datamover will no longer accept commands */
> +                               writel(0, DMOV_FLUSH0(id));
> +                       }
> +                       ch_status = readl(DMOV_STATUS(id));
> +                       PRINT_FLOW("msm_datamover_irq_handler id %d, status %x\n", id, ch_status);
> +                       if ((ch_status & DMOV_STATUS_CMD_PTR_RDY) && !list_empty(&ready_commands[id])) {
> +                               cmd = list_entry(ready_commands[id].next, typeof(*cmd), list);
> +                               list_move_tail(&cmd->list, &active_commands[id]);
> +                               if (cmd->execute_func)
> +                                       cmd->execute_func(cmd);
> +                               PRINT_FLOW("msm_datamover_irq_handler id %d, start command\n", id);
> +                               writel(cmd->cmdptr, DMOV_CMD_PTR(id));
> +                       }
> +               } while (ch_status & DMOV_STATUS_RSLT_VALID);
> +               if (list_empty(&active_commands[id]) && list_empty(&ready_commands[id]))
> +                       channel_active &= ~(1U << id);
> +               PRINT_FLOW("msm_datamover_irq_handler id %d, status %x\n", id, ch_status);
> +       }
> +
> +       if (!channel_active) {
> +               disable_irq_nosync(INT_ADM_AARM);
> +               clk_disable(msm_dmov_clk);
> +       }
> +
> +       spin_unlock_irqrestore(&msm_dmov_lock, irq_flags);
> +       return IRQ_HANDLED;
> +}
> +
> +static int __init msm_init_datamover(void)
> +{
> +       int i;
> +       int ret;
> +       struct clk *clk;
> +
> +       for (i = 0; i < MSM_DMOV_CHANNEL_COUNT; i++) {
> +               INIT_LIST_HEAD(&ready_commands[i]);
> +               INIT_LIST_HEAD(&active_commands[i]);
> +               writel(DMOV_CONFIG_IRQ_EN | DMOV_CONFIG_FORCE_TOP_PTR_RSLT | DMOV_CONFIG_FORCE_FLUSH_RSLT, DMOV_CONFIG(i));
> +       }
> +       clk = clk_get(NULL, "adm_clk");
> +       if (IS_ERR(clk))
> +               return PTR_ERR(clk);
> +       clk_prepare(clk);
> +       msm_dmov_clk = clk;
> +       ret = request_irq(INT_ADM_AARM, msm_datamover_irq_handler, 0, "msmdatamover", NULL);
> +       if (ret)
> +               return ret;
> +       disable_irq(INT_ADM_AARM);
> +       return 0;
> +}
> +module_init(msm_init_datamover);
> +
> +/* now the actual SD card driver */
> +
>  #include "msm_sdcc.h"
>
>  #define DRIVER_NAME "msm-sdcc"
> --
> 2.1.0.rc2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC PATCH 03/18] mmc: msm: pass dmov resources via device
  2015-03-04 19:32 ` [RFC PATCH 03/18] mmc: msm: pass dmov resources via device Arnd Bergmann
@ 2015-03-13 13:15   ` Ulf Hansson
  0 siblings, 0 replies; 36+ messages in thread
From: Ulf Hansson @ 2015-03-13 13:15 UTC (permalink / raw)
  To: linux-arm-kernel

On 4 March 2015 at 20:32, Arnd Bergmann <arnd@arndb.de> wrote:
> The data mover code that got moved here from arch/arm was not
> using the device model at all. This tries to retrofit it
> passing the irq and mmio address using resources.
>
> The approach is a little half-baked, but it still seems better
> than the original code. One problem now is that the resources
> are not getting cleaned up properly. Instead of doing something
> that I can't test myself, I just disable module unloading to
> avoid having to rewrite more than necessary.
>
> It's unclear whether this works with multiple sdcc devices.
> What I know is that no platform in the kernel registers more
> than one at the moment, and I suspect that trying to use more
> than one was already broken. If it was working previously,
> it most likely keeps working, and it's unlikely that we will
> see new users of this driver that require more than one
> device.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: Ulf Hansson <ulf.hansson@linaro.org>

> ---
>  arch/arm/mach-msm/devices-msm7x00.c | 44 +++++++++++++++++++++++++++++++++++
>  arch/arm/mach-msm/devices-qsd8x50.c | 44 +++++++++++++++++++++++++++++++++++
>  drivers/mmc/host/msm_sdcc.c         | 46 ++++++++++++++++++++++---------------
>  3 files changed, 115 insertions(+), 19 deletions(-)
>
> diff --git a/arch/arm/mach-msm/devices-msm7x00.c b/arch/arm/mach-msm/devices-msm7x00.c
> index d83404d4b328..aa3feeb96414 100644
> --- a/arch/arm/mach-msm/devices-msm7x00.c
> +++ b/arch/arm/mach-msm/devices-msm7x00.c
> @@ -211,6 +211,17 @@ static struct resource resources_sdc1[] = {
>                 .name   = "status_irq"
>         },
>         {
> +               .start  = INT_ADM_AARM,
> +               .end    = INT_ADM_AARM,
> +               .flags  = IORESOURCE_IRQ,
> +               .name   = "dmov_irq",
> +       },
> +       {
> +               .start  = MSM_DMOV_PHYS + (3 * 0x400),
> +               .end    = MSM_DMOV_PHYS + (4 * 0x400) - 1,
> +               .flags  = IORESOURCE_MEM,
> +       },
> +       {
>                 .start  = 8,
>                 .end    = 8,
>                 .flags  = IORESOURCE_DMA,
> @@ -234,6 +245,17 @@ static struct resource resources_sdc2[] = {
>                 .name   = "status_irq"
>         },
>         {
> +               .start  = INT_ADM_AARM,
> +               .end    = INT_ADM_AARM,
> +               .flags  = IORESOURCE_IRQ,
> +               .name   = "dmov_irq",
> +       },
> +       {
> +               .start  = MSM_DMOV_PHYS + (3 * 0x400),
> +               .end    = MSM_DMOV_PHYS + (4 * 0x400) - 1,
> +               .flags  = IORESOURCE_MEM,
> +       },
> +       {
>                 .start  = 8,
>                 .end    = 8,
>                 .flags  = IORESOURCE_DMA,
> @@ -257,6 +279,17 @@ static struct resource resources_sdc3[] = {
>                 .name   = "status_irq"
>         },
>         {
> +               .start  = INT_ADM_AARM,
> +               .end    = INT_ADM_AARM,
> +               .flags  = IORESOURCE_IRQ,
> +               .name   = "dmov_irq",
> +       },
> +       {
> +               .start  = MSM_DMOV_PHYS + (3 * 0x400),
> +               .end    = MSM_DMOV_PHYS + (4 * 0x400) - 1,
> +               .flags  = IORESOURCE_MEM,
> +       },
> +       {
>                 .start  = 8,
>                 .end    = 8,
>                 .flags  = IORESOURCE_DMA,
> @@ -280,6 +313,17 @@ static struct resource resources_sdc4[] = {
>                 .name   = "status_irq"
>         },
>         {
> +               .start  = INT_ADM_AARM,
> +               .end    = INT_ADM_AARM,
> +               .flags  = IORESOURCE_IRQ,
> +               .name   = "dmov_irq",
> +       },
> +       {
> +               .start  = MSM_DMOV_PHYS + (3 * 0x400),
> +               .end    = MSM_DMOV_PHYS + (4 * 0x400) - 1,
> +               .flags  = IORESOURCE_MEM,
> +       },
> +       {
>                 .start  = 8,
>                 .end    = 8,
>                 .flags  = IORESOURCE_DMA,
> diff --git a/arch/arm/mach-msm/devices-qsd8x50.c b/arch/arm/mach-msm/devices-qsd8x50.c
> index dfc884521fc1..6db025cef825 100644
> --- a/arch/arm/mach-msm/devices-qsd8x50.c
> +++ b/arch/arm/mach-msm/devices-qsd8x50.c
> @@ -175,6 +175,17 @@ static struct resource resources_sdc1[] = {
>                 .name   = "status_irq"
>         },
>         {
> +               .start  = INT_ADM_AARM,
> +               .end    = INT_ADM_AARM,
> +               .flags  = IORESOURCE_IRQ,
> +               .name   = "dmov_irq",
> +       },
> +       {
> +               .start  = MSM_DMOV_PHYS + (3 * 0x400),
> +               .end    = MSM_DMOV_PHYS + (4 * 0x400) - 1,
> +               .flags  = IORESOURCE_MEM,
> +       },
> +       {
>                 .start  = 8,
>                 .end    = 8,
>                 .flags  = IORESOURCE_DMA,
> @@ -198,6 +209,17 @@ static struct resource resources_sdc2[] = {
>                 .name   = "status_irq"
>         },
>         {
> +               .start  = INT_ADM_AARM,
> +               .end    = INT_ADM_AARM,
> +               .flags  = IORESOURCE_IRQ,
> +               .name   = "dmov_irq",
> +       },
> +       {
> +               .start  = MSM_DMOV_PHYS + (3 * 0x400),
> +               .end    = MSM_DMOV_PHYS + (4 * 0x400) - 1,
> +               .flags  = IORESOURCE_MEM,
> +       },
> +       {
>                 .start  = 8,
>                 .end    = 8,
>                 .flags  = IORESOURCE_DMA,
> @@ -221,6 +243,17 @@ static struct resource resources_sdc3[] = {
>                 .name   = "status_irq"
>         },
>         {
> +               .start  = INT_ADM_AARM,
> +               .end    = INT_ADM_AARM,
> +               .flags  = IORESOURCE_IRQ,
> +               .name   = "dmov_irq",
> +       },
> +       {
> +               .start  = MSM_DMOV_PHYS + (3 * 0x400),
> +               .end    = MSM_DMOV_PHYS + (4 * 0x400) - 1,
> +               .flags  = IORESOURCE_MEM,
> +       },
> +       {
>                 .start  = 8,
>                 .end    = 8,
>                 .flags  = IORESOURCE_DMA,
> @@ -244,6 +277,17 @@ static struct resource resources_sdc4[] = {
>                 .name   = "status_irq"
>         },
>         {
> +               .start  = INT_ADM_AARM,
> +               .end    = INT_ADM_AARM,
> +               .flags  = IORESOURCE_IRQ,
> +               .name   = "dmov_irq",
> +       },
> +       {
> +               .start  = MSM_DMOV_PHYS + (3 * 0x400),
> +               .end    = MSM_DMOV_PHYS + (4 * 0x400) - 1,
> +               .flags  = IORESOURCE_MEM,
> +       },
> +       {
>                 .start  = 8,
>                 .end    = 8,
>                 .flags  = IORESOURCE_DMA,
> diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c
> index 83dc4e5d9963..3002e377e9f7 100644
> --- a/drivers/mmc/host/msm_sdcc.c
> +++ b/drivers/mmc/host/msm_sdcc.c
> @@ -45,7 +45,6 @@
>  #include <asm/sizes.h>
>
>  #include <linux/platform_data/mmc-msm_sdcc.h>
> -#include <mach/msm_iomap.h>
>  #include <mach/clk.h>
>
>  /* data mover definitions */
> @@ -170,16 +169,7 @@ typedef struct {
>
>  #define MSM_DMOV_CHANNEL_COUNT 16
>
> -#define DMOV_SD0(off, ch) (MSM_DMOV_BASE + 0x0000 + (off) + ((ch) << 2))
> -#define DMOV_SD1(off, ch) (MSM_DMOV_BASE + 0x0400 + (off) + ((ch) << 2))
> -#define DMOV_SD2(off, ch) (MSM_DMOV_BASE + 0x0800 + (off) + ((ch) << 2))
> -#define DMOV_SD3(off, ch) (MSM_DMOV_BASE + 0x0C00 + (off) + ((ch) << 2))
> -
> -#if defined(CONFIG_ARCH_MSM7X30)
> -#define DMOV_SD_AARM DMOV_SD2
> -#else
> -#define DMOV_SD_AARM DMOV_SD3
> -#endif
> +#define DMOV_SD_AARM(off, ch) (msm_dmov_base + (off) + ((ch) << 2))
>
>  #define DMOV_CMD_PTR(ch)      DMOV_SD_AARM(0x000, ch)
>  #define DMOV_RSLT(ch)         DMOV_SD_AARM(0x040, ch)
> @@ -203,6 +193,8 @@ enum {
>
>  static DEFINE_SPINLOCK(msm_dmov_lock);
>  static struct clk *msm_dmov_clk;
> +static int msm_dmov_irq;
> +static void __iomem *msm_dmov_base;
>  static unsigned int channel_active;
>  static struct list_head ready_commands[MSM_DMOV_CHANNEL_COUNT];
>  static struct list_head active_commands[MSM_DMOV_CHANNEL_COUNT];
> @@ -248,7 +240,7 @@ static void msm_dmov_enqueue_cmd(unsigned id, struct msm_dmov_cmd *cmd)
>                 PRINT_IO("msm_dmov_enqueue_cmd(%d), start command, status %x\n", id, status);
>                 list_add_tail(&cmd->list, &active_commands[id]);
>                 if (!channel_active)
> -                       enable_irq(INT_ADM_AARM);
> +                       enable_irq(msm_dmov_irq);
>                 channel_active |= 1U << id;
>                 writel(cmd->cmdptr, DMOV_CMD_PTR(id));
>         } else {
> @@ -370,7 +362,7 @@ static irqreturn_t msm_datamover_irq_handler(int irq, void *dev_id)
>         }
>
>         if (!channel_active) {
> -               disable_irq_nosync(INT_ADM_AARM);
> +               disable_irq_nosync(msm_dmov_irq);
>                 clk_disable(msm_dmov_clk);
>         }
>
> @@ -378,12 +370,18 @@ static irqreturn_t msm_datamover_irq_handler(int irq, void *dev_id)
>         return IRQ_HANDLED;
>  }
>
> -static int __init msm_init_datamover(void)
> +static int msm_init_datamover(int irq, resource_size_t phys)
>  {
>         int i;
>         int ret;
>         struct clk *clk;
>
> +       if (msm_dmov_irq || msm_dmov_base)
> +               return -EBUSY;
> +
> +       msm_dmov_irq = irq;
> +       msm_dmov_base = ioremap(phys, 0x400);
> +
>         for (i = 0; i < MSM_DMOV_CHANNEL_COUNT; i++) {
>                 INIT_LIST_HEAD(&ready_commands[i]);
>                 INIT_LIST_HEAD(&active_commands[i]);
> @@ -394,13 +392,12 @@ static int __init msm_init_datamover(void)
>                 return PTR_ERR(clk);
>         clk_prepare(clk);
>         msm_dmov_clk = clk;
> -       ret = request_irq(INT_ADM_AARM, msm_datamover_irq_handler, 0, "msmdatamover", NULL);
> +       ret = request_irq(msm_dmov_irq, msm_datamover_irq_handler, 0, "msmdatamover", NULL);
>         if (ret)
>                 return ret;
> -       disable_irq(INT_ADM_AARM);
> +       disable_irq(msm_dmov_irq);
>         return 0;
>  }
> -module_init(msm_init_datamover);
>
>  /* now the actual SD card driver */
>
> @@ -1529,8 +1526,10 @@ msmsdcc_probe(struct platform_device *pdev)
>         struct mmc_host *mmc;
>         struct resource *cmd_irqres = NULL;
>         struct resource *stat_irqres = NULL;
> +       struct resource *dmov_irqres = NULL;
>         struct resource *memres = NULL;
>         struct resource *dmares = NULL;
> +       struct resource *dmovres = NULL;
>         int ret;
>
>         /* must have platform data */
> @@ -1549,17 +1548,22 @@ msmsdcc_probe(struct platform_device *pdev)
>         }
>
>         memres = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +       dmovres = platform_get_resource(pdev, IORESOURCE_MEM, 1);
>         dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
>         cmd_irqres = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
>                                                   "cmd_irq");
>         stat_irqres = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
>                                                    "status_irq");
> +       dmov_irqres = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
> +                                                  "dmov_irq");
>
> -       if (!cmd_irqres || !memres) {
> +       if (!cmd_irqres || !memres || !dmov_irqres || !dmovres) {
>                 pr_err("%s: Invalid resource\n", __func__);
>                 return -ENXIO;
>         }
>
> +       msm_init_datamover(dmov_irqres->start, dmovres->start);
> +
>         /*
>          * Setup our host structure
>          */
> @@ -1826,7 +1830,11 @@ static struct platform_driver msmsdcc_driver = {
>         },
>  };
>
> -module_platform_driver(msmsdcc_driver);
> +static int __init msmsdcc_init(void)
> +{
> +       return platform_driver_register(&msmsdcc_driver);
> +}
> +module_init(msmsdcc_init);
>
>  MODULE_DESCRIPTION("Qualcomm MSM 7X00A Multimedia Card Interface driver");
>  MODULE_LICENSE("GPL");
> --
> 2.1.0.rc2
>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RFC PATCH 04/18] mmc: msm: move clk-reset logic to platform
  2015-03-04 19:32 ` [RFC PATCH 04/18] mmc: msm: move clk-reset logic to platform Arnd Bergmann
@ 2015-03-13 13:15   ` Ulf Hansson
  0 siblings, 0 replies; 36+ messages in thread
From: Ulf Hansson @ 2015-03-13 13:15 UTC (permalink / raw)
  To: linux-arm-kernel

On 4 March 2015 at 20:32, Arnd Bergmann <arnd@arndb.de> wrote:
> There is no generic interface for resetting a clock, and
> creating a reset driver for msm seems overkill, so this
> moves the reset logic from the msm_sdcc driver into
> a platform_data callback that calls into the clock driver.
>
> This follows the model that is used for all other devices
> on the msm platform that require a clk reset.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: Ulf Hansson <ulf.hansson@linaro.org>

> ---
>  arch/arm/mach-msm/board-qsd8x50.c          | 18 +++++++++++++++++-
>  arch/arm/mach-msm/board-trout-mmc.c        | 18 ++++++++++++++++++
>  arch/arm/mach-msm/clock.c                  |  2 +-
>  drivers/mmc/host/msm_sdcc.c                | 12 ++----------
>  include/linux/platform_data/mmc-msm_sdcc.h |  3 +++
>  5 files changed, 41 insertions(+), 12 deletions(-)
>
> diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c
> index 4c748616ef47..9676a73683d2 100644
> --- a/arch/arm/mach-msm/board-qsd8x50.c
> +++ b/arch/arm/mach-msm/board-qsd8x50.c
> @@ -180,6 +180,21 @@ static uint32_t msm_sdcc_setup_power(struct device *dv, unsigned int vdd)
>         return 0;
>  }
>
> +static void msm_sdcc_clk_reset(struct clk *clk)
> +{
> +       int ret;
> +
> +       ret = clk_reset(clk, CLK_RESET_ASSERT);
> +       if (ret)
> +               pr_err("sdcc clock assert failed at %lu Hz with err %d\n",
> +                       clk_get_rate(clk), ret);
> +
> +       ret = clk_reset(clk, CLK_RESET_DEASSERT);
> +       if (ret)
> +               pr_err("sdcc clock deassert failed at %lu Hz with err %d\n",
> +                       clk_get_rate(clk), ret);
> +}
> +
>  static struct msm_mmc_gpio_data sdc1_gpio = {
>         .gpio = sdc1_gpio_cfg,
>         .size = ARRAY_SIZE(sdc1_gpio_cfg),
> @@ -188,7 +203,8 @@ static struct msm_mmc_gpio_data sdc1_gpio = {
>  static struct msm_mmc_platform_data qsd8x50_sdc1_data = {
>         .ocr_mask       = MMC_VDD_27_28 | MMC_VDD_28_29,
>         .translate_vdd  = msm_sdcc_setup_power,
> -       .gpio_data = &sdc1_gpio,
> +       .gpio_data      = &sdc1_gpio,
> +       .clk_reset      = msm_sdcc_clk_reset,
>  };
>
>  static void __init qsd8x50_init_mmc(void)
> diff --git a/arch/arm/mach-msm/board-trout-mmc.c b/arch/arm/mach-msm/board-trout-mmc.c
> index 3723e55819d6..2474bba71c8b 100644
> --- a/arch/arm/mach-msm/board-trout-mmc.c
> +++ b/arch/arm/mach-msm/board-trout-mmc.c
> @@ -2,6 +2,7 @@
>  ** Author: Brian Swetland <swetland@google.com>
>  */
>  #include <linux/gpio.h>
> +#include <linux/clk.h>
>  #include <linux/kernel.h>
>  #include <linux/init.h>
>  #include <linux/platform_device.h>
> @@ -14,6 +15,7 @@
>  #include <asm/io.h>
>
>  #include <mach/vreg.h>
> +#include <mach/clk.h>
>
>  #include <linux/platform_data/mmc-msm_sdcc.h>
>
> @@ -154,6 +156,21 @@ static unsigned int trout_sdslot_status(struct device *dev)
>         return (!status);
>  }
>
> +static void trout_sdcc_clk_reset(struct clk *clk)
> +{
> +       int ret;
> +
> +       ret = clk_reset(clk, CLK_RESET_ASSERT);
> +       if (ret)
> +               pr_err("sdcc clock assert failed at %lu Hz with err %d\n",
> +                       clk_get_rate(clk), ret);
> +
> +       ret = clk_reset(clk, CLK_RESET_DEASSERT);
> +       if (ret)
> +               pr_err("sdcc clock deassert failed at %lu Hz with err %d\n",
> +                       clk_get_rate(clk), ret);
> +}
> +
>  #define TROUT_MMC_VDD  MMC_VDD_165_195 | MMC_VDD_20_21 | MMC_VDD_21_22 \
>                         | MMC_VDD_22_23 | MMC_VDD_23_24 | MMC_VDD_24_25 \
>                         | MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 \
> @@ -163,6 +180,7 @@ static struct msm_mmc_platform_data trout_sdslot_data = {
>         .ocr_mask       = TROUT_MMC_VDD,
>         .status         = trout_sdslot_status,
>         .translate_vdd  = trout_sdslot_switchvdd,
> +       .clk_reset      = trout_sdcc_clk_reset,
>  };
>
>  int __init trout_init_mmc(unsigned int sys_rev)
> diff --git a/arch/arm/mach-msm/clock.c b/arch/arm/mach-msm/clock.c
> index 35ea02b52483..0b59ad5eb557 100644
> --- a/arch/arm/mach-msm/clock.c
> +++ b/arch/arm/mach-msm/clock.c
> @@ -23,6 +23,6 @@ int clk_reset(struct clk *clk, enum clk_reset_action action)
>  {
>         struct clk_hw *hw = __clk_get_hw(clk);
>         struct msm_clk *m = to_msm_clk(hw);
> +
>         return m->reset(hw, action);
>  }
> -EXPORT_SYMBOL(clk_reset);
> diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c
> index 3002e377e9f7..be5b9b3b3843 100644
> --- a/drivers/mmc/host/msm_sdcc.c
> +++ b/drivers/mmc/host/msm_sdcc.c
> @@ -45,7 +45,6 @@
>  #include <asm/sizes.h>
>
>  #include <linux/platform_data/mmc-msm_sdcc.h>
> -#include <mach/clk.h>
>
>  /* data mover definitions */
>
> @@ -493,15 +492,8 @@ static void msmsdcc_reset_and_restore(struct msmsdcc_host *host)
>         mci_mask0 = readl(host->base + MMCIMASK0);
>
>         /* Reset the controller */
> -       ret = clk_reset(host->clk, CLK_RESET_ASSERT);
> -       if (ret)
> -               pr_err("%s: Clock assert failed at %u Hz with err %d\n",
> -                               mmc_hostname(host->mmc), host->clk_rate, ret);
> -
> -       ret = clk_reset(host->clk, CLK_RESET_DEASSERT);
> -       if (ret)
> -               pr_err("%s: Clock deassert failed at %u Hz with err %d\n",
> -                               mmc_hostname(host->mmc), host->clk_rate, ret);
> +       if (host->plat->clk_reset)
> +               host->plat->clk_reset(host->clk);
>
>         pr_info("%s: Controller has been re-initialiazed\n",
>                         mmc_hostname(host->mmc));
> diff --git a/include/linux/platform_data/mmc-msm_sdcc.h b/include/linux/platform_data/mmc-msm_sdcc.h
> index 55aa873c9396..6f1821a4bf93 100644
> --- a/include/linux/platform_data/mmc-msm_sdcc.h
> +++ b/include/linux/platform_data/mmc-msm_sdcc.h
> @@ -15,6 +15,8 @@ struct msm_mmc_gpio_data {
>         u8 size;
>  };
>
> +struct clk;
> +
>  struct msm_mmc_platform_data {
>         unsigned int ocr_mask;                  /* available voltages */
>         u32 (*translate_vdd)(struct device *, unsigned int);
> @@ -22,6 +24,7 @@ struct msm_mmc_platform_data {
>         int (*register_status_notify)(void (*callback)(int card_present, void *dev_id), void *dev_id);
>         struct msm_mmc_gpio_data *gpio_data;
>         void (*init_card)(struct mmc_card *card);
> +       void (*clk_reset)(struct clk *clk);
>  };
>
>  #endif
> --
> 2.1.0.rc2
>

^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2015-03-13 13:15 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-04 19:32 [RFC PATCH 00/18] ARM: msm multiplatform support Arnd Bergmann
2015-03-04 19:32 ` [RFC PATCH 01/18] serial: remove obsolete msm_serial_hs driver Arnd Bergmann
2015-03-04 20:03   ` Paul Bolle
2015-03-04 20:07     ` Paul Bolle
2015-03-04 20:38       ` Arnd Bergmann
2015-03-04 19:32 ` [RFC PATCH 02/18] mmc: msm: move data mover into mmc driver Arnd Bergmann
2015-03-13 13:14   ` Ulf Hansson
2015-03-04 19:32 ` [RFC PATCH 03/18] mmc: msm: pass dmov resources via device Arnd Bergmann
2015-03-13 13:15   ` Ulf Hansson
2015-03-04 19:32 ` [RFC PATCH 04/18] mmc: msm: move clk-reset logic to platform Arnd Bergmann
2015-03-13 13:15   ` Ulf Hansson
2015-03-04 19:32 ` [RFC PATCH 05/18] ARM: msm: fix qsd8x50 rev.a support Arnd Bergmann
2015-03-04 19:33 ` [RFC PATCH 06/18] ARM: msm: fix mach/msm_iomap.h inclusions Arnd Bergmann
2015-03-04 19:33 ` [RFC PATCH 07/18] ARM: msm: fix sirc code for multiplatform Arnd Bergmann
2015-03-04 19:33 ` [RFC PATCH 08/18] ARM: msm: fix gpiomux config " Arnd Bergmann
2015-03-04 19:33 ` [RFC PATCH 09/18] ARM: msm: fix vic irqchip " Arnd Bergmann
2015-03-04 19:33 ` [RFC PATCH 10/18] gpio: move msm-v1 driver to mach-msm Arnd Bergmann
2015-03-09 16:10   ` Linus Walleij
2015-03-04 19:33 ` [RFC PATCH 11/18] clocksource: qcom: make mach-msm and mach-qcom coexist Arnd Bergmann
2015-03-04 19:33 ` [RFC PATCH 12/18] ARM: msm: make smd behave like a normal driver Arnd Bergmann
2015-03-04 19:33 ` [RFC PATCH 13/18] ARM: msm: rename conflicting symbols Arnd Bergmann
2015-03-04 19:33 ` [RFC PATCH 14/18] ARM: msm: pass gpio irq range as resource Arnd Bergmann
2015-03-04 19:33 ` [RFC PATCH 15/18] ARM: msm: clean up irq handling Arnd Bergmann
2015-03-04 19:33 ` [RFC PATCH 16/18] ARM: msm: make msm_smd.h global Arnd Bergmann
2015-03-04 19:33 ` [RFC PATCH 17/18] ARM: msm: make all header files local Arnd Bergmann
2015-03-04 19:33 ` [RFC PATCH 18/18] ARM: msm: enable multiplatform support Arnd Bergmann
2015-03-04 20:31 ` [RFC PATCH 00/18] ARM: msm " Paul Bolle
2015-03-04 20:35   ` Arnd Bergmann
2015-03-04 21:09     ` Paul Bolle
2015-03-04 21:14       ` Paul Bolle
2015-03-04 22:11 ` dwalker at fifo99.com
2015-03-04 22:30   ` Arnd Bergmann
2015-03-05 16:40 ` Ulf Hansson
2015-03-08 22:52   ` Arnd Bergmann
2015-03-07  3:12 ` dwalker at fifo99.com
2015-03-12 16:27   ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).