mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-06-09 23:36:03 +09:00
x86: quark: Convert to use clrbits, setbits, clrsetbits macros
Change existing codes to use clrbits, setbits, clrsetbits macros. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
d0b3e3bfbb
commit
8e3683029e
|
@ -73,8 +73,6 @@ static void quark_setup_bars(void)
|
||||||
|
|
||||||
static void quark_pcie_early_init(void)
|
static void quark_pcie_early_init(void)
|
||||||
{
|
{
|
||||||
u32 pcie_cfg;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Step1: Assert PCIe signal PERST#
|
* Step1: Assert PCIe signal PERST#
|
||||||
*
|
*
|
||||||
|
@ -84,23 +82,18 @@ static void quark_pcie_early_init(void)
|
||||||
board_assert_perst();
|
board_assert_perst();
|
||||||
|
|
||||||
/* Step2: PHY common lane reset */
|
/* Step2: PHY common lane reset */
|
||||||
pcie_cfg = msg_port_alt_read(MSG_PORT_SOC_UNIT, PCIE_CFG);
|
msg_port_alt_setbits(MSG_PORT_SOC_UNIT, PCIE_CFG, PCIE_PHY_LANE_RST);
|
||||||
pcie_cfg |= PCIE_PHY_LANE_RST;
|
|
||||||
msg_port_alt_write(MSG_PORT_SOC_UNIT, PCIE_CFG, pcie_cfg);
|
|
||||||
/* wait 1 ms for PHY common lane reset */
|
/* wait 1 ms for PHY common lane reset */
|
||||||
mdelay(1);
|
mdelay(1);
|
||||||
|
|
||||||
/* Step3: PHY sideband interface reset and controller main reset */
|
/* Step3: PHY sideband interface reset and controller main reset */
|
||||||
pcie_cfg = msg_port_alt_read(MSG_PORT_SOC_UNIT, PCIE_CFG);
|
msg_port_alt_setbits(MSG_PORT_SOC_UNIT, PCIE_CFG,
|
||||||
pcie_cfg |= (PCIE_PHY_SB_RST | PCIE_CTLR_MAIN_RST);
|
PCIE_PHY_SB_RST | PCIE_CTLR_MAIN_RST);
|
||||||
msg_port_alt_write(MSG_PORT_SOC_UNIT, PCIE_CFG, pcie_cfg);
|
|
||||||
/* wait 80ms for PLL to lock */
|
/* wait 80ms for PLL to lock */
|
||||||
mdelay(80);
|
mdelay(80);
|
||||||
|
|
||||||
/* Step4: Controller sideband interface reset */
|
/* Step4: Controller sideband interface reset */
|
||||||
pcie_cfg = msg_port_alt_read(MSG_PORT_SOC_UNIT, PCIE_CFG);
|
msg_port_alt_setbits(MSG_PORT_SOC_UNIT, PCIE_CFG, PCIE_CTLR_SB_RST);
|
||||||
pcie_cfg |= PCIE_CTLR_SB_RST;
|
|
||||||
msg_port_alt_write(MSG_PORT_SOC_UNIT, PCIE_CFG, pcie_cfg);
|
|
||||||
/* wait 20ms for controller sideband interface reset */
|
/* wait 20ms for controller sideband interface reset */
|
||||||
mdelay(20);
|
mdelay(20);
|
||||||
|
|
||||||
|
@ -108,66 +101,43 @@ static void quark_pcie_early_init(void)
|
||||||
board_deassert_perst();
|
board_deassert_perst();
|
||||||
|
|
||||||
/* Step6: Controller primary interface reset */
|
/* Step6: Controller primary interface reset */
|
||||||
pcie_cfg = msg_port_alt_read(MSG_PORT_SOC_UNIT, PCIE_CFG);
|
msg_port_alt_setbits(MSG_PORT_SOC_UNIT, PCIE_CFG, PCIE_CTLR_PRI_RST);
|
||||||
pcie_cfg |= PCIE_CTLR_PRI_RST;
|
|
||||||
msg_port_alt_write(MSG_PORT_SOC_UNIT, PCIE_CFG, pcie_cfg);
|
|
||||||
|
|
||||||
/* Mixer Load Lane 0 */
|
/* Mixer Load Lane 0 */
|
||||||
pcie_cfg = msg_port_io_read(MSG_PORT_PCIE_AFE, PCIE_RXPICTRL0_L0);
|
msg_port_io_clrbits(MSG_PORT_PCIE_AFE, PCIE_RXPICTRL0_L0,
|
||||||
pcie_cfg &= ~((1 << 6) | (1 << 7));
|
(1 << 6) | (1 << 7));
|
||||||
msg_port_io_write(MSG_PORT_PCIE_AFE, PCIE_RXPICTRL0_L0, pcie_cfg);
|
|
||||||
|
|
||||||
/* Mixer Load Lane 1 */
|
/* Mixer Load Lane 1 */
|
||||||
pcie_cfg = msg_port_io_read(MSG_PORT_PCIE_AFE, PCIE_RXPICTRL0_L1);
|
msg_port_io_clrbits(MSG_PORT_PCIE_AFE, PCIE_RXPICTRL0_L1,
|
||||||
pcie_cfg &= ~((1 << 6) | (1 << 7));
|
(1 << 6) | (1 << 7));
|
||||||
msg_port_io_write(MSG_PORT_PCIE_AFE, PCIE_RXPICTRL0_L1, pcie_cfg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void quark_usb_early_init(void)
|
static void quark_usb_early_init(void)
|
||||||
{
|
{
|
||||||
u32 usb;
|
|
||||||
|
|
||||||
/* The sequence below comes from Quark firmware writer guide */
|
/* The sequence below comes from Quark firmware writer guide */
|
||||||
|
|
||||||
usb = msg_port_alt_read(MSG_PORT_USB_AFE, USB2_GLOBAL_PORT);
|
msg_port_alt_clrsetbits(MSG_PORT_USB_AFE, USB2_GLOBAL_PORT,
|
||||||
usb &= ~(1 << 1);
|
1 << 1, (1 << 6) | (1 << 7));
|
||||||
usb |= ((1 << 6) | (1 << 7));
|
|
||||||
msg_port_alt_write(MSG_PORT_USB_AFE, USB2_GLOBAL_PORT, usb);
|
|
||||||
|
|
||||||
usb = msg_port_alt_read(MSG_PORT_USB_AFE, USB2_COMPBG);
|
msg_port_alt_clrsetbits(MSG_PORT_USB_AFE, USB2_COMPBG,
|
||||||
usb &= ~((1 << 8) | (1 << 9));
|
(1 << 8) | (1 << 9), (1 << 7) | (1 << 10));
|
||||||
usb |= ((1 << 7) | (1 << 10));
|
|
||||||
msg_port_alt_write(MSG_PORT_USB_AFE, USB2_COMPBG, usb);
|
|
||||||
|
|
||||||
usb = msg_port_alt_read(MSG_PORT_USB_AFE, USB2_PLL2);
|
msg_port_alt_setbits(MSG_PORT_USB_AFE, USB2_PLL2, 1 << 29);
|
||||||
usb |= (1 << 29);
|
|
||||||
msg_port_alt_write(MSG_PORT_USB_AFE, USB2_PLL2, usb);
|
|
||||||
|
|
||||||
usb = msg_port_alt_read(MSG_PORT_USB_AFE, USB2_PLL1);
|
msg_port_alt_setbits(MSG_PORT_USB_AFE, USB2_PLL1, 1 << 1);
|
||||||
usb |= (1 << 1);
|
|
||||||
msg_port_alt_write(MSG_PORT_USB_AFE, USB2_PLL1, usb);
|
|
||||||
|
|
||||||
usb = msg_port_alt_read(MSG_PORT_USB_AFE, USB2_PLL1);
|
msg_port_alt_clrsetbits(MSG_PORT_USB_AFE, USB2_PLL1,
|
||||||
usb &= ~((1 << 3) | (1 << 4) | (1 << 5));
|
(1 << 3) | (1 << 4) | (1 << 5), 1 << 6);
|
||||||
usb |= (1 << 6);
|
|
||||||
msg_port_alt_write(MSG_PORT_USB_AFE, USB2_PLL1, usb);
|
|
||||||
|
|
||||||
usb = msg_port_alt_read(MSG_PORT_USB_AFE, USB2_PLL2);
|
msg_port_alt_clrbits(MSG_PORT_USB_AFE, USB2_PLL2, 1 << 29);
|
||||||
usb &= ~(1 << 29);
|
|
||||||
msg_port_alt_write(MSG_PORT_USB_AFE, USB2_PLL2, usb);
|
|
||||||
|
|
||||||
usb = msg_port_alt_read(MSG_PORT_USB_AFE, USB2_PLL2);
|
msg_port_alt_setbits(MSG_PORT_USB_AFE, USB2_PLL2, 1 << 24);
|
||||||
usb |= (1 << 24);
|
|
||||||
msg_port_alt_write(MSG_PORT_USB_AFE, USB2_PLL2, usb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void quark_enable_legacy_seg(void)
|
static void quark_enable_legacy_seg(void)
|
||||||
{
|
{
|
||||||
u32 hmisc2;
|
msg_port_setbits(MSG_PORT_HOST_BRIDGE, HMISC2,
|
||||||
|
HMISC2_SEGE | HMISC2_SEGF | HMISC2_SEGAB);
|
||||||
hmisc2 = msg_port_read(MSG_PORT_HOST_BRIDGE, HMISC2);
|
|
||||||
hmisc2 |= (HMISC2_SEGE | HMISC2_SEGF | HMISC2_SEGAB);
|
|
||||||
msg_port_write(MSG_PORT_HOST_BRIDGE, HMISC2, hmisc2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int arch_cpu_init(void)
|
int arch_cpu_init(void)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user