linux.git
6 years agoMLK-16285-2 usb: typec: tcpci: add optional reset pin support
Peter Chen [Wed, 9 Jan 2019 08:52:08 +0000 (14:22 +0530)]
MLK-16285-2 usb: typec: tcpci: add optional reset pin support

Some USB3 differential channel switch chips need to do reset before
functional, we add this support here.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Acked-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16285-1 usb: typec: tcpci: move request interrupt to the end of probe
Peter Chen [Wed, 9 Jan 2019 07:44:27 +0000 (13:14 +0530)]
MLK-16285-1 usb: typec: tcpci: move request interrupt to the end of probe

The tcpci_irq may visit tcpci->port if unexpected interrupt occurs
(eg, board design issue causes GPIO status is incorrect) and cause
NULL pointer dereference issue.

Besides, delete clear TCPC_ALERT and TCPC_ALERT_MASK code which are
already done at tcpci_init.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Acked-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16298-1 usb: typec: make super speed signal mux select configurable
Li Jun [Wed, 9 Jan 2019 07:34:03 +0000 (13:04 +0530)]
MLK-16298-1 usb: typec: make super speed signal mux select configurable

Instead of fixed pull up super speed mux selection gpio for cc1, use
GPIO_ACTIVE_HIGH/LOW to map the CC1/CC2 orientation via gpiod api, So
for ss-sel-gpios:
GPIO_ACTIVE_HIGH: CC1 <--> GPIO high
GPIO_ACTIVE_LOW : CC1 <--> GPIO low

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16013-44 usb: typec: tcpm: set data role after src detach
Li Jun [Wed, 9 Jan 2019 07:29:18 +0000 (12:59 +0530)]
MLK-16013-44 usb: typec: tcpm: set data role after src detach

As the default data role is device mode if the port is not host,
so set the port data role to be device mode after src detach, this
is to fix the issue of port data role still kept to be host while
the port is open.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16013-43 usb: typec: tcpci: add extcon for data role switch
Li Jun [Wed, 9 Jan 2019 07:27:41 +0000 (12:57 +0530)]
MLK-16013-43 usb: typec: tcpci: add extcon for data role switch

Use extcon device for dual role switch on typec port.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16013-37 usb: typec: Power swap force discharge for source
Li Jun [Wed, 9 Jan 2019 07:19:26 +0000 (12:49 +0530)]
MLK-16013-37 usb: typec: Power swap force discharge for source

VBus off only means the vbus falls to be below 4v, we can use vbus
force discharge and vbus low alarm to go forward.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16013-36 usb: typec: wait for cc change on ERROR_RECOVERY
Li Jun [Wed, 9 Jan 2019 07:16:13 +0000 (12:46 +0530)]
MLK-16013-36 usb: typec: wait for cc change on ERROR_RECOVERY

We should wait at least tErrorRecovery before move to unattached state.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16013-34 usb: typec: Support cc changes on RP pull-up value
Li Jun [Wed, 9 Jan 2019 07:14:21 +0000 (12:44 +0530)]
MLK-16013-34 usb: typec: Support cc changes on RP pull-up value

CC line changes on souce side RP value is permitted per standard, in
this case we should move to SNK_ATTACH_WAIT.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16013-33 usb: typec: Do not switch to unattached state for BIST
Li Jun [Wed, 9 Jan 2019 07:11:29 +0000 (12:41 +0530)]
MLK-16013-33 usb: typec: Do not switch to unattached state for BIST

If we received unsupported BIST command, we should by pass it and ready
to accept following command for test, not unconditionly to set the port
to be unattached state and terminate the test.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16013-32 usb: typec: refine source to sink swap handling
Li Jun [Wed, 9 Jan 2019 07:09:10 +0000 (12:39 +0530)]
MLK-16013-32 usb: typec: refine source to sink swap handling

To early start sink power after source turn off vbus, move the set power
role after vbus is turned off in PR_SWAP_SRC_SNK_SOURCE_OFF, also per
spec, we should do error recovery if the sink side does not turn on
vbus in PD_T_PS_SOURCE_ON.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16013-31 usb: typec: Set to unattached state if souce disconnected
Li Jun [Wed, 9 Jan 2019 07:07:13 +0000 (12:37 +0530)]
MLK-16013-31 usb: typec: Set to unattached state if souce disconnected

In SNK_HARD_RESET_SINK_ON, if the source disconnected, we should set
state to be unattached state intead of startup sink.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16013-30 usb: typec: Reset hard_reset_count to be 0 after send source cap
Li Jun [Wed, 9 Jan 2019 07:00:39 +0000 (12:30 +0530)]
MLK-16013-30 usb: typec: Reset hard_reset_count to be 0 after send source cap

Per standard, we should clear the hard reset count to be 0 after souce
sent the source cap.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16013-29 usb: typec: tcpm: Don't reset message id after soft reset
Li Jun [Wed, 9 Jan 2019 06:58:35 +0000 (12:28 +0530)]
MLK-16013-29 usb: typec: tcpm: Don't reset message id after soft reset

If the power source sent soft reset and the other end accepted, we should
not reset the message id as it was already updated by pd_transmit when
handling the soft reset.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agousb: typec: add max_snk_mv/ma/mw
Vipul Kumar [Thu, 10 Jan 2019 05:46:29 +0000 (11:16 +0530)]
usb: typec: add max_snk_mv/ma/mw

This patch add max_snk_mv/ma/mw to fix the below
compilation error.

drivers/usb/typec/tcpci.c:707:15: error: ‘struct tcpc_config’ has no member named ‘max_snk_mv’
          &tcfg->max_snk_mv) ||
               ^~
drivers/usb/typec/tcpci.c:709:13: error: ‘struct tcpc_config’ has no member named ‘max_snk_ma’
        &tcfg->max_snk_ma) ||
             ^~

Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16013-9 usb: typec: add interface to get port type and role
Li Jun [Wed, 9 Jan 2019 11:27:21 +0000 (16:57 +0530)]
MLK-16013-9 usb: typec: add interface to get port type and role

Add interface to get typec port type and default power role from
dt. To validate a correct setting is specified, add TYPEC_PORT_TYPE_UNKNOWN
and TYPEC_ROLE_UNKNOWN for typec_port_type and typec_role enum.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
During 4.14 rebase renamed to typec_port_types_dt to avoid conflict with
sysfs values.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Rebase it on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16013-27 usb: typec: add super speed signal mux selection
Li Jun [Wed, 9 Jan 2019 06:44:00 +0000 (12:14 +0530)]
MLK-16013-27 usb: typec: add super speed signal mux selection

According to the polarity of cc line, we need to do USB3 signal mux
selection if it's controlled by software.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16013-26 usb: typec: tcpm: update PD timing
Li Jun [Wed, 9 Jan 2019 06:31:50 +0000 (12:01 +0530)]
MLK-16013-26 usb: typec: tcpm: update PD timing

This patch is to update several PD timings for PD compliance, all
those timing definitions should be configurable via user config,
this can be improved later, for now I just update its values in PD
spec defined range.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16013-25 usb: typec: tcpm: correct the PD_T_SENDER_RESPONSE value
Li Jun [Wed, 9 Jan 2019 06:28:55 +0000 (11:58 +0530)]
MLK-16013-25 usb: typec: tcpm: correct the PD_T_SENDER_RESPONSE value

