diff options
author | Hans de Goede <hdegoede@redhat.com> | 2014-11-16 07:56:57 -0500 |
---|---|---|
committer | Maxime Ripard <maxime.ripard@free-electrons.com> | 2014-11-23 11:02:57 -0500 |
commit | c1ec51603053260b138fc98e2ed18a5a9bea4515 (patch) | |
tree | bc00330e624ba3df280e677d4a28cf2394c2f382 | |
parent | 95e94c1fadcd1959857db45c2e11810a893badd0 (diff) |
clk: sunxi: gmac-tx-clk mux is not a CLK_MUX_INDEX_BIT mux
A CLK_MUX_INDEX_BIT mux has one bit per parent, but the sun7i-a20-gmac-clk
has 2 bits selecting between 3 possible parents using values of 0, 1, 2,
which makes it a regular mux which should not have CLK_MUX_INDEX_BIT set in
its flag.
However we do not support parent 1 (an external clock), so use a table to
select parent 0 or 2, which are the 2 parents we support.
Note this has not been causing any issues sofar, because we start with a
parent setting of parent 0, and only ever re-parent to parent 2 (for which
we use an index of 1 as we skip parent 1) and with CLK_MUX_INDEX_BIT set
we write a value of 2 for index 1.
Tested on both a cubietruck (which uses rgmii mode) as well as a cs908
(an a31s board which uses mii mode).
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
-rw-r--r-- | drivers/clk/sunxi/clk-a20-gmac.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/clk/sunxi/clk-a20-gmac.c b/drivers/clk/sunxi/clk-a20-gmac.c index 5296fd6dd7b3..0dcf4f205fb8 100644 --- a/drivers/clk/sunxi/clk-a20-gmac.c +++ b/drivers/clk/sunxi/clk-a20-gmac.c | |||
@@ -53,6 +53,11 @@ static DEFINE_SPINLOCK(gmac_lock); | |||
53 | #define SUN7I_A20_GMAC_MASK 0x3 | 53 | #define SUN7I_A20_GMAC_MASK 0x3 |
54 | #define SUN7I_A20_GMAC_PARENTS 2 | 54 | #define SUN7I_A20_GMAC_PARENTS 2 |
55 | 55 | ||
56 | static u32 sun7i_a20_gmac_mux_table[SUN7I_A20_GMAC_PARENTS] = { | ||
57 | 0x00, /* Select mii_phy_tx_clk */ | ||
58 | 0x02, /* Select gmac_int_tx_clk */ | ||
59 | }; | ||
60 | |||
56 | static void __init sun7i_a20_gmac_clk_setup(struct device_node *node) | 61 | static void __init sun7i_a20_gmac_clk_setup(struct device_node *node) |
57 | { | 62 | { |
58 | struct clk *clk; | 63 | struct clk *clk; |
@@ -90,7 +95,7 @@ static void __init sun7i_a20_gmac_clk_setup(struct device_node *node) | |||
90 | gate->lock = &gmac_lock; | 95 | gate->lock = &gmac_lock; |
91 | mux->reg = reg; | 96 | mux->reg = reg; |
92 | mux->mask = SUN7I_A20_GMAC_MASK; | 97 | mux->mask = SUN7I_A20_GMAC_MASK; |
93 | mux->flags = CLK_MUX_INDEX_BIT; | 98 | mux->table = sun7i_a20_gmac_mux_table; |
94 | mux->lock = &gmac_lock; | 99 | mux->lock = &gmac_lock; |
95 | 100 | ||
96 | clk = clk_register_composite(NULL, clk_name, | 101 | clk = clk_register_composite(NULL, clk_name, |