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-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * INET		An implementation of the TCP/IP protocol suite for the LINUX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *		operating system.  INET is implemented using the  BSD Socket
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *		interface as the means of communication with the user level.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *		Holds initial configuration information for devices.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * Version:	@(#)Space.c	1.0.7	08/12/93
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  * Authors:	Ross Biro
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  *		Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  *		Donald J. Becker, <becker@scyld.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  * Changelog:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  *		Stephen Hemminger (09/2003)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  *		- get rid of pre-linked dev list, dynamic device allocation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  *		Paul Gortmaker (03/2002)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  *		- struct init cleanup, enable multiple ISA autoprobes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  *		Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 09/1999
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  *		- fix sbni: s/device/net_device/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  *		Paul Gortmaker (06/98):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  *		 - sort probes in a sane way, make sure all (safe) probes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  *		   get run once & failed autoprobes don't autoprobe again.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #include <linux/netdevice.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #include <linux/etherdevice.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #include <linux/errno.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #include <linux/netlink.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #include <net/Space.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) /* A unified ethernet device probe.  This is the easiest way to have every
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)  * ethernet adaptor have the name "eth[0123...]".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) struct devprobe2 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	struct net_device *(*probe)(int unit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	int status;	/* non-zero if autoprobe has failed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) static int __init probe_list2(int unit, struct devprobe2 *p, int autoprobe)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	struct net_device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	for (; p->probe; p++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 		if (autoprobe && p->status)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 			continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 		dev = p->probe(unit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 		if (!IS_ERR(dev))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 			return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 		if (autoprobe)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 			p->status = PTR_ERR(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	return -ENODEV;
^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) /* ISA probes that touch addresses < 0x400 (including those that also
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59)  * look for EISA/PCI cards in addition to ISA cards).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) static struct devprobe2 isa_probes[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) #if defined(CONFIG_HP100) && defined(CONFIG_ISA)	/* ISA, EISA */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	{hp100_probe, 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) #ifdef CONFIG_3C515
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	{tc515_probe, 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) #ifdef CONFIG_ULTRA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	{ultra_probe, 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) #ifdef CONFIG_WD80x3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	{wd_probe, 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) #if defined(CONFIG_NE2000) /* ISA (use ne2k-pci for PCI cards) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	{ne_probe, 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) #ifdef CONFIG_LANCE		/* ISA/VLB (use pcnet32 for PCI cards) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	{lance_probe, 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) #ifdef CONFIG_SMC9194
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	{smc_init, 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) #ifdef CONFIG_CS89x0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) #ifndef CONFIG_CS89x0_PLATFORM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	{cs89x0_probe, 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) #if defined(CONFIG_MVME16x_NET) || defined(CONFIG_BVME6000_NET)	/* Intel */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	{i82596_probe, 0},					/* I82596 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) #ifdef CONFIG_NI65
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	{ni65_probe, 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	{NULL, 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) static struct devprobe2 m68k_probes[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) #ifdef CONFIG_ATARILANCE	/* Lance-based Atari ethernet boards */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	{atarilance_probe, 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) #ifdef CONFIG_SUN3LANCE         /* sun3 onboard Lance chip */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	{sun3lance_probe, 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) #ifdef CONFIG_SUN3_82586        /* sun3 onboard Intel 82586 chip */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	{sun3_82586_probe, 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) #ifdef CONFIG_APNE		/* A1200 PCMCIA NE2000 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	{apne_probe, 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) #ifdef CONFIG_MVME147_NET	/* MVME147 internal Ethernet */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	{mvme147lance_probe, 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	{NULL, 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) /* Unified ethernet device probe, segmented per architecture and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)  * per bus interface. This drives the legacy devices only for now.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) static void __init ethif_probe2(int unit)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	unsigned long base_addr = netdev_boot_base("eth", unit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	if (base_addr == 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	(void)(probe_list2(unit, m68k_probes, base_addr == 0) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 		probe_list2(unit, isa_probes, base_addr == 0));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) /*  Statically configured drivers -- order matters here. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) static int __init net_olddevs_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	int num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) #ifdef CONFIG_SBNI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	for (num = 0; num < 8; ++num)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 		sbni_probe(num);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	for (num = 0; num < 8; ++num)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 		ethif_probe2(num);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) #ifdef CONFIG_COPS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	cops_probe(0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	cops_probe(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	cops_probe(2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) #ifdef CONFIG_LTPC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	ltpc_probe();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) device_initcall(net_olddevs_init);