SPI: spi-pxa2xx: Add support for Intel Quark X1000 SPI controller
Subsystems (3)
v3 cover SPI: spi-pxa2xx: Add support for Intel Quark X1000 SPI controller
Hi,
Intel Quark X1000 consists of two SPI controllers which can be PCI enumerated. SPI-PXA2XX PCI layer doesn't support it. Thus, we add support for Intel Quark X1000 SPI as well.
---
v3:
[PATCH 1/2]
* Improve the commit message.
* A couple of minor fixes.
[PATCH 2/2]
* Set '.num_chipselect' to '1' instead of '4'.
* A couple of minor fixes.
v2:
Split into two patches: one is for helper functions, and another is for quark supporting.
[PATCH 1/2]
* Add helper functions to access registers.
* Use 'switch' instead of 'if-else'. [PATCH 2/2]
* Use 'switch' instead of 'if-else'.
* Add comments for the 'dds'&'clk_div' caculation.
* A couple of minor fixes.
Weike Chen (2):
SPI: spi-pxa2xx: Add helpers for regiseters' accessing
SPI: spi-pxa2xx: SPI support for Intel Quark X1000
drivers/spi/spi-pxa2xx-pci.c | 8 ++ drivers/spi/spi-pxa2xx.c | 304 ++++++++++++++++++++++++++++++++++++------ drivers/spi/spi-pxa2xx.h | 16 ++- include/linux/pxa2xx_ssp.h | 21 +++ 4 files changed, 304 insertions(+), 45 deletions(-)
Signature · 1 line
1.7.9.5
PATCH v3 1/2 SPI: spi-pxa2xx: Add helpers for regiseters' accessing
There are several registers for SPI, and the registers of 'SSCR0' and 'SSCR1' are accessed frequently. This path is to introduce helper functions to simplify the accessing of 'SSCR0' and 'SSCR1'.
--- drivers/spi/spi-pxa2xx.c | 107 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 84 insertions(+), 23 deletions(-)
drivers/spi/spi-pxa2xx.c +84 -23
@@ -80,6 +80,73 @@ static bool is_lpss_ssp(const struct driver_data *drv_data)return drv_data->ssp_type ==LPSS_SSP ; } +static u32 pxa2xx_spi_get_ssrc1_change_mask (const struct driver_data *drv_data) +{ +switch (drv_data->ssp_type) { +default : +return SSCR1_CHANGE_MASK ; + } +} + +static u32 +pxa2xx_spi_get_rx_default_thre (const struct driver_data *drv_data) +{ +switch (drv_data->ssp_type) { +default : +return RX_THRESH_DFLT ; + } +} + +static bool pxa2xx_spi_txfifo_full (const struct driver_data *drv_data) +{ +void __iomem *reg = drv_data->ioaddr; +u32 mask; + +switch (drv_data->ssp_type) { +default : + mask =SSSR_TFL_MASK ; +break ; + } + +return (read_SSSR (reg) & mask) == mask; +} + +static void pxa2xx_spi_clear_rx_thre (const struct driver_data *drv_data, +u32 *sccr1_reg) +{ +u32 mask; + +switch (drv_data->ssp_type) { +default : + mask =SSCR1_RFT ; +break ; + } + *sccr1_reg &= ~mask; +} + +static void pxa2xx_spi_set_rx_thre (const struct driver_data *drv_data, +u32 *sccr1_reg,u32 threshold) +{ +switch (drv_data->ssp_type) { +default : + *sccr1_reg |=SSCR1_RxTresh (threshold); +break ; + } +} + +static u32 pxa2xx_configure_sscr0 (const struct driver_data *drv_data, +u32 clk_div,u8 bits) +{ +switch (drv_data->ssp_type) { +default : +return clk_div + | SSCR0_Motorola + |SSCR0_DataSize (bits >16 ? bits -16 : bits) + |SSCR0_SSE + | (bits >16 ?SSCR0_EDSS :0 ); + } +} +/* * Read and write LPSS SSP private registers. Caller must first check that * is_lpss_ssp() returns true before these can be called.
@@ -234,7 +301,7 @@ static int null_writer(struct driver_data *drv_data)void __iomem *reg = drv_data->ioaddr;u8 n_bytes = drv_data->n_bytes; -if (((read_SSSR (reg) &SSSR_TFL_MASK ) ==SSSR_TFL_MASK ) +if (pxa2xx_spi_txfifo_full (drv_data) || (drv_data->tx == drv_data->tx_end))return 0 ;
@@ -262,7 +329,7 @@ static int u8_writer(struct driver_data *drv_data) {void __iomem *reg = drv_data->ioaddr; -if (((read_SSSR (reg) &SSSR_TFL_MASK ) ==SSSR_TFL_MASK ) +if (pxa2xx_spi_txfifo_full (drv_data) || (drv_data->tx == drv_data->tx_end))return 0 ;
@@ -289,7 +356,7 @@ static int u16_writer(struct driver_data *drv_data) {void __iomem *reg = drv_data->ioaddr; -if (((read_SSSR (reg) &SSSR_TFL_MASK ) ==SSSR_TFL_MASK ) +if (pxa2xx_spi_txfifo_full (drv_data) || (drv_data->tx == drv_data->tx_end))return 0 ;
@@ -316,7 +383,7 @@ static int u32_writer(struct driver_data *drv_data) {void __iomem *reg = drv_data->ioaddr; -if (((read_SSSR (reg) &SSSR_TFL_MASK ) ==SSSR_TFL_MASK ) +if (pxa2xx_spi_txfifo_full (drv_data) || (drv_data->tx == drv_data->tx_end))return 0 ;
@@ -508,8 +575,9 @@ static irqreturn_t interrupt_transfer(struct driver_data *drv_data)* remaining RX bytes. */ if (pxa25x_ssp_comp (drv_data)) { +u32 rx_thre; - sccr1_reg &= ~SSCR1_RFT ; +pxa2xx_spi_clear_rx_thre (drv_data, &sccr1_reg); bytes_left = drv_data->rx_end - drv_data->rx;switch (drv_data->n_bytes) {
@@ -519,10 +587,11 @@ static irqreturn_t interrupt_transfer(struct driver_data *drv_data) bytes_left >>=1 ; } -if (bytes_left >RX_THRESH_DFLT ) - bytes_left =RX_THRESH_DFLT ; + rx_thre =pxa2xx_spi_get_rx_default_thre (drv_data); +if (rx_thre > bytes_left) + rx_thre = bytes_left; - sccr1_reg |=SSCR1_RxTresh (bytes_left); +pxa2xx_spi_set_rx_thre (drv_data, &sccr1_reg, rx_thre); }write_SSCR1 (sccr1_reg, reg); }
@@ -613,6 +682,7 @@ static void pump_transfers(unsigned long data)u32 cr1;u32 dma_thresh = drv_data->cur_chip->dma_threshold;u32 dma_burst = drv_data->cur_chip->dma_burst_size; +u32 change_mask =pxa2xx_spi_get_ssrc1_change_mask (drv_data);/* Get current state information */ message = drv_data->cur_msg;
@@ -731,11 +801,7 @@ static void pump_transfers(unsigned long data) "pump_transfers: DMA burst size reduced to match bits_per_word\n"); } - cr0 = clk_div - | SSCR0_Motorola - |SSCR0_DataSize (bits >16 ? bits -16 : bits) - |SSCR0_SSE - | (bits >16 ?SSCR0_EDSS :0 ); + cr0 =pxa2xx_configure_sscr0 (drv_data, clk_div, bits); } message->state =RUNNING_STATE ;
@@ -772,16 +838,15 @@ static void pump_transfers(unsigned long data) }/* see if we need to reload the config registers */ -if ((read_SSCR0 (reg) != cr0) - || (read_SSCR1 (reg) &SSCR1_CHANGE_MASK ) != - (cr1 &SSCR1_CHANGE_MASK )) { +if ((read_SSCR0 (reg) != cr0) || + (read_SSCR1 (reg) & change_mask) != (cr1 & change_mask)) {/* stop the SSP, and update the other bits */ write_SSCR0 (cr0 & ~SSCR0_SSE , reg);if (!pxa25x_ssp_comp (drv_data))write_SSTO (chip->timeout, reg);/* first set CR1 without interrupt and service enables */ -write_SSCR1 (cr1 &SSCR1_CHANGE_MASK , reg); +write_SSCR1 (cr1 & change_mask, reg);/* restart the SSP */ write_SSCR0 (cr0, reg);
@@ -959,12 +1024,8 @@ static int setup(struct spi_device *spi) clk_div =ssp_get_clk_div (drv_data, spi->max_speed_hz); chip->speed_hz = spi->max_speed_hz; - chip->cr0 = clk_div - | SSCR0_Motorola - |SSCR0_DataSize (spi->bits_per_word >16 ? - spi->bits_per_word -16 : spi->bits_per_word) - |SSCR0_SSE - | (spi->bits_per_word >16 ?SSCR0_EDSS :0 ); + chip->cr0 =pxa2xx_configure_sscr0 (drv_data, clk_div, + spi->bits_per_word); chip->cr1 &= ~(SSCR1_SPO |SSCR1_SPH ); chip->cr1 |= (((spi->mode &SPI_CPHA ) !=0 ) ?SSCR1_SPH :0 ) | (((spi->mode &SPI_CPOL ) !=0 ) ?SSCR1_SPO :0 );
Signature · 1 line
1.7.9.5
RE: [PATCH 1/2 v3] SPI: spi-pxa2xx: Add helpers for regiseters' accessing
Any update for these patches? Just want to follow-up.
Best regards?Alvin Chen
ICFS Platform Engineering Solution
Flex Services (CMMI Level 3, IQA2005, IQA2008),?Greater Asia Region Intel Information Technology Tel. 010-82171960 inet.8-7581960
Email. alvin.chen at intel.com
Quoted 217 lines
-----Original Message-----
From: Chen, Alvin
Sent: Wednesday, October 8, 2014 11:50 PM
To: Eric Miao; Russell King; Haojian Zhuang; Mark Brown
Cc: linux-arm-kernel at lists.infradead.org; linux-spi at vger.kernel.org; linux-kernel at vger.kernel.org; Westerberg, Mika; Kweh, Hock Leong; Ong, Boon Leong; Tan, Raymond; Chen, Alvin; Andy Shevchenko
Subject: [PATCH 1/2 v3] SPI: spi-pxa2xx: Add helpers for regiseters' accessingThere are several registers for SPI, and the registers of 'SSCR0' and 'SSCR1' are accessed frequently. This path is to introduce helper functions to simplify the accessing of 'SSCR0' and 'SSCR1'.
Reviewed-by Andy Shevchenko <[email protected]>Acked-by Mika Westerberg <[email protected]>Signed-off-by Weike Chen <[email protected]>--- drivers/spi/spi-pxa2xx.c | 107 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 84 insertions(+), 23 deletions(-)drivers/spi/spi-pxa2xx.c index renamed from drivers/spi/spi-pxa2xx.c +0
-0256c0ab..33dba9b 100644
drivers/spi/spi-pxa2xx.c +71
-5@@ -80,6 +80,73 @@ static bool is_lpss_ssp(const struct driver_data *drv_data)return drv_data->ssp_type ==LPSS_SSP ; } +static u32 pxa2xx_spi_get_ssrc1_change_mask (const struct driver_data +*drv_data) { +switch (drv_data->ssp_type) { +default : +return SSCR1_CHANGE_MASK ; + } +} + +static u32 +pxa2xx_spi_get_rx_default_thre (const struct driver_data *drv_data) { +switch (drv_data->ssp_type) { +default : +return RX_THRESH_DFLT ; + } +} + +static bool pxa2xx_spi_txfifo_full (const struct driver_data *drv_data) +{ +void __iomem *reg = drv_data->ioaddr; +u32 mask; + +switch (drv_data->ssp_type) { +default : + mask =SSSR_TFL_MASK ; +break ; + } + +return (read_SSSR (reg) & mask) == mask; } + +static void pxa2xx_spi_clear_rx_thre (const struct driver_data *drv_data, +u32 *sccr1_reg) +{ +u32 mask; + +switch (drv_data->ssp_type) { +default : + mask =SSCR1_RFT ; +break ; + } + *sccr1_reg &= ~mask; +} + +static void pxa2xx_spi_set_rx_thre (const struct driver_data *drv_data, +u32 *sccr1_reg,u32 threshold) +{ +switch (drv_data->ssp_type) { +default : + *sccr1_reg |=SSCR1_RxTresh (threshold); +break ; + } +} + +static u32 pxa2xx_configure_sscr0 (const struct driver_data *drv_data, +u32 clk_div,u8 bits) +{ +switch (drv_data->ssp_type) { +default : +return clk_div + | SSCR0_Motorola + |SSCR0_DataSize (bits >16 ? bits -16 : bits) + |SSCR0_SSE + | (bits >16 ?SSCR0_EDSS :0 ); + } +} +/* * Read and write LPSS SSP private registers. Caller must first check that * is_lpss_ssp() returns true before these can be called. @@ -234,7 +301,7 @@ static int null_writer(struct driver_data *drv_data)void __iomem *reg = drv_data->ioaddr;u8 n_bytes = drv_data->n_bytes; -if (((read_SSSR (reg) &SSSR_TFL_MASK ) ==SSSR_TFL_MASK ) +if (pxa2xx_spi_txfifo_full (drv_data) || (drv_data->tx == drv_data->tx_end))return 0 ;@@ -262,7 +329,7 @@ static int u8_writer(struct driver_data *drv_data) {void __iomem *reg = drv_data->ioaddr; -if (((read_SSSR (reg) &SSSR_TFL_MASK ) ==SSSR_TFL_MASK ) +if (pxa2xx_spi_txfifo_full (drv_data) || (drv_data->tx == drv_data->tx_end))return 0 ;@@ -289,7 +356,7 @@ static int u16_writer(struct driver_data *drv_data) {void __iomem *reg = drv_data->ioaddr; -if (((read_SSSR (reg) &SSSR_TFL_MASK ) ==SSSR_TFL_MASK ) +if (pxa2xx_spi_txfifo_full (drv_data) || (drv_data->tx == drv_data->tx_end))return 0 ;@@ -316,7 +383,7 @@ static int u32_writer(struct driver_data *drv_data) {void __iomem *reg = drv_data->ioaddr; -if (((read_SSSR (reg) &SSSR_TFL_MASK ) ==SSSR_TFL_MASK ) +if (pxa2xx_spi_txfifo_full (drv_data) || (drv_data->tx == drv_data->tx_end))return 0 ;@@ -508,8 +575,9 @@ static irqreturn_t interrupt_transfer(structdriver_data *drv_data) * remaining RX bytes. */ if (pxa25x_ssp_comp (drv_data)) { +u32 rx_thre; - sccr1_reg &= ~SSCR1_RFT ; +pxa2xx_spi_clear_rx_thre (drv_data, &sccr1_reg); bytes_left = drv_data->rx_end - drv_data->rx;drivers/spi/spi-pxa2xx.c +4
-3switch (drv_data->n_bytes) {@@ -519,10 +587,11 @@ static irqreturn_t interrupt_transfer(struct driver_data *drv_data) bytes_left >>= 1; } -if (bytes_left >RX_THRESH_DFLT ) - bytes_left =RX_THRESH_DFLT ; + rx_thre =pxa2xx_spi_get_rx_default_thre (drv_data); +if (rx_thre > bytes_left) + rx_thre = bytes_left; - sccr1_reg |=SSCR1_RxTresh (bytes_left); +pxa2xx_spi_set_rx_thre (drv_data, &sccr1_reg, rx_thre); }write_SSCR1 (sccr1_reg, reg);drivers/spi/spi-pxa2xx.c +2
-5}@@ -613,6 +682,7 @@ static void pump_transfers(unsigned long data)u32 cr1;u32 dma_thresh = drv_data->cur_chip->dma_threshold;u32 dma_burst = drv_data->cur_chip->dma_burst_size; +u32 change_mask =pxa2xx_spi_get_ssrc1_change_mask (drv_data);/* Get current state information */ message = drv_data->cur_msg;@@ -731,11 +801,7 @@ static void pump_transfers(unsigned long data) "pump_transfers: DMA burst size reduced to match bits_per_word\n"); } - cr0 = clk_div - | SSCR0_Motorola - |SSCR0_DataSize (bits >16 ? bits -16 : bits) - |SSCR0_SSE - | (bits >16 ?SSCR0_EDSS :0 ); + cr0 = pxa2xx_configure_sscr0(drv_data, clk_div, bits); }drivers/spi/spi-pxa2xx.c +5
-11message->state =RUNNING_STATE ;@@ -772,16 +838,15 @@ static void pump_transfers(unsigned long data) }/* see if we need to reload the config registers */ -if ((read_SSCR0 (reg) != cr0) - || (read_SSCR1 (reg) &SSCR1_CHANGE_MASK ) != - (cr1 &SSCR1_CHANGE_MASK )) { +if ((read_SSCR0 (reg) != cr0) || + (read_SSCR1 (reg) & change_mask) != (cr1 & change_mask)) {/* stop the SSP, and update the other bits */ write_SSCR0 (cr0 & ~SSCR0_SSE , reg);if (!pxa25x_ssp_comp (drv_data))write_SSTO (chip->timeout, reg);/* first set CR1 without interrupt and service enables */ -write_SSCR1 (cr1 &SSCR1_CHANGE_MASK , reg); +write_SSCR1 (cr1 & change_mask, reg);/* restart the SSP */ write_SSCR0 (cr0, reg);@@ -959,12 +1024,8 @@ static int setup(struct spi_device *spi) clk_div =ssp_get_clk_div (drv_data, spi->max_speed_hz); chip->speed_hz = spi->max_speed_hz; - chip->cr0 = clk_div - | SSCR0_Motorola - |SSCR0_DataSize (spi->bits_per_word >16 ? - spi->bits_per_word -16 : spi->bits_per_word) - |SSCR0_SSE - | (spi->bits_per_word >16 ?SSCR0_EDSS :0 ); + chip->cr0 =pxa2xx_configure_sscr0 (drv_data, clk_div, + spi->bits_per_word); chip->cr1 &= ~(SSCR1_SPO |SSCR1_SPH ); chip->cr1 |= (((spi->mode &SPI_CPHA ) !=0 ) ?SSCR1_SPH :0 ) | (((spi->mode &SPI_CPOL ) !=0 ) ?SSCR1_SPO :0 ); --1.7.9.5
Re: [PATCH 1/2 v3] SPI: spi-pxa2xx: Add helpers for regiseters' accessing
Quoted 2 lines · Alvin
Any update for these patches? Just want to follow-up.
Hi Alvin, Weike.
I'm not clear if these patches apply to the current tip-of-tree.
I thought the action required here, was for a resend of patches to ensure they applied to tip-of-tree ?
Best,
BOD
RE: [PATCH 1/2 v3] SPI: spi-pxa2xx: Add helpers for regiseters' accessing
Quoted 9 lines
Quoted 1 line
Hi Alvin, Weike.
I'm not clear if these patches apply to the current tip-of-tree.
I thought the action required here, was for a resend of patches to ensure they applied to tip-of-tree ?
As I said before, it is based on the slave-dma tree (git.infraded.org) for-linus branch, which will be reapplied on top of v3.19-rc1.
That is to say these patches will be applied to slave-dma tree for-linus branch, and then the slave-dma tree for-linus branch will be applied to v3.19. Andy, am I right?
Andy Shevchenko
reviewerRe: [PATCH 1/2 v3] SPI: spi-pxa2xx: Add helpers for regiseters' accessing
Quoted 6 lines · Alvin
Quoted 6 lines
Quoted 1 line
Hi Alvin, Weike.
I'm not clear if these patches apply to the current tip-of-tree.
Quoted 7 lines
Quoted 3 lines
I thought the action required here, was for a resend of patches to ensure they applied to tip-of-tree ?
As I said before, it is based on the slave-dma tree (git.infraded.org) for-linus branch, which will be reapplied on top of v3.19-rc1.
That is to say these patches will be applied to slave-dma tree for-linus branch, and then the slave-dma tree for-linus branch will be applied to v3.19. Andy, am I right?
All of those patches are in v3.18-rc1, so you may rebase on top of 3.18-rcX safely I guess.
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
RE: [PATCH 1/2 v3] SPI: spi-pxa2xx: Add helpers for regiseters' accessing
Quoted 13 lines · Alvin
Quoted 10 lines
Quoted 9 lines
Quoted 1 line
Hi Alvin, Weike.
I'm not clear if these patches apply to the current tip-of-tree.
I thought the action required here, was for a resend of patches to ensure they applied to tip-of-tree ?
As I said before, it is based on the slave-dma tree (git.infraded.org) for-linus
Quoted 9 lines
branch, which will be reapplied on top of v3.19-rc1.
Quoted 2 lines
That is to say these patches will be applied to slave-dma tree for-linus branch,
and then the slave-dma tree for-linus branch will be applied to v3.19.
Quoted 1 line
Andy, am I right?
All of those patches are in v3.18-rc1, so you may rebase on top of 3.18-rcX safely I guess.
Andy, I remember you ask me to rebase on the slave-dma tree (git.infraded.org) for-linus branch, and the slave-dma for-linus branch will be reapplied on top of v3.19-rc1.
So now I need rebase on top of 3.18-rcX, isn't it? Just to confirm.
RE: [PATCH 1/2 v3] SPI: spi-pxa2xx: Add helpers for regiseters' accessing
In reply to Andy ShevchenkoQuoted 8 lines
Quoted 4 lines
All of those patches are in v3.18-rc1, so you may rebase on top of 3.18-rcX safely I guess.
Andy, I remember you ask me to rebase on the slave-dma tree (git.infraded.org) for-linus branch, and the slave-dma for-linus branch will be reapplied on top of v3.19-rc1.
Just to confirm, these patches can be applied well on top of 3.18-rc2.
Quoted 1 line
So now I need rebase on top of 3.18-rcX, isn't it? Just to confirm.
Mark Brown
maintainerRe: [PATCH 1/2 v3] SPI: spi-pxa2xx: Add helpers for regiseters' accessing
In reply to Weike ChenQuoted 3 lines · Weike Chen
There are several registers for SPI, and the registers of 'SSCR0' and 'SSCR1' are accessed frequently. This path is to introduce helper functions to simplify the accessing of 'SSCR0' and 'SSCR1'.
Applied both, thanks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141124/5bde2185/attachment.sig>
PATCH v3 2/2 SPI: spi-pxa2xx: SPI support for Intel Quark X1000
In reply to Weike ChenThere are two SPI controllers exported by PCI subsystem for Intel Quark X1000. The SPI memory mapped I/O registers supported by Quark are different from the current implementation, and Quark only supports the registers of 'SSCR0', 'SSCR1', 'SSSR', 'SSDR', and 'DDS_RATE'. This patch is to enable the SPI for Intel Quark X1000.
This piece of work is derived from Dan O'Donovan's initial work for Intel Quark X1000 SPI enabling.
--- drivers/spi/spi-pxa2xx-pci.c | 8 ++ drivers/spi/spi-pxa2xx.c | 197 ++++++++++++++++++++++++++++++++++++++---- drivers/spi/spi-pxa2xx.h | 16 ++-- include/linux/pxa2xx_ssp.h | 21 +++++ 4 files changed, 220 insertions(+), 22 deletions(-)
drivers/spi/spi-pxa2xx-pci.c +8 -0
@@ -19,6 +19,7 @@ enum {PORT_BSW0 ,PORT_BSW1 ,PORT_BSW2 , + PORT_QUARK_X1000, }; struct pxa_spi_info {
@@ -92,6 +93,12 @@ static struct pxa_spi_info spi_info_configs[] = { .tx_param = &bsw2_tx_param, .rx_param = &bsw2_rx_param, }, + [PORT_QUARK_X1000] = { + .type = QUARK_X1000_SSP, + .port_id = -1, + .num_chipselect = 1, + .max_clk_rate = 50000000, + }, }; static int pxa2xx_spi_pci_probe(struct pci_dev *dev,
@@ -192,6 +199,7 @@ static void pxa2xx_spi_pci_remove(struct pci_dev *dev)static const struct pci_device_id pxa2xx_spi_pci_devices[] = { {PCI_VDEVICE (INTEL ,0x2e6a ),PORT_CE4100 }, + {PCI_VDEVICE (INTEL ,0x0935 ),PORT_QUARK_X1000 }, {PCI_VDEVICE (INTEL ,0x0f0e ),PORT_BYT }, {PCI_VDEVICE (INTEL ,0x228e ),PORT_BSW0 }, {PCI_VDEVICE (INTEL ,0x2290 ),PORT_BSW1 },
drivers/spi/spi-pxa2xx.c +180 -17
318 lines not on this page · raw message
drivers/spi/spi-pxa2xx.h +11 -5
@@ -93,6 +93,7 @@ struct driver_data {struct chip_data {u32 cr0;u32 cr1; +u32 dds_rate;u32 psp;u32 timeout;u8 n_bytes;
@@ -126,6 +127,7 @@ DEFINE_SSP_REG(SSCR1, 0x04) DEFINE_SSP_REG(SSSR, 0x08) DEFINE_SSP_REG(SSITR, 0x0c) DEFINE_SSP_REG(SSDR, 0x10) +DEFINE_SSP_REG(DDS_RATE, 0x28) /* DDS Clock Rate */ DEFINE_SSP_REG(SSTO, 0x28) DEFINE_SSP_REG(SSPSP, 0x2c)DEFINE_SSP_REG (SSITF ,SSITF )
@@ -141,18 +143,22 @@ DEFINE_SSP_REG(SSIRF, SSIRF)static inline int pxa25x_ssp_comp (struct driver_data *drv_data) { -if (drv_data->ssp_type == PXA25x_SSP) +switch (drv_data->ssp_type) { +case PXA25x_SSP: +case CE4100_SSP : +case QUARK_X1000_SSP :return 1 ; -if (drv_data->ssp_type ==CE4100_SSP ) -return 1 ; -return 0 ; +default : +return 0 ; + } }static inline void write_SSSR_CS (struct driver_data *drv_data,u32 val) {void __iomem *reg = drv_data->ioaddr; -if (drv_data->ssp_type ==CE4100_SSP ) +if (drv_data->ssp_type ==CE4100_SSP || + drv_data->ssp_type ==QUARK_X1000_SSP ) val |=read_SSSR (reg) &SSSR_ALT_FRM_MASK ;write_SSSR (val, reg);
include/linux/pxa2xx_ssp.h +21 -0
@@ -106,6 +106,26 @@#define SSCR1_TxTresh (x) (((x) - 1) << 6)/* level [1..4] */ #define SSCR1_RFT (0x00000c00)/* Receive FIFO Threshold (mask) */ #define SSCR1_RxTresh (x) (((x) - 1) << 10)/* level [1..4] */ + +/* QUARK_X1000 SSCR0 bit definition */ +#define QUARK_X1000_SSCR0_DSS (0x1F)/* Data Size Select (mask) */ +#define QUARK_X1000_SSCR0_DataSize (x) ((x) - 1)/* Data Size Select [4..32] */ +#define QUARK_X1000_SSCR0_FRF (0x3 << 5)/* FRame Format (mask) */ +#define QUARK_X1000_SSCR0_Motorola (0x0 << 5)/* Motorola's Serial Peripheral Interface (SPI) */ + +#define RX_THRESH_QUARK_X1000_DFLT 1 +#define TX_THRESH_QUARK_X1000_DFLT 16 + +#define QUARK_X1000_SSSR_TFL_MASK (0x1F << 8)/* Transmit FIFO Level mask */ +#define QUARK_X1000_SSSR_RFL_MASK (0x1F << 13)/* Receive FIFO Level mask */ + +#define QUARK_X1000_SSCR1_TFT (0x1F << 6)/* Transmit FIFO Threshold (mask) */ +#define QUARK_X1000_SSCR1_TxTresh (x) (((x) - 1) << 6)/* level [1..32] */ +#define QUARK_X1000_SSCR1_RFT (0x1F << 11)/* Receive FIFO Threshold (mask) */ +#define QUARK_X1000_SSCR1_RxTresh (x) (((x) - 1) << 11)/* level [1..32] */ +#define QUARK_X1000_SSCR1_STRF (1 << 17)/* Select FIFO or EFWR */ +#define QUARK_X1000_SSCR1_EFWR (1 << 16)/* Enable FIFO Write/Read */ +#endif /* extra bits in PXA255, PXA26x and PXA27x SSP ports */
@@ -175,6 +195,7 @@ enum pxa_ssp_type {PXA910_SSP ,CE4100_SSP ,LPSS_SSP , + QUARK_X1000_SSP, }; struct ssp_device {
Signature · 1 line
1.7.9.5
Re: [PATCH 2/2 v3] SPI: spi-pxa2xx: SPI support for Intel Quark X1000
Hi Alvin,
Doesn't apply.
Applying: SPI: spi-pxa2xx: SPI support for Intel Quark X1000
error: patch failed: drivers/spi/spi-pxa2xx-pci.c:19
error: drivers/spi/spi-pxa2xx-pci.c: patch does not apply Patch failed at 0002 SPI: spi-pxa2xx: SPI support for Intel Quark X1000
--
Bryan
RE: [PATCH 2/2 v3] SPI: spi-pxa2xx: SPI support for Intel Quark X1000
Quoted 9 lines
Hi Alvin,
Doesn't apply.
Applying: SPI: spi-pxa2xx: SPI support for Intel Quark X1000
error: patch failed:drivers/spi/spi-pxa2xx-pci.c:19
error:drivers/spi/spi-pxa2xx-pci.c: patch does not apply Patch failed at 0002 SPI:
spi-pxa2xx: SPI support for Intel Quark X1000
It is based on the slave-dma tree (git.infraded.org) for-linus branch, which will be reapplied on top of v3.19-rc1. More information can be got from Andy.
Quoted 2 lines
--
Bryan
Andy Shevchenko
reviewerRe: [PATCH 2/2 v3] SPI: spi-pxa2xx: SPI support for Intel Quark X1000
Quoted 9 lines · Alvin
Quoted 7 lines
Doesn't apply.
Applying: SPI: spi-pxa2xx: SPI support for Intel Quark X1000
error: patch failed:drivers/spi/spi-pxa2xx-pci.c:19
error:drivers/spi/spi-pxa2xx-pci.c: patch does not apply Patch failed at 0002 SPI:
spi-pxa2xx: SPI support for Intel Quark X1000It is based on the slave-dma tree (git.infraded.org) for-linus branch, which will be reapplied on top of v3.19-rc1. More information can be got from Andy.
Actually if I understand correctly your series requires only one patch to be applied from topic/spi-pxa2xx branch by Chiau Ee, though you have to rearrange the code in the spi-pxa2xx-pci.c to not be closer to Braswell stuff.
But again, it's only my guessing, you may try to rebase it on top of topic branch mentioned above.
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
Hi Mark,
Any update for these patches? Just want to follow-up.
Best regards?Alvin Chen
ICFS Platform Engineering Solution
Flex Services (CMMI Level 3, IQA2005, IQA2008),?Greater Asia Region Intel Information Technology Tel. 010-82171960 inet.8-7581960
Email. alvin.chen at intel.com
Quoted 49 lines
-----Original Message-----
From: Chen, Alvin
Sent: Wednesday, October 8, 2014 11:50 PM
To: Eric Miao; Russell King; Haojian Zhuang; Mark Brown
Cc: linux-arm-kernel at lists.infradead.org; linux-spi at vger.kernel.org; linux-kernel at vger.kernel.org; Westerberg, Mika; Kweh, Hock Leong; Ong, Boon Leong; Tan, Raymond; Chen, Alvin; Andy Shevchenko
Subject: [PATCH 0/2 v3] SPI: spi-pxa2xx: Add support for Intel Quark X1000 SPI controllerHi,
Intel Quark X1000 consists of two SPI controllers which can be PCI enumerated. SPI-PXA2XX PCI layer doesn't support it. Thus, we add support for Intel Quark X1000 SPI as well.---
v3:
[PATCH 1/2]
* Improve the commit message.
* A couple of minor fixes.
[PATCH 2/2]
* Set '.num_chipselect' to '1' instead of '4'.
* A couple of minor fixes.v2:
Split into two patches: one is for helper functions, and another is for quark supporting.[PATCH 1/2]
* Add helper functions to access registers.
* Use 'switch' instead of 'if-else'. [PATCH 2/2]
* Use 'switch' instead of 'if-else'.
* Add comments for the 'dds'&'clk_div' caculation.
* A couple of minor fixes.Weike Chen (2):
SPI: spi-pxa2xx: Add helpers for regiseters' accessing
SPI: spi-pxa2xx: SPI support for Intel Quark X1000drivers/spi/spi-pxa2xx-pci.c | 8 ++ drivers/spi/spi-pxa2xx.c | 304 ++++++++++++++++++++++++++++++++++++------ drivers/spi/spi-pxa2xx.h | 16 ++- include/linux/pxa2xx_ssp.h | 21 +++ 4 files changed, 304 insertions(+), 45 deletions(-)--
1.7.9.5
Mark Brown
maintainerQuoted 3 lines · Alvin
Hi Mark,
Any update for these patches? Just want to follow-up.
Don't top post and allow a reasonable time for review, you are chasing
this after less than a week. This just sends more e-mail which wastes
my time.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141016/adb929fe/attachment.sig>