008-openrb-medium.patch 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. --- a/arch/powerpc/boot/Makefile
  2. +++ b/arch/powerpc/boot/Makefile
  3. @@ -71,7 +71,7 @@ src-plat := of.c cuboot-52xx.c cuboot-82
  4. cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yosemite.c simpleboot.c \
  5. virtex405-head.S virtex.c redboot-83xx.c cuboot-sam440ep.c \
  6. cuboot-acadia.c cuboot-magicboxv1.c cuboot-magicboxv2.c \
  7. - cuboot-openrb-light.c
  8. + cuboot-openrb-light.c cuboot-openrb-medium.c
  9. src-boot := $(src-wlib) $(src-plat) empty.c
  10. src-boot := $(addprefix $(obj)/, $(src-boot))
  11. @@ -218,6 +218,7 @@ image-$(CONFIG_ACADIA) += cuImage.acad
  12. image-$(CONFIG_MAGICBOXV1) += cuImage.magicboxv1
  13. image-$(CONFIG_MAGICBOXV2) += cuImage.magicboxv2
  14. image-$(CONFIG_OPENRB_LIGHT) += cuImage.openrb-light
  15. +image-$(CONFIG_OPENRB_MEDIUM) += cuImage.openrb-medium
  16. # Board ports in arch/powerpc/platform/44x/Kconfig
  17. image-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony
  18. --- a/arch/powerpc/platforms/40x/Kconfig
  19. +++ b/arch/powerpc/platforms/40x/Kconfig
  20. @@ -89,6 +89,16 @@ config OPENRB_LIGHT
  21. help
  22. This option enables support for the OpenRB Light board.
  23. +config OPENRB_MEDIUM
  24. + bool "OpenRB Medium"
  25. + depends on 40x
  26. + default n
  27. + select PPC40x_SIMPLE
  28. + select 405EP
  29. + select PCI
  30. + help
  31. + This option enables support for the OpenRB Medium board.
  32. +
  33. #config REDWOOD_5
  34. # bool "Redwood-5"
  35. # depends on 40x
  36. --- a/arch/powerpc/platforms/40x/ppc40x_simple.c
  37. +++ b/arch/powerpc/platforms/40x/ppc40x_simple.c
  38. @@ -55,6 +55,7 @@ static char *board[] __initdata = {
  39. "magicboxv1",
  40. "magicboxv2",
  41. "openrb,light",
  42. + "openrb,medium",
  43. };
  44. static int __init ppc40x_probe(void)
  45. --- /dev/null
  46. +++ b/arch/powerpc/boot/cuboot-openrb-medium.c
  47. @@ -0,0 +1,69 @@
  48. +/*
  49. + * Old U-boot compatibility for OpenRB Medium
  50. + *
  51. + * Author: Gabor Juhos <[email protected]>
  52. + *
  53. + * This program is free software; you can redistribute it and/or modify it
  54. + * under the terms of the GNU General Public License version 2 as published
  55. + * by the Free Software Foundation.
  56. + */
  57. +
  58. +#include "ops.h"
  59. +#include "io.h"
  60. +#include "dcr.h"
  61. +#include "stdio.h"
  62. +#include "4xx.h"
  63. +#include "44x.h"
  64. +#include "cuboot.h"
  65. +
  66. +#define TARGET_4xx
  67. +#define TARGET_405EP
  68. +#include "ppcboot.h"
  69. +
  70. +static bd_t bd;
  71. +
  72. +static void fixup_cf_card(void)
  73. +{
  74. +#define DCRN_CPC0_PCI_BASE 0xf9
  75. +#define CF_CS0_BASE 0xff100000
  76. +#define CF_CS1_BASE 0xff200000
  77. +
  78. + /* Turn on PerWE instead of PCIsomething */
  79. + mtdcr(DCRN_CPC0_PCI_BASE,
  80. + mfdcr(DCRN_CPC0_PCI_BASE) | (0x80000000L >> 27));
  81. +
  82. + /* PerCS1 (CF's CS0): base 0xff100000, 16-bit, rw */
  83. + mtdcr(DCRN_EBC0_CFGADDR, EBC_B1CR);
  84. + mtdcr(DCRN_EBC0_CFGDATA, CF_CS0_BASE | EBC_BXCR_BU_RW | EBC_BXCR_BW_16);
  85. + mtdcr(DCRN_EBC0_CFGADDR, EBC_B1AP);
  86. + mtdcr(DCRN_EBC0_CFGDATA, 0x080bd800);
  87. +
  88. + /* PerCS2 (CF's CS1): base 0xff200000, 16-bit, rw */
  89. + mtdcr(DCRN_EBC0_CFGADDR, EBC_B2CR);
  90. + mtdcr(DCRN_EBC0_CFGDATA, CF_CS1_BASE | EBC_BXCR_BU_RW | EBC_BXCR_BW_16);
  91. + mtdcr(DCRN_EBC0_CFGADDR, EBC_B2AP);
  92. + mtdcr(DCRN_EBC0_CFGDATA, 0x080bd800);
  93. +
  94. +#undef DCRN_CPC0_PCI_BASE
  95. +#undef CF_CS0_BASE
  96. +#undef CF_CS1_BASE
  97. +}
  98. +
  99. +static void openrb_light_fixups(void)
  100. +{
  101. + fixup_cf_card();
  102. + ibm405ep_fixup_clocks(33333000);
  103. + ibm4xx_sdram_fixup_memsize();
  104. + dt_fixup_mac_addresses(&bd.bi_enetaddr, &bd.bi_enet1addr);
  105. +}
  106. +
  107. +void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
  108. + unsigned long r6, unsigned long r7)
  109. +{
  110. + CUBOOT_INIT();
  111. + platform_ops.fixups = openrb_light_fixups;
  112. + platform_ops.exit = ibm40x_dbcr_reset;
  113. + fdt_init(_dtb_start);
  114. + serial_console_init();
  115. +}
  116. +
  117. --- /dev/null
  118. +++ b/arch/powerpc/boot/dts/openrb-medium.dts
  119. @@ -0,0 +1,281 @@
  120. +/*
  121. + * Device Tree Source for OpenRB Medium board
  122. + *
  123. + * Copyright 2008 Imre Kaloz <[email protected]>
  124. + * Copyright 2009 Gabor Juhos <[email protected]>
  125. + *
  126. + * Based on walnut.dts
  127. + *
  128. + * This file is licensed under the terms of the GNU General Public
  129. + * License version 2. This program is licensed "as is" without
  130. + * any warranty of any kind, whether express or implied.
  131. + */
  132. +
  133. +/dts-v1/;
  134. +
  135. +/ {
  136. + #address-cells = <1>;
  137. + #size-cells = <1>;
  138. + model = "openrb,medium";
  139. + compatible = "openrb,medium";
  140. + dcr-parent = <&{/cpus/cpu@0}>;
  141. +
  142. + aliases {
  143. + ethernet0 = &EMAC0;
  144. + ethernet1 = &EMAC1;
  145. + serial0 = &UART0;
  146. + serial1 = &UART1;
  147. + };
  148. +
  149. + cpus {
  150. + #address-cells = <1>;
  151. + #size-cells = <0>;
  152. +
  153. + cpu@0 {
  154. + device_type = "cpu";
  155. + model = "PowerPC,405EP";
  156. + reg = <0x00000000>;
  157. + clock-frequency = <0xbebc200>; /* Filled in by zImage */
  158. + timebase-frequency = <0>; /* Filled in by zImage */
  159. + i-cache-line-size = <20>;
  160. + d-cache-line-size = <20>;
  161. + i-cache-size = <4000>;
  162. + d-cache-size = <4000>;
  163. + dcr-controller;
  164. + dcr-access-method = "native";
  165. + };
  166. + };
  167. +
  168. + memory {
  169. + device_type = "memory";
  170. + reg = <0x00000000 0x00000000>; /* Filled in by zImage */
  171. + };
  172. +
  173. + UIC0: interrupt-controller {
  174. + compatible = "ibm,uic";
  175. + interrupt-controller;
  176. + cell-index = <0>;
  177. + dcr-reg = <0x0c0 0x009>;
  178. + #address-cells = <0>;
  179. + #size-cells = <0>;
  180. + #interrupt-cells = <2>;
  181. + };
  182. +
  183. + plb {
  184. + compatible = "ibm,plb3";
  185. + #address-cells = <1>;
  186. + #size-cells = <1>;
  187. + ranges;
  188. + clock-frequency = <0>; /* Filled in by zImage */
  189. +
  190. + SDRAM0: memory-controller {
  191. + compatible = "ibm,sdram-405ep";
  192. + dcr-reg = <0x010 0x002>;
  193. + };
  194. +
  195. + MAL: mcmal {
  196. + compatible = "ibm,mcmal-405ep", "ibm,mcmal";
  197. + dcr-reg = <0x180 0x062>;
  198. + num-tx-chans = <4>;
  199. + num-rx-chans = <2>;
  200. + interrupt-parent = <&UIC0>;
  201. + interrupts = <
  202. + 0xb 0x4 /* TXEOB */
  203. + 0xc 0x4 /* RXEOB */
  204. + 0xa 0x4 /* SERR */
  205. + 0xd 0x4 /* TXDE */
  206. + 0xe 0x4 /* RXDE */>;
  207. + };
  208. +
  209. + POB0: opb {
  210. + compatible = "ibm,opb-405ep", "ibm,opb";
  211. + #address-cells = <1>;
  212. + #size-cells = <1>;
  213. + ranges = <0xef600000 0xef600000 0x00a00000>;
  214. + dcr-reg = <0x0a0 0x005>;
  215. + clock-frequency = <0>; /* Filled in by zImage */
  216. +
  217. + UART0: serial@ef600300 {
  218. + device_type = "serial";
  219. + compatible = "ns16550";
  220. + reg = <0xef600300 0x00000008>;
  221. + virtual-reg = <0xef600300>;
  222. + clock-frequency = <0>; /* Filled in by zImage */
  223. + current-speed = <115200>;
  224. + interrupt-parent = <&UIC0>;
  225. + interrupts = <0x0 0x4>;
  226. + };
  227. +
  228. + UART1: serial@ef600400 {
  229. + device_type = "serial";
  230. + compatible = "ns16550";
  231. + reg = <0xef600400 0x00000008>;
  232. + virtual-reg = <0xef600400>;
  233. + clock-frequency = <0>; /* Filled in by zImage */
  234. + current-speed = <115200>;
  235. + interrupt-parent = <&UIC0>;
  236. + interrupts = <0x1 0x4>;
  237. + };
  238. +
  239. + IIC: i2c@ef600500 {
  240. + compatible = "ibm,iic-405ep", "ibm,iic";
  241. + #address-cells = <1>;
  242. + #size-cells = <0>;
  243. + reg = <0xef600500 0x00000011>;
  244. + interrupt-parent = <&UIC0>;
  245. + interrupts = <0x2 0x4>;
  246. +
  247. + dtt@48 {
  248. + compatible = "national,lm75";
  249. + reg = <0x48>;
  250. + };
  251. +
  252. + eeprom@50 {
  253. + compatible = "at24,24c16";
  254. + reg = <0x50>;
  255. + };
  256. + };
  257. +
  258. + GPIO0: gpio-controller@ef600700 {
  259. + compatible = "ibm,ppc4xx-gpio";
  260. + reg = <0xef600700 0x00000020>;
  261. + #gpio-cells = <2>;
  262. + gpio-controller;
  263. + };
  264. +
  265. + EMAC0: ethernet@ef600800 {
  266. + linux,network-index = <0x0>;
  267. + device_type = "network";
  268. + compatible = "ibm,emac-405ep", "ibm,emac";
  269. + interrupt-parent = <&UIC0>;
  270. + interrupts = <
  271. + 0xf 0x4 /* Ethernet */
  272. + 0x9 0x4 /* Ethernet Wake Up */>;
  273. + local-mac-address = [000000000000]; /* Filled in by zImage */
  274. + reg = <0xef600800 0x00000070>;
  275. + mal-device = <&MAL>;
  276. + mal-tx-channel = <0>;
  277. + mal-rx-channel = <0>;
  278. + cell-index = <0>;
  279. + max-frame-size = <0x5dc>;
  280. + rx-fifo-size = <0x1000>;
  281. + tx-fifo-size = <0x800>;
  282. + phy-mode = "mii";
  283. + phy-map = <0x00000000>;
  284. + };
  285. +
  286. + EMAC1: ethernet@ef600900 {
  287. + linux,network-index = <0x1>;
  288. + device_type = "network";
  289. + compatible = "ibm,emac-405ep", "ibm,emac";
  290. + interrupt-parent = <&UIC0>;
  291. + interrupts = <
  292. + 0x11 0x4 /* Ethernet */
  293. + 0x09 0x4 /* Ethernet Wake Up */>;
  294. + local-mac-address = [000000000000]; /* Filled in by zImage */
  295. + reg = <0xef600900 0x00000070>;
  296. + mal-device = <&MAL>;
  297. + mal-tx-channel = <2>;
  298. + mal-rx-channel = <1>;
  299. + cell-index = <1>;
  300. + max-frame-size = <0x5dc>;
  301. + rx-fifo-size = <0x1000>;
  302. + tx-fifo-size = <0x800>;
  303. + mdio-device = <&EMAC0>;
  304. + phy-mode = "mii";
  305. + phy-map = <0x00000001>;
  306. + };
  307. +
  308. + leds {
  309. + compatible = "gpio-leds";
  310. + user {
  311. + label = "magicbox:red:user";
  312. + gpios = <&GPIO0 2 1>;
  313. + };
  314. + };
  315. + };
  316. +
  317. + EBC0: ebc {
  318. + compatible = "ibm,ebc-405ep", "ibm,ebc";
  319. + dcr-reg = <0x012 0x002>;
  320. + #address-cells = <2>;
  321. + #size-cells = <1>;
  322. + /* The ranges property is supplied by the bootwrapper
  323. + * and is based on the firmware's configuration of the
  324. + * EBC bridge
  325. + */
  326. + clock-frequency = <0>; /* Filled in by zImage */
  327. +
  328. + cf_card@ff100000 {
  329. + compatible = "magicbox-cf", "pata-magicbox-cf";
  330. + reg = <0x00000000 0xff100000 0x00001000
  331. + 0x00000000 0xff200000 0x00001000>;
  332. + interrupt-parent = <&UIC0>;
  333. + interrupts = <0x19 0x1 /* IRQ_TYPE_EDGE_RISING */ >;
  334. + };
  335. +
  336. + nor_flash@ffc00000 {
  337. + compatible = "cfi-flash";
  338. + bank-width = <2>;
  339. + reg = <0x00000000 0xffc00000 0x00400000>;
  340. + #address-cells = <1>;
  341. + #size-cells = <1>;
  342. + partition@0 {
  343. + label = "linux";
  344. + reg = <0x0 0x120000>;
  345. + };
  346. + partition@120000 {
  347. + label = "rootfs";
  348. + reg = <0x120000 0x2a0000>;
  349. + };
  350. + partition@3c0000 {
  351. + label = "u-boot";
  352. + reg = <0x3c0000 0x30000>;
  353. + read-only;
  354. + };
  355. + };
  356. + };
  357. +
  358. + PCI0: pci@ec000000 {
  359. + device_type = "pci";
  360. + #interrupt-cells = <1>;
  361. + #size-cells = <2>;
  362. + #address-cells = <3>;
  363. + compatible = "ibm,plb405ep-pci", "ibm,plb-pci";
  364. + primary;
  365. + reg = <0xeec00000 0x00000008 /* Config space access */
  366. + 0xeed80000 0x00000004 /* IACK */
  367. + 0xeed80000 0x00000004 /* Special cycle */
  368. + 0xef480000 0x00000040>; /* Internal registers */
  369. +
  370. + /* Outbound ranges, one memory and one IO,
  371. + * later cannot be changed. Chip supports a second
  372. + * IO range but we don't use it for now
  373. + */
  374. + ranges = <0x02000000 0x00000000 0x80000000 0x80000000 0x00000000 0x20000000
  375. + 0x01000000 0x00000000 0x00000000 0xe8000000 0x00000000 0x00010000>;
  376. +
  377. + /* Inbound 2GB range starting at 0 */
  378. + dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x80000000>;
  379. +
  380. + interrupt-map-mask = <0xf800 0x0 0x0 0x0>;
  381. + interrupt-map = <
  382. + /* IDSEL 1 */
  383. + 0x800 0x0 0x0 0x0 &UIC0 0x1c 0x8
  384. +
  385. + /* IDSEL 2 */
  386. + 0x1000 0x0 0x0 0x0 &UIC0 0x1d 0x8
  387. +
  388. + /* IDSEL 3 */
  389. + 0x1800 0x0 0x0 0x0 &UIC0 0x1e 0x8
  390. +
  391. + /* IDSEL 4 */
  392. + 0x2000 0x0 0x0 0x0 &UIC0 0x1f 0x8
  393. + >;
  394. + };
  395. + };
  396. +
  397. + chosen {
  398. + linux,stdout-path = "/plb/opb/serial@ef600300";
  399. + };
  400. +};