static struct gb_connection *
gb_connection_intf_find(struct gb_interface *intf, u16 cport_id)
{
- struct greybus_host_device *hd = intf->hd;
+ struct gb_host_device *hd = intf->hd;
struct gb_connection *connection;
list_for_each_entry(connection, &hd->connections, hd_links)
}
static struct gb_connection *
-gb_connection_hd_find(struct greybus_host_device *hd, u16 cport_id)
+gb_connection_hd_find(struct gb_host_device *hd, u16 cport_id)
{
struct gb_connection *connection;
unsigned long flags;
* Callback from the host driver to let us know that data has been
* received on the bundle.
*/
-void greybus_data_rcvd(struct greybus_host_device *hd, u16 cport_id,
+void greybus_data_rcvd(struct gb_host_device *hd, u16 cport_id,
u8 *data, size_t length)
{
struct gb_connection *connection;
* pointer otherwise.
*/
struct gb_connection *
-gb_connection_create_range(struct greybus_host_device *hd,
+gb_connection_create_range(struct gb_host_device *hd,
struct gb_bundle *bundle, struct device *parent,
u16 cport_id, u8 protocol_id, u32 ida_start,
u32 ida_end)
static int gb_connection_hd_cport_enable(struct gb_connection *connection)
{
- struct greybus_host_device *hd = connection->hd;
+ struct gb_host_device *hd = connection->hd;
int ret;
if (!hd->driver->cport_enable)
static void gb_connection_hd_cport_disable(struct gb_connection *connection)
{
- struct greybus_host_device *hd = connection->hd;
+ struct gb_host_device *hd = connection->hd;
if (!hd->driver->cport_disable)
return;
static int
gb_connection_svc_connection_create(struct gb_connection *connection)
{
- struct greybus_host_device *hd = connection->hd;
+ struct gb_host_device *hd = connection->hd;
struct gb_protocol *protocol = connection->protocol;
struct gb_interface *intf;
int ret;
void gb_connection_latency_tag_enable(struct gb_connection *connection)
{
- struct greybus_host_device *hd = connection->hd;
+ struct gb_host_device *hd = connection->hd;
int ret;
if (!hd->driver->latency_tag_enable)
void gb_connection_latency_tag_disable(struct gb_connection *connection)
{
- struct greybus_host_device *hd = connection->hd;
+ struct gb_host_device *hd = connection->hd;
int ret;
if (!hd->driver->latency_tag_disable)
};
struct gb_connection {
- struct greybus_host_device *hd;
+ struct gb_host_device *hd;
struct gb_bundle *bundle;
struct kref kref;
u16 hd_cport_id;
struct gb_connection *connection);
struct gb_connection *gb_connection_create(struct gb_bundle *bundle,
u16 cport_id, u8 protocol_id);
-struct gb_connection *gb_connection_create_range(struct greybus_host_device *hd,
+struct gb_connection *gb_connection_create_range(struct gb_host_device *hd,
struct gb_bundle *bundle, struct device *parent,
u16 cport_id, u8 protocol_id, u32 ida_start,
u32 ida_end);
void gb_connection_destroy(struct gb_connection *connection);
-void greybus_data_rcvd(struct greybus_host_device *hd, u16 cport_id,
+void greybus_data_rcvd(struct gb_host_device *hd, u16 cport_id,
u8 *data, size_t length);
int gb_connection_bind_protocol(struct gb_connection *connection);
* - Bit 1: 2nd rib location from top, i.e. between interface 2 and 3.
* - Bit 2: 3rd rib location from top, i.e. between interface 3 and 4.
*/
-static bool validate_front_ribs(struct greybus_host_device *hd,
+static bool validate_front_ribs(struct gb_host_device *hd,
struct endo_layout *layout, bool mini,
u16 endo_id)
{
* its rotational orientation. We define one canonical id to represent a
* particular endo configuration.
*/
-static bool validate_back_ribs(struct greybus_host_device *hd,
+static bool validate_back_ribs(struct gb_host_device *hd,
struct endo_layout *layout, u16 endo_id)
{
u8 max_ribs = layout->max_ribs;
* Validate the endo-id passed from SVC. Error out if its not a valid Endo,
* else return structure representing ribs positions on front and back of Endo.
*/
-static int gb_endo_validate_id(struct greybus_host_device *hd,
+static int gb_endo_validate_id(struct gb_host_device *hd,
struct endo_layout *layout, u16 endo_id)
{
/* Validate Endo Size */
return 0;
}
-static int gb_endo_register(struct greybus_host_device *hd,
+static int gb_endo_register(struct gb_host_device *hd,
struct gb_endo *endo)
{
int dev_id;
return retval;
}
-struct gb_endo *gb_endo_create(struct greybus_host_device *hd, u16 endo_id,
+struct gb_endo *gb_endo_create(struct gb_host_device *hd, u16 endo_id,
u8 ap_intf_id)
{
struct gb_endo *endo;
device_unregister(&endo->dev);
}
-int greybus_endo_setup(struct greybus_host_device *hd, u16 endo_id,
+int greybus_endo_setup(struct gb_host_device *hd, u16 endo_id,
u8 ap_intf_id)
{
struct gb_endo *endo;
#define to_gb_endo(d) container_of(d, struct gb_endo, dev)
/* Greybus "private" definitions */
-struct greybus_host_device;
+struct gb_host_device;
int gb_endo_init(void);
void gb_endo_exit(void);
-struct gb_endo *gb_endo_create(struct greybus_host_device *hd,
+struct gb_endo *gb_endo_create(struct gb_host_device *hd,
u16 endo_id, u8 ap_intf_id);
void gb_endo_remove(struct gb_endo *endo);
-int greybus_endo_setup(struct greybus_host_device *hd, u16 endo_id,
+int greybus_endo_setup(struct gb_host_device *hd, u16 endo_id,
u8 ap_intf_id);
u8 endo_get_module_id(struct gb_endo *endo, u8 interface_id);
* es1_ap_dev - ES1 USB Bridge to AP structure
* @usb_dev: pointer to the USB device we are.
* @usb_intf: pointer to the USB interface we are bound to.
- * @hd: pointer to our greybus_host_device structure
+ * @hd: pointer to our gb_host_device structure
* @cport_in_endpoint: bulk in endpoint for CPort data
* @cport-out_endpoint: bulk out endpoint for CPort data
* @cport_in_urb: array of urbs for the CPort in messages
struct es1_ap_dev {
struct usb_device *usb_dev;
struct usb_interface *usb_intf;
- struct greybus_host_device *hd;
+ struct gb_host_device *hd;
__u8 cport_in_endpoint;
__u8 cport_out_endpoint;
spinlock_t cport_out_urb_lock;
};
-static inline struct es1_ap_dev *hd_to_es1(struct greybus_host_device *hd)
+static inline struct es1_ap_dev *hd_to_es1(struct gb_host_device *hd)
{
return (struct es1_ap_dev *)&hd->hd_priv;
}
* Returns zero if the message was successfully queued, or a negative errno
* otherwise.
*/
-static int message_send(struct greybus_host_device *hd, u16 cport_id,
+static int message_send(struct gb_host_device *hd, u16 cport_id,
struct gb_message *message, gfp_t gfp_mask)
{
struct es1_ap_dev *es1 = hd_to_es1(hd);
*/
static void message_cancel(struct gb_message *message)
{
- struct greybus_host_device *hd = message->operation->connection->hd;
+ struct gb_host_device *hd = message->operation->connection->hd;
struct es1_ap_dev *es1 = hd_to_es1(hd);
struct urb *urb;
int i;
usb_free_urb(urb);
}
-static int latency_tag_enable(struct greybus_host_device *hd, u16 cport_id)
+static int latency_tag_enable(struct gb_host_device *hd, u16 cport_id)
{
int retval;
struct es1_ap_dev *es1 = hd_to_es1(hd);
return retval;
}
-static int latency_tag_disable(struct greybus_host_device *hd, u16 cport_id)
+static int latency_tag_disable(struct gb_host_device *hd, u16 cport_id)
{
int retval;
struct es1_ap_dev *es1 = hd_to_es1(hd);
static void cport_in_callback(struct urb *urb)
{
- struct greybus_host_device *hd = urb->context;
+ struct gb_host_device *hd = urb->context;
struct device *dev = &urb->dev->dev;
struct gb_operation_msg_hdr *header;
int status = check_urb_status(urb);
static void cport_out_callback(struct urb *urb)
{
struct gb_message *message = urb->context;
- struct greybus_host_device *hd = message->operation->connection->hd;
+ struct gb_host_device *hd = message->operation->connection->hd;
struct es1_ap_dev *es1 = hd_to_es1(hd);
int status = check_urb_status(urb);
unsigned long flags;
const struct usb_device_id *id)
{
struct es1_ap_dev *es1;
- struct greybus_host_device *hd;
+ struct gb_host_device *hd;
struct usb_device *udev;
struct usb_host_interface *iface_desc;
struct usb_endpoint_descriptor *endpoint;
* es2_ap_dev - ES2 USB Bridge to AP structure
* @usb_dev: pointer to the USB device we are.
* @usb_intf: pointer to the USB interface we are bound to.
- * @hd: pointer to our greybus_host_device structure
+ * @hd: pointer to our gb_host_device structure
* @cport_in: endpoint, urbs and buffer for cport in messages
* @cport_out: endpoint for for cport out messages
struct es2_ap_dev {
struct usb_device *usb_dev;
struct usb_interface *usb_intf;
- struct greybus_host_device *hd;
+ struct gb_host_device *hd;
struct es2_cport_in cport_in[NUM_BULKS];
struct es2_cport_out cport_out[NUM_BULKS];
__u8 endpoint_out;
};
-static inline struct es2_ap_dev *hd_to_es2(struct greybus_host_device *hd)
+static inline struct es2_ap_dev *hd_to_es2(struct gb_host_device *hd)
{
return (struct es2_ap_dev *)&hd->hd_priv;
}
* Returns zero if the message was successfully queued, or a negative errno
* otherwise.
*/
-static int message_send(struct greybus_host_device *hd, u16 cport_id,
+static int message_send(struct gb_host_device *hd, u16 cport_id,
struct gb_message *message, gfp_t gfp_mask)
{
struct es2_ap_dev *es2 = hd_to_es2(hd);
*/
static void message_cancel(struct gb_message *message)
{
- struct greybus_host_device *hd = message->operation->connection->hd;
+ struct gb_host_device *hd = message->operation->connection->hd;
struct es2_ap_dev *es2 = hd_to_es2(hd);
struct urb *urb;
int i;
usb_free_urb(urb);
}
-static int cport_reset(struct greybus_host_device *hd, u16 cport_id)
+static int cport_reset(struct gb_host_device *hd, u16 cport_id)
{
struct es2_ap_dev *es2 = hd_to_es2(hd);
struct usb_device *udev = es2->usb_dev;
return 0;
}
-static int cport_enable(struct greybus_host_device *hd, u16 cport_id)
+static int cport_enable(struct gb_host_device *hd, u16 cport_id)
{
int retval;
return 0;
}
-static int latency_tag_enable(struct greybus_host_device *hd, u16 cport_id)
+static int latency_tag_enable(struct gb_host_device *hd, u16 cport_id)
{
int retval;
struct es2_ap_dev *es2 = hd_to_es2(hd);
return retval;
}
-static int latency_tag_disable(struct greybus_host_device *hd, u16 cport_id)
+static int latency_tag_disable(struct gb_host_device *hd, u16 cport_id)
{
int retval;
struct es2_ap_dev *es2 = hd_to_es2(hd);
static void cport_in_callback(struct urb *urb)
{
- struct greybus_host_device *hd = urb->context;
+ struct gb_host_device *hd = urb->context;
struct device *dev = &urb->dev->dev;
struct gb_operation_msg_hdr *header;
int status = check_urb_status(urb);
static void cport_out_callback(struct urb *urb)
{
struct gb_message *message = urb->context;
- struct greybus_host_device *hd = message->operation->connection->hd;
+ struct gb_host_device *hd = message->operation->connection->hd;
struct es2_ap_dev *es2 = hd_to_es2(hd);
int status = check_urb_status(urb);
unsigned long flags;
const struct usb_device_id *id)
{
struct es2_ap_dev *es2;
- struct greybus_host_device *hd;
+ struct gb_host_device *hd;
struct usb_device *udev;
struct usb_host_interface *iface_desc;
struct usb_endpoint_descriptor *endpoint;
return dev->type == &greybus_bundle_type;
}
-static inline bool cport_id_valid(struct greybus_host_device *hd, u16 cport_id)
+static inline bool cport_id_valid(struct gb_host_device *hd, u16 cport_id)
{
return cport_id != CPORT_ID_BAD && cport_id < hd->num_cports;
}
#include <linux/tracepoint.h>
struct gb_message;
-struct greybus_host_device;
+struct gb_host_device;
DECLARE_EVENT_CLASS(gb_message,
DECLARE_EVENT_CLASS(gb_host_device,
- TP_PROTO(struct greybus_host_device *hd, u16 intf_cport_id,
+ TP_PROTO(struct gb_host_device *hd, u16 intf_cport_id,
size_t payload_size),
TP_ARGS(hd, intf_cport_id, payload_size),
*/
DEFINE_EVENT(gb_host_device, gb_host_device_send,
- TP_PROTO(struct greybus_host_device *hd, u16 intf_cport_id,
+ TP_PROTO(struct gb_host_device *hd, u16 intf_cport_id,
size_t payload_size),
TP_ARGS(hd, intf_cport_id, payload_size)
*/
DEFINE_EVENT(gb_host_device, gb_host_device_recv,
- TP_PROTO(struct greybus_host_device *hd, u16 intf_cport_id,
+ TP_PROTO(struct gb_host_device *hd, u16 intf_cport_id,
size_t payload_size),
TP_ARGS(hd, intf_cport_id, payload_size)
static void free_hd(struct kref *kref)
{
- struct greybus_host_device *hd;
+ struct gb_host_device *hd;
- hd = container_of(kref, struct greybus_host_device, kref);
+ hd = container_of(kref, struct gb_host_device, kref);
ida_destroy(&hd->cport_id_map);
kfree(hd);
mutex_unlock(&hd_mutex);
}
-struct greybus_host_device *greybus_create_hd(struct greybus_host_driver *driver,
+struct gb_host_device *greybus_create_hd(struct greybus_host_driver *driver,
struct device *parent,
size_t buffer_size_max,
size_t num_cports)
{
- struct greybus_host_device *hd;
+ struct gb_host_device *hd;
/*
* Validate that the driver implements all of the callbacks
}
EXPORT_SYMBOL_GPL(greybus_create_hd);
-void greybus_remove_hd(struct greybus_host_device *hd)
+void greybus_remove_hd(struct gb_host_device *hd)
{
/*
* Tear down all interfaces, modules, and the endo that is associated
#ifndef __HD_H
#define __HD_H
-struct greybus_host_device;
+struct gb_host_device;
struct gb_message;
/* Greybus "Host driver" structure, needed by a host controller driver to be
struct greybus_host_driver {
size_t hd_priv_size;
- int (*cport_enable)(struct greybus_host_device *hd, u16 cport_id);
- int (*cport_disable)(struct greybus_host_device *hd, u16 cport_id);
- int (*message_send)(struct greybus_host_device *hd, u16 dest_cport_id,
+ int (*cport_enable)(struct gb_host_device *hd, u16 cport_id);
+ int (*cport_disable)(struct gb_host_device *hd, u16 cport_id);
+ int (*message_send)(struct gb_host_device *hd, u16 dest_cport_id,
struct gb_message *message, gfp_t gfp_mask);
void (*message_cancel)(struct gb_message *message);
- int (*latency_tag_enable)(struct greybus_host_device *hd, u16 cport_id);
- int (*latency_tag_disable)(struct greybus_host_device *hd,
- u16 cport_id);
+ int (*latency_tag_enable)(struct gb_host_device *hd, u16 cport_id);
+ int (*latency_tag_disable)(struct gb_host_device *hd, u16 cport_id);
};
-struct greybus_host_device {
+struct gb_host_device {
struct kref kref;
struct device *parent;
const struct greybus_host_driver *driver;
unsigned long hd_priv[0] __aligned(sizeof(s64));
};
-struct greybus_host_device *greybus_create_hd(struct greybus_host_driver *hd,
+struct gb_host_device *greybus_create_hd(struct greybus_host_driver *hd,
struct device *parent,
size_t buffer_size_max,
size_t num_cports);
-void greybus_remove_hd(struct greybus_host_device *hd);
+void greybus_remove_hd(struct gb_host_device *hd);
#endif /* __HD_H */
// FIXME, odds are you don't want to call this function, rework the caller to
// not need it please.
-struct gb_interface *gb_interface_find(struct greybus_host_device *hd,
+struct gb_interface *gb_interface_find(struct gb_host_device *hd,
u8 interface_id)
{
struct gb_interface *intf;
* Returns a pointer to the new interfce or a null pointer if a
* failure occurs due to memory exhaustion.
*/
-struct gb_interface *gb_interface_create(struct greybus_host_device *hd,
+struct gb_interface *gb_interface_create(struct gb_host_device *hd,
u8 interface_id)
{
struct gb_module *module;
put_device(&module->dev);
}
-void gb_interfaces_remove(struct greybus_host_device *hd)
+void gb_interfaces_remove(struct gb_host_device *hd)
{
struct gb_interface *intf, *temp;
struct gb_control *control;
struct list_head bundles;
- struct list_head links; /* greybus_host_device->interfaces */
+ struct list_head links; /* gb_host_device->interfaces */
struct list_head manifest_descs;
u8 interface_id; /* Physical location within the Endo */
u8 device_id; /* Device id allocated for the interface block by the SVC */
u32 ara_prod_id;
struct gb_module *module;
- struct greybus_host_device *hd;
+ struct gb_host_device *hd;
/* The interface needs to boot over unipro */
bool boot_over_unipro;
/* Greybus "private" definitions */
-struct gb_interface *gb_interface_find(struct greybus_host_device *hd,
+struct gb_interface *gb_interface_find(struct gb_host_device *hd,
u8 interface_id);
-struct gb_interface *gb_interface_create(struct greybus_host_device *hd,
+struct gb_interface *gb_interface_create(struct gb_host_device *hd,
u8 interface_id);
void gb_interface_destroy(struct gb_interface *intf);
int gb_interface_init(struct gb_interface *intf, u8 device_id);
void gb_interface_remove(struct gb_interface *intf);
-void gb_interfaces_remove(struct greybus_host_device *hd);
+void gb_interfaces_remove(struct gb_host_device *hd);
int gb_create_bundle_connection(struct gb_interface *intf, u8 class);
#endif /* __INTERFACE_H */
* Search the list of modules in the system. If one is found, return it, with
* the reference count incremented.
*/
-struct gb_module *gb_module_find(struct greybus_host_device *hd, u8 module_id)
+struct gb_module *gb_module_find(struct gb_host_device *hd, u8 module_id)
{
struct device *dev;
struct gb_module *module = NULL;
};
#define to_gb_module(d) container_of(d, struct gb_module, dev)
-struct greybus_host_device;
+struct gb_host_device;
/* Greybus "private" definitions */
-struct gb_module *gb_module_find(struct greybus_host_device *hd, u8 module_id);
+struct gb_module *gb_module_find(struct gb_host_device *hd, u8 module_id);
struct gb_module *gb_module_create(struct device *parent, u8 module_id);
void gb_module_remove_all(struct gb_endo *endo);
*/
static void gb_message_cancel(struct gb_message *message)
{
- struct greybus_host_device *hd = message->operation->connection->hd;
+ struct gb_host_device *hd = message->operation->connection->hd;
hd->driver->message_cancel(message);
}
gb_operation_put(operation);
}
-static void gb_operation_message_init(struct greybus_host_device *hd,
+static void gb_operation_message_init(struct gb_host_device *hd,
struct gb_message *message, u16 operation_id,
size_t payload_size, u8 type)
{
* message payload / the message size
*/
static struct gb_message *
-gb_operation_message_alloc(struct greybus_host_device *hd, u8 type,
+gb_operation_message_alloc(struct gb_host_device *hd, u8 type,
size_t payload_size, gfp_t gfp_flags)
{
struct gb_message *message;
bool gb_operation_response_alloc(struct gb_operation *operation,
size_t response_size, gfp_t gfp)
{
- struct greybus_host_device *hd = operation->connection->hd;
+ struct gb_host_device *hd = operation->connection->hd;
struct gb_operation_msg_hdr *request_header;
struct gb_message *response;
u8 type;
size_t request_size, size_t response_size,
unsigned long op_flags, gfp_t gfp_flags)
{
- struct greybus_host_device *hd = connection->hd;
+ struct gb_host_device *hd = connection->hd;
struct gb_operation *operation;
operation = kmem_cache_zalloc(gb_operation_cache, gfp_flags);
size_t gb_operation_get_payload_size_max(struct gb_connection *connection)
{
- struct greybus_host_device *hd = connection->hd;
+ struct gb_host_device *hd = connection->hd;
return hd->buffer_size_max - sizeof(struct gb_operation_msg_hdr);
}
/*
* This function is called when a message send request has completed.
*/
-void greybus_message_sent(struct greybus_host_device *hd,
+void greybus_message_sent(struct gb_host_device *hd,
struct gb_message *message, int status)
{
struct gb_operation *operation = message->operation;
void gb_operation_cancel(struct gb_operation *operation, int errno);
void gb_operation_cancel_incoming(struct gb_operation *operation, int errno);
-void greybus_message_sent(struct greybus_host_device *hd,
+void greybus_message_sent(struct gb_host_device *hd,
struct gb_message *message, int status);
int gb_operation_sync_timeout(struct gb_connection *connection, int type,
* This is a temporary connection, used only at initial bootup.
*/
struct gb_connection *
-gb_ap_svc_connection_create(struct greybus_host_device *hd)
+gb_ap_svc_connection_create(struct gb_host_device *hd)
{
struct gb_connection *connection;
* 'partially' initialized one svc connection.
*/
static struct gb_interface *
-gb_ap_interface_create(struct greybus_host_device *hd,
+gb_ap_interface_create(struct gb_host_device *hd,
struct gb_connection *connection, u8 interface_id)
{
struct gb_interface *intf;
*/
static int gb_svc_read_and_clear_module_boot_status(struct gb_interface *intf)
{
- struct greybus_host_device *hd = intf->hd;
+ struct gb_host_device *hd = intf->hd;
int ret;
u32 value;
static int gb_svc_hello(struct gb_operation *op)
{
struct gb_connection *connection = op->connection;
- struct greybus_host_device *hd = connection->hd;
+ struct gb_host_device *hd = connection->hd;
struct gb_svc_hello_request *hello_request;
struct gb_interface *intf;
u16 endo_id;
static void svc_intf_remove(struct gb_connection *connection,
struct gb_interface *intf)
{
- struct greybus_host_device *hd = connection->hd;
+ struct gb_host_device *hd = connection->hd;
struct gb_svc *svc = connection->private;
u8 intf_id = intf->interface_id;
u8 device_id;
struct gb_svc_intf_hotplug_request *hotplug = &svc_hotplug->data;
struct gb_connection *connection = svc_hotplug->connection;
struct gb_svc *svc = connection->private;
- struct greybus_host_device *hd = connection->hd;
+ struct gb_host_device *hd = connection->hd;
struct gb_interface *intf;
u8 intf_id, device_id;
int ret;
{
struct gb_message *request = op->request;
struct gb_svc_intf_hot_unplug_request *hot_unplug = request->payload;
- struct greybus_host_device *hd = op->connection->hd;
+ struct gb_host_device *hd = op->connection->hd;
struct gb_interface *intf;
u8 intf_id;
int gb_svc_protocol_init(void);
void gb_svc_protocol_exit(void);
-struct gb_connection *
-gb_ap_svc_connection_create(struct greybus_host_device *hd);
+struct gb_connection *gb_ap_svc_connection_create(struct gb_host_device *hd);
+
#endif /* __SVC_H */