spi: pxa2xx: Use LPSS prefix for defines that are Intel LPSS specific
Subsystems (3)
PATCH 1/5 spi: pxa2xx: Use LPSS prefix for defines that are Intel LPSS specific
Rename a few defines that are specific to Intel LPSS SPI private registers with LPSS prefix. It makes easier to distinguish them from common defines.
--- drivers/spi/spi-pxa2xx.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/spi/spi-pxa2xx.c +8 -8
@@ -61,9 +61,9 @@ MODULE_ALIAS("platform:pxa2xx-spi"); | QUARK_X1000_SSCR1_TFT \ | SSCR1_SPH | SSCR1_SPO | SSCR1_LBM) -#define GENERAL_REG_RXTO_HOLDOFF_DISABLE BIT(24) -#define SPI_CS_CONTROL_SW_MODE BIT(0) -#define SPI_CS_CONTROL_CS_HIGH BIT(1) +#define LPSS_GENERAL_REG_RXTO_HOLDOFF_DISABLE BIT(24) +#define LPSS_CS_CONTROL_SW_MODE BIT(0) +#define LPSS_CS_CONTROL_CS_HIGH BIT(1)struct lpss_config {/* LPSS offset from drv_data->ioaddr */
@@ -250,8 +250,8 @@ static void lpss_ssp_setup(struct driver_data *drv_data)/* Enable software chip select control */ value =__lpss_ssp_read_priv (drv_data, config->reg_cs_ctrl); - value &= ~(SPI_CS_CONTROL_SW_MODE |SPI_CS_CONTROL_CS_HIGH ); - value |=SPI_CS_CONTROL_SW_MODE |SPI_CS_CONTROL_CS_HIGH ; + value &= ~(LPSS_CS_CONTROL_SW_MODE |LPSS_CS_CONTROL_CS_HIGH ); + value |=LPSS_CS_CONTROL_SW_MODE |LPSS_CS_CONTROL_CS_HIGH ;__lpss_ssp_write_priv (drv_data, config->reg_cs_ctrl, value);/* Enable multiblock DMA transfers */
@@ -261,7 +261,7 @@ static void lpss_ssp_setup(struct driver_data *drv_data)if (config->reg_general >=0 ) { value =__lpss_ssp_read_priv (drv_data, config->reg_general); - value |=GENERAL_REG_RXTO_HOLDOFF_DISABLE ; + value |=LPSS_GENERAL_REG_RXTO_HOLDOFF_DISABLE ;__lpss_ssp_write_priv (drv_data, config->reg_general, value); }
@@ -277,9 +277,9 @@ static void lpss_ssp_cs_control(struct driver_data *drv_data, bool enable) value =__lpss_ssp_read_priv (drv_data, config->reg_cs_ctrl);if (enable) - value &= ~SPI_CS_CONTROL_CS_HIGH ; + value &= ~LPSS_CS_CONTROL_CS_HIGH ;else - value |=SPI_CS_CONTROL_CS_HIGH ; + value |=LPSS_CS_CONTROL_CS_HIGH ;__lpss_ssp_write_priv (drv_data, config->reg_cs_ctrl, value); }
Signature · 6 lines
2.6.1 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/5 spi: pxa2xx: Add output control for multiple Intel LPSS chip selects
In reply to a message not in the archiveIntel LPSS SPI host controllers in upcoming Intel platforms can have up to 4 chip selects per port. Extend chip select control in lpss_ssp_cs_control() by adding a code that selects the active chip select output prior to changing the state. Detection for number of enabled chip select signals will be added by another patch.
--- drivers/spi/spi-pxa2xx.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-)
drivers/spi/spi-pxa2xx.c +24 -3
@@ -64,6 +64,8 @@ MODULE_ALIAS("platform:pxa2xx-spi");#define LPSS_GENERAL_REG_RXTO_HOLDOFF_DISABLE BIT(24)#define LPSS_CS_CONTROL_SW_MODE BIT(0)#define LPSS_CS_CONTROL_CS_HIGH BIT(1) +#define LPSS_CS_CONTROL_CS_SEL_SHIFT 8 +#define LPSS_CS_CONTROL_CS_SEL_MASK (3 << LPSS_CS_CONTROL_CS_SEL_SHIFT)struct lpss_config {/* LPSS offset from drv_data->ioaddr */
@@ -271,15 +273,34 @@ static void lpss_ssp_setup(struct driver_data *drv_data)static void lpss_ssp_cs_control (struct driver_data *drv_data,bool enable) {const struct lpss_config *config; -u32 value; +u32 value, cs; config =lpss_get_config (drv_data); value =__lpss_ssp_read_priv (drv_data, config->reg_cs_ctrl); -if (enable) +if (enable) { + cs = drv_data->cur_msg->spi->chip_select; + cs <<=LPSS_CS_CONTROL_CS_SEL_SHIFT ; +if (cs != (value &LPSS_CS_CONTROL_CS_SEL_MASK )) { +/* +* When switching another chip select output active +* the output must be selected first and wait 2 ssp_clk +* cycles before changing state to active. Otherwise +* a short glitch will occur on the previous chip +* select since output select is latched but state +* control is not. +*/ + value &= ~LPSS_CS_CONTROL_CS_SEL_MASK ; + value |= cs; +__lpss_ssp_write_priv (drv_data, + config->reg_cs_ctrl, value); +ndelay (1000000000 / + (drv_data->master->max_speed_hz /2 )); + } value &= ~LPSS_CS_CONTROL_CS_HIGH ; -else + }else { value |=LPSS_CS_CONTROL_CS_HIGH ; + }__lpss_ssp_write_priv (drv_data, config->reg_cs_ctrl, value); }
Signature · 6 lines
2.6.1 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/5 spi: pxa2xx: Detect number of enabled Intel LPSS SPI chip select signals
In reply to a message not in the archiveSPI capabilities register located in private registers space of newer Intel LPSS SPI host controllers tell in register bits 12:9 which chip select signals are enabled.
Use that information for detecting the number of chip selects. For simplicity we assume chip selects are enabled one after another without disabled chip selects between. For instance CS0 | CS1 | CS2 but not CS0 | CS1 | CS3.
--- drivers/spi/spi-pxa2xx.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
drivers/spi/spi-pxa2xx.c +21 -1
@@ -13,6 +13,7 @@* GNU General Public License for more details. */ +#include <linux/bitops.h> #include <linux/init.h> #include <linux/module.h> #include <linux/device.h>
@@ -66,6 +67,8 @@ MODULE_ALIAS("platform:pxa2xx-spi");#define LPSS_CS_CONTROL_CS_HIGH BIT(1)#define LPSS_CS_CONTROL_CS_SEL_SHIFT 8#define LPSS_CS_CONTROL_CS_SEL_MASK (3 << LPSS_CS_CONTROL_CS_SEL_SHIFT) +#define LPSS_CAPS_CS_EN_SHIFT 9 +#define LPSS_CAPS_CS_EN_MASK (0xf << LPSS_CAPS_CS_EN_SHIFT)struct lpss_config {/* LPSS offset from drv_data->ioaddr */
@@ -74,6 +77,7 @@ struct lpss_config {int reg_general;int reg_ssp;int reg_cs_ctrl; +int reg_capabilities;/* FIFO thresholds */ u32 rx_threshold;u32 tx_threshold_lo;
@@ -87,6 +91,7 @@ static const struct lpss_config lpss_platforms[] = { .reg_general = 0x08, .reg_ssp = 0x0c, .reg_cs_ctrl = 0x18, + .reg_capabilities = -1, .rx_threshold = 64, .tx_threshold_lo = 160, .tx_threshold_hi = 224,
@@ -96,6 +101,7 @@ static const struct lpss_config lpss_platforms[] = { .reg_general = 0x08, .reg_ssp = 0x0c, .reg_cs_ctrl = 0x18, + .reg_capabilities = -1, .rx_threshold = 64, .tx_threshold_lo = 160, .tx_threshold_hi = 224,
@@ -105,6 +111,7 @@ static const struct lpss_config lpss_platforms[] = { .reg_general = -1, .reg_ssp = 0x20, .reg_cs_ctrl = 0x24, + .reg_capabilities = 0xfc, .rx_threshold = 1, .tx_threshold_lo = 32, .tx_threshold_hi = 56,
@@ -1404,6 +1411,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)struct spi_master *master;struct driver_data *drv_data;struct ssp_device *ssp; +const struct lpss_config *config;int status;u32 tmp;
@@ -1443,7 +1451,6 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) master->mode_bits =SPI_CPOL |SPI_CPHA |SPI_CS_HIGH |SPI_LOOP ; master->bus_num = ssp->port_id; - master->num_chipselect = platform_info->num_chipselect; master->dma_alignment =DMA_ALIGNMENT ; master->cleanup = cleanup; master->setup = setup;
@@ -1529,6 +1536,19 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)if (is_lpss_ssp (drv_data))lpss_ssp_setup (drv_data); +if (is_lpss_ssp (drv_data)) { +lpss_ssp_setup (drv_data); + config =lpss_get_config (drv_data); +if (config->reg_capabilities >=0 ) { + tmp =__lpss_ssp_read_priv (drv_data, + config->reg_capabilities); + tmp &=LPSS_CAPS_CS_EN_MASK ; + tmp >>=LPSS_CAPS_CS_EN_SHIFT ; + platform_info->num_chipselect =ffz (tmp); + } + } + master->num_chipselect = platform_info->num_chipselect; +tasklet_init (&drv_data->pump_transfers, pump_transfers, (unsigned long )drv_data);
Signature · 6 lines
2.6.1 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 4/5 spi: pxa2xx: Add support for Intel Broxton
In reply to a message not in the archiveLPSS SPI in Intel Broxton is otherwise the same than in Intel Sunrisepoint but it supports up to four chip selects per port and has different FIFO thresholds. Patch adds support for two Broxton SoC variants.
--- drivers/spi/spi-pxa2xx.c | 20 ++++++++++++++++++++ include/linux/pxa2xx_ssp.h | 1 + 2 files changed, 21 insertions(+)
drivers/spi/spi-pxa2xx.c +20 -0
@@ -116,6 +116,16 @@ static const struct lpss_config lpss_platforms[] = { .tx_threshold_lo = 32, .tx_threshold_hi = 56, }, + {/* LPSS_BXT_SSP */ + .offset = 0x200, + .reg_general = -1, + .reg_ssp = 0x20, + .reg_cs_ctrl = 0x24, + .reg_capabilities = 0xfc, + .rx_threshold = 1, + .tx_threshold_lo = 16, + .tx_threshold_hi = 48, + }, }; static inline const struct lpss_config
@@ -130,6 +140,7 @@ static bool is_lpss_ssp(const struct driver_data *drv_data)case LPSS_LPT_SSP :case LPSS_BYT_SSP :case LPSS_SPT_SSP : +case LPSS_BXT_SSP :return true;default :return false;
@@ -1156,6 +1167,7 @@ static int setup(struct spi_device *spi)case LPSS_LPT_SSP :case LPSS_BYT_SSP :case LPSS_SPT_SSP : +case LPSS_BXT_SSP : config =lpss_get_config (drv_data); tx_thres = config->tx_threshold_lo; tx_hi_thres = config->tx_threshold_hi;
@@ -1317,6 +1329,14 @@ static const struct pci_device_id pxa2xx_spi_pci_compound_match[] = {/* SPT-H */ { PCI_VDEVICE(INTEL, 0xa129), LPSS_SPT_SSP }, { PCI_VDEVICE(INTEL, 0xa12a), LPSS_SPT_SSP }, +/* BXT */ + { PCI_VDEVICE(INTEL, 0x0ac2), LPSS_BXT_SSP }, + { PCI_VDEVICE(INTEL, 0x0ac4), LPSS_BXT_SSP }, + { PCI_VDEVICE(INTEL, 0x0ac6), LPSS_BXT_SSP }, +/* APL */ + { PCI_VDEVICE(INTEL, 0x5ac2), LPSS_BXT_SSP }, + { PCI_VDEVICE(INTEL, 0x5ac4), LPSS_BXT_SSP }, + { PCI_VDEVICE(INTEL, 0x5ac6), LPSS_BXT_SSP }, { }, };
include/linux/pxa2xx_ssp.h +1 -0
@@ -198,6 +198,7 @@ enum pxa_ssp_type {LPSS_LPT_SSP ,/* Keep LPSS types sorted with lpss_platforms[] */ LPSS_BYT_SSP ,LPSS_SPT_SSP , + LPSS_BXT_SSP, }; struct ssp_device {
Signature · 6 lines
2.6.1 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 5/5 spi: pxa2xx: Rework self-initiated platform data creation for non-ACPI
In reply to a message not in the archiveExtend the pxa2xx_spi_acpi_get_pdata() so that it can create platform data also on platforms that do not support ACPI or if CONFIG_ACPI is not set. Now it is expected that "pxa2xx-spi" platform device is either created with explicit platform data or has an ACPI companion device.
However there is only little in pxa2xx_spi_acpi_get_pdata() that is really dependent on ACPI companion and it can be reworked to cover also cases where "pxa2xx-spi" device doesn't have ACPI companion and is created without platform data.
Do this by renaming the pxa2xx_spi_acpi_get_pdata(), moving it outside of CONFIG_ACPI test and changing a few runtime tests there to support non-ACPI case. Only port/bus ID setting based on ACPI _UID is dependent on ACPI and is moved to own function inside CONFIG_ACPI.
Purpose of this to support non-ACPI case for those PCI enumerated compound devices that integrate both LPSS SPI host controller and integrated DMA engine under the same PCI ID and which are registered in MFD layer instead of in spi-pxa2xx-pci.c.
--- drivers/spi/spi-pxa2xx.c | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-)
drivers/spi/spi-pxa2xx.c +26 -12
@@ -1304,6 +1304,7 @@ static void cleanup(struct spi_device *spi)kfree (chip); } +#ifdef CONFIG_PCI #ifdef CONFIG_ACPI static const struct acpi_device_id pxa2xx_spi_acpi_match[] = {
@@ -1317,6 +1318,23 @@ static const struct acpi_device_id pxa2xx_spi_acpi_match[] = { };MODULE_DEVICE_TABLE (acpi, pxa2xx_spi_acpi_match); +static int pxa2xx_spi_get_port_id (struct acpi_device *adev) +{ +unsigned int devid; +int port_id =-1 ; + +if (adev && adev->pnp.unique_id && + !kstrtouint (adev->pnp.unique_id,0 , &devid)) + port_id = devid; +return port_id; +} +#else /* !CONFIG_ACPI */ +static int pxa2xx_spi_get_port_id (struct acpi_device *adev) +{ +return -1 ; +} +#endif +/* * PCI IDs of compound devices that integrate both host controller and private * integrated DMA engine. Please note these are not used in module
@@ -1351,7 +1369,7 @@ static bool pxa2xx_spi_idma_filter(struct dma_chan *chan, void *param) }static struct pxa2xx_spi_master * -pxa2xx_spi_acpi_get_pdata (struct platform_device *pdev) +pxa2xx_spi_init_pdata (struct platform_device *pdev) {struct pxa2xx_spi_master *pdata;struct acpi_device *adev;
@@ -1359,19 +1377,18 @@ pxa2xx_spi_acpi_get_pdata(struct platform_device *pdev)struct resource *res;const struct acpi_device_id *adev_id =NULL ;const struct pci_device_id *pcidev_id =NULL ; -unsigned int devid;int type; adev =ACPI_COMPANION (&pdev->dev); -if (!adev) -return NULL ;if (dev_is_pci (pdev->dev.parent)) pcidev_id =pci_match_id (pxa2xx_spi_pci_compound_match,to_pci_dev (pdev->dev.parent)); -else +else if (adev) adev_id =acpi_match_device (pdev->dev.driver->acpi_match_table, &pdev->dev); +else +return NULL ;if (adev_id) type = (int )adev_id->driver_data;
@@ -1405,10 +1422,7 @@ pxa2xx_spi_acpi_get_pdata(struct platform_device *pdev) ssp->irq =platform_get_irq (pdev,0 ); ssp->type = type; ssp->pdev = pdev; - - ssp->port_id =-1 ; -if (adev->pnp.unique_id && !kstrtouint (adev->pnp.unique_id,0 , &devid)) - ssp->port_id = devid; + ssp->port_id =pxa2xx_spi_get_port_id (adev); pdata->num_chipselect =1 ; pdata->enable_dma = true;
@@ -1416,9 +1430,9 @@ pxa2xx_spi_acpi_get_pdata(struct platform_device *pdev) return pdata; } -#else +#else /* !CONFIG_PCI */ static inline struct pxa2xx_spi_master * -pxa2xx_spi_acpi_get_pdata (struct platform_device *pdev) +pxa2xx_spi_init_pdata (struct platform_device *pdev) {return NULL ; }
@@ -1437,7 +1451,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) platform_info =dev_get_platdata (dev);if (!platform_info) { - platform_info =pxa2xx_spi_acpi_get_pdata (pdev); + platform_info =pxa2xx_spi_init_pdata (pdev);if (!platform_info) {dev_err (&pdev->dev,"missing platform data\n" );return -ENODEV ;
Signature · 6 lines
2.6.1 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 5/5] spi: pxa2xx: Rework self-initiated platform data creation for non-ACPI
In reply to a message not in the archiveThe patch
spi: pxa2xx: Rework self-initiated platform data creation for non-ACPI
has been applied to the spi tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
0db642151ad80967e9e1c2abf3e19bd7902ecdc9Mon Sep 17 00:00:00 2001
From: Jarkko Nikula <jarkko.nikula-VuQAYsv1563Yd54FQh9/[email protected]>
Date: Wed, 28 Oct 2015 15:13:43 +0200
Subject: [PATCH] spi: pxa2xx: Rework self-initiated platform data creation for
non-ACPI
Extend the pxa2xx_spi_acpi_get_pdata() so that it can create platform data also on platforms that do not support ACPI or if CONFIG_ACPI is not set. Now it is expected that "pxa2xx-spi" platform device is either created with explicit platform data or has an ACPI companion device.
However there is only little in pxa2xx_spi_acpi_get_pdata() that is really dependent on ACPI companion and it can be reworked to cover also cases where "pxa2xx-spi" device doesn't have ACPI companion and is created without platform data.
Do this by renaming the pxa2xx_spi_acpi_get_pdata(), moving it outside of CONFIG_ACPI test and changing a few runtime tests there to support non-ACPI case. Only port/bus ID setting based on ACPI _UID is dependent on ACPI and is moved to own function inside CONFIG_ACPI.
Purpose of this to support non-ACPI case for those PCI enumerated compound devices that integrate both LPSS SPI host controller and integrated DMA engine under the same PCI ID and which are registered in MFD layer instead of in spi-pxa2xx-pci.c.
--- drivers/spi/spi-pxa2xx.c | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-)
drivers/spi/spi-pxa2xx.c +26 -12
@@ -1300,6 +1300,7 @@ static void cleanup(struct spi_device *spi)kfree (chip); } +#ifdef CONFIG_PCI #ifdef CONFIG_ACPI static const struct acpi_device_id pxa2xx_spi_acpi_match[] = {
@@ -1313,6 +1314,23 @@ static const struct acpi_device_id pxa2xx_spi_acpi_match[] = { };MODULE_DEVICE_TABLE (acpi, pxa2xx_spi_acpi_match); +static int pxa2xx_spi_get_port_id (struct acpi_device *adev) +{ +unsigned int devid; +int port_id =-1 ; + +if (adev && adev->pnp.unique_id && + !kstrtouint (adev->pnp.unique_id,0 , &devid)) + port_id = devid; +return port_id; +} +#else /* !CONFIG_ACPI */ +static int pxa2xx_spi_get_port_id (struct acpi_device *adev) +{ +return -1 ; +} +#endif +/* * PCI IDs of compound devices that integrate both host controller and private * integrated DMA engine. Please note these are not used in module
@@ -1347,7 +1365,7 @@ static bool pxa2xx_spi_idma_filter(struct dma_chan *chan, void *param) }static struct pxa2xx_spi_master * -pxa2xx_spi_acpi_get_pdata (struct platform_device *pdev) +pxa2xx_spi_init_pdata (struct platform_device *pdev) {struct pxa2xx_spi_master *pdata;struct acpi_device *adev;
@@ -1355,19 +1373,18 @@ pxa2xx_spi_acpi_get_pdata(struct platform_device *pdev)struct resource *res;const struct acpi_device_id *adev_id =NULL ;const struct pci_device_id *pcidev_id =NULL ; -unsigned int devid;int type; adev =ACPI_COMPANION (&pdev->dev); -if (!adev) -return NULL ;if (dev_is_pci (pdev->dev.parent)) pcidev_id =pci_match_id (pxa2xx_spi_pci_compound_match,to_pci_dev (pdev->dev.parent)); -else +else if (adev) adev_id =acpi_match_device (pdev->dev.driver->acpi_match_table, &pdev->dev); +else +return NULL ;if (adev_id) type = (int )adev_id->driver_data;
@@ -1401,10 +1418,7 @@ pxa2xx_spi_acpi_get_pdata(struct platform_device *pdev) ssp->irq =platform_get_irq (pdev,0 ); ssp->type = type; ssp->pdev = pdev; - - ssp->port_id =-1 ; -if (adev->pnp.unique_id && !kstrtouint (adev->pnp.unique_id,0 , &devid)) - ssp->port_id = devid; + ssp->port_id =pxa2xx_spi_get_port_id (adev); pdata->num_chipselect =1 ; pdata->enable_dma = true;
@@ -1412,9 +1426,9 @@ pxa2xx_spi_acpi_get_pdata(struct platform_device *pdev) return pdata; } -#else +#else /* !CONFIG_PCI */ static inline struct pxa2xx_spi_master * -pxa2xx_spi_acpi_get_pdata (struct platform_device *pdev) +pxa2xx_spi_init_pdata (struct platform_device *pdev) {return NULL ; }
@@ -1433,7 +1447,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) platform_info =dev_get_platdata (dev);if (!platform_info) { - platform_info =pxa2xx_spi_acpi_get_pdata (pdev); + platform_info =pxa2xx_spi_init_pdata (pdev);if (!platform_info) {dev_err (&pdev->dev,"missing platform data\n" );return -ENODEV ;
Signature · 6 lines
2.6.1 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/5] spi: pxa2xx: Detect number of enabled Intel LPSS SPI chip select signals
In reply to a message not in the archiveThe patch
spi: pxa2xx: Detect number of enabled Intel LPSS SPI chip select signals
has been applied to the spi tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
8b136baa5892f25bba0373d6eb0f5f84efc93986Mon Sep 17 00:00:00 2001
From: Jarkko Nikula <jarkko.nikula-VuQAYsv1563Yd54FQh9/[email protected]>
Date: Wed, 28 Oct 2015 15:13:41 +0200
Subject: [PATCH] spi: pxa2xx: Detect number of enabled Intel LPSS SPI chip
select signals
SPI capabilities register located in private registers space of newer Intel LPSS SPI host controllers tell in register bits 12:9 which chip select signals are enabled.
Use that information for detecting the number of chip selects. For simplicity we assume chip selects are enabled one after another without disabled chip selects between. For instance CS0 | CS1 | CS2 but not CS0 | CS1 | CS3.
--- drivers/spi/spi-pxa2xx.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
drivers/spi/spi-pxa2xx.c +21 -1
@@ -13,6 +13,7 @@* GNU General Public License for more details. */ +#include <linux/bitops.h> #include <linux/init.h> #include <linux/module.h> #include <linux/device.h>
@@ -66,6 +67,8 @@ MODULE_ALIAS("platform:pxa2xx-spi");#define LPSS_CS_CONTROL_CS_HIGH BIT(1)#define LPSS_CS_CONTROL_CS_SEL_SHIFT 8#define LPSS_CS_CONTROL_CS_SEL_MASK (3 << LPSS_CS_CONTROL_CS_SEL_SHIFT) +#define LPSS_CAPS_CS_EN_SHIFT 9 +#define LPSS_CAPS_CS_EN_MASK (0xf << LPSS_CAPS_CS_EN_SHIFT)struct lpss_config {/* LPSS offset from drv_data->ioaddr */
@@ -74,6 +77,7 @@ struct lpss_config {int reg_general;int reg_ssp;int reg_cs_ctrl; +int reg_capabilities;/* FIFO thresholds */ u32 rx_threshold;u32 tx_threshold_lo;
@@ -87,6 +91,7 @@ static const struct lpss_config lpss_platforms[] = { .reg_general = 0x08, .reg_ssp = 0x0c, .reg_cs_ctrl = 0x18, + .reg_capabilities = -1, .rx_threshold = 64, .tx_threshold_lo = 160, .tx_threshold_hi = 224,
@@ -96,6 +101,7 @@ static const struct lpss_config lpss_platforms[] = { .reg_general = 0x08, .reg_ssp = 0x0c, .reg_cs_ctrl = 0x18, + .reg_capabilities = -1, .rx_threshold = 64, .tx_threshold_lo = 160, .tx_threshold_hi = 224,
@@ -105,6 +111,7 @@ static const struct lpss_config lpss_platforms[] = { .reg_general = -1, .reg_ssp = 0x20, .reg_cs_ctrl = 0x24, + .reg_capabilities = 0xfc, .rx_threshold = 1, .tx_threshold_lo = 32, .tx_threshold_hi = 56,
@@ -1400,6 +1407,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)struct spi_master *master;struct driver_data *drv_data;struct ssp_device *ssp; +const struct lpss_config *config;int status;u32 tmp;
@@ -1439,7 +1447,6 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) master->mode_bits =SPI_CPOL |SPI_CPHA |SPI_CS_HIGH |SPI_LOOP ; master->bus_num = ssp->port_id; - master->num_chipselect = platform_info->num_chipselect; master->dma_alignment =DMA_ALIGNMENT ; master->cleanup = cleanup; master->setup = setup;
@@ -1525,6 +1532,19 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)if (is_lpss_ssp (drv_data))lpss_ssp_setup (drv_data); +if (is_lpss_ssp (drv_data)) { +lpss_ssp_setup (drv_data); + config =lpss_get_config (drv_data); +if (config->reg_capabilities >=0 ) { + tmp =__lpss_ssp_read_priv (drv_data, + config->reg_capabilities); + tmp &=LPSS_CAPS_CS_EN_MASK ; + tmp >>=LPSS_CAPS_CS_EN_SHIFT ; + platform_info->num_chipselect =ffz (tmp); + } + } + master->num_chipselect = platform_info->num_chipselect; +tasklet_init (&drv_data->pump_transfers, pump_transfers, (unsigned long )drv_data);
Signature · 6 lines
2.6.1 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/5] spi: pxa2xx: Add output control for multiple Intel LPSS chip selects
In reply to a message not in the archiveThe patch
spi: pxa2xx: Add output control for multiple Intel LPSS chip selects
has been applied to the spi tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
d0283eb2dbc11ec08375fdf6a436e96d25b3a593Mon Sep 17 00:00:00 2001
From: Jarkko Nikula <jarkko.nikula-VuQAYsv1563Yd54FQh9/[email protected]>
Date: Wed, 28 Oct 2015 15:13:40 +0200
Subject: [PATCH] spi: pxa2xx: Add output control for multiple Intel LPSS chip
selects
Intel LPSS SPI host controllers in upcoming Intel platforms can have up to 4 chip selects per port. Extend chip select control in lpss_ssp_cs_control() by adding a code that selects the active chip select output prior to changing the state. Detection for number of enabled chip select signals will be added by another patch.
--- drivers/spi/spi-pxa2xx.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-)
drivers/spi/spi-pxa2xx.c +24 -3
@@ -64,6 +64,8 @@ MODULE_ALIAS("platform:pxa2xx-spi");#define LPSS_GENERAL_REG_RXTO_HOLDOFF_DISABLE BIT(24)#define LPSS_CS_CONTROL_SW_MODE BIT(0)#define LPSS_CS_CONTROL_CS_HIGH BIT(1) +#define LPSS_CS_CONTROL_CS_SEL_SHIFT 8 +#define LPSS_CS_CONTROL_CS_SEL_MASK (3 << LPSS_CS_CONTROL_CS_SEL_SHIFT)struct lpss_config {/* LPSS offset from drv_data->ioaddr */
@@ -271,15 +273,34 @@ static void lpss_ssp_setup(struct driver_data *drv_data)static void lpss_ssp_cs_control (struct driver_data *drv_data,bool enable) {const struct lpss_config *config; -u32 value; +u32 value, cs; config =lpss_get_config (drv_data); value =__lpss_ssp_read_priv (drv_data, config->reg_cs_ctrl); -if (enable) +if (enable) { + cs = drv_data->cur_msg->spi->chip_select; + cs <<=LPSS_CS_CONTROL_CS_SEL_SHIFT ; +if (cs != (value &LPSS_CS_CONTROL_CS_SEL_MASK )) { +/* +* When switching another chip select output active +* the output must be selected first and wait 2 ssp_clk +* cycles before changing state to active. Otherwise +* a short glitch will occur on the previous chip +* select since output select is latched but state +* control is not. +*/ + value &= ~LPSS_CS_CONTROL_CS_SEL_MASK ; + value |= cs; +__lpss_ssp_write_priv (drv_data, + config->reg_cs_ctrl, value); +ndelay (1000000000 / + (drv_data->master->max_speed_hz /2 )); + } value &= ~LPSS_CS_CONTROL_CS_HIGH ; -else + }else { value |=LPSS_CS_CONTROL_CS_HIGH ; + }__lpss_ssp_write_priv (drv_data, config->reg_cs_ctrl, value); }
Signature · 6 lines
2.6.1 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
The patch
spi: pxa2xx: Use LPSS prefix for defines that are Intel LPSS specific
has been applied to the spi tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
624ea72ebddc1f61d32c9e6265f8d6f6dacd26d6Mon Sep 17 00:00:00 2001
From: Jarkko Nikula <jarkko.nikula-VuQAYsv1563Yd54FQh9/[email protected]>
Date: Wed, 28 Oct 2015 15:13:39 +0200
Subject: [PATCH] spi: pxa2xx: Use LPSS prefix for defines that are Intel LPSS
specific
Rename a few defines that are specific to Intel LPSS SPI private registers with LPSS prefix. It makes easier to distinguish them from common defines.
--- drivers/spi/spi-pxa2xx.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/spi/spi-pxa2xx.c +8 -8
@@ -61,9 +61,9 @@ MODULE_ALIAS("platform:pxa2xx-spi"); | QUARK_X1000_SSCR1_TFT \ | SSCR1_SPH | SSCR1_SPO | SSCR1_LBM) -#define GENERAL_REG_RXTO_HOLDOFF_DISABLE BIT(24) -#define SPI_CS_CONTROL_SW_MODE BIT(0) -#define SPI_CS_CONTROL_CS_HIGH BIT(1) +#define LPSS_GENERAL_REG_RXTO_HOLDOFF_DISABLE BIT(24) +#define LPSS_CS_CONTROL_SW_MODE BIT(0) +#define LPSS_CS_CONTROL_CS_HIGH BIT(1)struct lpss_config {/* LPSS offset from drv_data->ioaddr */
@@ -250,8 +250,8 @@ static void lpss_ssp_setup(struct driver_data *drv_data)/* Enable software chip select control */ value =__lpss_ssp_read_priv (drv_data, config->reg_cs_ctrl); - value &= ~(SPI_CS_CONTROL_SW_MODE |SPI_CS_CONTROL_CS_HIGH ); - value |=SPI_CS_CONTROL_SW_MODE |SPI_CS_CONTROL_CS_HIGH ; + value &= ~(LPSS_CS_CONTROL_SW_MODE |LPSS_CS_CONTROL_CS_HIGH ); + value |=LPSS_CS_CONTROL_SW_MODE |LPSS_CS_CONTROL_CS_HIGH ;__lpss_ssp_write_priv (drv_data, config->reg_cs_ctrl, value);/* Enable multiblock DMA transfers */
@@ -261,7 +261,7 @@ static void lpss_ssp_setup(struct driver_data *drv_data)if (config->reg_general >=0 ) { value =__lpss_ssp_read_priv (drv_data, config->reg_general); - value |=GENERAL_REG_RXTO_HOLDOFF_DISABLE ; + value |=LPSS_GENERAL_REG_RXTO_HOLDOFF_DISABLE ;__lpss_ssp_write_priv (drv_data, config->reg_general, value); }
@@ -277,9 +277,9 @@ static void lpss_ssp_cs_control(struct driver_data *drv_data, bool enable) value =__lpss_ssp_read_priv (drv_data, config->reg_cs_ctrl);if (enable) - value &= ~SPI_CS_CONTROL_CS_HIGH ; + value &= ~LPSS_CS_CONTROL_CS_HIGH ;else - value |=SPI_CS_CONTROL_CS_HIGH ; + value |=LPSS_CS_CONTROL_CS_HIGH ;__lpss_ssp_write_priv (drv_data, config->reg_cs_ctrl, value); }
Signature · 6 lines
2.6.1 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html