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)  * Broadcom specific AMBA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * System on Chip (SoC) Host
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Licensed under the GNU/GPL. See COPYING for details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include "bcma_private.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include "scan.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/of_address.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/bcma/bcma.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/bcma/bcma_soc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) static u8 bcma_host_soc_read8(struct bcma_device *core, u16 offset)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 	return readb(core->io_addr + offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) static u16 bcma_host_soc_read16(struct bcma_device *core, u16 offset)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	return readw(core->io_addr + offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) static u32 bcma_host_soc_read32(struct bcma_device *core, u16 offset)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	return readl(core->io_addr + offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) static void bcma_host_soc_write8(struct bcma_device *core, u16 offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 				 u8 value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	writeb(value, core->io_addr + offset);
^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) static void bcma_host_soc_write16(struct bcma_device *core, u16 offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 				 u16 value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	writew(value, core->io_addr + offset);
^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 void bcma_host_soc_write32(struct bcma_device *core, u16 offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 				 u32 value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	writel(value, core->io_addr + offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) #ifdef CONFIG_BCMA_BLOCKIO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) static void bcma_host_soc_block_read(struct bcma_device *core, void *buffer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 				     size_t count, u16 offset, u8 reg_width)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	void __iomem *addr = core->io_addr + offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	switch (reg_width) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	case sizeof(u8): {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 		u8 *buf = buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 		while (count) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 			*buf = __raw_readb(addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 			buf++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 			count--;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	case sizeof(u16): {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 		__le16 *buf = buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 		WARN_ON(count & 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 		while (count) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 			*buf = (__force __le16)__raw_readw(addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 			buf++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 			count -= 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	case sizeof(u32): {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 		__le32 *buf = buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 		WARN_ON(count & 3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 		while (count) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 			*buf = (__force __le32)__raw_readl(addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 			buf++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 			count -= 4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 		WARN_ON(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) static void bcma_host_soc_block_write(struct bcma_device *core,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 				      const void *buffer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 				      size_t count, u16 offset, u8 reg_width)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	void __iomem *addr = core->io_addr + offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	switch (reg_width) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	case sizeof(u8): {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 		const u8 *buf = buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 		while (count) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 			__raw_writeb(*buf, addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 			buf++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 			count--;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	case sizeof(u16): {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 		const __le16 *buf = buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 		WARN_ON(count & 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 		while (count) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 			__raw_writew((__force u16)(*buf), addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 			buf++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 			count -= 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	case sizeof(u32): {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 		const __le32 *buf = buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 		WARN_ON(count & 3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 		while (count) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 			__raw_writel((__force u32)(*buf), addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 			buf++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 			count -= 4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 		WARN_ON(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) #endif /* CONFIG_BCMA_BLOCKIO */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) static u32 bcma_host_soc_aread32(struct bcma_device *core, u16 offset)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	if (WARN_ONCE(!core->io_wrap, "Accessed core has no wrapper/agent\n"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 		return ~0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	return readl(core->io_wrap + offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) static void bcma_host_soc_awrite32(struct bcma_device *core, u16 offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 				  u32 value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	if (WARN_ONCE(!core->io_wrap, "Accessed core has no wrapper/agent\n"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	writel(value, core->io_wrap + offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) static const struct bcma_host_ops bcma_host_soc_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	.read8		= bcma_host_soc_read8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	.read16		= bcma_host_soc_read16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	.read32		= bcma_host_soc_read32,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	.write8		= bcma_host_soc_write8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	.write16	= bcma_host_soc_write16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	.write32	= bcma_host_soc_write32,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) #ifdef CONFIG_BCMA_BLOCKIO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	.block_read	= bcma_host_soc_block_read,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	.block_write	= bcma_host_soc_block_write,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	.aread32	= bcma_host_soc_aread32,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	.awrite32	= bcma_host_soc_awrite32,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) int __init bcma_host_soc_register(struct bcma_soc *soc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	struct bcma_bus *bus = &soc->bus;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	/* iomap only first core. We have to read some register on this core
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	 * to scan the bus.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	bus->mmio = ioremap(BCMA_ADDR_BASE, BCMA_CORE_SIZE * 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	if (!bus->mmio)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	/* Host specific */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	bus->hosttype = BCMA_HOSTTYPE_SOC;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	bus->ops = &bcma_host_soc_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	/* Initialize struct, detect chip */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	bcma_init_bus(bus);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) int __init bcma_host_soc_init(struct bcma_soc *soc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	struct bcma_bus *bus = &soc->bus;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	/* Scan bus and initialize it */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	err = bcma_bus_early_register(bus);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	if (err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 		iounmap(bus->mmio);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) #ifdef CONFIG_OF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) static int bcma_host_soc_probe(struct platform_device *pdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	struct device *dev = &pdev->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	struct device_node *np = dev->of_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	struct bcma_bus *bus;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	/* Alloc */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	bus = devm_kzalloc(dev, sizeof(*bus), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	if (!bus)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	bus->dev = dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	/* Map MMIO */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	bus->mmio = of_iomap(np, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	if (!bus->mmio)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	/* Host specific */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	bus->hosttype = BCMA_HOSTTYPE_SOC;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	bus->ops = &bcma_host_soc_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	/* Initialize struct, detect chip */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	bcma_init_bus(bus);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	/* Register */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	err = bcma_bus_register(bus);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	if (err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 		goto err_unmap_mmio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	platform_set_drvdata(pdev, bus);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 	return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) err_unmap_mmio:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	iounmap(bus->mmio);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 	return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) static int bcma_host_soc_remove(struct platform_device *pdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 	struct bcma_bus *bus = platform_get_drvdata(pdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 	bcma_bus_unregister(bus);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 	iounmap(bus->mmio);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 	platform_set_drvdata(pdev, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) static const struct of_device_id bcma_host_soc_of_match[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 	{ .compatible = "brcm,bus-axi", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 	{},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) MODULE_DEVICE_TABLE(of, bcma_host_soc_of_match);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) static struct platform_driver bcma_host_soc_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	.driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 		.name = "bcma-host-soc",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 		.of_match_table = bcma_host_soc_of_match,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 	.probe		= bcma_host_soc_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 	.remove		= bcma_host_soc_remove,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) int __init bcma_host_soc_register_driver(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 	return platform_driver_register(&bcma_host_soc_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) void __exit bcma_host_soc_unregister_driver(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 	platform_driver_unregister(&bcma_host_soc_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) #endif /* CONFIG_OF */