]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
serial: UniPhier: support OF configuration
authorMasahiro Yamada <yamada.m@jp.panasonic.com>
Wed, 26 Nov 2014 09:34:00 +0000 (18:34 +0900)
committerMasahiro Yamada <yamada.m@jp.panasonic.com>
Thu, 27 Nov 2014 17:21:01 +0000 (02:21 +0900)
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>
arch/arm/dts/uniphier-ph1-ld4-ref.dts
arch/arm/dts/uniphier-ph1-ld4.dtsi
arch/arm/dts/uniphier-ph1-pro4-ref.dts
arch/arm/dts/uniphier-ph1-pro4.dtsi
arch/arm/dts/uniphier-ph1-sld8-ref.dts
arch/arm/dts/uniphier-ph1-sld8.dtsi
drivers/serial/serial_uniphier.c

index bc8ead4fdab104ee70bd26e6ab322dc5c4929a0d..20b05831432923fa96a079adcf60c37cf5105173 100644 (file)
 
        chosen {
                bootargs = "console=ttyPS0,115200 earlyprintk";
+               stdout-path = &uart0;
        };
 };
+
+&uart0 {
+       status = "okay";
+};
+
+&uart1 {
+       status = "okay";
+};
index ee53d9c194457dde1e1c7e99d2255b7115cd708c..c1c2c62b7991c2c7d45db93305d8a531ee3b95e3 100644 (file)
                #address-cells = <1>;
                #size-cells = <1>;
                ranges;
+
+               uart0: serial@54006800 {
+                       compatible = "panasonic,uniphier-uart";
+                       status = "disabled";
+                       reg = <0x54006800 0x20>;
+                       clock-frequency = <36864000>;
+               };
+
+               uart1: serial@54006900 {
+                       compatible = "panasonic,uniphier-uart";
+                       status = "disabled";
+                       reg = <0x54006900 0x20>;
+                       clock-frequency = <36864000>;
+               };
+
+               uart2: serial@54006a00 {
+                       compatible = "panasonic,uniphier-uart";
+                       status = "disabled";
+                       reg = <0x54006a00 0x20>;
+                       clock-frequency = <36864000>;
+               };
+
+               uart3: serial@54006b00 {
+                       compatible = "panasonic,uniphier-uart";
+                       status = "disabled";
+                       reg = <0x54006b00 0x20>;
+                       clock-frequency = <36864000>;
+               };
        };
 };
index 03091a897afabdc5aa8f843897c4738c77288d3f..b42c9c8098c7c796b1201e68409b482b96cf75dc 100644 (file)
 
        chosen {
                bootargs = "console=ttyPS0,115200 earlyprintk";
+               stdout-path = &uart0;
        };
 };
+
+&uart0 {
+       status = "okay";
+};
+
+&uart1 {
+       status = "okay";
+};
index 7619c36a2f2d3c381e953a8869aa5569c4a6cab6..b53fbc5161c520730b39a37c4235dc9aed20c3ce 100644 (file)
                #address-cells = <1>;
                #size-cells = <1>;
                ranges;
+
+               uart0: serial@54006800 {
+                       compatible = "panasonic,uniphier-uart";
+                       status = "disabled";
+                       reg = <0x54006800 0x20>;
+                       clock-frequency = <73728000>;
+               };
+
+               uart1: serial@54006900 {
+                       compatible = "panasonic,uniphier-uart";
+                       status = "disabled";
+                       reg = <0x54006900 0x20>;
+                       clock-frequency = <73728000>;
+               };
+
+               uart2: serial@54006a00 {
+                       compatible = "panasonic,uniphier-uart";
+                       status = "disabled";
+                       reg = <0x54006a00 0x20>;
+                       clock-frequency = <73728000>;
+               };
+
+               uart3: serial@54006b00 {
+                       compatible = "panasonic,uniphier-uart";
+                       status = "disabled";
+                       reg = <0x54006b00 0x20>;
+                       clock-frequency = <73728000>;
+               };
        };
 };
index e7969afe8c4c76664fcf9f2593a7fe123d00e830..6f898a3a9678f36a17ed6b05e84932ba402dd3b8 100644 (file)
 
        chosen {
                bootargs = "console=ttyPS0,115200 earlyprintk";
+               stdout-path = &uart0;
        };
 };
+
+&uart0 {
+       status = "okay";
+};
+
+&uart1 {
+       status = "okay";
+};
index 2f895e91dbc5a420a2211031826d941b309a82f7..9a8da5e4423cb1bceeca798b0d0c0f1865bd1029 100644 (file)
                #address-cells = <1>;
                #size-cells = <1>;
                ranges;
+
+               uart0: serial@54006800 {
+                       compatible = "panasonic,uniphier-uart";
+                       status = "disabled";
+                       reg = <0x54006800 0x20>;
+                       clock-frequency = <80000000>;
+               };
+
+               uart1: serial@54006900 {
+                       compatible = "panasonic,uniphier-uart";
+                       status = "disabled";
+                       reg = <0x54006900 0x20>;
+                       clock-frequency = <80000000>;
+               };
+
+               uart2: serial@54006a00 {
+                       compatible = "panasonic,uniphier-uart";
+                       status = "disabled";
+                       reg = <0x54006a00 0x20>;
+                       clock-frequency = <80000000>;
+               };
+
+               uart3: serial@54006b00 {
+                       compatible = "panasonic,uniphier-uart";
+                       status = "disabled";
+                       reg = <0x54006b00 0x20>;
+                       clock-frequency = <80000000>;
+               };
        };
 };
index 6046efb51fe87b8711bf7e4c13e007ead20e3647..e8a1608b9988c193c1c860795730ecced5b4c107 100644 (file)
@@ -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