008-nsa325-uboot-generic.patch 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  1. --- a/arch/arm/mach-kirkwood/Kconfig
  2. +++ b/arch/arm/mach-kirkwood/Kconfig
  3. @@ -68,6 +68,9 @@ config TARGET_SBx81LIFKW
  4. config TARGET_SBx81LIFXCAT
  5. bool "Allied Telesis SBx81GP24/SBx81GT24"
  6. +config TARGET_NSA325
  7. + bool "Zyxel NSA325 board"
  8. +
  9. endchoice
  10. config SYS_SOC
  11. @@ -91,6 +94,7 @@ source "board/Seagate/goflexhome/Kconfig
  12. source "board/Seagate/nas220/Kconfig"
  13. source "board/zyxel/nsa310/Kconfig"
  14. source "board/zyxel/nsa310s/Kconfig"
  15. +source "board/zyxel/nsa325/Kconfig"
  16. source "board/alliedtelesis/SBx81LIFKW/Kconfig"
  17. source "board/alliedtelesis/SBx81LIFXCAT/Kconfig"
  18. --- /dev/null
  19. +++ b/board/zyxel/nsa325/Kconfig
  20. @@ -0,0 +1,12 @@
  21. +if TARGET_NSA325
  22. +
  23. +config SYS_BOARD
  24. + default "nsa325"
  25. +
  26. +config SYS_VENDOR
  27. + default "zyxel"
  28. +
  29. +config SYS_CONFIG_NAME
  30. + default "nsa325"
  31. +
  32. +endif
  33. --- /dev/null
  34. +++ b/board/zyxel/nsa325/MAINTAINERS
  35. @@ -0,0 +1,6 @@
  36. +NSA325 BOARD
  37. +M: Alberto Bursi <[email protected]>
  38. +S: Maintained
  39. +F: board/zyxel/nsa325/
  40. +F: include/configs/nsa325.h
  41. +F: configs/nsa325_defconfig
  42. --- /dev/null
  43. +++ b/board/zyxel/nsa325/Makefile
  44. @@ -0,0 +1,13 @@
  45. +#
  46. +# (C) Copyright 2015 bodhi <[email protected]>
  47. +#
  48. +# Based on
  49. +# (C) Copyright 2009
  50. +# Marvell Semiconductor <www.marvell.com>
  51. +# Written-by: Prafulla Wadaskar <[email protected]>
  52. +#
  53. +# SPDX-License-Identifier: GPL-2.0+
  54. +#
  55. +
  56. +obj-y := nsa325.o
  57. +
  58. --- /dev/null
  59. +++ b/board/zyxel/nsa325/kwbimage.cfg
  60. @@ -0,0 +1,78 @@
  61. +# Copyright (C) 2015 bodhi <[email protected]>
  62. +#
  63. +# Extracted from Zyxel GPL source for u-boot-1.1.4_NSA325v2
  64. +#
  65. +# See file CREDITS for list of people who contributed to this
  66. +# project.
  67. +#
  68. +# This program is free software; you can redistribute it and/or
  69. +# modify it under the terms of the GNU General Public License as
  70. +# published by the Free Software Foundation; either version 2 of
  71. +# the License, or (at your option) any later version.
  72. +#
  73. +# This program is distributed in the hope that it will be useful,
  74. +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  75. +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  76. +# GNU General Public License for more details.
  77. +#
  78. +# You should have received a copy of the GNU General Public License
  79. +# along with this program; if not, write to the Free Software
  80. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  81. +# MA 02110-1301 USA
  82. +#
  83. +# Refer docs/README.kwimage for more details about how-to configure
  84. +# and create kirkwood boot image
  85. +#
  86. +
  87. +# Boot Media configurations
  88. +#BOOT_FROM uart
  89. +BOOT_FROM nand
  90. +NAND_ECC_MODE default
  91. +NAND_PAGE_SIZE 0x0800
  92. +
  93. +# SOC registers configuration using bootrom header extension
  94. +# Maximum KWBIMAGE_MAX_CONFIG configurations allowed
  95. +
  96. +# Configure RGMII-0 interface pad voltage to 1.8V
  97. +DATA 0xFFD100e0 0x1b1b1b9b
  98. +
  99. +#Dram initalization
  100. +DATA 0xFFD01400 0x4301503E # DDR Configuration register
  101. +DATA 0xFFD01404 0xB9843000 # DDR Controller Control Low
  102. +DATA 0xFFD01408 0x33137777 # DDR Timing (Low)
  103. +DATA 0xFFD0140C 0x16000C55 # DDR Timing (High)
  104. +DATA 0xFFD01410 0x04000000 # DDR Address Control
  105. +DATA 0xFFD01414 0x00000000 # DDR Open Pages Control
  106. +DATA 0xFFD01418 0x00000000 # DDR Operation
  107. +DATA 0xFFD0141C 0x00000672 # DDR Mode
  108. +DATA 0xFFD01420 0x00000004 # DDR Extended Mode
  109. +DATA 0xFFD01424 0x0000F14F # DDR Controller Control High
  110. +DATA 0xFFD01428 0x000D6720 # DDR3 ODT Read Timing
  111. +DATA 0xFFD0147C 0x0000B571 # DDR2 ODT Write Timing
  112. +DATA 0xFFD01504 0x1FFFFFF1 # CS[0]n Size
  113. +DATA 0xFFD01508 0x20000000 # CS[1]n Base address to 512Mb
  114. +DATA 0xFFD0150C 0x1FFFFFF4 # CS[1]n Size 512Mb Window enabled for CS1
  115. +DATA 0xFFD01514 0x00000000 # CS[2]n Size, window disabled
  116. +DATA 0xFFD0151C 0x00000000 # CS[3]n Size, window disabled
  117. +DATA 0xFFD01494 0x00120000 # DDR ODT Control (Low)
  118. +DATA 0xFFD01498 0x00000000 # DDR ODT Control (High)
  119. +DATA 0xFFD0149C 0x0000E803 # CPU ODT Control
  120. +
  121. +DATA 0xFFD015D0 0x00000630
  122. +DATA 0xFFD015D4 0x00000046
  123. +DATA 0xFFD015D8 0x00000008
  124. +DATA 0xFFD015DC 0x00000000
  125. +DATA 0xFFD015E0 0x00000023
  126. +DATA 0xFFD015E4 0x00203C18
  127. +DATA 0xFFD01620 0x00384800
  128. +DATA 0xFFD01480 0x00000001
  129. +DATA 0xFFD20134 0x66666666
  130. +DATA 0xFFD20138 0x00066666
  131. +
  132. +#Disable nsa325 hardware watchdog to allow successful kwbooting
  133. +DATA 0xFFD10100 0x00004000 # set GPIO 14 to high to disable the watchdog
  134. +DATA 0xFFD10104 0xFFFFBFFF # set GPIO 14 to output (to block any other input to it)
  135. +
  136. +# End of Header extension
  137. +DATA 0x0 0x0
  138. +
  139. --- /dev/null
  140. +++ b/board/zyxel/nsa325/nsa325.c
  141. @@ -0,0 +1,265 @@
  142. +/*
  143. + * Copyright (C) 2015 bodhi <[email protected]>
  144. + *
  145. + * Based on
  146. + * Copyright (C) 2014 Jason Plum <[email protected]>
  147. + *
  148. + * Based on nsa320.c originall written by
  149. + * Copyright (C) 2012 Peter Schildmann <[email protected]>
  150. + *
  151. + * Based on guruplug.c originally written by
  152. + * Siddarth Gore <[email protected]>
  153. + * (C) Copyright 2009
  154. + * Marvell Semiconductor <www.marvell.com>
  155. + *
  156. + * See file CREDITS for list of people who contributed to this
  157. + * project.
  158. + *
  159. + * This program is free software; you can redistribute it and/or
  160. + * modify it under the terms of the GNU General Public License as
  161. + * published by the Free Software Foundation; either version 2 of
  162. + * the License, or (at your option) any later version.
  163. + *
  164. + * This program is distributed in the hope that it will be useful,
  165. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  166. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  167. + * GNU General Public License for more details.
  168. + *
  169. + * You should have received a copy of the GNU General Public License
  170. + * along with this program; if not, write to the Free Software
  171. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  172. + * MA 02110-1301 USA
  173. + */
  174. +
  175. +#include <common.h>
  176. +#include <miiphy.h>
  177. +#include <asm/arch/soc.h>
  178. +#include <asm/arch/mpp.h>
  179. +#include <asm/arch/cpu.h>
  180. +#include <asm/gpio.h>
  181. +#include <asm/io.h>
  182. +#include "nsa325.h"
  183. +#include <asm/arch/gpio.h>
  184. +
  185. +DECLARE_GLOBAL_DATA_PTR;
  186. +
  187. +int board_early_init_f(void)
  188. +{
  189. + /*
  190. + * default gpio configuration
  191. + * There are maximum 64 gpios controlled through 2 sets of registers
  192. + * the below configuration configures mainly initial LED status
  193. + */
  194. + mvebu_config_gpio(NSA325_VAL_LOW, NSA325_VAL_HIGH,
  195. + NSA325_OE_LOW, NSA325_OE_HIGH);
  196. +
  197. + /* Multi-Purpose Pins Functionality configuration */
  198. + /* (all LEDs & power off active high) */
  199. + u32 kwmpp_config[] = {
  200. + MPP0_NF_IO2,
  201. + MPP1_NF_IO3,
  202. + MPP2_NF_IO4,
  203. + MPP3_NF_IO5,
  204. + MPP4_NF_IO6,
  205. + MPP5_NF_IO7,
  206. + MPP6_SYSRST_OUTn,
  207. + MPP7_GPO,
  208. + MPP8_TW_SDA, /* PCF8563 RTC chip */
  209. + MPP9_TW_SCK, /* connected to TWSI */
  210. + MPP10_UART0_TXD,
  211. + MPP11_UART0_RXD,
  212. + MPP12_GPO, /* HDD2 LED (green) */
  213. + MPP13_GPIO, /* HDD2 LED (red) */
  214. + MPP14_GPIO, /* MCU DATA pin (in) */
  215. + MPP15_GPIO, /* USB LED (green) */
  216. + MPP16_GPIO, /* MCU CLK pin (out) */
  217. + MPP17_GPIO, /* MCU ACT pin (out) */
  218. + MPP18_NF_IO0,
  219. + MPP19_NF_IO1,
  220. + MPP20_GPIO,
  221. + MPP21_GPIO, /* USB power */
  222. + MPP22_GPIO,
  223. + MPP23_GPIO,
  224. + MPP24_GPIO,
  225. + MPP25_GPIO,
  226. + MPP26_GPIO,
  227. + MPP27_GPIO,
  228. + MPP28_GPIO, /* SYS LED (green) */
  229. + MPP29_GPIO, /* SYS LED (orange) */
  230. + MPP30_GPIO,
  231. + MPP31_GPIO,
  232. + MPP32_GPIO,
  233. + MPP33_GPIO,
  234. + MPP34_GPIO,
  235. + MPP35_GPIO,
  236. + MPP36_GPIO, /* reset button */
  237. + MPP37_GPIO, /* copy button */
  238. + MPP38_GPIO, /* VID B0 */
  239. + MPP39_GPIO, /* COPY LED (green) */
  240. + MPP40_GPIO, /* COPY LED (red) */
  241. + MPP41_GPIO, /* HDD1 LED (green) */
  242. + MPP42_GPIO, /* HDD1 LED (red) */
  243. + MPP43_GPIO, /* HTP pin */
  244. + MPP44_GPIO, /* buzzer */
  245. + MPP45_GPIO, /* VID B1 */
  246. + MPP46_GPIO, /* power button */
  247. + MPP47_GPIO, /* HDD2 power */
  248. + MPP48_GPIO, /* power off */
  249. + 0
  250. + };
  251. + kirkwood_mpp_conf(kwmpp_config, NULL);
  252. + return 0;
  253. +}
  254. +
  255. +int board_init(void)
  256. +{
  257. +
  258. + /* address of boot parameters */
  259. + gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
  260. +
  261. + /* This disables the hardware watchdog in the mcu on this board. */
  262. + kw_gpio_set_valid(14, 1);
  263. + kw_gpio_direction_output(14, 0);
  264. + kw_gpio_set_value(14, 1);
  265. +
  266. + return 0;
  267. +}
  268. +
  269. +#ifdef CONFIG_RESET_PHY_R
  270. +/* Configure and enable MV88E1318 PHY */
  271. +void reset_phy(void)
  272. +{
  273. + u16 reg;
  274. + u16 devadr;
  275. + char *name = "egiga0";
  276. +
  277. + if (miiphy_set_current_dev(name))
  278. + return;
  279. +
  280. + /* command to read PHY dev address */
  281. + if (miiphy_read(name, 0xEE, 0xEE, (u16 *) &devadr)) {
  282. + printf("Err..%s could not read PHY dev address\n",
  283. + __FUNCTION__);
  284. + return;
  285. + }
  286. +
  287. + /* Set RGMII delay */
  288. + miiphy_write(name, devadr, MV88E1318_PGADR_REG, MV88E1318_MAC_CTRL_PG);
  289. + miiphy_read(name, devadr, MV88E1318_MAC_CTRL_REG, &reg);
  290. + reg |= (MV88E1318_RGMII_RXTM_CTRL | MV88E1318_RGMII_TXTM_CTRL);
  291. + miiphy_write(name, devadr, MV88E1318_MAC_CTRL_REG, reg);
  292. + miiphy_write(name, devadr, MV88E1318_PGADR_REG, 0);
  293. +
  294. + /* reset the phy */
  295. + miiphy_reset(name, devadr);
  296. +
  297. + /* The ZyXEL NSA325 uses the 88E1310S Alaska (interface identical to 88E1318) */
  298. + /* and has an MCU attached to the LED[2] via tristate interrupt */
  299. + reg = 0;
  300. +
  301. + /* switch to LED register page */
  302. + miiphy_write(name, devadr, MV88E1318_PGADR_REG, MV88E1318_LED_PG);
  303. + /* read out LED polarity register */
  304. + miiphy_read(name, devadr, MV88E1318_LED_POL_REG, &reg);
  305. + /* clear 4, set 5 - LED2 low, tri-state */
  306. + reg &= ~(MV88E1318_LED2_4);
  307. + reg |= (MV88E1318_LED2_5);
  308. + /* write back LED polarity register */
  309. + miiphy_write(name, devadr, MV88E1318_LED_POL_REG, reg);
  310. + /* jump back to page 0, per the PHY chip documenation. */
  311. + miiphy_write(name, devadr, MV88E1318_PGADR_REG, 0);
  312. +
  313. + /* Set the phy back to auto-negotiation mode. Onboard mcu sets it as 10Mbits/s on poweroff for WoL function */
  314. + miiphy_write(name, devadr, 0x4, 0x1e1);
  315. + miiphy_write(name, devadr, 0x9, 0x300);
  316. + /* Downshift */
  317. + miiphy_write(name, devadr, 0x10, 0x3860);
  318. + miiphy_write(name, devadr, 0x0, 0x9140);
  319. +
  320. + printf("MV88E1318 PHY initialized on %s\n", name);
  321. +
  322. +}
  323. +#endif /* CONFIG_RESET_PHY_R */
  324. +
  325. +#ifdef CONFIG_SHOW_BOOT_PROGRESS
  326. +void show_boot_progress(int val)
  327. +{
  328. + struct kwgpio_registers *gpio0 = (struct kwgpio_registers *)MVEBU_GPIO0_BASE;
  329. + u32 dout0 = readl(&gpio0->dout);
  330. + u32 blen0 = readl(&gpio0->blink_en);
  331. +
  332. + struct kwgpio_registers *gpio1 = (struct kwgpio_registers *)MVEBU_GPIO1_BASE;
  333. + u32 dout1 = readl(&gpio1->dout);
  334. + u32 blen1 = readl(&gpio1->blink_en);
  335. +
  336. + switch (val) {
  337. + case BOOTSTAGE_ID_DECOMP_IMAGE:
  338. + writel(blen0 & ~(SYS_GREEN_LED | SYS_ORANGE_LED), &gpio0->blink_en);
  339. + writel((dout0 & ~SYS_GREEN_LED) | SYS_ORANGE_LED, &gpio0->dout);
  340. + break;
  341. + case BOOTSTAGE_ID_RUN_OS:
  342. + writel(dout0 & ~SYS_ORANGE_LED, &gpio0->dout);
  343. + writel(blen0 | SYS_GREEN_LED, &gpio0->blink_en);
  344. + break;
  345. + case BOOTSTAGE_ID_NET_START:
  346. + writel(dout1 & ~COPY_RED_LED, &gpio1->dout);
  347. + writel((blen1 & ~COPY_RED_LED) | COPY_GREEN_LED, &gpio1->blink_en);
  348. + break;
  349. + case BOOTSTAGE_ID_NET_LOADED:
  350. + writel(blen1 & ~(COPY_RED_LED | COPY_GREEN_LED), &gpio1->blink_en);
  351. + writel((dout1 & ~COPY_RED_LED) | COPY_GREEN_LED, &gpio1->dout);
  352. + break;
  353. + case -BOOTSTAGE_ID_NET_NETLOOP_OK:
  354. + case -BOOTSTAGE_ID_NET_LOADED:
  355. + writel(dout1 & ~COPY_GREEN_LED, &gpio1->dout);
  356. + writel((blen1 & ~COPY_GREEN_LED) | COPY_RED_LED, &gpio1->blink_en);
  357. + break;
  358. + default:
  359. + if (val < 0) {
  360. + /* error */
  361. + printf("Error occured, error code = %d\n", -val);
  362. + writel(dout0 & ~SYS_GREEN_LED, &gpio0->dout);
  363. + writel(blen0 | SYS_ORANGE_LED, &gpio0->blink_en);
  364. + }
  365. + break;
  366. + }
  367. +}
  368. +#endif
  369. +
  370. +#if defined(CONFIG_KIRKWOOD_GPIO)
  371. +/* Return GPIO button status */
  372. +/*
  373. +un-pressed:
  374. + gpio-36 (Reset Button ) in hi (act lo) - IRQ edge (clear )
  375. + gpio-37 (Copy Button ) in hi (act lo) - IRQ edge (clear )
  376. + gpio-46 (Power Button ) in lo (act hi) - IRQ edge (clear )
  377. +pressed
  378. + gpio-36 (Reset Button ) in lo (act hi) - IRQ edge (clear )
  379. + gpio-37 (Copy Button ) in lo (act hi) - IRQ edge (clear )
  380. + gpio-46 (Power Button ) in hi (act lo) - IRQ edge (clear )
  381. +*/
  382. +
  383. +static int
  384. +do_read_button(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  385. +{
  386. + if (strcmp(argv[1], "power") == 0) {
  387. + kw_gpio_set_valid(BTN_POWER, GPIO_INPUT_OK);
  388. + kw_gpio_direction_input(BTN_POWER);
  389. + return !kw_gpio_get_value(BTN_POWER);
  390. + }
  391. + else if (strcmp(argv[1], "reset") == 0)
  392. + return kw_gpio_get_value(BTN_RESET);
  393. + else if (strcmp(argv[1], "copy") == 0)
  394. + return kw_gpio_get_value(BTN_COPY);
  395. + else
  396. + return -1;
  397. +}
  398. +
  399. +
  400. +U_BOOT_CMD(button, 2, 0, do_read_button,
  401. + "Return GPIO button status 0=off 1=on",
  402. + "- button power|reset|copy: test buttons states\n"
  403. +);
  404. +
  405. +#endif
  406. +
  407. --- /dev/null
  408. +++ b/board/zyxel/nsa325/nsa325.h
  409. @@ -0,0 +1,77 @@
  410. +/*
  411. + * Copyright (C) 2014 Jason Plum <[email protected]>
  412. + *
  413. + * Based on nsa320.h originall written by
  414. + * Copyright (C) 2012 Peter Schildmann <[email protected]>
  415. + *
  416. + * Based on guruplug.h originally written by
  417. + * Siddarth Gore <[email protected]>
  418. + * (C) Copyright 2009
  419. + * Marvell Semiconductor <www.marvell.com>
  420. + *
  421. + * See file CREDITS for list of people who contributed to this
  422. + * project.
  423. + *
  424. + * This program is free software; you can redistribute it and/or
  425. + * modify it under the terms of the GNU General Public License as
  426. + * published by the Free Software Foundation; either version 2 of
  427. + * the License, or (at your option) any later version.
  428. + *
  429. + * This program is distributed in the hope that it will be useful,
  430. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  431. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  432. + * GNU General Public License for more details.
  433. + *
  434. + * You should have received a copy of the GNU General Public License
  435. + * along with this program; if not, write to the Free Software
  436. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  437. + * MA 02110-1301 USA
  438. + */
  439. +
  440. +#ifndef __NSA325_H
  441. +#define __NSA325_H
  442. +
  443. +/* low GPIO's */
  444. +#define HDD2_GREEN_LED (1 << 12)
  445. +#define HDD2_RED_LED (1 << 13)
  446. +#define USB_GREEN_LED (1 << 15)
  447. +#define USB_POWER (1 << 21)
  448. +#define SYS_GREEN_LED (1 << 28)
  449. +#define SYS_ORANGE_LED (1 << 29)
  450. +
  451. +#define PIN_USB_GREEN_LED 15
  452. +#define PIN_USB_POWER 21
  453. +
  454. +#define NSA325_OE_LOW (~(HDD2_GREEN_LED | HDD2_RED_LED | \
  455. + USB_GREEN_LED | USB_POWER | \
  456. + SYS_GREEN_LED | SYS_ORANGE_LED))
  457. +#define NSA325_VAL_LOW (SYS_GREEN_LED | USB_POWER)
  458. +
  459. +/* high GPIO's */
  460. +#define COPY_GREEN_LED (1 << 7)
  461. +#define COPY_RED_LED (1 << 8)
  462. +#define HDD1_GREEN_LED (1 << 9)
  463. +#define HDD1_RED_LED (1 << 10)
  464. +#define HDD2_POWER (1 << 15)
  465. +#define WATCHDOG_SIGNAL (1 << 14)
  466. +
  467. +#define NSA325_OE_HIGH (~(COPY_GREEN_LED | COPY_RED_LED | \
  468. + HDD1_GREEN_LED | HDD1_RED_LED | HDD2_POWER | WATCHDOG_SIGNAL ))
  469. +#define NSA325_VAL_HIGH (WATCHDOG_SIGNAL | HDD2_POWER)
  470. +
  471. +/* PHY related */
  472. +#define MV88E1318_PGADR_REG 22
  473. +#define MV88E1318_MAC_CTRL_PG 2
  474. +#define MV88E1318_MAC_CTRL_REG 21
  475. +#define MV88E1318_RGMII_TXTM_CTRL (1 << 4)
  476. +#define MV88E1318_RGMII_RXTM_CTRL (1 << 5)
  477. +#define MV88E1318_LED_PG 3
  478. +#define MV88E1318_LED_POL_REG 17
  479. +#define MV88E1318_LED2_4 (1 << 4)
  480. +#define MV88E1318_LED2_5 (1 << 5)
  481. +
  482. +#define BTN_POWER 46
  483. +#define BTN_RESET 36
  484. +#define BTN_COPY 37
  485. +
  486. +#endif /* __NSA325_H */
  487. --- /dev/null
  488. +++ b/configs/nsa325_defconfig
  489. @@ -0,0 +1,40 @@
  490. +CONFIG_ARM=y
  491. +CONFIG_KIRKWOOD=y
  492. +CONFIG_SYS_TEXT_BASE=0x600000
  493. +CONFIG_TARGET_NSA325=y
  494. +CONFIG_IDENT_STRING="\nZyXEL NSA325 2-Bay Power Media Server"
  495. +CONFIG_NR_DRAM_BANKS=2
  496. +CONFIG_BOOTDELAY=3
  497. +CONFIG_SYS_PROMPT="NSA325> "
  498. +# CONFIG_CMD_IMLS is not set
  499. +# CONFIG_CMD_FLASH is not set
  500. +CONFIG_MVGBE=y
  501. +CONFIG_MII=y
  502. +CONFIG_SYS_NS16550=y
  503. +CONFIG_CMD_FDT=y
  504. +CONFIG_OF_LIBFDT=y
  505. +CONFIG_CMD_SETEXPR=y
  506. +CONFIG_CMD_DHCP=y
  507. +CONFIG_CMD_MII=y
  508. +CONFIG_CMD_PING=y
  509. +CONFIG_CMD_DNS=y
  510. +CONFIG_CMD_SNTP=y
  511. +CONFIG_CMD_USB=y
  512. +CONFIG_USB=y
  513. +CONFIG_CMD_DATE=y
  514. +CONFIG_CMD_EXT2=y
  515. +CONFIG_CMD_EXT4=y
  516. +CONFIG_CMD_FAT=y
  517. +CONFIG_CMD_JFFS2=y
  518. +CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:0x0c0000(uboot),0x80000(uboot_env),0x7ec0000(ubi)"
  519. +CONFIG_CMD_MTDPARTS=y
  520. +CONFIG_CMD_ENV=y
  521. +CONFIG_CMD_NAND=y
  522. +CONFIG_EFI_PARTITION=y
  523. +CONFIG_ENV_IS_IN_NAND=y
  524. +CONFIG_CMD_UBI=y
  525. +CONFIG_USB_EHCI_HCD=y
  526. +CONFIG_USB_STORAGE=y
  527. +CONFIG_LZMA=y
  528. +CONFIG_LZO=y
  529. +CONFIG_SYS_LONGHELP=y
  530. --- /dev/null
  531. +++ b/include/configs/nsa325.h
  532. @@ -0,0 +1,120 @@
  533. +/*
  534. + * (C) Copyright 2016 bodhi <[email protected]>
  535. + *
  536. + * Based on
  537. + * Copyright (C) 2014 Jason Plum <[email protected]>
  538. + * Based on
  539. + * Copyright (C) 2012 Peter Schildmann <[email protected]>
  540. + *
  541. + * Based on guruplug.h originally written by
  542. + * Siddarth Gore <[email protected]>
  543. + * (C) Copyright 2009
  544. + * Marvell Semiconductor <www.marvell.com>
  545. + *
  546. + * See file CREDITS for list of people who contributed to this
  547. + * project.
  548. + *
  549. + * This program is free software; you can redistribute it and/or
  550. + * modify it under the terms of the GNU General Public License as
  551. + * published by the Free Software Foundation; either version 2 of
  552. + * the License, or (at your option) any later version.
  553. + *
  554. + * This program is distributed in the hope that it will be useful,
  555. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  556. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  557. + * GNU General Public License for more details.
  558. + *
  559. + * You should have received a copy of the GNU General Public License
  560. + * along with this program; if not, write to the Free Software
  561. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  562. + * MA 02110-1301 USA
  563. + */
  564. +
  565. +#ifndef _CONFIG_NSA325_H
  566. +#define _CONFIG_NSA325_H
  567. +
  568. +/*
  569. + * High Level Configuration Options (easy to change)
  570. + */
  571. +#define CONFIG_FEROCEON_88FR131 1 /* CPU Core subversion */
  572. +#define CONFIG_KW88F6281 1 /* SOC Name */
  573. +
  574. +#define CONFIG_SKIP_LOWLEVEL_INIT /* disable board lowlevel_init */
  575. +
  576. +/*
  577. + * Misc Configuration Options
  578. + */
  579. +#define CONFIG_SHOW_BOOT_PROGRESS 1 /* boot progess display (LED's) */
  580. +
  581. +/*
  582. + * Commands configuration
  583. + */
  584. +#define CONFIG_PREBOOT
  585. +
  586. +/*
  587. + * mv-common.h should be defined after CMD configs since it used them
  588. + * to enable certain macros
  589. + */
  590. +#include "mv-common.h"
  591. +
  592. +/*
  593. + * Environment variables configurations
  594. + */
  595. +#ifdef CONFIG_CMD_NAND
  596. +#define CONFIG_ENV_SECT_SIZE 0x20000 /* 128K */
  597. +#endif
  598. +/*
  599. + * max 4k env size is enough, but in case of nand
  600. + * it has to be rounded to sector size
  601. + */
  602. +#define CONFIG_ENV_SIZE 0x20000 /* 128k */
  603. +#define CONFIG_ENV_ADDR 0xc0000
  604. +#define CONFIG_ENV_OFFSET 0xc0000 /* env starts here */
  605. +
  606. +/*
  607. + * Default environment variables
  608. + */
  609. +#define CONFIG_BOOTCOMMAND \
  610. + "ubi part ubi; " \
  611. + "ubi read 0x800000 kernel; " \
  612. + "bootm 0x800000"
  613. +
  614. +#define CONFIG_EXTRA_ENV_SETTINGS \
  615. + "console=console=ttyS0,115200\0" \
  616. + "mtdids=nand0=orion_nand\0" \
  617. + "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \
  618. + "bootargs_root=\0"
  619. +
  620. +/*
  621. + * Ethernet Driver configuration
  622. + */
  623. +#ifdef CONFIG_CMD_NET
  624. +#define CONFIG_MVGBE_PORTS {1, 0} /* enable port 0 only */
  625. +#define CONFIG_PHY_BASE_ADR 0x1
  626. +#define CONFIG_NETCONSOLE
  627. +#endif /* CONFIG_CMD_NET */
  628. +
  629. +/*
  630. + * SATA Driver configuration
  631. + */
  632. +#ifdef CONFIG_MVSATA_IDE
  633. +#define CONFIG_SYS_ATA_IDE0_OFFSET MV_SATA_PORT0_OFFSET
  634. +#define CONFIG_SYS_ATA_IDE1_OFFSET MV_SATA_PORT1_OFFSET
  635. +#endif /* CONFIG_MVSATA_IDE */
  636. +
  637. +/*
  638. + * File system
  639. + */
  640. +#define CONFIG_JFFS2_NAND
  641. +#define CONFIG_JFFS2_LZO
  642. +
  643. +/*
  644. + * Date Time
  645. + */
  646. +#ifdef CONFIG_CMD_DATE
  647. +#define CONFIG_RTC_MV
  648. +#endif /* CONFIG_CMD_DATE */
  649. +
  650. +#define CONFIG_KIRKWOOD_GPIO /* Enable GPIO Support */
  651. +
  652. +#endif /* _CONFIG_NSA325_H */