aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2010-12-08 10:57:24 +0000
committerAlan Cox <alan@linux.intel.com>2010-12-08 10:57:24 +0000
commit697c8d5c3ece0754d886023c59ef78e8ccee6319 (patch)
tree2e8ec94c20006f8ff08c467d6a3228defe672256
parentc21f4fdd23372b770a58d8c38d91762e980c351d (diff)
downloadmrst-s0i3-test-697c8d5c3ece0754d886023c59ef78e8ccee6319.tar.gz
mrst-s0i3-test-697c8d5c3ece0754d886023c59ef78e8ccee6319.tar.xz
mrst-s0i3-test-697c8d5c3ece0754d886023c59ef78e8ccee6319.zip
Signed-off-by: Mark A. Allyn <mark.a.allyn@intel.com>
-rw-r--r--drivers/staging/sep/sep_driver.c134
1 files changed, 29 insertions, 105 deletions
diff --git a/drivers/staging/sep/sep_driver.c b/drivers/staging/sep/sep_driver.c
index 0332c370fd8..046be74e665 100644
--- a/drivers/staging/sep/sep_driver.c
+++ b/drivers/staging/sep/sep_driver.c
@@ -7,8 +7,7 @@
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
+ * Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@@ -26,9 +25,11 @@
* CHANGES:
*
* 2009.06.26 Initial publish
+ * 2010.09.14 Upgrade to Medfield
*
*/
+#define DEBUG
#include <linux/init.h>
#include <linux/module.h>
#include <linux/fs.h>
@@ -42,135 +43,61 @@
#include <linux/pci.h>
#include <linux/firmware.h>
#include <linux/slab.h>
-#include <asm/ioctl.h>
+#include <linux/ioctl.h>
+#include <asm/current.h>
#include <linux/ioport.h>
-#include <asm/io.h>
+#include <linux/io.h>
#include <linux/interrupt.h>
#include <linux/pagemap.h>
#include <asm/cacheflush.h>
-#include "sep_driver_hw_defs.h"
-#include "sep_driver_config.h"
-#include "sep_driver_api.h"
-#include "sep_dev.h"
-
-#if SEP_DRIVER_ARM_DEBUG_MODE
-
-#define CRYS_SEP_ROM_length 0x4000
-#define CRYS_SEP_ROM_start_address 0x8000C000UL
-#define CRYS_SEP_ROM_start_address_offset 0xC000UL
-#define SEP_ROM_BANK_register 0x80008420UL
-#define SEP_ROM_BANK_register_offset 0x8420UL
-#define SEP_RAR_IO_MEM_REGION_START_ADDRESS 0x82000000
-
-/*
- * THESE 2 definitions are specific to the board - must be
- * defined during integration
- */
-#define SEP_RAR_IO_MEM_REGION_START_ADDRESS 0xFF0D0000
-
-/* 2M size */
-
-static void sep_load_rom_code(struct sep_device *sep)
-{
- /* Index variables */
- unsigned long i, k, j;
- u32 reg;
- u32 error;
- u32 warning;
-
- /* Loading ROM from SEP_ROM_image.h file */
- k = sizeof(CRYS_SEP_ROM);
-
- edbg("SEP Driver: DX_CC_TST_SepRomLoader start\n");
-
- edbg("SEP Driver: k is %lu\n", k);
- edbg("SEP Driver: sep->reg_addr is %p\n", sep->reg_addr);
- edbg("SEP Driver: CRYS_SEP_ROM_start_address_offset is %p\n", CRYS_SEP_ROM_start_address_offset);
-
- for (i = 0; i < 4; i++) {
- /* write bank */
- sep_write_reg(sep, SEP_ROM_BANK_register_offset, i);
-
- for (j = 0; j < CRYS_SEP_ROM_length / 4; j++) {
- sep_write_reg(sep, CRYS_SEP_ROM_start_address_offset + 4 * j, CRYS_SEP_ROM[i * 0x1000 + j]);
-
- k = k - 4;
-
- if (k == 0) {
- j = CRYS_SEP_ROM_length;
- i = 4;
- }
- }
- }
-
- /* reset the SEP */
- sep_write_reg(sep, HW_HOST_SEP_SW_RST_REG_ADDR, 0x1);
-
- /* poll for SEP ROM boot finish */
- do
- reg = sep_read_reg(sep, HW_HOST_SEP_HOST_GPR3_REG_ADDR);
- while (!reg);
+#include <linux/sched.h>
+#include <linux/delay.h>
- edbg("SEP Driver: ROM polling ended\n");
+#include <linux/netlink.h>
+#include <linux/connector.h>
+#include <linux/cn_proc.h>
- switch (reg) {
- case 0x1:
- /* fatal error - read erro status from GPRO */
- error = sep_read_reg(sep, HW_HOST_SEP_HOST_GPR0_REG_ADDR);
- edbg("SEP Driver: ROM polling case 1\n");
- break;
- case 0x4:
- /* Cold boot ended successfully */
- case 0x8:
- /* Warmboot ended successfully */
- case 0x10:
- /* ColdWarm boot ended successfully */
- error = 0;
- case 0x2:
- /* Boot First Phase ended */
- warning = sep_read_reg(sep, HW_HOST_SEP_HOST_GPR0_REG_ADDR);
- case 0x20:
- edbg("SEP Driver: ROM polling case %d\n", reg);
- break;
- }
-
-}
+/* Stub out memrar and rar_register if those drivers are not in config */
+#if defined(CONFIG_MRST_RAR_HANDLER)
+#include "../memrar/memrar.h"
#else
-static void sep_load_rom_code(struct sep_device *sep) { }
-#endif /* SEP_DRIVER_ARM_DEBUG_MODE */
+#include "memrar_stub.h"
+#endif
+#if defined(CONFIG_RAR_REGISTER)
+#include "../rar_register/rar_register.h"
+#else
+#include "rar_register_stub.h"
+#endif
+#include "sep_driver_hw_defs.h"
+#include "sep_driver_config.h"
+#include "sep_driver_api.h"
+#include "sep_dev.h"
/*----------------------------------------
DEFINES
-----------------------------------------*/
-#define BASE_ADDRESS_FOR_SYSTEM 0xfffc0000
#define SEP_RAR_IO_MEM_REGION_SIZE 0x40000
/*--------------------------------------------
GLOBAL variables
--------------------------------------------*/
-/* debug messages level */
-static int debug;
-module_param(debug, int , 0);
-MODULE_PARM_DESC(debug, "Flag to enable SEP debug messages");
-
/* Keep this a single static object for now to keep the conversion easy */
static struct sep_device sep_instance;
-static struct sep_device *sep_dev = &sep_instance;
+static struct sep_device *sep_dev;
/*
mutex for the access to the internals of the sep driver
*/
static DEFINE_MUTEX(sep_mutex);
-
-
-/* wait queue head (event) of the driver */
-static DECLARE_WAIT_QUEUE_HEAD(sep_event);
+static DEFINE_MUTEX(ioctl_mutex);
+static DEFINE_SPINLOCK(snd_rply_lck);
+static unsigned long snd_rply_lck_flag;
/**
* sep_load_firmware - copy firmware cache/resident
@@ -2537,9 +2464,6 @@ static int __devinit sep_probe(struct pci_dev *pdev, const struct pci_device_id
}
edbg("SEP Driver:reg_addr is %p\n", sep->reg_addr);
- /* load the rom code */
- sep_load_rom_code(sep);
-
/* set up system base address and shared memory location */
sep->rar_addr = dma_alloc_coherent(&sep->pdev->dev,
2 * SEP_RAR_IO_MEM_REGION_SIZE,