summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2018-06-28staging: wilc1000: remove unused marco related to HIF commandsAjay Singh1-36/+0
After removing the multiplexing of hif commands in hif_if_work() macros prefix with 'HOST_IF_MSG_' are not required. Also 'id' field in host_if_msg is not required anymore. Signed-off-by: Ajay Singh <ajay.kathat@microchip.com> Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: wilc1000: remove host_if_work() to handle TODO list issueAjay Singh1-296/+278
Remove multiplexing of command at host_if_work(). Make use of function pointer instead of command ID to track individual work_struct separately. Modified the handler function to take work_struct pointer as argument and its return type is changes to void. Now prototype of 'handle_' function is same work_struct i.e. 'void (*fun)(struct struct *)' to register with work_queue. Removed host_if_work() because its not required now. Signed-off-by: Ajay Singh <ajay.kathat@microchip.com> Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: wilc1000: Use common structs to parse ip packetsThibaut Robert1-28/+15
Use structs ethhdr, iphdr and tcphdr instead of manual parsing in tcp_process. This commit fix handling of ip packets containing options. It also fixes the following sparse warning: drivers/staging/wilc1000//wilc_wlan.c:201:19: warning: cast to restricted __be16 Signed-off-by: Thibaut Robert <thibaut.robert@gmail.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-gpio: avoid use banks in device treeSergio Paracuellos4-90/+31
Banks shouldn't be defined in DT if number of resources per bank is not variable. We actually know that this SoC has three banks so take that into account in order to don't overspecify the device tree. Device tree will only have one node making it simple. Update device tree, binding doc and code accordly. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-gpio: update Kconfig with SoC detailsSergio Paracuellos1-2/+2
Kconfig is using a generic 'Mediatek GPIO Support' in description and help which is not specific at all about the current SoC which is MT7621. Update it. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-gpio: avoid long line in a commentSergio Paracuellos1-2/+3
Checkpatch script is complaining about a comment line which exceeds 80 characteres. Just silence it. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-gpio: set different names for each gpio_chip and irq_chipSergio Paracuellos1-2/+12
Currently the driver defines 3 gpiochips, one for each bank. /sys/class/gpio/gpiochip416/label:1e000600.gpio /sys/class/gpio/gpiochip448/label:1e000600.gpio /sys/class/gpio/gpiochip480/label:1e000600.gpio Unfortunately they all have the same label Interrupts from /proc/interrupt show the same name which is confusing: /proc/interrupts: 17: 0 0 0 0 MIPS GIC 19 mt7621, mt7621, mt7621 which is the interrupt from the GPIO controller. It is a little weird that all three banks are named "mt7621" here. We also have: 26: 0 0 0 0 GPIO 18 reset which is the interrupt from GPIO which provides the "reset" button. I suspect that if I had interrupts form two different banks they would both be called "GPIO" which would be a little confusing. In order to unify all of this set different names for each chip Use a 'bank-based' name instead the same for all: 'mt7621-bank[0-2]'. Create a new 'mediatek_gpio_bank_name' function which return the name depending on the bank number. This function is allways called with a valid index 0, 1 or 2. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-gpio: avoid one level indentation in interrupt handlerSergio Paracuellos1-7/+5
There is no need to check for 'pending' before loop over the interrupts using 'for_each_set_bit' if nothing is set the return values will be the same so just avoid this check avoiding also one level intentation and improving readability. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-gpio: avoid to set up irqs if not defined in dtsSergio Paracuellos1-20/+22
If there is no interrupt defined in the dts 'irq_of_parse_and_map' returns 0 and we should't set up interrupts for each gpio chip in that case. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-gpio: avoid check for NULL in 'to_mediatek_gpio' callsSergio Paracuellos1-9/+0
Function 'to_mediatek_gpio' cannot return NULL, so this NULL checkings are pointless. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-gpio: align indentation for all definesSergio Paracuellos1-2/+2
There was two remaining defines which weren't properly aligned with the rest. Align them improving readability. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-gpio: update kerneldoc for state containersSergio Paracuellos1-12/+3
Update kernel doc for mtk_data and also remove no needed documentation for mtk_gc which is clear enough to don't need it. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-gpio: remove no more necessary PIN_MASK macroSergio Paracuellos1-10/+9
PIN_MASK macro was being used because of the fact we were only using one interrupt controller for all of the gpio chips. This has been changed to use one per gpio chip and each has 32 irqs. Because of this this macro is not needed anymore. Use BIT macro instead. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-gpio: avoid custom irq_domain for gpioSergio Paracuellos2-141/+81
Instead of create a custom irq_domain for this chip, use 'gpiochip_set_chained_irqchip' from GPIOLIB_IRQCHIP. It is ok to call this function several times. We have to manually mark the line with 'IRQF_SHARED' and then loop over the three banks until you find a hit. There were some problems with removing an irqchip like that but this driver is a bool so it might work just fine. After this changes the functions 'mediatek_gpio_to_irq' is not needed anymore and also the 'gpio_irq_domain' field from the state container. Instead of use the custom irq domain in the irq handler use the associated domain from the gpio_chip in 'irq_find_mapping' function. Function 'mediatek_gpio_bank_probe' has been moved a it to the botton to have all the irq related functions together and avoid some forward declarations to resolve some symbols along the code. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-gpio: implement high level and low level irqsSergio Paracuellos1-10/+37
This chip support high level and low level interrupts. Those have to be implemented also to get a complete and clean driver. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-gpio: add kerneldoc for state data containersSergio Paracuellos1-0/+18
This commit adds kerneldoc for the two data containers in order to better understanding of its existence. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-gpio: add COMPILE_TESTSergio Paracuellos1-1/+1
This driver is actually platform-agnostic. Add COMPILE_TEST for the compilation test coverage. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-gpio: implement '.irq_[request|release]_resources' functionsSergio Paracuellos1-5/+37
When implementing custom irqchips it is important to also implement .irq_request_resources() and .irq_release_resources() and make sure these call gpiochip_[un]lock_as_irq(). Add those two for this driver. Also store struct device pointer in global state structure to be able to use 'dev_err' with the device from 'mediatek_request_resources' function. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-gpio: make use of 'builtin_platform_driver'Sergio Paracuellos1-1/+1
This driver was being registered using 'module_platform_driver' but it is not a module at all. Instead of this use 'builtin_platform_driver' which seems to be the correct one. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-gpio: avoid including 'gpio.h'Sergio Paracuellos1-1/+0
Including file '<linux/gpio.h>' should be avoided in new drivers code, so just remove it because it is no necessary at all. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-gpio: make use 'bgpio_init' from GPIO_GENERICSergio Paracuellos2-95/+42
Gpio complexity is just masking the fact that offset is always 0..n and writes to bits 0..n of some memory address. Because of this whole thing can just me converted to use GPIO_GENERIC and avoid duplications of a lot of driver custom functions. So use bgpio_init instead of custom code adding GPIO_GENERIC dependency to the Kconfig file. Also to make easier using bgpio_init function offset for each gpio bank, enumeration where register were defined has been replaced in favour of some macros which handle each gpio offset taking into account the bank where are located. Because of this change write and read functions which are being used for remaining irq handling stuff have been updated also as well as its dependencies along the code. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-eth: Use eth_hw_addr_random()Kamal Heib1-2/+1
Use eth_hw_addr_random() to set a random dev_addr and update addr_assign_type. Fixes: e3cbf478f846 ('staging: mt7621-eth: add the drivers core files') Signed-off-by: Kamal Heib <kamalheib1@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-eth: Fix memory leak in mtk_add_mac() error pathKamal Heib1-3/+10
Fix memory leak in error path of mtk_add_mac() by make sure to free the allocated netdev. Fixes: e3cbf478f846 ('staging: mt7621-eth: add the drivers core files') Signed-off-by: Kamal Heib <kamalheib1@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-dts: Fix remaining pcie warningsRosen Penev2-12/+11
This currently fixes the remaining dtb warnings: Node /pcie@1e140000/pcie0 has a reg or ranges property, but no unit name Node /pcie@1e140000/pcie1 has a reg or ranges property, but no unit name Node /pcie@1e140000/pcie2 has a reg or ranges property, but no unit name Node /pcie@1e140000/pcie0 node name is not "pci" or "pcie" Node /pcie@1e140000/pcie0 missing ranges for PCI bridge (or not a bridge) Node /pcie@1e140000/pcie0 missing bus-range for PCI bridge Node /pcie@1e140000/pcie1 node name is not "pci" or "pcie" Node /pcie@1e140000/pcie1 missing ranges for PCI bridge (or not a bridge) Node /pcie@1e140000/pcie1 missing bus-range for PCI bridge Node /pcie@1e140000/pcie2 node name is not "pci" or "pcie" Node /pcie@1e140000/pcie2 missing ranges for PCI bridge (or not a bridge) Node /pcie@1e140000/pcie2 missing bus-range for PCI bridge Warning (unit_address_format): Failed prerequisite 'pci_bridge' Warning (pci_device_reg): Failed prerequisite 'pci_bridge' Warning (pci_device_bus_num): Failed prerequisite 'pci_bridge' device_type was removed since according to documentation, it's deprecated for pci(e) devices. Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-mmc: Find response of SD_APP_OP_COND by defaultChristian Lütke-Stetzkamp1-3/+1
The response type of the SD_APP_OP_COND command is correctly determined using the mmc_resp_type macro, because the only use of that opcode, mmc_send_app_op_cond, correctly places MMC_RSP_R3 in cmd.flags. So there is no need to treat that opcode separately. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-mmc: Find response of MMC_SEND_OP_COND by defaultChristian Lütke-Stetzkamp1-1/+1
The response type of the MMC_SEND_OP_COND command is correctly determined using the mmc_resp_type macro, because the only use of that opcode, mmc_send_op_cond, correctly places MMC_RSP_R3 in cmd.flags. So there is no need to treat that opcode separately. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-mmc: Factor out from msdc_command_start()Christian Lütke-Stetzkamp1-15/+25
Currently msdc_command_start does multiple things and is hard to read, so factor out the finding of the response type. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-mmc: Remove unused argument from msdc_do_commandChristian Lütke-Stetzkamp1-3/+2
The argument tune of msdc_do_command is never used, so remove it. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-mmc: Remove unused macro is_card_presentChristian Lütke-Stetzkamp1-4/+0
The macro is_card_present is unused and also a duplicate of a macro in mmc, so remove it. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-mmc: Remove unused define MAX_PHY_SGMTSChristian Lütke-Stetzkamp1-1/+0
The define MAX_PHY_SGMTS is never used, so remove it. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-mmc: Remove unused enum msdc_modeChristian Lütke-Stetzkamp1-6/+0
The enum msdc_mode is never used, so remove it. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-mmc: Remove unused define IRQ_SDCChristian Lütke-Stetzkamp1-2/+0
The define IRQ_SDC is never used, so remove it. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-mmc: Remove unused define RALINK_MSDC_BASEChristian Lütke-Stetzkamp1-2/+0
The define RALINK_MSDC_BASE is never used, so remove it. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-mmc: Cleanup source of base address for ioChristian Lütke-Stetzkamp2-303/+236
Currently the base address for all io operations is hidden behind a macro, REG_ADD. This macro uses the symbol "base" as the base address and all functions set base = host->base. This is hard to read, so the whole wrapping is removed and host->base is directly inserted in the io access. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-mmc: Remove MSDC_MODE_* definesChristian Lütke-Stetzkamp1-7/+0
The MSDC_MODE_* defines are all never used and do not contain any information about the device, so remove them. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-mmc: Remove unused variable from msdc_tune_requestChristian Lütke-Stetzkamp1-2/+0
The variable cmd in the function msdc_tune_request is set but never used, so remove it. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-mmc: Remove unused macro MAX_BD_PER_GPDChristian Lütke-Stetzkamp1-1/+0
The macro MAX_BD_PER_GPD is never used, so remove it. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-mmc: Remove unused macro msdc_retryChristian Lütke-Stetzkamp1-13/+0
The macro msdc_retry is never used, so remove it. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-mmc: Make msdc_clr_fifo a function and relax cpuChristian Lütke-Stetzkamp1-13/+15
In the current code, msdc_clr_fifo is a macro and just busy waits for a limited amount of time for the fifo clear to finish. That is not correct, the programming manual hits, that the user should wait until the bit is cleared by hardware and not a limited amount of time. So the code is changed to a function, that also relaxes the cpu while busy waiting. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-mmc: Remove unnecessary BUG_ON() in msdc_dma_setupChristian Lütke-Stetzkamp1-3/+0
The BUG_ON() removed by this patch is just a duplicate of a prior BUG_ON() statement. There the condition is just clearer, it checks weather sglen > MAX_BD_NUM and MAX_BD_NUM is equal MAX_BD_PER_GPD. So this statement can be safely removed. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-mmc: Remove variable num form msdc_dma_setupChristian Lütke-Stetzkamp1-3/+2
The variable num in msdc_dma_setup is only used for a BUG_ON statement, so it can be removed by inlining the condition. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-mmc: Remove unused field sglen from msdc_dmaChristian Lütke-Stetzkamp2-4/+0
The field sglen from struct msdc_dma is once set and never read, so remove it. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-mmc: Remove unused field sg from msdc_dmaChristian Lütke-Stetzkamp2-2/+0
The field sg from struct msdc_dma is once set and never read, so remove it. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-mmc: Refactor dma setup processChristian Lütke-Stetzkamp1-21/+13
Current code uses two functions for dma setup, msdc_dma_config and msdc_dma_setup. By now msdc_dma_setup is nearly empty and mainly calls msdc_dma_config, so the later one can be inline into the first one. While doing this there is also some refactoring done. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-mmc: Remove unused field mode from msdc_dmaChristian Lütke-Stetzkamp2-5/+1
The field mode of struct msdc_dma has no remaining use, so remove it. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-mmc: Remove DMA basic mode codeChristian Lütke-Stetzkamp1-56/+32
The driver currently only uses DMA linked mode and the upstream driver does the same, so remove the basic mode code. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-mmc: Remove register debugging structuresChristian Lütke-Stetzkamp1-411/+0
Current code has structures for all the registers of the device, but these are never used and there are also masks for all of them, so these structures do not contain any useful information. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-mmc: Remove unused macro sdr_write8Christian Lütke-Stetzkamp1-2/+0
The macro sdr_write8 is never used, so remove it. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-mmc: Remove unused macro sdr_read8Christian Lütke-Stetzkamp1-1/+0
The macro sdr_read8 is never used, so remove it. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28staging: mt7621-mmc: Replace sdr_read32 with readlChristian Lütke-Stetzkamp2-50/+49
The current code uses a macro (sdr_read32) for reading from hardware, but it is only a readl, so replace it to get nearer to upstream code. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>