diff options
author | Lucas Stach <dev@lynxeye.de> | 2015-11-18 20:57:55 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-11-30 08:22:30 +0100 |
commit | e7a8519963fcb235a123dfe5e7dd59d6fb2eaf9e (patch) | |
tree | a97f1ede51a32b6fb11e09b746c53b3ae538b80b /arch/arm/boards | |
parent | c5478e10de53f477bbbd3ba7b6fe24737acbf60b (diff) | |
download | barebox-e7a8519963fcb235a123dfe5e7dd59d6fb2eaf9e.tar.gz barebox-e7a8519963fcb235a123dfe5e7dd59d6fb2eaf9e.tar.xz |
ARM: mx6sx-sabresdb: set proper hostname
Also move the initcall to the level matching the name of the
function.
Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/boards')
-rw-r--r-- | arch/arm/boards/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/boards/ccxmx53/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/boards/ccxmx53/board.c | 181 | ||||
-rw-r--r-- | arch/arm/boards/ccxmx53/flash-header-imx53-ccxmx53_1gib.imxcfg | 67 | ||||
-rw-r--r-- | arch/arm/boards/ccxmx53/flash-header-imx53-ccxmx53_512mb.imxcfg | 67 | ||||
-rw-r--r-- | arch/arm/boards/ccxmx53/lowlevel.c | 53 | ||||
-rw-r--r-- | arch/arm/boards/freescale-mx6sx-sabresdb/board.c | 4 |
7 files changed, 374 insertions, 1 deletions
diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile index 1536c6bac1..2e58f15f35 100644 --- a/arch/arm/boards/Makefile +++ b/arch/arm/boards/Makefile @@ -17,6 +17,7 @@ obj-$(CONFIG_MACH_CANON_A1100) += canon-a1100/ obj-$(CONFIG_MACH_CM_FX6) += cm-fx6/ obj-$(CONFIG_MACH_NITROGEN6X) += boundarydevices-nitrogen6x/ obj-$(CONFIG_MACH_CCMX51) += ccxmx51/ +obj-$(CONFIG_MACH_CCMX53) += ccxmx53/ obj-$(CONFIG_MACH_CFA10036) += crystalfontz-cfa10036/ obj-$(CONFIG_MACH_CHUMBY) += chumby_falconwing/ obj-$(CONFIG_MACH_CLEP7212) += clep7212/ diff --git a/arch/arm/boards/ccxmx53/Makefile b/arch/arm/boards/ccxmx53/Makefile new file mode 100644 index 0000000000..01c7a259e9 --- /dev/null +++ b/arch/arm/boards/ccxmx53/Makefile @@ -0,0 +1,2 @@ +obj-y += board.o +lwl-y += lowlevel.o diff --git a/arch/arm/boards/ccxmx53/board.c b/arch/arm/boards/ccxmx53/board.c new file mode 100644 index 0000000000..0031aed772 --- /dev/null +++ b/arch/arm/boards/ccxmx53/board.c @@ -0,0 +1,181 @@ +/* + * Copyright (C) 2015 Jason Cobham <cobham.jason@gmail.com> + * + * Board specific file for the Digi ConnectCore ccxmx53 SoM + * + * 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 <linux/sizes.h> +#include <i2c/i2c.h> +#include <gpio.h> + +#include <generated/mach-types.h> +#include <mach/imx5.h> +#include <mach/generic.h> +#include <mach/imx53-regs.h> +#include <mach/esdctl.h> +#include <asm/armlinux.h> +#include <mach/bbu.h> +#include <mach/iim.h> + + +struct ccwmx53_ident { + const char *id_string; + const int mem_sz; + const char industrial; + const char eth0; + const char eth1; + const char wless; +}; + +static struct ccwmx53_ident ccwmx53_ids[] = { + /* 0x00 - 5500xxxx-xx */ + { "Unknown", 0, 0, 0, 0, 0}, + /* 0x01 - 5500xxxx-xx */ + { "Not supported", 0, 0, 0, 0, 0}, + /* 0x02 - 55001604-01 */ + { "i.MX535@1000MHz, Wireless, PHY, Ext. Eth, Accel", SZ_512M, 0, 1, 1, 1}, + /* 0x03 - 55001605-01 */ + { "i.MX535@1000MHz, PHY, Accel", SZ_512M, 0, 1, 0, 0}, + /* 0x04 - 55001604-02 */ + { "i.MX535@1000MHz, Wireless, PHY, Ext. Eth, Accel", SZ_512M, 0, 1, 1, 1}, + /* 0x05 - 5500xxxx-xx */ + { "i.MX535@1000MHz, PHY, Ext. Eth, Accel", SZ_512M, 0, 1, 1, 0}, + /* 0x06 - 55001604-03 */ + { "i.MX535@1000MHz, Wireless, PHY, Accel", SZ_512M, 0, 1, 0, 1}, + /* 0x07 - 5500xxxx-xx */ + { "i.MX535@1000MHz, PHY, Accel", SZ_512M, 0, 1, 0, 0}, + /* 0x08 - 55001604-04 */ + { "i.MX537@800MHz, Wireless, PHY, Accel", SZ_512M, 1, 1, 0, 1}, + /* 0x09 - 55001605-02 */ + { "i.MX537@800MHz, PHY, Accel", SZ_512M, 1, 1, 0, 0}, + /* 0x0a - 5500xxxx-xx */ + { "i.MX537@800MHz, Wireless, PHY, Ext. Eth, Accel", SZ_512M, 1, 1, 1, 1}, + /* 0x0b - 55001605-03 */ + { "i.MX537@800MHz, PHY, Ext. Eth, Accel", SZ_1G, 1, 1, 1, 0}, + /* 0x0c - 5500xxxx-xx */ + { "Reserved for future use", 0, 0, 0, 0, 0}, + /* 0x0d - 55001605-05 */ + { "i.MX537@800MHz, PHY, Accel", SZ_1G, 1, 1, 0, 0}, + /* 0x0e - 5500xxxx-xx */ + { "Reserved for future use", 0, 0, 0, 0, 0}, + /* 0x0f - 5500xxxx-xx */ + { "Reserved for future use", 0, 0, 0, 0, 0}, +}; + +static struct ccwmx53_ident *ccwmx53_id; + +/* On these boards, memory information is encoded in the MAC address. + * Print device memory, and option info from lookup table. + * */ +static int ccwmx53_devices_init(void) +{ + u8 hwid[6] = {0}; + char manloc = 0; + + if ((imx_iim_read(1, 9, hwid, sizeof(hwid)) != sizeof(hwid)) || + (hwid[0] < 0x02) || + (hwid[0] >= ARRAY_SIZE(ccwmx53_ids))) { + printf("Module Variant: Unknown (0x%02x) (0x%02x) (0x%02x) (0x%02x) (0x%02x) (0x%02x)\n", + hwid[0], hwid[1], hwid[2], hwid[3], hwid[4], hwid[5]); + memset(hwid, 0x00, sizeof(hwid)); + } + + ccwmx53_id = &ccwmx53_ids[hwid[0]]; + printf("Module Variant: %s (0x%02x)\n", ccwmx53_id->id_string, hwid[0]); + + if (hwid[0]) { + printf("Module HW Rev : %02x\n", hwid[1] + 1); + switch (hwid[2] & 0xc0) { + case 0x00: + manloc = 'B'; + break; + case 0x40: + manloc = 'W'; + break; + case 0x80: + manloc = 'S'; + break; + default: + manloc = 'N'; + break; + } + + printf("Module Serial : %c%d\n", manloc, + ((hwid[2] & 0x3f) << 24) | + (hwid[3] << 16) | + (hwid[4] << 8) | + hwid[5]); + + printf("Module RAM : %dK\n", (ccwmx53_id->mem_sz) / 1024); + + } else { + return -ENOSYS; + } + + armlinux_set_architecture(MACH_TYPE_CCWMX53); + + return 0; +} +device_initcall(ccwmx53_devices_init); + +static int ccxmx53_init(void) +{ + unsigned char value = 0; + struct i2c_adapter *adapter = NULL; + struct i2c_client client; + int addr = 0x68; /* da9053 device address is 0x68 */ + int bus = 0; /* I2C0 bus */ + + if (!of_machine_is_compatible("digi,imx53-ccxmx53")) + return 0; + + adapter = i2c_get_adapter(bus); + if (adapter) { + client.adapter = adapter; + client.addr = addr; + /* Enable 3.3V ext regulator. */ + value = 0xfa; + if (i2c_write_reg(&client, 0x19, &value, 1) < 0) { + printf("Can't set regulator. I2C write failed\n"); + return -ENOSYS; + } + } else { + printf("Can't set regulator. No I2C Adapter\n"); + return -ENOSYS; + } + + armlinux_set_architecture(MACH_TYPE_CCMX53); + + barebox_set_model("Digi CCMX53"); + barebox_set_hostname("ccxmx53"); + + imx53_bbu_internal_nand_register_handler("nand", + BBU_HANDLER_FLAG_DEFAULT, SZ_512K); + + return 0; +} +late_initcall(ccxmx53_init); + +static int ccxmx53_postcore_init(void) +{ + if (!of_machine_is_compatible("digi,imx53-ccxmx53")) + return 0; + + imx53_init_lowlevel(800); + + return 0; +} +postcore_initcall(ccxmx53_postcore_init); diff --git a/arch/arm/boards/ccxmx53/flash-header-imx53-ccxmx53_1gib.imxcfg b/arch/arm/boards/ccxmx53/flash-header-imx53-ccxmx53_1gib.imxcfg new file mode 100644 index 0000000000..6f1cab60c7 --- /dev/null +++ b/arch/arm/boards/ccxmx53/flash-header-imx53-ccxmx53_1gib.imxcfg @@ -0,0 +1,67 @@ +loadaddr 0x70000000 +soc imx53 +dcdofs 0x400 +wm 32 0x53fa8554 0x00200000 +wm 32 0x53fa8558 0x00200040 +wm 32 0x53fa8560 0x00200000 +wm 32 0x53fa8564 0x00200040 +wm 32 0x53fa8568 0x00200040 +wm 32 0x53fa8570 0x00200000 +wm 32 0x53fa8574 0x00200000 +wm 32 0x53fa8578 0x00200000 +wm 32 0x53fa857c 0x00200040 +wm 32 0x53fa8580 0x00200040 +wm 32 0x53fa8584 0x00200000 +wm 32 0x53fa8588 0x00200000 +wm 32 0x53fa8590 0x00200040 +wm 32 0x53fa8594 0x00200000 +wm 32 0x53fa86f0 0x00200000 +wm 32 0x53fa86f4 0x00000200 +wm 32 0x53fa86fc 0x00000000 +wm 32 0x53fa8714 0x00000000 +wm 32 0x53fa8718 0x00200000 +wm 32 0x53fa871c 0x00200000 +wm 32 0x53fa8720 0x00200000 +wm 32 0x53fa8724 0x06000000 +wm 32 0x53fa8728 0x00200000 +wm 32 0x53fa872c 0x00200000 +wm 32 0x63fd9088 0x2d313331 +wm 32 0x63fd9090 0x393b3836 +wm 32 0x63fd90f8 0x00000800 +wm 32 0x63fd907c 0x020c0211 +wm 32 0x63fd9080 0x014c0155 +wm 32 0x63fd9018 0x000016d0 +wm 32 0x63fd9000 0xc4110000 +wm 32 0x63fd900c 0x4d5122d2 +wm 32 0x63fd9010 0x92d18a22 +wm 32 0x63fd9014 0x00c70092 +wm 32 0x63fd902c 0x000026d2 +wm 32 0x63fd9030 0x009f000e +wm 32 0x63fd9008 0x12272000 +wm 32 0x63fd9004 0x00030012 +wm 32 0x63fd901c 0x04008010 +wm 32 0x63fd901c 0x00008032 +wm 32 0x63fd901c 0x00008033 +wm 32 0x63fd901c 0x00008031 +wm 32 0x63fd901c 0x0b5280b0 +wm 32 0x63fd901c 0x04008010 +wm 32 0x63fd901c 0x00008020 +wm 32 0x63fd901c 0x00008020 +wm 32 0x63fd901c 0x0a528030 +wm 32 0x63fd901c 0x03c68031 +wm 32 0x63fd901c 0x00448031 +wm 32 0x63fd901c 0x04008018 +wm 32 0x63fd901c 0x0000803a +wm 32 0x63fd901c 0x0000803b +wm 32 0x63fd901c 0x00008039 +wm 32 0x63fd901c 0x0b528138 +wm 32 0x63fd901c 0x04008018 +wm 32 0x63fd901c 0x00008028 +wm 32 0x63fd901c 0x00008028 +wm 32 0x63fd901c 0x0a528038 +wm 32 0x63fd901c 0x03c68039 +wm 32 0x63fd901c 0x00448039 +wm 32 0x63fd9020 0x00005800 +wm 32 0x63fd9058 0x00022225 +wm 32 0x63fd901c 0x00000000 +wm 32 0x63fd9040 0x04b80003 diff --git a/arch/arm/boards/ccxmx53/flash-header-imx53-ccxmx53_512mb.imxcfg b/arch/arm/boards/ccxmx53/flash-header-imx53-ccxmx53_512mb.imxcfg new file mode 100644 index 0000000000..b707dd64a6 --- /dev/null +++ b/arch/arm/boards/ccxmx53/flash-header-imx53-ccxmx53_512mb.imxcfg @@ -0,0 +1,67 @@ +loadaddr 0x70000000 +soc imx53 +dcdofs 0x400 +wm 32 0x53fa8554 0x00200000 +wm 32 0x53fa8558 0x00200040 +wm 32 0x53fa8560 0x00200000 +wm 32 0x53fa8564 0x00200040 +wm 32 0x53fa8568 0x00200040 +wm 32 0x53fa8570 0x00200000 +wm 32 0x53fa8574 0x00200000 +wm 32 0x53fa8578 0x00200000 +wm 32 0x53fa857c 0x00200040 +wm 32 0x53fa8580 0x00200040 +wm 32 0x53fa8584 0x00200000 +wm 32 0x53fa8588 0x00200000 +wm 32 0x53fa8590 0x00200040 +wm 32 0x53fa8594 0x00200000 +wm 32 0x53fa86f0 0x00200000 +wm 32 0x53fa86f4 0x00000200 +wm 32 0x53fa86fc 0x00000000 +wm 32 0x53fa8714 0x00000000 +wm 32 0x53fa8718 0x00200000 +wm 32 0x53fa871c 0x00200000 +wm 32 0x53fa8720 0x00200000 +wm 32 0x53fa8724 0x06000000 +wm 32 0x53fa8728 0x00200000 +wm 32 0x53fa872c 0x00200000 +wm 32 0x63fd9088 0x2d313331 +wm 32 0x63fd9090 0x393b3836 +wm 32 0x63fd90f8 0x00000800 +wm 32 0x63fd907c 0x020c0211 +wm 32 0x63fd9080 0x014c0155 +wm 32 0x63fd9018 0x000016d0 +wm 32 0x63fd9000 0xc2110000 +wm 32 0x63fd900c 0x4d5122d2 +wm 32 0x63fd9010 0x92d18a22 +wm 32 0x63fd9014 0x00c70092 +wm 32 0x63fd902c 0x000026d2 +wm 32 0x63fd9030 0x009f000e +wm 32 0x63fd9008 0x12272000 +wm 32 0x63fd9004 0x00030012 +wm 32 0x63fd901c 0x04008010 +wm 32 0x63fd901c 0x00008032 +wm 32 0x63fd901c 0x00008033 +wm 32 0x63fd901c 0x00008031 +wm 32 0x63fd901c 0x0b5280b0 +wm 32 0x63fd901c 0x04008010 +wm 32 0x63fd901c 0x00008020 +wm 32 0x63fd901c 0x00008020 +wm 32 0x63fd901c 0x0a528030 +wm 32 0x63fd901c 0x03c68031 +wm 32 0x63fd901c 0x00448031 +wm 32 0x63fd901c 0x04008018 +wm 32 0x63fd901c 0x0000803a +wm 32 0x63fd901c 0x0000803b +wm 32 0x63fd901c 0x00008039 +wm 32 0x63fd901c 0x0b528138 +wm 32 0x63fd901c 0x04008018 +wm 32 0x63fd901c 0x00008028 +wm 32 0x63fd901c 0x00008028 +wm 32 0x63fd901c 0x0a528038 +wm 32 0x63fd901c 0x03c68039 +wm 32 0x63fd901c 0x00448039 +wm 32 0x63fd9020 0x00005800 +wm 32 0x63fd9058 0x00022225 +wm 32 0x63fd901c 0x00000000 +wm 32 0x63fd9040 0x04b80003 diff --git a/arch/arm/boards/ccxmx53/lowlevel.c b/arch/arm/boards/ccxmx53/lowlevel.c new file mode 100644 index 0000000000..b321811e95 --- /dev/null +++ b/arch/arm/boards/ccxmx53/lowlevel.c @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2013 Sascha Hauer <s.hauer@pengutronix.de> + * + * 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 <mach/esdctl.h> +#include <mach/generic.h> +#include <image-metadata.h> +#include <asm/barebox-arm-head.h> +#include <asm/barebox-arm.h> +#include <asm/sections.h> +#include <asm/cache.h> +#include <asm/mmu.h> + +BAREBOX_IMD_TAG_STRING(ccxmx53_memsize_SZ_512M, IMD_TYPE_PARAMETER, "memsize=512", 0); +BAREBOX_IMD_TAG_STRING(ccxmx53_memsize_SZ_1G, IMD_TYPE_PARAMETER, "memsize=1024", 0); + +static void __noreturn start_imx53_ccxmx53_common(uint32_t size, + void *fdt_blob_fixed_offset) +{ + void *fdt; + + imx5_cpu_lowlevel_init(); + arm_setup_stack(0xf8020000 - 8); + + fdt = fdt_blob_fixed_offset - get_runtime_offset(); + barebox_arm_entry(0x70000000, size, fdt); +} + +#define CCMX53_ENTRY(name, fdt_name, memory_size) \ + ENTRY_FUNCTION(name, r0, r1, r2) \ + { \ + extern char __dtb_##fdt_name##_start[]; \ + \ + IMD_USED(ccxmx53_memsize_##memory_size); \ + \ + start_imx53_ccxmx53_common(memory_size, \ + __dtb_##fdt_name##_start); \ + } + +CCMX53_ENTRY(start_ccxmx53_512mb, imx53_ccxmx53, SZ_512M); +CCMX53_ENTRY(start_ccxmx53_1gib, imx53_ccxmx53, SZ_1G); diff --git a/arch/arm/boards/freescale-mx6sx-sabresdb/board.c b/arch/arm/boards/freescale-mx6sx-sabresdb/board.c index 353b460a16..ca22eba393 100644 --- a/arch/arm/boards/freescale-mx6sx-sabresdb/board.c +++ b/arch/arm/boards/freescale-mx6sx-sabresdb/board.c @@ -241,9 +241,11 @@ static int imx6sx_sdb_coredevices_init(void) imx6sx_sdb_setup_fec(); + barebox_set_hostname("mx6sx-sabresdb"); + imx6_bbu_internal_mmc_register_handler("sd", "/dev/mmc3", BBU_HANDLER_FLAG_DEFAULT); return 0; } -console_initcall(imx6sx_sdb_coredevices_init); +coredevice_initcall(imx6sx_sdb_coredevices_init); |