LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: John Garry <john.garry@huawei.com>
To: <xuwei5@huawei.com>, <mika.westerberg@linux.intel.com>,
<andriy.shevchenko@linux.intel.com>, <lee.jones@linaro.org>
Cc: <rjw@rjwysocki.net>, <linux-kernel@vger.kernel.org>,
<arnd@arndb.de>, <graeme.gregory@linaro.org>,
<helgaas@kernel.org>, <z.liuxinliang@hisilicon.com>,
<linuxarm@huawei.com>, John Garry <john.garry@huawei.com>
Subject: [PATCH 2/2] HISI LPC: Add ACPI UART support
Date: Thu, 3 May 2018 23:08:39 +0800 [thread overview]
Message-ID: <1525360119-102166-3-git-send-email-john.garry@huawei.com> (raw)
In-Reply-To: <1525360119-102166-1-git-send-email-john.garry@huawei.com>
On the Huawei D03 development board the system UART is
the UART connected on the LPC bus.
The profile for the device driver required for this HW
would be as follows:
- platform driver
- supports 16550
- supports ACPI
- supports polling mode
- supports IO space
In principle we should use the PNP driver (8250_dw.c) for
8250-devices with ACPI FW. However since this host driver
does not support PNP devices, and modifying the PNP core
code to support it is not worth the effort, use the generic
8250 isa driver.
For this, we need to setup the MFD cell platform data for
a serial 8250 Port.
In addition to this change, we also make the following
changes:
- set child ACPI device as enumerated. This fixes a conflict
in serdev setup for the UART
- use platform device ID auto for creating the uart child
platform device to avoid conflict with platform devices
created for serial8250_isa_devs from 8250_core.c
Signed-off-by: John Garry <john.garry@huawei.com>
---
drivers/bus/hisi_lpc.c | 41 ++++++++++++++++++++++++++++++++++++++++-
1 file changed, 40 insertions(+), 1 deletion(-)
diff --git a/drivers/bus/hisi_lpc.c b/drivers/bus/hisi_lpc.c
index 71693d77..b0ee2fa 100644
--- a/drivers/bus/hisi_lpc.c
+++ b/drivers/bus/hisi_lpc.c
@@ -17,6 +17,7 @@
#include <linux/of_address.h>
#include <linux/of_platform.h>
#include <linux/pci.h>
+#include <linux/serial_8250.h>
#include <linux/slab.h>
#define DRV_NAME "hisi-lpc"
@@ -362,6 +363,35 @@ static int hisi_lpc_acpi_xlat_io_res(struct acpi_device *adev,
.pnpid = "IPI0001",
};
+static const struct mfd_cell_acpi_match hisi_lpc_acpi_mfd_match_uart = {
+ .pnpid = "HISI1031",
+};
+
+static int hisi_lpc_acpi_uart_setup(struct device *hostdev,
+ struct mfd_cell *mfd_cell)
+{
+ const struct resource * const resource = mfd_cell->resources;
+ struct plat_serial8250_port ref_port[] = {
+ {
+ .iobase = resource->start,
+ .uartclk = 1843200,
+ .iotype = UPIO_PORT,
+ .flags = UPF_BOOT_AUTOCONF,
+ },
+ {}
+ };
+
+ mfd_cell->platform_data = devm_kmemdup(hostdev, &ref_port,
+ sizeof(ref_port), GFP_KERNEL);
+ if (!mfd_cell->platform_data)
+ return -ENOMEM;
+
+ mfd_cell->pdata_size = sizeof(ref_port);
+
+ return 0;
+}
+
+
struct hisi_lpc_acpi_mfd_cell {
struct mfd_cell mfd_cell;
int (*setup)(struct device *hostdev, struct mfd_cell *mfd_cell);
@@ -373,6 +403,14 @@ struct hisi_lpc_acpi_mfd_cell {
.acpi_match = &hisi_lpc_acpi_mfd_match_ipmi,
},
},
+ /* 8250-compatible uart */
+ {
+ .mfd_cell = {
+ .name = "serial8250",
+ .acpi_match = &hisi_lpc_acpi_mfd_match_uart,
+ },
+ .setup = hisi_lpc_acpi_uart_setup,
+ },
{}
};
@@ -530,10 +568,11 @@ static int hisi_lpc_acpi_probe(struct device *hostdev)
return ret;
}
+ acpi_device_set_enumerated(child);
count++;
}
- ret = mfd_add_devices(hostdev, PLATFORM_DEVID_NONE,
+ ret = mfd_add_devices(hostdev, PLATFORM_DEVID_AUTO,
mfd_cells, cell_num, NULL, 0, NULL);
if (ret) {
dev_err(hostdev, "failed to add mfd cells (%d)\n", ret);
--
1.9.1
next prev parent reply other threads:[~2018-05-03 15:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-03 15:08 [PATCH 0/2] HISI LPC " John Garry
2018-05-03 15:08 ` [PATCH 1/2] HISI LPC: Reference static MFD cells for ACPI support John Garry
2018-05-03 16:54 ` Andy Shevchenko
2018-05-04 9:02 ` Lee Jones
2018-05-04 9:27 ` John Garry
2018-05-04 10:03 ` Lee Jones
2018-05-04 10:21 ` John Garry
2018-05-04 12:29 ` John Garry
2018-05-03 15:08 ` John Garry [this message]
2018-05-03 16:56 ` [PATCH 2/2] HISI LPC: Add ACPI UART support Andy Shevchenko
2018-05-04 12:33 ` John Garry
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=1525360119-102166-3-git-send-email-john.garry@huawei.com \
--to=john.garry@huawei.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=arnd@arndb.de \
--cc=graeme.gregory@linaro.org \
--cc=helgaas@kernel.org \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=mika.westerberg@linux.intel.com \
--cc=rjw@rjwysocki.net \
--cc=xuwei5@huawei.com \
--cc=z.liuxinliang@hisilicon.com \
--subject='Re: [PATCH 2/2] HISI LPC: Add ACPI UART support' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).