usb: renesas_usbhs: Add has_new_pipe_configs flag
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Tue, 25 Jun 2019 05:38:52 +0000 (14:38 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Jun 2019 02:33:08 +0000 (10:33 +0800)
In the future, each struct renesas_usbhs_driver_param is stored on
the each platform related source code (e.g. rcar3.c). So, to simplify
the source code, this patch adds a new flag has_new_pipe_configs.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/renesas_usbhs/common.c
include/linux/usb/renesas_usbhs.h

index 35b06e7..f9476a0 100644 (file)
@@ -529,8 +529,7 @@ static const struct usbhs_of_data rcar_gen2_data = {
        .platform_callback = &usbhs_rcar2_ops,
        .param = {
                .has_usb_dmac = 1,
-               .pipe_configs = usbhsc_new_pipe,
-               .pipe_size = ARRAY_SIZE(usbhsc_new_pipe),
+               .has_new_pipe_configs = 1,
        }
 };
 
@@ -539,8 +538,7 @@ static const struct usbhs_of_data rcar_gen3_data = {
        .param = {
                .has_usb_dmac = 1,
                .multi_clks = 1,
-               .pipe_configs = usbhsc_new_pipe,
-               .pipe_size = ARRAY_SIZE(usbhsc_new_pipe),
+               .has_new_pipe_configs = 1,
        }
 };
 
@@ -549,16 +547,14 @@ static const struct usbhs_of_data rcar_gen3_with_pll_data = {
        .param = {
                .has_usb_dmac = 1,
                .multi_clks = 1,
-               .pipe_configs = usbhsc_new_pipe,
-               .pipe_size = ARRAY_SIZE(usbhsc_new_pipe),
+               .has_new_pipe_configs = 1,
        }
 };
 
 static const struct usbhs_of_data rza1_data = {
        .platform_callback = &usbhs_rza1_ops,
        .param = {
-               .pipe_configs = usbhsc_new_pipe,
-               .pipe_size = ARRAY_SIZE(usbhsc_new_pipe),
+               .has_new_pipe_configs = 1,
        }
 };
 
@@ -567,8 +563,7 @@ static const struct usbhs_of_data rza2_data = {
        .param = {
                .has_cnen = 1,
                .cfifo_byte_addr = 1,
-               .pipe_configs = usbhsc_new_pipe,
-               .pipe_size = ARRAY_SIZE(usbhsc_new_pipe),
+               .has_new_pipe_configs = 1,
        }
 };
 
@@ -715,7 +710,10 @@ static int usbhs_probe(struct platform_device *pdev)
        priv->pfunc = info->platform_callback;
 
        /* set default param if platform doesn't have */
-       if (!priv->dparam.pipe_configs) {
+       if (usbhs_get_dparam(priv, has_new_pipe_configs)) {
+               priv->dparam.pipe_configs = usbhsc_new_pipe;
+               priv->dparam.pipe_size = ARRAY_SIZE(usbhsc_new_pipe);
+       } else if (!priv->dparam.pipe_configs) {
                priv->dparam.pipe_configs = usbhsc_default_pipe;
                priv->dparam.pipe_size = ARRAY_SIZE(usbhsc_default_pipe);
        }
index fee84b7..6914475 100644 (file)
@@ -181,6 +181,7 @@ struct renesas_usbhs_driver_param {
        u32 cfifo_byte_addr:1; /* CFIFO is byte addressable */
 #define USBHS_USB_DMAC_XFER_SIZE       32      /* hardcode the xfer size */
        u32 multi_clks:1;
+       u32 has_new_pipe_configs:1;
 };
 
 /*