blob: c08be1ee461b955b7c49c56f4fe00b9f04ea6482 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Wang Huanf0ce7d62014-09-05 13:52:44 +08002/*
3 * Copyright 2014 Freescale Semiconductor, Inc.
Wang Huanf0ce7d62014-09-05 13:52:44 +08004 */
5
6#include <common.h>
7#include <i2c.h>
8#include <asm/io.h>
9#include <asm/arch/immap_ls102xa.h>
10#include <asm/arch/clock.h>
11#include <asm/arch/fsl_serdes.h>
Yao Yuane0f8f542015-12-05 14:59:10 +080012#include <asm/arch/ls102xa_soc.h>
Zhuoyu Zhangfe4f2882015-08-17 18:55:12 +080013#include <asm/arch/ls102xa_devdis.h>
Yao Yuanfec6aa02014-11-26 14:54:33 +080014#include <hwconfig.h>
Wang Huanf0ce7d62014-09-05 13:52:44 +080015#include <mmc.h>
Mingkai Hu5b0df8a2015-10-26 19:47:41 +080016#include <fsl_csu.h>
Wang Huanf0ce7d62014-09-05 13:52:44 +080017#include <fsl_esdhc.h>
18#include <fsl_ifc.h>
Ruchika Gupta901ae762014-10-15 11:39:06 +053019#include <fsl_sec.h>
Alison Wang9da51782014-12-03 15:00:47 +080020#include <spl.h>
Zhuoyu Zhangfe4f2882015-08-17 18:55:12 +080021#include <fsl_devdis.h>
Aneesh Bansal39d5b3b2016-01-22 16:37:26 +053022#include <fsl_validate.h>
Shengzhou Liu15875a52016-11-21 11:36:48 +080023#include <fsl_ddr.h>
tang yuantian57296e72014-12-17 12:58:05 +080024#include "../common/sleep.h"
Wang Huanf0ce7d62014-09-05 13:52:44 +080025#include "../common/qixis.h"
26#include "ls1021aqds_qixis.h"
Zhao Qiang9fc2f302014-09-26 16:25:32 +080027#ifdef CONFIG_U_QE
Qianyu Gongae6a7582016-02-18 13:01:59 +080028#include <fsl_qe.h>
Zhao Qiang9fc2f302014-09-26 16:25:32 +080029#endif
Wang Huanf0ce7d62014-09-05 13:52:44 +080030
Yao Yuanfec6aa02014-11-26 14:54:33 +080031#define PIN_MUX_SEL_CAN 0x03
32#define PIN_MUX_SEL_IIC2 0xa0
33#define PIN_MUX_SEL_RGMII 0x00
34#define PIN_MUX_SEL_SAI 0x0c
35#define PIN_MUX_SEL_SDHC 0x00
36
37#define SET_SDHC_MUX_SEL(reg, value) ((reg & 0x0f) | value)
38#define SET_EC_MUX_SEL(reg, value) ((reg & 0xf0) | value)
Wang Huanf0ce7d62014-09-05 13:52:44 +080039enum {
Yao Yuanfec6aa02014-11-26 14:54:33 +080040 MUX_TYPE_CAN,
41 MUX_TYPE_IIC2,
42 MUX_TYPE_RGMII,
43 MUX_TYPE_SAI,
44 MUX_TYPE_SDHC,
Wang Huanf0ce7d62014-09-05 13:52:44 +080045 MUX_TYPE_SD_PCI4,
46 MUX_TYPE_SD_PC_SA_SG_SG,
47 MUX_TYPE_SD_PC_SA_PC_SG,
48 MUX_TYPE_SD_PC_SG_SG,
49};
50
Alison Wang29d75432014-12-09 17:38:23 +080051enum {
52 GE0_CLK125,
53 GE2_CLK125,
54 GE1_CLK125,
55};
56
Wang Huanf0ce7d62014-09-05 13:52:44 +080057int checkboard(void)
58{
Alison Wang34de5e42016-02-02 15:16:23 +080059#if !defined(CONFIG_QSPI_BOOT) && !defined(CONFIG_SD_BOOT_QSPI)
Wang Huanf0ce7d62014-09-05 13:52:44 +080060 char buf[64];
Alison Wang2145a372014-12-09 17:38:02 +080061#endif
Alison Wang9da51782014-12-03 15:00:47 +080062#if !defined(CONFIG_SD_BOOT) && !defined(CONFIG_QSPI_BOOT)
Wang Huanf0ce7d62014-09-05 13:52:44 +080063 u8 sw;
Alison Wang9da51782014-12-03 15:00:47 +080064#endif
Wang Huanf0ce7d62014-09-05 13:52:44 +080065
66 puts("Board: LS1021AQDS\n");
67
Alison Wang9da51782014-12-03 15:00:47 +080068#ifdef CONFIG_SD_BOOT
69 puts("SD\n");
70#elif CONFIG_QSPI_BOOT
71 puts("QSPI\n");
72#else
Wang Huanf0ce7d62014-09-05 13:52:44 +080073 sw = QIXIS_READ(brdcfg[0]);
74 sw = (sw & QIXIS_LBMAP_MASK) >> QIXIS_LBMAP_SHIFT;
75
76 if (sw < 0x8)
77 printf("vBank: %d\n", sw);
78 else if (sw == 0x8)
79 puts("PromJet\n");
80 else if (sw == 0x9)
81 puts("NAND\n");
82 else if (sw == 0x15)
83 printf("IFCCard\n");
84 else
85 printf("invalid setting of SW%u\n", QIXIS_LBMAP_SWITCH);
Alison Wang9da51782014-12-03 15:00:47 +080086#endif
Wang Huanf0ce7d62014-09-05 13:52:44 +080087
Alison Wang34de5e42016-02-02 15:16:23 +080088#if !defined(CONFIG_QSPI_BOOT) && !defined(CONFIG_SD_BOOT_QSPI)
Wang Huanf0ce7d62014-09-05 13:52:44 +080089 printf("Sys ID:0x%02x, Sys Ver: 0x%02x\n",
90 QIXIS_READ(id), QIXIS_READ(arch));
91
92 printf("FPGA: v%d (%s), build %d\n",
93 (int)QIXIS_READ(scver), qixis_read_tag(buf),
94 (int)qixis_read_minor());
Alison Wang2145a372014-12-09 17:38:02 +080095#endif
Wang Huanf0ce7d62014-09-05 13:52:44 +080096
97 return 0;
98}
99
100unsigned long get_board_sys_clk(void)
101{
102 u8 sysclk_conf = QIXIS_READ(brdcfg[1]);
103
104 switch (sysclk_conf & 0x0f) {
105 case QIXIS_SYSCLK_64:
106 return 64000000;
107 case QIXIS_SYSCLK_83:
108 return 83333333;
109 case QIXIS_SYSCLK_100:
110 return 100000000;
111 case QIXIS_SYSCLK_125:
112 return 125000000;
113 case QIXIS_SYSCLK_133:
114 return 133333333;
115 case QIXIS_SYSCLK_150:
116 return 150000000;
117 case QIXIS_SYSCLK_160:
118 return 160000000;
119 case QIXIS_SYSCLK_166:
120 return 166666666;
121 }
122 return 66666666;
123}
124
125unsigned long get_board_ddr_clk(void)
126{
127 u8 ddrclk_conf = QIXIS_READ(brdcfg[1]);
128
129 switch ((ddrclk_conf & 0x30) >> 4) {
130 case QIXIS_DDRCLK_100:
131 return 100000000;
132 case QIXIS_DDRCLK_125:
133 return 125000000;
134 case QIXIS_DDRCLK_133:
135 return 133333333;
136 }
137 return 66666666;
138}
139
Chenhui Zhao50966942014-11-06 10:51:59 +0800140int select_i2c_ch_pca9547(u8 ch)
141{
142 int ret;
143
144 ret = i2c_write(I2C_MUX_PCA_ADDR_PRI, 0, 1, &ch, 1);
145 if (ret) {
146 puts("PCA: failed to select proper channel\n");
147 return ret;
148 }
149
150 return 0;
151}
152
Wang Huanf0ce7d62014-09-05 13:52:44 +0800153int dram_init(void)
154{
Chenhui Zhao50966942014-11-06 10:51:59 +0800155 /*
156 * When resuming from deep sleep, the I2C channel may not be
157 * in the default channel. So, switch to the default channel
158 * before accessing DDR SPD.
159 */
160 select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT);
Simon Glass0e0ac202017-04-06 12:47:04 -0600161 return fsl_initdram();
Wang Huanf0ce7d62014-09-05 13:52:44 +0800162}
163
164#ifdef CONFIG_FSL_ESDHC
165struct fsl_esdhc_cfg esdhc_cfg[1] = {
166 {CONFIG_SYS_FSL_ESDHC_ADDR},
167};
168
169int board_mmc_init(bd_t *bis)
170{
171 esdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK);
172
173 return fsl_esdhc_initialize(bis, &esdhc_cfg[0]);
174}
175#endif
176
Wang Huanf0ce7d62014-09-05 13:52:44 +0800177int board_early_init_f(void)
178{
179 struct ccsr_scfg *scfg = (struct ccsr_scfg *)CONFIG_SYS_FSL_SCFG_ADDR;
Wang Huanf0ce7d62014-09-05 13:52:44 +0800180
181#ifdef CONFIG_TSEC_ENET
Claudiu Manoil51b503e2015-08-12 13:29:14 +0300182 /* clear BD & FR bits for BE BD's and frame data */
183 clrbits_be32(&scfg->etsecdmamcr, SCFG_ETSECDMAMCR_LE_BD_FR);
Wang Huanf0ce7d62014-09-05 13:52:44 +0800184#endif
185
186#ifdef CONFIG_FSL_IFC
187 init_early_memctl_regs();
188#endif
189
Yao Yuane0f8f542015-12-05 14:59:10 +0800190 arch_soc_init();
Wang Huanf0ce7d62014-09-05 13:52:44 +0800191
tang yuantian57296e72014-12-17 12:58:05 +0800192#if defined(CONFIG_DEEP_SLEEP)
193 if (is_warm_boot())
194 fsl_dp_disable_console();
195#endif
196
Wang Huanf0ce7d62014-09-05 13:52:44 +0800197 return 0;
198}
Alison Wang9da51782014-12-03 15:00:47 +0800199
200#ifdef CONFIG_SPL_BUILD
201void board_init_f(ulong dummy)
202{
Ashish Kumar11234062017-08-11 11:09:14 +0530203 struct ccsr_cci400 *cci = (struct ccsr_cci400 *)(CONFIG_SYS_IMMR +
204 CONFIG_SYS_CCI400_OFFSET);
Alison Wang6027eb42015-03-12 11:31:44 +0800205 unsigned int major;
Alison Wang9da51782014-12-03 15:00:47 +0800206
Alison Wangab98bb52014-12-09 17:38:14 +0800207#ifdef CONFIG_NAND_BOOT
208 struct ccsr_gur __iomem *gur = (void *)CONFIG_SYS_FSL_GUTS_ADDR;
209 u32 porsr1, pinctl;
210
211 /*
212 * There is LS1 SoC issue where NOR, FPGA are inaccessible during
213 * NAND boot because IFC signals > IFC_AD7 are not enabled.
214 * This workaround changes RCW source to make all signals enabled.
215 */
216 porsr1 = in_be32(&gur->porsr1);
217 pinctl = ((porsr1 & ~(DCFG_CCSR_PORSR1_RCW_MASK)) |
218 DCFG_CCSR_PORSR1_RCW_SRC_I2C);
219 out_be32((unsigned int *)(CONFIG_SYS_DCSR_DCFG_ADDR + DCFG_DCSR_PORCR1),
220 pinctl);
221#endif
222
Alison Wang9da51782014-12-03 15:00:47 +0800223 /* Clear the BSS */
224 memset(__bss_start, 0, __bss_end - __bss_start);
225
226#ifdef CONFIG_FSL_IFC
227 init_early_memctl_regs();
228#endif
229
230 get_clocks();
231
tang yuantian57296e72014-12-17 12:58:05 +0800232#if defined(CONFIG_DEEP_SLEEP)
233 if (is_warm_boot())
234 fsl_dp_disable_console();
235#endif
236
Alison Wang9da51782014-12-03 15:00:47 +0800237 preloader_console_init();
238
239#ifdef CONFIG_SPL_I2C_SUPPORT
240 i2c_init_all();
241#endif
Alison Wang6027eb42015-03-12 11:31:44 +0800242
243 major = get_soc_major_rev();
244 if (major == SOC_MAJOR_VER_1_0)
245 out_le32(&cci->ctrl_ord, CCI400_CTRLORD_TERM_BARRIER);
Alison Wang9da51782014-12-03 15:00:47 +0800246
Alison Wang28253032018-10-16 16:19:22 +0800247 timer_init();
Alison Wang9da51782014-12-03 15:00:47 +0800248 dram_init();
249
Alison Wang5dec9d72015-07-09 10:50:07 +0800250 /* Allow OCRAM access permission as R/W */
Mingkai Hu5b0df8a2015-10-26 19:47:41 +0800251#ifdef CONFIG_LAYERSCAPE_NS_ACCESS
252 enable_layerscape_ns_access();
Alison Wang5dec9d72015-07-09 10:50:07 +0800253#endif
254
Alison Wang9da51782014-12-03 15:00:47 +0800255 board_init_r(NULL, 0);
256}
257#endif
Wang Huanf0ce7d62014-09-05 13:52:44 +0800258
Alison Wang29d75432014-12-09 17:38:23 +0800259void config_etseccm_source(int etsec_gtx_125_mux)
260{
261 struct ccsr_scfg *scfg = (struct ccsr_scfg *)CONFIG_SYS_FSL_SCFG_ADDR;
262
263 switch (etsec_gtx_125_mux) {
264 case GE0_CLK125:
265 out_be32(&scfg->etsecmcr, SCFG_ETSECCMCR_GE0_CLK125);
266 debug("etseccm set to GE0_CLK125\n");
267 break;
268
269 case GE2_CLK125:
270 out_be32(&scfg->etsecmcr, SCFG_ETSECCMCR_GE2_CLK125);
271 debug("etseccm set to GE2_CLK125\n");
272 break;
273
274 case GE1_CLK125:
275 out_be32(&scfg->etsecmcr, SCFG_ETSECCMCR_GE1_CLK125);
276 debug("etseccm set to GE1_CLK125\n");
277 break;
278
279 default:
280 printf("Error! trying to set etseccm to invalid value\n");
281 break;
282 }
283}
284
Wang Huanf0ce7d62014-09-05 13:52:44 +0800285int config_board_mux(int ctrl_type)
286{
Yao Yuanfec6aa02014-11-26 14:54:33 +0800287 u8 reg12, reg14;
Wang Huanf0ce7d62014-09-05 13:52:44 +0800288
289 reg12 = QIXIS_READ(brdcfg[12]);
Yao Yuanfec6aa02014-11-26 14:54:33 +0800290 reg14 = QIXIS_READ(brdcfg[14]);
Wang Huanf0ce7d62014-09-05 13:52:44 +0800291
292 switch (ctrl_type) {
Yao Yuanfec6aa02014-11-26 14:54:33 +0800293 case MUX_TYPE_CAN:
Alison Wang29d75432014-12-09 17:38:23 +0800294 config_etseccm_source(GE2_CLK125);
Yao Yuanfec6aa02014-11-26 14:54:33 +0800295 reg14 = SET_EC_MUX_SEL(reg14, PIN_MUX_SEL_CAN);
296 break;
297 case MUX_TYPE_IIC2:
298 reg14 = SET_SDHC_MUX_SEL(reg14, PIN_MUX_SEL_IIC2);
299 break;
300 case MUX_TYPE_RGMII:
301 reg14 = SET_EC_MUX_SEL(reg14, PIN_MUX_SEL_RGMII);
302 break;
303 case MUX_TYPE_SAI:
Alison Wang29d75432014-12-09 17:38:23 +0800304 config_etseccm_source(GE2_CLK125);
Yao Yuanfec6aa02014-11-26 14:54:33 +0800305 reg14 = SET_EC_MUX_SEL(reg14, PIN_MUX_SEL_SAI);
306 break;
307 case MUX_TYPE_SDHC:
308 reg14 = SET_SDHC_MUX_SEL(reg14, PIN_MUX_SEL_SDHC);
309 break;
Wang Huanf0ce7d62014-09-05 13:52:44 +0800310 case MUX_TYPE_SD_PCI4:
311 reg12 = 0x38;
312 break;
313 case MUX_TYPE_SD_PC_SA_SG_SG:
314 reg12 = 0x01;
315 break;
316 case MUX_TYPE_SD_PC_SA_PC_SG:
317 reg12 = 0x01;
318 break;
319 case MUX_TYPE_SD_PC_SG_SG:
320 reg12 = 0x21;
321 break;
322 default:
323 printf("Wrong mux interface type\n");
324 return -1;
325 }
326
327 QIXIS_WRITE(brdcfg[12], reg12);
Yao Yuanfec6aa02014-11-26 14:54:33 +0800328 QIXIS_WRITE(brdcfg[14], reg14);
Wang Huanf0ce7d62014-09-05 13:52:44 +0800329
330 return 0;
331}
332
333int config_serdes_mux(void)
334{
335 struct ccsr_gur *gur = (struct ccsr_gur *)CONFIG_SYS_FSL_GUTS_ADDR;
336 u32 cfg;
337
338 cfg = in_be32(&gur->rcwsr[4]) & RCWSR4_SRDS1_PRTCL_MASK;
339 cfg >>= RCWSR4_SRDS1_PRTCL_SHIFT;
340
341 switch (cfg) {
342 case 0x0:
343 config_board_mux(MUX_TYPE_SD_PCI4);
344 break;
345 case 0x30:
346 config_board_mux(MUX_TYPE_SD_PC_SA_SG_SG);
347 break;
348 case 0x60:
349 config_board_mux(MUX_TYPE_SD_PC_SG_SG);
350 break;
351 case 0x70:
352 config_board_mux(MUX_TYPE_SD_PC_SA_PC_SG);
353 break;
354 default:
355 printf("SRDS1 prtcl:0x%x\n", cfg);
356 break;
357 }
358
359 return 0;
360}
361
tang yuantian9f51db22015-10-16 16:06:05 +0800362#ifdef CONFIG_BOARD_LATE_INIT
363int board_late_init(void)
364{
Aneesh Bansal39d5b3b2016-01-22 16:37:26 +0530365#ifdef CONFIG_CHAIN_OF_TRUST
366 fsl_setenv_chain_of_trust();
367#endif
tang yuantian9f51db22015-10-16 16:06:05 +0800368
369 return 0;
370}
371#endif
372
Ruchika Gupta901ae762014-10-15 11:39:06 +0530373int misc_init_r(void)
374{
Yao Yuanfec6aa02014-11-26 14:54:33 +0800375 int conflict_flag;
376
377 /* some signals can not enable simultaneous*/
378 conflict_flag = 0;
379 if (hwconfig("sdhc"))
380 conflict_flag++;
381 if (hwconfig("iic2"))
382 conflict_flag++;
383 if (conflict_flag > 1) {
384 printf("WARNING: pin conflict !\n");
385 return 0;
386 }
387
388 conflict_flag = 0;
389 if (hwconfig("rgmii"))
390 conflict_flag++;
391 if (hwconfig("can"))
392 conflict_flag++;
393 if (hwconfig("sai"))
394 conflict_flag++;
395 if (conflict_flag > 1) {
396 printf("WARNING: pin conflict !\n");
397 return 0;
398 }
399
400 if (hwconfig("can"))
401 config_board_mux(MUX_TYPE_CAN);
402 else if (hwconfig("rgmii"))
403 config_board_mux(MUX_TYPE_RGMII);
404 else if (hwconfig("sai"))
405 config_board_mux(MUX_TYPE_SAI);
406
407 if (hwconfig("iic2"))
408 config_board_mux(MUX_TYPE_IIC2);
409 else if (hwconfig("sdhc"))
410 config_board_mux(MUX_TYPE_SDHC);
411
Zhuoyu Zhangfe4f2882015-08-17 18:55:12 +0800412#ifdef CONFIG_FSL_DEVICE_DISABLE
413 device_disable(devdis_tbl, ARRAY_SIZE(devdis_tbl));
414#endif
Ruchika Gupta901ae762014-10-15 11:39:06 +0530415#ifdef CONFIG_FSL_CAAM
416 return sec_init();
417#endif
Yao Yuanfec6aa02014-11-26 14:54:33 +0800418 return 0;
Ruchika Gupta901ae762014-10-15 11:39:06 +0530419}
Ruchika Gupta901ae762014-10-15 11:39:06 +0530420
Wang Huanf0ce7d62014-09-05 13:52:44 +0800421int board_init(void)
422{
Ashish Kumar11234062017-08-11 11:09:14 +0530423 struct ccsr_cci400 *cci = (struct ccsr_cci400 *)(CONFIG_SYS_IMMR +
424 CONFIG_SYS_CCI400_OFFSET);
Alison Wang6027eb42015-03-12 11:31:44 +0800425 unsigned int major;
Wang Huanf0ce7d62014-09-05 13:52:44 +0800426
Hou Zhiqiang4b23ca82016-08-02 19:03:27 +0800427#ifdef CONFIG_SYS_FSL_ERRATUM_A010315
428 erratum_a010315();
429#endif
Shengzhou Liu15875a52016-11-21 11:36:48 +0800430#ifdef CONFIG_SYS_FSL_ERRATUM_A009942
431 erratum_a009942_check_cpo();
432#endif
Alison Wang6027eb42015-03-12 11:31:44 +0800433 major = get_soc_major_rev();
434 if (major == SOC_MAJOR_VER_1_0) {
435 /* Set CCI-400 control override register to
436 * enable barrier transaction */
437 out_le32(&cci->ctrl_ord, CCI400_CTRLORD_EN_BARRIER);
438 }
Wang Huanf0ce7d62014-09-05 13:52:44 +0800439
440 select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT);
441
442#ifndef CONFIG_SYS_FSL_NO_SERDES
443 fsl_serdes_init();
444 config_serdes_mux();
445#endif
Zhao Qiang9fc2f302014-09-26 16:25:32 +0800446
Alison Wang69364922016-02-05 12:48:17 +0800447 ls102xa_smmu_stream_id_init();
Xiubo Li03d40aa2014-11-21 17:40:59 +0800448
Zhao Qiang9fc2f302014-09-26 16:25:32 +0800449#ifdef CONFIG_U_QE
450 u_qe_init();
451#endif
452
Wang Huanf0ce7d62014-09-05 13:52:44 +0800453 return 0;
454}
tang yuantian57296e72014-12-17 12:58:05 +0800455
456#if defined(CONFIG_DEEP_SLEEP)
457void board_sleep_prepare(void)
458{
Ashish Kumar11234062017-08-11 11:09:14 +0530459 struct ccsr_cci400 __iomem *cci = (void *)(CONFIG_SYS_IMMR +
460 CONFIG_SYS_CCI400_OFFSET);
Alison Wang6027eb42015-03-12 11:31:44 +0800461 unsigned int major;
462
463 major = get_soc_major_rev();
464 if (major == SOC_MAJOR_VER_1_0) {
465 /* Set CCI-400 control override register to
466 * enable barrier transaction */
467 out_le32(&cci->ctrl_ord, CCI400_CTRLORD_EN_BARRIER);
468 }
tang yuantian57296e72014-12-17 12:58:05 +0800469
tang yuantian57296e72014-12-17 12:58:05 +0800470
Mingkai Hu5b0df8a2015-10-26 19:47:41 +0800471#ifdef CONFIG_LAYERSCAPE_NS_ACCESS
472 enable_layerscape_ns_access();
tang yuantian57296e72014-12-17 12:58:05 +0800473#endif
474}
475#endif
Wang Huanf0ce7d62014-09-05 13:52:44 +0800476
Simon Glass2aec3cc2014-10-23 18:58:47 -0600477int ft_board_setup(void *blob, bd_t *bd)
Wang Huanf0ce7d62014-09-05 13:52:44 +0800478{
479 ft_cpu_setup(blob, bd);
Simon Glass2aec3cc2014-10-23 18:58:47 -0600480
Minghuan Lian0c535242015-03-12 10:58:48 +0800481#ifdef CONFIG_PCI
482 ft_pci_setup(blob, bd);
Minghuan Liana4d6b612014-10-31 13:43:44 +0800483#endif
484
Simon Glass2aec3cc2014-10-23 18:58:47 -0600485 return 0;
Wang Huanf0ce7d62014-09-05 13:52:44 +0800486}
487
488u8 flash_read8(void *addr)
489{
490 return __raw_readb(addr + 1);
491}
492
493void flash_write16(u16 val, void *addr)
494{
495 u16 shftval = (((val >> 8) & 0xff) | ((val << 8) & 0xff00));
496
497 __raw_writew(shftval, addr);
498}
499
500u16 flash_read16(void *addr)
501{
502 u16 val = __raw_readw(addr);
503
504 return (((val) >> 8) & 0x00ff) | (((val) << 8) & 0xff00);
505}