Skip to content

Commit

Permalink
new time/early_printk/uart drivers compiling, untested
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastien Bourdeauducq committed May 22, 2012
1 parent aa07145 commit 3faaf7a
Show file tree
Hide file tree
Showing 8 changed files with 122 additions and 238 deletions.
6 changes: 2 additions & 4 deletions arch/lm32/Kconfig.cpu
Expand Up @@ -20,6 +20,7 @@ config CPU_MICO32
bool "mico32"
help
LatticeMico32 processor.

endchoice

choice
Expand All @@ -29,15 +30,12 @@ choice
config BOARD_MILKYMIST_ONE
bool "Milkymist One"

config BOARD_MILKYMIST_SOC
bool "Milkymist SoC"
endchoice
endif

config CPU_CLOCK
int "CPU Clock [Hz] (integer)"
default "80000000" if BOARD_MILKYMIST_ONE
default "100000000" if BOARD_MILKYMIST_SOC
default "83333333" if BOARD_MILKYMIST_ONE

config KERNEL_BASE_ADDR
hex "Physical address where Linux Kernel is"
Expand Down
42 changes: 15 additions & 27 deletions arch/lm32/boot/dts/milkymist_one.dts
Expand Up @@ -23,7 +23,7 @@
device_type = "cpu";
compatible = "lattice,mico32";
reg = <0>;
clock-frequency = <80000000>; /* 80 MHz */
clock-frequency = <83333333>;
i-cache-line-size = <16>;
d-cache-line-size = <16>;
i-cache-size = <4096>;
Expand All @@ -43,46 +43,34 @@
reg = <0x40000000 0x08000000>; /* 128MB */
};

flash@0 {
compatible = "cfi-flash";
reg = <0x80000000 0x02000000>; /* 32MB */
bank-width = <4>;
device-width = <1>;
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "bitstream";
reg = <0x00000000 0x00180000>;
read-only;
};
partition@180000 {
label = "unused";
reg = <0x000a0000 0x02360000>;
read-only;
};
};

