Commit e54b106d authored by Sandeep Patil's avatar Sandeep Patil Committed by Greg Kroah-Hartman

greybus: gpbridge: rename 'gpbridge' to 'gbphy' everywhere

The 'gpbridge' name didn't relaly reflect what the bus is; which
is a bus for bridged-phy devices. So, rename all instances
of 'gpbridge' to more appropriate 'gbphy'

Testing Done:
Build and boot tested. 'lsgb' will stop displaying 'GPBridge' devices
until I change the library to reflect this change.
Signed-off-by: default avatarSandeep Patil <patil_sandeep@projectara.com>
Suggested-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent e16715c1
...@@ -14,7 +14,7 @@ greybus-y := core.o \ ...@@ -14,7 +14,7 @@ greybus-y := core.o \
operation.o \ operation.o \
legacy.o legacy.o
gb-gpbridge-y := gpbridge.o gb-gbphy-y := gbphy.o
# Prefix all modules with gb- # Prefix all modules with gb-
gb-vibrator-y := vibrator.o gb-vibrator-y := vibrator.o
...@@ -43,7 +43,7 @@ gb-usb-y := usb.o ...@@ -43,7 +43,7 @@ gb-usb-y := usb.o
gb-spi-y := spi.o gb-spi-y := spi.o
obj-m += greybus.o obj-m += greybus.o
obj-m += gb-gpbridge.o obj-m += gb-gbphy.o
obj-m += gb-vibrator.o obj-m += gb-vibrator.o
obj-m += gb-power-supply.o obj-m += gb-power-supply.o
obj-m += gb-loopback.o obj-m += gb-loopback.o
......
/* /*
* Greybus GP Bridge driver * Greybus Bridged-Phy Bus driver
* *
* Copyright 2014 Google Inc. * Copyright 2014 Google Inc.
* Copyright 2014 Linaro Ltd. * Copyright 2014 Linaro Ltd.
...@@ -17,49 +17,49 @@ ...@@ -17,49 +17,49 @@
#include <linux/device.h> #include <linux/device.h>
#include "greybus.h" #include "greybus.h"
#include "gpbridge.h" #include "gbphy.h"
struct gpbridge_host { struct gbphy_host {
struct gb_bundle *bundle; struct gb_bundle *bundle;
struct list_head devices; struct list_head devices;
}; };
static DEFINE_IDA(gpbridge_id); static DEFINE_IDA(gbphy_id);
static ssize_t protocol_id_show(struct device *dev, static ssize_t protocol_id_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct gpbridge_device *gpbdev = to_gpbridge_dev(dev); struct gbphy_device *gbphy_dev = to_gbphy_dev(dev);
return sprintf(buf, "0x%02x\n", gpbdev->cport_desc->protocol_id); return sprintf(buf, "0x%02x\n", gbphy_dev->cport_desc->protocol_id);
} }
static DEVICE_ATTR_RO(protocol_id); static DEVICE_ATTR_RO(protocol_id);
static struct attribute *gpbdev_attrs[] = { static struct attribute *gbphy_dev_attrs[] = {
&dev_attr_protocol_id.attr, &dev_attr_protocol_id.attr,
NULL, NULL,
}; };
ATTRIBUTE_GROUPS(gpbdev); ATTRIBUTE_GROUPS(gbphy_dev);
static void gpbdev_release(struct device *dev) static void gbphy_dev_release(struct device *dev)
{ {
struct gpbridge_device *gpbdev = to_gpbridge_dev(dev); struct gbphy_device *gbphy_dev = to_gbphy_dev(dev);
ida_simple_remove(&gpbridge_id, gpbdev->id); ida_simple_remove(&gbphy_id, gbphy_dev->id);
kfree(gpbdev); kfree(gbphy_dev);
} }
static struct device_type greybus_gpbdev_type = { static struct device_type greybus_gbphy_dev_type = {
.name = "gpbridge_device", .name = "gbphy_device",
.release = gpbdev_release, .release = gbphy_dev_release,
}; };
static int gpbdev_uevent(struct device *dev, struct kobj_uevent_env *env) static int gbphy_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
{ {
struct gpbridge_device *gpbdev = to_gpbridge_dev(dev); struct gbphy_device *gbphy_dev = to_gbphy_dev(dev);
struct greybus_descriptor_cport *cport_desc = gpbdev->cport_desc; struct greybus_descriptor_cport *cport_desc = gbphy_dev->cport_desc;
struct gb_bundle *bundle = gpbdev->bundle; struct gb_bundle *bundle = gbphy_dev->bundle;
struct gb_interface *intf = bundle->intf; struct gb_interface *intf = bundle->intf;
struct gb_module *module = intf->module; struct gb_module *module = intf->module;
struct gb_host_device *hd = intf->hd; struct gb_host_device *hd = intf->hd;
...@@ -73,11 +73,11 @@ static int gpbdev_uevent(struct device *dev, struct kobj_uevent_env *env) ...@@ -73,11 +73,11 @@ static int gpbdev_uevent(struct device *dev, struct kobj_uevent_env *env)
if (add_uevent_var(env, "GREYBUS_ID=%08x/%08x", if (add_uevent_var(env, "GREYBUS_ID=%08x/%08x",
intf->vendor_id, intf->product_id)) intf->vendor_id, intf->product_id))
return -ENOMEM; return -ENOMEM;
if (add_uevent_var(env, "BUNDLE=%u", gpbdev->bundle->id)) if (add_uevent_var(env, "BUNDLE=%u", gbphy_dev->bundle->id))
return -ENOMEM; return -ENOMEM;
if (add_uevent_var(env, "BUNDLE_CLASS=%02x", bundle->class)) if (add_uevent_var(env, "BUNDLE_CLASS=%02x", bundle->class))
return -ENOMEM; return -ENOMEM;
if (add_uevent_var(env, "GPBDEV_ID=%u", gpbdev->id)) if (add_uevent_var(env, "GBPHY=%u", gbphy_dev->id))
return -ENOMEM; return -ENOMEM;
if (add_uevent_var(env, "PROTOCOL_ID=%02x", cport_desc->protocol_id)) if (add_uevent_var(env, "PROTOCOL_ID=%02x", cport_desc->protocol_id))
return -ENOMEM; return -ENOMEM;
...@@ -85,65 +85,65 @@ static int gpbdev_uevent(struct device *dev, struct kobj_uevent_env *env) ...@@ -85,65 +85,65 @@ static int gpbdev_uevent(struct device *dev, struct kobj_uevent_env *env)
return 0; return 0;
} }
static const struct gpbridge_device_id * static const struct gbphy_device_id *
gpbdev_match_id(struct gpbridge_device *gpbdev, struct gpbridge_driver *gpbdrv) gbphy_dev_match_id(struct gbphy_device *gbphy_dev, struct gbphy_driver *gbphy_drv)
{ {
const struct gpbridge_device_id *id = gpbdrv->id_table; const struct gbphy_device_id *id = gbphy_drv->id_table;
if (!id) if (!id)
return NULL; return NULL;
for (; id->protocol_id; id++) for (; id->protocol_id; id++)
if (id->protocol_id == gpbdev->cport_desc->protocol_id) if (id->protocol_id == gbphy_dev->cport_desc->protocol_id)
return id; return id;
return NULL; return NULL;
} }
static int gpbdev_match(struct device *dev, struct device_driver *drv) static int gbphy_dev_match(struct device *dev, struct device_driver *drv)
{ {
struct gpbridge_driver *gpbdrv = to_gpbridge_driver(drv); struct gbphy_driver *gbphy_drv = to_gbphy_driver(drv);
struct gpbridge_device *gpbdev = to_gpbridge_dev(dev); struct gbphy_device *gbphy_dev = to_gbphy_dev(dev);
const struct gpbridge_device_id *id; const struct gbphy_device_id *id;
id = gpbdev_match_id(gpbdev, gpbdrv); id = gbphy_dev_match_id(gbphy_dev, gbphy_drv);
if (id) if (id)
return 1; return 1;
return 0; return 0;
} }
static int gpbdev_probe(struct device *dev) static int gbphy_dev_probe(struct device *dev)
{ {
struct gpbridge_driver *gpbdrv = to_gpbridge_driver(dev->driver); struct gbphy_driver *gbphy_drv = to_gbphy_driver(dev->driver);
struct gpbridge_device *gpbdev = to_gpbridge_dev(dev); struct gbphy_device *gbphy_dev = to_gbphy_dev(dev);
const struct gpbridge_device_id *id; const struct gbphy_device_id *id;
id = gpbdev_match_id(gpbdev, gpbdrv); id = gbphy_dev_match_id(gbphy_dev, gbphy_drv);
if (!id) if (!id)
return -ENODEV; return -ENODEV;
return gpbdrv->probe(gpbdev, id); return gbphy_drv->probe(gbphy_dev, id);
} }
static int gpbdev_remove(struct device *dev) static int gbphy_dev_remove(struct device *dev)
{ {
struct gpbridge_driver *gpbdrv = to_gpbridge_driver(dev->driver); struct gbphy_driver *gbphy_drv = to_gbphy_driver(dev->driver);
struct gpbridge_device *gpbdev = to_gpbridge_dev(dev); struct gbphy_device *gbphy_dev = to_gbphy_dev(dev);
gpbdrv->remove(gpbdev); gbphy_drv->remove(gbphy_dev);
return 0; return 0;
} }
static struct bus_type gpbridge_bus_type = { static struct bus_type gbphy_bus_type = {
.name = "gpbridge", .name = "gbphy",
.match = gpbdev_match, .match = gbphy_dev_match,
.probe = gpbdev_probe, .probe = gbphy_dev_probe,
.remove = gpbdev_remove, .remove = gbphy_dev_remove,
.uevent = gpbdev_uevent, .uevent = gbphy_dev_uevent,
}; };
int gb_gpbridge_register_driver(struct gpbridge_driver *driver, int gb_gbphy_register_driver(struct gbphy_driver *driver,
struct module *owner, const char *mod_name) struct module *owner, const char *mod_name)
{ {
int retval; int retval;
...@@ -151,7 +151,7 @@ int gb_gpbridge_register_driver(struct gpbridge_driver *driver, ...@@ -151,7 +151,7 @@ int gb_gpbridge_register_driver(struct gpbridge_driver *driver,
if (greybus_disabled()) if (greybus_disabled())
return -ENODEV; return -ENODEV;
driver->driver.bus = &gpbridge_bus_type; driver->driver.bus = &gbphy_bus_type;
driver->driver.name = driver->name; driver->driver.name = driver->name;
driver->driver.owner = owner; driver->driver.owner = owner;
driver->driver.mod_name = mod_name; driver->driver.mod_name = mod_name;
...@@ -163,15 +163,15 @@ int gb_gpbridge_register_driver(struct gpbridge_driver *driver, ...@@ -163,15 +163,15 @@ int gb_gpbridge_register_driver(struct gpbridge_driver *driver,
pr_info("registered new driver %s\n", driver->name); pr_info("registered new driver %s\n", driver->name);
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(gb_gpbridge_register_driver); EXPORT_SYMBOL_GPL(gb_gbphy_register_driver);
void gb_gpbridge_deregister_driver(struct gpbridge_driver *driver) void gb_gbphy_deregister_driver(struct gbphy_driver *driver)
{ {
driver_unregister(&driver->driver); driver_unregister(&driver->driver);
} }
EXPORT_SYMBOL_GPL(gb_gpbridge_deregister_driver); EXPORT_SYMBOL_GPL(gb_gbphy_deregister_driver);
int gb_gpbridge_get_version(struct gb_connection *connection) int gb_gbphy_get_version(struct gb_connection *connection)
{ {
struct gb_protocol_version_request request; struct gb_protocol_version_request request;
struct gb_protocol_version_response response; struct gb_protocol_version_response response;
...@@ -196,135 +196,135 @@ int gb_gpbridge_get_version(struct gb_connection *connection) ...@@ -196,135 +196,135 @@ int gb_gpbridge_get_version(struct gb_connection *connection)
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(gb_gpbridge_get_version); EXPORT_SYMBOL_GPL(gb_gbphy_get_version);
static struct gpbridge_device *gb_gpbridge_create_dev(struct gb_bundle *bundle, static struct gbphy_device *gb_gbphy_create_dev(struct gb_bundle *bundle,
struct greybus_descriptor_cport *cport_desc) struct greybus_descriptor_cport *cport_desc)
{ {
struct gpbridge_device *gpbdev; struct gbphy_device *gbphy_dev;
int retval; int retval;
int id; int id;
id = ida_simple_get(&gpbridge_id, 1, 0, GFP_KERNEL); id = ida_simple_get(&gbphy_id, 1, 0, GFP_KERNEL);
if (id < 0) if (id < 0)
return ERR_PTR(id); return ERR_PTR(id);
gpbdev = kzalloc(sizeof(*gpbdev), GFP_KERNEL); gbphy_dev = kzalloc(sizeof(*gbphy_dev), GFP_KERNEL);
if (!gpbdev) { if (!gbphy_dev) {
ida_simple_remove(&gpbridge_id, id); ida_simple_remove(&gbphy_id, id);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
} }
gpbdev->id = id; gbphy_dev->id = id;
gpbdev->bundle = bundle; gbphy_dev->bundle = bundle;
gpbdev->cport_desc = cport_desc; gbphy_dev->cport_desc = cport_desc;
gpbdev->dev.parent = &bundle->dev; gbphy_dev->dev.parent = &bundle->dev;
gpbdev->dev.bus = &gpbridge_bus_type; gbphy_dev->dev.bus = &gbphy_bus_type;
gpbdev->dev.type = &greybus_gpbdev_type; gbphy_dev->dev.type = &greybus_gbphy_dev_type;
gpbdev->dev.groups = gpbdev_groups; gbphy_dev->dev.groups = gbphy_dev_groups;
gpbdev->dev.dma_mask = bundle->dev.dma_mask; gbphy_dev->dev.dma_mask = bundle->dev.dma_mask;
dev_set_name(&gpbdev->dev, "gpb%d", id); dev_set_name(&gbphy_dev->dev, "gbphy%d", id);
retval = device_register(&gpbdev->dev); retval = device_register(&gbphy_dev->dev);
if (retval) { if (retval) {
put_device(&gpbdev->dev); put_device(&gbphy_dev->dev);
return ERR_PTR(retval); return ERR_PTR(retval);
} }
return gpbdev; return gbphy_dev;
} }
static void gb_gpbridge_disconnect(struct gb_bundle *bundle) static void gb_gbphy_disconnect(struct gb_bundle *bundle)
{ {
struct gpbridge_host *gpb_host = greybus_get_drvdata(bundle); struct gbphy_host *gbphy_host = greybus_get_drvdata(bundle);
struct gpbridge_device *gpbdev, *temp; struct gbphy_device *gbphy_dev, *temp;
list_for_each_entry_safe(gpbdev, temp, &gpb_host->devices, list) { list_for_each_entry_safe(gbphy_dev, temp, &gbphy_host->devices, list) {
list_del(&gpbdev->list); list_del(&gbphy_dev->list);
device_unregister(&gpbdev->dev); device_unregister(&gbphy_dev->dev);
} }
kfree(gpb_host); kfree(gbphy_host);
} }
static int gb_gpbridge_probe(struct gb_bundle *bundle, static int gb_gbphy_probe(struct gb_bundle *bundle,
const struct greybus_bundle_id *id) const struct greybus_bundle_id *id)
{ {
struct gpbridge_host *gpb_host; struct gbphy_host *gbphy_host;
struct gpbridge_device *gpbdev; struct gbphy_device *gbphy_dev;
int i; int i;
if (bundle->num_cports == 0) if (bundle->num_cports == 0)
return -ENODEV; return -ENODEV;
gpb_host = kzalloc(sizeof(*gpb_host), GFP_KERNEL); gbphy_host = kzalloc(sizeof(*gbphy_host), GFP_KERNEL);
if (!gpb_host) if (!gbphy_host)
return -ENOMEM; return -ENOMEM;
gpb_host->bundle = bundle; gbphy_host->bundle = bundle;
INIT_LIST_HEAD(&gpb_host->devices); INIT_LIST_HEAD(&gbphy_host->devices);
greybus_set_drvdata(bundle, gpb_host); greybus_set_drvdata(bundle, gbphy_host);
/* /*
* Create a bunch of children devices, one per cport, and bind the * Create a bunch of children devices, one per cport, and bind the
* bridged phy drivers to them. * bridged phy drivers to them.
*/ */
for (i = 0; i < bundle->num_cports; ++i) { for (i = 0; i < bundle->num_cports; ++i) {
gpbdev = gb_gpbridge_create_dev(bundle, &bundle->cport_desc[i]); gbphy_dev = gb_gbphy_create_dev(bundle, &bundle->cport_desc[i]);
if (IS_ERR(gpbdev)) { if (IS_ERR(gbphy_dev)) {
gb_gpbridge_disconnect(bundle); gb_gbphy_disconnect(bundle);
return PTR_ERR(gpbdev); return PTR_ERR(gbphy_dev);
} }
list_add(&gpbdev->list, &gpb_host->devices); list_add(&gbphy_dev->list, &gbphy_host->devices);
} }
return 0; return 0;
} }
static const struct greybus_bundle_id gb_gpbridge_id_table[] = { static const struct greybus_bundle_id gb_gbphy_id_table[] = {
{ GREYBUS_DEVICE_CLASS(GREYBUS_CLASS_BRIDGED_PHY) }, { GREYBUS_DEVICE_CLASS(GREYBUS_CLASS_BRIDGED_PHY) },
{ }, { },
}; };
MODULE_DEVICE_TABLE(greybus, gb_gpbridge_id_table); MODULE_DEVICE_TABLE(greybus, gb_gbphy_id_table);
static struct greybus_driver gb_gpbridge_driver = { static struct greybus_driver gb_gbphy_driver = {
.name = "gpbridge", .name = "gbphy",
.probe = gb_gpbridge_probe, .probe = gb_gbphy_probe,
.disconnect = gb_gpbridge_disconnect, .disconnect = gb_gbphy_disconnect,
.id_table = gb_gpbridge_id_table, .id_table = gb_gbphy_id_table,
}; };
static int __init gpbridge_init(void) static int __init gbphy_init(void)
{ {
int retval; int retval;
retval = bus_register(&gpbridge_bus_type); retval = bus_register(&gbphy_bus_type);
if (retval) { if (retval) {
pr_err("gpbridge bus register failed (%d)\n", retval); pr_err("gbphy bus register failed (%d)\n", retval);
return retval; return retval;
} }
retval = greybus_register(&gb_gpbridge_driver); retval = greybus_register(&gb_gbphy_driver);
if (retval) { if (retval) {
pr_err("error registering greybus driver\n"); pr_err("error registering greybus driver\n");
goto error_gpbridge; goto error_gbphy;
} }
return 0; return 0;
error_gpbridge: error_gbphy:
bus_unregister(&gpbridge_bus_type); bus_unregister(&gbphy_bus_type);
ida_destroy(&gpbridge_id); ida_destroy(&gbphy_id);
return retval; return retval;
} }
module_init(gpbridge_init); module_init(gbphy_init);
static void __exit gpbridge_exit(void) static void __exit gbphy_exit(void)
{ {
greybus_deregister(&gb_gpbridge_driver); greybus_deregister(&gb_gbphy_driver);
bus_unregister(&gpbridge_bus_type); bus_unregister(&gbphy_bus_type);
ida_destroy(&gpbridge_id); ida_destroy(&gbphy_id);
} }
module_exit(gpbridge_exit); module_exit(gbphy_exit);
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
/* /*
* Greybus GPBridge phy driver * Greybus Bridged-Phy Bus driver
* *
* Copyright 2016 Google Inc. * Copyright 2016 Google Inc.
* *
* Released under the GPLv2 only. * Released under the GPLv2 only.
*/ */
#ifndef __GPBRIDGE_H #ifndef __GBPHY_H
#define __GPBRIDGE_H #define __GBPHY_H
struct gpbridge_device { struct gbphy_device {
u32 id; u32 id;
struct greybus_descriptor_cport *cport_desc; struct greybus_descriptor_cport *cport_desc;
struct gb_bundle *bundle; struct gb_bundle *bundle;
struct list_head list; struct list_head list;
struct device dev; struct device dev;
}; };
#define to_gpbridge_dev(d) container_of(d, struct gpbridge_device, dev) #define to_gbphy_dev(d) container_of(d, struct gbphy_device, dev)
static inline void *gb_gpbridge_get_data(struct gpbridge_device *gdev) static inline void *gb_gbphy_get_data(struct gbphy_device *gdev)
{ {
return dev_get_drvdata(&gdev->dev); return dev_get_drvdata(&gdev->dev);
} }
static inline void gb_gpbridge_set_data(struct gpbridge_device *gdev, void *data) static inline void gb_gbphy_set_data(struct gbphy_device *gdev, void *data)
{ {
dev_set_drvdata(&gdev->dev, data); dev_set_drvdata(&gdev->dev, data);
} }
struct gpbridge_device_id { struct gbphy_device_id {
__u8 protocol_id; __u8 protocol_id;
}; };
#define GPBRIDGE_PROTOCOL(p) \ #define GBPHY_PROTOCOL(p) \
.protocol_id = (p), .protocol_id = (p),
struct gpbridge_driver { struct gbphy_driver {
const char *name; const char *name;
int (*probe)(struct gpbridge_device *, int (*probe)(struct gbphy_device *,
const struct gpbridge_device_id *id); const struct gbphy_device_id *id);
void (*remove)(struct gpbridge_device *); void (*remove)(struct gbphy_device *);
const struct gpbridge_device_id *id_table; const struct gbphy_device_id *id_table;
struct device_driver driver; struct device_driver driver;
}; };
#define to_gpbridge_driver(d) container_of(d, struct gpbridge_driver, driver) #define to_gbphy_driver(d) container_of(d, struct gbphy_driver, driver)
int gb_gpbridge_get_version(struct gb_connection *connection); int gb_gbphy_get_version(struct gb_connection *connection);
int gb_gpbridge_register_driver(struct gpbridge_driver *driver, int gb_gbphy_register_driver(struct gbphy_driver *driver,
struct module *owner, const char *mod_name); struct module *owner, const char *mod_name);
void gb_gpbridge_deregister_driver(struct gpbridge_driver *driver); void gb_gbphy_deregister_driver(struct gbphy_driver *driver);
#define gb_gpbridge_register(driver) \ #define gb_gbphy_register(driver) \
gb_gpbridge_register_driver(driver, THIS_MODULE, KBUILD_MODNAME) gb_gbphy_register_driver(driver, THIS_MODULE, KBUILD_MODNAME)
#define gb_gpbridge_deregister(driver) \ #define gb_gbphy_deregister(driver) \
gb_gpbridge_deregister_driver(driver) gb_gbphy_deregister_driver(driver)
/** /**
* module_gpbridge_driver() - Helper macro for registering a gpbridge driver * module_gbphy_driver() - Helper macro for registering a gbphy driver
* @__gpbridge_driver: gpbridge_driver structure * @__gbphy_driver: gbphy_driver structure
* *
* Helper macro for gpbridge drivers to set up proper module init / exit * Helper macro for gbphy drivers to set up proper module init / exit
* functions. Replaces module_init() and module_exit() and keeps people from * functions. Replaces module_init() and module_exit() and keeps people from
* printing pointless things to the kernel log when their driver is loaded. * printing pointless things to the kernel log when their driver is loaded.
*/ */
#define module_gpbridge_driver(__gpbridge_driver) \ #define module_gbphy_driver(__gbphy_driver) \
module_driver(__gpbridge_driver, gb_gpbridge_register, gb_gpbridge_deregister) module_driver(__gbphy_driver, gb_gbphy_register, gb_gbphy_deregister)
#endif /* __GPBRIDGE_H */ #endif /* __GBPHY_H */
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include <linux/mutex.h> #include <linux/mutex.h>
#include "greybus.h" #include "greybus.h"
#include "gpbridge.h" #include "gbphy.h"
struct gb_gpio_line { struct gb_gpio_line {
/* The following has to be an array of line_max entries */ /* The following has to be an array of line_max entries */
...@@ -33,7 +33,7 @@ struct gb_gpio_line { ...@@ -33,7 +33,7 @@ struct gb_gpio_line {
}; };
struct gb_gpio_controller { struct gb_gpio_controller {
struct gpbridge_device *gpbdev; struct gbphy_device *gbphy_dev;
struct gb_connection *connection; struct gb_connection *connection;
u8 line_max; /* max line number */ u8 line_max; /* max line number */
struct gb_gpio_line *lines; struct gb_gpio_line *lines;
...@@ -79,7 +79,7 @@ static int gb_gpio_activate_operation(struct gb_gpio_controller *ggc, u8 which) ...@@ -79,7 +79,7 @@ static int gb_gpio_activate_operation(struct gb_gpio_controller *ggc, u8 which)
static void gb_gpio_deactivate_operation(struct gb_gpio_controller *ggc, static void gb_gpio_deactivate_operation(struct gb_gpio_controller *ggc,
u8 which) u8 which)
{ {
struct device *dev = &ggc->gpbdev->dev; struct device *dev = &ggc->gbphy_dev->dev;
struct gb_gpio_deactivate_request request; struct gb_gpio_deactivate_request request;
int ret; int ret;
...@@ -97,7 +97,7 @@ static void gb_gpio_deactivate_operation(struct gb_gpio_controller *ggc, ...@@ -97,7 +97,7 @@ static void gb_gpio_deactivate_operation(struct gb_gpio_controller *ggc,
static int gb_gpio_get_direction_operation(struct gb_gpio_controller *ggc, static int gb_gpio_get_direction_operation(struct gb_gpio_controller *ggc,
u8 which) u8 which)
{ {
struct device *dev = &ggc->gpbdev->dev; struct device *dev = &ggc->gbphy_dev->dev;
struct gb_gpio_get_direction_request request; struct gb_gpio_get_direction_request request;
struct gb_gpio_get_direction_response response; struct gb_gpio_get_direction_response response;
int ret; int ret;
...@@ -151,7 +151,7 @@ static int gb_gpio_direction_out_operation(struct gb_gpio_controller *ggc, ...@@ -151,7 +151,7 @@ static int gb_gpio_direction_out_operation(struct gb_gpio_controller *ggc,
static int gb_gpio_get_value_operation(struct gb_gpio_controller *ggc, static int gb_gpio_get_value_operation(struct gb_gpio_controller *ggc,
u8 which) u8 which)
{ {
struct device *dev = &ggc->gpbdev->dev; struct device *dev = &ggc->gbphy_dev->dev;
struct gb_gpio_get_value_request request; struct gb_gpio_get_value_request request;
struct gb_gpio_get_value_response response; struct gb_gpio_get_value_response response;
int ret; int ret;
...@@ -178,7 +178,7 @@ static int gb_gpio_get_value_operation(struct gb_gpio_controller *ggc, ...@@ -178,7 +178,7 @@ static int gb_gpio_get_value_operation(struct gb_gpio_controller *ggc,
static void gb_gpio_set_value_operation(struct gb_gpio_controller *ggc, static void gb_gpio_set_value_operation(struct gb_gpio_controller *ggc,
u8 which, bool value_high) u8 which, bool value_high)
{ {
struct device *dev = &ggc->gpbdev->dev; struct device *dev = &ggc->gbphy_dev->dev;
struct gb_gpio_set_value_request request; struct gb_gpio_set_value_request request;
int ret; int ret;
...@@ -217,7 +217,7 @@ static int gb_gpio_set_debounce_operation(struct gb_gpio_controller *ggc, ...@@ -217,7 +217,7 @@ static int gb_gpio_set_debounce_operation(struct gb_gpio_controller *ggc,
static void _gb_gpio_irq_mask(struct gb_gpio_controller *ggc, u8 hwirq) static void _gb_gpio_irq_mask(struct gb_gpio_controller *ggc, u8 hwirq)
{ {
struct device *dev = &ggc->gpbdev->dev; struct device *dev = &ggc->gbphy_dev->dev;
struct gb_gpio_irq_mask_request request; struct gb_gpio_irq_mask_request request;
int ret; int ret;
...@@ -231,7 +231,7 @@ static void _gb_gpio_irq_mask(struct gb_gpio_controller *ggc, u8 hwirq) ...@@ -231,7 +231,7 @@ static void _gb_gpio_irq_mask(struct gb_gpio_controller *ggc, u8 hwirq)
static void _gb_gpio_irq_unmask(struct gb_gpio_controller *ggc, u8 hwirq) static void _gb_gpio_irq_unmask(struct gb_gpio_controller *ggc, u8 hwirq)
{ {
struct device *dev = &ggc->gpbdev->dev; struct device *dev = &ggc->gbphy_dev->dev;
struct gb_gpio_irq_unmask_request request; struct gb_gpio_irq_unmask_request request;
int ret; int ret;
...@@ -246,7 +246,7 @@ static void _gb_gpio_irq_unmask(struct gb_gpio_controller *ggc, u8 hwirq) ...@@ -246,7 +246,7 @@ static void _gb_gpio_irq_unmask(struct gb_gpio_controller *ggc, u8 hwirq)
static void _gb_gpio_irq_set_type(struct gb_gpio_controller *ggc, static void _gb_gpio_irq_set_type(struct gb_gpio_controller *ggc,
u8 hwirq, u8 type) u8 hwirq, u8 type)
{ {
struct device *dev = &ggc->gpbdev->dev; struct device *dev = &ggc->gbphy_dev->dev;
struct gb_gpio_irq_type_request request; struct gb_gpio_irq_type_request request;
int ret; int ret;
...@@ -285,7 +285,7 @@ static int gb_gpio_irq_set_type(struct irq_data *d, unsigned int type) ...@@ -285,7 +285,7 @@ static int gb_gpio_irq_set_type(struct irq_data *d, unsigned int type)
struct gpio_chip *chip = irq_data_to_gpio_chip(d); struct gpio_chip *chip = irq_data_to_gpio_chip(d);
struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip); struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip);
struct gb_gpio_line *line = &ggc->lines[d->hwirq]; struct gb_gpio_line *line = &ggc->lines[d->hwirq];
struct device *dev = &ggc->gpbdev->dev; struct device *dev = &ggc->gbphy_dev->dev;
u8 irq_type; u8 irq_type;
switch (type) { switch (type) {
...@@ -352,7 +352,7 @@ static int gb_gpio_request_handler(struct gb_operation *op) ...@@ -352,7 +352,7 @@ static int gb_gpio_request_handler(struct gb_operation *op)
{ {
struct gb_connection *connection = op->connection; struct gb_connection *connection = op->connection;
struct gb_gpio_controller *ggc = gb_connection_get_data(connection); struct gb_gpio_controller *ggc = gb_connection_get_data(connection);
struct device *dev = &ggc->gpbdev->dev; struct device *dev = &ggc->gbphy_dev->dev;
struct gb_message *request; struct gb_message *request;
struct gb_gpio_irq_event_request *event; struct gb_gpio_irq_event_request *event;
u8 type = op->type; u8 type = op->type;
...@@ -624,8 +624,8 @@ static int gb_gpio_to_irq(struct gpio_chip *chip, unsigned offset) ...@@ -624,8 +624,8 @@ static int gb_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
return irq_find_mapping(ggc->irqdomain, offset); return irq_find_mapping(ggc->irqdomain, offset);
} }
static int gb_gpio_probe(struct gpbridge_device *gpbdev, static int gb_gpio_probe(struct gbphy_device *gbphy_dev,
const struct gpbridge_device_id *id) const struct gbphy_device_id *id)
{ {
struct gb_connection *connection; struct gb_connection *connection;
struct gb_gpio_controller *ggc; struct gb_gpio_controller *ggc;
...@@ -637,8 +637,8 @@ static int gb_gpio_probe(struct gpbridge_device *gpbdev, ...@@ -637,8 +637,8 @@ static int gb_gpio_probe(struct gpbridge_device *gpbdev,
if (!ggc) if (!ggc)
return -ENOMEM; return -ENOMEM;
connection = gb_connection_create(gpbdev->bundle, connection = gb_connection_create(gbphy_dev->bundle,
le16_to_cpu(gpbdev->cport_desc->id), le16_to_cpu(gbphy_dev->cport_desc->id),
gb_gpio_request_handler); gb_gpio_request_handler);
if (IS_ERR(connection)) { if (IS_ERR(connection)) {
ret = PTR_ERR(connection); ret = PTR_ERR(connection);
...@@ -647,14 +647,14 @@ static int gb_gpio_probe(struct gpbridge_device *gpbdev, ...@@ -647,14 +647,14 @@ static int gb_gpio_probe(struct gpbridge_device *gpbdev,
ggc->connection = connection; ggc->connection = connection;
gb_connection_set_data(connection, ggc); gb_connection_set_data(connection, ggc);
ggc->gpbdev = gpbdev; ggc->gbphy_dev = gbphy_dev;
gb_gpbridge_set_data(gpbdev, ggc); gb_gbphy_set_data(gbphy_dev, ggc);
ret = gb_connection_enable_tx(connection); ret = gb_connection_enable_tx(connection);
if (ret) if (ret)
goto exit_connection_destroy; goto exit_connection_destroy;
ret = gb_gpbridge_get_version(connection); ret = gb_gbphy_get_version(connection);
if (ret) if (ret)
goto exit_connection_disable; goto exit_connection_disable;
...@@ -676,9 +676,9 @@ static int gb_gpio_probe(struct gpbridge_device *gpbdev, ...@@ -676,9 +676,9 @@ static int gb_gpio_probe(struct gpbridge_device *gpbdev,
gpio->label = "greybus_gpio"; gpio->label = "greybus_gpio";
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
gpio->parent = &gpbdev->dev; gpio->parent = &gbphy_dev->dev;
#else #else
gpio->dev = &gpbdev->dev; gpio->dev = &gbphy_dev->dev;
#endif #endif
gpio->owner = THIS_MODULE; gpio->owner = THIS_MODULE;
...@@ -729,9 +729,9 @@ static int gb_gpio_probe(struct gpbridge_device *gpbdev, ...@@ -729,9 +729,9 @@ static int gb_gpio_probe(struct gpbridge_device *gpbdev,
return ret; return ret;
} }
static void gb_gpio_remove(struct gpbridge_device *gpbdev) static void gb_gpio_remove(struct gbphy_device *gbphy_dev)
{ {
struct gb_gpio_controller *ggc = gb_gpbridge_get_data(gpbdev); struct gb_gpio_controller *ggc = gb_gbphy_get_data(gbphy_dev);
struct gb_connection *connection = ggc->connection; struct gb_connection *connection = ggc->connection;
gb_connection_disable_rx(connection); gb_connection_disable_rx(connection);
...@@ -743,18 +743,18 @@ static void gb_gpio_remove(struct gpbridge_device *gpbdev) ...@@ -743,18 +743,18 @@ static void gb_gpio_remove(struct gpbridge_device *gpbdev)
kfree(ggc); kfree(ggc);
} }
static const struct gpbridge_device_id gb_gpio_id_table[] = { static const struct gbphy_device_id gb_gpio_id_table[] = {
{ GPBRIDGE_PROTOCOL(GREYBUS_PROTOCOL_GPIO) }, { GBPHY_PROTOCOL(GREYBUS_PROTOCOL_GPIO) },
{ }, { },
}; };
MODULE_DEVICE_TABLE(gpbridge, gb_gpio_id_table); MODULE_DEVICE_TABLE(gbphy, gb_gpio_id_table);
static struct gpbridge_driver gpio_driver = { static struct gbphy_driver gpio_driver = {
.name = "gpio", .name = "gpio",
.probe = gb_gpio_probe, .probe = gb_gpio_probe,
.remove = gb_gpio_remove, .remove = gb_gpio_remove,
.id_table = gb_gpio_id_table, .id_table = gb_gpio_id_table,
}; };
module_gpbridge_driver(gpio_driver); module_gbphy_driver(gpio_driver);
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
...@@ -13,11 +13,11 @@ ...@@ -13,11 +13,11 @@
#include <linux/i2c.h> #include <linux/i2c.h>
#include "greybus.h" #include "greybus.h"
#include "gpbridge.h" #include "gbphy.h"
struct gb_i2c_device { struct gb_i2c_device {
struct gb_connection *connection; struct gb_connection *connection;
struct gpbridge_device *gpbdev; struct gbphy_device *gbphy_dev;
u32 functionality; u32 functionality;
...@@ -85,7 +85,7 @@ gb_i2c_operation_create(struct gb_connection *connection, ...@@ -85,7 +85,7 @@ gb_i2c_operation_create(struct gb_connection *connection,
u32 i; u32 i;
if (msg_count > (u32)U16_MAX) { if (msg_count > (u32)U16_MAX) {
dev_err(&gb_i2c_dev->gpbdev->dev, "msg_count (%u) too big\n", dev_err(&gb_i2c_dev->gbphy_dev->dev, "msg_count (%u) too big\n",
msg_count); msg_count);
return NULL; return NULL;
} }
...@@ -168,7 +168,7 @@ static int gb_i2c_transfer_operation(struct gb_i2c_device *gb_i2c_dev, ...@@ -168,7 +168,7 @@ static int gb_i2c_transfer_operation(struct gb_i2c_device *gb_i2c_dev,
struct i2c_msg *msgs, u32 msg_count) struct i2c_msg *msgs, u32 msg_count)
{ {
struct gb_connection *connection = gb_i2c_dev->connection; struct gb_connection *connection = gb_i2c_dev->connection;
struct device *dev = &gb_i2c_dev->gpbdev->dev; struct device *dev = &gb_i2c_dev->gbphy_dev->dev;
struct gb_operation *operation; struct gb_operation *operation;
int ret; int ret;
...@@ -242,8 +242,8 @@ static int gb_i2c_device_setup(struct gb_i2c_device *gb_i2c_dev) ...@@ -242,8 +242,8 @@ static int gb_i2c_device_setup(struct gb_i2c_device *gb_i2c_dev)
return gb_i2c_functionality_operation(gb_i2c_dev); return gb_i2c_functionality_operation(gb_i2c_dev);
} }
static int gb_i2c_probe(struct gpbridge_device *gpbdev, static int gb_i2c_probe(struct gbphy_device *gbphy_dev,
const struct gpbridge_device_id *id) const struct gbphy_device_id *id)
{ {
struct gb_connection *connection; struct gb_connection *connection;
struct gb_i2c_device *gb_i2c_dev; struct gb_i2c_device *gb_i2c_dev;
...@@ -254,8 +254,8 @@ static int gb_i2c_probe(struct gpbridge_device *gpbdev, ...@@ -254,8 +254,8 @@ static int gb_i2c_probe(struct gpbridge_device *gpbdev,
if (!gb_i2c_dev) if (!gb_i2c_dev)
return -ENOMEM; return -ENOMEM;
connection = gb_connection_create(gpbdev->bundle, connection = gb_connection_create(gbphy_dev->bundle,
le16_to_cpu(gpbdev->cport_desc->id), le16_to_cpu(gbphy_dev->cport_desc->id),
NULL); NULL);
if (IS_ERR(connection)) { if (IS_ERR(connection)) {
ret = PTR_ERR(connection); ret = PTR_ERR(connection);
...@@ -264,14 +264,14 @@ static int gb_i2c_probe(struct gpbridge_device *gpbdev, ...@@ -264,14 +264,14 @@ static int gb_i2c_probe(struct gpbridge_device *gpbdev,
gb_i2c_dev->connection = connection; gb_i2c_dev->connection = connection;
gb_connection_set_data(connection, gb_i2c_dev); gb_connection_set_data(connection, gb_i2c_dev);
gb_i2c_dev->gpbdev = gpbdev; gb_i2c_dev->gbphy_dev = gbphy_dev;
gb_gpbridge_set_data(gpbdev, gb_i2c_dev); gb_gbphy_set_data(gbphy_dev, gb_i2c_dev);
ret = gb_connection_enable(connection); ret = gb_connection_enable(connection);
if (ret) if (ret)
goto exit_connection_destroy; goto exit_connection_destroy;
ret = gb_gpbridge_get_version(connection); ret = gb_gbphy_get_version(connection);
if (ret) if (ret)
goto exit_connection_disable; goto exit_connection_disable;
...@@ -286,7 +286,7 @@ static int gb_i2c_probe(struct gpbridge_device *gpbdev, ...@@ -286,7 +286,7 @@ static int gb_i2c_probe(struct gpbridge_device *gpbdev,
adapter->algo = &gb_i2c_algorithm; adapter->algo = &gb_i2c_algorithm;
/* adapter->algo_data = what? */ /* adapter->algo_data = what? */
adapter->dev.parent = &gpbdev->dev; adapter->dev.parent = &gbphy_dev->dev;
snprintf(adapter->name, sizeof(adapter->name), "Greybus i2c adapter"); snprintf(adapter->name, sizeof(adapter->name), "Greybus i2c adapter");
i2c_set_adapdata(adapter, gb_i2c_dev); i2c_set_adapdata(adapter, gb_i2c_dev);
...@@ -306,9 +306,9 @@ static int gb_i2c_probe(struct gpbridge_device *gpbdev, ...@@ -306,9 +306,9 @@ static int gb_i2c_probe(struct gpbridge_device *gpbdev,
return ret; return ret;
} }
static void gb_i2c_remove(struct gpbridge_device *gpbdev) static void gb_i2c_remove(struct gbphy_device *gbphy_dev)
{ {
struct gb_i2c_device *gb_i2c_dev = gb_gpbridge_get_data(gpbdev); struct gb_i2c_device *gb_i2c_dev = gb_gbphy_get_data(gbphy_dev);
struct gb_connection *connection = gb_i2c_dev->connection; struct gb_connection *connection = gb_i2c_dev->connection;
i2c_del_adapter(&gb_i2c_dev->adapter); i2c_del_adapter(&gb_i2c_dev->adapter);
...@@ -317,18 +317,18 @@ static void gb_i2c_remove(struct gpbridge_device *gpbdev) ...@@ -317,18 +317,18 @@ static void gb_i2c_remove(struct gpbridge_device *gpbdev)
kfree(gb_i2c_dev); kfree(gb_i2c_dev);
} }
static const struct gpbridge_device_id gb_i2c_id_table[] = { static const struct gbphy_device_id gb_i2c_id_table[] = {
{ GPBRIDGE_PROTOCOL(GREYBUS_PROTOCOL_I2C) }, { GBPHY_PROTOCOL(GREYBUS_PROTOCOL_I2C) },
{ }, { },
}; };
MODULE_DEVICE_TABLE(gpbridge, gb_i2c_id_table); MODULE_DEVICE_TABLE(gbphy, gb_i2c_id_table);
static struct gpbridge_driver i2c_driver = { static struct gbphy_driver i2c_driver = {
.name = "i2c", .name = "i2c",
.probe = gb_i2c_probe, .probe = gb_i2c_probe,
.remove = gb_i2c_remove, .remove = gb_i2c_remove,
.id_table = gb_i2c_id_table, .id_table = gb_i2c_id_table,
}; };
module_gpbridge_driver(i2c_driver); module_gbphy_driver(i2c_driver);
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#define TOSHIBA_DMID 0x0126 #define TOSHIBA_DMID 0x0126
#define TOSHIBA_ES2_BRIDGE_DPID 0x1000 #define TOSHIBA_ES2_BRIDGE_DPID 0x1000
#define TOSHIBA_ES3_APBRIDGE_DPID 0x1001 #define TOSHIBA_ES3_APBRIDGE_DPID 0x1001
#define TOSHIBA_ES3_GPBRIDGE_DPID 0x1002 #define TOSHIBA_ES3_GBPHY_DPID 0x1002
static int gb_interface_dme_attr_get(struct gb_interface *intf, static int gb_interface_dme_attr_get(struct gb_interface *intf,
......
...@@ -86,7 +86,7 @@ struct gb_loopback { ...@@ -86,7 +86,7 @@ struct gb_loopback {
struct gb_loopback_stats throughput; struct gb_loopback_stats throughput;
struct gb_loopback_stats requests_per_second; struct gb_loopback_stats requests_per_second;
struct gb_loopback_stats apbridge_unipro_latency; struct gb_loopback_stats apbridge_unipro_latency;
struct gb_loopback_stats gpbridge_firmware_latency; struct gb_loopback_stats gbphy_firmware_latency;
int type; int type;
int async; int async;
...@@ -106,7 +106,7 @@ struct gb_loopback { ...@@ -106,7 +106,7 @@ struct gb_loopback {
u32 lbid; u32 lbid;
u64 elapsed_nsecs; u64 elapsed_nsecs;
u32 apbridge_latency_ts; u32 apbridge_latency_ts;
u32 gpbridge_latency_ts; u32 gbphy_latency_ts;
u32 send_count; u32 send_count;
}; };
...@@ -290,7 +290,7 @@ gb_loopback_stats_attrs(throughput); ...@@ -290,7 +290,7 @@ gb_loopback_stats_attrs(throughput);
/* Latency across the UniPro link from APBridge's perspective */ /* Latency across the UniPro link from APBridge's perspective */
gb_loopback_stats_attrs(apbridge_unipro_latency); gb_loopback_stats_attrs(apbridge_unipro_latency);
/* Firmware induced overhead in the GPBridge */ /* Firmware induced overhead in the GPBridge */
gb_loopback_stats_attrs(gpbridge_firmware_latency); gb_loopback_stats_attrs(gbphy_firmware_latency);
/* Number of errors encountered during loop */ /* Number of errors encountered during loop */
gb_loopback_ro_attr(error); gb_loopback_ro_attr(error);
...@@ -340,9 +340,9 @@ static struct attribute *loopback_attrs[] = { ...@@ -340,9 +340,9 @@ static struct attribute *loopback_attrs[] = {
&dev_attr_apbridge_unipro_latency_min.attr, &dev_attr_apbridge_unipro_latency_min.attr,
&dev_attr_apbridge_unipro_latency_max.attr, &dev_attr_apbridge_unipro_latency_max.attr,
&dev_attr_apbridge_unipro_latency_avg.attr, &dev_attr_apbridge_unipro_latency_avg.attr,
&dev_attr_gpbridge_firmware_latency_min.attr, &dev_attr_gbphy_firmware_latency_min.attr,
&dev_attr_gpbridge_firmware_latency_max.attr, &dev_attr_gbphy_firmware_latency_max.attr,
&dev_attr_gpbridge_firmware_latency_avg.attr, &dev_attr_gbphy_firmware_latency_avg.attr,
&dev_attr_type.attr, &dev_attr_type.attr,
&dev_attr_size.attr, &dev_attr_size.attr,
&dev_attr_us_wait.attr, &dev_attr_us_wait.attr,
...@@ -670,7 +670,7 @@ static int gb_loopback_sync_transfer(struct gb_loopback *gb, u32 len) ...@@ -670,7 +670,7 @@ static int gb_loopback_sync_transfer(struct gb_loopback *gb, u32 len)
int retval; int retval;
gb->apbridge_latency_ts = 0; gb->apbridge_latency_ts = 0;
gb->gpbridge_latency_ts = 0; gb->gbphy_latency_ts = 0;
request = kmalloc(len + sizeof(*request), GFP_KERNEL); request = kmalloc(len + sizeof(*request), GFP_KERNEL);
if (!request) if (!request)
...@@ -696,7 +696,7 @@ static int gb_loopback_sync_transfer(struct gb_loopback *gb, u32 len) ...@@ -696,7 +696,7 @@ static int gb_loopback_sync_transfer(struct gb_loopback *gb, u32 len)
retval = -EREMOTEIO; retval = -EREMOTEIO;
} }
gb->apbridge_latency_ts = (u32)__le32_to_cpu(response->reserved0); gb->apbridge_latency_ts = (u32)__le32_to_cpu(response->reserved0);
gb->gpbridge_latency_ts = (u32)__le32_to_cpu(response->reserved1); gb->gbphy_latency_ts = (u32)__le32_to_cpu(response->reserved1);
gb_error: gb_error:
kfree(request); kfree(request);
...@@ -752,7 +752,7 @@ static int gb_loopback_async_transfer_complete( ...@@ -752,7 +752,7 @@ static int gb_loopback_async_transfer_complete(
} else { } else {
gb->apbridge_latency_ts = gb->apbridge_latency_ts =
(u32)__le32_to_cpu(response->reserved0); (u32)__le32_to_cpu(response->reserved0);
gb->gpbridge_latency_ts = gb->gbphy_latency_ts =
(u32)__le32_to_cpu(response->reserved1); (u32)__le32_to_cpu(response->reserved1);
} }
...@@ -850,12 +850,12 @@ static void gb_loopback_reset_stats(struct gb_loopback *gb) ...@@ -850,12 +850,12 @@ static void gb_loopback_reset_stats(struct gb_loopback *gb)
sizeof(struct gb_loopback_stats)); sizeof(struct gb_loopback_stats));
memcpy(&gb->apbridge_unipro_latency, &reset, memcpy(&gb->apbridge_unipro_latency, &reset,
sizeof(struct gb_loopback_stats)); sizeof(struct gb_loopback_stats));
memcpy(&gb->gpbridge_firmware_latency, &reset, memcpy(&gb->gbphy_firmware_latency, &reset,
sizeof(struct gb_loopback_stats)); sizeof(struct gb_loopback_stats));
/* Should be initialized at least once per transaction set */ /* Should be initialized at least once per transaction set */
gb->apbridge_latency_ts = 0; gb->apbridge_latency_ts = 0;
gb->gpbridge_latency_ts = 0; gb->gbphy_latency_ts = 0;
memset(&gb->ts, 0, sizeof(struct timeval)); memset(&gb->ts, 0, sizeof(struct timeval));
} }
...@@ -931,8 +931,8 @@ static void gb_loopback_calculate_latency_stats(struct gb_loopback *gb) ...@@ -931,8 +931,8 @@ static void gb_loopback_calculate_latency_stats(struct gb_loopback *gb)
/* Log the firmware supplied latency values */ /* Log the firmware supplied latency values */
gb_loopback_update_stats(&gb->apbridge_unipro_latency, gb_loopback_update_stats(&gb->apbridge_unipro_latency,
gb->apbridge_latency_ts); gb->apbridge_latency_ts);
gb_loopback_update_stats(&gb->gpbridge_firmware_latency, gb_loopback_update_stats(&gb->gbphy_firmware_latency,
gb->gpbridge_latency_ts); gb->gbphy_latency_ts);
} }
static void gb_loopback_calculate_stats(struct gb_loopback *gb, bool error) static void gb_loopback_calculate_stats(struct gb_loopback *gb, bool error)
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <linux/pwm.h> #include <linux/pwm.h>
#include "greybus.h" #include "greybus.h"
#include "gpbridge.h" #include "gbphy.h"
struct gb_pwm_chip { struct gb_pwm_chip {
struct gb_connection *connection; struct gb_connection *connection;
...@@ -178,8 +178,8 @@ static const struct pwm_ops gb_pwm_ops = { ...@@ -178,8 +178,8 @@ static const struct pwm_ops gb_pwm_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
static int gb_pwm_probe(struct gpbridge_device *gpbdev, static int gb_pwm_probe(struct gbphy_device *gbphy_dev,
const struct gpbridge_device_id *id) const struct gbphy_device_id *id)
{ {
struct gb_connection *connection; struct gb_connection *connection;
struct gb_pwm_chip *pwmc; struct gb_pwm_chip *pwmc;
...@@ -190,8 +190,8 @@ static int gb_pwm_probe(struct gpbridge_device *gpbdev, ...@@ -190,8 +190,8 @@ static int gb_pwm_probe(struct gpbridge_device *gpbdev,
if (!pwmc) if (!pwmc)
return -ENOMEM; return -ENOMEM;
connection = gb_connection_create(gpbdev->bundle, connection = gb_connection_create(gbphy_dev->bundle,
le16_to_cpu(gpbdev->cport_desc->id), le16_to_cpu(gbphy_dev->cport_desc->id),
NULL); NULL);
if (IS_ERR(connection)) { if (IS_ERR(connection)) {
ret = PTR_ERR(connection); ret = PTR_ERR(connection);
...@@ -200,13 +200,13 @@ static int gb_pwm_probe(struct gpbridge_device *gpbdev, ...@@ -200,13 +200,13 @@ static int gb_pwm_probe(struct gpbridge_device *gpbdev,
pwmc->connection = connection; pwmc->connection = connection;
gb_connection_set_data(connection, pwmc); gb_connection_set_data(connection, pwmc);
gb_gpbridge_set_data(gpbdev, pwmc); gb_gbphy_set_data(gbphy_dev, pwmc);
ret = gb_connection_enable(connection); ret = gb_connection_enable(connection);
if (ret) if (ret)
goto exit_connection_destroy; goto exit_connection_destroy;
ret = gb_gpbridge_get_version(connection); ret = gb_gbphy_get_version(connection);
if (ret) if (ret)
goto exit_connection_disable; goto exit_connection_disable;
...@@ -217,7 +217,7 @@ static int gb_pwm_probe(struct gpbridge_device *gpbdev, ...@@ -217,7 +217,7 @@ static int gb_pwm_probe(struct gpbridge_device *gpbdev,
pwm = &pwmc->chip; pwm = &pwmc->chip;
pwm->dev = &gpbdev->dev; pwm->dev = &gbphy_dev->dev;
pwm->ops = &gb_pwm_ops; pwm->ops = &gb_pwm_ops;
pwm->base = -1; /* Allocate base dynamically */ pwm->base = -1; /* Allocate base dynamically */
pwm->npwm = pwmc->pwm_max + 1; pwm->npwm = pwmc->pwm_max + 1;
...@@ -225,7 +225,7 @@ static int gb_pwm_probe(struct gpbridge_device *gpbdev, ...@@ -225,7 +225,7 @@ static int gb_pwm_probe(struct gpbridge_device *gpbdev,
ret = pwmchip_add(pwm); ret = pwmchip_add(pwm);
if (ret) { if (ret) {
dev_err(&gpbdev->dev, dev_err(&gbphy_dev->dev,
"failed to register PWM: %d\n", ret); "failed to register PWM: %d\n", ret);
goto exit_connection_disable; goto exit_connection_disable;
} }
...@@ -241,9 +241,9 @@ static int gb_pwm_probe(struct gpbridge_device *gpbdev, ...@@ -241,9 +241,9 @@ static int gb_pwm_probe(struct gpbridge_device *gpbdev,
return ret; return ret;
} }
static void gb_pwm_remove(struct gpbridge_device *gpbdev) static void gb_pwm_remove(struct gbphy_device *gbphy_dev)
{ {
struct gb_pwm_chip *pwmc = gb_gpbridge_get_data(gpbdev); struct gb_pwm_chip *pwmc = gb_gbphy_get_data(gbphy_dev);
struct gb_connection *connection = pwmc->connection; struct gb_connection *connection = pwmc->connection;
pwmchip_remove(&pwmc->chip); pwmchip_remove(&pwmc->chip);
...@@ -252,18 +252,18 @@ static void gb_pwm_remove(struct gpbridge_device *gpbdev) ...@@ -252,18 +252,18 @@ static void gb_pwm_remove(struct gpbridge_device *gpbdev)
kfree(pwmc); kfree(pwmc);
} }
static const struct gpbridge_device_id gb_pwm_id_table[] = { static const struct gbphy_device_id gb_pwm_id_table[] = {
{ GPBRIDGE_PROTOCOL(GREYBUS_PROTOCOL_PWM) }, { GBPHY_PROTOCOL(GREYBUS_PROTOCOL_PWM) },
{ }, { },
}; };
MODULE_DEVICE_TABLE(gpbridge, gb_pwm_id_table); MODULE_DEVICE_TABLE(gbphy, gb_pwm_id_table);
static struct gpbridge_driver pwm_driver = { static struct gbphy_driver pwm_driver = {
.name = "pwm", .name = "pwm",
.probe = gb_pwm_probe, .probe = gb_pwm_probe,
.remove = gb_pwm_remove, .remove = gb_pwm_remove,
.id_table = gb_pwm_id_table, .id_table = gb_pwm_id_table,
}; };
module_gpbridge_driver(pwm_driver); module_gbphy_driver(pwm_driver);
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
...@@ -15,11 +15,11 @@ ...@@ -15,11 +15,11 @@
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include "greybus.h" #include "greybus.h"
#include "gpbridge.h" #include "gbphy.h"
struct gb_sdio_host { struct gb_sdio_host {
struct gb_connection *connection; struct gb_connection *connection;
struct gpbridge_device *gpbdev; struct gbphy_device *gbphy_dev;
struct mmc_host *mmc; struct mmc_host *mmc;
struct mmc_request *mrq; struct mmc_request *mrq;
struct mutex lock; /* lock for this host */ struct mutex lock; /* lock for this host */
...@@ -708,8 +708,8 @@ static const struct mmc_host_ops gb_sdio_ops = { ...@@ -708,8 +708,8 @@ static const struct mmc_host_ops gb_sdio_ops = {
.get_cd = gb_mmc_get_cd, .get_cd = gb_mmc_get_cd,
}; };
static int gb_sdio_probe(struct gpbridge_device *gpbdev, static int gb_sdio_probe(struct gbphy_device *gbphy_dev,
const struct gpbridge_device_id *id) const struct gbphy_device_id *id)
{ {
struct gb_connection *connection; struct gb_connection *connection;
struct mmc_host *mmc; struct mmc_host *mmc;
...@@ -717,12 +717,12 @@ static int gb_sdio_probe(struct gpbridge_device *gpbdev, ...@@ -717,12 +717,12 @@ static int gb_sdio_probe(struct gpbridge_device *gpbdev,
size_t max_buffer; size_t max_buffer;
int ret = 0; int ret = 0;
mmc = mmc_alloc_host(sizeof(*host), &gpbdev->dev); mmc = mmc_alloc_host(sizeof(*host), &gbphy_dev->dev);
if (!mmc) if (!mmc)
return -ENOMEM; return -ENOMEM;
connection = gb_connection_create(gpbdev->bundle, connection = gb_connection_create(gbphy_dev->bundle,
le16_to_cpu(gpbdev->cport_desc->id), le16_to_cpu(gbphy_dev->cport_desc->id),
gb_sdio_request_handler); gb_sdio_request_handler);
if (IS_ERR(connection)) { if (IS_ERR(connection)) {
ret = PTR_ERR(connection); ret = PTR_ERR(connection);
...@@ -735,14 +735,14 @@ static int gb_sdio_probe(struct gpbridge_device *gpbdev, ...@@ -735,14 +735,14 @@ static int gb_sdio_probe(struct gpbridge_device *gpbdev,
host->connection = connection; host->connection = connection;
gb_connection_set_data(connection, host); gb_connection_set_data(connection, host);
host->gpbdev = gpbdev; host->gbphy_dev = gbphy_dev;
gb_gpbridge_set_data(gpbdev, host); gb_gbphy_set_data(gbphy_dev, host);
ret = gb_connection_enable_tx(connection); ret = gb_connection_enable_tx(connection);
if (ret) if (ret)
goto exit_connection_destroy; goto exit_connection_destroy;
ret = gb_gpbridge_get_version(connection); ret = gb_gbphy_get_version(connection);
if (ret) if (ret)
goto exit_connection_disable; goto exit_connection_disable;
...@@ -767,7 +767,7 @@ static int gb_sdio_probe(struct gpbridge_device *gpbdev, ...@@ -767,7 +767,7 @@ static int gb_sdio_probe(struct gpbridge_device *gpbdev,
mutex_init(&host->lock); mutex_init(&host->lock);
spin_lock_init(&host->xfer); spin_lock_init(&host->xfer);
host->mrq_workqueue = alloc_workqueue("mmc-%s", 0, 1, host->mrq_workqueue = alloc_workqueue("mmc-%s", 0, 1,
dev_name(&gpbdev->dev)); dev_name(&gbphy_dev->dev));
if (!host->mrq_workqueue) { if (!host->mrq_workqueue) {
ret = -ENOMEM; ret = -ENOMEM;
goto exit_buf_free; goto exit_buf_free;
...@@ -801,9 +801,9 @@ static int gb_sdio_probe(struct gpbridge_device *gpbdev, ...@@ -801,9 +801,9 @@ static int gb_sdio_probe(struct gpbridge_device *gpbdev,
return ret; return ret;
} }
static void gb_sdio_remove(struct gpbridge_device *gpbdev) static void gb_sdio_remove(struct gbphy_device *gbphy_dev)
{ {
struct gb_sdio_host *host = gb_gpbridge_get_data(gpbdev); struct gb_sdio_host *host = gb_gbphy_get_data(gbphy_dev);
struct gb_connection *connection = host->connection; struct gb_connection *connection = host->connection;
struct mmc_host *mmc; struct mmc_host *mmc;
...@@ -823,18 +823,18 @@ static void gb_sdio_remove(struct gpbridge_device *gpbdev) ...@@ -823,18 +823,18 @@ static void gb_sdio_remove(struct gpbridge_device *gpbdev)
mmc_free_host(mmc); mmc_free_host(mmc);
} }
static const struct gpbridge_device_id gb_sdio_id_table[] = { static const struct gbphy_device_id gb_sdio_id_table[] = {
{ GPBRIDGE_PROTOCOL(GREYBUS_PROTOCOL_SDIO) }, { GBPHY_PROTOCOL(GREYBUS_PROTOCOL_SDIO) },
{ }, { },
}; };
MODULE_DEVICE_TABLE(gpbridge, gb_sdio_id_table); MODULE_DEVICE_TABLE(gbphy, gb_sdio_id_table);
static struct gpbridge_driver sdio_driver = { static struct gbphy_driver sdio_driver = {
.name = "sdio", .name = "sdio",
.probe = gb_sdio_probe, .probe = gb_sdio_probe,
.remove = gb_sdio_remove, .remove = gb_sdio_remove,
.id_table = gb_sdio_id_table, .id_table = gb_sdio_id_table,
}; };
module_gpbridge_driver(sdio_driver); module_gbphy_driver(sdio_driver);
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
...@@ -10,17 +10,17 @@ ...@@ -10,17 +10,17 @@
#include <linux/module.h> #include <linux/module.h>
#include "greybus.h" #include "greybus.h"
#include "gpbridge.h" #include "gbphy.h"
#include "spilib.h" #include "spilib.h"
static int gb_spi_probe(struct gpbridge_device *gpbdev, static int gb_spi_probe(struct gbphy_device *gbphy_dev,
const struct gpbridge_device_id *id) const struct gbphy_device_id *id)
{ {
struct gb_connection *connection; struct gb_connection *connection;
int ret; int ret;
connection = gb_connection_create(gpbdev->bundle, connection = gb_connection_create(gbphy_dev->bundle,
le16_to_cpu(gpbdev->cport_desc->id), le16_to_cpu(gbphy_dev->cport_desc->id),
NULL); NULL);
if (IS_ERR(connection)) if (IS_ERR(connection))
return PTR_ERR(connection); return PTR_ERR(connection);
...@@ -29,15 +29,15 @@ static int gb_spi_probe(struct gpbridge_device *gpbdev, ...@@ -29,15 +29,15 @@ static int gb_spi_probe(struct gpbridge_device *gpbdev,
if (ret) if (ret)
goto exit_connection_destroy; goto exit_connection_destroy;
ret = gb_gpbridge_get_version(connection); ret = gb_gbphy_get_version(connection);
if (ret) if (ret)
goto exit_connection_disable; goto exit_connection_disable;
ret = gb_spilib_master_init(connection, &gpbdev->dev); ret = gb_spilib_master_init(connection, &gbphy_dev->dev);
if (ret) if (ret)
goto exit_connection_disable; goto exit_connection_disable;
gb_gpbridge_set_data(gpbdev, connection); gb_gbphy_set_data(gbphy_dev, connection);
return 0; return 0;
...@@ -49,27 +49,27 @@ static int gb_spi_probe(struct gpbridge_device *gpbdev, ...@@ -49,27 +49,27 @@ static int gb_spi_probe(struct gpbridge_device *gpbdev,
return ret; return ret;
} }
static void gb_spi_remove(struct gpbridge_device *gpbdev) static void gb_spi_remove(struct gbphy_device *gbphy_dev)
{ {
struct gb_connection *connection = gb_gpbridge_get_data(gpbdev); struct gb_connection *connection = gb_gbphy_get_data(gbphy_dev);
gb_spilib_master_exit(connection); gb_spilib_master_exit(connection);
gb_connection_disable(connection); gb_connection_disable(connection);
gb_connection_destroy(connection); gb_connection_destroy(connection);
} }
static const struct gpbridge_device_id gb_spi_id_table[] = { static const struct gbphy_device_id gb_spi_id_table[] = {
{ GPBRIDGE_PROTOCOL(GREYBUS_PROTOCOL_SPI) }, { GBPHY_PROTOCOL(GREYBUS_PROTOCOL_SPI) },
{ }, { },
}; };
MODULE_DEVICE_TABLE(gpbridge, gb_spi_id_table); MODULE_DEVICE_TABLE(gbphy, gb_spi_id_table);
static struct gpbridge_driver spi_driver = { static struct gbphy_driver spi_driver = {
.name = "spi", .name = "spi",
.probe = gb_spi_probe, .probe = gb_spi_probe,
.remove = gb_spi_remove, .remove = gb_spi_remove,
.id_table = gb_spi_id_table, .id_table = gb_spi_id_table,
}; };
module_gpbridge_driver(spi_driver); module_gbphy_driver(spi_driver);
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include <linux/kdev_t.h> #include <linux/kdev_t.h>
#include "greybus.h" #include "greybus.h"
#include "gpbridge.h" #include "gbphy.h"
#define GB_NUM_MINORS 16 /* 16 is is more than enough */ #define GB_NUM_MINORS 16 /* 16 is is more than enough */
#define GB_NAME "ttyGB" #define GB_NAME "ttyGB"
...@@ -42,7 +42,7 @@ struct gb_tty_line_coding { ...@@ -42,7 +42,7 @@ struct gb_tty_line_coding {
}; };
struct gb_tty { struct gb_tty {
struct gpbridge_device *gpbdev; struct gbphy_device *gbphy_dev;
struct tty_port port; struct tty_port port;
void *buffer; void *buffer;
size_t buffer_payload_max; size_t buffer_payload_max;
...@@ -78,7 +78,7 @@ static int gb_uart_receive_data_handler(struct gb_operation *op) ...@@ -78,7 +78,7 @@ static int gb_uart_receive_data_handler(struct gb_operation *op)
unsigned long tty_flags = TTY_NORMAL; unsigned long tty_flags = TTY_NORMAL;
if (request->payload_size < sizeof(*receive_data)) { if (request->payload_size < sizeof(*receive_data)) {
dev_err(&gb_tty->gpbdev->dev, dev_err(&gb_tty->gbphy_dev->dev,
"short receive-data request received (%zu < %zu)\n", "short receive-data request received (%zu < %zu)\n",
request->payload_size, sizeof(*receive_data)); request->payload_size, sizeof(*receive_data));
return -EINVAL; return -EINVAL;
...@@ -88,7 +88,7 @@ static int gb_uart_receive_data_handler(struct gb_operation *op) ...@@ -88,7 +88,7 @@ static int gb_uart_receive_data_handler(struct gb_operation *op)
recv_data_size = le16_to_cpu(receive_data->size); recv_data_size = le16_to_cpu(receive_data->size);
if (recv_data_size != request->payload_size - sizeof(*receive_data)) { if (recv_data_size != request->payload_size - sizeof(*receive_data)) {
dev_err(&gb_tty->gpbdev->dev, dev_err(&gb_tty->gbphy_dev->dev,
"malformed receive-data request received (%u != %zu)\n", "malformed receive-data request received (%u != %zu)\n",
recv_data_size, recv_data_size,
request->payload_size - sizeof(*receive_data)); request->payload_size - sizeof(*receive_data));
...@@ -113,7 +113,7 @@ static int gb_uart_receive_data_handler(struct gb_operation *op) ...@@ -113,7 +113,7 @@ static int gb_uart_receive_data_handler(struct gb_operation *op)
count = tty_insert_flip_string_fixed_flag(port, receive_data->data, count = tty_insert_flip_string_fixed_flag(port, receive_data->data,
tty_flags, recv_data_size); tty_flags, recv_data_size);
if (count != recv_data_size) { if (count != recv_data_size) {
dev_err(&gb_tty->gpbdev->dev, dev_err(&gb_tty->gbphy_dev->dev,
"UART: RX 0x%08x bytes only wrote 0x%08x\n", "UART: RX 0x%08x bytes only wrote 0x%08x\n",
recv_data_size, count); recv_data_size, count);
} }
...@@ -130,7 +130,7 @@ static int gb_uart_serial_state_handler(struct gb_operation *op) ...@@ -130,7 +130,7 @@ static int gb_uart_serial_state_handler(struct gb_operation *op)
struct gb_uart_serial_state_request *serial_state; struct gb_uart_serial_state_request *serial_state;
if (request->payload_size < sizeof(*serial_state)) { if (request->payload_size < sizeof(*serial_state)) {
dev_err(&gb_tty->gpbdev->dev, dev_err(&gb_tty->gbphy_dev->dev,
"short serial-state event received (%zu < %zu)\n", "short serial-state event received (%zu < %zu)\n",
request->payload_size, sizeof(*serial_state)); request->payload_size, sizeof(*serial_state));
return -EINVAL; return -EINVAL;
...@@ -157,7 +157,7 @@ static int gb_uart_request_handler(struct gb_operation *op) ...@@ -157,7 +157,7 @@ static int gb_uart_request_handler(struct gb_operation *op)
ret = gb_uart_serial_state_handler(op); ret = gb_uart_serial_state_handler(op);
break; break;
default: default:
dev_err(&gb_tty->gpbdev->dev, dev_err(&gb_tty->gbphy_dev->dev,
"unsupported unsolicited request: 0x%02x\n", type); "unsupported unsolicited request: 0x%02x\n", type);
ret = -EINVAL; ret = -EINVAL;
} }
...@@ -211,7 +211,7 @@ static int send_break(struct gb_tty *gb_tty, u8 state) ...@@ -211,7 +211,7 @@ static int send_break(struct gb_tty *gb_tty, u8 state)
struct gb_uart_set_break_request request; struct gb_uart_set_break_request request;
if ((state != 0) && (state != 1)) { if ((state != 0) && (state != 1)) {
dev_err(&gb_tty->gpbdev->dev, dev_err(&gb_tty->gbphy_dev->dev,
"invalid break state of %d\n", state); "invalid break state of %d\n", state);
return -EINVAL; return -EINVAL;
} }
...@@ -619,8 +619,8 @@ static const struct tty_operations gb_ops = { ...@@ -619,8 +619,8 @@ static const struct tty_operations gb_ops = {
static struct tty_port_operations null_ops = { }; static struct tty_port_operations null_ops = { };
static int gb_uart_probe(struct gpbridge_device *gpbdev, static int gb_uart_probe(struct gbphy_device *gbphy_dev,
const struct gpbridge_device_id *id) const struct gbphy_device_id *id)
{ {
struct gb_connection *connection; struct gb_connection *connection;
size_t max_payload; size_t max_payload;
...@@ -633,8 +633,8 @@ static int gb_uart_probe(struct gpbridge_device *gpbdev, ...@@ -633,8 +633,8 @@ static int gb_uart_probe(struct gpbridge_device *gpbdev,
if (!gb_tty) if (!gb_tty)
return -ENOMEM; return -ENOMEM;
connection = gb_connection_create(gpbdev->bundle, connection = gb_connection_create(gbphy_dev->bundle,
le16_to_cpu(gpbdev->cport_desc->id), le16_to_cpu(gbphy_dev->cport_desc->id),
gb_uart_request_handler); gb_uart_request_handler);
if (IS_ERR(connection)) { if (IS_ERR(connection)) {
retval = PTR_ERR(connection); retval = PTR_ERR(connection);
...@@ -678,15 +678,15 @@ static int gb_uart_probe(struct gpbridge_device *gpbdev, ...@@ -678,15 +678,15 @@ static int gb_uart_probe(struct gpbridge_device *gpbdev,
gb_tty->port.ops = &null_ops; gb_tty->port.ops = &null_ops;
gb_tty->connection = connection; gb_tty->connection = connection;
gb_tty->gpbdev = gpbdev; gb_tty->gbphy_dev = gbphy_dev;
gb_connection_set_data(connection, gb_tty); gb_connection_set_data(connection, gb_tty);
gb_gpbridge_set_data(gpbdev, gb_tty); gb_gbphy_set_data(gbphy_dev, gb_tty);
retval = gb_connection_enable_tx(connection); retval = gb_connection_enable_tx(connection);
if (retval) if (retval)
goto exit_release_minor; goto exit_release_minor;
retval = gb_gpbridge_get_version(connection); retval = gb_gbphy_get_version(connection);
if (retval) if (retval)
goto exit_connection_disable; goto exit_connection_disable;
...@@ -704,7 +704,7 @@ static int gb_uart_probe(struct gpbridge_device *gpbdev, ...@@ -704,7 +704,7 @@ static int gb_uart_probe(struct gpbridge_device *gpbdev,
goto exit_connection_disable; goto exit_connection_disable;
tty_dev = tty_port_register_device(&gb_tty->port, gb_tty_driver, minor, tty_dev = tty_port_register_device(&gb_tty->port, gb_tty_driver, minor,
&gpbdev->dev); &gbphy_dev->dev);
if (IS_ERR(tty_dev)) { if (IS_ERR(tty_dev)) {
retval = PTR_ERR(tty_dev); retval = PTR_ERR(tty_dev);
goto exit_connection_disable; goto exit_connection_disable;
...@@ -727,9 +727,9 @@ static int gb_uart_probe(struct gpbridge_device *gpbdev, ...@@ -727,9 +727,9 @@ static int gb_uart_probe(struct gpbridge_device *gpbdev,
return retval; return retval;
} }
static void gb_uart_remove(struct gpbridge_device *gpbdev) static void gb_uart_remove(struct gbphy_device *gbphy_dev)
{ {
struct gb_tty *gb_tty = gb_gpbridge_get_data(gpbdev); struct gb_tty *gb_tty = gb_gbphy_get_data(gbphy_dev);
struct gb_connection *connection = gb_tty->connection; struct gb_connection *connection = gb_tty->connection;
struct tty_struct *tty; struct tty_struct *tty;
...@@ -800,13 +800,13 @@ static void gb_tty_exit(void) ...@@ -800,13 +800,13 @@ static void gb_tty_exit(void)
idr_destroy(&tty_minors); idr_destroy(&tty_minors);
} }
static const struct gpbridge_device_id gb_uart_id_table[] = { static const struct gbphy_device_id gb_uart_id_table[] = {
{ GPBRIDGE_PROTOCOL(GREYBUS_PROTOCOL_UART) }, { GBPHY_PROTOCOL(GREYBUS_PROTOCOL_UART) },
{ }, { },
}; };
MODULE_DEVICE_TABLE(gpbridge, gb_uart_id_table); MODULE_DEVICE_TABLE(gbphy, gb_uart_id_table);
static struct gpbridge_driver uart_driver = { static struct gbphy_driver uart_driver = {
.name = "uart", .name = "uart",
.probe = gb_uart_probe, .probe = gb_uart_probe,
.remove = gb_uart_remove, .remove = gb_uart_remove,
...@@ -821,7 +821,7 @@ static int gb_uart_driver_init(void) ...@@ -821,7 +821,7 @@ static int gb_uart_driver_init(void)
if (ret) if (ret)
return ret; return ret;
ret = gb_gpbridge_register(&uart_driver); ret = gb_gbphy_register(&uart_driver);
if (ret) { if (ret) {
gb_tty_exit(); gb_tty_exit();
return ret; return ret;
...@@ -833,7 +833,7 @@ module_init(gb_uart_driver_init); ...@@ -833,7 +833,7 @@ module_init(gb_uart_driver_init);
static void gb_uart_driver_exit(void) static void gb_uart_driver_exit(void)
{ {
gb_gpbridge_deregister(&uart_driver); gb_gbphy_deregister(&uart_driver);
gb_tty_exit(); gb_tty_exit();
} }
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include <linux/usb/hcd.h> #include <linux/usb/hcd.h>
#include "greybus.h" #include "greybus.h"
#include "gpbridge.h" #include "gbphy.h"
/* Version of the Greybus USB protocol we support */ /* Version of the Greybus USB protocol we support */
#define GB_USB_VERSION_MAJOR 0x00 #define GB_USB_VERSION_MAJOR 0x00
...@@ -38,7 +38,7 @@ struct gb_usb_hub_control_response { ...@@ -38,7 +38,7 @@ struct gb_usb_hub_control_response {
struct gb_usb_device { struct gb_usb_device {
struct gb_connection *connection; struct gb_connection *connection;
struct gpbridge_device *gpbdev; struct gbphy_device *gbphy_dev;
}; };
static inline struct gb_usb_device *to_gb_usb_device(struct usb_hcd *hcd) static inline struct gb_usb_device *to_gb_usb_device(struct usb_hcd *hcd)
...@@ -59,7 +59,7 @@ static void hcd_stop(struct usb_hcd *hcd) ...@@ -59,7 +59,7 @@ static void hcd_stop(struct usb_hcd *hcd)
ret = gb_operation_sync(dev->connection, GB_USB_TYPE_HCD_STOP, ret = gb_operation_sync(dev->connection, GB_USB_TYPE_HCD_STOP,
NULL, 0, NULL, 0); NULL, 0, NULL, 0);
if (ret) if (ret)
dev_err(&dev->gpbdev->dev, "HCD stop failed '%d'\n", ret); dev_err(&dev->gbphy_dev->dev, "HCD stop failed '%d'\n", ret);
} }
static int hcd_start(struct usb_hcd *hcd) static int hcd_start(struct usb_hcd *hcd)
...@@ -71,7 +71,7 @@ static int hcd_start(struct usb_hcd *hcd) ...@@ -71,7 +71,7 @@ static int hcd_start(struct usb_hcd *hcd)
ret = gb_operation_sync(dev->connection, GB_USB_TYPE_HCD_START, ret = gb_operation_sync(dev->connection, GB_USB_TYPE_HCD_START,
NULL, 0, NULL, 0); NULL, 0, NULL, 0);
if (ret) { if (ret) {
dev_err(&dev->gpbdev->dev, "HCD start failed '%d'\n", ret); dev_err(&dev->gbphy_dev->dev, "HCD start failed '%d'\n", ret);
return ret; return ret;
} }
...@@ -161,11 +161,11 @@ static struct hc_driver usb_gb_hc_driver = { ...@@ -161,11 +161,11 @@ static struct hc_driver usb_gb_hc_driver = {
.hub_control = hub_control, .hub_control = hub_control,
}; };
static int gb_usb_probe(struct gpbridge_device *gpbdev, static int gb_usb_probe(struct gbphy_device *gbphy_dev,
const struct gpbridge_device_id *id) const struct gbphy_device_id *id)
{ {
struct gb_connection *connection; struct gb_connection *connection;
struct device *dev = &gpbdev->dev; struct device *dev = &gbphy_dev->dev;
struct gb_usb_device *gb_usb_dev; struct gb_usb_device *gb_usb_dev;
struct usb_hcd *hcd; struct usb_hcd *hcd;
int retval; int retval;
...@@ -174,8 +174,8 @@ static int gb_usb_probe(struct gpbridge_device *gpbdev, ...@@ -174,8 +174,8 @@ static int gb_usb_probe(struct gpbridge_device *gpbdev,
if (!hcd) if (!hcd)
return -ENOMEM; return -ENOMEM;
connection = gb_connection_create(gpbdev->bundle, connection = gb_connection_create(gbphy_dev->bundle,
le16_to_cpu(gpbdev->cport_desc->id), le16_to_cpu(gbphy_dev->cport_desc->id),
NULL); NULL);
if (IS_ERR(connection)) { if (IS_ERR(connection)) {
retval = PTR_ERR(connection); retval = PTR_ERR(connection);
...@@ -185,8 +185,8 @@ static int gb_usb_probe(struct gpbridge_device *gpbdev, ...@@ -185,8 +185,8 @@ static int gb_usb_probe(struct gpbridge_device *gpbdev,
gb_usb_dev = to_gb_usb_device(hcd); gb_usb_dev = to_gb_usb_device(hcd);
gb_usb_dev->connection = connection; gb_usb_dev->connection = connection;
gb_connection_set_data(connection, gb_usb_dev); gb_connection_set_data(connection, gb_usb_dev);
gb_usb_dev->gpbdev = gpbdev; gb_usb_dev->gbphy_dev = gbphy_dev;
gb_gpbridge_set_data(gpbdev, gb_usb_dev); gb_gbphy_set_data(gbphy_dev, gb_usb_dev);
hcd->has_tt = 1; hcd->has_tt = 1;
...@@ -194,7 +194,7 @@ static int gb_usb_probe(struct gpbridge_device *gpbdev, ...@@ -194,7 +194,7 @@ static int gb_usb_probe(struct gpbridge_device *gpbdev,
if (retval) if (retval)
goto exit_connection_destroy; goto exit_connection_destroy;
retval = gb_gpbridge_get_version(connection); retval = gb_gbphy_get_version(connection);
if (retval) if (retval)
goto exit_connection_disable; goto exit_connection_disable;
...@@ -226,9 +226,9 @@ static int gb_usb_probe(struct gpbridge_device *gpbdev, ...@@ -226,9 +226,9 @@ static int gb_usb_probe(struct gpbridge_device *gpbdev,
return retval; return retval;
} }
static void gb_usb_remove(struct gpbridge_device *gpbdev) static void gb_usb_remove(struct gbphy_device *gbphy_dev)
{ {
struct gb_usb_device *gb_usb_dev = gb_gpbridge_get_data(gpbdev); struct gb_usb_device *gb_usb_dev = gb_gbphy_get_data(gbphy_dev);
struct gb_connection *connection = gb_usb_dev->connection; struct gb_connection *connection = gb_usb_dev->connection;
struct usb_hcd *hcd = gb_usb_device_to_hcd(gb_usb_dev); struct usb_hcd *hcd = gb_usb_device_to_hcd(gb_usb_dev);
...@@ -238,18 +238,18 @@ static void gb_usb_remove(struct gpbridge_device *gpbdev) ...@@ -238,18 +238,18 @@ static void gb_usb_remove(struct gpbridge_device *gpbdev)
usb_put_hcd(hcd); usb_put_hcd(hcd);
} }
static const struct gpbridge_device_id gb_usb_id_table[] = { static const struct gbphy_device_id gb_usb_id_table[] = {
{ GPBRIDGE_PROTOCOL(GREYBUS_PROTOCOL_USB) }, { GBPHY_PROTOCOL(GREYBUS_PROTOCOL_USB) },
{ }, { },
}; };
MODULE_DEVICE_TABLE(gpbridge, gb_usb_id_table); MODULE_DEVICE_TABLE(gbphy, gb_usb_id_table);
static struct gpbridge_driver usb_driver = { static struct gbphy_driver usb_driver = {
.name = "usb", .name = "usb",
.probe = gb_usb_probe, .probe = gb_usb_probe,
.remove = gb_usb_remove, .remove = gb_usb_remove,
.id_table = gb_usb_id_table, .id_table = gb_usb_id_table,
}; };
module_gpbridge_driver(usb_driver); module_gbphy_driver(usb_driver);
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment