200-dt2_board_support.patch 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. Index: linux-3.18.43/arch/arm/mach-orion5x/Kconfig
  2. ===================================================================
  3. --- linux-3.18.43.orig/arch/arm/mach-orion5x/Kconfig
  4. +++ linux-3.18.43/arch/arm/mach-orion5x/Kconfig
  5. @@ -36,6 +36,13 @@ config MACH_RD88F5182_DT
  6. Say 'Y' here if you want your kernel to support the Marvell
  7. Orion-NAS (88F5182) RD2, Flattened Device Tree.
  8. +config MACH_DT2
  9. + bool "Freecom DataTank Gateway"
  10. + select I2C_BOARDINFO
  11. + help
  12. + Say 'Y' here if you want your kernel to support the
  13. + Freecom DataTank Gateway
  14. +
  15. config MACH_KUROBOX_PRO
  16. bool "KuroBox Pro"
  17. select I2C_BOARDINFO
  18. Index: linux-3.18.43/arch/arm/mach-orion5x/Makefile
  19. ===================================================================
  20. --- linux-3.18.43.orig/arch/arm/mach-orion5x/Makefile
  21. +++ linux-3.18.43/arch/arm/mach-orion5x/Makefile
  22. @@ -14,6 +14,7 @@ obj-$(CONFIG_MACH_TS78XX) += ts78xx-setu
  23. obj-$(CONFIG_MACH_MV2120) += mv2120-setup.o
  24. obj-$(CONFIG_MACH_NET2BIG) += net2big-setup.o
  25. obj-$(CONFIG_MACH_WNR854T) += wnr854t-setup.o
  26. +obj-$(CONFIG_MACH_DT2) += dt2-setup.o
  27. obj-$(CONFIG_MACH_RD88F5181L_GE) += rd88f5181l-ge-setup.o
  28. obj-$(CONFIG_MACH_RD88F5181L_FXO) += rd88f5181l-fxo-setup.o
  29. obj-$(CONFIG_MACH_RD88F6183AP_GE) += rd88f6183ap-ge-setup.o
  30. Index: linux-3.18.43/arch/arm/mach-orion5x/dt2-common.h
  31. ===================================================================
  32. --- /dev/null
  33. +++ linux-3.18.43/arch/arm/mach-orion5x/dt2-common.h
  34. @@ -0,0 +1,82 @@
  35. +#ifndef __INC_DT2_COMMON_H
  36. +#define __INC_DT2_COMMON_H
  37. +
  38. +#define ATAG_MV_UBOOT 0x41000403
  39. +
  40. +struct tag_mv_uboot {
  41. + u32 uboot_version;
  42. + u32 tclk;
  43. + u32 sysclk;
  44. + u32 isUsbHost;
  45. + u32 overEthAddr;
  46. + u8 dt2_eeprom[256];
  47. +};
  48. +
  49. +#define DT2_EEPROM_ADDR 0x50
  50. +#define DT2_EEPROM_OFFSET 0
  51. +#define DT2_EEPROM_LENGTH 256
  52. +
  53. +#define DT2_SERIAL_NUMBER_DEFAULT "run on default\0"
  54. +#define DT2_REVISION_DEFAULT_INIT 0xFF
  55. +#define DT2_CONFIG_FLAGS_DEFAULT 0x00
  56. +
  57. +#define _PACKED_ __attribute__((packed))
  58. +
  59. +struct DT2_EEPROM_SD_CONFIG {
  60. + unsigned int ram_1;
  61. + unsigned int ram_2;
  62. + unsigned int ram_3;
  63. + unsigned int ram_4;
  64. + unsigned char ram_5;
  65. + unsigned char ram_6;
  66. + unsigned short ram_7;
  67. + unsigned int magic_id;
  68. + } _PACKED_; // 24 Bytes in total
  69. +
  70. +struct DT2_EEPROM_FC_CONFIG {
  71. + unsigned char rtc_sts_mask;
  72. + unsigned char rtc_sts_init;
  73. + unsigned char rtc_int_mask;
  74. + unsigned char rtc_int_init;
  75. + unsigned char rtc_atrim_init;
  76. + unsigned char rtc_dtrim_init;
  77. + unsigned char dummy1;
  78. + unsigned char dummy2;
  79. + unsigned char dt2_config_flags; /* 0x80 to load rtc_values to RTC */
  80. + unsigned char dt2_revision; /* upper nibble is HW, lower nibble is FW */
  81. + unsigned char dt2_serial_number[16]; /* Serial number of DT-2 */
  82. + } _PACKED_; // 26 Bytes in total
  83. +
  84. +#define CFG_LOAD_RTC_VALUES 0x80
  85. +
  86. +struct DT2_EEPROM_GW_CONFIG {
  87. + unsigned int dummy1;
  88. + unsigned int dummy2;
  89. + unsigned int dummy3;
  90. + unsigned char dummy4;
  91. + unsigned char tos_video_val1;
  92. + unsigned char tos_video_val2;
  93. + unsigned char tos_voip_val;
  94. + unsigned char qos_igmp_cfg;
  95. + unsigned char num_of_ifs;
  96. + unsigned short vlan_ports_if[3];
  97. + unsigned char mac_addr[3][6];
  98. + } _PACKED_; // 42 Bytes in total
  99. +
  100. +#define _SIZE_OF_ALL_STRUCTS_ (sizeof(struct DT2_EEPROM_SD_CONFIG) + sizeof(struct DT2_EEPROM_FC_CONFIG) + sizeof(struct DT2_EEPROM_GW_CONFIG))
  101. +
  102. +// MV = EEPROM - SD - FC - GW - CRC
  103. +struct DT2_EEPROM_MV_CONFIG {
  104. + unsigned int reg_addr[(DT2_EEPROM_LENGTH - _SIZE_OF_ALL_STRUCTS_ - sizeof(unsigned int)) / (sizeof(unsigned int) * 2)];
  105. + unsigned int reg_data[(DT2_EEPROM_LENGTH - _SIZE_OF_ALL_STRUCTS_ - sizeof(unsigned int)) / (sizeof(unsigned int) * 2)];
  106. + } _PACKED_;
  107. +
  108. +struct DT2_EEPROM_STRUCT {
  109. + struct DT2_EEPROM_MV_CONFIG mv;
  110. + struct DT2_EEPROM_SD_CONFIG sd;
  111. + struct DT2_EEPROM_FC_CONFIG fc;
  112. + struct DT2_EEPROM_GW_CONFIG gw;
  113. + unsigned int crc;
  114. + } _PACKED_;
  115. +
  116. +#endif
  117. Index: linux-3.18.43/arch/arm/mach-orion5x/dt2-setup.c
  118. ===================================================================
  119. --- /dev/null
  120. +++ linux-3.18.43/arch/arm/mach-orion5x/dt2-setup.c
  121. @@ -0,0 +1,448 @@
  122. +/*
  123. + * arch/arm/mach-orion5x/dt2-setup.c
  124. + *
  125. + * Freecom DataTank Gateway Setup
  126. + *
  127. + * Copyright (C) 2009 Zintis Petersons <Zintis.Petersons@abcsolutions.lv>
  128. + *
  129. + * This file is licensed under the terms of the GNU General Public
  130. + * License version 2. This program is licensed "as is" without any
  131. + * warranty of any kind, whether express or implied.
  132. + */
  133. +
  134. +#include <linux/kernel.h>
  135. +#include <linux/init.h>
  136. +#include <linux/platform_device.h>
  137. +#include <linux/pci.h>
  138. +#include <linux/irq.h>
  139. +#include <linux/mtd/physmap.h>
  140. +#include <linux/mv643xx_eth.h>
  141. +#include <linux/ethtool.h>
  142. +#include <linux/if_ether.h>
  143. +#include <net/dsa.h>
  144. +#include <linux/ata_platform.h>
  145. +#include <linux/i2c.h>
  146. +#include <linux/reboot.h>
  147. +#include <linux/interrupt.h>
  148. +#include <asm/mach-types.h>
  149. +#include <asm/gpio.h>
  150. +#include <asm/mach/arch.h>
  151. +#include <asm/mach/pci.h>
  152. +#include <mach/orion5x.h>
  153. +#include "common.h"
  154. +#include "mpp.h"
  155. +
  156. +/*****************************************************************************
  157. + * DT2 local
  158. + ****************************************************************************/
  159. +#include <asm/setup.h>
  160. +#include "dt2-common.h"
  161. +
  162. +u32 mvUbootVer = 0;
  163. +u32 mvTclk = 166666667;
  164. +u32 mvSysclk = 200000000;
  165. +u32 mvIsUsbHost = 1;
  166. +u32 overEthAddr = 0;
  167. +u32 gBoardId = -1;
  168. +struct DT2_EEPROM_STRUCT dt2_eeprom;
  169. +
  170. +/*****************************************************************************
  171. + * DT2 Info
  172. + ****************************************************************************/
  173. +/*
  174. + * PCI
  175. + */
  176. +
  177. +#define DT2_PCI_SLOT0_OFFS 7
  178. +#define DT2_PCI_SLOT0_IRQ_A_PIN 3
  179. +#define DT2_PCI_SLOT0_IRQ_B_PIN 2
  180. +
  181. +#define DT2_PIN_GPIO_SYNC 25
  182. +#define DT2_PIN_GPIO_POWER 24
  183. +#define DT2_PIN_GPIO_UNPLUG1 23
  184. +#define DT2_PIN_GPIO_UNPLUG2 22
  185. +#define DT2_PIN_GPIO_RESET 4
  186. +
  187. +#define DT2_NOR_BOOT_BASE 0xf4000000
  188. +#define DT2_NOR_BOOT_SIZE SZ_512K
  189. +
  190. +#define DT2_LEDS_BASE 0xfa000000
  191. +#define DT2_LEDS_SIZE SZ_1K
  192. +
  193. +/*****************************************************************************
  194. + * 512K NOR Flash on Device bus Boot CS
  195. + ****************************************************************************/
  196. +
  197. +static struct mtd_partition dt2_partitions[] = {
  198. + {
  199. + .name = "u-boot",
  200. + .size = 0x00080000,
  201. + .offset = 0,
  202. + },
  203. +};
  204. +
  205. +static struct physmap_flash_data dt2_nor_flash_data = {
  206. + .width = 1, /* 8 bit bus width */
  207. + .parts = dt2_partitions,
  208. + .nr_parts = ARRAY_SIZE(dt2_partitions)
  209. +};
  210. +
  211. +static struct resource dt2_nor_flash_resource = {
  212. + .flags = IORESOURCE_MEM,
  213. + .start = DT2_NOR_BOOT_BASE,
  214. + .end = DT2_NOR_BOOT_BASE + DT2_NOR_BOOT_SIZE - 1,
  215. +};
  216. +
  217. +static struct platform_device dt2_nor_flash = {
  218. + .name = "physmap-flash",
  219. + .id = 0,
  220. + .dev = {
  221. + .platform_data = &dt2_nor_flash_data,
  222. + },
  223. + .resource = &dt2_nor_flash_resource,
  224. + .num_resources = 1,
  225. +};
  226. +
  227. +/*****************************************************************************
  228. + * PCI
  229. + ****************************************************************************/
  230. +
  231. +void __init dt2_pci_preinit(void)
  232. +{
  233. + int pin, irq;
  234. +
  235. + /*
  236. + * Configure PCI GPIO IRQ pins
  237. + */
  238. + pin = DT2_PCI_SLOT0_IRQ_A_PIN;
  239. + if (gpio_request(pin, "PCI IntA") == 0) {
  240. + if (gpio_direction_input(pin) == 0) {
  241. + irq = gpio_to_irq(pin);
  242. + irq_set_irq_type(irq, IRQ_TYPE_LEVEL_LOW);
  243. + printk (KERN_INFO "PCI IntA IRQ: %d\n", irq);
  244. + } else {
  245. + printk(KERN_ERR "dt2_pci_preinit failed to "
  246. + "irq_set_irq_type pin %d\n", pin);
  247. + gpio_free(pin);
  248. + }
  249. + } else {
  250. + printk(KERN_ERR "dt2_pci_preinit failed to request gpio %d\n", pin);
  251. + }
  252. +
  253. + pin = DT2_PCI_SLOT0_IRQ_B_PIN;
  254. + if (gpio_request(pin, "PCI IntB") == 0) {
  255. + if (gpio_direction_input(pin) == 0) {
  256. + irq = gpio_to_irq(pin);
  257. + irq_set_irq_type(irq, IRQ_TYPE_LEVEL_LOW);
  258. + printk (KERN_INFO "PCI IntB IRQ: %d\n", irq);
  259. + } else {
  260. + printk(KERN_ERR "dt2_pci_preinit failed to "
  261. + "irq_set_irq_type pin %d\n", pin);
  262. + gpio_free(pin);
  263. + }
  264. + } else {
  265. + printk(KERN_ERR "dt2_pci_preinit failed to gpio_request %d\n", pin);
  266. + }
  267. +}
  268. +
  269. +static int __init dt2_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
  270. +{
  271. + int irq;
  272. +
  273. + /*
  274. + * Check for devices with hard-wired IRQs.
  275. + */
  276. + irq = orion5x_pci_map_irq(dev, slot, pin);
  277. + if (irq != -1){
  278. + printk(KERN_INFO "orion5x_pci_map_irq: %d\n", irq);
  279. + return irq;
  280. + }
  281. +
  282. + /*
  283. + * PCI IRQs are connected via GPIOs
  284. + */
  285. + switch (slot - DT2_PCI_SLOT0_OFFS) {
  286. + case 0:
  287. + if (pin == 1){
  288. + irq = gpio_to_irq(DT2_PCI_SLOT0_IRQ_A_PIN);
  289. + printk(KERN_INFO "dt2_pci_map_irq DT2_PCI_SLOT0_IRQ_A_PIN: %d\n", irq);
  290. + }
  291. + else {
  292. + irq = gpio_to_irq(DT2_PCI_SLOT0_IRQ_B_PIN);
  293. + printk(KERN_INFO "dt2_pci_map_irq DT2_PCI_SLOT0_IRQ_B_PIN: %d\n", irq);
  294. + }
  295. + default:
  296. + irq = -1;
  297. + printk(KERN_INFO "dt2_pci_map_irq IRQ: %d\n", irq);
  298. + }
  299. +
  300. + return irq;
  301. +}
  302. +
  303. +static struct hw_pci dt2_pci __initdata = {
  304. + .nr_controllers = 2,
  305. + .preinit = dt2_pci_preinit,
  306. + .setup = orion5x_pci_sys_setup,
  307. + .scan = orion5x_pci_sys_scan_bus,
  308. + .map_irq = dt2_pci_map_irq,
  309. +};
  310. +
  311. +static int __init dt2_pci_init(void)
  312. +{
  313. + if (machine_is_dt2())
  314. + pci_common_init(&dt2_pci);
  315. +
  316. + return 0;
  317. +}
  318. +
  319. +subsys_initcall(dt2_pci_init);
  320. +
  321. +/*****************************************************************************
  322. + * Ethernet
  323. + ****************************************************************************/
  324. +
  325. +static struct mv643xx_eth_platform_data dt2_eth_data = {
  326. + .phy_addr = MV643XX_ETH_PHY_NONE,
  327. + .speed = SPEED_1000,
  328. + .duplex = DUPLEX_FULL,
  329. +};
  330. +
  331. +static struct dsa_chip_data dt2_switch_chip_data = {
  332. + .port_names[0] = "wan",
  333. + .port_names[1] = "lan1",
  334. + .port_names[2] = "lan2",
  335. + .port_names[3] = "cpu",
  336. + .port_names[4] = "lan3",
  337. + .port_names[5] = "lan4",
  338. +};
  339. +
  340. +static struct dsa_platform_data dt2_switch_plat_data = {
  341. + .nr_chips = 1,
  342. + .chip = &dt2_switch_chip_data,
  343. +};
  344. +
  345. +/*****************************************************************************
  346. + * RTC ISL1208 on I2C bus
  347. + ****************************************************************************/
  348. +static struct i2c_board_info __initdata dt2_i2c_rtc = {
  349. + I2C_BOARD_INFO("isl1208", 0x6F),
  350. +};
  351. +
  352. +/*****************************************************************************
  353. + * Sata
  354. + ****************************************************************************/
  355. +static struct mv_sata_platform_data dt2_sata_data = {
  356. + .n_ports = 2,
  357. +};
  358. +
  359. +/*****************************************************************************
  360. + * General Setup
  361. + ****************************************************************************/
  362. +static unsigned int dt2_mpp_modes[] __initdata = {
  363. + MPP0_GPIO, // RTC interrupt
  364. + MPP1_GPIO, // 88e6131 interrupt
  365. + MPP2_GPIO, // PCI_intB
  366. + MPP3_GPIO, // PCI_intA
  367. + MPP4_GPIO, // reset button switch
  368. + MPP5_GPIO,
  369. + MPP6_GPIO,
  370. + MPP7_GPIO,
  371. + MPP8_GPIO,
  372. + MPP9_GIGE, /* GE_RXERR */
  373. + MPP10_GPIO, // usb
  374. + MPP11_GPIO, // usb
  375. + MPP12_GIGE, // GE_TXD[4]
  376. + MPP13_GIGE, // GE_TXD[5]
  377. + MPP14_GIGE, // GE_TXD[6]
  378. + MPP15_GIGE, // GE_TXD[7]
  379. + MPP16_GIGE, // GE_RXD[4]
  380. + MPP17_GIGE, // GE_RXD[5]
  381. + MPP18_GIGE, // GE_RXD[6]
  382. + MPP19_GIGE, // GE_RXD[7]
  383. + 0,
  384. +};
  385. +
  386. +/*****************************************************************************
  387. + * LEDS
  388. + ****************************************************************************/
  389. +static struct platform_device dt2_leds = {
  390. + .name = "dt2-led",
  391. + .id = -1,
  392. +};
  393. +
  394. +/****************************************************************************
  395. + * GPIO key
  396. + ****************************************************************************/
  397. +static irqreturn_t dt2_reset_handler(int irq, void *dev_id)
  398. +{
  399. + /* This is the paper-clip reset which does an emergency reboot. */
  400. + printk(KERN_INFO "Restarting system.\n");
  401. + machine_restart(NULL);
  402. +
  403. + /* This should never be reached. */
  404. + return IRQ_HANDLED;
  405. +}
  406. +
  407. +static irqreturn_t dt2_power_handler(int irq, void *dev_id)
  408. +{
  409. + printk(KERN_INFO "Shutting down system.\n");
  410. + machine_power_off();
  411. + return IRQ_HANDLED;
  412. +}
  413. +
  414. +static void __init dt2_init(void)
  415. +{
  416. + /*
  417. + * Setup basic Orion functions. Need to be called early.
  418. + */
  419. + orion5x_init();
  420. +
  421. + orion5x_mpp_conf(dt2_mpp_modes);
  422. +
  423. + /*
  424. + * Configure peripherals.
  425. + */
  426. +
  427. + orion5x_uart0_init();
  428. + orion5x_ehci0_init();
  429. + orion5x_ehci1_init();
  430. + orion5x_i2c_init();
  431. + orion5x_sata_init(&dt2_sata_data);
  432. + orion5x_xor_init();
  433. +
  434. + printk(KERN_INFO "U-Boot parameters:\n");
  435. + printk(KERN_INFO "Sys Clk = %d, Tclk = %d, BoardID = 0x%02x\n", mvSysclk, mvTclk, gBoardId);
  436. +
  437. + printk(KERN_INFO "Serial: %s\n", dt2_eeprom.fc.dt2_serial_number);
  438. + printk(KERN_INFO "Revision: %016x\n", dt2_eeprom.fc.dt2_revision);
  439. + printk(KERN_INFO "DT2: Using MAC address %pM for port 0\n",
  440. + dt2_eeprom.gw.mac_addr[0]);
  441. + printk(KERN_INFO "DT2: Using MAC address %pM for port 1\n",
  442. + dt2_eeprom.gw.mac_addr[1]);
  443. +
  444. + orion5x_eth_init(&dt2_eth_data);
  445. + memcpy(dt2_eth_data.mac_addr, dt2_eeprom.gw.mac_addr[0], 6);
  446. + orion5x_eth_switch_init(&dt2_switch_plat_data, NO_IRQ);
  447. +
  448. + i2c_register_board_info(0, &dt2_i2c_rtc, 1);
  449. +
  450. + mvebu_mbus_add_window_by_id(ORION_MBUS_DEVBUS_BOOT_TARGET,
  451. + ORION_MBUS_DEVBUS_BOOT_ATTR,
  452. + DT2_NOR_BOOT_BASE, DT2_NOR_BOOT_SIZE);
  453. +
  454. + platform_device_register(&dt2_nor_flash);
  455. +
  456. + mvebu_mbus_add_window_by_id(ORION_MBUS_DEVBUS_TARGET(0),
  457. + ORION_MBUS_DEVBUS_ATTR(0),
  458. + DT2_LEDS_BASE, DT2_LEDS_SIZE);
  459. + platform_device_register(&dt2_leds);
  460. +
  461. + if (request_irq(gpio_to_irq(DT2_PIN_GPIO_RESET), &dt2_reset_handler,
  462. + IRQF_TRIGGER_LOW,
  463. + "DT2: Reset button", NULL) < 0) {
  464. +
  465. + printk("DT2: Reset Button IRQ %d not available\n",
  466. + gpio_to_irq(DT2_PIN_GPIO_RESET));
  467. + }
  468. +
  469. + if (request_irq(gpio_to_irq(DT2_PIN_GPIO_POWER), &dt2_power_handler,
  470. + IRQF_TRIGGER_LOW,
  471. + "DT2: Power button", NULL) < 0) {
  472. +
  473. + printk(KERN_DEBUG "DT2: Power Button IRQ %d not available\n",
  474. + gpio_to_irq(DT2_PIN_GPIO_POWER));
  475. + }
  476. +}
  477. +
  478. +static int __init parse_tag_dt2_uboot(const struct tag *t)
  479. +{
  480. + struct tag_mv_uboot *mv_uboot;
  481. +
  482. + // Get pointer to our block
  483. + mv_uboot = (struct tag_mv_uboot*)&t->u;
  484. + mvTclk = mv_uboot->tclk;
  485. + mvSysclk = mv_uboot->sysclk;
  486. + mvUbootVer = mv_uboot->uboot_version;
  487. + mvIsUsbHost = mv_uboot->isUsbHost;
  488. +
  489. + // Some clock fixups
  490. + if(mvTclk == 166000000) mvTclk = 166666667;
  491. + else if(mvTclk == 133000000) mvTclk = 133333333;
  492. + else if(mvSysclk == 166000000) mvSysclk = 166666667;
  493. +
  494. + gBoardId = (mvUbootVer & 0xff);
  495. +
  496. + //DT2 specific data
  497. + memcpy(&dt2_eeprom, mv_uboot->dt2_eeprom, sizeof(struct DT2_EEPROM_STRUCT));
  498. +
  499. + return 0;
  500. +}
  501. +__tagtable(ATAG_MV_UBOOT, parse_tag_dt2_uboot);
  502. +
  503. +/*
  504. + * This is OpenWrt specific fixup. It includes code from original "tag_fixup_mem32" to
  505. + * fixup bogus memory tags and also fixes kernel cmdline by adding " init=/etc/preinit"
  506. + * at the end. It is important to flash OpenWrt image from original Freecom firmware.
  507. + *
  508. + * Vanilla kernel should use "tag_fixup_mem32" function.
  509. + */
  510. +static void __init openwrt_fixup(struct tag *t, char **from)
  511. +{
  512. + char *p = NULL;
  513. + static char openwrt_init_tag[] __initdata = " init=/etc/preinit";
  514. +
  515. + for (; t->hdr.size; t = tag_next(t)){
  516. + /* Locate the Freecom cmdline */
  517. + if (t->hdr.tag == ATAG_CMDLINE) {
  518. + p = t->u.cmdline.cmdline;
  519. + printk("%s(%d): Found cmdline '%s' at 0x%0lx\n",
  520. + __FUNCTION__, __LINE__, p, (unsigned long)p);
  521. + }
  522. + /*
  523. + * Many orion-based systems have buggy bootloader implementations.
  524. + * This is a common fixup for bogus memory tags.
  525. + */
  526. + if (t->hdr.tag == ATAG_MEM &&
  527. + (!t->u.mem.size || t->u.mem.size & ~PAGE_MASK ||
  528. + t->u.mem.start & ~PAGE_MASK)) {
  529. + printk(KERN_WARNING
  530. + "Clearing invalid memory bank %dKB@0x%08x\n",
  531. + t->u.mem.size / 1024, t->u.mem.start);
  532. + t->hdr.tag = 0;
  533. + }
  534. + }
  535. +
  536. + printk("%s(%d): End of table at 0x%0lx\n", __FUNCTION__, __LINE__, (unsigned long)t);
  537. +
  538. + /* Overwrite the end of the table with a new cmdline tag. */
  539. + t->hdr.tag = ATAG_CMDLINE;
  540. + t->hdr.size =
  541. + (sizeof (struct tag_header) +
  542. + strlen(p) + strlen(openwrt_init_tag) + 1 + 4) >> 2;
  543. +
  544. + strlcpy(t->u.cmdline.cmdline, p, COMMAND_LINE_SIZE);
  545. + strlcpy(t->u.cmdline.cmdline + strlen(p), openwrt_init_tag,
  546. + COMMAND_LINE_SIZE - strlen(p));
  547. +
  548. + printk("%s(%d): New cmdline '%s' at 0x%0lx\n",
  549. + __FUNCTION__, __LINE__,
  550. + t->u.cmdline.cmdline, (unsigned long)t->u.cmdline.cmdline);
  551. +
  552. + t = tag_next(t);
  553. +
  554. + printk("%s(%d): New end of table at 0x%0lx\n", __FUNCTION__, __LINE__, (unsigned long)t);
  555. +
  556. + t->hdr.tag = ATAG_NONE;
  557. + t->hdr.size = 0;
  558. +}
  559. +
  560. +/* Warning: Freecom uses their own custom bootloader with mach-type (=1500) */
  561. +MACHINE_START(DT2, "Freecom DataTank Gateway")
  562. + /* Maintainer: Zintis Petersons <Zintis.Petersons@abcsolutions.lv> */
  563. + .atag_offset = 0x100,
  564. + .init_machine = dt2_init,
  565. + .map_io = orion5x_map_io,
  566. + .init_irq = orion5x_init_irq,
  567. + .init_time = orion5x_timer_init,
  568. + .fixup = openwrt_fixup, //tag_fixup_mem32,
  569. +MACHINE_END