diff options
| author | Bartosz Golaszewski <bgolaszewski@baylibre.com> | 2017-01-30 05:02:03 -0500 |
|---|---|---|
| committer | Sekhar Nori <nsekhar@ti.com> | 2017-01-31 10:18:24 -0500 |
| commit | 00bacfbfaf508940fd5fba22372a0935c4a01358 (patch) | |
| tree | 7eff288b50a24f01e7ccd22f828c51d843490480 | |
| parent | 8ba0f6caa41c0786b964dcf75ab74bb05c726ec3 (diff) | |
ARM: davinci: da850: model the SATA refclk
Register a fixed rate clock modelling the external SATA oscillator
for da850 (both DT and board file mode).
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
| -rw-r--r-- | arch/arm/mach-davinci/da8xx-dt.c | 8 | ||||
| -rw-r--r-- | arch/arm/mach-davinci/devices-da8xx.c | 29 | ||||
| -rw-r--r-- | arch/arm/mach-davinci/include/mach/da8xx.h | 1 |
3 files changed, 38 insertions, 0 deletions
diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c index 62c3d5174d4a..071933b16a0c 100644 --- a/arch/arm/mach-davinci/da8xx-dt.c +++ b/arch/arm/mach-davinci/da8xx-dt.c | |||
| @@ -50,6 +50,9 @@ static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = { | |||
| 50 | 50 | ||
| 51 | static void __init da850_init_machine(void) | 51 | static void __init da850_init_machine(void) |
| 52 | { | 52 | { |
| 53 | /* All existing boards use 100MHz SATA refclkpn */ | ||
| 54 | static const unsigned long sata_refclkpn = 100 * 1000 * 1000; | ||
| 55 | |||
| 53 | int ret; | 56 | int ret; |
| 54 | 57 | ||
| 55 | ret = da8xx_register_usb20_phy_clk(false); | 58 | ret = da8xx_register_usb20_phy_clk(false); |
| @@ -61,6 +64,11 @@ static void __init da850_init_machine(void) | |||
| 61 | pr_warn("%s: registering USB 1.1 PHY clock failed: %d", | 64 | pr_warn("%s: registering USB 1.1 PHY clock failed: %d", |
| 62 | __func__, ret); | 65 | __func__, ret); |
| 63 | 66 | ||
| 67 | ret = da850_register_sata_refclk(sata_refclkpn); | ||
| 68 | if (ret) | ||
| 69 | pr_warn("%s: registering SATA REFCLK failed: %d", | ||
| 70 | __func__, ret); | ||
| 71 | |||
| 64 | of_platform_default_populate(NULL, da850_auxdata_lookup, NULL); | 72 | of_platform_default_populate(NULL, da850_auxdata_lookup, NULL); |
| 65 | davinci_pm_init(); | 73 | davinci_pm_init(); |
| 66 | pdata_quirks_init(); | 74 | pdata_quirks_init(); |
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c index c2457b3fdb5f..cfceb326a39b 100644 --- a/arch/arm/mach-davinci/devices-da8xx.c +++ b/arch/arm/mach-davinci/devices-da8xx.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include <mach/common.h> | 24 | #include <mach/common.h> |
| 25 | #include <mach/time.h> | 25 | #include <mach/time.h> |
| 26 | #include <mach/da8xx.h> | 26 | #include <mach/da8xx.h> |
| 27 | #include <mach/clock.h> | ||
| 27 | #include "cpuidle.h" | 28 | #include "cpuidle.h" |
| 28 | #include "sram.h" | 29 | #include "sram.h" |
| 29 | 30 | ||
| @@ -1023,6 +1024,28 @@ int __init da8xx_register_spi_bus(int instance, unsigned num_chipselect) | |||
| 1023 | } | 1024 | } |
| 1024 | 1025 | ||
| 1025 | #ifdef CONFIG_ARCH_DAVINCI_DA850 | 1026 | #ifdef CONFIG_ARCH_DAVINCI_DA850 |
| 1027 | static struct clk sata_refclk = { | ||
| 1028 | .name = "sata_refclk", | ||
| 1029 | .set_rate = davinci_simple_set_rate, | ||
| 1030 | }; | ||
| 1031 | |||
| 1032 | static struct clk_lookup sata_refclk_lookup = | ||
| 1033 | CLK("ahci_da850", "refclk", &sata_refclk); | ||
| 1034 | |||
| 1035 | int __init da850_register_sata_refclk(int rate) | ||
| 1036 | { | ||
| 1037 | int ret; | ||
| 1038 | |||
| 1039 | sata_refclk.rate = rate; | ||
| 1040 | ret = clk_register(&sata_refclk); | ||
| 1041 | if (ret) | ||
| 1042 | return ret; | ||
| 1043 | |||
| 1044 | clkdev_add(&sata_refclk_lookup); | ||
| 1045 | |||
| 1046 | return 0; | ||
| 1047 | } | ||
| 1048 | |||
| 1026 | static struct resource da850_sata_resources[] = { | 1049 | static struct resource da850_sata_resources[] = { |
| 1027 | { | 1050 | { |
| 1028 | .start = DA850_SATA_BASE, | 1051 | .start = DA850_SATA_BASE, |
| @@ -1055,9 +1078,15 @@ static struct platform_device da850_sata_device = { | |||
| 1055 | 1078 | ||
| 1056 | int __init da850_register_sata(unsigned long refclkpn) | 1079 | int __init da850_register_sata(unsigned long refclkpn) |
| 1057 | { | 1080 | { |
| 1081 | int ret; | ||
| 1082 | |||
| 1058 | /* please see comment in drivers/ata/ahci_da850.c */ | 1083 | /* please see comment in drivers/ata/ahci_da850.c */ |
| 1059 | BUG_ON(refclkpn != 100 * 1000 * 1000); | 1084 | BUG_ON(refclkpn != 100 * 1000 * 1000); |
| 1060 | 1085 | ||
| 1086 | ret = da850_register_sata_refclk(refclkpn); | ||
| 1087 | if (ret) | ||
| 1088 | return ret; | ||
| 1089 | |||
| 1061 | return platform_device_register(&da850_sata_device); | 1090 | return platform_device_register(&da850_sata_device); |
| 1062 | } | 1091 | } |
| 1063 | #endif | 1092 | #endif |
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h index 85ff2183b6db..7e464228948b 100644 --- a/arch/arm/mach-davinci/include/mach/da8xx.h +++ b/arch/arm/mach-davinci/include/mach/da8xx.h | |||
| @@ -95,6 +95,7 @@ int da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata); | |||
| 95 | int da8xx_register_usb_refclkin(int rate); | 95 | int da8xx_register_usb_refclkin(int rate); |
| 96 | int da8xx_register_usb20_phy_clk(bool use_usb_refclkin); | 96 | int da8xx_register_usb20_phy_clk(bool use_usb_refclkin); |
| 97 | int da8xx_register_usb11_phy_clk(bool use_usb_refclkin); | 97 | int da8xx_register_usb11_phy_clk(bool use_usb_refclkin); |
| 98 | int da850_register_sata_refclk(int rate); | ||
| 98 | int da8xx_register_emac(void); | 99 | int da8xx_register_emac(void); |
| 99 | int da8xx_register_uio_pruss(void); | 100 | int da8xx_register_uio_pruss(void); |
| 100 | int da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata); | 101 | int da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata); |
