mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-29 22:10:51 -04:00
Code in misc-ep93xx.h relies on machine_is_*() macros for several
boards that no longer have legacy board files. They were removed in
commit e5ef574dda ("ARM: ep93xx: delete all boardfiles"). This
prevents the removal of machine IDs no longer used by the kernel from
mach-types. To resolve this issue, create local copies of these macros.
(The checks themselves are still valid because the IDs are still passed
in by the bootloader on these machines.) Also take the opportunity to
remove three repeated checks for the same ID.
Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com>
Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Signed-off-by: Alexander Sverdlin <asv@kernel.org>
88 lines
2.7 KiB
C
88 lines
2.7 KiB
C
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
/*
|
|
* Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org>
|
|
*/
|
|
|
|
/*
|
|
* These machine IDs are no longer used by the kernel since EP93xx was converted
|
|
* to DT booting, but they are still passed in by bootloaders, so we use our own
|
|
* local definitions of the relevant macros.
|
|
*/
|
|
#define machine_is_bk3() (__machine_arch_type == 1880)
|
|
#define machine_is_edb9301() (__machine_arch_type == 462)
|
|
#define machine_is_edb9302a() (__machine_arch_type == 1127)
|
|
#define machine_is_edb9302() (__machine_arch_type == 538)
|
|
#define machine_is_edb9307a() (__machine_arch_type == 1128)
|
|
#define machine_is_edb9307() (__machine_arch_type == 607)
|
|
#define machine_is_edb9312() (__machine_arch_type == 451)
|
|
#define machine_is_edb9315a() (__machine_arch_type == 772)
|
|
#define machine_is_edb9315() (__machine_arch_type == 463)
|
|
#define machine_is_ts72xx() (__machine_arch_type == 673)
|
|
#define machine_is_vision_ep9307() (__machine_arch_type == 1578)
|
|
|
|
static inline unsigned int __raw_readl(unsigned int ptr)
|
|
{
|
|
return *((volatile unsigned int *)ptr);
|
|
}
|
|
|
|
static inline void __raw_writeb(unsigned char value, unsigned int ptr)
|
|
{
|
|
*((volatile unsigned char *)ptr) = value;
|
|
}
|
|
|
|
static inline void __raw_writel(unsigned int value, unsigned int ptr)
|
|
{
|
|
*((volatile unsigned int *)ptr) = value;
|
|
}
|
|
|
|
/*
|
|
* Some bootloaders don't turn off DMA from the ethernet MAC before
|
|
* jumping to linux, which means that we might end up with bits of RX
|
|
* status and packet data scribbled over the uncompressed kernel image.
|
|
* Work around this by resetting the ethernet MAC before we uncompress.
|
|
*/
|
|
#define PHYS_ETH_SELF_CTL 0x80010020
|
|
#define ETH_SELF_CTL_RESET 0x00000001
|
|
|
|
static inline void ep93xx_ethernet_reset(void)
|
|
{
|
|
unsigned int v;
|
|
|
|
/* Reset the ethernet MAC. */
|
|
v = __raw_readl(PHYS_ETH_SELF_CTL);
|
|
__raw_writel(v | ETH_SELF_CTL_RESET, PHYS_ETH_SELF_CTL);
|
|
|
|
/* Wait for reset to finish. */
|
|
while (__raw_readl(PHYS_ETH_SELF_CTL) & ETH_SELF_CTL_RESET)
|
|
;
|
|
}
|
|
|
|
#define TS72XX_WDT_CONTROL_PHYS_BASE 0x23800000
|
|
#define TS72XX_WDT_FEED_PHYS_BASE 0x23c00000
|
|
#define TS72XX_WDT_FEED_VAL 0x05
|
|
|
|
static inline void __maybe_unused ts72xx_watchdog_disable(void)
|
|
{
|
|
__raw_writeb(TS72XX_WDT_FEED_VAL, TS72XX_WDT_FEED_PHYS_BASE);
|
|
__raw_writeb(0, TS72XX_WDT_CONTROL_PHYS_BASE);
|
|
}
|
|
|
|
static inline void ep93xx_decomp_setup(void)
|
|
{
|
|
if (machine_is_ts72xx())
|
|
ts72xx_watchdog_disable();
|
|
|
|
if (machine_is_edb9301() ||
|
|
machine_is_edb9302() ||
|
|
machine_is_edb9302a() ||
|
|
machine_is_edb9307() ||
|
|
machine_is_edb9307a() ||
|
|
machine_is_edb9312() ||
|
|
machine_is_edb9315() ||
|
|
machine_is_edb9315a() ||
|
|
machine_is_ts72xx() ||
|
|
machine_is_bk3() ||
|
|
machine_is_vision_ep9307())
|
|
ep93xx_ethernet_reset();
|
|
}
|