<p>Julius Werner has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/20586">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">rockchip/rk3399: Adjust gpio_t format to match ARM TF<br><br>Our structure packing for Rockchip's gpio_t was chosen arbitrarily. ARM<br>Trusted Firmware has since become a thing and chosen a slightly<br>different way to represent GPIOs in a 32-bit word. Let's align our<br>format to them so we don't need to remember to convert the values every<br>time we pass them through.<br><br>CQ-DEPEND=CL:572228<br><br>Change-Id: I9ce33da28ee8a34d2d944bee010d8bfc06fe879b<br>Signed-off-by: Julius Werner <jwerner@chromium.org><br>---<br>M src/mainboard/google/gru/mainboard.c<br>M src/soc/rockchip/common/include/soc/gpio.h<br>2 files changed, 11 insertions(+), 13 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/86/20586/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/src/mainboard/google/gru/mainboard.c b/src/mainboard/google/gru/mainboard.c<br>index 099a3d9..fa127ed 100644<br>--- a/src/mainboard/google/gru/mainboard.c<br>+++ b/src/mainboard/google/gru/mainboard.c<br>@@ -99,7 +99,7 @@<br>                        .polarity = BL31_GPIO_LEVEL_LOW,<br>              },<br>    };<br>-   param_p15_en.gpio.index = GET_GPIO_NUM(GPIO_P15V_EN);<br>+        param_p15_en.gpio.index = GPIO_P15V_EN.raw;<br>   register_bl31_param(&param_p15_en.h);<br> <br>  static struct bl31_gpio_param param_p18_audio_en = {<br>@@ -110,7 +110,7 @@<br>                     .polarity = BL31_GPIO_LEVEL_LOW,<br>              },<br>    };<br>-   param_p18_audio_en.gpio.index = GET_GPIO_NUM(GPIO_P18V_AUDIO_PWREN);<br>+ param_p18_audio_en.gpio.index = GPIO_P18V_AUDIO_PWREN.raw;<br>    register_bl31_param(&param_p18_audio_en.h);<br> <br>    static struct bl31_gpio_param param_p30_en = {<br>@@ -121,7 +121,7 @@<br>                   .polarity = BL31_GPIO_LEVEL_LOW,<br>              },<br>    };<br>-   param_p30_en.gpio.index = GET_GPIO_NUM(GPIO_P30V_EN);<br>+        param_p30_en.gpio.index = GPIO_P30V_EN.raw;<br>   register_bl31_param(&param_p30_en.h);<br> }<br> <br>@@ -137,7 +137,7 @@<br>         };<br> <br>         /* gru/kevin reset pin: gpio0b3 */<br>-   param_reset.gpio.index = GET_GPIO_NUM(GPIO_RESET),<br>+   param_reset.gpio.index = GPIO_RESET.raw,<br> <br>   register_bl31_param(&param_reset.h);<br> }<br>@@ -158,7 +158,7 @@<br>      * reuse with tsadc int pin, so iomux need set back to<br>         * gpio in BL31 and depthcharge before you setting this gpio<br>   */<br>-  param_poweroff.gpio.index = GET_GPIO_NUM(GPIO_POWEROFF),<br>+     param_poweroff.gpio.index = GPIO_POWEROFF.raw,<br> <br>     register_bl31_param(&param_poweroff.h);<br> }<br>diff --git a/src/soc/rockchip/common/include/soc/gpio.h b/src/soc/rockchip/common/include/soc/gpio.h<br>index 4c1cfa0..fbe593b 100644<br>--- a/src/soc/rockchip/common/include/soc/gpio.h<br>+++ b/src/soc/rockchip/common/include/soc/gpio.h<br>@@ -19,8 +19,6 @@<br> #include <types.h><br> <br> #define GPIO(p, b, i) ((gpio_t){.port = p, .bank = GPIO_##b, .idx = i})<br>-#define GET_GPIO_NUM(gpio)        (gpio.port * 32 + gpio.bank * 8 + gpio.idx)<br>-<br> <br> struct rockchip_gpio_regs {<br>       u32 swporta_dr;<br>@@ -43,16 +41,16 @@<br> typedef union {<br>        u32 raw;<br>      struct {<br>-             u16 port;<br>             union {<br>                       struct {<br>-                             u16 num : 5;<br>-                         u16 reserved1 : 11;<br>+                          u32 num : 5;<br>+                         u32 reserved1 : 27;<br>                   };<br>                    struct {<br>-                             u16 idx : 3;<br>-                         u16 bank : 2;<br>-                                u16 reserved2 : 11;<br>+                          u32 idx : 3;<br>+                         u32 bank : 2;<br>+                                u32 port : 3;<br>+                                u32 reserved2 : 24;<br>                   };<br>            };<br>    };<br></pre><p>To view, visit <a href="https://review.coreboot.org/20586">change 20586</a>. To unsubscribe, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/20586"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I9ce33da28ee8a34d2d944bee010d8bfc06fe879b </div>
<div style="display:none"> Gerrit-Change-Number: 20586 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Julius Werner <jwerner@chromium.org> </div>