Luc Verhaegen has uploaded this change for review.

View Change

ati: add further spi initialization

Change-Id: I14fb218d001c1e12888225675bd8fdd46e7d8fae
Signed-off-by: Luc Verhaegen <libv@skynet.be>
---
M ati_spi.c
1 file changed, 33 insertions(+), 0 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/89/29089/1
diff --git a/ati_spi.c b/ati_spi.c
index ee5041d..7d1e909 100644
--- a/ati_spi.c
+++ b/ati_spi.c
@@ -44,11 +44,15 @@
#define R600_LOW_VID_LOWER_GPIO_CNTL 0x0724

#define R600_ROM_CNTL 0x1600
+#define R600_ROM_CLK_CTRL 0x1604
+#define R600_ROM_SW_STATUS 0x161C

#define R600_GPIOPAD_MASK 0x1798
#define R600_GPIOPAD_A 0x179C
#define R600_GPIOPAD_EN 0x17A0

+#define R600_ROM_SW_STATUS_LOOP_COUNT 1000
+
struct r600_spi_data {
uint32_t reg_general_pwrmgt;
uint32_t reg_lower_gpio_enable;
@@ -58,6 +62,7 @@
uint32_t reg_low_vid_lower_gpio_cntl;

uint32_t reg_rom_cntl;
+ uint32_t reg_rom_clk_ctrl;
uint32_t reg_gpiopad_mask;
uint32_t reg_gpiopad_a;
uint32_t reg_gpiopad_en;
@@ -94,6 +99,7 @@
mmio_read(R600_LOW_VID_LOWER_GPIO_CNTL);

data->reg_rom_cntl = mmio_read(R600_ROM_CNTL);
+ data->reg_rom_clk_ctrl = mmio_read(R600_ROM_CLK_CTRL);

data->reg_gpiopad_mask = mmio_read(R600_GPIOPAD_MASK);
data->reg_gpiopad_a = mmio_read(R600_GPIOPAD_A);
@@ -139,6 +145,8 @@

mmio_write(R600_LOWER_GPIO_ENABLE, data->reg_lower_gpio_enable);

+ mmio_write(R600_ROM_CLK_CTRL, data->reg_rom_clk_ctrl);
+
free(data);
device->private_data = NULL;

@@ -151,6 +159,8 @@
static int
r600_spi_enable(struct flashrom_pci_device *device)
{
+ int i;
+
msg_pdbg("%s();\n", __func__);

/* software enable clock gating and set sck divider to 1 */
@@ -173,6 +183,29 @@

mmio_mask(R600_LOWER_GPIO_ENABLE, 0x0400, 0x0400);

+ programmer_delay(1000);
+
+ mmio_mask(R600_GPIOPAD_MASK, 0, 0x700);
+ mmio_mask(R600_GPIOPAD_EN, 0, 0x700);
+ mmio_mask(R600_GPIOPAD_A, 0, 0x00080000);
+
+ mmio_mask(R600_ROM_CLK_CTRL, 0x04000000, 0x0C000000);
+
+ if (mmio_read(R600_ROM_SW_STATUS)) {
+ for (i = 0; i < R600_ROM_SW_STATUS_LOOP_COUNT; i++) {
+ mmio_write(R600_ROM_SW_STATUS, 0);
+ programmer_delay(1000);
+ if (!mmio_read(R600_ROM_SW_STATUS))
+ break;
+ }
+
+ if (i == R600_ROM_SW_STATUS_LOOP_COUNT) {
+ msg_perr("%s: failed to clear R600_ROM_SW_STATUS\n",
+ __func__);
+ return -1;
+ }
+ }
+
return 0;
}


To view, visit change 29089. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I14fb218d001c1e12888225675bd8fdd46e7d8fae
Gerrit-Change-Number: 29089
Gerrit-PatchSet: 1
Gerrit-Owner: Luc Verhaegen <libv@skynet.be>