qcacmn: Add USB bus support (HIF Dispatcher)
Add module specific changes for USB bus support. Change-Id: If1f7d16a733d5d98cba982e3a5e7936356c57d8a CRs-Fixed: 1023663
This commit is contained in:

committed by
Vishwajith Upendra

parent
91c8529516
commit
1957ba9385
@@ -284,3 +284,27 @@ void hif_dummy_display_stats(struct hif_softc *hif_ctx)
|
|||||||
*/
|
*/
|
||||||
void hif_dummy_clear_stats(struct hif_softc *hif_ctx)
|
void hif_dummy_clear_stats(struct hif_softc *hif_ctx)
|
||||||
{}
|
{}
|
||||||
|
/**
|
||||||
|
* hif_dummy_set_bundle_mode() - dummy call
|
||||||
|
* @hif_sc: hif context
|
||||||
|
* @enabled: flag to enable/disable bundling
|
||||||
|
* @rx_bundle_cnt: bundle count to be used for RX
|
||||||
|
*
|
||||||
|
* Return: none
|
||||||
|
*/
|
||||||
|
void hif_dummy_set_bundle_mode(struct hif_softc *hif_ctx,
|
||||||
|
bool enabled, int rx_bundle_cnt)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hif_dummy_bus_reset_resume() - dummy call
|
||||||
|
* @hif_sc: hif context
|
||||||
|
*
|
||||||
|
* Return: int 0 for success, non zero for failure
|
||||||
|
*/
|
||||||
|
int hif_dummy_bus_reset_resume(struct hif_softc *hif_ctx)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@@ -55,3 +55,7 @@ void hif_dummy_ipa_get_ce_resource(struct hif_softc *hif_sc,
|
|||||||
void hif_dummy_mask_interrupt_call(struct hif_softc *hif_sc);
|
void hif_dummy_mask_interrupt_call(struct hif_softc *hif_sc);
|
||||||
void hif_dummy_display_stats(struct hif_softc *hif_ctx);
|
void hif_dummy_display_stats(struct hif_softc *hif_ctx);
|
||||||
void hif_dummy_clear_stats(struct hif_softc *hif_ctx);
|
void hif_dummy_clear_stats(struct hif_softc *hif_ctx);
|
||||||
|
void hif_dummy_set_bundle_mode(struct hif_softc *hif_ctx,
|
||||||
|
bool enabled, int rx_bundle_cnt);
|
||||||
|
int hif_dummy_bus_reset_resume(struct hif_softc *hif_ctx);
|
||||||
|
|
||||||
|
@@ -31,6 +31,7 @@
|
|||||||
#include "hif.h"
|
#include "hif.h"
|
||||||
#include "hif_main.h"
|
#include "hif_main.h"
|
||||||
#include "multibus.h"
|
#include "multibus.h"
|
||||||
|
#include "dummy.h"
|
||||||
#if defined(HIF_PCI) || defined(HIF_SNOC) || defined(HIF_AHB)
|
#if defined(HIF_PCI) || defined(HIF_SNOC) || defined(HIF_AHB)
|
||||||
#include "ce_main.h"
|
#include "ce_main.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -49,12 +50,13 @@ static void hif_intialize_default_ops(struct hif_softc *hif_sc)
|
|||||||
|
|
||||||
/* must be filled in by hif_bus_open */
|
/* must be filled in by hif_bus_open */
|
||||||
bus_ops->hif_bus_close = NULL;
|
bus_ops->hif_bus_close = NULL;
|
||||||
|
|
||||||
/* dummy implementations */
|
/* dummy implementations */
|
||||||
bus_ops->hif_display_stats =
|
bus_ops->hif_display_stats =
|
||||||
&hif_dummy_display_stats;
|
&hif_dummy_display_stats;
|
||||||
bus_ops->hif_clear_stats =
|
bus_ops->hif_clear_stats =
|
||||||
&hif_dummy_clear_stats;
|
&hif_dummy_clear_stats;
|
||||||
|
bus_ops->hif_set_bundle_mode = hif_dummy_set_bundle_mode;
|
||||||
|
bus_ops->hif_bus_reset_resume = hif_dummy_bus_reset_resume;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define NUM_OPS (sizeof(struct hif_bus_ops) / sizeof(void *))
|
#define NUM_OPS (sizeof(struct hif_bus_ops) / sizeof(void *))
|
||||||
@@ -100,6 +102,8 @@ int hif_bus_get_context_size(enum qdf_bus_type bus_type)
|
|||||||
return hif_snoc_get_context_size();
|
return hif_snoc_get_context_size();
|
||||||
case QDF_BUS_TYPE_SDIO:
|
case QDF_BUS_TYPE_SDIO:
|
||||||
return hif_sdio_get_context_size();
|
return hif_sdio_get_context_size();
|
||||||
|
case QDF_BUS_TYPE_USB:
|
||||||
|
return hif_usb_get_context_size();
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -131,6 +135,8 @@ QDF_STATUS hif_bus_open(struct hif_softc *hif_sc,
|
|||||||
break;
|
break;
|
||||||
case QDF_BUS_TYPE_SDIO:
|
case QDF_BUS_TYPE_SDIO:
|
||||||
status = hif_initialize_sdio_ops(hif_sc);
|
status = hif_initialize_sdio_ops(hif_sc);
|
||||||
|
case QDF_BUS_TYPE_USB:
|
||||||
|
status = hif_initialize_usb_ops(&hif_sc->bus_ops);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
status = QDF_STATUS_E_NOSUPPORT;
|
status = QDF_STATUS_E_NOSUPPORT;
|
||||||
@@ -347,3 +353,34 @@ void hif_disable_power_management(struct hif_opaque_softc *hif_hdl)
|
|||||||
hif_sc->bus_ops.hif_disable_power_management(hif_sc);
|
hif_sc->bus_ops.hif_disable_power_management(hif_sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hif_set_bundle_mode() - enable bundling and set default rx bundle cnt
|
||||||
|
* @scn: pointer to hif_opaque_softc structure
|
||||||
|
* @enabled: flag to enable/disable bundling
|
||||||
|
* @rx_bundle_cnt: bundle count to be used for RX
|
||||||
|
*
|
||||||
|
* Return: none
|
||||||
|
*/
|
||||||
|
void hif_set_bundle_mode(struct hif_opaque_softc *scn, bool enabled,
|
||||||
|
int rx_bundle_cnt)
|
||||||
|
{
|
||||||
|
struct hif_softc *hif_sc = HIF_GET_SOFTC(scn);
|
||||||
|
hif_sc->bus_ops.hif_set_bundle_mode(hif_sc, enabled, rx_bundle_cnt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hif_bus_reset_resume() - resume the bus after reset
|
||||||
|
* @scn: struct hif_opaque_softc
|
||||||
|
*
|
||||||
|
* This function is called to tell the driver that USB device has been resumed
|
||||||
|
* and it has also been reset. The driver should redo any necessary
|
||||||
|
* initialization. This function resets WLAN SOC.
|
||||||
|
*
|
||||||
|
* Return: int 0 for success, non zero for failure
|
||||||
|
*/
|
||||||
|
int hif_bus_reset_resume(struct hif_opaque_softc *scn)
|
||||||
|
|
||||||
|
{
|
||||||
|
struct hif_softc *hif_sc = HIF_GET_SOFTC(scn);
|
||||||
|
return hif_sc->bus_ops.hif_bus_reset_resume(hif_sc);
|
||||||
|
}
|
||||||
|
@@ -74,6 +74,9 @@ struct hif_bus_ops {
|
|||||||
void (*hif_disable_power_management)(struct hif_softc *hif_ctx);
|
void (*hif_disable_power_management)(struct hif_softc *hif_ctx);
|
||||||
void (*hif_display_stats)(struct hif_softc *hif_ctx);
|
void (*hif_display_stats)(struct hif_softc *hif_ctx);
|
||||||
void (*hif_clear_stats)(struct hif_softc *hif_ctx);
|
void (*hif_clear_stats)(struct hif_softc *hif_ctx);
|
||||||
|
void (*hif_set_bundle_mode) (struct hif_softc *hif_ctx, bool enabled,
|
||||||
|
int rx_bundle_cnt);
|
||||||
|
int (*hif_bus_reset_resume)(struct hif_softc *hif_ctx);
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef HIF_SNOC
|
#ifdef HIF_SNOC
|
||||||
@@ -169,4 +172,23 @@ static inline int hif_sdio_get_context_size(void)
|
|||||||
}
|
}
|
||||||
#endif /* HIF_SDIO */
|
#endif /* HIF_SDIO */
|
||||||
|
|
||||||
|
#ifdef HIF_USB
|
||||||
|
QDF_STATUS hif_initialize_usb_ops(struct hif_bus_ops *bus_ops);
|
||||||
|
int hif_usb_get_context_size(void);
|
||||||
|
#else
|
||||||
|
static inline QDF_STATUS hif_initialize_usb_ops(struct hif_bus_ops *bus_ops)
|
||||||
|
{
|
||||||
|
HIF_ERROR("%s: not supported", __func__);
|
||||||
|
return QDF_STATUS_E_NOSUPPORT;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* hif_usb_get_context_size() - dummy when usb isn't supported
|
||||||
|
*
|
||||||
|
* Return: 0 as an invalid size to indicate no support
|
||||||
|
*/
|
||||||
|
static inline int hif_usb_get_context_size(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif /* HIF_USB */
|
||||||
#endif /* _MULTIBUS_H_ */
|
#endif /* _MULTIBUS_H_ */
|
||||||
|
79
hif/src/dispatcher/multibus_usb.c
Normal file
79
hif/src/dispatcher/multibus_usb.c
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016 The Linux Foundation. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and/or distribute this software for
|
||||||
|
* any purpose with or without fee is hereby granted, provided that the
|
||||||
|
* above copyright notice and this permission notice appear in all
|
||||||
|
* copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||||
|
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
||||||
|
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||||
|
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||||
|
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
* PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "hif.h"
|
||||||
|
#include "hif_main.h"
|
||||||
|
#include "multibus.h"
|
||||||
|
#include "usb_api.h"
|
||||||
|
#include "hif_io32.h"
|
||||||
|
#include "dummy.h"
|
||||||
|
#include "if_usb.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hif_initialize_usb_ops() - initialize the usb ops
|
||||||
|
* @bus_ops: hif_bus_ops table pointer to initialize
|
||||||
|
*
|
||||||
|
* Return: QDF_STATUS_SUCCESS
|
||||||
|
*/
|
||||||
|
QDF_STATUS hif_initialize_usb_ops(struct hif_bus_ops *bus_ops)
|
||||||
|
{
|
||||||
|
bus_ops->hif_bus_open = &hif_usb_open;
|
||||||
|
bus_ops->hif_bus_close = &hif_usb_close;
|
||||||
|
bus_ops->hif_bus_prevent_linkdown = &hif_dummy_bus_prevent_linkdown;
|
||||||
|
bus_ops->hif_reset_soc = &hif_dummy_reset_soc;
|
||||||
|
bus_ops->hif_bus_suspend = &hif_usb_bus_suspend;
|
||||||
|
bus_ops->hif_bus_resume = &hif_usb_bus_resume;
|
||||||
|
bus_ops->hif_target_sleep_state_adjust =
|
||||||
|
&hif_dummy_target_sleep_state_adjust;
|
||||||
|
bus_ops->hif_disable_isr = &hif_usb_disable_isr;
|
||||||
|
bus_ops->hif_nointrs = &hif_usb_nointrs;
|
||||||
|
bus_ops->hif_enable_bus = &hif_usb_enable_bus;
|
||||||
|
bus_ops->hif_disable_bus = &hif_usb_disable_bus;
|
||||||
|
bus_ops->hif_bus_configure = &hif_usb_bus_configure;
|
||||||
|
bus_ops->hif_get_config_item = &hif_dummy_get_config_item;
|
||||||
|
bus_ops->hif_set_mailbox_swap = &hif_dummy_set_mailbox_swap;
|
||||||
|
bus_ops->hif_claim_device = &hif_dummy_claim_device;
|
||||||
|
bus_ops->hif_shutdown_device = &hif_usb_shutdown_bus_device;
|
||||||
|
bus_ops->hif_stop = &hif_usb_stop_device;
|
||||||
|
bus_ops->hif_bus_pkt_dl_len_set = &hif_dummy_bus_pkt_dl_len_set;
|
||||||
|
bus_ops->hif_cancel_deferred_target_sleep =
|
||||||
|
&hif_dummy_cancel_deferred_target_sleep;
|
||||||
|
bus_ops->hif_irq_disable = &hif_usb_irq_disable;
|
||||||
|
bus_ops->hif_irq_enable = &hif_usb_irq_enable;
|
||||||
|
bus_ops->hif_dump_registers = &hif_dummy_dump_registers;
|
||||||
|
bus_ops->hif_dump_target_memory = &hif_dummy_dump_target_memory;
|
||||||
|
bus_ops->hif_ipa_get_ce_resource = &hif_dummy_ipa_get_ce_resource;
|
||||||
|
bus_ops->hif_enable_power_management =
|
||||||
|
&hif_dummy_enable_power_management;
|
||||||
|
bus_ops->hif_disable_power_management =
|
||||||
|
&hif_dummy_disable_power_management;
|
||||||
|
bus_ops->hif_set_bundle_mode = hif_usb_set_bundle_mode;
|
||||||
|
bus_ops->hif_bus_reset_resume = hif_usb_bus_reset_resume;
|
||||||
|
|
||||||
|
return QDF_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hif_usb_get_context_size() - return the size of the usb context
|
||||||
|
*
|
||||||
|
* Return the size of the context. (0 for invalid bus)
|
||||||
|
*/
|
||||||
|
int hif_usb_get_context_size(void)
|
||||||
|
{
|
||||||
|
return sizeof(struct hif_usb_softc);
|
||||||
|
}
|
@@ -24,7 +24,8 @@
|
|||||||
* under proprietary terms before Copyright ownership was assigned
|
* under proprietary terms before Copyright ownership was assigned
|
||||||
* to the Linux Foundation.
|
* to the Linux Foundation.
|
||||||
*/
|
*/
|
||||||
|
#ifndef _PCI_API_H_
|
||||||
|
#define _PCI_API_H_
|
||||||
QDF_STATUS hif_pci_open(struct hif_softc *hif_ctx,
|
QDF_STATUS hif_pci_open(struct hif_softc *hif_ctx,
|
||||||
enum qdf_bus_type bus_type);
|
enum qdf_bus_type bus_type);
|
||||||
void hif_pci_close(struct hif_softc *hif_ctx);
|
void hif_pci_close(struct hif_softc *hif_ctx);
|
||||||
@@ -51,3 +52,4 @@ void hif_pci_enable_power_management(struct hif_softc *hif_ctx,
|
|||||||
void hif_pci_disable_power_management(struct hif_softc *hif_ctx);
|
void hif_pci_disable_power_management(struct hif_softc *hif_ctx);
|
||||||
void hif_pci_display_stats(struct hif_softc *hif_ctx);
|
void hif_pci_display_stats(struct hif_softc *hif_ctx);
|
||||||
void hif_pci_clear_stats(struct hif_softc *hif_ctx);
|
void hif_pci_clear_stats(struct hif_softc *hif_ctx);
|
||||||
|
#endif /* _PCI_API_H_ */
|
||||||
|
@@ -25,6 +25,8 @@
|
|||||||
* to the Linux Foundation.
|
* to the Linux Foundation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef _SNOC_API_H_
|
||||||
|
#define _SNOC_API_H_
|
||||||
QDF_STATUS hif_snoc_open(struct hif_softc *hif_ctx,
|
QDF_STATUS hif_snoc_open(struct hif_softc *hif_ctx,
|
||||||
enum qdf_bus_type bus_type);
|
enum qdf_bus_type bus_type);
|
||||||
void hif_snoc_close(struct hif_softc *hif_ctx);
|
void hif_snoc_close(struct hif_softc *hif_ctx);
|
||||||
@@ -43,3 +45,4 @@ void hif_snoc_irq_enable(struct hif_softc *scn, int ce_id);
|
|||||||
int hif_snoc_dump_registers(struct hif_softc *scn);
|
int hif_snoc_dump_registers(struct hif_softc *scn);
|
||||||
void hif_snoc_display_stats(struct hif_softc *hif_ctx);
|
void hif_snoc_display_stats(struct hif_softc *hif_ctx);
|
||||||
void hif_snoc_clear_stats(struct hif_softc *hif_ctx);
|
void hif_snoc_clear_stats(struct hif_softc *hif_ctx);
|
||||||
|
#endif /* _SNOC_API_H_ */
|
||||||
|
44
hif/src/dispatcher/usb_api.h
Normal file
44
hif/src/dispatcher/usb_api.h
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016 The Linux Foundation. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and/or distribute this software for
|
||||||
|
* any purpose with or without fee is hereby granted, provided that the
|
||||||
|
* above copyright notice and this permission notice appear in all
|
||||||
|
* copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||||
|
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
||||||
|
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||||
|
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||||
|
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
* PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
#ifndef _USB_API_H_
|
||||||
|
#define _USB_API_H_
|
||||||
|
|
||||||
|
QDF_STATUS hif_usb_open(struct hif_softc *hif_ctx,
|
||||||
|
enum qdf_bus_type bus_type);
|
||||||
|
void hif_usb_close(struct hif_softc *hif_ctx);
|
||||||
|
|
||||||
|
|
||||||
|
void hif_usb_disable_isr(struct hif_softc *hif_ctx);
|
||||||
|
void hif_usb_nointrs(struct hif_softc *scn);
|
||||||
|
QDF_STATUS hif_usb_enable_bus(struct hif_softc *ol_sc,
|
||||||
|
struct device *dev, void *bdev,
|
||||||
|
const hif_bus_id *bid,
|
||||||
|
enum hif_enable_type type);
|
||||||
|
void hif_usb_disable_bus(struct hif_softc *scn);
|
||||||
|
int hif_usb_bus_configure(struct hif_softc *scn);
|
||||||
|
void hif_usb_irq_disable(struct hif_softc *scn, int ce_id);
|
||||||
|
void hif_usb_irq_enable(struct hif_softc *scn, int ce_id);
|
||||||
|
int hif_usb_dump_registers(struct hif_softc *scn);
|
||||||
|
int hif_usb_bus_suspend(struct hif_softc *hif_ctx);
|
||||||
|
int hif_usb_bus_resume(struct hif_softc *hif_ctx);
|
||||||
|
void hif_usb_stop_device(struct hif_softc *hif_sc);
|
||||||
|
void hif_usb_shutdown_bus_device(struct hif_softc *scn);
|
||||||
|
int hif_usb_bus_reset_resume(struct hif_softc *hif_ctx);
|
||||||
|
void hif_usb_set_bundle_mode(struct hif_opaque_softc *scn,
|
||||||
|
bool enabled, int rx_bundle_cnt);
|
||||||
|
#endif /*_USB_API_H_*/
|
Reference in New Issue
Block a user