Per PD spec, the sender response should be in a small range 24~30ms, so
correct the PD_T_SENDER_RESPONSE to be 25.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16013-24 usb: typec: tcpm: use hrtimer for send response
Li Jun [Wed, 9 Jan 2019 06:26:46 +0000 (11:56 +0530)]
MLK-16013-24 usb: typec: tcpm: use hrtimer for send response

As the sender response timer have very small margin(25~30ms), so
use a hrtimer to handle it.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
6 years agoMLK-16013-23 usb: typec: tcpm: Do soft reset for unexpected get sink cap
Li Jun [Wed, 9 Jan 2019 06:14:38 +0000 (11:44 +0530)]
MLK-16013-23 usb: typec: tcpm: Do soft reset for unexpected get sink cap

A source or sink should receive the get_sink_cap message when in SRC_RDY or
SNK_RDY, if the port receives a get sink capability request before ready,
which means there is message sync error, we should do soft reset to recover
from it, instead of sending a reject message.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16013-22 usb: typec: tcpm: split operations of power swap from sink to source
Li Jun [Wed, 9 Jan 2019 06:12:22 +0000 (11:42 +0530)]
MLK-16013-22 usb: typec: tcpm: split operations of power swap from sink to source

Add one more state:PR_SWAP_SNK_SRC_ASSERT_RP, as the next state of
PR_SWAP_SNK_SRC_SINK_OFF, it will turn on vbus and wait the vbus
is really on and then send the PS_RDY to the other side.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16013-21 usb: typec: tcpm: handle pd message send failure
Li Jun [Wed, 9 Jan 2019 06:07:36 +0000 (11:37 +0530)]
MLK-16013-21 usb: typec: tcpm: handle pd message send failure

If the PD message send failed, we need to do soft reset, further if
soft reset failed, we have to start a hard reset.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16013-20 usb: typec: Add bist test mode support
Li Jun [Wed, 9 Jan 2019 05:57:08 +0000 (11:27 +0530)]
MLK-16013-20 usb: typec: Add bist test mode support

BIST(Built In Self-Test – Power Delivery testing mechanism for
the PHY Layer), see PD 3.0 spec 5.9 Built in Self-Test (BIST), is
added to support BIST message handling in PD compliance test.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16013-18 usb: typec: handle unexpected vbus from sink
Li Jun [Wed, 9 Jan 2019 05:50:31 +0000 (11:20 +0530)]
MLK-16013-18 usb: typec: handle unexpected vbus from sink

Power source detected the attachment of sink, will firstly check
the vbus level to make sure power sink isn't sourcing vbus(< 600mv)
before going forward, otherwise it will terminate the session and
go to SRC_UNATTACHED state, this is required by PD compliance.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agousb: typec: tcpm: Fix compilation error
Vipul Kumar [Thu, 10 Jan 2019 05:24:10 +0000 (10:54 +0530)]
usb: typec: tcpm: Fix compilation error

As per 'commit 8e04b3721cc8 ("typec: tcpm: add starting value for drp
toggling")', make changes to fix the below compilation error.

drivers/usb/typec/tcpm.c: In function ‘tcpm_src_attach’:
drivers/usb/typec/tcpm.c:2625:2: error: too few arguments to function ‘tcpm_start_drp_toggling’
  tcpm_start_drp_toggling(port);
  ^~~~~~~~~~~~~~~~~~~~~~~
