Path: blob/master/arch/arm/mach-ep93xx/include/mach/uncompress.h
15157 views
/*1* arch/arm/mach-ep93xx/include/mach/uncompress.h2*3* Copyright (C) 2006 Lennert Buytenhek <[email protected]>4*5* This program is free software; you can redistribute it and/or modify6* it under the terms of the GNU General Public License as published by7* the Free Software Foundation; either version 2 of the License, or (at8* your option) any later version.9*/1011#include <mach/ep93xx-regs.h>1213static unsigned char __raw_readb(unsigned int ptr)14{15return *((volatile unsigned char *)ptr);16}1718static unsigned int __raw_readl(unsigned int ptr)19{20return *((volatile unsigned int *)ptr);21}2223static void __raw_writeb(unsigned char value, unsigned int ptr)24{25*((volatile unsigned char *)ptr) = value;26}2728static void __raw_writel(unsigned int value, unsigned int ptr)29{30*((volatile unsigned int *)ptr) = value;31}3233#if defined(CONFIG_EP93XX_EARLY_UART1)34#define UART_BASE EP93XX_UART1_PHYS_BASE35#elif defined(CONFIG_EP93XX_EARLY_UART2)36#define UART_BASE EP93XX_UART2_PHYS_BASE37#elif defined(CONFIG_EP93XX_EARLY_UART3)38#define UART_BASE EP93XX_UART3_PHYS_BASE39#else40#define UART_BASE EP93XX_UART1_PHYS_BASE41#endif4243#define PHYS_UART_DATA (UART_BASE + 0x00)44#define PHYS_UART_FLAG (UART_BASE + 0x18)45#define UART_FLAG_TXFF 0x204647static inline void putc(int c)48{49int i;5051for (i = 0; i < 1000; i++) {52/* Transmit fifo not full? */53if (!(__raw_readb(PHYS_UART_FLAG) & UART_FLAG_TXFF))54break;55}5657__raw_writeb(c, PHYS_UART_DATA);58}5960static inline void flush(void)61{62}636465/*66* Some bootloaders don't turn off DMA from the ethernet MAC before67* jumping to linux, which means that we might end up with bits of RX68* status and packet data scribbled over the uncompressed kernel image.69* Work around this by resetting the ethernet MAC before we uncompress.70*/71#define PHYS_ETH_SELF_CTL 0x8001002072#define ETH_SELF_CTL_RESET 0x000000017374static void ethernet_reset(void)75{76unsigned int v;7778/* Reset the ethernet MAC. */79v = __raw_readl(PHYS_ETH_SELF_CTL);80__raw_writel(v | ETH_SELF_CTL_RESET, PHYS_ETH_SELF_CTL);8182/* Wait for reset to finish. */83while (__raw_readl(PHYS_ETH_SELF_CTL) & ETH_SELF_CTL_RESET)84;85}868788static void arch_decomp_setup(void)89{90ethernet_reset();91}9293#define arch_decomp_wdog()949596