@@ -504,140 +504,31 @@ static void omap_init_rng(void)
504504WARN (IS_ERR (pdev ), "Can't build omap_device for omap_rng\n" );
505505}
506506
507- #if defined(CONFIG_CRYPTO_DEV_OMAP_SHAM ) || defined(CONFIG_CRYPTO_DEV_OMAP_SHAM_MODULE )
508-
509- #ifdef CONFIG_ARCH_OMAP2
510- static struct resource omap2_sham_resources [] = {
511- {
512- .start = OMAP24XX_SEC_SHA1MD5_BASE ,
513- .end = OMAP24XX_SEC_SHA1MD5_BASE + 0x64 ,
514- .flags = IORESOURCE_MEM ,
515- },
516- {
517- .start = 51 + OMAP_INTC_START ,
518- .flags = IORESOURCE_IRQ ,
519- }
520- };
521- static int omap2_sham_resources_sz = ARRAY_SIZE (omap2_sham_resources );
522- #else
523- #define omap2_sham_resources NULL
524- #define omap2_sham_resources_sz 0
525- #endif
526-
527- #ifdef CONFIG_ARCH_OMAP3
528- static struct resource omap3_sham_resources [] = {
529- {
530- .start = OMAP34XX_SEC_SHA1MD5_BASE ,
531- .end = OMAP34XX_SEC_SHA1MD5_BASE + 0x64 ,
532- .flags = IORESOURCE_MEM ,
533- },
534- {
535- .start = 49 + OMAP_INTC_START ,
536- .flags = IORESOURCE_IRQ ,
537- },
538- {
539- .start = OMAP34XX_DMA_SHA1MD5_RX ,
540- .flags = IORESOURCE_DMA ,
541- }
542- };
543- static int omap3_sham_resources_sz = ARRAY_SIZE (omap3_sham_resources );
544- #else
545- #define omap3_sham_resources NULL
546- #define omap3_sham_resources_sz 0
547- #endif
548-
549- static struct platform_device sham_device = {
550- .name = "omap-sham" ,
551- .id = -1 ,
552- };
553-
554- static void omap_init_sham (void )
507+ static void __init omap_init_sham (void )
555508{
556- if (cpu_is_omap24xx ()) {
557- sham_device .resource = omap2_sham_resources ;
558- sham_device .num_resources = omap2_sham_resources_sz ;
559- } else if (cpu_is_omap34xx ()) {
560- sham_device .resource = omap3_sham_resources ;
561- sham_device .num_resources = omap3_sham_resources_sz ;
562- } else {
563- pr_err ("%s: platform not supported\n" , __func__ );
564- return ;
565- }
566- platform_device_register (& sham_device );
567- }
568- #else
569- static inline void omap_init_sham (void ) { }
570- #endif
571-
572- #if defined(CONFIG_CRYPTO_DEV_OMAP_AES ) || defined(CONFIG_CRYPTO_DEV_OMAP_AES_MODULE )
573-
574- #ifdef CONFIG_ARCH_OMAP2
575- static struct resource omap2_aes_resources [] = {
576- {
577- .start = OMAP24XX_SEC_AES_BASE ,
578- .end = OMAP24XX_SEC_AES_BASE + 0x4C ,
579- .flags = IORESOURCE_MEM ,
580- },
581- {
582- .start = OMAP24XX_DMA_AES_TX ,
583- .flags = IORESOURCE_DMA ,
584- },
585- {
586- .start = OMAP24XX_DMA_AES_RX ,
587- .flags = IORESOURCE_DMA ,
588- }
589- };
590- static int omap2_aes_resources_sz = ARRAY_SIZE (omap2_aes_resources );
591- #else
592- #define omap2_aes_resources NULL
593- #define omap2_aes_resources_sz 0
594- #endif
509+ struct omap_hwmod * oh ;
510+ struct platform_device * pdev ;
595511
596- #ifdef CONFIG_ARCH_OMAP3
597- static struct resource omap3_aes_resources [] = {
598- {
599- .start = OMAP34XX_SEC_AES_BASE ,
600- .end = OMAP34XX_SEC_AES_BASE + 0x4C ,
601- .flags = IORESOURCE_MEM ,
602- },
603- {
604- .start = OMAP34XX_DMA_AES2_TX ,
605- .flags = IORESOURCE_DMA ,
606- },
607- {
608- .start = OMAP34XX_DMA_AES2_RX ,
609- .flags = IORESOURCE_DMA ,
610- }
611- };
612- static int omap3_aes_resources_sz = ARRAY_SIZE (omap3_aes_resources );
613- #else
614- #define omap3_aes_resources NULL
615- #define omap3_aes_resources_sz 0
616- #endif
512+ oh = omap_hwmod_lookup ("sham" );
513+ if (!oh )
514+ return ;
617515
618- static struct platform_device aes_device = {
619- .name = "omap-aes" ,
620- .id = -1 ,
621- };
516+ pdev = omap_device_build ("omap-sham" , -1 , oh , NULL , 0 );
517+ WARN (IS_ERR (pdev ), "Can't build omap_device for omap-sham\n" );
518+ }
622519
623- static void omap_init_aes (void )
520+ static void __init omap_init_aes (void )
624521{
625- if (cpu_is_omap24xx ()) {
626- aes_device .resource = omap2_aes_resources ;
627- aes_device .num_resources = omap2_aes_resources_sz ;
628- } else if (cpu_is_omap34xx ()) {
629- aes_device .resource = omap3_aes_resources ;
630- aes_device .num_resources = omap3_aes_resources_sz ;
631- } else {
632- pr_err ("%s: platform not supported\n" , __func__ );
522+ struct omap_hwmod * oh ;
523+ struct platform_device * pdev ;
524+
525+ oh = omap_hwmod_lookup ("aes" );
526+ if (!oh )
633527return ;
634- }
635- platform_device_register (& aes_device );
636- }
637528
638- #else
639- static inline void omap_init_aes ( void ) { }
640- #endif
529+ pdev = omap_device_build ( "omap-aes" , -1 , oh , NULL , 0 );
530+ WARN ( IS_ERR ( pdev ), "Can't build omap_device for omap-aes\n" );
531+ }
641532
642533/*-------------------------------------------------------------------------*/
643534
@@ -764,11 +655,11 @@ static int __init omap2_init_devices(void)
764655omap_init_dmic ();
765656omap_init_mcpdm ();
766657omap_init_mcspi ();
658+ omap_init_sham ();
659+ omap_init_aes ();
767660}
768661omap_init_sti ();
769662omap_init_rng ();
770- omap_init_sham ();
771- omap_init_aes ();
772663omap_init_vout ();
773664omap_init_ocp2scp ();
774665
0 commit comments