size_t buffer_size_max)
{
struct greybus_host_device *hd;
- struct gb_endo *endo;
- u16 endo_id = 0x4755; // FIXME - get endo "ID" from the SVC
- u8 ap_intf_id = 0x01; // FIXME - get AP interface ID from the SVC
/*
* Validate that the driver implements all of the callbacks
ida_init(&hd->cport_id_map);
hd->buffer_size_max = buffer_size_max;
+ return hd;
+}
+EXPORT_SYMBOL_GPL(greybus_create_hd);
+
+int greybus_endo_setup(struct greybus_host_device *hd, u16 endo_id,
+ u8 ap_intf_id)
+{
+ struct gb_endo *endo;
+
endo = gb_endo_create(hd, endo_id, ap_intf_id);
- if (IS_ERR(endo)) {
- greybus_remove_hd(hd);
- return ERR_CAST(endo);
- }
+ if (IS_ERR(endo))
+ return PTR_ERR(endo);
hd->endo = endo;
- return hd;
+ return 0;
}
-EXPORT_SYMBOL_GPL(greybus_create_hd);
+EXPORT_SYMBOL_GPL(greybus_endo_setup);
void greybus_remove_hd(struct greybus_host_device *hd)
{
bool bulk_out_found = false;
int retval = -ENOMEM;
int i;
+ u16 endo_id = 0x4755; // FIXME - get endo "ID" from the SVC
+ u8 ap_intf_id = 0x01; // FIXME - get endo "ID" from the SVC
u8 svc_interval = 0;
udev = usb_get_dev(interface_to_usbdev(interface));
gb_debugfs_get(), es1,
&apb1_log_enable_fops);
+ /*
+ * XXX Soon this will be initiated later, with a combination
+ * XXX of a Control protocol probe operation and a
+ * XXX subsequent Control protocol connected operation for
+ * XXX the SVC connection. At that point we know we're
+ * XXX properly connected to an Endo.
+ */
+ retval = greybus_endo_setup(hd, endo_id, ap_intf_id);
+ if (retval)
+ goto error;
+
return 0;
error:
ap_disconnect(interface);
bool bulk_out_found = false;
int retval = -ENOMEM;
int i;
+ u16 endo_id = 0x4755; // FIXME - get endo "ID" from the SVC
+ u8 ap_intf_id = 0x01; // FIXME - get endo "ID" from the SVC
u8 svc_interval = 0;
udev = usb_get_dev(interface_to_usbdev(interface));
gb_debugfs_get(), es1,
&apb1_log_enable_fops);
+ /*
+ * XXX Soon this will be initiated later, with a combination
+ * XXX of a Control protocol probe operation and a
+ * XXX subsequent Control protocol connected operation for
+ * XXX the SVC connection. At that point we know we're
+ * XXX properly connected to an Endo.
+ */
+ retval = greybus_endo_setup(hd, endo_id, ap_intf_id);
+ if (retval)
+ goto error;
+
return 0;
error:
ap_disconnect(interface);
struct greybus_host_device *greybus_create_hd(struct greybus_host_driver *hd,
struct device *parent,
size_t buffer_size_max);
+int greybus_endo_setup(struct greybus_host_device *hd, u16 endo_id,
+ u8 ap_intf_id);
void greybus_remove_hd(struct greybus_host_device *hd);
struct greybus_driver {