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) // SPDX-License-Identifier: GPL-2.0+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) // Copyright (c) 2007 TinCanTools
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) //	David Anders <danders@amltd.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) // @History:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) // derived from linux/arch/arm/mach-s3c2410/mach-bast.c, written by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) // Ben Dooks <ben@simtec.co.uk>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/gpio/machine.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/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/list.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/timer.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <linux/device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <linux/serial_core.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include <linux/serial_s3c.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^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/map.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #include <asm/mach/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #include <asm/mach/flash.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #include <asm/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #include <asm/mach-types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #include <linux/platform_data/i2c-s3c2410.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #include "devs.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #include "cpu.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #include <linux/mtd/mtd.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #include <linux/mtd/partitions.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #include <linux/mtd/map.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #include <linux/mtd/physmap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #include "s3c24xx.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) static struct resource tct_hammer_nor_resource =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 			DEFINE_RES_MEM(0x00000000, SZ_16M);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) static struct mtd_partition tct_hammer_mtd_partitions[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 		.name		= "System",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 		.size		= 0x240000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 		.offset		= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 		.mask_flags 	= MTD_WRITEABLE,  /* force read-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	}, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 		.name		= "JFFS2",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 		.size		= MTDPART_SIZ_FULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 		.offset		= MTDPART_OFS_APPEND,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	}
^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) static struct physmap_flash_data tct_hammer_flash_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	.width		= 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	.parts		= tct_hammer_mtd_partitions,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	.nr_parts	= ARRAY_SIZE(tct_hammer_mtd_partitions),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) static struct platform_device tct_hammer_device_nor = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	.name		= "physmap-flash",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	.id		= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	.dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 			.platform_data = &tct_hammer_flash_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	.num_resources	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	.resource	= &tct_hammer_nor_resource,
^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) static struct map_desc tct_hammer_iodesc[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) #define UCON S3C2410_UCON_DEFAULT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) static struct s3c2410_uartcfg tct_hammer_uartcfgs[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	[0] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 		.hwport	     = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 		.flags	     = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 		.ucon	     = UCON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 		.ulcon	     = ULCON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 		.ufcon	     = UFCON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	[1] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 		.hwport	     = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 		.flags	     = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 		.ucon	     = UCON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 		.ulcon	     = ULCON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 		.ufcon	     = UFCON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	[2] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 		.hwport	     = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 		.flags	     = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 		.ucon	     = UCON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 		.ulcon	     = ULCON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 		.ufcon	     = UFCON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) static struct gpiod_lookup_table tct_hammer_mmc_gpio_table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	.dev_id = "s3c2410-sdi",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	.table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 		/* bus pins */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 		GPIO_LOOKUP_IDX("GPIOE",  5, "bus", 0, GPIO_ACTIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 		GPIO_LOOKUP_IDX("GPIOE",  6, "bus", 1, GPIO_ACTIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 		GPIO_LOOKUP_IDX("GPIOE",  7, "bus", 2, GPIO_ACTIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 		GPIO_LOOKUP_IDX("GPIOE",  8, "bus", 3, GPIO_ACTIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 		GPIO_LOOKUP_IDX("GPIOE",  9, "bus", 4, GPIO_ACTIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 		GPIO_LOOKUP_IDX("GPIOE", 10, "bus", 5, GPIO_ACTIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 		{ },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) static struct platform_device *tct_hammer_devices[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	&s3c_device_adc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	&s3c_device_wdt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	&s3c_device_i2c0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	&s3c_device_ohci,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	&s3c_device_rtc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	&s3c_device_usbgadget,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	&s3c_device_sdi,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	&tct_hammer_device_nor,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) static void __init tct_hammer_map_io(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	s3c24xx_init_io(tct_hammer_iodesc, ARRAY_SIZE(tct_hammer_iodesc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	s3c24xx_init_uarts(tct_hammer_uartcfgs, ARRAY_SIZE(tct_hammer_uartcfgs));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) static void __init tct_hammer_init_time(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	s3c2410_init_clocks(12000000);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	s3c24xx_timer_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) static void __init tct_hammer_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	s3c_i2c0_set_platdata(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	gpiod_add_lookup_table(&tct_hammer_mmc_gpio_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	platform_add_devices(tct_hammer_devices, ARRAY_SIZE(tct_hammer_devices));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) MACHINE_START(TCT_HAMMER, "TCT_HAMMER")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	.atag_offset	= 0x100,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	.map_io		= tct_hammer_map_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	.init_irq	= s3c2410_init_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	.init_machine	= tct_hammer_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	.init_time	= tct_hammer_init_time,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) MACHINE_END