summaryrefslogtreecommitdiffstats
path: root/drivers/misc/mchp_pci1xxxx (follow)
Commit message (Collapse)AuthorAgeFilesLines
* misc: microchip: pci1xxxx: Fix some NULL vs IS_ERR() bugsDan Carpenter2023-08-121-4/+4
| | | | | | | | | | The devm_nvmem_register() function returns error pointers. It never returns NULL. Update the checks accordingly. Fixes: 0969001569e4 ("misc: microchip: pci1xxxx: Add support to read and write into PCI1XXXX OTP via NVMEM sysfs") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/043df330-222b-4c2c-ae19-ed2f731bfe0b@moroto.mountain Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* misc: microchip: pci1xxxx: Add support to read and write into PCI1XXXX ↵Kumaravel Thiagarajan2023-08-041-0/+140
| | | | | | | | | | | | | | | | | | EEPROM via NVMEM sysfs Microchip's pci1xxxx is an unmanaged PCIe3.1a switch for consumer, industrial, and automotive applications. This switch integrates OTP and EEPROM to enable customization of the part in the field. This patch adds support to read and write into PCI1XXXX EEPROM via NVMEM sysfs. Signed-off-by: Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com> Co-developed-by: Tharun Kumar P <tharunkumar.pasumarthi@microchip.com> Signed-off-by: Tharun Kumar P <tharunkumar.pasumarthi@microchip.com> Co-developed-by: Vaibhaav Ram T.L <vaibhaavram.tl@microchip.com> Signed-off-by: Vaibhaav Ram T.L <vaibhaavram.tl@microchip.com> Link: https://lore.kernel.org/r/20230620143520.858-3-vaibhaavram.tl@microchip.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* misc: microchip: pci1xxxx: Add support to read and write into PCI1XXXX OTP ↵Kumaravel Thiagarajan2023-08-043-1/+305
| | | | | | | | | | | | | | | | | via NVMEM sysfs Microchip's pci1xxxx is an unmanaged PCIe3.1a switch for consumer, industrial, and automotive applications. This switch integrates OTP and EEPROM to enable customization of the part in the field. This patch adds support to read and write into PCI1XXXX OTP via NVMEM sysfs. Signed-off-by: Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com> Co-developed-by: Tharun Kumar P <tharunkumar.pasumarthi@microchip.com> Signed-off-by: Tharun Kumar P <tharunkumar.pasumarthi@microchip.com> Co-developed-by: Vaibhaav Ram T.L <vaibhaavram.tl@microchip.com> Signed-off-by: Vaibhaav Ram T.L <vaibhaavram.tl@microchip.com> Link: https://lore.kernel.org/r/20230620143520.858-2-vaibhaavram.tl@microchip.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* misc: microchip: pci1xxxx: Convert to immutable irqchipLinus Walleij2023-03-091-2/+8
| | | | | | | | | | | | Convert the driver to immutable irq-chip with a bit of intuition. Cc: linux-gpio@vger.kernel.org Cc: Marc Zyngier <maz@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20230223133252.2257276-1-linus.walleij@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* misc: microchip: pci1xxxx: Fix a memory leak in the error handling of ↵Christophe JAILLET2022-09-221-2/+1
| | | | | | | | | | | | | | | gp_aux_bus_probe() 'aux_bus' is freed in the remove function but not in the error handling path of the probe. Use devm_kzalloc() to simplify the remove function and fix the leak in the probe. Fixes: 393fc2f5948f ("misc: microchip: pci1xxxx: load auxiliary bus driver for the PIO function in the multi-function endpoint of pci1xxxx device.") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/17e19926669a1654e5f2495bf3b289581183d02e.1663482259.git.christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* misc: microchip: pci1xxxx: Do not disable the pci device twice in ↵Christophe JAILLET2022-09-221-1/+0
| | | | | | | | | | | | gp_aux_bus_remove() gp_aux_bus_probe() uses pcim_enable_device(), so there is no point in calling pci_disable_device() explicitly in the remove function. Fixes: 393fc2f5948f ("misc: microchip: pci1xxxx: load auxiliary bus driver for the PIO function in the multi-function endpoint of pci1xxxx device.") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/8a3a385b3ae15ee7497469ec3250302b626a018b.1663482259.git.christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* misc: microchip: pci1xxxx: use DEFINE_SIMPLE_DEV_PM_OPS() in place of the ↵Kumaravel Thiagarajan2022-09-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | SIMPLE_DEV_PM_OPS() in pci1xxxx's gpio driver build errors listed below and reported by Sudip Mukherjee <sudipm.mukherjee@gmail.com> for the builds of riscv, s390, csky, alpha and loongarch allmodconfig are fixed in this patch. drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c:311:12: error: 'pci1xxxx_gpio_resume' defined but not used [-Werror=unused-function] 311 | static int pci1xxxx_gpio_resume(struct device *dev) | ^~~~~~~~~~~~~~~~~~~~ drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c:295:12: error: 'pci1xxxx_gpio_suspend' defined but not used [-Werror=unused-function] 295 | static int pci1xxxx_gpio_suspend(struct device *dev) | ^~~~~~~~~~~~~~~~~~~~~ Fixes: 4ec7ac90ff39 ("misc: microchip: pci1xxxx: Add power management functions - suspend & resume handlers.") Reported-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com> Signed-off-by: Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com> Link: https://lore.kernel.org/r/20220915094729.646185-1-kumaravel.thiagarajan@microchip.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* misc: microchip: pci1xxxx: Remove duplicate includeYihao Han2022-09-221-1/+0
| | | | | | | | | | Remove duplicate include in mchp_pci1xxxx_gpio.c Fixes: 7d3e4d807df2 ("misc: microchip: pci1xxxx: load gpio driver for the gpio controller auxiliary device enumerated by the auxiliary bus driver.") Reviewed-by: Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com> Signed-off-by: Yihao Han <hanyihao@vivo.com> Link: https://lore.kernel.org/r/20220913030257.22352-1-hanyihao@vivo.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* misc: microchip: pci1xxxx: use module_auxiliary_driverWei Yongjun2022-09-091-13/+1
| | | | | | | | | | | Use the module_auxiliary_driver() macro to make the code simpler by eliminating module_init and module_exit calls. Fixes: 7d3e4d807df2 ("misc: microchip: pci1xxxx: load gpio driver for the gpio controller auxiliary device enumerated by the auxiliary bus driver.") Reviewed-by: Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Link: https://lore.kernel.org/r/20220907145808.1789249-5-weiyongjun@huaweicloud.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* misc: microchip: pci1xxxx: Add missing MODULE_DEVICE_TABLEWei Yongjun2022-09-091-0/+1
| | | | | | | | | | | | This patch adds missing MODULE_DEVICE_TABLE definition which generates correct modalias for automatic loading of this driver when it is built as an external module. Fixes: 7d3e4d807df2 ("misc: microchip: pci1xxxx: load gpio driver for the gpio controller auxiliary device enumerated by the auxiliary bus driver.") Reviewed-by: Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Link: https://lore.kernel.org/r/20220907145808.1789249-4-weiyongjun@huaweicloud.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* misc: microchip: pci1xxxx: Make symbol 'pci1xxxx_gpio_auxiliary_id_table' staticWei Yongjun2022-09-091-1/+1
| | | | | | | | | | | | | | | | The sparse tool complains as follows: drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c:409:34: warning: symbol 'pci1xxxx_gpio_auxiliary_id_table' was not declared. Should it be static? This symbol is not used outside of mchp_pci1xxxx_gpio.c, so marks it static. Fixes: 7d3e4d807df2 ("misc: microchip: pci1xxxx: load gpio driver for the gpio controller auxiliary device enumerated by the auxiliary bus driver.") Reported-by: kernel test robot <lkp@intel.com> Reviewed-by: Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Link: https://lore.kernel.org/r/20220907145808.1789249-3-weiyongjun@huaweicloud.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* misc: microchip: pci1xxxx: Fix missing spin_lock_init()Wei Yongjun2022-09-091-0/+1
| | | | | | | | | | | The driver allocates the spinlock but not initialize it. Use spin_lock_init() on it to initialize it correctly. Fixes: 7d3e4d807df2 ("misc: microchip: pci1xxxx: load gpio driver for the gpio controller auxiliary device enumerated by the auxiliary bus driver.") Reviewed-by: Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Link: https://lore.kernel.org/r/20220907145808.1789249-2-weiyongjun@huaweicloud.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* misc: microchip: pci1xxxx: fix error handling in gp_aux_bus_probe()Wei Yongjun2022-09-091-4/+5
| | | | | | | | | | | In some error handling path, resoures alloced may not released. This patch fix them. Fixes: 393fc2f5948f ("misc: microchip: pci1xxxx: load auxiliary bus driver for the PIO function in the multi-function endpoint of pci1xxxx device.") Reviewed-by: Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Link: https://lore.kernel.org/r/20220907145808.1789249-1-weiyongjun@huaweicloud.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* misc: microchip: pci1xxxx: fix dependency issues in building the pci1xxxx's ↵Kumaravel Thiagarajan2022-09-061-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | aux bus driver. build errors and warnings listed below and reported by kernel test robot <lkp@intel.com> on the char-misc-next branch are fixed in this add-on patch. errors: ERROR: modpost: "auxiliary_device_init" [drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gp.ko] undefined! ERROR: modpost: "__auxiliary_device_add" [drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gp.ko] undefined! ERROR: modpost: "auxiliary_driver_unregister" [drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.ko] undefined! ERROR: modpost: "__auxiliary_driver_register" [drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.ko] undefined! ia64-linux-ld: drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gp.o: in function `gp_aux_bus_probe.part.0': mchp_pci1xxxx_gp.c:(.text+0x342): undefined reference to `auxiliary_device_init' ia64-linux-ld: mchp_pci1xxxx_gp.c:(.text+0x392): undefined reference to `__auxiliary_device_add' ia64-linux-ld: mchp_pci1xxxx_gp.c:(.text+0x5c2): undefined reference to `auxiliary_device_init' ia64-linux-ld: mchp_pci1xxxx_gp.c:(.text+0x612): undefined reference to `__auxiliary_device_add' ia64-linux-ld: drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.o: in function `pci1xxxx_gpio_driver_init': mchp_pci1xxxx_gpio.c:(.init.text+0x42): undefined reference to `__auxiliary_driver_register' warnings: unmet direct dependencies detected for GPIOLIB_IRQCHIP when selected by GP_PCI1XXXX Fixes: 393fc2f5948f ("misc: microchip: pci1xxxx: load auxiliary bus driver for the PIO function in the multi-function endpoint of pci1xxxx device.") Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com> Link: https://lore.kernel.org/r/20220906124951.696776-1-kumaravel.thiagarajan@microchip.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* misc: microchip: pci1xxxx: Add power management functions - suspend & resume ↵Kumaravel Thiagarajan2022-09-021-0/+37
| | | | | | | | | | | | handlers. Power event handlers suspend and resume are invoked by the operating system to notify the driver about the power events. Wakeup is enabled before entering suspend and disabled after resuming. Signed-off-by: Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com> Link: https://lore.kernel.org/r/20220824200047.150308-6-kumaravel.thiagarajan@microchip.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* misc: microchip: pci1xxxx: Add gpio irq handler and irq helper functions ↵Kumaravel Thiagarajan2022-09-021-0/+159
| | | | | | | | | | | | irq_ack, irq_mask, irq_unmask and irq_set_type of irq_chip. The helper functions irq_set_type, irq_mask, irq_unmask and irq_ack configure the interrupt type, mask, unmask and acknowledge the interrupts. Signed-off-by: Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com> Link: https://lore.kernel.org/r/20220824200047.150308-5-kumaravel.thiagarajan@microchip.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* misc: microchip: pci1xxxx: Add functions to configure gpio pins as input / ↵Kumaravel Thiagarajan2022-09-021-0/+79
| | | | | | | | | | | | | output, get status, handle I/O for gpio pins. direction_input and direction_output functions configures a gpio pin as input and output respectively. get_direction function returns if a gpio pin is output or input. get function returns the value of a gpio pin whereas set function assigns output value for a gpio pin. Signed-off-by: Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com> Link: https://lore.kernel.org/r/20220824200047.150308-4-kumaravel.thiagarajan@microchip.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* misc: microchip: pci1xxxx: load gpio driver for the gpio controller ↵Kumaravel Thiagarajan2022-09-022-1/+164
| | | | | | | | | | | | auxiliary device enumerated by the auxiliary bus driver. PIO function's auxiliary bus driver enumerates separate child devices for GPIO controller and OTP/EEPROM interface. This gpio driver implemented based on the gpio framework is loaded for the gpio auxiliary device. Signed-off-by: Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com> Link: https://lore.kernel.org/r/20220824200047.150308-3-kumaravel.thiagarajan@microchip.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* misc: microchip: pci1xxxx: load auxiliary bus driver for the PIO function in ↵Kumaravel Thiagarajan2022-09-024-0/+206
the multi-function endpoint of pci1xxxx device. pci1xxxx is a PCIe switch with a multi-function endpoint on one of its downstream ports. PIO function is one of the functions in the multi-function endpoint. PIO function combines a GPIO controller and also an interface to program pci1xxxx's OTP & EEPROM. This auxiliary bus driver is loaded for the PIO function and separate child devices are enumerated for GPIO controller and OTP/EEPROM interface. Signed-off-by: Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com> Link: https://lore.kernel.org/r/20220824200047.150308-2-kumaravel.thiagarajan@microchip.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>