示例#1
0
static int smsspi_SetIntLine(void *context)
{
	struct _Msg {
		struct SmsMsgHdr_ST hdr;
		u32 data[3];
	} Msg = {
		{
		MSG_SMS_SPI_INT_LINE_SET_REQ, 0, HIF_TASK,
			    sizeof(struct _Msg), 0}, {
		0, intr_pin, 200}
	};
	struct _smsspi_txmsg msg;

       printk("[cmmbspi]smsspi_SetIntLine\n") ;
	PDEBUG("Sending SPI Set Interrupt command sequence\n");

	msg.buffer = &Msg;
	msg.size = sizeof(Msg);
	msg.alignment = SPI_PACKET_SIZE;
	msg.add_preamble = 1;
	msg.prewrite = NULL;
	msg.postwrite = NULL;	/* smsspiphy_restore_clock; */

	return smsspi_queue_message_and_wait(context, &msg);
//	return 0;
}
示例#2
0
static int smsspi_write(void *context, void *txbuf, size_t len)
{
    struct _smsspi_txmsg msg;

    msg.buffer = txbuf;
    msg.size = len;
    msg.prewrite = NULL;
    msg.postwrite = NULL;

    if (len > 0x1000) {
        /* The FW is the only long message. Do not add preamble,
        and do not padd it */
        msg.alignment = 4;
        msg.add_preamble = 0;
        msg.prewrite = smschipreset;
    } else {
        msg.alignment = SPI_PACKET_SIZE;
        msg.add_preamble = 1;
    }
    //PDEBUG("Writing message to  SPI.\n");
    //PDEBUG("msg hdr: 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x.\n",
    //     ((u8 *) txbuf)[0], ((u8 *) txbuf)[1], ((u8 *) txbuf)[2],
    //   ((u8 *) txbuf)[3], ((u8 *) txbuf)[4], ((u8 *) txbuf)[5],
    // ((u8 *) txbuf)[6], ((u8 *) txbuf)[7]);
    //PDEBUG("0x%x, 0x%x,\n",    ((u8 *) txbuf)[0], ((u8 *) txbuf)[1]);

    return smsspi_queue_message_and_wait(context, &msg);
}
示例#3
0
static int smsspi_preload(void *context)
{
    struct _smsspi_txmsg msg;
    struct _spi_device_st *spi_device = (struct _spi_device_st *) context;

    prepareForFWDnl(spi_device->phy_dev);
    PDEBUG("Sending SPI init sequence\n");
    msg.buffer = smsspi_startup;
    msg.size = sizeof(smsspi_startup);
    msg.alignment = 4;
    msg.add_preamble = 0;
    msg.prewrite = NULL;	/* smsspiphy_reduce_clock; */
    msg.postwrite = NULL;



    printk(KERN_EMERG "smsmdtv: call smsspi_queue_message_and_wait\n") ;
    smsspi_queue_message_and_wait(context, &msg);


    smsspi_SetIntLine(context);

    return 0;

}
示例#4
0
static int smsspi_postload(void *context)
{
    struct _Msg {
        struct SmsMsgHdr_ST hdr;
        u32 data[1];
    } Msg = {
        {
            MSG_SMS_SET_PERIODIC_STATS_REQ, 0, HIF_TASK,
            sizeof(struct _Msg), 0
        }, {
            1
        }
    };
    struct _spi_device_st *spi_device = (struct _spi_device_st *) context;
    struct _smsspi_txmsg msg;

    PDEBUG("Sending Period Statistics Req\n");
//This function just speed up the SPI clock
    fwDnlComplete(spi_device->phy_dev, 0);
    msg.buffer = &Msg;
    msg.size = sizeof(Msg);
    msg.alignment = SPI_PACKET_SIZE;
    msg.add_preamble = 1;
    msg.prewrite = NULL;
    msg.postwrite = NULL;	/* smsspiphy_restore_clock; */

    g_Sms_Int_Counter=0;
    g_Sms_Int_Counter=0;
    smsspi_queue_message_and_wait(context, &msg);

    return 0;
}
示例#5
0
static int smsspi_preload(void *context)
{
	struct _smsspi_txmsg msg;
	struct _spi_device_st *spi_device = (struct _spi_device_st *) context;
	struct _Msg Msg = {
		{
		MSG_SMS_SPI_INT_LINE_SET_REQ, 0, HIF_TASK,
			sizeof(struct _Msg), 0}, {
		0, intr_pin, 0}
	};
	int rc;

	prepareForFWDnl(spi_device->phy_dev);
	PDEBUG("Sending SPI init sequence\n");
	msg.buffer = smsspi_startup;
	msg.size = sizeof(smsspi_startup);
	msg.alignment = 4;
	msg.add_preamble = 0;
	msg.prewrite = NULL;	/* smsspiphy_reduce_clock; */
	msg.postwrite = NULL;   /* smsspiphy_restore_clock; */

	rc = smsspi_queue_message_and_wait(context, &msg);
	if (rc < 0) {
		sms_err("smsspi_queue_message_and_wait error, rc=%d\n", rc);
		return rc;
	}

	sms_debug("sending MSG_SMS_SPI_INT_LINE_SET_REQ, time is now %d",\
		jiffies_to_msecs(jiffies));
	PDEBUG("Sending SPI Set Interrupt command sequence\n");
	msg.buffer = &Msg;
	msg.size = sizeof(Msg);
	msg.alignment = SPI_PACKET_SIZE;
	msg.add_preamble = 1;

	rc = smsspi_queue_message_and_wait(context, &msg);
	if (rc < 0) {
		sms_err("smsspi_queue_message_and_wait error, rc=%d\n", rc);
		return rc;
	}

	return rc;
}