diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2014-05-05 11:05:51 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2014-05-05 11:05:51 +0200 |
commit | f8327af20c1c2988b0d9909f403780e31cc6b59e (patch) | |
tree | 80eb52cc1160e577646e136ad9e3e4638aac5559 /arch | |
parent | b568687bc3c48edd814c4b4546d049d859c8cc3f (diff) | |
parent | 9f556d4b6fc71d548e5c984c416f4f1b7d599d2f (diff) | |
download | barebox-f8327af20c1c2988b0d9909f403780e31cc6b59e.tar.gz barebox-f8327af20c1c2988b0d9909f403780e31cc6b59e.tar.xz |
Merge branch 'for-next/ioresource'
Diffstat (limited to 'arch')
27 files changed, 243 insertions, 181 deletions
diff --git a/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c b/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c index e2ad1c86dd..31422e64a0 100644 --- a/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c +++ b/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c @@ -223,7 +223,8 @@ static int eukrea_cpuimx27_console_init(void) imx27_setup_weimcs(3, 0x0000D603, 0x0D1D0D01, 0x00D20000); #ifdef CONFIG_DRIVER_SERIAL_NS16550 add_ns16550_device(DEVICE_ID_DYNAMIC, MX27_CS3_BASE_ADDR + QUART_OFFSET, 0xf, - IORESOURCE_MEM_16BIT, &quad_uart_serial_plat); + IORESOURCE_MEM | IORESOURCE_MEM_16BIT, + &quad_uart_serial_plat); #endif return 0; } diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h index e0630ebb7e..ccf1f59013 100644 --- a/arch/arm/include/asm/io.h +++ b/arch/arm/include/asm/io.h @@ -3,6 +3,8 @@ #include <asm-generic/io.h> +#define IO_SPACE_LIMIT 0 + /* * String version of IO memory access ops: */ diff --git a/arch/arm/mach-mvebu/armada-370-xp.c b/arch/arm/mach-mvebu/armada-370-xp.c index 776b4c09b8..209be0b603 100644 --- a/arch/arm/mach-mvebu/armada-370-xp.c +++ b/arch/arm/mach-mvebu/armada-370-xp.c @@ -60,7 +60,8 @@ static int armada_370_xp_add_uart(void) uart_plat.clock = clk_get_rate(tclk); if (!add_ns16550_device(DEVICE_ID_DYNAMIC, (unsigned int)CONSOLE_UART_BASE, 32, - IORESOURCE_MEM_32BIT, &uart_plat)) + IORESOURCE_MEM | IORESOURCE_MEM_32BIT, + &uart_plat)) return -ENODEV; return 0; } diff --git a/arch/arm/mach-mvebu/kirkwood.c b/arch/arm/mach-mvebu/kirkwood.c index 1284220dcf..c79d13002a 100644 --- a/arch/arm/mach-mvebu/kirkwood.c +++ b/arch/arm/mach-mvebu/kirkwood.c @@ -58,7 +58,8 @@ static int kirkwood_add_uart(void) uart_plat.clock = clk_get_rate(tclk); if (!add_ns16550_device(DEVICE_ID_DYNAMIC, (unsigned int)CONSOLE_UART_BASE, 32, - IORESOURCE_MEM_32BIT, &uart_plat)) + IORESOURCE_MEM | IORESOURCE_MEM_32BIT, + &uart_plat)) return -ENODEV; return 0; } diff --git a/arch/arm/mach-socfpga/xload.c b/arch/arm/mach-socfpga/xload.c index 0b99db0d96..6586ada349 100644 --- a/arch/arm/mach-socfpga/xload.c +++ b/arch/arm/mach-socfpga/xload.c @@ -45,8 +45,8 @@ static void socfpga_uart_init(void) clks[uart] = clk_fixed("uart", 100000000); clkdev_add_physbase(clks[uart], CYCLONE5_UART0_ADDRESS, NULL); clkdev_add_physbase(clks[uart], CYCLONE5_UART1_ADDRESS, NULL); - add_ns16550_device(0, 0xffc02000, 1024, IORESOURCE_MEM_8BIT, - &uart_pdata); + add_ns16550_device(0, 0xffc02000, 1024, IORESOURCE_MEM | + IORESOURCE_MEM_8BIT, &uart_pdata); } static void socfpga_timer_init(void) diff --git a/arch/arm/mach-tegra/tegra20.c b/arch/arm/mach-tegra/tegra20.c index cc2d748641..bdd7960f48 100644 --- a/arch/arm/mach-tegra/tegra20.c +++ b/arch/arm/mach-tegra/tegra20.c @@ -50,7 +50,7 @@ static int tegra20_add_debug_console(void) return -ENODEV; add_ns16550_device(DEVICE_ID_DYNAMIC, base, 8 << debug_uart.shift, - IORESOURCE_MEM_8BIT, &debug_uart); + IORESOURCE_MEM | IORESOURCE_MEM_8BIT, &debug_uart); return 0; } diff --git a/arch/mips/boards/dlink-dir-320/serial.c b/arch/mips/boards/dlink-dir-320/serial.c index bddb6838c9..eb873791c4 100644 --- a/arch/mips/boards/dlink-dir-320/serial.c +++ b/arch/mips/boards/dlink-dir-320/serial.c @@ -36,7 +36,7 @@ static int dir320_console_init(void) /* Register the serial port */ add_ns16550_device(DEVICE_ID_DYNAMIC, DEBUG_LL_UART_ADDR, 8, - IORESOURCE_MEM_8BIT, &serial_plat); + IORESOURCE_MEM | IORESOURCE_MEM_8BIT, &serial_plat); return 0; } diff --git a/arch/mips/boards/loongson-ls1b/serial.c b/arch/mips/boards/loongson-ls1b/serial.c index d8e0f7c28a..7159ab7a5c 100644 --- a/arch/mips/boards/loongson-ls1b/serial.c +++ b/arch/mips/boards/loongson-ls1b/serial.c @@ -15,7 +15,7 @@ static int console_init(void) barebox_set_hostname("ls1b"); add_ns16550_device(DEVICE_ID_DYNAMIC, KSEG1ADDR(LS1X_UART2_BASE), - 8, IORESOURCE_MEM_8BIT, &serial_plat); + 8, IORESOURCE_MEM | IORESOURCE_MEM_8BIT, &serial_plat); return 0; } diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h index 4100e1e52d..4832be6d09 100644 --- a/arch/mips/include/asm/io.h +++ b/arch/mips/include/asm/io.h @@ -14,6 +14,8 @@ #include <asm/types.h> #include <asm/byteorder.h> +#define IO_SPACE_LIMIT 0 + /*****************************************************************************/ /* * readX/writeX() are used to access memory mapped devices. On some @@ -76,4 +78,6 @@ static inline void __raw_writel(u32 b, volatile void __iomem *addr) #define out_be16(a, v) __raw_writew(__cpu_to_be16(v), a) #define out_be32(a, v) __raw_writel(__cpu_to_be32(v), a) +#include <asm-generic/io.h> + #endif /* __ASM_MIPS_IO_H */ diff --git a/arch/mips/mach-ar231x/ar231x.c b/arch/mips/mach-ar231x/ar231x.c index ca912bf0ef..f714a11e92 100644 --- a/arch/mips/mach-ar231x/ar231x.c +++ b/arch/mips/mach-ar231x/ar231x.c @@ -189,7 +189,9 @@ static int ar2312_console_init(void) /* Register the serial port */ serial_plat.clock = ar2312_sys_frequency(); add_ns16550_device(DEVICE_ID_DYNAMIC, KSEG1ADDR(AR2312_UART0), - 8 << AR2312_UART_SHIFT, IORESOURCE_MEM_8BIT, &serial_plat); + 8 << AR2312_UART_SHIFT, + IORESOURCE_MEM | IORESOURCE_MEM_8BIT, + &serial_plat); return 0; } console_initcall(ar2312_console_init); diff --git a/arch/nios2/include/asm/io.h b/arch/nios2/include/asm/io.h index 8ee48e08d3..59eea73ac2 100644 --- a/arch/nios2/include/asm/io.h +++ b/arch/nios2/include/asm/io.h @@ -22,6 +22,8 @@ #include <asm/byteorder.h> +#define IO_SPACE_LIMIT 0 + #define __raw_writeb(v, a) (*(volatile unsigned char *)(a) = (v)) #define __raw_writew(v, a) (*(volatile unsigned short *)(a) = (v)) #define __raw_writel(v, a) (*(volatile unsigned int *)(a) = (v)) diff --git a/arch/openrisc/boards/generic/generic.c b/arch/openrisc/boards/generic/generic.c index 290e05c6ec..9f680073cb 100644 --- a/arch/openrisc/boards/generic/generic.c +++ b/arch/openrisc/boards/generic/generic.c @@ -15,7 +15,8 @@ static int openrisc_console_init(void) barebox_set_hostname("or1k"); /* Register the serial port */ - add_ns16550_device(DEVICE_ID_DYNAMIC, OPENRISC_SOPC_UART_BASE, 1024, IORESOURCE_MEM_8BIT, &serial_plat); + add_ns16550_device(DEVICE_ID_DYNAMIC, OPENRISC_SOPC_UART_BASE, 1024, + IORESOURCE_MEM | IORESOURCE_MEM_8BIT, &serial_plat); #ifdef CONFIG_DRIVER_NET_ETHOC add_generic_device("ethoc", DEVICE_ID_DYNAMIC, NULL, diff --git a/arch/openrisc/include/asm/io.h b/arch/openrisc/include/asm/io.h index 90abb42961..05580bd193 100644 --- a/arch/openrisc/include/asm/io.h +++ b/arch/openrisc/include/asm/io.h @@ -16,104 +16,9 @@ #ifndef __ASM_OPENRISC_IO_H #define __ASM_OPENRISC_IO_H -#include <asm/byteorder.h> - -/* - * Given a physical address and a length, return a virtual address - * that can be used to access the memory range with the caching - * properties specified by "flags". - */ -#define MAP_NOCACHE (0) -#define MAP_WRCOMBINE (0) -#define MAP_WRBACK (0) -#define MAP_WRTHROUGH (0) - -static inline void * -map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags) -{ - return (void *)paddr; -} - -/* - * Take down a mapping set up by map_physmem(). - */ -static inline void unmap_physmem(void *vaddr, unsigned long flags) -{ - -} - -/* - * Change virtual addresses to physical addresses - */ -static inline phys_addr_t virt_to_phys(void *vaddr) -{ - return (phys_addr_t)(vaddr); -} - - -/* - * readX/writeX() are used to access memory mapped devices. On some - * architectures the memory mapped IO stuff needs to be accessed - * differently. On the openrisc architecture, we just read/write the - * memory location directly. - */ -#define readb(addr) (*(volatile unsigned char *) (addr)) -#define readw(addr) (*(volatile unsigned short *) (addr)) -#define readl(addr) (*(volatile unsigned int *) (addr)) -#define __raw_readb readb -#define __raw_readw readw -#define __raw_readl readl - -#define writeb(b, addr) ((*(volatile unsigned char *) (addr)) = (b)) -#define writew(b, addr) ((*(volatile unsigned short *) (addr)) = (b)) -#define writel(b, addr) ((*(volatile unsigned int *) (addr)) = (b)) -#define __raw_writeb writeb -#define __raw_writew writew -#define __raw_writel writel - -#define memset_io(a, b, c) memset((void *)(a), (b), (c)) -#define memcpy_fromio(a, b, c) memcpy((a), (void *)(b), (c)) -#define memcpy_toio(a, b, c) memcpy((void *)(a), (b), (c)) +#define IO_SPACE_LIMIT 0x0 -#define out_be32(a, v) __raw_writel((v), (void __iomem __force *)(a)) -#define out_be16(a, v) __raw_writew((v), (a)) - -#define in_be32(a) __raw_readl((const void __iomem __force *)(a)) -#define in_be16(a) __raw_readw(a) - -#define writel_be(v, a) out_be32((__force unsigned *)a, v) -#define readl_be(a) in_be32((__force unsigned *)a) - -/* - * Again, OpenRISC does not require mem IO specific function. - */ - - -#define IO_BASE 0x0 -#define IO_SPACE_LIMIT 0xffffffff - -#define inb(port) readb((port + IO_BASE)) -#define outb(value, port) writeb((value), (port + IO_BASE)) -#define inb_p(port) inb((port)) -#define outb_p(value, port) outb((value), (port)) - -/* - * Convert a physical pointer to a virtual kernel pointer for /dev/mem - * access - */ -#define xlate_dev_mem_ptr(p) __va(p) - -/* - * Convert a virtual cached pointer to an uncached pointer - */ -#define xlate_dev_kmem_ptr(p) p - -#define ioread8(addr) readb(addr) -#define ioread16(addr) readw(addr) -#define ioread32(addr) readl(addr) - -#define iowrite8(v, addr) writeb((v), (addr)) -#define iowrite16(v, addr) writew((v), (addr)) -#define iowrite32(v, addr) writel((v), (addr)) +#include <asm/byteorder.h> +#include <asm-generic/io.h> #endif diff --git a/arch/ppc/boards/freescale-p1022ds/p1022ds.c b/arch/ppc/boards/freescale-p1022ds/p1022ds.c index c800064062..57e7953fb1 100644 --- a/arch/ppc/boards/freescale-p1022ds/p1022ds.c +++ b/arch/ppc/boards/freescale-p1022ds/p1022ds.c @@ -130,7 +130,7 @@ static int p1022ds_console_init(void) serial_plat.clock = fsl_get_bus_freq(0); add_ns16550_device(DEVICE_ID_DYNAMIC, CFG_IMMR + 0x4500, 16, - IORESOURCE_MEM_8BIT, &serial_plat); + IORESOURCE_MEM | IORESOURCE_MEM_8BIT, &serial_plat); return 0; } diff --git a/arch/ppc/boards/freescale-p2020rdb/p2020rdb.c b/arch/ppc/boards/freescale-p2020rdb/p2020rdb.c index 229ae41f08..385a436459 100644 --- a/arch/ppc/boards/freescale-p2020rdb/p2020rdb.c +++ b/arch/ppc/boards/freescale-p2020rdb/p2020rdb.c @@ -112,7 +112,8 @@ static int p2020_console_init(void) serial_plat.clock = fsl_get_bus_freq(0); - add_ns16550_device(DEVICE_ID_DYNAMIC, 0xffe04500, 16, IORESOURCE_MEM_8BIT, + add_ns16550_device(DEVICE_ID_DYNAMIC, 0xffe04500, 16, + IORESOURCE_MEM | IORESOURCE_MEM_8BIT, &serial_plat); return 0; } diff --git a/arch/ppc/boards/geip-da923rc/da923rc.c b/arch/ppc/boards/geip-da923rc/da923rc.c index 976aa8d54c..3d77349e0d 100644 --- a/arch/ppc/boards/geip-da923rc/da923rc.c +++ b/arch/ppc/boards/geip-da923rc/da923rc.c @@ -115,7 +115,8 @@ static int da923rc_console_init(void) barebox_set_model("unknown"); serial_plat.clock = fsl_get_bus_freq(0); - add_ns16550_device(1, CFG_CCSRBAR + 0x4600, 16, IORESOURCE_MEM_8BIT, + add_ns16550_device(1, CFG_CCSRBAR + 0x4600, 16, + IORESOURCE_MEM | IORESOURCE_MEM_8BIT, &serial_plat); return 0; } diff --git a/arch/ppc/include/asm/io.h b/arch/ppc/include/asm/io.h index d3473e5c96..98bf5132cd 100644 --- a/arch/ppc/include/asm/io.h +++ b/arch/ppc/include/asm/io.h @@ -12,6 +12,7 @@ #define SIO_CONFIG_RA 0x398 #define SIO_CONFIG_RD 0x399 +#define _IO_BASE 0 #define readb(addr) in_8((volatile u8 *)(addr)) #define writeb(b,addr) out_8((volatile u8 *)(addr), (b)) diff --git a/arch/sandbox/include/asm/io.h b/arch/sandbox/include/asm/io.h index 8ca164f214..35b578454e 100644 --- a/arch/sandbox/include/asm/io.h +++ b/arch/sandbox/include/asm/io.h @@ -2,5 +2,6 @@ #define __ASM_SANDBOX_IO_H #include <asm-generic/io.h> +#define IO_SPACE_LIMIT 0 #endif /* __ASM_SANDBOX_IO_H */ diff --git a/arch/x86/boards/x86_generic/Makefile b/arch/x86/boards/x86_generic/Makefile index 248240da07..fca707dd8b 100644 --- a/arch/x86/boards/x86_generic/Makefile +++ b/arch/x86/boards/x86_generic/Makefile @@ -1 +1,4 @@ obj-y += generic_pc.o +obj-$(CONFIG_DISK_INTF_PLATFORM_IDE) += intf_platform_ide.o +obj-$(CONFIG_DISK_BIOS) += disk_bios_drive.o +obj-$(CONFIG_DRIVER_SERIAL_NS16550) += serial_ns16550.o diff --git a/arch/x86/boards/x86_generic/disk_bios_drive.c b/arch/x86/boards/x86_generic/disk_bios_drive.c new file mode 100644 index 0000000000..f33f48c3fb --- /dev/null +++ b/arch/x86/boards/x86_generic/disk_bios_drive.c @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2009 Juergen Beisert, 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. + * + * + */ + +/** + * @file + * @brief Generic PC support for the BIOS disk interface + */ + +#include <common.h> +#include <driver.h> +#include <init.h> +#include <linux/err.h> +#include "envsector.h" + +static int bios_disk_init(void) +{ + struct cdev *cdev; + + add_generic_device("biosdrive", DEVICE_ID_DYNAMIC, NULL, 0, 0, + IORESOURCE_MEM, NULL); + + if (pers_env_size != PATCH_AREA_PERS_SIZE_UNUSED) { + cdev = devfs_add_partition("biosdisk0", + pers_env_storage * 512, + (unsigned)pers_env_size * 512, + DEVFS_PARTITION_FIXED, "env0"); + printf("Partition: %ld\n", IS_ERR(cdev) ? PTR_ERR(cdev) : 0); + } else + printf("No persistent storage defined\n"); + + return 0; +} +device_initcall(bios_disk_init); diff --git a/arch/x86/mach-i386/generic.c b/arch/x86/boards/x86_generic/envsector.h index 69cf53c8fe..86511c8af7 100644 --- a/arch/x86/mach-i386/generic.c +++ b/arch/x86/boards/x86_generic/envsector.h @@ -1,6 +1,4 @@ /* - * Copyright (C) 2009 Juergen Beisert, 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 @@ -16,19 +14,23 @@ /** * @file - * @brief x86 Architecture Initialization routines + * @brief x86 Generic PC common definitions */ +#ifndef __X86_ENVSECTOR_H +#define __ENVSECTOR_H -#include <io.h> +/* + * These datas are from the MBR, created by the linker and filled by the + * setup tool while installing barebox on the disk drive + */ +extern uint64_t pers_env_storage; +extern uint16_t pers_env_size; +extern uint8_t pers_env_drive; -/** to work with the 8250 UART driver implementation we need this function */ -unsigned int x86_uart_read(unsigned long base, unsigned char reg_idx) -{ - return inb(base + reg_idx); -} +/** + * Persistent environment "not used" marker. + * Note: Must be in accordance to the value the tool "setup_mbr" writes. + */ +#define PATCH_AREA_PERS_SIZE_UNUSED 0x000 -/** to work with the 8250 UART driver implementation we need this function */ -void x86_uart_write(unsigned int val, unsigned long base, unsigned char reg_idx) -{ - outb(val, base + reg_idx); -} +#endif diff --git a/arch/x86/boards/x86_generic/generic_pc.c b/arch/x86/boards/x86_generic/generic_pc.c index 74a72243a3..5560efc889 100644 --- a/arch/x86/boards/x86_generic/generic_pc.c +++ b/arch/x86/boards/x86_generic/generic_pc.c @@ -24,67 +24,16 @@ #include <driver.h> #include <init.h> #include <asm/syslib.h> -#include <ns16550.h> #include <linux/err.h> -/* - * These datas are from the MBR, created by the linker and filled by the - * setup tool while installing barebox on the disk drive - */ -extern uint64_t pers_env_storage; -extern uint16_t pers_env_size; -extern uint8_t pers_env_drive; - -/** - * Persistent environment "not used" marker. - * Note: Must be in accordance to the value the tool "setup_mbr" writes. - */ -#define PATCH_AREA_PERS_SIZE_UNUSED 0x000 - static int devices_init(void) { - struct cdev *cdev; - /* extended memory only */ add_mem_device("ram0", 0x0, bios_get_memsize() << 10, IORESOURCE_MEM_WRITEABLE); - add_generic_device("biosdrive", DEVICE_ID_DYNAMIC, NULL, 0, 0, IORESOURCE_MEM, - NULL); - - if (pers_env_size != PATCH_AREA_PERS_SIZE_UNUSED) { - cdev = devfs_add_partition("biosdisk0", - pers_env_storage * 512, - (unsigned)pers_env_size * 512, - DEVFS_PARTITION_FIXED, "env0"); - printf("Partition: %ld\n", IS_ERR(cdev) ? PTR_ERR(cdev) : 0); - } else - printf("No persistent storage defined\n"); - - return 0; -} -device_initcall(devices_init); - -#ifdef CONFIG_DRIVER_SERIAL_NS16550 - -static struct NS16550_plat serial_plat = { - .clock = 1843200, - .reg_read = x86_uart_read, - .reg_write = x86_uart_write, -}; - -static int pc_console_init(void) -{ - barebox_set_model("X86 generic barebox"); - barebox_set_hostname("x86"); - - /* Register the serial port */ - add_ns16550_device(DEVICE_ID_DYNAMIC, 0x3f8, 8, 0, &serial_plat); - return 0; } -console_initcall(pc_console_init); - -#endif +device_initcall(devices_init); /** @page generic_pc Generic PC based bootloader diff --git a/arch/x86/boards/x86_generic/intf_platform_ide.c b/arch/x86/boards/x86_generic/intf_platform_ide.c new file mode 100644 index 0000000000..18a2620ce0 --- /dev/null +++ b/arch/x86/boards/x86_generic/intf_platform_ide.c @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2014 Juergen Beisert, Pengutronix, Michel Stam, + * Fugro Intersite + * + * 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. + * + * + */ + +/** + * @file + * @brief Generic PC support for the IDE platform driver + */ + +#include <common.h> +#include <driver.h> +#include <init.h> +#include <linux/err.h> +#include <platform_ide.h> +#include "envsector.h" + +static struct ide_port_info ide_plat = { + .ioport_shift = 0, + .dataif_be = 0, +}; + +static struct resource primary_ide_resources[] = { + { + .name = "base", + .start = 0x1f0, + .end = 0x1f7, + .flags = IORESOURCE_IO + }, + { + .name = "alt", + .start = 0x3f6, + .end = 0x3f7, + .flags = IORESOURCE_IO + } +}; + +static struct resource secondary_ide_resources[] = { + { + .name = "base", + .start = 0x170, + .end = 0x177, + .flags = IORESOURCE_IO + }, +}; + +static struct device_d primary_ide_device = { + .name = "ide_intf", + .id = 0, + .platform_data = &ide_plat, + .resource = primary_ide_resources, + .num_resources = ARRAY_SIZE(primary_ide_resources), +}; + +static struct device_d secondary_ide_device = { + .name = "ide_intf", + .id = 1, + .platform_data = &ide_plat, + .resource = secondary_ide_resources, + .num_resources = ARRAY_SIZE(secondary_ide_resources), +}; + +static int platform_ide_init(void) +{ + struct cdev *cdev; + + platform_device_register(&primary_ide_device); + platform_device_register(&secondary_ide_device); + + if (pers_env_size != PATCH_AREA_PERS_SIZE_UNUSED) { + cdev = devfs_add_partition("ata0", + pers_env_storage * 512, + (unsigned)pers_env_size * 512, + DEVFS_PARTITION_FIXED, "env0"); + printf("Partition: %ld\n", IS_ERR(cdev) ? PTR_ERR(cdev) : 0); + } else + printf("No persistent storage defined\n"); + + return 0; +} +device_initcall(platform_ide_init); diff --git a/arch/x86/boards/x86_generic/serial_ns16550.c b/arch/x86/boards/x86_generic/serial_ns16550.c new file mode 100644 index 0000000000..3b284f3d3d --- /dev/null +++ b/arch/x86/boards/x86_generic/serial_ns16550.c @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2009 Juergen Beisert, Pengutronix, Michel Stam, + * Fugro Intersite + * + * 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. + * + * + */ + +/** + * @file + * @brief Generic PC support to let barebox acting as a boot loader + */ + +#include <common.h> +#include <types.h> +#include <driver.h> +#include <init.h> +#include <asm/syslib.h> +#include <ns16550.h> +#include <linux/err.h> + +static struct NS16550_plat serial_plat = { + .clock = 1843200, +}; + +static int pc_console_init(void) +{ + barebox_set_model("X86 generic barebox"); + barebox_set_hostname("x86"); + + /* Register the serial port */ + add_ns16550_device(DEVICE_ID_DYNAMIC, 0x3f8, 8, IORESOURCE_IO, + &serial_plat); + add_ns16550_device(DEVICE_ID_DYNAMIC, 0x2f8, 8, IORESOURCE_IO, + &serial_plat); + + return 0; +} +console_initcall(pc_console_init); diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index 9cb78e41ec..f020510569 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h @@ -12,6 +12,8 @@ #include <asm/byteorder.h> +#define IO_SPACE_LIMIT 0xffff + static inline void outb(unsigned char value, int port) { asm volatile("outb %b0, %w1" : : "a"(value), "Nd"(port)); diff --git a/arch/x86/include/asm/syslib.h b/arch/x86/include/asm/syslib.h index a6c44e954e..14e373a5af 100644 --- a/arch/x86/include/asm/syslib.h +++ b/arch/x86/include/asm/syslib.h @@ -14,9 +14,6 @@ * */ -extern unsigned int x86_uart_read(unsigned long, unsigned char); -extern void x86_uart_write(unsigned int, unsigned long, unsigned char); - #ifdef CONFIG_X86_BIOS_BRINGUP extern int bios_disk_rw_int13_extensions(int, int, void*) __attribute__((regparm(3))); diff --git a/arch/x86/mach-i386/Makefile b/arch/x86/mach-i386/Makefile index 10712e6a3b..e46aa5b5ee 100644 --- a/arch/x86/mach-i386/Makefile +++ b/arch/x86/mach-i386/Makefile @@ -1,4 +1,3 @@ -obj-y += generic.o obj-y += reset.o # reference clocksource |