#include <plat/hardware.h>
#include <plat/omap34xx.h>
+#include <linux/spi/cpcap.h>
+#include <linux/spi/cpcap-regbits.h>
+
/*
* Register definitions for CPCAP related SPI register
*/
int access_flag;
};
+#if 0
static char tx[4];
+#endif
static bool emu_uart_is_active = FALSE;
/* Although SPI driver is provided through linux system as implemented above,
* we suggest they should use poweric interface.
*
*/
+#if 0
static inline void raw_writel_reg(u32 value, u32 reg)
{
unsigned int absolute_reg = (u32)OMAP_MCSPI_BASE + reg;
return result;
}
+#endif
/*
* Check if the writting is allowed. If MiniUSB port has already been
omap_writew(reg_val, reg);
}
+static int find_ms2_dev(struct device *dev, void *data)
+{
+ if (!strncmp((char*)data, dev_name(dev), strlen((char*)data))) {
+ printk(KERN_INFO "Found it\n");
+ return 1;
+ }
+ return 0;
+}
+
+/*
+ * c01fcb98 T cpcap_regacc_read
+ * c01fcc04 T cpcap_regacc_write
+ */
+
+
+static int (*my_cpcap_regacc_read)(struct cpcap_device *, enum cpcap_reg, unsigned short *) =
+ (int (*)(struct cpcap_device *, enum cpcap_reg, unsigned short *))0xc01fcb98;
+
+static int (*my_cpcap_regacc_write)(struct cpcap_device *, enum cpcap_reg, unsigned short, unsigned short) =
+ (int (*)(struct cpcap_device *, enum cpcap_reg, unsigned short, unsigned short))0xc01fcc04;
+
+
void activate_emu_uart(void)
{
int i;
u16 tmp = 0;
+ struct device *cpcap = NULL;
+ struct cpcap_device *cpcap_dev;
+
+ printk(KERN_INFO "Searching for cpcap_usb...\n");
+
+ cpcap = device_find_child(&platform_bus, "cpcap_usb", find_ms2_dev);
+ if (cpcap == NULL)
+ return;
+
+ cpcap_dev = cpcap->platform_data;
+ if (cpcap_dev == NULL)
+ return;
- read_cpcap_register_raw(18, &tmp);
+ //read_cpcap_register_raw(18, &tmp);
+ my_cpcap_regacc_read(cpcap_dev, CPCAP_REG_VERSC1, &tmp);
printk(KERN_ALERT "Reading CPCAP vendor_version: 0x%04X\n", tmp);
/*
* Step 1:
* Configure CPCAP to route UART3 to USB port; Switch VBUSIN to supply
* UART/USB transeiver and set VBUS standby mode 3
*/
- write_cpcap_register_raw(897, 0x0101);
- write_cpcap_register_raw(411, 0x014C);
+ //write_cpcap_register_raw(897, 0x0101);
+ //write_cpcap_register_raw(411, 0x014C);
+ my_cpcap_regacc_write(cpcap_dev, CPCAP_REG_USBC2, 0x0101, 0xffff);
+ my_cpcap_regacc_write(cpcap_dev, CPCAP_REG_VUSBC, 0x014c, 0xffff);
/* Step 3:
* Configure OMAP SCM to set ULPI port as UART3 function