Skip to content

Commit

Permalink
Merge pull request #4 from khadas/khadas-vims-4.9.y
Browse files Browse the repository at this point in the history
Khadas vims 4.9.y
  • Loading branch information
yan-wyb authored Dec 26, 2021
2 parents cef8669 + e84d3c1 commit deedb21
Show file tree
Hide file tree
Showing 22 changed files with 171 additions and 69 deletions.
3 changes: 2 additions & 1 deletion arch/arm/boot/dts/amlogic/sm1_s905d3_ac200.dts
Original file line number Diff line number Diff line change
Expand Up @@ -1152,10 +1152,11 @@
//dai-tdm-lane-slot-mask-out = <1 1 1 1 1 1 1 1>;
dai-tdm-clk-sel = <1>;
clocks = <&clkaudio CLKID_AUDIO_MCLK_B
&clkaudio CLKID_AUDIO_MCLK_PAD0
&clkc CLKID_MPLL1
&clkc CLKID_MPLL0
&clkaudio CLKID_AUDIO_SPDIFOUT_A>;
clock-names = "mclk", "clk_srcpll",
clock-names = "mclk", "mclk_pad", "clk_srcpll",
"samesource_srcpll", "samesource_clk";
pinctrl-names = "tdm_pins";
pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/boot/dts/amlogic/sm1_s905d3_ac202.dts
Original file line number Diff line number Diff line change
Expand Up @@ -1163,10 +1163,11 @@
//dai-tdm-lane-slot-mask-out = <1 1 1 1 1 1 1 1>;
dai-tdm-clk-sel = <1>;
clocks = <&clkaudio CLKID_AUDIO_MCLK_B
&clkaudio CLKID_AUDIO_MCLK_PAD0
&clkc CLKID_MPLL1
&clkc CLKID_MPLL0
&clkaudio CLKID_AUDIO_SPDIFOUT_A>;
clock-names = "mclk", "clk_srcpll",
clock-names = "mclk", "mclk_pad", "clk_srcpll",
"samesource_srcpll", "samesource_clk";
pinctrl-names = "tdm_pins";
/*pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;*/
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/boot/dts/amlogic/sm1_s905d3_ac202_1g.dts
Original file line number Diff line number Diff line change
Expand Up @@ -1163,10 +1163,11 @@
//dai-tdm-lane-slot-mask-out = <1 1 1 1 1 1 1 1>;
dai-tdm-clk-sel = <1>;
clocks = <&clkaudio CLKID_AUDIO_MCLK_B
&clkaudio CLKID_AUDIO_MCLK_PAD0
&clkc CLKID_MPLL1
&clkc CLKID_MPLL0
&clkaudio CLKID_AUDIO_SPDIFOUT_A>;
clock-names = "mclk", "clk_srcpll",
clock-names = "mclk", "mclk_pad", "clk_srcpll",
"samesource_srcpll", "samesource_clk";
pinctrl-names = "tdm_pins";
/*pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;*/
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/boot/dts/amlogic/sm1_s905d3_skt.dts
Original file line number Diff line number Diff line change
Expand Up @@ -1143,10 +1143,11 @@
dai-tdm-lane-slot-mask-out = <1 0 0 0>;
dai-tdm-clk-sel = <1>;
clocks = <&clkaudio CLKID_AUDIO_MCLK_B
&clkaudio CLKID_AUDIO_MCLK_PAD0
&clkc CLKID_MPLL1
&clkc CLKID_MPLL0
&clkaudio CLKID_AUDIO_SPDIFOUT_A>;
clock-names = "mclk", "clk_srcpll",
clock-names = "mclk", "mclk_pad", "clk_srcpll",
"samesource_srcpll", "samesource_clk";
pinctrl-names = "tdm_pins";
pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/boot/dts/amlogic/sm1_s905x3_ac213.dts
Original file line number Diff line number Diff line change
Expand Up @@ -1127,10 +1127,11 @@
dai-tdm-lane-slot-mask-out = <1 0 0 0>;
dai-tdm-clk-sel = <1>;
clocks = <&clkaudio CLKID_AUDIO_MCLK_B
&clkaudio CLKID_AUDIO_MCLK_PAD0
&clkc CLKID_MPLL1
&clkc CLKID_MPLL0
&clkaudio CLKID_AUDIO_SPDIFOUT_A>;
clock-names = "mclk", "clk_srcpll",
clock-names = "mclk", "mclk_pad", "clk_srcpll",
"samesource_srcpll", "samesource_clk";
pinctrl-names = "tdm_pins";
pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
Expand Down
22 changes: 10 additions & 12 deletions arch/arm64/boot/dts/amlogic/kvim3l_linux.dts
Original file line number Diff line number Diff line change
Expand Up @@ -1170,18 +1170,16 @@
#sound-dai-cells = <0>;
dai-tdm-lane-slot-mask-in = <0 1 0 0>;
dai-tdm-lane-slot-mask-out = <1 0 0 0>;
//dai-tdm-lane-slot-mask-in = <0 0 0 0 0 0 0 0>;
//dai-tdm-lane-slot-mask-out = <1 1 1 1 1 1 1 1>;
dai-tdm-clk-sel = <1>;
clocks = <&clkaudio CLKID_AUDIO_MCLK_B
&clkaudio CLKID_AUDIO_MCLK_PAD0
&clkc CLKID_MPLL1
&clkc CLKID_MPLL0
&clkaudio CLKID_AUDIO_SPDIFOUT_A>;
clock-names = "mclk", "clk_srcpll",
clock-names = "mclk", "mclk_pad", "clk_srcpll",
"samesource_srcpll", "samesource_clk";
pinctrl-names = "tdm_pins";
/*pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;*/
pinctrl-0 = < &tdmout_b &tdmin_b>;
pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
mclk_pad = <0>; /* 0: mclk_0; 1: mclk_1 */

