9
0
Fork 0

Merge branch 'for-next/misc'

This commit is contained in:
Sascha Hauer 2013-02-04 15:49:00 +01:00
commit da5fe0ba47
41 changed files with 421 additions and 81 deletions

16
MAKEALL
View File

@ -56,6 +56,7 @@ usage() {
echo "JOBS -j jobs"
echo "BUILDDIR -O build dir"
echo "LOGDIR -l log dir"
echo "REGEX -e regex"
echo ""
}
@ -152,8 +153,9 @@ do_build_target() {
do_build() {
local arch=$1
local regex=$2
for i in arch/${arch}/configs/*_defconfig
find arch/${arch}/configs -name "${regex}_defconfig" | while read i
do
local target=$(basename $i)
@ -178,7 +180,7 @@ do_build_all() {
return $build_target
}
while getopts "hc:j:O:l:a:" Option
while getopts "hc:j:O:l:a:e:" Option
do
case $Option in
a )
@ -196,6 +198,9 @@ case $Option in
O )
BUILDDIR=${OPTARG}
;;
e )
REGEX=${OPTARG}
;;
h )
usage
exit 0
@ -241,6 +246,11 @@ fi
[ -d "${LOGDIR}" ] || mkdir ${LOGDIR} || exit 1
if [ ! "${REGEX}" ]
then
REGEX="*"
fi
if [ ! "${CONFIG}" ] && [ ! "${CROSS_COMPILE+set}" ]
then
echo "You need to specify a CONFIG or a CROSS_COMPILE"
@ -262,7 +272,7 @@ fi
if [ $# -eq 0 ]
then
do_build ${ARCH}
do_build ${ARCH} "${REGEX}"
else
do_build_target ${ARCH} $1
fi

View File

@ -15,7 +15,7 @@ CONFIG_MALLOC_SIZE=0x2000000
CONFIG_SHELL_NONE=y
# CONFIG_ERRNO_MESSAGES is not set
# CONFIG_TIMESTAMP is not set
# CONFIG_CONSOLE_FULL is not set
CONFIG_CONSOLE_SIMPLE=y
# CONFIG_DEFAULT_ENVIRONMENT is not set
CONFIG_DRIVER_SERIAL_OMAP4_USBBOOT=y
# CONFIG_SPI is not set

View File

@ -14,7 +14,7 @@ CONFIG_PROMPT="X-load Beagle>"
CONFIG_SHELL_NONE=y
# CONFIG_ERRNO_MESSAGES is not set
# CONFIG_TIMESTAMP is not set
# CONFIG_CONSOLE_FULL is not set
CONFIG_CONSOLE_SIMPLE=y
# CONFIG_DEFAULT_ENVIRONMENT is not set
CONFIG_DRIVER_SERIAL_NS16550=y
CONFIG_DRIVER_SERIAL_NS16550_OMAP_EXTENSIONS=y

View File

@ -14,7 +14,7 @@ CONFIG_PROMPT="barebox> "
CONFIG_SHELL_NONE=y
# CONFIG_ERRNO_MESSAGES is not set
# CONFIG_TIMESTAMP is not set
# CONFIG_CONSOLE_FULL is not set
CONFIG_CONSOLE_SIMPLE=y
# CONFIG_DEFAULT_ENVIRONMENT is not set
CONFIG_DRIVER_SERIAL_NS16550=y
CONFIG_DRIVER_SERIAL_NS16550_OMAP_EXTENSIONS=y

View File

@ -17,7 +17,7 @@ CONFIG_PROMPT="barebox> "
CONFIG_SHELL_NONE=y
# CONFIG_ERRNO_MESSAGES is not set
# CONFIG_TIMESTAMP is not set
# CONFIG_CONSOLE_FULL is not set
CONFIG_CONSOLE_SIMPLE=y
# CONFIG_DEFAULT_ENVIRONMENT is not set
CONFIG_DRIVER_SERIAL_NS16550=y
CONFIG_DRIVER_SERIAL_NS16550_OMAP_EXTENSIONS=y

View File

@ -20,7 +20,7 @@ CONFIG_CBSIZE=128
CONFIG_SHELL_NONE=y
# CONFIG_ERRNO_MESSAGES is not set
# CONFIG_TIMESTAMP is not set
# CONFIG_CONSOLE_FULL is not set
CONFIG_CONSOLE_SIMPLE=y
# CONFIG_DEFAULT_ENVIRONMENT is not set
CONFIG_DRIVER_SERIAL_NS16550=y
CONFIG_DRIVER_SERIAL_NS16550_OMAP_EXTENSIONS=y

View File

@ -17,7 +17,7 @@ CONFIG_PROMPT="barebox> "
CONFIG_SHELL_NONE=y
# CONFIG_ERRNO_MESSAGES is not set
# CONFIG_TIMESTAMP is not set
# CONFIG_CONSOLE_FULL is not set
CONFIG_CONSOLE_SIMPLE=y
# CONFIG_DEFAULT_ENVIRONMENT is not set
CONFIG_DRIVER_SERIAL_NS16550=y
CONFIG_DRIVER_SERIAL_NS16550_OMAP_EXTENSIONS=y

View File

@ -73,11 +73,25 @@ extern int arm_architecture;
#define PTE_FLAGS_CACHED_V4 (PTE_SMALL_AP_UNO_SRW | PTE_BUFFERABLE | PTE_CACHEABLE)
#define PTE_FLAGS_UNCACHED_V4 PTE_SMALL_AP_UNO_SRW
static uint32_t PTE_FLAGS_CACHED;
static uint32_t PTE_FLAGS_UNCACHED;
/*
* PTE flags to set cached and uncached areas.
* This will be determined at runtime.
*/
static uint32_t pte_flags_cached;
static uint32_t pte_flags_uncached;
#define PTE_MASK ((1 << 12) - 1)
uint32_t mmu_get_pte_cached_flags()
{
return pte_flags_cached;
}
uint32_t mmu_get_pte_uncached_flags()
{
return pte_flags_uncached;
}
/*
* Create a second level translation table for the given virtual address.
* We initially create a flat uncached mapping on it.
@ -93,7 +107,7 @@ static u32 *arm_create_pte(unsigned long virt)
ttb[virt >> 20] = (unsigned long)table | PMD_TYPE_TABLE;
for (i = 0; i < 256; i++) {
table[i] = virt | PTE_TYPE_SMALL | PTE_FLAGS_UNCACHED;
table[i] = virt | PTE_TYPE_SMALL | pte_flags_uncached;
virt += PAGE_SIZE;
}
@ -114,7 +128,7 @@ static u32 *find_pte(unsigned long adr)
return &table[(adr >> PAGE_SHIFT) & 0xff];
}
static void remap_range(void *_start, size_t size, uint32_t flags)
void remap_range(void *_start, size_t size, uint32_t flags)
{
unsigned long start = (unsigned long)_start;
u32 *p;
@ -176,7 +190,7 @@ static int arm_mmu_remap_sdram(struct memory_bank *bank)
for (i = 0; i < num_ptes; i++) {
ptes[i] = (phys + i * 4096) | PTE_TYPE_SMALL |
PTE_FLAGS_CACHED;
pte_flags_cached;
}
pte = 0;
@ -238,9 +252,10 @@ static void vectors_init(void)
memcpy(vectors, __exceptions_start, __exceptions_stop - __exceptions_start);
if (cr & CR_V)
exc[256 - 16] = (u32)vectors | PTE_TYPE_SMALL | PTE_FLAGS_CACHED;
exc[256 - 16] = (u32)vectors | PTE_TYPE_SMALL |
pte_flags_cached;
else
exc[0] = (u32)vectors | PTE_TYPE_SMALL | PTE_FLAGS_CACHED;
exc[0] = (u32)vectors | PTE_TYPE_SMALL | pte_flags_cached;
}
/*
@ -254,11 +269,11 @@ static int mmu_init(void)
arm_set_cache_functions();
if (cpu_architecture() >= CPU_ARCH_ARMv7) {
PTE_FLAGS_CACHED = PTE_FLAGS_CACHED_V7;
PTE_FLAGS_UNCACHED = PTE_FLAGS_UNCACHED_V7;
pte_flags_cached = PTE_FLAGS_CACHED_V7;
pte_flags_uncached = PTE_FLAGS_UNCACHED_V7;
} else {
PTE_FLAGS_CACHED = PTE_FLAGS_CACHED_V4;
PTE_FLAGS_UNCACHED = PTE_FLAGS_UNCACHED_V4;
pte_flags_cached = PTE_FLAGS_CACHED_V4;
pte_flags_uncached = PTE_FLAGS_UNCACHED_V4;
}
ttb = memalign(0x10000, 0x4000);
@ -315,8 +330,6 @@ void mmu_disable(void)
__mmu_cache_off();
}
#define PAGE_ALIGN(s) (((s) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
void *dma_alloc_coherent(size_t size)
{
void *ret;
@ -326,7 +339,7 @@ void *dma_alloc_coherent(size_t size)
dma_inv_range((unsigned long)ret, (unsigned long)ret + size);
remap_range(ret, size, PTE_FLAGS_UNCACHED);
remap_range(ret, size, pte_flags_uncached);
return ret;
}
@ -343,7 +356,7 @@ void *phys_to_virt(unsigned long phys)
void dma_free_coherent(void *mem, size_t size)
{
remap_range(mem, size, PTE_FLAGS_CACHED);
remap_range(mem, size, pte_flags_cached);
free(mem);
}

View File

@ -41,7 +41,10 @@ void dma_flush_range(unsigned long, unsigned long);
void dma_inv_range(unsigned long, unsigned long);
unsigned long virt_to_phys(void *virt);
void *phys_to_virt(unsigned long phys);
void remap_range(void *_start, size_t size, uint32_t flags);
void *map_io_sections(unsigned long physaddr, void *start, size_t size);
uint32_t mmu_get_pte_cached_flags(void);
uint32_t mmu_get_pte_uncached_flags(void);
#else
static inline void *dma_alloc_coherent(size_t size)
@ -76,11 +79,25 @@ static inline void dma_inv_range(unsigned long s, unsigned long e)
{
}
static inline void remap_range(void *_start, size_t size, uint32_t flags)
{
}
static inline void *map_io_sections(unsigned long phys, void *start, size_t size)
{
return (void *)phys;
}
static inline uint32_t mmu_get_pte_cached_flags(void)
{
return 0;
}
static inline uint32_t mmu_get_pte_uncached_flags(void)
{
return 0;
}
#endif
#ifdef CONFIG_CACHE_L2X0

View File

@ -66,6 +66,7 @@ SECTIONS
}
#endif
_etext = .; /* End of text and rodata section */
_sdata = .;
. = ALIGN(4);
.data : { *(.data*) }
@ -87,6 +88,7 @@ SECTIONS
__usymtab : { BAREBOX_SYMS }
__usymtab_end = .;
_edata = .;
. = ALIGN(4);
__bss_start = .;
.bss : { *(.bss*) }

View File

@ -55,6 +55,7 @@ SECTIONS
.rodata : { *(.rodata) }
__etext = .; /* End of text and rodata section */
__sdata = .;
. = ALIGN(4);
.data : { *(.data) }
@ -79,6 +80,7 @@ SECTIONS
__usymtab : { BAREBOX_SYMS }
___usymtab_end = .;
__edata = .;
. = ALIGN(4);
___bss_start = .;
.bss : { *(.bss) }

View File

@ -0,0 +1,18 @@
#ifndef __ASM_MMU_H
#define __ASM_MMU_H
static inline void remap_range(void *_start, size_t size, uint32_t flags)
{
}
static inline uint32_t mmu_get_pte_cached_flags(void)
{
return 0;
}
static inline uint32_t mmu_get_pte_uncached_flags(void)
{
return 0;
}
#endif /* __ASM_MMU_H */

View File

@ -0,0 +1,18 @@
#ifndef __ASM_MMU_H
#define __ASM_MMU_H
static inline void remap_range(void *_start, size_t size, uint32_t flags)
{
}
static inline uint32_t mmu_get_pte_cached_flags(void)
{
return 0;
}
static inline uint32_t mmu_get_pte_uncached_flags(void)
{
return 0;
}
#endif /* __ASM_MMU_H */

View File

@ -44,6 +44,7 @@ SECTIONS
.rodata : { *(.rodata*) }
_etext = .; /* End of text and rodata section */
_sdata = .;
. = ALIGN(4);
.data : { *(.data*) }
@ -68,6 +69,7 @@ SECTIONS
__usymtab : { BAREBOX_SYMS }
__usymtab_end = .;
_edata = .;
. = ALIGN(4);
__bss_start = .;
.bss : { *(.bss*) }

View File

@ -74,6 +74,7 @@ SECTIONS
* adjacent to simplify the startup code -- and provide
* the global pointer for gp-relative access.
*/
_sdata = .;
_data = .;
.data :
{

View File

@ -0,0 +1,18 @@
#ifndef __ASM_MMU_H
#define __ASM_MMU_H
static inline void remap_range(void *_start, size_t size, uint32_t flags)
{
}
static inline uint32_t mmu_get_pte_cached_flags(void)
{
return 0;
}
static inline uint32_t mmu_get_pte_uncached_flags(void)
{
return 0;
}
#endif /* __ASM_MMU_H */

View File

@ -0,0 +1,18 @@
#ifndef __ASM_MMU_H
#define __ASM_MMU_H
static inline void remap_range(void *_start, size_t size, uint32_t flags)
{
}
static inline uint32_t mmu_get_pte_cached_flags(void)
{
return 0;
}
static inline uint32_t mmu_get_pte_uncached_flags(void)
{
return 0;
}
#endif /* __ASM_MMU_H */

View File

@ -41,6 +41,7 @@ SECTIONS
_etext = .;
PROVIDE (etext = .);
_sdata = .;
.rodata :
{

View File

@ -69,6 +69,7 @@ SECTIONS
. = (. + 0x0FFF) & 0xFFFFF000;
_etext = .;
PROVIDE (erotext = .);
_sdata = .;
.reloc :
{
*(.got)

View File

@ -540,4 +540,22 @@ extern int write_bat(ppc_bat_t bat, unsigned long upper, unsigned long lower);
(rt<<21)|(ra<<16)|(ws<<11)|(946<<1)
#endif
#ifndef __ASSEMBLY__
static inline void remap_range(void *_start, size_t size, uint32_t flags)
{
}
static inline uint32_t mmu_get_pte_cached_flags(void)
{
return 0;
}
static inline uint32_t mmu_get_pte_uncached_flags(void)
{
return 0;
}
#endif
#endif /* _PPC_MMU_H_ */

View File

@ -0,0 +1,18 @@
#ifndef __ASM_MMU_H
#define __ASM_MMU_H
static inline void remap_range(void *_start, size_t size, uint32_t flags)
{
}
static inline uint32_t mmu_get_pte_cached_flags(void)
{
return 0;
}
static inline uint32_t mmu_get_pte_uncached_flags(void)
{
return 0;
}
#endif /* __ASM_MMU_H */

View File

@ -0,0 +1,18 @@
#ifndef __ASM_MMU_H
#define __ASM_MMU_H
static inline void remap_range(void *_start, size_t size, uint32_t flags)
{
}
static inline uint32_t mmu_get_pte_cached_flags(void)
{
return 0;
}
static inline uint32_t mmu_get_pte_uncached_flags(void)
{
return 0;
}
#endif /* __ASM_MMU_H */

View File

@ -153,6 +153,7 @@ SECTIONS
} > barebox
BAREBOX_BARE_INIT_SIZE
_sdata = .;
.data : AT ( LOADADDR(.text) + SIZEOF(.text) ) {
*(.data*)
. = ALIGN(4);
@ -191,6 +192,7 @@ SECTIONS
. = ALIGN(4);
} > barebox
_edata = .;
.bss : {
__bss_start = .;
*(.bss*);

View File

@ -267,6 +267,7 @@ endmenu
menu "memory"
config CMD_LOADB
depends on !CONSOLE_NONE
select CRC16
tristate
prompt "loadb"
@ -274,10 +275,12 @@ config CMD_LOADB
config CMD_LOADY
select CRC16
select XYMODEM
depends on !CONSOLE_NONE
tristate
prompt "loady"
config CMD_LOADS
depends on !CONSOLE_NONE
tristate
prompt "loads"

View File

@ -143,8 +143,7 @@ static int bootm_open_oftree(struct image_data *data, const char *oftree, int nu
size_t size;
unsigned int align;
if (bootm_verbose(data))
printf("Loading oftree from '%s'\n", oftree);
printf("Loading devicetree from '%s'\n", oftree);
ft = file_name_detect_type(oftree);
if ((int)ft < 0) {
@ -380,13 +379,14 @@ static int do_bootm(int argc, char *argv[])
}
}
printf("\nLoading OS %s '%s'", file_type_to_string(os_type),
data.os_file);
if (os_type == filetype_uimage &&
data.os->header.ih_type == IH_TYPE_MULTI)
printf(", multifile image %d", data.os_num);
printf("\n");
if (bootm_verbose(&data)) {
printf("\nLoading OS %s '%s'", file_type_to_string(os_type),
data.os_file);
if (os_type == filetype_uimage &&
data.os->header.ih_type == IH_TYPE_MULTI)
printf(", multifile image %d", data.os_num);
printf("\n");
if (data.os_res)
printf("OS image is at 0x%08x-0x%08x\n",
data.os_res->start,

View File

@ -20,17 +20,40 @@
#include <common.h>
#include <command.h>
#include <complete.h>
#include <getopt.h>
static int cmd_reset(int argc, char *argv[])
{
int opt, shutdown_flag;
shutdown_flag = 1;
while ((opt = getopt(argc, argv, "f")) > 0) {
switch (opt) {
case 'f':
shutdown_flag = 0;
break;
}
}
if (shutdown_flag)
shutdown_barebox();
reset_cpu(0);
/* Not reached */
return 1;
}
BAREBOX_CMD_HELP_START(reset)
BAREBOX_CMD_HELP_USAGE("reset [-f]\n")
BAREBOX_CMD_HELP_SHORT("Perform RESET of the CPU.\n")
BAREBOX_CMD_HELP_OPT("-f", "force RESET, don't call shutdown\n")
BAREBOX_CMD_HELP_END
BAREBOX_CMD_START(reset)
.cmd = cmd_reset,
.usage = "Perform RESET of the CPU",
BAREBOX_CMD_HELP(cmd_reset_help)
BAREBOX_CMD_COMPLETE(empty_complete)
BAREBOX_CMD_END

View File

@ -460,10 +460,13 @@ config TIMESTAMP
commands like bootm or iminfo. This option is
automatically enabled when you select CFG_CMD_DATE .
choice
prompt "console support"
default CONSOLE_FULL
config CONSOLE_FULL
bool
default y
prompt "Enable full console support"
prompt "full"
help
This option enables full console support capable of
handling multiple consoles. Also the full console support
@ -472,6 +475,16 @@ config CONSOLE_FULL
once the first console is registered. Recommended for most
usecases.
config CONSOLE_SIMPLE
bool
prompt "simple"
config CONSOLE_NONE
bool
prompt "none"
endchoice
choice
prompt "Console activation strategy"
depends on CONSOLE_FULL
@ -504,11 +517,6 @@ config CONSOLE_ACTIVATE_NONE
endchoice
config CONSOLE_SIMPLE
bool
default y
depends on !CONSOLE_FULL
config PARTITION
bool
prompt "Enable Partitions"

View File

@ -23,6 +23,7 @@ obj-$(CONFIG_MEMINFO) += meminfo.o
obj-$(CONFIG_COMMAND_SUPPORT) += command.o
obj-$(CONFIG_CONSOLE_FULL) += console.o
obj-$(CONFIG_CONSOLE_SIMPLE) += console_simple.o
obj-$(CONFIG_CONSOLE_NONE) += console_none.o
obj-$(CONFIG_DIGEST) += digest.o
obj-$(CONFIG_ENVIRONMENT_VARIABLES) += env.o
obj-$(CONFIG_UIMAGE) += image.o

42
common/console_none.c Normal file
View File

@ -0,0 +1,42 @@
#include <config.h>
#include <common.h>
#include <fs.h>
#include <errno.h>
#include <debug_ll.h>
int fputc(int fd, char c)
{
if (fd != 1 && fd != 2)
return write(fd, &c, 1);
return 0;
}
EXPORT_SYMBOL(fputc);
int fputs(int fd, const char *s)
{
if (fd != 1 && fd != 2)
return write(fd, s, strlen(s));
return 0;
}
EXPORT_SYMBOL(fputs);
int fprintf(int file, const char *fmt, ...)
{
va_list args;
uint i;
char printbuffer[CFG_PBSIZE];
va_start (args, fmt);
/* For this to work, printbuffer must be larger than
* anything we ever want to print.
*/
i = vsprintf (printbuffer, fmt, args);
va_end (args);
/* Print the string */
fputs(file, printbuffer);
return i;
}
EXPORT_SYMBOL(fprintf);

View File

@ -75,6 +75,10 @@ static int mem_malloc_resource(void)
(unsigned long)&_stext,
(unsigned long)&_etext -
(unsigned long)&_stext);
request_sdram_region("barebox data",
(unsigned long)&_sdata,
(unsigned long)&_edata -
(unsigned long)&_sdata);
request_sdram_region("bss",
(unsigned long)&__bss_start,
(unsigned long)&__bss_stop -

View File

@ -15,20 +15,15 @@ global editcmd=sedit
/env/config
if [ ${global.allow_color} = "true" ]; then
export PS1="\e[1;32mbarebox@\e[1;36m\h:\w\e[0m "
else
export PS1="barebox@\h:\w "
fi
if [ -e /env/menu ]; then
echo -e -n "\nHit m for menu or any other key to stop autoboot: "
else
echo -e -n "\nHit any key to stop autoboot: "
fi
timeout -a $global.autoboot_timeout -v key
autoboot="$?"
# allow to stop the boot before execute the /env/init/*
# but without waiting
timeout -s -a -v key 0
if [ "${key}" = "q" ]; then
exit
@ -38,6 +33,13 @@ for i in /env/init/*; do
. $i
done
timeout -a $global.autoboot_timeout -v key
autoboot="$?"
if [ "${key}" = "q" ]; then
exit
fi
if [ "$autoboot" = 0 ]; then
boot
fi

View File

@ -0,0 +1,9 @@
#!/bin/sh
/env/config
if [ ${global.allow_color} = "true" ]; then
export PS1="\e[1;32mbarebox@\e[1;36m\h:\w\e[0m "
else
export PS1="barebox@\h:\w "
fi

View File

@ -1,4 +1,5 @@
menu "serial drivers"
depends on !CONSOLE_NONE
config DRIVER_SERIAL_ARM_DCC
depends on ARM

View File

@ -44,7 +44,7 @@ config USB_GADGET_DFU
config USB_GADGET_SERIAL
bool
depends on EXPERIMENTAL
depends on EXPERIMENTAL && !CONSOLE_NONE
prompt "Serial Gadget"
endif

View File

@ -15,10 +15,10 @@ config W1_SLAVE_DS2431_WRITE
depends on W1_SLAVE_DS2431
config W1_SLAVE_DS2433
bool "4kb EEPROM family support (DS2433)"
bool "EEPROM family support (DS2433 4Kb or DS28EC20 20kb)"
help
Say Y here if you want to use a 1-wire
4kb EEPROM family device (DS2433).
EEPROM family device (DS2433 4Kb or DS28EC20 20kb).
config W1_SLAVE_DS2433_WRITE
bool "write support"

View File

@ -10,8 +10,6 @@
#include <init.h>
#include "../w1.h"
#define W1_EEPROM_SIZE 512
#define W1_PAGE_COUNT 16
#define W1_PAGE_SIZE 32
#define W1_PAGE_BITS 5
#define W1_PAGE_MASK 0x1F
@ -23,9 +21,8 @@
#define W1_F23_READ_SCRATCH 0xAA
#define W1_F23_COPY_SCRATCH 0x55
#define DRIVERNAME "ds2433"
static int ds2433_count = 0;
static int ds28ec20_count = 0;
/**
* Check the file size bounds and adjusts count as needed.
@ -49,7 +46,7 @@ static ssize_t ds2433_cdev_read(struct cdev *cdev, void *buf, size_t count,
struct w1_bus *bus = dev->bus;
u8 wrbuf[3];
if ((count = ds2433_fix_count(off, count, W1_EEPROM_SIZE)) == 0)
if ((count = ds2433_fix_count(off, count, cdev->size)) == 0)
return 0;
/* read directly from the EEPROM */
@ -134,7 +131,7 @@ static ssize_t ds2433_cdev_write(struct cdev *cdev, const void *buf, size_t coun
int addr, len, idx;
const u8 *buf8 = buf;
if ((count = ds2433_fix_count(off, count, W1_EEPROM_SIZE)) == 0)
if ((count = ds2433_fix_count(off, count, cdev->size)) == 0)
return 0;
/* Can only write data to one page at a time */
@ -165,7 +162,7 @@ static struct file_operations ds2433_ops = {
.lseek = dev_lseek_default,
};
static int ds2433_probe(struct w1_device *dev)
static int ds2433_cdev_create(struct w1_device *dev, int size, int id)
{
struct cdev *cdev;
@ -173,24 +170,48 @@ static int ds2433_probe(struct w1_device *dev)
cdev->dev = &dev->dev;
cdev->priv = dev;
cdev->ops = &ds2433_ops;
cdev->size = W1_EEPROM_SIZE;
cdev->name = asprintf(DRIVERNAME"%d", ds2433_count++);
cdev->size = size;
cdev->name = asprintf("%s%d", dev->dev.driver->name, id);
if (cdev->name == NULL)
return -ENOMEM;
return devfs_create(cdev);
}
static int ds2433_probe(struct w1_device *dev)
{
return ds2433_cdev_create(dev, 512, ds2433_count++);
}
static int ds28ec20_probe(struct w1_device *dev)
{
return ds2433_cdev_create(dev, 2560, ds28ec20_count++);
}
struct w1_driver ds2433_driver = {
.drv = {
.name = DRIVERNAME,
.name = "ds2433",
},
.probe = ds2433_probe,
.fid = 0x23,
};
struct w1_driver ds28ec20_driver = {
.drv = {
.name = "ds28ec20",
},
.probe = ds28ec20_probe,
.fid = 0x43,
};
static int w1_ds2433_init(void)
{
return w1_driver_register(&ds2433_driver);
int ret;
ret = w1_driver_register(&ds2433_driver);
if (ret)
return ret;
return w1_driver_register(&ds28ec20_driver);
}
device_initcall(w1_ds2433_init);

View File

@ -246,6 +246,11 @@ static void tftp_parse_oack(struct file_priv *priv, unsigned char *pkt, int len)
}
}
static void tftp_timer_reset(struct file_priv *priv)
{
priv->progress_timeout = priv->resend_timeout = get_time_ns();
}
static void tftp_handler(void *ctx, char *packet, unsigned len)
{
struct file_priv *priv = ctx;
@ -282,6 +287,9 @@ static void tftp_handler(void *ctx, char *packet, unsigned len)
}
priv->block++;
tftp_timer_reset(priv);
if (priv->state == STATE_LAST) {
priv->state = STATE_DONE;
break;
@ -335,6 +343,8 @@ static void tftp_handler(void *ctx, char *packet, unsigned len)
priv->last_block = priv->block;
tftp_timer_reset(priv);
kfifo_put(priv->fifo, pkt + 2, len);
if (len < priv->blocksize) {
@ -364,11 +374,6 @@ static void tftp_handler(void *ctx, char *packet, unsigned len)
}
}
static void tftp_timer_reset(struct file_priv *priv)
{
priv->progress_timeout = priv->resend_timeout = get_time_ns();
}
static struct file_priv *tftp_do_open(struct device_d *dev,
int accmode, const char *filename)
{
@ -549,8 +554,6 @@ static int tftp_read(struct device_d *dev, FILE *f, void *buf, size_t insize)
debug("%s %zu\n", __func__, insize);
tftp_timer_reset(priv);
while (insize) {
now = kfifo_get(priv->fifo, buf, insize);
if (priv->state == STATE_DONE)
@ -561,10 +564,8 @@ static int tftp_read(struct device_d *dev, FILE *f, void *buf, size_t insize)
insize -= now;
}
if (TFTP_FIFO_SIZE - kfifo_len(priv->fifo) >= priv->blocksize) {
if (TFTP_FIFO_SIZE - kfifo_len(priv->fifo) >= priv->blocksize)
tftp_send(priv);
tftp_timer_reset(priv);
}
ret = tftp_poll(priv);
if (ret == TFTP_ERR_RESEND)

View File

@ -3,6 +3,7 @@
extern char _text[], _stext[], _etext[];
extern char __bss_start[], __bss_stop[];
extern char _sdata[], _edata[];
extern char __bare_init_start[], __bare_init_end[];
extern char _end[];
extern void *_barebox_image_size;

View File

@ -216,6 +216,8 @@ int run_shell(void);
#define PAGE_SIZE 4096
#define PAGE_SHIFT 12
#define PAGE_ALIGN(s) (((s) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
#define PAGE_ALIGN_DOWN(x) ((x) & ~(PAGE_SIZE - 1))
int memory_display(char *addr, loff_t offs, ulong nbytes, int size, int swab);

View File

@ -11,6 +11,15 @@
/* serial stuff */
void serial_printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2)));
int sprintf(char *buf, const char *fmt, ...) __attribute__ ((format(__printf__, 2, 3)));
int snprintf(char *buf, size_t size, const char *fmt, ...) __attribute__ ((format(__printf__, 3, 4)));
int vsprintf(char *buf, const char *fmt, va_list args);
char *asprintf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2)));
char *vasprintf(const char *fmt, va_list ap);
int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);
int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
#ifndef CONFIG_CONSOLE_NONE
/* stdin */
int tstc(void);
@ -20,6 +29,51 @@ int getc(void);
int console_puts(unsigned int ch, const char *s);
void console_flush(void);
int printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2)));
int vprintf(const char *fmt, va_list args);
#else
static inline int tstc(void)
{
return 0;
}
static inline int console_puts(unsigned int ch, const char *str)
{
return 0;
}
static inline int getc(void)
{
return -EINVAL;
}
static inline void console_putc(unsigned int ch, char c) {}
static inline void console_flush(void) {}
static int printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2)));
static inline int printf(const char *fmt, ...)
{
return 0;
}
static inline int vprintf(const char *fmt, va_list args)
{
return 0;
}
#ifndef ARCH_HAS_CTRLC
/* test if ctrl-c was pressed */
static inline int ctrlc (void)
{
return 0;
}
#endif /* ARCH_HAS_CTRC */
#endif
static inline int puts(const char *s)
{
return console_puts(CONSOLE_STDOUT, s);
@ -30,16 +84,6 @@ static inline void putchar(char c)
console_putc(CONSOLE_STDOUT, c);
}
int printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2)));
int vprintf(const char *fmt, va_list args);
int sprintf(char *buf, const char *fmt, ...) __attribute__ ((format(__printf__, 2, 3)));
int snprintf(char *buf, size_t size, const char *fmt, ...) __attribute__ ((format(__printf__, 3, 4)));
int vsprintf(char *buf, const char *fmt, va_list args);
char *asprintf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2)));
char *vasprintf(const char *fmt, va_list ap);
int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);
int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
/* stderr */
#define eputc(c) console_putc(CONSOLE_STDERR, c)
#define eputs(s) console_puts(CONSOLE_STDERR, s)

View File

@ -17,6 +17,7 @@ config NET_PING
config NET_NETCONSOLE
bool
depends on !CONSOLE_NONE
prompt "network console support"
help
This option adds support for a simple udp based network console.