Commit 2f5f817f authored by Arend van Spriel's avatar Arend van Spriel Committed by John W. Linville

brcmfmac: determine sd host controller related variable earlier

The commit "eb9c174 brcmfmac: determine host controller related
variables during probe" was not implemented correctly as the
information is already needed in brcmf_sdbrcm_probe(). This patch
moves it to brcmf_sdioh_attach() instead.
Reviewed-by: default avatarFranky Lin <frankyl@broadcom.com>
Reviewed-by: default avatarHante Meuleman <meuleman@broadcom.com>
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 4b776961
...@@ -278,6 +278,9 @@ static int brcmf_sdioh_enablefuncs(struct brcmf_sdio_dev *sdiodev) ...@@ -278,6 +278,9 @@ static int brcmf_sdioh_enablefuncs(struct brcmf_sdio_dev *sdiodev)
int brcmf_sdioh_attach(struct brcmf_sdio_dev *sdiodev) int brcmf_sdioh_attach(struct brcmf_sdio_dev *sdiodev)
{ {
int err_ret = 0; int err_ret = 0;
struct mmc_host *host;
struct sdio_func *func;
uint max_blocks;
brcmf_dbg(SDIO, "\n"); brcmf_dbg(SDIO, "\n");
...@@ -299,6 +302,20 @@ int brcmf_sdioh_attach(struct brcmf_sdio_dev *sdiodev) ...@@ -299,6 +302,20 @@ int brcmf_sdioh_attach(struct brcmf_sdio_dev *sdiodev)
brcmf_sdioh_enablefuncs(sdiodev); brcmf_sdioh_enablefuncs(sdiodev);
/*
* determine host related variables after brcmf_sdio_probe()
* as func->cur_blksize is properly set and F2 init has been
* completed successfully.
*/
func = sdiodev->func[2];
host = func->card->host;
sdiodev->sg_support = host->max_segs > 1;
max_blocks = min_t(uint, host->max_blk_count, 511u);
sdiodev->max_request_size = min_t(uint, host->max_req_size,
max_blocks * func->cur_blksize);
sdiodev->max_segment_count = min_t(uint, host->max_segs,
SG_MAX_SINGLE_ALLOC);
sdiodev->max_segment_size = host->max_seg_size;
out: out:
sdio_release_host(sdiodev->func[1]); sdio_release_host(sdiodev->func[1]);
brcmf_dbg(SDIO, "Done\n"); brcmf_dbg(SDIO, "Done\n");
...@@ -327,8 +344,6 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func, ...@@ -327,8 +344,6 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func,
int err; int err;
struct brcmf_sdio_dev *sdiodev; struct brcmf_sdio_dev *sdiodev;
struct brcmf_bus *bus_if; struct brcmf_bus *bus_if;
struct mmc_host *host;
uint max_blocks;
brcmf_dbg(SDIO, "Enter\n"); brcmf_dbg(SDIO, "Enter\n");
brcmf_dbg(SDIO, "Class=%x\n", func->class); brcmf_dbg(SDIO, "Class=%x\n", func->class);
...@@ -376,19 +391,6 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func, ...@@ -376,19 +391,6 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func,
goto fail; goto fail;
} }
/*
* determine host related variables after brcmf_sdio_probe()
* as func->cur_blksize is properly set and F2 init has been
* completed successfully.
*/
host = func->card->host;
sdiodev->sg_support = host->max_segs > 1;
max_blocks = min_t(uint, host->max_blk_count, 511u);
sdiodev->max_request_size = min_t(uint, host->max_req_size,
max_blocks * func->cur_blksize);
sdiodev->max_segment_count = min_t(uint, host->max_segs,
SG_MAX_SINGLE_ALLOC);
sdiodev->max_segment_size = host->max_seg_size;
brcmf_dbg(SDIO, "F2 init completed...\n"); brcmf_dbg(SDIO, "F2 init completed...\n");
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment