summaryrefslogtreecommitdiff
path: root/drivers/serial
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.m@jp.panasonic.com>2014-11-26 18:34:00 +0900
committerMasahiro Yamada <yamada.m@jp.panasonic.com>2014-11-28 02:21:01 +0900
commit625177d27ed9e91cb96c0221b8020f7e4d24bfb6 (patch)
tree5c850d2c035fda55616aa6594ccca6f0779dda18 /drivers/serial
parent509eb67802d5cdc2b2789f08ac9f2ba33d796872 (diff)
downloadu-boot-imx-625177d27ed9e91cb96c0221b8020f7e4d24bfb6.zip
u-boot-imx-625177d27ed9e91cb96c0221b8020f7e4d24bfb6.tar.gz
u-boot-imx-625177d27ed9e91cb96c0221b8020f7e4d24bfb6.tar.bz2
serial: UniPhier: support OF configuration
This commit implements the ofdata_to_platdata handler for the UniPhier serial driver and adds serial device nodes to the device tree sources. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/serial_uniphier.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/serial/serial_uniphier.c b/drivers/serial/serial_uniphier.c
index 6046efb..e8a1608 100644
--- a/drivers/serial/serial_uniphier.c
+++ b/drivers/serial/serial_uniphier.c
@@ -11,6 +11,7 @@
#include <dm/device.h>
#include <dm/platform_data/serial-uniphier.h>
#include <serial.h>
+#include <fdtdec.h>
#define UART_REG(x) \
u8 x; \
@@ -113,19 +114,21 @@ static int uniphier_serial_remove(struct udevice *dev)
}
#ifdef CONFIG_OF_CONTROL
-static const struct udevice_id uniphier_uart_of_match = {
- { .compatible = "panasonic,uniphier-uart"},
+static const struct udevice_id uniphier_uart_of_match[] = {
+ { .compatible = "panasonic,uniphier-uart" },
{},
};
static int uniphier_serial_ofdata_to_platdata(struct udevice *dev)
{
- /*
- * TODO: Masahiro Yamada (yamada.m@jp.panasonic.com)
- *
- * Implement conversion code from DTB to platform data
- * when supporting CONFIG_OF_CONTROL on UniPhir platform.
- */
+ struct uniphier_serial_platform_data *plat = dev_get_platdata(dev);
+ DECLARE_GLOBAL_DATA_PTR;
+
+ plat->base = fdtdec_get_addr(gd->fdt_blob, dev->of_offset, "reg");
+ plat->uartclk = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+ "clock-frequency", 0);
+
+ return 0;
}
#endif