arm: support for Cavium Celestial CNC1800L

This commit is contained in:
haru 2022-07-19 09:49:45 +09:00
parent 973ef09590
commit 8d740c808f
9 changed files with 222 additions and 0 deletions

1
.gitignore vendored
View File

@ -52,6 +52,7 @@
*.zst *.zst
Module.symvers Module.symvers
modules.order modules.order
uImage
# #
# Top-level generic files # Top-level generic files

View File

@ -432,6 +432,8 @@ source "arch/arm/mach-bcm/Kconfig"
source "arch/arm/mach-berlin/Kconfig" source "arch/arm/mach-berlin/Kconfig"
source "arch/arm/mach-celestial/Kconfig"
source "arch/arm/mach-clps711x/Kconfig" source "arch/arm/mach-clps711x/Kconfig"
source "arch/arm/mach-cns3xxx/Kconfig" source "arch/arm/mach-cns3xxx/Kconfig"

View File

@ -293,6 +293,14 @@ choice
If you have a Broadcom STB chip and would like early print If you have a Broadcom STB chip and would like early print
messages to appear over the UART, select this option. messages to appear over the UART, select this option.
config DEBUG_CELESTIAL_UART
bool "Kernel low-level debugging on CNC1800L"
depends on MACH_CELESTIAL
select DEBUG_UART_8250
help
Say Y here if you want kernel low-level debugging support
on Celestial platforms.
config DEBUG_CLPS711X_UART1 config DEBUG_CLPS711X_UART1
bool "Kernel low-level debugging messages via UART1" bool "Kernel low-level debugging messages via UART1"
depends on ARCH_CLPS711X depends on ARCH_CLPS711X
@ -1622,6 +1630,7 @@ config DEBUG_UART_8250
config DEBUG_UART_PHYS config DEBUG_UART_PHYS
hex "Physical base address of debug UART" hex "Physical base address of debug UART"
default 0x801f1000 if DEBUG_CELESTIAL_UART
default 0x01c20000 if DEBUG_DAVINCI_DMx_UART0 default 0x01c20000 if DEBUG_DAVINCI_DMx_UART0
default 0x01c28000 if DEBUG_SUNXI_UART0 default 0x01c28000 if DEBUG_SUNXI_UART0
default 0x01c28400 if DEBUG_SUNXI_UART1 default 0x01c28400 if DEBUG_SUNXI_UART1
@ -1764,6 +1773,7 @@ config DEBUG_UART_PHYS
config DEBUG_UART_VIRT config DEBUG_UART_VIRT
hex "Virtual base address of debug UART" hex "Virtual base address of debug UART"
default 0xfec00000 if DEBUG_CELESTIAL_UART
default 0xc881f000 if DEBUG_RV1108_UART2 default 0xc881f000 if DEBUG_RV1108_UART2
default 0xc8821000 if DEBUG_RV1108_UART1 default 0xc8821000 if DEBUG_RV1108_UART1
default 0xc8912000 if DEBUG_RV1108_UART0 default 0xc8912000 if DEBUG_RV1108_UART0

View File

@ -168,6 +168,7 @@ machine-$(CONFIG_ARCH_AT91) += at91
machine-$(CONFIG_ARCH_AXXIA) += axxia machine-$(CONFIG_ARCH_AXXIA) += axxia
machine-$(CONFIG_ARCH_BCM) += bcm machine-$(CONFIG_ARCH_BCM) += bcm
machine-$(CONFIG_ARCH_BERLIN) += berlin machine-$(CONFIG_ARCH_BERLIN) += berlin
machine-$(CONFIG_MACH_CELESTIAL) += celestial
machine-$(CONFIG_ARCH_CLPS711X) += clps711x machine-$(CONFIG_ARCH_CLPS711X) += clps711x
machine-$(CONFIG_ARCH_CNS3XXX) += cns3xxx machine-$(CONFIG_ARCH_CNS3XXX) += cns3xxx
machine-$(CONFIG_ARCH_DAVINCI) += davinci machine-$(CONFIG_ARCH_DAVINCI) += davinci

View File

@ -5,6 +5,8 @@ dtb-$(CONFIG_MACH_ARTPEC6) += \
artpec6-devboard.dtb artpec6-devboard.dtb
dtb-$(CONFIG_MACH_ASM9260) += \ dtb-$(CONFIG_MACH_ASM9260) += \
alphascale-asm9260-devkit.dtb alphascale-asm9260-devkit.dtb
dtb-$(CONFIG_MACH_CELESTIAL) += \
celestial-cnc1800l.dtb
# Keep at91 dtb files sorted alphabetically for each SoC # Keep at91 dtb files sorted alphabetically for each SoC
dtb-$(CONFIG_SOC_AT91RM9200) += \ dtb-$(CONFIG_SOC_AT91RM9200) += \
at91rm9200ek.dtb \ at91rm9200ek.dtb \

View File

