1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter.git synced 2025-03-09 15:40:20 +00:00

Kernel 5.4 RUTX support

This commit is contained in:
Ycarus (Yannick Chabanois) 2023-08-14 17:47:02 +02:00
parent 839fcf1cab
commit cfce9f52b2
7376 changed files with 3902 additions and 546 deletions

View file

@ -0,0 +1,48 @@
#
# U-boot - Makefile
#
# Copyright (c) 2005-2008 Analog Device Inc.
#
# (C) Copyright 2000-2006
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
#
# 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 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
include $(TOPDIR)/config.mk
LIB = $(obj)lib$(BOARD).o
COBJS-y := $(BOARD).o gpio_cfi_flash.o
SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
OBJS := $(addprefix $(obj),$(COBJS-y))
SOBJS := $(addprefix $(obj),$(SOBJS-y))
$(LIB): $(obj).depend $(OBJS) $(SOBJS)
$(call cmd_link_o_target, $(OBJS) $(SOBJS))
#########################################################################
# defines $(obj).depend target
include $(SRCTREE)/rules.mk
sinclude $(obj).depend
#########################################################################

View file

@ -0,0 +1,60 @@
/*
* U-boot - main board file
*
* Copyright (c) 2005-2009 Analog Devices Inc.
*
* Licensed under the GPL-2 or later.
*/
#include <common.h>
#include <config.h>
#include <command.h>
#include <net.h>
#include <netdev.h>
#include <asm/blackfin.h>
#include <asm/net.h>
#include "gpio_cfi_flash.h"
DECLARE_GLOBAL_DATA_PTR;
int checkboard(void)
{
printf("Board: Bluetechnix CM-BF537E board\n");
printf(" Support: http://www.bluetechnix.at/\n");
return 0;
}
static void board_init_enetaddr(char *var)
{
uchar enetaddr[6];
if (eth_getenv_enetaddr(var, enetaddr))
return;
printf("Warning: %s: generating 'random' MAC address\n", var);
bfin_gen_rand_mac(enetaddr);
eth_setenv_enetaddr(var, enetaddr);
}
#ifndef CONFIG_BFIN_MAC
# define bfin_EMAC_initialize(x) 1
#endif
#ifndef CONFIG_SMC911X
# define smc911x_initialize(n, x) 1
#endif
int board_eth_init(bd_t *bis)
{
/* return ok if at least 1 eth device works */
return bfin_EMAC_initialize(bis) &
smc911x_initialize(0, CONFIG_SMC911X_BASE);
}
int misc_init_r(void)
{
board_init_enetaddr("ethaddr");
board_init_enetaddr("eth1addr");
gpio_cfi_flash_init();
return 0;
}

View file

@ -0,0 +1,31 @@
#
# Copyright (c) 2005-2008 Analog Device Inc.
#
# (C) Copyright 2001
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
#
# 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 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
CFLAGS_lib += -O2
CFLAGS_lib/lzma += -O2
CFLAGS_lib/zlib += -O2
# Set some default LDR flags based on boot mode.
LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8

View file

@ -0,0 +1,81 @@
/*
* gpio_cfi_flash.c - GPIO-assisted Flash Chip Support
*
* Copyright (c) 2009-2010 Analog Devices Inc.
*
* Licensed under the GPL-2 or later.
*/
#include <common.h>
#include <asm/blackfin.h>
#include <asm/gpio.h>
#include <asm/io.h>
#include "gpio_cfi_flash.h"
/* Allow this driver to be shared among boards */
#ifndef GPIO_PIN_1
#define GPIO_PIN_1 GPIO_PF4
#endif
#define GPIO_MASK_1 (1 << 21)
#ifndef GPIO_PIN_2
#define GPIO_MASK_2 (0)
#else
#define GPIO_MASK_2 (1 << 22)
#endif
#ifndef GPIO_PIN_3
#define GPIO_MASK_3 (0)
#else
#define GPIO_MASK_3 (1 << 23)
#endif
#define GPIO_MASK (GPIO_MASK_1 | GPIO_MASK_2 | GPIO_MASK_3)
void *gpio_cfi_flash_swizzle(void *vaddr)
{
unsigned long addr = (unsigned long)vaddr;
gpio_set_value(GPIO_PIN_1, addr & GPIO_MASK_1);
#ifdef GPIO_PIN_2
gpio_set_value(GPIO_PIN_2, addr & GPIO_MASK_2);
#endif
#ifdef GPIO_PIN_3
gpio_set_value(GPIO_PIN_3, addr & GPIO_MASK_3);
#endif
SSYNC();
udelay(1);
return (void *)(addr & ~GPIO_MASK);
}
#define __raw_writeq(value, addr) *(volatile u64 *)addr = value
#define __raw_readq(addr) *(volatile u64 *)addr
#define MAKE_FLASH(size, sfx) \
void flash_write##size(u##size value, void *addr) \
{ \
__raw_write##sfx(value, gpio_cfi_flash_swizzle(addr)); \
} \
u##size flash_read##size(void *addr) \
{ \
return __raw_read##sfx(gpio_cfi_flash_swizzle(addr)); \
}
MAKE_FLASH(8, b) /* flash_write8() flash_read8() */
MAKE_FLASH(16, w) /* flash_write16() flash_read16() */
MAKE_FLASH(32, l) /* flash_write32() flash_read32() */
MAKE_FLASH(64, q) /* flash_write64() flash_read64() */
void gpio_cfi_flash_init(void)
{
gpio_request(GPIO_PIN_1, "gpio_cfi_flash");
gpio_direction_output(GPIO_PIN_1, 0);
#ifdef GPIO_PIN_2
gpio_request(GPIO_PIN_2, "gpio_cfi_flash");
gpio_direction_output(GPIO_PIN_2, 0);
#endif
#ifdef GPIO_PIN_3
gpio_request(GPIO_PIN_3, "gpio_cfi_flash");
gpio_direction_output(GPIO_PIN_3, 0);
#endif
}

View file

@ -0,0 +1,10 @@
/*
* gpio_cfi_flash.c - GPIO-assisted Flash Chip Support
*
* Copyright (c) 2009 Analog Devices Inc.
*
* Licensed under the GPL-2 or later.
*/
void *gpio_cfi_flash_swizzle(void *vaddr);
void gpio_cfi_flash_init(void);