]> git.karo-electronics.de Git - linux-beck.git/commitdiff
greybus: control: suppress bundle_activate() for bootrom
authorJohan Hovold <johan@hovoldconsulting.com>
Thu, 21 Jul 2016 12:24:11 +0000 (14:24 +0200)
committerGreg Kroah-Hartman <gregkh@google.com>
Thu, 21 Jul 2016 23:36:48 +0000 (16:36 -0700)
We always knew backward compatibility with the ES3 bootrom, which was
finalised about a year ago, would be a pain. Here we go again.

The bootrom does not support control requests added after it was burnt
into ROM for obvious reasons. This means that we need to suppress
sending the new bundle_activate() operation to any interface executing
the legacy bootrom.

Do so by adding a new NO_PM interface quirk (we can use the
control-protocol version for this later once we bump it).

Note that the interface-disable path (e.g. for power down) is already
handled by the FORCED_DISABLE quirk, and that the suspend/resume
paths are currently avoided by making sure that the bootrom bundle
never suspends.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Tested-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/control.c
drivers/staging/greybus/control.h
drivers/staging/greybus/interface.c
drivers/staging/greybus/interface.h

index 37a30b3075cefb363cc52e443ff7627eba4bfce5..a08a79da45d7d3f7a308e7fb77385fa4bc064059 100644 (file)
@@ -329,6 +329,9 @@ int gb_control_bundle_activate(struct gb_control *control, u8 bundle_id)
        struct gb_control_bundle_pm_response response;
        int ret;
 
+       if (!control->has_bundle_activate)
+               return 0;
+
        request.bundle_id = bundle_id;
        ret = gb_operation_sync(control->connection,
                                GB_CONTROL_TYPE_BUNDLE_ACTIVATE, &request,
@@ -528,6 +531,10 @@ int gb_control_enable(struct gb_control *control)
        if (control->protocol_major > 0 || control->protocol_minor > 1)
                control->has_bundle_version = true;
 
+       /* FIXME: use protocol version instead */
+       if (!(control->intf->quirks & GB_INTERFACE_QUIRK_NO_PM))
+               control->has_bundle_activate = true;
+
        return 0;
 
 err_disable_connection:
index f73ec3e297ba0570af88a323450d75920132c690..f9a60daf9a72e7d0bbd6e356fd64a48bb0d3730f 100644 (file)
@@ -19,6 +19,7 @@ struct gb_control {
        u8 protocol_major;
        u8 protocol_minor;
 
+       bool has_bundle_activate;
        bool has_bundle_version;
 
        char *vendor_string;
index 6abe1311058fb48c0c1df76fe510b85cc5dddda6..74fa298f5fe7978c7258d8906479df6aac063c48 100644 (file)
@@ -411,7 +411,8 @@ static int gb_interface_read_and_clear_init_status(struct gb_interface *intf)
         */
        bootrom_quirks = GB_INTERFACE_QUIRK_NO_CPORT_FEATURES |
                                GB_INTERFACE_QUIRK_FORCED_DISABLE |
-                               GB_INTERFACE_QUIRK_LEGACY_MODE_SWITCH;
+                               GB_INTERFACE_QUIRK_LEGACY_MODE_SWITCH |
+                               GB_INTERFACE_QUIRK_NO_PM;
        switch (init_status) {
        case GB_INIT_BOOTROM_UNIPRO_BOOT_STARTED:
        case GB_INIT_BOOTROM_FALLBACK_UNIPRO_BOOT_STARTED:
index daa9759149a5d1c6f4270a5967551c56f49e9c64..a08d104806540d6e6de0b83e20fba9ffec9f2a94 100644 (file)
@@ -23,6 +23,7 @@ enum gb_interface_type {
 #define GB_INTERFACE_QUIRK_NO_ARA_IDS                  BIT(2)
 #define GB_INTERFACE_QUIRK_FORCED_DISABLE              BIT(3)
 #define GB_INTERFACE_QUIRK_LEGACY_MODE_SWITCH          BIT(4)
+#define GB_INTERFACE_QUIRK_NO_PM                       BIT(5)
 
 struct gb_interface {
        struct device dev;