/*
Expand Down Expand Up @@ -1539,13 +1537,13 @@
};
};

//tdmb_mclk: tdmb_mclk {
// mux {
// groups = "mclk0_a";
// function = "mclk0";
// drive-strength = <2>;
// };
//};
tdmb_mclk: tdmb_mclk {
mux {
groups = "mclk0_a";
function = "mclk0";
drive-strength = <2>;
};
};
tdmout_b: tdmout_b {
mux { /* GPIOA_1, GPIOA_2, GPIOA_3, GPIOA_4, */
/* GPIOA_5, GPIOA_6, GPIOA_7, GPIOA_8, */
Expand Down
3 changes: 2 additions & 1 deletion arch/arm64/boot/dts/amlogic/sm1_s905d3_ac200.dts
Original file line number Diff line number Diff line change
Expand Up @@ -1152,10 +1152,11 @@
dai-tdm-lane-slot-mask-out = <1 0 0 0>;
dai-tdm-clk-sel = <1>;
clocks = <&clkaudio CLKID_AUDIO_MCLK_B
&clkaudio CLKID_AUDIO_MCLK_PAD0
&clkc CLKID_MPLL1
&clkc CLKID_MPLL0
&clkaudio CLKID_AUDIO_SPDIFOUT_A>;
clock-names = "mclk", "clk_srcpll",
clock-names = "mclk", "mclk_pad", "clk_srcpll",
"samesource_srcpll", "samesource_clk";
pinctrl-names = "tdm_pins";
pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
Expand Down
3 changes: 2 additions & 1 deletion arch/arm64/boot/dts/amlogic/sm1_s905d3_ac202.dts
Original file line number Diff line number Diff line change
Expand Up @@ -1162,10 +1162,11 @@
//dai-tdm-lane-slot-mask-out = <1 1 1 1 1 1 1 1>;
dai-tdm-clk-sel = <1>;
clocks = <&clkaudio CLKID_AUDIO_MCLK_B
&clkaudio CLKID_AUDIO_MCLK_PAD0
&clkc CLKID_MPLL1
&clkc CLKID_MPLL0
&clkaudio CLKID_AUDIO_SPDIFOUT_A>;
clock-names = "mclk", "clk_srcpll",
clock-names = "mclk", "mclk_pad", "clk_srcpll",
"samesource_srcpll", "samesource_clk";
pinctrl-names = "tdm_pins";
/*pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;*/
Expand Down
3 changes: 2 additions & 1 deletion arch/arm64/boot/dts/amlogic/sm1_s905d3_ac202_1g.dts
Original file line number Diff line number Diff line change
Expand Up @@ -1162,10 +1162,11 @@
//dai-tdm-lane-slot-mask-out = <1 1 1 1 1 1 1 1>;
dai-tdm-clk-sel = <1>;
clocks = <&clkaudio CLKID_AUDIO_MCLK_B
&clkaudio CLKID_AUDIO_MCLK_PAD0
&clkc CLKID_MPLL1
&clkc CLKID_MPLL0
&clkaudio CLKID_AUDIO_SPDIFOUT_A>;
clock-names = "mclk", "clk_srcpll",
clock-names = "mclk", "mclk_pad", "clk_srcpll",
"samesource_srcpll", "samesource_clk";
pinctrl-names = "tdm_pins";
/*pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;*/
Expand Down
3 changes: 2 additions & 1 deletion arch/arm64/boot/dts/amlogic/sm1_s905d3_skt.dts
Original file line number Diff line number Diff line change
Expand Up @@ -1141,10 +1141,11 @@
dai-tdm-lane-slot-mask-out = <1 0 0 0>;
dai-tdm-clk-sel = <1>;
clocks = <&clkaudio CLKID_AUDIO_MCLK_B
&clkaudio CLKID_AUDIO_MCLK_PAD0
&clkc CLKID_MPLL1
&clkc CLKID_MPLL0
&clkaudio CLKID_AUDIO_SPDIFOUT_A>;
clock-names = "mclk", "clk_srcpll",
clock-names = "mclk", "mclk_pad", "clk_srcpll",
"samesource_srcpll", "samesource_clk";
pinctrl-names = "tdm_pins";
pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
Expand Down
3 changes: 2 additions & 1 deletion arch/arm64/boot/dts/amlogic/sm1_s905x3_ac213.dts
Original file line number Diff line number Diff line change
Expand Up @@ -1204,10 +1204,11 @@
dai-tdm-lane-slot-mask-out = <1 0 0 0>;
dai-tdm-clk-sel = <1>;
clocks = <&clkaudio CLKID_AUDIO_MCLK_B
&clkaudio CLKID_AUDIO_MCLK_PAD0
&clkc CLKID_MPLL1
&clkc CLKID_MPLL0
&clkaudio CLKID_AUDIO_SPDIFOUT_A>;
clock-names = "mclk", "clk_srcpll",
clock-names = "mclk", "mclk_pad", "clk_srcpll",
"samesource_srcpll", "samesource_clk";
pinctrl-names = "tdm_pins";
pinctrl-0 = <&tdmb_mclk &tdmout_b &tdmin_b>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ gceSTATUS _AdjustParam(IN gcsPLATFORM *Platform,OUT gcsMODULE_PARAMETERS *Args)
Args->extSRAMBases[0] = (gctPHYS_ADDR_T)res->start;