drivers/usb/typec/tcpm.c:2537:13: note: declared here
 static bool tcpm_start_drp_toggling(struct tcpm_port *port,
             ^~~~~~~~~~~~~~~~~~~~~~~
drivers/usb/typec/tcpm.c: In function ‘tcpm_snk_attach’:
drivers/usb/typec/tcpm.c:2749:2: error: too few arguments to function ‘tcpm_start_drp_toggling’
  tcpm_start_drp_toggling(port);
  ^~~~~~~~~~~~~~~~~~~~~~~
drivers/usb/typec/tcpm.c:2537:13: note: declared here
 static bool tcpm_start_drp_toggling(struct tcpm_port *port,
             ^~~~~~~~~~~~~~~~~~~~~~~
scripts/Makefile.build:303: recipe for target 'drivers/usb/typec/tcpm.o' failed

Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16013-17 usb: typec: tcpm: optimise cc toggling for drp port
Li Jun [Wed, 9 Jan 2019 05:41:51 +0000 (11:11 +0530)]
MLK-16013-17 usb: typec: tcpm: optimise cc toggling for drp port

We should only enable drp auto toggling when unattached, so add one
more parameter; when attached, we set the cc line state according to
the other end cc status.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16013-16: usb: typec: tcpm: tcpm init sequence update
Li Jun [Wed, 9 Jan 2019 05:24:57 +0000 (10:54 +0530)]
MLK-16013-16: usb: typec: tcpm: tcpm init sequence update

Force an error recovery is not a good way to handle all cases and may
break the case of power up with typec already connected. Also the tcpc
init should start after tcpm init setup is done, as tcpc init will
turn on HW event alert so may generate events immediately and drive
tcpm state machine go forward, so move it at the end of tcpm_init.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16013-15: usb: typec: tcpci: Enable vbus force discharge
Li Jun [Wed, 9 Jan 2019 05:18:11 +0000 (10:48 +0530)]
MLK-16013-15: usb: typec: tcpci: Enable vbus force discharge

Enable vbus low voltage alert and do force discharge, this can aid turn
off vbus quickly.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16013-14: usb: typec: tcpci: handle fault event
Li Jun [Wed, 9 Jan 2019 05:07:25 +0000 (10:37 +0530)]
MLK-16013-14: usb: typec: tcpci: handle fault event

We need clear any fault alerts to make tcpci controller to recover
from fault.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16013-13: usb: typec: tcpci: handle rx buffer overflow event
Li Jun [Wed, 9 Jan 2019 05:03:36 +0000 (10:33 +0530)]
MLK-16013-13: usb: typec: tcpci: handle rx buffer overflow event

Add rx buffer overflow event handling.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16013-12: usb: typec: tcpci: clear pending events before request irq
Li Jun [Wed, 9 Jan 2019 05:01:01 +0000 (10:31 +0530)]
MLK-16013-12: usb: typec: tcpci: clear pending events before request irq

Clear all possible pending events before request irq.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16013-11 usb: typec: only clear alert events for enabled irq
Li Jun [Wed, 9 Jan 2019 04:38:03 +0000 (10:08 +0530)]
MLK-16013-11 usb: typec: only clear alert events for enabled irq

Uncondtionaly clear all events may impact the typec controller state
machine, so save the enabled irq and only clear alert events for enabled
irq.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-16013-10 usb: typec: add vbus detection for power sink
Li Jun [Wed, 9 Jan 2019 04:30:46 +0000 (10:00 +0530)]
MLK-16013-10 usb: typec: add vbus detection for power sink

Typec port controller may need enable vbus detection to detect
the vbus from power source.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-11305 radio-si476x: support set V4L2_CID_AUDIO_MUTE CTRL
Zidan Wang [Fri, 31 Jul 2015 09:02:48 +0000 (17:02 +0800)]
MLK-11305 radio-si476x: support set V4L2_CID_AUDIO_MUTE CTRL

By using gstreamer plugin v4l2radio, it will call VIDIOC_S_CTRL with
V4L2_CID_AUDIO_MUTE, but return failed.

So add V4L2_CID_AUDIO_MUTE CTRL support for radio-si476x.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit c18520adfd6de40dcc0659ddd778b0a2bd383cd4)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-19455 tick/nohz: Prevent bogus softirq pending warning
Thomas Gleixner [Thu, 30 Aug 2018 15:05:19 +0000 (17:05 +0200)]
MLK-19455 tick/nohz: Prevent bogus softirq pending warning

Commit 0a0e0829f990 ("nohz: Fix missing tick reprogram when interrupting an
inline softirq") got backported to stable trees and now causes the NOHZ
softirq pending warning to trigger. It's not an upstream issue as the NOHZ
update logic has been changed there.

The problem is when a softirq disabled section gets interrupted and on
return from interrupt the tick/nohz state is evaluated, which then can
observe pending soft interrupts. These soft interrupts are legitimately
pending because they cannot be processed as long as soft interrupts are
disabled and the interrupted code will correctly process them when soft
interrupts are reenabled.

Add a check for softirqs disabled to the pending check to prevent the
warning.

Reported-by: Grygorii Strashko <grygorii.strashko@ti.com>
Reported-by: John Crispin <john@phrozen.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: John Crispin <john@phrozen.org>
Cc: Frederic Weisbecker <frederic@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Anna-Maria Gleixner <anna-maria@linutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: stable@vger.kernel.org
Acked-by: Frederic Weisbecker <frederic@kernel.org>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Acked-by: Jason Liu <Jason.hui.liu@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-18338-2 perf: ddr: added axid filter support
Frank Li [Thu, 17 May 2018 17:26:48 +0000 (12:26 -0500)]
MLK-18338-2 perf: ddr: added axid filter support

 perf stat -a -e ddr0/axid-read,axi_id=MMMMDDDD/ cmd

MMMM AXI_MASKING
DDDD AXI_ID

Signed-off-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-17074-3 PM / Domains: use default state 0 to enter for multi states domains
Dong Aisheng [Thu, 30 Nov 2017 09:32:08 +0000 (17:32 +0800)]
MLK-17074-3 PM / Domains: use default state 0 to enter for multi states domains

If no valid state idx specified by governor, we use the default state_idx
0 to enter in case the domain has multi low power states.

Reviewed-by: Frank Li <frank.li@nxp.com>
Reviewed-by: Ranjani Vaidyanathan <Ranjani.Vaidyanathan@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-17074-2 PM / Domains: choose the deepest state to enter if no devices using it
Dong Aisheng [Mon, 27 Nov 2017 09:33:47 +0000 (17:33 +0800)]
MLK-17074-2 PM / Domains: choose the deepest state to enter if no devices using it

For a domain belongs to no devices anymore, let's choose the deepest state
to enter to save power.

Reviewed-by: Frank Li <frank.li@nxp.com>
Reviewed-by: Ranjani Vaidyanathan <Ranjani.Vaidyanathan@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-17074-1 PM / Domains: support enter deepest state for multiple states domains
Dong Aisheng [Fri, 24 Nov 2017 08:31:32 +0000 (16:31 +0800)]
MLK-17074-1 PM / Domains: support enter deepest state for multiple states domains

Currently the generic power domain suspend code pm_genpd_suspend_noirq
will try to power off a domain used by devices in genpd_sync_poweroff
if its status is not GPD_STATE_ACTIVE.

However, for power domains supporting multiple low power states, it may
already enter an intermediate low power state by runtime PM before system
suspend and the status is already GPD_STATE_POWER_OFF which results in
then the power domain stay at an intermediate low power state during
system suspend.

Let's give the power domain a chance to switch to the deepest state in
case it's already off but in an intermediate low power state.
Due to power domain is alway off, so no need to check device wakeup
case anymore.

Reviewed-by: Frank Li <frank.li@nxp.com>
Reviewed-by: Ranjani Vaidyanathan <Ranjani.Vaidyanathan@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-15300-1 perf: fixed crash when irq have not assigned in dts file
Frank Li [Wed, 28 Jun 2017 16:36:57 +0000 (11:36 -0500)]
MLK-15300-1 perf: fixed crash when irq have not assigned in dts file

[ 28.061044] perf[2494]: PC Alignment exception: pc=0000000072656d69 sp=ffff800032f2bd30
[ 28.069061] Internal error: Oops - SP/PC alignment exception: 8a000000 1 PREEMPT SMP
[ 28.077066] Modules linked in:
[ 28.080128] CPU: 2 PID: 2494 Comm: perf Not tainted 4.9.11-02540-g3ebe22c #52
[ 28.087263] Hardware name: Freescale i.MX8QXP LPDDR4 ARM2 (DT)
[ 28.093093] task: ffff80002e097080 task.stack: ffff800032f28000
[ 28.099011] PC is at 0x72656d69
[ 28.102163] LR is at perf_try_init_event+0x98/0xb0
[ 28.106950] pc : [<0000000072656d69>] lr : [<ffff0000081594e0>] pstate: 60000145

Signed-off-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-13855-3: perf: ddr-perf: Add counter overflow handling
Tiberiu Breana [Wed, 14 Jun 2017 14:50:11 +0000 (17:50 +0300)]
MLK-13855-3: perf: ddr-perf: Add counter overflow handling

Added support for counter overflow interrupts.
When the cycles counter overflows, update all local event data,
then reset it and let it continue counting.

Signed-off-by: Tiberiu Breana <andrei-tiberiu.breana@nxp.com>
[Arul: fsl-imx8qm.dtsi changes shall be added separately]
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-13855-2: perf: ddr-perf: Always enable the cycles counter
Tiberiu Breana [Mon, 19 Jun 2017 08:21:52 +0000 (11:21 +0300)]
MLK-13855-2: perf: ddr-perf: Always enable the cycles counter

Always enable cycles counter 0, regardless if it is explicitly
selected by the user or not. The cycles counter generates overflow
interrupts that will be used to update other counters.

Signed-off-by: Tiberiu Breana <andrei-tiberiu.breana@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-13855-1: perf: ddr-perf: Clean up driver
Tiberiu Breana [Wed, 14 Jun 2017 14:45:47 +0000 (17:45 +0300)]
MLK-13855-1: perf: ddr-perf: Clean up driver

- repurpose e2c_map array to a perf_event* array
- add ddr_perf_event_enable function
- tidy up indenting

Signed-off-by: Tiberiu Breana <andrei-tiberiu.breana@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-14238-02: dt-bindings: pwm: Add NXP TPM PWM
Bai Ping [Tue, 21 Mar 2017 03:16:18 +0000 (11:16 +0800)]
MLK-14238-02: dt-bindings: pwm: Add NXP TPM PWM

Add binding doc for tpm pwm module.

Signed-off-by: Bai Ping <ping.bai@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-14379: drivers: perf: Add DDR perf count support
Frank Li [Wed, 5 Oct 2016 19:54:42 +0000 (14:54 -0500)]
MLK-14379: drivers: perf: Add DDR perf count support

perf stat -a -e ddr0/cycles/,ddr0/read-bytes/,ddr0/write-bytes/,ddr1/cycles/,d
dr1/read-bytes/,ddr1/write-bytes/ dd if=/dev/zero of=/dev/null bs=10M count=1
1+0 records in
1+0 records out

 Performance counter stats for 'system wide':

           7236174      ddr0/cycles/                                                  (99.97%)
              8573      ddr0/read-bytes/                                              (99.99%)
            163628      ddr0/write-bytes/
           7256543      ddr1/cycles/                                                  (99.99%)
              9308      ddr1/read-bytes/                                              (100.00%)
            165039      ddr1/write-bytes/

       0.008990125 seconds time elapsed

Signed-off-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Tiberiu Breana <andrei-tiberiu.breana@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoof: of_reserved_mem: Ensure cma reserved region not cross the low/high memory
Jason Liu [Wed, 23 Nov 2016 07:42:54 +0000 (15:42 +0800)]
of: of_reserved_mem: Ensure cma reserved region not cross the low/high memory

Need ensure the cma reserved region not cross the low/high memory boundary
when using the dynamic allocation methond through device-tree, otherwise,
kernel will fail to boot up when cma reserved region cross how/high mem.

Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>
Cc: Laura Abbott <labbott@redhat.com>
Cc: Frank Rowand <frowand.list@gmail.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-18261 irqchip: imx-irqsteer: fix idx calculation for mask callback
Antoine Bouyer [Fri, 4 May 2018 09:48:09 +0000 (11:48 +0200)]
MLK-18261 irqchip: imx-irqsteer: fix idx calculation for mask callback

Fixes: a2e6a7833495 (MLK-16136-9 irqchip: imx-irqsteer: adjust irq config
via 'endian')

This patch fixes mask register offset calculation, when endian is not
default value 0 (i.e imx8mq).

Signed-off-by: Antoine Bouyer <antoine.bouyer@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-17290-01 irqchip: imx-irqsteer: add runtime pm support
Fugang Duan [Thu, 21 Dec 2017 01:03:57 +0000 (09:03 +0800)]
MLK-17290-01 irqchip: imx-irqsteer: add runtime pm support

Add runtime pm to manage irqsteer clock and its power domain in system
idle and suspend status to save power.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Frank Li <Frank.Li@nxp.com>
Tested-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-16909 irqchip: imx-irqsteer: restore registers after power off
Fugang Duan [Mon, 20 Nov 2017 07:55:40 +0000 (15:55 +0800)]
MLK-16909 irqchip: imx-irqsteer: restore registers after power off

Once irqsteer controller is power off during suspend, the registers
are lost, it should restore the registers after resume back.

BuildInfo:
 - SCFW a479ff78, IMX-MKIMAGE ff9860c5, ATF 923651a
 - U-Boot 2017.03-00691-g96cf020

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Tested-by: Pandy.gao <pandy.gao@nxp.com>
Acked-by: Pandy.gao <pandy.gao@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-16473 irqchip: imx-irqsteer: change irqsteer type to level
Seb Laveze [Wed, 23 Aug 2017 08:55:00 +0000 (10:55 +0200)]
MLK-16473 irqchip: imx-irqsteer: change irqsteer type to level

Irqsteer block only supports level interrupts.

(BuildInfo: SCFW 3e70523d, IMX-MKIMAGE 0, ATF 0)

Signed-off-by: Seb Laveze <sebastien.laveze@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-16368: irqchip: intmux: fix address definition of register
Shengjiu Wang [Tue, 5 Sep 2017 08:22:45 +0000 (16:22 +0800)]
MLK-16368: irqchip: intmux: fix address definition of register

Fix the offset of CHANIPR register address. Document is KL28Z
reference manual

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-16136-9 irqchip: imx-irqsteer: adjust irq config via 'endian'.
Fancy Fang [Fri, 4 Aug 2017 10:33:44 +0000 (18:33 +0800)]
MLK-16136-9 irqchip: imx-irqsteer: adjust irq config via 'endian'.

Change the irq configurations with adding endianness
determination for different platforms which may choose
different kinds of endianess.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-16136-7 irqchip: imx-irqsteer: correct registers macro defitions
Fancy Fang [Fri, 4 Aug 2017 06:32:46 +0000 (14:32 +0800)]
MLK-16136-7 irqchip: imx-irqsteer: correct registers macro defitions

Correct several macro definitions related with irqsteer
to avoid incorrect expression calculation due to operators
priority.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-16077-1: irqchip: intmux: add interrupt multiplexing support
Shengjiu Wang [Mon, 24 Jul 2017 06:09:57 +0000 (14:09 +0800)]
MLK-16077-1: irqchip: intmux: add interrupt multiplexing support

The intmux module is used to output internal interrupt in subsystem
to system with 32-to-8 configuration. It has several multiplex
channels depends on system. intmux is introduced in KL28Z reference
manual.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-15009 irqchip: imx-irqsteer: correct type of irqstat
Peng Fan [Mon, 5 Jun 2017 11:47:17 +0000 (19:47 +0800)]
MLK-15009 irqchip: imx-irqsteer: correct type of irqstat

The type of irqstat in irqsteer_irqchip_data unsigned long, actually
it needs to be 32bits width, so use unsigned int.

And use sizeof(irqsteer_data->irqstat[0]), instead of 4 when alloc
memory for irqsteer_data.

for_each_set_bit needs the second param type is unsigned long *, so
cast the irqsteer_data->irqstat to unsigned long *, this is safe here.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-15005-03 irqchip: irqsteer: add ipg clock support
Fugang Duan [Mon, 5 Jun 2017 03:31:10 +0000 (11:31 +0800)]
MLK-15005-03 irqchip: irqsteer: add ipg clock support

Some subsystems have lpcg sw_bit to control the ipg_clk to LIS,
so add the ipg clock for the module.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-14978 irqchip: irqsteer: add NXP imx8 irq steer controller support
Fugang Duan [Sat, 13 May 2017 11:19:29 +0000 (19:19 +0800)]
MLK-14978 irqchip: irqsteer: add NXP imx8 irq steer controller support

The IrqSteer module redirects/steers the incoming interrupts to output
interrupts of a selected/designated channel as specified by a set of
configuration registers.

NXP i.MX8x chips integrate IrqSteer controller for some DSC to share irq
line for all modules in the subsystem which can reduce the IRQ lines
connected to the parent interrupt controller GIC, so IrqSteer irqchip
acts as the second irq domain in the system.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
6 years agoMLK-17740 ARM: imx_v7_defconfig: enable wireless HOSTAP
Fugang Duan [Thu, 8 Mar 2018 10:43:10 +0000 (18:43 +0800)]
MLK-17740 ARM: imx_v7_defconfig: enable wireless HOSTAP

Add wireless HOSTAP config enable for i.MX7ULP Murata 1PJ (Qca9377-3).

Reviewed-by: Gao Pan <pandy.gao@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-18276-01 ARM: imx_v7_defconfig: add regulatory rules t database config
Andy Duan [Fri, 11 May 2018 02:26:51 +0000 (10:26 +0800)]
MLK-18276-01 ARM: imx_v7_defconfig: add regulatory rules t database config

Enable regulatory rules database config:
        CONFIG_CFG80211_INTERNAL_REGDB

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-18993 brcmfmac: configure wowl parameters only if firmware support wowl
Lo-Hsiang Lo [Fri, 21 Sep 2018 06:37:41 +0000 (14:37 +0800)]
MLK-18993 brcmfmac: configure wowl parameters only if firmware support wowl

Configure wowl parameters only if firmware support wowl.

Tested-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Lo-Hsiang Lo <double.lo@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit:ceccd33fb63e49cb816a827c0dfcb8abf7059e7f)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19517-18 brcmfmac: map 802.1d priority to precedence level based on AP WMM params
Saravanan Shanmugham [Wed, 13 Sep 2017 05:04:14 +0000 (14:04 +0900)]
MLK-19517-18 brcmfmac: map 802.1d priority to precedence level based on AP WMM params

In WLAN, priority among various access categories of traffic is
always set by the AP using WMM parameters and this may not always
follow the standard 802.1d priority.
In this change, priority is adjusted based on the AP WMM params
received as part of the Assoc Response and the same is later used
to map the priority of all incoming traffic.

This change should fix the following 802.11n certification tests:
* 5.2.31 ACM Bit Conformance test
* 5.2.32 AC Parameter Modification test

Signed-off-by: Saravanan Shanmugham <sasm@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit:62657fc5931db1c1d48c3181f2f4effebf37a74b)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19517-17 brcmfmac: 4373 save-restore support
Chi-Hsien Lin [Tue, 12 Jun 2018 09:41:43 +0000 (04:41 -0500)]
MLK-19517-17 brcmfmac: 4373 save-restore support

