From 20607eed6758b4d3c547aebe93a65ebd34f5ab8a Mon Sep 17 00:00:00 2001 From: Vincent BENOIT Date: Tue, 14 Feb 2023 07:42:13 +0000 Subject: [PATCH] patch du noyau pour la pengwyn --- recipes-kernel/dts/files/am335x-pengwyn.dts | 68 ++++---- .../0001-omap2-mcspi-control-cs-change.patch | 16 ++ .../linux/files/0002-printk-tpm-spi.patch | 132 ++++++++++++++- .../linux/files/0004-printk-tpm-spi.patch | 115 +++++++++++++ .../linux/files/0005-printk-omap2-mcspi.patch | 158 ++++++++++++++++++ .../linux/linux-ti-staging_%.bbappend | 2 +- 6 files changed, 451 insertions(+), 40 deletions(-) create mode 100644 recipes-kernel/linux/files/0001-omap2-mcspi-control-cs-change.patch create mode 100644 recipes-kernel/linux/files/0004-printk-tpm-spi.patch create mode 100644 recipes-kernel/linux/files/0005-printk-omap2-mcspi.patch diff --git a/recipes-kernel/dts/files/am335x-pengwyn.dts b/recipes-kernel/dts/files/am335x-pengwyn.dts index e6622c7..a7bb919 100644 --- a/recipes-kernel/dts/files/am335x-pengwyn.dts +++ b/recipes-kernel/dts/files/am335x-pengwyn.dts @@ -69,9 +69,9 @@ spi0_pins: pinmux_spi0_pins { pinctrl-single,pins = < - AM33XX_PADCONF(AM335X_PIN_SPI0_CS0, PIN_INPUT_PULLUP, MUX_MODE0) + AM33XX_PADCONF(AM335X_PIN_SPI0_CS0, PIN_INPUT, MUX_MODE0) AM33XX_PADCONF(AM335X_PIN_SPI0_D0, PIN_INPUT, MUX_MODE0) /* spi0_d0_mosi, external pullup */ - AM33XX_PADCONF(AM335X_PIN_SPI0_D1, PIN_INPUT_PULLUP, MUX_MODE0) /* spi0_d1_miso */ + AM33XX_PADCONF(AM335X_PIN_SPI0_D1, PIN_INPUT, MUX_MODE0) /* spi0_d1_miso */ AM33XX_PADCONF(AM335X_PIN_SPI0_SCLK, PIN_INPUT, MUX_MODE0) /* external pullup */ >; }; @@ -285,13 +285,6 @@ status = "okay"; }; -//&uart1 { -// pinctrl-names = "default"; -// pinctrl-0 = <&uart1_pins>; -// -// status = "disabled"; -//}; - &i2c0 { pinctrl-names = "default"; pinctrl-0 = <&i2c0_pins>; @@ -338,29 +331,35 @@ pinctrl-names = "default"; pinctrl-0 = <&spi0_pins>; cs-gpios = <&gpio0 5 GPIO_ACTIVE_LOW>; /* SPI0_CS0 */ - status = "okay"; - //ti,pindir-do-out-d1-in; + status = "disabled"; + ti,pindir-d0-out-d1-in; + ti,spi-num-cs = <1>; + interrupt-parent = <&intc>; + interrupt = <65>; + dmas = <&edma 16 + &edma 17 + &edma 18 + &edma 19>; + dma-names = "tx0", "rx0", "tx1", "rx1"; + /* - spidev@0 { + tpm@0 { + // number of cells required to define a chip select address on the SPI bus. + #address-cells = <1>; + // should be zero + #size-cells = <0>; + // name of SPI bus controller following generic names recommended practice + compatible = "infineon,slb9670"; + spi-max-frequency = <3200000>; + reg = <0>; + }; + + spidev@1 { compatible = "rohm,dh2228fv"; spi-max-frequency = <5000000>; reg = <1>; }; */ - - slb9670@0 { - // number of cells required to define a chip select address on the SPI bus. - //#address-cells = <1>; - // should be zero - //#size-cells = <0>; - // name of SPI bus controller following generic names recommended practice - compatible = "infineon,slb9670"; - spi-max-frequency = <32000000>; - reg = <0>; - //num-cs = <1>; - //gpios = <&gpio0 15 GPIO_ACTIVE_LOW>; - //status = "okay"; - }; }; &spi1 { @@ -368,16 +367,25 @@ pinctrl-0 = <&spi1_pins>; cs-gpios = <&gpio3 17 GPIO_ACTIVE_LOW>; /* SPI1_CS0 */ status = "okay"; - //ti,pindir-do-out-d1-in; + ti,pindir-d0-out-d1-in; + #address-cells = <1>; + #size-cells = <0>; + interrupt-parent = <&intc>; + interrupt = <125>; + dmas = <&edma 42 + &edma 43 + &edma 44 + &edma 45>; + dma-names = "tx0", "rx0", "tx1", "rx1"; slb9670@0 { // number of cells required to define a chip select address on the SPI bus. - //#address-cells = <1>; + #address-cells = <1>; // should be zero - //#size-cells = <0>; + #size-cells = <0>; // name of SPI bus controller following generic names recommended practice compatible = "infineon,slb9670"; - spi-max-frequency = <33000000>; + spi-max-frequency = <10000000>; reg = <0>; }; diff --git a/recipes-kernel/linux/files/0001-omap2-mcspi-control-cs-change.patch b/recipes-kernel/linux/files/0001-omap2-mcspi-control-cs-change.patch new file mode 100644 index 0000000..ccfc8b1 --- /dev/null +++ b/recipes-kernel/linux/files/0001-omap2-mcspi-control-cs-change.patch @@ -0,0 +1,16 @@ +--- a/drivers/spi/spi-omap2-mcspi.c ++++ b/drivers/spi/spi-omap2-mcspi.c +@@ -1252,8 +1252,11 @@ static int omap2_mcspi_transfer_one(struct spi_master *master, + + omap2_mcspi_set_enable(spi, 0); + +- if (gpio_is_valid(spi->cs_gpio)) +- omap2_mcspi_set_cs(spi, !(spi->mode & SPI_CS_HIGH)); ++ if (gpio_is_valid(spi->cs_gpio)) { ++ if(!(t->cs_change)) { ++ omap2_mcspi_set_cs(spi, !(spi->mode & SPI_CS_HIGH)); ++ } ++ } + + if (mcspi->fifo_depth > 0 && t) + omap2_mcspi_set_fifo(spi, t, 0); diff --git a/recipes-kernel/linux/files/0002-printk-tpm-spi.patch b/recipes-kernel/linux/files/0002-printk-tpm-spi.patch index 3642443..a74db99 100644 --- a/recipes-kernel/linux/files/0002-printk-tpm-spi.patch +++ b/recipes-kernel/linux/files/0002-printk-tpm-spi.patch @@ -1,3 +1,44 @@ +--- a/drivers/char/tpm/tpm-chip.c ++++ b/drivers/char/tpm/tpm-chip.c +@@ -36,12 +36,16 @@ static int tpm_request_locality(struct tpm_chip *chip) + { + int rc; + +- if (!chip->ops->request_locality) ++ if (!chip->ops->request_locality) { ++ printk(KERN_INFO "[REQUEST LOCALITY] no function\n"); + return 0; ++ } + + rc = chip->ops->request_locality(chip, 0); +- if (rc < 0) ++ if (rc < 0) { ++ printk(KERN_INFO "[REQUEST LOCALITY] function error\n"); + return rc; ++ } + + chip->locality = rc; + return 0; +@@ -104,9 +108,11 @@ int tpm_chip_start(struct tpm_chip *chip) + tpm_clk_enable(chip); + + if (chip->locality == -1) { ++ printk(KERN_INFO "[START] locality = -1\n"); + ret = tpm_request_locality(chip); + if (ret) { + tpm_clk_disable(chip); ++ printk(KERN_INFO "[START] request locality error\n"); + return ret; + } + } +@@ -115,6 +121,7 @@ int tpm_chip_start(struct tpm_chip *chip) + if (ret) { + tpm_relinquish_locality(chip); + tpm_clk_disable(chip); ++ printk(KERN_INFO "[START] cmd ready error\n"); + return ret; + } + --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c @@ -105,13 +105,17 @@ static int wait_startup(struct tpm_chip *chip, int l) @@ -19,7 +60,72 @@ return -1; } -@@ -861,7 +865,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, +@@ -122,12 +126,16 @@ static bool check_locality(struct tpm_chip *chip, int l) + u8 access; + + rc = tpm_tis_read8(priv, TPM_ACCESS(l), &access); +- if (rc < 0) ++ if (rc < 0) { ++ printk(KERN_INFO "[CHECK LOCALITY] read8 error\n"); + return false; ++ } + ++ printk(KERN_INFO "[CHECK LOCALITY] read8: 0x%x\n", access); + if ((access & (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) == + (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) { + priv->locality = l; ++ printk(KERN_INFO "[CHECK LOCALITY] access => TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID\n"); + return true; + } + +@@ -194,31 +202,42 @@ static int request_locality(struct tpm_chip *chip, int l) + unsigned long stop, timeout; + long rc; + +- if (check_locality(chip, l)) ++ if (check_locality(chip, l)) { ++ printk(KERN_INFO "[REQUEST_LOCALITY - CORE] error\n"); + return l; ++ } + + rc = tpm_tis_write8(priv, TPM_ACCESS(l), TPM_ACCESS_REQUEST_USE); +- if (rc < 0) ++ if (rc < 0) { ++ printk(KERN_INFO "[REQUEST_LOCALITY - CORE] write8 (0x%x) error\n", TPM_ACCESS_REQUEST_USE); + return rc; ++ } + + stop = jiffies + chip->timeout_a; + ++ printk(KERN_INFO "[REQUEST_LOCALITY - CORE] flags = 0x%x\n", chip->flags); + if (chip->flags & TPM_CHIP_FLAG_IRQ) { ++ printk(KERN_INFO "[REQUEST_LOCALITY - CORE] TPM_CHIP_FLAG_IRQ\n"); + again: + timeout = stop - jiffies; +- if ((long)timeout <= 0) ++ if ((long)timeout <= 0) { ++ printk(KERN_INFO "[REQUEST_LOCALITY - CORE] timeout\n"); + return -1; ++ } + rc = wait_event_interruptible_timeout(priv->int_queue, + (check_locality + (chip, l)), + timeout); +- if (rc > 0) ++ if (rc > 0){ ++ printk(KERN_INFO "[REQUEST_LOCALITY - CORE] wait event : l = 0x%x\n", l); + return l; ++ } + if (rc == -ERESTARTSYS && freezing(current)) { + clear_thread_flag(TIF_SIGPENDING); + goto again; + } + } else { ++ printk(KERN_INFO "[REQUEST_LOCALITY - CORE] not TPM_CHIP_FLAG_IRQ\n"); + /* wait for burstcount */ + do { + if (check_locality(chip, l)) +@@ -861,7 +880,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, u8 rid; int rc, probe; struct tpm_chip *chip; @@ -28,7 +134,7 @@ chip = tpmm_chip_alloc(dev, &tpm_tis); if (IS_ERR(chip)) return PTR_ERR(chip); -@@ -894,6 +898,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, +@@ -894,6 +913,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, } } @@ -36,7 +142,7 @@ if (chip->ops->clk_enable != NULL) chip->ops->clk_enable(chip, true); -@@ -902,6 +907,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, +@@ -902,16 +922,21 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, goto out_err; } @@ -44,15 +150,21 @@ /* Take control of the TPM's interrupt hardware and shut it off */ rc = tpm_tis_read32(priv, TPM_INT_ENABLE(priv->locality), &intmask); if (rc < 0) -@@ -912,6 +918,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, + goto out_err; + ++ printk(KERN_INFO "[INIT] intmask = 0x%x\n", intmask); + intmask |= TPM_INTF_CMD_READY_INT | TPM_INTF_LOCALITY_CHANGE_INT | + TPM_INTF_DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT; ++ printk(KERN_INFO "[INIT] intmask = 0x%x\n", intmask); intmask &= ~TPM_GLOBAL_INT_ENABLE; ++ printk(KERN_INFO "[INIT] intmask = 0x%x\n", intmask); tpm_tis_write32(priv, TPM_INT_ENABLE(priv->locality), intmask); + printk(KERN_INFO "[INIT] plop3\n"); rc = tpm_chip_start(chip); if (rc) goto out_err; -@@ -920,12 +927,14 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, +@@ -920,12 +945,14 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, if (rc) goto out_err; @@ -67,7 +179,7 @@ rc = tpm_tis_read8(priv, TPM_RID(0), &rid); if (rc < 0) goto out_err; -@@ -934,12 +943,14 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, +@@ -934,12 +961,14 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, (chip->flags & TPM_CHIP_FLAG_TPM2) ? "2.0" : "1.2", vendor >> 16, rid); @@ -82,7 +194,7 @@ /* Figure out the capabilities */ rc = tpm_tis_read32(priv, TPM_INTF_CAPS(priv->locality), &intfcaps); if (rc < 0) -@@ -966,6 +977,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, +@@ -966,6 +995,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, if (intfcaps & TPM_INTF_DATA_AVAIL_INT) dev_dbg(dev, "\tData Avail Int Support\n"); @@ -90,7 +202,7 @@ /* INTERRUPT Setup */ init_waitqueue_head(&priv->read_queue); init_waitqueue_head(&priv->int_queue); -@@ -991,6 +1003,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, +@@ -991,6 +1021,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, } } @@ -98,7 +210,7 @@ rc = tpm_chip_register(chip); if (rc) goto out_err; -@@ -1003,6 +1016,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, +@@ -1003,6 +1034,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, if ((chip->ops != NULL) && (chip->ops->clk_enable != NULL)) chip->ops->clk_enable(chip, false); @@ -106,6 +218,8 @@ tpm_tis_remove(chip); return rc; +diff --git a/drivers/char/tpm/tpm_tis_spi.c b/drivers/char/tpm/tpm_tis_spi.c +index 19513e622053..317aadb6973b 100644 --- a/drivers/char/tpm/tpm_tis_spi.c +++ b/drivers/char/tpm/tpm_tis_spi.c @@ -197,6 +197,7 @@ static int tpm_tis_spi_probe(struct spi_device *dev) diff --git a/recipes-kernel/linux/files/0004-printk-tpm-spi.patch b/recipes-kernel/linux/files/0004-printk-tpm-spi.patch new file mode 100644 index 0000000..e3c841c --- /dev/null +++ b/recipes-kernel/linux/files/0004-printk-tpm-spi.patch @@ -0,0 +1,115 @@ +--- a/drivers/char/tpm/tpm_tis_spi.c ++++ b/drivers/char/tpm/tpm_tis_spi.c +@@ -61,6 +61,7 @@ static int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len, + u8 transfer_len; + + spi_bus_lock(phy->spi_device->master); ++ printk(KERN_INFO "in: %x - out: %x - addr: 0x%x - len:%d\n", in, out, addr, len); + + while (len) { + transfer_len = min_t(u16, len, MAX_SPI_FRAMESIZE); +@@ -79,9 +80,14 @@ static int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len, + spi_message_init(&m); + spi_message_add_tail(&spi_xfer, &m); + ret = spi_sync_locked(phy->spi_device, &m); +- if (ret < 0) ++ if (ret < 0) { + goto exit; ++ } + ++ printk(KERN_INFO "phy->iobuf: 0x%x 0x%x 0x%x 0x%x\n", phy->iobuf[0], ++ phy->iobuf[1], ++ phy->iobuf[2], ++ phy->iobuf[3]); + if ((phy->iobuf[3] & 0x01) == 0) { + // handle SPI wait states + phy->iobuf[0] = 0; +@@ -91,10 +97,12 @@ static int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len, + spi_message_init(&m); + spi_message_add_tail(&spi_xfer, &m); + ret = spi_sync_locked(phy->spi_device, &m); +- if (ret < 0) ++ if (ret < 0){ + goto exit; +- if (phy->iobuf[0] & 0x01) ++ } ++ if (phy->iobuf[0] & 0x01) { + break; ++ } + } + + if (i == TPM_RETRY) { +@@ -108,8 +116,10 @@ static int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len, + spi_xfer.delay_usecs = 5; + + if (in) { ++ printk(KERN_INFO "in => read\n"); + spi_xfer.tx_buf = NULL; + } else if (out) { ++ printk(KERN_INFO "out => write\n"); + spi_xfer.rx_buf = NULL; + memcpy(phy->iobuf, out, transfer_len); + out += transfer_len; +@@ -118,10 +128,14 @@ static int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len, + spi_message_init(&m); + spi_message_add_tail(&spi_xfer, &m); + ret = spi_sync_locked(phy->spi_device, &m); +- if (ret < 0) ++ if (ret < 0) { ++ printk(KERN_INFO "==> spi_sync_locked error\n"); + goto exit; ++ } + + if (in) { ++ printk(KERN_INFO "transfer_len: %d - phy->iobuf: 0x%x\n", transfer_len, ++ phy->iobuf[0]); + memcpy(in, phy->iobuf, transfer_len); + in += transfer_len; + } +@@ -130,6 +144,7 @@ static int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len, + } + + exit: ++ printk(KERN_INFO "exit - spi_bus_unlock\n****\n"); + spi_bus_unlock(phy->spi_device->master); + return ret; + } +@@ -137,12 +152,14 @@ static int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len, + static int tpm_tis_spi_read_bytes(struct tpm_tis_data *data, u32 addr, + u16 len, u8 *result) + { ++ printk(KERN_INFO "read bytes : addr: 0x%04x - len: %d\n", addr, len); + return tpm_tis_spi_transfer(data, addr, len, result, NULL); + } + + static int tpm_tis_spi_write_bytes(struct tpm_tis_data *data, u32 addr, + u16 len, const u8 *value) + { ++ printk(KERN_INFO "write bytes : addr: 0x%04x - len: %d\n", addr, len); + return tpm_tis_spi_transfer(data, addr, len, NULL, value); + } + +@@ -151,6 +168,7 @@ static int tpm_tis_spi_read16(struct tpm_tis_data *data, u32 addr, u16 *result) + __le16 result_le; + int rc; + ++ printk(KERN_INFO "read16 : addr: 0x%04x - len: %d\n", addr, sizeof(u16)); + rc = data->phy_ops->read_bytes(data, addr, sizeof(u16), + (u8 *)&result_le); + if (!rc) +@@ -164,6 +182,7 @@ static int tpm_tis_spi_read32(struct tpm_tis_data *data, u32 addr, u32 *result) + __le32 result_le; + int rc; + ++ printk(KERN_INFO "read32 : addr: 0x%04x - len: %d\n", addr, sizeof(u32)); + rc = data->phy_ops->read_bytes(data, addr, sizeof(u32), + (u8 *)&result_le); + if (!rc) +@@ -177,6 +196,7 @@ static int tpm_tis_spi_write32(struct tpm_tis_data *data, u32 addr, u32 value) + __le32 value_le; + int rc; + ++ printk(KERN_INFO "write32 : addr: 0x%04x - val: 0x%04x\n", addr, value); + value_le = cpu_to_le32(value); + rc = data->phy_ops->write_bytes(data, addr, sizeof(u32), + (u8 *)&value_le); diff --git a/recipes-kernel/linux/files/0005-printk-omap2-mcspi.patch b/recipes-kernel/linux/files/0005-printk-omap2-mcspi.patch new file mode 100644 index 0000000..ce8fcdf --- /dev/null +++ b/recipes-kernel/linux/files/0005-printk-omap2-mcspi.patch @@ -0,0 +1,158 @@ +--- a/drivers/spi/spi-omap2-mcspi.c ++++ b/drivers/spi/spi-omap2-mcspi.c +@@ -1146,6 +1146,7 @@ static int omap2_mcspi_transfer_one(struct spi_master *master, + int status = 0; + u32 chconf; + ++ printk(KERN_INFO "[MCSPI] transfer one\n"); + mcspi = spi_master_get_devdata(master); + mcspi_dma = mcspi->dma_channels + spi->chip_select; + cs = spi->controller_state; +@@ -1158,27 +1159,40 @@ static int omap2_mcspi_transfer_one(struct spi_master *master, + * omap2_mcspi_setup_transfer will be called to configure the hardware + * with the correct mode on the first iteration of the loop below. + */ +- if (spi->mode != cs->mode) ++ printk(KERN_INFO "[MCSPI] mode: (0x%x/0x%x)\n", spi->mode, cs->mode); ++ if (spi->mode != cs->mode) { ++ printk(KERN_INFO "[MCSPI] par_override !\n"); + par_override = 1; ++ } + + omap2_mcspi_set_enable(spi, 0); + +- if (gpio_is_valid(spi->cs_gpio)) ++ if (gpio_is_valid(spi->cs_gpio)) { ++ printk(KERN_INFO "[MCSPI] gpio is valid ! (0x%x)\n", spi->cs_gpio); + omap2_mcspi_set_cs(spi, spi->mode & SPI_CS_HIGH); ++ } + + if (par_override || + (t->speed_hz != spi->max_speed_hz) || + (t->bits_per_word != spi->bits_per_word)) { + par_override = 1; ++ printk(KERN_INFO "[MCSPI] setup transfer !\n"); + status = omap2_mcspi_setup_transfer(spi, t); +- if (status < 0) ++ if (status < 0) { ++ printk(KERN_INFO "[MCSPI] ==> out\n"); + goto out; ++ } + if (t->speed_hz == spi->max_speed_hz && +- t->bits_per_word == spi->bits_per_word) ++ t->bits_per_word == spi->bits_per_word) { ++ printk(KERN_INFO "[MCSPI] par_override = 0 !\n"); + par_override = 0; ++ } + } ++ + if (cd && cd->cs_per_word) { ++ printk(KERN_INFO "[MCSPI] cs_per_word - toggle chip select after every word !\n"); + chconf = mcspi->ctx.modulctrl; ++ printk(KERN_INFO "[MCSPI] cs_per_word: chconf: 0x%x\n", chconf); + chconf &= ~OMAP2_MCSPI_MODULCTRL_SINGLE; + mcspi_write_reg(master, OMAP2_MCSPI_MODULCTRL, chconf); + mcspi->ctx.modulctrl = +@@ -1186,29 +1200,40 @@ static int omap2_mcspi_transfer_one(struct spi_master *master, + } + + chconf = mcspi_cached_chconf0(spi); ++ printk(KERN_INFO "[MCSPI] chconf: 0x%x\n", chconf); + chconf &= ~OMAP2_MCSPI_CHCONF_TRM_MASK; ++ printk(KERN_INFO "[MCSPI] chconf: 0x%x\n", chconf); + chconf &= ~OMAP2_MCSPI_CHCONF_TURBO; ++ printk(KERN_INFO "[MCSPI] chconf: 0x%x\n", chconf); + + if (t->tx_buf == NULL) + chconf |= OMAP2_MCSPI_CHCONF_TRM_RX_ONLY; + else if (t->rx_buf == NULL) + chconf |= OMAP2_MCSPI_CHCONF_TRM_TX_ONLY; + ++ printk(KERN_INFO "[MCSPI] chconf: 0x%x\n", chconf); + if (cd && cd->turbo_mode && t->tx_buf == NULL) { ++ printk(KERN_INFO "[MCSPI] Turbo mode\n"); + /* Turbo mode is for more than one word */ +- if (t->len > ((cs->word_len + 7) >> 3)) ++ if (t->len > ((cs->word_len + 7) >> 3)) { + chconf |= OMAP2_MCSPI_CHCONF_TURBO; ++ printk(KERN_INFO "[MCSPI] chconf: 0x%x\n", chconf); ++ } + } + ++ printk(KERN_INFO "[MCSPI] write conf\n"); + mcspi_write_chconf0(spi, chconf); + + if (t->len) { + unsigned count; ++ printk(KERN_INFO "[MCSPI] spi transfer len : %d\n", t->len); + + if ((mcspi_dma->dma_rx && mcspi_dma->dma_tx) && + master->cur_msg_mapped && +- master->can_dma(master, spi, t)) ++ master->can_dma(master, spi, t)) { ++ printk(KERN_INFO "[MCSPI] set fifo\n"); + omap2_mcspi_set_fifo(spi, t, 1); ++ } + + omap2_mcspi_set_enable(spi, 1); + +@@ -1219,32 +1244,40 @@ static int omap2_mcspi_transfer_one(struct spi_master *master, + + if ((mcspi_dma->dma_rx && mcspi_dma->dma_tx) && + master->cur_msg_mapped && +- master->can_dma(master, spi, t)) ++ master->can_dma(master, spi, t)) { ++ printk(KERN_INFO "[MCSPI] use dma\n"); + count = omap2_mcspi_txrx_dma(spi, t); +- else ++ } else { ++ printk(KERN_INFO "[MCSPI] use pio\n"); + count = omap2_mcspi_txrx_pio(spi, t); +- ++ } + if (count != t->len) { + status = -EIO; ++ printk(KERN_INFO "[MCSPI] ==> go out (count: %d/%d)\n", count, t->len); + goto out; + } + } + + omap2_mcspi_set_enable(spi, 0); + +- if (mcspi->fifo_depth > 0) ++ if (mcspi->fifo_depth > 0) { ++ printk(KERN_INFO "[MCSPI] reset fifo\n"); + omap2_mcspi_set_fifo(spi, t, 0); ++ } + + out: + /* Restore defaults if they were overriden */ + if (par_override) { ++ printk(KERN_INFO "[MCSPI] restore default\n"); + par_override = 0; + status = omap2_mcspi_setup_transfer(spi, NULL); + } + + if (cd && cd->cs_per_word) { + chconf = mcspi->ctx.modulctrl; ++ printk(KERN_INFO "[MCSPI] chconf: 0x%x\n", chconf); + chconf |= OMAP2_MCSPI_MODULCTRL_SINGLE; ++ printk(KERN_INFO "[MCSPI] chconf: 0x%x\n", chconf); + mcspi_write_reg(master, OMAP2_MCSPI_MODULCTRL, chconf); + mcspi->ctx.modulctrl = + mcspi_read_cs_reg(spi, OMAP2_MCSPI_MODULCTRL); +@@ -1252,8 +1285,12 @@ static int omap2_mcspi_transfer_one(struct spi_master *master, + + omap2_mcspi_set_enable(spi, 0); + +- if (gpio_is_valid(spi->cs_gpio)) +- omap2_mcspi_set_cs(spi, !(spi->mode & SPI_CS_HIGH)); ++ if (gpio_is_valid(spi->cs_gpio)) { ++ printk(KERN_INFO "[MCSPI] reset CS !\n"); ++ if(!(t->cs_change)) { ++ omap2_mcspi_set_cs(spi, !(spi->mode & SPI_CS_HIGH)); ++ } ++ } + + if (mcspi->fifo_depth > 0 && t) + omap2_mcspi_set_fifo(spi, t, 0); diff --git a/recipes-kernel/linux/linux-ti-staging_%.bbappend b/recipes-kernel/linux/linux-ti-staging_%.bbappend index c49e391..2698878 100644 --- a/recipes-kernel/linux/linux-ti-staging_%.bbappend +++ b/recipes-kernel/linux/linux-ti-staging_%.bbappend @@ -4,6 +4,6 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/files:" SRC_URI += " \ file://0001-dtc-lexer-extern-yylloc.patch \ - file://0002-printk-tpm-spi.patch \ + file://0001-omap2-mcspi-control-cs-change.patch \ file://defconfig \ "