提交 6e670b5c 编写于 作者: B Bin Meng

spi: ich: Change PCHV_ to ICHV_

The ICH SPI controller supports two variants, one of which is ICH7
compatible and the other is ICH9 compatible. Change 'pch_version'
to 'ich_version' to better match its original name.
Signed-off-by: NBin Meng <bmeng.cn@gmail.com>
Reviewed-by: NSimon Glass <sjg@chromium.org>
Reviewed-by: NJagan Teki <jteki@openedev.com>
Tested-by: NSimon Glass <sjg@chromium.org>
上级 1f9eb59d
...@@ -123,7 +123,7 @@ static int ich_init_controller(struct udevice *dev, ...@@ -123,7 +123,7 @@ static int ich_init_controller(struct udevice *dev,
sbase = (void *)sbase_addr; sbase = (void *)sbase_addr;
debug("%s: sbase=%p\n", __func__, sbase); debug("%s: sbase=%p\n", __func__, sbase);
if (plat->ich_version == PCHV_7) { if (plat->ich_version == ICHV_7) {
struct ich7_spi_regs *ich7_spi = sbase; struct ich7_spi_regs *ich7_spi = sbase;
ich7_spi = (struct ich7_spi_regs *)sbase; ich7_spi = (struct ich7_spi_regs *)sbase;
...@@ -139,7 +139,7 @@ static int ich_init_controller(struct udevice *dev, ...@@ -139,7 +139,7 @@ static int ich_init_controller(struct udevice *dev,
ctlr->bbar = offsetof(struct ich7_spi_regs, bbar); ctlr->bbar = offsetof(struct ich7_spi_regs, bbar);
ctlr->preop = offsetof(struct ich7_spi_regs, preop); ctlr->preop = offsetof(struct ich7_spi_regs, preop);
ctlr->base = ich7_spi; ctlr->base = ich7_spi;
} else if (plat->ich_version == PCHV_9) { } else if (plat->ich_version == ICHV_9) {
struct ich9_spi_regs *ich9_spi = sbase; struct ich9_spi_regs *ich9_spi = sbase;
ctlr->ichspi_lock = readw(&ich9_spi->hsfs) & HSFS_FLOCKDN; ctlr->ichspi_lock = readw(&ich9_spi->hsfs) & HSFS_FLOCKDN;
...@@ -165,7 +165,7 @@ static int ich_init_controller(struct udevice *dev, ...@@ -165,7 +165,7 @@ static int ich_init_controller(struct udevice *dev,
/* Work out the maximum speed we can support */ /* Work out the maximum speed we can support */
ctlr->max_speed = 20000000; ctlr->max_speed = 20000000;
if (plat->ich_version == PCHV_9 && ich9_can_do_33mhz(dev)) if (plat->ich_version == ICHV_9 && ich9_can_do_33mhz(dev))
ctlr->max_speed = 33000000; ctlr->max_speed = 33000000;
debug("ICH SPI: Version ID %d detected at %p, speed %ld\n", debug("ICH SPI: Version ID %d detected at %p, speed %ld\n",
plat->ich_version, ctlr->base, ctlr->max_speed); plat->ich_version, ctlr->base, ctlr->max_speed);
...@@ -394,7 +394,7 @@ static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen, ...@@ -394,7 +394,7 @@ static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen,
if (ret < 0) if (ret < 0)
return ret; return ret;
if (plat->ich_version == PCHV_7) if (plat->ich_version == ICHV_7)
ich_writew(ctlr, SPIS_CDS | SPIS_FCERR, ctlr->status); ich_writew(ctlr, SPIS_CDS | SPIS_FCERR, ctlr->status);
else else
ich_writeb(ctlr, SPIS_CDS | SPIS_FCERR, ctlr->status); ich_writeb(ctlr, SPIS_CDS | SPIS_FCERR, ctlr->status);
...@@ -649,7 +649,7 @@ static int ich_spi_child_pre_probe(struct udevice *dev) ...@@ -649,7 +649,7 @@ static int ich_spi_child_pre_probe(struct udevice *dev)
* ICH 7 SPI controller only supports array read command * ICH 7 SPI controller only supports array read command
* and byte program command for SST flash * and byte program command for SST flash
*/ */
if (plat->ich_version == PCHV_7) { if (plat->ich_version == ICHV_7) {
slave->mode_rx = SPI_RX_SLOW; slave->mode_rx = SPI_RX_SLOW;
slave->mode = SPI_TX_BYTE; slave->mode = SPI_TX_BYTE;
} }
...@@ -665,12 +665,12 @@ static int ich_spi_ofdata_to_platdata(struct udevice *dev) ...@@ -665,12 +665,12 @@ static int ich_spi_ofdata_to_platdata(struct udevice *dev)
ret = fdt_node_check_compatible(gd->fdt_blob, dev->of_offset, ret = fdt_node_check_compatible(gd->fdt_blob, dev->of_offset,
"intel,ich7-spi"); "intel,ich7-spi");
if (ret == 0) { if (ret == 0) {
plat->ich_version = PCHV_7; plat->ich_version = ICHV_7;
} else { } else {
ret = fdt_node_check_compatible(gd->fdt_blob, dev->of_offset, ret = fdt_node_check_compatible(gd->fdt_blob, dev->of_offset,
"intel,ich9-spi"); "intel,ich9-spi");
if (ret == 0) if (ret == 0)
plat->ich_version = PCHV_9; plat->ich_version = ICHV_9;
} }
return ret; return ret;
......
...@@ -127,8 +127,13 @@ struct spi_trans { ...@@ -127,8 +127,13 @@ struct spi_trans {
#define SPI_OPCODE_WREN 0x06 #define SPI_OPCODE_WREN 0x06
#define SPI_OPCODE_FAST_READ 0x0b #define SPI_OPCODE_FAST_READ 0x0b
enum ich_version {
ICHV_7,
ICHV_9,
};
struct ich_spi_platdata { struct ich_spi_platdata {
enum pch_version ich_version; /* Controller version, 7 or 9 */ enum ich_version ich_version; /* Controller version, 7 or 9 */
}; };
struct ich_spi_priv { struct ich_spi_priv {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册