sysmobts: add support for the sysmobts v2
This commit is contained in:
parent
3655aaa952
commit
045022f36e
|
@ -107,6 +107,7 @@ obj-$(CONFIG_MACH_SOCFPGA_EBV_SOCRATES) += ebv-socrates/
|
|||
obj-$(CONFIG_MACH_SOCFPGA_TERASIC_SOCKIT) += terasic-sockit/
|
||||
obj-$(CONFIG_MACH_SOLIDRUN_CUBOX) += solidrun-cubox/
|
||||
obj-$(CONFIG_MACH_SOLIDRUN_MICROSOM) += solidrun-microsom/
|
||||
obj-$(CONFIG_MACH_SYSMOBTS) += sysmobts/
|
||||
obj-$(CONFIG_MACH_TNY_A9260) += tny-a926x/
|
||||
obj-$(CONFIG_MACH_TNY_A9263) += tny-a926x/
|
||||
obj-$(CONFIG_MACH_TNY_A9G20) += tny-a926x/
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
obj-y += board.o
|
||||
lwl-y += lowlevel.o
|
||||
bbenv-y += defaultenv-sysmobts
|
|
@ -0,0 +1,167 @@
|
|||
/*
|
||||
* Copyright (C) 2015 Jan Luebbe <jluebbe@lasnet.de>
|
||||
*
|
||||
* This file is part of barebox.
|
||||
* See file CREDITS for list of people who contributed to this project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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 <io.h>
|
||||
#include <globalvar.h>
|
||||
#include <gpio.h>
|
||||
#include <envfs.h>
|
||||
#include <fs.h>
|
||||
#include <fcntl.h>
|
||||
#include <libfile.h>
|
||||
#include <net.h>
|
||||
|
||||
#include <linux/sizes.h>
|
||||
#include <asm/armlinux.h>
|
||||
|
||||
#define PINMUX0 0x01c40000
|
||||
#define PINMUX1 0x01c40004
|
||||
#define PINMUX1_I2C BIT(7)
|
||||
|
||||
#define VDD3P3V_PWDN (0x01c40048)
|
||||
|
||||
#include <net/davinci_emac.h>
|
||||
|
||||
#define EMAC_BASE_ADDR 0x01C80000
|
||||
#define EMAC_WRAPPER_BASE_ADDR 0x01C81000
|
||||
#define EMAC_WRAPPER_RAM_ADDR 0x01C82000
|
||||
#define EMAC_MDIO_BASE_ADDR 0x01C84000
|
||||
|
||||
static struct resource dm644x_emac_resources[] = {
|
||||
{
|
||||
.start = EMAC_BASE_ADDR,
|
||||
.end = EMAC_BASE_ADDR + 0xff,
|
||||
.flags = IORESOURCE_MEM,
|
||||
}, {
|
||||
.start = EMAC_WRAPPER_BASE_ADDR,
|
||||
.end = EMAC_WRAPPER_BASE_ADDR + 0xfff,
|
||||
.flags = IORESOURCE_MEM,
|
||||
}, {
|
||||
.start = EMAC_MDIO_BASE_ADDR,
|
||||
.end = EMAC_MDIO_BASE_ADDR + 0xff,
|
||||
.flags = IORESOURCE_MEM,
|
||||
}, {
|
||||
.start = EMAC_WRAPPER_RAM_ADDR,
|
||||
.end = EMAC_WRAPPER_RAM_ADDR + 0x1fff, /* 8kB */
|
||||
.flags = IORESOURCE_MEM,
|
||||
}
|
||||
};
|
||||
|
||||
static struct davinci_emac_platform_data dm644x_emac_pdata = {
|
||||
.force_link = false,
|
||||
.interface_rmii = false,
|
||||
.phy_addr = 1,
|
||||
};
|
||||
|
||||
static struct device_d dm644x_emac_device = {
|
||||
.id = DEVICE_ID_DYNAMIC,
|
||||
.name = "davinci_emac",
|
||||
.num_resources = ARRAY_SIZE(dm644x_emac_resources),
|
||||
.resource = dm644x_emac_resources,
|
||||
.platform_data = &dm644x_emac_pdata,
|
||||
};
|
||||
|
||||
static void sysmobts_board_detect(void)
|
||||
{
|
||||
int board_ver, board_cfg;
|
||||
char variant[4];
|
||||
|
||||
board_ver = gpio_get_value(15);
|
||||
board_ver |= gpio_get_value(16) << 1;
|
||||
board_ver |= gpio_get_value(17) << 1;
|
||||
|
||||
board_cfg = gpio_get_value(10);
|
||||
board_cfg |= gpio_get_value(11) << 1;
|
||||
board_cfg |= gpio_get_value(12) << 3;
|
||||
board_cfg |= gpio_get_value(13) << 4;
|
||||
board_cfg |= gpio_get_value(14) << 4;
|
||||
|
||||
variant[0] = 'A' + board_ver;
|
||||
variant[1] = '.';
|
||||
variant[2] = '0' + board_cfg;
|
||||
variant[3] = '\0';
|
||||
|
||||
globalvar_add_simple("board.variant", variant);
|
||||
|
||||
printf("detected 'sysmobts_v2 %s'\n", variant);
|
||||
}
|
||||
|
||||
static int sysmobts_set_ethaddr(void)
|
||||
{
|
||||
char addr[6];
|
||||
int fd, ret;
|
||||
|
||||
fd = open("/dev/eeprom0", O_RDONLY);
|
||||
if (fd < 0) {
|
||||
ret = fd;
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = read_full(fd, addr, 6);
|
||||
if (ret < 0)
|
||||
goto err_open;
|
||||
|
||||
eth_register_ethaddr(0, addr);
|
||||
|
||||
ret = 0;
|
||||
|
||||
err_open:
|
||||
close(fd);
|
||||
err:
|
||||
if (ret)
|
||||
pr_err("can't read eeprom /dev/eeprom0 (%s)\n", strerror(ret));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define MACH_TYPE_SYSMOBTS_V2 3758
|
||||
|
||||
static void sysmobts_devices_shutdown(void)
|
||||
{
|
||||
writel(readl(PINMUX1) | PINMUX1_I2C, PINMUX1);
|
||||
}
|
||||
|
||||
static int sysmobts_coredevices_init(void)
|
||||
{
|
||||
board_shutdown = sysmobts_devices_shutdown;
|
||||
|
||||
writel(0, VDD3P3V_PWDN);
|
||||
|
||||
writel(0x8000000f, PINMUX0);
|
||||
writel(0x00050187, PINMUX1);
|
||||
|
||||
writel(readl(PINMUX1) & ~PINMUX1_I2C, PINMUX1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
coredevice_initcall(sysmobts_coredevices_init);
|
||||
|
||||
static int sysmobts_devices_init(void)
|
||||
{
|
||||
sysmobts_board_detect();
|
||||
|
||||
sysmobts_set_ethaddr();
|
||||
platform_device_register(&dm644x_emac_device);
|
||||
|
||||
defaultenv_append_directory(defaultenv_sysmobts);
|
||||
|
||||
armlinux_set_architecture(MACH_TYPE_SYSMOBTS_V2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
device_initcall(sysmobts_devices_init);
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh
|
||||
|
||||
if test -e /dev/nand0.root.ubi; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ubiattach -d 0 /dev/nand0.root
|
||||
if [ $? != 0 ]; then
|
||||
echo "failed to run ubiattach"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
bootchooser -d -w 120
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
global bootm.image=/mnt/rescue/boot/zImage
|
||||
#global bootm.oftree=<path to oftree>
|
||||
#global bootm.initrd=<path to initrd>
|
||||
|
||||
global linux.bootargs.dyn.root="root=ubi0:rescue ubi.mtd=root rootfstype=ubifs ro rauc.slot=rescue"
|
||||
global linux.bootargs.dyn.mtd="mtdparts=davinci_nand.0:${nand0.partitions}"
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
global bootm.image=/mnt/tftp/linux/arch/arm/boot/zImage
|
||||
#global bootm.oftree=<path to oftree>
|
||||
#global bootm.initrd=<path to initrd>
|
||||
|
||||
global linux.bootargs.dyn.root="root=ubi0:rescue ubi.mtd=root rootfstype=ubifs ro rauc.slot=rescue"
|
||||
global linux.bootargs.dyn.mtd="mtdparts=davinci_nand.0:${nand0.partitions}"
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
global bootm.image=/mnt/system0/kernel
|
||||
if [ -e /mnt/system0/devicetree ]; then
|
||||
global bootm.oftree=/mnt/system0/devicetree
|
||||
fi
|
||||
global bootm.initrd=/mnt/system0/initramfs
|
||||
|
||||
global linux.bootargs.dyn.root="root=ubi0:system0 ubi.mtd=root rootfstype=ubifs ro rauc.slot=system0"
|
||||
global linux.bootargs.dyn.mtd="mtdparts=davinci_nand.0:${nand0.partitions}"
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
global bootm.image=/mnt/system1/kernel
|
||||
if [ -e /mnt/system1/devicetree ]; then
|
||||
global bootm.oftree=/mnt/system1/devicetree
|
||||
fi
|
||||
global bootm.initrd=/mnt/system1/initramfs
|
||||
|
||||
global linux.bootargs.dyn.root="root=ubi0:system1 ubi.mtd=root rootfstype=ubifs ro rauc.slot=system1"
|
||||
global linux.bootargs.dyn.mtd="mtdparts=davinci_nand.0:${nand0.partitions}"
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
mkdir /mnt/system0
|
||||
automount -d /mnt/system0 'prepare-ubi && mount /dev/nand0.root.ubi.system0 /mnt/system0'
|
||||
|
||||
mkdir /mnt/system1
|
||||
automount -d /mnt/system1 'prepare-ubi && mount /dev/nand0.root.ubi.system1 /mnt/system1'
|
||||
|
||||
mkdir /mnt/rescue
|
||||
automount -d /mnt/rescue 'prepare-ubi && mount /dev/nand0.root.ubi.rescue /mnt/rescue'
|
|
@ -0,0 +1 @@
|
|||
chooser factory
|
|
@ -0,0 +1 @@
|
|||
console=ttyS0,115200n8
|
|
@ -0,0 +1 @@
|
|||
quiet panic=30
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (C) 2015 Jan Luebbe <jluebbe@lasnet.de>
|
||||
*
|
||||
* This file is part of barebox.
|
||||
* See file CREDITS for list of people who contributed to this project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#define __LOWLEVEL_INIT__
|
||||
|
||||
#include <common.h>
|
||||
#include <asm/barebox-arm.h>
|
||||
#include <asm/barebox-arm-head.h>
|
||||
#include <init.h>
|
||||
#include <linux/sizes.h>
|
||||
|
||||
extern char __dtb_dm6442_sysmobts_start[];
|
||||
|
||||
void __naked __bare_init barebox_arm_reset_vector(void)
|
||||
{
|
||||
void *fdt;
|
||||
|
||||
arm_cpu_lowlevel_init();
|
||||
|
||||
fdt = __dtb_dm6442_sysmobts_start - get_runtime_offset();
|
||||
|
||||
barebox_arm_entry(0x80000000, SZ_256M, fdt);
|
||||
}
|
|
@ -46,6 +46,7 @@ pbl-dtb-$(CONFIG_MACH_SOCFPGA_EBV_SOCRATES) += socfpga_cyclone5_socrates.dtb.o
|
|||
pbl-dtb-$(CONFIG_MACH_SOCFPGA_TERASIC_SOCKIT) += socfpga_cyclone5_sockit.dtb.o
|
||||
pbl-dtb-$(CONFIG_MACH_SOLIDRUN_CUBOX) += dove-cubox-bb.dtb.o
|
||||
pbl-dtb-$(CONFIG_MACH_SOLIDRUN_MICROSOM) += imx6dl-hummingboard.dtb.o
|
||||
pbl-dtb-$(CONFIG_MACH_SYSMOBTS) += dm6442-sysmobts.dtb.o
|
||||
pbl-dtb-$(CONFIG_MACH_TORADEX_COLIBRI_T20) += tegra20-colibri-iris.dtb.o
|
||||
pbl-dtb-$(CONFIG_MACH_TOSHIBA_AC100) += tegra20-paz00.dtb.o
|
||||
pbl-dtb-$(CONFIG_MACH_TQMA53) += imx53-mba53.dtb.o
|
||||
|
|
|
@ -0,0 +1,178 @@
|
|||
/dts-v1/;
|
||||
|
||||
#include "dm644x.dtsi"
|
||||
|
||||
/ {
|
||||
model = "sysmobts";
|
||||
compatible = "sysmocom,sysmobts";
|
||||
|
||||
chosen {
|
||||
stdout-path = &serial0;
|
||||
environment@0 {
|
||||
compatible = "barebox,environment";
|
||||
device-path = &env;
|
||||
};
|
||||
};
|
||||
|
||||
memory {
|
||||
reg = <0x80000000 0x10000000>;
|
||||
};
|
||||
|
||||
soc {
|
||||
serial0: serial@1c20000 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
wdt: wdt@1c21000 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
gpio: gpio@1c67000 {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
nand@0x02000000 {
|
||||
status = "okay";
|
||||
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
env: partition@0 {
|
||||
label = "env";
|
||||
reg = <0x0 0x20000>;
|
||||
};
|
||||
|
||||
partition@1 {
|
||||
label = "ubl";
|
||||
reg = <0x20000 0xa0000>;
|
||||
};
|
||||
|
||||
partition@2 {
|
||||
label = "bootloader";
|
||||
reg = <0xc0000 0x340000>;
|
||||
};
|
||||
|
||||
partition@3 {
|
||||
label = "root";
|
||||
reg = <0x400000 0x0>;
|
||||
};
|
||||
};
|
||||
|
||||
i2c: i2c {
|
||||
compatible = "i2c-gpio";
|
||||
gpios = <
|
||||
&gpio 44 0 /* sda */
|
||||
&gpio 43 0 /* scl */
|
||||
>;
|
||||
i2c-gpio,sda-open-drain;
|
||||
i2c-gpio,scl-open-drain;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
status = "okay";
|
||||
|
||||
eeprom: eeprom@50 {
|
||||
compatible = "24c02";
|
||||
reg = <0x50>;
|
||||
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
partition@0 {
|
||||
label = "state";
|
||||
reg = <0x25 0x54>; /* _pad1 in struct sysmobts_eeprom */
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
status {
|
||||
gpios = <&gpio 29 0>;
|
||||
linux,default-trigger = "heartbeat";
|
||||
default-state = "off";
|
||||
};
|
||||
};
|
||||
|
||||
state: state {
|
||||
compatible = "barebox,state";
|
||||
magic = <0xaabe52dc>;
|
||||
backend-type = "raw";
|
||||
backend = &eeprom, "partname:state";
|
||||
|
||||
bootstate {
|
||||
system0 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
remaining_attempts {
|
||||
reg = <0x0 0x1>;
|
||||
type = "uint8";
|
||||
};
|
||||
priority {
|
||||
reg = <0x1 0x1>;
|
||||
type = "uint8";
|
||||
};
|
||||
ok {
|
||||
reg = <0x2 0x1>;
|
||||
type = "uint8";
|
||||
};
|
||||
};
|
||||
|
||||
system1 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
remaining_attempts {
|
||||
reg = <0x3 0x1>;
|
||||
type = "uint8";
|
||||
};
|
||||
priority {
|
||||
reg = <0x4 0x1>;
|
||||
type = "uint8";
|
||||
};
|
||||
ok {
|
||||
reg = <0x5 0x1>;
|
||||
type = "uint8";
|
||||
};
|
||||
};
|
||||
|
||||
rescue {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
remaining_attempts {
|
||||
reg = <0x6 0x1>;
|
||||
type = "uint8";
|
||||
};
|
||||
priority {
|
||||
reg = <0x7 0x1>;
|
||||
type = "uint8";
|
||||
};
|
||||
ok {
|
||||
reg = <0x8 0x1>;
|
||||
type = "uint8";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
bootstate: bootstate {
|
||||
compatible = "barebox,bootstate";
|
||||
backend-type = "state";
|
||||
backend = <&state>;
|
||||
|
||||
system0 {
|
||||
default_attempts = <3>;
|
||||
};
|
||||
|
||||
system1 {
|
||||
default_attempts = <3>;
|
||||
};
|
||||
|
||||
rescue {
|
||||
default_attempts = <3>;
|
||||
};
|
||||
};
|
||||
};
|
|
@ -0,0 +1,47 @@
|
|||
#include "skeleton.dtsi"
|
||||
|
||||
/ {
|
||||
soc {
|
||||
compatible = "simple-bus";
|
||||
model = "TI TMS320DM644x";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
ranges = <0x0 0x01c00000 0x400000>;
|
||||
|
||||
serial0: serial@1c20000 {
|
||||
compatible = "ns16550a";
|
||||
reg = <0x20000 0x400>;
|
||||
reg-shift = <2>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
wdt: wdt@1c21000 {
|
||||
compatible = "ti,davinci-wdt";
|
||||
reg = <0x21C00 0x1000>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
gpio: gpio@1c67000 {
|
||||
compatible = "ti,dm6441-gpio";
|
||||
gpio-controller;
|
||||
reg = <0x67000 0x800>;
|
||||
#gpio-cells = <2>;
|
||||
ti,ngpio = <71>;
|
||||
status = "disabled";
|
||||
};
|
||||
};
|
||||
|
||||
nand@0x02000000 {
|
||||
compatible = "ti,davinci-nand";
|
||||
reg = <0x02000000 0x2000000
|
||||
0x01E00000 0x1000>;
|
||||
ti,davinci-chipselect = <0>;
|
||||
ti,davinci-mask-ale = <0>;
|
||||
ti,davinci-mask-cle = <0>;
|
||||
ti,davinci-mask-chipsel = <0>;
|
||||
nand-ecc-mode = "hw";
|
||||
ti,davinci-ecc-bits = <1>;
|
||||
nand-on-flash-bbt;
|
||||
status = "disabled";
|
||||
};
|
||||
};
|
|
@ -10,6 +10,11 @@ config ARCH_DAVINCI_DM644x
|
|||
choice
|
||||
prompt "Davinci Board type"
|
||||
|
||||
config MACH_SYSMOBTS
|
||||
bool "Sysmobts"
|
||||
select ARCH_DAVINCI_DM644x
|
||||
select HAVE_DEFAULT_ENVIRONMENT_NEW
|
||||
|
||||
config MACH_VIRT2REAL
|
||||
bool "Virt2Real"
|
||||
select HAVE_DEFAULT_ENVIRONMENT_NEW
|
||||
|
|
Loading…
Reference in New Issue