Thomas Gleixner | 1802d0b | 2019-05-27 08:55:21 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2015-2016 MediaTek Inc. |
| 4 | * Author: Yong Wu <yong.wu@mediatek.com> |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 5 | */ |
| 6 | #include <linux/clk.h> |
| 7 | #include <linux/component.h> |
| 8 | #include <linux/device.h> |
| 9 | #include <linux/err.h> |
| 10 | #include <linux/io.h> |
Yong Wu | 4f608d3 | 2017-08-21 19:00:21 +0800 | [diff] [blame] | 11 | #include <linux/module.h> |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 12 | #include <linux/of.h> |
| 13 | #include <linux/of_platform.h> |
| 14 | #include <linux/platform_device.h> |
| 15 | #include <linux/pm_runtime.h> |
| 16 | #include <soc/mediatek/smi.h> |
Honghui Zhang | 3c8f4ad | 2016-06-08 17:50:59 +0800 | [diff] [blame] | 17 | #include <dt-bindings/memory/mt2701-larb-port.h> |
Yong Wu | 66a2891 | 2021-01-11 19:18:49 +0800 | [diff] [blame] | 18 | #include <dt-bindings/memory/mtk-memory-port.h> |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 19 | |
Yong Wu | 534e0ad | 2021-09-14 19:36:55 +0800 | [diff] [blame] | 20 | /* SMI COMMON */ |
| 21 | #define SMI_BUS_SEL 0x220 |
| 22 | #define SMI_BUS_LARB_SHIFT(larbid) ((larbid) << 1) |
| 23 | /* All are MMU0 defaultly. Only specialize mmu1 here. */ |
| 24 | #define F_MMU1_LARB(larbid) (0x1 << SMI_BUS_LARB_SHIFT(larbid)) |
Yong Wu | e6dec92 | 2017-08-21 19:00:16 +0800 | [diff] [blame] | 25 | |
Yong Wu | 534e0ad | 2021-09-14 19:36:55 +0800 | [diff] [blame] | 26 | /* SMI LARB */ |
Fabien Parent | a8529f3 | 2020-09-06 20:09:38 +0200 | [diff] [blame] | 27 | |
Yong Wu | 534e0ad | 2021-09-14 19:36:55 +0800 | [diff] [blame] | 28 | /* Below are about mmu enable registers, they are different in SoCs */ |
| 29 | /* gen1: mt2701 */ |
Honghui Zhang | 3c8f4ad | 2016-06-08 17:50:59 +0800 | [diff] [blame] | 30 | #define REG_SMI_SECUR_CON_BASE 0x5c0 |
| 31 | |
| 32 | /* every register control 8 port, register offset 0x4 */ |
| 33 | #define REG_SMI_SECUR_CON_OFFSET(id) (((id) >> 3) << 2) |
| 34 | #define REG_SMI_SECUR_CON_ADDR(id) \ |
| 35 | (REG_SMI_SECUR_CON_BASE + REG_SMI_SECUR_CON_OFFSET(id)) |
| 36 | |
| 37 | /* |
| 38 | * every port have 4 bit to control, bit[port + 3] control virtual or physical, |
| 39 | * bit[port + 2 : port + 1] control the domain, bit[port] control the security |
| 40 | * or non-security. |
| 41 | */ |
| 42 | #define SMI_SECUR_CON_VAL_MSK(id) (~(0xf << (((id) & 0x7) << 2))) |
| 43 | #define SMI_SECUR_CON_VAL_VIRT(id) BIT((((id) & 0x7) << 2) + 3) |
| 44 | /* mt2701 domain should be set to 3 */ |
| 45 | #define SMI_SECUR_CON_VAL_DOMAIN(id) (0x3 << ((((id) & 0x7) << 2) + 1)) |
| 46 | |
Yong Wu | 534e0ad | 2021-09-14 19:36:55 +0800 | [diff] [blame] | 47 | /* gen2: */ |
| 48 | /* mt8167 */ |
| 49 | #define MT8167_SMI_LARB_MMU_EN 0xfc0 |
| 50 | |
| 51 | /* mt8173 */ |
| 52 | #define MT8173_SMI_LARB_MMU_EN 0xf00 |
| 53 | |
| 54 | /* general */ |
| 55 | #define SMI_LARB_NONSEC_CON(id) (0x380 + ((id) * 4)) |
| 56 | #define F_MMU_EN BIT(0) |
| 57 | #define BANK_SEL(id) ({ \ |
Yong Wu | 8d2c749 | 2021-01-11 19:19:11 +0800 | [diff] [blame] | 58 | u32 _id = (id) & 0x3; \ |
| 59 | (_id << 8 | _id << 10 | _id << 12 | _id << 14); \ |
| 60 | }) |
Yong Wu | e6dec92 | 2017-08-21 19:00:16 +0800 | [diff] [blame] | 61 | |
Yong Wu | a5c1898 | 2021-09-14 19:36:54 +0800 | [diff] [blame] | 62 | enum mtk_smi_type { |
Yong Wu | 42d42c7 | 2019-08-24 11:01:49 +0800 | [diff] [blame] | 63 | MTK_SMI_GEN1, |
Yong Wu | 4740475 | 2021-09-14 19:36:57 +0800 | [diff] [blame] | 64 | MTK_SMI_GEN2, /* gen2 smi common */ |
| 65 | MTK_SMI_GEN2_SUB_COMM, /* gen2 smi sub common */ |
Yong Wu | 42d42c7 | 2019-08-24 11:01:49 +0800 | [diff] [blame] | 66 | }; |
| 67 | |
Yong Wu | 0e14917 | 2021-09-14 19:36:53 +0800 | [diff] [blame] | 68 | #define MTK_SMI_CLK_NR_MAX 4 |
| 69 | |
| 70 | /* larbs: Require apb/smi clocks while gals is optional. */ |
| 71 | static const char * const mtk_smi_larb_clks[] = {"apb", "smi", "gals"}; |
| 72 | #define MTK_SMI_LARB_REQ_CLK_NR 2 |
| 73 | #define MTK_SMI_LARB_OPT_CLK_NR 1 |
| 74 | |
| 75 | /* |
| 76 | * common: Require these four clocks in has_gals case. Otherwise, only apb/smi are required. |
Yong Wu | 3e4f74e | 2021-09-14 19:36:58 +0800 | [diff] [blame] | 77 | * sub common: Require apb/smi/gals0 clocks in has_gals case. Otherwise, only apb/smi are required. |
Yong Wu | 0e14917 | 2021-09-14 19:36:53 +0800 | [diff] [blame] | 78 | */ |
| 79 | static const char * const mtk_smi_common_clks[] = {"apb", "smi", "gals0", "gals1"}; |
| 80 | #define MTK_SMI_COM_REQ_CLK_NR 2 |
| 81 | #define MTK_SMI_COM_GALS_REQ_CLK_NR MTK_SMI_CLK_NR_MAX |
Yong Wu | 3e4f74e | 2021-09-14 19:36:58 +0800 | [diff] [blame] | 82 | #define MTK_SMI_SUB_COM_GALS_REQ_CLK_NR 3 |
Yong Wu | 0e14917 | 2021-09-14 19:36:53 +0800 | [diff] [blame] | 83 | |
Yong Wu | 42d42c7 | 2019-08-24 11:01:49 +0800 | [diff] [blame] | 84 | struct mtk_smi_common_plat { |
Yong Wu | a5c1898 | 2021-09-14 19:36:54 +0800 | [diff] [blame] | 85 | enum mtk_smi_type type; |
| 86 | bool has_gals; |
| 87 | u32 bus_sel; /* Balance some larbs to enter mmu0 or mmu1 */ |
Yong Wu | 42d42c7 | 2019-08-24 11:01:49 +0800 | [diff] [blame] | 88 | }; |
| 89 | |
Honghui Zhang | 3c8f4ad | 2016-06-08 17:50:59 +0800 | [diff] [blame] | 90 | struct mtk_smi_larb_gen { |
| 91 | int port_in_larb[MTK_LARB_NR_MAX + 1]; |
Krzysztof Kozlowski | 3aa5a6c | 2020-07-24 09:40:28 +0200 | [diff] [blame] | 92 | void (*config_port)(struct device *dev); |
Yong Wu | 2e9b090 | 2019-08-24 11:01:48 +0800 | [diff] [blame] | 93 | unsigned int larb_direct_to_common_mask; |
Honghui Zhang | 3c8f4ad | 2016-06-08 17:50:59 +0800 | [diff] [blame] | 94 | }; |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 95 | |
| 96 | struct mtk_smi { |
Honghui Zhang | 3c8f4ad | 2016-06-08 17:50:59 +0800 | [diff] [blame] | 97 | struct device *dev; |
Yong Wu | 0e14917 | 2021-09-14 19:36:53 +0800 | [diff] [blame] | 98 | unsigned int clk_num; |
| 99 | struct clk_bulk_data clks[MTK_SMI_CLK_NR_MAX]; |
Honghui Zhang | 3c8f4ad | 2016-06-08 17:50:59 +0800 | [diff] [blame] | 100 | struct clk *clk_async; /*only needed by mt2701*/ |
Yong Wu | 567e58c | 2019-08-24 11:02:05 +0800 | [diff] [blame] | 101 | union { |
| 102 | void __iomem *smi_ao_base; /* only for gen1 */ |
| 103 | void __iomem *base; /* only for gen2 */ |
| 104 | }; |
Yong Wu | 4740475 | 2021-09-14 19:36:57 +0800 | [diff] [blame] | 105 | struct device *smi_common_dev; /* for sub common */ |
Yong Wu | 42d42c7 | 2019-08-24 11:01:49 +0800 | [diff] [blame] | 106 | const struct mtk_smi_common_plat *plat; |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 107 | }; |
| 108 | |
| 109 | struct mtk_smi_larb { /* larb: local arbiter */ |
Honghui Zhang | 3c8f4ad | 2016-06-08 17:50:59 +0800 | [diff] [blame] | 110 | struct mtk_smi smi; |
| 111 | void __iomem *base; |
Yong Wu | 4740475 | 2021-09-14 19:36:57 +0800 | [diff] [blame] | 112 | struct device *smi_common_dev; /* common or sub-common dev */ |
Honghui Zhang | 3c8f4ad | 2016-06-08 17:50:59 +0800 | [diff] [blame] | 113 | const struct mtk_smi_larb_gen *larb_gen; |
| 114 | int larbid; |
| 115 | u32 *mmu; |
Yong Wu | 8d2c749 | 2021-01-11 19:19:11 +0800 | [diff] [blame] | 116 | unsigned char *bank; |
Honghui Zhang | 3c8f4ad | 2016-06-08 17:50:59 +0800 | [diff] [blame] | 117 | }; |
| 118 | |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 119 | int mtk_smi_larb_get(struct device *larbdev) |
| 120 | { |
Zhang Qilong | a2d522f | 2020-11-23 18:21:18 +0800 | [diff] [blame] | 121 | int ret = pm_runtime_resume_and_get(larbdev); |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 122 | |
Yong Wu | 4f0a1a1 | 2019-08-24 11:02:04 +0800 | [diff] [blame] | 123 | return (ret < 0) ? ret : 0; |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 124 | } |
Philipp Zabel | cb1b5df | 2016-04-27 10:48:00 +0200 | [diff] [blame] | 125 | EXPORT_SYMBOL_GPL(mtk_smi_larb_get); |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 126 | |
| 127 | void mtk_smi_larb_put(struct device *larbdev) |
| 128 | { |
Yong Wu | 4f0a1a1 | 2019-08-24 11:02:04 +0800 | [diff] [blame] | 129 | pm_runtime_put_sync(larbdev); |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 130 | } |
Philipp Zabel | cb1b5df | 2016-04-27 10:48:00 +0200 | [diff] [blame] | 131 | EXPORT_SYMBOL_GPL(mtk_smi_larb_put); |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 132 | |
| 133 | static int |
| 134 | mtk_smi_larb_bind(struct device *dev, struct device *master, void *data) |
| 135 | { |
| 136 | struct mtk_smi_larb *larb = dev_get_drvdata(dev); |
Yong Wu | 1ee9feb | 2019-08-24 11:02:08 +0800 | [diff] [blame] | 137 | struct mtk_smi_larb_iommu *larb_mmu = data; |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 138 | unsigned int i; |
| 139 | |
Yong Wu | ec2da07 | 2019-08-24 11:02:07 +0800 | [diff] [blame] | 140 | for (i = 0; i < MTK_LARB_NR_MAX; i++) { |
Yong Wu | 1ee9feb | 2019-08-24 11:02:08 +0800 | [diff] [blame] | 141 | if (dev == larb_mmu[i].dev) { |
Yong Wu | ec2da07 | 2019-08-24 11:02:07 +0800 | [diff] [blame] | 142 | larb->larbid = i; |
Yong Wu | 1ee9feb | 2019-08-24 11:02:08 +0800 | [diff] [blame] | 143 | larb->mmu = &larb_mmu[i].mmu; |
Yong Wu | 8d2c749 | 2021-01-11 19:19:11 +0800 | [diff] [blame] | 144 | larb->bank = larb_mmu[i].bank; |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 145 | return 0; |
| 146 | } |
| 147 | } |
| 148 | return -ENODEV; |
| 149 | } |
| 150 | |
Yong Wu | 534e0ad | 2021-09-14 19:36:55 +0800 | [diff] [blame] | 151 | static void |
| 152 | mtk_smi_larb_unbind(struct device *dev, struct device *master, void *data) |
Yong Wu | e6dec92 | 2017-08-21 19:00:16 +0800 | [diff] [blame] | 153 | { |
Yong Wu | 534e0ad | 2021-09-14 19:36:55 +0800 | [diff] [blame] | 154 | /* Do nothing as the iommu is always enabled. */ |
Yong Wu | e6dec92 | 2017-08-21 19:00:16 +0800 | [diff] [blame] | 155 | } |
| 156 | |
Yong Wu | 534e0ad | 2021-09-14 19:36:55 +0800 | [diff] [blame] | 157 | static const struct component_ops mtk_smi_larb_component_ops = { |
| 158 | .bind = mtk_smi_larb_bind, |
| 159 | .unbind = mtk_smi_larb_unbind, |
| 160 | }; |
Fabien Parent | a8529f3 | 2020-09-06 20:09:38 +0200 | [diff] [blame] | 161 | |
Honghui Zhang | 3c8f4ad | 2016-06-08 17:50:59 +0800 | [diff] [blame] | 162 | static void mtk_smi_larb_config_port_gen1(struct device *dev) |
| 163 | { |
| 164 | struct mtk_smi_larb *larb = dev_get_drvdata(dev); |
| 165 | const struct mtk_smi_larb_gen *larb_gen = larb->larb_gen; |
| 166 | struct mtk_smi *common = dev_get_drvdata(larb->smi_common_dev); |
| 167 | int i, m4u_port_id, larb_port_num; |
| 168 | u32 sec_con_val, reg_val; |
| 169 | |
| 170 | m4u_port_id = larb_gen->port_in_larb[larb->larbid]; |
| 171 | larb_port_num = larb_gen->port_in_larb[larb->larbid + 1] |
| 172 | - larb_gen->port_in_larb[larb->larbid]; |
| 173 | |
| 174 | for (i = 0; i < larb_port_num; i++, m4u_port_id++) { |
| 175 | if (*larb->mmu & BIT(i)) { |
| 176 | /* bit[port + 3] controls the virtual or physical */ |
| 177 | sec_con_val = SMI_SECUR_CON_VAL_VIRT(m4u_port_id); |
| 178 | } else { |
| 179 | /* do not need to enable m4u for this port */ |
| 180 | continue; |
| 181 | } |
| 182 | reg_val = readl(common->smi_ao_base |
| 183 | + REG_SMI_SECUR_CON_ADDR(m4u_port_id)); |
| 184 | reg_val &= SMI_SECUR_CON_VAL_MSK(m4u_port_id); |
| 185 | reg_val |= sec_con_val; |
| 186 | reg_val |= SMI_SECUR_CON_VAL_DOMAIN(m4u_port_id); |
| 187 | writel(reg_val, |
| 188 | common->smi_ao_base |
| 189 | + REG_SMI_SECUR_CON_ADDR(m4u_port_id)); |
| 190 | } |
| 191 | } |
| 192 | |
Yong Wu | 534e0ad | 2021-09-14 19:36:55 +0800 | [diff] [blame] | 193 | static void mtk_smi_larb_config_port_mt8167(struct device *dev) |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 194 | { |
Yong Wu | 534e0ad | 2021-09-14 19:36:55 +0800 | [diff] [blame] | 195 | struct mtk_smi_larb *larb = dev_get_drvdata(dev); |
| 196 | |
| 197 | writel(*larb->mmu, larb->base + MT8167_SMI_LARB_MMU_EN); |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 198 | } |
| 199 | |
Yong Wu | 534e0ad | 2021-09-14 19:36:55 +0800 | [diff] [blame] | 200 | static void mtk_smi_larb_config_port_mt8173(struct device *dev) |
| 201 | { |
| 202 | struct mtk_smi_larb *larb = dev_get_drvdata(dev); |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 203 | |
Yong Wu | 534e0ad | 2021-09-14 19:36:55 +0800 | [diff] [blame] | 204 | writel(*larb->mmu, larb->base + MT8173_SMI_LARB_MMU_EN); |
| 205 | } |
Honghui Zhang | 3c8f4ad | 2016-06-08 17:50:59 +0800 | [diff] [blame] | 206 | |
Yong Wu | 534e0ad | 2021-09-14 19:36:55 +0800 | [diff] [blame] | 207 | static void mtk_smi_larb_config_port_gen2_general(struct device *dev) |
| 208 | { |
| 209 | struct mtk_smi_larb *larb = dev_get_drvdata(dev); |
| 210 | u32 reg; |
| 211 | int i; |
| 212 | |
| 213 | if (BIT(larb->larbid) & larb->larb_gen->larb_direct_to_common_mask) |
| 214 | return; |
| 215 | |
| 216 | for_each_set_bit(i, (unsigned long *)larb->mmu, 32) { |
| 217 | reg = readl_relaxed(larb->base + SMI_LARB_NONSEC_CON(i)); |
| 218 | reg |= F_MMU_EN; |
| 219 | reg |= BANK_SEL(larb->bank[i]); |
| 220 | writel(reg, larb->base + SMI_LARB_NONSEC_CON(i)); |
| 221 | } |
| 222 | } |
Fabien Parent | a8529f3 | 2020-09-06 20:09:38 +0200 | [diff] [blame] | 223 | |
Honghui Zhang | 3c8f4ad | 2016-06-08 17:50:59 +0800 | [diff] [blame] | 224 | static const struct mtk_smi_larb_gen mtk_smi_larb_mt2701 = { |
| 225 | .port_in_larb = { |
| 226 | LARB0_PORT_OFFSET, LARB1_PORT_OFFSET, |
| 227 | LARB2_PORT_OFFSET, LARB3_PORT_OFFSET |
| 228 | }, |
| 229 | .config_port = mtk_smi_larb_config_port_gen1, |
| 230 | }; |
| 231 | |
Yong Wu | e6dec92 | 2017-08-21 19:00:16 +0800 | [diff] [blame] | 232 | static const struct mtk_smi_larb_gen mtk_smi_larb_mt2712 = { |
Yong Wu | 2e9b090 | 2019-08-24 11:01:48 +0800 | [diff] [blame] | 233 | .config_port = mtk_smi_larb_config_port_gen2_general, |
| 234 | .larb_direct_to_common_mask = BIT(8) | BIT(9), /* bdpsys */ |
Yong Wu | e6dec92 | 2017-08-21 19:00:16 +0800 | [diff] [blame] | 235 | }; |
| 236 | |
Ming-Fan Chen | fc492f3 | 2020-01-08 14:41:30 +0800 | [diff] [blame] | 237 | static const struct mtk_smi_larb_gen mtk_smi_larb_mt6779 = { |
| 238 | .config_port = mtk_smi_larb_config_port_gen2_general, |
| 239 | .larb_direct_to_common_mask = |
| 240 | BIT(4) | BIT(6) | BIT(11) | BIT(12) | BIT(13), |
| 241 | /* DUMMY | IPU0 | IPU1 | CCU | MDLA */ |
| 242 | }; |
| 243 | |
Yong Wu | 534e0ad | 2021-09-14 19:36:55 +0800 | [diff] [blame] | 244 | static const struct mtk_smi_larb_gen mtk_smi_larb_mt8167 = { |
| 245 | /* mt8167 do not need the port in larb */ |
| 246 | .config_port = mtk_smi_larb_config_port_mt8167, |
| 247 | }; |
| 248 | |
| 249 | static const struct mtk_smi_larb_gen mtk_smi_larb_mt8173 = { |
| 250 | /* mt8173 do not need the port in larb */ |
| 251 | .config_port = mtk_smi_larb_config_port_mt8173, |
| 252 | }; |
| 253 | |
Yong Wu | 907ba6a | 2019-08-24 11:02:02 +0800 | [diff] [blame] | 254 | static const struct mtk_smi_larb_gen mtk_smi_larb_mt8183 = { |
Yong Wu | 907ba6a | 2019-08-24 11:02:02 +0800 | [diff] [blame] | 255 | .config_port = mtk_smi_larb_config_port_gen2_general, |
| 256 | .larb_direct_to_common_mask = BIT(2) | BIT(3) | BIT(7), |
| 257 | /* IPU0 | IPU1 | CCU */ |
| 258 | }; |
| 259 | |
Yong Wu | 02c02dd | 2020-11-03 13:42:00 +0800 | [diff] [blame] | 260 | static const struct mtk_smi_larb_gen mtk_smi_larb_mt8192 = { |
| 261 | .config_port = mtk_smi_larb_config_port_gen2_general, |
| 262 | }; |
| 263 | |
Honghui Zhang | 3c8f4ad | 2016-06-08 17:50:59 +0800 | [diff] [blame] | 264 | static const struct of_device_id mtk_smi_larb_of_ids[] = { |
Yong Wu | 534e0ad | 2021-09-14 19:36:55 +0800 | [diff] [blame] | 265 | {.compatible = "mediatek,mt2701-smi-larb", .data = &mtk_smi_larb_mt2701}, |
| 266 | {.compatible = "mediatek,mt2712-smi-larb", .data = &mtk_smi_larb_mt2712}, |
| 267 | {.compatible = "mediatek,mt6779-smi-larb", .data = &mtk_smi_larb_mt6779}, |
| 268 | {.compatible = "mediatek,mt8167-smi-larb", .data = &mtk_smi_larb_mt8167}, |
| 269 | {.compatible = "mediatek,mt8173-smi-larb", .data = &mtk_smi_larb_mt8173}, |
| 270 | {.compatible = "mediatek,mt8183-smi-larb", .data = &mtk_smi_larb_mt8183}, |
| 271 | {.compatible = "mediatek,mt8192-smi-larb", .data = &mtk_smi_larb_mt8192}, |
Honghui Zhang | 3c8f4ad | 2016-06-08 17:50:59 +0800 | [diff] [blame] | 272 | {} |
| 273 | }; |
| 274 | |
Yong Wu | 4740475 | 2021-09-14 19:36:57 +0800 | [diff] [blame] | 275 | static int mtk_smi_device_link_common(struct device *dev, struct device **com_dev) |
| 276 | { |
| 277 | struct platform_device *smi_com_pdev; |
| 278 | struct device_node *smi_com_node; |
| 279 | struct device *smi_com_dev; |
| 280 | struct device_link *link; |
| 281 | |
| 282 | smi_com_node = of_parse_phandle(dev->of_node, "mediatek,smi", 0); |
| 283 | if (!smi_com_node) |
| 284 | return -EINVAL; |
| 285 | |
| 286 | smi_com_pdev = of_find_device_by_node(smi_com_node); |
| 287 | of_node_put(smi_com_node); |
| 288 | if (smi_com_pdev) { |
| 289 | /* smi common is the supplier, Make sure it is ready before */ |
| 290 | if (!platform_get_drvdata(smi_com_pdev)) |
| 291 | return -EPROBE_DEFER; |
| 292 | smi_com_dev = &smi_com_pdev->dev; |
| 293 | link = device_link_add(dev, smi_com_dev, |
| 294 | DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS); |
| 295 | if (!link) { |
| 296 | dev_err(dev, "Unable to link smi-common dev\n"); |
| 297 | return -ENODEV; |
| 298 | } |
| 299 | *com_dev = smi_com_dev; |
| 300 | } else { |
| 301 | dev_err(dev, "Failed to get the smi_common device\n"); |
| 302 | return -EINVAL; |
| 303 | } |
| 304 | return 0; |
| 305 | } |
| 306 | |
Yong Wu | 0e14917 | 2021-09-14 19:36:53 +0800 | [diff] [blame] | 307 | static int mtk_smi_dts_clk_init(struct device *dev, struct mtk_smi *smi, |
| 308 | const char * const clks[], |
| 309 | unsigned int clk_nr_required, |
| 310 | unsigned int clk_nr_optional) |
| 311 | { |
| 312 | int i, ret; |
| 313 | |
| 314 | for (i = 0; i < clk_nr_required; i++) |
| 315 | smi->clks[i].id = clks[i]; |
| 316 | ret = devm_clk_bulk_get(dev, clk_nr_required, smi->clks); |
| 317 | if (ret) |
| 318 | return ret; |
| 319 | |
| 320 | for (i = clk_nr_required; i < clk_nr_required + clk_nr_optional; i++) |
| 321 | smi->clks[i].id = clks[i]; |
| 322 | ret = devm_clk_bulk_get_optional(dev, clk_nr_optional, |
| 323 | smi->clks + clk_nr_required); |
| 324 | smi->clk_num = clk_nr_required + clk_nr_optional; |
| 325 | return ret; |
| 326 | } |
| 327 | |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 328 | static int mtk_smi_larb_probe(struct platform_device *pdev) |
| 329 | { |
| 330 | struct mtk_smi_larb *larb; |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 331 | struct device *dev = &pdev->dev; |
Yong Wu | 0e14917 | 2021-09-14 19:36:53 +0800 | [diff] [blame] | 332 | int ret; |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 333 | |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 334 | larb = devm_kzalloc(dev, sizeof(*larb), GFP_KERNEL); |
| 335 | if (!larb) |
| 336 | return -ENOMEM; |
| 337 | |
Honghui Zhang | 7548786 | 2017-08-04 09:32:25 +0800 | [diff] [blame] | 338 | larb->larb_gen = of_device_get_match_data(dev); |
Yong Wu | 912fea8 | 2021-09-14 19:36:59 +0800 | [diff] [blame^] | 339 | larb->base = devm_platform_ioremap_resource(pdev, 0); |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 340 | if (IS_ERR(larb->base)) |
| 341 | return PTR_ERR(larb->base); |
| 342 | |
Yong Wu | 0e14917 | 2021-09-14 19:36:53 +0800 | [diff] [blame] | 343 | ret = mtk_smi_dts_clk_init(dev, &larb->smi, mtk_smi_larb_clks, |
| 344 | MTK_SMI_LARB_REQ_CLK_NR, MTK_SMI_LARB_OPT_CLK_NR); |
| 345 | if (ret) |
| 346 | return ret; |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 347 | |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 348 | larb->smi.dev = dev; |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 349 | |
Yong Wu | 4740475 | 2021-09-14 19:36:57 +0800 | [diff] [blame] | 350 | ret = mtk_smi_device_link_common(dev, &larb->smi_common_dev); |
| 351 | if (ret < 0) |
| 352 | return ret; |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 353 | |
| 354 | pm_runtime_enable(dev); |
| 355 | platform_set_drvdata(pdev, larb); |
Yong Wu | 30b869e | 2021-09-14 19:36:56 +0800 | [diff] [blame] | 356 | ret = component_add(dev, &mtk_smi_larb_component_ops); |
| 357 | if (ret) |
| 358 | goto err_pm_disable; |
| 359 | return 0; |
| 360 | |
| 361 | err_pm_disable: |
| 362 | pm_runtime_disable(dev); |
| 363 | device_link_remove(dev, larb->smi_common_dev); |
| 364 | return ret; |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 365 | } |
| 366 | |
| 367 | static int mtk_smi_larb_remove(struct platform_device *pdev) |
| 368 | { |
Yong Wu | 6ce2c05 | 2021-04-10 17:11:16 +0800 | [diff] [blame] | 369 | struct mtk_smi_larb *larb = platform_get_drvdata(pdev); |
| 370 | |
| 371 | device_link_remove(&pdev->dev, larb->smi_common_dev); |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 372 | pm_runtime_disable(&pdev->dev); |
| 373 | component_del(&pdev->dev, &mtk_smi_larb_component_ops); |
| 374 | return 0; |
| 375 | } |
| 376 | |
Yong Wu | 4f0a1a1 | 2019-08-24 11:02:04 +0800 | [diff] [blame] | 377 | static int __maybe_unused mtk_smi_larb_resume(struct device *dev) |
| 378 | { |
| 379 | struct mtk_smi_larb *larb = dev_get_drvdata(dev); |
| 380 | const struct mtk_smi_larb_gen *larb_gen = larb->larb_gen; |
| 381 | int ret; |
| 382 | |
Yong Wu | 0e14917 | 2021-09-14 19:36:53 +0800 | [diff] [blame] | 383 | ret = clk_bulk_prepare_enable(larb->smi.clk_num, larb->smi.clks); |
| 384 | if (ret < 0) |
Yong Wu | 4f0a1a1 | 2019-08-24 11:02:04 +0800 | [diff] [blame] | 385 | return ret; |
Yong Wu | 4f0a1a1 | 2019-08-24 11:02:04 +0800 | [diff] [blame] | 386 | |
| 387 | /* Configure the basic setting for this larb */ |
| 388 | larb_gen->config_port(dev); |
| 389 | |
| 390 | return 0; |
| 391 | } |
| 392 | |
| 393 | static int __maybe_unused mtk_smi_larb_suspend(struct device *dev) |
| 394 | { |
| 395 | struct mtk_smi_larb *larb = dev_get_drvdata(dev); |
| 396 | |
Yong Wu | 0e14917 | 2021-09-14 19:36:53 +0800 | [diff] [blame] | 397 | clk_bulk_disable_unprepare(larb->smi.clk_num, larb->smi.clks); |
Yong Wu | 4f0a1a1 | 2019-08-24 11:02:04 +0800 | [diff] [blame] | 398 | return 0; |
| 399 | } |
| 400 | |
| 401 | static const struct dev_pm_ops smi_larb_pm_ops = { |
| 402 | SET_RUNTIME_PM_OPS(mtk_smi_larb_suspend, mtk_smi_larb_resume, NULL) |
Yong Wu | fb03082 | 2019-10-09 19:59:33 +0800 | [diff] [blame] | 403 | SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, |
| 404 | pm_runtime_force_resume) |
Yong Wu | 4f0a1a1 | 2019-08-24 11:02:04 +0800 | [diff] [blame] | 405 | }; |
| 406 | |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 407 | static struct platform_driver mtk_smi_larb_driver = { |
| 408 | .probe = mtk_smi_larb_probe, |
Honghui Zhang | 3c8f4ad | 2016-06-08 17:50:59 +0800 | [diff] [blame] | 409 | .remove = mtk_smi_larb_remove, |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 410 | .driver = { |
| 411 | .name = "mtk-smi-larb", |
| 412 | .of_match_table = mtk_smi_larb_of_ids, |
Yong Wu | 4f0a1a1 | 2019-08-24 11:02:04 +0800 | [diff] [blame] | 413 | .pm = &smi_larb_pm_ops, |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 414 | } |
| 415 | }; |
| 416 | |
Yong Wu | 42d42c7 | 2019-08-24 11:01:49 +0800 | [diff] [blame] | 417 | static const struct mtk_smi_common_plat mtk_smi_common_gen1 = { |
Yong Wu | a5c1898 | 2021-09-14 19:36:54 +0800 | [diff] [blame] | 418 | .type = MTK_SMI_GEN1, |
Yong Wu | 42d42c7 | 2019-08-24 11:01:49 +0800 | [diff] [blame] | 419 | }; |
| 420 | |
| 421 | static const struct mtk_smi_common_plat mtk_smi_common_gen2 = { |
Yong Wu | a5c1898 | 2021-09-14 19:36:54 +0800 | [diff] [blame] | 422 | .type = MTK_SMI_GEN2, |
Yong Wu | 42d42c7 | 2019-08-24 11:01:49 +0800 | [diff] [blame] | 423 | }; |
| 424 | |
Ming-Fan Chen | fc492f3 | 2020-01-08 14:41:30 +0800 | [diff] [blame] | 425 | static const struct mtk_smi_common_plat mtk_smi_common_mt6779 = { |
Yong Wu | a5c1898 | 2021-09-14 19:36:54 +0800 | [diff] [blame] | 426 | .type = MTK_SMI_GEN2, |
| 427 | .has_gals = true, |
| 428 | .bus_sel = F_MMU1_LARB(1) | F_MMU1_LARB(2) | F_MMU1_LARB(4) | |
| 429 | F_MMU1_LARB(5) | F_MMU1_LARB(6) | F_MMU1_LARB(7), |
Ming-Fan Chen | fc492f3 | 2020-01-08 14:41:30 +0800 | [diff] [blame] | 430 | }; |
| 431 | |
Yong Wu | 907ba6a | 2019-08-24 11:02:02 +0800 | [diff] [blame] | 432 | static const struct mtk_smi_common_plat mtk_smi_common_mt8183 = { |
Yong Wu | a5c1898 | 2021-09-14 19:36:54 +0800 | [diff] [blame] | 433 | .type = MTK_SMI_GEN2, |
Yong Wu | 907ba6a | 2019-08-24 11:02:02 +0800 | [diff] [blame] | 434 | .has_gals = true, |
Yong Wu | 567e58c | 2019-08-24 11:02:05 +0800 | [diff] [blame] | 435 | .bus_sel = F_MMU1_LARB(1) | F_MMU1_LARB(2) | F_MMU1_LARB(5) | |
| 436 | F_MMU1_LARB(7), |
Yong Wu | 907ba6a | 2019-08-24 11:02:02 +0800 | [diff] [blame] | 437 | }; |
| 438 | |
Yong Wu | 02c02dd | 2020-11-03 13:42:00 +0800 | [diff] [blame] | 439 | static const struct mtk_smi_common_plat mtk_smi_common_mt8192 = { |
Yong Wu | a5c1898 | 2021-09-14 19:36:54 +0800 | [diff] [blame] | 440 | .type = MTK_SMI_GEN2, |
Yong Wu | 02c02dd | 2020-11-03 13:42:00 +0800 | [diff] [blame] | 441 | .has_gals = true, |
| 442 | .bus_sel = F_MMU1_LARB(1) | F_MMU1_LARB(2) | F_MMU1_LARB(5) | |
| 443 | F_MMU1_LARB(6), |
| 444 | }; |
| 445 | |
Honghui Zhang | 3c8f4ad | 2016-06-08 17:50:59 +0800 | [diff] [blame] | 446 | static const struct of_device_id mtk_smi_common_of_ids[] = { |
Yong Wu | 534e0ad | 2021-09-14 19:36:55 +0800 | [diff] [blame] | 447 | {.compatible = "mediatek,mt2701-smi-common", .data = &mtk_smi_common_gen1}, |
| 448 | {.compatible = "mediatek,mt2712-smi-common", .data = &mtk_smi_common_gen2}, |
| 449 | {.compatible = "mediatek,mt6779-smi-common", .data = &mtk_smi_common_mt6779}, |
| 450 | {.compatible = "mediatek,mt8167-smi-common", .data = &mtk_smi_common_gen2}, |
| 451 | {.compatible = "mediatek,mt8173-smi-common", .data = &mtk_smi_common_gen2}, |
| 452 | {.compatible = "mediatek,mt8183-smi-common", .data = &mtk_smi_common_mt8183}, |
| 453 | {.compatible = "mediatek,mt8192-smi-common", .data = &mtk_smi_common_mt8192}, |
Honghui Zhang | 3c8f4ad | 2016-06-08 17:50:59 +0800 | [diff] [blame] | 454 | {} |
| 455 | }; |
| 456 | |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 457 | static int mtk_smi_common_probe(struct platform_device *pdev) |
| 458 | { |
| 459 | struct device *dev = &pdev->dev; |
| 460 | struct mtk_smi *common; |
Yong Wu | 0e14917 | 2021-09-14 19:36:53 +0800 | [diff] [blame] | 461 | int ret, clk_required = MTK_SMI_COM_REQ_CLK_NR; |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 462 | |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 463 | common = devm_kzalloc(dev, sizeof(*common), GFP_KERNEL); |
| 464 | if (!common) |
| 465 | return -ENOMEM; |
| 466 | common->dev = dev; |
Yong Wu | 42d42c7 | 2019-08-24 11:01:49 +0800 | [diff] [blame] | 467 | common->plat = of_device_get_match_data(dev); |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 468 | |
Yong Wu | 3e4f74e | 2021-09-14 19:36:58 +0800 | [diff] [blame] | 469 | if (common->plat->has_gals) { |
| 470 | if (common->plat->type == MTK_SMI_GEN2) |
| 471 | clk_required = MTK_SMI_COM_GALS_REQ_CLK_NR; |
| 472 | else if (common->plat->type == MTK_SMI_GEN2_SUB_COMM) |
| 473 | clk_required = MTK_SMI_SUB_COM_GALS_REQ_CLK_NR; |
| 474 | } |
Yong Wu | 0e14917 | 2021-09-14 19:36:53 +0800 | [diff] [blame] | 475 | ret = mtk_smi_dts_clk_init(dev, common, mtk_smi_common_clks, clk_required, 0); |
| 476 | if (ret) |
| 477 | return ret; |
Yong Wu | 64fea74 | 2019-08-24 11:02:01 +0800 | [diff] [blame] | 478 | |
Honghui Zhang | 3c8f4ad | 2016-06-08 17:50:59 +0800 | [diff] [blame] | 479 | /* |
| 480 | * for mtk smi gen 1, we need to get the ao(always on) base to config |
| 481 | * m4u port, and we need to enable the aync clock for transform the smi |
| 482 | * clock into emi clock domain, but for mtk smi gen2, there's no smi ao |
| 483 | * base. |
| 484 | */ |
Yong Wu | a5c1898 | 2021-09-14 19:36:54 +0800 | [diff] [blame] | 485 | if (common->plat->type == MTK_SMI_GEN1) { |
Yong Wu | 912fea8 | 2021-09-14 19:36:59 +0800 | [diff] [blame^] | 486 | common->smi_ao_base = devm_platform_ioremap_resource(pdev, 0); |
Honghui Zhang | 3c8f4ad | 2016-06-08 17:50:59 +0800 | [diff] [blame] | 487 | if (IS_ERR(common->smi_ao_base)) |
| 488 | return PTR_ERR(common->smi_ao_base); |
| 489 | |
| 490 | common->clk_async = devm_clk_get(dev, "async"); |
| 491 | if (IS_ERR(common->clk_async)) |
| 492 | return PTR_ERR(common->clk_async); |
| 493 | |
Arvind Yadav | 46cc815 | 2017-08-10 10:47:32 +0530 | [diff] [blame] | 494 | ret = clk_prepare_enable(common->clk_async); |
| 495 | if (ret) |
| 496 | return ret; |
Yong Wu | 567e58c | 2019-08-24 11:02:05 +0800 | [diff] [blame] | 497 | } else { |
Yong Wu | 912fea8 | 2021-09-14 19:36:59 +0800 | [diff] [blame^] | 498 | common->base = devm_platform_ioremap_resource(pdev, 0); |
Yong Wu | 567e58c | 2019-08-24 11:02:05 +0800 | [diff] [blame] | 499 | if (IS_ERR(common->base)) |
| 500 | return PTR_ERR(common->base); |
Honghui Zhang | 3c8f4ad | 2016-06-08 17:50:59 +0800 | [diff] [blame] | 501 | } |
Yong Wu | 4740475 | 2021-09-14 19:36:57 +0800 | [diff] [blame] | 502 | |
| 503 | /* link its smi-common if this is smi-sub-common */ |
| 504 | if (common->plat->type == MTK_SMI_GEN2_SUB_COMM) { |
| 505 | ret = mtk_smi_device_link_common(dev, &common->smi_common_dev); |
| 506 | if (ret < 0) |
| 507 | return ret; |
| 508 | } |
| 509 | |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 510 | pm_runtime_enable(dev); |
| 511 | platform_set_drvdata(pdev, common); |
| 512 | return 0; |
| 513 | } |
| 514 | |
| 515 | static int mtk_smi_common_remove(struct platform_device *pdev) |
| 516 | { |
Yong Wu | 4740475 | 2021-09-14 19:36:57 +0800 | [diff] [blame] | 517 | struct mtk_smi *common = dev_get_drvdata(&pdev->dev); |
| 518 | |
| 519 | if (common->plat->type == MTK_SMI_GEN2_SUB_COMM) |
| 520 | device_link_remove(&pdev->dev, common->smi_common_dev); |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 521 | pm_runtime_disable(&pdev->dev); |
| 522 | return 0; |
| 523 | } |
| 524 | |
Yong Wu | 4f0a1a1 | 2019-08-24 11:02:04 +0800 | [diff] [blame] | 525 | static int __maybe_unused mtk_smi_common_resume(struct device *dev) |
| 526 | { |
| 527 | struct mtk_smi *common = dev_get_drvdata(dev); |
Yong Wu | 567e58c | 2019-08-24 11:02:05 +0800 | [diff] [blame] | 528 | u32 bus_sel = common->plat->bus_sel; |
Yong Wu | 4f0a1a1 | 2019-08-24 11:02:04 +0800 | [diff] [blame] | 529 | int ret; |
| 530 | |
Yong Wu | 0e14917 | 2021-09-14 19:36:53 +0800 | [diff] [blame] | 531 | ret = clk_bulk_prepare_enable(common->clk_num, common->clks); |
| 532 | if (ret) |
Yong Wu | 4f0a1a1 | 2019-08-24 11:02:04 +0800 | [diff] [blame] | 533 | return ret; |
Yong Wu | 567e58c | 2019-08-24 11:02:05 +0800 | [diff] [blame] | 534 | |
Yong Wu | a5c1898 | 2021-09-14 19:36:54 +0800 | [diff] [blame] | 535 | if (common->plat->type == MTK_SMI_GEN2 && bus_sel) |
Yong Wu | 567e58c | 2019-08-24 11:02:05 +0800 | [diff] [blame] | 536 | writel(bus_sel, common->base + SMI_BUS_SEL); |
Yong Wu | 4f0a1a1 | 2019-08-24 11:02:04 +0800 | [diff] [blame] | 537 | return 0; |
| 538 | } |
| 539 | |
| 540 | static int __maybe_unused mtk_smi_common_suspend(struct device *dev) |
| 541 | { |
| 542 | struct mtk_smi *common = dev_get_drvdata(dev); |
| 543 | |
Yong Wu | 0e14917 | 2021-09-14 19:36:53 +0800 | [diff] [blame] | 544 | clk_bulk_disable_unprepare(common->clk_num, common->clks); |
Yong Wu | 4f0a1a1 | 2019-08-24 11:02:04 +0800 | [diff] [blame] | 545 | return 0; |
| 546 | } |
| 547 | |
| 548 | static const struct dev_pm_ops smi_common_pm_ops = { |
| 549 | SET_RUNTIME_PM_OPS(mtk_smi_common_suspend, mtk_smi_common_resume, NULL) |
Yong Wu | fb03082 | 2019-10-09 19:59:33 +0800 | [diff] [blame] | 550 | SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, |
| 551 | pm_runtime_force_resume) |
Yong Wu | 4f0a1a1 | 2019-08-24 11:02:04 +0800 | [diff] [blame] | 552 | }; |
| 553 | |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 554 | static struct platform_driver mtk_smi_common_driver = { |
| 555 | .probe = mtk_smi_common_probe, |
| 556 | .remove = mtk_smi_common_remove, |
| 557 | .driver = { |
| 558 | .name = "mtk-smi-common", |
| 559 | .of_match_table = mtk_smi_common_of_ids, |
Yong Wu | 4f0a1a1 | 2019-08-24 11:02:04 +0800 | [diff] [blame] | 560 | .pm = &smi_common_pm_ops, |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 561 | } |
| 562 | }; |
| 563 | |
Yong Wu | 1821203 | 2021-01-21 14:24:27 +0800 | [diff] [blame] | 564 | static struct platform_driver * const smidrivers[] = { |
| 565 | &mtk_smi_common_driver, |
| 566 | &mtk_smi_larb_driver, |
| 567 | }; |
| 568 | |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 569 | static int __init mtk_smi_init(void) |
| 570 | { |
Yong Wu | 1821203 | 2021-01-21 14:24:27 +0800 | [diff] [blame] | 571 | return platform_register_drivers(smidrivers, ARRAY_SIZE(smidrivers)); |
Yong Wu | cc8bbe1 | 2016-02-23 01:20:49 +0800 | [diff] [blame] | 572 | } |
Yong Wu | 4f608d3 | 2017-08-21 19:00:21 +0800 | [diff] [blame] | 573 | module_init(mtk_smi_init); |
Yong Wu | 50fc8d9 | 2021-01-26 14:00:55 +0800 | [diff] [blame] | 574 | |
| 575 | static void __exit mtk_smi_exit(void) |
| 576 | { |
| 577 | platform_unregister_drivers(smidrivers, ARRAY_SIZE(smidrivers)); |
| 578 | } |
| 579 | module_exit(mtk_smi_exit); |
| 580 | |
| 581 | MODULE_DESCRIPTION("MediaTek SMI driver"); |
| 582 | MODULE_LICENSE("GPL v2"); |