Use sr_eng_en bit to check 4373 sr support.

Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit:af0f9024b058dbbf529dcb2dedae9ae3919ebe8b)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19517-16 brcmfmac: fix full timeout waiting for action frame on-channel tx
Chung-Hsien Hsu [Mon, 11 Jun 2018 09:32:21 +0000 (17:32 +0800)]
MLK-19517-16 brcmfmac: fix full timeout waiting for action frame on-channel tx

The driver sends an action frame down and waits for a completion signal
triggered by the received BRCMF_E_ACTION_FRAME_OFF_CHAN_COMPLETE event
to continue the process. However, the action frame could be transmitted
either on the current channel or on an off channel. For the on-channel
case, only BRCMF_E_ACTION_FRAME_COMPLETE event will be received when
the frame is transmitted, which make the driver always wait a full
timeout duration. This patch has the completion signal be triggered by
receiving the BRCMF_E_ACTION_FRAME_COMPLETE event for the on-channel
case.

Signed-off-by: Chung-Hsien Hsu <stanley.hsu@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit:3758e8288d6feb7b5dc125a4b8107a4f7e5963ab)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19517-15 brcmfmac: reduce timeout for action frame scan
Chung-Hsien Hsu [Fri, 8 Jun 2018 09:34:33 +0000 (17:34 +0800)]
MLK-19517-15 brcmfmac: reduce timeout for action frame scan

