* [Patch 2/4] intel scu ipc
@ 2010-05-28 8:40 Ds, Sreedhara
2010-05-28 13:47 ` Matthew Garrett
0 siblings, 1 reply; 3+ messages in thread
From: Ds, Sreedhara @ 2010-05-28 8:40 UTC (permalink / raw)
To: platform-driver-x86@vger.kernel.org, mjg@redhat.com,
x86@kernel.org, Alan Cox
[-- Attachment #1: Type: text/plain, Size: 4394 bytes --]
Hello,
Please review and accept the patch
From cfe6eb1f2ea12732f03d4edee85c50ba713a9d36 Mon Sep 17 00:00:00 2001
From: Sreedhara DS <sreedhara.ds@intel.com>
Date: Fri, 28 May 2010 13:55:44 +0530
Subject: [PATCH] changes to work on both moorestown and medfield
new pci id added for medfiled
return type of ipc_data_readl chnaged from u8 u32
modified: intel_scu_ipc.c
Signed-off-by: Sreedhara DS <sreedhara.ds@intel.com>
---
drivers/platform/x86/intel_scu_ipc.c | 53 +++++++++++++++++++++-------------
1 files changed, 33 insertions(+), 20 deletions(-)
diff --git a/drivers/platform/x86/intel_scu_ipc.c b/drivers/platform/x86/intel_scu_ipc.c
index b2101ec..ffd304a 100644
--- a/drivers/platform/x86/intel_scu_ipc.c
+++ b/drivers/platform/x86/intel_scu_ipc.c
@@ -151,7 +151,7 @@ static inline u8 ipc_data_readb(u32 offset) /* Read ipc byte data */
return readb(ipcdev.ipc_base + IPC_READ_BUFFER + offset);
}
-static inline u8 ipc_data_readl(u32 offset) /* Read ipc u32 data */
+static inline u32 ipc_data_readl(u32 offset) /* Read ipc u32 data */
{
return readl(ipcdev.ipc_base + IPC_READ_BUFFER + offset);
}
@@ -181,18 +181,19 @@ static int pwr_reg_rdwr(u16 *addr, u8 *data, u32 count, u32 op, u32 id)
int nc;
u32 offset = 0;
u32 err = 0;
- u8 cbuf[IPC_WWBUF_SIZE] = { '\0' };
+ u8 cbuf[IPC_WWBUF_SIZE] = { };
u32 *wbuf = (u32 *)&cbuf;
mutex_lock(&ipclock);
+
if (ipcdev.pdev == NULL) {
mutex_unlock(&ipclock);
return -ENODEV;
}
- if (platform == 1) {
+ if (platform == PLATFORM_LANGWELL) {
/* Entry is 4 bytes for read/write, 5 bytes for read modify */
- for (nc = 0; nc < count; nc++) {
+ for (nc = 0; nc < count; nc++, offset += 3) {
cbuf[offset] = addr[nc];
cbuf[offset + 1] = addr[nc] >> 8;
if (id != IPC_CMD_PCNTRL_R)
@@ -201,33 +202,44 @@ static int pwr_reg_rdwr(u16 *addr, u8 *data, u32 count, u32 op, u32 id)
cbuf[offset + 3] = data[nc + 1];
offset += 1;
}
- offset += 3;
}
for (nc = 0, offset = 0; nc < count; nc++, offset += 4)
ipc_data_writel(wbuf[nc], offset); /* Write wbuff */
+ if (id != IPC_CMD_PCNTRL_M)
+ ipc_command((count*4) << 16 | id << 12 | 0 << 8 | op);
+ else
+ ipc_command((count*5) << 16 | id << 12 | 0 << 8 | op);
+
} else {
- for (nc = 0, offset = 0; nc < count; nc++, offset += 2)
- ipc_data_writel(addr[nc], offset); /* Write addresses */
- if (id != IPC_CMD_PCNTRL_R) {
- for (nc = 0; nc < count; nc++, offset++)
- ipc_data_writel(data[nc], offset); /* Write data */
- if (id == IPC_CMD_PCNTRL_M)
- ipc_data_writel(data[nc + 1], offset); /* Mask value*/
+ for (nc = 0; nc < count; nc++, offset += 2) {
+ cbuf[offset] = addr[nc];
+ cbuf[offset + 1] = addr[nc] >> 8;
}
- }
- if (id != IPC_CMD_PCNTRL_M)
- ipc_command((count * 3) << 16 | id << 12 | 0 << 8 | op);
- else
- ipc_command((count * 4) << 16 | id << 12 | 0 << 8 | op);
+ if (id == IPC_CMD_PCNTRL_R) {
+ for (nc = 0, offset = 0; nc < count; nc++, offset += 4)
+ ipc_data_writel(wbuf[nc], offset);
+ ipc_command((count*2) << 16 | id << 12 | 0 << 8 | op);
+ } else if (id == IPC_CMD_PCNTRL_W) {
+ for (nc = 0; nc < count; nc++, offset += 1)
+ cbuf[offset] = data[nc];
+ for (nc = 0, offset = 0; nc < count; nc++, offset += 4)
+ ipc_data_writel(wbuf[nc], offset);
+ ipc_command((count*3) << 16 | id << 12 | 0 << 8 | op);
+ } else if (id == IPC_CMD_PCNTRL_M) {
+ cbuf[offset] = data[0];
+ cbuf[offset + 1] = data[1];
+ ipc_data_writel(wbuf[0], 0); /* Write wbuff */
+ ipc_command(4 << 16 | id << 12 | 0 << 8 | op);
+ }
+ }
err = busy_loop();
-
if (id == IPC_CMD_PCNTRL_R) { /* Read rbuf */
/* Workaround: values are read as 0 without memcpy_fromio */
- memcpy_fromio(cbuf, ipcdev.ipc_base + IPC_READ_BUFFER, 16);
- if (platform == 1) {
+ memcpy_fromio(cbuf, ipcdev.ipc_base + 0x90, 16);
+ if (platform == PLATFORM_LANGWELL) {
for (nc = 0, offset = 2; nc < count; nc++, offset += 3)
data[nc] = ipc_data_readb(offset);
} else {
@@ -796,6 +808,7 @@ static void ipc_remove(struct pci_dev *pdev)
static const struct pci_device_id pci_ids[] = {
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x080e)},
+ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x082a)},
{ 0,}
};
MODULE_DEVICE_TABLE(pci, pci_ids);
--
1.5.4.5
[-- Attachment #2: 0002-changes-to-work-on-both-moorestown-and-medfield.patch --]
[-- Type: application/octet-stream, Size: 4222 bytes --]
From cfe6eb1f2ea12732f03d4edee85c50ba713a9d36 Mon Sep 17 00:00:00 2001
From: Sreedhara DS <sreedhara.ds@intel.com>
Date: Fri, 28 May 2010 13:55:44 +0530
Subject: [PATCH] changes to work on both moorestown and medfield
new pci id added for medfiled
return type of ipc_data_readl chnaged from u8 u32
modified: intel_scu_ipc.c
Signed-off-by: Sreedhara DS <sreedhara.ds@intel.com>
---
drivers/platform/x86/intel_scu_ipc.c | 53 +++++++++++++++++++++-------------
1 files changed, 33 insertions(+), 20 deletions(-)
diff --git a/drivers/platform/x86/intel_scu_ipc.c b/drivers/platform/x86/intel_scu_ipc.c
index b2101ec..ffd304a 100644
--- a/drivers/platform/x86/intel_scu_ipc.c
+++ b/drivers/platform/x86/intel_scu_ipc.c
@@ -151,7 +151,7 @@ static inline u8 ipc_data_readb(u32 offset) /* Read ipc byte data */
return readb(ipcdev.ipc_base + IPC_READ_BUFFER + offset);
}
-static inline u8 ipc_data_readl(u32 offset) /* Read ipc u32 data */
+static inline u32 ipc_data_readl(u32 offset) /* Read ipc u32 data */
{
return readl(ipcdev.ipc_base + IPC_READ_BUFFER + offset);
}
@@ -181,18 +181,19 @@ static int pwr_reg_rdwr(u16 *addr, u8 *data, u32 count, u32 op, u32 id)
int nc;
u32 offset = 0;
u32 err = 0;
- u8 cbuf[IPC_WWBUF_SIZE] = { '\0' };
+ u8 cbuf[IPC_WWBUF_SIZE] = { };
u32 *wbuf = (u32 *)&cbuf;
mutex_lock(&ipclock);
+
if (ipcdev.pdev == NULL) {
mutex_unlock(&ipclock);
return -ENODEV;
}
- if (platform == 1) {
+ if (platform == PLATFORM_LANGWELL) {
/* Entry is 4 bytes for read/write, 5 bytes for read modify */
- for (nc = 0; nc < count; nc++) {
+ for (nc = 0; nc < count; nc++, offset += 3) {
cbuf[offset] = addr[nc];
cbuf[offset + 1] = addr[nc] >> 8;
if (id != IPC_CMD_PCNTRL_R)
@@ -201,33 +202,44 @@ static int pwr_reg_rdwr(u16 *addr, u8 *data, u32 count, u32 op, u32 id)
cbuf[offset + 3] = data[nc + 1];
offset += 1;
}
- offset += 3;
}
for (nc = 0, offset = 0; nc < count; nc++, offset += 4)
ipc_data_writel(wbuf[nc], offset); /* Write wbuff */
+ if (id != IPC_CMD_PCNTRL_M)
+ ipc_command((count*4) << 16 | id << 12 | 0 << 8 | op);
+ else
+ ipc_command((count*5) << 16 | id << 12 | 0 << 8 | op);
+
} else {
- for (nc = 0, offset = 0; nc < count; nc++, offset += 2)
- ipc_data_writel(addr[nc], offset); /* Write addresses */
- if (id != IPC_CMD_PCNTRL_R) {
- for (nc = 0; nc < count; nc++, offset++)
- ipc_data_writel(data[nc], offset); /* Write data */
- if (id == IPC_CMD_PCNTRL_M)
- ipc_data_writel(data[nc + 1], offset); /* Mask value*/
+ for (nc = 0; nc < count; nc++, offset += 2) {
+ cbuf[offset] = addr[nc];
+ cbuf[offset + 1] = addr[nc] >> 8;
}
- }
- if (id != IPC_CMD_PCNTRL_M)
- ipc_command((count * 3) << 16 | id << 12 | 0 << 8 | op);
- else
- ipc_command((count * 4) << 16 | id << 12 | 0 << 8 | op);
+ if (id == IPC_CMD_PCNTRL_R) {
+ for (nc = 0, offset = 0; nc < count; nc++, offset += 4)
+ ipc_data_writel(wbuf[nc], offset);
+ ipc_command((count*2) << 16 | id << 12 | 0 << 8 | op);
+ } else if (id == IPC_CMD_PCNTRL_W) {
+ for (nc = 0; nc < count; nc++, offset += 1)
+ cbuf[offset] = data[nc];
+ for (nc = 0, offset = 0; nc < count; nc++, offset += 4)
+ ipc_data_writel(wbuf[nc], offset);
+ ipc_command((count*3) << 16 | id << 12 | 0 << 8 | op);
+ } else if (id == IPC_CMD_PCNTRL_M) {
+ cbuf[offset] = data[0];
+ cbuf[offset + 1] = data[1];
+ ipc_data_writel(wbuf[0], 0); /* Write wbuff */
+ ipc_command(4 << 16 | id << 12 | 0 << 8 | op);
+ }
+ }
err = busy_loop();
-
if (id == IPC_CMD_PCNTRL_R) { /* Read rbuf */
/* Workaround: values are read as 0 without memcpy_fromio */
- memcpy_fromio(cbuf, ipcdev.ipc_base + IPC_READ_BUFFER, 16);
- if (platform == 1) {
+ memcpy_fromio(cbuf, ipcdev.ipc_base + 0x90, 16);
+ if (platform == PLATFORM_LANGWELL) {
for (nc = 0, offset = 2; nc < count; nc++, offset += 3)
data[nc] = ipc_data_readb(offset);
} else {
@@ -796,6 +808,7 @@ static void ipc_remove(struct pci_dev *pdev)
static const struct pci_device_id pci_ids[] = {
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x080e)},
+ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x082a)},
{ 0,}
};
MODULE_DEVICE_TABLE(pci, pci_ids);
--
1.5.4.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Patch 2/4] intel scu ipc
2010-05-28 8:40 [Patch 2/4] intel scu ipc Ds, Sreedhara
@ 2010-05-28 13:47 ` Matthew Garrett
2010-05-30 17:19 ` [Patch 2/4] intel scu ipcAlan Cox Ds, Sreedhara
0 siblings, 1 reply; 3+ messages in thread
From: Matthew Garrett @ 2010-05-28 13:47 UTC (permalink / raw)
To: Ds, Sreedhara
Cc: platform-driver-x86@vger.kernel.org, x86@kernel.org, Alan Cox
On Fri, May 28, 2010 at 02:10:51PM +0530, Ds, Sreedhara wrote:
> From cfe6eb1f2ea12732f03d4edee85c50ba713a9d36 Mon Sep 17 00:00:00 2001
> From: Sreedhara DS <sreedhara.ds@intel.com>
> Date: Fri, 28 May 2010 13:55:44 +0530
> Subject: [PATCH] changes to work on both moorestown and medfield
> new pci id added for medfiled
> return type of ipc_data_readl chnaged from u8 u32
This sounds like a separate bugfix that should be in a different patch.
> - u8 cbuf[IPC_WWBUF_SIZE] = { '\0' };
> + u8 cbuf[IPC_WWBUF_SIZE] = { };
Why this change?
> - for (nc = 0; nc < count; nc++) {
> + for (nc = 0; nc < count; nc++, offset += 3) {
> cbuf[offset] = addr[nc];
> cbuf[offset + 1] = addr[nc] >> 8;
> if (id != IPC_CMD_PCNTRL_R)
> @@ -201,33 +202,44 @@ static int pwr_reg_rdwr(u16 *addr, u8 *data, u32 count, u32 op, u32 id)
> cbuf[offset + 3] = data[nc + 1];
> offset += 1;
> }
> - offset += 3;
Again, what does this have to do with the patch description?
> /* Workaround: values are read as 0 without memcpy_fromio */
> - memcpy_fromio(cbuf, ipcdev.ipc_base + IPC_READ_BUFFER, 16);
> - if (platform == 1) {
> + memcpy_fromio(cbuf, ipcdev.ipc_base + 0x90, 16);
> + if (platform == PLATFORM_LANGWELL) {
You've replaced one constant with a define, and replaced another define
with a constant. That seems a little odd.
--
Matthew Garrett | mjg59@srcf.ucam.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [Patch 2/4] intel scu ipcAlan Cox
2010-05-28 13:47 ` Matthew Garrett
@ 2010-05-30 17:19 ` Ds, Sreedhara
0 siblings, 0 replies; 3+ messages in thread
From: Ds, Sreedhara @ 2010-05-30 17:19 UTC (permalink / raw)
To: Matthew Garrett; +Cc: platform-driver-x86@vger.kernel.org, x86@kernel.org
Hello,
I am resending the patch with corrections.
With these corrections, patch[4/4] is also changed. I will resend all 4 patches once again
--Sreedhara
-----Original Message-----
From: Matthew Garrett [mailto:mjg59@srcf.ucam.org]
Sent: Friday, May 28, 2010 7:17 PM
To: Ds, Sreedhara
Cc: platform-driver-x86@vger.kernel.org; x86@kernel.org; Alan Cox
Subject: Re: [Patch 2/4] intel scu ipc
On Fri, May 28, 2010 at 02:10:51PM +0530, Ds, Sreedhara wrote:
> From cfe6eb1f2ea12732f03d4edee85c50ba713a9d36 Mon Sep 17 00:00:00 2001
> From: Sreedhara DS <sreedhara.ds@intel.com>
> Date: Fri, 28 May 2010 13:55:44 +0530
> Subject: [PATCH] changes to work on both moorestown and medfield
> new pci id added for medfiled
> return type of ipc_data_readl chnaged from u8 u32
This sounds like a separate bugfix that should be in a different patch.
> - u8 cbuf[IPC_WWBUF_SIZE] = { '\0' };
> + u8 cbuf[IPC_WWBUF_SIZE] = { };
Why this change?
> - for (nc = 0; nc < count; nc++) {
> + for (nc = 0; nc < count; nc++, offset += 3) {
> cbuf[offset] = addr[nc];
> cbuf[offset + 1] = addr[nc] >> 8;
> if (id != IPC_CMD_PCNTRL_R)
> @@ -201,33 +202,44 @@ static int pwr_reg_rdwr(u16 *addr, u8 *data, u32 count, u32 op, u32 id)
> cbuf[offset + 3] = data[nc + 1];
> offset += 1;
> }
> - offset += 3;
Again, what does this have to do with the patch description?
> /* Workaround: values are read as 0 without memcpy_fromio */
> - memcpy_fromio(cbuf, ipcdev.ipc_base + IPC_READ_BUFFER, 16);
> - if (platform == 1) {
> + memcpy_fromio(cbuf, ipcdev.ipc_base + 0x90, 16);
> + if (platform == PLATFORM_LANGWELL) {
You've replaced one constant with a define, and replaced another define
with a constant. That seems a little odd.
--
Matthew Garrett | mjg59@srcf.ucam.org
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-05-30 17:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-28 8:40 [Patch 2/4] intel scu ipc Ds, Sreedhara
2010-05-28 13:47 ` Matthew Garrett
2010-05-30 17:19 ` [Patch 2/4] intel scu ipcAlan Cox Ds, Sreedhara
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.