aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-amd/0060-yocto-amd-i2c-dev-add-calls-to-enable-and-disable-IM.patch
blob: 3fa9c407b945677c353b96a43c7d297a2dbdbd47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From ae1353dc647641a2a9f2614eeb7f761e0c63586c Mon Sep 17 00:00:00 2001
From: Arindam Nath <arindam.nath@amd.com>
Date: Mon, 4 Aug 2014 19:21:44 +0530
Subject: [PATCH 60/60] yocto: amd: i2c-dev: add calls to enable and disable
 IMC from fetching BIOS code

The patch adds support to disable IMC from fetching BIOS code when
we first open the SMBus device. We can perform SMBus transaction
safely once IMC is disabled. Then when we close the device after
the operation, we enable IMC to start fetching from BIOS ROM again.

Upstream Status: None

Signed-off-by: Arindam Nath <arindam.nath@amd.com>
---
 drivers/i2c/i2c-dev.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
index c3ccdea..c92ec4c 100644
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -39,6 +39,7 @@
 #include <linux/i2c-dev.h>
 #include <linux/jiffies.h>
 #include <linux/uaccess.h>
+#include <linux/amd_imc.h>
 
 /*
  * An i2c_dev represents an i2c_adapter ... an I2C or SMBus master, not a
@@ -512,6 +513,8 @@ static int i2cdev_open(struct inode *inode, struct file *file)
 	client->adapter = adap;
 	file->private_data = client;
 
+	amd_imc_enter_scratch_ram();
+
 	return 0;
 }
 
@@ -523,6 +526,8 @@ static int i2cdev_release(struct inode *inode, struct file *file)
 	kfree(client);
 	file->private_data = NULL;
 
+	amd_imc_exit_scratch_ram();
+
 	return 0;
 }
 
-- 
1.9.1