mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-16 17:58:23 +00:00
5750e5e29a
Intel Quark SoC has a low end x86 processor with only 400MHz frequency. Currently it takes about 15 seconds for U-Boot to boot to shell and the most time consuming part is with MRC, which is about 12 seconds. MRC programs lots of registers on the SoC internal message bus indirectly accessed via pci bus. To speed up the boot, create an optimized version of pci config read/write dword routines which directly operate on PCI I/O ports. These two routines are inlined to provide better performance too. Now it only takes about 3 seconds to finish MRC, which is really fast (4 times faster than before). Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
77 lines
2 KiB
C
77 lines
2 KiB
C
/*
|
|
* Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <asm/arch/device.h>
|
|
#include <asm/arch/msg_port.h>
|
|
#include <asm/arch/quark.h>
|
|
|
|
void msg_port_setup(int op, int port, int reg)
|
|
{
|
|
qrk_pci_write_config_dword(QUARK_HOST_BRIDGE, MSG_CTRL_REG,
|
|
(((op) << 24) | ((port) << 16) |
|
|
(((reg) << 8) & 0xff00) | MSG_BYTE_ENABLE));
|
|
}
|
|
|
|
u32 msg_port_read(u8 port, u32 reg)
|
|
{
|
|
u32 value;
|
|
|
|
qrk_pci_write_config_dword(QUARK_HOST_BRIDGE, MSG_CTRL_EXT_REG,
|
|
reg & 0xffffff00);
|
|
msg_port_setup(MSG_OP_READ, port, reg);
|
|
qrk_pci_read_config_dword(QUARK_HOST_BRIDGE, MSG_DATA_REG, &value);
|
|
|
|
return value;
|
|
}
|
|
|
|
void msg_port_write(u8 port, u32 reg, u32 value)
|
|
{
|
|
qrk_pci_write_config_dword(QUARK_HOST_BRIDGE, MSG_DATA_REG, value);
|
|
qrk_pci_write_config_dword(QUARK_HOST_BRIDGE, MSG_CTRL_EXT_REG,
|
|
reg & 0xffffff00);
|
|
msg_port_setup(MSG_OP_WRITE, port, reg);
|
|
}
|
|
|
|
u32 msg_port_alt_read(u8 port, u32 reg)
|
|
{
|
|
u32 value;
|
|
|
|
qrk_pci_write_config_dword(QUARK_HOST_BRIDGE, MSG_CTRL_EXT_REG,
|
|
reg & 0xffffff00);
|
|
msg_port_setup(MSG_OP_ALT_READ, port, reg);
|
|
qrk_pci_read_config_dword(QUARK_HOST_BRIDGE, MSG_DATA_REG, &value);
|
|
|
|
return value;
|
|
}
|
|
|
|
void msg_port_alt_write(u8 port, u32 reg, u32 value)
|
|
{
|
|
qrk_pci_write_config_dword(QUARK_HOST_BRIDGE, MSG_DATA_REG, value);
|
|
qrk_pci_write_config_dword(QUARK_HOST_BRIDGE, MSG_CTRL_EXT_REG,
|
|
reg & 0xffffff00);
|
|
msg_port_setup(MSG_OP_ALT_WRITE, port, reg);
|
|
}
|
|
|
|
u32 msg_port_io_read(u8 port, u32 reg)
|
|
{
|
|
u32 value;
|
|
|
|
qrk_pci_write_config_dword(QUARK_HOST_BRIDGE, MSG_CTRL_EXT_REG,
|
|
reg & 0xffffff00);
|
|
msg_port_setup(MSG_OP_IO_READ, port, reg);
|
|
qrk_pci_read_config_dword(QUARK_HOST_BRIDGE, MSG_DATA_REG, &value);
|
|
|
|
return value;
|
|
}
|
|
|
|
void msg_port_io_write(u8 port, u32 reg, u32 value)
|
|
{
|
|
qrk_pci_write_config_dword(QUARK_HOST_BRIDGE, MSG_DATA_REG, value);
|
|
qrk_pci_write_config_dword(QUARK_HOST_BRIDGE, MSG_CTRL_EXT_REG,
|
|
reg & 0xffffff00);
|
|
msg_port_setup(MSG_OP_IO_WRITE, port, reg);
|
|
}
|