From: Andy Shevchenko Date: Wed, 27 Oct 2021 11:28:09 +0000 (+0300) Subject: x86: tangier: Enable support for SD/SDIO family in the pinmux driver X-Git-Tag: v2025.01-rc5-pxa1908~1656^2~3 X-Git-Url: http://git.dujemihanovic.xyz/%7B%7B%20%24style.RelPermalink%20%7D%7D?a=commitdiff_plain;h=90cc2c5c64422d9ff004721f2c57f3643459424a;p=u-boot.git x86: tangier: Enable support for SD/SDIO family in the pinmux driver We would need to quirk out the Card Detect case and for that we allow configuring the SD/SDIO family of pins. Signed-off-by: Andy Shevchenko Reviewed-by: Bin Meng --- diff --git a/arch/x86/cpu/tangier/pinmux.c b/arch/x86/cpu/tangier/pinmux.c index acf97e3af5..8385167b2b 100644 --- a/arch/x86/cpu/tangier/pinmux.c +++ b/arch/x86/cpu/tangier/pinmux.c @@ -37,8 +37,9 @@ struct mrfld_family { .npins = (e) - (s) + 1, \ } -/* Now we only support I2C family of pins */ +/* Now we only support SD/SDIO and I2C families of pins */ static struct mrfld_family mrfld_families[] = { + MRFLD_FAMILY(3, 37, 56), MRFLD_FAMILY(7, 101, 114), }; @@ -125,6 +126,34 @@ static int mrfld_pinconfig_protected(unsigned int pin, u32 mask, u32 bits) return ret; } +static int mrfld_pinconfig(unsigned int pin, u32 mask, u32 bits) +{ + struct mrfld_pinctrl *pinctrl; + struct udevice *dev; + void __iomem *bufcfg; + u32 v, value; + int ret; + + ret = syscon_get_by_driver_data(X86_SYSCON_PINCONF, &dev); + if (ret) + return ret; + + pinctrl = dev_get_priv(dev); + + bufcfg = mrfld_get_bufcfg(pinctrl, pin); + if (!bufcfg) + return -EINVAL; + + value = readl(bufcfg); + v = (value & ~mask) | (bits & mask); + writel(v, bufcfg); + + debug("v: 0x%x p: 0x%x bits: %d, mask: %d bufcfg: 0x%p\n", + v, (u32)bufcfg, bits, mask, bufcfg); + + return 0; +} + static int mrfld_pinctrl_cfg_pin(ofnode pin_node) { bool is_protected; @@ -133,10 +162,7 @@ static int mrfld_pinctrl_cfg_pin(ofnode pin_node) u32 mask; int ret; - /* For now we only support just protected Family of pins */ is_protected = ofnode_read_bool(pin_node, "protected"); - if (!is_protected) - return -ENOTSUPP; pad_offset = ofnode_read_s32_default(pin_node, "pad-offset", -1); if (pad_offset == -1) @@ -152,7 +178,10 @@ static int mrfld_pinctrl_cfg_pin(ofnode pin_node) if (mode & ~mask) return -ENOTSUPP; - ret = mrfld_pinconfig_protected(pad_offset, mask, mode); + if (is_protected) + ret = mrfld_pinconfig_protected(pad_offset, mask, mode); + else + ret = mrfld_pinconfig(pad_offset, mask, mode); return ret; }