Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

brcm80211: smac: use bcma core access function in srom.c

The code in srom.c now uses the core access function provided by
BCMA so no need to pass __iomem pointer any longer.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Alwin Beukers <alwin@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Arend van Spriel and committed by
John W. Linville
b14f1674 373c78e1

+17 -37
+1 -1
drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
··· 725 725 goto exit; 726 726 727 727 /* Init nvram from sprom/otp if they exist */ 728 - if (srom_var_init(&sii->pub, cc)) 728 + if (srom_var_init(&sii->pub)) 729 729 goto exit; 730 730 731 731 ai_nvram_process(sii);
+15 -35
drivers/net/wireless/brcm80211/brcmsmac/srom.c
··· 586 586 * shared between devices. */ 587 587 static u8 brcms_srom_crc8_table[CRC8_TABLE_SIZE]; 588 588 589 - static u8 __iomem * 590 - srom_window_address(struct si_pub *sih, u8 __iomem *curmap) 591 - { 592 - if (ai_get_ccrev(sih) < 32) 593 - return curmap + PCI_BAR0_SPROM_OFFSET; 594 - if (ai_get_cccaps(sih) & CC_CAP_SROM) 595 - return curmap + PCI_16KB0_CCREGS_OFFSET + CC_SROM_OTP; 596 - 597 - return NULL; 598 - } 599 - 600 589 static uint mask_shift(u16 mask) 601 590 { 602 591 uint i; ··· 768 779 * Return 0 on success, nonzero on error. 769 780 */ 770 781 static int 771 - sprom_read_pci(struct si_pub *sih, u8 __iomem *sprom, uint wordoff, 772 - u16 *buf, uint nwords, bool check_crc) 782 + sprom_read_pci(struct si_pub *sih, u16 *buf, uint nwords, bool check_crc) 773 783 { 774 784 int err = 0; 775 785 uint i; 776 786 u8 *bbuf = (u8 *)buf; /* byte buffer */ 777 787 uint nbytes = nwords << 1; 788 + struct bcma_device *core; 789 + uint sprom_offset; 790 + 791 + /* determine core to read */ 792 + if (ai_get_ccrev(sih) < 32) { 793 + core = ai_findcore(sih, BCMA_CORE_80211, 0); 794 + sprom_offset = PCI_BAR0_SPROM_OFFSET; 795 + } else { 796 + core = ai_findcore(sih, BCMA_CORE_CHIPCOMMON, 0); 797 + sprom_offset = CHIPCREGOFFS(sromotp); 798 + } 778 799 779 800 /* read the sprom in bytes */ 780 801 for (i = 0; i < nbytes; i++) 781 - bbuf[i] = readb(sprom+i); 802 + bbuf[i] = bcma_read8(core, sprom_offset+i); 782 803 783 804 if (buf[0] == 0xffff) 784 805 /* ··· 850 851 * Initialize nonvolatile variable table from sprom. 851 852 * Return 0 on success, nonzero on error. 852 853 */ 853 - static int initvars_srom_pci(struct si_pub *sih, void __iomem *curmap) 854 + int srom_var_init(struct si_pub *sih) 854 855 { 855 856 u16 *srom; 856 - u8 __iomem *sromwindow; 857 857 u8 sromrev = 0; 858 858 u32 sr; 859 859 int err = 0; ··· 864 866 if (!srom) 865 867 return -ENOMEM; 866 868 867 - sromwindow = srom_window_address(sih, curmap); 868 - 869 869 crc8_populate_lsb(brcms_srom_crc8_table, SROM_CRC8_POLY); 870 870 if (ai_is_sprom_available(sih)) { 871 - err = sprom_read_pci(sih, sromwindow, 0, srom, 872 - SROM4_WORDS, true); 871 + err = sprom_read_pci(sih, srom, SROM4_WORDS, true); 873 872 874 873 if (err == 0) 875 874 /* srom read and passed crc */ ··· 915 920 list_del(&entry->var_list); 916 921 kfree(entry); 917 922 } 918 - } 919 - /* 920 - * Initialize local vars from the right source for this platform. 921 - * Return 0 on success, nonzero on error. 922 - */ 923 - int srom_var_init(struct si_pub *sih, void __iomem *curmap) 924 - { 925 - uint len; 926 - 927 - len = 0; 928 - 929 - if (curmap != NULL) 930 - return initvars_srom_pci(sih, curmap); 931 - 932 - return -EINVAL; 933 923 } 934 924 935 925 /*
+1 -1
drivers/net/wireless/brcm80211/brcmsmac/srom.h
··· 20 20 #include "types.h" 21 21 22 22 /* Prototypes */ 23 - extern int srom_var_init(struct si_pub *sih, void __iomem *curmap); 23 + extern int srom_var_init(struct si_pub *sih); 24 24 extern void srom_free_vars(struct si_pub *sih); 25 25 26 26 extern int srom_read(struct si_pub *sih, uint bus, void *curmap,