1 /* SPDX-License-Identifier: GPL-2.0-only */
5 #include <console/console.h>
6 #include <amdblocks/alink.h>
8 void alink_ab_indx(u32 reg_space
, u32 reg_addr
, u32 mask
, u32 val
)
12 outl((reg_space
& 0x7) << 29 | reg_addr
, AB_INDX
);
15 * For certain revisions of the chip, the ABCFG registers,
16 * with an address of 0x100NN (where 'N' is any hexadecimal
17 * number), require an extra programming step.*/
23 // printk(BIOS_DEBUG, "about write %x, index=%x", tmp,
24 // (reg_space&0x3)<<29 | reg_addr);
26 /* probably we don't have to do it again. */
27 outl((reg_space
& 0x7) << 29 | reg_addr
, AB_INDX
);
32 void alink_rc_indx(u32 reg_space
, u32 reg_addr
, u32 port
, u32 mask
, u32 val
)
36 outl((reg_space
& 0x7) << 29 | (port
& 3) << 24 | reg_addr
, AB_INDX
);
39 * For certain revisions of the chip, the ABCFG registers,
40 * with an address of 0x100NN (where 'N' is any hexadecimal
41 * number), require an extra programming step.*/
47 //printk(BIOS_DEBUG, "about write %x, index=%x", tmp,
48 // (reg_space&0x3)<<29 | (port&3) << 24 | reg_addr);
50 /* probably we don't have to do it again. */
51 outl((reg_space
& 0x7) << 29 | (port
& 3) << 24 | reg_addr
, AB_INDX
);
57 * space = 0: AX_INDXC, AX_DATAC
58 * space = 1: AX_INDXP, AX_DATAP
60 void alink_ax_indx(u32 space
/*c or p? */, u32 axindc
, u32 mask
, u32 val
)
64 /* read axindc to tmp */
65 outl(space
<< 29 | space
<< 3 | 0x30, AB_INDX
);
66 outl(axindc
, AB_DATA
);
68 outl(space
<< 29 | space
<< 3 | 0x34, AB_INDX
);
76 outl(space
<< 29 | space
<< 3 | 0x30, AB_INDX
);
77 outl(axindc
, AB_DATA
);
79 outl(space
<< 29 | space
<< 3 | 0x34, AB_INDX
);