Finding a common channel to send an action frame out is required for
some action types. Since a loop with several scan retry is used to find
the channel, a short wait time could be considered for each attempt.
This patch reduces the wait time from 1500 to 450 msec for each action
frame scan.

Signed-off-by: Chung-Hsien Hsu <stanley.hsu@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit:4435f37332bd39026028a81b6e442bbe3105e790)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19517-14 brcmfmac: increase max hanger slots from 1K to 3K in fws layer
Madhan Mohan R [Thu, 24 May 2018 08:49:00 +0000 (14:19 +0530)]
MLK-19517-14 brcmfmac: increase max hanger slots from 1K to 3K in fws layer

Will enable FMAC to push more packets to bus tx queue and help
improve throughput when fws queuing is enabled. This change is
required to tune the throughput for passing WMM CERT tests.

Signed-off-by: Madhan Mohan R <MadhanMohan.R@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit:48195bf1b7dea8c6030dfce45900dda60f2d0ea4)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19517-13 brcmfmac: disable command decode in sdio_aos for 4354
Double Lo [Wed, 6 Jun 2018 02:39:58 +0000 (21:39 -0500)]
MLK-19517-13 brcmfmac: disable command decode in sdio_aos for 4354

Transaction between AOS and SDIOD is not protected, and if cmd 52
received in AOS and in the middle of response state changed from AOS to
SDIOD, response is corrupted and it causes to SDIO Host controller to
hang.

Signed-off-by: Lo-Hsiang Lo <double.lo@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit:50ad46dcdb5f23514f81567e7b0ac7f3ec9dc281)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19517-12 brcmfmac: only generate random p2p address when needed
Chi-Hsien Lin [Fri, 1 Jun 2018 10:22:05 +0000 (05:22 -0500)]
MLK-19517-12 brcmfmac: only generate random p2p address when needed

P2p spec mentioned that the p2p device address should be the globally
administered address with locally administered bit set. Therefore,
follow this guideline by default.

When the primary interface is set to a locally administered address, the
locally administered bit cannot be set again. Generate a random locally
administered address for this case.

Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit:930ac6e9230a48a775e55ee6cb31c4dffe5d5dcc)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19517-11 brcmfmac: P2P CERT 6.1.9-Support GOUT handling P2P Presence Request
Madhan Mohan R [Wed, 23 May 2018 11:52:44 +0000 (17:22 +0530)]
MLK-19517-11 brcmfmac: P2P CERT 6.1.9-Support GOUT handling P2P Presence Request

Send P2P Presence Response from the p2p interface address instead
of the p2p device address.

Signed-off-by: Madhan Mohan R <MadhanMohan.R@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit:1ce946c329e68457fd8e72da33d17251a7f2377c)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19517-09 brcmfmac: disable command decode in sdio_aos for 4339/4345
Wright Feng [Thu, 31 May 2018 02:11:20 +0000 (21:11 -0500)]
MLK-19517-09 brcmfmac: disable command decode in sdio_aos for 4339/4345

Transaction between AOS and SDIOD is not protected, and if cmd 52
received in AOS and in the middle of response state changed from AOS to
SDIOD, response is corrupted and it causes to SDIO Host controller to
hang.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit:166eee38c42e1dad00b05c52f9c3a8d6b5c8853f)
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19517-08 brcmfmac: fix unused variable building warning message
Wright Feng [Tue, 29 May 2018 07:52:58 +0000 (02:52 -0500)]
MLK-19517-08 brcmfmac: fix unused variable building warning message

The variable "wq_flags" is not used anymore. Remove it.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit:453591909a747bede4ff3fabe1d4073370f920f4)
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19517-07 brcmfmac: remove "arp_hostip_clear" from "brcmf_netdev_stop"
Wright Feng [Fri, 25 May 2018 07:02:04 +0000 (02:02 -0500)]
MLK-19517-07 brcmfmac: remove "arp_hostip_clear" from "brcmf_netdev_stop"

The firmware does not respond ARP request and causes ping failed with
following steps.

1. Bring up interface
   ifconfig wlan0 up or start wpa_supplicant
2. Set the IP address
   ifconfig wlan0 192.168.100.10
3. Bring down interface or
   ifconfig wlan0 down or kill wpa_supplicant