@ -0,0 +1,118 @@
/dts-v1/;
/ {
#address-cells = <1>;
#size-cells = <1>;
interrupt-parent = <&vic>;
model = "Cavium Celestial CNC1800L";
compatible = "cavium,cnc1800l";
aliases {
serial0 = &uart0;
};
chosen {
stdout-path = "serial0:115200n8";
};
memory {
device_type = "memory";
reg = <0x00000000 0x088fffff>;
};
cpus {
#address-cells = <0>;
#size-cells = <0>;
cpu {
compatible = "arm,arm1176jzf";
device_type = "cpu";
};
};
clocks{
timclk: timclk{
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <94500000>;
};
pclk: pclk{
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <47250000>;
};
};
vic: interrupt-controller@10130000 {
compatible = "snps,dw-apb-ictl";
reg = <0x80140000 0x1000>;
interrupt-controller;
#interrupt-cells = <1>;
};
timer0: timer@801e2000 {
compatible = "snps,dw-apb-timer-cnc1800l";
reg = <0x801e2000 0x100>;
clocks = <&pclk>;
};
timer1: timer@80270000 {
compatible = "cavium,cnc1800l-timer";
reg = <0x80270000 0x100>;
clocks = <&timclk>;
interrupts = <4>;
};
watchdog0: wd@801e1000 {
compatible = "snps,dw-wdt", "cavium,cnc1800l-wdt";
reg = <0x801e1000 0x100>;
interrupts = <0>;
clocks = <&timclk>;
};
uart0: serial@801f1000 {
compatible = "snps,dw-apb-uart";
reg = <0x801f1000 0x100>;
reg-io-width = <1>;
clocks = <&pclk>;
interrupts = <12>;
reg-shift = <2>;
};
clock-controller@b2100000 {
compatible = "cavium,cnc1800l-clockctrl";
reg = <0xb2100000 0x1000>;
clocks = <&pclk>;
};
usb0: ohci@80210000 {
compatible = "cavium,cnc1800l-ohci", "usb-ohci";
reg = <0x80210000 0x1000>;
interrupts = <27>;
};
usb1: ehci@80210000 {
compatible = "cavium,cnc1800l-ehci", "usb-ehci";
reg = <0x80200000 0x1000>;
interrupts = <22>;
};
nand0: nand@a4000000 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "cavium,cnc1800l-nand";
reg = <0x80100000 0x48>, //SMC
<0xa4000000 0x2000000>; //NAND
};
gpio@80260000 {
compatible = "cavium,cnc1800l-gpio";
reg = <0x80260000 0x100>;
gpio-controller;
#gpio-cells = <2>;
// interrupts = <6>;
cavium,nrdevs = <14>;
};
};

View File

@ -0,0 +1,8 @@
config MACH_CELESTIAL
bool "Celestial CNC1800L"
depends on ARCH_MULTI_V6
select DW_APB_ICTL
select SERIAL_8250
select SERIAL_8250_CONSOLE
help
Support for Cavium CNC1800L Soc.

View File

@ -0,0 +1 @@
obj-$(CONFIG_MACH_CELESTIAL) := cnc1800l_machine.o

View File

@ -0,0 +1,79 @@
#include <linux/clocksource.h>
#include <linux/dma-mapping.h>
#include <linux/io.h>
#include <linux/irqchip.h>
#include <linux/irqchip/arm-gic.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/clk-provider.h>
#include <linux/regmap.h>
#include <linux/smp.h>
#include <asm/smp_scu.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/psci.h>
#include <linux/arm-smccc.h>
#define CNC1800L_VIRT_UART0 0xfec00000
#define CNC1800L_PHYS_UART0 0x801f1000
static struct map_desc cnc1800l_of_io_desc[] __initdata = {
#ifdef CONFIG_DEBUG_CELESTIAL_UART
{
.virtual = CNC1800L_VIRT_UART0,
.pfn = __phys_to_pfn(CNC1800L_PHYS_UART0),
.length = SZ_4K,
.type = MT_DEVICE,
},
#endif
};
static void __init cnc1800l_of_map_io(void)
{
iotable_init(cnc1800l_of_io_desc, ARRAY_SIZE(cnc1800l_of_io_desc));
}
static void __init cnc1800l_init_machine(void)
{
return;
}
//based on board_bcm281xx.c
static void cnc1800l_restart(enum reboot_mode mode, const char *cmd){
struct device_node *np_wdog;
unsigned short __iomem *p;
np_wdog = of_find_compatible_node(NULL, NULL, "cavium,cnc1800l-wdt");
if (!np_wdog) {
pr_emerg("Couldn't find cavium,cnc1800l-wdt\n");
return;
}
p = (unsigned short*)of_iomap(np_wdog, 0);
of_node_put(np_wdog);
if (!p) {
pr_emerg("failed to obtain wdt vaddress\n");
return;
}
/* WDT_TORR */
p[2] = 0x0;
p[3] = 0x0;
/* WDT_CCVR */
p[4] = 0x0;
p[5] = 0x0;
//reload
*((u32*)&p[6]) = 0x76;
/* WDT_CR, enable WDT and generated System Reset */
p[0] = 0x1;
while(1);
}
static const char * const cnc1800l_dt_match[] = {
"cavium,cnc1800l",
NULL
};
DT_MACHINE_START(CNC1800L, "Cavium Celestial CNC1800L")
.map_io = cnc1800l_of_map_io,
.init_machine = cnc1800l_init_machine,
.restart = cnc1800l_restart,
.dt_compat = cnc1800l_dt_match,
MACHINE_END