csr-bus@e0000000 {
#address-cells = <1>;
#size-cells = <1>;
ranges = <0x0 0xe0000000 0x100000>;
compatible = "milkymist,csr-bus";

uart@0 {
uart@0000 {
device_type = "serial";
compatible = "milkymist,uart";
clock-frequency = <80000000>;
reg = <0x0 0x1000>;
clock-frequency = <83333333>;
reg = <0x0000 0x800>;
interrupts = <0>;
interrupt-parent = <&pic>;
};

timer@1800 {
compatible = "milkymist,timer";
reg = <0x1800 0x800>;
interrupts = <1>;
interrupt-parent = <&pic>;
};

ethernet@8000 {
ethernet@2000 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "milkymist,minimac2";
reg = <0x8000 0x1000>;
interrupts = <10 11>;
compatible = "milkymist,minimac3";
reg = <0x2000 0x800>;
interrupts = <2>;
interrupt-parent = <&pic>;

phy0: ethernet-phy@0 {
Expand Down
85 changes: 8 additions & 77 deletions arch/lm32/defconfig
Expand Up @@ -161,19 +161,18 @@ CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
CONFIG_PLAT_MILKYMIST=y
CONFIG_CPU_MICO32=y
CONFIG_BOARD_MILKYMIST_ONE=y
# CONFIG_BOARD_MILKYMIST_SOC is not set
CONFIG_CPU_CLOCK=80000000
CONFIG_CPU_CLOCK=83333333
CONFIG_KERNEL_BASE_ADDR=0x40000000
# CONFIG_EARLY_PRINTK is not set
CONFIG_EARLY_PRINTK=y
# CONFIG_LM32_HW_JTAG is not set
# CONFIG_NO_HZ is not set
# CONFIG_HIGH_RES_TIMERS is not set
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
# CONFIG_HZ_100 is not set
CONFIG_HZ_250=y
CONFIG_HZ_100=y
# CONFIG_HZ_250 is not set
# CONFIG_HZ_300 is not set
# CONFIG_HZ_1000 is not set
CONFIG_HZ=250
CONFIG_HZ=100
# CONFIG_SCHED_HRTICK is not set
CONFIG_FLATMEM_MANUAL=y
CONFIG_HAVE_MEMBLOCK=y
Expand Down Expand Up @@ -250,7 +249,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
# CONFIG_ATM is not set
# CONFIG_L2TP is not set
# CONFIG_BRIDGE is not set
# CONFIG_NET_DSA is not set
# CONFIG_VLAN_8021Q is not set
# CONFIG_DECNET is not set
# CONFIG_LLC2 is not set
Expand Down Expand Up @@ -313,8 +311,6 @@ CONFIG_OF_ADDRESS=y
CONFIG_OF_IRQ=y
CONFIG_OF_DEVICE=y
CONFIG_OF_GPIO=y
CONFIG_OF_NET=y
CONFIG_OF_MDIO=y
# CONFIG_PARPORT is not set
CONFIG_BLK_DEV=y
# CONFIG_BLK_DEV_COW_COMMON is not set
Expand Down Expand Up @@ -346,66 +342,7 @@ CONFIG_SCSI_MOD=y
# CONFIG_SCSI_NETLINK is not set
# CONFIG_ATA is not set
# CONFIG_MD is not set
CONFIG_NETDEVICES=y
# CONFIG_DUMMY is not set
# CONFIG_BONDING is not set
# CONFIG_MACVLAN is not set
# CONFIG_EQUALIZER is not set
# CONFIG_TUN is not set
# CONFIG_VETH is not set
# CONFIG_MII is not set
CONFIG_PHYLIB=y

#
# MII PHY device drivers
#
CONFIG_MARVELL_PHY=y
# CONFIG_DAVICOM_PHY is not set
# CONFIG_QSEMI_PHY is not set
# CONFIG_LXT_PHY is not set
# CONFIG_CICADA_PHY is not set
# CONFIG_VITESSE_PHY is not set
# CONFIG_SMSC_PHY is not set
# CONFIG_BROADCOM_PHY is not set
# CONFIG_ICPLUS_PHY is not set
# CONFIG_REALTEK_PHY is not set
# CONFIG_NATIONAL_PHY is not set
# CONFIG_STE10XP is not set
# CONFIG_LSI_ET1011C_PHY is not set
CONFIG_MICREL_PHY=y
# CONFIG_FIXED_PHY is not set
CONFIG_MDIO_BITBANG=y
# CONFIG_MDIO_GPIO is not set
# CONFIG_NET_ETHERNET is not set
# CONFIG_NETDEV_1000 is not set
# CONFIG_NETDEV_10000 is not set
# CONFIG_WLAN is not set

#
# Enable WiMAX (Networking options) to see the WiMAX drivers
#
# CONFIG_WAN is not set

#
# CAIF transport drivers
#
CONFIG_PPP=y
# CONFIG_PPP_MULTILINK is not set
# CONFIG_PPP_FILTER is not set
CONFIG_PPP_ASYNC=y
CONFIG_PPP_SYNC_TTY=y
CONFIG_PPP_DEFLATE=y
CONFIG_PPP_BSDCOMP=y
# CONFIG_PPP_MPPE is not set
# CONFIG_PPPOE is not set
CONFIG_SLIP=y
CONFIG_SLIP_COMPRESSED=y
CONFIG_SLHC=y
# CONFIG_SLIP_SMART is not set
# CONFIG_SLIP_MODE_SLIP6 is not set
# CONFIG_NETCONSOLE is not set
# CONFIG_NETPOLL is not set
# CONFIG_NET_POLL_CONTROLLER is not set
# CONFIG_NETDEVICES is not set
# CONFIG_ISDN is not set
# CONFIG_PHONE is not set

Expand Down Expand Up @@ -555,12 +492,7 @@ CONFIG_GPIOLIB=y
# CONFIG_HWMON is not set
# CONFIG_THERMAL is not set
# CONFIG_WATCHDOG is not set
CONFIG_MFD_SUPPORT=y
# CONFIG_MFD_CORE is not set
# CONFIG_MFD_SM501 is not set
# CONFIG_HTC_PASIC3 is not set
# CONFIG_MFD_TMIO is not set
# CONFIG_ABX500_CORE is not set
# CONFIG_MFD_SUPPORT is not set
# CONFIG_REGULATOR is not set
# CONFIG_MEDIA_SUPPORT is not set

Expand Down Expand Up @@ -597,7 +529,7 @@ CONFIG_DUMMY_CONSOLE=y
#
# CONFIG_VIRTIO_BALLOON is not set
# CONFIG_STAGING is not set
CONFIG_IOMMU_SUPPORT=y
# CONFIG_IOMMU_SUPPORT is not set
# CONFIG_VIRT_DRIVERS is not set

#
Expand Down Expand Up @@ -893,7 +825,6 @@ CONFIG_CRC32=y
# CONFIG_LIBCRC32C is not set
# CONFIG_CRC8 is not set
CONFIG_ZLIB_INFLATE=y
CONFIG_ZLIB_DEFLATE=y
# CONFIG_XZ_DEC is not set
# CONFIG_XZ_DEC_BCJ is not set
CONFIG_DECOMPRESS_GZIP=y
Expand Down
8 changes: 3 additions & 5 deletions arch/lm32/kernel/process.c
Expand Up @@ -46,7 +46,6 @@
#include <asm/traps.h>
#include <asm/setup.h>
#include <asm/pgtable.h>
#include <asm/hw/milkymist.h>

asmlinkage void ret_from_fork(void);
asmlinkage void syscall_tail(void);
Expand Down Expand Up @@ -93,9 +92,9 @@ void cpu_idle(void)

void machine_restart(char * __unused)
{
/* Writing to CSR_SYSTEM_ID causes a system reset */
iowrite32be(1, CSR_SYSTEM_ID);
while(1);
printk("%s:%d: machine_restart() is not possible on lm32\n", __FILE__, __LINE__);
for (;;)
cpu_relax();
}

void machine_halt(void)
Expand Down Expand Up @@ -259,4 +258,3 @@ void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long usp)

/*printk("start_thread: current=%lx usp=%lx\n", current, usp);*/
}

19 changes: 4 additions & 15 deletions arch/lm32/platforms/milkymist/early_printk.c
Expand Up @@ -36,26 +36,15 @@
#include <asm/irq.h>
#include <linux/io.h>

#define UART_RXTX (void*)0xe0000000
#define UART_DIVISOR (void*)0xe0000004
#define UART_STAT (void*)0xe0000008
#define UART_CTRL (void*)0xe000000c
#define UART_DEBUG (void*)0xe000000c
#define UART_RXTX ((void *)0xe0000000)
#define UART_STAT ((void *)0xe000000c)

#define UART_STAT_THRE (1<<0)
#define UART_STAT_RX_EVT (1<<1)
#define UART_STAT_TX_EVT (1<<2)
#define UART_STAT_TXING (1)

static void __init early_console_putc(char c)
{
unsigned int timeout = 1000;
uint32_t stat;

iowrite32be(c, UART_RXTX);

do {
stat = ioread32be(UART_STAT);
} while (!(stat & UART_STAT_THRE) && --timeout);
while(ioread32be(UART_STAT) & UART_STAT_TXING);
}

static void __init early_console_write(struct console *con, const char *s,
Expand Down
1 change: 0 additions & 1 deletion arch/lm32/platforms/milkymist/setup.c
Expand Up @@ -8,4 +8,3 @@ void __init plat_setup_arch(void)
milkymist_setup_early_printk();
#endif
}

0 comments on commit 3faaf7a

Please sign in to comment.