4. Bring up interface again and set the same IP address
5. Connect to AP(192.168.100.1) and ping to AP will be failed.

FMAC clears arp_hostip when bringing down the interface, but not set it
back if setting the same IP address. We are able to see the IP address
in interface info(inconfig wlan0) but the ping still cannot work because
the firmware ARP offload does not respond the ARP request.
Because of that, we remove "arp_hostip_clear" from function
"brcmf_netdev_stop"

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit: 840f43680465c41ab40be3758f9dc91a91175d98)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19517-06 brcmfmac: add 4-way handshake offload detection for FT-802.1X
Chung-Hsien Hsu [Thu, 24 May 2018 03:15:09 +0000 (11:15 +0800)]
MLK-19517-06 brcmfmac: add 4-way handshake offload detection for FT-802.1X

Add 4-way handshake offload detection for FT with EAP authentication.

Signed-off-by: Chung-Hsien Hsu <stanley.hsu@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit: e25e421d61441199b50e4c13f50a27416f00c65c)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19517-05 brcmfmac: add credit map updating support
Wright Feng [Wed, 18 Apr 2018 02:33:21 +0000 (21:33 -0500)]
MLK-19517-05 brcmfmac: add credit map updating support

The credit numbers are static and tunable per chip in firmware side.
However the credit number may be changed that is based on packet pool
length and will send BRCMF_E_FIFO_CREDIT_MAP event to ask host driver
updating the credit numbers during interface up.
The purpose of this patch is making host driver has ability of updating
the credit numbers when receiving the BRCMF_E_FIFO_CREDIT_MAP event.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit: b26faa8fe2a6cc7e8b2acceb35254b9fad5bd461)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19517-04 brcmfmac: make setting SDIO workqueue WQ_HIGHPRI a module parameter
Wright Feng [Mon, 26 Mar 2018 02:53:42 +0000 (21:53 -0500)]
MLK-19517-04 brcmfmac: make setting SDIO workqueue WQ_HIGHPRI a module parameter

With setting sdio_wq_highpri=1 in module parameters, tasks submitted to
SDIO workqueue will put at the head of the queue and run immediately.
This parameter is for getting higher TX/RX throughput with SDIO bus.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit: 7c2b310299f051be555c6928f0f858fdbac35abb)
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19517-03 revert: brcmfmac: add a module parameter to set scheduling priority...
Wright Feng [Thu, 26 Apr 2018 06:35:53 +0000 (01:35 -0500)]
MLK-19517-03 revert: brcmfmac: add a module parameter to set scheduling priority of sdio_dpc

will use WQ_HIGHPRI instead.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit: 2925b73171942933311e87ab51747a055cfd8abf)
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19517-02 brcmfmac: handle compressed tx status signal
Chung-Hsien Hsu [Tue, 8 May 2018 07:29:35 +0000 (15:29 +0800)]
MLK-19517-02 brcmfmac: handle compressed tx status signal

Firmware inform the driver about tx status by normal tx status signal
or compressed tx status signal. This patch adds support to handle the
compressed tx status signal.

Signed-off-by: Chung-Hsien Hsu <stanley.hsu@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit: 480bdeffb48904468ca5591721b148a736e03d68)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19517-01 brcmfmac: add CYW89342 PCIE device
Saint Chuang [Fri, 4 May 2018 08:49:53 +0000 (03:49 -0500)]
MLK-19517-01 brcmfmac: add CYW89342 PCIE device

CYW89342 is a 2x2 MIMO,802.11a/b/g/n/ac,SDIO 3.0 and PCIe 3.0 for WLAN.
It is an automotive wireless chip.

Signed-off-by: Saint Chuang <jiac@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit: 53fda4df73934276239dc5b43cceecf2d9f62c52)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19091 cfg80211: make phy index match after wiphy dev is released
Andy Duan [Thu, 13 Sep 2018 09:23:37 +0000 (17:23 +0800)]
MLK-19091 cfg80211: make phy index match after wiphy dev is released

During insmod/rmmod test, the phy index increases that cause troube
for test case. To make global variable wiphy_counter match between
creat and free wiphy device, it needs to decrease the atomic counter
when wiphy device is freed.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-19516 brcmfmac: fix 4339 CRC error under SDIO 3.0 SDR104 mode
Double Lo [Thu, 6 Sep 2018 05:49:41 +0000 (00:49 -0500)]
MLK-19516 brcmfmac: fix 4339 CRC error under SDIO 3.0 SDR104 mode

This patch fixes 4339 CRC error while running Tput test with
suspend/resume test script. Update F2 Watermark to 48 to avoid
CRC error.

The continuous failure messages before system crash:
brcmfmac: brcmf_sdiod_sglist_rw: CMD53 sg block read failed -84
brcmfmac: brcmf_sdio_rxglom: glom read of 25600 bytes failed: -5
brcmfmac: brcmf_sdio_rxfail: abort command, terminate frame
brcmfmac: brcmf_sdiod_sglist_rw: CMD53 sg block read failed -84
brcmfmac: brcmf_sdio_rxglom: glom read of 24576 bytes failed: -5
brcmfmac: brcmf_sdio_rxfail: abort command, terminate frame

Tested-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Lo-Hsiang Lo <double.lo@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-18675-21 brcmfmac: Remove WOWL configuration in disconnect state
Double Lo [Tue, 13 Mar 2018 08:22:20 +0000 (03:22 -0500)]
MLK-18675-21 brcmfmac: Remove WOWL configuration in disconnect state

Set wowl configuration in disconnect state is redundant.
Remove it to fix no scan result issue after resume.

Signed-off-by: Lo-Hsiang Lo <double.lo@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-18675-20 brcmfmac: Support wake on ping packet
Double Lo [Tue, 6 Feb 2018 11:07:05 +0000 (05:07 -0600)]
MLK-18675-20 brcmfmac: Support wake on ping packet

FMAC driver need to provide a dummy wowlan filter for kernel and
provided the well configured wowlan stack. So the system will
keep driver in connected state in suspend mode and can be wake
up by ping packet.

Enable unicast packet filter before system suspend and
disable it after resume.

Signed-off-by: Lo-Hsiang Lo <double.lo@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-18675-19 brcmfmac: make firmware eap_restrict a module parameter
Wright Feng [Fri, 2 Mar 2018 06:45:32 +0000 (00:45 -0600)]
MLK-18675-19 brcmfmac: make firmware eap_restrict a module parameter

When eap_restrict is enabled, firmware will toss non-802.1x frames from
tx/rx data path if station not yet authorized.
Internal firmware eap_restrict is disabled by default. This patch makes
it possible to enable firmware eap_restrict by specifying
eap_restrict=1 as module parameter.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-18675-18 brcmfmac: add a module parameter to set scheduling priority of sdio_dpc
Wright Feng [Fri, 2 Mar 2018 02:41:21 +0000 (20:41 -0600)]
MLK-18675-18 brcmfmac: add a module parameter to set scheduling priority of sdio_dpc

To enhance RX throughput, we add a module parameter "sdio_dpc_prio" to let
user can set scheduling  priority for sdio_dpc. It can improve RX
throughput by reducing the receiving time in sdio_dpc.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-18675-17 brcmfmac: fix system warning message during wowl suspend
Double Lo [Mon, 5 Feb 2018 10:33:49 +0000 (04:33 -0600)]
MLK-18675-17 brcmfmac: fix system warning message during wowl suspend

