diff options
| -rw-r--r-- | arch/arm/mach-davinci/Makefile | 2 | ||||
| -rw-r--r-- | arch/arm/mach-davinci/da850.c | 24 | ||||
| -rw-r--r-- | arch/arm/mach-davinci/da8xx-dt.c | 10 | ||||
| -rw-r--r-- | arch/arm/mach-davinci/devices-da8xx.c | 30 | ||||
| -rw-r--r-- | arch/arm/mach-davinci/include/mach/common.h | 2 | ||||
| -rw-r--r-- | arch/arm/mach-davinci/include/mach/da8xx.h | 1 | ||||
| -rw-r--r-- | arch/arm/mach-davinci/pdata-quirks.c | 39 | ||||
| -rw-r--r-- | drivers/bus/da8xx-mstpri.c | 2 | ||||
| -rw-r--r-- | drivers/cpufreq/davinci-cpufreq.c | 2 |
9 files changed, 102 insertions, 10 deletions
diff --git a/arch/arm/mach-davinci/Makefile b/arch/arm/mach-davinci/Makefile index 0a2e6da45f28..df96ca9eab6d 100644 --- a/arch/arm/mach-davinci/Makefile +++ b/arch/arm/mach-davinci/Makefile | |||
| @@ -21,7 +21,7 @@ obj-$(CONFIG_AINTC) += irq.o | |||
| 21 | obj-$(CONFIG_CP_INTC) += cp_intc.o | 21 | obj-$(CONFIG_CP_INTC) += cp_intc.o |
| 22 | 22 | ||
| 23 | # Board specific | 23 | # Board specific |
| 24 | obj-$(CONFIG_MACH_DA8XX_DT) += da8xx-dt.o | 24 | obj-$(CONFIG_MACH_DA8XX_DT) += da8xx-dt.o pdata-quirks.o |
| 25 | obj-$(CONFIG_MACH_DAVINCI_EVM) += board-dm644x-evm.o | 25 | obj-$(CONFIG_MACH_DAVINCI_EVM) += board-dm644x-evm.o |
| 26 | obj-$(CONFIG_MACH_SFFSDR) += board-sffsdr.o | 26 | obj-$(CONFIG_MACH_SFFSDR) += board-sffsdr.o |
| 27 | obj-$(CONFIG_MACH_NEUROS_OSD2) += board-neuros-osd2.o | 27 | obj-$(CONFIG_MACH_NEUROS_OSD2) += board-neuros-osd2.o |
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c index 1d873d15b545..d09765ba246b 100644 --- a/arch/arm/mach-davinci/da850.c +++ b/arch/arm/mach-davinci/da850.c | |||
| @@ -571,7 +571,7 @@ static struct clk_lookup da850_clks[] = { | |||
| 571 | CLK("spi_davinci.0", NULL, &spi0_clk), | 571 | CLK("spi_davinci.0", NULL, &spi0_clk), |
| 572 | CLK("spi_davinci.1", NULL, &spi1_clk), | 572 | CLK("spi_davinci.1", NULL, &spi1_clk), |
| 573 | CLK("vpif", NULL, &vpif_clk), | 573 | CLK("vpif", NULL, &vpif_clk), |
| 574 | CLK("ahci_da850", NULL, &sata_clk), | 574 | CLK("ahci_da850", "fck", &sata_clk), |
| 575 | CLK("davinci-rproc.0", NULL, &dsp_clk), | 575 | CLK("davinci-rproc.0", NULL, &dsp_clk), |
| 576 | CLK(NULL, NULL, &ehrpwm_clk), | 576 | CLK(NULL, NULL, &ehrpwm_clk), |
| 577 | CLK("ehrpwm.0", "fck", &ehrpwm0_clk), | 577 | CLK("ehrpwm.0", "fck", &ehrpwm0_clk), |
| @@ -1202,14 +1202,28 @@ static int da850_set_armrate(struct clk *clk, unsigned long index) | |||
| 1202 | return clk_set_rate(pllclk, index); | 1202 | return clk_set_rate(pllclk, index); |
| 1203 | } | 1203 | } |
| 1204 | 1204 | ||
| 1205 | static int da850_set_pll0rate(struct clk *clk, unsigned long index) | 1205 | static int da850_set_pll0rate(struct clk *clk, unsigned long rate) |
| 1206 | { | 1206 | { |
| 1207 | unsigned int prediv, mult, postdiv; | ||
| 1208 | struct da850_opp *opp; | ||
| 1209 | struct pll_data *pll = clk->pll_data; | 1207 | struct pll_data *pll = clk->pll_data; |
| 1208 | struct cpufreq_frequency_table *freq; | ||
| 1209 | unsigned int prediv, mult, postdiv; | ||
| 1210 | struct da850_opp *opp = NULL; | ||
| 1210 | int ret; | 1211 | int ret; |
| 1211 | 1212 | ||
| 1212 | opp = (struct da850_opp *) cpufreq_info.freq_table[index].driver_data; | 1213 | rate /= 1000; |
| 1214 | |||
| 1215 | for (freq = da850_freq_table; | ||
| 1216 | freq->frequency != CPUFREQ_TABLE_END; freq++) { | ||
| 1217 | /* rate is in Hz, freq->frequency is in KHz */ | ||
| 1218 | if (freq->frequency == rate) { | ||
| 1219 | opp = (struct da850_opp *)freq->driver_data; | ||
| 1220 | break; | ||
| 1221 | } | ||
| 1222 | } | ||
| 1223 | |||
| 1224 | if (!opp) | ||
| 1225 | return -EINVAL; | ||
| 1226 | |||
| 1213 | prediv = opp->prediv; | 1227 | prediv = opp->prediv; |
| 1214 | mult = opp->mult; | 1228 | mult = opp->mult; |
| 1215 | postdiv = opp->postdiv; | 1229 | postdiv = opp->postdiv; |
diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c index 9ee44da6eb7b..071933b16a0c 100644 --- a/arch/arm/mach-davinci/da8xx-dt.c +++ b/arch/arm/mach-davinci/da8xx-dt.c | |||
| @@ -42,6 +42,7 @@ static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = { | |||
| 42 | OF_DEV_AUXDATA("ti,da830-ohci", 0x01e25000, "ohci-da8xx", NULL), | 42 | OF_DEV_AUXDATA("ti,da830-ohci", 0x01e25000, "ohci-da8xx", NULL), |
| 43 | OF_DEV_AUXDATA("ti,da830-musb", 0x01e00000, "musb-da8xx", NULL), | 43 | OF_DEV_AUXDATA("ti,da830-musb", 0x01e00000, "musb-da8xx", NULL), |
| 44 | OF_DEV_AUXDATA("ti,da830-usb-phy", 0x01c1417c, "da8xx-usb-phy", NULL), | 44 | OF_DEV_AUXDATA("ti,da830-usb-phy", 0x01c1417c, "da8xx-usb-phy", NULL), |
| 45 | OF_DEV_AUXDATA("ti,da850-ahci", 0x01e18000, "ahci_da850", NULL), | ||
| 45 | {} | 46 | {} |
| 46 | }; | 47 | }; |
| 47 | 48 | ||
| @@ -49,6 +50,9 @@ static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = { | |||
| 49 | 50 | ||
| 50 | static void __init da850_init_machine(void) | 51 | static void __init da850_init_machine(void) |
| 51 | { | 52 | { |
| 53 | /* All existing boards use 100MHz SATA refclkpn */ | ||
| 54 | static const unsigned long sata_refclkpn = 100 * 1000 * 1000; | ||
| 55 | |||
| 52 | int ret; | 56 | int ret; |
| 53 | 57 | ||
| 54 | ret = da8xx_register_usb20_phy_clk(false); | 58 | ret = da8xx_register_usb20_phy_clk(false); |
| @@ -60,8 +64,14 @@ static void __init da850_init_machine(void) | |||
| 60 | pr_warn("%s: registering USB 1.1 PHY clock failed: %d", | 64 | pr_warn("%s: registering USB 1.1 PHY clock failed: %d", |
| 61 | __func__, ret); | 65 | __func__, ret); |
| 62 | 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 | |||
| 63 | of_platform_default_populate(NULL, da850_auxdata_lookup, NULL); | 72 | of_platform_default_populate(NULL, da850_auxdata_lookup, NULL); |
| 64 | davinci_pm_init(); | 73 | davinci_pm_init(); |
| 74 | pdata_quirks_init(); | ||
| 65 | } | 75 | } |
| 66 | 76 | ||
| 67 | static const char *const da850_boards_compat[] __initconst = { | 77 | static const char *const da850_boards_compat[] __initconst = { |
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c index c2457b3fdb5f..7cf529ffbe5a 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,8 +1078,11 @@ 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 | { |
| 1058 | /* please see comment in drivers/ata/ahci_da850.c */ | 1081 | int ret; |
| 1059 | BUG_ON(refclkpn != 100 * 1000 * 1000); | 1082 | |
| 1083 | ret = da850_register_sata_refclk(refclkpn); | ||
| 1084 | if (ret) | ||
| 1085 | return ret; | ||
| 1060 | 1086 | ||
| 1061 | return platform_device_register(&da850_sata_device); | 1087 | return platform_device_register(&da850_sata_device); |
| 1062 | } | 1088 | } |
diff --git a/arch/arm/mach-davinci/include/mach/common.h b/arch/arm/mach-davinci/include/mach/common.h index 0b3c169758ed..037aa66bcac1 100644 --- a/arch/arm/mach-davinci/include/mach/common.h +++ b/arch/arm/mach-davinci/include/mach/common.h | |||
| @@ -102,6 +102,8 @@ int davinci_pm_init(void); | |||
| 102 | static inline int davinci_pm_init(void) { return 0; } | 102 | static inline int davinci_pm_init(void) { return 0; } |
| 103 | #endif | 103 | #endif |
| 104 | 104 | ||
| 105 | void __init pdata_quirks_init(void); | ||
| 106 | |||
| 105 | #define SRAM_SIZE SZ_128K | 107 | #define SRAM_SIZE SZ_128K |
| 106 | 108 | ||
| 107 | #endif /* __ARCH_ARM_MACH_DAVINCI_COMMON_H */ | 109 | #endif /* __ARCH_ARM_MACH_DAVINCI_COMMON_H */ |
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); |
diff --git a/arch/arm/mach-davinci/pdata-quirks.c b/arch/arm/mach-davinci/pdata-quirks.c new file mode 100644 index 000000000000..5b57da475065 --- /dev/null +++ b/arch/arm/mach-davinci/pdata-quirks.c | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | /* | ||
| 2 | * Legacy platform_data quirks | ||
| 3 | * | ||
| 4 | * Copyright (C) 2016 BayLibre, Inc | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License version 2 as | ||
| 8 | * published by the Free Software Foundation. | ||
| 9 | */ | ||
| 10 | #include <linux/kernel.h> | ||
| 11 | #include <linux/of_platform.h> | ||
| 12 | |||
| 13 | #include <mach/common.h> | ||
| 14 | |||
| 15 | struct pdata_init { | ||
| 16 | const char *compatible; | ||
| 17 | void (*fn)(void); | ||
| 18 | }; | ||
| 19 | |||
| 20 | static void pdata_quirks_check(struct pdata_init *quirks) | ||
| 21 | { | ||
| 22 | while (quirks->compatible) { | ||
| 23 | if (of_machine_is_compatible(quirks->compatible)) { | ||
| 24 | if (quirks->fn) | ||
| 25 | quirks->fn(); | ||
| 26 | break; | ||
| 27 | } | ||
| 28 | quirks++; | ||
| 29 | } | ||
| 30 | } | ||
| 31 | |||
| 32 | static struct pdata_init pdata_quirks[] __initdata = { | ||
| 33 | { /* sentinel */ }, | ||
| 34 | }; | ||
| 35 | |||
| 36 | void __init pdata_quirks_init(void) | ||
| 37 | { | ||
| 38 | pdata_quirks_check(pdata_quirks); | ||
| 39 | } | ||
diff --git a/drivers/bus/da8xx-mstpri.c b/drivers/bus/da8xx-mstpri.c index 063397f2c0db..9af9bcc68059 100644 --- a/drivers/bus/da8xx-mstpri.c +++ b/drivers/bus/da8xx-mstpri.c | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * Copyright (C) 2016 BayLibre SAS | 4 | * Copyright (C) 2016 BayLibre SAS |
| 5 | * | 5 | * |
| 6 | * Author: | 6 | * Author: |
| 7 | * Bartosz Golaszewski <bgolaszewski@baylibre.com.com> | 7 | * Bartosz Golaszewski <bgolaszewski@baylibre.com> |
| 8 | * | 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License version 2 as | 10 | * it under the terms of the GNU General Public License version 2 as |
diff --git a/drivers/cpufreq/davinci-cpufreq.c b/drivers/cpufreq/davinci-cpufreq.c index b95a872800ec..d54a27c99121 100644 --- a/drivers/cpufreq/davinci-cpufreq.c +++ b/drivers/cpufreq/davinci-cpufreq.c | |||
| @@ -55,7 +55,7 @@ static int davinci_target(struct cpufreq_policy *policy, unsigned int idx) | |||
| 55 | return ret; | 55 | return ret; |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | ret = clk_set_rate(armclk, idx); | 58 | ret = clk_set_rate(armclk, new_freq * 1000); |
| 59 | if (ret) | 59 | if (ret) |
| 60 | return ret; | 60 | return ret; |
| 61 | 61 | ||
