diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 9b6c626..527a913 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -159,6 +159,7 @@ select PINCTRL select PINCTRL_ROCKCHIP select HAVE_PBL_MULTI_IMAGES + select HAS_DEBUG_LL config ARCH_SOCFPGA bool "Altera SOCFPGA cyclone5" diff --git a/arch/arm/boards/friendlyarm-mini2440/Kconfig b/arch/arm/boards/friendlyarm-mini2440/Kconfig index a8e79b3..feb905e 100644 --- a/arch/arm/boards/friendlyarm-mini2440/Kconfig +++ b/arch/arm/boards/friendlyarm-mini2440/Kconfig @@ -25,4 +25,10 @@ help This adds support for MINI2440 SVGA (1024x768) video output adapter. +config MINI2440_VIDEO_W35 + bool "Support W35 display (320x240)" + select MINI2440_VIDEO + help + This adds support for Sharp 3.5 inch TFT display. + endif diff --git a/arch/arm/boards/friendlyarm-mini2440/mini2440.c b/arch/arm/boards/friendlyarm-mini2440/mini2440.c index 2dcb7db..b59c836 100644 --- a/arch/arm/boards/friendlyarm-mini2440/mini2440.c +++ b/arch/arm/boards/friendlyarm-mini2440/mini2440.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -116,6 +117,23 @@ .vmode = FB_VMODE_NONINTERLACED, }, #endif +#ifdef CONFIG_MINI2440_VIDEO_W35 + { + .name = "W35", + .refresh = 60, + .xres = 320, + .left_margin = 68, + .right_margin = 66, + .hsync_len = 4, + .yres = 240, + .upper_margin = 4, + .lower_margin = 4, + .vsync_len = 9, + .pixclock = 115913, + .sync = FB_SYNC_USE_PWREN | FB_SYNC_CLK_INVERT, + .vmode = FB_VMODE_NONINTERLACED, + }, +#endif }; static struct s3c_fb_platform_data s3c24x0_fb_data = { @@ -300,6 +318,8 @@ devfs_del_partition("env_raw"); devfs_add_partition("nand0", 0x40000, 0x20000, DEVFS_PARTITION_FIXED, "env_raw"); dev_add_bb_dev("env_raw", "env0"); + + s3c24x0_bbu_nand_register_handler(); #endif s3c24xx_add_mci(&mci_data); s3c24xx_add_fb(&s3c24x0_fb_data); diff --git a/arch/arm/cpu/cache.c b/arch/arm/cpu/cache.c index 34d3090..7b161d5 100644 --- a/arch/arm/cpu/cache.c +++ b/arch/arm/cpu/cache.c @@ -4,8 +4,6 @@ #include #include -int arm_architecture; - struct cache_fns { void (*dma_clean_range)(unsigned long start, unsigned long end); void (*dma_flush_range)(unsigned long start, unsigned long end); diff --git a/arch/arm/cpu/mmu.c b/arch/arm/cpu/mmu.c index aaf66d4..299ebdb 100644 --- a/arch/arm/cpu/mmu.c +++ b/arch/arm/cpu/mmu.c @@ -64,8 +64,6 @@ ); } -extern int arm_architecture; - #define PTE_FLAGS_CACHED_V7 (PTE_EXT_TEX(1) | PTE_BUFFERABLE | PTE_CACHEABLE) #define PTE_FLAGS_UNCACHED_V7 (0) #define PTE_FLAGS_CACHED_V4 (PTE_SMALL_AP_UNO_SRW | PTE_BUFFERABLE | PTE_CACHEABLE) diff --git a/arch/arm/mach-rockchip/include/mach/debug_ll.h b/arch/arm/mach-rockchip/include/mach/debug_ll.h new file mode 100644 index 0000000..c666b99 --- /dev/null +++ b/arch/arm/mach-rockchip/include/mach/debug_ll.h @@ -0,0 +1,60 @@ +#ifndef __MACH_DEBUG_LL_H__ +#define __MACH_DEBUG_LL_H__ + +#include + +#if CONFIG_DEBUG_ROCKCHIP_UART_PORT == 0 +#define UART_BASE 0x10124000 +#endif +#if CONFIG_DEBUG_ROCKCHIP_UART_PORT == 1 +#define UART_BASE 0x10126000 +#endif +#if CONFIG_DEBUG_ROCKCHIP_UART_PORT == 2 +#define UART_BASE 0x20064000 +#endif +#if CONFIG_DEBUG_ROCKCHIP_UART_PORT == 3 +#define UART_BASE 0x20068000 +#endif + +#define LSR_THRE 0x20 /* Xmit holding register empty */ +#define LSR (5 << 2) +#define THR (0 << 2) + +#define LCR_BKSE 0x80 /* Bank select enable */ +#define LSR (5 << 2) +#define THR (0 << 2) +#define DLL (0 << 2) +#define IER (1 << 2) +#define DLM (1 << 2) +#define FCR (2 << 2) +#define LCR (3 << 2) +#define MCR (4 << 2) +#define MDR (8 << 2) + +static inline void INIT_LL(void) +{ + unsigned int clk = 100000000; + unsigned int divisor = clk / 16 / 115200; + + writeb(0x00, UART_BASE + LCR); + writeb(0x00, UART_BASE + IER); + writeb(0x07, UART_BASE + MDR); + writeb(LCR_BKSE, UART_BASE + LCR); + writeb(divisor & 0xff, UART_BASE + DLL); + writeb(divisor >> 8, UART_BASE + DLM); + writeb(0x03, UART_BASE + LCR); + writeb(0x03, UART_BASE + MCR); + writeb(0x07, UART_BASE + FCR); + writeb(0x00, UART_BASE + MDR); +} + +static inline void PUTC_LL(char c) +{ + /* Wait until there is space in the FIFO */ + while ((readb(UART_BASE + LSR) & LSR_THRE) == 0); + /* Send the character */ + writeb(c, UART_BASE + THR); + /* Wait to make sure it hits the line, in case we die too soon. */ + while ((readb(UART_BASE + LSR) & LSR_THRE) == 0); +} +#endif diff --git a/arch/arm/mach-samsung/Kconfig b/arch/arm/mach-samsung/Kconfig index 13dac29..8f421bb 100644 --- a/arch/arm/mach-samsung/Kconfig +++ b/arch/arm/mach-samsung/Kconfig @@ -166,6 +166,12 @@ Add generic support to boot from NAND flash. Image loading will be skipped if the code is running from NOR or already from SDRAM. +config BAREBOX_UPDATE_NAND_S3C24XX + bool + depends on BAREBOX_UPDATE + depends on S3C_NAND_BOOT + default y + endmenu endif diff --git a/arch/arm/mach-samsung/Makefile b/arch/arm/mach-samsung/Makefile index 46393e1..284c80a 100644 --- a/arch/arm/mach-samsung/Makefile +++ b/arch/arm/mach-samsung/Makefile @@ -8,4 +8,5 @@ obj-$(CONFIG_ARCH_S3C64xx) += gpio-s3c64xx.o clocks-s3c64xx.o mem-s3c64xx.o obj-$(CONFIG_ARCH_S5PCxx) += gpio-s5pcxx.o clocks-s5pcxx.o mem-s5pcxx.o pbl-$(CONFIG_ARCH_S5PCxx) += mem-s5pcxx.o +obj-$(CONFIG_BAREBOX_UPDATE_NAND_S3C24XX) += bbu-nand-s3c24x0.o obj-$(CONFIG_S3C_LOWLEVEL_INIT) += $(obj-lowlevel-y) diff --git a/arch/arm/mach-samsung/bbu-nand-s3c24x0.c b/arch/arm/mach-samsung/bbu-nand-s3c24x0.c new file mode 100644 index 0000000..0d25abf --- /dev/null +++ b/arch/arm/mach-samsung/bbu-nand-s3c24x0.c @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2014 Michael Olbrich, Pengutronix + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation. + * + */ + +#include +#include +#include +#include +#include + +static int nand_update(struct bbu_handler *handler, struct bbu_data *data) +{ + int fd, ret; + + if (file_detect_type(data->image, data->len) != filetype_arm_barebox && + !bbu_force(data, "Not an ARM barebox image")) + return -EINVAL; + + ret = bbu_confirm(data); + if (ret) + return ret; + + fd = open(data->devicefile, O_WRONLY); + if (fd < 0) + return fd; + + debug("%s: eraseing %s from 0 to 0x%08x\n", __func__, + data->devicefile, data->len); + ret = erase(fd, data->len, 0); + if (ret) { + printf("erasing %s failed with %s\n", data->devicefile, + strerror(-ret)); + goto err_close; + } + + ret = write(fd, data->image, data->len); + if (ret < 0) { + printf("writing update to %s failed with %s\n", data->devicefile, + strerror(-ret)); + goto err_close; + } + + ret = 0; + +err_close: + close(fd); + + return ret; +} + +/* + * Register a s3c24x0 update handler for NAND + */ +int s3c24x0_bbu_nand_register_handler(void) +{ + struct bbu_handler *handler; + int ret; + + handler = xzalloc(sizeof(*handler)); + handler->devicefile = "/dev/nand0.barebox"; + handler->name = "nand"; + handler->handler = nand_update; + handler->flags = BBU_HANDLER_FLAG_DEFAULT; + + ret = bbu_register_handler(handler); + if (ret) + free(handler); + + return ret; +} diff --git a/arch/arm/mach-samsung/include/mach/bbu.h b/arch/arm/mach-samsung/include/mach/bbu.h new file mode 100644 index 0000000..7ce7052 --- /dev/null +++ b/arch/arm/mach-samsung/include/mach/bbu.h @@ -0,0 +1,16 @@ +#ifndef __MACH_BBU_H +#define __MACH_BBU_H + +#include +#include + +#ifdef CONFIG_BAREBOX_UPDATE_NAND_S3C24XX +int s3c24x0_bbu_nand_register_handler(void); +#else +static inline int s3c24x0_bbu_nand_register_handler(void) +{ + return -ENOSYS; +} +#endif + +#endif diff --git a/common/Kconfig b/common/Kconfig index d437343..62d82c6 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -846,6 +846,13 @@ Say Y here if you want kernel low-level debugging support on AM33XX. +config DEBUG_ROCKCHIP_UART + bool "RK31xx Debug UART" + depends on ARCH_ROCKCHIP + help + Say Y here if you want kernel low-level debugging support + on RK31XX. + endchoice config DEBUG_IMX_UART_PORT @@ -878,6 +885,14 @@ OMAP4: 1 - 3 AM33XX: 0 - 2 +config DEBUG_ROCKCHIP_UART_PORT + int "RK31xx UART debug port" if DEBUG_ROCKCHIP_UART + default 2 + depends on ARCH_ROCKCHIP + help + Choose UART port on which kernel low-level debug messages + should be output. + config DEBUG_INITCALLS bool "Trace initcalls" help diff --git a/pbl/misc.c b/pbl/misc.c index 9065bf0..7e76120 100644 --- a/pbl/misc.c +++ b/pbl/misc.c @@ -13,9 +13,3 @@ { while(1); } - -void __noreturn start_barebox(void) -{ - /* Should never be here in the pbl */ - hang(); -}