diff options
author | Pawel Moll <pawel.moll@arm.com> | 2012-06-12 11:14:03 -0400 |
---|---|---|
committer | Pawel Moll <pawel.moll@arm.com> | 2012-07-12 11:16:56 -0400 |
commit | d927daf5c81c9b6bf2d6a83dc4c8c60268930ee5 (patch) | |
tree | e0a45cf8833d54d2b811b1b5a9635b3b8c844084 | |
parent | ef5911966d2312478a74e93d993cd623a869ab10 (diff) |
ARM: vexpress: Check master site in daughterboard's sysctl operations
With recent enough motherboard firmware, core tile can be fitted
in either of the two daughterboard sites. The non-DT tile code for
V2P-CA9 did not check that when configuring DVI output nor setting
CLCD pixel clock.
Fixed now, providing "get master site" API in motherboard's code.
Signed-off-by: Pawel Moll <pawel.moll@arm.com>
-rw-r--r-- | arch/arm/mach-vexpress/ct-ca9x4.c | 15 | ||||
-rw-r--r-- | arch/arm/mach-vexpress/include/mach/motherboard.h | 9 | ||||
-rw-r--r-- | arch/arm/mach-vexpress/v2m.c | 18 |
3 files changed, 31 insertions, 11 deletions
diff --git a/arch/arm/mach-vexpress/ct-ca9x4.c b/arch/arm/mach-vexpress/ct-ca9x4.c index c65cc3b462a5..ab15a5515312 100644 --- a/arch/arm/mach-vexpress/ct-ca9x4.c +++ b/arch/arm/mach-vexpress/ct-ca9x4.c | |||
@@ -66,8 +66,15 @@ static void __init ct_ca9x4_init_irq(void) | |||
66 | 66 | ||
67 | static void ct_ca9x4_clcd_enable(struct clcd_fb *fb) | 67 | static void ct_ca9x4_clcd_enable(struct clcd_fb *fb) |
68 | { | 68 | { |
69 | v2m_cfg_write(SYS_CFG_MUXFPGA | SYS_CFG_SITE_DB1, 0); | 69 | u32 site = v2m_get_master_site(); |
70 | v2m_cfg_write(SYS_CFG_DVIMODE | SYS_CFG_SITE_DB1, 2); | 70 | |
71 | /* | ||
72 | * Old firmware was using the "site" component of the command | ||
73 | * to control the DVI muxer (while it should be always 0 ie. MB). | ||
74 | * Newer firmware uses the data register. Keep both for compatibility. | ||
75 | */ | ||
76 | v2m_cfg_write(SYS_CFG_MUXFPGA | SYS_CFG_SITE(site), site); | ||
77 | v2m_cfg_write(SYS_CFG_DVIMODE | SYS_CFG_SITE(SYS_CFG_SITE_MB), 2); | ||
71 | } | 78 | } |
72 | 79 | ||
73 | static int ct_ca9x4_clcd_setup(struct clcd_fb *fb) | 80 | static int ct_ca9x4_clcd_setup(struct clcd_fb *fb) |
@@ -112,7 +119,9 @@ static long ct_round(struct clk *clk, unsigned long rate) | |||
112 | 119 | ||
113 | static int ct_set(struct clk *clk, unsigned long rate) | 120 | static int ct_set(struct clk *clk, unsigned long rate) |
114 | { | 121 | { |
115 | return v2m_cfg_write(SYS_CFG_OSC | SYS_CFG_SITE_DB1 | 1, rate); | 122 | u32 site = v2m_get_master_site(); |
123 | |||
124 | return v2m_cfg_write(SYS_CFG_OSC | SYS_CFG_SITE(site) | 1, rate); | ||
116 | } | 125 | } |
117 | 126 | ||
118 | static const struct clk_ops osc1_clk_ops = { | 127 | static const struct clk_ops osc1_clk_ops = { |
diff --git a/arch/arm/mach-vexpress/include/mach/motherboard.h b/arch/arm/mach-vexpress/include/mach/motherboard.h index 31a92890893d..f004ec982d29 100644 --- a/arch/arm/mach-vexpress/include/mach/motherboard.h +++ b/arch/arm/mach-vexpress/include/mach/motherboard.h | |||
@@ -104,9 +104,10 @@ | |||
104 | #define SYS_CFG_REBOOT (9 << 20) | 104 | #define SYS_CFG_REBOOT (9 << 20) |
105 | #define SYS_CFG_DVIMODE (11 << 20) | 105 | #define SYS_CFG_DVIMODE (11 << 20) |
106 | #define SYS_CFG_POWER (12 << 20) | 106 | #define SYS_CFG_POWER (12 << 20) |
107 | #define SYS_CFG_SITE_MB (0 << 16) | 107 | #define SYS_CFG_SITE(n) ((n) << 16) |
108 | #define SYS_CFG_SITE_DB1 (1 << 16) | 108 | #define SYS_CFG_SITE_MB 0 |
109 | #define SYS_CFG_SITE_DB2 (2 << 16) | 109 | #define SYS_CFG_SITE_DB1 1 |
110 | #define SYS_CFG_SITE_DB2 2 | ||
110 | #define SYS_CFG_STACK(n) ((n) << 12) | 111 | #define SYS_CFG_STACK(n) ((n) << 12) |
111 | 112 | ||
112 | #define SYS_CFG_ERR (1 << 1) | 113 | #define SYS_CFG_ERR (1 << 1) |
@@ -122,6 +123,8 @@ void v2m_flags_set(u32 data); | |||
122 | #define SYS_MISC_MASTERSITE (1 << 14) | 123 | #define SYS_MISC_MASTERSITE (1 << 14) |
123 | #define SYS_PROCIDx_HBI_MASK 0xfff | 124 | #define SYS_PROCIDx_HBI_MASK 0xfff |
124 | 125 | ||
126 | int v2m_get_master_site(void); | ||
127 | |||
125 | /* | 128 | /* |
126 | * Core tile IDs | 129 | * Core tile IDs |
127 | */ | 130 | */ |
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c index fde26adaef32..bb185921fce1 100644 --- a/arch/arm/mach-vexpress/v2m.c +++ b/arch/arm/mach-vexpress/v2m.c | |||
@@ -147,6 +147,13 @@ void __init v2m_flags_set(u32 data) | |||
147 | writel(data, v2m_sysreg_base + V2M_SYS_FLAGSSET); | 147 | writel(data, v2m_sysreg_base + V2M_SYS_FLAGSSET); |
148 | } | 148 | } |
149 | 149 | ||
150 | int v2m_get_master_site(void) | ||
151 | { | ||
152 | u32 misc = readl(v2m_sysreg_base + V2M_SYS_MISC); | ||
153 | |||
154 | return misc & SYS_MISC_MASTERSITE ? SYS_CFG_SITE_DB2 : SYS_CFG_SITE_DB1; | ||
155 | } | ||
156 | |||
150 | 157 | ||
151 | static struct resource v2m_pcie_i2c_resource = { | 158 | static struct resource v2m_pcie_i2c_resource = { |
152 | .start = V2M_SERIAL_BUS_PCI, | 159 | .start = V2M_SERIAL_BUS_PCI, |
@@ -326,7 +333,8 @@ static long v2m_osc_round(struct clk *clk, unsigned long rate) | |||
326 | 333 | ||
327 | static int v2m_osc1_set(struct clk *clk, unsigned long rate) | 334 | static int v2m_osc1_set(struct clk *clk, unsigned long rate) |
328 | { | 335 | { |
329 | return v2m_cfg_write(SYS_CFG_OSC | SYS_CFG_SITE_MB | 1, rate); | 336 | return v2m_cfg_write(SYS_CFG_OSC | SYS_CFG_SITE(SYS_CFG_SITE_MB) | 1, |
337 | rate); | ||
330 | } | 338 | } |
331 | 339 | ||
332 | static const struct clk_ops osc1_clk_ops = { | 340 | static const struct clk_ops osc1_clk_ops = { |
@@ -404,13 +412,13 @@ static void __init v2m_init_early(void) | |||
404 | 412 | ||
405 | static void v2m_power_off(void) | 413 | static void v2m_power_off(void) |
406 | { | 414 | { |
407 | if (v2m_cfg_write(SYS_CFG_SHUTDOWN | SYS_CFG_SITE_MB, 0)) | 415 | if (v2m_cfg_write(SYS_CFG_SHUTDOWN | SYS_CFG_SITE(SYS_CFG_SITE_MB), 0)) |
408 | printk(KERN_EMERG "Unable to shutdown\n"); | 416 | printk(KERN_EMERG "Unable to shutdown\n"); |
409 | } | 417 | } |
410 | 418 | ||
411 | static void v2m_restart(char str, const char *cmd) | 419 | static void v2m_restart(char str, const char *cmd) |
412 | { | 420 | { |
413 | if (v2m_cfg_write(SYS_CFG_REBOOT | SYS_CFG_SITE_MB, 0)) | 421 | if (v2m_cfg_write(SYS_CFG_REBOOT | SYS_CFG_SITE(SYS_CFG_SITE_MB), 0)) |
414 | printk(KERN_EMERG "Unable to reboot\n"); | 422 | printk(KERN_EMERG "Unable to reboot\n"); |
415 | } | 423 | } |
416 | 424 | ||
@@ -605,8 +613,8 @@ void __init v2m_dt_init_early(void) | |||
605 | 613 | ||
606 | /* Confirm board type against DT property, if available */ | 614 | /* Confirm board type against DT property, if available */ |
607 | if (of_property_read_u32(allnodes, "arm,hbi", &dt_hbi) == 0) { | 615 | if (of_property_read_u32(allnodes, "arm,hbi", &dt_hbi) == 0) { |
608 | u32 misc = readl(v2m_sysreg_base + V2M_SYS_MISC); | 616 | int site = v2m_get_master_site(); |
609 | u32 id = readl(v2m_sysreg_base + (misc & SYS_MISC_MASTERSITE ? | 617 | u32 id = readl(v2m_sysreg_base + (site == SYS_CFG_SITE_DB2 ? |
610 | V2M_SYS_PROCID1 : V2M_SYS_PROCID0)); | 618 | V2M_SYS_PROCID1 : V2M_SYS_PROCID0)); |
611 | u32 hbi = id & SYS_PROCIDx_HBI_MASK; | 619 | u32 hbi = id & SYS_PROCIDx_HBI_MASK; |
612 | 620 | ||