Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  * arch/arm/mach-orion5x/rd88f6183-ap-ge-setup.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Marvell Orion-1-90 AP GE Reference Design Setup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * This file is licensed under the terms of the GNU General Public
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * License version 2.  This program is licensed "as is" without any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * warranty of any kind, whether express or implied.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/pci.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <linux/mtd/physmap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <linux/mv643xx_eth.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <linux/spi/spi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <linux/spi/flash.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include <linux/ethtool.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include <linux/platform_data/dsa.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #include <asm/mach-types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #include <asm/mach/arch.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #include <asm/mach/pci.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #include "common.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #include "orion5x.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) static struct mv643xx_eth_platform_data rd88f6183ap_ge_eth_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 	.phy_addr	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	.speed		= SPEED_1000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	.duplex		= DUPLEX_FULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) static struct dsa_chip_data rd88f6183ap_ge_switch_chip_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	.port_names[0]	= "lan1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	.port_names[1]	= "lan2",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	.port_names[2]	= "lan3",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	.port_names[3]	= "lan4",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	.port_names[4]	= "wan",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	.port_names[5]	= "cpu",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) static struct mtd_partition rd88f6183ap_ge_partitions[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 		.name	= "kernel",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 		.offset	= 0x00000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 		.size	= 0x00200000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	}, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 		.name	= "rootfs",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 		.offset	= 0x00200000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 		.size	= 0x00500000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	}, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 		.name	= "nvram",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 		.offset	= 0x00700000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 		.size	= 0x00080000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) static struct flash_platform_data rd88f6183ap_ge_spi_slave_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	.type		= "m25p64",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	.nr_parts	= ARRAY_SIZE(rd88f6183ap_ge_partitions),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	.parts		= rd88f6183ap_ge_partitions,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) static struct spi_board_info __initdata rd88f6183ap_ge_spi_slave_info[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 		.modalias	= "m25p80",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 		.platform_data	= &rd88f6183ap_ge_spi_slave_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 		.max_speed_hz	= 20000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 		.bus_num	= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 		.chip_select	= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) static void __init rd88f6183ap_ge_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	 * Setup basic Orion functions. Need to be called early.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	orion5x_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	 * Configure peripherals.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	orion5x_ehci0_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	orion5x_eth_init(&rd88f6183ap_ge_eth_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	orion5x_eth_switch_init(&rd88f6183ap_ge_switch_chip_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	spi_register_board_info(rd88f6183ap_ge_spi_slave_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 				ARRAY_SIZE(rd88f6183ap_ge_spi_slave_info));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	orion5x_spi_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	orion5x_uart0_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) static struct hw_pci rd88f6183ap_ge_pci __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	.nr_controllers	= 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	.setup		= orion5x_pci_sys_setup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	.scan		= orion5x_pci_sys_scan_bus,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	.map_irq	= orion5x_pci_map_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) static int __init rd88f6183ap_ge_pci_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	if (machine_is_rd88f6183ap_ge()) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 		orion5x_pci_disable();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 		pci_common_init(&rd88f6183ap_ge_pci);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) subsys_initcall(rd88f6183ap_ge_pci_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) MACHINE_START(RD88F6183AP_GE, "Marvell Orion-1-90 AP GE Reference Design")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	/* Maintainer: Lennert Buytenhek <buytenh@marvell.com> */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	.atag_offset	= 0x100,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	.nr_irqs	= ORION5X_NR_IRQS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	.init_machine	= rd88f6183ap_ge_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	.map_io		= orion5x_map_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	.init_early	= orion5x_init_early,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	.init_irq	= orion5x_init_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	.init_time	= orion5x_timer_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	.fixup		= tag_fixup_mem32,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	.restart	= orion5x_restart,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) MACHINE_END