Tom Rini d678a59d2d Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""
When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay
Ethernet"' I failed to notice that b4 noticed it was based on next and
so took that as the base commit and merged that part of next to master.

This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing
changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35.

Reported-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-19 08:16:36 -06:00

62 lines
1.4 KiB
C

// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
*/
#include <common.h>
#include <asm/io.h>
#include <asm/arch/device.h>
#include <asm/arch/quark.h>
/*
* Intel Galileo gen2 board uses GPIO Resume Well bank pin0 as the PERST# pin.
*
* We cannot use any public GPIO APIs in <asm-generic/gpio.h> to control this
* pin, as these APIs will eventually call into gpio_ich6_of_to_plat()
* in the Intel ICH6 GPIO driver where it calls PCI configuration space access
* APIs which will trigger PCI enumeration process.
*
* Check <asm/arch-quark/quark.h> for more details.
*/
void board_assert_perst(void)
{
u32 base, port, val;
/* retrieve the GPIO IO base */
qrk_pci_read_config_dword(QUARK_LEGACY_BRIDGE, LB_GBA, &base);
base = (base & 0xffff) & ~0x7f;
/* enable the pin */
port = base + 0x20;
val = inl(port);
val |= (1 << 0);
outl(val, port);
/* configure the pin as output */
port = base + 0x24;
val = inl(port);
val &= ~(1 << 0);
outl(val, port);
/* pull it down (assert) */
port = base + 0x28;
val = inl(port);
val &= ~(1 << 0);
outl(val, port);
}
void board_deassert_perst(void)
{
u32 base, port, val;
/* retrieve the GPIO IO base */
qrk_pci_read_config_dword(QUARK_LEGACY_BRIDGE, LB_GBA, &base);
base = (base & 0xffff) & ~0x7f;
/* pull it up (de-assert) */
port = base + 0x28;
val = inl(port);
val |= (1 << 0);
outl(val, port);
}