summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-02-04 19:09:15 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2015-02-04 19:09:15 +0100
commita7c92d6c5da9ff7fbe9f8ca79201c804aae9cb33 (patch)
tree57d6dd0e92df51a44494c886f1803d22d3efcaf6 /arch
parent1a1ac39eeb95c064599dff42f77a64c4a1d2ec4e (diff)
parentb5579c7c12db00e3c90575f1e1da7e7488104b53 (diff)
downloadbarebox-a7c92d6c5da9ff7fbe9f8ca79201c804aae9cb33.tar.gz
barebox-a7c92d6c5da9ff7fbe9f8ca79201c804aae9cb33.tar.xz
Merge branch 'for-next/imx'
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/boards/embedsky-e9/board.c17
-rw-r--r--arch/arm/boards/embedsky-e9/defaultenv-e9/boot/mmc34
-rw-r--r--arch/arm/boards/phytec-phyflex-imx6/board.c31
-rw-r--r--arch/arm/boards/phytec-phyflex-imx6/flash-header-phytec-pfla02-1gib-1bank.imxcfg8
-rw-r--r--arch/arm/boards/phytec-phyflex-imx6/lowlevel.c1
-rw-r--r--arch/arm/dts/imx6q-embedsky-e9.dts23
-rw-r--r--arch/arm/dts/imx6qdl-phytec-pfla02.dtsi41
-rw-r--r--arch/arm/mach-imx/Kconfig1
-rw-r--r--arch/arm/mach-imx/clk-imx5.c1
-rw-r--r--arch/arm/mach-imx/imx6-bbu-nand.c38
-rw-r--r--arch/arm/mach-imx/include/mach/devices-imx53.h5
11 files changed, 133 insertions, 37 deletions
diff --git a/arch/arm/boards/embedsky-e9/board.c b/arch/arm/boards/embedsky-e9/board.c
index 1e7e06788a..e8aac0c1b0 100644
--- a/arch/arm/boards/embedsky-e9/board.c
+++ b/arch/arm/boards/embedsky-e9/board.c
@@ -40,6 +40,7 @@
#include <mach/spi.h>
#include <mach/usb.h>
#include <envfs.h>
+#include <bootsource.h>
#define PHY_ID_RTL8211E 0x001cc915
#define PHY_ID_MASK 0xffffffff
@@ -59,11 +60,25 @@ static int rtl8211e_phy_fixup(struct phy_device *dev)
static int e9_devices_init(void)
{
+ int ret;
+ char *environment_path;
+
if (!of_machine_is_compatible("embedsky,e9"))
return 0;
armlinux_set_architecture(3980);
- barebox_set_hostname("e9");
+
+ environment_path = asprintf("/chosen/environment-mmc%d",
+ bootsource_get_instance());
+
+ ret = of_device_enable_path(environment_path);
+
+ if (ret < 0)
+ pr_warn("Failed to enable environment partition '%s' (%d)\n",
+ environment_path, ret);
+
+ free(environment_path);
+
defaultenv_append_directory(defaultenv_e9);
return 0;
diff --git a/arch/arm/boards/embedsky-e9/defaultenv-e9/boot/mmc3 b/arch/arm/boards/embedsky-e9/defaultenv-e9/boot/mmc3
index 374eb1cfe6..f6cb529d3c 100644
--- a/arch/arm/boards/embedsky-e9/defaultenv-e9/boot/mmc3
+++ b/arch/arm/boards/embedsky-e9/defaultenv-e9/boot/mmc3
@@ -2,5 +2,5 @@
mount /dev/mmc3.0
-global.bootm.image=/mnt/mmc3.0/boot/zImage
-global.linux.bootargs.dyn.root="root=/dev/mmcblk1p1 rootwait"
+global.bootm.image=/mnt/mmc3.0/zImage
+global.linux.bootargs.dyn.root="root=/dev/mmcblk0p2 rootwait"
diff --git a/arch/arm/boards/phytec-phyflex-imx6/board.c b/arch/arm/boards/phytec-phyflex-imx6/board.c
index 1551460393..5f65261a9f 100644
--- a/arch/arm/boards/phytec-phyflex-imx6/board.c
+++ b/arch/arm/boards/phytec-phyflex-imx6/board.c
@@ -17,6 +17,7 @@
*
*/
+#include <malloc.h>
#include <envfs.h>
#include <environment.h>
#include <bootsource.h>
@@ -65,6 +66,9 @@ static void phyflex_err006282_workaround(void)
static int phytec_pfla02_init(void)
{
+ int ret;
+ char *environment_path;
+
if (!of_machine_is_compatible("phytec,imx6q-pfla02") &&
!of_machine_is_compatible("phytec,imx6dl-pfla02") &&
!of_machine_is_compatible("phytec,imx6s-pfla02"))
@@ -76,19 +80,38 @@ static int phytec_pfla02_init(void)
switch (bootsource_get()) {
case BOOTSOURCE_MMC:
- of_device_enable_path("/chosen/environment-sd");
+ environment_path = asprintf("/chosen/environment-sd%d",
+ bootsource_get_instance() + 1);
break;
case BOOTSOURCE_NAND:
- of_device_enable_path("/chosen/environment-nand");
+ environment_path = asprintf("/chosen/environment-nand");
break;
default:
case BOOTSOURCE_SPI:
- of_device_enable_path("/chosen/environment-spinor");
+ environment_path = asprintf("/chosen/environment-spinor");
break;
}
- defaultenv_append_directory(defaultenv_phyflex_imx6);
+ ret = of_device_enable_path(environment_path);
+ if (ret < 0)
+ pr_warn("Failed to enable environment partition '%s' (%d)\n",
+ environment_path, ret);
+
+ free(environment_path);
return 0;
}
device_initcall(phytec_pfla02_init);
+
+static int phytec_pbab0x_init(void)
+{
+ if (!of_machine_is_compatible("phytec,imx6x-pbab01") &&
+ !of_machine_is_compatible("phytec,imx6dl-pbab05") &&
+ !of_machine_is_compatible("phytec,imx6q-pbab02"))
+ return 0;
+
+ defaultenv_append_directory(defaultenv_phyflex_imx6);
+
+ return 0;
+}
+device_initcall(phytec_pbab0x_init);
diff --git a/arch/arm/boards/phytec-phyflex-imx6/flash-header-phytec-pfla02-1gib-1bank.imxcfg b/arch/arm/boards/phytec-phyflex-imx6/flash-header-phytec-pfla02-1gib-1bank.imxcfg
new file mode 100644
index 0000000000..e414b6e612
--- /dev/null
+++ b/arch/arm/boards/phytec-phyflex-imx6/flash-header-phytec-pfla02-1gib-1bank.imxcfg
@@ -0,0 +1,8 @@
+#define SETUP_MDCFG0 \
+ wm 32 0x021b000c 0x565c9b85
+
+#define SETUP_1GIB_2GIB_4GIB \
+ wm 32 0x021b0040 0x00000027; \
+ wm 32 0x021b0000 0x831a0000
+
+#include "flash-header-phytec-pfla02.h"
diff --git a/arch/arm/boards/phytec-phyflex-imx6/lowlevel.c b/arch/arm/boards/phytec-phyflex-imx6/lowlevel.c
index dbd264aed2..ee6d7fb262 100644
--- a/arch/arm/boards/phytec-phyflex-imx6/lowlevel.c
+++ b/arch/arm/boards/phytec-phyflex-imx6/lowlevel.c
@@ -90,6 +90,7 @@ static void __noreturn start_imx6_phytec_common(uint32_t size,
}
PHYTEC_ENTRY(start_phytec_pbab01_1gib, imx6q_phytec_pbab01, SZ_1G, true);
+PHYTEC_ENTRY(start_phytec_pbab01_1gib_1bank, imx6q_phytec_pbab01, SZ_1G, true);
PHYTEC_ENTRY(start_phytec_pbab01_2gib, imx6q_phytec_pbab01, SZ_2G, true);
PHYTEC_ENTRY(start_phytec_pbab01_4gib, imx6q_phytec_pbab01, SZ_4G, true);
PHYTEC_ENTRY(start_phytec_pbab01dl_1gib, imx6dl_phytec_pbab01, SZ_1G, false);
diff --git a/arch/arm/dts/imx6q-embedsky-e9.dts b/arch/arm/dts/imx6q-embedsky-e9.dts
index d8a606a1bb..53665cf9d5 100644
--- a/arch/arm/dts/imx6q-embedsky-e9.dts
+++ b/arch/arm/dts/imx6q-embedsky-e9.dts
@@ -19,9 +19,16 @@
chosen {
linux,stdout-path = &uart4;
- environment@0 {
+ environment-mmc1 {
compatible = "barebox,environment";
device-path = &usdhc2, "partname:barebox-environment";
+ status = "disabled";
+ };
+
+ environment-mmc3 {
+ compatible = "barebox,environment";
+ device-path = &usdhc4, "partname:barebox-environment";
+ status = "disabled";
};
};
@@ -40,3 +47,17 @@
reg = <0x80000 0x80000>;
};
};
+
+&usdhc4 {
+ #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/dts/imx6qdl-phytec-pfla02.dtsi b/arch/arm/dts/imx6qdl-phytec-pfla02.dtsi
index 32ce088fee..5ac0ef9431 100644
--- a/arch/arm/dts/imx6qdl-phytec-pfla02.dtsi
+++ b/arch/arm/dts/imx6qdl-phytec-pfla02.dtsi
@@ -23,11 +23,29 @@
status = "disabled";
};
- environment-sd {
+ environment-sd1 {
+ compatible = "barebox,environment";
+ device-path = &usdhc1, "partname:barebox-environment";
+ status = "disabled";
+ };
+
+ environment-sd2 {
+ compatible = "barebox,environment";
+ device-path = &usdhc2, "partname:barebox-environment";
+ status = "disabled";
+ };
+
+ environment-sd3 {
compatible = "barebox,environment";
device-path = &usdhc3, "partname:barebox-environment";
status = "disabled";
};
+
+ environment-sd4 {
+ compatible = "barebox,environment";
+ device-path = &usdhc4, "partname:barebox-environment";
+ status = "disabled";
+ };
};
};
@@ -48,14 +66,23 @@
partition@0 {
label = "barebox";
- reg = <0x0 0x80000>;
+ reg = <0x0 0x100000>;
};
partition@1 {
label = "barebox-environment";
- reg = <0x80000 0x10000>;
+ reg = <0x100000 0x20000>;
};
+ partition@2 {
+ label = "oftree";
+ reg = <0x120000 0x20000>;
+ };
+
+ partition@3 {
+ label = "kernel";
+ reg = <0x140000 0x0>;
+ };
};
};
@@ -95,22 +122,22 @@
partition@1 {
label = "barebox-environment";
- reg = <0x400000 0x20000>;
+ reg = <0x400000 0x100000>;
};
partition@2 {
label = "oftree";
- reg = <0x420000 0x20000>;
+ reg = <0x500000 0x100000>;
};
partition@3 {
label = "kernel";
- reg = <0x440000 0x800000>;
+ reg = <0x600000 0x800000>;
};
partition@4 {
label = "root";
- reg = <0xC40000 0x0>;
+ reg = <0xe00000 0x0>;
};
};
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 9ac36e1453..477207e646 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -119,6 +119,7 @@ config BAREBOX_UPDATE_IMX6_NAND
depends on BAREBOX_UPDATE
depends on MTD
depends on MTD_WRITE
+ depends on NAND_MXS
default y
comment "Freescale i.MX System-on-Chip"
diff --git a/arch/arm/mach-imx/clk-imx5.c b/arch/arm/mach-imx/clk-imx5.c
index 2ae8d6aa3a..ea805b0f64 100644
--- a/arch/arm/mach-imx/clk-imx5.c
+++ b/arch/arm/mach-imx/clk-imx5.c
@@ -372,6 +372,7 @@ int __init mx53_clocks_init(void __iomem *regs, unsigned long rate_ckil, unsigne
clkdev_add_physbase(clks[IMX5_CLK_UART_ROOT], MX53_UART1_BASE_ADDR, NULL);
clkdev_add_physbase(clks[IMX5_CLK_UART_ROOT], MX53_UART2_BASE_ADDR, NULL);
clkdev_add_physbase(clks[IMX5_CLK_UART_ROOT], MX53_UART3_BASE_ADDR, NULL);
+ clkdev_add_physbase(clks[IMX5_CLK_UART_ROOT], MX53_UART4_BASE_ADDR, NULL);
clkdev_add_physbase(clks[IMX5_CLK_PER_ROOT], MX53_I2C1_BASE_ADDR, NULL);
clkdev_add_physbase(clks[IMX5_CLK_PER_ROOT], MX53_I2C2_BASE_ADDR, NULL);
clkdev_add_physbase(clks[IMX5_CLK_PER_ROOT], MX53_I2C3_BASE_ADDR, NULL);
diff --git a/arch/arm/mach-imx/imx6-bbu-nand.c b/arch/arm/mach-imx/imx6-bbu-nand.c
index 1b46e514e9..d2bfedbad5 100644
--- a/arch/arm/mach-imx/imx6-bbu-nand.c
+++ b/arch/arm/mach-imx/imx6-bbu-nand.c
@@ -30,6 +30,7 @@
#include <fs.h>
#include <mach/bbu.h>
#include <linux/mtd/mtd-abi.h>
+#include <linux/mtd/nand_mxs.h>
#include <linux/mtd/mtd.h>
#include <linux/stat.h>
@@ -235,22 +236,9 @@ static int fcb_create(struct fcb_block *fcb, struct mtd_info *mtd)
fcb->TotalPageSize = mtd->writesize + mtd->oobsize;
fcb->SectorsPerBlock = mtd->erasesize / mtd->writesize;
- if (mtd->writesize == 2048) {
- fcb->EccBlock0EccType = 4;
- } else if (mtd->writesize == 4096) {
- if (mtd->oobsize == 218) {
- fcb->EccBlock0EccType = 8;
- } else if (mtd->oobsize == 128) {
- fcb->EccBlock0EccType = 4;
- } else {
- pr_err("Illegal oobsize %d\n", mtd->oobsize);
- return -EINVAL;
- }
- } else {
- pr_err("Illegal writesize %d\n", mtd->writesize);
- return -EINVAL;
- }
-
+ /* Divide ECC strength by two and save the value into FCB structure. */
+ fcb->EccBlock0EccType =
+ mxs_nand_get_ecc_strength(mtd->writesize, mtd->oobsize) >> 1;
fcb->EccBlockNEccType = fcb->EccBlock0EccType;
/* Also hardcoded in kobs-ng */
@@ -267,12 +255,8 @@ static int fcb_create(struct fcb_block *fcb, struct mtd_info *mtd)
/* DBBT search area starts at third block */
fcb->DBBTSearchAreaStartAddress = mtd->erasesize / mtd->writesize * 2;
- if (mtd->writesize == 2048) {
- fcb->BadBlockMarkerByte = 0x000007cf;
- } else {
- pr_err("BadBlockMarkerByte unknown for writesize %d\n", mtd->writesize);
- return -EINVAL;
- }
+ fcb->BadBlockMarkerByte = mxs_nand_mark_byte_offset(mtd);
+ fcb->BadBlockMarkerStartBit = mxs_nand_mark_bit_offset(mtd);
fcb->BBMarkerPhysicalOffset = mtd->writesize;
@@ -437,6 +421,16 @@ static int imx6_bbu_nand_update(struct bbu_handler *handler, struct bbu_data *da
fcb_create(fcb, mtd);
encode_hamming_13_8(fcb, ecc, 512);
+
+ /*
+ * Set the first and second byte of OOB data to 0xFF, not 0x00. These
+ * bytes are used as the Manufacturers Bad Block Marker (MBBM). Since
+ * the FCB is mostly written to the first page in a block, a scan for
+ * factory bad blocks will detect these blocks as bad, e.g. when
+ * function nand_scan_bbt() is executed to build a new bad block table.
+ */
+ memset(fcb_raw_page + mtd->writesize, 0xFF, 2);
+
ret = raw_write_page(mtd, fcb_raw_page, 0);
if (ret)
goto out;
diff --git a/arch/arm/mach-imx/include/mach/devices-imx53.h b/arch/arm/mach-imx/include/mach/devices-imx53.h
index 88be4fdbc8..10caae8c93 100644
--- a/arch/arm/mach-imx/include/mach/devices-imx53.h
+++ b/arch/arm/mach-imx/include/mach/devices-imx53.h
@@ -47,6 +47,11 @@ static inline struct device_d *imx53_add_uart2(void)
return imx_add_uart_imx21((void *)MX53_UART3_BASE_ADDR, 2);
}
+static inline struct device_d *imx53_add_uart3(void)
+{
+ return imx_add_uart_imx21((void *)MX53_UART4_BASE_ADDR, 3);
+}
+
static inline struct device_d *imx53_add_fec(struct fec_platform_data *pdata)
{
return imx_add_fec_imx27((void *)MX53_FEC_BASE_ADDR, pdata);