aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorFranky Lin <frankyl@broadcom.com>2012-05-04 21:27:33 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-05-15 17:27:57 -0400
commit3bba829f63ad776be487005c3a106531a27806f5 (patch)
tree62d93f40fac028700137e0b664b0a1f2bf066c0f /drivers/net
parent45db339cd2b138fba993013b5d73049fd3384e44 (diff)
brcmfmac: replace brcmf_sdcard_cfg_write with brcmf_sdio_regwb
Use the newly introduced brcmf_sdio_regwb to replace brcmf_sdcard_cfg_write as part of the SDIO WiFi dongle register access interface clean up. Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Reviewed-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Franky Lin <frankyl@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c32
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c96
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c9
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h9
4 files changed, 48 insertions, 98 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
index fc5c628e76a5..f6bb148c5ad3 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
@@ -87,15 +87,13 @@ int brcmf_sdio_intr_register(struct brcmf_sdio_dev *sdiodev)
87 /* must configure SDIO_CCCR_IENx to enable irq */ 87 /* must configure SDIO_CCCR_IENx to enable irq */
88 data = brcmf_sdio_regrb(sdiodev, SDIO_CCCR_IENx, &ret); 88 data = brcmf_sdio_regrb(sdiodev, SDIO_CCCR_IENx, &ret);
89 data |= 1 << SDIO_FUNC_1 | 1 << SDIO_FUNC_2 | 1; 89 data |= 1 << SDIO_FUNC_1 | 1 << SDIO_FUNC_2 | 1;
90 brcmf_sdcard_cfg_write(sdiodev, SDIO_FUNC_0, SDIO_CCCR_IENx, 90 brcmf_sdio_regwb(sdiodev, SDIO_CCCR_IENx, data, &ret);
91 data, &ret);
92 91
93 /* redirect, configure ane enable io for interrupt signal */ 92 /* redirect, configure ane enable io for interrupt signal */
94 data = SDIO_SEPINT_MASK | SDIO_SEPINT_OE; 93 data = SDIO_SEPINT_MASK | SDIO_SEPINT_OE;
95 if (sdiodev->irq_flags | IRQF_TRIGGER_HIGH) 94 if (sdiodev->irq_flags | IRQF_TRIGGER_HIGH)
96 data |= SDIO_SEPINT_ACT_HI; 95 data |= SDIO_SEPINT_ACT_HI;
97 brcmf_sdcard_cfg_write(sdiodev, SDIO_FUNC_0, SDIO_CCCR_BRCM_SEPINT, 96 brcmf_sdio_regwb(sdiodev, SDIO_CCCR_BRCM_SEPINT, data, &ret);
98 data, &ret);
99 97
100 return 0; 98 return 0;
101} 99}
@@ -104,9 +102,8 @@ int brcmf_sdio_intr_unregister(struct brcmf_sdio_dev *sdiodev)
104{ 102{
105 brcmf_dbg(TRACE, "Entering\n"); 103 brcmf_dbg(TRACE, "Entering\n");
106 104
107 brcmf_sdcard_cfg_write(sdiodev, SDIO_FUNC_0, SDIO_CCCR_BRCM_SEPINT, 105 brcmf_sdio_regwb(sdiodev, SDIO_CCCR_BRCM_SEPINT, 0, NULL);
108 0, NULL); 106 brcmf_sdio_regwb(sdiodev, SDIO_CCCR_IENx, 0, NULL);
109 brcmf_sdcard_cfg_write(sdiodev, SDIO_FUNC_0, SDIO_CCCR_IENx, 0, NULL);
110 107
111 if (sdiodev->irq_wake) { 108 if (sdiodev->irq_wake) {
112 disable_irq_wake(sdiodev->irq); 109 disable_irq_wake(sdiodev->irq);
@@ -157,27 +154,6 @@ int brcmf_sdio_intr_unregister(struct brcmf_sdio_dev *sdiodev)
157} 154}
158#endif /* CONFIG_BRCMFMAC_SDIO_OOB */ 155#endif /* CONFIG_BRCMFMAC_SDIO_OOB */
159 156
160void
161brcmf_sdcard_cfg_write(struct brcmf_sdio_dev *sdiodev, uint fnc_num, u32 addr,
162 u8 data, int *err)
163{
164 int status;
165 s32 retry = 0;
166
167 do {
168 if (retry) /* wait for 1 ms till bus get settled down */
169 udelay(1000);
170 status = brcmf_sdioh_request_byte(sdiodev, SDIOH_WRITE, fnc_num,
171 addr, (u8 *) &data);
172 } while (status != 0
173 && (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT));
174 if (err)
175 *err = status;
176
177 brcmf_dbg(INFO, "fun = %d, addr = 0x%x, u8data = 0x%x\n",
178 fnc_num, addr, data);
179}
180
181int 157int
182brcmf_sdcard_set_sbaddr_window(struct brcmf_sdio_dev *sdiodev, u32 address) 158brcmf_sdcard_set_sbaddr_window(struct brcmf_sdio_dev *sdiodev, u32 address)
183{ 159{
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
index 85f277c2efab..1e35a3de9595 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
@@ -696,8 +696,8 @@ static int brcmf_sdbrcm_htclk(struct brcmf_sdio *bus, bool on, bool pendok)
696 clkreq = 696 clkreq =
697 bus->alp_only ? SBSDIO_ALP_AVAIL_REQ : SBSDIO_HT_AVAIL_REQ; 697 bus->alp_only ? SBSDIO_ALP_AVAIL_REQ : SBSDIO_HT_AVAIL_REQ;
698 698
699 brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1, 699 brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
700 SBSDIO_FUNC1_CHIPCLKCSR, clkreq, &err); 700 clkreq, &err);
701 if (err) { 701 if (err) {
702 brcmf_dbg(ERROR, "HT Avail request error: %d\n", err); 702 brcmf_dbg(ERROR, "HT Avail request error: %d\n", err);
703 return -EBADE; 703 return -EBADE;
@@ -723,8 +723,8 @@ static int brcmf_sdbrcm_htclk(struct brcmf_sdio *bus, bool on, bool pendok)
723 } 723 }
724 724
725 devctl |= SBSDIO_DEVCTL_CA_INT_ONLY; 725 devctl |= SBSDIO_DEVCTL_CA_INT_ONLY;
726 brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1, 726 brcmf_sdio_regwb(bus->sdiodev, SBSDIO_DEVICE_CTL,
727 SBSDIO_DEVICE_CTL, devctl, &err); 727 devctl, &err);
728 brcmf_dbg(INFO, "CLKCTL: set PENDING\n"); 728 brcmf_dbg(INFO, "CLKCTL: set PENDING\n");
729 bus->clkstate = CLK_PENDING; 729 bus->clkstate = CLK_PENDING;
730 730
@@ -734,8 +734,8 @@ static int brcmf_sdbrcm_htclk(struct brcmf_sdio *bus, bool on, bool pendok)
734 devctl = brcmf_sdio_regrb(bus->sdiodev, 734 devctl = brcmf_sdio_regrb(bus->sdiodev,
735 SBSDIO_DEVICE_CTL, &err); 735 SBSDIO_DEVICE_CTL, &err);
736 devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY; 736 devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY;
737 brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1, 737 brcmf_sdio_regwb(bus->sdiodev, SBSDIO_DEVICE_CTL,
738 SBSDIO_DEVICE_CTL, devctl, &err); 738 devctl, &err);
739 } 739 }
740 740
741 /* Otherwise, wait here (polling) for HT Avail */ 741 /* Otherwise, wait here (polling) for HT Avail */
@@ -780,13 +780,13 @@ static int brcmf_sdbrcm_htclk(struct brcmf_sdio *bus, bool on, bool pendok)
780 devctl = brcmf_sdio_regrb(bus->sdiodev, 780 devctl = brcmf_sdio_regrb(bus->sdiodev,
781 SBSDIO_DEVICE_CTL, &err); 781 SBSDIO_DEVICE_CTL, &err);
782 devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY; 782 devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY;
783 brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1, 783 brcmf_sdio_regwb(bus->sdiodev, SBSDIO_DEVICE_CTL,
784 SBSDIO_DEVICE_CTL, devctl, &err); 784 devctl, &err);
785 } 785 }
786 786
787 bus->clkstate = CLK_SDONLY; 787 bus->clkstate = CLK_SDONLY;
788 brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1, 788 brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
789 SBSDIO_FUNC1_CHIPCLKCSR, clkreq, &err); 789 clkreq, &err);
790 brcmf_dbg(INFO, "CLKCTL: turned OFF\n"); 790 brcmf_dbg(INFO, "CLKCTL: turned OFF\n");
791 if (err) { 791 if (err) {
792 brcmf_dbg(ERROR, "Failed access turning clock off: %d\n", 792 brcmf_dbg(ERROR, "Failed access turning clock off: %d\n",
@@ -897,14 +897,12 @@ static int brcmf_sdbrcm_bussleep(struct brcmf_sdio *bus, bool sleep)
897 /* Turn off our contribution to the HT clock request */ 897 /* Turn off our contribution to the HT clock request */
898 brcmf_sdbrcm_clkctl(bus, CLK_SDONLY, false); 898 brcmf_sdbrcm_clkctl(bus, CLK_SDONLY, false);
899 899
900 brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1, 900 brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
901 SBSDIO_FUNC1_CHIPCLKCSR, 901 SBSDIO_FORCE_HW_CLKREQ_OFF, NULL);
902 SBSDIO_FORCE_HW_CLKREQ_OFF, NULL);
903 902
904 /* Isolate the bus */ 903 /* Isolate the bus */
905 brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1, 904 brcmf_sdio_regwb(bus->sdiodev, SBSDIO_DEVICE_CTL,
906 SBSDIO_DEVICE_CTL, 905 SBSDIO_DEVCTL_PADS_ISO, NULL);
907 SBSDIO_DEVCTL_PADS_ISO, NULL);
908 906
909 /* Change state */ 907 /* Change state */
910 bus->sleeping = true; 908 bus->sleeping = true;
@@ -912,8 +910,8 @@ static int brcmf_sdbrcm_bussleep(struct brcmf_sdio *bus, bool sleep)
912 } else { 910 } else {
913 /* Waking up: bus power up is ok, set local state */ 911 /* Waking up: bus power up is ok, set local state */
914 912
915 brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1, 913 brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
916 SBSDIO_FUNC1_CHIPCLKCSR, 0, NULL); 914 0, NULL);
917 915
918 /* Make sure the controller has the bus up */ 916 /* Make sure the controller has the bus up */
919 brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false); 917 brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false);
@@ -1035,9 +1033,8 @@ static void brcmf_sdbrcm_rxfail(struct brcmf_sdio *bus, bool abort, bool rtx)
1035 if (abort) 1033 if (abort)
1036 brcmf_sdcard_abort(bus->sdiodev, SDIO_FUNC_2); 1034 brcmf_sdcard_abort(bus->sdiodev, SDIO_FUNC_2);
1037 1035
1038 brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1, 1036 brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_FRAMECTRL,
1039 SBSDIO_FUNC1_FRAMECTRL, 1037 SFC_RF_TERM, &err);
1040 SFC_RF_TERM, &err);
1041 bus->f1regdata++; 1038 bus->f1regdata++;
1042 1039
1043 /* Wait until the packet has been flushed (device/FIFO stable) */ 1040 /* Wait until the packet has been flushed (device/FIFO stable) */
@@ -2173,9 +2170,8 @@ static int brcmf_sdbrcm_txpkt(struct brcmf_sdio *bus, struct sk_buff *pkt,
2173 bus->tx_sderrs++; 2170 bus->tx_sderrs++;
2174 2171
2175 brcmf_sdcard_abort(bus->sdiodev, SDIO_FUNC_2); 2172 brcmf_sdcard_abort(bus->sdiodev, SDIO_FUNC_2);
2176 brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1, 2173 brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_FRAMECTRL,
2177 SBSDIO_FUNC1_FRAMECTRL, SFC_WF_TERM, 2174 SFC_WF_TERM, NULL);
2178 NULL);
2179 bus->f1regdata++; 2175 bus->f1regdata++;
2180 2176
2181 for (i = 0; i < 3; i++) { 2177 for (i = 0; i < 3; i++) {
@@ -2305,17 +2301,16 @@ static void brcmf_sdbrcm_bus_stop(struct device *dev)
2305 saveclk = brcmf_sdio_regrb(bus->sdiodev, 2301 saveclk = brcmf_sdio_regrb(bus->sdiodev,
2306 SBSDIO_FUNC1_CHIPCLKCSR, &err); 2302 SBSDIO_FUNC1_CHIPCLKCSR, &err);
2307 if (!err) { 2303 if (!err) {
2308 brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1, 2304 brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
2309 SBSDIO_FUNC1_CHIPCLKCSR, 2305 (saveclk | SBSDIO_FORCE_HT), &err);
2310 (saveclk | SBSDIO_FORCE_HT), &err);
2311 } 2306 }
2312 if (err) 2307 if (err)
2313 brcmf_dbg(ERROR, "Failed to force clock for F2: err %d\n", err); 2308 brcmf_dbg(ERROR, "Failed to force clock for F2: err %d\n", err);
2314 2309
2315 /* Turn off the bus (F2), free any pending packets */ 2310 /* Turn off the bus (F2), free any pending packets */
2316 brcmf_dbg(INTR, "disable SDIO interrupts\n"); 2311 brcmf_dbg(INTR, "disable SDIO interrupts\n");
2317 brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_0, SDIO_CCCR_IOEx, 2312 brcmf_sdio_regwb(bus->sdiodev, SDIO_CCCR_IOEx, SDIO_FUNC_ENABLE_1,
2318 SDIO_FUNC_ENABLE_1, NULL); 2313 NULL);
2319 2314
2320 /* Clear any pending interrupts now that F2 is disabled */ 2315 /* Clear any pending interrupts now that F2 is disabled */
2321 w_sdreg32(bus, local_hostintmask, 2316 w_sdreg32(bus, local_hostintmask,
@@ -2414,8 +2409,8 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
2414 bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; 2409 bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN;
2415 } 2410 }
2416 devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY; 2411 devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY;
2417 brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1, 2412 brcmf_sdio_regwb(bus->sdiodev, SBSDIO_DEVICE_CTL,
2418 SBSDIO_DEVICE_CTL, devctl, &err); 2413 devctl, &err);
2419 if (err) { 2414 if (err) {
2420 brcmf_dbg(ERROR, "error writing DEVCTL: %d\n", 2415 brcmf_dbg(ERROR, "error writing DEVCTL: %d\n",
2421 err); 2416 err);
@@ -2536,9 +2531,8 @@ clkwait:
2536 2531
2537 brcmf_sdcard_abort(bus->sdiodev, SDIO_FUNC_2); 2532 brcmf_sdcard_abort(bus->sdiodev, SDIO_FUNC_2);
2538 2533
2539 brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1, 2534 brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_FRAMECTRL,
2540 SBSDIO_FUNC1_FRAMECTRL, SFC_WF_TERM, 2535 SFC_WF_TERM, NULL);
2541 NULL);
2542 bus->f1regdata++; 2536 bus->f1regdata++;
2543 2537
2544 for (i = 0; i < 3; i++) { 2538 for (i = 0; i < 3; i++) {
@@ -2874,9 +2868,8 @@ static int brcmf_tx_frame(struct brcmf_sdio *bus, u8 *frame, u16 len)
2874 2868
2875 brcmf_sdcard_abort(bus->sdiodev, SDIO_FUNC_2); 2869 brcmf_sdcard_abort(bus->sdiodev, SDIO_FUNC_2);
2876 2870
2877 brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1, 2871 brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_FRAMECTRL,
2878 SBSDIO_FUNC1_FRAMECTRL, 2872 SFC_WF_TERM, NULL);
2879 SFC_WF_TERM, NULL);
2880 bus->f1regdata++; 2873 bus->f1regdata++;
2881 2874
2882 for (i = 0; i < 3; i++) { 2875 for (i = 0; i < 3; i++) {
@@ -3461,9 +3454,8 @@ static int brcmf_sdbrcm_bus_init(struct device *dev)
3461 saveclk = brcmf_sdio_regrb(bus->sdiodev, 3454 saveclk = brcmf_sdio_regrb(bus->sdiodev,
3462 SBSDIO_FUNC1_CHIPCLKCSR, &err); 3455 SBSDIO_FUNC1_CHIPCLKCSR, &err);
3463 if (!err) { 3456 if (!err) {
3464 brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1, 3457 brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
3465 SBSDIO_FUNC1_CHIPCLKCSR, 3458 (saveclk | SBSDIO_FORCE_HT), &err);
3466 (saveclk | SBSDIO_FORCE_HT), &err);
3467 } 3459 }
3468 if (err) { 3460 if (err) {
3469 brcmf_dbg(ERROR, "Failed to force clock for F2: err %d\n", err); 3461 brcmf_dbg(ERROR, "Failed to force clock for F2: err %d\n", err);
@@ -3475,8 +3467,7 @@ static int brcmf_sdbrcm_bus_init(struct device *dev)
3475 offsetof(struct sdpcmd_regs, tosbmailboxdata), &retries); 3467 offsetof(struct sdpcmd_regs, tosbmailboxdata), &retries);
3476 enable = (SDIO_FUNC_ENABLE_1 | SDIO_FUNC_ENABLE_2); 3468 enable = (SDIO_FUNC_ENABLE_1 | SDIO_FUNC_ENABLE_2);
3477 3469
3478 brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_0, SDIO_CCCR_IOEx, 3470 brcmf_sdio_regwb(bus->sdiodev, SDIO_CCCR_IOEx, enable, NULL);
3479 enable, NULL);
3480 3471
3481 timeout = jiffies + msecs_to_jiffies(BRCMF_WAIT_F2RDY); 3472 timeout = jiffies + msecs_to_jiffies(BRCMF_WAIT_F2RDY);
3482 ready = 0; 3473 ready = 0;
@@ -3499,19 +3490,16 @@ static int brcmf_sdbrcm_bus_init(struct device *dev)
3499 w_sdreg32(bus, bus->hostintmask, 3490 w_sdreg32(bus, bus->hostintmask,
3500 offsetof(struct sdpcmd_regs, hostintmask), &retries); 3491 offsetof(struct sdpcmd_regs, hostintmask), &retries);
3501 3492
3502 brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1, 3493 brcmf_sdio_regwb(bus->sdiodev, SBSDIO_WATERMARK, 8, &err);
3503 SBSDIO_WATERMARK, 8, &err);
3504 } else { 3494 } else {
3505 /* Disable F2 again */ 3495 /* Disable F2 again */
3506 enable = SDIO_FUNC_ENABLE_1; 3496 enable = SDIO_FUNC_ENABLE_1;
3507 brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_0, 3497 brcmf_sdio_regwb(bus->sdiodev, SDIO_CCCR_IOEx, enable, NULL);
3508 SDIO_CCCR_IOEx, enable, NULL);
3509 ret = -ENODEV; 3498 ret = -ENODEV;
3510 } 3499 }
3511 3500
3512 /* Restore previous clock setting */ 3501 /* Restore previous clock setting */
3513 brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1, 3502 brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, saveclk, &err);
3514 SBSDIO_FUNC1_CHIPCLKCSR, saveclk, &err);
3515 3503
3516 if (ret == 0) { 3504 if (ret == 0) {
3517 ret = brcmf_sdio_intr_register(bus->sdiodev); 3505 ret = brcmf_sdio_intr_register(bus->sdiodev);
@@ -3729,9 +3717,8 @@ brcmf_sdbrcm_probe_attach(struct brcmf_sdio *bus, u32 regsva)
3729 * programs PLL control regs 3717 * programs PLL control regs
3730 */ 3718 */
3731 3719
3732 brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1, 3720 brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
3733 SBSDIO_FUNC1_CHIPCLKCSR, 3721 BRCMF_INIT_CLKCTL1, &err);
3734 BRCMF_INIT_CLKCTL1, &err);
3735 if (!err) 3722 if (!err)
3736 clkctl = brcmf_sdio_regrb(bus->sdiodev, 3723 clkctl = brcmf_sdio_regrb(bus->sdiodev,
3737 SBSDIO_FUNC1_CHIPCLKCSR, &err); 3724 SBSDIO_FUNC1_CHIPCLKCSR, &err);
@@ -3792,16 +3779,15 @@ static bool brcmf_sdbrcm_probe_init(struct brcmf_sdio *bus)
3792 brcmf_dbg(TRACE, "Enter\n"); 3779 brcmf_dbg(TRACE, "Enter\n");
3793 3780
3794 /* Disable F2 to clear any intermediate frame state on the dongle */ 3781 /* Disable F2 to clear any intermediate frame state on the dongle */
3795 brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_0, SDIO_CCCR_IOEx, 3782 brcmf_sdio_regwb(bus->sdiodev, SDIO_CCCR_IOEx,
3796 SDIO_FUNC_ENABLE_1, NULL); 3783 SDIO_FUNC_ENABLE_1, NULL);
3797 3784
3798 bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; 3785 bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN;
3799 bus->sleeping = false; 3786 bus->sleeping = false;
3800 bus->rxflow = false; 3787 bus->rxflow = false;
3801 3788
3802 /* Done with backplane-dependent accesses, can drop clock... */ 3789 /* Done with backplane-dependent accesses, can drop clock... */
3803 brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1, 3790 brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, 0, NULL);
3804 SBSDIO_FUNC1_CHIPCLKCSR, 0, NULL);
3805 3791
3806 /* ...and initialize clock/power states */ 3792 /* ...and initialize clock/power states */
3807 bus->clkstate = CLK_SDONLY; 3793 bus->clkstate = CLK_SDONLY;
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c b/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c
index 654b7e032b27..d4b390c2acfd 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c
@@ -425,8 +425,7 @@ brcmf_sdio_chip_buscoreprep(struct brcmf_sdio_dev *sdiodev)
425 425
426 /* Try forcing SDIO core to do ALPAvail request only */ 426 /* Try forcing SDIO core to do ALPAvail request only */
427 clkset = SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_ALP_AVAIL_REQ; 427 clkset = SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_ALP_AVAIL_REQ;
428 brcmf_sdcard_cfg_write(sdiodev, SDIO_FUNC_1, 428 brcmf_sdio_regwb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, clkset, &err);
429 SBSDIO_FUNC1_CHIPCLKCSR, clkset, &err);
430 if (err) { 429 if (err) {
431 brcmf_dbg(ERROR, "error writing for HT off\n"); 430 brcmf_dbg(ERROR, "error writing for HT off\n");
432 return err; 431 return err;
@@ -454,13 +453,11 @@ brcmf_sdio_chip_buscoreprep(struct brcmf_sdio_dev *sdiodev)
454 } 453 }
455 454
456 clkset = SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_FORCE_ALP; 455 clkset = SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_FORCE_ALP;
457 brcmf_sdcard_cfg_write(sdiodev, SDIO_FUNC_1, 456 brcmf_sdio_regwb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, clkset, &err);
458 SBSDIO_FUNC1_CHIPCLKCSR, clkset, &err);
459 udelay(65); 457 udelay(65);
460 458
461 /* Also, disable the extra SDIO pull-ups */ 459 /* Also, disable the extra SDIO pull-ups */
462 brcmf_sdcard_cfg_write(sdiodev, SDIO_FUNC_1, 460 brcmf_sdio_regwb(sdiodev, SBSDIO_FUNC1_SDIOPULLUP, 0, NULL);
463 SBSDIO_FUNC1_SDIOPULLUP, 0, NULL);
464 461
465 return 0; 462 return 0;
466} 463}
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h b/drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h
index decfe0d14bad..7a97cb50f13d 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h
@@ -168,15 +168,6 @@ struct brcmf_sdio_dev {
168extern int brcmf_sdio_intr_register(struct brcmf_sdio_dev *sdiodev); 168extern int brcmf_sdio_intr_register(struct brcmf_sdio_dev *sdiodev);
169extern int brcmf_sdio_intr_unregister(struct brcmf_sdio_dev *sdiodev); 169extern int brcmf_sdio_intr_unregister(struct brcmf_sdio_dev *sdiodev);
170 170
171/* Access SDIO address space (e.g. CCCR) using CMD52 (single-byte interface).
172 * fn: function number
173 * addr: unmodified SDIO-space address
174 * data: data byte to write
175 * err: pointer to error code (or NULL)
176 */
177extern void brcmf_sdcard_cfg_write(struct brcmf_sdio_dev *sdiodev, uint func,
178 u32 addr, u8 data, int *err);
179
180/* Synchronous access to device (client) core registers via CMD53 to F1. 171/* Synchronous access to device (client) core registers via CMD53 to F1.
181 * addr: backplane address (i.e. >= regsva from attach) 172 * addr: backplane address (i.e. >= regsva from attach)
182 * size: register width in bytes (2 or 4) 173 * size: register width in bytes (2 or 4)