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-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) #include <linux/export.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) #include <linux/ide.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) static void ide_legacy_init_one(struct ide_hw **hws, struct ide_hw *hw,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) 				u8 port_no, const struct ide_port_info *d,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 				unsigned long config)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 	unsigned long base, ctl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 	int irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 	if (port_no == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 		base = 0x1f0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 		ctl  = 0x3f6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 		irq  = 14;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 		base = 0x170;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 		ctl  = 0x376;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 		irq  = 15;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	if (!request_region(base, 8, d->name)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 		printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 				d->name, base, base + 7);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	if (!request_region(ctl, 1, d->name)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 		printk(KERN_ERR "%s: I/O resource 0x%lX not free.\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 				d->name, ctl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 		release_region(base, 8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	ide_std_init_ports(hw, base, ctl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	hw->irq = irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	hw->config = config;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	hws[port_no] = hw;
^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) int ide_legacy_device_add(const struct ide_port_info *d, unsigned long config)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	struct ide_hw hw[2], *hws[] = { NULL, NULL };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	memset(&hw, 0, sizeof(hw));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 	if ((d->host_flags & IDE_HFLAG_QD_2ND_PORT) == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 		ide_legacy_init_one(hws, &hw[0], 0, d, config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 	ide_legacy_init_one(hws, &hw[1], 1, d, config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 	if (hws[0] == NULL && hws[1] == NULL &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 	    (d->host_flags & IDE_HFLAG_SINGLE))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 		return -ENOENT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 	return ide_host_add(d, hws, 2, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) EXPORT_SYMBOL_GPL(ide_legacy_device_add);