There is a system warning message, warn_slowpath-fmt, during suspend
while using supplicant join AP and enable wowl feature by IW command.
It's cuased by brcmf_pno_remove_request path can't find the reqid.
This fix will not go to remove pno request function if there is no
pno scan.

Signed-off-by: Lo-Hsiang Lo <double.lo@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-18675-16 brcmfmac: do not print ulp_sdioctrl get error
Naveen [Tue, 6 Feb 2018 06:22:58 +0000 (11:52 +0530)]
MLK-18675-16 brcmfmac: do not print ulp_sdioctrl get error

Don't print ulp_sdioctrl get error as errors are expected for non ulp
cases.

Signed-off-by: Naveen Gupta <nagu@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-18675-15 brcmfmac: support AP isolation
Wright Feng [Wed, 31 Jan 2018 10:07:12 +0000 (04:07 -0600)]
MLK-18675-15 brcmfmac: support AP isolation

Hostap daemon has a parameter "ap_isolate which is used to prevent
low-level bridging of frames between associated stations in the BSS.
For driver side, we add cfg80211 ops method change_bss to support
setting AP isolation from user space.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Chi-hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-18675-14 brcmfmac: Add support for 43428 SDIO device ID
Wright Feng [Mon, 29 Jan 2018 02:52:08 +0000 (20:52 -0600)]
MLK-18675-14 brcmfmac: Add support for 43428 SDIO device ID

The device 43428 is a new SDIO device ID but shares the same WLAN core
with device 43430a1. It is a 1x1 802.11b/g/n 2.4GHz HT20,
256-QAM/Turbo QAM WLAN chip.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Chi-hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-18675-13 brcmfmac: add FT-based AKMs in brcmf_set_key_mgmt() for FT support
Chung-Hsien Hsu [Thu, 1 Feb 2018 03:50:33 +0000 (11:50 +0800)]
MLK-18675-13 brcmfmac: add FT-based AKMs in brcmf_set_key_mgmt() for FT support

Add WLAN_AKM_SUITE_FT_8021X and WLAN_AKM_SUITE_FT_PSK in
brcmf_set_key_mgmt() for FT support.

Signed-off-by: Chung-Hsien Hsu <stanley.hsu@cypress.com>
Signed-off-by: Chi-hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agobrcmfmac: Fix compilation error
Vipul Kumar [Tue, 8 Jan 2019 09:13:36 +0000 (14:43 +0530)]
brcmfmac: Fix compilation error

This patch fix the below compilation errors.

drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c: In function ‘brcmf_sdio_ulp_pre_redownload_check’:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:2631:10: error: implicit declaration of function ‘brcmf_sdiod_regrb’; did you mean ‘brcmf_sdiod_readb’? [-Werror=implicit-function-declaration]
  value = brcmf_sdiod_regrb(bus->sdiodev, SDIO_CCCR_IOEx, &err);
          ^~~~~~~~~~~~~~~~~
          brcmf_sdiod_readb
