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

Configure Feed

Select the types of activity you want to include in your feed.

powerpc/8xx: Remove immr_map() and immr_unmap()

Since commit fb533d0c5a97 ("[POWERPC] 8xx: Infrastructure code cleanup.")
immr_map() is just returning mpc8xxx_immr pointer and immr_unmap()
do nothing.

We already have parts of code that use mpc8xxx_immr directly so get rid
of immr_map() and immr_unmap() by using mpc8xxx_immr directly. And avoid
going through local pointers that hide the pointed structure.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/633ed46f6015ff44d5599258647ea517f75d6a1d.1691474658.git.christophe.leroy@csgroup.eu

authored by

Christophe Leroy and committed by
Michael Ellerman
fbbf4280 cb888cdf

+22 -62
-8
arch/powerpc/include/asm/fs_pd.h
··· 22 22 #define cpm2_unmap(addr) do {} while(0) 23 23 #endif 24 24 25 - #ifdef CONFIG_PPC_8xx 26 - #include <asm/8xx_immap.h> 27 - 28 - #define immr_map(member) (&mpc8xx_immr->member) 29 - #define immr_map_size(member, size) (&mpc8xx_immr->member) 30 - #define immr_unmap(addr) do {} while (0) 31 - #endif 32 - 33 25 static inline int uart_baudrate(void) 34 26 { 35 27 return get_baudrate();
+3 -7
arch/powerpc/platforms/8xx/cpm1.c
··· 41 41 #include <asm/rheap.h> 42 42 #include <asm/cpm.h> 43 43 44 - #include <asm/fs_pd.h> 44 + #include <sysdev/fsl_soc.h> 45 45 46 46 #ifdef CONFIG_8xx_GPIO 47 47 #include <linux/gpio/legacy-of-mm-gpiochip.h> ··· 54 54 55 55 void __init cpm_reset(void) 56 56 { 57 - sysconf8xx_t __iomem *siu_conf; 58 - 59 57 cpmp = &mpc8xx_immr->im_cpm; 60 58 61 59 #ifndef CONFIG_PPC_EARLY_DEBUG_CPM ··· 75 77 * manual recommends it. 76 78 * Bit 25, FAM can also be set to use FEC aggressive mode (860T). 77 79 */ 78 - siu_conf = immr_map(im_siu_conf); 79 80 if ((mfspr(SPRN_IMMR) & 0xffff) == 0x0900) /* MPC885 */ 80 - out_be32(&siu_conf->sc_sdcr, 0x40); 81 + out_be32(&mpc8xx_immr->im_siu_conf.sc_sdcr, 0x40); 81 82 else 82 - out_be32(&siu_conf->sc_sdcr, 1); 83 - immr_unmap(siu_conf); 83 + out_be32(&mpc8xx_immr->im_siu_conf.sc_sdcr, 1); 84 84 } 85 85 86 86 static DEFINE_SPINLOCK(cmd_lock);
+19 -47
arch/powerpc/platforms/8xx/m8xx_setup.c
··· 22 22 23 23 #include <asm/io.h> 24 24 #include <asm/8xx_immap.h> 25 - #include <asm/fs_pd.h> 26 25 #include <mm/mmu_decl.h> 27 26 28 27 #include "pic.h" ··· 40 41 void __init __attribute__ ((weak)) 41 42 init_internal_rtc(void) 42 43 { 43 - sit8xx_t __iomem *sys_tmr = immr_map(im_sit); 44 - 45 44 /* Disable the RTC one second and alarm interrupts. */ 46 - clrbits16(&sys_tmr->sit_rtcsc, (RTCSC_SIE | RTCSC_ALE)); 45 + clrbits16(&mpc8xx_immr->im_sit.sit_rtcsc, (RTCSC_SIE | RTCSC_ALE)); 47 46 48 47 /* Enable the RTC */ 49 - setbits16(&sys_tmr->sit_rtcsc, (RTCSC_RTF | RTCSC_RTE)); 50 - immr_unmap(sys_tmr); 48 + setbits16(&mpc8xx_immr->im_sit.sit_rtcsc, (RTCSC_RTF | RTCSC_RTE)); 51 49 } 52 50 53 51 static int __init get_freq(char *name, unsigned long *val) ··· 76 80 void __init mpc8xx_calibrate_decr(void) 77 81 { 78 82 struct device_node *cpu; 79 - cark8xx_t __iomem *clk_r1; 80 - car8xx_t __iomem *clk_r2; 81 - sitk8xx_t __iomem *sys_tmr1; 82 - sit8xx_t __iomem *sys_tmr2; 83 83 int irq, virq; 84 84 85 - clk_r1 = immr_map(im_clkrstk); 86 - 87 85 /* Unlock the SCCR. */ 88 - out_be32(&clk_r1->cark_sccrk, ~KAPWR_KEY); 89 - out_be32(&clk_r1->cark_sccrk, KAPWR_KEY); 90 - immr_unmap(clk_r1); 86 + out_be32(&mpc8xx_immr->im_clkrstk.cark_sccrk, ~KAPWR_KEY); 87 + out_be32(&mpc8xx_immr->im_clkrstk.cark_sccrk, KAPWR_KEY); 91 88 92 89 /* Force all 8xx processors to use divide by 16 processor clock. */ 93 - clk_r2 = immr_map(im_clkrst); 94 - setbits32(&clk_r2->car_sccr, 0x02000000); 95 - immr_unmap(clk_r2); 90 + setbits32(&mpc8xx_immr->im_clkrst.car_sccr, 0x02000000); 96 91 97 92 /* Processor frequency is MHz. 98 93 */ ··· 110 123 * we guarantee the registers are locked, then we unlock them 111 124 * for our use. 112 125 */ 113 - sys_tmr1 = immr_map(im_sitk); 114 - out_be32(&sys_tmr1->sitk_tbscrk, ~KAPWR_KEY); 115 - out_be32(&sys_tmr1->sitk_rtcsck, ~KAPWR_KEY); 116 - out_be32(&sys_tmr1->sitk_tbk, ~KAPWR_KEY); 117 - out_be32(&sys_tmr1->sitk_tbscrk, KAPWR_KEY); 118 - out_be32(&sys_tmr1->sitk_rtcsck, KAPWR_KEY); 119 - out_be32(&sys_tmr1->sitk_tbk, KAPWR_KEY); 120 - immr_unmap(sys_tmr1); 126 + out_be32(&mpc8xx_immr->im_sitk.sitk_tbscrk, ~KAPWR_KEY); 127 + out_be32(&mpc8xx_immr->im_sitk.sitk_rtcsck, ~KAPWR_KEY); 128 + out_be32(&mpc8xx_immr->im_sitk.sitk_tbk, ~KAPWR_KEY); 129 + out_be32(&mpc8xx_immr->im_sitk.sitk_tbscrk, KAPWR_KEY); 130 + out_be32(&mpc8xx_immr->im_sitk.sitk_rtcsck, KAPWR_KEY); 131 + out_be32(&mpc8xx_immr->im_sitk.sitk_tbk, KAPWR_KEY); 121 132 122 133 init_internal_rtc(); 123 134 ··· 129 144 of_node_put(cpu); 130 145 irq = virq_to_hw(virq); 131 146 132 - sys_tmr2 = immr_map(im_sit); 133 - out_be16(&sys_tmr2->sit_tbscr, ((1 << (7 - (irq/2))) << 8) | 134 - (TBSCR_TBF | TBSCR_TBE)); 135 - immr_unmap(sys_tmr2); 147 + out_be16(&mpc8xx_immr->im_sit.sit_tbscr, 148 + ((1 << (7 - (irq / 2))) << 8) | (TBSCR_TBF | TBSCR_TBE)); 136 149 137 150 if (request_irq(virq, timebase_interrupt, IRQF_NO_THREAD, "tbint", 138 151 NULL)) ··· 144 161 145 162 int mpc8xx_set_rtc_time(struct rtc_time *tm) 146 163 { 147 - sitk8xx_t __iomem *sys_tmr1; 148 - sit8xx_t __iomem *sys_tmr2; 149 164 time64_t time; 150 165 151 - sys_tmr1 = immr_map(im_sitk); 152 - sys_tmr2 = immr_map(im_sit); 153 166 time = rtc_tm_to_time64(tm); 154 167 155 - out_be32(&sys_tmr1->sitk_rtck, KAPWR_KEY); 156 - out_be32(&sys_tmr2->sit_rtc, (u32)time); 157 - out_be32(&sys_tmr1->sitk_rtck, ~KAPWR_KEY); 168 + out_be32(&mpc8xx_immr->im_sitk.sitk_rtck, KAPWR_KEY); 169 + out_be32(&mpc8xx_immr->im_sit.sit_rtc, (u32)time); 170 + out_be32(&mpc8xx_immr->im_sitk.sitk_rtck, ~KAPWR_KEY); 158 171 159 - immr_unmap(sys_tmr2); 160 - immr_unmap(sys_tmr1); 161 172 return 0; 162 173 } 163 174 164 175 void mpc8xx_get_rtc_time(struct rtc_time *tm) 165 176 { 166 177 unsigned long data; 167 - sit8xx_t __iomem *sys_tmr = immr_map(im_sit); 168 178 169 179 /* Get time from the RTC. */ 170 - data = in_be32(&sys_tmr->sit_rtc); 180 + data = in_be32(&mpc8xx_immr->im_sit.sit_rtc); 171 181 rtc_time64_to_tm(data, tm); 172 - immr_unmap(sys_tmr); 173 182 return; 174 183 } 175 184 176 185 void __noreturn mpc8xx_restart(char *cmd) 177 186 { 178 - car8xx_t __iomem *clk_r = immr_map(im_clkrst); 179 - 180 - 181 187 local_irq_disable(); 182 188 183 - setbits32(&clk_r->car_plprcr, 0x00000080); 189 + setbits32(&mpc8xx_immr->im_clkrst.car_plprcr, 0x00000080); 184 190 /* Clear the ME bit in MSR to cause checkstop on machine check 185 191 */ 186 192 mtmsr(mfmsr() & ~0x1000); 187 193 188 - in_8(&clk_r->res[0]); 194 + in_8(&mpc8xx_immr->im_clkrst.res[0]); 189 195 panic("Restart failed\n"); 190 196 }