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>
This commit is contained in:
Masahiro Yamada 2014-11-26 18:34:00 +09:00
parent 509eb67802
commit 625177d27e
7 changed files with 122 additions and 8 deletions

View file

@ -21,5 +21,14 @@
chosen { chosen {
bootargs = "console=ttyPS0,115200 earlyprintk"; bootargs = "console=ttyPS0,115200 earlyprintk";
stdout-path = &uart0;
}; };
}; };
&uart0 {
status = "okay";
};
&uart1 {
status = "okay";
};

View file

@ -28,5 +28,33 @@
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
ranges; 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>;
};
}; };
}; };

View file

@ -21,5 +21,14 @@
chosen { chosen {
bootargs = "console=ttyPS0,115200 earlyprintk"; bootargs = "console=ttyPS0,115200 earlyprintk";
stdout-path = &uart0;
}; };
}; };
&uart0 {
status = "okay";
};
&uart1 {
status = "okay";
};

View file

@ -34,5 +34,33 @@
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
ranges; 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>;
};
}; };
}; };

View file

@ -21,5 +21,14 @@
chosen { chosen {
bootargs = "console=ttyPS0,115200 earlyprintk"; bootargs = "console=ttyPS0,115200 earlyprintk";
stdout-path = &uart0;
}; };
}; };
&uart0 {
status = "okay";
};
&uart1 {
status = "okay";
};

View file

@ -28,5 +28,33 @@
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
ranges; 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>;
};
}; };
}; };

View file

@ -11,6 +11,7 @@
#include <dm/device.h> #include <dm/device.h>
#include <dm/platform_data/serial-uniphier.h> #include <dm/platform_data/serial-uniphier.h>
#include <serial.h> #include <serial.h>
#include <fdtdec.h>
#define UART_REG(x) \ #define UART_REG(x) \
u8 x; \ u8 x; \
@ -113,19 +114,21 @@ static int uniphier_serial_remove(struct udevice *dev)
} }
#ifdef CONFIG_OF_CONTROL #ifdef CONFIG_OF_CONTROL
static const struct udevice_id uniphier_uart_of_match = { static const struct udevice_id uniphier_uart_of_match[] = {
{ .compatible = "panasonic,uniphier-uart"}, { .compatible = "panasonic,uniphier-uart" },
{}, {},
}; };
static int uniphier_serial_ofdata_to_platdata(struct udevice *dev) static int uniphier_serial_ofdata_to_platdata(struct udevice *dev)
{ {
/* struct uniphier_serial_platform_data *plat = dev_get_platdata(dev);
* TODO: Masahiro Yamada (yamada.m@jp.panasonic.com) DECLARE_GLOBAL_DATA_PTR;
*
* Implement conversion code from DTB to platform data plat->base = fdtdec_get_addr(gd->fdt_blob, dev->of_offset, "reg");
* when supporting CONFIG_OF_CONTROL on UniPhir platform. plat->uartclk = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
*/ "clock-frequency", 0);
return 0;
} }
#endif #endif