Args->contiguousBase = 0;
Args->contiguousSize = 0x200000;/*(gctSIZE_T)(res->end - res->start+1);*/
Args->contiguousSize = (gctSIZE_T)(res->end - res->start+1);
}
else
{
Expand Down
5 changes: 4 additions & 1 deletion drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,9 @@ void meson6_dwmac_shutdown(struct platform_device *pdev)
}

#endif

extern int wol_enable;

static int meson6_dwmac_probe(struct platform_device *pdev)
{
struct plat_stmmacenet_data *plat_dat;
Expand Down Expand Up @@ -660,7 +663,7 @@ static int meson6_dwmac_probe(struct platform_device *pdev)
ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
if (ret)
goto err_remove_config_dt;
if (support_mac_wol)
if (wol_enable)
device_init_wakeup(&pdev->dev, 1);
return 0;

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/phy/realtek.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ MODULE_AUTHOR("Johnson Leung");
MODULE_LICENSE("GPL");

struct phy_device *g_phydev;
static int wol_enable = 0;
int wol_enable = 0;

#ifdef CONFIG_AMLOGIC_ETH_PRIVE
unsigned int support_external_phy_wol;
Expand Down
5 changes: 4 additions & 1 deletion include/dt-bindings/clock/amlogic,sm1-audio-clk.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,8 @@
#define CLKID_EARCRX_CMDC (MCLK_BASE + 20)
#define CLKID_EARCRX_DMAC (MCLK_BASE + 21)

#define NUM_AUDIO_CLKS (MCLK_BASE + 22)
#define CLKID_AUDIO_MCLK_PAD0 (MCLK_BASE + 22)
#define CLKID_AUDIO_MCLK_PAD1 (MCLK_BASE + 23)

#define NUM_AUDIO_CLKS (MCLK_BASE + 24)
#endif /* __SM1_AUDIO_CLK_H__ */
5 changes: 4 additions & 1 deletion include/dt-bindings/clock/amlogic,tm2-audio-clk.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,8 @@
#define CLKID_EARCRX_CMDC (MCLK_BASE + 20)
#define CLKID_EARCRX_DMAC (MCLK_BASE + 21)

#define NUM_AUDIO_CLKS (MCLK_BASE + 22)
#define CLKID_AUDIO_MCLK_PAD0 (MCLK_BASE + 22)
#define CLKID_AUDIO_MCLK_PAD1 (MCLK_BASE + 23)

#define NUM_AUDIO_CLKS (MCLK_BASE + 24)
#endif /* __TM2_AUDIO_CLK_H__ */
9 changes: 9 additions & 0 deletions sound/soc/amlogic/auge/audio_clks.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ do { \
&_name##_gate.hw, &clk_gate_ops, \
CLK_SET_RATE_NO_REPARENT)

#define REGISTER_CLK_COM_PARENTS(_name, pnames) \
clk_register_composite(NULL, #_name, \
pnames##_parent_names, \
ARRAY_SIZE(pnames##_parent_names), \
&_name##_mux.hw, &clk_mux_ops, \
&_name##_div.hw, &clk_divider_ops, \
&_name##_gate.hw, &clk_gate_ops, \
CLK_SET_RATE_NO_REPARENT)

struct audio_clk_init {
int clk_num;
int (*clk_gates)(struct clk **clks, void __iomem *iobase);
Expand Down
24 changes: 24 additions & 0 deletions sound/soc/amlogic/auge/sm1,clocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ static const char *const audioclk_parent_names[] = {
"i_slv_sclk_d", "i_slv_sclk_e", "i_slv_sclk_f", "i_slv_sclk_g",
"i_slv_sclk_h", "i_slv_sclk_i", "i_slv_sclk_j"};

static const char *const mclk_pad_parent_names[] = {
"mclk_a", "mclk_b", "mclk_c",
"mclk_d", "mclk_e", "mclk_f"
};

CLOCK_GATE(audio_ddr_arb, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 0);
CLOCK_GATE(audio_pdm, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 1);
CLOCK_GATE(audio_tdmina, AUD_ADDR_OFFSET(EE_AUDIO_CLK_GATE_EN0), 2);
Expand Down Expand Up @@ -194,6 +199,15 @@ CLOCK_COM_GATE(mclk_d, AUD_ADDR_OFFSET(EE_AUDIO_MCLK_D_CTRL(1)), 31);
CLOCK_COM_MUX(mclk_e, AUD_ADDR_OFFSET(EE_AUDIO_MCLK_E_CTRL(1)), 0x7, 24);
CLOCK_COM_DIV(mclk_e, AUD_ADDR_OFFSET(EE_AUDIO_MCLK_E_CTRL(1)), 0, 16);
CLOCK_COM_GATE(mclk_e, AUD_ADDR_OFFSET(EE_AUDIO_MCLK_E_CTRL(1)), 31);
/* mclk_pad0 */
CLOCK_COM_MUX(mclk_pad0, AUD_ADDR_OFFSET(EE_AUDIO_MST_PAD_CTRL0(1)), 0x7, 8);
CLOCK_COM_DIV(mclk_pad0, AUD_ADDR_OFFSET(EE_AUDIO_MST_PAD_CTRL0(1)), 0, 8);
CLOCK_COM_GATE(mclk_pad0, AUD_ADDR_OFFSET(EE_AUDIO_MST_PAD_CTRL0(1)), 15);
/* mclk_pad1 */
CLOCK_COM_MUX(mclk_pad1, AUD_ADDR_OFFSET(EE_AUDIO_MST_PAD_CTRL0(1)), 0x7, 24);
CLOCK_COM_DIV(mclk_pad1, AUD_ADDR_OFFSET(EE_AUDIO_MST_PAD_CTRL0(1)), 16, 8);
CLOCK_COM_GATE(mclk_pad1, AUD_ADDR_OFFSET(EE_AUDIO_MST_PAD_CTRL0(1)), 31);

/* mclk_f */
CLOCK_COM_MUX(mclk_f, AUD_ADDR_OFFSET(EE_AUDIO_MCLK_F_CTRL(1)), 0x7, 24);
CLOCK_COM_DIV(mclk_f, AUD_ADDR_OFFSET(EE_AUDIO_MCLK_F_CTRL(1)), 0, 16);
Expand Down Expand Up @@ -369,6 +383,16 @@ static int sm1_clks_init(struct clk **clks, void __iomem *iobase)
clks[CLKID_EARCRX_DMAC] = REGISTER_CLK_COM(earcrx_dmac);
WARN_ON(IS_ERR_OR_NULL(clks[CLKID_EARCRX_DMAC]));

IOMAP_COM_CLK(mclk_pad0, iobase);
clks[CLKID_AUDIO_MCLK_PAD0] =
REGISTER_CLK_COM_PARENTS(mclk_pad0, mclk_pad);
WARN_ON(IS_ERR_OR_NULL(clks[CLKID_AUDIO_MCLK_PAD0]));

IOMAP_COM_CLK(mclk_pad1, iobase);
clks[CLKID_AUDIO_MCLK_PAD1] =
REGISTER_CLK_COM_PARENTS(mclk_pad1, mclk_pad);
WARN_ON(IS_ERR_OR_NULL(clks[CLKID_AUDIO_MCLK_PAD1]));

return 0;
}

Expand Down
49 changes: 36 additions & 13 deletions sound/soc/amlogic/auge/tdm.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ struct aml_tdm {
struct clk *clk;
struct clk *clk_gate;
struct clk *mclk;
/* mclk mux out to pad */
struct clk *mclk2pad;
struct clk *samesrc_srcpll;
struct clk *samesrc_clk;
bool contns_clk;
Expand Down Expand Up @@ -909,12 +911,17 @@ static int aml_tdm_set_clk_pad(struct aml_tdm *p_tdm)
if (p_tdm->chipinfo && (!p_tdm->chipinfo->mclkpad_no_offset))
mpad_offset = 1;

aml_tdm_clk_pad_select(p_tdm->actrl,
p_tdm->mclk_pad,
mpad_offset,
p_tdm->id,
p_tdm->id,
p_tdm->clk_sel);
if (p_tdm->mclk_pad >= 0) {
aml_tdm_mclk_pad_select(p_tdm->actrl,
p_tdm->mclk_pad,
mpad_offset,
p_tdm->clk_sel);
}

aml_tdm_sclk_pad_select(p_tdm->actrl,
mpad_offset,
p_tdm->id,
p_tdm->id);

return 0;
}
Expand Down Expand Up @@ -1659,7 +1666,7 @@ static int aml_tdm_platform_probe(struct platform_device *pdev)
ret = of_parse_tdm_lane_slot_out(node,
&p_tdm->setting.lane_mask_out);
if (ret < 0)
p_tdm->setting.lane_mask_out = 0x0;
p_tdm->setting.lane_mask_out = 0x1;

/* get tdm lanes oe info. if not, set to default 0 */
ret = of_parse_tdm_lane_oe_slot_in(node,
Expand Down Expand Up @@ -1701,6 +1708,28 @@ static int aml_tdm_platform_probe(struct platform_device *pdev)
return ret;
}

/* clk tree style after SM1, instead of legacy prop */
p_tdm->mclk2pad = devm_clk_get(&pdev->dev, "mclk_pad");
if (!IS_ERR(p_tdm->mclk2pad)) {
ret = clk_set_parent(p_tdm->mclk2pad, p_tdm->mclk);
if (ret) {
dev_err(&pdev->dev, "Can't set tdm mclk_pad parent\n");
return -EINVAL;
}
clk_prepare_enable(p_tdm->mclk2pad);
p_tdm->mclk_pad = -1;
} else {
/* mclk pad ctrl */
ret = of_property_read_u32(node, "mclk_pad",
&p_tdm->mclk_pad);
if (ret < 0) {
/* No mclk in defalut if chip needs mclk pad mux. */
p_tdm->mclk_pad = -1;
dev_warn_once(&pdev->dev,
"neither mclk_pad nor mclk2pad set\n");
}
}

/* complete mclk for tdm */
if (get_meson_cpu_version(MESON_CPU_VERSION_LVL_MINOR) == 0xa)
meson_clk_measure((1<<16) | 0x67);
Expand All @@ -1723,12 +1752,6 @@ static int aml_tdm_platform_probe(struct platform_device *pdev)
if (p_tdm->start_clk_enable == 1)
aml_set_default_tdm_clk(p_tdm);

/* mclk pad ctrl */
ret = of_property_read_u32(node, "mclk_pad",
&p_tdm->mclk_pad);
if (ret < 0)
p_tdm->mclk_pad = -1; /* not use mclk in defalut. */

p_tdm->dev = dev;
/* For debug to disable share buffer */
p_tdm->en_share = 1;
Expand Down
Loading

0 comments on commit deedb21

Please sign in to comment.