aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMartin Fuzzey <mfuzzey@parkeon.com>2012-11-22 14:15:05 -0500
committerMike Turquette <mturquette@linaro.org>2012-11-26 14:14:45 -0500
commit1f61e5f143b578606389887887af549bc5554353 (patch)
treeb49a23716e8896eac027f2730a4cf0d94983ec4f /drivers
parent45228ef32240957b1536fbba1ca12377cb2e587c (diff)
clk: clock multiplexers may register out of order
When a clock, C is initialised any orphan clocks listing C as a possible parent are reparented to it regardless of the parent requested by the orphan's get_parent() operation. This means that multiplexers registered before their parents are reparented to the first parent subsequently declared, regardless of the selection made by the hardware registers. For example: static const char *sel[] = { "srcA", "srcB", "dummy", "srcC" }; child = clk_register_mux(NULL, "child", sel, ARRAY_SIZE(sel), ...); clk_register_fixed(NULL, "dummy", ...); clk_register_fixed(NULL, "srcA", ...); clk_register_fixed(NULL, "srcB", ...); clk_register_fixed(NULL, "srcC", ...); Causes child's parent to always be "dummy". To fix this, when an orphanned clock has a get_parent() operation, only reparent to the clock indicated by get_parent(). Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com> Signed-off-by: Mike Turquette <mturquette@linaro.org> [mturquette@linaro.org: improve $SUBJECT]
Diffstat (limited to 'drivers')
-rw-r--r--drivers/clk/clk.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 2fd28ddd06c..9955ad7e786 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1298,12 +1298,20 @@ int __clk_init(struct device *dev, struct clk *clk)
1298 * walk the list of orphan clocks and reparent any that are children of 1298 * walk the list of orphan clocks and reparent any that are children of
1299 * this clock 1299 * this clock
1300 */ 1300 */
1301 hlist_for_each_entry_safe(orphan, tmp, tmp2, &clk_orphan_list, child_node) 1301 hlist_for_each_entry_safe(orphan, tmp, tmp2, &clk_orphan_list, child_node) {
1302 if (orphan->ops->get_parent) {
1303 i = orphan->ops->get_parent(orphan->hw);
1304 if (!strcmp(clk->name, orphan->parent_names[i]))
1305 __clk_reparent(orphan, clk);
1306 continue;
1307 }
1308
1302 for (i = 0; i < orphan->num_parents; i++) 1309 for (i = 0; i < orphan->num_parents; i++)
1303 if (!strcmp(clk->name, orphan->parent_names[i])) { 1310 if (!strcmp(clk->name, orphan->parent_names[i])) {
1304 __clk_reparent(orphan, clk); 1311 __clk_reparent(orphan, clk);
1305 break; 1312 break;
1306 } 1313 }
1314 }
1307 1315
1308 /* 1316 /*
1309 * optional platform-specific magic 1317 * optional platform-specific magic
id='n189' href='#n189'>189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244



















































































































































































































































                                                                              
/*
 * fp_move.S
 *
 * Copyright Roman Zippel, 1997.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, and the entire permission notice in its entirety,
 *    including the disclaimer of warranties.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. The name of the author may not be used to endorse or promote
 *    products derived from this software without specific prior
 *    written permission.
 *
 * ALTERNATIVELY, this product may be distributed under the terms of
 * the GNU General Public License, in which case the provisions of the GPL are
 * required INSTEAD OF the above restrictions.  (This clause is
 * necessary due to a potential bad interaction between the GPL and
 * the restrictions contained in a BSD-style copyright.)
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include "fp_emu.h"
#include "fp_decode.h"

do_no_pc_mode=1

	.globl	fp_fmove_fp2mem

fp_fmove_fp2mem:
	clr.b	(2+FPD_FPSR,FPDATA)
	fp_decode_dest_format
	move.w	%d0,%d1			| store data size twice in %d1
	swap	%d1			| one can be trashed below
	move.w	%d0,%d1
#ifdef FPU_EMU_DEBUG
	lea	0f,%a0
	clr.l	%d0
	move.b	(%a0,%d1.w),%d0
	printf	PDECODE,"fmove.%c ",1,%d0
	fp_decode_src_reg
	printf	PDECODE,"fp%d,",1,%d0

	.data
0:	.byte	'l','s','x','p','w','d','b','p'
	.previous
#endif

	| encode addressing mode for dest
	fp_decode_addr_mode

	.long	fp_data, fp_ill
	.long	fp_indirect, fp_postinc
	.long	fp_predecr, fp_disp16
	.long	fp_extmode0, fp_extmode1

	| addressing mode: data register direct
fp_data:
	fp_mode_data_direct
	move.w	%d0,%d1
	fp_decode_src_reg
	fp_get_fp_reg
	lea	(FPD_TEMPFP1,FPDATA),%a1
	move.l	(%a0)+,(%a1)+
	move.l	(%a0)+,(%a1)+
	move.l	(%a0),(%a1)
	lea	(-8,%a1),%a0
	swap	%d1
	move.l	%d1,%d2
	printf	PDECODE,"\n"
	jmp	([0f:w,%pc,%d1.w*4])

	.align	4
0:
	.long	fp_data_long, fp_data_single
	.long	fp_ill, fp_ill
	.long	fp_data_word, fp_ill
	.long	fp_data_byte, fp_ill

fp_data_byte:
	jsr	fp_normalize_ext
	jsr	fp_conv_ext2byte
	move.l	%d0,%d1
	swap	%d2
	move.w	%d2,%d0
	jsr	fp_get_data_reg
	move.b	%d1,%d0
	move.w	%d2,%d1
	jsr	fp_put_data_reg
	jra	fp_final

fp_data_word:
	jsr	fp_normalize_ext
	jsr	fp_conv_ext2short
	move.l	%d0,%d1
	swap	%d2
	move.w	%d2,%d0
	jsr	fp_get_data_reg
	move.w	%d1,%d0
	move.l	%d2,%d1
	jsr	fp_put_data_reg
	jra	fp_final

fp_data_long:
	jsr	fp_normalize_ext
	jsr	fp_conv_ext2long
	swap	%d2
	move.w	%d2,%d1
	jsr	fp_put_data_reg
	jra	fp_final

fp_data_single:
	jsr	fp_normalize_ext
	jsr	fp_conv_ext2single
	swap	%d2
	move.w	%d2,%d1
	jsr	fp_put_data_reg
	jra	fp_final

	| addressing mode: address register indirect
fp_indirect:
	fp_mode_addr_indirect
	jra	fp_putdest

	| addressing mode: address register indirect with postincrement
fp_postinc:
	fp_mode_addr_indirect_postinc
	jra	fp_putdest

	| addressing mode: address register indirect with predecrement
fp_predecr:
	fp_mode_addr_indirect_predec
	jra	fp_putdest

	| addressing mode: address register indirect with 16bit displacement
fp_disp16:
	fp_mode_addr_indirect_disp16
	jra     fp_putdest

fp_extmode0:
	fp_mode_addr_indirect_extmode0
	jra	fp_putdest

fp_extmode1:
	fp_decode_addr_reg
	jmp	([0f:w,%pc,%d0*4])

	.align	4
0:
	.long	fp_abs_short, fp_abs_long
	.long	fp_ill, fp_ill
	.long	fp_ill, fp_ill
	.long	fp_ill, fp_ill

fp_abs_short:
	fp_mode_abs_short
	jra	fp_putdest

fp_abs_long:
	fp_mode_abs_long
	jra	fp_putdest

fp_putdest:
	move.l	%a0,%a1
	fp_decode_src_reg
	move.l	%d1,%d2			| save size
	fp_get_fp_reg
	printf	PDECODE,"\n"
	addq.l	#8,%a0
	move.l	(%a0),-(%sp)
	move.l	-(%a0),-(%sp)
	move.l	-(%a0),-(%sp)
	move.l	%sp,%a0
	jsr	fp_normalize_ext

	swap	%d2
	jmp	([0f:w,%pc,%d2.w*4])

	.align	4
0:
	.long	fp_format_long, fp_format_single
	.long	fp_format_extended, fp_format_packed
	.long	fp_format_word, fp_format_double
	.long	fp_format_byte, fp_format_packed

fp_format_long:
	jsr	fp_conv_ext2long
	putuser.l %d0,(%a1),fp_err_ua1,%a1
	jra	fp_finish_move

fp_format_single:
	jsr	fp_conv_ext2single
	putuser.l %d0,(%a1),fp_err_ua1,%a1
	jra	fp_finish_move

fp_format_extended:
	move.l	(%a0)+,%d0
	lsl.w	#1,%d0
	lsl.l	#7,%d0
	lsl.l	#8,%d0
	putuser.l %d0,(%a1)+,fp_err_ua1,%a1
	move.l	(%a0)+,%d0
	putuser.l %d0,(%a1)+,fp_err_ua1,%a1
	move.l	(%a0),%d0
	putuser.l %d0,(%a1),fp_err_ua1,%a1
	jra	fp_finish_move

fp_format_packed:
	/* not supported yet */
	lea	(12,%sp),%sp
	jra	fp_ill

fp_format_word:
	jsr	fp_conv_ext2short
	putuser.w %d0,(%a1),fp_err_ua1,%a1
	jra	fp_finish_move

fp_format_double:
	jsr	fp_conv_ext2double
	jra	fp_finish_move

fp_format_byte:
	jsr	fp_conv_ext2byte
	putuser.b %d0,(%a1),fp_err_ua1,%a1
|	jra	fp_finish_move

fp_finish_move:
	lea	(12,%sp),%sp
	jra	fp_final