RFC: OMAP Synchronous Serial Interface (SSI) driver
Subsystems (4)
cover RFC: OMAP Synchronous Serial Interface (SSI) driver
Hi guys !
I'm working on adding support for Nokia HSPA modems to OMAP.
Please consider integrating the following patch set into the linux-omap tree. The patch set implements a generic device driver for the OMAP Synchronous Serial Interface.
The Synchronous Serial Interface (SSI) is a high speed communication interface that is used for connecting OMAP to a cellular modem engine.
The patch set is based on linux-omap 2.6.27-rc6.
Any comments will be appreciated.
Br,
Carlos
Documentation/arm/OMAP/ssi/board-ssi.c.example | 216 +++++++ Documentation/arm/OMAP/ssi/ssi | 233 +++++++ arch/arm/plat-omap/include/mach/ssi/ssi_gdd_reg.h | 145 ++++ arch/arm/plat-omap/include/mach/ssi/ssi_reg_common.h | 73 ++ arch/arm/plat-omap/include/mach/ssi/ssi_ssr_reg.h | 56 + arch/arm/plat-omap/include/mach/ssi/ssi_sst_reg.h | 65 ++ arch/arm/plat-omap/include/mach/ssi/ssi_sys_reg.h | 108 +++ drivers/misc/Kconfig | 2 drivers/misc/Makefile | 2 drivers/misc/ssi/Kconfig | 20 drivers/misc/ssi/Makefile | 11 drivers/misc/ssi/ssi_driver.c | 572 +++++++++++++++++++ drivers/misc/ssi/ssi_driver.h | 228 +++++++ drivers/misc/ssi/ssi_driver_bus.c | 218 +++++++ drivers/misc/ssi/ssi_driver_dma.c | 461 +++++++++++++++ drivers/misc/ssi/ssi_driver_if.c | 374 ++++++++++++ drivers/misc/ssi/ssi_driver_int.c | 296 +++++++++ include/linux/ssi_driver_if.h | 138 ++++ 18 files changed, 3213 insertions(+), 5 deletions(-)
PATCH 1/5 OMAP SSI hardware interface definitions
--- arch/arm/plat-omap/include/mach/ssi/ssi_gdd_reg.h | 145 ++++++++++++++++++++ .../plat-omap/include/mach/ssi/ssi_reg_common.h | 73 ++++++++++ arch/arm/plat-omap/include/mach/ssi/ssi_ssr_reg.h | 56 ++++++++ arch/arm/plat-omap/include/mach/ssi/ssi_sst_reg.h | 65 +++++++++ arch/arm/plat-omap/include/mach/ssi/ssi_sys_reg.h | 107 ++++++++++++++ 5 files changed, 446 insertions(+), 0 deletions(-) create mode 100644 arch/arm/plat-omap/include/mach/ssi/ssi_gdd_reg.h create mode 100644 arch/arm/plat-omap/include/mach/ssi/ssi_reg_common.h create mode 100644 arch/arm/plat-omap/include/mach/ssi/ssi_ssr_reg.h create mode 100644 arch/arm/plat-omap/include/mach/ssi/ssi_sst_reg.h create mode 100644 arch/arm/plat-omap/include/mach/ssi/ssi_sys_reg.h
arch/arm/plat-omap/include/mach/ssi/ssi_gdd_reg.h new file +145 -0
@@ -0,0 +1,145 @@ +/* +* ssi_gdd_reg.h +* +* Hardware defintions for SSI Controller GDD registers. +* +* HARDWARE: OMAP 2420, OMAP 3430 +* +* Copyright (C) 2007-2008 Nokia Corporation. All rights reserved. +* +* Contact: Carlos Chinea <[email protected]> +* +* 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. +* +* 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 St, Fifth Floor, Boston, MA +* 02110-1301 USA +*/ +#ifndef __SSI_GDD_REG_H__ +#define __SSI_GDD_REG_H__ + +#include "ssi_reg_common.h" + +#define SSI_GDD_HW_ID_REG SSI_GDD_REG32(0x0000) +#define SSI_GDD_PPORT_ID_REG SSI_GDD_REG32(0x0010) +#define SSI_GDD_MPORT_ID_REG SSI_GDD_REG32(0x0014) + +#define SSI_GDD_PPORT_SR_REG SSI_GDD_REG32(0x0020) +# define SSI_PPORT_ACTIVE_LCH_NUMBER_MASK 0xFF + +#define SSI_GDD_MPORT_SR_REG SSI_GDD_REG32(0x0024) +# define SSI_MPORT_ACTIVE_LCH_NUMBER_MASK 0xFF + +#define SSI_GDD_TEST_REG SSI_GDD_REG32(0x0040) +# define SSI_TEST 0x1 + +#define SSI_GDD_GCR_REG SSI_GDD_REG32(0x0100) +# define SSI_CLK_AUTOGATING_ON (1<<3) +# define SSI_FREE (1<<2) +# define SSI_SWITCH_OFF 0x1 + +#define SSI_GDD_GRST_REG SSI_GDD_REG32(0x0200) +# define SSI_SWRESET 0x1 + +#define SSI_GDD_CSDP_BASE 0x0800 +#define SSI_GDD_CSDP_OFFSET 0x40 +#define SSI_GDD_CSDP_REG (channel) SSI_GDD_REG16(SSI_GDD_CSDP_BASE +\ + (channel*SSI_GDD_CSDP_OFFSET)) +# define SSI_DST_BURST_EN_MASK 0xC000 +# define SSI_DST_SINGLE_ACCESS0 0x0 +# define SSI_DST_SINGLE_ACCESS (0x1<<14) +# define SSI_DST_BURST_4X32_BIT (0x2<<14) +# define SSI_DST_BURST_8x32_BIT (0x3<<14)/*NOTE: NOT SUPPORTED */ + +# define SSI_DST_MASK 0x1E00 +# define SSI_DST_MEMORY_PORT (0x8<<9) +# define SSI_DST_PERIPHERAL_PORT (0x9<<9) + +# define SSI_SRC_BURST_EN_MASK 0x0180 +# define SSI_SRC_SINGLE_ACCESS0 0x0 +# define SSI_SRC_SINGLE_ACCESS (0x1<<7) +# define SSI_SRC_BURST_4x32_BIT (0x2<<7) +# define SSI_SRC_BURST_8x32_BIT (0x3<<7)/*NOTE: NOT SUPPORTED */ + +# define SSI_SRC_MASK 0x003C +# define SSI_SRC_MEMORY_PORT (0x8<<2) +# define SSI_SRC_PERIPHERAL_PORT (0x9<<2) + +# define SSI_DATA_TYPE_MASK 0x0003 +# define SSI_DATA_TYPE_S32 0x2 + +#define SSI_GDD_CCR_BASE 0x0802 +#define SSI_GDD_CCR_OFFSET 0x40 +#define SSI_GDD_CCR_REG (channel) SSI_GDD_REG16(SSI_GDD_CCR_BASE +\ + (channel*SSI_GDD_CCR_OFFSET)) +# define SSI_DST_AMODE_MASK (0x3<<14) +# define SSI_DST_AMODE_CONST 0x0 +# define SSI_DST_AMODE_POSTINC (0x1<<12) + +# define SSI_SRC_AMODE_MASK (0x3<<12) +# define SSI_SRC_AMODE_CONST 0x0 +# define SSI_SRC_AMODE_POSTINC (0x1<<12) + +# define SSI_CCR_ENABLE (0x1<<7) + +# define SSI_CCR_SYNC_MASK 0x001F + +#define SSI_GDD_CICR_BASE 0x0804 +#define SSI_GDD_CICR_OFFSET 0x40 +#define SSI_GDD_CICR_REG (channel) SSI_GDD_REG16(SSI_GDD_CICR_BASE +\ + (channel*SSI_GDD_CICR_OFFSET)) +# define SSI_BLOCK_IE (0x1<<5) +# define SSI_HALF_IE (0x1<<2) +# define SSI_TOUT_IE 0x1 + +#define SSI_GDD_CSR_BASE 0x0806 +#define SSI_GDD_CSR_OFFSET 0x40 +#define SSI_GDD_CSR_REG (channel) SSI_GDD_REG16(SSI_GDD_CSR_BASE +\ + (channel*SSI_GDD_CSR_OFFSET)) +# define SSI_CSR_SYNC (0x1<<6) +# define SSI_CSR_BLOCK (0x1<<5) +# define SSI_CSR_HALF (0x1<<2) +# define SSI_CSR_TOUR 0x1 + +#define SSI_GDD_CSSA_BASE 0x0808 +#define SSI_GDD_CSSA_OFFSET 0x40 +#define SSI_GDD_CSSA_REG (channel) SSI_GDD_REG32(SSI_GDD_CSSA_BASE +\ + (channel*SSI_GDD_CSSA_OFFSET)) + +#define SSI_GDD_CDSA_BASE 0x080C +#define SSI_GDD_CDSA_OFFSET 0x40 +#define SSI_GDD_CDSA_REG (channel) SSI_GDD_REG32(SSI_GDD_CDSA_BASE +\ + (channel*SSI_GDD_CDSA_OFFSET)) + +#define SSI_GDD_CEN_BASE 0x0810 +#define SSI_GDD_CEN_OFFSET 0x40 +#define SSI_GDD_CEN_REG (channel) SSI_GDD_REG16(SSI_GDD_CEN_BASE +\ + (channel*SSI_GDD_CEN_OFFSET)) + +#define SSI_GDD_CSAC_BASE 0x0818 +#define SSI_GDD_CSAC_OFFSET 0x40 +#define SSI_GDD_CSAC_REG (channel) SSI_GDD_REG16(SSI_GDD_CSAC_BASE +\ + (channel*SSI_GDD_CSAC_OFFSET)) + +#define SSI_GDD_CDAC_BASE 0x081A +#define SSI_GDD_CDAC_OFFSET 0x40 +#define SSI_GDD_CDAC_REG (channel) SSI_GDD_REG16(SSI_GDD_CDAC_BASE +\ + (channel*SSI_GDD_CDAC_OFFSET)) + +#define SSI_GDD_CLNK_CTRL_BASE 0x0828 +#define SSI_GDD_CLNK_CTRL_OFFSET 0x40 +#define SSI_GDD_CLNK_CTRL_REG (channel) SSI_GDD_REG16(SSI_GDD_CLNK_CTRL_BASE +\ + (channel*SSI_GDD_CLNK_CTRL_OFFSET)) +# define SSI_ENABLE_LNK (0x1<<15) +# define SSI_STOP_LNK (0x1<<14) +# define NEXT_CH_ID_MASK 0xF + +#endif
arch/arm/plat-omap/include/mach/ssi/ssi_reg_common.h new file +73 -0
73 lines not on this page · raw message
arch/arm/plat-omap/include/mach/ssi/ssi_ssr_reg.h new file +56 -0
56 lines not on this page · raw message
arch/arm/plat-omap/include/mach/ssi/ssi_sst_reg.h new file +65 -0
65 lines not on this page · raw message
arch/arm/plat-omap/include/mach/ssi/ssi_sys_reg.h new file +107 -0
107 lines not on this page · raw message
Signature · 1 line
1.5.3.6
PATCH 2/5 OMAP SSI driver interface
In reply to Carlos Chinea--- include/linux/ssi_driver_if.h | 137 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 137 insertions(+), 0 deletions(-) create mode 100644 include/linux/ssi_driver_if.h
include/linux/ssi_driver_if.h new file +137 -0
@@ -0,0 +1,137 @@ +/* +* ssi_driver_if.h +* +* Header for the SSI driver low level interface. +* +* Copyright (C) 2007-2008 Nokia Corporation. All rights reserved. +* +* Contact: Carlos Chinea <[email protected]> +* +* 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. +* +* 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 St, Fifth Floor, Boston, MA +* 02110-1301 USA +*/ +#ifndef __SSI_DRIVER_IF_H__ +#define __SSI_DRIVER_IF_H__ + +#include <linux/device.h> + +#define SSI_IOMEM_NAME "SSI_IO_MEM" +#define SSI_P1_MPU_IRQ0_NAME "SSI_P1_MPU_IRQ0" +#define SSI_P2_MPU_IRQ0_NAME "SSI_P2_MPU_IRQ0" +#define SSI_P1_MPU_IRQ1_NAME "SSI_P1_MPU_IRQ1" +#define SSI_P2_MPU_IRQ1_NAME "SSI_P2_MPU_IRQ1" +#define SSI_GDD_MPU_IRQ_NAME "GDD_MPU_IRQ" + +/* IRQ values */ +#define SSI_P1_MPU_IRQ0 67 +#define SSI_P2_MPU_IRQ0 68 +#define SSI_P1_MPU_IRQ1 69 +#define SSI_P2_MPU_IRQ1 70 +#define SSI_GDD_MPU_IRQ 71 + +/* The number of ports handled by the driver. (MAX:2) */ +#define SSI_MAX_PORTS 1 + +/* +* Masks used to enable or disable the reception of certain hardware events +* for the ssi_device_drivers +*/ +#define SSI_EVENT_CLEAR 0x00 +#define SSI_EVENT_MASK 0xFF +#define SSI_EVENT_BREAK_DETECTED_MASK 0x01 +#define SSI_EVENT_ERROR_MASK 0x02 + +#define ANY_SSI_CONTROLLER -1 +#define ANY_CHANNEL -1 +#define CHANNEL (channel) (1<<channel) + +enum { +SSI_EVENT_BREAK_DETECTED =0 , +SSI_EVENT_ERROR , +}; + +enum { +SSI_IOCTL_WAKE_UP , +SSI_IOCTL_WAKE_DOWN , +SSI_IOCTL_SEND_BREAK , +GET_WAKE , +}; + +/* Forward references */ +struct ssi_device ; +struct ssi_dev ; +struct ssi_port ; +struct ssi_channel ; + +struct ssi_port_pd { +u32 tx_mode; +u32 tx_frame_size; +u32 divisor; +u32 tx_ch; +u32 arb_mode; +u32 rx_mode; +u32 rx_frame_size; +u32 rx_ch; +u32 timeout; +u8 n_irq; +}; + +struct ssi_platform_data { +unsigned char *clk_name; +struct ssi_dev *ssi_ctrl; +struct ssi_port_pd *ports; +u8 num_ports; +}; + +struct ssi_device { +int n_ctrl; +unsigned int n_p; +unsigned int n_ch; +char modalias[BUS_ID_SIZE ]; +struct ssi_channel *ch; +struct device device; +}; + +#define to_ssi_device (dev) container_of(dev, struct ssi_device, device) + +struct ssi_device_driver { +unsigned long ctrl_mask; +unsigned long ch_mask[SSI_MAX_PORTS ]; +unsigned long event_mask; +void (*port_event) (int c_id,unsigned int port, +unsigned int event,void *arg); +int (*probe)(struct ssi_device *dev); +int (*remove)(struct ssi_device *dev); +int (*suspend)(struct ssi_device *dev, +pm_message_t mesg); +int (*resume)(struct ssi_device *dev); +struct device_driver driver; +}; + +#define to_ssi_device_driver (drv) container_of(drv, \ + struct ssi_device_driver, \ + driver) + +int register_ssi_driver (struct ssi_device_driver *driver); +void unregister_ssi_driver (struct ssi_device_driver *driver); +int ssi_open (struct ssi_device *dev); +int ssi_write (struct ssi_device *dev,u32 *data,unsigned int count); +void ssi_write_cancel (struct ssi_device *dev); +int ssi_read (struct ssi_device *dev,u32 *data,unsigned int w_count); +void ssi_read_cancel (struct ssi_device *dev); +int ssi_ioctl (struct ssi_device *dev,unsigned int command,void *arg); +void ssi_close (struct ssi_device *dev); +void ssi_dev_set_cb (struct ssi_device *dev,void (*r_cb)(struct ssi_device *dev) + ,void (*w_cb)(struct ssi_device *dev)); +#endif
Signature · 1 line
1.5.3.6
PATCH 3/5 OMAP SSI driver code
In reply to Carlos Chinea--- drivers/misc/ssi/Kconfig | 20 ++ drivers/misc/ssi/Makefile | 11 + drivers/misc/ssi/ssi_driver.c | 572 +++++++++++++++++++++++++++++++++++++ drivers/misc/ssi/ssi_driver.h | 228 +++++++++++++++ drivers/misc/ssi/ssi_driver_bus.c | 218 ++++++++++++++ drivers/misc/ssi/ssi_driver_dma.c | 461 ++++++++++++++++++++++++++++++ drivers/misc/ssi/ssi_driver_if.c | 374 ++++++++++++++++++++++++ drivers/misc/ssi/ssi_driver_int.c | 295 +++++++++++++++++++ 8 files changed, 2179 insertions(+), 0 deletions(-) create mode 100644 drivers/misc/ssi/Kconfig create mode 100644 drivers/misc/ssi/Makefile create mode 100644 drivers/misc/ssi/ssi_driver.c create mode 100644 drivers/misc/ssi/ssi_driver.h create mode 100644 drivers/misc/ssi/ssi_driver_bus.c create mode 100644 drivers/misc/ssi/ssi_driver_dma.c create mode 100644 drivers/misc/ssi/ssi_driver_if.c create mode 100644 drivers/misc/ssi/ssi_driver_int.c
drivers/misc/ssi/Kconfig new file +20 -0
@@ -0,0 +1,20 @@ +# +# OMAP SSI HW kernel configuration +# +config OMAP_SSI + tristate "OMAP SSI hardware driver" + depends on ARCH_OMAP + default n + ---help--- + If you say Y here, you will enable the OMAP SSI hardware driver. + + If unsure, say N. + +config OMAP_SSI_DEBUG + bool "Debug on the OMAP SSI HW driver" + depends on OMAP_SSI && DEBUG_KERNEL + default n + ---help--- + Enable the debug information in the OMAP SSI hardware driver. + + If unsure, say N.
drivers/misc/ssi/Makefile new file +11 -0
@@ -0,0 +1,11 @@ +# +# Makefile for SSI drivers +# +omap_ssi-objs := ssi_driver.o ssi_driver_dma.o ssi_driver_int.o \ + ssi_driver_if.o ssi_driver_bus.o + +obj-$(CONFIG_OMAP_SSI) += omap_ssi.o + +ifeq ($(CONFIG_OMAP_SSI_DEBUG),y) +EXTRA_CFLAGS += -DSSI_DEBUG +endif
drivers/misc/ssi/ssi_driver.c new file +572 -0
572 lines not on this page · raw message
drivers/misc/ssi/ssi_driver.h new file +228 -0
228 lines not on this page · raw message
drivers/misc/ssi/ssi_driver_bus.c new file +218 -0
218 lines not on this page · raw message
drivers/misc/ssi/ssi_driver_dma.c new file +461 -0
461 lines not on this page · raw message
drivers/misc/ssi/ssi_driver_if.c new file +374 -0
374 lines not on this page · raw message
drivers/misc/ssi/ssi_driver_int.c new file +295 -0
295 lines not on this page · raw message
Signature · 1 line
1.5.3.6
PATCH 4/5 OMAP SSI integration into misc drivers
In reply to Carlos Chinea--- drivers/misc/Kconfig | 2 ++ drivers/misc/Makefile | 1 + 2 files changed, 3 insertions(+), 0 deletions(-)
drivers/misc/Kconfig +2 -0
@@ -488,4 +488,6 @@ config SGI_GRU_DEBUG This option enables addition debugging code for the SGI GRU driver. If you are unsure, say N. +source "drivers/misc/ssi/Kconfig" + endif # MISC_DEVICES
drivers/misc/Makefile +1 -0
@@ -31,3 +31,4 @@ obj-$(CONFIG_KGDB_TESTS) += kgdbts.o obj-$(CONFIG_SGI_XP) += sgi-xp/ obj-$(CONFIG_SGI_GRU) += sgi-gru/ obj-$(CONFIG_HP_ILO) += hpilo.o +obj-$(CONFIG_OMAP_SSI) += ssi/
Signature · 1 line
1.5.3.6
PATCH 5/5 OMAP SSI API documentation
In reply to Carlos Chinea--- Documentation/arm/OMAP/ssi/board-ssi.c.example | 216 ++++++++++++++++++++++ Documentation/arm/OMAP/ssi/ssi | 232 ++++++++++++++++++++++++ 2 files changed, 448 insertions(+), 0 deletions(-) create mode 100644 Documentation/arm/OMAP/ssi/board-ssi.c.example create mode 100644 Documentation/arm/OMAP/ssi/ssi
Documentation/arm/OMAP/ssi/board-ssi.c.example new file +216 -0
@@ -0,0 +1,216 @@ +/* + * board-ssi.c.example + * + * Copyright (C) 2007-2008 Nokia Corporation. All rights reserved. + * + * Contact: Carlos Chinea <[email protected]> + * + * 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. + * + * 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 St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#ifdef CONFIG_OMAP_SSI + +#include <linux/platform_device.h> +#include <linux/err.h> +#include <linux/clk.h> +#include <linux/io.h> +#include <linux/ssi_driver_if.h> +#include <mach/ssi/ssi_sys_reg.h> +#include <mach/ssi/ssi_ssr_reg.h> +#include <mach/ssi/ssi_sst_reg.h> + +#include "clock.h" + +struct ssi_internal_clk { + struct clk clk; + struct clk **childs; + int n_childs; + struct platform_device *pdev; +}; + +static struct ssi_internal_clk ssi_clock; + +static void ssi_pdev_release(struct device *dev) +{ +} + +static struct ssi_port_pd ssi_ports[] = { + [0] = { + .tx_mode = SSI_MODE_FRAME, + .tx_frame_size = SSI_FRAMESIZE_DEFAULT, + .divisor = SSI_DIVISOR_DEFAULT, + .tx_ch = SSI_CHANNELS_DEFAULT, + .arb_mode = SSI_ARBMODE_ROUNDROBIN, + .rx_mode = SSI_MODE_FRAME, + .rx_frame_size = SSI_FRAMESIZE_DEFAULT, + .rx_ch = SSI_CHANNELS_DEFAULT, + .timeout = SSI_TIMEOUT_DEFAULT, + .n_irq = 0, + }, +}; + +static struct ssi_platform_data ssi_p_d = { + .clk_name = "ssi_clk", + .num_ports = ARRAY_SIZE(ssi_ports), + .ports = ssi_ports, +}; + +static struct resource ssi_resources[] = { + [0] = { + .start = SSI_IOMEM_BASE_ADDR, + .end = SSI_IOMEM_BASE_ADDR + SSI_IOMEM_SIZE, + .name = SSI_IOMEM_NAME, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = SSI_P1_MPU_IRQ0, + .end = SSI_P1_MPU_IRQ0, + .name = SSI_P1_MPU_IRQ0_NAME, + .flags = IORESOURCE_IRQ, + }, + [2] = { + .start = SSI_P1_MPU_IRQ1, + .end = SSI_P1_MPU_IRQ1, + .name = SSI_P1_MPU_IRQ1_NAME, + .flags = IORESOURCE_IRQ, + }, + [3] = { + .start = SSI_P2_MPU_IRQ0, + .end = SSI_P2_MPU_IRQ0, + .name = SSI_P2_MPU_IRQ0_NAME, + .flags = IORESOURCE_IRQ, + }, + [4] = { + .start = SSI_P2_MPU_IRQ1, + .end = SSI_P2_MPU_IRQ1, + .name = SSI_P2_MPU_IRQ1_NAME, + .flags = IORESOURCE_IRQ, + }, + [5] = { + .start = SSI_GDD_MPU_IRQ, + .end = SSI_GDD_MPU_IRQ, + .name = SSI_GDD_MPU_IRQ_NAME, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device ssi_pdev = { + .name = "omap_ssi", + .id = -1, + .num_resources = ARRAY_SIZE(ssi_resources), + .resource = ssi_resources, + .dev = { + .release = ssi_pdev_release, + .platform_data = &ssi_p_d, + }, +}; + +static void set_ssi_mode(struct platform_device *pdev, u32 mode) +{ + void __iomem *base = (void __iomem *)pdev->resource[0].start; + int port; + int num_ports = ((struct ssi_platform_data *) + (pdev->dev.platform_data))->num_ports; + + for (port = 0; port < num_ports; port++) { + outl(mode, OMAP2_IO_ADDRESS(base + SSI_SST_MODE_REG(port))); + outl(mode, OMAP2_IO_ADDRESS(base + SSI_SSR_MODE_REG(port))); + } +} + +static int ssi_clk_init(struct ssi_internal_clk *ssi_clk) +{ + const char *clk_names[] = { "ssi_ick", "ssi_ssr_fck" }; + int i; + int j; + + ssi_clk->n_childs = ARRAY_SIZE(clk_names); + ssi_clk->childs = kzalloc(ssi_clk->n_childs * sizeof(*ssi_clk->childs), + GFP_KERNEL); + if (!ssi_clk->childs) + return -ENOMEM; + + for (i = 0; i < ssi_clk->n_childs; i++) { + ssi_clk->childs[i] = clk_get(NULL, clk_names[i]); + if (IS_ERR(ssi_clk->childs[i])) { + pr_err("Unable to get SSI clock: %s", clk_names[i]); + for (j = i - 1; j >= 0; j--) + clk_put(ssi_clk->childs[j]); + return -ENODEV; + } + } + + return 0; +} + +static int ssi_clk_enable(struct clk *clk) +{ + struct ssi_internal_clk *ssi_clk = + container_of(clk, struct ssi_internal_clk, clk); + int err = 0; + int i; + int j; + + for (i = 0; ((i < ssi_clk->n_childs) && (err >= 0)); i++) + err = omap2_clk_enable(ssi_clk->childs[i]); + + if (unlikely(err < 0)) { + pr_err("Error on SSI clk %d\n", i); + for (j = i - 1; j >= 0; j--) + omap2_clk_disable(ssi_clk->childs[j]); + } else { + if (ssi_clk->clk.usecount == 1) + set_ssi_mode(ssi_clk->pdev, SSI_MODE_FRAME); + } + + return err; +} + +static void ssi_clk_disable(struct clk *clk) +{ + struct ssi_internal_clk *ssi_clk = + container_of(clk, struct ssi_internal_clk, clk); + + int i; + + if (ssi_clk->clk.usecount == 0) + set_ssi_mode(ssi_clk->pdev, SSI_MODE_SLEEP); + + for (i = 0; i < ssi_clk->n_childs; i++) + omap2_clk_disable(ssi_clk->childs[i]); +} + +static struct ssi_internal_clk ssi_clock = { + .clk = { + .name = "ssi_clk", + .id = -1, + .enable = ssi_clk_enable, + .disable = ssi_clk_disable, + }, + .pdev = &ssi_pdev, +}; + +void __init ssi_init(void) +{ + int err; + + ssi_clk_init(&ssi_clock); + clk_register(&ssi_clock.clk); + + err = platform_device_register(&ssi_pdev); + if (err < 0) + pr_err("Unable to register SSI platform device: %d\n", err); +} +#endif
Documentation/arm/OMAP/ssi/ssi new file +232 -0
232 lines not on this page · raw message
Signature · 1 line
1.5.3.6
cover RFC: OMAP Synchronous Serial Interface (SSI) driver (take II)
In reply to Carlos ChineaHi guys !
A couple of weeks ago, I sent a set of patches for comments.
I am sending a new set of those patches with debug statements removed and a bug fix.
The new patch set is based on linux-omap 2.6.27-rc7
Any comments will be appreciated.
Br,
Carlos
Documentation/arm/OMAP/ssi/board-ssi.c.example | 216 ++++++++ Documentation/arm/OMAP/ssi/ssi | 232 +++++++++ arch/arm/plat-omap/include/mach/ssi/ssi_gdd_reg.h | 145 ++++++ .../plat-omap/include/mach/ssi/ssi_reg_common.h | 73 +++ arch/arm/plat-omap/include/mach/ssi/ssi_ssr_reg.h | 56 +++ arch/arm/plat-omap/include/mach/ssi/ssi_sst_reg.h | 65 +++ arch/arm/plat-omap/include/mach/ssi/ssi_sys_reg.h | 107 ++++ drivers/misc/Kconfig | 2 + drivers/misc/Makefile | 1 + drivers/misc/ssi/Kconfig | 11 + drivers/misc/ssi/Makefile | 7 + drivers/misc/ssi/ssi_driver.c | 513 ++++++++++++++++++++ drivers/misc/ssi/ssi_driver.h | 211 ++++++++ drivers/misc/ssi/ssi_driver_bus.c | 192 ++++++++ drivers/misc/ssi/ssi_driver_dma.c | 406 ++++++++++++++++ drivers/misc/ssi/ssi_driver_if.c | 335 +++++++++++++ drivers/misc/ssi/ssi_driver_int.c | 232 +++++++++ include/linux/ssi_driver_if.h | 137 ++++++ 18 files changed, 2941 insertions(+), 0 deletions(-)
Quoted 44 lines · ext Carlos Chinea
Hi guys !
I'm working on adding support for Nokia HSPA modems to OMAP.
Please consider integrating the following patch set into the linux-omap tree. The patch set implements a generic device driver for the OMAP Synchronous Serial Interface.
The Synchronous Serial Interface (SSI) is a high speed communication interface that is used for connecting OMAP to a cellular modem engine.
The patch set is based on linux-omap 2.6.27-rc6.
Any comments will be appreciated.
Br,
CarlosDocumentation/arm/OMAP/ssi/board-ssi.c.example | 216 +++++++ Documentation/arm/OMAP/ssi/ssi | 233 +++++++ arch/arm/plat-omap/include/mach/ssi/ssi_gdd_reg.h | 145 ++++ arch/arm/plat-omap/include/mach/ssi/ssi_reg_common.h | 73 ++ arch/arm/plat-omap/include/mach/ssi/ssi_ssr_reg.h | 56 + arch/arm/plat-omap/include/mach/ssi/ssi_sst_reg.h | 65 ++ arch/arm/plat-omap/include/mach/ssi/ssi_sys_reg.h | 108 +++ drivers/misc/Kconfig | 2 drivers/misc/Makefile | 2 drivers/misc/ssi/Kconfig | 20 drivers/misc/ssi/Makefile | 11 drivers/misc/ssi/ssi_driver.c | 572 +++++++++++++++++++ drivers/misc/ssi/ssi_driver.h | 228 +++++++ drivers/misc/ssi/ssi_driver_bus.c | 218 +++++++ drivers/misc/ssi/ssi_driver_dma.c | 461 +++++++++++++++ drivers/misc/ssi/ssi_driver_if.c | 374 ++++++++++++ drivers/misc/ssi/ssi_driver_int.c | 296 +++++++++ include/linux/ssi_driver_if.h | 138 ++++ 18 files changed, 3213 insertions(+), 5 deletions(-)--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 1/5 OMAP SSI hardware interface definitions
--- arch/arm/plat-omap/include/mach/ssi/ssi_gdd_reg.h | 145 ++++++++++++++++++++ .../plat-omap/include/mach/ssi/ssi_reg_common.h | 73 ++++++++++ arch/arm/plat-omap/include/mach/ssi/ssi_ssr_reg.h | 56 ++++++++ arch/arm/plat-omap/include/mach/ssi/ssi_sst_reg.h | 65 +++++++++ arch/arm/plat-omap/include/mach/ssi/ssi_sys_reg.h | 107 ++++++++++++++ 5 files changed, 446 insertions(+), 0 deletions(-) create mode 100644 arch/arm/plat-omap/include/mach/ssi/ssi_gdd_reg.h create mode 100644 arch/arm/plat-omap/include/mach/ssi/ssi_reg_common.h create mode 100644 arch/arm/plat-omap/include/mach/ssi/ssi_ssr_reg.h create mode 100644 arch/arm/plat-omap/include/mach/ssi/ssi_sst_reg.h create mode 100644 arch/arm/plat-omap/include/mach/ssi/ssi_sys_reg.h
arch/arm/plat-omap/include/mach/ssi/ssi_gdd_reg.h new file +145 -0
@@ -0,0 +1,145 @@ +/* +* ssi_gdd_reg.h +* +* Hardware defintions for SSI Controller GDD registers. +* +* HARDWARE: OMAP 2420, OMAP 3430 +* +* Copyright (C) 2007-2008 Nokia Corporation. All rights reserved. +* +* Contact: Carlos Chinea <[email protected]> +* +* 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. +* +* 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 St, Fifth Floor, Boston, MA +* 02110-1301 USA +*/ +#ifndef __SSI_GDD_REG_H__ +#define __SSI_GDD_REG_H__ + +#include "ssi_reg_common.h" + +#define SSI_GDD_HW_ID_REG SSI_GDD_REG32(0x0000) +#define SSI_GDD_PPORT_ID_REG SSI_GDD_REG32(0x0010) +#define SSI_GDD_MPORT_ID_REG SSI_GDD_REG32(0x0014) + +#define SSI_GDD_PPORT_SR_REG SSI_GDD_REG32(0x0020) +# define SSI_PPORT_ACTIVE_LCH_NUMBER_MASK 0xFF + +#define SSI_GDD_MPORT_SR_REG SSI_GDD_REG32(0x0024) +# define SSI_MPORT_ACTIVE_LCH_NUMBER_MASK 0xFF + +#define SSI_GDD_TEST_REG SSI_GDD_REG32(0x0040) +# define SSI_TEST 0x1 + +#define SSI_GDD_GCR_REG SSI_GDD_REG32(0x0100) +# define SSI_CLK_AUTOGATING_ON (1<<3) +# define SSI_FREE (1<<2) +# define SSI_SWITCH_OFF 0x1 + +#define SSI_GDD_GRST_REG SSI_GDD_REG32(0x0200) +# define SSI_SWRESET 0x1 + +#define SSI_GDD_CSDP_BASE 0x0800 +#define SSI_GDD_CSDP_OFFSET 0x40 +#define SSI_GDD_CSDP_REG (channel) SSI_GDD_REG16(SSI_GDD_CSDP_BASE +\ + (channel*SSI_GDD_CSDP_OFFSET)) +# define SSI_DST_BURST_EN_MASK 0xC000 +# define SSI_DST_SINGLE_ACCESS0 0x0 +# define SSI_DST_SINGLE_ACCESS (0x1<<14) +# define SSI_DST_BURST_4X32_BIT (0x2<<14) +# define SSI_DST_BURST_8x32_BIT (0x3<<14)/*NOTE: NOT SUPPORTED */ + +# define SSI_DST_MASK 0x1E00 +# define SSI_DST_MEMORY_PORT (0x8<<9) +# define SSI_DST_PERIPHERAL_PORT (0x9<<9) + +# define SSI_SRC_BURST_EN_MASK 0x0180 +# define SSI_SRC_SINGLE_ACCESS0 0x0 +# define SSI_SRC_SINGLE_ACCESS (0x1<<7) +# define SSI_SRC_BURST_4x32_BIT (0x2<<7) +# define SSI_SRC_BURST_8x32_BIT (0x3<<7)/*NOTE: NOT SUPPORTED */ + +# define SSI_SRC_MASK 0x003C +# define SSI_SRC_MEMORY_PORT (0x8<<2) +# define SSI_SRC_PERIPHERAL_PORT (0x9<<2) + +# define SSI_DATA_TYPE_MASK 0x0003 +# define SSI_DATA_TYPE_S32 0x2 + +#define SSI_GDD_CCR_BASE 0x0802 +#define SSI_GDD_CCR_OFFSET 0x40 +#define SSI_GDD_CCR_REG (channel) SSI_GDD_REG16(SSI_GDD_CCR_BASE +\ + (channel*SSI_GDD_CCR_OFFSET)) +# define SSI_DST_AMODE_MASK (0x3<<14) +# define SSI_DST_AMODE_CONST 0x0 +# define SSI_DST_AMODE_POSTINC (0x1<<12) + +# define SSI_SRC_AMODE_MASK (0x3<<12) +# define SSI_SRC_AMODE_CONST 0x0 +# define SSI_SRC_AMODE_POSTINC (0x1<<12) + +# define SSI_CCR_ENABLE (0x1<<7) + +# define SSI_CCR_SYNC_MASK 0x001F + +#define SSI_GDD_CICR_BASE 0x0804 +#define SSI_GDD_CICR_OFFSET 0x40 +#define SSI_GDD_CICR_REG (channel) SSI_GDD_REG16(SSI_GDD_CICR_BASE +\ + (channel*SSI_GDD_CICR_OFFSET)) +# define SSI_BLOCK_IE (0x1<<5) +# define SSI_HALF_IE (0x1<<2) +# define SSI_TOUT_IE 0x1 + +#define SSI_GDD_CSR_BASE 0x0806 +#define SSI_GDD_CSR_OFFSET 0x40 +#define SSI_GDD_CSR_REG (channel) SSI_GDD_REG16(SSI_GDD_CSR_BASE +\ + (channel*SSI_GDD_CSR_OFFSET)) +# define SSI_CSR_SYNC (0x1<<6) +# define SSI_CSR_BLOCK (0x1<<5) +# define SSI_CSR_HALF (0x1<<2) +# define SSI_CSR_TOUR 0x1 + +#define SSI_GDD_CSSA_BASE 0x0808 +#define SSI_GDD_CSSA_OFFSET 0x40 +#define SSI_GDD_CSSA_REG (channel) SSI_GDD_REG32(SSI_GDD_CSSA_BASE +\ + (channel*SSI_GDD_CSSA_OFFSET)) + +#define SSI_GDD_CDSA_BASE 0x080C +#define SSI_GDD_CDSA_OFFSET 0x40 +#define SSI_GDD_CDSA_REG (channel) SSI_GDD_REG32(SSI_GDD_CDSA_BASE +\ + (channel*SSI_GDD_CDSA_OFFSET)) + +#define SSI_GDD_CEN_BASE 0x0810 +#define SSI_GDD_CEN_OFFSET 0x40 +#define SSI_GDD_CEN_REG (channel) SSI_GDD_REG16(SSI_GDD_CEN_BASE +\ + (channel*SSI_GDD_CEN_OFFSET)) + +#define SSI_GDD_CSAC_BASE 0x0818 +#define SSI_GDD_CSAC_OFFSET 0x40 +#define SSI_GDD_CSAC_REG (channel) SSI_GDD_REG16(SSI_GDD_CSAC_BASE +\ + (channel*SSI_GDD_CSAC_OFFSET)) + +#define SSI_GDD_CDAC_BASE 0x081A +#define SSI_GDD_CDAC_OFFSET 0x40 +#define SSI_GDD_CDAC_REG (channel) SSI_GDD_REG16(SSI_GDD_CDAC_BASE +\ + (channel*SSI_GDD_CDAC_OFFSET)) + +#define SSI_GDD_CLNK_CTRL_BASE 0x0828 +#define SSI_GDD_CLNK_CTRL_OFFSET 0x40 +#define SSI_GDD_CLNK_CTRL_REG (channel) SSI_GDD_REG16(SSI_GDD_CLNK_CTRL_BASE +\ + (channel*SSI_GDD_CLNK_CTRL_OFFSET)) +# define SSI_ENABLE_LNK (0x1<<15) +# define SSI_STOP_LNK (0x1<<14) +# define NEXT_CH_ID_MASK 0xF + +#endif
arch/arm/plat-omap/include/mach/ssi/ssi_reg_common.h new file +73 -0
73 lines not on this page · raw message
arch/arm/plat-omap/include/mach/ssi/ssi_ssr_reg.h new file +56 -0
56 lines not on this page · raw message
arch/arm/plat-omap/include/mach/ssi/ssi_sst_reg.h new file +65 -0
65 lines not on this page · raw message
arch/arm/plat-omap/include/mach/ssi/ssi_sys_reg.h new file +107 -0
107 lines not on this page · raw message
Signature · 1 line
1.5.3.6
PATCH 2/5 OMAP SSI driver interface
--- include/linux/ssi_driver_if.h | 137 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 137 insertions(+), 0 deletions(-) create mode 100644 include/linux/ssi_driver_if.h
include/linux/ssi_driver_if.h new file +137 -0
@@ -0,0 +1,137 @@ +/* +* ssi_driver_if.h +* +* Header for the SSI driver low level interface. +* +* Copyright (C) 2007-2008 Nokia Corporation. All rights reserved. +* +* Contact: Carlos Chinea <[email protected]> +* +* 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. +* +* 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 St, Fifth Floor, Boston, MA +* 02110-1301 USA +*/ +#ifndef __SSI_DRIVER_IF_H__ +#define __SSI_DRIVER_IF_H__ + +#include <linux/device.h> + +#define SSI_IOMEM_NAME "SSI_IO_MEM" +#define SSI_P1_MPU_IRQ0_NAME "SSI_P1_MPU_IRQ0" +#define SSI_P2_MPU_IRQ0_NAME "SSI_P2_MPU_IRQ0" +#define SSI_P1_MPU_IRQ1_NAME "SSI_P1_MPU_IRQ1" +#define SSI_P2_MPU_IRQ1_NAME "SSI_P2_MPU_IRQ1" +#define SSI_GDD_MPU_IRQ_NAME "GDD_MPU_IRQ" + +/* IRQ values */ +#define SSI_P1_MPU_IRQ0 67 +#define SSI_P2_MPU_IRQ0 68 +#define SSI_P1_MPU_IRQ1 69 +#define SSI_P2_MPU_IRQ1 70 +#define SSI_GDD_MPU_IRQ 71 + +/* The number of ports handled by the driver. (MAX:2) */ +#define SSI_MAX_PORTS 1 + +/* +* Masks used to enable or disable the reception of certain hardware events +* for the ssi_device_drivers +*/ +#define SSI_EVENT_CLEAR 0x00 +#define SSI_EVENT_MASK 0xFF +#define SSI_EVENT_BREAK_DETECTED_MASK 0x01 +#define SSI_EVENT_ERROR_MASK 0x02 + +#define ANY_SSI_CONTROLLER -1 +#define ANY_CHANNEL -1 +#define CHANNEL (channel) (1<<channel) + +enum { +SSI_EVENT_BREAK_DETECTED =0 , +SSI_EVENT_ERROR , +}; + +enum { +SSI_IOCTL_WAKE_UP , +SSI_IOCTL_WAKE_DOWN , +SSI_IOCTL_SEND_BREAK , +SSI_IOCTL_WAKE , +}; + +/* Forward references */ +struct ssi_device ; +struct ssi_dev ; +struct ssi_port ; +struct ssi_channel ; + +struct ssi_port_pd { +u32 tx_mode; +u32 tx_frame_size; +u32 divisor; +u32 tx_ch; +u32 arb_mode; +u32 rx_mode; +u32 rx_frame_size; +u32 rx_ch; +u32 timeout; +u8 n_irq; +}; + +struct ssi_platform_data { +unsigned char *clk_name; +struct ssi_dev *ssi_ctrl; +struct ssi_port_pd *ports; +u8 num_ports; +}; + +struct ssi_device { +int n_ctrl; +unsigned int n_p; +unsigned int n_ch; +char modalias[BUS_ID_SIZE ]; +struct ssi_channel *ch; +struct device device; +}; + +#define to_ssi_device (dev) container_of(dev, struct ssi_device, device) + +struct ssi_device_driver { +unsigned long ctrl_mask; +unsigned long ch_mask[SSI_MAX_PORTS ]; +unsigned long event_mask; +void (*port_event) (int c_id,unsigned int port, +unsigned int event,void *arg); +int (*probe)(struct ssi_device *dev); +int (*remove)(struct ssi_device *dev); +int (*suspend)(struct ssi_device *dev, +pm_message_t mesg); +int (*resume)(struct ssi_device *dev); +struct device_driver driver; +}; + +#define to_ssi_device_driver (drv) container_of(drv, \ + struct ssi_device_driver, \ + driver) + +int register_ssi_driver (struct ssi_device_driver *driver); +void unregister_ssi_driver (struct ssi_device_driver *driver); +int ssi_open (struct ssi_device *dev); +int ssi_write (struct ssi_device *dev,u32 *data,unsigned int count); +void ssi_write_cancel (struct ssi_device *dev); +int ssi_read (struct ssi_device *dev,u32 *data,unsigned int w_count); +void ssi_read_cancel (struct ssi_device *dev); +int ssi_ioctl (struct ssi_device *dev,unsigned int command,void *arg); +void ssi_close (struct ssi_device *dev); +void ssi_dev_set_cb (struct ssi_device *dev,void (*r_cb)(struct ssi_device *dev) + ,void (*w_cb)(struct ssi_device *dev)); +#endif
Signature · 1 line
1.5.3.6
PATCH 3/5 OMAP SSI driver code
--- drivers/misc/ssi/Kconfig | 11 + drivers/misc/ssi/Makefile | 7 + drivers/misc/ssi/ssi_driver.c | 513 +++++++++++++++++++++++++++++++++++++ drivers/misc/ssi/ssi_driver.h | 211 +++++++++++++++ drivers/misc/ssi/ssi_driver_bus.c | 192 ++++++++++++++ drivers/misc/ssi/ssi_driver_dma.c | 406 +++++++++++++++++++++++++++++ drivers/misc/ssi/ssi_driver_if.c | 335 ++++++++++++++++++++++++ drivers/misc/ssi/ssi_driver_int.c | 232 +++++++++++++++++ 8 files changed, 1907 insertions(+), 0 deletions(-) create mode 100644 drivers/misc/ssi/Kconfig create mode 100644 drivers/misc/ssi/Makefile create mode 100644 drivers/misc/ssi/ssi_driver.c create mode 100644 drivers/misc/ssi/ssi_driver.h create mode 100644 drivers/misc/ssi/ssi_driver_bus.c create mode 100644 drivers/misc/ssi/ssi_driver_dma.c create mode 100644 drivers/misc/ssi/ssi_driver_if.c create mode 100644 drivers/misc/ssi/ssi_driver_int.c
drivers/misc/ssi/Kconfig new file +11 -0
@@ -0,0 +1,11 @@ +# +# OMAP SSI HW kernel configuration +# +config OMAP_SSI + tristate "OMAP SSI hardware driver" + depends on ARCH_OMAP + default n + ---help--- + If you say Y here, you will enable the OMAP SSI hardware driver. + + If unsure, say N.
drivers/misc/ssi/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# +# Makefile for SSI drivers +# +omap_ssi-objs := ssi_driver.o ssi_driver_dma.o ssi_driver_int.o \ + ssi_driver_if.o ssi_driver_bus.o + +obj-$(CONFIG_OMAP_SSI) += omap_ssi.o
drivers/misc/ssi/ssi_driver.c new file +513 -0
513 lines not on this page · raw message
drivers/misc/ssi/ssi_driver.h new file +211 -0
211 lines not on this page · raw message
drivers/misc/ssi/ssi_driver_bus.c new file +192 -0
192 lines not on this page · raw message
drivers/misc/ssi/ssi_driver_dma.c new file +406 -0
406 lines not on this page · raw message
drivers/misc/ssi/ssi_driver_if.c new file +335 -0
335 lines not on this page · raw message
drivers/misc/ssi/ssi_driver_int.c new file +232 -0
232 lines not on this page · raw message
Signature · 1 line
1.5.3.6
PATCH 4/5 OMAP SSI integration into misc drivers
--- drivers/misc/Kconfig | 2 ++ drivers/misc/Makefile | 1 + 2 files changed, 3 insertions(+), 0 deletions(-)
drivers/misc/Kconfig +2 -0
@@ -488,4 +488,6 @@ config SGI_GRU_DEBUG This option enables addition debugging code for the SGI GRU driver. If you are unsure, say N. +source "drivers/misc/ssi/Kconfig" + endif # MISC_DEVICES
drivers/misc/Makefile +1 -0
@@ -31,3 +31,4 @@ obj-$(CONFIG_KGDB_TESTS) += kgdbts.o obj-$(CONFIG_SGI_XP) += sgi-xp/ obj-$(CONFIG_SGI_GRU) += sgi-gru/ obj-$(CONFIG_HP_ILO) += hpilo.o +obj-$(CONFIG_OMAP_SSI) += ssi/
Signature · 1 line
1.5.3.6
PATCH 5/5 OMAP SSI API documentation
--- Documentation/arm/OMAP/ssi/board-ssi.c.example | 216 ++++++++++++++++++++++ Documentation/arm/OMAP/ssi/ssi | 232 ++++++++++++++++++++++++ 2 files changed, 448 insertions(+), 0 deletions(-) create mode 100644 Documentation/arm/OMAP/ssi/board-ssi.c.example create mode 100644 Documentation/arm/OMAP/ssi/ssi
Documentation/arm/OMAP/ssi/board-ssi.c.example new file +216 -0
@@ -0,0 +1,216 @@ +/* + * board-ssi.c.example + * + * Copyright (C) 2007-2008 Nokia Corporation. All rights reserved. + * + * Contact: Carlos Chinea <[email protected]> + * + * 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. + * + * 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 St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#ifdef CONFIG_OMAP_SSI + +#include <linux/platform_device.h> +#include <linux/err.h> +#include <linux/clk.h> +#include <linux/io.h> +#include <linux/ssi_driver_if.h> +#include <mach/ssi/ssi_sys_reg.h> +#include <mach/ssi/ssi_ssr_reg.h> +#include <mach/ssi/ssi_sst_reg.h> + +#include "clock.h" + +struct ssi_internal_clk { + struct clk clk; + struct clk **childs; + int n_childs; + struct platform_device *pdev; +}; + +static struct ssi_internal_clk ssi_clock; + +static void ssi_pdev_release(struct device *dev) +{ +} + +static struct ssi_port_pd ssi_ports[] = { + [0] = { + .tx_mode = SSI_MODE_FRAME, + .tx_frame_size = SSI_FRAMESIZE_DEFAULT, + .divisor = SSI_DIVISOR_DEFAULT, + .tx_ch = SSI_CHANNELS_DEFAULT, + .arb_mode = SSI_ARBMODE_ROUNDROBIN, + .rx_mode = SSI_MODE_FRAME, + .rx_frame_size = SSI_FRAMESIZE_DEFAULT, + .rx_ch = SSI_CHANNELS_DEFAULT, + .timeout = SSI_TIMEOUT_DEFAULT, + .n_irq = 0, + }, +}; + +static struct ssi_platform_data ssi_p_d = { + .clk_name = "ssi_clk", + .num_ports = ARRAY_SIZE(ssi_ports), + .ports = ssi_ports, +}; + +static struct resource ssi_resources[] = { + [0] = { + .start = SSI_IOMEM_BASE_ADDR, + .end = SSI_IOMEM_BASE_ADDR + SSI_IOMEM_SIZE, + .name = SSI_IOMEM_NAME, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = SSI_P1_MPU_IRQ0, + .end = SSI_P1_MPU_IRQ0, + .name = SSI_P1_MPU_IRQ0_NAME, + .flags = IORESOURCE_IRQ, + }, + [2] = { + .start = SSI_P1_MPU_IRQ1, + .end = SSI_P1_MPU_IRQ1, + .name = SSI_P1_MPU_IRQ1_NAME, + .flags = IORESOURCE_IRQ, + }, + [3] = { + .start = SSI_P2_MPU_IRQ0, + .end = SSI_P2_MPU_IRQ0, + .name = SSI_P2_MPU_IRQ0_NAME, + .flags = IORESOURCE_IRQ, + }, + [4] = { + .start = SSI_P2_MPU_IRQ1, + .end = SSI_P2_MPU_IRQ1, + .name = SSI_P2_MPU_IRQ1_NAME, + .flags = IORESOURCE_IRQ, + }, + [5] = { + .start = SSI_GDD_MPU_IRQ, + .end = SSI_GDD_MPU_IRQ, + .name = SSI_GDD_MPU_IRQ_NAME, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device ssi_pdev = { + .name = "omap_ssi", + .id = -1, + .num_resources = ARRAY_SIZE(ssi_resources), + .resource = ssi_resources, + .dev = { + .release = ssi_pdev_release, + .platform_data = &ssi_p_d, + }, +}; + +static void set_ssi_mode(struct platform_device *pdev, u32 mode) +{ + void __iomem *base = (void __iomem *)pdev->resource[0].start; + int port; + int num_ports = ((struct ssi_platform_data *) + (pdev->dev.platform_data))->num_ports; + + for (port = 0; port < num_ports; port++) { + outl(mode, OMAP2_IO_ADDRESS(base + SSI_SST_MODE_REG(port))); + outl(mode, OMAP2_IO_ADDRESS(base + SSI_SSR_MODE_REG(port))); + } +} + +static int ssi_clk_init(struct ssi_internal_clk *ssi_clk) +{ + const char *clk_names[] = { "ssi_ick", "ssi_ssr_fck" }; + int i; + int j; + + ssi_clk->n_childs = ARRAY_SIZE(clk_names); + ssi_clk->childs = kzalloc(ssi_clk->n_childs * sizeof(*ssi_clk->childs), + GFP_KERNEL); + if (!ssi_clk->childs) + return -ENOMEM; + + for (i = 0; i < ssi_clk->n_childs; i++) { + ssi_clk->childs[i] = clk_get(NULL, clk_names[i]); + if (IS_ERR(ssi_clk->childs[i])) { + pr_err("Unable to get SSI clock: %s", clk_names[i]); + for (j = i - 1; j >= 0; j--) + clk_put(ssi_clk->childs[j]); + return -ENODEV; + } + } + + return 0; +} + +static int ssi_clk_enable(struct clk *clk) +{ + struct ssi_internal_clk *ssi_clk = + container_of(clk, struct ssi_internal_clk, clk); + int err = 0; + int i; + int j; + + for (i = 0; ((i < ssi_clk->n_childs) && (err >= 0)); i++) + err = omap2_clk_enable(ssi_clk->childs[i]); + + if (unlikely(err < 0)) { + pr_err("Error on SSI clk %d\n", i); + for (j = i - 1; j >= 0; j--) + omap2_clk_disable(ssi_clk->childs[j]); + } else { + if (ssi_clk->clk.usecount == 1) + set_ssi_mode(ssi_clk->pdev, SSI_MODE_FRAME); + } + + return err; +} + +static void ssi_clk_disable(struct clk *clk) +{ + struct ssi_internal_clk *ssi_clk = + container_of(clk, struct ssi_internal_clk, clk); + + int i; + + if (ssi_clk->clk.usecount == 0) + set_ssi_mode(ssi_clk->pdev, SSI_MODE_SLEEP); + + for (i = 0; i < ssi_clk->n_childs; i++) + omap2_clk_disable(ssi_clk->childs[i]); +} + +static struct ssi_internal_clk ssi_clock = { + .clk = { + .name = "ssi_clk", + .id = -1, + .enable = ssi_clk_enable, + .disable = ssi_clk_disable, + }, + .pdev = &ssi_pdev, +}; + +void __init ssi_init(void) +{ + int err; + + ssi_clk_init(&ssi_clock); + clk_register(&ssi_clock.clk); + + err = platform_device_register(&ssi_pdev); + if (err < 0) + pr_err("Unable to register SSI platform device: %d\n", err); +} +#endif
Documentation/arm/OMAP/ssi/ssi new file +232 -0
232 lines not on this page · raw message
Signature · 1 line
1.5.3.6
Re: [PATCH 1/5] OMAP SSI hardware interface definitions
In reply to Carlos ChineaQuoted 2 lines · Carlos Chinea
Signed-off-by Carlos Chinea <[email protected]>
You should provide patch comments, in the form of at least one whole sentence. $SUBJECT is rarely felt to be enough.
Quoted 7 lines
---
arch/arm/plat-omap/include/mach/ssi/ssi_gdd_reg.h | 145 ++++++++++++++++++++.../plat-omap/include/mach/ssi/ssi_reg_common.h| 73 ++++++++++arch/arm/plat-omap/include/mach/ssi/ssi_ssr_reg.h | 56 ++++++++ arch/arm/plat-omap/include/mach/ssi/ssi_sst_reg.h | 65 +++++++++ arch/arm/plat-omap/include/mach/ssi/ssi_sys_reg.h | 107 ++++++++++++++ 5 files changed, 446 insertions(+), 0 deletions(-)
Why is this five files instead of one?
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/5] RFC: OMAP Synchronous Serial Interface (SSI) driver (take II)
In reply to Carlos ChineaQuoted 8 lines · Carlos Chinea
Hi guys !
A couple of weeks ago, I sent a set of patches for comments.
I am sending a new set of those patches with debug statements removed and a bug fix.The new patch set is based on linux-omap 2.6.27-rc7
Any comments will be appreciated.
You should send this to LKML, and cc linux-omap to get proper review of these patches.
Tony
Quoted 75 lines
Br,
CarlosDocumentation/arm/OMAP/ssi/board-ssi.c.example | 216 ++++++++ Documentation/arm/OMAP/ssi/ssi | 232 +++++++++ arch/arm/plat-omap/include/mach/ssi/ssi_gdd_reg.h | 145 ++++++ .../plat-omap/include/mach/ssi/ssi_reg_common.h | 73 +++ arch/arm/plat-omap/include/mach/ssi/ssi_ssr_reg.h | 56 +++ arch/arm/plat-omap/include/mach/ssi/ssi_sst_reg.h | 65 +++ arch/arm/plat-omap/include/mach/ssi/ssi_sys_reg.h | 107 ++++ drivers/misc/Kconfig | 2 + drivers/misc/Makefile | 1 + drivers/misc/ssi/Kconfig | 11 + drivers/misc/ssi/Makefile | 7 + drivers/misc/ssi/ssi_driver.c | 513 ++++++++++++++++++++ drivers/misc/ssi/ssi_driver.h | 211 ++++++++ drivers/misc/ssi/ssi_driver_bus.c | 192 ++++++++ drivers/misc/ssi/ssi_driver_dma.c | 406 ++++++++++++++++ drivers/misc/ssi/ssi_driver_if.c | 335 +++++++++++++ drivers/misc/ssi/ssi_driver_int.c | 232 +++++++++ include/linux/ssi_driver_if.h | 137 ++++++ 18 files changed, 2941 insertions(+), 0 deletions(-)Quoted 40 lines · ext Carlos Chinea
Hi guys !
I'm working on adding support for Nokia HSPA modems to OMAP.
Please consider integrating the following patch set into the linux-omap tree. The patch set implements a generic device driver for the OMAP Synchronous Serial Interface.
The Synchronous Serial Interface (SSI) is a high speed communication interface that is used for connecting OMAP to a cellular modem engine.
The patch set is based on linux-omap 2.6.27-rc6.
Any comments will be appreciated.
Br,
CarlosDocumentation/arm/OMAP/ssi/board-ssi.c.example | 216 +++++++ Documentation/arm/OMAP/ssi/ssi | 233 +++++++ arch/arm/plat-omap/include/mach/ssi/ssi_gdd_reg.h | 145 ++++ arch/arm/plat-omap/include/mach/ssi/ssi_reg_common.h | 73 ++ arch/arm/plat-omap/include/mach/ssi/ssi_ssr_reg.h | 56 + arch/arm/plat-omap/include/mach/ssi/ssi_sst_reg.h | 65 ++ arch/arm/plat-omap/include/mach/ssi/ssi_sys_reg.h | 108 +++ drivers/misc/Kconfig | 2 drivers/misc/Makefile | 2 drivers/misc/ssi/Kconfig | 20 drivers/misc/ssi/Makefile | 11 drivers/misc/ssi/ssi_driver.c | 572 +++++++++++++++++++ drivers/misc/ssi/ssi_driver.h | 228 +++++++ drivers/misc/ssi/ssi_driver_bus.c | 218 +++++++ drivers/misc/ssi/ssi_driver_dma.c | 461 +++++++++++++++ drivers/misc/ssi/ssi_driver_if.c | 374 ++++++++++++ drivers/misc/ssi/ssi_driver_int.c | 296 +++++++++ include/linux/ssi_driver_if.h | 138 ++++ 18 files changed, 3213 insertions(+), 5 deletions(-)Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html