mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kai-Heng Feng <kai.heng.feng@canonical.com>
To: linus.walleij@linaro.org
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Kai-Heng Feng <kai.heng.feng@canonical.com>
Subject: [PATCH] pinctrl: amd: don't load pinctrl-amd on Gigabyte AM4 boards
Date: Thu, 25 May 2017 12:00:06 +0800	[thread overview]
Message-ID: <20170525040006.22654-1-kai.heng.feng@canonical.com> (raw)

On Gigabyte AM4 boards, pinctrl-amd generates tons of irq, makes the
system not able to boot properly.

Don't load the module until Gigabyte fixes the issue.

BugLink: https://bugs.launchpad.net/bugs/1671360
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 drivers/pinctrl/pinctrl-amd.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c
index 1482d132fbb8..5b015d3552b8 100644
--- a/drivers/pinctrl/pinctrl-amd.c
+++ b/drivers/pinctrl/pinctrl-amd.c
@@ -29,6 +29,7 @@
 #include <linux/interrupt.h>
 #include <linux/list.h>
 #include <linux/bitops.h>
+#include <linux/dmi.h>
 #include <linux/pinctrl/pinconf.h>
 #include <linux/pinctrl/pinconf-generic.h>
 
@@ -739,6 +740,26 @@ static struct pinctrl_desc amd_pinctrl_desc = {
 	.owner = THIS_MODULE,
 };
 
+static bool amd_gpio_is_gigabyte_am4(void)
+{
+	const char *board_name;
+
+	if (!dmi_match(DMI_BOARD_VENDOR, "Gigabyte Technology Co., Ltd."))
+		return false;
+
+	board_name = dmi_get_system_info(DMI_BOARD_NAME);
+
+	if (!board_name)
+		return false;
+
+	if (strstr(board_name, "A320") ||
+		strstr(board_name, "B350") ||
+		strstr(board_name, "X370"))
+		return true;
+
+	return false;
+}
+
 static int amd_gpio_probe(struct platform_device *pdev)
 {
 	int ret = 0;
@@ -746,6 +767,10 @@ static int amd_gpio_probe(struct platform_device *pdev)
 	struct resource *res;
 	struct amd_gpio *gpio_dev;
 
+	/* Don't load this module if it's a Gigabyte AM4 board */
+	if (amd_gpio_is_gigabyte_am4())
+		return -ENODEV;
+
 	gpio_dev = devm_kzalloc(&pdev->dev,
 				sizeof(struct amd_gpio), GFP_KERNEL);
 	if (!gpio_dev)
-- 
2.13.0

             reply	other threads:[~2017-05-25  4:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-25  4:00 Kai-Heng Feng [this message]
2017-05-26 10:09 ` Thomas Gleixner
2017-05-26 10:18   ` Kai-Heng Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170525040006.22654-1-kai.heng.feng@canonical.com \
    --to=kai.heng.feng@canonical.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®