diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2014-08-07 06:14:58 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2014-08-07 06:14:58 +0200 |
commit | 7e094e336c312178c898f19fcd4c7af6a992c038 (patch) | |
tree | be60e483b334d7237b7c2e73257a57359c28c723 /arch | |
parent | f64760777b022e25909e05212b490edb1afdf764 (diff) | |
parent | d73ad85a93584f5cf7e4c8604831e106e9273c3a (diff) | |
download | barebox-7e094e336c312178c898f19fcd4c7af6a992c038.tar.gz barebox-7e094e336c312178c898f19fcd4c7af6a992c038.tar.xz |
Merge branch 'for-next/imx'
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/boards/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/boards/embedsky-e9/Makefile | 4 | ||||
-rw-r--r-- | arch/arm/boards/embedsky-e9/board.c | 87 | ||||
-rw-r--r-- | arch/arm/boards/embedsky-e9/defaultenv-e9/boot/mmc1 | 6 | ||||
-rw-r--r-- | arch/arm/boards/embedsky-e9/defaultenv-e9/boot/mmc3 | 6 | ||||
-rw-r--r-- | arch/arm/boards/embedsky-e9/defaultenv-e9/config-board | 7 | ||||
-rw-r--r-- | arch/arm/boards/embedsky-e9/flash-header-e9.imxcfg | 87 | ||||
-rw-r--r-- | arch/arm/boards/embedsky-e9/lowlevel.c | 18 | ||||
-rw-r--r-- | arch/arm/configs/imx_v7_defconfig | 1 | ||||
-rw-r--r-- | arch/arm/dts/Makefile | 4 | ||||
-rw-r--r-- | arch/arm/dts/imx6q-embedsky-e9.dts | 42 | ||||
-rw-r--r-- | arch/arm/mach-imx/Kconfig | 6 | ||||
-rw-r--r-- | arch/arm/mach-imx/imx-bbu-internal.c | 63 |
13 files changed, 297 insertions, 35 deletions
diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile index e195870439..c60da81261 100644 --- a/arch/arm/boards/Makefile +++ b/arch/arm/boards/Makefile @@ -29,6 +29,7 @@ obj-$(CONFIG_MACH_EDB9307) += edb93xx/ obj-$(CONFIG_MACH_EDB9315A) += edb93xx/ obj-$(CONFIG_MACH_EDB9315) += edb93xx/ obj-$(CONFIG_MACH_EFIKA_MX_SMARTBOOK) += efika-mx-smartbook/ +obj-$(CONFIG_MACH_EMBEDSKY_E9) += embedsky-e9/ obj-$(CONFIG_MACH_EMBEST_RIOTBOARD) += embest-riotboard/ obj-$(CONFIG_MACH_EUKREA_CPUIMX25) += eukrea_cpuimx25/ obj-$(CONFIG_MACH_EUKREA_CPUIMX27) += eukrea_cpuimx27/ diff --git a/arch/arm/boards/embedsky-e9/Makefile b/arch/arm/boards/embedsky-e9/Makefile new file mode 100644 index 0000000000..db2dba7769 --- /dev/null +++ b/arch/arm/boards/embedsky-e9/Makefile @@ -0,0 +1,4 @@ +obj-y += board.o flash-header-e9.dcd.o +extra-y += flash-header-e9.dcd.S flash-header-e9.dcd +lwl-y += lowlevel.o +bbenv-y += defaultenv-e9 diff --git a/arch/arm/boards/embedsky-e9/board.c b/arch/arm/boards/embedsky-e9/board.c new file mode 100644 index 0000000000..55b4320219 --- /dev/null +++ b/arch/arm/boards/embedsky-e9/board.c @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2014 Andrey Panov <rockford@yandex.ru> + * + * based on arch/arm/boards/freescale-mx6-sabresd/board.c + * Copyright (C) 2013 Hubert Feurstein <h.feurstein@gmail.com> + * + * based on arch/arm/boards/freescale-mx6-sabrelite/board.c + * Copyright (C) 2012 Steffen Trumtrar, 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. + */ + +#include <common.h> +#include <init.h> +#include <environment.h> +#include <mach/imx6-regs.h> +#include <fec.h> +#include <gpio.h> +#include <asm/armlinux.h> +#include <generated/mach-types.h> +#include <partition.h> +#include <linux/phy.h> +#include <asm/io.h> +#include <asm/mmu.h> +#include <mach/generic.h> +#include <sizes.h> +#include <net.h> +#include <mach/imx6.h> +#include <mach/devices-imx6.h> +#include <mach/iomux-mx6.h> +#include <spi/spi.h> +#include <mach/spi.h> +#include <mach/usb.h> +#include <envfs.h> + +#define PHY_ID_RTL8211E 0x001cc915 +#define PHY_ID_MASK 0xffffffff + +/* + * This should reset a PHY. Taken from E9 U-Boot/Linux source. + */ +static int rtl8211e_phy_fixup(struct phy_device *dev) +{ + phy_write(dev, 0x00, 0x3140); + mdelay(10); + phy_write(dev, 0x00, 0x3340); + mdelay(10); + + return 0; +} + +static int e9_devices_init(void) +{ + if (!of_machine_is_compatible("embedsky,e9")) + return 0; + + armlinux_set_architecture(3980); + barebox_set_hostname("e9"); + defaultenv_append_directory(defaultenv_e9); + + return 0; +} +device_initcall(e9_devices_init); + +static int e9_coredevices_init(void) +{ + if (!of_machine_is_compatible("embedsky,e9")) + return 0; + + phy_register_fixup_for_uid(PHY_ID_RTL8211E, PHY_ID_MASK, + rtl8211e_phy_fixup); + + return 0; +} +/* + * Do this before the fec initializes but after our + * gpios are available. + */ +coredevice_initcall(e9_coredevices_init); diff --git a/arch/arm/boards/embedsky-e9/defaultenv-e9/boot/mmc1 b/arch/arm/boards/embedsky-e9/defaultenv-e9/boot/mmc1 new file mode 100644 index 0000000000..0177e6c6b8 --- /dev/null +++ b/arch/arm/boards/embedsky-e9/defaultenv-e9/boot/mmc1 @@ -0,0 +1,6 @@ +#!/bin/sh + +mount /dev/mmc1.0 + +global.bootm.image=/mnt/mmc1.0/zImage +global.linux.bootargs.dyn.root="root=/dev/mmcblk0p2 rootwait" diff --git a/arch/arm/boards/embedsky-e9/defaultenv-e9/boot/mmc3 b/arch/arm/boards/embedsky-e9/defaultenv-e9/boot/mmc3 new file mode 100644 index 0000000000..374eb1cfe6 --- /dev/null +++ b/arch/arm/boards/embedsky-e9/defaultenv-e9/boot/mmc3 @@ -0,0 +1,6 @@ +#!/bin/sh + +mount /dev/mmc3.0 + +global.bootm.image=/mnt/mmc3.0/boot/zImage +global.linux.bootargs.dyn.root="root=/dev/mmcblk1p1 rootwait" diff --git a/arch/arm/boards/embedsky-e9/defaultenv-e9/config-board b/arch/arm/boards/embedsky-e9/defaultenv-e9/config-board new file mode 100644 index 0000000000..6cba769921 --- /dev/null +++ b/arch/arm/boards/embedsky-e9/defaultenv-e9/config-board @@ -0,0 +1,7 @@ +#!/bin/sh + +# board defaults, do not change in running system. Change /env/config +# instead + +global.hostname=e9 +global.boot.default=$bootsource$bootsource_instance diff --git a/arch/arm/boards/embedsky-e9/flash-header-e9.imxcfg b/arch/arm/boards/embedsky-e9/flash-header-e9.imxcfg new file mode 100644 index 0000000000..52edefd77a --- /dev/null +++ b/arch/arm/boards/embedsky-e9/flash-header-e9.imxcfg @@ -0,0 +1,87 @@ +loadaddr 0x27800000 +soc imx6 +dcdofs 0x400 + +wm 32 0x020e0798 0x000c0000 +wm 32 0x020e0758 0x00000000 +wm 32 0x020e0588 0x00000030 +wm 32 0x020e0594 0x00000030 +wm 32 0x020e056c 0x00000030 +wm 32 0x020e0578 0x00000030 +wm 32 0x020e074c 0x00000030 +wm 32 0x020e057c 0x00000030 +wm 32 0x020e058c 0x00000000 +wm 32 0x020e059c 0x00000030 +wm 32 0x020e05a0 0x00000030 +wm 32 0x020e078c 0x00000030 +wm 32 0x020e0750 0x00020000 +wm 32 0x020e05a8 0x00000018 +wm 32 0x020e05b0 0x00000018 +wm 32 0x020e0524 0x00000018 +wm 32 0x020e051c 0x00000018 +wm 32 0x020e0518 0x00000018 +wm 32 0x020e050c 0x00000018 +wm 32 0x020e05b8 0x00000018 +wm 32 0x020e05c0 0x00000018 +wm 32 0x020e0774 0x00020000 +wm 32 0x020e0784 0x00000018 +wm 32 0x020e0788 0x00000018 +wm 32 0x020e0794 0x00000018 +wm 32 0x020e079c 0x00000018 +wm 32 0x020e07a0 0x00000018 +wm 32 0x020e07a4 0x00000018 +wm 32 0x020e07a8 0x00000018 +wm 32 0x020e0748 0x00000018 +wm 32 0x020e05ac 0x00000018 +wm 32 0x020e05b4 0x00000018 +wm 32 0x020e0528 0x00000018 +wm 32 0x020e0520 0x00000018 +wm 32 0x020e0514 0x00000018 +wm 32 0x020e0510 0x00000018 +wm 32 0x020e05bc 0x00000018 +wm 32 0x020e05c4 0x00000018 +wm 32 0x021b0800 0xa1390003 +wm 32 0x021b080c 0x001f001f +wm 32 0x021b0810 0x001f001f +wm 32 0x021b480c 0x001f001f +wm 32 0x021b4810 0x001f001f +wm 32 0x021b083c 0x4333033f +wm 32 0x021b0840 0x032c031d +wm 32 0x021b483c 0x43200332 +wm 32 0x021b4840 0x031a026a +wm 32 0x021b0848 0x4d464746 +wm 32 0x021b4848 0x47453f4d +wm 32 0x021b0850 0x3e434440 +wm 32 0x021b4850 0x47384839 +wm 32 0x021b081c 0x33333333 +wm 32 0x021b0820 0x33333333 +wm 32 0x021b0824 0x33333333 +wm 32 0x021b0828 0x33333333 +wm 32 0x021b481c 0x33333333 +wm 32 0x021b4820 0x33333333 +wm 32 0x021b4824 0x33333333 +wm 32 0x021b4828 0x33333333 +wm 32 0x021b08b8 0x00000800 +wm 32 0x021b48b8 0x00000800 +wm 32 0x021b0004 0x00020036 +wm 32 0x021b0008 0x09444040 +wm 32 0x021b000c 0x8a8f7955 +wm 32 0x021b0010 0xff328f64 +wm 32 0x021b0014 0x01ff00db +wm 32 0x021b0018 0x00001740 +wm 32 0x021b001c 0x00008000 +wm 32 0x021b002c 0x000026d2 +wm 32 0x021b0030 0x008f1023 +wm 32 0x021b0040 0x00000047 +wm 32 0x021b0000 0x841a0000 +wm 32 0x021b001c 0x04088032 +wm 32 0x021b001c 0x00008033 +wm 32 0x021b001c 0x00048031 +wm 32 0x021b001c 0x09408030 +wm 32 0x021b001c 0x04008040 +wm 32 0x021b0020 0x00005800 +wm 32 0x021b0818 0x00011117 +wm 32 0x021b4818 0x00011117 +wm 32 0x021b0004 0x00025576 +wm 32 0x021b0404 0x00011006 +wm 32 0x021b001c 0x00000000 diff --git a/arch/arm/boards/embedsky-e9/lowlevel.c b/arch/arm/boards/embedsky-e9/lowlevel.c new file mode 100644 index 0000000000..fee1011700 --- /dev/null +++ b/arch/arm/boards/embedsky-e9/lowlevel.c @@ -0,0 +1,18 @@ +#include <common.h> +#include <sizes.h> +#include <mach/generic.h> +#include <asm/barebox-arm-head.h> +#include <asm/barebox-arm.h> + +extern char __dtb_imx6q_embedsky_e9_start[]; + +ENTRY_FUNCTION(start_imx6q_embedsky_e9, r0, r1, r2) +{ + void *fdt; + + imx6_cpu_lowlevel_init(); + + fdt = __dtb_imx6q_embedsky_e9_start - get_runtime_offset(); + + barebox_arm_entry(0x10000000, SZ_2G, fdt); +} diff --git a/arch/arm/configs/imx_v7_defconfig b/arch/arm/configs/imx_v7_defconfig index 66fc123223..0a4f2fe129 100644 --- a/arch/arm/configs/imx_v7_defconfig +++ b/arch/arm/configs/imx_v7_defconfig @@ -16,6 +16,7 @@ CONFIG_MACH_SABRELITE=y CONFIG_MACH_SABRESD=y CONFIG_MACH_NITROGEN6X=y CONFIG_MACH_SOLIDRUN_MICROSOM=y +CONFIG_MACH_EMBEDSKY_E9=y CONFIG_MACH_EMBEST_RIOTBOARD=y CONFIG_MACH_UDOO=y CONFIG_MACH_VARISCITE_MX6=y diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 72ad5e6a6f..18e451988d 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -31,7 +31,8 @@ dtb-$(CONFIG_ARCH_IMX6) += imx6q-gk802.dtb \ imx6q-udoo.dtb \ imx6q-var-custom.dtb \ imx6s-riotboard.dtb \ - imx6q-phytec-pbaa03.dtb + imx6q-phytec-pbaa03.dtb \ + imx6q-embedsky-e9.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3188-radxarock.dtb dtb-$(CONFIG_ARCH_SOCFPGA) += socfpga_cyclone5_sockit.dtb \ socfpga_cyclone5_socrates.dtb @@ -47,6 +48,7 @@ obj-$(CONFIG_BUILTIN_DTB) += $(BUILTIN_DTB).dtb.o pbl-$(CONFIG_MACH_BEAGLEBONE) += am335x-bone.dtb.o am335x-boneblack.dtb.o am335x-bone-common.dtb.o pbl-$(CONFIG_MACH_DFI_FS700_M60) += imx6q-dfi-fs700-m60-6q.dtb.o imx6dl-dfi-fs700-m60-6s.dtb.o pbl-$(CONFIG_MACH_EFIKA_MX_SMARTBOOK) += imx51-genesi-efika-sb.dtb.o +pbl-$(CONFIG_MACH_EMBEDSKY_E9) += imx6q-embedsky-e9.dtb.o pbl-$(CONFIG_MACH_EMBEST_RIOTBOARD) += imx6s-riotboard.dtb.o pbl-$(CONFIG_MACH_FREESCALE_MX51_PDK) += imx51-babbage.dtb.o pbl-$(CONFIG_MACH_FREESCALE_MX53_LOCO) += imx53-qsb.dtb.o imx53-qsrb.dtb.o diff --git a/arch/arm/dts/imx6q-embedsky-e9.dts b/arch/arm/dts/imx6q-embedsky-e9.dts new file mode 100644 index 0000000000..14f6d5fe15 --- /dev/null +++ b/arch/arm/dts/imx6q-embedsky-e9.dts @@ -0,0 +1,42 @@ +/* + * Copyright 2012 Freescale Semiconductor, Inc. + * Copyright 2011 Linaro Ltd. + * + * The code contained herein is licensed under the GNU General Public + * License. You may obtain a copy of the GNU General Public License + * Version 2 or later at the following locations: + * + * http://www.opensource.org/licenses/gpl-license.html + * http://www.gnu.org/copyleft/gpl.html + */ + +/dts-v1/; + +#include "imx6q.dtsi" +#include <arm/imx6q-embedsky-e9.dtsi> + +/ { + chosen { + linux,stdout-path = &uart4; + + environment@0 { + compatible = "barebox,environment"; + device-path = &usdhc2, "partname:barebox-environment"; + }; + + }; +}; + +&usdhc2 { + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "barebox"; + reg = <0x0 0x80000>; + }; + partition@1 { + label = "barebox-environment"; + reg = <0x80000 0x80000>; + }; +}; diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index 2d99f3eec5..53a44a06e9 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig @@ -208,6 +208,12 @@ config MACH_EFIKA_MX_SMARTBOOK help Choose this to compile barebox for the Efika MX Smartbook +config MACH_EMBEDSKY_E9 + bool "Embedsky E9 Mini-PC" + select ARCH_IMX6 + help + Choose this to compile barebox for the Embedsky E9 Mini PC + config MACH_FREESCALE_MX51_PDK bool "Freescale i.MX51 PDK" select ARCH_IMX51 diff --git a/arch/arm/mach-imx/imx-bbu-internal.c b/arch/arm/mach-imx/imx-bbu-internal.c index 125415ec8d..56369a0f94 100644 --- a/arch/arm/mach-imx/imx-bbu-internal.c +++ b/arch/arm/mach-imx/imx-bbu-internal.c @@ -168,7 +168,7 @@ static int imx_bbu_internal_v1_update(struct bbu_handler *handler, struct bbu_da * layer. */ static int imx_bbu_internal_v2_write_nand_dbbt(struct imx_internal_bbu_handler *imx_handler, - struct bbu_data *data, void *image, int image_len) + struct bbu_data *data) { struct mtd_info_user meminfo; int fd; @@ -178,6 +178,11 @@ static int imx_bbu_internal_v2_write_nand_dbbt(struct imx_internal_bbu_handler * uint32_t *ptr, *num_bb, *bb; uint64_t offset; int block = 0, len, now, blocksize; + int dbbt_start_page = 4; + int firmware_start_page = 12; + void *dbbt_base; + void *image, *freep = NULL; + int pre_image_size; ret = stat(data->devicefile, &s); if (ret) @@ -193,32 +198,40 @@ static int imx_bbu_internal_v2_write_nand_dbbt(struct imx_internal_bbu_handler * if (ret) goto out; + pre_image_size = firmware_start_page * meminfo.writesize; + image = freep = xzalloc(data->len + pre_image_size); + memcpy(image + pre_image_size, data->image, data->len); + blocksize = meminfo.erasesize; ptr = image + 0x4; *ptr++ = FCB_MAGIC; /* FCB */ *ptr++ = 1; /* FCB version */ + ptr = image + 0x68; /* Firmware start page */ + *ptr = firmware_start_page; + ptr = image + 0x78; /* DBBT start page */ - *ptr = 4; + *ptr = dbbt_start_page; - ptr = image + 4 * 2048 + 4; + dbbt_base = image + dbbt_start_page * meminfo.writesize; + ptr = dbbt_base + 4; *ptr++ = DBBT_MAGIC; /* DBBT */ *ptr = 1; /* DBBT version */ - ptr = (u32*)(image + 0x2010); + ptr = (u32*)(dbbt_base + 0x10); /* * This is marked as reserved in the i.MX53 reference manual, but * must be != 0. Otherwise the ROM ignores the DBBT */ *ptr = 1; - ptr = (u32*)(image + 0x4004); /* start of DBBT */ + ptr = (u32*)(dbbt_base + 4 * meminfo.writesize + 4); /* start of DBBT */ num_bb = ptr; bb = ptr + 1; offset = 0; - size_need = data->len + 0x8000; + size_need = data->len + pre_image_size; /* * Collect bad blocks and construct DBBT @@ -261,18 +274,18 @@ static int imx_bbu_internal_v2_write_nand_dbbt(struct imx_internal_bbu_handler * } debug("total image size: 0x%08zx. Space needed including bad blocks: 0x%08zx\n", - data->len + 0x8000, - data->len + 0x8000 + *num_bb * blocksize); + data->len + pre_image_size, + data->len + pre_image_size + *num_bb * blocksize); - if (data->len + 0x8000 + *num_bb * blocksize > imx_handler->device_size) { + if (data->len + pre_image_size + *num_bb * blocksize > imx_handler->device_size) { printf("needed space (0x%08zx) exceeds partition space (0x%08zx)\n", - data->len + 0x8000 + *num_bb * blocksize, + data->len + pre_image_size + *num_bb * blocksize, imx_handler->device_size); ret = -ENOSPC; goto out; } - len = data->len + 0x8000; + len = data->len + pre_image_size; offset = 0; /* @@ -312,6 +325,7 @@ static int imx_bbu_internal_v2_write_nand_dbbt(struct imx_internal_bbu_handler * out: close(fd); + free(freep); return ret; } @@ -329,10 +343,7 @@ static int imx_bbu_internal_v2_update(struct bbu_handler *handler, struct bbu_da { struct imx_internal_bbu_handler *imx_handler = container_of(handler, struct imx_internal_bbu_handler, handler); - void *imx_pre_image = NULL; - int imx_pre_image_size; - int ret, image_len; - void *buf; + int ret; uint32_t *barker; ret = imx_bbu_check_prereq(data); @@ -346,26 +357,10 @@ static int imx_bbu_internal_v2_update(struct bbu_handler *handler, struct bbu_da return -EINVAL; } - imx_pre_image_size = 0; - - if (imx_handler->flags & IMX_INTERNAL_FLAG_NAND) { - /* NAND needs additional space for the DBBT */ - imx_pre_image_size += 0x6000; - imx_pre_image = xzalloc(imx_pre_image_size); - - /* Create a buffer containing header and image data */ - image_len = data->len + imx_pre_image_size; - buf = xzalloc(image_len); - memcpy(buf, imx_pre_image, imx_pre_image_size); - memcpy(buf + imx_pre_image_size, data->image, data->len); - - ret = imx_bbu_internal_v2_write_nand_dbbt(imx_handler, data, buf, - image_len); - free(buf); - free(imx_pre_image); - } else { + if (imx_handler->flags & IMX_INTERNAL_FLAG_NAND) + ret = imx_bbu_internal_v2_write_nand_dbbt(imx_handler, data); + else ret = imx_bbu_write_device(imx_handler, data, data->image, data->len); - } return ret; } |