Skip to content

Commit

Permalink
pinctrl: sunrisepoint: Align GPIO number space with Windows
Browse files Browse the repository at this point in the history
It turns out that the Windows GPIO driver for Sunrisepoint PCH-H uses
similar bank structure than it does for Cannon Lake with the exception
that here the bank size is always 24 pins. Starting from pad group E the
BIOS/Windows GPIO numbering does not match the hardware anymore but
instead there are gaps to make each pad group ("bank") consume exactly
24 pins. Because of this Linux does not use correct pins for
GpioIo/GpioIo resources exposed by the BIOS.

This patch aligns the GPIO number space with BIOS/Windows to make sure
the same numbering scheme is used in Linux as well following what we did
already for Intel Cannon Lake.

Link: https://bugzilla.redhat.com/show_bug.cgi?id=1543769
Reported-by: Vivien FRASCA <vivien.frasca@gmail.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Mika Westerberg authored and Linus Walleij committed May 2, 2018
1 parent 83b9dc1 commit c41eb2c
Showing 1 changed file with 42 additions and 3 deletions.
45 changes: 42 additions & 3 deletions drivers/pinctrl/intel/pinctrl-sunrisepoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,27 @@
.npins = ((e) - (s) + 1), \
}

#define SPTH_GPP(r, s, e, g) \
{ \
.reg_num = (r), \
.base = (s), \
.size = ((e) - (s) + 1), \
.gpio_base = (g), \
}

#define SPTH_COMMUNITY(b, s, e, g) \
{ \
.barno = (b), \
.padown_offset = SPT_PAD_OWN, \
.padcfglock_offset = SPT_PADCFGLOCK, \
.hostown_offset = SPT_HOSTSW_OWN, \
.ie_offset = SPT_GPI_IE, \
.pin_base = (s), \
.npins = ((e) - (s) + 1), \
.gpps = (g), \
.ngpps = ARRAY_SIZE(g), \
}

/* Sunrisepoint-LP */
static const struct pinctrl_pin_desc sptlp_pins[] = {
/* GPP_A */
Expand Down Expand Up @@ -531,10 +552,28 @@ static const struct intel_function spth_functions[] = {
FUNCTION("i2c2", spth_i2c2_groups),
};

static const struct intel_padgroup spth_community0_gpps[] = {
SPTH_GPP(0, 0, 23, 0), /* GPP_A */
SPTH_GPP(1, 24, 47, 24), /* GPP_B */
};

static const struct intel_padgroup spth_community1_gpps[] = {
SPTH_GPP(0, 48, 71, 48), /* GPP_C */
SPTH_GPP(1, 72, 95, 72), /* GPP_D */
SPTH_GPP(2, 96, 108, 96), /* GPP_E */
SPTH_GPP(3, 109, 132, 120), /* GPP_F */
SPTH_GPP(4, 133, 156, 144), /* GPP_G */
SPTH_GPP(5, 157, 180, 168), /* GPP_H */
};

static const struct intel_padgroup spth_community3_gpps[] = {
SPTH_GPP(0, 181, 191, 192), /* GPP_I */
};

static const struct intel_community spth_communities[] = {
SPT_COMMUNITY(0, 0, 47),
SPT_COMMUNITY(1, 48, 180),
SPT_COMMUNITY(2, 181, 191),
SPTH_COMMUNITY(0, 0, 47, spth_community0_gpps),
SPTH_COMMUNITY(1, 48, 180, spth_community1_gpps),
SPTH_COMMUNITY(2, 181, 191, spth_community3_gpps),
};

static const struct intel_pinctrl_soc_data spth_soc_data = {
Expand Down

0 comments on commit c41eb2c

Please sign in to comment.