In file included from drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:42:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h:437:2: error: implicit declaration of function ‘brcmf_sdiod_regrl’; did you mean ‘brcmf_sdiod_readl’? [-Werror=implicit-function-declaration]
  brcmf_sdiod_regrl(sdh, D11SHM_ADDR(offset), ret)
  ^~~~~~~~~~~~~~~~~
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:2636:18: note: in expansion of macro ‘D11SHM_RD’
   ulp_wake_ind = D11SHM_RD(bus->sdiodev, M_ULP_WAKE_IND(
                  ^~~~~~~~~
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h:434:2: error: implicit declaration of function ‘brcmf_sdiod_regwl’; did you mean ‘brcmf_sdiod_readl’? [-Werror=implicit-function-declaration]
  brcmf_sdiod_regwl(sdh, D11SHM_ADDR(offset), val, ret)
  ^~~~~~~~~~~~~~~~~
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:2654:4: note: in expansion of macro ‘D11SHM_WR’
    D11SHM_WR(bus->sdiodev, M_DS1_CTRL_SDIO(
    ^~~~~~~~~
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c: In function ‘brcmf_sdio_firmware_callback’:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:4388:9: error: implicit declaration of function ‘brcmf_bus_started’; did you mean ‘brcmf_bus_txctl’? [-Werror=implicit-function-declaration]
   err = brcmf_bus_started(dev);
         ^~~~~~~~~~~~~~~~~
         brcmf_bus_txctl
cc1: some warnings being treated as errors
scripts/Makefile.build:303: recipe for target 'drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.o' failed
make[6]: *** [drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.o] Error 1

Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agobrcmfmac: pass struct in brcmf_fw_get_firmwares()
Vipul Kumar [Tue, 8 Jan 2019 08:59:39 +0000 (14:29 +0530)]
brcmfmac: pass struct in brcmf_fw_get_firmwares()

As per 'commit d09ae51a4b67 ("brcmfmac: pass struct in
brcmf_fw_get_firmwares()")', make changes in the brcmf_fw_get_firmwares()
call to fix the compilation error.

drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c: In function ‘brcmf_sdio_ulp_reinit_fw’:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:2597:45: error: ‘BRCMF_FW_REQUEST_NVRAM’ undeclared (first use in this function); did you mean ‘BRCMF_FW_TYPE_NVRAM’?
  err = brcmf_fw_get_firmwares(sdiodev->dev, BRCMF_FW_REQUEST_NVRAM,
                                             ^~~~~~~~~~~~~~~~~~~~~~
                                             BRCMF_FW_TYPE_NVRAM
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:2597:45: note: each undeclared identifier is reported only once for each function it appears in
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:2598:17: error: passing argument 3 of ‘brcmf_fw_get_firmwares’ from incompatible pointer type [-Werror=incompatible-pointer-types]
          sdiodev->fw_name, sdiodev->nvram_name,
          ~~~~~~~^~~~~~~~~
In file included from drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h:22,
                 from drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:42:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h:93:14: note: expected ‘void (*)(struct device *, int,  struct brcmf_fw_request *)’ but argument is of type ‘char *’
       void (*fw_cb)(struct device *dev, int err,
       ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       struct brcmf_fw_request *req));
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:2597:8: error: too many arguments to function ‘brcmf_fw_get_firmwares’
  err = brcmf_fw_get_firmwares(sdiodev->dev, BRCMF_FW_REQUEST_NVRAM,
        ^~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h:22,
                 from drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:42:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h:92:5: note: declared here
 int brcmf_fw_get_firmwares(struct device *dev, struct brcmf_fw_request *req,
     ^~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-18675-12 brcmfmac: DS1 Exit should re download the firmware.
Naveen [Tue, 9 Jan 2018 06:03:10 +0000 (11:33 +0530)]
MLK-18675-12 brcmfmac: DS1 Exit should re download the firmware.

In Deep Sleep mode ARM is off and once Exit trigger comes than
Mail Box Interrupt comes to Host and whole Re Initiation should be done
in the ARM to start TX/RX.

Signed-off-by: Naveen Gupta <nagu@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Vipul: Fixed merge conflicts
Conflict:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-18675-11 brcmfmac: 43012 Update F2 Watermark to 0x60 to fix DMA Error during...
Naveen [Thu, 4 Jan 2018 06:04:15 +0000 (11:34 +0530)]
MLK-18675-11 brcmfmac: 43012 Update F2 Watermark to 0x60 to fix DMA Error during UDP RX Traffic.

The number of words that the read FIFO has to contain except
the end of frame before sends data back to the host.
Max watermark = (512B - 2* (BurstLength))/4 =
(512 - 128)/4 = 384/4 = 0x60
so if burst length (i.e. BurstLength = 64) is increased,
watermark has to be reduced. This is the optimal setting for this chip.

Signed-off-by: Naveen Gupta <nagu@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-18675-10 brcmfmac: calling skb_orphan before sending skb to SDIO bus
Wright Feng [Tue, 2 Jan 2018 02:12:54 +0000 (20:12 -0600)]
MLK-18675-10 brcmfmac: calling skb_orphan before sending skb to SDIO bus

Linux 3.6 introduces TSQ which has a per socket threshold for TCP Tx
packet to reduce latency. In fcmode 1/2, host driver enqueues skb in
hanger and TCP doesn't push new skb frees until host frees the skb when
receiving fwstatus event. So using skb_orphan before sending skb to bus
will make the skb removing the ownership of socket. With this patch, we
got better throughput in fcmode 1/2.

Tested 43455 TCP throughput in 20 MHz bandwidth with/without this patch.
fcmode 0: 59.5 / 59.6 (Mbps)
fcmode 1: 59.3 / 23.4 (Mbps)
fcmode 2: 59.6 / 21.5 (Mbps)

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-18675-07 brcmfmac: Saverestore support changes for 43012
Andy Duan [Mon, 25 Jun 2018 08:54:07 +0000 (16:54 +0800)]
MLK-18675-07 brcmfmac: Saverestore support changes for 43012

Saverestore register settings for 43012.

Signed-off-by: Praveen Babu Chandran <pucn@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Vipul: updated while rebase on v4.19
conflicts:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-18675-06 brcmfmac: set apsta to 1 when AP start on primary interface.
Wright Feng [Mon, 11 Sep 2017 07:48:57 +0000 (02:48 -0500)]
MLK-18675-06 brcmfmac: set apsta to 1 when AP start on primary interface.

APSTA can work on two band concurrently with using VSDB(Virtual
Simultaneous Dual-Band) or RSDB(Real Simultaneous Dual-Band) features.
In this case, we have to keep apsta is 1 in firmware side. However, if
we start wpa_supplicant on wlan0 and then start hostapd on wlan 1, the
apsta will be set to 0, and we will see data stall on wlan0(station)
So that, we only set apsta to 1 when AP start on primary interface.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-18675-05 brcmfmac: Add support for CYW43012 SDIO chipset
Chi-Hsien Lin [Tue, 20 Jun 2017 07:20:23 +0000 (02:20 -0500)]
MLK-18675-05 brcmfmac: Add support for CYW43012 SDIO chipset

CYW43012 is a 1x1 802.11a/b/g/n Dual-Band HT20, 256-QAM/Turbo QAM. It
is an Ultra Low Power WLAN+BT combo chip.

Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Vipul: updated whilre rebase on v4.19
conflicts:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-18675-04 brcmfmac: return -EPERM when getting error in vendor command handler
Wright Feng [Tue, 22 Aug 2017 03:36:04 +0000 (22:36 -0500)]
MLK-18675-04 brcmfmac: return -EPERM when getting error in vendor command handler

Firmware returns proprietary error code when getting error in
fil_cmd_data_set or fil_cmd_data_get. Sometimes the vendor tool or
utilities which uses libnl may stuck in some commands when wl is down.
For example, issue "scan" command after issuing "down" command, the
"scan" command will be the blocking call and stuck as no response from
firmware. It is caused by that firmware returns BCME_NOTUP(-4) when wl
is down, but in Linux the -4 is -EINTR, so libnl catches the error and
not pass to upper layer.
Because of that, the driver should return Linux error code instead of the
proprietary error code, and the tools or utilities need to get the real
firmware error code by another command "bcmerrorstr" after receiving
the error.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agoMLK-18675-03 brcmfmac: Add sg parameters dts parsing
Chi-Hsien Lin [Tue, 15 Aug 2017 05:25:14 +0000 (00:25 -0500)]
MLK-18675-03 brcmfmac: Add sg parameters dts parsing

broken_sg_support, sd_head_align, and sd_sgentry_align are used in
brcmfmac code but not configurable in dts file. Add the parsing logic.
Now they can be configured like below in dts:
brcm,broken_sg_support;
brcm,sd_head_align = /bits/ 16 <4>;
brcm,sd_sgentry_align = /bits/ 16 <4>;

Signed-off-by: Chi-hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agobrcmfmac: Rename / replace old IO functions with simpler ones.
Vipul Kumar [Tue, 8 Jan 2019 06:46:20 +0000 (12:16 +0530)]
brcmfmac: Rename / replace old IO functions with simpler ones.

As per 'commit 71bd508d7ded ("brcmfmac: Rename / replace old IO functions
with simpler ones.")', rename/ replace old IO functions to fix the
compilation errors.

drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c: In function ‘brcmf_sdio_firmware_callback’:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:4116:4: error: implicit declaration of function ‘brcmf_sdiod_regwb’; did you mean ‘brcmf_sdiod_readb’? [-Werror=implicit-function-declaration]
    brcmf_sdiod_regwb(sdiodev, SBSDIO_WATERMARK, CY_4373_F2_WATERMARK, &err);
    ^~~~~~~~~~~~~~~~~
    brcmf_sdiod_readb
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:4116:22: error: ‘sdiodev’ undeclared (first use in this function); did you mean ‘sdiod’?
    brcmf_sdiod_regwb(sdiodev, SBSDIO_WATERMARK, CY_4373_F2_WATERMARK, &err);
                      ^~~~~~~
                      sdiod
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:4116:22: note: each undeclared identifier is reported only once for each function it appears in
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:4117:13: error: implicit declaration of function ‘brcmf_sdiod_regrb’; did you mean ‘brcmf_sdiod_readb’? [-Werror=implicit-function-declaration]
    devctl = brcmf_sdiod_regrb(sdiodev, SBSDIO_DEVICE_CTL, &err);
             ^~~~~~~~~~~~~~~~~
             brcmf_sdiod_readb
cc1: some warnings being treated as errors
scripts/Makefile.build:303: recipe for target 'drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.o' failed

Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
6 years agobrcmfmac: Fix compilation error
Vipul Kumar [Tue, 8 Jan 2019 06:30:10 +0000 (12:00 +0530)]
brcmfmac: Fix compilation error

As per 'commit 2d6edad4b2da ("brcmfmac: remove duplicate pointer variable
from brcmf_sdio_firmware_callback()")', make changes to fix the
compilation error.

drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c: In function ‘brcmf_sdio_firmware_callback’:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:4112:11: error: ‘sdiodev’ undeclared (first use in this function); did you mean ‘sdiod’?
   switch (sdiodev->func0->device) {
           ^~~~~~~
           sdiod
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:4112:11: note: each undeclared identifier is reported only once for each function it appears in

Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>